@budibase/server 2.7.7-alpha.7 → 2.7.7-alpha.9
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/automation.js +249 -125
- package/dist/automation.js.map +3 -3
- package/dist/index.js +323 -194
- package/dist/index.js.map +3 -3
- package/dist/query.js +233 -109
- package/dist/query.js.map +3 -3
- package/package.json +10 -10
- package/src/api/controllers/backup.ts +9 -3
- package/src/api/controllers/role.ts +5 -5
- package/src/api/controllers/routing.ts +3 -3
- package/src/middleware/currentapp.ts +1 -1
- package/src/sdk/app/backups/exports.ts +33 -5
- package/src/sdk/app/backups/imports.ts +21 -1
package/dist/index.js
CHANGED
|
@@ -9305,7 +9305,7 @@ function lowerBuiltinRoleID(roleId1, roleId2) {
|
|
|
9305
9305
|
}
|
|
9306
9306
|
return builtinRoleToNumber(roleId1) > builtinRoleToNumber(roleId2) ? roleId2 : roleId1;
|
|
9307
9307
|
}
|
|
9308
|
-
async function getRole(roleId) {
|
|
9308
|
+
async function getRole(roleId, opts) {
|
|
9309
9309
|
if (!roleId) {
|
|
9310
9310
|
return void 0;
|
|
9311
9311
|
}
|
|
@@ -9321,6 +9321,9 @@ async function getRole(roleId) {
|
|
|
9321
9321
|
role = Object.assign(role, dbRole);
|
|
9322
9322
|
role._id = getExternalRoleID(role._id);
|
|
9323
9323
|
} catch (err) {
|
|
9324
|
+
if (!isBuiltin(roleId) && (opts == null ? void 0 : opts.defaultPublic)) {
|
|
9325
|
+
return cloneDeep2(BUILTIN_ROLES.PUBLIC);
|
|
9326
|
+
}
|
|
9324
9327
|
if (Object.keys(role).length === 0) {
|
|
9325
9328
|
throw err;
|
|
9326
9329
|
}
|
|
@@ -10158,7 +10161,9 @@ var encryption_exports = {};
|
|
|
10158
10161
|
__export(encryption_exports, {
|
|
10159
10162
|
SecretOption: () => SecretOption,
|
|
10160
10163
|
decrypt: () => decrypt,
|
|
10164
|
+
decryptFile: () => decryptFile,
|
|
10161
10165
|
encrypt: () => encrypt,
|
|
10166
|
+
encryptFile: () => encryptFile,
|
|
10162
10167
|
getSecret: () => getSecret
|
|
10163
10168
|
});
|
|
10164
10169
|
function getSecret(secretOption) {
|
|
@@ -10179,11 +10184,11 @@ function getSecret(secretOption) {
|
|
|
10179
10184
|
}
|
|
10180
10185
|
return secret;
|
|
10181
10186
|
}
|
|
10182
|
-
function stretchString(
|
|
10183
|
-
return import_crypto.default.pbkdf2Sync(
|
|
10187
|
+
function stretchString(secret, salt) {
|
|
10188
|
+
return import_crypto.default.pbkdf2Sync(secret, salt, ITERATIONS, STRETCH_LENGTH, "sha512");
|
|
10184
10189
|
}
|
|
10185
10190
|
function encrypt(input, secretOption = "api" /* API */) {
|
|
10186
|
-
const salt = import_crypto.default.randomBytes(
|
|
10191
|
+
const salt = import_crypto.default.randomBytes(SALT_LENGTH);
|
|
10187
10192
|
const stretched = stretchString(getSecret(secretOption), salt);
|
|
10188
10193
|
const cipher = import_crypto.default.createCipheriv(ALGO, stretched, salt);
|
|
10189
10194
|
const base = cipher.update(input);
|
|
@@ -10200,16 +10205,101 @@ function decrypt(input, secretOption = "api" /* API */) {
|
|
|
10200
10205
|
const final = decipher.final();
|
|
10201
10206
|
return Buffer.concat([base, final]).toString();
|
|
10202
10207
|
}
|
|
10203
|
-
|
|
10208
|
+
async function encryptFile({ dir, filename }, secret) {
|
|
10209
|
+
const outputFileName = `${filename}.enc`;
|
|
10210
|
+
const filePath = (0, import_path.join)(dir, filename);
|
|
10211
|
+
const inputFile = import_fs2.default.createReadStream(filePath);
|
|
10212
|
+
const outputFile = import_fs2.default.createWriteStream((0, import_path.join)(dir, outputFileName));
|
|
10213
|
+
const salt = import_crypto.default.randomBytes(SALT_LENGTH);
|
|
10214
|
+
const iv = import_crypto.default.randomBytes(IV_LENGTH);
|
|
10215
|
+
const stretched = stretchString(secret, salt);
|
|
10216
|
+
const cipher = import_crypto.default.createCipheriv(ALGO, stretched, iv);
|
|
10217
|
+
outputFile.write(salt);
|
|
10218
|
+
outputFile.write(iv);
|
|
10219
|
+
inputFile.pipe(import_zlib.default.createGzip()).pipe(cipher).pipe(outputFile);
|
|
10220
|
+
return new Promise((r) => {
|
|
10221
|
+
outputFile.on("finish", () => {
|
|
10222
|
+
r({
|
|
10223
|
+
filename: outputFileName,
|
|
10224
|
+
dir
|
|
10225
|
+
});
|
|
10226
|
+
});
|
|
10227
|
+
});
|
|
10228
|
+
}
|
|
10229
|
+
async function getSaltAndIV(path5) {
|
|
10230
|
+
const fileStream = import_fs2.default.createReadStream(path5);
|
|
10231
|
+
const salt = await readBytes(fileStream, SALT_LENGTH);
|
|
10232
|
+
const iv = await readBytes(fileStream, IV_LENGTH);
|
|
10233
|
+
fileStream.close();
|
|
10234
|
+
return { salt, iv };
|
|
10235
|
+
}
|
|
10236
|
+
async function decryptFile(inputPath, outputPath, secret) {
|
|
10237
|
+
const { salt, iv } = await getSaltAndIV(inputPath);
|
|
10238
|
+
const inputFile = import_fs2.default.createReadStream(inputPath, {
|
|
10239
|
+
start: SALT_LENGTH + IV_LENGTH
|
|
10240
|
+
});
|
|
10241
|
+
const outputFile = import_fs2.default.createWriteStream(outputPath);
|
|
10242
|
+
const stretched = stretchString(secret, salt);
|
|
10243
|
+
const decipher = import_crypto.default.createDecipheriv(ALGO, stretched, iv);
|
|
10244
|
+
const unzip = import_zlib.default.createGunzip();
|
|
10245
|
+
inputFile.pipe(decipher).pipe(unzip).pipe(outputFile);
|
|
10246
|
+
return new Promise((res, rej) => {
|
|
10247
|
+
outputFile.on("finish", () => {
|
|
10248
|
+
outputFile.close();
|
|
10249
|
+
res();
|
|
10250
|
+
});
|
|
10251
|
+
inputFile.on("error", (e) => {
|
|
10252
|
+
outputFile.close();
|
|
10253
|
+
rej(e);
|
|
10254
|
+
});
|
|
10255
|
+
decipher.on("error", (e) => {
|
|
10256
|
+
outputFile.close();
|
|
10257
|
+
rej(e);
|
|
10258
|
+
});
|
|
10259
|
+
unzip.on("error", (e) => {
|
|
10260
|
+
outputFile.close();
|
|
10261
|
+
rej(e);
|
|
10262
|
+
});
|
|
10263
|
+
outputFile.on("error", (e) => {
|
|
10264
|
+
outputFile.close();
|
|
10265
|
+
rej(e);
|
|
10266
|
+
});
|
|
10267
|
+
});
|
|
10268
|
+
}
|
|
10269
|
+
function readBytes(stream3, length) {
|
|
10270
|
+
return new Promise((resolve3, reject) => {
|
|
10271
|
+
let bytesRead = 0;
|
|
10272
|
+
const data2 = [];
|
|
10273
|
+
stream3.on("readable", () => {
|
|
10274
|
+
let chunk;
|
|
10275
|
+
while ((chunk = stream3.read(length - bytesRead)) !== null) {
|
|
10276
|
+
data2.push(chunk);
|
|
10277
|
+
bytesRead += chunk.length;
|
|
10278
|
+
}
|
|
10279
|
+
resolve3(Buffer.concat(data2));
|
|
10280
|
+
});
|
|
10281
|
+
stream3.on("end", () => {
|
|
10282
|
+
reject(new Error("Insufficient data in the stream."));
|
|
10283
|
+
});
|
|
10284
|
+
stream3.on("error", (error2) => {
|
|
10285
|
+
reject(error2);
|
|
10286
|
+
});
|
|
10287
|
+
});
|
|
10288
|
+
}
|
|
10289
|
+
var import_crypto, import_fs2, import_zlib, import_path, ALGO, SEPARATOR3, ITERATIONS, STRETCH_LENGTH, SALT_LENGTH, IV_LENGTH, SecretOption;
|
|
10204
10290
|
var init_encryption = __esm({
|
|
10205
10291
|
"../backend-core/src/security/encryption.ts"() {
|
|
10206
10292
|
import_crypto = __toESM(require("crypto"));
|
|
10293
|
+
import_fs2 = __toESM(require("fs"));
|
|
10294
|
+
import_zlib = __toESM(require("zlib"));
|
|
10207
10295
|
init_environment2();
|
|
10296
|
+
import_path = require("path");
|
|
10208
10297
|
ALGO = "aes-256-ctr";
|
|
10209
10298
|
SEPARATOR3 = "-";
|
|
10210
10299
|
ITERATIONS = 1e4;
|
|
10211
|
-
RANDOM_BYTES = 16;
|
|
10212
10300
|
STRETCH_LENGTH = 32;
|
|
10301
|
+
SALT_LENGTH = 16;
|
|
10302
|
+
IV_LENGTH = 16;
|
|
10213
10303
|
SecretOption = /* @__PURE__ */ ((SecretOption2) => {
|
|
10214
10304
|
SecretOption2["API"] = "api";
|
|
10215
10305
|
SecretOption2["ENCRYPTION"] = "encryption";
|
|
@@ -11120,12 +11210,12 @@ var init_plugin4 = __esm({
|
|
|
11120
11210
|
function budibaseTempDir() {
|
|
11121
11211
|
return bbTmp;
|
|
11122
11212
|
}
|
|
11123
|
-
var
|
|
11213
|
+
var import_path2, import_os, import_fs3, ObjectStoreBuckets, bbTmp;
|
|
11124
11214
|
var init_utils8 = __esm({
|
|
11125
11215
|
"../backend-core/src/objectStore/utils.ts"() {
|
|
11126
|
-
|
|
11216
|
+
import_path2 = require("path");
|
|
11127
11217
|
import_os = require("os");
|
|
11128
|
-
|
|
11218
|
+
import_fs3 = __toESM(require("fs"));
|
|
11129
11219
|
init_environment2();
|
|
11130
11220
|
ObjectStoreBuckets = {
|
|
11131
11221
|
BACKUPS: environment_default.BACKUPS_BUCKET_NAME,
|
|
@@ -11134,9 +11224,9 @@ var init_utils8 = __esm({
|
|
|
11134
11224
|
GLOBAL: environment_default.GLOBAL_BUCKET_NAME,
|
|
11135
11225
|
PLUGINS: environment_default.PLUGIN_BUCKET_NAME
|
|
11136
11226
|
};
|
|
11137
|
-
bbTmp = (0,
|
|
11138
|
-
if (!
|
|
11139
|
-
|
|
11227
|
+
bbTmp = (0, import_path2.join)((0, import_os.tmpdir)(), ".budibase");
|
|
11228
|
+
if (!import_fs3.default.existsSync(bbTmp)) {
|
|
11229
|
+
import_fs3.default.mkdirSync(bbTmp);
|
|
11140
11230
|
}
|
|
11141
11231
|
}
|
|
11142
11232
|
});
|
|
@@ -11148,17 +11238,17 @@ function sanitizeKey(input) {
|
|
|
11148
11238
|
function sanitizeBucket(input) {
|
|
11149
11239
|
return input.replace(new RegExp(APP_DEV_PREFIX, "g"), APP_PREFIX);
|
|
11150
11240
|
}
|
|
11151
|
-
var import_aws_sdk, import_stream, import_node_fetch6, import_tar_fs,
|
|
11241
|
+
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
11242
|
var init_objectStore = __esm({
|
|
11153
11243
|
"../backend-core/src/objectStore/objectStore.ts"() {
|
|
11154
11244
|
import_aws_sdk = __toESM(require("aws-sdk"));
|
|
11155
11245
|
import_stream = __toESM(require("stream"));
|
|
11156
11246
|
import_node_fetch6 = __toESM(require("node-fetch"));
|
|
11157
11247
|
import_tar_fs = __toESM(require("tar-fs"));
|
|
11158
|
-
|
|
11248
|
+
import_zlib2 = __toESM(require("zlib"));
|
|
11159
11249
|
import_util = require("util");
|
|
11160
|
-
|
|
11161
|
-
|
|
11250
|
+
import_path3 = require("path");
|
|
11251
|
+
import_fs4 = __toESM(require("fs"));
|
|
11162
11252
|
init_environment2();
|
|
11163
11253
|
init_utils8();
|
|
11164
11254
|
import_uuid3 = require("uuid");
|
|
@@ -11237,7 +11327,7 @@ var init_objectStore = __esm({
|
|
|
11237
11327
|
metadata
|
|
11238
11328
|
}) => {
|
|
11239
11329
|
const extension = filename.split(".").pop();
|
|
11240
|
-
const fileBytes =
|
|
11330
|
+
const fileBytes = import_fs4.default.readFileSync(path5);
|
|
11241
11331
|
const objectStore = ObjectStore(bucketName);
|
|
11242
11332
|
await makeSureBucketExists(objectStore, bucketName);
|
|
11243
11333
|
let contentType = type;
|
|
@@ -11339,13 +11429,13 @@ var init_objectStore = __esm({
|
|
|
11339
11429
|
bucketName = sanitizeBucket(bucketName);
|
|
11340
11430
|
filepath = sanitizeKey(filepath);
|
|
11341
11431
|
const data2 = await retrieve(bucketName, filepath);
|
|
11342
|
-
const outputPath = (0,
|
|
11343
|
-
|
|
11432
|
+
const outputPath = (0, import_path3.join)(budibaseTempDir(), (0, import_uuid3.v4)());
|
|
11433
|
+
import_fs4.default.writeFileSync(outputPath, data2);
|
|
11344
11434
|
return outputPath;
|
|
11345
11435
|
};
|
|
11346
11436
|
retrieveDirectory = async (bucketName, path5) => {
|
|
11347
|
-
let writePath = (0,
|
|
11348
|
-
|
|
11437
|
+
let writePath = (0, import_path3.join)(budibaseTempDir(), (0, import_uuid3.v4)());
|
|
11438
|
+
import_fs4.default.mkdirSync(writePath);
|
|
11349
11439
|
const objects = await listAllObjects(bucketName, path5);
|
|
11350
11440
|
let fullObjects = await Promise.all(
|
|
11351
11441
|
objects.map((obj) => retrieve(bucketName, obj.Key))
|
|
@@ -11357,9 +11447,9 @@ var init_objectStore = __esm({
|
|
|
11357
11447
|
const possiblePath = filename.split("/");
|
|
11358
11448
|
if (possiblePath.length > 1) {
|
|
11359
11449
|
const dirs = possiblePath.slice(0, possiblePath.length - 1);
|
|
11360
|
-
|
|
11450
|
+
import_fs4.default.mkdirSync((0, import_path3.join)(writePath, ...dirs), { recursive: true });
|
|
11361
11451
|
}
|
|
11362
|
-
|
|
11452
|
+
import_fs4.default.writeFileSync((0, import_path3.join)(writePath, ...possiblePath), data2);
|
|
11363
11453
|
}
|
|
11364
11454
|
return writePath;
|
|
11365
11455
|
};
|
|
@@ -11413,14 +11503,14 @@ var init_objectStore = __esm({
|
|
|
11413
11503
|
uploadDirectory = async (bucketName, localPath, bucketPath) => {
|
|
11414
11504
|
bucketName = sanitizeBucket(bucketName);
|
|
11415
11505
|
let uploads = [];
|
|
11416
|
-
const files =
|
|
11506
|
+
const files = import_fs4.default.readdirSync(localPath, { withFileTypes: true });
|
|
11417
11507
|
for (let file of files) {
|
|
11418
|
-
const path5 = sanitizeKey((0,
|
|
11419
|
-
const local = (0,
|
|
11508
|
+
const path5 = sanitizeKey((0, import_path3.join)(bucketPath, file.name));
|
|
11509
|
+
const local = (0, import_path3.join)(localPath, file.name);
|
|
11420
11510
|
if (file.isDirectory()) {
|
|
11421
11511
|
uploads.push(uploadDirectory(bucketName, local, path5));
|
|
11422
11512
|
} else {
|
|
11423
|
-
uploads.push(streamUpload(bucketName, path5,
|
|
11513
|
+
uploads.push(streamUpload(bucketName, path5, import_fs4.default.createReadStream(local)));
|
|
11424
11514
|
}
|
|
11425
11515
|
}
|
|
11426
11516
|
await Promise.all(uploads);
|
|
@@ -11432,7 +11522,7 @@ var init_objectStore = __esm({
|
|
|
11432
11522
|
if (!response2.ok) {
|
|
11433
11523
|
throw new Error(`unexpected response ${response2.statusText}`);
|
|
11434
11524
|
}
|
|
11435
|
-
await streamPipeline(response2.body,
|
|
11525
|
+
await streamPipeline(response2.body, import_zlib2.default.createUnzip(), import_tar_fs.default.extract(path5));
|
|
11436
11526
|
};
|
|
11437
11527
|
downloadTarball = async (url, bucketName, path5) => {
|
|
11438
11528
|
bucketName = sanitizeBucket(bucketName);
|
|
@@ -11441,8 +11531,8 @@ var init_objectStore = __esm({
|
|
|
11441
11531
|
if (!response2.ok) {
|
|
11442
11532
|
throw new Error(`unexpected response ${response2.statusText}`);
|
|
11443
11533
|
}
|
|
11444
|
-
const tmpPath = (0,
|
|
11445
|
-
await streamPipeline(response2.body,
|
|
11534
|
+
const tmpPath = (0, import_path3.join)(budibaseTempDir(), path5);
|
|
11535
|
+
await streamPipeline(response2.body, import_zlib2.default.createUnzip(), import_tar_fs.default.extract(tmpPath));
|
|
11446
11536
|
if (!environment_default.isTest() && environment_default.SELF_HOSTED) {
|
|
11447
11537
|
await uploadDirectory(bucketName, tmpPath, path5);
|
|
11448
11538
|
}
|
|
@@ -12024,16 +12114,16 @@ var init_constants4 = __esm({
|
|
|
12024
12114
|
});
|
|
12025
12115
|
|
|
12026
12116
|
// src/utilities/centralPath.ts
|
|
12027
|
-
function
|
|
12028
|
-
return
|
|
12117
|
+
function join4(...args) {
|
|
12118
|
+
return import_path4.default.join(...args);
|
|
12029
12119
|
}
|
|
12030
12120
|
function resolve(...args) {
|
|
12031
|
-
return
|
|
12121
|
+
return import_path4.default.resolve(...args);
|
|
12032
12122
|
}
|
|
12033
|
-
var
|
|
12123
|
+
var import_path4;
|
|
12034
12124
|
var init_centralPath = __esm({
|
|
12035
12125
|
"src/utilities/centralPath.ts"() {
|
|
12036
|
-
|
|
12126
|
+
import_path4 = __toESM(require("path"));
|
|
12037
12127
|
}
|
|
12038
12128
|
});
|
|
12039
12129
|
|
|
@@ -12055,14 +12145,14 @@ function parseIntSafe(number) {
|
|
|
12055
12145
|
return parseInt(number);
|
|
12056
12146
|
}
|
|
12057
12147
|
}
|
|
12058
|
-
var
|
|
12148
|
+
var import_path5, LOADED2, environment2, environment_default2;
|
|
12059
12149
|
var init_environment3 = __esm({
|
|
12060
12150
|
"src/environment.ts"() {
|
|
12061
|
-
|
|
12151
|
+
import_path5 = require("path");
|
|
12062
12152
|
LOADED2 = false;
|
|
12063
12153
|
if (!LOADED2 && isDev2() && !isTest2()) {
|
|
12064
12154
|
require("dotenv").config({
|
|
12065
|
-
path: (0,
|
|
12155
|
+
path: (0, import_path5.join)(__dirname, "..", ".env")
|
|
12066
12156
|
});
|
|
12067
12157
|
LOADED2 = true;
|
|
12068
12158
|
}
|
|
@@ -12146,22 +12236,22 @@ var init_environment3 = __esm({
|
|
|
12146
12236
|
});
|
|
12147
12237
|
|
|
12148
12238
|
// src/utilities/fileSystem/filesystem.ts
|
|
12149
|
-
var
|
|
12239
|
+
var import_fs5, import_path6, import_tar, uuid2, TOP_LEVEL_PATH, init9, checkDevelopmentEnvironment, loadHandlebarsFile, apiFileReturn, streamFile, createTempFolder, extractTarball, findFileRec, deleteFolderFileSystem;
|
|
12150
12240
|
var init_filesystem = __esm({
|
|
12151
12241
|
"src/utilities/fileSystem/filesystem.ts"() {
|
|
12152
|
-
|
|
12242
|
+
import_fs5 = __toESM(require("fs"));
|
|
12153
12243
|
init_budibaseDir();
|
|
12154
|
-
|
|
12244
|
+
import_path6 = require("path");
|
|
12155
12245
|
init_environment3();
|
|
12156
12246
|
import_tar = __toESM(require("tar"));
|
|
12157
12247
|
init_environment3();
|
|
12158
12248
|
uuid2 = require("uuid/v4");
|
|
12159
|
-
TOP_LEVEL_PATH = environment_default2.TOP_LEVEL_PATH || (0,
|
|
12249
|
+
TOP_LEVEL_PATH = environment_default2.TOP_LEVEL_PATH || (0, import_path6.resolve)((0, import_path6.join)(__dirname, "..", "..", ".."));
|
|
12160
12250
|
init9 = () => {
|
|
12161
12251
|
const tempDir = budibaseTempDir2();
|
|
12162
|
-
if (!
|
|
12252
|
+
if (!import_fs5.default.existsSync(tempDir)) {
|
|
12163
12253
|
try {
|
|
12164
|
-
|
|
12254
|
+
import_fs5.default.mkdirSync(tempDir);
|
|
12165
12255
|
} catch (err) {
|
|
12166
12256
|
if (!err || err.code !== "EEXIST") {
|
|
12167
12257
|
throw err;
|
|
@@ -12173,11 +12263,11 @@ var init_filesystem = __esm({
|
|
|
12173
12263
|
if (!environment_default2.isDev() || environment_default2.isTest()) {
|
|
12174
12264
|
return;
|
|
12175
12265
|
}
|
|
12176
|
-
if (!
|
|
12177
|
-
|
|
12266
|
+
if (!import_fs5.default.existsSync(budibaseTempDir2())) {
|
|
12267
|
+
import_fs5.default.mkdirSync(budibaseTempDir2());
|
|
12178
12268
|
}
|
|
12179
12269
|
let error2;
|
|
12180
|
-
if (!
|
|
12270
|
+
if (!import_fs5.default.existsSync((0, import_path6.join)(process.cwd(), ".env"))) {
|
|
12181
12271
|
error2 = "Must run via yarn once to generate environment.";
|
|
12182
12272
|
}
|
|
12183
12273
|
if (error2) {
|
|
@@ -12186,23 +12276,23 @@ var init_filesystem = __esm({
|
|
|
12186
12276
|
}
|
|
12187
12277
|
};
|
|
12188
12278
|
loadHandlebarsFile = (path5) => {
|
|
12189
|
-
return
|
|
12279
|
+
return import_fs5.default.readFileSync(path5, "utf8");
|
|
12190
12280
|
};
|
|
12191
12281
|
apiFileReturn = (contents) => {
|
|
12192
|
-
const path5 = (0,
|
|
12193
|
-
|
|
12194
|
-
return
|
|
12282
|
+
const path5 = (0, import_path6.join)(budibaseTempDir2(), uuid2());
|
|
12283
|
+
import_fs5.default.writeFileSync(path5, contents);
|
|
12284
|
+
return import_fs5.default.createReadStream(path5);
|
|
12195
12285
|
};
|
|
12196
12286
|
streamFile = (path5) => {
|
|
12197
|
-
return
|
|
12287
|
+
return import_fs5.default.createReadStream(path5);
|
|
12198
12288
|
};
|
|
12199
12289
|
createTempFolder = (item) => {
|
|
12200
|
-
const path5 = (0,
|
|
12290
|
+
const path5 = (0, import_path6.join)(budibaseTempDir2(), item);
|
|
12201
12291
|
try {
|
|
12202
|
-
if (
|
|
12203
|
-
|
|
12292
|
+
if (import_fs5.default.existsSync(path5)) {
|
|
12293
|
+
import_fs5.default.rmSync(path5, { recursive: true, force: true });
|
|
12204
12294
|
}
|
|
12205
|
-
|
|
12295
|
+
import_fs5.default.mkdirSync(path5);
|
|
12206
12296
|
} catch (err) {
|
|
12207
12297
|
throw new Error(`Path cannot be created: ${err.message}`);
|
|
12208
12298
|
}
|
|
@@ -12215,13 +12305,13 @@ var init_filesystem = __esm({
|
|
|
12215
12305
|
});
|
|
12216
12306
|
};
|
|
12217
12307
|
findFileRec = (startPath, filter2) => {
|
|
12218
|
-
if (!
|
|
12308
|
+
if (!import_fs5.default.existsSync(startPath)) {
|
|
12219
12309
|
return;
|
|
12220
12310
|
}
|
|
12221
|
-
const files =
|
|
12311
|
+
const files = import_fs5.default.readdirSync(startPath);
|
|
12222
12312
|
for (let i = 0, len = files.length; i < len; i++) {
|
|
12223
|
-
const filename = (0,
|
|
12224
|
-
const stat =
|
|
12313
|
+
const filename = (0, import_path6.join)(startPath, files[i]);
|
|
12314
|
+
const stat = import_fs5.default.lstatSync(filename);
|
|
12225
12315
|
if (stat.isDirectory()) {
|
|
12226
12316
|
return findFileRec(filename, filter2);
|
|
12227
12317
|
} else if (filename.endsWith(filter2)) {
|
|
@@ -12230,10 +12320,10 @@ var init_filesystem = __esm({
|
|
|
12230
12320
|
}
|
|
12231
12321
|
};
|
|
12232
12322
|
deleteFolderFileSystem = (path5) => {
|
|
12233
|
-
if (!
|
|
12323
|
+
if (!import_fs5.default.existsSync(path5)) {
|
|
12234
12324
|
return;
|
|
12235
12325
|
}
|
|
12236
|
-
|
|
12326
|
+
import_fs5.default.rmSync(path5, { recursive: true, force: true });
|
|
12237
12327
|
};
|
|
12238
12328
|
}
|
|
12239
12329
|
});
|
|
@@ -12247,12 +12337,12 @@ async function backupClientLibrary(appId) {
|
|
|
12247
12337
|
try {
|
|
12248
12338
|
tmpManifestPath = await objectStore_exports2.retrieveToTmp(
|
|
12249
12339
|
ObjectStoreBuckets2.APPS,
|
|
12250
|
-
(0,
|
|
12340
|
+
(0, import_path7.join)(appId, "manifest.json")
|
|
12251
12341
|
);
|
|
12252
12342
|
} catch (error2) {
|
|
12253
12343
|
tmpManifestPath = await objectStore_exports2.retrieveToTmp(
|
|
12254
12344
|
ObjectStoreBuckets2.APPS,
|
|
12255
|
-
(0,
|
|
12345
|
+
(0, import_path7.join)(
|
|
12256
12346
|
appId,
|
|
12257
12347
|
"node_modules",
|
|
12258
12348
|
"budibase",
|
|
@@ -12264,17 +12354,17 @@ async function backupClientLibrary(appId) {
|
|
|
12264
12354
|
}
|
|
12265
12355
|
const tmpClientPath = await objectStore_exports2.retrieveToTmp(
|
|
12266
12356
|
ObjectStoreBuckets2.APPS,
|
|
12267
|
-
(0,
|
|
12357
|
+
(0, import_path7.join)(appId, "budibase-client.js")
|
|
12268
12358
|
);
|
|
12269
12359
|
const manifestUpload = objectStore_exports2.upload({
|
|
12270
12360
|
bucket: ObjectStoreBuckets2.APPS,
|
|
12271
|
-
filename: (0,
|
|
12361
|
+
filename: (0, import_path7.join)(appId, "manifest.json.bak"),
|
|
12272
12362
|
path: tmpManifestPath,
|
|
12273
12363
|
type: "application/json"
|
|
12274
12364
|
});
|
|
12275
12365
|
const clientUpload = objectStore_exports2.upload({
|
|
12276
12366
|
bucket: ObjectStoreBuckets2.APPS,
|
|
12277
|
-
filename: (0,
|
|
12367
|
+
filename: (0, import_path7.join)(appId, "budibase-client.js.bak"),
|
|
12278
12368
|
path: tmpClientPath,
|
|
12279
12369
|
type: "application/javascript"
|
|
12280
12370
|
});
|
|
@@ -12284,7 +12374,7 @@ async function updateClientLibrary(appId) {
|
|
|
12284
12374
|
let manifest, client3;
|
|
12285
12375
|
if (environment_default2.isDev()) {
|
|
12286
12376
|
const clientPath = devClientLibPath();
|
|
12287
|
-
manifest = (0,
|
|
12377
|
+
manifest = (0, import_path7.join)(import_path7.default.dirname(import_path7.default.dirname(clientPath)), "manifest.json");
|
|
12288
12378
|
client3 = clientPath;
|
|
12289
12379
|
} else {
|
|
12290
12380
|
manifest = resolve(TOP_LEVEL_PATH, "client", "manifest.json");
|
|
@@ -12292,16 +12382,16 @@ async function updateClientLibrary(appId) {
|
|
|
12292
12382
|
}
|
|
12293
12383
|
const manifestUpload = objectStore_exports2.streamUpload(
|
|
12294
12384
|
ObjectStoreBuckets2.APPS,
|
|
12295
|
-
(0,
|
|
12296
|
-
|
|
12385
|
+
(0, import_path7.join)(appId, "manifest.json"),
|
|
12386
|
+
import_fs6.default.createReadStream(manifest),
|
|
12297
12387
|
{
|
|
12298
12388
|
ContentType: "application/json"
|
|
12299
12389
|
}
|
|
12300
12390
|
);
|
|
12301
12391
|
const clientUpload = objectStore_exports2.streamUpload(
|
|
12302
12392
|
ObjectStoreBuckets2.APPS,
|
|
12303
|
-
(0,
|
|
12304
|
-
|
|
12393
|
+
(0, import_path7.join)(appId, "budibase-client.js"),
|
|
12394
|
+
import_fs6.default.createReadStream(client3),
|
|
12305
12395
|
{
|
|
12306
12396
|
ContentType: "application/javascript"
|
|
12307
12397
|
}
|
|
@@ -12311,32 +12401,32 @@ async function updateClientLibrary(appId) {
|
|
|
12311
12401
|
async function revertClientLibrary(appId) {
|
|
12312
12402
|
const tmpManifestPath = await objectStore_exports2.retrieveToTmp(
|
|
12313
12403
|
ObjectStoreBuckets2.APPS,
|
|
12314
|
-
(0,
|
|
12404
|
+
(0, import_path7.join)(appId, "manifest.json.bak")
|
|
12315
12405
|
);
|
|
12316
12406
|
const tmpClientPath = await objectStore_exports2.retrieveToTmp(
|
|
12317
12407
|
ObjectStoreBuckets2.APPS,
|
|
12318
|
-
(0,
|
|
12408
|
+
(0, import_path7.join)(appId, "budibase-client.js.bak")
|
|
12319
12409
|
);
|
|
12320
12410
|
const manifestUpload = objectStore_exports2.upload({
|
|
12321
12411
|
bucket: ObjectStoreBuckets2.APPS,
|
|
12322
|
-
filename: (0,
|
|
12412
|
+
filename: (0, import_path7.join)(appId, "manifest.json"),
|
|
12323
12413
|
path: tmpManifestPath,
|
|
12324
12414
|
type: "application/json"
|
|
12325
12415
|
});
|
|
12326
12416
|
const clientUpload = objectStore_exports2.upload({
|
|
12327
12417
|
bucket: ObjectStoreBuckets2.APPS,
|
|
12328
|
-
filename: (0,
|
|
12418
|
+
filename: (0, import_path7.join)(appId, "budibase-client.js"),
|
|
12329
12419
|
path: tmpClientPath,
|
|
12330
12420
|
type: "application/javascript"
|
|
12331
12421
|
});
|
|
12332
12422
|
await Promise.all([manifestUpload, clientUpload]);
|
|
12333
12423
|
}
|
|
12334
|
-
var
|
|
12424
|
+
var import_path7, import_fs6;
|
|
12335
12425
|
var init_clientLibrary = __esm({
|
|
12336
12426
|
"src/utilities/fileSystem/clientLibrary.ts"() {
|
|
12337
|
-
|
|
12427
|
+
import_path7 = __toESM(require("path"));
|
|
12338
12428
|
init_constants4();
|
|
12339
|
-
|
|
12429
|
+
import_fs6 = __toESM(require("fs"));
|
|
12340
12430
|
init_src2();
|
|
12341
12431
|
init_centralPath();
|
|
12342
12432
|
init_environment3();
|
|
@@ -12345,18 +12435,18 @@ var init_clientLibrary = __esm({
|
|
|
12345
12435
|
});
|
|
12346
12436
|
|
|
12347
12437
|
// src/utilities/fileSystem/app.ts
|
|
12348
|
-
var
|
|
12438
|
+
var import_fs7, import_path8, NODE_MODULES_PATH, createApp, deleteApp, getComponentLibraryManifest;
|
|
12349
12439
|
var init_app7 = __esm({
|
|
12350
12440
|
"src/utilities/fileSystem/app.ts"() {
|
|
12351
12441
|
init_budibaseDir();
|
|
12352
|
-
|
|
12353
|
-
|
|
12442
|
+
import_fs7 = __toESM(require("fs"));
|
|
12443
|
+
import_path8 = require("path");
|
|
12354
12444
|
init_constants4();
|
|
12355
12445
|
init_clientLibrary();
|
|
12356
12446
|
init_environment3();
|
|
12357
12447
|
init_src2();
|
|
12358
12448
|
init_filesystem();
|
|
12359
|
-
NODE_MODULES_PATH = (0,
|
|
12449
|
+
NODE_MODULES_PATH = (0, import_path8.join)(TOP_LEVEL_PATH, "node_modules");
|
|
12360
12450
|
createApp = async (appId) => {
|
|
12361
12451
|
await updateClientLibrary(appId);
|
|
12362
12452
|
};
|
|
@@ -12368,11 +12458,11 @@ var init_app7 = __esm({
|
|
|
12368
12458
|
const filename = "manifest.json";
|
|
12369
12459
|
if (environment_default2.isDev() || environment_default2.isTest()) {
|
|
12370
12460
|
const paths = [
|
|
12371
|
-
(0,
|
|
12372
|
-
(0,
|
|
12461
|
+
(0, import_path8.join)(TOP_LEVEL_PATH, "packages/client", filename),
|
|
12462
|
+
(0, import_path8.join)(process.cwd(), "client", filename)
|
|
12373
12463
|
];
|
|
12374
12464
|
for (let path6 of paths) {
|
|
12375
|
-
if (
|
|
12465
|
+
if (import_fs7.default.existsSync(path6)) {
|
|
12376
12466
|
delete require.cache[require.resolve(path6)];
|
|
12377
12467
|
return require(path6);
|
|
12378
12468
|
}
|
|
@@ -12387,14 +12477,14 @@ var init_app7 = __esm({
|
|
|
12387
12477
|
let resp;
|
|
12388
12478
|
let path5;
|
|
12389
12479
|
try {
|
|
12390
|
-
path5 = (0,
|
|
12480
|
+
path5 = (0, import_path8.join)(appId, filename);
|
|
12391
12481
|
resp = await objectStore_exports2.retrieve(ObjectStoreBuckets2.APPS, path5);
|
|
12392
12482
|
} catch (error2) {
|
|
12393
12483
|
console.error(
|
|
12394
12484
|
`component-manifest-objectstore=failed appId=${appId} path=${path5}`,
|
|
12395
12485
|
error2
|
|
12396
12486
|
);
|
|
12397
|
-
path5 = (0,
|
|
12487
|
+
path5 = (0, import_path8.join)(appId, "node_modules", library, "package", filename);
|
|
12398
12488
|
resp = await objectStore_exports2.retrieve(ObjectStoreBuckets2.APPS, path5);
|
|
12399
12489
|
}
|
|
12400
12490
|
if (typeof resp !== "string") {
|
|
@@ -12409,19 +12499,19 @@ var init_app7 = __esm({
|
|
|
12409
12499
|
async function getPluginImpl(path5, plugin) {
|
|
12410
12500
|
var _a2;
|
|
12411
12501
|
const hash2 = (_a2 = plugin.schema) == null ? void 0 : _a2.hash;
|
|
12412
|
-
if (!
|
|
12413
|
-
|
|
12502
|
+
if (!import_fs8.default.existsSync(path5)) {
|
|
12503
|
+
import_fs8.default.mkdirSync(path5);
|
|
12414
12504
|
}
|
|
12415
|
-
const filename = (0,
|
|
12505
|
+
const filename = (0, import_path9.join)(path5, plugin.name);
|
|
12416
12506
|
const metadataName = `${filename}.bbmetadata`;
|
|
12417
|
-
if (
|
|
12418
|
-
const currentHash =
|
|
12507
|
+
if (import_fs8.default.existsSync(filename)) {
|
|
12508
|
+
const currentHash = import_fs8.default.readFileSync(metadataName, "utf8");
|
|
12419
12509
|
if (currentHash === hash2) {
|
|
12420
12510
|
return require(filename);
|
|
12421
12511
|
} else {
|
|
12422
12512
|
console.log(`Updating plugin: ${plugin.name}`);
|
|
12423
12513
|
delete require.cache[require.resolve(filename)];
|
|
12424
|
-
|
|
12514
|
+
import_fs8.default.unlinkSync(filename);
|
|
12425
12515
|
}
|
|
12426
12516
|
}
|
|
12427
12517
|
const pluginKey = objectStore_exports2.getPluginJSKey(plugin);
|
|
@@ -12429,24 +12519,24 @@ async function getPluginImpl(path5, plugin) {
|
|
|
12429
12519
|
objectStore_exports2.ObjectStoreBuckets.PLUGINS,
|
|
12430
12520
|
pluginKey
|
|
12431
12521
|
);
|
|
12432
|
-
|
|
12433
|
-
|
|
12522
|
+
import_fs8.default.writeFileSync(filename, pluginJs);
|
|
12523
|
+
import_fs8.default.writeFileSync(metadataName, hash2);
|
|
12434
12524
|
return require(filename);
|
|
12435
12525
|
}
|
|
12436
|
-
var
|
|
12526
|
+
var import_fs8, import_path9, DATASOURCE_PATH, AUTOMATION_PATH, getPluginMetadata, getDatasourcePlugin, getAutomationPlugin;
|
|
12437
12527
|
var init_plugin5 = __esm({
|
|
12438
12528
|
"src/utilities/fileSystem/plugin.ts"() {
|
|
12439
12529
|
init_budibaseDir();
|
|
12440
|
-
|
|
12441
|
-
|
|
12530
|
+
import_fs8 = __toESM(require("fs"));
|
|
12531
|
+
import_path9 = require("path");
|
|
12442
12532
|
init_src2();
|
|
12443
|
-
DATASOURCE_PATH = (0,
|
|
12444
|
-
AUTOMATION_PATH = (0,
|
|
12533
|
+
DATASOURCE_PATH = (0, import_path9.join)(budibaseTempDir2(), "datasource");
|
|
12534
|
+
AUTOMATION_PATH = (0, import_path9.join)(budibaseTempDir2(), "automation");
|
|
12445
12535
|
getPluginMetadata = async (path5) => {
|
|
12446
12536
|
let metadata = {};
|
|
12447
12537
|
try {
|
|
12448
|
-
const pkg2 =
|
|
12449
|
-
const schema =
|
|
12538
|
+
const pkg2 = import_fs8.default.readFileSync((0, import_path9.join)(path5, "package.json"), "utf8");
|
|
12539
|
+
const schema = import_fs8.default.readFileSync((0, import_path9.join)(path5, "schema.json"), "utf8");
|
|
12450
12540
|
metadata.schema = JSON.parse(schema);
|
|
12451
12541
|
metadata.package = JSON.parse(pkg2);
|
|
12452
12542
|
if (!metadata.package.name || !metadata.package.version || !metadata.package.description) {
|
|
@@ -13714,21 +13804,21 @@ __export(version_exports, {
|
|
|
13714
13804
|
getLicenseVersion: () => getLicenseVersion,
|
|
13715
13805
|
getProVersion: () => getProVersion
|
|
13716
13806
|
});
|
|
13717
|
-
var
|
|
13807
|
+
var import_fs9, import_path10, getLicenseVersion, getProVersion;
|
|
13718
13808
|
var init_version2 = __esm({
|
|
13719
13809
|
"../pro/packages/pro/src/constants/version.ts"() {
|
|
13720
13810
|
init_src2();
|
|
13721
|
-
|
|
13722
|
-
|
|
13811
|
+
import_fs9 = __toESM(require("fs"));
|
|
13812
|
+
import_path10 = __toESM(require("path"));
|
|
13723
13813
|
getLicenseVersion = () => {
|
|
13724
13814
|
if (environment_default.isDev()) {
|
|
13725
13815
|
const DEV_VER_FILENAME = "dev-version.txt";
|
|
13726
|
-
const verFile =
|
|
13727
|
-
if (
|
|
13728
|
-
return
|
|
13816
|
+
const verFile = import_path10.default.join(objectStore_exports2.budibaseTempDir(), DEV_VER_FILENAME);
|
|
13817
|
+
if (import_fs9.default.existsSync(verFile)) {
|
|
13818
|
+
return import_fs9.default.readFileSync(verFile, "utf8");
|
|
13729
13819
|
} else {
|
|
13730
13820
|
const devVer = utils_exports2.newid();
|
|
13731
|
-
|
|
13821
|
+
import_fs9.default.writeFileSync(verFile, devVer);
|
|
13732
13822
|
return devVer;
|
|
13733
13823
|
}
|
|
13734
13824
|
} else {
|
|
@@ -14174,31 +14264,31 @@ function getOfflineLicense() {
|
|
|
14174
14264
|
}
|
|
14175
14265
|
}
|
|
14176
14266
|
function getOfflineLicenseFromDisk() {
|
|
14177
|
-
if (
|
|
14178
|
-
const token =
|
|
14267
|
+
if (import_fs10.default.existsSync(LICENSE_FILE_PATH)) {
|
|
14268
|
+
const token = import_fs10.default.readFileSync(LICENSE_FILE_PATH, { encoding: "utf-8" });
|
|
14179
14269
|
return import_jsonwebtoken.default.verify(token, PUBLIC_KEY, { algorithms: ["RS256"] });
|
|
14180
14270
|
}
|
|
14181
14271
|
}
|
|
14182
14272
|
function writeOfflineLicenseToDisk(signedLicense) {
|
|
14183
|
-
|
|
14273
|
+
import_fs10.default.writeFileSync(LICENSE_FILE_PATH, signedLicense, { encoding: "utf-8" });
|
|
14184
14274
|
}
|
|
14185
14275
|
function deleteOfflineLicense() {
|
|
14186
|
-
|
|
14276
|
+
import_fs10.default.rmSync(LICENSE_FILE_PATH, { force: true });
|
|
14187
14277
|
}
|
|
14188
|
-
var
|
|
14278
|
+
var import_fs10, import_path11, import_os2, import_jsonwebtoken, SUB_DIRECTORY, DIRECTORY, OFFLINE_LICENSE_FILE, LICENSE_FILE_PATH, PUBLIC_KEY;
|
|
14189
14279
|
var init_offline = __esm({
|
|
14190
14280
|
"../pro/packages/pro/src/sdk/licensing/licenses/offline.ts"() {
|
|
14191
|
-
|
|
14192
|
-
|
|
14281
|
+
import_fs10 = __toESM(require("fs"));
|
|
14282
|
+
import_path11 = require("path");
|
|
14193
14283
|
import_os2 = require("os");
|
|
14194
14284
|
import_jsonwebtoken = __toESM(require("jsonwebtoken"));
|
|
14195
14285
|
init_src2();
|
|
14196
14286
|
SUB_DIRECTORY = environment_default.isTest() ? ".budibase-test" : ".budibase";
|
|
14197
|
-
DIRECTORY = (0,
|
|
14287
|
+
DIRECTORY = (0, import_path11.join)((0, import_os2.tmpdir)(), SUB_DIRECTORY);
|
|
14198
14288
|
OFFLINE_LICENSE_FILE = "offline_license.txt";
|
|
14199
|
-
LICENSE_FILE_PATH = (0,
|
|
14200
|
-
if (!
|
|
14201
|
-
|
|
14289
|
+
LICENSE_FILE_PATH = (0, import_path11.join)(DIRECTORY, OFFLINE_LICENSE_FILE);
|
|
14290
|
+
if (!import_fs10.default.existsSync(DIRECTORY)) {
|
|
14291
|
+
import_fs10.default.mkdirSync(DIRECTORY);
|
|
14202
14292
|
}
|
|
14203
14293
|
PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvz3jePLCFBXZ19c8Dpkv\nXtSgOhKFOcvQdo/LV0KJRUzQWDPWuO4ILtBtnqhjtIzZH4CH0qCYBet5L6Qr4CM1\nl2HXiAD1Q2rlHNW9wDaYyKb1F5f+v4RyqCAyzlkwRdksmkLeECTboojNnmRCrE3C\n8suunQP5bEScqEY2kclqzSf8e6xqMzPUg3mL/pNa1iEv7TuLbU9nJfgR36l0WmZY\n94fWnSaT8OSXSqcxsaByf06gfS3HAoTJNc7eqz1Hf9fUORQGPUAnFK8cT3SfdA36\nd/o3ZWE1TTj1zYwlCLN5qRKr3hU8nC3xEYNEbkB9SfTRaOq9Q7P8WmfLkoCPm3pR\nmwIDAQAB\n-----END PUBLIC KEY-----\n";
|
|
14204
14294
|
}
|
|
@@ -15655,13 +15745,13 @@ var init_groups6 = __esm({
|
|
|
15655
15745
|
|
|
15656
15746
|
// ../pro/packages/pro/src/utilities/fileSystem.ts
|
|
15657
15747
|
function loadJSFile(directory, name) {
|
|
15658
|
-
return
|
|
15748
|
+
return import_fs11.default.readFileSync((0, import_path12.join)(directory, name), "utf8");
|
|
15659
15749
|
}
|
|
15660
|
-
var
|
|
15750
|
+
var import_fs11, import_path12;
|
|
15661
15751
|
var init_fileSystem2 = __esm({
|
|
15662
15752
|
"../pro/packages/pro/src/utilities/fileSystem.ts"() {
|
|
15663
|
-
|
|
15664
|
-
|
|
15753
|
+
import_fs11 = __toESM(require("fs"));
|
|
15754
|
+
import_path12 = require("path");
|
|
15665
15755
|
}
|
|
15666
15756
|
});
|
|
15667
15757
|
|
|
@@ -18629,8 +18719,8 @@ async function runBackup(trigger3, tenantId, appId, opts) {
|
|
|
18629
18719
|
}
|
|
18630
18720
|
});
|
|
18631
18721
|
await updateMetadata2("complete" /* COMPLETE */, { filename, contents });
|
|
18632
|
-
if (
|
|
18633
|
-
|
|
18722
|
+
if (import_fs12.default.existsSync(tarPath)) {
|
|
18723
|
+
import_fs12.default.rmSync(tarPath);
|
|
18634
18724
|
}
|
|
18635
18725
|
} catch (err) {
|
|
18636
18726
|
logging_exports.logAlert("App backup error", err);
|
|
@@ -18688,14 +18778,14 @@ async function exportProcessor(job, opts) {
|
|
|
18688
18778
|
});
|
|
18689
18779
|
});
|
|
18690
18780
|
}
|
|
18691
|
-
var
|
|
18781
|
+
var import_fs12;
|
|
18692
18782
|
var init_processing = __esm({
|
|
18693
18783
|
"../pro/packages/pro/src/sdk/backups/processing.ts"() {
|
|
18694
18784
|
init_src2();
|
|
18695
18785
|
init_backup5();
|
|
18696
18786
|
init_src();
|
|
18697
18787
|
init_queue4();
|
|
18698
|
-
|
|
18788
|
+
import_fs12 = __toESM(require("fs"));
|
|
18699
18789
|
}
|
|
18700
18790
|
});
|
|
18701
18791
|
|
|
@@ -19378,15 +19468,15 @@ async function downloadBackup(ctx) {
|
|
|
19378
19468
|
const backupId = ctx.params.backupId;
|
|
19379
19469
|
const { metadata, path: path5 } = await backups_default.downloadAppBackup(backupId);
|
|
19380
19470
|
ctx.attachment(`backup-${metadata.timestamp}.tar.gz`);
|
|
19381
|
-
ctx.body =
|
|
19471
|
+
ctx.body = import_fs13.default.createReadStream(path5);
|
|
19382
19472
|
}
|
|
19383
|
-
var
|
|
19473
|
+
var import_fs13;
|
|
19384
19474
|
var init_backups3 = __esm({
|
|
19385
19475
|
"../pro/packages/pro/src/api/controllers/apps/backups.ts"() {
|
|
19386
19476
|
init_src();
|
|
19387
19477
|
init_sdk2();
|
|
19388
19478
|
init_src2();
|
|
19389
|
-
|
|
19479
|
+
import_fs13 = __toESM(require("fs"));
|
|
19390
19480
|
}
|
|
19391
19481
|
});
|
|
19392
19482
|
|
|
@@ -20651,7 +20741,7 @@ var init_currentapp = __esm({
|
|
|
20651
20741
|
userId,
|
|
20652
20742
|
globalId,
|
|
20653
20743
|
roleId,
|
|
20654
|
-
role: await roles_exports.getRole(roleId)
|
|
20744
|
+
role: await roles_exports.getRole(roleId, { defaultPublic: true })
|
|
20655
20745
|
};
|
|
20656
20746
|
}
|
|
20657
20747
|
return next();
|
|
@@ -24946,13 +25036,14 @@ __export(exports_exports, {
|
|
|
24946
25036
|
streamExportApp: () => streamExportApp
|
|
24947
25037
|
});
|
|
24948
25038
|
function tarFilesToTmp(tmpDir, files) {
|
|
24949
|
-
const
|
|
24950
|
-
|
|
25039
|
+
const fileName = `${uuid3()}.tar.gz`;
|
|
25040
|
+
const exportFile = (0, import_path13.join)(budibaseTempDir2(), fileName);
|
|
25041
|
+
import_tar2.default.create(
|
|
24951
25042
|
{
|
|
24952
25043
|
sync: true,
|
|
24953
25044
|
gzip: true,
|
|
24954
25045
|
file: exportFile,
|
|
24955
|
-
|
|
25046
|
+
noDirRecurse: false,
|
|
24956
25047
|
cwd: tmpDir
|
|
24957
25048
|
},
|
|
24958
25049
|
files
|
|
@@ -24969,7 +25060,7 @@ async function exportDB(dbName, opts = {}) {
|
|
|
24969
25060
|
return db_exports.doWithDB(dbName, async (db2) => {
|
|
24970
25061
|
if (opts == null ? void 0 : opts.exportPath) {
|
|
24971
25062
|
const path5 = opts == null ? void 0 : opts.exportPath;
|
|
24972
|
-
const writeStream =
|
|
25063
|
+
const writeStream = import_fs14.default.createWriteStream(path5);
|
|
24973
25064
|
await db2.dump(writeStream, exportOpts);
|
|
24974
25065
|
return path5;
|
|
24975
25066
|
} else {
|
|
@@ -25002,9 +25093,9 @@ async function exportApp(appId, config) {
|
|
|
25002
25093
|
for (let path5 of STATIC_APP_FILES) {
|
|
25003
25094
|
const contents = await objectStore_exports2.retrieve(
|
|
25004
25095
|
ObjectStoreBuckets2.APPS,
|
|
25005
|
-
(0,
|
|
25096
|
+
(0, import_path13.join)(appPath, path5)
|
|
25006
25097
|
);
|
|
25007
|
-
|
|
25098
|
+
import_fs14.default.writeFileSync((0, import_path13.join)(tmpPath, path5), contents);
|
|
25008
25099
|
}
|
|
25009
25100
|
} else {
|
|
25010
25101
|
tmpPath = await objectStore_exports2.retrieveDirectory(
|
|
@@ -25013,37 +25104,52 @@ async function exportApp(appId, config) {
|
|
|
25013
25104
|
);
|
|
25014
25105
|
}
|
|
25015
25106
|
}
|
|
25016
|
-
const downloadedPath = (0,
|
|
25017
|
-
if (
|
|
25018
|
-
const allFiles =
|
|
25107
|
+
const downloadedPath = (0, import_path13.join)(tmpPath, appPath);
|
|
25108
|
+
if (import_fs14.default.existsSync(downloadedPath)) {
|
|
25109
|
+
const allFiles = import_fs14.default.readdirSync(downloadedPath);
|
|
25019
25110
|
for (let file of allFiles) {
|
|
25020
|
-
const path5 = (0,
|
|
25021
|
-
|
|
25111
|
+
const path5 = (0, import_path13.join)(downloadedPath, file);
|
|
25112
|
+
import_fs14.default.renameSync(path5, (0, import_path13.join)(downloadedPath, "..", file));
|
|
25022
25113
|
}
|
|
25023
|
-
|
|
25114
|
+
import_fs14.default.rmdirSync(downloadedPath);
|
|
25024
25115
|
}
|
|
25025
|
-
const dbPath = (0,
|
|
25116
|
+
const dbPath = (0, import_path13.join)(tmpPath, DB_EXPORT_FILE);
|
|
25026
25117
|
await exportDB(appId, {
|
|
25027
25118
|
filter: defineFilter(config == null ? void 0 : config.excludeRows, config == null ? void 0 : config.excludeLogs),
|
|
25028
25119
|
exportPath: dbPath
|
|
25029
25120
|
});
|
|
25121
|
+
if (config == null ? void 0 : config.encryptPassword) {
|
|
25122
|
+
for (let file of import_fs14.default.readdirSync(tmpPath)) {
|
|
25123
|
+
const path5 = (0, import_path13.join)(tmpPath, file);
|
|
25124
|
+
await encryption_exports.encryptFile(
|
|
25125
|
+
{ dir: tmpPath, filename: file },
|
|
25126
|
+
config.encryptPassword
|
|
25127
|
+
);
|
|
25128
|
+
import_fs14.default.rmSync(path5);
|
|
25129
|
+
}
|
|
25130
|
+
}
|
|
25030
25131
|
if (config == null ? void 0 : config.tar) {
|
|
25031
|
-
const tarPath = tarFilesToTmp(tmpPath,
|
|
25032
|
-
|
|
25132
|
+
const tarPath = tarFilesToTmp(tmpPath, import_fs14.default.readdirSync(tmpPath));
|
|
25133
|
+
import_fs14.default.rmSync(tmpPath, { recursive: true, force: true });
|
|
25033
25134
|
return tarPath;
|
|
25034
25135
|
} else {
|
|
25035
25136
|
return tmpPath;
|
|
25036
25137
|
}
|
|
25037
25138
|
}
|
|
25038
|
-
async function streamExportApp(
|
|
25139
|
+
async function streamExportApp({
|
|
25140
|
+
appId,
|
|
25141
|
+
excludeRows,
|
|
25142
|
+
encryptPassword
|
|
25143
|
+
}) {
|
|
25039
25144
|
const tmpPath = await exportApp(appId, {
|
|
25040
25145
|
excludeRows,
|
|
25041
25146
|
excludeLogs: true,
|
|
25042
|
-
tar: true
|
|
25147
|
+
tar: true,
|
|
25148
|
+
encryptPassword
|
|
25043
25149
|
});
|
|
25044
25150
|
return streamFile(tmpPath);
|
|
25045
25151
|
}
|
|
25046
|
-
var
|
|
25152
|
+
var import_fs14, import_path13, import_tar2, uuid3, MemoryStream2;
|
|
25047
25153
|
var init_exports2 = __esm({
|
|
25048
25154
|
"src/sdk/app/backups/exports.ts"() {
|
|
25049
25155
|
init_src2();
|
|
@@ -25052,11 +25158,11 @@ var init_exports2 = __esm({
|
|
|
25052
25158
|
init_constants4();
|
|
25053
25159
|
init_utils9();
|
|
25054
25160
|
init_constants7();
|
|
25055
|
-
|
|
25056
|
-
|
|
25161
|
+
import_fs14 = __toESM(require("fs"));
|
|
25162
|
+
import_path13 = require("path");
|
|
25057
25163
|
init_environment3();
|
|
25164
|
+
import_tar2 = __toESM(require("tar"));
|
|
25058
25165
|
uuid3 = require("uuid/v4");
|
|
25059
|
-
tar3 = require("tar");
|
|
25060
25166
|
MemoryStream2 = require("memorystream");
|
|
25061
25167
|
}
|
|
25062
25168
|
});
|
|
@@ -25133,16 +25239,16 @@ async function getTemplateStream(template) {
|
|
|
25133
25239
|
throw new Error("Cannot import a non-text based file.");
|
|
25134
25240
|
}
|
|
25135
25241
|
if (template.file) {
|
|
25136
|
-
return
|
|
25242
|
+
return import_fs15.default.createReadStream(template.file.path);
|
|
25137
25243
|
} else if (template.key) {
|
|
25138
25244
|
const [type, name] = template.key.split("/");
|
|
25139
25245
|
const tmpPath = await downloadTemplate(type, name);
|
|
25140
|
-
return
|
|
25246
|
+
return import_fs15.default.createReadStream((0, import_path14.join)(tmpPath, name, "db", "dump.txt"));
|
|
25141
25247
|
}
|
|
25142
25248
|
}
|
|
25143
25249
|
function untarFile(file) {
|
|
25144
|
-
const tmpPath = (0,
|
|
25145
|
-
|
|
25250
|
+
const tmpPath = (0, import_path14.join)(budibaseTempDir2(), uuid4());
|
|
25251
|
+
import_fs15.default.mkdirSync(tmpPath);
|
|
25146
25252
|
tar4.extract({
|
|
25147
25253
|
sync: true,
|
|
25148
25254
|
cwd: tmpPath,
|
|
@@ -25150,31 +25256,49 @@ function untarFile(file) {
|
|
|
25150
25256
|
});
|
|
25151
25257
|
return tmpPath;
|
|
25152
25258
|
}
|
|
25259
|
+
async function decryptFiles(path5, password) {
|
|
25260
|
+
try {
|
|
25261
|
+
for (let file of import_fs15.default.readdirSync(path5)) {
|
|
25262
|
+
const inputPath = (0, import_path14.join)(path5, file);
|
|
25263
|
+
const outputPath = inputPath.replace(/\.enc$/, "");
|
|
25264
|
+
await encryption_exports.decryptFile(inputPath, outputPath, password);
|
|
25265
|
+
import_fs15.default.rmSync(inputPath);
|
|
25266
|
+
}
|
|
25267
|
+
} catch (err) {
|
|
25268
|
+
if (err.message === "incorrect header check") {
|
|
25269
|
+
throw new Error("File cannot be imported");
|
|
25270
|
+
}
|
|
25271
|
+
throw err;
|
|
25272
|
+
}
|
|
25273
|
+
}
|
|
25153
25274
|
function getGlobalDBFile(tmpPath) {
|
|
25154
|
-
return
|
|
25275
|
+
return import_fs15.default.readFileSync((0, import_path14.join)(tmpPath, GLOBAL_DB_EXPORT_FILE), "utf8");
|
|
25155
25276
|
}
|
|
25156
25277
|
function getListOfAppsInMulti(tmpPath) {
|
|
25157
|
-
return
|
|
25278
|
+
return import_fs15.default.readdirSync(tmpPath).filter((dir) => dir !== GLOBAL_DB_EXPORT_FILE);
|
|
25158
25279
|
}
|
|
25159
25280
|
async function importApp(appId, db2, template) {
|
|
25160
25281
|
var _a2, _b2;
|
|
25161
25282
|
let prodAppId = db_exports.getProdAppID(appId);
|
|
25162
25283
|
let dbStream;
|
|
25163
25284
|
const isTar = template.file && ((_b2 = (_a2 = template == null ? void 0 : template.file) == null ? void 0 : _a2.type) == null ? void 0 : _b2.endsWith("gzip"));
|
|
25164
|
-
const isDirectory = template.file &&
|
|
25285
|
+
const isDirectory = template.file && import_fs15.default.lstatSync(template.file.path).isDirectory();
|
|
25165
25286
|
if (template.file && (isTar || isDirectory)) {
|
|
25166
25287
|
const tmpPath = isTar ? untarFile(template.file) : template.file.path;
|
|
25167
|
-
|
|
25288
|
+
if (isTar && template.file.password) {
|
|
25289
|
+
await decryptFiles(tmpPath, template.file.password);
|
|
25290
|
+
}
|
|
25291
|
+
const contents = import_fs15.default.readdirSync(tmpPath);
|
|
25168
25292
|
if (contents.length) {
|
|
25169
25293
|
let promises = [];
|
|
25170
25294
|
let excludedFiles = [GLOBAL_DB_EXPORT_FILE, DB_EXPORT_FILE];
|
|
25171
25295
|
for (let filename of contents) {
|
|
25172
|
-
const path5 = (0,
|
|
25296
|
+
const path5 = (0, import_path14.join)(tmpPath, filename);
|
|
25173
25297
|
if (excludedFiles.includes(filename)) {
|
|
25174
25298
|
continue;
|
|
25175
25299
|
}
|
|
25176
|
-
filename = (0,
|
|
25177
|
-
if (
|
|
25300
|
+
filename = (0, import_path14.join)(prodAppId, filename);
|
|
25301
|
+
if (import_fs15.default.lstatSync(path5).isDirectory()) {
|
|
25178
25302
|
promises.push(
|
|
25179
25303
|
objectStore_exports2.uploadDirectory(ObjectStoreBuckets2.APPS, path5, filename)
|
|
25180
25304
|
);
|
|
@@ -25190,7 +25314,7 @@ async function importApp(appId, db2, template) {
|
|
|
25190
25314
|
}
|
|
25191
25315
|
await Promise.all(promises);
|
|
25192
25316
|
}
|
|
25193
|
-
dbStream =
|
|
25317
|
+
dbStream = import_fs15.default.createReadStream((0, import_path14.join)(tmpPath, DB_EXPORT_FILE));
|
|
25194
25318
|
} else {
|
|
25195
25319
|
dbStream = await getTemplateStream(template);
|
|
25196
25320
|
}
|
|
@@ -25202,7 +25326,7 @@ async function importApp(appId, db2, template) {
|
|
|
25202
25326
|
await updateAutomations(prodAppId, db2);
|
|
25203
25327
|
return ok;
|
|
25204
25328
|
}
|
|
25205
|
-
var
|
|
25329
|
+
var import_path14, import_fs15, uuid4, tar4;
|
|
25206
25330
|
var init_imports = __esm({
|
|
25207
25331
|
"src/sdk/app/backups/imports.ts"() {
|
|
25208
25332
|
init_src2();
|
|
@@ -25211,8 +25335,8 @@ var init_imports = __esm({
|
|
|
25211
25335
|
init_constants7();
|
|
25212
25336
|
init_fileSystem();
|
|
25213
25337
|
init_constants4();
|
|
25214
|
-
|
|
25215
|
-
|
|
25338
|
+
import_path14 = require("path");
|
|
25339
|
+
import_fs15 = __toESM(require("fs"));
|
|
25216
25340
|
init_sdk3();
|
|
25217
25341
|
init_src();
|
|
25218
25342
|
uuid4 = require("uuid/v4");
|
|
@@ -41712,13 +41836,18 @@ var init_query6 = __esm({
|
|
|
41712
41836
|
// src/api/controllers/backup.ts
|
|
41713
41837
|
async function exportAppDump(ctx) {
|
|
41714
41838
|
const { appId } = ctx.query;
|
|
41715
|
-
const { excludeRows } = ctx.request.body;
|
|
41839
|
+
const { excludeRows, encryptPassword } = ctx.request.body;
|
|
41716
41840
|
const [app2] = await db_exports.getAppsByIDs([appId]);
|
|
41717
41841
|
const appName = app2.name;
|
|
41718
41842
|
ctx.req.setTimeout(0);
|
|
41719
|
-
const
|
|
41843
|
+
const extension = encryptPassword ? "enc.tar.gz" : "tar.gz";
|
|
41844
|
+
const backupIdentifier = `${appName}-export-${(/* @__PURE__ */ new Date()).getTime()}.${extension}`;
|
|
41720
41845
|
ctx.attachment(backupIdentifier);
|
|
41721
|
-
ctx.body = await sdk_default.backups.streamExportApp(
|
|
41846
|
+
ctx.body = await sdk_default.backups.streamExportApp({
|
|
41847
|
+
appId,
|
|
41848
|
+
excludeRows,
|
|
41849
|
+
encryptPassword
|
|
41850
|
+
});
|
|
41722
41851
|
await context_exports.doInAppContext(appId, async () => {
|
|
41723
41852
|
const appDb = context_exports.getAppDB();
|
|
41724
41853
|
const app3 = await appDb.get(DocumentType2.APP_METADATA);
|
|
@@ -43174,18 +43303,18 @@ async function npmUpload(url, name, headers = {}) {
|
|
|
43174
43303
|
}
|
|
43175
43304
|
try {
|
|
43176
43305
|
await extractTarball(tarballPluginFile, path5);
|
|
43177
|
-
deleteFolderFileSystem((0,
|
|
43306
|
+
deleteFolderFileSystem((0, import_path15.join)(path5, "package"));
|
|
43178
43307
|
} catch (err) {
|
|
43179
43308
|
throw new Error(err);
|
|
43180
43309
|
}
|
|
43181
43310
|
return await getPluginMetadata(path5);
|
|
43182
43311
|
}
|
|
43183
|
-
var import_node_fetch20,
|
|
43312
|
+
var import_node_fetch20, import_path15;
|
|
43184
43313
|
var init_npm = __esm({
|
|
43185
43314
|
"src/api/controllers/plugin/npm.ts"() {
|
|
43186
43315
|
init_fileSystem();
|
|
43187
43316
|
import_node_fetch20 = __toESM(require("node-fetch"));
|
|
43188
|
-
|
|
43317
|
+
import_path15 = require("path");
|
|
43189
43318
|
init_utils28();
|
|
43190
43319
|
}
|
|
43191
43320
|
});
|
|
@@ -43393,7 +43522,7 @@ async function prepareUpload({ s3Key, bucket, metadata, file }) {
|
|
|
43393
43522
|
key: response2.Key
|
|
43394
43523
|
};
|
|
43395
43524
|
}
|
|
43396
|
-
var import_string_templates10, import_aws_sdk4,
|
|
43525
|
+
var import_string_templates10, import_aws_sdk4, import_fs16, uuid5, send2, toggleBetaUiFeature, serveBuilder, uploadFile, deleteObjects, serveApp, serveBuilderPreview, serveClientLibrary, getSignedUploadURL;
|
|
43397
43526
|
var init_static = __esm({
|
|
43398
43527
|
"src/api/controllers/static/index.ts"() {
|
|
43399
43528
|
init_centralPath();
|
|
@@ -43404,7 +43533,7 @@ var init_static = __esm({
|
|
|
43404
43533
|
init_utils9();
|
|
43405
43534
|
init_src2();
|
|
43406
43535
|
import_aws_sdk4 = __toESM(require("aws-sdk"));
|
|
43407
|
-
|
|
43536
|
+
import_fs16 = __toESM(require("fs"));
|
|
43408
43537
|
init_sdk3();
|
|
43409
43538
|
init_src4();
|
|
43410
43539
|
require("svelte/register");
|
|
@@ -43419,9 +43548,9 @@ var init_static = __esm({
|
|
|
43419
43548
|
};
|
|
43420
43549
|
return;
|
|
43421
43550
|
}
|
|
43422
|
-
let builderPath =
|
|
43423
|
-
if (!
|
|
43424
|
-
|
|
43551
|
+
let builderPath = join4(TOP_LEVEL_PATH, "new_design_ui");
|
|
43552
|
+
if (!import_fs16.default.existsSync(builderPath)) {
|
|
43553
|
+
import_fs16.default.mkdirSync(builderPath);
|
|
43425
43554
|
}
|
|
43426
43555
|
await objectStore_exports2.downloadTarballDirect(
|
|
43427
43556
|
"https://cdn.budi.live/beta:design_ui/new_ui.tar.gz",
|
|
@@ -43433,7 +43562,7 @@ var init_static = __esm({
|
|
|
43433
43562
|
};
|
|
43434
43563
|
};
|
|
43435
43564
|
serveBuilder = async function(ctx) {
|
|
43436
|
-
const builderPath =
|
|
43565
|
+
const builderPath = join4(TOP_LEVEL_PATH, "builder");
|
|
43437
43566
|
await send2(ctx, ctx.file, { root: builderPath });
|
|
43438
43567
|
};
|
|
43439
43568
|
uploadFile = async function(ctx) {
|
|
@@ -43522,7 +43651,7 @@ var init_static = __esm({
|
|
|
43522
43651
|
};
|
|
43523
43652
|
serveClientLibrary = async function(ctx) {
|
|
43524
43653
|
return send2(ctx, "budibase-client.js", {
|
|
43525
|
-
root:
|
|
43654
|
+
root: join4(NODE_MODULES_PATH, "@budibase", "client", "dist")
|
|
43526
43655
|
});
|
|
43527
43656
|
};
|
|
43528
43657
|
getSignedUploadURL = async function(ctx) {
|
|
@@ -44842,13 +44971,13 @@ var init_routes = __esm({
|
|
|
44842
44971
|
});
|
|
44843
44972
|
|
|
44844
44973
|
// src/api/index.ts
|
|
44845
|
-
var import_router35,
|
|
44974
|
+
var import_router35, import_zlib3, compress, router35;
|
|
44846
44975
|
var init_api8 = __esm({
|
|
44847
44976
|
"src/api/index.ts"() {
|
|
44848
44977
|
import_router35 = __toESM(require("@koa/router"));
|
|
44849
44978
|
init_src2();
|
|
44850
44979
|
init_currentapp();
|
|
44851
|
-
|
|
44980
|
+
import_zlib3 = __toESM(require("zlib"));
|
|
44852
44981
|
init_routes();
|
|
44853
44982
|
init_src4();
|
|
44854
44983
|
init_public();
|
|
@@ -44861,10 +44990,10 @@ var init_api8 = __esm({
|
|
|
44861
44990
|
compress({
|
|
44862
44991
|
threshold: 2048,
|
|
44863
44992
|
gzip: {
|
|
44864
|
-
flush:
|
|
44993
|
+
flush: import_zlib3.default.constants.Z_SYNC_FLUSH
|
|
44865
44994
|
},
|
|
44866
44995
|
deflate: {
|
|
44867
|
-
flush:
|
|
44996
|
+
flush: import_zlib3.default.constants.Z_SYNC_FLUSH
|
|
44868
44997
|
},
|
|
44869
44998
|
br: false
|
|
44870
44999
|
})
|
|
@@ -44910,7 +45039,7 @@ var init_automations8 = __esm({
|
|
|
44910
45039
|
|
|
44911
45040
|
// src/watch.ts
|
|
44912
45041
|
function watch() {
|
|
44913
|
-
const watchPath =
|
|
45042
|
+
const watchPath = import_path16.default.join(environment_default2.PLUGINS_DIR, "./**/*.tar.gz");
|
|
44914
45043
|
import_chokidar.default.watch(watchPath, {
|
|
44915
45044
|
ignored: "**/node_modules",
|
|
44916
45045
|
awaitWriteFinish: {
|
|
@@ -44920,7 +45049,7 @@ function watch() {
|
|
|
44920
45049
|
usePolling: true,
|
|
44921
45050
|
interval: 250
|
|
44922
45051
|
}).on("all", async (event, path5) => {
|
|
44923
|
-
if (!(path5 == null ? void 0 : path5.endsWith(".tar.gz")) || !
|
|
45052
|
+
if (!(path5 == null ? void 0 : path5.endsWith(".tar.gz")) || !import_fs17.default.existsSync(path5)) {
|
|
44924
45053
|
return;
|
|
44925
45054
|
}
|
|
44926
45055
|
await tenancy.doInTenant(constants_exports.DEFAULT_TENANT_ID, async () => {
|
|
@@ -44936,13 +45065,13 @@ function watch() {
|
|
|
44936
45065
|
});
|
|
44937
45066
|
});
|
|
44938
45067
|
}
|
|
44939
|
-
var
|
|
45068
|
+
var import_path16, import_chokidar, import_fs17;
|
|
44940
45069
|
var init_watch = __esm({
|
|
44941
45070
|
"src/watch.ts"() {
|
|
44942
|
-
|
|
45071
|
+
import_path16 = __toESM(require("path"));
|
|
44943
45072
|
init_environment3();
|
|
44944
45073
|
import_chokidar = __toESM(require("chokidar"));
|
|
44945
|
-
|
|
45074
|
+
import_fs17 = __toESM(require("fs"));
|
|
44946
45075
|
init_src2();
|
|
44947
45076
|
init_plugins5();
|
|
44948
45077
|
}
|
|
@@ -44998,7 +45127,7 @@ async function startup(app2, server2) {
|
|
|
44998
45127
|
shutdown9(server2);
|
|
44999
45128
|
}
|
|
45000
45129
|
}
|
|
45001
|
-
if (environment_default2.SELF_HOSTED && !environment_default2.MULTI_TENANCY && environment_default2.PLUGINS_DIR &&
|
|
45130
|
+
if (environment_default2.SELF_HOSTED && !environment_default2.MULTI_TENANCY && environment_default2.PLUGINS_DIR && import_fs18.default.existsSync(environment_default2.PLUGINS_DIR)) {
|
|
45002
45131
|
watch();
|
|
45003
45132
|
}
|
|
45004
45133
|
await installation_exports.checkInstallVersion();
|
|
@@ -45033,14 +45162,14 @@ async function startup(app2, server2) {
|
|
|
45033
45162
|
}
|
|
45034
45163
|
}
|
|
45035
45164
|
}
|
|
45036
|
-
var
|
|
45165
|
+
var import_fs18, STARTUP_RAN;
|
|
45037
45166
|
var init_startup = __esm({
|
|
45038
45167
|
"src/startup.ts"() {
|
|
45039
45168
|
init_environment3();
|
|
45040
45169
|
init_redis4();
|
|
45041
45170
|
init_workerRequests();
|
|
45042
45171
|
init_src2();
|
|
45043
|
-
|
|
45172
|
+
import_fs18 = __toESM(require("fs"));
|
|
45044
45173
|
init_watch();
|
|
45045
45174
|
init_automations8();
|
|
45046
45175
|
init_fileSystem();
|