@budibase/backend-core 2.24.2 → 2.26.0

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
@@ -919,13 +919,13 @@ var require_locale = __commonJS({
919
919
  oneOf: "${path} must be one of the following values: ${values}",
920
920
  notOneOf: "${path} must not be one of the following values: ${values}",
921
921
  notType: ({
922
- path: path2,
922
+ path: path3,
923
923
  type,
924
924
  value,
925
925
  originalValue
926
926
  }) => {
927
927
  let isCast = originalValue != null && originalValue !== value;
928
- let msg = `${path2} must be a \`${type}\` type, but the final value was: \`${(0, _printValue.default)(value, true)}\`` + (isCast ? ` (cast from the value \`${(0, _printValue.default)(originalValue, true)}\`).` : ".");
928
+ let msg = `${path3} must be a \`${type}\` type, but the final value was: \`${(0, _printValue.default)(value, true)}\`` + (isCast ? ` (cast from the value \`${(0, _printValue.default)(originalValue, true)}\`).` : ".");
929
929
  if (value === null) {
930
930
  msg += `
931
931
  If "null" is intended as an empty value be sure to mark the schema as \`.nullable()\``;
@@ -1104,10 +1104,10 @@ var require_ValidationError = __commonJS({
1104
1104
  var strReg = /\$\{\s*(\w+)\s*\}/g;
1105
1105
  var ValidationError = class _ValidationError extends Error {
1106
1106
  static formatError(message, params2) {
1107
- const path2 = params2.label || params2.path || "this";
1108
- if (path2 !== params2.path)
1107
+ const path3 = params2.label || params2.path || "this";
1108
+ if (path3 !== params2.path)
1109
1109
  params2 = _extends({}, params2, {
1110
- path: path2
1110
+ path: path3
1111
1111
  });
1112
1112
  if (typeof message === "string")
1113
1113
  return message.replace(strReg, (_2, key) => (0, _printValue.default)(params2[key]));
@@ -1172,14 +1172,14 @@ var require_runTests = __commonJS({
1172
1172
  value,
1173
1173
  errors,
1174
1174
  sort,
1175
- path: path2
1175
+ path: path3
1176
1176
  } = options2;
1177
1177
  let callback = once(cb);
1178
1178
  let count = tests.length;
1179
1179
  const nestedErrors = [];
1180
1180
  errors = errors ? errors : [];
1181
1181
  if (!count)
1182
- return errors.length ? callback(new _ValidationError.default(errors, value, path2)) : callback(null, value);
1182
+ return errors.length ? callback(new _ValidationError.default(errors, value, path3)) : callback(null, value);
1183
1183
  for (let i = 0; i < tests.length; i++) {
1184
1184
  const test = tests[i];
1185
1185
  test(args, function finishTestRun(err) {
@@ -1202,7 +1202,7 @@ var require_runTests = __commonJS({
1202
1202
  errors = nestedErrors;
1203
1203
  }
1204
1204
  if (errors.length) {
1205
- callback(new _ValidationError.default(errors, value, path2), value);
1205
+ callback(new _ValidationError.default(errors, value, path3), value);
1206
1206
  return;
1207
1207
  }
1208
1208
  callback(null, value);
@@ -1247,9 +1247,9 @@ var require_property_expr = __commonJS({
1247
1247
  Cache,
1248
1248
  split,
1249
1249
  normalizePath,
1250
- setter: function(path2) {
1251
- var parts = normalizePath(path2);
1252
- return setCache.get(path2) || setCache.set(path2, function setter(obj, value) {
1250
+ setter: function(path3) {
1251
+ var parts = normalizePath(path3);
1252
+ return setCache.get(path3) || setCache.set(path3, function setter(obj, value) {
1253
1253
  var index2 = 0;
1254
1254
  var len = parts.length;
1255
1255
  var data = obj;
@@ -1263,9 +1263,9 @@ var require_property_expr = __commonJS({
1263
1263
  data[parts[index2]] = value;
1264
1264
  });
1265
1265
  },
1266
- getter: function(path2, safe) {
1267
- var parts = normalizePath(path2);
1268
- return getCache2.get(path2) || getCache2.set(path2, function getter(data) {
1266
+ getter: function(path3, safe) {
1267
+ var parts = normalizePath(path3);
1268
+ return getCache2.get(path3) || getCache2.set(path3, function getter(data) {
1269
1269
  var index2 = 0, len = parts.length;
1270
1270
  while (index2 < len) {
1271
1271
  if (data != null || !safe)
@@ -1277,24 +1277,24 @@ var require_property_expr = __commonJS({
1277
1277
  });
1278
1278
  },
1279
1279
  join: function(segments) {
1280
- return segments.reduce(function(path2, part) {
1281
- return path2 + (isQuoted(part) || DIGIT_REGEX.test(part) ? "[" + part + "]" : (path2 ? "." : "") + part);
1280
+ return segments.reduce(function(path3, part) {
1281
+ return path3 + (isQuoted(part) || DIGIT_REGEX.test(part) ? "[" + part + "]" : (path3 ? "." : "") + part);
1282
1282
  }, "");
1283
1283
  },
1284
- forEach: function(path2, cb, thisArg) {
1285
- forEach(Array.isArray(path2) ? path2 : split(path2), cb, thisArg);
1284
+ forEach: function(path3, cb, thisArg) {
1285
+ forEach(Array.isArray(path3) ? path3 : split(path3), cb, thisArg);
1286
1286
  }
1287
1287
  };
1288
- function normalizePath(path2) {
1289
- return pathCache.get(path2) || pathCache.set(
1290
- path2,
1291
- split(path2).map(function(part) {
1288
+ function normalizePath(path3) {
1289
+ return pathCache.get(path3) || pathCache.set(
1290
+ path3,
1291
+ split(path3).map(function(part) {
1292
1292
  return part.replace(CLEAN_QUOTES_REGEX, "$2");
1293
1293
  })
1294
1294
  );
1295
1295
  }
1296
- function split(path2) {
1297
- return path2.match(SPLIT_REGEX) || [""];
1296
+ function split(path3) {
1297
+ return path3.match(SPLIT_REGEX) || [""];
1298
1298
  }
1299
1299
  function forEach(parts, iter, thisArg) {
1300
1300
  var len = parts.length, part, idx, isArray, isBracket;
@@ -1442,7 +1442,7 @@ var require_createValidation = __commonJS({
1442
1442
  function validate3(_ref, cb) {
1443
1443
  let {
1444
1444
  value,
1445
- path: path2 = "",
1445
+ path: path3 = "",
1446
1446
  label,
1447
1447
  options: options2,
1448
1448
  originalValue,
@@ -1466,14 +1466,14 @@ var require_createValidation = __commonJS({
1466
1466
  value,
1467
1467
  originalValue,
1468
1468
  label,
1469
- path: overrides.path || path2
1469
+ path: overrides.path || path3
1470
1470
  }, params2, overrides.params), resolve);
1471
1471
  const error = new _ValidationError.default(_ValidationError.default.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name);
1472
1472
  error.params = nextParams;
1473
1473
  return error;
1474
1474
  }
1475
1475
  let ctx = _extends({
1476
- path: path2,
1476
+ path: path3,
1477
1477
  parent,
1478
1478
  type: name,
1479
1479
  createError,
@@ -1531,15 +1531,15 @@ var require_reach = __commonJS({
1531
1531
  exports.default = void 0;
1532
1532
  var _propertyExpr = require_property_expr();
1533
1533
  var trim = (part) => part.substr(0, part.length - 1).substr(1);
1534
- function getIn(schema, path2, value, context = value) {
1534
+ function getIn(schema, path3, value, context = value) {
1535
1535
  let parent, lastPart, lastPartDebug;
1536
- if (!path2)
1536
+ if (!path3)
1537
1537
  return {
1538
1538
  parent,
1539
- parentPath: path2,
1539
+ parentPath: path3,
1540
1540
  schema
1541
1541
  };
1542
- (0, _propertyExpr.forEach)(path2, (_part, isBracket, isArray) => {
1542
+ (0, _propertyExpr.forEach)(path3, (_part, isBracket, isArray) => {
1543
1543
  let part = isBracket ? trim(_part) : _part;
1544
1544
  schema = schema.resolve({
1545
1545
  context,
@@ -1549,7 +1549,7 @@ var require_reach = __commonJS({
1549
1549
  if (schema.innerType) {
1550
1550
  let idx = isArray ? parseInt(part, 10) : 0;
1551
1551
  if (value && idx >= value.length) {
1552
- throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path2}. because there is no value at that index. `);
1552
+ throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path3}. because there is no value at that index. `);
1553
1553
  }
1554
1554
  parent = value;
1555
1555
  value = value && value[idx];
@@ -1557,7 +1557,7 @@ var require_reach = __commonJS({
1557
1557
  }
1558
1558
  if (!isArray) {
1559
1559
  if (!schema.fields || !schema.fields[part])
1560
- throw new Error(`The schema does not contain the path: ${path2}. (failed at: ${lastPartDebug} which is a type: "${schema._type}")`);
1560
+ throw new Error(`The schema does not contain the path: ${path3}. (failed at: ${lastPartDebug} which is a type: "${schema._type}")`);
1561
1561
  parent = value;
1562
1562
  value = value && value[part];
1563
1563
  schema = schema.fields[part];
@@ -1571,7 +1571,7 @@ var require_reach = __commonJS({
1571
1571
  parentPath: lastPart
1572
1572
  };
1573
1573
  }
1574
- var reach = (obj, path2, value, context) => getIn(obj, path2, value, context).schema;
1574
+ var reach = (obj, path3, value, context) => getIn(obj, path3, value, context).schema;
1575
1575
  var _default = reach;
1576
1576
  exports.default = _default;
1577
1577
  }
@@ -1825,7 +1825,7 @@ attempted value: ${formattedValue}
1825
1825
  _validate(_value, options2 = {}, cb) {
1826
1826
  let {
1827
1827
  sync,
1828
- path: path2,
1828
+ path: path3,
1829
1829
  from = [],
1830
1830
  originalValue = _value,
1831
1831
  strict = this.spec.strict,
@@ -1839,7 +1839,7 @@ attempted value: ${formattedValue}
1839
1839
  }
1840
1840
  let args = {
1841
1841
  value,
1842
- path: path2,
1842
+ path: path3,
1843
1843
  options: options2,
1844
1844
  originalValue,
1845
1845
  schema: this,
@@ -1857,7 +1857,7 @@ attempted value: ${formattedValue}
1857
1857
  (0, _runTests.default)({
1858
1858
  args,
1859
1859
  value,
1860
- path: path2,
1860
+ path: path3,
1861
1861
  sync,
1862
1862
  tests: initialTests,
1863
1863
  endEarly: abortEarly
@@ -1867,7 +1867,7 @@ attempted value: ${formattedValue}
1867
1867
  (0, _runTests.default)({
1868
1868
  tests: this.tests,
1869
1869
  args,
1870
- path: path2,
1870
+ path: path3,
1871
1871
  sync,
1872
1872
  value,
1873
1873
  endEarly: abortEarly
@@ -2147,15 +2147,15 @@ attempted value: ${formattedValue}
2147
2147
  exports.default = BaseSchema;
2148
2148
  BaseSchema.prototype.__isYupSchema__ = true;
2149
2149
  for (const method of ["validate", "validateSync"])
2150
- BaseSchema.prototype[`${method}At`] = function(path2, value, options2 = {}) {
2150
+ BaseSchema.prototype[`${method}At`] = function(path3, value, options2 = {}) {
2151
2151
  const {
2152
2152
  parent,
2153
2153
  parentPath,
2154
2154
  schema
2155
- } = (0, _reach.getIn)(this, path2, value, options2.context);
2155
+ } = (0, _reach.getIn)(this, path3, value, options2.context);
2156
2156
  return schema[method](parent && parent[parentPath], _extends({}, options2, {
2157
2157
  parent,
2158
- path: path2
2158
+ path: path3
2159
2159
  }));
2160
2160
  };
2161
2161
  for (const alias of ["equals", "is"])
@@ -2803,7 +2803,7 @@ var require_sortFields = __commonJS({
2803
2803
  if (_Reference.default.isRef(value) && value.isSibling)
2804
2804
  addNode(value.path, key);
2805
2805
  else if ((0, _isSchema.default)(value) && "deps" in value)
2806
- value.deps.forEach((path2) => addNode(path2, key));
2806
+ value.deps.forEach((path3) => addNode(path3, key));
2807
2807
  }
2808
2808
  return _toposort.default.array(nodes, edges).reverse();
2809
2809
  }
@@ -2990,12 +2990,12 @@ var require_object = __commonJS({
2990
2990
  }
2991
2991
  originalValue = originalValue || value;
2992
2992
  let tests = this._nodes.map((key) => (_2, cb) => {
2993
- let path2 = key.indexOf(".") === -1 ? (opts.path ? `${opts.path}.` : "") + key : `${opts.path || ""}["${key}"]`;
2993
+ let path3 = key.indexOf(".") === -1 ? (opts.path ? `${opts.path}.` : "") + key : `${opts.path || ""}["${key}"]`;
2994
2994
  let field = this.fields[key];
2995
2995
  if (field && "validate" in field) {
2996
2996
  field.validate(value[key], _extends({}, opts, {
2997
2997
  // @ts-ignore
2998
- path: path2,
2998
+ path: path3,
2999
2999
  from,
3000
3000
  // inner fields are always strict:
3001
3001
  // 1. this isn't strict so the casting will also have cast inner values
@@ -3238,7 +3238,7 @@ var require_array = __commonJS({
3238
3238
  var _options$abortEarly, _options$recursive;
3239
3239
  let errors = [];
3240
3240
  let sync = options2.sync;
3241
- let path2 = options2.path;
3241
+ let path3 = options2.path;
3242
3242
  let innerType = this.innerType;
3243
3243
  let endEarly = (_options$abortEarly = options2.abortEarly) != null ? _options$abortEarly : this.spec.abortEarly;
3244
3244
  let recursive = (_options$recursive = options2.recursive) != null ? _options$recursive : this.spec.recursive;
@@ -3258,9 +3258,9 @@ var require_array = __commonJS({
3258
3258
  let tests = new Array(value.length);
3259
3259
  for (let idx = 0; idx < value.length; idx++) {
3260
3260
  let item = value[idx];
3261
- let path3 = `${options2.path || ""}[${idx}]`;
3261
+ let path4 = `${options2.path || ""}[${idx}]`;
3262
3262
  let innerOptions = _extends({}, options2, {
3263
- path: path3,
3263
+ path: path4,
3264
3264
  strict: true,
3265
3265
  parent: value,
3266
3266
  index: idx,
@@ -3270,7 +3270,7 @@ var require_array = __commonJS({
3270
3270
  }
3271
3271
  (0, _runTests.default)({
3272
3272
  sync,
3273
- path: path2,
3273
+ path: path3,
3274
3274
  value,
3275
3275
  errors,
3276
3276
  endEarly,
@@ -3414,11 +3414,11 @@ var require_Lazy = __commonJS({
3414
3414
  validateSync(value, options2) {
3415
3415
  return this._resolve(value, options2).validateSync(value, options2);
3416
3416
  }
3417
- validateAt(path2, value, options2) {
3418
- return this._resolve(value, options2).validateAt(path2, value, options2);
3417
+ validateAt(path3, value, options2) {
3418
+ return this._resolve(value, options2).validateAt(path3, value, options2);
3419
3419
  }
3420
- validateSyncAt(path2, value, options2) {
3421
- return this._resolve(value, options2).validateSyncAt(path2, value, options2);
3420
+ validateSyncAt(path3, value, options2) {
3421
+ return this._resolve(value, options2).validateSyncAt(path3, value, options2);
3422
3422
  }
3423
3423
  describe() {
3424
3424
  return null;
@@ -4198,8 +4198,8 @@ var require_utils = __commonJS({
4198
4198
  options2.proxy = true;
4199
4199
  }
4200
4200
  var trustProxy = options2.proxy;
4201
- var proto = (req.headers["x-forwarded-proto"] || "").toLowerCase(), tls = req.connection.encrypted || trustProxy && "https" == proto.split(/\s*,\s*/)[0], host = trustProxy && req.headers["x-forwarded-host"] || req.headers.host, protocol = tls ? "https" : "http", path2 = req.url || "";
4202
- return protocol + "://" + host + path2;
4201
+ var proto = (req.headers["x-forwarded-proto"] || "").toLowerCase(), tls = req.connection.encrypted || trustProxy && "https" == proto.split(/\s*,\s*/)[0], host = trustProxy && req.headers["x-forwarded-host"] || req.headers.host, protocol = tls ? "https" : "http", path3 = req.url || "";
4202
+ return protocol + "://" + host + path3;
4203
4203
  };
4204
4204
  exports.merge = function(a, b) {
4205
4205
  if (a && b) {
@@ -4638,11 +4638,11 @@ var require_oauth = __commonJS({
4638
4638
  }
4639
4639
  return result.join("");
4640
4640
  };
4641
- exports.OAuth.prototype._createClient = function(port, hostname, method, path2, headers, sslEnabled) {
4641
+ exports.OAuth.prototype._createClient = function(port, hostname, method, path3, headers, sslEnabled) {
4642
4642
  var options2 = {
4643
4643
  host: hostname,
4644
4644
  port,
4645
- path: path2,
4645
+ path: path3,
4646
4646
  method,
4647
4647
  headers
4648
4648
  };
@@ -4737,18 +4737,18 @@ var require_oauth = __commonJS({
4737
4737
  headers["Content-length"] = 0;
4738
4738
  }
4739
4739
  headers["Content-Type"] = post_content_type;
4740
- var path2;
4740
+ var path3;
4741
4741
  if (!parsedUrl.pathname || parsedUrl.pathname == "")
4742
4742
  parsedUrl.pathname = "/";
4743
4743
  if (parsedUrl.query)
4744
- path2 = parsedUrl.pathname + "?" + parsedUrl.query;
4744
+ path3 = parsedUrl.pathname + "?" + parsedUrl.query;
4745
4745
  else
4746
- path2 = parsedUrl.pathname;
4746
+ path3 = parsedUrl.pathname;
4747
4747
  var request;
4748
4748
  if (parsedUrl.protocol == "https:") {
4749
- request = this._createClient(parsedUrl.port, parsedUrl.hostname, method, path2, headers, true);
4749
+ request = this._createClient(parsedUrl.port, parsedUrl.hostname, method, path3, headers, true);
4750
4750
  } else {
4751
- request = this._createClient(parsedUrl.port, parsedUrl.hostname, method, path2, headers);
4751
+ request = this._createClient(parsedUrl.port, parsedUrl.hostname, method, path3, headers);
4752
4752
  }
4753
4753
  var clientOptions = this._clientOptions;
4754
4754
  if (callback) {
@@ -14972,10 +14972,10 @@ var require_store = __commonJS({
14972
14972
  }
14973
14973
  exports.Store = Store;
14974
14974
  Store.prototype.synchronous = false;
14975
- Store.prototype.findCookie = function(domain, path2, key, cb) {
14975
+ Store.prototype.findCookie = function(domain, path3, key, cb) {
14976
14976
  throw new Error("findCookie is not implemented");
14977
14977
  };
14978
- Store.prototype.findCookies = function(domain, path2, cb) {
14978
+ Store.prototype.findCookies = function(domain, path3, cb) {
14979
14979
  throw new Error("findCookies is not implemented");
14980
14980
  };
14981
14981
  Store.prototype.putCookie = function(cookie, cb) {
@@ -14984,10 +14984,10 @@ var require_store = __commonJS({
14984
14984
  Store.prototype.updateCookie = function(oldCookie, newCookie, cb) {
14985
14985
  throw new Error("updateCookie is not implemented");
14986
14986
  };
14987
- Store.prototype.removeCookie = function(domain, path2, key, cb) {
14987
+ Store.prototype.removeCookie = function(domain, path3, key, cb) {
14988
14988
  throw new Error("removeCookie is not implemented");
14989
14989
  };
14990
- Store.prototype.removeCookies = function(domain, path2, cb) {
14990
+ Store.prototype.removeCookies = function(domain, path3, cb) {
14991
14991
  throw new Error("removeCookies is not implemented");
14992
14992
  };
14993
14993
  Store.prototype.removeAllCookies = function(cb) {
@@ -15071,22 +15071,22 @@ var require_memstore = __commonJS({
15071
15071
  if (util.inspect.custom) {
15072
15072
  MemoryCookieStore.prototype[util.inspect.custom] = MemoryCookieStore.prototype.inspect;
15073
15073
  }
15074
- MemoryCookieStore.prototype.findCookie = function(domain, path2, key, cb) {
15074
+ MemoryCookieStore.prototype.findCookie = function(domain, path3, key, cb) {
15075
15075
  if (!this.idx[domain]) {
15076
15076
  return cb(null, void 0);
15077
15077
  }
15078
- if (!this.idx[domain][path2]) {
15078
+ if (!this.idx[domain][path3]) {
15079
15079
  return cb(null, void 0);
15080
15080
  }
15081
- return cb(null, this.idx[domain][path2][key] || null);
15081
+ return cb(null, this.idx[domain][path3][key] || null);
15082
15082
  };
15083
- MemoryCookieStore.prototype.findCookies = function(domain, path2, cb) {
15083
+ MemoryCookieStore.prototype.findCookies = function(domain, path3, cb) {
15084
15084
  var results = [];
15085
15085
  if (!domain) {
15086
15086
  return cb(null, []);
15087
15087
  }
15088
15088
  var pathMatcher;
15089
- if (!path2) {
15089
+ if (!path3) {
15090
15090
  pathMatcher = function matchAll(domainIndex) {
15091
15091
  for (var curPath in domainIndex) {
15092
15092
  var pathIndex = domainIndex[curPath];
@@ -15098,7 +15098,7 @@ var require_memstore = __commonJS({
15098
15098
  } else {
15099
15099
  pathMatcher = function matchRFC(domainIndex) {
15100
15100
  Object.keys(domainIndex).forEach(function(cookiePath) {
15101
- if (pathMatch(path2, cookiePath)) {
15101
+ if (pathMatch(path3, cookiePath)) {
15102
15102
  var pathIndex = domainIndex[cookiePath];
15103
15103
  for (var key in pathIndex) {
15104
15104
  results.push(pathIndex[key]);
@@ -15131,16 +15131,16 @@ var require_memstore = __commonJS({
15131
15131
  MemoryCookieStore.prototype.updateCookie = function(oldCookie, newCookie, cb) {
15132
15132
  this.putCookie(newCookie, cb);
15133
15133
  };
15134
- MemoryCookieStore.prototype.removeCookie = function(domain, path2, key, cb) {
15135
- if (this.idx[domain] && this.idx[domain][path2] && this.idx[domain][path2][key]) {
15136
- delete this.idx[domain][path2][key];
15134
+ MemoryCookieStore.prototype.removeCookie = function(domain, path3, key, cb) {
15135
+ if (this.idx[domain] && this.idx[domain][path3] && this.idx[domain][path3][key]) {
15136
+ delete this.idx[domain][path3][key];
15137
15137
  }
15138
15138
  cb(null);
15139
15139
  };
15140
- MemoryCookieStore.prototype.removeCookies = function(domain, path2, cb) {
15140
+ MemoryCookieStore.prototype.removeCookies = function(domain, path3, cb) {
15141
15141
  if (this.idx[domain]) {
15142
- if (path2) {
15143
- delete this.idx[domain][path2];
15142
+ if (path3) {
15143
+ delete this.idx[domain][path3];
15144
15144
  } else {
15145
15145
  delete this.idx[domain];
15146
15146
  }
@@ -15157,11 +15157,11 @@ var require_memstore = __commonJS({
15157
15157
  var domains = Object.keys(idx);
15158
15158
  domains.forEach(function(domain) {
15159
15159
  var paths = Object.keys(idx[domain]);
15160
- paths.forEach(function(path2) {
15161
- var keys2 = Object.keys(idx[domain][path2]);
15160
+ paths.forEach(function(path3) {
15161
+ var keys2 = Object.keys(idx[domain][path3]);
15162
15162
  keys2.forEach(function(key) {
15163
15163
  if (key !== null) {
15164
- cookies.push(idx[domain][path2][key]);
15164
+ cookies.push(idx[domain][path3][key]);
15165
15165
  }
15166
15166
  });
15167
15167
  });
@@ -15389,18 +15389,18 @@ var require_cookie = __commonJS({
15389
15389
  }
15390
15390
  return true;
15391
15391
  }
15392
- function defaultPath(path2) {
15393
- if (!path2 || path2.substr(0, 1) !== "/") {
15392
+ function defaultPath(path3) {
15393
+ if (!path3 || path3.substr(0, 1) !== "/") {
15394
15394
  return "/";
15395
15395
  }
15396
- if (path2 === "/") {
15397
- return path2;
15396
+ if (path3 === "/") {
15397
+ return path3;
15398
15398
  }
15399
- var rightSlash = path2.lastIndexOf("/");
15399
+ var rightSlash = path3.lastIndexOf("/");
15400
15400
  if (rightSlash === 0) {
15401
15401
  return "/";
15402
15402
  }
15403
- return path2.slice(0, rightSlash);
15403
+ return path3.slice(0, rightSlash);
15404
15404
  }
15405
15405
  function trimTerminator(str) {
15406
15406
  for (var t = 0; t < TERMINATORS.length; t++) {
@@ -15576,21 +15576,21 @@ var require_cookie = __commonJS({
15576
15576
  cmp = a.creationIndex - b.creationIndex;
15577
15577
  return cmp;
15578
15578
  }
15579
- function permutePath(path2) {
15580
- if (path2 === "/") {
15579
+ function permutePath(path3) {
15580
+ if (path3 === "/") {
15581
15581
  return ["/"];
15582
15582
  }
15583
- if (path2.lastIndexOf("/") === path2.length - 1) {
15584
- path2 = path2.substr(0, path2.length - 1);
15583
+ if (path3.lastIndexOf("/") === path3.length - 1) {
15584
+ path3 = path3.substr(0, path3.length - 1);
15585
15585
  }
15586
- var permutations = [path2];
15587
- while (path2.length > 1) {
15588
- var lindex = path2.lastIndexOf("/");
15586
+ var permutations = [path3];
15587
+ while (path3.length > 1) {
15588
+ var lindex = path3.lastIndexOf("/");
15589
15589
  if (lindex === 0) {
15590
15590
  break;
15591
15591
  }
15592
- path2 = path2.substr(0, lindex);
15593
- permutations.push(path2);
15592
+ path3 = path3.substr(0, lindex);
15593
+ permutations.push(path3);
15594
15594
  }
15595
15595
  permutations.push("/");
15596
15596
  return permutations;
@@ -15921,7 +15921,7 @@ var require_cookie = __commonJS({
15921
15921
  options2 = {};
15922
15922
  }
15923
15923
  var host = canonicalDomain(context.hostname);
15924
- var path2 = context.pathname || "/";
15924
+ var path3 = context.pathname || "/";
15925
15925
  var secure = options2.secure;
15926
15926
  if (secure == null && context.protocol && (context.protocol == "https:" || context.protocol == "wss:")) {
15927
15927
  secure = true;
@@ -15944,7 +15944,7 @@ var require_cookie = __commonJS({
15944
15944
  return false;
15945
15945
  }
15946
15946
  }
15947
- if (!allPaths && !pathMatch(path2, c.path)) {
15947
+ if (!allPaths && !pathMatch(path3, c.path)) {
15948
15948
  return false;
15949
15949
  }
15950
15950
  if (c.secure && !secure) {
@@ -15960,7 +15960,7 @@ var require_cookie = __commonJS({
15960
15960
  }
15961
15961
  return true;
15962
15962
  }
15963
- store2.findCookies(host, allPaths ? null : path2, function(err, cookies) {
15963
+ store2.findCookies(host, allPaths ? null : path3, function(err, cookies) {
15964
15964
  if (err) {
15965
15965
  return cb(err);
15966
15966
  }
@@ -16447,14 +16447,14 @@ var require_aws_sign2 = __commonJS({
16447
16447
  }
16448
16448
  module2.exports.canonicalizeHeaders = canonicalizeHeaders;
16449
16449
  function canonicalizeResource(resource) {
16450
- var url = parse(resource, true), path2 = url.pathname, buf = [];
16450
+ var url = parse(resource, true), path3 = url.pathname, buf = [];
16451
16451
  Object.keys(url.query).forEach(function(key) {
16452
16452
  if (!~keys2.indexOf(key))
16453
16453
  return;
16454
16454
  var val = "" == url.query[key] ? "" : "=" + encodeURIComponent(url.query[key]);
16455
16455
  buf.push(key + val);
16456
16456
  });
16457
- return path2 + (buf.length ? "?" + buf.sort().join("&") : "");
16457
+ return path3 + (buf.length ? "?" + buf.sort().join("&") : "");
16458
16458
  }
16459
16459
  module2.exports.canonicalizeResource = canonicalizeResource;
16460
16460
  }
@@ -16752,15 +16752,15 @@ var require_aws4 = __commonJS({
16752
16752
  if (pathStr !== "/") {
16753
16753
  if (normalizePath)
16754
16754
  pathStr = pathStr.replace(/\/{2,}/g, "/");
16755
- pathStr = pathStr.split("/").reduce(function(path2, piece) {
16755
+ pathStr = pathStr.split("/").reduce(function(path3, piece) {
16756
16756
  if (normalizePath && piece === "..") {
16757
- path2.pop();
16757
+ path3.pop();
16758
16758
  } else if (!normalizePath || piece !== ".") {
16759
16759
  if (decodePath)
16760
16760
  piece = decodeURIComponent(piece.replace(/\+/g, " "));
16761
- path2.push(encodeRfc3986Full(piece));
16761
+ path3.push(encodeRfc3986Full(piece));
16762
16762
  }
16763
- return path2;
16763
+ return path3;
16764
16764
  }, []).join("/");
16765
16765
  if (pathStr[0] !== "/")
16766
16766
  pathStr = "/" + pathStr;
@@ -16813,27 +16813,27 @@ var require_aws4 = __commonJS({
16813
16813
  };
16814
16814
  };
16815
16815
  RequestSigner.prototype.parsePath = function() {
16816
- var path2 = this.request.path || "/";
16817
- if (/[^0-9A-Za-z;,/?:@&=+$\-_.!~*'()#%]/.test(path2)) {
16818
- path2 = encodeURI(decodeURI(path2));
16816
+ var path3 = this.request.path || "/";
16817
+ if (/[^0-9A-Za-z;,/?:@&=+$\-_.!~*'()#%]/.test(path3)) {
16818
+ path3 = encodeURI(decodeURI(path3));
16819
16819
  }
16820
- var queryIx = path2.indexOf("?"), query = null;
16820
+ var queryIx = path3.indexOf("?"), query = null;
16821
16821
  if (queryIx >= 0) {
16822
- query = querystring.parse(path2.slice(queryIx + 1));
16823
- path2 = path2.slice(0, queryIx);
16822
+ query = querystring.parse(path3.slice(queryIx + 1));
16823
+ path3 = path3.slice(0, queryIx);
16824
16824
  }
16825
16825
  this.parsedPath = {
16826
- path: path2,
16826
+ path: path3,
16827
16827
  query
16828
16828
  };
16829
16829
  };
16830
16830
  RequestSigner.prototype.formatPath = function() {
16831
- var path2 = this.parsedPath.path, query = this.parsedPath.query;
16831
+ var path3 = this.parsedPath.path, query = this.parsedPath.query;
16832
16832
  if (!query)
16833
- return path2;
16833
+ return path3;
16834
16834
  if (query[""] != null)
16835
16835
  delete query[""];
16836
- return path2 + "?" + encodeRfc3986(querystring.stringify(query));
16836
+ return path3 + "?" + encodeRfc3986(querystring.stringify(query));
16837
16837
  };
16838
16838
  aws4.RequestSigner = RequestSigner;
16839
16839
  aws4.sign = function(request, credentials) {
@@ -29992,13 +29992,13 @@ var require_validate = __commonJS({
29992
29992
  return schema2.type || primitiveConstructors[schema2.name] == schema2 && schema2.name.toLowerCase();
29993
29993
  }
29994
29994
  var errors = [];
29995
- function checkProp(value, schema2, path2, i) {
29995
+ function checkProp(value, schema2, path3, i) {
29996
29996
  var l;
29997
- path2 += path2 ? typeof i == "number" ? "[" + i + "]" : typeof i == "undefined" ? "" : "." + i : i;
29997
+ path3 += path3 ? typeof i == "number" ? "[" + i + "]" : typeof i == "undefined" ? "" : "." + i : i;
29998
29998
  function addError(message) {
29999
- errors.push({ property: path2, message });
29999
+ errors.push({ property: path3, message });
30000
30000
  }
30001
- if ((typeof schema2 != "object" || schema2 instanceof Array) && (path2 || typeof schema2 != "function") && !(schema2 && getType(schema2))) {
30001
+ if ((typeof schema2 != "object" || schema2 instanceof Array) && (path3 || typeof schema2 != "function") && !(schema2 && getType(schema2))) {
30002
30002
  if (typeof schema2 == "function") {
30003
30003
  if (!(value instanceof schema2)) {
30004
30004
  addError("is not an instance of the class/constructor " + schema2.name);
@@ -30012,12 +30012,12 @@ var require_validate = __commonJS({
30012
30012
  addError("is a readonly field, it can not be changed");
30013
30013
  }
30014
30014
  if (schema2["extends"]) {
30015
- checkProp(value, schema2["extends"], path2, i);
30015
+ checkProp(value, schema2["extends"], path3, i);
30016
30016
  }
30017
30017
  function checkType(type, value2) {
30018
30018
  if (type) {
30019
30019
  if (typeof type == "string" && type != "any" && (type == "null" ? value2 !== null : typeof value2 != type) && !(value2 instanceof Array && type == "array") && !(value2 instanceof Date && type == "date") && !(type == "integer" && value2 % 1 === 0)) {
30020
- return [{ property: path2, message: value2 + " - " + typeof value2 + " value found, but a " + type + " is required" }];
30020
+ return [{ property: path3, message: value2 + " - " + typeof value2 + " value found, but a " + type + " is required" }];
30021
30021
  }
30022
30022
  if (type instanceof Array) {
30023
30023
  var unionErrors = [];
@@ -30032,7 +30032,7 @@ var require_validate = __commonJS({
30032
30032
  } else if (typeof type == "object") {
30033
30033
  var priorErrors = errors;
30034
30034
  errors = [];
30035
- checkProp(value2, type, path2);
30035
+ checkProp(value2, type, path3);
30036
30036
  var theseErrors = errors;
30037
30037
  errors = priorErrors;
30038
30038
  return theseErrors;
@@ -30059,7 +30059,7 @@ var require_validate = __commonJS({
30059
30059
  propDef = schema2.items[i];
30060
30060
  if (options2.coerce)
30061
30061
  value[i] = options2.coerce(value[i], propDef);
30062
- errors.concat(checkProp(value[i], propDef, path2, i));
30062
+ errors.concat(checkProp(value[i], propDef, path3, i));
30063
30063
  }
30064
30064
  }
30065
30065
  if (schema2.minItems && value.length < schema2.minItems) {
@@ -30069,7 +30069,7 @@ var require_validate = __commonJS({
30069
30069
  addError("There must be a maximum of " + schema2.maxItems + " in the array");
30070
30070
  }
30071
30071
  } else if (schema2.properties || schema2.additionalProperties) {
30072
- errors.concat(checkObj(value, schema2.properties, path2, schema2.additionalProperties));
30072
+ errors.concat(checkObj(value, schema2.properties, path3, schema2.additionalProperties));
30073
30073
  }
30074
30074
  if (schema2.pattern && typeof value == "string" && !value.match(schema2.pattern)) {
30075
30075
  addError("does not match the regex pattern " + schema2.pattern);
@@ -30107,10 +30107,10 @@ var require_validate = __commonJS({
30107
30107
  }
30108
30108
  return null;
30109
30109
  }
30110
- function checkObj(instance2, objTypeDef, path2, additionalProp) {
30110
+ function checkObj(instance2, objTypeDef, path3, additionalProp) {
30111
30111
  if (typeof objTypeDef == "object") {
30112
30112
  if (typeof instance2 != "object" || instance2 instanceof Array) {
30113
- errors.push({ property: path2, message: "an object is required" });
30113
+ errors.push({ property: path3, message: "an object is required" });
30114
30114
  }
30115
30115
  for (var i in objTypeDef) {
30116
30116
  if (objTypeDef.hasOwnProperty(i) && i != "__proto__" && i != "constructor") {
@@ -30124,7 +30124,7 @@ var require_validate = __commonJS({
30124
30124
  if (options2.coerce && i in instance2) {
30125
30125
  value = instance2[i] = options2.coerce(value, propDef);
30126
30126
  }
30127
- checkProp(value, propDef, path2, i);
30127
+ checkProp(value, propDef, path3, i);
30128
30128
  }
30129
30129
  }
30130
30130
  }
@@ -30134,22 +30134,22 @@ var require_validate = __commonJS({
30134
30134
  delete instance2[i];
30135
30135
  continue;
30136
30136
  } else {
30137
- errors.push({ property: path2, message: "The property " + i + " is not defined in the schema and the schema does not allow additional properties" });
30137
+ errors.push({ property: path3, message: "The property " + i + " is not defined in the schema and the schema does not allow additional properties" });
30138
30138
  }
30139
30139
  }
30140
30140
  var requires = objTypeDef && objTypeDef[i] && objTypeDef[i].requires;
30141
30141
  if (requires && !(requires in instance2)) {
30142
- errors.push({ property: path2, message: "the presence of the property " + i + " requires that " + requires + " also be present" });
30142
+ errors.push({ property: path3, message: "the presence of the property " + i + " requires that " + requires + " also be present" });
30143
30143
  }
30144
30144
  value = instance2[i];
30145
30145
  if (additionalProp && (!(objTypeDef && typeof objTypeDef == "object") || !(i in objTypeDef))) {
30146
30146
  if (options2.coerce) {
30147
30147
  value = instance2[i] = options2.coerce(value, additionalProp);
30148
30148
  }
30149
- checkProp(value, additionalProp, path2, i);
30149
+ checkProp(value, additionalProp, path3, i);
30150
30150
  }
30151
30151
  if (!_changing && value && value.$schema) {
30152
- errors = errors.concat(checkProp(value, value.$schema, path2, i));
30152
+ errors = errors.concat(checkProp(value, value.$schema, path3, i));
30153
30153
  }
30154
30154
  }
30155
30155
  return errors;
@@ -30758,11 +30758,11 @@ var require_signer = __commonJS({
30758
30758
  RequestSigner.prototype.writeDateHeader = function() {
30759
30759
  return this.writeHeader("date", jsprim.rfc1123(/* @__PURE__ */ new Date()));
30760
30760
  };
30761
- RequestSigner.prototype.writeTarget = function(method, path2) {
30761
+ RequestSigner.prototype.writeTarget = function(method, path3) {
30762
30762
  assert.string(method, "method");
30763
- assert.string(path2, "path");
30763
+ assert.string(path3, "path");
30764
30764
  method = method.toLowerCase();
30765
- this.writeHeader("(request-target)", method + " " + path2);
30765
+ this.writeHeader("(request-target)", method + " " + path3);
30766
30766
  };
30767
30767
  RequestSigner.prototype.sign = function(cb) {
30768
30768
  assert.func(cb, "callback");
@@ -39650,11 +39650,11 @@ var require_mime_types = __commonJS({
39650
39650
  }
39651
39651
  return exts[0];
39652
39652
  }
39653
- function lookup2(path2) {
39654
- if (!path2 || typeof path2 !== "string") {
39653
+ function lookup2(path3) {
39654
+ if (!path3 || typeof path3 !== "string") {
39655
39655
  return false;
39656
39656
  }
39657
- var extension2 = extname("x." + path2).toLowerCase().substr(1);
39657
+ var extension2 = extname("x." + path3).toLowerCase().substr(1);
39658
39658
  if (!extension2) {
39659
39659
  return false;
39660
39660
  }
@@ -40384,7 +40384,7 @@ var require_form_data = __commonJS({
40384
40384
  "use strict";
40385
40385
  var CombinedStream = require_combined_stream();
40386
40386
  var util = require("util");
40387
- var path2 = require("path");
40387
+ var path3 = require("path");
40388
40388
  var http = require("http");
40389
40389
  var https = require("https");
40390
40390
  var parseUrl = require("url").parse;
@@ -40510,11 +40510,11 @@ var require_form_data = __commonJS({
40510
40510
  FormData.prototype._getContentDisposition = function(value, options2) {
40511
40511
  var filename, contentDisposition;
40512
40512
  if (typeof options2.filepath === "string") {
40513
- filename = path2.normalize(options2.filepath).replace(/\\/g, "/");
40513
+ filename = path3.normalize(options2.filepath).replace(/\\/g, "/");
40514
40514
  } else if (options2.filename || value.name || value.path) {
40515
- filename = path2.basename(options2.filename || value.name || value.path);
40515
+ filename = path3.basename(options2.filename || value.name || value.path);
40516
40516
  } else if (value.readable && value.hasOwnProperty("httpVersion")) {
40517
- filename = path2.basename(value.client._httpMessage.path);
40517
+ filename = path3.basename(value.client._httpMessage.path);
40518
40518
  }
40519
40519
  if (filename) {
40520
40520
  contentDisposition = 'filename="' + filename + '"';
@@ -42171,8 +42171,8 @@ var require_uri_all = __commonJS({
42171
42171
  wsComponents.secure = void 0;
42172
42172
  }
42173
42173
  if (wsComponents.resourceName) {
42174
- var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), path2 = _wsComponents$resourc2[0], query = _wsComponents$resourc2[1];
42175
- wsComponents.path = path2 && path2 !== "/" ? path2 : void 0;
42174
+ var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), path3 = _wsComponents$resourc2[0], query = _wsComponents$resourc2[1];
42175
+ wsComponents.path = path3 && path3 !== "/" ? path3 : void 0;
42176
42176
  wsComponents.query = query;
42177
42177
  wsComponents.resourceName = void 0;
42178
42178
  }
@@ -42574,12 +42574,12 @@ var require_util2 = __commonJS({
42574
42574
  return "'" + escapeQuotes(str) + "'";
42575
42575
  }
42576
42576
  function getPathExpr(currentPath, expr, jsonPointers, isNumber) {
42577
- var path2 = jsonPointers ? "'/' + " + expr + (isNumber ? "" : ".replace(/~/g, '~0').replace(/\\//g, '~1')") : isNumber ? "'[' + " + expr + " + ']'" : "'[\\'' + " + expr + " + '\\']'";
42578
- return joinPaths(currentPath, path2);
42577
+ var path3 = jsonPointers ? "'/' + " + expr + (isNumber ? "" : ".replace(/~/g, '~0').replace(/\\//g, '~1')") : isNumber ? "'[' + " + expr + " + ']'" : "'[\\'' + " + expr + " + '\\']'";
42578
+ return joinPaths(currentPath, path3);
42579
42579
  }
42580
42580
  function getPath(currentPath, prop, jsonPointers) {
42581
- var path2 = jsonPointers ? toQuotedString("/" + escapeJsonPointer(prop)) : toQuotedString(getProperty(prop));
42582
- return joinPaths(currentPath, path2);
42581
+ var path3 = jsonPointers ? toQuotedString("/" + escapeJsonPointer(prop)) : toQuotedString(getProperty(prop));
42582
+ return joinPaths(currentPath, path3);
42583
42583
  }
42584
42584
  var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
42585
42585
  var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
@@ -48883,7 +48883,7 @@ var require_auth = __commonJS({
48883
48883
  return authHeader;
48884
48884
  }
48885
48885
  };
48886
- Auth.prototype.digest = function(method, path2, authHeader) {
48886
+ Auth.prototype.digest = function(method, path3, authHeader) {
48887
48887
  var self2 = this;
48888
48888
  var challenge = {};
48889
48889
  var re = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi;
@@ -48906,13 +48906,13 @@ var require_auth = __commonJS({
48906
48906
  var nc = qop && "00000001";
48907
48907
  var cnonce = qop && uuid2().replace(/-/g, "");
48908
48908
  var ha1 = ha1Compute(challenge.algorithm, self2.user, challenge.realm, self2.pass, challenge.nonce, cnonce);
48909
- var ha2 = md5(method + ":" + path2);
48909
+ var ha2 = md5(method + ":" + path3);
48910
48910
  var digestResponse = qop ? md5(ha1 + ":" + challenge.nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + ha2) : md5(ha1 + ":" + challenge.nonce + ":" + ha2);
48911
48911
  var authValues = {
48912
48912
  username: self2.user,
48913
48913
  realm: challenge.realm,
48914
48914
  nonce: challenge.nonce,
48915
- uri: path2,
48915
+ uri: path3,
48916
48916
  qop,
48917
48917
  response: digestResponse,
48918
48918
  nc,
@@ -50934,10 +50934,10 @@ var require_request2 = __commonJS({
50934
50934
  Request.prototype.enableUnixSocket = function() {
50935
50935
  var unixParts = this.uri.path.split(":");
50936
50936
  var host = unixParts[0];
50937
- var path2 = unixParts[1];
50937
+ var path3 = unixParts[1];
50938
50938
  this.socketPath = host;
50939
- this.uri.pathname = path2;
50940
- this.uri.path = path2;
50939
+ this.uri.pathname = path3;
50940
+ this.uri.path = path3;
50941
50941
  this.uri.host = host;
50942
50942
  this.uri.hostname = host;
50943
50943
  this.uri.isUnix = true;
@@ -50986,14 +50986,14 @@ var require_request2 = __commonJS({
50986
50986
  md5: self2.getHeader("content-md5") || "",
50987
50987
  amazonHeaders: aws2.canonicalizeHeaders(self2.headers)
50988
50988
  };
50989
- var path2 = self2.uri.path;
50990
- if (opts.bucket && path2) {
50991
- auth.resource = "/" + opts.bucket + path2;
50992
- } else if (opts.bucket && !path2) {
50989
+ var path3 = self2.uri.path;
50990
+ if (opts.bucket && path3) {
50991
+ auth.resource = "/" + opts.bucket + path3;
50992
+ } else if (opts.bucket && !path3) {
50993
50993
  auth.resource = "/" + opts.bucket;
50994
- } else if (!opts.bucket && path2) {
50995
- auth.resource = path2;
50996
- } else if (!opts.bucket && !path2) {
50994
+ } else if (!opts.bucket && path3) {
50995
+ auth.resource = path3;
50996
+ } else if (!opts.bucket && !path3) {
50997
50997
  auth.resource = "/";
50998
50998
  }
50999
50999
  auth.resource = aws2.canonicalizeResource(auth.resource);
@@ -54853,6 +54853,16 @@ var deepGet = (obj, key) => {
54853
54853
  // ../shared-core/src/helpers/cron.ts
54854
54854
  var import_cron_validate = __toESM(require_lib2());
54855
54855
 
54856
+ // ../shared-core/src/helpers/schema.ts
54857
+ var schema_exports = {};
54858
+ __export(schema_exports, {
54859
+ isDeprecatedSingleUserColumn: () => isDeprecatedSingleUserColumn
54860
+ });
54861
+ function isDeprecatedSingleUserColumn(schema) {
54862
+ const result = schema.type === "bb_reference" /* BB_REFERENCE */ && schema.subtype === "user" /* USER */ && schema.constraints?.type !== "array";
54863
+ return result;
54864
+ }
54865
+
54856
54866
  // ../shared-core/src/filters.ts
54857
54867
  var HBS_REGEX = /{{([^{].*?)}}/g;
54858
54868
  var getValidOperatorsForType = (fieldType, field, datasource2) => {
@@ -54876,7 +54886,7 @@ var getValidOperatorsForType = (fieldType, field, datasource2) => {
54876
54886
  Op.In
54877
54887
  ];
54878
54888
  let ops = [];
54879
- const { type, subtype, formulaType } = fieldType;
54889
+ const { type, formulaType } = fieldType;
54880
54890
  if (type === "string" /* STRING */) {
54881
54891
  ops = stringOps;
54882
54892
  } else if (type === "number" /* NUMBER */ || type === "bigint" /* BIGINT */) {
@@ -54893,9 +54903,9 @@ var getValidOperatorsForType = (fieldType, field, datasource2) => {
54893
54903
  ops = numOps;
54894
54904
  } else if (type === "formula" /* FORMULA */ && formulaType === "static" /* STATIC */) {
54895
54905
  ops = stringOps.concat([Op.MoreThan, Op.LessThan]);
54896
- } else if (type === "bb_reference" /* BB_REFERENCE */ && subtype == "user" /* USER */) {
54906
+ } else if (type === "bb_reference_single" /* BB_REFERENCE_SINGLE */ || schema_exports.isDeprecatedSingleUserColumn(fieldType)) {
54897
54907
  ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In];
54898
- } else if (type === "bb_reference" /* BB_REFERENCE */ && subtype == "users" /* USERS */) {
54908
+ } else if (type === "bb_reference" /* BB_REFERENCE */) {
54899
54909
  ops = [Op.Contains, Op.NotContains, Op.ContainsAny, Op.Empty, Op.NotEmpty];
54900
54910
  }
54901
54911
  const externalTable = datasource2?.tableId?.includes("datasource_plus");
@@ -55415,7 +55425,8 @@ var allowDisplayColumnByType = {
55415
55425
  ["attachment_single" /* ATTACHMENT_SINGLE */]: false,
55416
55426
  ["link" /* LINK */]: false,
55417
55427
  ["json" /* JSON */]: false,
55418
- ["bb_reference" /* BB_REFERENCE */]: false
55428
+ ["bb_reference" /* BB_REFERENCE */]: false,
55429
+ ["bb_reference_single" /* BB_REFERENCE_SINGLE */]: false
55419
55430
  };
55420
55431
  var allowSortColumnByType = {
55421
55432
  ["string" /* STRING */]: true,
@@ -55434,7 +55445,8 @@ var allowSortColumnByType = {
55434
55445
  ["attachment_single" /* ATTACHMENT_SINGLE */]: false,
55435
55446
  ["array" /* ARRAY */]: false,
55436
55447
  ["link" /* LINK */]: false,
55437
- ["bb_reference" /* BB_REFERENCE */]: false
55448
+ ["bb_reference" /* BB_REFERENCE */]: false,
55449
+ ["bb_reference_single" /* BB_REFERENCE_SINGLE */]: false
55438
55450
  };
55439
55451
 
55440
55452
  // src/constants/misc.ts
@@ -55889,9 +55901,9 @@ function checkSlashesInUrl(url) {
55889
55901
  }
55890
55902
 
55891
55903
  // src/db/couch/utils.ts
55892
- async function directCouchCall(path2, method = "GET", body2) {
55904
+ async function directCouchCall(path3, method = "GET", body2) {
55893
55905
  let { url, cookie } = getCouchInfo();
55894
- const couchUrl = `${url}/${path2}`;
55906
+ const couchUrl = `${url}/${path3}`;
55895
55907
  return await directCouchUrlCall({ url: couchUrl, cookie, method, body: body2 });
55896
55908
  }
55897
55909
  async function directCouchUrlCall({
@@ -55917,8 +55929,8 @@ async function directCouchUrlCall({
55917
55929
  }
55918
55930
  return await (0, import_node_fetch.default)(checkSlashesInUrl(encodeURI(url)), params2);
55919
55931
  }
55920
- async function directCouchQuery(path2, method = "GET", body2) {
55921
- const response = await directCouchCall(path2, method, body2);
55932
+ async function directCouchQuery(path3, method = "GET", body2) {
55933
+ const response = await directCouchCall(path3, method, body2);
55922
55934
  if (response.status < 300) {
55923
55935
  return await response.json();
55924
55936
  } else {
@@ -56133,6 +56145,19 @@ function buildNano(couchInfo) {
56133
56145
  parseUrl: false
56134
56146
  });
56135
56147
  }
56148
+ var CouchDBError = class extends Error {
56149
+ constructor(message, info) {
56150
+ super(message);
56151
+ const statusCode = info.status || info.statusCode || 500;
56152
+ this.status = statusCode;
56153
+ this.statusCode = statusCode;
56154
+ this.reason = info.reason;
56155
+ this.name = info.name;
56156
+ this.errid = info.errid;
56157
+ this.description = info.description;
56158
+ this.error = info.error;
56159
+ }
56160
+ };
56136
56161
  function DatabaseWithConnection(dbName, connection, opts) {
56137
56162
  const db = new DatabaseImpl(dbName, opts, connection);
56138
56163
  return new DDInstrumentedDatabase(db);
@@ -56193,7 +56218,7 @@ var DatabaseImpl = class _DatabaseImpl {
56193
56218
  await this.nano().db.create(this.name);
56194
56219
  } catch (err) {
56195
56220
  if (err.statusCode !== 412) {
56196
- throw err;
56221
+ throw new CouchDBError(err.message, err);
56197
56222
  }
56198
56223
  }
56199
56224
  }
@@ -56209,10 +56234,8 @@ var DatabaseImpl = class _DatabaseImpl {
56209
56234
  if (err.statusCode === 404 && err.reason === DATABASE_NOT_FOUND) {
56210
56235
  await this.checkAndCreateDb();
56211
56236
  return await this.performCall(call);
56212
- } else if (err.statusCode) {
56213
- err.status = err.statusCode;
56214
56237
  }
56215
- throw err;
56238
+ throw new CouchDBError(`CouchDB error: ${err.message}`, err);
56216
56239
  }
56217
56240
  }
56218
56241
  async get(id) {
@@ -56331,7 +56354,7 @@ var DatabaseImpl = class _DatabaseImpl {
56331
56354
  if (err.statusCode === 404) {
56332
56355
  return;
56333
56356
  } else {
56334
- throw { ...err, status: err.statusCode };
56357
+ throw new CouchDBError(err.message, err);
56335
56358
  }
56336
56359
  }
56337
56360
  }
@@ -56602,14 +56625,14 @@ function doInScimContext(task) {
56602
56625
  };
56603
56626
  return newContext(updates, task);
56604
56627
  }
56605
- async function ensureSnippetContext() {
56628
+ async function ensureSnippetContext(enabled2 = !environment_default.isTest()) {
56606
56629
  const ctx = getCurrentContext();
56607
56630
  if (!ctx || ctx.snippets) {
56608
56631
  return;
56609
56632
  }
56610
56633
  let snippets;
56611
56634
  const db = getAppDB();
56612
- if (db && !environment_default.isTest()) {
56635
+ if (db && enabled2) {
56613
56636
  const app = await db.get("app_metadata" /* APP_METADATA */);
56614
56637
  snippets = app.snippets;
56615
56638
  }
@@ -56852,6 +56875,7 @@ var objectStore_exports2 = {};
56852
56875
  __export(objectStore_exports2, {
56853
56876
  ObjectStore: () => ObjectStore,
56854
56877
  ObjectStoreBuckets: () => ObjectStoreBuckets,
56878
+ SIGNED_FILE_PREFIX: () => SIGNED_FILE_PREFIX,
56855
56879
  bucketTTLConfig: () => bucketTTLConfig,
56856
56880
  budibaseTempDir: () => budibaseTempDir,
56857
56881
  clientLibraryCDNUrl: () => clientLibraryCDNUrl,
@@ -56868,12 +56892,15 @@ __export(objectStore_exports2, {
56868
56892
  getAppFileUrl: () => getAppFileUrl,
56869
56893
  getGlobalFileS3Key: () => getGlobalFileS3Key,
56870
56894
  getGlobalFileUrl: () => getGlobalFileUrl,
56895
+ getObjectMetadata: () => getObjectMetadata,
56871
56896
  getPluginIconKey: () => getPluginIconKey,
56872
56897
  getPluginJSKey: () => getPluginJSKey,
56873
56898
  getPluginS3Dir: () => getPluginS3Dir,
56874
56899
  getPresignedUrl: () => getPresignedUrl,
56875
56900
  getReadStream: () => getReadStream,
56876
56901
  listAllObjects: () => listAllObjects,
56902
+ processAutomationAttachment: () => processAutomationAttachment,
56903
+ processObjectStoreAttachment: () => processObjectStoreAttachment,
56877
56904
  retrieve: () => retrieve,
56878
56905
  retrieveDirectory: () => retrieveDirectory,
56879
56906
  retrieveToTmp: () => retrieveToTmp,
@@ -56895,7 +56922,7 @@ var import_path2 = require("path");
56895
56922
  var import_fs3 = __toESM(require("fs"));
56896
56923
 
56897
56924
  // src/objectStore/utils.ts
56898
- var import_path = require("path");
56925
+ var import_path = __toESM(require("path"));
56899
56926
  var import_os = require("os");
56900
56927
  var import_fs2 = __toESM(require("fs"));
56901
56928
  var ObjectStoreBuckets = {
@@ -56935,6 +56962,40 @@ var bucketTTLConfig = (bucketName, days) => {
56935
56962
  };
56936
56963
  return params2;
56937
56964
  };
56965
+ async function processUrlAttachment(attachment) {
56966
+ const response = await fetch(attachment.url);
56967
+ if (!response.ok || !response.body) {
56968
+ throw new Error(`Unexpected response ${response.statusText}`);
56969
+ }
56970
+ const fallbackFilename = import_path.default.basename(new URL(attachment.url).pathname);
56971
+ return {
56972
+ filename: attachment.filename || fallbackFilename,
56973
+ content: response.body
56974
+ };
56975
+ }
56976
+ async function processObjectStoreAttachment(attachment) {
56977
+ const result = extractBucketAndPath(attachment.url);
56978
+ if (result === null) {
56979
+ throw new Error("Invalid signed URL");
56980
+ }
56981
+ const { bucket, path: objectPath } = result;
56982
+ const readStream = await getReadStream(bucket, objectPath);
56983
+ const fallbackFilename = import_path.default.basename(objectPath);
56984
+ return {
56985
+ bucket,
56986
+ path: objectPath,
56987
+ filename: attachment.filename || fallbackFilename,
56988
+ content: readStream
56989
+ };
56990
+ }
56991
+ async function processAutomationAttachment(attachment) {
56992
+ const isFullyFormedUrl = attachment.url?.startsWith("http://") || attachment.url?.startsWith("https://");
56993
+ if (isFullyFormedUrl) {
56994
+ return await processUrlAttachment(attachment);
56995
+ } else {
56996
+ return await processObjectStoreAttachment(attachment);
56997
+ }
56998
+ }
56938
56999
 
56939
57000
  // src/objectStore/objectStore.ts
56940
57001
  var import_uuid2 = require("uuid");
@@ -58256,7 +58317,7 @@ var streamPipeline = (0, import_util.promisify)(import_stream.default.pipeline);
58256
58317
  var STATE = {
58257
58318
  bucketCreationPromises: {}
58258
58319
  };
58259
- var signedFilePrefix = "/files/signed";
58320
+ var SIGNED_FILE_PREFIX = "/files/signed";
58260
58321
  var CONTENT_TYPE_MAP = {
58261
58322
  txt: "text/plain",
58262
58323
  html: "text/html",
@@ -58334,21 +58395,19 @@ async function createBucketIfNotExists(client, bucketName) {
58334
58395
  async function upload({
58335
58396
  bucket: bucketName,
58336
58397
  filename,
58337
- path: path2,
58398
+ path: path3,
58338
58399
  type,
58339
58400
  metadata,
58340
58401
  body: body2,
58341
58402
  ttl
58342
58403
  }) {
58343
58404
  const extension = filename.split(".").pop();
58344
- const fileBytes = path2 ? (await import_promises.default.open(path2)).createReadStream() : body2;
58405
+ const fileBytes = path3 ? (await import_promises.default.open(path3)).createReadStream() : body2;
58345
58406
  const objectStore = ObjectStore(bucketName);
58346
58407
  const bucketCreated = await createBucketIfNotExists(objectStore, bucketName);
58347
- if (ttl && (bucketCreated.created || bucketCreated.exists)) {
58408
+ if (ttl && bucketCreated.created) {
58348
58409
  let ttlConfig = bucketTTLConfig(bucketName, ttl);
58349
- if (objectStore.putBucketLifecycleConfiguration) {
58350
- await objectStore.putBucketLifecycleConfiguration(ttlConfig).promise();
58351
- }
58410
+ await objectStore.putBucketLifecycleConfiguration(ttlConfig).promise();
58352
58411
  }
58353
58412
  let contentType = type;
58354
58413
  if (!contentType) {
@@ -58381,11 +58440,9 @@ async function streamUpload({
58381
58440
  const extension = filename.split(".").pop();
58382
58441
  const objectStore = ObjectStore(bucketName);
58383
58442
  const bucketCreated = await createBucketIfNotExists(objectStore, bucketName);
58384
- if (ttl && (bucketCreated.created || bucketCreated.exists)) {
58443
+ if (ttl && bucketCreated.created) {
58385
58444
  let ttlConfig = bucketTTLConfig(bucketName, ttl);
58386
- if (objectStore.putBucketLifecycleConfiguration) {
58387
- await objectStore.putBucketLifecycleConfiguration(ttlConfig).promise();
58388
- }
58445
+ await objectStore.putBucketLifecycleConfiguration(ttlConfig).promise();
58389
58446
  }
58390
58447
  if (filename?.endsWith(".js")) {
58391
58448
  extra = {
@@ -58424,13 +58481,13 @@ async function retrieve(bucketName, filepath) {
58424
58481
  return response.Body;
58425
58482
  }
58426
58483
  }
58427
- async function listAllObjects(bucketName, path2) {
58484
+ async function listAllObjects(bucketName, path3) {
58428
58485
  const objectStore = ObjectStore(bucketName);
58429
58486
  const list = (params2 = {}) => {
58430
58487
  return objectStore.listObjectsV2({
58431
58488
  ...params2,
58432
58489
  Bucket: sanitizeBucket(bucketName),
58433
- Prefix: sanitizeKey(path2)
58490
+ Prefix: sanitizeKey(path3)
58434
58491
  }).promise();
58435
58492
  };
58436
58493
  let isTruncated = false, token, objects = [];
@@ -58460,9 +58517,9 @@ function getPresignedUrl(bucketName, key, durationSeconds = 3600) {
58460
58517
  return url;
58461
58518
  } else {
58462
58519
  const signedUrl = new URL(url);
58463
- const path2 = signedUrl.pathname;
58520
+ const path3 = signedUrl.pathname;
58464
58521
  const query = signedUrl.search;
58465
- return `${signedFilePrefix}${path2}${query}`;
58522
+ return `${SIGNED_FILE_PREFIX}${path3}${query}`;
58466
58523
  }
58467
58524
  }
58468
58525
  async function retrieveToTmp(bucketName, filepath) {
@@ -58473,10 +58530,10 @@ async function retrieveToTmp(bucketName, filepath) {
58473
58530
  import_fs3.default.writeFileSync(outputPath, data);
58474
58531
  return outputPath;
58475
58532
  }
58476
- async function retrieveDirectory(bucketName, path2) {
58533
+ async function retrieveDirectory(bucketName, path3) {
58477
58534
  let writePath = (0, import_path2.join)(budibaseTempDir(), (0, import_uuid2.v4)());
58478
58535
  import_fs3.default.mkdirSync(writePath);
58479
- const objects = await listAllObjects(bucketName, path2);
58536
+ const objects = await listAllObjects(bucketName, path3);
58480
58537
  let streams = await Promise.all(
58481
58538
  objects.map((obj) => getReadStream(bucketName, obj.Key))
58482
58539
  );
@@ -58521,7 +58578,7 @@ async function deleteFiles(bucketName, filepaths) {
58521
58578
  const params2 = {
58522
58579
  Bucket: bucketName,
58523
58580
  Delete: {
58524
- Objects: filepaths.map((path2) => ({ Key: sanitizeKey(path2) }))
58581
+ Objects: filepaths.map((path3) => ({ Key: sanitizeKey(path3) }))
58525
58582
  }
58526
58583
  };
58527
58584
  return objectStore.deleteObjects(params2).promise();
@@ -58557,15 +58614,15 @@ async function uploadDirectory(bucketName, localPath, bucketPath) {
58557
58614
  let uploads = [];
58558
58615
  const files = import_fs3.default.readdirSync(localPath, { withFileTypes: true });
58559
58616
  for (let file of files) {
58560
- const path2 = sanitizeKey((0, import_path2.join)(bucketPath, file.name));
58617
+ const path3 = sanitizeKey((0, import_path2.join)(bucketPath, file.name));
58561
58618
  const local = (0, import_path2.join)(localPath, file.name);
58562
58619
  if (file.isDirectory()) {
58563
- uploads.push(uploadDirectory(bucketName, local, path2));
58620
+ uploads.push(uploadDirectory(bucketName, local, path3));
58564
58621
  } else {
58565
58622
  uploads.push(
58566
58623
  streamUpload({
58567
58624
  bucket: bucketName,
58568
- filename: path2,
58625
+ filename: path3,
58569
58626
  stream: import_fs3.default.createReadStream(local)
58570
58627
  })
58571
58628
  );
@@ -58574,45 +58631,61 @@ async function uploadDirectory(bucketName, localPath, bucketPath) {
58574
58631
  await Promise.all(uploads);
58575
58632
  return files;
58576
58633
  }
58577
- async function downloadTarballDirect(url, path2, headers = {}) {
58578
- path2 = sanitizeKey(path2);
58634
+ async function downloadTarballDirect(url, path3, headers = {}) {
58635
+ path3 = sanitizeKey(path3);
58579
58636
  const response = await (0, import_node_fetch3.default)(url, { headers });
58580
58637
  if (!response.ok) {
58581
58638
  throw new Error(`unexpected response ${response.statusText}`);
58582
58639
  }
58583
- await streamPipeline(response.body, import_zlib.default.createUnzip(), import_tar_fs.default.extract(path2));
58640
+ await streamPipeline(response.body, import_zlib.default.createUnzip(), import_tar_fs.default.extract(path3));
58584
58641
  }
58585
- async function downloadTarball(url, bucketName, path2) {
58642
+ async function downloadTarball(url, bucketName, path3) {
58586
58643
  bucketName = sanitizeBucket(bucketName);
58587
- path2 = sanitizeKey(path2);
58644
+ path3 = sanitizeKey(path3);
58588
58645
  const response = await (0, import_node_fetch3.default)(url);
58589
58646
  if (!response.ok) {
58590
58647
  throw new Error(`unexpected response ${response.statusText}`);
58591
58648
  }
58592
- const tmpPath = (0, import_path2.join)(budibaseTempDir(), path2);
58649
+ const tmpPath = (0, import_path2.join)(budibaseTempDir(), path3);
58593
58650
  await streamPipeline(response.body, import_zlib.default.createUnzip(), import_tar_fs.default.extract(tmpPath));
58594
58651
  if (!environment_default.isTest() && environment_default.SELF_HOSTED) {
58595
- await uploadDirectory(bucketName, tmpPath, path2);
58652
+ await uploadDirectory(bucketName, tmpPath, path3);
58596
58653
  }
58597
58654
  return tmpPath;
58598
58655
  }
58599
- async function getReadStream(bucketName, path2) {
58656
+ async function getReadStream(bucketName, path3) {
58600
58657
  bucketName = sanitizeBucket(bucketName);
58601
- path2 = sanitizeKey(path2);
58658
+ path3 = sanitizeKey(path3);
58602
58659
  const client = ObjectStore(bucketName);
58603
58660
  const params2 = {
58604
58661
  Bucket: bucketName,
58605
- Key: path2
58662
+ Key: path3
58606
58663
  };
58607
58664
  return client.getObject(params2).createReadStream();
58608
58665
  }
58666
+ async function getObjectMetadata(bucket, path3) {
58667
+ bucket = sanitizeBucket(bucket);
58668
+ path3 = sanitizeKey(path3);
58669
+ const client = ObjectStore(bucket);
58670
+ const params2 = {
58671
+ Bucket: bucket,
58672
+ Key: path3
58673
+ };
58674
+ try {
58675
+ return await client.headObject(params2).promise();
58676
+ } catch (err) {
58677
+ throw new Error("Unable to retrieve metadata from object");
58678
+ }
58679
+ }
58609
58680
  function extractBucketAndPath(url) {
58610
58681
  const baseUrl = url.split("?")[0];
58611
- const regex = new RegExp(`^${signedFilePrefix}/(?<bucket>[^/]+)/(?<path>.+)$`);
58682
+ const regex = new RegExp(
58683
+ `^${SIGNED_FILE_PREFIX}/(?<bucket>[^/]+)/(?<path>.+)$`
58684
+ );
58612
58685
  const match = baseUrl.match(regex);
58613
58686
  if (match && match.groups) {
58614
- const { bucket, path: path2 } = match.groups;
58615
- return { bucket, path: path2 };
58687
+ const { bucket, path: path3 } = match.groups;
58688
+ return { bucket, path: path3 };
58616
58689
  }
58617
58690
  return null;
58618
58691
  }
@@ -65706,8 +65779,8 @@ async function encryptFile({ dir, filename }, secret) {
65706
65779
  });
65707
65780
  });
65708
65781
  }
65709
- async function getSaltAndIV(path2) {
65710
- const fileStream = import_fs5.default.createReadStream(path2);
65782
+ async function getSaltAndIV(path3) {
65783
+ const fileStream = import_fs5.default.createReadStream(path3);
65711
65784
  const salt = await readBytes(fileStream, SALT_LENGTH);
65712
65785
  const iv = await readBytes(fileStream, IV_LENGTH);
65713
65786
  fileStream.close();
@@ -65881,16 +65954,19 @@ function authenticated_default(noAuthPatterns = [], opts = {
65881
65954
  if (!authenticated) {
65882
65955
  authenticated = false;
65883
65956
  }
65884
- if (user) {
65957
+ const isUser = (user2) => {
65958
+ return user2 && user2.email;
65959
+ };
65960
+ if (isUser(user)) {
65885
65961
  import_dd_trace3.default.setUser({
65886
- id: user?._id,
65887
- tenantId: user?.tenantId,
65888
- budibaseAccess: user?.budibaseAccess,
65889
- status: user?.status
65962
+ id: user._id,
65963
+ tenantId: user.tenantId,
65964
+ budibaseAccess: user.budibaseAccess,
65965
+ status: user.status
65890
65966
  });
65891
65967
  }
65892
65968
  finalise(ctx, { authenticated, user, internal, version, publicEndpoint });
65893
- if (user && user.email) {
65969
+ if (isUser(user)) {
65894
65970
  return doInUserContext(user, ctx, next);
65895
65971
  } else {
65896
65972
  return next();