@webiny/api-core-ddb 6.3.0-beta.4 → 6.4.0-beta.0

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 (36) hide show
  1. package/adminUsers/definitions/entities.js +5 -6
  2. package/adminUsers/definitions/entities.js.map +1 -1
  3. package/adminUsers/definitions/types.js +0 -3
  4. package/adminUsers/index.js +135 -156
  5. package/adminUsers/index.js.map +1 -1
  6. package/adminUsers/types.js +5 -4
  7. package/adminUsers/types.js.map +1 -1
  8. package/createApiCoreDdb.js +19 -22
  9. package/createApiCoreDdb.js.map +1 -1
  10. package/index.js +0 -2
  11. package/keyValueStore/KeyValueStoreDynamoTable.js +24 -25
  12. package/keyValueStore/KeyValueStoreDynamoTable.js.map +1 -1
  13. package/keyValueStore/KeyValueStoreStorageOperations.d.ts +2 -1
  14. package/keyValueStore/KeyValueStoreStorageOperations.js +72 -72
  15. package/keyValueStore/KeyValueStoreStorageOperations.js.map +1 -1
  16. package/keyValueStore/index.js +2 -3
  17. package/keyValueStore/index.js.map +1 -1
  18. package/package.json +9 -9
  19. package/security/definitions/entities.js +19 -24
  20. package/security/definitions/entities.js.map +1 -1
  21. package/security/definitions/types.js +0 -3
  22. package/security/index.js +389 -464
  23. package/security/index.js.map +1 -1
  24. package/security/types.js +6 -5
  25. package/security/types.js.map +1 -1
  26. package/tenancy/definitions/tenantEntity.js +5 -9
  27. package/tenancy/definitions/tenantEntity.js.map +1 -1
  28. package/tenancy/definitions/types.js +0 -3
  29. package/tenancy/index.js +107 -127
  30. package/tenancy/index.js.map +1 -1
  31. package/tenancy/types.js +4 -3
  32. package/tenancy/types.js.map +1 -1
  33. package/adminUsers/definitions/types.js.map +0 -1
  34. package/index.js.map +0 -1
  35. package/security/definitions/types.js.map +0 -1
  36. package/tenancy/definitions/types.js.map +0 -1
@@ -1,83 +1,83 @@
1
1
  import { WebinyError } from "@webiny/error";
2
2
  import { KeyValueStoreDynamoTable } from "./KeyValueStoreDynamoTable.js";
3
- export class KeyValueStoreStorageOperations {
4
- constructor(dynamoDbClient) {
5
- this.table = new KeyValueStoreDynamoTable(dynamoDbClient);
6
- this.entity = this.table.getEntity();
7
- }
8
- createScopedKey(key, scope) {
9
- return `${scope}:${key}`;
10
- }
11
- async get(key, scope) {
12
- try {
13
- const scopedKey = this.createScopedKey(key, scope);
14
- const entry = await this.entity.get(this.table.createKeys({
15
- scopedKey
16
- }));
17
- if (!entry) {
18
- return null;
19
- }
20
-
21
- // Return the user-facing key without scope prefix
22
- return {
23
- key,
24
- value: entry.data.value,
25
- scope: entry.data.scope
26
- };
27
- } catch (err) {
28
- throw WebinyError.from(err, {
29
- message: "Could not get key-value record.",
30
- code: "GET_KEY_VALUE_ERROR",
31
- data: {
32
- key,
33
- scope
34
- }
35
- });
3
+ class KeyValueStoreStorageOperations {
4
+ constructor(dynamoDbClient){
5
+ this.table = new KeyValueStoreDynamoTable(dynamoDbClient);
6
+ this.entity = this.table.getEntity();
36
7
  }
37
- }
38
- async set(key, value, scope) {
39
- try {
40
- const scopedKey = this.createScopedKey(key, scope);
41
- const keys = this.table.createKeys({
42
- scopedKey
43
- });
44
- await this.entity.put({
45
- ...keys,
46
- TYPE: "KeyValueStore",
47
- data: {
48
- key,
49
- value,
50
- scope
8
+ createScopedKey(key, scope) {
9
+ return `${scope}:${key}`;
10
+ }
11
+ async get(key, scope) {
12
+ try {
13
+ const scopedKey = this.createScopedKey(key, scope);
14
+ const entry = await this.entity.get(this.table.createKeys({
15
+ scopedKey
16
+ }));
17
+ if (!entry) return null;
18
+ const ttl = Number(entry.expiresAt);
19
+ if (ttl && ttl <= Math.floor(Date.now() / 1000)) return null;
20
+ return {
21
+ key,
22
+ value: entry.data.value,
23
+ scope: entry.data.scope
24
+ };
25
+ } catch (err) {
26
+ throw WebinyError.from(err, {
27
+ message: "Could not get key-value record.",
28
+ code: "GET_KEY_VALUE_ERROR",
29
+ data: {
30
+ key,
31
+ scope
32
+ }
33
+ });
51
34
  }
52
- });
53
- } catch (err) {
54
- throw WebinyError.from(err, {
55
- message: "Could not set key-value record.",
56
- code: "SET_KEY_VALUE_ERROR",
57
- data: {
58
- key,
59
- scope
35
+ }
36
+ async set(key, value, scope, options) {
37
+ try {
38
+ const scopedKey = this.createScopedKey(key, scope);
39
+ const keys = this.table.createKeys({
40
+ scopedKey
41
+ });
42
+ await this.entity.put({
43
+ ...keys,
44
+ TYPE: "KeyValueStore",
45
+ expiresAt: options?.expiresAt ? Math.floor(options.expiresAt.getTime() / 1000) : void 0,
46
+ data: {
47
+ key,
48
+ value,
49
+ scope
50
+ }
51
+ });
52
+ } catch (err) {
53
+ throw WebinyError.from(err, {
54
+ message: "Could not set key-value record.",
55
+ code: "SET_KEY_VALUE_ERROR",
56
+ data: {
57
+ key,
58
+ scope
59
+ }
60
+ });
60
61
  }
61
- });
62
62
  }
63
- }
64
- async delete(key, scope) {
65
- try {
66
- const scopedKey = this.createScopedKey(key, scope);
67
- await this.entity.delete(this.table.createKeys({
68
- scopedKey
69
- }));
70
- } catch (err) {
71
- throw WebinyError.from(err, {
72
- message: "Could not delete key-value record.",
73
- code: "DELETE_KEY_VALUE_ERROR",
74
- data: {
75
- key,
76
- scope
63
+ async delete(key, scope) {
64
+ try {
65
+ const scopedKey = this.createScopedKey(key, scope);
66
+ await this.entity.delete(this.table.createKeys({
67
+ scopedKey
68
+ }));
69
+ } catch (err) {
70
+ throw WebinyError.from(err, {
71
+ message: "Could not delete key-value record.",
72
+ code: "DELETE_KEY_VALUE_ERROR",
73
+ data: {
74
+ key,
75
+ scope
76
+ }
77
+ });
77
78
  }
78
- });
79
79
  }
80
- }
81
80
  }
81
+ export { KeyValueStoreStorageOperations };
82
82
 
83
83
  //# sourceMappingURL=KeyValueStoreStorageOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","KeyValueStoreDynamoTable","KeyValueStoreStorageOperations","constructor","dynamoDbClient","table","entity","getEntity","createScopedKey","key","scope","get","scopedKey","entry","createKeys","value","data","err","from","message","code","set","keys","put","TYPE","delete"],"sources":["KeyValueStoreStorageOperations.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { WebinyError } from \"@webiny/error\";\nimport { KeyValueStoreDynamoTable } from \"./KeyValueStoreDynamoTable.js\";\n\ninterface KeyValueRecord {\n key: string;\n value: any;\n scope: string;\n}\n\nexport class KeyValueStoreStorageOperations {\n private readonly table;\n private readonly entity;\n\n constructor(dynamoDbClient: DynamoDBDocument) {\n this.table = new KeyValueStoreDynamoTable<KeyValueRecord>(dynamoDbClient);\n this.entity = this.table.getEntity();\n }\n\n private createScopedKey(key: string, scope: string): string {\n return `${scope}:${key}`;\n }\n\n async get(key: string, scope: string): Promise<KeyValueRecord | null> {\n try {\n const scopedKey = this.createScopedKey(key, scope);\n const entry = await this.entity.get(this.table.createKeys({ scopedKey }));\n\n if (!entry) {\n return null;\n }\n\n // Return the user-facing key without scope prefix\n return {\n key,\n value: entry.data.value,\n scope: entry.data.scope\n };\n } catch (err) {\n throw WebinyError.from(err, {\n message: \"Could not get key-value record.\",\n code: \"GET_KEY_VALUE_ERROR\",\n data: { key, scope }\n });\n }\n }\n\n async set(key: string, value: any, scope: string): Promise<void> {\n try {\n const scopedKey = this.createScopedKey(key, scope);\n const keys = this.table.createKeys({ scopedKey });\n\n await this.entity.put({\n ...keys,\n TYPE: \"KeyValueStore\",\n data: {\n key,\n value,\n scope\n }\n });\n } catch (err) {\n throw WebinyError.from(err, {\n message: \"Could not set key-value record.\",\n code: \"SET_KEY_VALUE_ERROR\",\n data: { key, scope }\n });\n }\n }\n\n async delete(key: string, scope: string): Promise<void> {\n try {\n const scopedKey = this.createScopedKey(key, scope);\n await this.entity.delete(this.table.createKeys({ scopedKey }));\n } catch (err) {\n throw WebinyError.from(err, {\n message: \"Could not delete key-value record.\",\n code: \"DELETE_KEY_VALUE_ERROR\",\n data: { key, scope }\n });\n }\n }\n}\n"],"mappings":"AACA,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B,KAAK,CAACS,UAAU,CAAC;QAAEF;MAAU,CAAC,CAAC;MAEjD,MAAM,IAAI,CAACN,MAAM,CAACiB,GAAG,CAAC;QAClB,GAAGD,IAAI;QACPE,IAAI,EAAE,eAAe;QACrBR,IAAI,EAAE;UACFP,GAAG;UACHM,KAAK;UACLL;QACJ;MACJ,CAAC,CAAC;IACN,CAAC,CAAC,OAAOO,GAAG,EAAE;MACV,MAAMjB,WAAW,CAACkB,IAAI,CAACD,GAAG,EAAE;QACxBE,OAAO,EAAE,iCAAiC;QAC1CC,IAAI,EAAE,qBAAqB;QAC3BJ,IAAI,EAAE;UAAEP,GAAG;UAAEC;QAAM;MACvB,CAAC,CAAC;IACN;EACJ;EAEA,MAAMe,MAAMA,CAAChB,GAAW,EAAEC,KAAa,EAAiB;IACpD,IAAI;MACA,MAAME,SAAS,GAAG,IAAI,CAACJ,eAAe,CAACC,GAAG,EAAEC,KAAK,CAAC;MAClD,MAAM,IAAI,CAACJ,MAAM,CAACmB,MAAM,CAAC,IAAI,CAACpB,KAAK,CAACS,UAAU,CAAC;QAAEF;MAAU,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC,OAAOK,GAAG,EAAE;MACV,MAAMjB,WAAW,CAACkB,IAAI,CAACD,GAAG,EAAE;QACxBE,OAAO,EAAE,oCAAoC;QAC7CC,IAAI,EAAE,wBAAwB;QAC9BJ,IAAI,EAAE;UAAEP,GAAG;UAAEC;QAAM;MACvB,CAAC,CAAC;IACN;EACJ;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"keyValueStore/KeyValueStoreStorageOperations.js","sources":["../../src/keyValueStore/KeyValueStoreStorageOperations.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { WebinyError } from \"@webiny/error\";\nimport type { IKeyValueStoreSetOptions } from \"@webiny/api-core/features/keyValueStore/abstractions.js\";\nimport { KeyValueStoreDynamoTable } from \"./KeyValueStoreDynamoTable.js\";\n\ninterface KeyValueRecord {\n key: string;\n value: any;\n scope: string;\n}\n\nexport class KeyValueStoreStorageOperations {\n private readonly table;\n private readonly entity;\n\n constructor(dynamoDbClient: DynamoDBDocument) {\n this.table = new KeyValueStoreDynamoTable<KeyValueRecord>(dynamoDbClient);\n this.entity = this.table.getEntity();\n }\n\n private createScopedKey(key: string, scope: string): string {\n return `${scope}:${key}`;\n }\n\n async get(key: string, scope: string): Promise<KeyValueRecord | null> {\n try {\n const scopedKey = this.createScopedKey(key, scope);\n const entry = await this.entity.get(this.table.createKeys({ scopedKey }));\n\n if (!entry) {\n return null;\n }\n\n const ttl = Number(entry.expiresAt);\n if (ttl && ttl <= Math.floor(Date.now() / 1000)) {\n return null;\n }\n\n return {\n key,\n value: entry.data.value,\n scope: entry.data.scope\n };\n } catch (err) {\n throw WebinyError.from(err, {\n message: \"Could not get key-value record.\",\n code: \"GET_KEY_VALUE_ERROR\",\n data: { key, scope }\n });\n }\n }\n\n async set(\n key: string,\n value: any,\n scope: string,\n options?: IKeyValueStoreSetOptions\n ): Promise<void> {\n try {\n const scopedKey = this.createScopedKey(key, scope);\n const keys = this.table.createKeys({ scopedKey });\n\n await this.entity.put({\n ...keys,\n TYPE: \"KeyValueStore\",\n expiresAt: options?.expiresAt\n ? Math.floor(options.expiresAt.getTime() / 1000)\n : undefined,\n data: {\n key,\n value,\n scope\n }\n });\n } catch (err) {\n throw WebinyError.from(err, {\n message: \"Could not set key-value record.\",\n code: \"SET_KEY_VALUE_ERROR\",\n data: { key, scope }\n });\n }\n }\n\n async delete(key: string, scope: string): Promise<void> {\n try {\n const scopedKey = this.createScopedKey(key, scope);\n await this.entity.delete(this.table.createKeys({ scopedKey }));\n } catch (err) {\n throw WebinyError.from(err, {\n message: \"Could not delete key-value record.\",\n code: \"DELETE_KEY_VALUE_ERROR\",\n data: { key, scope }\n });\n }\n }\n}\n"],"names":["KeyValueStoreStorageOperations","dynamoDbClient","KeyValueStoreDynamoTable","key","scope","scopedKey","entry","ttl","Number","Math","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,OAAO,KAAK,QACzCE;gBACN,MAAM;oBACFb;oBACAU;oBACAT;gBACJ;YACJ;QACJ,EAAE,OAAOO,KAAK;YACV,MAAMC,YAAY,IAAI,CAACD,KAAK;gBACxB,SAAS;gBACT,MAAM;gBACN,MAAM;oBAAER;oBAAKC;gBAAM;YACvB;QACJ;IACJ;IAEA,MAAM,OAAOD,GAAW,EAAEC,KAAa,EAAiB;QACpD,IAAI;YACA,MAAMC,YAAY,IAAI,CAAC,eAAe,CAACF,KAAKC;YAC5C,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;gBAAEC;YAAU;QAC/D,EAAE,OAAOM,KAAK;YACV,MAAMC,YAAY,IAAI,CAACD,KAAK;gBACxB,SAAS;gBACT,MAAM;gBACN,MAAM;oBAAER;oBAAKC;gBAAM;YACvB;QACJ;IACJ;AACJ"}
@@ -1,6 +1,5 @@
1
1
  import { KeyValueStoreStorageOperations } from "./KeyValueStoreStorageOperations.js";
2
- export const createStorageOperations = params => {
3
- return new KeyValueStoreStorageOperations(params.documentClient);
4
- };
2
+ const createStorageOperations = (params)=>new KeyValueStoreStorageOperations(params.documentClient);
3
+ export { createStorageOperations };
5
4
 
6
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["KeyValueStoreStorageOperations","createStorageOperations","params","documentClient"],"sources":["index.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { KeyValueStoreStorageOperations } from \"./KeyValueStoreStorageOperations.js\";\n\nexport interface CreateKeyValueStoreStorageOperations {\n (params: { documentClient: DynamoDBDocument }): KeyValueStoreStorageOperations;\n}\n\nexport const createStorageOperations: CreateKeyValueStoreStorageOperations = params => {\n return new KeyValueStoreStorageOperations(params.documentClient);\n};\n"],"mappings":"AACA,SAASA,8BAA8B;AAMvC,OAAO,MAAMC,uBAA6D,GAAGC,MAAM,IAAI;EACnF,OAAO,IAAIF,8BAA8B,CAACE,MAAM,CAACC,cAAc,CAAC;AACpE,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"keyValueStore/index.js","sources":["../../src/keyValueStore/index.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { KeyValueStoreStorageOperations } from \"./KeyValueStoreStorageOperations.js\";\n\nexport interface CreateKeyValueStoreStorageOperations {\n (params: { documentClient: DynamoDBDocument }): KeyValueStoreStorageOperations;\n}\n\nexport const createStorageOperations: CreateKeyValueStoreStorageOperations = params => {\n return new KeyValueStoreStorageOperations(params.documentClient);\n};\n"],"names":["createStorageOperations","params","KeyValueStoreStorageOperations"],"mappings":";AAOO,MAAMA,0BAAgEC,CAAAA,SAClE,IAAIC,+BAA+BD,OAAO,cAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-core-ddb",
3
- "version": "6.3.0-beta.4",
3
+ "version": "6.4.0-beta.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -21,16 +21,16 @@
21
21
  "author": "Webiny Ltd.",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@webiny/api": "6.3.0-beta.4",
25
- "@webiny/api-core": "6.3.0-beta.4",
26
- "@webiny/aws-sdk": "6.3.0-beta.4",
27
- "@webiny/db-dynamodb": "6.3.0-beta.4",
28
- "@webiny/error": "6.3.0-beta.4"
24
+ "@webiny/api": "6.4.0-beta.0",
25
+ "@webiny/api-core": "6.4.0-beta.0",
26
+ "@webiny/aws-sdk": "6.4.0-beta.0",
27
+ "@webiny/db-dynamodb": "6.4.0-beta.0",
28
+ "@webiny/error": "6.4.0-beta.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@webiny/api": "0.0.0",
32
- "@webiny/build-tools": "6.3.0-beta.4",
33
- "@webiny/project-utils": "6.3.0-beta.4",
32
+ "@webiny/build-tools": "6.4.0-beta.0",
33
+ "@webiny/project-utils": "6.4.0-beta.0",
34
34
  "jest-dynalite": "3.6.1",
35
35
  "rimraf": "6.1.3",
36
36
  "typescript": "6.0.3"
@@ -39,5 +39,5 @@
39
39
  "access": "public",
40
40
  "directory": "dist"
41
41
  },
42
- "gitHead": "7cefe15431dbd65504e1f58147dc9e55bcbfa693"
42
+ "gitHead": "a545d7529828af07d08d49c3da1bcb967483b9ce"
43
43
  }
@@ -1,28 +1,23 @@
1
1
  import { createStandardEntity, standardEntityAttributes } from "@webiny/db-dynamodb";
2
2
  import { ENTITIES } from "../types.js";
3
- export const createRoleEntity = table => {
4
- return createStandardEntity({
5
- name: ENTITIES.ROLE,
6
- table
7
- });
8
- };
9
- export const createTeamEntity = table => {
10
- return createStandardEntity({
11
- name: ENTITIES.TEAM,
12
- table,
13
- attributes: {
14
- ...standardEntityAttributes
15
- }
16
- });
17
- };
18
- export const createApiKeyEntity = table => {
19
- return createStandardEntity({
20
- name: ENTITIES.API_KEY,
21
- table,
22
- attributes: {
23
- ...standardEntityAttributes
24
- }
25
- });
26
- };
3
+ const createRoleEntity = (table)=>createStandardEntity({
4
+ name: ENTITIES.ROLE,
5
+ table
6
+ });
7
+ const createTeamEntity = (table)=>createStandardEntity({
8
+ name: ENTITIES.TEAM,
9
+ table,
10
+ attributes: {
11
+ ...standardEntityAttributes
12
+ }
13
+ });
14
+ const createApiKeyEntity = (table)=>createStandardEntity({
15
+ name: ENTITIES.API_KEY,
16
+ table,
17
+ attributes: {
18
+ ...standardEntityAttributes
19
+ }
20
+ });
21
+ export { createApiKeyEntity, createRoleEntity, createTeamEntity };
27
22
 
28
23
  //# sourceMappingURL=entities.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createStandardEntity","standardEntityAttributes","ENTITIES","createRoleEntity","table","name","ROLE","createTeamEntity","TEAM","attributes","createApiKeyEntity","API_KEY"],"sources":["entities.ts"],"sourcesContent":["import { createStandardEntity, standardEntityAttributes } from \"@webiny/db-dynamodb\";\nimport type { StorageApiKey, StorageRole, StorageTeam } from \"@webiny/api-core/types/security.js\";\nimport type { Table } from \"@webiny/db-dynamodb/toolbox.js\";\nimport { ENTITIES } from \"../types.js\";\nimport type { IApiKeyEntity, IRoleEntity, ITeamEntity } from \"~/security/definitions/types.js\";\n\nexport const createRoleEntity = (table: Table<string, string, string>): IRoleEntity => {\n return createStandardEntity<StorageRole>({\n name: ENTITIES.ROLE,\n table\n });\n};\n\nexport const createTeamEntity = (table: Table<string, string, string>): ITeamEntity => {\n return createStandardEntity<StorageTeam>({\n name: ENTITIES.TEAM,\n table,\n attributes: {\n ...standardEntityAttributes\n }\n });\n};\n\nexport const createApiKeyEntity = (table: Table<string, string, string>): IApiKeyEntity => {\n return createStandardEntity<StorageApiKey>({\n name: ENTITIES.API_KEY,\n table,\n attributes: {\n ...standardEntityAttributes\n }\n });\n};\n"],"mappings":"AAAA,SAASA,oBAAoB,EAAEC,wBAAwB,QAAQ,qBAAqB;AAGpF,SAASC,QAAQ;AAGjB,OAAO,MAAMC,gBAAgB,GAAIC,KAAoC,IAAkB;EACnF,OAAOJ,oBAAoB,CAAc;IACrCK,IAAI,EAAEH,QAAQ,CAACI,IAAI;IACnBF;EACJ,CAAC,CAAC;AACN,CAAC;AAED,OAAO,MAAMG,gBAAgB,GAAIH,KAAoC,IAAkB;EACnF,OAAOJ,oBAAoB,CAAc;IACrCK,IAAI,EAAEH,QAAQ,CAACM,IAAI;IACnBJ,KAAK;IACLK,UAAU,EAAE;MACR,GAAGR;IACP;EACJ,CAAC,CAAC;AACN,CAAC;AAED,OAAO,MAAMS,kBAAkB,GAAIN,KAAoC,IAAoB;EACvF,OAAOJ,oBAAoB,CAAgB;IACvCK,IAAI,EAAEH,QAAQ,CAACS,OAAO;IACtBP,KAAK;IACLK,UAAU,EAAE;MACR,GAAGR;IACP;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"security/definitions/entities.js","sources":["../../../src/security/definitions/entities.ts"],"sourcesContent":["import { createStandardEntity, standardEntityAttributes } from \"@webiny/db-dynamodb\";\nimport type { StorageApiKey, StorageRole, StorageTeam } from \"@webiny/api-core/types/security.js\";\nimport type { Table } from \"@webiny/db-dynamodb/toolbox.js\";\nimport { ENTITIES } from \"../types.js\";\nimport type { IApiKeyEntity, IRoleEntity, ITeamEntity } from \"~/security/definitions/types.js\";\n\nexport const createRoleEntity = (table: Table<string, string, string>): IRoleEntity => {\n return createStandardEntity<StorageRole>({\n name: ENTITIES.ROLE,\n table\n });\n};\n\nexport const createTeamEntity = (table: Table<string, string, string>): ITeamEntity => {\n return createStandardEntity<StorageTeam>({\n name: ENTITIES.TEAM,\n table,\n attributes: {\n ...standardEntityAttributes\n }\n });\n};\n\nexport const createApiKeyEntity = (table: Table<string, string, string>): IApiKeyEntity => {\n return createStandardEntity<StorageApiKey>({\n name: ENTITIES.API_KEY,\n table,\n attributes: {\n ...standardEntityAttributes\n }\n });\n};\n"],"names":["createRoleEntity","table","createStandardEntity","ENTITIES","createTeamEntity","standardEntityAttributes","createApiKeyEntity"],"mappings":";;AAMO,MAAMA,mBAAmB,CAACC,QACtBC,qBAAkC;QACrC,MAAMC,SAAS,IAAI;QACnBF;IACJ;AAGG,MAAMG,mBAAmB,CAACH,QACtBC,qBAAkC;QACrC,MAAMC,SAAS,IAAI;QACnBF;QACA,YAAY;YACR,GAAGI,wBAAwB;QAC/B;IACJ;AAGG,MAAMC,qBAAqB,CAACL,QACxBC,qBAAoC;QACvC,MAAMC,SAAS,OAAO;QACtBF;QACA,YAAY;YACR,GAAGI,wBAAwB;QAC/B;IACJ"}
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map