@webiny/api-event-handler-aws-ddb-os 6.6.0-alpha.0 → 6.6.0-alpha.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/createWebinyApiHandler.d.ts +5 -0
- package/createWebinyApiHandler.js +13 -7
- package/createWebinyApiHandler.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -1
- package/package.json +13 -13
|
@@ -17,3 +17,8 @@ export type CreateAwsDdbOsApiHandlerConfig = Pick<BaseConfig, "extensions" | "do
|
|
|
17
17
|
openSearchClient?: ReturnType<typeof createAwsOpenSearchClient>;
|
|
18
18
|
};
|
|
19
19
|
export declare function createAwsDdbOsApiHandler(config: CreateAwsDdbOsApiHandlerConfig): (event: any, context?: import("aws-lambda").Context) => Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Response-streaming counterpart, for the Lambda function whose Function URL uses
|
|
22
|
+
* `InvokeMode: RESPONSE_STREAM`. Identical storage; only the transport differs.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createAwsDdbOsStreamApiHandler(config: CreateAwsDdbOsApiHandlerConfig): import("@webiny/event-handler-aws").StreamLambdaHandler;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createWebinyApiHandler } from "@webiny/api-event-handler-aws";
|
|
1
|
+
import { createWebinyApiHandler, createWebinyStreamApiHandler } from "@webiny/api-event-handler-aws";
|
|
2
2
|
import { ApiCoreDdbFeature } from "@webiny/api-core-ddb";
|
|
3
3
|
import { HeadlessCmsDdbEsFeature } from "@webiny/api-headless-cms-ddb-es";
|
|
4
4
|
import { AuditLogsDdbFeature } from "@webiny/api-audit-logs-ddb";
|
|
5
5
|
import { AcoDdbFeature } from "@webiny/api-aco-ddb";
|
|
6
|
-
import { WebsocketsDdbFeature } from "@webiny/api-websockets-
|
|
6
|
+
import { WebsocketsDdbFeature } from "@webiny/api-websockets-aws";
|
|
7
7
|
import { DbRegistryFeature } from "@webiny/db/exports/api/db.js";
|
|
8
8
|
import { AwsOpenSearchClientFactoryFeature, createAwsOpenSearchClient } from "@webiny/api-opensearch-aws";
|
|
9
9
|
import { OpenSearchClientFeature } from "@webiny/api-opensearch/features/OpenSearchClient/feature.js";
|
|
@@ -22,12 +22,12 @@ const openSearchClientFromEnv = ()=>{
|
|
|
22
22
|
};
|
|
23
23
|
return createAwsOpenSearchClient(openSearchClientOptions);
|
|
24
24
|
};
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
return createWebinyApiHandler({
|
|
25
|
+
function storageConfig(config) {
|
|
26
|
+
return {
|
|
28
27
|
extensions: config.extensions,
|
|
29
28
|
documentClient: config.documentClient,
|
|
30
29
|
registerRootStorage: (container, { documentClient })=>{
|
|
30
|
+
const openSearchClient = config.openSearchClient ?? openSearchClientFromEnv();
|
|
31
31
|
OpenSearchClientFeature.register(container, openSearchClient);
|
|
32
32
|
AwsOpenSearchClientFactoryFeature.register(container);
|
|
33
33
|
OpenSearchQueryBuilderOperatorFeature.register(container);
|
|
@@ -44,8 +44,14 @@ function createAwsDdbOsApiHandler(config) {
|
|
|
44
44
|
registerRequestStorage: (container)=>{
|
|
45
45
|
DbRegistryFeature.register(container);
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function createAwsDdbOsApiHandler(config) {
|
|
50
|
+
return createWebinyApiHandler(storageConfig(config));
|
|
51
|
+
}
|
|
52
|
+
function createAwsDdbOsStreamApiHandler(config) {
|
|
53
|
+
return createWebinyStreamApiHandler(storageConfig(config));
|
|
48
54
|
}
|
|
49
|
-
export { createAwsDdbOsApiHandler };
|
|
55
|
+
export { createAwsDdbOsApiHandler, createAwsDdbOsStreamApiHandler };
|
|
50
56
|
|
|
51
57
|
//# sourceMappingURL=createWebinyApiHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWebinyApiHandler.js","sources":["../src/createWebinyApiHandler.ts"],"sourcesContent":["/**\n * Webiny API handler for AWS Lambda with DynamoDB + OpenSearch storage.\n *\n * Thin variant over the storage-agnostic base (@webiny/api-event-handler-aws): same DynamoDB storage as the\n * `-ddb` variant for core/audit-logs/ACO/websockets, but CMS uses the DynamoDB+OpenSearch storage\n * operations (`HeadlessCmsDdbEsFeature`), the OpenSearch core is registered in the root, and\n * `DbRegistryFeature` is registered per-request before the CMS storage builds (its beforeInit\n * registers the entities the DDB→ES sync stages).\n */\nimport {\n createWebinyApiHandler as createBaseHandler,\n type CreateWebinyApiHandlerConfig as BaseConfig\n} from \"@webiny/api-event-handler-aws\";\nimport { ApiCoreDdbFeature } from \"@webiny/api-core-ddb\";\nimport { HeadlessCmsDdbEsFeature } from \"@webiny/api-headless-cms-ddb-es\";\nimport { AuditLogsDdbFeature } from \"@webiny/api-audit-logs-ddb\";\nimport { AcoDdbFeature } from \"@webiny/api-aco-ddb\";\nimport { WebsocketsDdbFeature } from \"@webiny/api-websockets-
|
|
1
|
+
{"version":3,"file":"createWebinyApiHandler.js","sources":["../src/createWebinyApiHandler.ts"],"sourcesContent":["/**\n * Webiny API handler for AWS Lambda with DynamoDB + OpenSearch storage.\n *\n * Thin variant over the storage-agnostic base (@webiny/api-event-handler-aws): same DynamoDB storage as the\n * `-ddb` variant for core/audit-logs/ACO/websockets, but CMS uses the DynamoDB+OpenSearch storage\n * operations (`HeadlessCmsDdbEsFeature`), the OpenSearch core is registered in the root, and\n * `DbRegistryFeature` is registered per-request before the CMS storage builds (its beforeInit\n * registers the entities the DDB→ES sync stages).\n */\nimport {\n createWebinyApiHandler as createBaseHandler,\n createWebinyStreamApiHandler as createBaseStreamHandler,\n type CreateWebinyApiHandlerConfig as BaseConfig\n} from \"@webiny/api-event-handler-aws\";\nimport { ApiCoreDdbFeature } from \"@webiny/api-core-ddb\";\nimport { HeadlessCmsDdbEsFeature } from \"@webiny/api-headless-cms-ddb-es\";\nimport { AuditLogsDdbFeature } from \"@webiny/api-audit-logs-ddb\";\nimport { AcoDdbFeature } from \"@webiny/api-aco-ddb\";\nimport { WebsocketsDdbFeature } from \"@webiny/api-websockets-aws\";\nimport { DbRegistryFeature } from \"@webiny/db/exports/api/db.js\";\nimport { type OpenSearchClientOptions } from \"@webiny/api-opensearch\";\nimport {\n createAwsOpenSearchClient,\n AwsOpenSearchClientFactoryFeature\n} from \"@webiny/api-opensearch-aws\";\nimport { OpenSearchClientFeature } from \"@webiny/api-opensearch/features/OpenSearchClient/feature.js\";\nimport { OpenSearchQueryBuilderOperatorFeature } from \"@webiny/api-opensearch/features/OpenSearchQueryBuilderOperator/feature.js\";\nimport { OpenSearchFieldFeature } from \"@webiny/api-opensearch/features/OpenSearchField/feature.js\";\nimport { OpenSearchIndexFeature } from \"@webiny/api-opensearch/features/OpenSearchIndex/feature.js\";\n\nexport type CreateAwsDdbOsApiHandlerConfig = Pick<BaseConfig, \"extensions\" | \"documentClient\"> & {\n /**\n * OpenSearch client. Defaults to one built from `OPENSEARCH_*` env vars. Injectable so\n * integration tests can point the handler at a local OpenSearch.\n */\n openSearchClient?: ReturnType<typeof createAwsOpenSearchClient>;\n};\n\nconst openSearchClientFromEnv = () => {\n const osUsername = process.env.OPENSEARCH_USERNAME;\n const osPassword = process.env.OPENSEARCH_PASSWORD;\n\n const openSearchClientOptions: OpenSearchClientOptions = {\n endpoint: `https://${process.env.OPENSEARCH_ENDPOINT}`\n };\n // Basic auth for local / self-managed OpenSearch; when absent the client falls back to AWS SigV4.\n if (osUsername && osPassword) {\n openSearchClientOptions.auth = {\n username: osUsername,\n password: osPassword\n };\n }\n\n return createAwsOpenSearchClient(openSearchClientOptions);\n};\n\n/**\n * The storage half of the composition, shared by the buffered and the response-streaming entry points\n * so the two Lambda functions built from this bundle cannot drift.\n */\nfunction storageConfig(\n config: CreateAwsDdbOsApiHandlerConfig\n): Pick<\n BaseConfig,\n \"extensions\" | \"documentClient\" | \"registerRootStorage\" | \"registerRequestStorage\"\n> {\n return {\n extensions: config.extensions,\n documentClient: config.documentClient,\n registerRootStorage: (container, { documentClient }) => {\n // Built here rather than at factory time: one bundle exports both the buffered and the\n // streaming handler, so an eager client would be created twice per cold start.\n const openSearchClient = config.openSearchClient ?? openSearchClientFromEnv();\n\n // ── OpenSearch core (client + query-builder operators + fields + index registries) ──\n // The DDB+ES CMS storage factory resolves all of these.\n OpenSearchClientFeature.register(container, openSearchClient);\n AwsOpenSearchClientFactoryFeature.register(container);\n OpenSearchQueryBuilderOperatorFeature.register(container);\n OpenSearchFieldFeature.register(container);\n OpenSearchIndexFeature.register(container);\n\n ApiCoreDdbFeature.register(container, { documentClient });\n // CMS uses the DynamoDB+OpenSearch storage operations; the rest stay DynamoDB-only.\n HeadlessCmsDdbEsFeature.register(container);\n AuditLogsDdbFeature.register(container, {});\n AcoDdbFeature.register(container);\n WebsocketsDdbFeature.register(container);\n },\n registerRequestStorage: container => {\n // DbRegistry holds the DDB entities the DDB+ES CMS storage stages for OpenSearch sync\n // (its beforeInit registers into it). Must be registered before HeadlessCmsFeature builds.\n DbRegistryFeature.register(container);\n }\n };\n}\n\nexport function createAwsDdbOsApiHandler(config: CreateAwsDdbOsApiHandlerConfig) {\n return createBaseHandler(storageConfig(config));\n}\n\n/**\n * Response-streaming counterpart, for the Lambda function whose Function URL uses\n * `InvokeMode: RESPONSE_STREAM`. Identical storage; only the transport differs.\n */\nexport function createAwsDdbOsStreamApiHandler(config: CreateAwsDdbOsApiHandlerConfig) {\n return createBaseStreamHandler(storageConfig(config));\n}\n"],"names":["openSearchClientFromEnv","osUsername","process","osPassword","openSearchClientOptions","createAwsOpenSearchClient","storageConfig","config","container","documentClient","openSearchClient","OpenSearchClientFeature","AwsOpenSearchClientFactoryFeature","OpenSearchQueryBuilderOperatorFeature","OpenSearchFieldFeature","OpenSearchIndexFeature","ApiCoreDdbFeature","HeadlessCmsDdbEsFeature","AuditLogsDdbFeature","AcoDdbFeature","WebsocketsDdbFeature","DbRegistryFeature","createAwsDdbOsApiHandler","createBaseHandler","createAwsDdbOsStreamApiHandler","createBaseStreamHandler"],"mappings":";;;;;;;;;;;;AAsCA,MAAMA,0BAA0B;IAC5B,MAAMC,aAAaC,QAAQ,GAAG,CAAC,mBAAmB;IAClD,MAAMC,aAAaD,QAAQ,GAAG,CAAC,mBAAmB;IAElD,MAAME,0BAAmD;QACrD,UAAU,CAAC,QAAQ,EAAEF,QAAQ,GAAG,CAAC,mBAAmB,EAAE;IAC1D;IAEA,IAAID,cAAcE,YACdC,wBAAwB,IAAI,GAAG;QAC3B,UAAUH;QACV,UAAUE;IACd;IAGJ,OAAOE,0BAA0BD;AACrC;AAMA,SAASE,cACLC,MAAsC;IAKtC,OAAO;QACH,YAAYA,OAAO,UAAU;QAC7B,gBAAgBA,OAAO,cAAc;QACrC,qBAAqB,CAACC,WAAW,EAAEC,cAAc,EAAE;YAG/C,MAAMC,mBAAmBH,OAAO,gBAAgB,IAAIP;YAIpDW,wBAAwB,QAAQ,CAACH,WAAWE;YAC5CE,kCAAkC,QAAQ,CAACJ;YAC3CK,sCAAsC,QAAQ,CAACL;YAC/CM,uBAAuB,QAAQ,CAACN;YAChCO,uBAAuB,QAAQ,CAACP;YAEhCQ,kBAAkB,QAAQ,CAACR,WAAW;gBAAEC;YAAe;YAEvDQ,wBAAwB,QAAQ,CAACT;YACjCU,oBAAoB,QAAQ,CAACV,WAAW,CAAC;YACzCW,cAAc,QAAQ,CAACX;YACvBY,qBAAqB,QAAQ,CAACZ;QAClC;QACA,wBAAwBA,CAAAA;YAGpBa,kBAAkB,QAAQ,CAACb;QAC/B;IACJ;AACJ;AAEO,SAASc,yBAAyBf,MAAsC;IAC3E,OAAOgB,uBAAkBjB,cAAcC;AAC3C;AAMO,SAASiB,+BAA+BjB,MAAsC;IACjF,OAAOkB,6BAAwBnB,cAAcC;AACjD"}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createAwsDdbOsApiHandler } from "./createWebinyApiHandler.js";
|
|
1
|
+
export { createAwsDdbOsApiHandler, createAwsDdbOsStreamApiHandler } from "./createWebinyApiHandler.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-event-handler-aws-ddb-os",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
@@ -18,25 +18,25 @@
|
|
|
18
18
|
],
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@webiny/api-aco-ddb": "6.6.0-alpha.
|
|
22
|
-
"@webiny/api-audit-logs-ddb": "6.6.0-alpha.
|
|
23
|
-
"@webiny/api-core-ddb": "6.6.0-alpha.
|
|
24
|
-
"@webiny/api-event-handler-aws": "6.6.0-alpha.
|
|
25
|
-
"@webiny/api-headless-cms-ddb-es": "6.6.0-alpha.
|
|
26
|
-
"@webiny/api-opensearch": "6.6.0-alpha.
|
|
27
|
-
"@webiny/api-opensearch-aws": "6.6.0-alpha.
|
|
28
|
-
"@webiny/api-websockets-
|
|
29
|
-
"@webiny/db": "6.6.0-alpha.
|
|
21
|
+
"@webiny/api-aco-ddb": "6.6.0-alpha.1",
|
|
22
|
+
"@webiny/api-audit-logs-ddb": "6.6.0-alpha.1",
|
|
23
|
+
"@webiny/api-core-ddb": "6.6.0-alpha.1",
|
|
24
|
+
"@webiny/api-event-handler-aws": "6.6.0-alpha.1",
|
|
25
|
+
"@webiny/api-headless-cms-ddb-es": "6.6.0-alpha.1",
|
|
26
|
+
"@webiny/api-opensearch": "6.6.0-alpha.1",
|
|
27
|
+
"@webiny/api-opensearch-aws": "6.6.0-alpha.1",
|
|
28
|
+
"@webiny/api-websockets-aws": "6.6.0-alpha.1",
|
|
29
|
+
"@webiny/db": "6.6.0-alpha.1"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@webiny/di": ">=0.2.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
36
|
-
"@webiny/di": "1.0
|
|
35
|
+
"@webiny/build-tools": "6.6.0-alpha.1",
|
|
36
|
+
"@webiny/di": "1.1.0",
|
|
37
37
|
"rimraf": "6.1.3",
|
|
38
38
|
"typescript": "7.0.2",
|
|
39
|
-
"vitest": "4.1.
|
|
39
|
+
"vitest": "4.1.11"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|