@budibase/backend-core 2.22.2 → 2.22.4
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 +67 -70
- package/dist/index.js.map +3 -3
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +4 -4
- package/dist/plugins.js.meta.json +1 -1
- package/dist/src/cache/docWritethrough.d.ts +4 -8
- package/dist/src/cache/docWritethrough.js +14 -8
- package/dist/src/cache/docWritethrough.js.map +1 -1
- package/dist/src/db/lucene.js +1 -1
- package/dist/src/db/lucene.js.map +1 -1
- package/dist/src/logging/pino/logger.js +11 -11
- package/dist/src/logging/pino/logger.js.map +1 -1
- package/dist/src/middleware/matchers.js +3 -10
- package/dist/src/middleware/matchers.js.map +1 -1
- package/dist/tests/core/utilities/structures/userGroups.js +1 -1
- package/package.json +4 -4
- package/src/auth/tests/auth.spec.ts +1 -1
- package/src/cache/docWritethrough.ts +19 -11
- package/src/cache/tests/docWritethrough.spec.ts +7 -6
- package/src/cache/tests/user.spec.ts +5 -5
- package/src/context/tests/index.spec.ts +1 -1
- package/src/db/lucene.ts +1 -1
- package/src/logging/pino/logger.ts +13 -13
- package/src/middleware/matchers.ts +3 -11
- package/src/middleware/passport/sso/tests/sso.spec.ts +6 -6
- package/src/middleware/tests/builder.spec.ts +3 -3
- package/src/middleware/tests/matchers.spec.ts +0 -34
- package/src/redis/tests/redis.spec.ts +1 -12
- package/src/redis/tests/redlockImpl.spec.ts +2 -2
- package/src/tenancy/tests/tenancy.spec.ts +2 -2
- package/tests/core/utilities/structures/userGroups.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -5333,7 +5333,7 @@ var require_extend = __commonJS({
|
|
|
5333
5333
|
}
|
|
5334
5334
|
return toStr.call(arr) === "[object Array]";
|
|
5335
5335
|
};
|
|
5336
|
-
var
|
|
5336
|
+
var isPlainObject2 = function isPlainObject3(obj) {
|
|
5337
5337
|
if (!obj || toStr.call(obj) !== "[object Object]") {
|
|
5338
5338
|
return false;
|
|
5339
5339
|
}
|
|
@@ -5390,12 +5390,12 @@ var require_extend = __commonJS({
|
|
|
5390
5390
|
src = getProperty(target, name);
|
|
5391
5391
|
copy = getProperty(options2, name);
|
|
5392
5392
|
if (target !== copy) {
|
|
5393
|
-
if (deep && copy && (
|
|
5393
|
+
if (deep && copy && (isPlainObject2(copy) || (copyIsArray = isArray(copy)))) {
|
|
5394
5394
|
if (copyIsArray) {
|
|
5395
5395
|
copyIsArray = false;
|
|
5396
5396
|
clone = src && isArray(src) ? src : [];
|
|
5397
5397
|
} else {
|
|
5398
|
-
clone = src &&
|
|
5398
|
+
clone = src && isPlainObject2(src) ? src : {};
|
|
5399
5399
|
}
|
|
5400
5400
|
setProperty(target, { name, newValue: extend(deep, clone, copy) });
|
|
5401
5401
|
} else if (typeof copy !== "undefined") {
|
|
@@ -29687,10 +29687,10 @@ var require_util = __commonJS({
|
|
|
29687
29687
|
return objectToString(d) === "[object Date]";
|
|
29688
29688
|
}
|
|
29689
29689
|
exports.isDate = isDate;
|
|
29690
|
-
function
|
|
29690
|
+
function isError2(e) {
|
|
29691
29691
|
return objectToString(e) === "[object Error]" || e instanceof Error;
|
|
29692
29692
|
}
|
|
29693
|
-
exports.isError =
|
|
29693
|
+
exports.isError = isError2;
|
|
29694
29694
|
function isFunction(arg) {
|
|
29695
29695
|
return typeof arg === "function";
|
|
29696
29696
|
}
|
|
@@ -57341,7 +57341,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
57341
57341
|
value = value.toLowerCase ? value.toLowerCase() : value;
|
|
57342
57342
|
}
|
|
57343
57343
|
if (!this.#noEscaping && escape && originalType === "string") {
|
|
57344
|
-
value = `${value}`.replace(/[
|
|
57344
|
+
value = `${value}`.replace(/[ /#+\-&|!(){}\]^"~*?:\\]/g, "\\$&");
|
|
57345
57345
|
}
|
|
57346
57346
|
if (originalType === "string" && !isNaN(value) && !type) {
|
|
57347
57347
|
value = `"${value}"`;
|
|
@@ -58312,15 +58312,51 @@ function getLogReadStream() {
|
|
|
58312
58312
|
}
|
|
58313
58313
|
|
|
58314
58314
|
// src/logging/pino/logger.ts
|
|
58315
|
+
function isPlainObject(obj) {
|
|
58316
|
+
return typeof obj === "object" && obj !== null && !(obj instanceof Error);
|
|
58317
|
+
}
|
|
58318
|
+
function isError(obj) {
|
|
58319
|
+
return obj instanceof Error;
|
|
58320
|
+
}
|
|
58321
|
+
function isMessage(obj) {
|
|
58322
|
+
return typeof obj === "string";
|
|
58323
|
+
}
|
|
58315
58324
|
var pinoInstance;
|
|
58316
58325
|
if (!environment_default.DISABLE_PINO_LOGGER) {
|
|
58317
|
-
|
|
58318
|
-
|
|
58319
|
-
|
|
58320
|
-
|
|
58321
|
-
|
|
58322
|
-
|
|
58323
|
-
|
|
58326
|
+
const level = environment_default.LOG_LEVEL;
|
|
58327
|
+
const pinoOptions = {
|
|
58328
|
+
level,
|
|
58329
|
+
formatters: {
|
|
58330
|
+
level: (level2) => {
|
|
58331
|
+
return { level: level2.toUpperCase() };
|
|
58332
|
+
},
|
|
58333
|
+
bindings: () => {
|
|
58334
|
+
if (environment_default.SELF_HOSTED) {
|
|
58335
|
+
return {
|
|
58336
|
+
service: environment_default.SERVICE_NAME
|
|
58337
|
+
};
|
|
58338
|
+
} else {
|
|
58339
|
+
return {};
|
|
58340
|
+
}
|
|
58341
|
+
}
|
|
58342
|
+
},
|
|
58343
|
+
timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`
|
|
58344
|
+
};
|
|
58345
|
+
const destinations = [];
|
|
58346
|
+
destinations.push(
|
|
58347
|
+
environment_default.isDev() ? {
|
|
58348
|
+
stream: (0, import_pino_pretty.default)({ singleLine: true }),
|
|
58349
|
+
level
|
|
58350
|
+
} : { stream: process.stdout, level }
|
|
58351
|
+
);
|
|
58352
|
+
if (environment_default.SELF_HOSTED) {
|
|
58353
|
+
destinations.push({
|
|
58354
|
+
stream: localFileDestination(),
|
|
58355
|
+
level
|
|
58356
|
+
});
|
|
58357
|
+
}
|
|
58358
|
+
pinoInstance = destinations.length ? (0, import_pino.default)(pinoOptions, import_pino.default.multistream(destinations)) : (0, import_pino.default)(pinoOptions);
|
|
58359
|
+
const getLogParams2 = (args) => {
|
|
58324
58360
|
let error = void 0;
|
|
58325
58361
|
let objects = [];
|
|
58326
58362
|
let message = "";
|
|
@@ -58374,40 +58410,6 @@ if (!environment_default.DISABLE_PINO_LOGGER) {
|
|
|
58374
58410
|
}
|
|
58375
58411
|
return [mergingObject, message];
|
|
58376
58412
|
};
|
|
58377
|
-
isPlainObject2 = isPlainObject, isError2 = isError, isMessage2 = isMessage, getLogParams3 = getLogParams2;
|
|
58378
|
-
const level = environment_default.LOG_LEVEL;
|
|
58379
|
-
const pinoOptions = {
|
|
58380
|
-
level,
|
|
58381
|
-
formatters: {
|
|
58382
|
-
level: (level2) => {
|
|
58383
|
-
return { level: level2.toUpperCase() };
|
|
58384
|
-
},
|
|
58385
|
-
bindings: () => {
|
|
58386
|
-
if (environment_default.SELF_HOSTED) {
|
|
58387
|
-
return {
|
|
58388
|
-
service: environment_default.SERVICE_NAME
|
|
58389
|
-
};
|
|
58390
|
-
} else {
|
|
58391
|
-
return {};
|
|
58392
|
-
}
|
|
58393
|
-
}
|
|
58394
|
-
},
|
|
58395
|
-
timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`
|
|
58396
|
-
};
|
|
58397
|
-
const destinations = [];
|
|
58398
|
-
destinations.push(
|
|
58399
|
-
environment_default.isDev() ? {
|
|
58400
|
-
stream: (0, import_pino_pretty.default)({ singleLine: true }),
|
|
58401
|
-
level
|
|
58402
|
-
} : { stream: process.stdout, level }
|
|
58403
|
-
);
|
|
58404
|
-
if (environment_default.SELF_HOSTED) {
|
|
58405
|
-
destinations.push({
|
|
58406
|
-
stream: localFileDestination(),
|
|
58407
|
-
level
|
|
58408
|
-
});
|
|
58409
|
-
}
|
|
58410
|
-
pinoInstance = destinations.length ? (0, import_pino.default)(pinoOptions, import_pino.default.multistream(destinations)) : (0, import_pino.default)(pinoOptions);
|
|
58411
58413
|
console.log = (...arg) => {
|
|
58412
58414
|
const [obj, msg] = getLogParams2(arg);
|
|
58413
58415
|
pinoInstance?.info(obj, msg);
|
|
@@ -58468,10 +58470,6 @@ if (!environment_default.DISABLE_PINO_LOGGER) {
|
|
|
58468
58470
|
return identity;
|
|
58469
58471
|
};
|
|
58470
58472
|
}
|
|
58471
|
-
var isPlainObject2;
|
|
58472
|
-
var isError2;
|
|
58473
|
-
var isMessage2;
|
|
58474
|
-
var getLogParams3;
|
|
58475
58473
|
var logger = pinoInstance;
|
|
58476
58474
|
|
|
58477
58475
|
// src/logging/alerts.ts
|
|
@@ -64126,23 +64124,28 @@ async function invalidateCode(code) {
|
|
|
64126
64124
|
var docWritethrough_exports = {};
|
|
64127
64125
|
__export(docWritethrough_exports, {
|
|
64128
64126
|
DocWritethrough: () => DocWritethrough,
|
|
64129
|
-
|
|
64127
|
+
DocWritethroughProcessor: () => DocWritethroughProcessor,
|
|
64130
64128
|
getProcessor: () => getProcessor,
|
|
64131
64129
|
init: () => init7
|
|
64132
64130
|
});
|
|
64133
64131
|
var PERSIST_MAX_ATTEMPTS = 100;
|
|
64134
64132
|
var processor;
|
|
64135
|
-
var
|
|
64136
|
-
|
|
64137
|
-
|
|
64138
|
-
|
|
64139
|
-
|
|
64133
|
+
var DocWritethroughProcessor = class _DocWritethroughProcessor {
|
|
64134
|
+
static get queue() {
|
|
64135
|
+
if (!_DocWritethroughProcessor._queue) {
|
|
64136
|
+
_DocWritethroughProcessor._queue = createQueue(
|
|
64137
|
+
"docWritethroughQueue" /* DOC_WRITETHROUGH_QUEUE */,
|
|
64138
|
+
{
|
|
64139
|
+
jobOptions: {
|
|
64140
|
+
attempts: PERSIST_MAX_ATTEMPTS
|
|
64141
|
+
}
|
|
64142
|
+
}
|
|
64143
|
+
);
|
|
64140
64144
|
}
|
|
64145
|
+
return _DocWritethroughProcessor._queue;
|
|
64141
64146
|
}
|
|
64142
|
-
);
|
|
64143
|
-
var DocWritethroughProcessor = class {
|
|
64144
64147
|
init() {
|
|
64145
|
-
|
|
64148
|
+
_DocWritethroughProcessor.queue.process(async (message) => {
|
|
64146
64149
|
try {
|
|
64147
64150
|
await this.persistToDb(message.data);
|
|
64148
64151
|
} catch (err) {
|
|
@@ -64181,7 +64184,7 @@ var DocWritethrough = class {
|
|
|
64181
64184
|
return this._docId;
|
|
64182
64185
|
}
|
|
64183
64186
|
async patch(data) {
|
|
64184
|
-
await
|
|
64187
|
+
await DocWritethroughProcessor.queue.add({
|
|
64185
64188
|
dbName: this.db.name,
|
|
64186
64189
|
docId: this.docId,
|
|
64187
64190
|
data
|
|
@@ -65064,7 +65067,6 @@ var buildMatcherRegex = (patterns) => {
|
|
|
65064
65067
|
return patterns.map((pattern) => {
|
|
65065
65068
|
let route = pattern.route;
|
|
65066
65069
|
const method = pattern.method;
|
|
65067
|
-
const strict = pattern.strict ? pattern.strict : false;
|
|
65068
65070
|
const matches2 = route.match(PARAM_REGEX);
|
|
65069
65071
|
if (matches2) {
|
|
65070
65072
|
for (let match of matches2) {
|
|
@@ -65073,17 +65075,12 @@ var buildMatcherRegex = (patterns) => {
|
|
|
65073
65075
|
route = route.replace(match, pattern2);
|
|
65074
65076
|
}
|
|
65075
65077
|
}
|
|
65076
|
-
return { regex: new RegExp(route), method,
|
|
65078
|
+
return { regex: new RegExp(route), method, route };
|
|
65077
65079
|
});
|
|
65078
65080
|
};
|
|
65079
65081
|
var matches = (ctx, options2) => {
|
|
65080
|
-
return options2.find(({ regex, method,
|
|
65081
|
-
|
|
65082
|
-
if (strict) {
|
|
65083
|
-
urlMatch = ctx.request.url === route;
|
|
65084
|
-
} else {
|
|
65085
|
-
urlMatch = regex.test(ctx.request.url);
|
|
65086
|
-
}
|
|
65082
|
+
return options2.find(({ regex, method, route }) => {
|
|
65083
|
+
const urlMatch = regex.test(ctx.request.url);
|
|
65087
65084
|
const methodMatch = method === "ALL" ? true : ctx.request.method.toLowerCase() === method.toLowerCase();
|
|
65088
65085
|
return urlMatch && methodMatch;
|
|
65089
65086
|
});
|