@webiny/api-sync-ddb-to-opensearch 6.6.0-alpha.12 → 6.6.0-alpha.14
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/createDdbToOpenSearchStreamHandler.js +4 -4
- package/createDdbToOpenSearchStreamHandler.js.map +1 -1
- package/features/DdbToOpenSearchHandler/DdbToOpenSearchHandler.d.ts +5 -5
- package/features/DdbToOpenSearchHandler/DdbToOpenSearchHandler.js +5 -5
- package/features/DdbToOpenSearchHandler/DdbToOpenSearchHandler.js.map +1 -1
- package/package.json +10 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Container } from "@webiny/feature/api";
|
|
2
|
-
import { RequestContainer } from "@webiny/
|
|
3
|
-
import {
|
|
2
|
+
import { RequestContainer } from "@webiny/api-kernel-core";
|
|
3
|
+
import { DynamoDBInputHandler } from "@webiny/api-kernel-aws/abstractions/handlers/DynamoDBInputHandler.js";
|
|
4
4
|
import { TimerFeature } from "@webiny/utils/features/Timer/feature.js";
|
|
5
5
|
import { ProcessEnvFeature } from "@webiny/stdlib/node";
|
|
6
6
|
import { DdbToOpenSearchFeature } from "./features/DdbToOpenSearchFeature.js";
|
|
@@ -15,10 +15,10 @@ const createDdbToOpenSearchStreamHandler = (client)=>{
|
|
|
15
15
|
DdbToOpenSearchFeature.register(container, {
|
|
16
16
|
client
|
|
17
17
|
});
|
|
18
|
-
const handler = container.resolve(
|
|
18
|
+
const handler = container.resolve(DynamoDBInputHandler);
|
|
19
19
|
return async (event)=>{
|
|
20
20
|
await handler.execute({
|
|
21
|
-
event,
|
|
21
|
+
input: event,
|
|
22
22
|
metadata: {}
|
|
23
23
|
}, ()=>Promise.resolve());
|
|
24
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDdbToOpenSearchStreamHandler.js","sources":["../src/createDdbToOpenSearchStreamHandler.ts"],"sourcesContent":["import { Container } from \"@webiny/feature/api\";\nimport { RequestContainer } from \"@webiny/
|
|
1
|
+
{"version":3,"file":"createDdbToOpenSearchStreamHandler.js","sources":["../src/createDdbToOpenSearchStreamHandler.ts"],"sourcesContent":["import { Container } from \"@webiny/feature/api\";\nimport { RequestContainer } from \"@webiny/api-kernel-core\";\nimport { DynamoDBInputHandler } from \"@webiny/api-kernel-aws/abstractions/handlers/DynamoDBInputHandler.js\";\nimport { TimerFeature } from \"@webiny/utils/features/Timer/feature.js\";\nimport { ProcessEnvFeature } from \"@webiny/stdlib/node\";\nimport { DdbToOpenSearchFeature } from \"./features/DdbToOpenSearchFeature.js\";\nimport type { Client } from \"@webiny/api-opensearch/client.js\";\nimport type { DynamoDBStreamEvent } from \"@webiny/aws-sdk/types/index.js\";\n\nexport type DdbToOpenSearchStreamHandler = (event: DynamoDBStreamEvent) => Promise<void>;\n\nexport const createDdbToOpenSearchStreamHandler = (\n client: Client\n): DdbToOpenSearchStreamHandler => {\n const container = new Container();\n container.registerInstance(RequestContainer, container);\n\n // Existing behavior: MAX_RUNNING_TIME = 900 hardcoded.\n // In real Lambda deployments, the handler bootstrap should register a Timer\n // that wraps context.getRemainingTimeInMillis(). This factory matches current behavior.\n ProcessEnvFeature.register(container);\n TimerFeature.register(container, {\n getRemainingSeconds: () => 900,\n getRemainingMilliseconds: () => 900 * 1000\n });\n\n DdbToOpenSearchFeature.register(container, { client });\n\n const handler = container.resolve(DynamoDBInputHandler);\n\n return async (event: DynamoDBStreamEvent): Promise<void> => {\n await handler.execute({ input: event, metadata: {} }, () => Promise.resolve());\n };\n};\n"],"names":["createDdbToOpenSearchStreamHandler","client","container","Container","RequestContainer","ProcessEnvFeature","TimerFeature","DdbToOpenSearchFeature","handler","DynamoDBInputHandler","event","Promise"],"mappings":";;;;;;AAWO,MAAMA,qCAAqC,CAC9CC;IAEA,MAAMC,YAAY,IAAIC;IACtBD,UAAU,gBAAgB,CAACE,kBAAkBF;IAK7CG,kBAAkB,QAAQ,CAACH;IAC3BI,aAAa,QAAQ,CAACJ,WAAW;QAC7B,qBAAqB,IAAM;QAC3B,0BAA0B,IAAM;IACpC;IAEAK,uBAAuB,QAAQ,CAACL,WAAW;QAAED;IAAO;IAEpD,MAAMO,UAAUN,UAAU,OAAO,CAACO;IAElC,OAAO,OAAOC;QACV,MAAMF,QAAQ,OAAO,CAAC;YAAE,OAAOE;YAAO,UAAU,CAAC;QAAE,GAAG,IAAMC,QAAQ,OAAO;IAC/E;AACJ"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Container } from "@webiny/feature/api";
|
|
2
2
|
import type { DynamoDBStreamEvent } from "@webiny/aws-sdk/types/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import type {
|
|
5
|
-
declare class DdbToOpenSearchHandlerImpl implements
|
|
3
|
+
import { DynamoDBInputHandler, type DynamoDBResult } from "@webiny/api-kernel-aws/abstractions/handlers/DynamoDBInputHandler.js";
|
|
4
|
+
import type { InputContext, NextFunction } from "@webiny/api-kernel-core";
|
|
5
|
+
declare class DdbToOpenSearchHandlerImpl implements DynamoDBInputHandler.Interface {
|
|
6
6
|
private container;
|
|
7
7
|
constructor(container: Container);
|
|
8
|
-
execute(
|
|
8
|
+
execute(inputCtx: InputContext<DynamoDBStreamEvent>, _next: NextFunction): Promise<DynamoDBResult>;
|
|
9
9
|
}
|
|
10
10
|
export declare const DdbToOpenSearchHandler: typeof DdbToOpenSearchHandlerImpl & {
|
|
11
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/
|
|
11
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-kernel-aws/abstractions/handlers/DynamoDBInputHandler.js").IDynamoDBInputHandler>;
|
|
12
12
|
};
|
|
13
13
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RequestContainer } from "@webiny/
|
|
1
|
+
import { DynamoDBInputHandler } from "@webiny/api-kernel-aws/abstractions/handlers/DynamoDBInputHandler.js";
|
|
2
|
+
import { RequestContainer } from "@webiny/api-kernel-core";
|
|
3
3
|
import { OperationsBuilder } from "@webiny/api-sync-to-opensearch/features/OperationsBuilder/abstraction.js";
|
|
4
4
|
import { ExecuteSyncWithRetry } from "@webiny/api-sync-to-opensearch/features/ExecuteSyncWithRetry/abstraction.js";
|
|
5
5
|
const MAX_RUNNING_TIME = 900;
|
|
@@ -7,10 +7,10 @@ class DdbToOpenSearchHandlerImpl {
|
|
|
7
7
|
constructor(container){
|
|
8
8
|
this.container = container;
|
|
9
9
|
}
|
|
10
|
-
async execute(
|
|
10
|
+
async execute(inputCtx, _next) {
|
|
11
11
|
const builder = this.container.resolve(OperationsBuilder);
|
|
12
12
|
const operations = await builder.build({
|
|
13
|
-
records:
|
|
13
|
+
records: inputCtx.input.Records
|
|
14
14
|
});
|
|
15
15
|
if (0 === operations.total) return {
|
|
16
16
|
success: true,
|
|
@@ -27,7 +27,7 @@ class DdbToOpenSearchHandlerImpl {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
const DdbToOpenSearchHandler =
|
|
30
|
+
const DdbToOpenSearchHandler = DynamoDBInputHandler.createImplementation({
|
|
31
31
|
implementation: DdbToOpenSearchHandlerImpl,
|
|
32
32
|
dependencies: [
|
|
33
33
|
RequestContainer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/DdbToOpenSearchHandler/DdbToOpenSearchHandler.js","sources":["../../../src/features/DdbToOpenSearchHandler/DdbToOpenSearchHandler.ts"],"sourcesContent":["import type { Container } from \"@webiny/feature/api\";\nimport type { DynamoDBStreamEvent } from \"@webiny/aws-sdk/types/index.js\";\nimport {\n
|
|
1
|
+
{"version":3,"file":"features/DdbToOpenSearchHandler/DdbToOpenSearchHandler.js","sources":["../../../src/features/DdbToOpenSearchHandler/DdbToOpenSearchHandler.ts"],"sourcesContent":["import type { Container } from \"@webiny/feature/api\";\nimport type { DynamoDBStreamEvent } from \"@webiny/aws-sdk/types/index.js\";\nimport {\n DynamoDBInputHandler,\n type DynamoDBResult\n} from \"@webiny/api-kernel-aws/abstractions/handlers/DynamoDBInputHandler.js\";\nimport { RequestContainer } from \"@webiny/api-kernel-core\";\nimport type { InputContext, NextFunction } from \"@webiny/api-kernel-core\";\nimport { OperationsBuilder } from \"@webiny/api-sync-to-opensearch/features/OperationsBuilder/abstraction.js\";\nimport { ExecuteSyncWithRetry } from \"@webiny/api-sync-to-opensearch/features/ExecuteSyncWithRetry/abstraction.js\";\n\nconst MAX_RUNNING_TIME = 900;\n\nclass DdbToOpenSearchHandlerImpl implements DynamoDBInputHandler.Interface {\n constructor(private container: Container) {}\n\n async execute(\n inputCtx: InputContext<DynamoDBStreamEvent>,\n _next: NextFunction\n ): Promise<DynamoDBResult> {\n const builder = this.container.resolve(OperationsBuilder);\n const operations = await builder.build({ records: inputCtx.input.Records });\n\n if (operations.total === 0) {\n return { success: true, processedRecords: 0 };\n }\n\n const executeSyncWithRetry = this.container.resolve(ExecuteSyncWithRetry);\n\n await executeSyncWithRetry.execute({\n maxRunningTime: MAX_RUNNING_TIME,\n operations\n });\n\n return { success: true, processedRecords: operations.count };\n }\n}\n\nexport const DdbToOpenSearchHandler = DynamoDBInputHandler.createImplementation({\n implementation: DdbToOpenSearchHandlerImpl,\n dependencies: [RequestContainer]\n});\n"],"names":["MAX_RUNNING_TIME","DdbToOpenSearchHandlerImpl","container","inputCtx","_next","builder","OperationsBuilder","operations","executeSyncWithRetry","ExecuteSyncWithRetry","DdbToOpenSearchHandler","DynamoDBInputHandler","RequestContainer"],"mappings":";;;;AAWA,MAAMA,mBAAmB;AAEzB,MAAMC;IACF,YAAoBC,SAAoB,CAAE;aAAtBA,SAAS,GAATA;IAAuB;IAE3C,MAAM,QACFC,QAA2C,EAC3CC,KAAmB,EACI;QACvB,MAAMC,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;QACvC,MAAMC,aAAa,MAAMF,QAAQ,KAAK,CAAC;YAAE,SAASF,SAAS,KAAK,CAAC,OAAO;QAAC;QAEzE,IAAII,AAAqB,MAArBA,WAAW,KAAK,EAChB,OAAO;YAAE,SAAS;YAAM,kBAAkB;QAAE;QAGhD,MAAMC,uBAAuB,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;QAEpD,MAAMD,qBAAqB,OAAO,CAAC;YAC/B,gBAAgBR;YAChBO;QACJ;QAEA,OAAO;YAAE,SAAS;YAAM,kBAAkBA,WAAW,KAAK;QAAC;IAC/D;AACJ;AAEO,MAAMG,yBAAyBC,qBAAqB,oBAAoB,CAAC;IAC5E,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-sync-ddb-to-opensearch",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"author": "Webiny Ltd.",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@webiny/api": "6.6.0-alpha.
|
|
19
|
-
"@webiny/api-
|
|
20
|
-
"@webiny/api-
|
|
21
|
-
"@webiny/
|
|
22
|
-
"@webiny/
|
|
23
|
-
"@webiny/
|
|
24
|
-
"@webiny/feature": "6.6.0-alpha.
|
|
18
|
+
"@webiny/api": "6.6.0-alpha.14",
|
|
19
|
+
"@webiny/api-kernel-aws": "6.6.0-alpha.14",
|
|
20
|
+
"@webiny/api-kernel-core": "6.6.0-alpha.14",
|
|
21
|
+
"@webiny/api-opensearch": "6.6.0-alpha.14",
|
|
22
|
+
"@webiny/api-sync-to-opensearch": "6.6.0-alpha.14",
|
|
23
|
+
"@webiny/aws-sdk": "6.6.0-alpha.14",
|
|
24
|
+
"@webiny/feature": "6.6.0-alpha.14",
|
|
25
25
|
"@webiny/stdlib": "0.0.21",
|
|
26
|
-
"@webiny/utils": "6.6.0-alpha.
|
|
26
|
+
"@webiny/utils": "6.6.0-alpha.14"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
29
|
+
"@webiny/build-tools": "6.6.0-alpha.14",
|
|
30
30
|
"typescript": "7.0.2"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|