@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 CHANGED
@@ -5333,7 +5333,7 @@ var require_extend = __commonJS({
5333
5333
  }
5334
5334
  return toStr.call(arr) === "[object Array]";
5335
5335
  };
5336
- var isPlainObject = function isPlainObject2(obj) {
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 && (isPlainObject(copy) || (copyIsArray = isArray(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 && isPlainObject(src) ? 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 isError(e) {
29690
+ function isError2(e) {
29691
29691
  return objectToString(e) === "[object Error]" || e instanceof Error;
29692
29692
  }
29693
- exports.isError = 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(/[ \/#+\-&|!(){}\]^"~*?:\\]/g, "\\$&");
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
- let isPlainObject = function(obj) {
58318
- return typeof obj === "object" && obj !== null && !(obj instanceof Error);
58319
- }, isError = function(obj) {
58320
- return obj instanceof Error;
58321
- }, isMessage = function(obj) {
58322
- return typeof obj === "string";
58323
- }, getLogParams2 = function(args) {
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
- docWritethroughProcessorQueue: () => docWritethroughProcessorQueue,
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 docWritethroughProcessorQueue = createQueue(
64136
- "docWritethroughQueue" /* DOC_WRITETHROUGH_QUEUE */,
64137
- {
64138
- jobOptions: {
64139
- attempts: PERSIST_MAX_ATTEMPTS
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
- docWritethroughProcessorQueue.process(async (message) => {
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 docWritethroughProcessorQueue.add({
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, strict, route };
65078
+ return { regex: new RegExp(route), method, route };
65077
65079
  });
65078
65080
  };
65079
65081
  var matches = (ctx, options2) => {
65080
- return options2.find(({ regex, method, strict, route }) => {
65081
- let urlMatch;
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
  });