@webiny/api-core-ddb 6.4.12-beta.5 → 6.5.0-beta.1
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/createApiCoreDdb.js +7 -2
- package/createApiCoreDdb.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +10 -10
- package/serviceDiscovery/DdbServiceManifestLoader.d.ts +7 -0
- package/serviceDiscovery/DdbServiceManifestLoader.js +27 -0
- package/serviceDiscovery/DdbServiceManifestLoader.js.map +1 -0
- package/serviceDiscovery/index.d.ts +1 -0
- package/serviceDiscovery/index.js +1 -0
package/createApiCoreDdb.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { ServiceDiscovery } from "@webiny/api-core/features/serviceDiscovery/index.js";
|
|
1
2
|
import { createStorageOperations } from "./adminUsers/index.js";
|
|
2
3
|
import { createStorageOperations as index_js_createStorageOperations } from "./tenancy/index.js";
|
|
3
4
|
import { createStorageOperations as external_security_index_js_createStorageOperations } from "./security/index.js";
|
|
4
5
|
import { createStorageOperations as external_keyValueStore_index_js_createStorageOperations } from "./keyValueStore/index.js";
|
|
5
|
-
|
|
6
|
+
import { DdbServiceManifestLoader } from "./serviceDiscovery/index.js";
|
|
7
|
+
const createApiCoreDdb = ({ documentClient })=>{
|
|
8
|
+
ServiceDiscovery.setLoader(new DdbServiceManifestLoader(documentClient));
|
|
9
|
+
return {
|
|
6
10
|
usersStorageOperations: createStorageOperations({
|
|
7
11
|
documentClient
|
|
8
12
|
}),
|
|
@@ -15,7 +19,8 @@ const createApiCoreDdb = ({ documentClient })=>({
|
|
|
15
19
|
keyValueStorageOperations: external_keyValueStore_index_js_createStorageOperations({
|
|
16
20
|
documentClient
|
|
17
21
|
})
|
|
18
|
-
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
19
24
|
export { createApiCoreDdb };
|
|
20
25
|
|
|
21
26
|
//# sourceMappingURL=createApiCoreDdb.js.map
|
package/createApiCoreDdb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createApiCoreDdb.js","sources":["../src/createApiCoreDdb.ts"],"sourcesContent":["import type { ApiCoreStorageOperations } from \"@webiny/api-core/types/core.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { createStorageOperations as createUsersStorageOperations } from \"./adminUsers/index.js\";\nimport { createStorageOperations as createTenancyStorageOperations } from \"./tenancy/index.js\";\nimport { createStorageOperations as createSecurityStorageOperations } from \"./security/index.js\";\nimport { createStorageOperations as createKeyValueStorageOperations } from \"./keyValueStore/index.js\";\n\ninterface CreateApiCoreDdbParams {\n documentClient: DynamoDBDocument;\n}\n\nexport const createApiCoreDdb = ({\n documentClient\n}: CreateApiCoreDdbParams): ApiCoreStorageOperations => {\n return {\n usersStorageOperations: createUsersStorageOperations({\n documentClient\n }),\n tenancyStorageOperations: createTenancyStorageOperations({\n documentClient\n }),\n securityStorageOperations: createSecurityStorageOperations({\n documentClient\n }),\n keyValueStorageOperations: createKeyValueStorageOperations({\n documentClient\n })\n };\n};\n"],"names":["createApiCoreDdb","documentClient","createUsersStorageOperations","createTenancyStorageOperations","createSecurityStorageOperations","createKeyValueStorageOperations"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createApiCoreDdb.js","sources":["../src/createApiCoreDdb.ts"],"sourcesContent":["import type { ApiCoreStorageOperations } from \"@webiny/api-core/types/core.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { ServiceDiscovery } from \"@webiny/api-core/features/serviceDiscovery/index.js\";\nimport { createStorageOperations as createUsersStorageOperations } from \"./adminUsers/index.js\";\nimport { createStorageOperations as createTenancyStorageOperations } from \"./tenancy/index.js\";\nimport { createStorageOperations as createSecurityStorageOperations } from \"./security/index.js\";\nimport { createStorageOperations as createKeyValueStorageOperations } from \"./keyValueStore/index.js\";\nimport { DdbServiceManifestLoader } from \"./serviceDiscovery/index.js\";\n\ninterface CreateApiCoreDdbParams {\n documentClient: DynamoDBDocument;\n}\n\nexport const createApiCoreDdb = ({\n documentClient\n}: CreateApiCoreDdbParams): ApiCoreStorageOperations => {\n ServiceDiscovery.setLoader(new DdbServiceManifestLoader(documentClient));\n\n return {\n usersStorageOperations: createUsersStorageOperations({\n documentClient\n }),\n tenancyStorageOperations: createTenancyStorageOperations({\n documentClient\n }),\n securityStorageOperations: createSecurityStorageOperations({\n documentClient\n }),\n keyValueStorageOperations: createKeyValueStorageOperations({\n documentClient\n })\n };\n};\n"],"names":["createApiCoreDdb","documentClient","ServiceDiscovery","DdbServiceManifestLoader","createUsersStorageOperations","createTenancyStorageOperations","createSecurityStorageOperations","createKeyValueStorageOperations"],"mappings":";;;;;;AAaO,MAAMA,mBAAmB,CAAC,EAC7BC,cAAc,EACO;IACrBC,iBAAiB,SAAS,CAAC,IAAIC,yBAAyBF;IAExD,OAAO;QACH,wBAAwBG,wBAA6B;YACjDH;QACJ;QACA,0BAA0BI,iCAA+B;YACrDJ;QACJ;QACA,2BAA2BK,mDAAgC;YACvDL;QACJ;QACA,2BAA2BM,wDAAgC;YACvDN;QACJ;IACJ;AACJ"}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-core-ddb",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
"author": "Webiny Ltd.",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@webiny/api": "6.
|
|
25
|
-
"@webiny/api-core": "6.
|
|
26
|
-
"@webiny/aws-sdk": "6.
|
|
27
|
-
"@webiny/db-dynamodb": "6.
|
|
28
|
-
"@webiny/error": "6.
|
|
24
|
+
"@webiny/api": "6.5.0-beta.1",
|
|
25
|
+
"@webiny/api-core": "6.5.0-beta.1",
|
|
26
|
+
"@webiny/aws-sdk": "6.5.0-beta.1",
|
|
27
|
+
"@webiny/db-dynamodb": "6.5.0-beta.1",
|
|
28
|
+
"@webiny/error": "6.5.0-beta.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@webiny/api": "6.
|
|
32
|
-
"@webiny/build-tools": "6.
|
|
33
|
-
"@webiny/project-utils": "6.
|
|
31
|
+
"@webiny/api": "6.5.0-beta.1",
|
|
32
|
+
"@webiny/build-tools": "6.5.0-beta.1",
|
|
33
|
+
"@webiny/project-utils": "6.5.0-beta.1",
|
|
34
34
|
"jest-dynalite": "3.6.1",
|
|
35
35
|
"rimraf": "6.1.3",
|
|
36
|
-
"typescript": "
|
|
36
|
+
"typescript": "7.0.2"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
2
|
+
import type { IServiceManifestLoader } from "@webiny/api-core/features/serviceDiscovery/index.js";
|
|
3
|
+
export declare class DdbServiceManifestLoader implements IServiceManifestLoader {
|
|
4
|
+
private readonly client;
|
|
5
|
+
constructor(client: Pick<DynamoDBDocument, "send">);
|
|
6
|
+
load(): Promise<any[] | undefined>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { QueryCommand, unmarshall } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
2
|
+
class DdbServiceManifestLoader {
|
|
3
|
+
constructor(client){
|
|
4
|
+
this.client = client;
|
|
5
|
+
}
|
|
6
|
+
async load() {
|
|
7
|
+
const result = await this.client.send(new QueryCommand({
|
|
8
|
+
TableName: String(process.env.DB_TABLE),
|
|
9
|
+
IndexName: "GSI1",
|
|
10
|
+
KeyConditionExpression: "GSI1_PK = :GSI1_PK AND GSI1_SK > :GSI1_SK",
|
|
11
|
+
ExpressionAttributeValues: {
|
|
12
|
+
":GSI1_PK": {
|
|
13
|
+
S: "SERVICE_MANIFESTS"
|
|
14
|
+
},
|
|
15
|
+
":GSI1_SK": {
|
|
16
|
+
S: " "
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
const items = result.Items;
|
|
21
|
+
if (!Array.isArray(items)) return;
|
|
22
|
+
return items.map((item)=>unmarshall(item).data);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export { DdbServiceManifestLoader };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=DdbServiceManifestLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceDiscovery/DdbServiceManifestLoader.js","sources":["../../src/serviceDiscovery/DdbServiceManifestLoader.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { QueryCommand } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { unmarshall } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { IServiceManifestLoader } from \"@webiny/api-core/features/serviceDiscovery/index.js\";\n\nexport class DdbServiceManifestLoader implements IServiceManifestLoader {\n private readonly client: Pick<DynamoDBDocument, \"send\">;\n\n constructor(client: Pick<DynamoDBDocument, \"send\">) {\n this.client = client;\n }\n\n async load() {\n const result = await this.client.send(\n new QueryCommand({\n TableName: String(process.env.DB_TABLE),\n IndexName: \"GSI1\",\n KeyConditionExpression: \"GSI1_PK = :GSI1_PK AND GSI1_SK > :GSI1_SK\",\n ExpressionAttributeValues: {\n \":GSI1_PK\": { S: \"SERVICE_MANIFESTS\" },\n \":GSI1_SK\": { S: \" \" }\n }\n })\n );\n\n const items = result.Items;\n\n if (!Array.isArray(items)) {\n return undefined;\n }\n\n return items.map(item => unmarshall(item).data);\n }\n}\n"],"names":["DdbServiceManifestLoader","client","result","QueryCommand","String","process","items","Array","item","unmarshall"],"mappings":";AAKO,MAAMA;IAGT,YAAYC,MAAsC,CAAE;QAChD,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEA,MAAM,OAAO;QACT,MAAMC,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACjC,IAAIC,aAAa;YACb,WAAWC,OAAOC,QAAQ,GAAG,CAAC,QAAQ;YACtC,WAAW;YACX,wBAAwB;YACxB,2BAA2B;gBACvB,YAAY;oBAAE,GAAG;gBAAoB;gBACrC,YAAY;oBAAE,GAAG;gBAAI;YACzB;QACJ;QAGJ,MAAMC,QAAQJ,OAAO,KAAK;QAE1B,IAAI,CAACK,MAAM,OAAO,CAACD,QACf;QAGJ,OAAOA,MAAM,GAAG,CAACE,CAAAA,OAAQC,WAAWD,MAAM,IAAI;IAClD;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DdbServiceManifestLoader } from "./DdbServiceManifestLoader.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DdbServiceManifestLoader } from "./DdbServiceManifestLoader.js";
|