@budibase/server 2.5.6-alpha.38 → 2.5.6-alpha.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/db/utils.js
CHANGED
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.getMultiIDParams = exports.generatePluginID = void 0;
|
|
6
|
+
exports.generateMemoryViewID = exports.getMetadataParams = exports.generateMetadataID = exports.generateUserFlagID = exports.getQueryParams = exports.getAutomationMetadataParams = exports.generateAutomationMetadataID = exports.generateQueryID = exports.getDatasourceParams = exports.generateDatasourceID = exports.getWebhookParams = exports.generateWebhookID = exports.getScreenParams = exports.generateScreenID = exports.getLayoutParams = exports.generateLayoutID = exports.getLinkParams = exports.generateLinkID = exports.generateAutomationID = exports.getAutomationParams = exports.getTableIDFromRowID = exports.generateTableID = exports.getTableParams = exports.getGlobalIDFromUserMetadataID = exports.generateUserMetadataID = exports.getUserMetadataParams = exports.generateRowID = exports.getRowParams = exports.getDocParams = exports.getQueryIndex = exports.getRoleParams = exports.generateRoleID = exports.generateDevAppID = exports.generateAppID = exports.UNICODE_MAX = exports.InternalTables = exports.ViewName = exports.AUTOMATION_LOG_PREFIX = exports.TABLE_ROW_PREFIX = exports.LINK_USER_METADATA_PREFIX = exports.USER_METDATA_PREFIX = exports.isProdAppID = exports.isDevAppID = exports.APP_DEV_PREFIX = exports.APP_PREFIX = exports.DocumentType = exports.StaticDatabases = exports.SEPARATOR = exports.BudibaseInternalDB = exports.AppStatus = void 0;
|
|
7
|
+
exports.getMultiIDParams = exports.generatePluginID = exports.getMemoryViewParams = void 0;
|
|
8
8
|
const newid_1 = __importDefault(require("./newid"));
|
|
9
9
|
const backend_core_1 = require("@budibase/backend-core");
|
|
10
10
|
exports.AppStatus = {
|
|
@@ -29,6 +29,7 @@ exports.isProdAppID = backend_core_1.db.isProdAppID;
|
|
|
29
29
|
exports.USER_METDATA_PREFIX = `${exports.DocumentType.ROW}${exports.SEPARATOR}${backend_core_1.db.InternalTable.USER_METADATA}${exports.SEPARATOR}`;
|
|
30
30
|
exports.LINK_USER_METADATA_PREFIX = `${exports.DocumentType.LINK}${exports.SEPARATOR}${backend_core_1.db.InternalTable.USER_METADATA}${exports.SEPARATOR}`;
|
|
31
31
|
exports.TABLE_ROW_PREFIX = `${exports.DocumentType.ROW}${exports.SEPARATOR}${exports.DocumentType.TABLE}`;
|
|
32
|
+
exports.AUTOMATION_LOG_PREFIX = `${exports.DocumentType.AUTOMATION_LOG}${exports.SEPARATOR}`;
|
|
32
33
|
exports.ViewName = backend_core_1.db.ViewName;
|
|
33
34
|
exports.InternalTables = backend_core_1.db.InternalTable;
|
|
34
35
|
exports.UNICODE_MAX = backend_core_1.db.UNICODE_MAX;
|
|
@@ -73,11 +73,14 @@ function exportDB(dbName, opts = {}) {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
exports.exportDB = exportDB;
|
|
76
|
-
function defineFilter(excludeRows) {
|
|
76
|
+
function defineFilter(excludeRows, excludeLogs) {
|
|
77
77
|
const ids = [utils_1.USER_METDATA_PREFIX, utils_1.LINK_USER_METADATA_PREFIX];
|
|
78
78
|
if (excludeRows) {
|
|
79
79
|
ids.push(utils_1.TABLE_ROW_PREFIX);
|
|
80
80
|
}
|
|
81
|
+
if (excludeLogs) {
|
|
82
|
+
ids.push(utils_1.AUTOMATION_LOG_PREFIX);
|
|
83
|
+
}
|
|
81
84
|
return (doc) => !ids.map(key => doc._id.includes(key)).reduce((prev, curr) => prev || curr);
|
|
82
85
|
}
|
|
83
86
|
/**
|
|
@@ -119,7 +122,10 @@ function exportApp(appId, config) {
|
|
|
119
122
|
}
|
|
120
123
|
// enforce an export of app DB to the tmp path
|
|
121
124
|
const dbPath = (0, path_1.join)(tmpPath, constants_2.DB_EXPORT_FILE);
|
|
122
|
-
yield exportDB(appId,
|
|
125
|
+
yield exportDB(appId, {
|
|
126
|
+
filter: defineFilter(config === null || config === void 0 ? void 0 : config.excludeRows, config === null || config === void 0 ? void 0 : config.excludeLogs),
|
|
127
|
+
exportPath: dbPath,
|
|
128
|
+
});
|
|
123
129
|
// if tar requested, return where the tarball is
|
|
124
130
|
if (config === null || config === void 0 ? void 0 : config.tar) {
|
|
125
131
|
// now the tmpPath contains both the DB export and attachments, tar this
|
|
@@ -143,7 +149,11 @@ exports.exportApp = exportApp;
|
|
|
143
149
|
*/
|
|
144
150
|
function streamExportApp(appId, excludeRows) {
|
|
145
151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
const tmpPath = yield exportApp(appId, {
|
|
152
|
+
const tmpPath = yield exportApp(appId, {
|
|
153
|
+
excludeRows,
|
|
154
|
+
excludeLogs: true,
|
|
155
|
+
tar: true,
|
|
156
|
+
});
|
|
147
157
|
return (0, fileSystem_1.streamFile)(tmpPath);
|
|
148
158
|
});
|
|
149
159
|
}
|