@budibase/backend-core 3.18.5 → 3.18.6

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.
Files changed (65) hide show
  1. package/dist/index.js +13 -13
  2. package/dist/index.js.map +4 -4
  3. package/dist/package.json +2 -2
  4. package/dist/src/cache/index.d.ts +5 -5
  5. package/dist/src/cache/index.js +6 -6
  6. package/dist/src/cache/index.js.map +1 -1
  7. package/dist/src/cache/workspaceMetadata.d.ts +22 -0
  8. package/dist/src/cache/{appMetadata.js → workspaceMetadata.js} +32 -32
  9. package/dist/src/cache/workspaceMetadata.js.map +1 -0
  10. package/dist/src/constants/db.d.ts +7 -7
  11. package/dist/src/constants/db.js +10 -10
  12. package/dist/src/constants/db.js.map +1 -1
  13. package/dist/src/context/mainContext.d.ts +18 -18
  14. package/dist/src/context/mainContext.js +68 -68
  15. package/dist/src/context/mainContext.js.map +1 -1
  16. package/dist/src/db/utils.d.ts +11 -11
  17. package/dist/src/db/utils.js +43 -43
  18. package/dist/src/db/utils.js.map +1 -1
  19. package/dist/src/db/views.d.ts +1 -1
  20. package/dist/src/db/views.js +5 -5
  21. package/dist/src/db/views.js.map +1 -1
  22. package/dist/src/docIds/conversions.d.ts +8 -10
  23. package/dist/src/docIds/conversions.js +33 -40
  24. package/dist/src/docIds/conversions.js.map +1 -1
  25. package/dist/src/docIds/ids.d.ts +4 -9
  26. package/dist/src/docIds/ids.js +8 -16
  27. package/dist/src/docIds/ids.js.map +1 -1
  28. package/dist/src/docIds/params.d.ts +2 -2
  29. package/dist/src/docIds/params.js +4 -4
  30. package/dist/src/docIds/params.js.map +1 -1
  31. package/dist/src/environment.js +2 -2
  32. package/dist/src/environment.js.map +1 -1
  33. package/dist/src/events/processors/AuditLogsProcessor.d.ts +2 -2
  34. package/dist/src/events/processors/AuditLogsProcessor.js +2 -2
  35. package/dist/src/events/processors/AuditLogsProcessor.js.map +1 -1
  36. package/dist/src/events/processors/posthog/PosthogProcessor.d.ts +1 -1
  37. package/dist/src/events/processors/posthog/PosthogProcessor.js +3 -3
  38. package/dist/src/events/processors/posthog/PosthogProcessor.js.map +1 -1
  39. package/dist/src/events/processors/posthog/rateLimiting.js +2 -2
  40. package/dist/src/events/processors/posthog/rateLimiting.js.map +1 -1
  41. package/dist/src/index.d.ts +11 -11
  42. package/dist/src/logging/pino/logger.js +4 -4
  43. package/dist/src/logging/pino/logger.js.map +1 -1
  44. package/dist/src/objectStore/objectStore.js +1 -1
  45. package/dist/src/objectStore/objectStore.js.map +1 -1
  46. package/dist/src/redis/init.d.ts +1 -1
  47. package/dist/src/redis/init.js +8 -8
  48. package/dist/src/redis/init.js.map +1 -1
  49. package/dist/src/redis/redlockImpl.d.ts +1 -1
  50. package/dist/src/redis/redlockImpl.js +3 -3
  51. package/dist/src/redis/redlockImpl.js.map +1 -1
  52. package/dist/src/redis/utils.d.ts +1 -1
  53. package/dist/src/redis/utils.js +1 -1
  54. package/dist/src/redis/utils.js.map +1 -1
  55. package/dist/src/security/permissions.d.ts +1 -1
  56. package/dist/src/tenancy/tenancy.js +2 -2
  57. package/dist/src/tenancy/tenancy.js.map +1 -1
  58. package/dist/src/users/users.d.ts +1 -1
  59. package/dist/src/users/users.js +11 -11
  60. package/dist/src/users/users.js.map +1 -1
  61. package/dist/src/utils/utils.js +5 -5
  62. package/dist/src/utils/utils.js.map +1 -1
  63. package/package.json +2 -2
  64. package/dist/src/cache/appMetadata.d.ts +0 -22
  65. package/dist/src/cache/appMetadata.js.map +0 -1
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/backend-core",
3
- "version": "3.18.5",
3
+ "version": "3.18.6",
4
4
  "description": "Budibase backend core libraries used in server and worker",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -112,5 +112,5 @@
112
112
  }
113
113
  }
114
114
  },
115
- "gitHead": "ed229ab880f5eeb626d86fd1131e2e6e88f98f6b"
115
+ "gitHead": "0062775fce7e68e01263a9c5a5e94bf978da8746"
116
116
  }
@@ -1,8 +1,8 @@
1
+ export * as docWritethrough from "./docWritethrough";
2
+ export * from "./generic";
1
3
  export * as generic from "./generic";
2
- export * as user from "./user";
3
- export * as app from "./appMetadata";
4
- export * as writethrough from "./writethrough";
5
4
  export * as invite from "./invite";
6
5
  export * as passwordReset from "./passwordReset";
7
- export * from "./generic";
8
- export * as docWritethrough from "./docWritethrough";
6
+ export * as user from "./user";
7
+ export * as workspace from "./workspaceMetadata";
8
+ export * as writethrough from "./writethrough";
@@ -36,13 +36,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.docWritethrough = exports.passwordReset = exports.invite = exports.writethrough = exports.app = exports.user = exports.generic = void 0;
39
+ exports.writethrough = exports.workspace = exports.user = exports.passwordReset = exports.invite = exports.generic = exports.docWritethrough = void 0;
40
+ exports.docWritethrough = __importStar(require("./docWritethrough"));
41
+ __exportStar(require("./generic"), exports);
40
42
  exports.generic = __importStar(require("./generic"));
41
- exports.user = __importStar(require("./user"));
42
- exports.app = __importStar(require("./appMetadata"));
43
- exports.writethrough = __importStar(require("./writethrough"));
44
43
  exports.invite = __importStar(require("./invite"));
45
44
  exports.passwordReset = __importStar(require("./passwordReset"));
46
- __exportStar(require("./generic"), exports);
47
- exports.docWritethrough = __importStar(require("./docWritethrough"));
45
+ exports.user = __importStar(require("./user"));
46
+ exports.workspace = __importStar(require("./workspaceMetadata"));
47
+ exports.writethrough = __importStar(require("./writethrough"));
48
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cache/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAoC;AACpC,+CAA8B;AAC9B,qDAAoC;AACpC,+DAA8C;AAC9C,mDAAkC;AAClC,iEAAgD;AAChD,4CAAyB;AACzB,qEAAoD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cache/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAoD;AACpD,4CAAyB;AACzB,qDAAoC;AACpC,mDAAkC;AAClC,iEAAgD;AAChD,+CAA8B;AAC9B,iEAAgD;AAChD,+DAA8C"}
@@ -0,0 +1,22 @@
1
+ import { Workspace } from "@budibase/types";
2
+ export declare enum WorkspaceState {
3
+ INVALID = "invalid"
4
+ }
5
+ export interface DeletedWorkspace {
6
+ state: WorkspaceState;
7
+ }
8
+ /**
9
+ * Get the requested workspace metadata by id.
10
+ * Use redis cache to first read the workspace metadata.
11
+ * If not present fallback to loading the workspace metadata directly and re-caching.
12
+ * @param workspaceId the id of the workspace to get metadata from.
13
+ * @returns the workspace metadata.
14
+ */
15
+ export declare function getWorkspaceMetadata(workspaceId: string): Promise<Workspace | DeletedWorkspace>;
16
+ /**
17
+ * Invalidate/reset the cached metadata when a change occurs in the db.
18
+ * @param workspaceId the cache key to bust/update.
19
+ * @param newMetadata optional - can simply provide the new metadata to update with.
20
+ * @return will respond with success when cache is updated.
21
+ */
22
+ export declare function invalidateWorkspaceMetadata(workspaceId: string, newMetadata?: any): Promise<void>;
@@ -9,52 +9,52 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AppState = void 0;
13
- exports.getAppMetadata = getAppMetadata;
14
- exports.invalidateAppMetadata = invalidateAppMetadata;
12
+ exports.WorkspaceState = void 0;
13
+ exports.getWorkspaceMetadata = getWorkspaceMetadata;
14
+ exports.invalidateWorkspaceMetadata = invalidateWorkspaceMetadata;
15
15
  const db_1 = require("../db");
16
16
  const init_1 = require("../redis/init");
17
- var AppState;
18
- (function (AppState) {
19
- AppState["INVALID"] = "invalid";
20
- })(AppState || (exports.AppState = AppState = {}));
17
+ var WorkspaceState;
18
+ (function (WorkspaceState) {
19
+ WorkspaceState["INVALID"] = "invalid";
20
+ })(WorkspaceState || (exports.WorkspaceState = WorkspaceState = {}));
21
21
  const EXPIRY_SECONDS = 3600;
22
22
  const INVALID_EXPIRY_SECONDS = 60;
23
23
  /**
24
- * The default populate app metadata function
24
+ * The default populate workspace metadata function
25
25
  */
26
- function populateFromDB(appId) {
26
+ function populateFromDB(workspaceId) {
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
- return (0, db_1.doWithDB)(appId, (db) => {
28
+ return (0, db_1.doWithDB)(workspaceId, (db) => {
29
29
  return db.get(db_1.DocumentType.APP_METADATA);
30
30
  }, { skip_setup: true });
31
31
  });
32
32
  }
33
33
  function isInvalid(metadata) {
34
- return !metadata || metadata.state === AppState.INVALID;
34
+ return !metadata || metadata.state === WorkspaceState.INVALID;
35
35
  }
36
36
  /**
37
- * Get the requested app metadata by id.
38
- * Use redis cache to first read the app metadata.
39
- * If not present fallback to loading the app metadata directly and re-caching.
40
- * @param appId the id of the app to get metadata from.
41
- * @returns the app metadata.
37
+ * Get the requested workspace metadata by id.
38
+ * Use redis cache to first read the workspace metadata.
39
+ * If not present fallback to loading the workspace metadata directly and re-caching.
40
+ * @param workspaceId the id of the workspace to get metadata from.
41
+ * @returns the workspace metadata.
42
42
  */
43
- function getAppMetadata(appId) {
43
+ function getWorkspaceMetadata(workspaceId) {
44
44
  return __awaiter(this, void 0, void 0, function* () {
45
- const client = yield (0, init_1.getAppClient)();
45
+ const client = yield (0, init_1.getWorkspaceClient)();
46
46
  // try cache
47
- let metadata = yield client.get(appId);
47
+ let metadata = yield client.get(workspaceId);
48
48
  if (!metadata) {
49
49
  let expiry = EXPIRY_SECONDS;
50
50
  try {
51
- metadata = yield populateFromDB(appId);
51
+ metadata = yield populateFromDB(workspaceId);
52
52
  }
53
53
  catch (err) {
54
- // app DB left around, but no metadata, it is invalid
54
+ // workspace DB left around, but no metadata, it is invalid
55
55
  if (err && err.status === 404) {
56
- metadata = { state: AppState.INVALID };
57
- // expire invalid apps regularly, in-case it was only briefly invalid
56
+ metadata = { state: WorkspaceState.INVALID };
57
+ // expire invalid workspaces regularly, in-case it was only briefly invalid
58
58
  expiry = INVALID_EXPIRY_SECONDS;
59
59
  }
60
60
  else {
@@ -65,32 +65,32 @@ function getAppMetadata(appId) {
65
65
  // so quickly the requests can get slightly out of sync
66
66
  // might store its invalid just before it stores its valid
67
67
  if (isInvalid(metadata)) {
68
- const temp = yield client.get(appId);
68
+ const temp = yield client.get(workspaceId);
69
69
  if (temp) {
70
70
  metadata = temp;
71
71
  }
72
72
  }
73
- yield client.store(appId, metadata, expiry);
73
+ yield client.store(workspaceId, metadata, expiry);
74
74
  }
75
75
  return metadata;
76
76
  });
77
77
  }
78
78
  /**
79
79
  * Invalidate/reset the cached metadata when a change occurs in the db.
80
- * @param appId the cache key to bust/update.
80
+ * @param workspaceId the cache key to bust/update.
81
81
  * @param newMetadata optional - can simply provide the new metadata to update with.
82
82
  * @return will respond with success when cache is updated.
83
83
  */
84
- function invalidateAppMetadata(appId, newMetadata) {
84
+ function invalidateWorkspaceMetadata(workspaceId, newMetadata) {
85
85
  return __awaiter(this, void 0, void 0, function* () {
86
- if (!appId) {
86
+ if (!workspaceId) {
87
87
  throw "Cannot invalidate if no app ID provided.";
88
88
  }
89
- const client = yield (0, init_1.getAppClient)();
90
- yield client.delete(appId);
89
+ const client = yield (0, init_1.getWorkspaceClient)();
90
+ yield client.delete(workspaceId);
91
91
  if (newMetadata) {
92
- yield client.store(appId, newMetadata, EXPIRY_SECONDS);
92
+ yield client.store(workspaceId, newMetadata, EXPIRY_SECONDS);
93
93
  }
94
94
  });
95
95
  }
96
- //# sourceMappingURL=appMetadata.js.map
96
+ //# sourceMappingURL=workspaceMetadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaceMetadata.js","sourceRoot":"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;oBAC3E,MAAM,GAAG,sBAAsB,CAAA;gBACjC,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,CAAA;gBACX,CAAC;YACH,CAAC;YACD,sDAAsD;YACtD,uDAAuD;YACvD,0DAA0D;YAC1D,IAAI,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACxB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;gBAC1C,IAAI,IAAI,EAAE,CAAC;oBACT,QAAQ,GAAG,IAAI,CAAA;gBACjB,CAAC;YACH,CAAC;YACD,MAAM,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;QACnD,CAAC;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;CAAA;AAED;;;;;GAKG;AACH,SAAsB,2BAA2B,CAC/C,WAAmB,EACnB,WAAiB;;QAEjB,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,0CAA0C,CAAA;QAClD,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAA,yBAAkB,GAAE,CAAA;QACzC,MAAM,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;QAChC,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,EAAE,cAAc,CAAC,CAAA;QAC9D,CAAC;IACH,CAAC;CAAA"}
@@ -1,4 +1,5 @@
1
- export { SEPARATOR, UNICODE_MAX, DocumentType, InternalTable, } from "@budibase/types";
1
+ export { DEFAULT_BB_DATASOURCE_ID } from "@budibase/shared-core";
2
+ export { DocumentType, InternalTable, SEPARATOR, UNICODE_MAX, } from "@budibase/types";
2
3
  /**
3
4
  * Can be used to create a few different forms of querying a view.
4
5
  */
@@ -8,7 +9,7 @@ export declare enum AutomationViewMode {
8
9
  STATUS = "status"
9
10
  }
10
11
  export declare enum ViewName {
11
- USER_BY_APP = "by_app",
12
+ USER_BY_WORKSPACE = "by_app",
12
13
  USER_BY_EMAIL = "by_email2",
13
14
  BY_API_KEY = "by_api_key",
14
15
  LINK = "by_link",
@@ -17,7 +18,7 @@ export declare enum ViewName {
17
18
  ACCOUNT_BY_EMAIL = "account_by_email",
18
19
  PLATFORM_USERS_LOWERCASE = "platform_users_lowercase_2",
19
20
  USER_BY_GROUP = "user_by_group",
20
- APP_BACKUP_BY_TRIGGER = "by_trigger"
21
+ WORKSPACE_BACKUP_BY_TRIGGER = "by_trigger"
21
22
  }
22
23
  export declare const DeprecatedViews: Record<string, string[]>;
23
24
  export declare const StaticDatabases: {
@@ -47,9 +48,9 @@ export declare const StaticDatabases: {
47
48
  name: string;
48
49
  };
49
50
  };
50
- export declare const APP_PREFIX: string;
51
- export declare const APP_DEV: string;
52
- export declare const APP_DEV_PREFIX: string;
51
+ export declare const WORKSPACE_PREFIX: string;
52
+ export declare const WORKSPACE_DEV: string;
53
+ export declare const WORKSPACE_DEV_PREFIX: string;
53
54
  export declare const SQS_DATASOURCE_INTERNAL = "internal";
54
55
  export declare const BUDIBASE_DATASOURCE_TYPE = "budibase";
55
56
  export declare const SQLITE_DESIGN_DOC_ID = "_design/sqlite";
@@ -57,7 +58,6 @@ export declare const DEFAULT_JOBS_TABLE_ID = "ta_bb_jobs";
57
58
  export declare const DEFAULT_INVENTORY_TABLE_ID = "ta_bb_inventory";
58
59
  export declare const DEFAULT_EXPENSES_TABLE_ID = "ta_bb_expenses";
59
60
  export declare const DEFAULT_EMPLOYEE_TABLE_ID = "ta_bb_employee";
60
- export { DEFAULT_BB_DATASOURCE_ID } from "@budibase/shared-core";
61
61
  export declare const USER_METADATA_PREFIX = "ro_ta_users_";
62
62
  export declare const enum DesignDocuments {
63
63
  SQLITE = "_design/sqlite",
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DesignDocuments = exports.USER_METADATA_PREFIX = exports.DEFAULT_BB_DATASOURCE_ID = exports.DEFAULT_EMPLOYEE_TABLE_ID = exports.DEFAULT_EXPENSES_TABLE_ID = exports.DEFAULT_INVENTORY_TABLE_ID = exports.DEFAULT_JOBS_TABLE_ID = exports.SQLITE_DESIGN_DOC_ID = exports.BUDIBASE_DATASOURCE_TYPE = exports.SQS_DATASOURCE_INTERNAL = exports.APP_DEV_PREFIX = exports.APP_DEV = exports.APP_PREFIX = exports.StaticDatabases = exports.DeprecatedViews = exports.ViewName = exports.AutomationViewMode = exports.InternalTable = exports.DocumentType = exports.UNICODE_MAX = exports.SEPARATOR = void 0;
3
+ exports.DesignDocuments = exports.USER_METADATA_PREFIX = exports.DEFAULT_EMPLOYEE_TABLE_ID = exports.DEFAULT_EXPENSES_TABLE_ID = exports.DEFAULT_INVENTORY_TABLE_ID = exports.DEFAULT_JOBS_TABLE_ID = exports.SQLITE_DESIGN_DOC_ID = exports.BUDIBASE_DATASOURCE_TYPE = exports.SQS_DATASOURCE_INTERNAL = exports.WORKSPACE_DEV_PREFIX = exports.WORKSPACE_DEV = exports.WORKSPACE_PREFIX = exports.StaticDatabases = exports.DeprecatedViews = exports.ViewName = exports.AutomationViewMode = exports.UNICODE_MAX = exports.SEPARATOR = exports.InternalTable = exports.DocumentType = exports.DEFAULT_BB_DATASOURCE_ID = void 0;
4
4
  const types_1 = require("@budibase/types");
5
+ var shared_core_1 = require("@budibase/shared-core");
6
+ Object.defineProperty(exports, "DEFAULT_BB_DATASOURCE_ID", { enumerable: true, get: function () { return shared_core_1.DEFAULT_BB_DATASOURCE_ID; } });
5
7
  var types_2 = require("@budibase/types");
6
- Object.defineProperty(exports, "SEPARATOR", { enumerable: true, get: function () { return types_2.SEPARATOR; } });
7
- Object.defineProperty(exports, "UNICODE_MAX", { enumerable: true, get: function () { return types_2.UNICODE_MAX; } });
8
8
  Object.defineProperty(exports, "DocumentType", { enumerable: true, get: function () { return types_2.DocumentType; } });
9
9
  Object.defineProperty(exports, "InternalTable", { enumerable: true, get: function () { return types_2.InternalTable; } });
10
+ Object.defineProperty(exports, "SEPARATOR", { enumerable: true, get: function () { return types_2.SEPARATOR; } });
11
+ Object.defineProperty(exports, "UNICODE_MAX", { enumerable: true, get: function () { return types_2.UNICODE_MAX; } });
10
12
  /**
11
13
  * Can be used to create a few different forms of querying a view.
12
14
  */
@@ -18,7 +20,7 @@ var AutomationViewMode;
18
20
  })(AutomationViewMode || (exports.AutomationViewMode = AutomationViewMode = {}));
19
21
  var ViewName;
20
22
  (function (ViewName) {
21
- ViewName["USER_BY_APP"] = "by_app";
23
+ ViewName["USER_BY_WORKSPACE"] = "by_app";
22
24
  ViewName["USER_BY_EMAIL"] = "by_email2";
23
25
  ViewName["BY_API_KEY"] = "by_api_key";
24
26
  ViewName["LINK"] = "by_link";
@@ -27,7 +29,7 @@ var ViewName;
27
29
  ViewName["ACCOUNT_BY_EMAIL"] = "account_by_email";
28
30
  ViewName["PLATFORM_USERS_LOWERCASE"] = "platform_users_lowercase_2";
29
31
  ViewName["USER_BY_GROUP"] = "user_by_group";
30
- ViewName["APP_BACKUP_BY_TRIGGER"] = "by_trigger";
32
+ ViewName["WORKSPACE_BACKUP_BY_TRIGGER"] = "by_trigger";
31
33
  })(ViewName || (exports.ViewName = ViewName = {}));
32
34
  exports.DeprecatedViews = {
33
35
  [ViewName.USER_BY_EMAIL]: [
@@ -65,9 +67,9 @@ exports.StaticDatabases = {
65
67
  name: "self-host-cloud",
66
68
  },
67
69
  };
68
- exports.APP_PREFIX = (0, types_1.prefixed)(types_1.DocumentType.APP);
69
- exports.APP_DEV = (0, types_1.prefixed)(types_1.DocumentType.APP_DEV);
70
- exports.APP_DEV_PREFIX = exports.APP_DEV;
70
+ exports.WORKSPACE_PREFIX = (0, types_1.prefixed)(types_1.DocumentType.APP);
71
+ exports.WORKSPACE_DEV = (0, types_1.prefixed)(types_1.DocumentType.APP_DEV);
72
+ exports.WORKSPACE_DEV_PREFIX = exports.WORKSPACE_DEV;
71
73
  exports.SQS_DATASOURCE_INTERNAL = "internal";
72
74
  exports.BUDIBASE_DATASOURCE_TYPE = "budibase";
73
75
  exports.SQLITE_DESIGN_DOC_ID = "_design/sqlite";
@@ -75,8 +77,6 @@ exports.DEFAULT_JOBS_TABLE_ID = "ta_bb_jobs";
75
77
  exports.DEFAULT_INVENTORY_TABLE_ID = "ta_bb_inventory";
76
78
  exports.DEFAULT_EXPENSES_TABLE_ID = "ta_bb_expenses";
77
79
  exports.DEFAULT_EMPLOYEE_TABLE_ID = "ta_bb_employee";
78
- var shared_core_1 = require("@budibase/shared-core");
79
- Object.defineProperty(exports, "DEFAULT_BB_DATASOURCE_ID", { enumerable: true, get: function () { return shared_core_1.DEFAULT_BB_DATASOURCE_ID; } });
80
80
  exports.USER_METADATA_PREFIX = `${types_1.DocumentType.ROW}${types_1.SEPARATOR}${types_1.InternalTable.USER_METADATA}${types_1.SEPARATOR}`;
81
81
  var DesignDocuments;
82
82
  (function (DesignDocuments) {
@@ -1 +1 @@
1
- {"version":3,"file":"db.js","sourceRoot":"","sources":["../../../src/constants/db.ts"],"names":[],"mappings":";;;AAAA,2CAKwB;AAExB,yCAKwB;AAJtB,kGAAA,SAAS,OAAA;AACT,oGAAA,WAAW,OAAA;AACX,qGAAA,YAAY,OAAA;AACZ,sGAAA,aAAa,OAAA;AAGf;;GAEG;AACH,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,iCAAW,CAAA;IACX,+CAAyB,CAAA;IACzB,uCAAiB,CAAA;AACnB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B;AAED,IAAY,QAWX;AAXD,WAAY,QAAQ;IAClB,kCAAsB,CAAA;IACtB,uCAA2B,CAAA;IAC3B,qCAAyB,CAAA;IACzB,4BAAgB,CAAA;IAChB,uCAA2B,CAAA;IAC3B,+CAAmC,CAAA;IACnC,iDAAqC,CAAA;IACrC,mEAAuD,CAAA;IACvD,2CAA+B,CAAA;IAC/B,gDAAoC,CAAA;AACtC,CAAC,EAXW,QAAQ,wBAAR,QAAQ,QAWnB;AA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,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,SAAS;SACnB;KACF;IACD,UAAU,EAAE;QACV,IAAI,EAAE,YAAY;KACnB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,WAAW;KAClB;IACD,6EAA6E;IAC7E,mEAAmE;IACnE,eAAe,EAAE;QACf,IAAI,EAAE,iBAAiB;KACxB;CACF,CAAA;AAEY,QAAA,gBAAgB,GAAG,IAAA,gBAAQ,EAAC,oBAAY,CAAC,GAAG,CAAC,CAAA;AAC7C,QAAA,aAAa,GAAG,IAAA,gBAAQ,EAAC,oBAAY,CAAC,OAAO,CAAC,CAAA;AAC9C,QAAA,oBAAoB,GAAG,qBAAa,CAAA;AACpC,QAAA,uBAAuB,GAAG,UAAU,CAAA;AACpC,QAAA,wBAAwB,GAAG,UAAU,CAAA;AACrC,QAAA,oBAAoB,GAAG,gBAAgB,CAAA;AACvC,QAAA,qBAAqB,GAAG,YAAY,CAAA;AACpC,QAAA,0BAA0B,GAAG,iBAAiB,CAAA;AAC9C,QAAA,yBAAyB,GAAG,gBAAgB,CAAA;AAC5C,QAAA,yBAAyB,GAAG,gBAAgB,CAAA;AAC5C,QAAA,oBAAoB,GAAG,GAAG,oBAAY,CAAC,GAAG,GAAG,iBAAS,GAAG,qBAAa,CAAC,aAAa,GAAG,iBAAS,EAAE,CAAA;AAE/G,IAAkB,eAGjB;AAHD,WAAkB,eAAe;IAC/B,4CAA6B,CAAA;IAC7B,oDAAiC,CAAA;AACnC,CAAC,EAHiB,eAAe,+BAAf,eAAe,QAGhC"}
@@ -9,32 +9,32 @@ export declare function isMultiTenant(): boolean;
9
9
  export declare function isTenantIdSet(): boolean;
10
10
  export declare function isTenancyEnabled(): string | undefined;
11
11
  /**
12
- * Given an app ID this will attempt to retrieve the tenant ID from it.
13
- * @return The tenant ID found within the app ID.
12
+ * Given a workspace ID this will attempt to retrieve the tenant ID from it.
13
+ * @return The tenant ID found within the workspace ID.
14
14
  */
15
- export declare function getTenantIDFromAppID(appId: string): string | undefined;
15
+ export declare function getTenantIDFromWorkspaceID(workspaceId: string): string | undefined;
16
16
  export declare function doInAutomationContext<T>(params: {
17
- appId: string;
17
+ workspaceId: string;
18
18
  automationId: string;
19
19
  task: () => T;
20
20
  }): Promise<T>;
21
- export declare function doInContext(appId: string, task: any): Promise<any>;
21
+ export declare function doInContext(workspaceId: string, task: any): Promise<any>;
22
22
  export declare function doInTenant<T>(tenantId: string | undefined, task: () => T): Promise<T>;
23
23
  export declare function doInSelfHostTenantUsingCloud<T>(tenantId: string, task: () => T): Promise<T>;
24
24
  export declare function doInLicenseContext<T>(license: License, task: () => T): Promise<T>;
25
25
  export declare function getLicense(): License | undefined;
26
26
  export declare function isSelfHostUsingCloud(): boolean;
27
27
  export declare function getSelfHostCloudDB(): Database;
28
- export declare function doInAppContext<T>(appId: string, task: () => T): Promise<T>;
28
+ export declare function doInWorkspaceContext<T>(workspaceId: string, task: () => T): Promise<T>;
29
29
  export declare function doInIdentityContext<T>(identity: IdentityContext, task: () => T): Promise<T>;
30
- export declare function doInAppMigrationContext<T>(appId: string, task: () => T): Promise<T>;
30
+ export declare function doInWorkspaceMigrationContext<T>(workspaceId: string, task: () => T): Promise<T>;
31
31
  export declare function getIdentity(): IdentityContext | undefined;
32
32
  export declare function getTenantId(): string;
33
33
  export declare function getAutomationId(): string | undefined;
34
- export declare function getAppId(): string | undefined;
34
+ export declare function getWorkspaceId(): string | undefined;
35
35
  export declare function getIP(): string | undefined;
36
- export declare const getDevAppId: () => string;
37
- export declare const getProdAppId: () => string;
36
+ export declare const getDevWorkspaceId: () => string;
37
+ export declare const getProdWorkspaceId: () => string;
38
38
  export declare function doInEnvironmentContext<T>(values: Record<string, string>, task: () => T): Promise<T>;
39
39
  export declare function doInScimContext(task: any): Promise<unknown>;
40
40
  export declare function doInIPContext(ip: string, task: any): Promise<unknown>;
@@ -43,20 +43,20 @@ export declare function getEnvironmentVariables(): Record<string, string> | null
43
43
  export declare function getGlobalDB(): Database;
44
44
  export declare function getAuditLogsDB(): Database;
45
45
  /**
46
- * Gets the app database based on whatever the request
46
+ * Gets the workspace database based on whatever the request
47
47
  * contained, dev or prod.
48
48
  */
49
- export declare function getAppDB(opts?: any): Database;
49
+ export declare function getWorkspaceDB(opts?: any): Database;
50
50
  /**
51
- * This specifically gets the prod app ID, if the request
52
- * contained a development app ID, this will get the prod one.
51
+ * This specifically gets the prod workspace ID, if the request
52
+ * contained a development workspace ID, this will get the prod one.
53
53
  */
54
- export declare function getProdAppDB(opts?: any): Database;
54
+ export declare function getProdWorkspaceDB(opts?: any): Database;
55
55
  /**
56
- * This specifically gets the dev app ID, if the request
57
- * contained a prod app ID, this will get the dev one.
56
+ * This specifically gets the dev workspace ID, if the request
57
+ * contained a prod workspace ID, this will get the dev one.
58
58
  */
59
- export declare function getDevAppDB(opts?: any): Database;
59
+ export declare function getDevWorkspaceDB(opts?: any): Database;
60
60
  export declare function isScim(): boolean;
61
61
  export declare function getCurrentContext(): ContextMap | undefined;
62
62
  export declare function getFeatureFlags(key: string): Record<string, boolean> | undefined;