Removing duplicate filtering of automation logs.
This commit is contained in:
parent
2b96de3c30
commit
15b1f3efe6
|
@ -26,7 +26,6 @@ export interface DBDumpOpts {
|
||||||
export interface ExportOpts extends DBDumpOpts {
|
export interface ExportOpts extends DBDumpOpts {
|
||||||
tar?: boolean
|
tar?: boolean
|
||||||
excludeRows?: boolean
|
excludeRows?: boolean
|
||||||
excludeLogs?: boolean
|
|
||||||
encryptPassword?: string
|
encryptPassword?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +82,7 @@ export async function exportDB(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function defineFilter(excludeRows?: boolean, excludeLogs?: boolean) {
|
function defineFilter(excludeRows?: boolean) {
|
||||||
const ids = [
|
const ids = [
|
||||||
USER_METDATA_PREFIX,
|
USER_METDATA_PREFIX,
|
||||||
LINK_USER_METADATA_PREFIX,
|
LINK_USER_METADATA_PREFIX,
|
||||||
|
@ -92,9 +91,6 @@ function defineFilter(excludeRows?: boolean, excludeLogs?: boolean) {
|
||||||
if (excludeRows) {
|
if (excludeRows) {
|
||||||
ids.push(TABLE_ROW_PREFIX)
|
ids.push(TABLE_ROW_PREFIX)
|
||||||
}
|
}
|
||||||
if (excludeLogs) {
|
|
||||||
ids.push(AUTOMATION_LOG_PREFIX)
|
|
||||||
}
|
|
||||||
return (doc: any) =>
|
return (doc: any) =>
|
||||||
!ids.map(key => doc._id.includes(key)).reduce((prev, curr) => prev || curr)
|
!ids.map(key => doc._id.includes(key)).reduce((prev, curr) => prev || curr)
|
||||||
}
|
}
|
||||||
|
@ -122,7 +118,7 @@ export async function exportApp(appId: string, config?: ExportOpts) {
|
||||||
fs.writeFileSync(join(tmpPath, path), contents)
|
fs.writeFileSync(join(tmpPath, path), contents)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// get all of the files
|
// get all the files
|
||||||
else {
|
else {
|
||||||
tmpPath = await objectStore.retrieveDirectory(
|
tmpPath = await objectStore.retrieveDirectory(
|
||||||
ObjectStoreBuckets.APPS,
|
ObjectStoreBuckets.APPS,
|
||||||
|
@ -145,7 +141,7 @@ export async function exportApp(appId: string, config?: ExportOpts) {
|
||||||
// enforce an export of app DB to the tmp path
|
// enforce an export of app DB to the tmp path
|
||||||
const dbPath = join(tmpPath, DB_EXPORT_FILE)
|
const dbPath = join(tmpPath, DB_EXPORT_FILE)
|
||||||
await exportDB(appId, {
|
await exportDB(appId, {
|
||||||
filter: defineFilter(config?.excludeRows, config?.excludeLogs),
|
filter: defineFilter(config?.excludeRows),
|
||||||
exportPath: dbPath,
|
exportPath: dbPath,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -195,7 +191,6 @@ export async function streamExportApp({
|
||||||
}) {
|
}) {
|
||||||
const tmpPath = await exportApp(appId, {
|
const tmpPath = await exportApp(appId, {
|
||||||
excludeRows,
|
excludeRows,
|
||||||
excludeLogs: true,
|
|
||||||
tar: true,
|
tar: true,
|
||||||
encryptPassword,
|
encryptPassword,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue