@budibase/backend-core 2.11.37 → 2.11.39
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 +324 -276
- package/dist/index.js.map +3 -3
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +4 -4
- package/dist/plugins.js.map +1 -1
- package/dist/plugins.js.meta.json +1 -1
- package/dist/src/cache/appMetadata.d.ts +5 -5
- package/dist/src/cache/appMetadata.js +5 -5
- package/dist/src/cache/user.d.ts +5 -5
- package/dist/src/cache/user.js +5 -5
- package/dist/src/cache/writethrough.d.ts +1 -1
- package/dist/src/cache/writethrough.js +2 -2
- package/dist/src/cache/writethrough.js.map +1 -1
- package/dist/src/configs/configs.d.ts +1 -1
- package/dist/src/configs/configs.js +1 -1
- package/dist/src/context/mainContext.d.ts +1 -1
- package/dist/src/context/mainContext.js +1 -1
- package/dist/src/db/Replication.d.ts +4 -4
- package/dist/src/db/Replication.js +4 -4
- package/dist/src/db/lucene.d.ts +8 -8
- package/dist/src/db/lucene.js +12 -12
- package/dist/src/db/utils.d.ts +1 -1
- package/dist/src/db/utils.js +1 -1
- package/dist/src/docIds/conversions.d.ts +1 -1
- package/dist/src/docIds/conversions.js +1 -1
- package/dist/src/docIds/ids.d.ts +11 -11
- package/dist/src/docIds/ids.js +11 -11
- package/dist/src/docIds/params.d.ts +8 -8
- package/dist/src/docIds/params.js +8 -8
- package/dist/src/helpers.d.ts +2 -2
- package/dist/src/helpers.js +2 -2
- package/dist/src/middleware/passport/local.d.ts +4 -4
- package/dist/src/middleware/passport/local.js +4 -4
- package/dist/src/middleware/passport/sso/oidc.js +11 -11
- package/dist/src/middleware/passport/utils.d.ts +3 -3
- package/dist/src/middleware/passport/utils.js +3 -3
- package/dist/src/objectStore/buckets/app.d.ts +3 -3
- package/dist/src/objectStore/buckets/app.js +3 -3
- package/dist/src/objectStore/objectStore.d.ts +3 -3
- package/dist/src/objectStore/objectStore.js +3 -3
- package/dist/src/queue/inMemoryQueue.d.ts +6 -6
- package/dist/src/queue/inMemoryQueue.js +9 -9
- package/dist/src/redis/redis.js +1 -1
- package/dist/src/security/permissions.d.ts +2 -2
- package/dist/src/security/permissions.js +2 -2
- package/dist/src/security/roles.d.ts +6 -6
- package/dist/src/security/roles.js +6 -6
- package/dist/src/users/db.d.ts +1 -1
- package/dist/src/users/db.js +12 -5
- package/dist/src/users/db.js.map +1 -1
- package/dist/src/users/users.d.ts +2 -1
- package/dist/src/users/users.js +20 -2
- package/dist/src/users/users.js.map +1 -1
- package/dist/src/users/utils.d.ts +1 -0
- package/dist/src/users/utils.js +2 -1
- package/dist/src/users/utils.js.map +1 -1
- package/dist/src/utils/utils.d.ts +11 -11
- package/dist/src/utils/utils.js +11 -11
- package/dist/tests/core/utilities/structures/licenses.js +13 -0
- package/dist/tests/core/utilities/structures/licenses.js.map +1 -1
- package/dist/tests/core/utilities/structures/quotas.d.ts +1 -1
- package/dist/tests/core/utilities/structures/quotas.js +3 -2
- package/dist/tests/core/utilities/structures/quotas.js.map +1 -1
- package/package.json +4 -4
- package/src/cache/appMetadata.ts +5 -5
- package/src/cache/user.ts +5 -5
- package/src/cache/writethrough.ts +2 -2
- package/src/configs/configs.ts +1 -1
- package/src/context/mainContext.ts +1 -1
- package/src/db/Replication.ts +4 -4
- package/src/db/lucene.ts +12 -12
- package/src/db/utils.ts +1 -1
- package/src/docIds/conversions.ts +1 -1
- package/src/docIds/ids.ts +11 -11
- package/src/docIds/params.ts +8 -8
- package/src/helpers.ts +2 -2
- package/src/middleware/passport/local.ts +4 -4
- package/src/middleware/passport/sso/oidc.ts +11 -11
- package/src/middleware/passport/utils.ts +3 -3
- package/src/objectStore/buckets/app.ts +3 -3
- package/src/objectStore/objectStore.ts +3 -3
- package/src/queue/inMemoryQueue.ts +9 -9
- package/src/redis/redis.ts +1 -1
- package/src/security/permissions.ts +2 -2
- package/src/security/roles.ts +6 -6
- package/src/users/db.ts +63 -48
- package/src/users/users.ts +16 -2
- package/src/users/utils.ts +1 -0
- package/src/utils/utils.ts +11 -11
- package/tests/core/users/users.spec.js +54 -0
- package/tests/core/utilities/structures/licenses.ts +13 -0
- package/tests/core/utilities/structures/quotas.ts +3 -2
package/dist/src/cache/user.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { User } from "@budibase/types";
|
|
|
3
3
|
* Get the requested user by id.
|
|
4
4
|
* Use redis cache to first read the user.
|
|
5
5
|
* If not present fallback to loading the user directly and re-caching.
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
6
|
+
* @param userId the id of the user to get
|
|
7
|
+
* @param tenantId the tenant of the user to get
|
|
8
|
+
* @param populateUser function to provide the user for re-caching. default to couch db
|
|
9
9
|
* @returns
|
|
10
10
|
*/
|
|
11
11
|
export declare function getUser(userId: string, tenantId?: string, populateUser?: any): Promise<any>;
|
|
@@ -13,8 +13,8 @@ export declare function getUser(userId: string, tenantId?: string, populateUser?
|
|
|
13
13
|
* Get the requested users by id.
|
|
14
14
|
* Use redis cache to first read the users.
|
|
15
15
|
* If not present fallback to loading the users directly and re-caching.
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
16
|
+
* @param userIds the ids of the user to get
|
|
17
|
+
* @param tenantId the tenant of the users to get
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
20
|
export declare function getUsers(userIds: string[]): Promise<{
|
package/dist/src/cache/user.js
CHANGED
|
@@ -89,9 +89,9 @@ function populateUsersFromDB(userIds) {
|
|
|
89
89
|
* Get the requested user by id.
|
|
90
90
|
* Use redis cache to first read the user.
|
|
91
91
|
* If not present fallback to loading the user directly and re-caching.
|
|
92
|
-
* @param
|
|
93
|
-
* @param
|
|
94
|
-
* @param
|
|
92
|
+
* @param userId the id of the user to get
|
|
93
|
+
* @param tenantId the tenant of the user to get
|
|
94
|
+
* @param populateUser function to provide the user for re-caching. default to couch db
|
|
95
95
|
* @returns
|
|
96
96
|
*/
|
|
97
97
|
function getUser(userId, tenantId, populateUser) {
|
|
@@ -139,8 +139,8 @@ exports.getUser = getUser;
|
|
|
139
139
|
* Get the requested users by id.
|
|
140
140
|
* Use redis cache to first read the users.
|
|
141
141
|
* If not present fallback to loading the users directly and re-caching.
|
|
142
|
-
* @param
|
|
143
|
-
* @param
|
|
142
|
+
* @param userIds the ids of the user to get
|
|
143
|
+
* @param tenantId the tenant of the users to get
|
|
144
144
|
* @returns
|
|
145
145
|
*/
|
|
146
146
|
function getUsers(userIds) {
|
|
@@ -3,7 +3,7 @@ export declare class Writethrough {
|
|
|
3
3
|
db: Database;
|
|
4
4
|
writeRateMs: number;
|
|
5
5
|
constructor(db: Database, writeRateMs?: number);
|
|
6
|
-
put(doc: any): Promise<{
|
|
6
|
+
put(doc: any, writeRateMs?: number): Promise<{
|
|
7
7
|
ok: boolean;
|
|
8
8
|
id: string | undefined;
|
|
9
9
|
rev: string | undefined;
|
|
@@ -139,9 +139,9 @@ class Writethrough {
|
|
|
139
139
|
this.db = db;
|
|
140
140
|
this.writeRateMs = writeRateMs;
|
|
141
141
|
}
|
|
142
|
-
put(doc) {
|
|
142
|
+
put(doc, writeRateMs = this.writeRateMs) {
|
|
143
143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
return put(this.db, doc,
|
|
144
|
+
return put(this.db, doc, writeRateMs);
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
get(id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writethrough.js","sourceRoot":"","sources":["../../../src/cache/writethrough.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA8B;AAC9B,wCAAqD;AACrD,wCAAoC;AACpC,2CAAwE;AACxE,4DAA6C;AAE7C,MAAM,qBAAqB,GAAG,KAAK,CAAA;AACnC,IAAI,KAAK,GAAqB,IAAI,CAAA;AAOlC,SAAe,QAAQ;;QACrB,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,MAAM,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CAAC,GAAQ,EAAE,cAAsB,IAAI,CAAC,WAAW;;YACxD,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,WAAW,CAAC,CAAA;QACvC,CAAC;KAAA;IAEK,GAAG,CAAC,EAAU;;YAClB,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;QACzB,CAAC;KAAA;IAEK,MAAM,CAAC,OAAY,EAAE,GAAS;;YAClC,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;QACtC,CAAC;KAAA;CACF;AApBD,oCAoBC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Config, ConfigType, GoogleInnerConfig, OIDCInnerConfig, OIDCLogosConfig, SCIMInnerConfig, SettingsConfig, SettingsInnerConfig, SMTPConfig, SMTPInnerConfig } from "@budibase/types";
|
|
2
2
|
/**
|
|
3
3
|
* Generates a new configuration ID.
|
|
4
|
-
* @returns
|
|
4
|
+
* @returns The new configuration ID which the config doc can be stored under.
|
|
5
5
|
*/
|
|
6
6
|
export declare function generateConfigID(type: ConfigType): string;
|
|
7
7
|
export declare function getConfig<T extends Config>(type: ConfigType): Promise<T | undefined>;
|
|
@@ -45,7 +45,7 @@ const environment_2 = __importDefault(require("../environment"));
|
|
|
45
45
|
// UTILS
|
|
46
46
|
/**
|
|
47
47
|
* Generates a new configuration ID.
|
|
48
|
-
* @returns
|
|
48
|
+
* @returns The new configuration ID which the config doc can be stored under.
|
|
49
49
|
*/
|
|
50
50
|
function generateConfigID(type) {
|
|
51
51
|
return `${constants_1.DocumentType.CONFIG}${constants_1.SEPARATOR}${type}`;
|
|
@@ -8,7 +8,7 @@ export declare function isTenantIdSet(): boolean;
|
|
|
8
8
|
export declare function isTenancyEnabled(): string | undefined;
|
|
9
9
|
/**
|
|
10
10
|
* Given an app ID this will attempt to retrieve the tenant ID from it.
|
|
11
|
-
* @return
|
|
11
|
+
* @return The tenant ID found within the app ID.
|
|
12
12
|
*/
|
|
13
13
|
export declare function getTenantIDFromAppID(appId: string): string | undefined;
|
|
14
14
|
export declare function doInAutomationContext(params: {
|
|
@@ -93,7 +93,7 @@ function isTenancyEnabled() {
|
|
|
93
93
|
exports.isTenancyEnabled = isTenancyEnabled;
|
|
94
94
|
/**
|
|
95
95
|
* Given an app ID this will attempt to retrieve the tenant ID from it.
|
|
96
|
-
* @return
|
|
96
|
+
* @return The tenant ID found within the app ID.
|
|
97
97
|
*/
|
|
98
98
|
function getTenantIDFromAppID(appId) {
|
|
99
99
|
if (!appId) {
|
|
@@ -4,20 +4,20 @@ declare class Replication {
|
|
|
4
4
|
replication: any;
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
7
|
+
* @param source - the DB you want to replicate or rollback to
|
|
8
|
+
* @param target - the DB you want to replicate to, or rollback from
|
|
9
9
|
*/
|
|
10
10
|
constructor({ source, target }: any);
|
|
11
11
|
close(): Promise<[void, void]>;
|
|
12
12
|
promisify(operation: any, opts?: {}): Promise<unknown>;
|
|
13
13
|
/**
|
|
14
14
|
* Two way replication operation, intended to be promise based.
|
|
15
|
-
* @param
|
|
15
|
+
* @param opts - PouchDB replication options
|
|
16
16
|
*/
|
|
17
17
|
sync(opts?: {}): any;
|
|
18
18
|
/**
|
|
19
19
|
* One way replication operation, intended to be promise based.
|
|
20
|
-
* @param
|
|
20
|
+
* @param opts - PouchDB replication options
|
|
21
21
|
*/
|
|
22
22
|
replicate(opts?: {}): any;
|
|
23
23
|
appReplicateOpts(): {
|
|
@@ -14,8 +14,8 @@ const constants_1 = require("../constants");
|
|
|
14
14
|
class Replication {
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
17
|
+
* @param source - the DB you want to replicate or rollback to
|
|
18
|
+
* @param target - the DB you want to replicate to, or rollback from
|
|
19
19
|
*/
|
|
20
20
|
constructor({ source, target }) {
|
|
21
21
|
this.source = (0, couch_1.getPouchDB)(source);
|
|
@@ -41,7 +41,7 @@ class Replication {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Two way replication operation, intended to be promise based.
|
|
44
|
-
* @param
|
|
44
|
+
* @param opts - PouchDB replication options
|
|
45
45
|
*/
|
|
46
46
|
sync(opts = {}) {
|
|
47
47
|
this.replication = this.promisify(this.source.sync, opts);
|
|
@@ -49,7 +49,7 @@ class Replication {
|
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* One way replication operation, intended to be promise based.
|
|
52
|
-
* @param
|
|
52
|
+
* @param opts - PouchDB replication options
|
|
53
53
|
*/
|
|
54
54
|
replicate(opts = {}) {
|
|
55
55
|
this.replication = this.promisify(this.source.replicate.to, opts);
|
package/dist/src/db/lucene.d.ts
CHANGED
|
@@ -69,10 +69,10 @@ export declare class QueryBuilder<T> {
|
|
|
69
69
|
* Performs a paginated search. A bookmark will be returned to allow the next
|
|
70
70
|
* page to be fetched. There is a max limit off 200 results per page in a
|
|
71
71
|
* paginated search.
|
|
72
|
-
* @param dbName
|
|
73
|
-
* @param index
|
|
74
|
-
* @param query
|
|
75
|
-
* @param params
|
|
72
|
+
* @param dbName Which database to run a lucene query on
|
|
73
|
+
* @param index Which search index to utilise
|
|
74
|
+
* @param query The JSON query structure
|
|
75
|
+
* @param params The search params including:
|
|
76
76
|
* tableId {string} The table ID to search
|
|
77
77
|
* sort {string} The sort column
|
|
78
78
|
* sortOrder {string} The sort order ("ascending" or "descending")
|
|
@@ -93,10 +93,10 @@ export declare function paginatedSearch<T>(dbName: string, index: string, query:
|
|
|
93
93
|
* desired amount of results. There is a limit of 1000 results to avoid
|
|
94
94
|
* heavy performance hits, and to avoid client components breaking from
|
|
95
95
|
* handling too much data.
|
|
96
|
-
* @param dbName
|
|
97
|
-
* @param index
|
|
98
|
-
* @param query
|
|
99
|
-
* @param params
|
|
96
|
+
* @param dbName Which database to run a lucene query on
|
|
97
|
+
* @param index Which search index to utilise
|
|
98
|
+
* @param query The JSON query structure
|
|
99
|
+
* @param params The search params including:
|
|
100
100
|
* tableId {string} The table ID to search
|
|
101
101
|
* sort {string} The sort column
|
|
102
102
|
* sortOrder {string} The sort order ("ascending" or "descending")
|
package/dist/src/db/lucene.js
CHANGED
|
@@ -534,10 +534,10 @@ function runQuery(url, body, cookie) {
|
|
|
534
534
|
* Gets round the fixed limit of 200 results from a query by fetching as many
|
|
535
535
|
* pages as required and concatenating the results. This recursively operates
|
|
536
536
|
* until enough results have been found.
|
|
537
|
-
* @param dbName
|
|
538
|
-
* @param index
|
|
539
|
-
* @param query
|
|
540
|
-
* @param params
|
|
537
|
+
* @param dbName Which database to run a lucene query on
|
|
538
|
+
* @param index Which search index to utilise
|
|
539
|
+
* @param query The JSON query structure
|
|
540
|
+
* @param params The search params including:
|
|
541
541
|
* tableId {string} The table ID to search
|
|
542
542
|
* sort {string} The sort column
|
|
543
543
|
* sortOrder {string} The sort order ("ascending" or "descending")
|
|
@@ -582,10 +582,10 @@ function recursiveSearch(dbName, index, query, params) {
|
|
|
582
582
|
* Performs a paginated search. A bookmark will be returned to allow the next
|
|
583
583
|
* page to be fetched. There is a max limit off 200 results per page in a
|
|
584
584
|
* paginated search.
|
|
585
|
-
* @param dbName
|
|
586
|
-
* @param index
|
|
587
|
-
* @param query
|
|
588
|
-
* @param params
|
|
585
|
+
* @param dbName Which database to run a lucene query on
|
|
586
|
+
* @param index Which search index to utilise
|
|
587
|
+
* @param query The JSON query structure
|
|
588
|
+
* @param params The search params including:
|
|
589
589
|
* tableId {string} The table ID to search
|
|
590
590
|
* sort {string} The sort column
|
|
591
591
|
* sortOrder {string} The sort order ("ascending" or "descending")
|
|
@@ -641,10 +641,10 @@ exports.paginatedSearch = paginatedSearch;
|
|
|
641
641
|
* desired amount of results. There is a limit of 1000 results to avoid
|
|
642
642
|
* heavy performance hits, and to avoid client components breaking from
|
|
643
643
|
* handling too much data.
|
|
644
|
-
* @param dbName
|
|
645
|
-
* @param index
|
|
646
|
-
* @param query
|
|
647
|
-
* @param params
|
|
644
|
+
* @param dbName Which database to run a lucene query on
|
|
645
|
+
* @param index Which search index to utilise
|
|
646
|
+
* @param query The JSON query structure
|
|
647
|
+
* @param params The search params including:
|
|
648
648
|
* tableId {string} The table ID to search
|
|
649
649
|
* sort {string} The sort column
|
|
650
650
|
* sortOrder {string} The sort order ("ascending" or "descending")
|
package/dist/src/db/utils.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare function getAllDbs(opts?: {
|
|
|
13
13
|
* Lots of different points in the system need to find the full list of apps, this will
|
|
14
14
|
* enumerate the entire CouchDB cluster and get the list of databases (every app).
|
|
15
15
|
*
|
|
16
|
-
* @return
|
|
16
|
+
* @return returns the app information document stored in each app database.
|
|
17
17
|
*/
|
|
18
18
|
export declare function getAllApps({ dev, all, idsOnly, efficient, }?: any): Promise<App[] | string[]>;
|
|
19
19
|
export declare function getAppsByIDs(appIds: string[]): Promise<App[]>;
|
package/dist/src/db/utils.js
CHANGED
|
@@ -76,7 +76,7 @@ exports.getAllDbs = getAllDbs;
|
|
|
76
76
|
* Lots of different points in the system need to find the full list of apps, this will
|
|
77
77
|
* enumerate the entire CouchDB cluster and get the list of databases (every app).
|
|
78
78
|
*
|
|
79
|
-
* @return
|
|
79
|
+
* @return returns the app information document stored in each app database.
|
|
80
80
|
*/
|
|
81
81
|
function getAllApps({ dev, all, idsOnly, efficient, } = {}) {
|
|
82
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -4,7 +4,7 @@ export declare function isProdAppID(appId?: string): boolean;
|
|
|
4
4
|
export declare function isDevApp(app: App): boolean;
|
|
5
5
|
/**
|
|
6
6
|
* Generates a development app ID from a real app ID.
|
|
7
|
-
* @returns
|
|
7
|
+
* @returns the dev app ID which can be used for dev database.
|
|
8
8
|
*/
|
|
9
9
|
export declare function getDevelopmentAppID(appId: string): string;
|
|
10
10
|
export declare const getDevAppID: typeof getDevelopmentAppID;
|
|
@@ -26,7 +26,7 @@ function isDevApp(app) {
|
|
|
26
26
|
exports.isDevApp = isDevApp;
|
|
27
27
|
/**
|
|
28
28
|
* Generates a development app ID from a real app ID.
|
|
29
|
-
* @returns
|
|
29
|
+
* @returns the dev app ID which can be used for dev database.
|
|
30
30
|
*/
|
|
31
31
|
function getDevelopmentAppID(appId) {
|
|
32
32
|
if (!appId || appId.startsWith(constants_1.APP_DEV_PREFIX)) {
|
package/dist/src/docIds/ids.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates a new app ID.
|
|
3
|
-
* @returns
|
|
3
|
+
* @returns The new app ID which the app doc can be stored under.
|
|
4
4
|
*/
|
|
5
5
|
export declare const generateAppID: (tenantId?: string | null) => string;
|
|
6
6
|
/**
|
|
7
7
|
* Gets a new row ID for the specified table.
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @returns
|
|
8
|
+
* @param tableId The table which the row is being created for.
|
|
9
|
+
* @param id If an ID is to be used then the UUID can be substituted for this.
|
|
10
|
+
* @returns The new ID which a row doc can be stored under.
|
|
11
11
|
*/
|
|
12
12
|
export declare function generateRowID(tableId: string, id?: string): string;
|
|
13
13
|
/**
|
|
14
14
|
* Generates a new workspace ID.
|
|
15
|
-
* @returns
|
|
15
|
+
* @returns The new workspace ID which the workspace doc can be stored under.
|
|
16
16
|
*/
|
|
17
17
|
export declare function generateWorkspaceID(): string;
|
|
18
18
|
/**
|
|
19
19
|
* Generates a new global user ID.
|
|
20
|
-
* @returns
|
|
20
|
+
* @returns The new user ID which the user doc can be stored under.
|
|
21
21
|
*/
|
|
22
22
|
export declare function generateGlobalUserID(id?: any): string;
|
|
23
23
|
export declare function isGlobalUserID(id: string): boolean;
|
|
24
24
|
/**
|
|
25
25
|
* Generates a new user ID based on the passed in global ID.
|
|
26
|
-
* @param
|
|
27
|
-
* @returns
|
|
26
|
+
* @param globalId The ID of the global user.
|
|
27
|
+
* @returns The new user ID which the user doc can be stored under.
|
|
28
28
|
*/
|
|
29
29
|
export declare function generateUserMetadataID(globalId: string): string;
|
|
30
30
|
/**
|
|
@@ -39,7 +39,7 @@ export declare function generateTemplateID(ownerId: any): string;
|
|
|
39
39
|
export declare function generateAppUserID(prodAppId: string, userId: string): string;
|
|
40
40
|
/**
|
|
41
41
|
* Generates a new role ID.
|
|
42
|
-
* @returns
|
|
42
|
+
* @returns The new role ID which the role doc can be stored under.
|
|
43
43
|
*/
|
|
44
44
|
export declare function generateRoleID(name: string): string;
|
|
45
45
|
/**
|
|
@@ -48,11 +48,11 @@ export declare function generateRoleID(name: string): string;
|
|
|
48
48
|
export declare function prefixRoleID(name: string): string;
|
|
49
49
|
/**
|
|
50
50
|
* Generates a new dev info document ID - this is scoped to a user.
|
|
51
|
-
* @returns
|
|
51
|
+
* @returns The new dev info ID which info for dev (like api key) can be stored under.
|
|
52
52
|
*/
|
|
53
53
|
export declare const generateDevInfoID: (userId: any) => string;
|
|
54
54
|
/**
|
|
55
55
|
* Generates a new plugin ID - to be used in the global DB.
|
|
56
|
-
* @returns
|
|
56
|
+
* @returns The new plugin ID which a plugin metadata document can be stored under.
|
|
57
57
|
*/
|
|
58
58
|
export declare const generatePluginID: (name: string) => string;
|
package/dist/src/docIds/ids.js
CHANGED
|
@@ -5,7 +5,7 @@ const constants_1 = require("../constants");
|
|
|
5
5
|
const newid_1 = require("./newid");
|
|
6
6
|
/**
|
|
7
7
|
* Generates a new app ID.
|
|
8
|
-
* @returns
|
|
8
|
+
* @returns The new app ID which the app doc can be stored under.
|
|
9
9
|
*/
|
|
10
10
|
const generateAppID = (tenantId) => {
|
|
11
11
|
let id = constants_1.APP_PREFIX;
|
|
@@ -17,9 +17,9 @@ const generateAppID = (tenantId) => {
|
|
|
17
17
|
exports.generateAppID = generateAppID;
|
|
18
18
|
/**
|
|
19
19
|
* Gets a new row ID for the specified table.
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @returns
|
|
20
|
+
* @param tableId The table which the row is being created for.
|
|
21
|
+
* @param id If an ID is to be used then the UUID can be substituted for this.
|
|
22
|
+
* @returns The new ID which a row doc can be stored under.
|
|
23
23
|
*/
|
|
24
24
|
function generateRowID(tableId, id) {
|
|
25
25
|
id = id || (0, newid_1.newid)();
|
|
@@ -28,7 +28,7 @@ function generateRowID(tableId, id) {
|
|
|
28
28
|
exports.generateRowID = generateRowID;
|
|
29
29
|
/**
|
|
30
30
|
* Generates a new workspace ID.
|
|
31
|
-
* @returns
|
|
31
|
+
* @returns The new workspace ID which the workspace doc can be stored under.
|
|
32
32
|
*/
|
|
33
33
|
function generateWorkspaceID() {
|
|
34
34
|
return `${constants_1.DocumentType.WORKSPACE}${constants_1.SEPARATOR}${(0, newid_1.newid)()}`;
|
|
@@ -36,7 +36,7 @@ function generateWorkspaceID() {
|
|
|
36
36
|
exports.generateWorkspaceID = generateWorkspaceID;
|
|
37
37
|
/**
|
|
38
38
|
* Generates a new global user ID.
|
|
39
|
-
* @returns
|
|
39
|
+
* @returns The new user ID which the user doc can be stored under.
|
|
40
40
|
*/
|
|
41
41
|
function generateGlobalUserID(id) {
|
|
42
42
|
return `${constants_1.DocumentType.USER}${constants_1.SEPARATOR}${id || (0, newid_1.newid)()}`;
|
|
@@ -49,8 +49,8 @@ function isGlobalUserID(id) {
|
|
|
49
49
|
exports.isGlobalUserID = isGlobalUserID;
|
|
50
50
|
/**
|
|
51
51
|
* Generates a new user ID based on the passed in global ID.
|
|
52
|
-
* @param
|
|
53
|
-
* @returns
|
|
52
|
+
* @param globalId The ID of the global user.
|
|
53
|
+
* @returns The new user ID which the user doc can be stored under.
|
|
54
54
|
*/
|
|
55
55
|
function generateUserMetadataID(globalId) {
|
|
56
56
|
return generateRowID(constants_1.InternalTable.USER_METADATA, globalId);
|
|
@@ -81,7 +81,7 @@ function generateAppUserID(prodAppId, userId) {
|
|
|
81
81
|
exports.generateAppUserID = generateAppUserID;
|
|
82
82
|
/**
|
|
83
83
|
* Generates a new role ID.
|
|
84
|
-
* @returns
|
|
84
|
+
* @returns The new role ID which the role doc can be stored under.
|
|
85
85
|
*/
|
|
86
86
|
function generateRoleID(name) {
|
|
87
87
|
const prefix = `${constants_1.DocumentType.ROLE}${constants_1.SEPARATOR}`;
|
|
@@ -100,7 +100,7 @@ function prefixRoleID(name) {
|
|
|
100
100
|
exports.prefixRoleID = prefixRoleID;
|
|
101
101
|
/**
|
|
102
102
|
* Generates a new dev info document ID - this is scoped to a user.
|
|
103
|
-
* @returns
|
|
103
|
+
* @returns The new dev info ID which info for dev (like api key) can be stored under.
|
|
104
104
|
*/
|
|
105
105
|
const generateDevInfoID = (userId) => {
|
|
106
106
|
return `${constants_1.DocumentType.DEV_INFO}${constants_1.SEPARATOR}${userId}`;
|
|
@@ -108,7 +108,7 @@ const generateDevInfoID = (userId) => {
|
|
|
108
108
|
exports.generateDevInfoID = generateDevInfoID;
|
|
109
109
|
/**
|
|
110
110
|
* Generates a new plugin ID - to be used in the global DB.
|
|
111
|
-
* @returns
|
|
111
|
+
* @returns The new plugin ID which a plugin metadata document can be stored under.
|
|
112
112
|
*/
|
|
113
113
|
const generatePluginID = (name) => {
|
|
114
114
|
return `${constants_1.DocumentType.PLUGIN}${constants_1.SEPARATOR}${name}`;
|
|
@@ -4,21 +4,21 @@ import { ViewName } from "../constants";
|
|
|
4
4
|
* is usually the case as most of our docs are top level e.g. tables, automations, users and so on.
|
|
5
5
|
* More complex cases such as link docs and rows which have multiple levels of IDs that their
|
|
6
6
|
* ID consists of need their own functions to build the allDocs parameters.
|
|
7
|
-
* @param
|
|
7
|
+
* @param docType The type of document which input params are being built for, e.g. user,
|
|
8
8
|
* link, app, table and so on.
|
|
9
|
-
* @param
|
|
9
|
+
* @param docId The ID of the document minus its type - this is only needed if looking
|
|
10
10
|
* for a singular document.
|
|
11
|
-
* @param
|
|
12
|
-
* @returns
|
|
11
|
+
* @param otherProps Add any other properties onto the request, e.g. include_docs.
|
|
12
|
+
* @returns Parameters which can then be used with an allDocs request.
|
|
13
13
|
*/
|
|
14
14
|
export declare function getDocParams(docType: string, docId?: string | null, otherProps?: any): any;
|
|
15
15
|
/**
|
|
16
16
|
* Gets the DB allDocs/query params for retrieving a row.
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
17
|
+
* @param tableId The table in which the rows have been stored.
|
|
18
|
+
* @param rowId The ID of the row which is being specifically queried for. This can be
|
|
19
19
|
* left null to get all the rows in the table.
|
|
20
|
-
* @param
|
|
21
|
-
* @returns
|
|
20
|
+
* @param otherProps Any other properties to add to the request.
|
|
21
|
+
* @returns Parameters which can then be used with an allDocs request.
|
|
22
22
|
*/
|
|
23
23
|
export declare function getRowParams(tableId?: string | null, rowId?: string | null, otherProps?: {}): any;
|
|
24
24
|
/**
|
|
@@ -8,12 +8,12 @@ const conversions_1 = require("./conversions");
|
|
|
8
8
|
* is usually the case as most of our docs are top level e.g. tables, automations, users and so on.
|
|
9
9
|
* More complex cases such as link docs and rows which have multiple levels of IDs that their
|
|
10
10
|
* ID consists of need their own functions to build the allDocs parameters.
|
|
11
|
-
* @param
|
|
11
|
+
* @param docType The type of document which input params are being built for, e.g. user,
|
|
12
12
|
* link, app, table and so on.
|
|
13
|
-
* @param
|
|
13
|
+
* @param docId The ID of the document minus its type - this is only needed if looking
|
|
14
14
|
* for a singular document.
|
|
15
|
-
* @param
|
|
16
|
-
* @returns
|
|
15
|
+
* @param otherProps Add any other properties onto the request, e.g. include_docs.
|
|
16
|
+
* @returns Parameters which can then be used with an allDocs request.
|
|
17
17
|
*/
|
|
18
18
|
function getDocParams(docType, docId, otherProps = {}) {
|
|
19
19
|
if (docId == null) {
|
|
@@ -24,11 +24,11 @@ function getDocParams(docType, docId, otherProps = {}) {
|
|
|
24
24
|
exports.getDocParams = getDocParams;
|
|
25
25
|
/**
|
|
26
26
|
* Gets the DB allDocs/query params for retrieving a row.
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
27
|
+
* @param tableId The table in which the rows have been stored.
|
|
28
|
+
* @param rowId The ID of the row which is being specifically queried for. This can be
|
|
29
29
|
* left null to get all the rows in the table.
|
|
30
|
-
* @param
|
|
31
|
-
* @returns
|
|
30
|
+
* @param otherProps Any other properties to add to the request.
|
|
31
|
+
* @returns Parameters which can then be used with an allDocs request.
|
|
32
32
|
*/
|
|
33
33
|
function getRowParams(tableId, rowId, otherProps = {}) {
|
|
34
34
|
if (tableId == null) {
|
package/dist/src/helpers.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Makes sure that a URL has the correct number of slashes, while maintaining the
|
|
3
3
|
* http(s):// double slashes.
|
|
4
|
-
* @param
|
|
5
|
-
* @return
|
|
4
|
+
* @param url The URL to test and remove any extra double slashes.
|
|
5
|
+
* @return The updated url.
|
|
6
6
|
*/
|
|
7
7
|
export declare function checkSlashesInUrl(url: string): string;
|
package/dist/src/helpers.js
CHANGED
|
@@ -4,8 +4,8 @@ exports.checkSlashesInUrl = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Makes sure that a URL has the correct number of slashes, while maintaining the
|
|
6
6
|
* http(s):// double slashes.
|
|
7
|
-
* @param
|
|
8
|
-
* @return
|
|
7
|
+
* @param url The URL to test and remove any extra double slashes.
|
|
8
|
+
* @return The updated url.
|
|
9
9
|
*/
|
|
10
10
|
function checkSlashesInUrl(url) {
|
|
11
11
|
return url.replace(/(https?:\/\/)|(\/)+/g, "$1$2");
|
|
@@ -4,10 +4,10 @@ export declare const options: {
|
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
6
|
* Passport Local Authentication Middleware.
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
7
|
+
* @param ctx the request structure
|
|
8
|
+
* @param email username to login with
|
|
9
|
+
* @param password plain text password to log in with
|
|
10
|
+
* @param done callback from passport to return user information and errors
|
|
11
11
|
* @returns The authenticated user, or errors if they occur
|
|
12
12
|
*/
|
|
13
13
|
export declare function authenticate(ctx: BBContext, email: string, password: string, done: Function): Promise<any>;
|
|
@@ -44,10 +44,10 @@ exports.options = {
|
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
46
46
|
* Passport Local Authentication Middleware.
|
|
47
|
-
* @param
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
47
|
+
* @param ctx the request structure
|
|
48
|
+
* @param email username to login with
|
|
49
|
+
* @param password plain text password to log in with
|
|
50
|
+
* @param done callback from passport to return user information and errors
|
|
51
51
|
* @returns The authenticated user, or errors if they occur
|
|
52
52
|
*/
|
|
53
53
|
function authenticate(ctx, email, password, done) {
|
|
@@ -44,15 +44,15 @@ const types_1 = require("@budibase/types");
|
|
|
44
44
|
const OIDCStrategy = require("@techpass/passport-openidconnect").Strategy;
|
|
45
45
|
function buildVerifyFn(saveUserFn) {
|
|
46
46
|
/**
|
|
47
|
-
* @param
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @param
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
47
|
+
* @param issuer The identity provider base URL
|
|
48
|
+
* @param sub The user ID
|
|
49
|
+
* @param profile The user profile information. Created by passport from the /userinfo response
|
|
50
|
+
* @param jwtClaims The parsed id_token claims
|
|
51
|
+
* @param accessToken The access_token for contacting the identity provider - may or may not be a JWT
|
|
52
|
+
* @param refreshToken The refresh_token for obtaining a new access_token - usually not a JWT
|
|
53
|
+
* @param idToken The id_token - always a JWT
|
|
54
|
+
* @param params The response body from requesting an access_token
|
|
55
|
+
* @param done The passport callback: err, user, info
|
|
56
56
|
*/
|
|
57
57
|
return (issuer, sub, profile, jwtClaims, accessToken, refreshToken, idToken, params, done) => __awaiter(this, void 0, void 0, function* () {
|
|
58
58
|
const details = {
|
|
@@ -73,8 +73,8 @@ function buildVerifyFn(saveUserFn) {
|
|
|
73
73
|
}
|
|
74
74
|
exports.buildVerifyFn = buildVerifyFn;
|
|
75
75
|
/**
|
|
76
|
-
* @param
|
|
77
|
-
* @param
|
|
76
|
+
* @param profile The structured profile created by passport using the user info endpoint
|
|
77
|
+
* @param jwtClaims The claims returned in the id token
|
|
78
78
|
*/
|
|
79
79
|
function getEmail(profile, jwtClaims) {
|
|
80
80
|
// profile not guaranteed to contain email e.g. github connected azure ad account
|
|
@@ -2,9 +2,9 @@ import { ConfigType, GoogleInnerConfig } from "@budibase/types";
|
|
|
2
2
|
/**
|
|
3
3
|
* Utility to handle authentication errors.
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
5
|
+
* @param done The passport callback.
|
|
6
|
+
* @param message Message that will be returned in the response body
|
|
7
|
+
* @param err (Optional) error that will be logged
|
|
8
8
|
*/
|
|
9
9
|
export declare function authError(done: Function, message: string, err?: any): any;
|
|
10
10
|
export declare function ssoCallbackUrl(type: ConfigType, config?: GoogleInnerConfig): Promise<string>;
|
|
@@ -38,9 +38,9 @@ const configs = __importStar(require("../../configs"));
|
|
|
38
38
|
/**
|
|
39
39
|
* Utility to handle authentication errors.
|
|
40
40
|
*
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
41
|
+
* @param done The passport callback.
|
|
42
|
+
* @param message Message that will be returned in the response body
|
|
43
|
+
* @param err (Optional) error that will be logged
|
|
44
44
|
*/
|
|
45
45
|
function authError(done, message, err) {
|
|
46
46
|
return done(err, null, // never return a user
|