@budibase/backend-core 2.11.20 → 2.11.22

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
@@ -906,7 +906,7 @@ var init_view2 = __esm({
906
906
  });
907
907
 
908
908
  // ../types/src/documents/document.ts
909
- var SEPARATOR, UNICODE_MAX, prefixed, DocumentType;
909
+ var SEPARATOR, UNICODE_MAX, prefixed, DocumentType, InternalTable;
910
910
  var init_document = __esm({
911
911
  "../types/src/documents/document.ts"() {
912
912
  "use strict";
@@ -949,6 +949,10 @@ var init_document = __esm({
949
949
  DocumentType2["AUDIT_LOG"] = "al";
950
950
  return DocumentType2;
951
951
  })(DocumentType || {});
952
+ InternalTable = /* @__PURE__ */ ((InternalTable2) => {
953
+ InternalTable2["USER_METADATA"] = "ta_users";
954
+ return InternalTable2;
955
+ })(InternalTable || {});
952
956
  }
953
957
  });
954
958
 
@@ -1499,7 +1503,7 @@ var init_src = __esm({
1499
1503
  });
1500
1504
 
1501
1505
  // src/constants/db.ts
1502
- var AutomationViewMode, ViewName, DeprecatedViews, InternalTable, StaticDatabases, APP_PREFIX, APP_DEV, APP_DEV_PREFIX, BUDIBASE_DATASOURCE_TYPE;
1506
+ var AutomationViewMode, ViewName, DeprecatedViews, StaticDatabases, APP_PREFIX, APP_DEV, APP_DEV_PREFIX, BUDIBASE_DATASOURCE_TYPE;
1503
1507
  var init_db2 = __esm({
1504
1508
  "src/constants/db.ts"() {
1505
1509
  "use strict";
@@ -1530,10 +1534,6 @@ var init_db2 = __esm({
1530
1534
  "by_email"
1531
1535
  ]
1532
1536
  };
1533
- InternalTable = /* @__PURE__ */ ((InternalTable2) => {
1534
- InternalTable2["USER_METADATA"] = "ta_users";
1535
- return InternalTable2;
1536
- })(InternalTable || {});
1537
1537
  StaticDatabases = {
1538
1538
  GLOBAL: {
1539
1539
  name: "global-db",
@@ -3402,6 +3402,9 @@ function generateWorkspaceID() {
3402
3402
  function generateGlobalUserID(id) {
3403
3403
  return `${"us" /* USER */}${SEPARATOR}${id || newid()}`;
3404
3404
  }
3405
+ function isGlobalUserID(id) {
3406
+ return isGlobalUserIDRegex.test(id);
3407
+ }
3405
3408
  function generateUserMetadataID(globalId) {
3406
3409
  return generateRowID("ta_users" /* USER_METADATA */, globalId);
3407
3410
  }
@@ -3428,7 +3431,7 @@ function generateRoleID(name) {
3428
3431
  function prefixRoleID(name) {
3429
3432
  return generateRoleID(name);
3430
3433
  }
3431
- var generateAppID, generateDevInfoID, generatePluginID;
3434
+ var generateAppID, isGlobalUserIDRegex, generateDevInfoID, generatePluginID;
3432
3435
  var init_ids = __esm({
3433
3436
  "src/docIds/ids.ts"() {
3434
3437
  "use strict";
@@ -3441,6 +3444,7 @@ var init_ids = __esm({
3441
3444
  }
3442
3445
  return `${id}${newid()}`;
3443
3446
  };
3447
+ isGlobalUserIDRegex = new RegExp(`^${"us" /* USER */}${SEPARATOR}.+`);
3444
3448
  generateDevInfoID = (userId) => {
3445
3449
  return `${"devinfo" /* DEV_INFO */}${SEPARATOR}${userId}`;
3446
3450
  };
@@ -4685,6 +4689,7 @@ __export(db_exports, {
4685
4689
  isDevApp: () => isDevApp,
4686
4690
  isDevAppID: () => isDevAppID,
4687
4691
  isDocumentConflictError: () => isDocumentConflictError,
4692
+ isGlobalUserID: () => isGlobalUserID,
4688
4693
  isProdAppID: () => isProdAppID,
4689
4694
  isSameAppID: () => isSameAppID,
4690
4695
  isTableId: () => isTableId,
@@ -6744,6 +6749,8 @@ function getProdAppID2(appId) {
6744
6749
  // ../shared-core/src/sdk/documents/users.ts
6745
6750
  var users_exports2 = {};
6746
6751
  __export(users_exports2, {
6752
+ containsUserID: () => containsUserID,
6753
+ getGlobalUserID: () => getGlobalUserID,
6747
6754
  hasAdminPermissions: () => hasAdminPermissions,
6748
6755
  hasAppBuilderPermissions: () => hasAppBuilderPermissions,
6749
6756
  hasBuilderPermissions: () => hasBuilderPermissions,
@@ -6753,6 +6760,7 @@ __export(users_exports2, {
6753
6760
  isBuilder: () => isBuilder,
6754
6761
  isGlobalBuilder: () => isGlobalBuilder
6755
6762
  });
6763
+ init_src();
6756
6764
  function isBuilder(user, appId) {
6757
6765
  if (!user) {
6758
6766
  return false;
@@ -6799,6 +6807,43 @@ function hasAdminPermissions(user) {
6799
6807
  }
6800
6808
  return !!user.admin?.global;
6801
6809
  }
6810
+ function getGlobalUserID(userId) {
6811
+ if (typeof userId !== "string") {
6812
+ return userId;
6813
+ }
6814
+ const prefix = `${"ro" /* ROW */}${SEPARATOR}${"ta_users" /* USER_METADATA */}${SEPARATOR}`;
6815
+ if (!userId.startsWith(prefix)) {
6816
+ return userId;
6817
+ }
6818
+ return userId.split(prefix)[1];
6819
+ }
6820
+ function containsUserID(value) {
6821
+ if (typeof value !== "string") {
6822
+ return false;
6823
+ }
6824
+ return value.includes(`${"us" /* USER */}${SEPARATOR}`);
6825
+ }
6826
+
6827
+ // ../shared-core/src/table.ts
6828
+ init_src();
6829
+ var allowDisplayColumnByType = {
6830
+ ["string" /* STRING */]: true,
6831
+ ["longform" /* LONGFORM */]: true,
6832
+ ["options" /* OPTIONS */]: true,
6833
+ ["number" /* NUMBER */]: true,
6834
+ ["datetime" /* DATETIME */]: true,
6835
+ ["formula" /* FORMULA */]: true,
6836
+ ["auto" /* AUTO */]: true,
6837
+ ["internal" /* INTERNAL */]: true,
6838
+ ["barcodeqr" /* BARCODEQR */]: true,
6839
+ ["bigint" /* BIGINT */]: true,
6840
+ ["boolean" /* BOOLEAN */]: false,
6841
+ ["array" /* ARRAY */]: false,
6842
+ ["attachment" /* ATTACHMENT */]: false,
6843
+ ["link" /* LINK */]: false,
6844
+ ["json" /* JSON */]: false,
6845
+ ["bb_reference" /* BB_REFERENCE */]: false
6846
+ };
6802
6847
 
6803
6848
  // src/users/utils.ts
6804
6849
  var isBuilder2 = sdk_exports.users.isBuilder;