@budibase/backend-core 2.32.15 → 2.32.17

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
@@ -61720,10 +61720,23 @@ var DocumentType = /* @__PURE__ */ ((DocumentType2) => {
61720
61720
  DocumentType2["ROW_ACTIONS"] = "ra";
61721
61721
  return DocumentType2;
61722
61722
  })(DocumentType || {});
61723
+ var sortedDocumentTypes = Object.values(DocumentType).sort(
61724
+ (a, b) => b.length - a.length
61725
+ // descending
61726
+ );
61723
61727
  var InternalTable = /* @__PURE__ */ ((InternalTable2) => {
61724
61728
  InternalTable2["USER_METADATA"] = "ta_users";
61725
61729
  return InternalTable2;
61726
61730
  })(InternalTable || {});
61731
+ var VirtualDocumentType = /* @__PURE__ */ ((VirtualDocumentType2) => {
61732
+ VirtualDocumentType2["VIEW"] = "view";
61733
+ VirtualDocumentType2["ROW_ACTION"] = "row_action";
61734
+ return VirtualDocumentType2;
61735
+ })(VirtualDocumentType || {});
61736
+ var sortedVirtualDocumentTypes = Object.values(VirtualDocumentType).sort(
61737
+ (a, b) => b.length - a.length
61738
+ // descending
61739
+ );
61727
61740
 
61728
61741
  // ../types/src/documents/global/user.ts
61729
61742
  function isSSOUser(user) {
@@ -62292,7 +62305,8 @@ __export(views_exports, {
62292
62305
  hasCalculationFields: () => hasCalculationFields,
62293
62306
  isBasicViewField: () => isBasicViewField,
62294
62307
  isCalculationField: () => isCalculationField,
62295
- isCalculationView: () => isCalculationView
62308
+ isCalculationView: () => isCalculationView,
62309
+ isVisible: () => isVisible
62296
62310
  });
62297
62311
  var import_lodash = require("lodash");
62298
62312
  function isCalculationField(field) {
@@ -62310,8 +62324,14 @@ function hasCalculationFields(view) {
62310
62324
  function calculationFields(view) {
62311
62325
  return (0, import_lodash.pickBy)(view.schema || {}, isCalculationField);
62312
62326
  }
62313
- function basicFields(view) {
62314
- return (0, import_lodash.pickBy)(view.schema || {}, (field) => !isCalculationField(field));
62327
+ function isVisible(field) {
62328
+ return field.visible !== false;
62329
+ }
62330
+ function basicFields(view, opts) {
62331
+ const { visible = true } = opts || {};
62332
+ return (0, import_lodash.pickBy)(view.schema || {}, (field) => {
62333
+ return !isCalculationField(field) && (!visible || isVisible(field));
62334
+ });
62315
62335
  }
62316
62336
 
62317
62337
  // ../shared-core/src/filters.ts
@@ -64004,6 +64024,12 @@ var DDInstrumentedDatabase = class {
64004
64024
  return this.db.get(id);
64005
64025
  });
64006
64026
  }
64027
+ tryGet(id) {
64028
+ return import_dd_trace.default.trace("db.tryGet", (span) => {
64029
+ span?.addTags({ db_name: this.name, doc_id: id });
64030
+ return this.db.tryGet(id);
64031
+ });
64032
+ }
64007
64033
  getMultiple(ids, opts) {
64008
64034
  return import_dd_trace.default.trace("db.getMultiple", (span) => {
64009
64035
  span?.addTags({
@@ -67704,7 +67730,8 @@ var flags = new FlagSet({
67704
67730
  AUTOMATION_BRANCHING: Flag.boolean(environment_default.isDev()),
67705
67731
  SQS: Flag.boolean(environment_default.isDev()),
67706
67732
  ["AI_CUSTOM_CONFIGS" /* AI_CUSTOM_CONFIGS */]: Flag.boolean(environment_default.isDev()),
67707
- ["ENRICHED_RELATIONSHIPS" /* ENRICHED_RELATIONSHIPS */]: Flag.boolean(environment_default.isDev())
67733
+ ["ENRICHED_RELATIONSHIPS" /* ENRICHED_RELATIONSHIPS */]: Flag.boolean(environment_default.isDev()),
67734
+ ["TABLES_DEFAULT_ADMIN" /* TABLES_DEFAULT_ADMIN */]: Flag.boolean(environment_default.isDev())
67708
67735
  });
67709
67736
 
67710
67737
  // src/features/tests/utils.ts
@@ -67889,6 +67916,16 @@ var DatabaseImpl = class _DatabaseImpl {
67889
67916
  return () => db.get(id);
67890
67917
  });
67891
67918
  }
67919
+ async tryGet(id) {
67920
+ try {
67921
+ return await this.get(id);
67922
+ } catch (err) {
67923
+ if (err.statusCode === 404) {
67924
+ return void 0;
67925
+ }
67926
+ throw err;
67927
+ }
67928
+ }
67892
67929
  async getMultiple(ids, opts) {
67893
67930
  ids = [...new Set(ids)];
67894
67931
  const includeDocs = !opts?.excludeDocs;
@@ -69748,7 +69785,9 @@ function getDBRoleID(roleName) {
69748
69785
  }
69749
69786
  function getExternalRoleID(roleId, version) {
69750
69787
  if (roleId.startsWith("role" /* ROLE */) && (isBuiltin(roleId) || version === RoleIDVersion.NAME)) {
69751
- return roleId.split(`${"role" /* ROLE */}${SEPARATOR}`)[1];
69788
+ const parts = roleId.split(SEPARATOR);
69789
+ parts.shift();
69790
+ return parts.join(SEPARATOR);
69752
69791
  }
69753
69792
  return roleId;
69754
69793
  }
@@ -76433,6 +76472,9 @@ var InternalBuilder = class {
76433
76472
  }
76434
76473
  create(opts) {
76435
76474
  const { body: body2 } = this.query;
76475
+ if (!body2) {
76476
+ throw new Error("Cannot create without row body");
76477
+ }
76436
76478
  let query = this.qualifiedKnex({ alias: false });
76437
76479
  const parsedBody = this.parseBody(body2);
76438
76480
  if (this.client === "oracledb" /* ORACLE */) {
@@ -76540,6 +76582,9 @@ var InternalBuilder = class {
76540
76582
  }
76541
76583
  update(opts) {
76542
76584
  const { body: body2, filters } = this.query;
76585
+ if (!body2) {
76586
+ throw new Error("Cannot update without row body");
76587
+ }
76543
76588
  let query = this.qualifiedKnex();
76544
76589
  const parsedBody = this.parseBody(body2);
76545
76590
  query = this.addFilters(query, filters);