@budibase/backend-core 2.11.20-alpha.0 → 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
@@ -480,7 +480,7 @@ var init_migrations = __esm({
480
480
  });
481
481
 
482
482
  // ../types/src/sdk/datasources.ts
483
- var QueryType, DatasourceFieldType, SourceName, DatasourceFeature;
483
+ var QueryType, DatasourceFieldType, SourceName;
484
484
  var init_datasources = __esm({
485
485
  "../types/src/sdk/datasources.ts"() {
486
486
  "use strict";
@@ -524,12 +524,6 @@ var init_datasources = __esm({
524
524
  SourceName2["SNOWFLAKE"] = "SNOWFLAKE";
525
525
  return SourceName2;
526
526
  })(SourceName || {});
527
- DatasourceFeature = /* @__PURE__ */ ((DatasourceFeature2) => {
528
- DatasourceFeature2["CONNECTION_CHECKING"] = "connection";
529
- DatasourceFeature2["FETCH_TABLE_NAMES"] = "fetch_table_names";
530
- DatasourceFeature2["EXPORT_SCHEMA"] = "export_schema";
531
- return DatasourceFeature2;
532
- })(DatasourceFeature || {});
533
527
  }
534
528
  });
535
529
 
@@ -912,7 +906,7 @@ var init_view2 = __esm({
912
906
  });
913
907
 
914
908
  // ../types/src/documents/document.ts
915
- var SEPARATOR, UNICODE_MAX, prefixed, DocumentType;
909
+ var SEPARATOR, UNICODE_MAX, prefixed, DocumentType, InternalTable;
916
910
  var init_document = __esm({
917
911
  "../types/src/documents/document.ts"() {
918
912
  "use strict";
@@ -955,6 +949,10 @@ var init_document = __esm({
955
949
  DocumentType2["AUDIT_LOG"] = "al";
956
950
  return DocumentType2;
957
951
  })(DocumentType || {});
952
+ InternalTable = /* @__PURE__ */ ((InternalTable2) => {
953
+ InternalTable2["USER_METADATA"] = "ta_users";
954
+ return InternalTable2;
955
+ })(InternalTable || {});
958
956
  }
959
957
  });
960
958
 
@@ -1505,7 +1503,7 @@ var init_src = __esm({
1505
1503
  });
1506
1504
 
1507
1505
  // src/constants/db.ts
1508
- 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;
1509
1507
  var init_db2 = __esm({
1510
1508
  "src/constants/db.ts"() {
1511
1509
  "use strict";
@@ -1536,10 +1534,6 @@ var init_db2 = __esm({
1536
1534
  "by_email"
1537
1535
  ]
1538
1536
  };
1539
- InternalTable = /* @__PURE__ */ ((InternalTable2) => {
1540
- InternalTable2["USER_METADATA"] = "ta_users";
1541
- return InternalTable2;
1542
- })(InternalTable || {});
1543
1537
  StaticDatabases = {
1544
1538
  GLOBAL: {
1545
1539
  name: "global-db",
@@ -3408,6 +3402,9 @@ function generateWorkspaceID() {
3408
3402
  function generateGlobalUserID(id) {
3409
3403
  return `${"us" /* USER */}${SEPARATOR}${id || newid()}`;
3410
3404
  }
3405
+ function isGlobalUserID(id) {
3406
+ return isGlobalUserIDRegex.test(id);
3407
+ }
3411
3408
  function generateUserMetadataID(globalId) {
3412
3409
  return generateRowID("ta_users" /* USER_METADATA */, globalId);
3413
3410
  }
@@ -3434,7 +3431,7 @@ function generateRoleID(name) {
3434
3431
  function prefixRoleID(name) {
3435
3432
  return generateRoleID(name);
3436
3433
  }
3437
- var generateAppID, generateDevInfoID, generatePluginID;
3434
+ var generateAppID, isGlobalUserIDRegex, generateDevInfoID, generatePluginID;
3438
3435
  var init_ids = __esm({
3439
3436
  "src/docIds/ids.ts"() {
3440
3437
  "use strict";
@@ -3447,6 +3444,7 @@ var init_ids = __esm({
3447
3444
  }
3448
3445
  return `${id}${newid()}`;
3449
3446
  };
3447
+ isGlobalUserIDRegex = new RegExp(`^${"us" /* USER */}${SEPARATOR}.+`);
3450
3448
  generateDevInfoID = (userId) => {
3451
3449
  return `${"devinfo" /* DEV_INFO */}${SEPARATOR}${userId}`;
3452
3450
  };
@@ -4691,6 +4689,7 @@ __export(db_exports, {
4691
4689
  isDevApp: () => isDevApp,
4692
4690
  isDevAppID: () => isDevAppID,
4693
4691
  isDocumentConflictError: () => isDocumentConflictError,
4692
+ isGlobalUserID: () => isGlobalUserID,
4694
4693
  isProdAppID: () => isProdAppID,
4695
4694
  isSameAppID: () => isSameAppID,
4696
4695
  isTableId: () => isTableId,
@@ -6750,6 +6749,8 @@ function getProdAppID2(appId) {
6750
6749
  // ../shared-core/src/sdk/documents/users.ts
6751
6750
  var users_exports2 = {};
6752
6751
  __export(users_exports2, {
6752
+ containsUserID: () => containsUserID,
6753
+ getGlobalUserID: () => getGlobalUserID,
6753
6754
  hasAdminPermissions: () => hasAdminPermissions,
6754
6755
  hasAppBuilderPermissions: () => hasAppBuilderPermissions,
6755
6756
  hasBuilderPermissions: () => hasBuilderPermissions,
@@ -6759,6 +6760,7 @@ __export(users_exports2, {
6759
6760
  isBuilder: () => isBuilder,
6760
6761
  isGlobalBuilder: () => isGlobalBuilder
6761
6762
  });
6763
+ init_src();
6762
6764
  function isBuilder(user, appId) {
6763
6765
  if (!user) {
6764
6766
  return false;
@@ -6805,6 +6807,43 @@ function hasAdminPermissions(user) {
6805
6807
  }
6806
6808
  return !!user.admin?.global;
6807
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
+ };
6808
6847
 
6809
6848
  // src/users/utils.ts
6810
6849
  var isBuilder2 = sdk_exports.users.isBuilder;
@@ -12310,23 +12349,9 @@ function validateDatasource(schema) {
12310
12349
  version: import_joi2.default.string().optional(),
12311
12350
  schema: import_joi2.default.object({
12312
12351
  docs: import_joi2.default.string(),
12313
- plus: import_joi2.default.boolean().optional(),
12314
- isSQL: import_joi2.default.boolean().optional(),
12315
- auth: import_joi2.default.object({
12316
- type: import_joi2.default.string().required()
12317
- }).optional(),
12318
- features: import_joi2.default.object(
12319
- Object.fromEntries(
12320
- Object.values(DatasourceFeature).map((key) => [
12321
- key,
12322
- import_joi2.default.boolean().optional()
12323
- ])
12324
- )
12325
- ).optional(),
12326
- relationships: import_joi2.default.boolean().optional(),
12327
- description: import_joi2.default.string().required(),
12328
12352
  friendlyName: import_joi2.default.string().required(),
12329
12353
  type: import_joi2.default.string().allow(...DATASOURCE_TYPES),
12354
+ description: import_joi2.default.string().required(),
12330
12355
  datasource: import_joi2.default.object().pattern(import_joi2.default.string(), fieldValidator).required(),
12331
12356
  query: import_joi2.default.object().pattern(import_joi2.default.string(), queryValidator).unknown(true).required(),
12332
12357
  extra: import_joi2.default.object().pattern(