@budibase/backend-core 2.26.1 → 2.26.2
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/index.js
CHANGED
|
@@ -23213,7 +23213,7 @@ var require_ed_compat = __commonJS({
|
|
|
23213
23213
|
Signer
|
|
23214
23214
|
};
|
|
23215
23215
|
var nacl = require_nacl_fast();
|
|
23216
|
-
var
|
|
23216
|
+
var stream3 = require("stream");
|
|
23217
23217
|
var util = require("util");
|
|
23218
23218
|
var assert = require_assert();
|
|
23219
23219
|
var Buffer2 = require_safer().Buffer;
|
|
@@ -23223,9 +23223,9 @@ var require_ed_compat = __commonJS({
|
|
|
23223
23223
|
throw new Error("ED25519 only supports the use of SHA-512 hashes");
|
|
23224
23224
|
this.key = key;
|
|
23225
23225
|
this.chunks = [];
|
|
23226
|
-
|
|
23226
|
+
stream3.Writable.call(this, {});
|
|
23227
23227
|
}
|
|
23228
|
-
util.inherits(Verifier,
|
|
23228
|
+
util.inherits(Verifier, stream3.Writable);
|
|
23229
23229
|
Verifier.prototype._write = function(chunk, enc, cb) {
|
|
23230
23230
|
this.chunks.push(chunk);
|
|
23231
23231
|
cb();
|
|
@@ -23258,9 +23258,9 @@ var require_ed_compat = __commonJS({
|
|
|
23258
23258
|
throw new Error("ED25519 only supports the use of SHA-512 hashes");
|
|
23259
23259
|
this.key = key;
|
|
23260
23260
|
this.chunks = [];
|
|
23261
|
-
|
|
23261
|
+
stream3.Writable.call(this, {});
|
|
23262
23262
|
}
|
|
23263
|
-
util.inherits(Signer,
|
|
23263
|
+
util.inherits(Signer, stream3.Writable);
|
|
23264
23264
|
Signer.prototype._write = function(chunk, enc, cb) {
|
|
23265
23265
|
this.chunks.push(chunk);
|
|
23266
23266
|
cb();
|
|
@@ -29428,9 +29428,9 @@ var require_extsprintf = __commonJS({
|
|
|
29428
29428
|
args.unshift(process.stdout);
|
|
29429
29429
|
jsFprintf.apply(null, args);
|
|
29430
29430
|
}
|
|
29431
|
-
function jsFprintf(
|
|
29431
|
+
function jsFprintf(stream3) {
|
|
29432
29432
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
29433
|
-
return
|
|
29433
|
+
return stream3.write(jsSprintf.apply(this, args));
|
|
29434
29434
|
}
|
|
29435
29435
|
function doPad(chr, width, left, str) {
|
|
29436
29436
|
var ret = str;
|
|
@@ -29606,9 +29606,9 @@ var require_extsprintf2 = __commonJS({
|
|
|
29606
29606
|
args.unshift(process.stdout);
|
|
29607
29607
|
jsFprintf.apply(null, args);
|
|
29608
29608
|
}
|
|
29609
|
-
function jsFprintf(
|
|
29609
|
+
function jsFprintf(stream3) {
|
|
29610
29610
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
29611
|
-
return
|
|
29611
|
+
return stream3.write(jsSprintf.apply(this, args));
|
|
29612
29612
|
}
|
|
29613
29613
|
function doPad(chr, width, left, str) {
|
|
29614
29614
|
var ret = str;
|
|
@@ -40003,26 +40003,26 @@ var require_combined_stream = __commonJS({
|
|
|
40003
40003
|
}
|
|
40004
40004
|
return combinedStream;
|
|
40005
40005
|
};
|
|
40006
|
-
CombinedStream.isStreamLike = function(
|
|
40007
|
-
return typeof
|
|
40006
|
+
CombinedStream.isStreamLike = function(stream3) {
|
|
40007
|
+
return typeof stream3 !== "function" && typeof stream3 !== "string" && typeof stream3 !== "boolean" && typeof stream3 !== "number" && !Buffer.isBuffer(stream3);
|
|
40008
40008
|
};
|
|
40009
|
-
CombinedStream.prototype.append = function(
|
|
40010
|
-
var isStreamLike = CombinedStream.isStreamLike(
|
|
40009
|
+
CombinedStream.prototype.append = function(stream3) {
|
|
40010
|
+
var isStreamLike = CombinedStream.isStreamLike(stream3);
|
|
40011
40011
|
if (isStreamLike) {
|
|
40012
|
-
if (!(
|
|
40013
|
-
var newStream = DelayedStream.create(
|
|
40012
|
+
if (!(stream3 instanceof DelayedStream)) {
|
|
40013
|
+
var newStream = DelayedStream.create(stream3, {
|
|
40014
40014
|
maxDataSize: Infinity,
|
|
40015
40015
|
pauseStream: this.pauseStreams
|
|
40016
40016
|
});
|
|
40017
|
-
|
|
40018
|
-
|
|
40017
|
+
stream3.on("data", this._checkDataSize.bind(this));
|
|
40018
|
+
stream3 = newStream;
|
|
40019
40019
|
}
|
|
40020
|
-
this._handleErrors(
|
|
40020
|
+
this._handleErrors(stream3);
|
|
40021
40021
|
if (this.pauseStreams) {
|
|
40022
|
-
|
|
40022
|
+
stream3.pause();
|
|
40023
40023
|
}
|
|
40024
40024
|
}
|
|
40025
|
-
this._streams.push(
|
|
40025
|
+
this._streams.push(stream3);
|
|
40026
40026
|
return this;
|
|
40027
40027
|
};
|
|
40028
40028
|
CombinedStream.prototype.pipe = function(dest, options2) {
|
|
@@ -40047,40 +40047,40 @@ var require_combined_stream = __commonJS({
|
|
|
40047
40047
|
}
|
|
40048
40048
|
};
|
|
40049
40049
|
CombinedStream.prototype._realGetNext = function() {
|
|
40050
|
-
var
|
|
40051
|
-
if (typeof
|
|
40050
|
+
var stream3 = this._streams.shift();
|
|
40051
|
+
if (typeof stream3 == "undefined") {
|
|
40052
40052
|
this.end();
|
|
40053
40053
|
return;
|
|
40054
40054
|
}
|
|
40055
|
-
if (typeof
|
|
40056
|
-
this._pipeNext(
|
|
40055
|
+
if (typeof stream3 !== "function") {
|
|
40056
|
+
this._pipeNext(stream3);
|
|
40057
40057
|
return;
|
|
40058
40058
|
}
|
|
40059
|
-
var getStream =
|
|
40060
|
-
getStream(function(
|
|
40061
|
-
var isStreamLike = CombinedStream.isStreamLike(
|
|
40059
|
+
var getStream = stream3;
|
|
40060
|
+
getStream(function(stream4) {
|
|
40061
|
+
var isStreamLike = CombinedStream.isStreamLike(stream4);
|
|
40062
40062
|
if (isStreamLike) {
|
|
40063
|
-
|
|
40064
|
-
this._handleErrors(
|
|
40063
|
+
stream4.on("data", this._checkDataSize.bind(this));
|
|
40064
|
+
this._handleErrors(stream4);
|
|
40065
40065
|
}
|
|
40066
|
-
this._pipeNext(
|
|
40066
|
+
this._pipeNext(stream4);
|
|
40067
40067
|
}.bind(this));
|
|
40068
40068
|
};
|
|
40069
|
-
CombinedStream.prototype._pipeNext = function(
|
|
40070
|
-
this._currentStream =
|
|
40071
|
-
var isStreamLike = CombinedStream.isStreamLike(
|
|
40069
|
+
CombinedStream.prototype._pipeNext = function(stream3) {
|
|
40070
|
+
this._currentStream = stream3;
|
|
40071
|
+
var isStreamLike = CombinedStream.isStreamLike(stream3);
|
|
40072
40072
|
if (isStreamLike) {
|
|
40073
|
-
|
|
40074
|
-
|
|
40073
|
+
stream3.on("end", this._getNext.bind(this));
|
|
40074
|
+
stream3.pipe(this, { end: false });
|
|
40075
40075
|
return;
|
|
40076
40076
|
}
|
|
40077
|
-
var value =
|
|
40077
|
+
var value = stream3;
|
|
40078
40078
|
this.write(value);
|
|
40079
40079
|
this._getNext();
|
|
40080
40080
|
};
|
|
40081
|
-
CombinedStream.prototype._handleErrors = function(
|
|
40081
|
+
CombinedStream.prototype._handleErrors = function(stream3) {
|
|
40082
40082
|
var self2 = this;
|
|
40083
|
-
|
|
40083
|
+
stream3.on("error", function(err) {
|
|
40084
40084
|
self2._emitError(err);
|
|
40085
40085
|
});
|
|
40086
40086
|
};
|
|
@@ -40129,11 +40129,11 @@ var require_combined_stream = __commonJS({
|
|
|
40129
40129
|
CombinedStream.prototype._updateDataSize = function() {
|
|
40130
40130
|
this.dataSize = 0;
|
|
40131
40131
|
var self2 = this;
|
|
40132
|
-
this._streams.forEach(function(
|
|
40133
|
-
if (!
|
|
40132
|
+
this._streams.forEach(function(stream3) {
|
|
40133
|
+
if (!stream3.dataSize) {
|
|
40134
40134
|
return;
|
|
40135
40135
|
}
|
|
40136
|
-
self2.dataSize +=
|
|
40136
|
+
self2.dataSize += stream3.dataSize;
|
|
40137
40137
|
});
|
|
40138
40138
|
if (this._currentStream && this._currentStream.dataSize) {
|
|
40139
40139
|
this.dataSize += this._currentStream.dataSize;
|
|
@@ -40668,9 +40668,9 @@ var require_form_data = __commonJS({
|
|
|
40668
40668
|
var require_isstream = __commonJS({
|
|
40669
40669
|
"../../node_modules/isstream/isstream.js"(exports, module2) {
|
|
40670
40670
|
"use strict";
|
|
40671
|
-
var
|
|
40671
|
+
var stream3 = require("stream");
|
|
40672
40672
|
function isStream(obj) {
|
|
40673
|
-
return obj instanceof
|
|
40673
|
+
return obj instanceof stream3.Stream;
|
|
40674
40674
|
}
|
|
40675
40675
|
function isReadable(obj) {
|
|
40676
40676
|
return isStream(obj) && typeof obj._read == "function" && typeof obj._readableState == "object";
|
|
@@ -49896,7 +49896,7 @@ var require_request2 = __commonJS({
|
|
|
49896
49896
|
var https = require("https");
|
|
49897
49897
|
var url = require("url");
|
|
49898
49898
|
var util = require("util");
|
|
49899
|
-
var
|
|
49899
|
+
var stream3 = require("stream");
|
|
49900
49900
|
var zlib3 = require("zlib");
|
|
49901
49901
|
var aws2 = require_aws_sign2();
|
|
49902
49902
|
var aws4 = require_aws4();
|
|
@@ -49973,7 +49973,7 @@ var require_request2 = __commonJS({
|
|
|
49973
49973
|
self2._har = new Har(self2);
|
|
49974
49974
|
options2 = self2._har.options(options2);
|
|
49975
49975
|
}
|
|
49976
|
-
|
|
49976
|
+
stream3.Stream.call(self2);
|
|
49977
49977
|
var reserved = Object.keys(Request.prototype);
|
|
49978
49978
|
var nonReserved = filterForNonReserved(reserved, options2);
|
|
49979
49979
|
extend(self2, nonReserved);
|
|
@@ -49991,7 +49991,7 @@ var require_request2 = __commonJS({
|
|
|
49991
49991
|
self2._tunnel = new Tunnel(self2);
|
|
49992
49992
|
self2.init(options2);
|
|
49993
49993
|
}
|
|
49994
|
-
util.inherits(Request,
|
|
49994
|
+
util.inherits(Request, stream3.Stream);
|
|
49995
49995
|
Request.debug = process.env.NODE_DEBUG && /\brequest\b/.test(process.env.NODE_DEBUG);
|
|
49996
49996
|
function debug() {
|
|
49997
49997
|
if (Request.debug) {
|
|
@@ -51059,13 +51059,13 @@ var require_request2 = __commonJS({
|
|
|
51059
51059
|
} else if (self2._ended) {
|
|
51060
51060
|
self2.emit("error", new Error("You cannot pipe after the response has been ended."));
|
|
51061
51061
|
} else {
|
|
51062
|
-
|
|
51062
|
+
stream3.Stream.prototype.pipe.call(self2, dest, opts);
|
|
51063
51063
|
self2.pipeDest(dest);
|
|
51064
51064
|
return dest;
|
|
51065
51065
|
}
|
|
51066
51066
|
} else {
|
|
51067
51067
|
self2.dests.push(dest);
|
|
51068
|
-
|
|
51068
|
+
stream3.Stream.prototype.pipe.call(self2, dest, opts);
|
|
51069
51069
|
return dest;
|
|
51070
51070
|
}
|
|
51071
51071
|
};
|
|
@@ -56094,10 +56094,10 @@ var DDInstrumentedDatabase = class {
|
|
|
56094
56094
|
return this.db.compact();
|
|
56095
56095
|
});
|
|
56096
56096
|
}
|
|
56097
|
-
dump(
|
|
56097
|
+
dump(stream3, opts) {
|
|
56098
56098
|
return import_dd_trace.default.trace("db.dump", (span) => {
|
|
56099
56099
|
span?.addTags({ db_name: this.name });
|
|
56100
|
-
return this.db.dump(
|
|
56100
|
+
return this.db.dump(stream3, opts);
|
|
56101
56101
|
});
|
|
56102
56102
|
}
|
|
56103
56103
|
load(...args) {
|
|
@@ -56365,13 +56365,13 @@ var DatabaseImpl = class _DatabaseImpl {
|
|
|
56365
56365
|
}
|
|
56366
56366
|
// All below functions are in-frequently called, just utilise PouchDB
|
|
56367
56367
|
// for them as it implements them better than we can
|
|
56368
|
-
async dump(
|
|
56368
|
+
async dump(stream3, opts) {
|
|
56369
56369
|
const pouch = getPouchDB(this.name);
|
|
56370
|
-
return pouch.dump(
|
|
56370
|
+
return pouch.dump(stream3, opts);
|
|
56371
56371
|
}
|
|
56372
|
-
async load(
|
|
56372
|
+
async load(stream3) {
|
|
56373
56373
|
const pouch = getPouchDB(this.name);
|
|
56374
|
-
return pouch.load(
|
|
56374
|
+
return pouch.load(stream3);
|
|
56375
56375
|
}
|
|
56376
56376
|
async createIndex(opts) {
|
|
56377
56377
|
const pouch = getPouchDB(this.name);
|
|
@@ -56913,7 +56913,7 @@ __export(objectStore_exports2, {
|
|
|
56913
56913
|
|
|
56914
56914
|
// src/objectStore/objectStore.ts
|
|
56915
56915
|
var import_aws_sdk = __toESM(require("aws-sdk"));
|
|
56916
|
-
var
|
|
56916
|
+
var import_stream2 = __toESM(require("stream"));
|
|
56917
56917
|
var import_node_fetch3 = __toESM(require("node-fetch"));
|
|
56918
56918
|
var import_tar_fs = __toESM(require("tar-fs"));
|
|
56919
56919
|
var import_zlib = __toESM(require("zlib"));
|
|
@@ -56925,6 +56925,7 @@ var import_fs3 = __toESM(require("fs"));
|
|
|
56925
56925
|
var import_path = __toESM(require("path"));
|
|
56926
56926
|
var import_os = require("os");
|
|
56927
56927
|
var import_fs2 = __toESM(require("fs"));
|
|
56928
|
+
var import_stream = __toESM(require("stream"));
|
|
56928
56929
|
var ObjectStoreBuckets = {
|
|
56929
56930
|
BACKUPS: environment_default.BACKUPS_BUCKET_NAME,
|
|
56930
56931
|
APPS: environment_default.APPS_BUCKET_NAME,
|
|
@@ -56956,11 +56957,10 @@ var bucketTTLConfig = (bucketName, days) => {
|
|
|
56956
56957
|
const lifecycleConfiguration = {
|
|
56957
56958
|
Rules: [lifecycleRule]
|
|
56958
56959
|
};
|
|
56959
|
-
|
|
56960
|
+
return {
|
|
56960
56961
|
Bucket: bucketName,
|
|
56961
56962
|
LifecycleConfiguration: lifecycleConfiguration
|
|
56962
56963
|
};
|
|
56963
|
-
return params2;
|
|
56964
56964
|
};
|
|
56965
56965
|
async function processUrlAttachment(attachment) {
|
|
56966
56966
|
const response = await fetch(attachment.url);
|
|
@@ -56968,9 +56968,12 @@ async function processUrlAttachment(attachment) {
|
|
|
56968
56968
|
throw new Error(`Unexpected response ${response.statusText}`);
|
|
56969
56969
|
}
|
|
56970
56970
|
const fallbackFilename = import_path.default.basename(new URL(attachment.url).pathname);
|
|
56971
|
+
if (!response.body) {
|
|
56972
|
+
throw new Error("No response received for attachment");
|
|
56973
|
+
}
|
|
56971
56974
|
return {
|
|
56972
56975
|
filename: attachment.filename || fallbackFilename,
|
|
56973
|
-
content: response.body
|
|
56976
|
+
content: import_stream.default.Readable.fromWeb(response.body)
|
|
56974
56977
|
};
|
|
56975
56978
|
}
|
|
56976
56979
|
async function processObjectStoreAttachment(attachment) {
|
|
@@ -58313,7 +58316,7 @@ function isDocumentConflictError(error) {
|
|
|
58313
58316
|
// src/objectStore/objectStore.ts
|
|
58314
58317
|
var import_promises = __toESM(require("fs/promises"));
|
|
58315
58318
|
var sanitize = require("sanitize-s3-objectkey");
|
|
58316
|
-
var streamPipeline = (0, import_util.promisify)(
|
|
58319
|
+
var streamPipeline = (0, import_util.promisify)(import_stream2.default.pipeline);
|
|
58317
58320
|
var STATE = {
|
|
58318
58321
|
bucketCreationPromises: {}
|
|
58319
58322
|
};
|
|
@@ -58431,7 +58434,7 @@ async function upload({
|
|
|
58431
58434
|
}
|
|
58432
58435
|
async function streamUpload({
|
|
58433
58436
|
bucket: bucketName,
|
|
58434
|
-
stream:
|
|
58437
|
+
stream: stream3,
|
|
58435
58438
|
filename,
|
|
58436
58439
|
type,
|
|
58437
58440
|
extra,
|
|
@@ -58462,7 +58465,7 @@ async function streamUpload({
|
|
|
58462
58465
|
const params2 = {
|
|
58463
58466
|
Bucket: sanitizeBucket(bucketName),
|
|
58464
58467
|
Key: sanitizeKey(filename),
|
|
58465
|
-
Body:
|
|
58468
|
+
Body: stream3,
|
|
58466
58469
|
ContentType: contentType,
|
|
58467
58470
|
...extra
|
|
58468
58471
|
};
|
|
@@ -58541,7 +58544,7 @@ async function retrieveDirectory(bucketName, path3) {
|
|
|
58541
58544
|
const writePromises = [];
|
|
58542
58545
|
for (let obj of objects) {
|
|
58543
58546
|
const filename = obj.Key;
|
|
58544
|
-
const
|
|
58547
|
+
const stream3 = streams[count++];
|
|
58545
58548
|
const possiblePath = filename.split("/");
|
|
58546
58549
|
const dirs = possiblePath.slice(0, possiblePath.length - 1);
|
|
58547
58550
|
const possibleDir = (0, import_path2.join)(writePath, ...dirs);
|
|
@@ -58551,11 +58554,11 @@ async function retrieveDirectory(bucketName, path3) {
|
|
|
58551
58554
|
const writeStream = import_fs3.default.createWriteStream((0, import_path2.join)(writePath, ...possiblePath), {
|
|
58552
58555
|
mode: 420
|
|
58553
58556
|
});
|
|
58554
|
-
|
|
58557
|
+
stream3.pipe(writeStream);
|
|
58555
58558
|
writePromises.push(
|
|
58556
58559
|
new Promise((resolve, reject) => {
|
|
58557
|
-
|
|
58558
|
-
|
|
58560
|
+
stream3.on("finish", resolve);
|
|
58561
|
+
stream3.on("error", reject);
|
|
58559
58562
|
writeStream.on("error", reject);
|
|
58560
58563
|
})
|
|
58561
58564
|
);
|
|
@@ -59206,18 +59209,18 @@ function waitForConnection(selectDb = DEFAULT_SELECT_DB) {
|
|
|
59206
59209
|
}, 500);
|
|
59207
59210
|
});
|
|
59208
59211
|
}
|
|
59209
|
-
function promisifyStream(
|
|
59212
|
+
function promisifyStream(stream3, client) {
|
|
59210
59213
|
return new Promise((resolve, reject) => {
|
|
59211
59214
|
const outputKeys = /* @__PURE__ */ new Set();
|
|
59212
|
-
|
|
59215
|
+
stream3.on("data", (keys2) => {
|
|
59213
59216
|
keys2.forEach((key) => {
|
|
59214
59217
|
outputKeys.add(key);
|
|
59215
59218
|
});
|
|
59216
59219
|
});
|
|
59217
|
-
|
|
59220
|
+
stream3.on("error", (err) => {
|
|
59218
59221
|
reject(err);
|
|
59219
59222
|
});
|
|
59220
|
-
|
|
59223
|
+
stream3.on("end", async () => {
|
|
59221
59224
|
const keysArray = Array.from(outputKeys);
|
|
59222
59225
|
try {
|
|
59223
59226
|
let getPromises = [];
|
|
@@ -59261,17 +59264,17 @@ var RedisWrapper = class {
|
|
|
59261
59264
|
async scan(key = "") {
|
|
59262
59265
|
const db = this._db;
|
|
59263
59266
|
key = `${db}${SEPARATOR2}${key}`;
|
|
59264
|
-
let
|
|
59267
|
+
let stream3;
|
|
59265
59268
|
if (CLUSTERED) {
|
|
59266
59269
|
let node = this.getClient().nodes("master");
|
|
59267
|
-
|
|
59270
|
+
stream3 = node[0].scanStream({ match: key + "*", count: 100 });
|
|
59268
59271
|
} else {
|
|
59269
|
-
|
|
59272
|
+
stream3 = this.getClient().scanStream({
|
|
59270
59273
|
match: key + "*",
|
|
59271
59274
|
count: 100
|
|
59272
59275
|
});
|
|
59273
59276
|
}
|
|
59274
|
-
return promisifyStream(
|
|
59277
|
+
return promisifyStream(stream3, this.getClient());
|
|
59275
59278
|
}
|
|
59276
59279
|
async keys(pattern) {
|
|
59277
59280
|
const db = this._db;
|
|
@@ -65822,22 +65825,22 @@ async function decryptFile(inputPath, outputPath, secret) {
|
|
|
65822
65825
|
});
|
|
65823
65826
|
});
|
|
65824
65827
|
}
|
|
65825
|
-
function readBytes(
|
|
65828
|
+
function readBytes(stream3, length) {
|
|
65826
65829
|
return new Promise((resolve, reject) => {
|
|
65827
65830
|
let bytesRead = 0;
|
|
65828
65831
|
const data = [];
|
|
65829
|
-
|
|
65832
|
+
stream3.on("readable", () => {
|
|
65830
65833
|
let chunk;
|
|
65831
|
-
while ((chunk =
|
|
65834
|
+
while ((chunk = stream3.read(length - bytesRead)) !== null) {
|
|
65832
65835
|
data.push(chunk);
|
|
65833
65836
|
bytesRead += chunk.length;
|
|
65834
65837
|
}
|
|
65835
65838
|
resolve(Buffer.concat(data));
|
|
65836
65839
|
});
|
|
65837
|
-
|
|
65840
|
+
stream3.on("end", () => {
|
|
65838
65841
|
reject(new Error("Insufficient data in the stream."));
|
|
65839
65842
|
});
|
|
65840
|
-
|
|
65843
|
+
stream3.on("error", (error) => {
|
|
65841
65844
|
reject(error);
|
|
65842
65845
|
});
|
|
65843
65846
|
});
|