@budibase/server 2.7.7-alpha.6 → 2.7.7-alpha.8
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/builder/assets/{index.003ebb4a.js → index.494fe793.js} +111 -111
- package/builder/index.html +1 -1
- package/dist/automation.js +245 -124
- package/dist/automation.js.map +3 -3
- package/dist/index.js +324 -205
- package/dist/index.js.map +3 -3
- package/dist/query.js +229 -108
- package/dist/query.js.map +3 -3
- package/package.json +10 -10
- package/src/api/controllers/backup.ts +22 -8
- package/src/api/routes/backup.ts +1 -1
- package/src/api/routes/tests/backup.spec.ts +18 -2
- package/src/sdk/app/backups/exports.ts +33 -5
- package/src/sdk/app/backups/imports.ts +21 -1
package/dist/index.js
CHANGED
|
@@ -10158,7 +10158,9 @@ var encryption_exports = {};
|
|
|
10158
10158
|
__export(encryption_exports, {
|
|
10159
10159
|
SecretOption: () => SecretOption,
|
|
10160
10160
|
decrypt: () => decrypt,
|
|
10161
|
+
decryptFile: () => decryptFile,
|
|
10161
10162
|
encrypt: () => encrypt,
|
|
10163
|
+
encryptFile: () => encryptFile,
|
|
10162
10164
|
getSecret: () => getSecret
|
|
10163
10165
|
});
|
|
10164
10166
|
function getSecret(secretOption) {
|
|
@@ -10179,11 +10181,11 @@ function getSecret(secretOption) {
|
|
|
10179
10181
|
}
|
|
10180
10182
|
return secret;
|
|
10181
10183
|
}
|
|
10182
|
-
function stretchString(
|
|
10183
|
-
return import_crypto.default.pbkdf2Sync(
|
|
10184
|
+
function stretchString(secret, salt) {
|
|
10185
|
+
return import_crypto.default.pbkdf2Sync(secret, salt, ITERATIONS, STRETCH_LENGTH, "sha512");
|
|
10184
10186
|
}
|
|
10185
10187
|
function encrypt(input, secretOption = "api" /* API */) {
|
|
10186
|
-
const salt = import_crypto.default.randomBytes(
|
|
10188
|
+
const salt = import_crypto.default.randomBytes(SALT_LENGTH);
|
|
10187
10189
|
const stretched = stretchString(getSecret(secretOption), salt);
|
|
10188
10190
|
const cipher = import_crypto.default.createCipheriv(ALGO, stretched, salt);
|
|
10189
10191
|
const base = cipher.update(input);
|
|
@@ -10200,16 +10202,101 @@ function decrypt(input, secretOption = "api" /* API */) {
|
|
|
10200
10202
|
const final = decipher.final();
|
|
10201
10203
|
return Buffer.concat([base, final]).toString();
|
|
10202
10204
|
}
|
|
10203
|
-
|
|
10205
|
+
async function encryptFile({ dir, filename }, secret) {
|
|
10206
|
+
const outputFileName = `${filename}.enc`;
|
|
10207
|
+
const filePath = (0, import_path.join)(dir, filename);
|
|
10208
|
+
const inputFile = import_fs2.default.createReadStream(filePath);
|
|
10209
|
+
const outputFile = import_fs2.default.createWriteStream((0, import_path.join)(dir, outputFileName));
|
|
10210
|
+
const salt = import_crypto.default.randomBytes(SALT_LENGTH);
|
|
10211
|
+
const iv = import_crypto.default.randomBytes(IV_LENGTH);
|
|
10212
|
+
const stretched = stretchString(secret, salt);
|
|
10213
|
+
const cipher = import_crypto.default.createCipheriv(ALGO, stretched, iv);
|
|
10214
|
+
outputFile.write(salt);
|
|
10215
|
+
outputFile.write(iv);
|
|
10216
|
+
inputFile.pipe(import_zlib.default.createGzip()).pipe(cipher).pipe(outputFile);
|
|
10217
|
+
return new Promise((r) => {
|
|
10218
|
+
outputFile.on("finish", () => {
|
|
10219
|
+
r({
|
|
10220
|
+
filename: outputFileName,
|
|
10221
|
+
dir
|
|
10222
|
+
});
|
|
10223
|
+
});
|
|
10224
|
+
});
|
|
10225
|
+
}
|
|
10226
|
+
async function getSaltAndIV(path5) {
|
|
10227
|
+
const fileStream = import_fs2.default.createReadStream(path5);
|
|
10228
|
+
const salt = await readBytes(fileStream, SALT_LENGTH);
|
|
10229
|
+
const iv = await readBytes(fileStream, IV_LENGTH);
|
|
10230
|
+
fileStream.close();
|
|
10231
|
+
return { salt, iv };
|
|
10232
|
+
}
|
|
10233
|
+
async function decryptFile(inputPath, outputPath, secret) {
|
|
10234
|
+
const { salt, iv } = await getSaltAndIV(inputPath);
|
|
10235
|
+
const inputFile = import_fs2.default.createReadStream(inputPath, {
|
|
10236
|
+
start: SALT_LENGTH + IV_LENGTH
|
|
10237
|
+
});
|
|
10238
|
+
const outputFile = import_fs2.default.createWriteStream(outputPath);
|
|
10239
|
+
const stretched = stretchString(secret, salt);
|
|
10240
|
+
const decipher = import_crypto.default.createDecipheriv(ALGO, stretched, iv);
|
|
10241
|
+
const unzip = import_zlib.default.createGunzip();
|
|
10242
|
+
inputFile.pipe(decipher).pipe(unzip).pipe(outputFile);
|
|
10243
|
+
return new Promise((res, rej) => {
|
|
10244
|
+
outputFile.on("finish", () => {
|
|
10245
|
+
outputFile.close();
|
|
10246
|
+
res();
|
|
10247
|
+
});
|
|
10248
|
+
inputFile.on("error", (e) => {
|
|
10249
|
+
outputFile.close();
|
|
10250
|
+
rej(e);
|
|
10251
|
+
});
|
|
10252
|
+
decipher.on("error", (e) => {
|
|
10253
|
+
outputFile.close();
|
|
10254
|
+
rej(e);
|
|
10255
|
+
});
|
|
10256
|
+
unzip.on("error", (e) => {
|
|
10257
|
+
outputFile.close();
|
|
10258
|
+
rej(e);
|
|
10259
|
+
});
|
|
10260
|
+
outputFile.on("error", (e) => {
|
|
10261
|
+
outputFile.close();
|
|
10262
|
+
rej(e);
|
|
10263
|
+
});
|
|
10264
|
+
});
|
|
10265
|
+
}
|
|
10266
|
+
function readBytes(stream3, length) {
|
|
10267
|
+
return new Promise((resolve3, reject) => {
|
|
10268
|
+
let bytesRead = 0;
|
|
10269
|
+
const data2 = [];
|
|
10270
|
+
stream3.on("readable", () => {
|
|
10271
|
+
let chunk;
|
|
10272
|
+
while ((chunk = stream3.read(length - bytesRead)) !== null) {
|
|
10273
|
+
data2.push(chunk);
|
|
10274
|
+
bytesRead += chunk.length;
|
|
10275
|
+
}
|
|
10276
|
+
resolve3(Buffer.concat(data2));
|
|
10277
|
+
});
|
|
10278
|
+
stream3.on("end", () => {
|
|
10279
|
+
reject(new Error("Insufficient data in the stream."));
|
|
10280
|
+
});
|
|
10281
|
+
stream3.on("error", (error2) => {
|
|
10282
|
+
reject(error2);
|
|
10283
|
+
});
|
|
10284
|
+
});
|
|
10285
|
+
}
|
|
10286
|
+
var import_crypto, import_fs2, import_zlib, import_path, ALGO, SEPARATOR3, ITERATIONS, STRETCH_LENGTH, SALT_LENGTH, IV_LENGTH, SecretOption;
|
|
10204
10287
|
var init_encryption = __esm({
|
|
10205
10288
|
"../backend-core/src/security/encryption.ts"() {
|
|
10206
10289
|
import_crypto = __toESM(require("crypto"));
|
|
10290
|
+
import_fs2 = __toESM(require("fs"));
|
|
10291
|
+
import_zlib = __toESM(require("zlib"));
|
|
10207
10292
|
init_environment2();
|
|
10293
|
+
import_path = require("path");
|
|
10208
10294
|
ALGO = "aes-256-ctr";
|
|
10209
10295
|
SEPARATOR3 = "-";
|
|
10210
10296
|
ITERATIONS = 1e4;
|
|
10211
|
-
RANDOM_BYTES = 16;
|
|
10212
10297
|
STRETCH_LENGTH = 32;
|
|
10298
|
+
SALT_LENGTH = 16;
|
|
10299
|
+
IV_LENGTH = 16;
|
|
10213
10300
|
SecretOption = /* @__PURE__ */ ((SecretOption2) => {
|
|
10214
10301
|
SecretOption2["API"] = "api";
|
|
10215
10302
|
SecretOption2["ENCRYPTION"] = "encryption";
|
|
@@ -11120,12 +11207,12 @@ var init_plugin4 = __esm({
|
|
|
11120
11207
|
function budibaseTempDir() {
|
|
11121
11208
|
return bbTmp;
|
|
11122
11209
|
}
|
|
11123
|
-
var
|
|
11210
|
+
var import_path2, import_os, import_fs3, ObjectStoreBuckets, bbTmp;
|
|
11124
11211
|
var init_utils8 = __esm({
|
|
11125
11212
|
"../backend-core/src/objectStore/utils.ts"() {
|
|
11126
|
-
|
|
11213
|
+
import_path2 = require("path");
|
|
11127
11214
|
import_os = require("os");
|
|
11128
|
-
|
|
11215
|
+
import_fs3 = __toESM(require("fs"));
|
|
11129
11216
|
init_environment2();
|
|
11130
11217
|
ObjectStoreBuckets = {
|
|
11131
11218
|
BACKUPS: environment_default.BACKUPS_BUCKET_NAME,
|
|
@@ -11134,9 +11221,9 @@ var init_utils8 = __esm({
|
|
|
11134
11221
|
GLOBAL: environment_default.GLOBAL_BUCKET_NAME,
|
|
11135
11222
|
PLUGINS: environment_default.PLUGIN_BUCKET_NAME
|
|
11136
11223
|
};
|
|
11137
|
-
bbTmp = (0,
|
|
11138
|
-
if (!
|
|
11139
|
-
|
|
11224
|
+
bbTmp = (0, import_path2.join)((0, import_os.tmpdir)(), ".budibase");
|
|
11225
|
+
if (!import_fs3.default.existsSync(bbTmp)) {
|
|
11226
|
+
import_fs3.default.mkdirSync(bbTmp);
|
|
11140
11227
|
}
|
|
11141
11228
|
}
|
|
11142
11229
|
});
|
|
@@ -11148,17 +11235,17 @@ function sanitizeKey(input) {
|
|
|
11148
11235
|
function sanitizeBucket(input) {
|
|
11149
11236
|
return input.replace(new RegExp(APP_DEV_PREFIX, "g"), APP_PREFIX);
|
|
11150
11237
|
}
|
|
11151
|
-
var import_aws_sdk, import_stream, import_node_fetch6, import_tar_fs,
|
|
11238
|
+
var import_aws_sdk, import_stream, import_node_fetch6, import_tar_fs, import_zlib2, import_util, import_path3, import_fs4, import_uuid3, sanitize, streamPipeline, STATE, CONTENT_TYPE_MAP, STRING_CONTENT_TYPES, ObjectStore, makeSureBucketExists, upload, streamUpload, retrieve, listAllObjects, getPresignedUrl, retrieveToTmp, retrieveDirectory, deleteFile, deleteFiles, deleteFolder, uploadDirectory, downloadTarballDirect, downloadTarball;
|
|
11152
11239
|
var init_objectStore = __esm({
|
|
11153
11240
|
"../backend-core/src/objectStore/objectStore.ts"() {
|
|
11154
11241
|
import_aws_sdk = __toESM(require("aws-sdk"));
|
|
11155
11242
|
import_stream = __toESM(require("stream"));
|
|
11156
11243
|
import_node_fetch6 = __toESM(require("node-fetch"));
|
|
11157
11244
|
import_tar_fs = __toESM(require("tar-fs"));
|
|
11158
|
-
|
|
11245
|
+
import_zlib2 = __toESM(require("zlib"));
|
|
11159
11246
|
import_util = require("util");
|
|
11160
|
-
|
|
11161
|
-
|
|
11247
|
+
import_path3 = require("path");
|
|
11248
|
+
import_fs4 = __toESM(require("fs"));
|
|
11162
11249
|
init_environment2();
|
|
11163
11250
|
init_utils8();
|
|
11164
11251
|
import_uuid3 = require("uuid");
|
|
@@ -11237,7 +11324,7 @@ var init_objectStore = __esm({
|
|
|
11237
11324
|
metadata
|
|
11238
11325
|
}) => {
|
|
11239
11326
|
const extension = filename.split(".").pop();
|
|
11240
|
-
const fileBytes =
|
|
11327
|
+
const fileBytes = import_fs4.default.readFileSync(path5);
|
|
11241
11328
|
const objectStore = ObjectStore(bucketName);
|
|
11242
11329
|
await makeSureBucketExists(objectStore, bucketName);
|
|
11243
11330
|
let contentType = type;
|
|
@@ -11339,13 +11426,13 @@ var init_objectStore = __esm({
|
|
|
11339
11426
|
bucketName = sanitizeBucket(bucketName);
|
|
11340
11427
|
filepath = sanitizeKey(filepath);
|
|
11341
11428
|
const data2 = await retrieve(bucketName, filepath);
|
|
11342
|
-
const outputPath = (0,
|
|
11343
|
-
|
|
11429
|
+
const outputPath = (0, import_path3.join)(budibaseTempDir(), (0, import_uuid3.v4)());
|
|
11430
|
+
import_fs4.default.writeFileSync(outputPath, data2);
|
|
11344
11431
|
return outputPath;
|
|
11345
11432
|
};
|
|
11346
11433
|
retrieveDirectory = async (bucketName, path5) => {
|
|
11347
|
-
let writePath = (0,
|
|
11348
|
-
|
|
11434
|
+
let writePath = (0, import_path3.join)(budibaseTempDir(), (0, import_uuid3.v4)());
|
|
11435
|
+
import_fs4.default.mkdirSync(writePath);
|
|
11349
11436
|
const objects = await listAllObjects(bucketName, path5);
|
|
11350
11437
|
let fullObjects = await Promise.all(
|
|
11351
11438
|
objects.map((obj) => retrieve(bucketName, obj.Key))
|
|
@@ -11357,9 +11444,9 @@ var init_objectStore = __esm({
|
|
|
11357
11444
|
const possiblePath = filename.split("/");
|
|
11358
11445
|
if (possiblePath.length > 1) {
|
|
11359
11446
|
const dirs = possiblePath.slice(0, possiblePath.length - 1);
|
|
11360
|
-
|
|
11447
|
+
import_fs4.default.mkdirSync((0, import_path3.join)(writePath, ...dirs), { recursive: true });
|
|
11361
11448
|
}
|
|
11362
|
-
|
|
11449
|
+
import_fs4.default.writeFileSync((0, import_path3.join)(writePath, ...possiblePath), data2);
|
|
11363
11450
|
}
|
|
11364
11451
|
return writePath;
|
|
11365
11452
|
};
|
|
@@ -11413,14 +11500,14 @@ var init_objectStore = __esm({
|
|
|
11413
11500
|
uploadDirectory = async (bucketName, localPath, bucketPath) => {
|
|
11414
11501
|
bucketName = sanitizeBucket(bucketName);
|
|
11415
11502
|
let uploads = [];
|
|
11416
|
-
const files =
|
|
11503
|
+
const files = import_fs4.default.readdirSync(localPath, { withFileTypes: true });
|
|
11417
11504
|
for (let file of files) {
|
|
11418
|
-
const path5 = sanitizeKey((0,
|
|
11419
|
-
const local = (0,
|
|
11505
|
+
const path5 = sanitizeKey((0, import_path3.join)(bucketPath, file.name));
|
|
11506
|
+
const local = (0, import_path3.join)(localPath, file.name);
|
|
11420
11507
|
if (file.isDirectory()) {
|
|
11421
11508
|
uploads.push(uploadDirectory(bucketName, local, path5));
|
|
11422
11509
|
} else {
|
|
11423
|
-
uploads.push(streamUpload(bucketName, path5,
|
|
11510
|
+
uploads.push(streamUpload(bucketName, path5, import_fs4.default.createReadStream(local)));
|
|
11424
11511
|
}
|
|
11425
11512
|
}
|
|
11426
11513
|
await Promise.all(uploads);
|
|
@@ -11432,7 +11519,7 @@ var init_objectStore = __esm({
|
|
|
11432
11519
|
if (!response2.ok) {
|
|
11433
11520
|
throw new Error(`unexpected response ${response2.statusText}`);
|
|
11434
11521
|
}
|
|
11435
|
-
await streamPipeline(response2.body,
|
|
11522
|
+
await streamPipeline(response2.body, import_zlib2.default.createUnzip(), import_tar_fs.default.extract(path5));
|
|
11436
11523
|
};
|
|
11437
11524
|
downloadTarball = async (url, bucketName, path5) => {
|
|
11438
11525
|
bucketName = sanitizeBucket(bucketName);
|
|
@@ -11441,8 +11528,8 @@ var init_objectStore = __esm({
|
|
|
11441
11528
|
if (!response2.ok) {
|
|
11442
11529
|
throw new Error(`unexpected response ${response2.statusText}`);
|
|
11443
11530
|
}
|
|
11444
|
-
const tmpPath = (0,
|
|
11445
|
-
await streamPipeline(response2.body,
|
|
11531
|
+
const tmpPath = (0, import_path3.join)(budibaseTempDir(), path5);
|
|
11532
|
+
await streamPipeline(response2.body, import_zlib2.default.createUnzip(), import_tar_fs.default.extract(tmpPath));
|
|
11446
11533
|
if (!environment_default.isTest() && environment_default.SELF_HOSTED) {
|
|
11447
11534
|
await uploadDirectory(bucketName, tmpPath, path5);
|
|
11448
11535
|
}
|
|
@@ -12024,16 +12111,16 @@ var init_constants4 = __esm({
|
|
|
12024
12111
|
});
|
|
12025
12112
|
|
|
12026
12113
|
// src/utilities/centralPath.ts
|
|
12027
|
-
function
|
|
12028
|
-
return
|
|
12114
|
+
function join4(...args) {
|
|
12115
|
+
return import_path4.default.join(...args);
|
|
12029
12116
|
}
|
|
12030
12117
|
function resolve(...args) {
|
|
12031
|
-
return
|
|
12118
|
+
return import_path4.default.resolve(...args);
|
|
12032
12119
|
}
|
|
12033
|
-
var
|
|
12120
|
+
var import_path4;
|
|
12034
12121
|
var init_centralPath = __esm({
|
|
12035
12122
|
"src/utilities/centralPath.ts"() {
|
|
12036
|
-
|
|
12123
|
+
import_path4 = __toESM(require("path"));
|
|
12037
12124
|
}
|
|
12038
12125
|
});
|
|
12039
12126
|
|
|
@@ -12055,14 +12142,14 @@ function parseIntSafe(number) {
|
|
|
12055
12142
|
return parseInt(number);
|
|
12056
12143
|
}
|
|
12057
12144
|
}
|
|
12058
|
-
var
|
|
12145
|
+
var import_path5, LOADED2, environment2, environment_default2;
|
|
12059
12146
|
var init_environment3 = __esm({
|
|
12060
12147
|
"src/environment.ts"() {
|
|
12061
|
-
|
|
12148
|
+
import_path5 = require("path");
|
|
12062
12149
|
LOADED2 = false;
|
|
12063
12150
|
if (!LOADED2 && isDev2() && !isTest2()) {
|
|
12064
12151
|
require("dotenv").config({
|
|
12065
|
-
path: (0,
|
|
12152
|
+
path: (0, import_path5.join)(__dirname, "..", ".env")
|
|
12066
12153
|
});
|
|
12067
12154
|
LOADED2 = true;
|
|
12068
12155
|
}
|
|
@@ -12146,22 +12233,22 @@ var init_environment3 = __esm({
|
|
|
12146
12233
|
});
|
|
12147
12234
|
|
|
12148
12235
|
// src/utilities/fileSystem/filesystem.ts
|
|
12149
|
-
var
|
|
12236
|
+
var import_fs5, import_path6, import_tar, uuid2, TOP_LEVEL_PATH, init9, checkDevelopmentEnvironment, loadHandlebarsFile, apiFileReturn, streamFile, createTempFolder, extractTarball, findFileRec, deleteFolderFileSystem;
|
|
12150
12237
|
var init_filesystem = __esm({
|
|
12151
12238
|
"src/utilities/fileSystem/filesystem.ts"() {
|
|
12152
|
-
|
|
12239
|
+
import_fs5 = __toESM(require("fs"));
|
|
12153
12240
|
init_budibaseDir();
|
|
12154
|
-
|
|
12241
|
+
import_path6 = require("path");
|
|
12155
12242
|
init_environment3();
|
|
12156
12243
|
import_tar = __toESM(require("tar"));
|
|
12157
12244
|
init_environment3();
|
|
12158
12245
|
uuid2 = require("uuid/v4");
|
|
12159
|
-
TOP_LEVEL_PATH = environment_default2.TOP_LEVEL_PATH || (0,
|
|
12246
|
+
TOP_LEVEL_PATH = environment_default2.TOP_LEVEL_PATH || (0, import_path6.resolve)((0, import_path6.join)(__dirname, "..", "..", ".."));
|
|
12160
12247
|
init9 = () => {
|
|
12161
12248
|
const tempDir = budibaseTempDir2();
|
|
12162
|
-
if (!
|
|
12249
|
+
if (!import_fs5.default.existsSync(tempDir)) {
|
|
12163
12250
|
try {
|
|
12164
|
-
|
|
12251
|
+
import_fs5.default.mkdirSync(tempDir);
|
|
12165
12252
|
} catch (err) {
|
|
12166
12253
|
if (!err || err.code !== "EEXIST") {
|
|
12167
12254
|
throw err;
|
|
@@ -12173,11 +12260,11 @@ var init_filesystem = __esm({
|
|
|
12173
12260
|
if (!environment_default2.isDev() || environment_default2.isTest()) {
|
|
12174
12261
|
return;
|
|
12175
12262
|
}
|
|
12176
|
-
if (!
|
|
12177
|
-
|
|
12263
|
+
if (!import_fs5.default.existsSync(budibaseTempDir2())) {
|
|
12264
|
+
import_fs5.default.mkdirSync(budibaseTempDir2());
|
|
12178
12265
|
}
|
|
12179
12266
|
let error2;
|
|
12180
|
-
if (!
|
|
12267
|
+
if (!import_fs5.default.existsSync((0, import_path6.join)(process.cwd(), ".env"))) {
|
|
12181
12268
|
error2 = "Must run via yarn once to generate environment.";
|
|
12182
12269
|
}
|
|
12183
12270
|
if (error2) {
|
|
@@ -12186,23 +12273,23 @@ var init_filesystem = __esm({
|
|
|
12186
12273
|
}
|
|
12187
12274
|
};
|
|
12188
12275
|
loadHandlebarsFile = (path5) => {
|
|
12189
|
-
return
|
|
12276
|
+
return import_fs5.default.readFileSync(path5, "utf8");
|
|
12190
12277
|
};
|
|
12191
12278
|
apiFileReturn = (contents) => {
|
|
12192
|
-
const path5 = (0,
|
|
12193
|
-
|
|
12194
|
-
return
|
|
12279
|
+
const path5 = (0, import_path6.join)(budibaseTempDir2(), uuid2());
|
|
12280
|
+
import_fs5.default.writeFileSync(path5, contents);
|
|
12281
|
+
return import_fs5.default.createReadStream(path5);
|
|
12195
12282
|
};
|
|
12196
12283
|
streamFile = (path5) => {
|
|
12197
|
-
return
|
|
12284
|
+
return import_fs5.default.createReadStream(path5);
|
|
12198
12285
|
};
|
|
12199
12286
|
createTempFolder = (item) => {
|
|
12200
|
-
const path5 = (0,
|
|
12287
|
+
const path5 = (0, import_path6.join)(budibaseTempDir2(), item);
|
|
12201
12288
|
try {
|
|
12202
|
-
if (
|
|
12203
|
-
|
|
12289
|
+
if (import_fs5.default.existsSync(path5)) {
|
|
12290
|
+
import_fs5.default.rmSync(path5, { recursive: true, force: true });
|
|
12204
12291
|
}
|
|
12205
|
-
|
|
12292
|
+
import_fs5.default.mkdirSync(path5);
|
|
12206
12293
|
} catch (err) {
|
|
12207
12294
|
throw new Error(`Path cannot be created: ${err.message}`);
|
|
12208
12295
|
}
|
|
@@ -12215,13 +12302,13 @@ var init_filesystem = __esm({
|
|
|
12215
12302
|
});
|
|
12216
12303
|
};
|
|
12217
12304
|
findFileRec = (startPath, filter2) => {
|
|
12218
|
-
if (!
|
|
12305
|
+
if (!import_fs5.default.existsSync(startPath)) {
|
|
12219
12306
|
return;
|
|
12220
12307
|
}
|
|
12221
|
-
const files =
|
|
12308
|
+
const files = import_fs5.default.readdirSync(startPath);
|
|
12222
12309
|
for (let i = 0, len = files.length; i < len; i++) {
|
|
12223
|
-
const filename = (0,
|
|
12224
|
-
const stat =
|
|
12310
|
+
const filename = (0, import_path6.join)(startPath, files[i]);
|
|
12311
|
+
const stat = import_fs5.default.lstatSync(filename);
|
|
12225
12312
|
if (stat.isDirectory()) {
|
|
12226
12313
|
return findFileRec(filename, filter2);
|
|
12227
12314
|
} else if (filename.endsWith(filter2)) {
|
|
@@ -12230,10 +12317,10 @@ var init_filesystem = __esm({
|
|
|
12230
12317
|
}
|
|
12231
12318
|
};
|
|
12232
12319
|
deleteFolderFileSystem = (path5) => {
|
|
12233
|
-
if (!
|
|
12320
|
+
if (!import_fs5.default.existsSync(path5)) {
|
|
12234
12321
|
return;
|
|
12235
12322
|
}
|
|
12236
|
-
|
|
12323
|
+
import_fs5.default.rmSync(path5, { recursive: true, force: true });
|
|
12237
12324
|
};
|
|
12238
12325
|
}
|
|
12239
12326
|
});
|
|
@@ -12247,12 +12334,12 @@ async function backupClientLibrary(appId) {
|
|
|
12247
12334
|
try {
|
|
12248
12335
|
tmpManifestPath = await objectStore_exports2.retrieveToTmp(
|
|
12249
12336
|
ObjectStoreBuckets2.APPS,
|
|
12250
|
-
(0,
|
|
12337
|
+
(0, import_path7.join)(appId, "manifest.json")
|
|
12251
12338
|
);
|
|
12252
12339
|
} catch (error2) {
|
|
12253
12340
|
tmpManifestPath = await objectStore_exports2.retrieveToTmp(
|
|
12254
12341
|
ObjectStoreBuckets2.APPS,
|
|
12255
|
-
(0,
|
|
12342
|
+
(0, import_path7.join)(
|
|
12256
12343
|
appId,
|
|
12257
12344
|
"node_modules",
|
|
12258
12345
|
"budibase",
|
|
@@ -12264,17 +12351,17 @@ async function backupClientLibrary(appId) {
|
|
|
12264
12351
|
}
|
|
12265
12352
|
const tmpClientPath = await objectStore_exports2.retrieveToTmp(
|
|
12266
12353
|
ObjectStoreBuckets2.APPS,
|
|
12267
|
-
(0,
|
|
12354
|
+
(0, import_path7.join)(appId, "budibase-client.js")
|
|
12268
12355
|
);
|
|
12269
12356
|
const manifestUpload = objectStore_exports2.upload({
|
|
12270
12357
|
bucket: ObjectStoreBuckets2.APPS,
|
|
12271
|
-
filename: (0,
|
|
12358
|
+
filename: (0, import_path7.join)(appId, "manifest.json.bak"),
|
|
12272
12359
|
path: tmpManifestPath,
|
|
12273
12360
|
type: "application/json"
|
|
12274
12361
|
});
|
|
12275
12362
|
const clientUpload = objectStore_exports2.upload({
|
|
12276
12363
|
bucket: ObjectStoreBuckets2.APPS,
|
|
12277
|
-
filename: (0,
|
|
12364
|
+
filename: (0, import_path7.join)(appId, "budibase-client.js.bak"),
|
|
12278
12365
|
path: tmpClientPath,
|
|
12279
12366
|
type: "application/javascript"
|
|
12280
12367
|
});
|
|
@@ -12284,7 +12371,7 @@ async function updateClientLibrary(appId) {
|
|
|
12284
12371
|
let manifest, client3;
|
|
12285
12372
|
if (environment_default2.isDev()) {
|
|
12286
12373
|
const clientPath = devClientLibPath();
|
|
12287
|
-
manifest = (0,
|
|
12374
|
+
manifest = (0, import_path7.join)(import_path7.default.dirname(import_path7.default.dirname(clientPath)), "manifest.json");
|
|
12288
12375
|
client3 = clientPath;
|
|
12289
12376
|
} else {
|
|
12290
12377
|
manifest = resolve(TOP_LEVEL_PATH, "client", "manifest.json");
|
|
@@ -12292,16 +12379,16 @@ async function updateClientLibrary(appId) {
|
|
|
12292
12379
|
}
|
|
12293
12380
|
const manifestUpload = objectStore_exports2.streamUpload(
|
|
12294
12381
|
ObjectStoreBuckets2.APPS,
|
|
12295
|
-
(0,
|
|
12296
|
-
|
|
12382
|
+
(0, import_path7.join)(appId, "manifest.json"),
|
|
12383
|
+
import_fs6.default.createReadStream(manifest),
|
|
12297
12384
|
{
|
|
12298
12385
|
ContentType: "application/json"
|
|
12299
12386
|
}
|
|
12300
12387
|
);
|
|
12301
12388
|
const clientUpload = objectStore_exports2.streamUpload(
|
|
12302
12389
|
ObjectStoreBuckets2.APPS,
|
|
12303
|
-
(0,
|
|
12304
|
-
|
|
12390
|
+
(0, import_path7.join)(appId, "budibase-client.js"),
|
|
12391
|
+
import_fs6.default.createReadStream(client3),
|
|
12305
12392
|
{
|
|
12306
12393
|
ContentType: "application/javascript"
|
|
12307
12394
|
}
|
|
@@ -12311,32 +12398,32 @@ async function updateClientLibrary(appId) {
|
|
|
12311
12398
|
async function revertClientLibrary(appId) {
|
|
12312
12399
|
const tmpManifestPath = await objectStore_exports2.retrieveToTmp(
|
|
12313
12400
|
ObjectStoreBuckets2.APPS,
|
|
12314
|
-
(0,
|
|
12401
|
+
(0, import_path7.join)(appId, "manifest.json.bak")
|
|
12315
12402
|
);
|
|
12316
12403
|
const tmpClientPath = await objectStore_exports2.retrieveToTmp(
|
|
12317
12404
|
ObjectStoreBuckets2.APPS,
|
|
12318
|
-
(0,
|
|
12405
|
+
(0, import_path7.join)(appId, "budibase-client.js.bak")
|
|
12319
12406
|
);
|
|
12320
12407
|
const manifestUpload = objectStore_exports2.upload({
|
|
12321
12408
|
bucket: ObjectStoreBuckets2.APPS,
|
|
12322
|
-
filename: (0,
|
|
12409
|
+
filename: (0, import_path7.join)(appId, "manifest.json"),
|
|
12323
12410
|
path: tmpManifestPath,
|
|
12324
12411
|
type: "application/json"
|
|
12325
12412
|
});
|
|
12326
12413
|
const clientUpload = objectStore_exports2.upload({
|
|
12327
12414
|
bucket: ObjectStoreBuckets2.APPS,
|
|
12328
|
-
filename: (0,
|
|
12415
|
+
filename: (0, import_path7.join)(appId, "budibase-client.js"),
|
|
12329
12416
|
path: tmpClientPath,
|
|
12330
12417
|
type: "application/javascript"
|
|
12331
12418
|
});
|
|
12332
12419
|
await Promise.all([manifestUpload, clientUpload]);
|
|
12333
12420
|
}
|
|
12334
|
-
var
|
|
12421
|
+
var import_path7, import_fs6;
|
|
12335
12422
|
var init_clientLibrary = __esm({
|
|
12336
12423
|
"src/utilities/fileSystem/clientLibrary.ts"() {
|
|
12337
|
-
|
|
12424
|
+
import_path7 = __toESM(require("path"));
|
|
12338
12425
|
init_constants4();
|
|
12339
|
-
|
|
12426
|
+
import_fs6 = __toESM(require("fs"));
|
|
12340
12427
|
init_src2();
|
|
12341
12428
|
init_centralPath();
|
|
12342
12429
|
init_environment3();
|
|
@@ -12345,18 +12432,18 @@ var init_clientLibrary = __esm({
|
|
|
12345
12432
|
});
|
|
12346
12433
|
|
|
12347
12434
|
// src/utilities/fileSystem/app.ts
|
|
12348
|
-
var
|
|
12435
|
+
var import_fs7, import_path8, NODE_MODULES_PATH, createApp, deleteApp, getComponentLibraryManifest;
|
|
12349
12436
|
var init_app7 = __esm({
|
|
12350
12437
|
"src/utilities/fileSystem/app.ts"() {
|
|
12351
12438
|
init_budibaseDir();
|
|
12352
|
-
|
|
12353
|
-
|
|
12439
|
+
import_fs7 = __toESM(require("fs"));
|
|
12440
|
+
import_path8 = require("path");
|
|
12354
12441
|
init_constants4();
|
|
12355
12442
|
init_clientLibrary();
|
|
12356
12443
|
init_environment3();
|
|
12357
12444
|
init_src2();
|
|
12358
12445
|
init_filesystem();
|
|
12359
|
-
NODE_MODULES_PATH = (0,
|
|
12446
|
+
NODE_MODULES_PATH = (0, import_path8.join)(TOP_LEVEL_PATH, "node_modules");
|
|
12360
12447
|
createApp = async (appId) => {
|
|
12361
12448
|
await updateClientLibrary(appId);
|
|
12362
12449
|
};
|
|
@@ -12368,11 +12455,11 @@ var init_app7 = __esm({
|
|
|
12368
12455
|
const filename = "manifest.json";
|
|
12369
12456
|
if (environment_default2.isDev() || environment_default2.isTest()) {
|
|
12370
12457
|
const paths = [
|
|
12371
|
-
(0,
|
|
12372
|
-
(0,
|
|
12458
|
+
(0, import_path8.join)(TOP_LEVEL_PATH, "packages/client", filename),
|
|
12459
|
+
(0, import_path8.join)(process.cwd(), "client", filename)
|
|
12373
12460
|
];
|
|
12374
12461
|
for (let path6 of paths) {
|
|
12375
|
-
if (
|
|
12462
|
+
if (import_fs7.default.existsSync(path6)) {
|
|
12376
12463
|
delete require.cache[require.resolve(path6)];
|
|
12377
12464
|
return require(path6);
|
|
12378
12465
|
}
|
|
@@ -12387,14 +12474,14 @@ var init_app7 = __esm({
|
|
|
12387
12474
|
let resp;
|
|
12388
12475
|
let path5;
|
|
12389
12476
|
try {
|
|
12390
|
-
path5 = (0,
|
|
12477
|
+
path5 = (0, import_path8.join)(appId, filename);
|
|
12391
12478
|
resp = await objectStore_exports2.retrieve(ObjectStoreBuckets2.APPS, path5);
|
|
12392
12479
|
} catch (error2) {
|
|
12393
12480
|
console.error(
|
|
12394
12481
|
`component-manifest-objectstore=failed appId=${appId} path=${path5}`,
|
|
12395
12482
|
error2
|
|
12396
12483
|
);
|
|
12397
|
-
path5 = (0,
|
|
12484
|
+
path5 = (0, import_path8.join)(appId, "node_modules", library, "package", filename);
|
|
12398
12485
|
resp = await objectStore_exports2.retrieve(ObjectStoreBuckets2.APPS, path5);
|
|
12399
12486
|
}
|
|
12400
12487
|
if (typeof resp !== "string") {
|
|
@@ -12409,19 +12496,19 @@ var init_app7 = __esm({
|
|
|
12409
12496
|
async function getPluginImpl(path5, plugin) {
|
|
12410
12497
|
var _a2;
|
|
12411
12498
|
const hash2 = (_a2 = plugin.schema) == null ? void 0 : _a2.hash;
|
|
12412
|
-
if (!
|
|
12413
|
-
|
|
12499
|
+
if (!import_fs8.default.existsSync(path5)) {
|
|
12500
|
+
import_fs8.default.mkdirSync(path5);
|
|
12414
12501
|
}
|
|
12415
|
-
const filename = (0,
|
|
12502
|
+
const filename = (0, import_path9.join)(path5, plugin.name);
|
|
12416
12503
|
const metadataName = `${filename}.bbmetadata`;
|
|
12417
|
-
if (
|
|
12418
|
-
const currentHash =
|
|
12504
|
+
if (import_fs8.default.existsSync(filename)) {
|
|
12505
|
+
const currentHash = import_fs8.default.readFileSync(metadataName, "utf8");
|
|
12419
12506
|
if (currentHash === hash2) {
|
|
12420
12507
|
return require(filename);
|
|
12421
12508
|
} else {
|
|
12422
12509
|
console.log(`Updating plugin: ${plugin.name}`);
|
|
12423
12510
|
delete require.cache[require.resolve(filename)];
|
|
12424
|
-
|
|
12511
|
+
import_fs8.default.unlinkSync(filename);
|
|
12425
12512
|
}
|
|
12426
12513
|
}
|
|
12427
12514
|
const pluginKey = objectStore_exports2.getPluginJSKey(plugin);
|
|
@@ -12429,24 +12516,24 @@ async function getPluginImpl(path5, plugin) {
|
|
|
12429
12516
|
objectStore_exports2.ObjectStoreBuckets.PLUGINS,
|
|
12430
12517
|
pluginKey
|
|
12431
12518
|
);
|
|
12432
|
-
|
|
12433
|
-
|
|
12519
|
+
import_fs8.default.writeFileSync(filename, pluginJs);
|
|
12520
|
+
import_fs8.default.writeFileSync(metadataName, hash2);
|
|
12434
12521
|
return require(filename);
|
|
12435
12522
|
}
|
|
12436
|
-
var
|
|
12523
|
+
var import_fs8, import_path9, DATASOURCE_PATH, AUTOMATION_PATH, getPluginMetadata, getDatasourcePlugin, getAutomationPlugin;
|
|
12437
12524
|
var init_plugin5 = __esm({
|
|
12438
12525
|
"src/utilities/fileSystem/plugin.ts"() {
|
|
12439
12526
|
init_budibaseDir();
|
|
12440
|
-
|
|
12441
|
-
|
|
12527
|
+
import_fs8 = __toESM(require("fs"));
|
|
12528
|
+
import_path9 = require("path");
|
|
12442
12529
|
init_src2();
|
|
12443
|
-
DATASOURCE_PATH = (0,
|
|
12444
|
-
AUTOMATION_PATH = (0,
|
|
12530
|
+
DATASOURCE_PATH = (0, import_path9.join)(budibaseTempDir2(), "datasource");
|
|
12531
|
+
AUTOMATION_PATH = (0, import_path9.join)(budibaseTempDir2(), "automation");
|
|
12445
12532
|
getPluginMetadata = async (path5) => {
|
|
12446
12533
|
let metadata = {};
|
|
12447
12534
|
try {
|
|
12448
|
-
const pkg2 =
|
|
12449
|
-
const schema =
|
|
12535
|
+
const pkg2 = import_fs8.default.readFileSync((0, import_path9.join)(path5, "package.json"), "utf8");
|
|
12536
|
+
const schema = import_fs8.default.readFileSync((0, import_path9.join)(path5, "schema.json"), "utf8");
|
|
12450
12537
|
metadata.schema = JSON.parse(schema);
|
|
12451
12538
|
metadata.package = JSON.parse(pkg2);
|
|
12452
12539
|
if (!metadata.package.name || !metadata.package.version || !metadata.package.description) {
|
|
@@ -13714,21 +13801,21 @@ __export(version_exports, {
|
|
|
13714
13801
|
getLicenseVersion: () => getLicenseVersion,
|
|
13715
13802
|
getProVersion: () => getProVersion
|
|
13716
13803
|
});
|
|
13717
|
-
var
|
|
13804
|
+
var import_fs9, import_path10, getLicenseVersion, getProVersion;
|
|
13718
13805
|
var init_version2 = __esm({
|
|
13719
13806
|
"../pro/packages/pro/src/constants/version.ts"() {
|
|
13720
13807
|
init_src2();
|
|
13721
|
-
|
|
13722
|
-
|
|
13808
|
+
import_fs9 = __toESM(require("fs"));
|
|
13809
|
+
import_path10 = __toESM(require("path"));
|
|
13723
13810
|
getLicenseVersion = () => {
|
|
13724
13811
|
if (environment_default.isDev()) {
|
|
13725
13812
|
const DEV_VER_FILENAME = "dev-version.txt";
|
|
13726
|
-
const verFile =
|
|
13727
|
-
if (
|
|
13728
|
-
return
|
|
13813
|
+
const verFile = import_path10.default.join(objectStore_exports2.budibaseTempDir(), DEV_VER_FILENAME);
|
|
13814
|
+
if (import_fs9.default.existsSync(verFile)) {
|
|
13815
|
+
return import_fs9.default.readFileSync(verFile, "utf8");
|
|
13729
13816
|
} else {
|
|
13730
13817
|
const devVer = utils_exports2.newid();
|
|
13731
|
-
|
|
13818
|
+
import_fs9.default.writeFileSync(verFile, devVer);
|
|
13732
13819
|
return devVer;
|
|
13733
13820
|
}
|
|
13734
13821
|
} else {
|
|
@@ -14174,31 +14261,31 @@ function getOfflineLicense() {
|
|
|
14174
14261
|
}
|
|
14175
14262
|
}
|
|
14176
14263
|
function getOfflineLicenseFromDisk() {
|
|
14177
|
-
if (
|
|
14178
|
-
const token =
|
|
14264
|
+
if (import_fs10.default.existsSync(LICENSE_FILE_PATH)) {
|
|
14265
|
+
const token = import_fs10.default.readFileSync(LICENSE_FILE_PATH, { encoding: "utf-8" });
|
|
14179
14266
|
return import_jsonwebtoken.default.verify(token, PUBLIC_KEY, { algorithms: ["RS256"] });
|
|
14180
14267
|
}
|
|
14181
14268
|
}
|
|
14182
14269
|
function writeOfflineLicenseToDisk(signedLicense) {
|
|
14183
|
-
|
|
14270
|
+
import_fs10.default.writeFileSync(LICENSE_FILE_PATH, signedLicense, { encoding: "utf-8" });
|
|
14184
14271
|
}
|
|
14185
14272
|
function deleteOfflineLicense() {
|
|
14186
|
-
|
|
14273
|
+
import_fs10.default.rmSync(LICENSE_FILE_PATH, { force: true });
|
|
14187
14274
|
}
|
|
14188
|
-
var
|
|
14275
|
+
var import_fs10, import_path11, import_os2, import_jsonwebtoken, SUB_DIRECTORY, DIRECTORY, OFFLINE_LICENSE_FILE, LICENSE_FILE_PATH, PUBLIC_KEY;
|
|
14189
14276
|
var init_offline = __esm({
|
|
14190
14277
|
"../pro/packages/pro/src/sdk/licensing/licenses/offline.ts"() {
|
|
14191
|
-
|
|
14192
|
-
|
|
14278
|
+
import_fs10 = __toESM(require("fs"));
|
|
14279
|
+
import_path11 = require("path");
|
|
14193
14280
|
import_os2 = require("os");
|
|
14194
14281
|
import_jsonwebtoken = __toESM(require("jsonwebtoken"));
|
|
14195
14282
|
init_src2();
|
|
14196
14283
|
SUB_DIRECTORY = environment_default.isTest() ? ".budibase-test" : ".budibase";
|
|
14197
|
-
DIRECTORY = (0,
|
|
14284
|
+
DIRECTORY = (0, import_path11.join)((0, import_os2.tmpdir)(), SUB_DIRECTORY);
|
|
14198
14285
|
OFFLINE_LICENSE_FILE = "offline_license.txt";
|
|
14199
|
-
LICENSE_FILE_PATH = (0,
|
|
14200
|
-
if (!
|
|
14201
|
-
|
|
14286
|
+
LICENSE_FILE_PATH = (0, import_path11.join)(DIRECTORY, OFFLINE_LICENSE_FILE);
|
|
14287
|
+
if (!import_fs10.default.existsSync(DIRECTORY)) {
|
|
14288
|
+
import_fs10.default.mkdirSync(DIRECTORY);
|
|
14202
14289
|
}
|
|
14203
14290
|
PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvz3jePLCFBXZ19c8Dpkv\nXtSgOhKFOcvQdo/LV0KJRUzQWDPWuO4ILtBtnqhjtIzZH4CH0qCYBet5L6Qr4CM1\nl2HXiAD1Q2rlHNW9wDaYyKb1F5f+v4RyqCAyzlkwRdksmkLeECTboojNnmRCrE3C\n8suunQP5bEScqEY2kclqzSf8e6xqMzPUg3mL/pNa1iEv7TuLbU9nJfgR36l0WmZY\n94fWnSaT8OSXSqcxsaByf06gfS3HAoTJNc7eqz1Hf9fUORQGPUAnFK8cT3SfdA36\nd/o3ZWE1TTj1zYwlCLN5qRKr3hU8nC3xEYNEbkB9SfTRaOq9Q7P8WmfLkoCPm3pR\nmwIDAQAB\n-----END PUBLIC KEY-----\n";
|
|
14204
14291
|
}
|
|
@@ -15655,13 +15742,13 @@ var init_groups6 = __esm({
|
|
|
15655
15742
|
|
|
15656
15743
|
// ../pro/packages/pro/src/utilities/fileSystem.ts
|
|
15657
15744
|
function loadJSFile(directory, name) {
|
|
15658
|
-
return
|
|
15745
|
+
return import_fs11.default.readFileSync((0, import_path12.join)(directory, name), "utf8");
|
|
15659
15746
|
}
|
|
15660
|
-
var
|
|
15747
|
+
var import_fs11, import_path12;
|
|
15661
15748
|
var init_fileSystem2 = __esm({
|
|
15662
15749
|
"../pro/packages/pro/src/utilities/fileSystem.ts"() {
|
|
15663
|
-
|
|
15664
|
-
|
|
15750
|
+
import_fs11 = __toESM(require("fs"));
|
|
15751
|
+
import_path12 = require("path");
|
|
15665
15752
|
}
|
|
15666
15753
|
});
|
|
15667
15754
|
|
|
@@ -18629,8 +18716,8 @@ async function runBackup(trigger3, tenantId, appId, opts) {
|
|
|
18629
18716
|
}
|
|
18630
18717
|
});
|
|
18631
18718
|
await updateMetadata2("complete" /* COMPLETE */, { filename, contents });
|
|
18632
|
-
if (
|
|
18633
|
-
|
|
18719
|
+
if (import_fs12.default.existsSync(tarPath)) {
|
|
18720
|
+
import_fs12.default.rmSync(tarPath);
|
|
18634
18721
|
}
|
|
18635
18722
|
} catch (err) {
|
|
18636
18723
|
logging_exports.logAlert("App backup error", err);
|
|
@@ -18688,14 +18775,14 @@ async function exportProcessor(job, opts) {
|
|
|
18688
18775
|
});
|
|
18689
18776
|
});
|
|
18690
18777
|
}
|
|
18691
|
-
var
|
|
18778
|
+
var import_fs12;
|
|
18692
18779
|
var init_processing = __esm({
|
|
18693
18780
|
"../pro/packages/pro/src/sdk/backups/processing.ts"() {
|
|
18694
18781
|
init_src2();
|
|
18695
18782
|
init_backup5();
|
|
18696
18783
|
init_src();
|
|
18697
18784
|
init_queue4();
|
|
18698
|
-
|
|
18785
|
+
import_fs12 = __toESM(require("fs"));
|
|
18699
18786
|
}
|
|
18700
18787
|
});
|
|
18701
18788
|
|
|
@@ -19378,15 +19465,15 @@ async function downloadBackup(ctx) {
|
|
|
19378
19465
|
const backupId = ctx.params.backupId;
|
|
19379
19466
|
const { metadata, path: path5 } = await backups_default.downloadAppBackup(backupId);
|
|
19380
19467
|
ctx.attachment(`backup-${metadata.timestamp}.tar.gz`);
|
|
19381
|
-
ctx.body =
|
|
19468
|
+
ctx.body = import_fs13.default.createReadStream(path5);
|
|
19382
19469
|
}
|
|
19383
|
-
var
|
|
19470
|
+
var import_fs13;
|
|
19384
19471
|
var init_backups3 = __esm({
|
|
19385
19472
|
"../pro/packages/pro/src/api/controllers/apps/backups.ts"() {
|
|
19386
19473
|
init_src();
|
|
19387
19474
|
init_sdk2();
|
|
19388
19475
|
init_src2();
|
|
19389
|
-
|
|
19476
|
+
import_fs13 = __toESM(require("fs"));
|
|
19390
19477
|
}
|
|
19391
19478
|
});
|
|
19392
19479
|
|
|
@@ -24302,13 +24389,6 @@ function convertBookmark(bookmark) {
|
|
|
24302
24389
|
}
|
|
24303
24390
|
return bookmark;
|
|
24304
24391
|
}
|
|
24305
|
-
function isQsTrue(param) {
|
|
24306
|
-
if (typeof param === "string") {
|
|
24307
|
-
return param.toLowerCase() === "true";
|
|
24308
|
-
} else {
|
|
24309
|
-
return param === true;
|
|
24310
|
-
}
|
|
24311
|
-
}
|
|
24312
24392
|
var import_stream2, Readable, isDev3, NUMBER_REGEX;
|
|
24313
24393
|
var init_utilities2 = __esm({
|
|
24314
24394
|
"src/utilities/index.ts"() {
|
|
@@ -24953,13 +25033,14 @@ __export(exports_exports, {
|
|
|
24953
25033
|
streamExportApp: () => streamExportApp
|
|
24954
25034
|
});
|
|
24955
25035
|
function tarFilesToTmp(tmpDir, files) {
|
|
24956
|
-
const
|
|
24957
|
-
|
|
25036
|
+
const fileName = `${uuid3()}.tar.gz`;
|
|
25037
|
+
const exportFile = (0, import_path13.join)(budibaseTempDir2(), fileName);
|
|
25038
|
+
import_tar2.default.create(
|
|
24958
25039
|
{
|
|
24959
25040
|
sync: true,
|
|
24960
25041
|
gzip: true,
|
|
24961
25042
|
file: exportFile,
|
|
24962
|
-
|
|
25043
|
+
noDirRecurse: false,
|
|
24963
25044
|
cwd: tmpDir
|
|
24964
25045
|
},
|
|
24965
25046
|
files
|
|
@@ -24976,7 +25057,7 @@ async function exportDB(dbName, opts = {}) {
|
|
|
24976
25057
|
return db_exports.doWithDB(dbName, async (db2) => {
|
|
24977
25058
|
if (opts == null ? void 0 : opts.exportPath) {
|
|
24978
25059
|
const path5 = opts == null ? void 0 : opts.exportPath;
|
|
24979
|
-
const writeStream =
|
|
25060
|
+
const writeStream = import_fs14.default.createWriteStream(path5);
|
|
24980
25061
|
await db2.dump(writeStream, exportOpts);
|
|
24981
25062
|
return path5;
|
|
24982
25063
|
} else {
|
|
@@ -25009,9 +25090,9 @@ async function exportApp(appId, config) {
|
|
|
25009
25090
|
for (let path5 of STATIC_APP_FILES) {
|
|
25010
25091
|
const contents = await objectStore_exports2.retrieve(
|
|
25011
25092
|
ObjectStoreBuckets2.APPS,
|
|
25012
|
-
(0,
|
|
25093
|
+
(0, import_path13.join)(appPath, path5)
|
|
25013
25094
|
);
|
|
25014
|
-
|
|
25095
|
+
import_fs14.default.writeFileSync((0, import_path13.join)(tmpPath, path5), contents);
|
|
25015
25096
|
}
|
|
25016
25097
|
} else {
|
|
25017
25098
|
tmpPath = await objectStore_exports2.retrieveDirectory(
|
|
@@ -25020,37 +25101,52 @@ async function exportApp(appId, config) {
|
|
|
25020
25101
|
);
|
|
25021
25102
|
}
|
|
25022
25103
|
}
|
|
25023
|
-
const downloadedPath = (0,
|
|
25024
|
-
if (
|
|
25025
|
-
const allFiles =
|
|
25104
|
+
const downloadedPath = (0, import_path13.join)(tmpPath, appPath);
|
|
25105
|
+
if (import_fs14.default.existsSync(downloadedPath)) {
|
|
25106
|
+
const allFiles = import_fs14.default.readdirSync(downloadedPath);
|
|
25026
25107
|
for (let file of allFiles) {
|
|
25027
|
-
const path5 = (0,
|
|
25028
|
-
|
|
25108
|
+
const path5 = (0, import_path13.join)(downloadedPath, file);
|
|
25109
|
+
import_fs14.default.renameSync(path5, (0, import_path13.join)(downloadedPath, "..", file));
|
|
25029
25110
|
}
|
|
25030
|
-
|
|
25111
|
+
import_fs14.default.rmdirSync(downloadedPath);
|
|
25031
25112
|
}
|
|
25032
|
-
const dbPath = (0,
|
|
25113
|
+
const dbPath = (0, import_path13.join)(tmpPath, DB_EXPORT_FILE);
|
|
25033
25114
|
await exportDB(appId, {
|
|
25034
25115
|
filter: defineFilter(config == null ? void 0 : config.excludeRows, config == null ? void 0 : config.excludeLogs),
|
|
25035
25116
|
exportPath: dbPath
|
|
25036
25117
|
});
|
|
25118
|
+
if (config == null ? void 0 : config.encryptPassword) {
|
|
25119
|
+
for (let file of import_fs14.default.readdirSync(tmpPath)) {
|
|
25120
|
+
const path5 = (0, import_path13.join)(tmpPath, file);
|
|
25121
|
+
await encryption_exports.encryptFile(
|
|
25122
|
+
{ dir: tmpPath, filename: file },
|
|
25123
|
+
config.encryptPassword
|
|
25124
|
+
);
|
|
25125
|
+
import_fs14.default.rmSync(path5);
|
|
25126
|
+
}
|
|
25127
|
+
}
|
|
25037
25128
|
if (config == null ? void 0 : config.tar) {
|
|
25038
|
-
const tarPath = tarFilesToTmp(tmpPath,
|
|
25039
|
-
|
|
25129
|
+
const tarPath = tarFilesToTmp(tmpPath, import_fs14.default.readdirSync(tmpPath));
|
|
25130
|
+
import_fs14.default.rmSync(tmpPath, { recursive: true, force: true });
|
|
25040
25131
|
return tarPath;
|
|
25041
25132
|
} else {
|
|
25042
25133
|
return tmpPath;
|
|
25043
25134
|
}
|
|
25044
25135
|
}
|
|
25045
|
-
async function streamExportApp(
|
|
25136
|
+
async function streamExportApp({
|
|
25137
|
+
appId,
|
|
25138
|
+
excludeRows,
|
|
25139
|
+
encryptPassword
|
|
25140
|
+
}) {
|
|
25046
25141
|
const tmpPath = await exportApp(appId, {
|
|
25047
25142
|
excludeRows,
|
|
25048
25143
|
excludeLogs: true,
|
|
25049
|
-
tar: true
|
|
25144
|
+
tar: true,
|
|
25145
|
+
encryptPassword
|
|
25050
25146
|
});
|
|
25051
25147
|
return streamFile(tmpPath);
|
|
25052
25148
|
}
|
|
25053
|
-
var
|
|
25149
|
+
var import_fs14, import_path13, import_tar2, uuid3, MemoryStream2;
|
|
25054
25150
|
var init_exports2 = __esm({
|
|
25055
25151
|
"src/sdk/app/backups/exports.ts"() {
|
|
25056
25152
|
init_src2();
|
|
@@ -25059,11 +25155,11 @@ var init_exports2 = __esm({
|
|
|
25059
25155
|
init_constants4();
|
|
25060
25156
|
init_utils9();
|
|
25061
25157
|
init_constants7();
|
|
25062
|
-
|
|
25063
|
-
|
|
25158
|
+
import_fs14 = __toESM(require("fs"));
|
|
25159
|
+
import_path13 = require("path");
|
|
25064
25160
|
init_environment3();
|
|
25161
|
+
import_tar2 = __toESM(require("tar"));
|
|
25065
25162
|
uuid3 = require("uuid/v4");
|
|
25066
|
-
tar3 = require("tar");
|
|
25067
25163
|
MemoryStream2 = require("memorystream");
|
|
25068
25164
|
}
|
|
25069
25165
|
});
|
|
@@ -25140,16 +25236,16 @@ async function getTemplateStream(template) {
|
|
|
25140
25236
|
throw new Error("Cannot import a non-text based file.");
|
|
25141
25237
|
}
|
|
25142
25238
|
if (template.file) {
|
|
25143
|
-
return
|
|
25239
|
+
return import_fs15.default.createReadStream(template.file.path);
|
|
25144
25240
|
} else if (template.key) {
|
|
25145
25241
|
const [type, name] = template.key.split("/");
|
|
25146
25242
|
const tmpPath = await downloadTemplate(type, name);
|
|
25147
|
-
return
|
|
25243
|
+
return import_fs15.default.createReadStream((0, import_path14.join)(tmpPath, name, "db", "dump.txt"));
|
|
25148
25244
|
}
|
|
25149
25245
|
}
|
|
25150
25246
|
function untarFile(file) {
|
|
25151
|
-
const tmpPath = (0,
|
|
25152
|
-
|
|
25247
|
+
const tmpPath = (0, import_path14.join)(budibaseTempDir2(), uuid4());
|
|
25248
|
+
import_fs15.default.mkdirSync(tmpPath);
|
|
25153
25249
|
tar4.extract({
|
|
25154
25250
|
sync: true,
|
|
25155
25251
|
cwd: tmpPath,
|
|
@@ -25157,31 +25253,49 @@ function untarFile(file) {
|
|
|
25157
25253
|
});
|
|
25158
25254
|
return tmpPath;
|
|
25159
25255
|
}
|
|
25256
|
+
async function decryptFiles(path5, password) {
|
|
25257
|
+
try {
|
|
25258
|
+
for (let file of import_fs15.default.readdirSync(path5)) {
|
|
25259
|
+
const inputPath = (0, import_path14.join)(path5, file);
|
|
25260
|
+
const outputPath = inputPath.replace(/\.enc$/, "");
|
|
25261
|
+
await encryption_exports.decryptFile(inputPath, outputPath, password);
|
|
25262
|
+
import_fs15.default.rmSync(inputPath);
|
|
25263
|
+
}
|
|
25264
|
+
} catch (err) {
|
|
25265
|
+
if (err.message === "incorrect header check") {
|
|
25266
|
+
throw new Error("File cannot be imported");
|
|
25267
|
+
}
|
|
25268
|
+
throw err;
|
|
25269
|
+
}
|
|
25270
|
+
}
|
|
25160
25271
|
function getGlobalDBFile(tmpPath) {
|
|
25161
|
-
return
|
|
25272
|
+
return import_fs15.default.readFileSync((0, import_path14.join)(tmpPath, GLOBAL_DB_EXPORT_FILE), "utf8");
|
|
25162
25273
|
}
|
|
25163
25274
|
function getListOfAppsInMulti(tmpPath) {
|
|
25164
|
-
return
|
|
25275
|
+
return import_fs15.default.readdirSync(tmpPath).filter((dir) => dir !== GLOBAL_DB_EXPORT_FILE);
|
|
25165
25276
|
}
|
|
25166
25277
|
async function importApp(appId, db2, template) {
|
|
25167
25278
|
var _a2, _b2;
|
|
25168
25279
|
let prodAppId = db_exports.getProdAppID(appId);
|
|
25169
25280
|
let dbStream;
|
|
25170
25281
|
const isTar = template.file && ((_b2 = (_a2 = template == null ? void 0 : template.file) == null ? void 0 : _a2.type) == null ? void 0 : _b2.endsWith("gzip"));
|
|
25171
|
-
const isDirectory = template.file &&
|
|
25282
|
+
const isDirectory = template.file && import_fs15.default.lstatSync(template.file.path).isDirectory();
|
|
25172
25283
|
if (template.file && (isTar || isDirectory)) {
|
|
25173
25284
|
const tmpPath = isTar ? untarFile(template.file) : template.file.path;
|
|
25174
|
-
|
|
25285
|
+
if (isTar && template.file.password) {
|
|
25286
|
+
await decryptFiles(tmpPath, template.file.password);
|
|
25287
|
+
}
|
|
25288
|
+
const contents = import_fs15.default.readdirSync(tmpPath);
|
|
25175
25289
|
if (contents.length) {
|
|
25176
25290
|
let promises = [];
|
|
25177
25291
|
let excludedFiles = [GLOBAL_DB_EXPORT_FILE, DB_EXPORT_FILE];
|
|
25178
25292
|
for (let filename of contents) {
|
|
25179
|
-
const path5 = (0,
|
|
25293
|
+
const path5 = (0, import_path14.join)(tmpPath, filename);
|
|
25180
25294
|
if (excludedFiles.includes(filename)) {
|
|
25181
25295
|
continue;
|
|
25182
25296
|
}
|
|
25183
|
-
filename = (0,
|
|
25184
|
-
if (
|
|
25297
|
+
filename = (0, import_path14.join)(prodAppId, filename);
|
|
25298
|
+
if (import_fs15.default.lstatSync(path5).isDirectory()) {
|
|
25185
25299
|
promises.push(
|
|
25186
25300
|
objectStore_exports2.uploadDirectory(ObjectStoreBuckets2.APPS, path5, filename)
|
|
25187
25301
|
);
|
|
@@ -25197,7 +25311,7 @@ async function importApp(appId, db2, template) {
|
|
|
25197
25311
|
}
|
|
25198
25312
|
await Promise.all(promises);
|
|
25199
25313
|
}
|
|
25200
|
-
dbStream =
|
|
25314
|
+
dbStream = import_fs15.default.createReadStream((0, import_path14.join)(tmpPath, DB_EXPORT_FILE));
|
|
25201
25315
|
} else {
|
|
25202
25316
|
dbStream = await getTemplateStream(template);
|
|
25203
25317
|
}
|
|
@@ -25209,7 +25323,7 @@ async function importApp(appId, db2, template) {
|
|
|
25209
25323
|
await updateAutomations(prodAppId, db2);
|
|
25210
25324
|
return ok;
|
|
25211
25325
|
}
|
|
25212
|
-
var
|
|
25326
|
+
var import_path14, import_fs15, uuid4, tar4;
|
|
25213
25327
|
var init_imports = __esm({
|
|
25214
25328
|
"src/sdk/app/backups/imports.ts"() {
|
|
25215
25329
|
init_src2();
|
|
@@ -25218,8 +25332,8 @@ var init_imports = __esm({
|
|
|
25218
25332
|
init_constants7();
|
|
25219
25333
|
init_fileSystem();
|
|
25220
25334
|
init_constants4();
|
|
25221
|
-
|
|
25222
|
-
|
|
25335
|
+
import_path14 = require("path");
|
|
25336
|
+
import_fs15 = __toESM(require("fs"));
|
|
25223
25337
|
init_sdk3();
|
|
25224
25338
|
init_src();
|
|
25225
25339
|
uuid4 = require("uuid/v4");
|
|
@@ -41718,17 +41832,23 @@ var init_query6 = __esm({
|
|
|
41718
41832
|
|
|
41719
41833
|
// src/api/controllers/backup.ts
|
|
41720
41834
|
async function exportAppDump(ctx) {
|
|
41721
|
-
|
|
41835
|
+
const { appId } = ctx.query;
|
|
41836
|
+
const { excludeRows, encryptPassword } = ctx.request.body;
|
|
41837
|
+
const [app2] = await db_exports.getAppsByIDs([appId]);
|
|
41838
|
+
const appName = app2.name;
|
|
41722
41839
|
ctx.req.setTimeout(0);
|
|
41723
|
-
const
|
|
41724
|
-
|
|
41725
|
-
const backupIdentifier = `${appName}-export-${(/* @__PURE__ */ new Date()).getTime()}.tar.gz`;
|
|
41840
|
+
const extension = encryptPassword ? "enc.tar.gz" : "tar.gz";
|
|
41841
|
+
const backupIdentifier = `${appName}-export-${(/* @__PURE__ */ new Date()).getTime()}.${extension}`;
|
|
41726
41842
|
ctx.attachment(backupIdentifier);
|
|
41727
|
-
ctx.body = await sdk_default.backups.streamExportApp(
|
|
41843
|
+
ctx.body = await sdk_default.backups.streamExportApp({
|
|
41844
|
+
appId,
|
|
41845
|
+
excludeRows,
|
|
41846
|
+
encryptPassword
|
|
41847
|
+
});
|
|
41728
41848
|
await context_exports.doInAppContext(appId, async () => {
|
|
41729
41849
|
const appDb = context_exports.getAppDB();
|
|
41730
|
-
const
|
|
41731
|
-
await events_exports.app.exported(
|
|
41850
|
+
const app3 = await appDb.get(DocumentType2.APP_METADATA);
|
|
41851
|
+
await events_exports.app.exported(app3);
|
|
41732
41852
|
});
|
|
41733
41853
|
}
|
|
41734
41854
|
var init_backup6 = __esm({
|
|
@@ -41736,7 +41856,6 @@ var init_backup6 = __esm({
|
|
|
41736
41856
|
init_sdk3();
|
|
41737
41857
|
init_src2();
|
|
41738
41858
|
init_utils9();
|
|
41739
|
-
init_utilities2();
|
|
41740
41859
|
}
|
|
41741
41860
|
});
|
|
41742
41861
|
|
|
@@ -41749,7 +41868,7 @@ var init_backup7 = __esm({
|
|
|
41749
41868
|
init_authorized();
|
|
41750
41869
|
init_src2();
|
|
41751
41870
|
router28 = new import_router28.default();
|
|
41752
|
-
router28.
|
|
41871
|
+
router28.post(
|
|
41753
41872
|
"/api/backups/export",
|
|
41754
41873
|
authorized_default(permissions_exports.BUILDER),
|
|
41755
41874
|
exportAppDump
|
|
@@ -43181,18 +43300,18 @@ async function npmUpload(url, name, headers = {}) {
|
|
|
43181
43300
|
}
|
|
43182
43301
|
try {
|
|
43183
43302
|
await extractTarball(tarballPluginFile, path5);
|
|
43184
|
-
deleteFolderFileSystem((0,
|
|
43303
|
+
deleteFolderFileSystem((0, import_path15.join)(path5, "package"));
|
|
43185
43304
|
} catch (err) {
|
|
43186
43305
|
throw new Error(err);
|
|
43187
43306
|
}
|
|
43188
43307
|
return await getPluginMetadata(path5);
|
|
43189
43308
|
}
|
|
43190
|
-
var import_node_fetch20,
|
|
43309
|
+
var import_node_fetch20, import_path15;
|
|
43191
43310
|
var init_npm = __esm({
|
|
43192
43311
|
"src/api/controllers/plugin/npm.ts"() {
|
|
43193
43312
|
init_fileSystem();
|
|
43194
43313
|
import_node_fetch20 = __toESM(require("node-fetch"));
|
|
43195
|
-
|
|
43314
|
+
import_path15 = require("path");
|
|
43196
43315
|
init_utils28();
|
|
43197
43316
|
}
|
|
43198
43317
|
});
|
|
@@ -43400,7 +43519,7 @@ async function prepareUpload({ s3Key, bucket, metadata, file }) {
|
|
|
43400
43519
|
key: response2.Key
|
|
43401
43520
|
};
|
|
43402
43521
|
}
|
|
43403
|
-
var import_string_templates10, import_aws_sdk4,
|
|
43522
|
+
var import_string_templates10, import_aws_sdk4, import_fs16, uuid5, send2, toggleBetaUiFeature, serveBuilder, uploadFile, deleteObjects, serveApp, serveBuilderPreview, serveClientLibrary, getSignedUploadURL;
|
|
43404
43523
|
var init_static = __esm({
|
|
43405
43524
|
"src/api/controllers/static/index.ts"() {
|
|
43406
43525
|
init_centralPath();
|
|
@@ -43411,7 +43530,7 @@ var init_static = __esm({
|
|
|
43411
43530
|
init_utils9();
|
|
43412
43531
|
init_src2();
|
|
43413
43532
|
import_aws_sdk4 = __toESM(require("aws-sdk"));
|
|
43414
|
-
|
|
43533
|
+
import_fs16 = __toESM(require("fs"));
|
|
43415
43534
|
init_sdk3();
|
|
43416
43535
|
init_src4();
|
|
43417
43536
|
require("svelte/register");
|
|
@@ -43426,9 +43545,9 @@ var init_static = __esm({
|
|
|
43426
43545
|
};
|
|
43427
43546
|
return;
|
|
43428
43547
|
}
|
|
43429
|
-
let builderPath =
|
|
43430
|
-
if (!
|
|
43431
|
-
|
|
43548
|
+
let builderPath = join4(TOP_LEVEL_PATH, "new_design_ui");
|
|
43549
|
+
if (!import_fs16.default.existsSync(builderPath)) {
|
|
43550
|
+
import_fs16.default.mkdirSync(builderPath);
|
|
43432
43551
|
}
|
|
43433
43552
|
await objectStore_exports2.downloadTarballDirect(
|
|
43434
43553
|
"https://cdn.budi.live/beta:design_ui/new_ui.tar.gz",
|
|
@@ -43440,7 +43559,7 @@ var init_static = __esm({
|
|
|
43440
43559
|
};
|
|
43441
43560
|
};
|
|
43442
43561
|
serveBuilder = async function(ctx) {
|
|
43443
|
-
const builderPath =
|
|
43562
|
+
const builderPath = join4(TOP_LEVEL_PATH, "builder");
|
|
43444
43563
|
await send2(ctx, ctx.file, { root: builderPath });
|
|
43445
43564
|
};
|
|
43446
43565
|
uploadFile = async function(ctx) {
|
|
@@ -43529,7 +43648,7 @@ var init_static = __esm({
|
|
|
43529
43648
|
};
|
|
43530
43649
|
serveClientLibrary = async function(ctx) {
|
|
43531
43650
|
return send2(ctx, "budibase-client.js", {
|
|
43532
|
-
root:
|
|
43651
|
+
root: join4(NODE_MODULES_PATH, "@budibase", "client", "dist")
|
|
43533
43652
|
});
|
|
43534
43653
|
};
|
|
43535
43654
|
getSignedUploadURL = async function(ctx) {
|
|
@@ -44849,13 +44968,13 @@ var init_routes = __esm({
|
|
|
44849
44968
|
});
|
|
44850
44969
|
|
|
44851
44970
|
// src/api/index.ts
|
|
44852
|
-
var import_router35,
|
|
44971
|
+
var import_router35, import_zlib3, compress, router35;
|
|
44853
44972
|
var init_api8 = __esm({
|
|
44854
44973
|
"src/api/index.ts"() {
|
|
44855
44974
|
import_router35 = __toESM(require("@koa/router"));
|
|
44856
44975
|
init_src2();
|
|
44857
44976
|
init_currentapp();
|
|
44858
|
-
|
|
44977
|
+
import_zlib3 = __toESM(require("zlib"));
|
|
44859
44978
|
init_routes();
|
|
44860
44979
|
init_src4();
|
|
44861
44980
|
init_public();
|
|
@@ -44868,10 +44987,10 @@ var init_api8 = __esm({
|
|
|
44868
44987
|
compress({
|
|
44869
44988
|
threshold: 2048,
|
|
44870
44989
|
gzip: {
|
|
44871
|
-
flush:
|
|
44990
|
+
flush: import_zlib3.default.constants.Z_SYNC_FLUSH
|
|
44872
44991
|
},
|
|
44873
44992
|
deflate: {
|
|
44874
|
-
flush:
|
|
44993
|
+
flush: import_zlib3.default.constants.Z_SYNC_FLUSH
|
|
44875
44994
|
},
|
|
44876
44995
|
br: false
|
|
44877
44996
|
})
|
|
@@ -44917,7 +45036,7 @@ var init_automations8 = __esm({
|
|
|
44917
45036
|
|
|
44918
45037
|
// src/watch.ts
|
|
44919
45038
|
function watch() {
|
|
44920
|
-
const watchPath =
|
|
45039
|
+
const watchPath = import_path16.default.join(environment_default2.PLUGINS_DIR, "./**/*.tar.gz");
|
|
44921
45040
|
import_chokidar.default.watch(watchPath, {
|
|
44922
45041
|
ignored: "**/node_modules",
|
|
44923
45042
|
awaitWriteFinish: {
|
|
@@ -44927,7 +45046,7 @@ function watch() {
|
|
|
44927
45046
|
usePolling: true,
|
|
44928
45047
|
interval: 250
|
|
44929
45048
|
}).on("all", async (event, path5) => {
|
|
44930
|
-
if (!(path5 == null ? void 0 : path5.endsWith(".tar.gz")) || !
|
|
45049
|
+
if (!(path5 == null ? void 0 : path5.endsWith(".tar.gz")) || !import_fs17.default.existsSync(path5)) {
|
|
44931
45050
|
return;
|
|
44932
45051
|
}
|
|
44933
45052
|
await tenancy.doInTenant(constants_exports.DEFAULT_TENANT_ID, async () => {
|
|
@@ -44943,13 +45062,13 @@ function watch() {
|
|
|
44943
45062
|
});
|
|
44944
45063
|
});
|
|
44945
45064
|
}
|
|
44946
|
-
var
|
|
45065
|
+
var import_path16, import_chokidar, import_fs17;
|
|
44947
45066
|
var init_watch = __esm({
|
|
44948
45067
|
"src/watch.ts"() {
|
|
44949
|
-
|
|
45068
|
+
import_path16 = __toESM(require("path"));
|
|
44950
45069
|
init_environment3();
|
|
44951
45070
|
import_chokidar = __toESM(require("chokidar"));
|
|
44952
|
-
|
|
45071
|
+
import_fs17 = __toESM(require("fs"));
|
|
44953
45072
|
init_src2();
|
|
44954
45073
|
init_plugins5();
|
|
44955
45074
|
}
|
|
@@ -45005,7 +45124,7 @@ async function startup(app2, server2) {
|
|
|
45005
45124
|
shutdown9(server2);
|
|
45006
45125
|
}
|
|
45007
45126
|
}
|
|
45008
|
-
if (environment_default2.SELF_HOSTED && !environment_default2.MULTI_TENANCY && environment_default2.PLUGINS_DIR &&
|
|
45127
|
+
if (environment_default2.SELF_HOSTED && !environment_default2.MULTI_TENANCY && environment_default2.PLUGINS_DIR && import_fs18.default.existsSync(environment_default2.PLUGINS_DIR)) {
|
|
45009
45128
|
watch();
|
|
45010
45129
|
}
|
|
45011
45130
|
await installation_exports.checkInstallVersion();
|
|
@@ -45040,14 +45159,14 @@ async function startup(app2, server2) {
|
|
|
45040
45159
|
}
|
|
45041
45160
|
}
|
|
45042
45161
|
}
|
|
45043
|
-
var
|
|
45162
|
+
var import_fs18, STARTUP_RAN;
|
|
45044
45163
|
var init_startup = __esm({
|
|
45045
45164
|
"src/startup.ts"() {
|
|
45046
45165
|
init_environment3();
|
|
45047
45166
|
init_redis4();
|
|
45048
45167
|
init_workerRequests();
|
|
45049
45168
|
init_src2();
|
|
45050
|
-
|
|
45169
|
+
import_fs18 = __toESM(require("fs"));
|
|
45051
45170
|
init_watch();
|
|
45052
45171
|
init_automations8();
|
|
45053
45172
|
init_fileSystem();
|