@webiny/api-event-handler-aws 0.0.0-unstable.0156a4c312

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 (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/composition/index.d.ts +4 -0
  4. package/composition/index.js +4 -0
  5. package/composition/registerInboundEventTypes.d.ts +16 -0
  6. package/composition/registerInboundEventTypes.js +17 -0
  7. package/composition/registerInboundEventTypes.js.map +1 -0
  8. package/composition/registerWebinyApiChild.d.ts +10 -0
  9. package/composition/registerWebinyApiChild.js +27 -0
  10. package/composition/registerWebinyApiChild.js.map +1 -0
  11. package/composition/registerWebinyApiRoot.d.ts +8 -0
  12. package/composition/registerWebinyApiRoot.js +27 -0
  13. package/composition/registerWebinyApiRoot.js.map +1 -0
  14. package/composition/types.d.ts +30 -0
  15. package/composition/types.js +0 -0
  16. package/createWebinyApiHandler.d.ts +4 -0
  17. package/createWebinyApiHandler.js +24 -0
  18. package/createWebinyApiHandler.js.map +1 -0
  19. package/createWebinyStreamApiHandler.d.ts +3 -0
  20. package/createWebinyStreamApiHandler.js +25 -0
  21. package/createWebinyStreamApiHandler.js.map +1 -0
  22. package/handlers/ApiGatewayAssumePermissionsDecorator.d.ts +23 -0
  23. package/handlers/ApiGatewayAssumePermissionsDecorator.js +23 -0
  24. package/handlers/ApiGatewayAssumePermissionsDecorator.js.map +1 -0
  25. package/handlers/ApiGatewayIdentityLoaderDecorator.d.ts +25 -0
  26. package/handlers/ApiGatewayIdentityLoaderDecorator.js +27 -0
  27. package/handlers/ApiGatewayIdentityLoaderDecorator.js.map +1 -0
  28. package/handlers/ApiGatewayTenantLoaderDecorator.d.ts +24 -0
  29. package/handlers/ApiGatewayTenantLoaderDecorator.js +25 -0
  30. package/handlers/ApiGatewayTenantLoaderDecorator.js.map +1 -0
  31. package/handlers/FunctionUrlStreamAssumePermissionsDecorator.d.ts +18 -0
  32. package/handlers/FunctionUrlStreamAssumePermissionsDecorator.js +24 -0
  33. package/handlers/FunctionUrlStreamAssumePermissionsDecorator.js.map +1 -0
  34. package/handlers/FunctionUrlStreamIdentityLoaderDecorator.d.ts +22 -0
  35. package/handlers/FunctionUrlStreamIdentityLoaderDecorator.js +27 -0
  36. package/handlers/FunctionUrlStreamIdentityLoaderDecorator.js.map +1 -0
  37. package/handlers/FunctionUrlStreamTenantLoaderDecorator.d.ts +22 -0
  38. package/handlers/FunctionUrlStreamTenantLoaderDecorator.js +27 -0
  39. package/handlers/FunctionUrlStreamTenantLoaderDecorator.js.map +1 -0
  40. package/handlers/S3TenantLoaderDecorator.d.ts +22 -0
  41. package/handlers/S3TenantLoaderDecorator.js +25 -0
  42. package/handlers/S3TenantLoaderDecorator.js.map +1 -0
  43. package/handlers/extractRequestAuth.d.ts +21 -0
  44. package/handlers/extractRequestAuth.js +34 -0
  45. package/handlers/extractRequestAuth.js.map +1 -0
  46. package/handlers/index.d.ts +8 -0
  47. package/handlers/index.js +8 -0
  48. package/index.d.ts +6 -0
  49. package/index.js +3 -0
  50. package/package.json +63 -0
  51. package/publicUrls/ManifestPublicUrls.d.ts +15 -0
  52. package/publicUrls/ManifestPublicUrls.js +19 -0
  53. package/publicUrls/ManifestPublicUrls.js.map +1 -0
  54. package/publicUrls/feature.d.ts +4 -0
  55. package/publicUrls/feature.js +11 -0
  56. package/publicUrls/feature.js.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Webiny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @webiny/api-event-handler-aws
2
+
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
6
+
7
+ 📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
8
+
9
+ ---
10
+
11
+ _This README file is automatically generated during the publish process._
@@ -0,0 +1,4 @@
1
+ export * from "./types.js";
2
+ export * from "./registerInboundEventTypes.js";
3
+ export * from "./registerWebinyApiRoot.js";
4
+ export * from "./registerWebinyApiChild.js";
@@ -0,0 +1,4 @@
1
+ export * from "./types.js";
2
+ export * from "./registerInboundEventTypes.js";
3
+ export * from "./registerWebinyApiRoot.js";
4
+ export * from "./registerWebinyApiChild.js";
@@ -0,0 +1,16 @@
1
+ import type { Container } from "@webiny/di";
2
+ /**
3
+ * Registers every NON-HTTP way this Lambda can be invoked: the event type that recognises the
4
+ * payload shape, plus the handler the dispatcher resolves once it matches. (The HTTP transport is
5
+ * registered by `ApiGatewayFeature`, which also brings the router.)
6
+ *
7
+ * Both halves are required. An event type with no handler resolves to an empty handler chain and
8
+ * the invocation silently does nothing; a handler with no event type fails the dispatch outright
9
+ * with "No event type matched the incoming event".
10
+ *
11
+ * This lives in one function so the set is testable, and so an inbound transport cannot be
12
+ * half-wired. Two bugs of exactly that shape have already shipped: WebSockets ($connect never
13
+ * dispatched, so server→client push was dead) and EventBridge Scheduler (schedules were created
14
+ * and fired, but the invocation was rejected, so scheduled publishing silently never happened).
15
+ */
16
+ export declare function registerInboundEventTypes(container: Container): void;
@@ -0,0 +1,17 @@
1
+ import { BackgroundTaskEventType, ScheduledActionEventType } from "@webiny/event-handler-core";
2
+ import { EventBridgeEventType, WebSocketEventType } from "@webiny/event-handler-aws";
3
+ import { BackgroundTasksAwsFeature } from "@webiny/background-tasks-aws";
4
+ import { BulkActionsEventBridgeLambdaHandlerFeature } from "@webiny/api-headless-cms-bulk-actions-aws";
5
+ import { ScheduledActionLambdaHandler } from "@webiny/api-scheduler";
6
+ function registerInboundEventTypes(container) {
7
+ container.register(BackgroundTaskEventType);
8
+ BackgroundTasksAwsFeature.register(container);
9
+ container.register(EventBridgeEventType);
10
+ BulkActionsEventBridgeLambdaHandlerFeature.register(container);
11
+ container.register(ScheduledActionEventType);
12
+ container.register(ScheduledActionLambdaHandler);
13
+ container.register(WebSocketEventType);
14
+ }
15
+ export { registerInboundEventTypes };
16
+
17
+ //# sourceMappingURL=registerInboundEventTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition/registerInboundEventTypes.js","sources":["../../src/composition/registerInboundEventTypes.ts"],"sourcesContent":["import type { Container } from \"@webiny/di\";\nimport { BackgroundTaskEventType } from \"@webiny/event-handler-core\";\nimport { ScheduledActionEventType } from \"@webiny/event-handler-core\";\nimport { EventBridgeEventType } from \"@webiny/event-handler-aws\";\nimport { WebSocketEventType } from \"@webiny/event-handler-aws\";\nimport { BackgroundTasksAwsFeature } from \"@webiny/background-tasks-aws\";\nimport { BulkActionsEventBridgeLambdaHandlerFeature } from \"@webiny/api-headless-cms-bulk-actions-aws\";\nimport { ScheduledActionLambdaHandler } from \"@webiny/api-scheduler\";\n\n/**\n * Registers every NON-HTTP way this Lambda can be invoked: the event type that recognises the\n * payload shape, plus the handler the dispatcher resolves once it matches. (The HTTP transport is\n * registered by `ApiGatewayFeature`, which also brings the router.)\n *\n * Both halves are required. An event type with no handler resolves to an empty handler chain and\n * the invocation silently does nothing; a handler with no event type fails the dispatch outright\n * with \"No event type matched the incoming event\".\n *\n * This lives in one function so the set is testable, and so an inbound transport cannot be\n * half-wired. Two bugs of exactly that shape have already shipped: WebSockets ($connect never\n * dispatched, so server→client push was dead) and EventBridge Scheduler (schedules were created\n * and fired, but the invocation was rejected, so scheduled publishing silently never happened).\n */\nexport function registerInboundEventTypes(container: Container): void {\n // Background task invocations (Step Functions → Lambda directly). BackgroundTasksAwsFeature\n // registers the Lambda handler + StepFunctionService (the AWS dispatch transport).\n container.register(BackgroundTaskEventType);\n BackgroundTasksAwsFeature.register(container);\n\n // EventBridge invocations (e.g. scheduled empty-trash-bin).\n container.register(EventBridgeEventType);\n BulkActionsEventBridgeLambdaHandlerFeature.register(container);\n\n // EventBridge Scheduler invocations (a scheduled publish/unpublish firing). SchedulerAwsFeature\n // wires only the OUTBOUND side (creating the schedule), so the inbound half belongs here.\n container.register(ScheduledActionEventType);\n container.register(ScheduledActionLambdaHandler);\n\n // API Gateway WebSocket invocations ($connect/$disconnect/$default). The connection handlers\n // come from WebsocketsFeature in the per-request stack.\n container.register(WebSocketEventType);\n}\n"],"names":["registerInboundEventTypes","container","BackgroundTaskEventType","BackgroundTasksAwsFeature","EventBridgeEventType","BulkActionsEventBridgeLambdaHandlerFeature","ScheduledActionEventType","ScheduledActionLambdaHandler","WebSocketEventType"],"mappings":";;;;;AAuBO,SAASA,0BAA0BC,SAAoB;IAG1DA,UAAU,QAAQ,CAACC;IACnBC,0BAA0B,QAAQ,CAACF;IAGnCA,UAAU,QAAQ,CAACG;IACnBC,2CAA2C,QAAQ,CAACJ;IAIpDA,UAAU,QAAQ,CAACK;IACnBL,UAAU,QAAQ,CAACM;IAInBN,UAAU,QAAQ,CAACO;AACvB"}
@@ -0,0 +1,10 @@
1
+ import type { Container } from "@webiny/di";
2
+ import type { WebinyApiCompositionConfig } from "./types.js";
3
+ /**
4
+ * Sets up the per-request CHILD container: the transport-agnostic feature stack (shared with the
5
+ * server transport), with the AWS-specific interleave points supplied as the `transports` adapters.
6
+ *
7
+ * Named for the `child` lifecycle step of `HandlerConfig`, not "request", so it matches the contract
8
+ * it implements.
9
+ */
10
+ export declare function registerWebinyApiChild(container: Container, config: WebinyApiCompositionConfig): Promise<void>;
@@ -0,0 +1,27 @@
1
+ import { registerApiRequestStack } from "@webiny/api-event-handler-core";
2
+ import { WebsocketsAwsFeature } from "@webiny/api-websockets-aws";
3
+ import { SchedulerAwsFeature } from "@webiny/api-scheduler-aws";
4
+ import { FileManagerS3Feature } from "@webiny/api-file-manager-s3";
5
+ import { ManifestPublicUrlsFeature } from "../publicUrls/feature.js";
6
+ async function registerWebinyApiChild(container, config) {
7
+ await registerApiRequestStack(container, {
8
+ extensions: config.extensions,
9
+ transports: {
10
+ hostingConfig: (c)=>{
11
+ ManifestPublicUrlsFeature.register(c);
12
+ },
13
+ realtime: (c)=>{
14
+ WebsocketsAwsFeature.register(c);
15
+ },
16
+ scheduler: (c)=>{
17
+ SchedulerAwsFeature.register(c);
18
+ },
19
+ fileManager: (c)=>{
20
+ FileManagerS3Feature.register(c, {});
21
+ }
22
+ }
23
+ });
24
+ }
25
+ export { registerWebinyApiChild };
26
+
27
+ //# sourceMappingURL=registerWebinyApiChild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition/registerWebinyApiChild.js","sources":["../../src/composition/registerWebinyApiChild.ts"],"sourcesContent":["import type { Container } from \"@webiny/di\";\nimport { registerApiRequestStack } from \"@webiny/api-event-handler-core\";\nimport { WebsocketsAwsFeature } from \"@webiny/api-websockets-aws\";\nimport { SchedulerAwsFeature } from \"@webiny/api-scheduler-aws\";\nimport { FileManagerS3Feature } from \"@webiny/api-file-manager-s3\";\nimport { ManifestPublicUrlsFeature } from \"~/publicUrls/feature.js\";\nimport type { WebinyApiCompositionConfig } from \"./types.js\";\n\n/**\n * Sets up the per-request CHILD container: the transport-agnostic feature stack (shared with the\n * server transport), with the AWS-specific interleave points supplied as the `transports` adapters.\n *\n * Named for the `child` lifecycle step of `HandlerConfig`, not \"request\", so it matches the contract\n * it implements.\n */\nexport async function registerWebinyApiChild(\n container: Container,\n config: WebinyApiCompositionConfig\n): Promise<void> {\n await registerApiRequestStack(container, {\n extensions: config.extensions,\n transports: {\n // Public URLs: written to the service manifest by the `api` and `admin` Pulumi apps.\n // Encryption and hashing keep api-core's build-param defaults.\n hostingConfig: c => {\n ManifestPublicUrlsFeature.register(c);\n },\n // Real AWS WebSocket transport (API Gateway Management API), registered right after\n // WebsocketsFeature so it overrides the NullWebsocketsTransport.\n realtime: c => {\n WebsocketsAwsFeature.register(c);\n },\n // Scheduler transport: the scheduler-aws extension (EventBridge Scheduler).\n scheduler: c => {\n SchedulerAwsFeature.register(c);\n },\n // File-manager storage transport: S3 (asset delivery + S3 file operations + schema).\n fileManager: c => {\n FileManagerS3Feature.register(c, {});\n }\n }\n });\n}\n"],"names":["registerWebinyApiChild","container","config","registerApiRequestStack","c","ManifestPublicUrlsFeature","WebsocketsAwsFeature","SchedulerAwsFeature","FileManagerS3Feature"],"mappings":";;;;;AAeO,eAAeA,uBAClBC,SAAoB,EACpBC,MAAkC;IAElC,MAAMC,wBAAwBF,WAAW;QACrC,YAAYC,OAAO,UAAU;QAC7B,YAAY;YAGR,eAAeE,CAAAA;gBACXC,0BAA0B,QAAQ,CAACD;YACvC;YAGA,UAAUA,CAAAA;gBACNE,qBAAqB,QAAQ,CAACF;YAClC;YAEA,WAAWA,CAAAA;gBACPG,oBAAoB,QAAQ,CAACH;YACjC;YAEA,aAAaA,CAAAA;gBACTI,qBAAqB,QAAQ,CAACJ,GAAG,CAAC;YACtC;QACJ;IACJ;AACJ"}
@@ -0,0 +1,8 @@
1
+ import type { Container } from "@webiny/di";
2
+ import type { getDocumentClient } from "@webiny/aws-sdk/client-dynamodb/index.js";
3
+ import type { WebinyApiCompositionConfig } from "./types.js";
4
+ /**
5
+ * ROOT container registration that is not transport-specific: database, caches, and the storage
6
+ * variant. Shared by both AWS Lambda composition roots.
7
+ */
8
+ export declare function registerWebinyApiRoot(container: Container, config: WebinyApiCompositionConfig, documentClient: ReturnType<typeof getDocumentClient>): Promise<void>;
@@ -0,0 +1,27 @@
1
+ import { DynamoDBCoreFeature } from "@webiny/db-dynamodb";
2
+ import { GraphQLSchemaCacheFeature } from "@webiny/api-graphql";
3
+ import { EncryptionKeyCacheFeature } from "@webiny/api-core/features/encryption/index.js";
4
+ import { JwksStoreFeature } from "@webiny/api-core/idp/index.js";
5
+ import { createLogger } from "@webiny/logger";
6
+ import { Logger } from "@webiny/api-core/features/logger/index.js";
7
+ import { StructuredLogFormatter, pinoLambdaDestination } from "pino-lambda";
8
+ async function registerWebinyApiRoot(container, config, documentClient) {
9
+ const formatter = new StructuredLogFormatter();
10
+ const destination = pinoLambdaDestination({
11
+ formatter
12
+ });
13
+ const logger = createLogger(destination);
14
+ container.registerInstance(Logger, logger);
15
+ DynamoDBCoreFeature.register(container, {
16
+ documentClient
17
+ });
18
+ GraphQLSchemaCacheFeature.register(container);
19
+ EncryptionKeyCacheFeature.register(container);
20
+ JwksStoreFeature.register(container);
21
+ await config.registerRootStorage(container, {
22
+ documentClient
23
+ });
24
+ }
25
+ export { registerWebinyApiRoot };
26
+
27
+ //# sourceMappingURL=registerWebinyApiRoot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition/registerWebinyApiRoot.js","sources":["../../src/composition/registerWebinyApiRoot.ts"],"sourcesContent":["import type { Container } from \"@webiny/di\";\nimport type { getDocumentClient } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { DynamoDBCoreFeature } from \"@webiny/db-dynamodb\";\nimport { GraphQLSchemaCacheFeature } from \"@webiny/api-graphql\";\nimport { EncryptionKeyCacheFeature } from \"@webiny/api-core/features/encryption/index.js\";\nimport { JwksStoreFeature } from \"@webiny/api-core/idp/index.js\";\nimport { createLogger } from \"@webiny/logger\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\nimport { pinoLambdaDestination } from \"pino-lambda\";\nimport { StructuredLogFormatter } from \"pino-lambda\";\nimport type { WebinyApiCompositionConfig } from \"./types.js\";\n\n/**\n * ROOT container registration that is not transport-specific: database, caches, and the storage\n * variant. Shared by both AWS Lambda composition roots.\n */\nexport async function registerWebinyApiRoot(\n container: Container,\n config: WebinyApiCompositionConfig,\n documentClient: ReturnType<typeof getDocumentClient>\n): Promise<void> {\n // ── Logger ─────────────────────────────────────────────────\n // One per Lambda instance, in CloudWatch's structured format. Every request container inherits it.\n const formatter = new StructuredLogFormatter();\n const destination = pinoLambdaDestination({ formatter });\n const logger = createLogger(destination);\n container.registerInstance(Logger, logger);\n\n // ── Database ───────────────────────────────────────────────\n DynamoDBCoreFeature.register(container, { documentClient });\n\n // Identity providers are not registered here. Each one comes from its project extension (e.g.\n // `<Cognito/>` registers CognitoIdpFeature), which registers in the request container. The\n // request auth step resolves from that container after extensions have registered, so it sees\n // them.\n\n // ── GraphQL schema cache ───────────────────────────────────\n // Root, so a built schema outlives the request that built it: one build per Lambda instance\n // instead of one per request.\n GraphQLSchemaCacheFeature.register(container);\n\n // ── Encryption key cache ───────────────────────────────────\n // Root, so the scrypt-derived key is computed once per Lambda instance instead of per request.\n EncryptionKeyCacheFeature.register(container);\n // Root, so identity providers' signing keys are fetched once per process, not per request.\n JwksStoreFeature.register(container);\n\n // ── Storage (variant-specific: CMS storage ops, DDB registries, OpenSearch core) ──\n await config.registerRootStorage(container, { documentClient });\n}\n"],"names":["registerWebinyApiRoot","container","config","documentClient","formatter","StructuredLogFormatter","destination","pinoLambdaDestination","logger","createLogger","Logger","DynamoDBCoreFeature","GraphQLSchemaCacheFeature","EncryptionKeyCacheFeature","JwksStoreFeature"],"mappings":";;;;;;;AAgBO,eAAeA,sBAClBC,SAAoB,EACpBC,MAAkC,EAClCC,cAAoD;IAIpD,MAAMC,YAAY,IAAIC;IACtB,MAAMC,cAAcC,sBAAsB;QAAEH;IAAU;IACtD,MAAMI,SAASC,aAAaH;IAC5BL,UAAU,gBAAgB,CAACS,QAAQF;IAGnCG,oBAAoB,QAAQ,CAACV,WAAW;QAAEE;IAAe;IAUzDS,0BAA0B,QAAQ,CAACX;IAInCY,0BAA0B,QAAQ,CAACZ;IAEnCa,iBAAiB,QAAQ,CAACb;IAG1B,MAAMC,OAAO,mBAAmB,CAACD,WAAW;QAAEE;IAAe;AACjE"}
@@ -0,0 +1,30 @@
1
+ import type { Container } from "@webiny/di";
2
+ import type { getDocumentClient } from "@webiny/aws-sdk/client-dynamodb/index.js";
3
+ import type { registerExtensions } from "@webiny/handler";
4
+ export interface RegisterRootStorageContext {
5
+ documentClient: ReturnType<typeof getDocumentClient>;
6
+ }
7
+ /**
8
+ * The transport-agnostic half of a Webiny AWS Lambda composition root, shared by the buffered API
9
+ * Gateway handler (`createWebinyApiHandler`) and the response-streaming Function URL handler
10
+ * (`createWebinyStreamApiHandler`) so the two cannot drift on storage, identity providers, or the
11
+ * per-request feature stack.
12
+ */
13
+ export interface WebinyApiCompositionConfig {
14
+ /**
15
+ * Project-defined extensions, applied at register() time. This is the one project-specific
16
+ * input; everything else is standard AWS/env wiring owned by this package.
17
+ */
18
+ extensions: () => Parameters<typeof registerExtensions>[1];
19
+ /**
20
+ * DynamoDB document client. Defaults to the standard AWS client (`getDocumentClient()`).
21
+ * Injectable so integration tests can point the handler at a local (dynalite) DynamoDB.
22
+ */
23
+ documentClient?: ReturnType<typeof getDocumentClient>;
24
+ /**
25
+ * Register the storage-variant features in the ROOT container: the CMS storage operations, the
26
+ * DDB storage registries, and (for the OpenSearch variant) the OpenSearch core. Supplied by the
27
+ * variant package.
28
+ */
29
+ registerRootStorage: (container: Container, ctx: RegisterRootStorageContext) => void | Promise<void>;
30
+ }
File without changes
@@ -0,0 +1,4 @@
1
+ import type { WebinyApiCompositionConfig } from "./composition/index.js";
2
+ export type { RegisterRootStorageContext } from "./composition/index.js";
3
+ export type CreateWebinyApiHandlerConfig = WebinyApiCompositionConfig;
4
+ export declare function createWebinyApiHandler(config: CreateWebinyApiHandlerConfig): (event: any, context?: import("aws-lambda").Context) => Promise<any>;
@@ -0,0 +1,24 @@
1
+ import { getDocumentClient } from "@webiny/aws-sdk/client-dynamodb/index.js";
2
+ import { ApiGatewayFeature, createLambdaHandler } from "@webiny/event-handler-aws";
3
+ import { ApiGatewayIdentityLoaderDecorator } from "./handlers/ApiGatewayIdentityLoaderDecorator.js";
4
+ import { ApiGatewayTenantLoaderDecorator } from "./handlers/ApiGatewayTenantLoaderDecorator.js";
5
+ import { ApiGatewayAssumePermissionsDecorator } from "./handlers/ApiGatewayAssumePermissionsDecorator.js";
6
+ import { registerInboundEventTypes, registerWebinyApiChild, registerWebinyApiRoot } from "./composition/index.js";
7
+ function createWebinyApiHandler(config) {
8
+ return createLambdaHandler({
9
+ root: async (container)=>{
10
+ ApiGatewayFeature.register(container);
11
+ container.registerDecorator(ApiGatewayIdentityLoaderDecorator);
12
+ container.registerDecorator(ApiGatewayTenantLoaderDecorator);
13
+ container.registerDecorator(ApiGatewayAssumePermissionsDecorator);
14
+ registerInboundEventTypes(container);
15
+ await registerWebinyApiRoot(container, config, config.documentClient ?? getDocumentClient());
16
+ },
17
+ child: async (container)=>{
18
+ await registerWebinyApiChild(container, config);
19
+ }
20
+ });
21
+ }
22
+ export { createWebinyApiHandler };
23
+
24
+ //# sourceMappingURL=createWebinyApiHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWebinyApiHandler.js","sources":["../src/createWebinyApiHandler.ts"],"sourcesContent":["/**\n * DI-native Webiny API handler for the AWS Lambda transport — storage-agnostic BASE.\n *\n * The ROOT container wires the AWS transport (API Gateway HTTP + auth/tenant loaders, background-task\n * and WebSocket Lambda invocations, DynamoDB, Cognito, storage). Everything that is not\n * transport-specific — database, identity providers, storage, and the transport-AGNOSTIC per-request\n * feature stack — lives in `composition/`, shared with the response-streaming handler\n * (`createWebinyStreamApiHandler`) so the two roots cannot drift. The storage variant is injected via\n * `registerRootStorage` by a thin variant package\n * (`@webiny/api-event-handler-aws-ddb`, `-aws-ddb-os`). Keeping the wiring in real packages (not an app\n * template) is what makes it unit/integration testable.\n */\nimport { getDocumentClient } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { createLambdaHandler, ApiGatewayFeature } from \"@webiny/event-handler-aws\";\nimport { ApiGatewayIdentityLoaderDecorator } from \"~/handlers/ApiGatewayIdentityLoaderDecorator.js\";\nimport { ApiGatewayTenantLoaderDecorator } from \"~/handlers/ApiGatewayTenantLoaderDecorator.js\";\nimport { ApiGatewayAssumePermissionsDecorator } from \"~/handlers/ApiGatewayAssumePermissionsDecorator.js\";\nimport {\n registerInboundEventTypes,\n registerWebinyApiChild,\n registerWebinyApiRoot\n} from \"~/composition/index.js\";\nimport type { WebinyApiCompositionConfig } from \"~/composition/index.js\";\n\nexport type { RegisterRootStorageContext } from \"~/composition/index.js\";\n\nexport type CreateWebinyApiHandlerConfig = WebinyApiCompositionConfig;\n\nexport function createWebinyApiHandler(config: CreateWebinyApiHandlerConfig) {\n return createLambdaHandler({\n root: async container => {\n // ── Transport ──────────────────────────────────────────────\n // ApiGatewayFeature registers the HTTP transport (event type + router + HttpFeature).\n ApiGatewayFeature.register(container);\n\n // ── Tenant + auth (extract → shared load) ──────────────────\n // These decorators depend on api-core (RequestTenantLoader/RequestIdentityLoader), so\n // they live in this composition layer, not event-handler-aws. registerDecorator applies\n // LATER registrations as the OUTER wrapper (whose execute() runs first). TENANT must be\n // established before IDENTITY: API-key authentication resolves the key by tenant partition\n // (ApiKeysRepository reads TenantContext.getTenant()), so identity establishment depends on\n // the tenant. The reverse is not true — RequestTenantLoader has no identity dependency. So\n // register identity first (inner) and tenant last (outer) → tenant runs, then identity,\n // then the router.\n container.registerDecorator(ApiGatewayIdentityLoaderDecorator);\n container.registerDecorator(ApiGatewayTenantLoaderDecorator);\n\n /*\n * Preview-as. Outermost, so the header lands in RawAssumePermissions before anything\n * can ask for permissions. Order is not load-bearing beyond that: the holder is read\n * lazily, and AssumedPermissions checks the caller's real permissions before it\n * honours the header.\n */\n container.registerDecorator(ApiGatewayAssumePermissionsDecorator);\n\n // Every non-HTTP invocation shape (background tasks, EventBridge, scheduled actions,\n // WebSockets) with its handler. Kept in one function so the set is testable and an\n // inbound transport can't be half-wired.\n registerInboundEventTypes(container);\n\n // Resolved here rather than at factory time: one bundle exports BOTH this handler and the\n // streaming one, so building the client eagerly would open a second DynamoDB client on\n // every cold start. `root` runs once, lazily.\n await registerWebinyApiRoot(\n container,\n config,\n config.documentClient ?? getDocumentClient()\n );\n },\n\n child: async container => {\n await registerWebinyApiChild(container, config);\n }\n });\n}\n"],"names":["createWebinyApiHandler","config","createLambdaHandler","container","ApiGatewayFeature","ApiGatewayIdentityLoaderDecorator","ApiGatewayTenantLoaderDecorator","ApiGatewayAssumePermissionsDecorator","registerInboundEventTypes","registerWebinyApiRoot","getDocumentClient","registerWebinyApiChild"],"mappings":";;;;;;AA4BO,SAASA,uBAAuBC,MAAoC;IACvE,OAAOC,oBAAoB;QACvB,MAAM,OAAMC;YAGRC,kBAAkB,QAAQ,CAACD;YAW3BA,UAAU,iBAAiB,CAACE;YAC5BF,UAAU,iBAAiB,CAACG;YAQ5BH,UAAU,iBAAiB,CAACI;YAK5BC,0BAA0BL;YAK1B,MAAMM,sBACFN,WACAF,QACAA,OAAO,cAAc,IAAIS;QAEjC;QAEA,OAAO,OAAMP;YACT,MAAMQ,uBAAuBR,WAAWF;QAC5C;IACJ;AACJ"}
@@ -0,0 +1,3 @@
1
+ import type { WebinyApiCompositionConfig } from "./composition/index.js";
2
+ export type CreateWebinyStreamApiHandlerConfig = WebinyApiCompositionConfig;
3
+ export declare function createWebinyStreamApiHandler(config: CreateWebinyStreamApiHandlerConfig): import("@webiny/event-handler-aws").StreamLambdaHandler;
@@ -0,0 +1,25 @@
1
+ import { getDocumentClient } from "@webiny/aws-sdk/client-dynamodb/index.js";
2
+ import { FunctionUrlStreamFeature, createStreamLambdaHandler } from "@webiny/event-handler-aws";
3
+ import { BackgroundTasksAwsFeature } from "@webiny/background-tasks-aws";
4
+ import { FunctionUrlStreamIdentityLoaderDecorator } from "./handlers/FunctionUrlStreamIdentityLoaderDecorator.js";
5
+ import { FunctionUrlStreamTenantLoaderDecorator } from "./handlers/FunctionUrlStreamTenantLoaderDecorator.js";
6
+ import { FunctionUrlStreamAssumePermissionsDecorator } from "./handlers/FunctionUrlStreamAssumePermissionsDecorator.js";
7
+ import { registerWebinyApiChild, registerWebinyApiRoot } from "./composition/index.js";
8
+ function createWebinyStreamApiHandler(config) {
9
+ return createStreamLambdaHandler({
10
+ root: async (container)=>{
11
+ FunctionUrlStreamFeature.register(container);
12
+ container.registerDecorator(FunctionUrlStreamIdentityLoaderDecorator);
13
+ container.registerDecorator(FunctionUrlStreamTenantLoaderDecorator);
14
+ container.registerDecorator(FunctionUrlStreamAssumePermissionsDecorator);
15
+ BackgroundTasksAwsFeature.register(container);
16
+ await registerWebinyApiRoot(container, config, config.documentClient ?? getDocumentClient());
17
+ },
18
+ child: async (container)=>{
19
+ await registerWebinyApiChild(container, config);
20
+ }
21
+ });
22
+ }
23
+ export { createWebinyStreamApiHandler };
24
+
25
+ //# sourceMappingURL=createWebinyStreamApiHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWebinyStreamApiHandler.js","sources":["../src/createWebinyStreamApiHandler.ts"],"sourcesContent":["/**\n * DI-native Webiny API handler for AWS Lambda **response streaming** — storage-agnostic BASE.\n *\n * This is a SECOND Lambda function sharing the buffered function's code bundle, not a second entry on\n * the same function: a Lambda's handler entry is fixed per function, and a `streamifyResponse` handler\n * is only meaningful under `InvokeMode: RESPONSE_STREAM`. It is reached through a Lambda Function URL\n * (fronted by CloudFront), because API Gateway buffers the entire Lambda response and therefore cannot\n * stream at all.\n *\n * Root/request registration is shared with `createWebinyApiHandler` via `composition/`; only\n * the transport differs. Notably NOT registered here: the background-task and WebSocket **event\n * types**. Those match inbound invocations that only ever target the buffered function, so\n * registering them would add cold-start cost for events this function never receives.\n *\n * Outbound transports are a different matter, and both ARE present: websockets push completion\n * messages from the shared per-request stack, and `BackgroundTasksAwsFeature` supplies the Step\n * Functions dispatcher that `TaskService.trigger()` needs. Omitting the latter does not disable\n * task triggering — it breaks it silently, because the shared root registers `TaskService` either\n * way and its callers treat a failed trigger as a no-op (ACO's FLP handlers, for one, swallow it),\n * so writes land while their projections never update.\n */\nimport { getDocumentClient } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { createStreamLambdaHandler, FunctionUrlStreamFeature } from \"@webiny/event-handler-aws\";\nimport { BackgroundTasksAwsFeature } from \"@webiny/background-tasks-aws\";\nimport { FunctionUrlStreamIdentityLoaderDecorator } from \"~/handlers/FunctionUrlStreamIdentityLoaderDecorator.js\";\nimport { FunctionUrlStreamTenantLoaderDecorator } from \"~/handlers/FunctionUrlStreamTenantLoaderDecorator.js\";\nimport { FunctionUrlStreamAssumePermissionsDecorator } from \"~/handlers/FunctionUrlStreamAssumePermissionsDecorator.js\";\nimport { registerWebinyApiChild, registerWebinyApiRoot } from \"~/composition/index.js\";\nimport type { WebinyApiCompositionConfig } from \"~/composition/index.js\";\n\nexport type CreateWebinyStreamApiHandlerConfig = WebinyApiCompositionConfig;\n\nexport function createWebinyStreamApiHandler(config: CreateWebinyStreamApiHandlerConfig) {\n return createStreamLambdaHandler({\n root: async container => {\n // ── Transport ──────────────────────────────────────────────\n // Registers the Function URL event type + router + the streaming terminal handler.\n // Deliberately NOT alongside ApiGatewayFeature: both event types match the same payload\n // shape, so they must never share a container.\n FunctionUrlStreamFeature.register(container);\n\n // ── Tenant + auth (extract → shared load) ──────────────────\n // registerDecorator applies LATER registrations as the OUTER wrapper (whose execute() runs\n // first). TENANT must be established before IDENTITY: API-key authentication resolves the\n // key by tenant partition (ApiKeysRepository reads TenantContext.getTenant()), so identity\n // establishment depends on the tenant. The reverse is not true. So register identity first\n // (inner) and tenant last (outer) → tenant runs, then identity, then the router. Mirrors\n // the buffered handler.\n container.registerDecorator(FunctionUrlStreamIdentityLoaderDecorator);\n container.registerDecorator(FunctionUrlStreamTenantLoaderDecorator);\n\n // Preview-as. Mirrors the buffered handler.\n container.registerDecorator(FunctionUrlStreamAssumePermissionsDecorator);\n\n // ── Background tasks: outbound dispatch only ───────────────\n // Registers StepFunctionService, which is what a `TaskService.trigger()` resolves to\n // actually start an execution. Without it the trigger throws deep inside the container\n // and every caller that ignores the failure just carries on. `BackgroundTaskEventType`\n // is deliberately left out, so the handler this also registers stays unreachable here:\n // Step Functions invokes the buffered function, never this one.\n BackgroundTasksAwsFeature.register(container);\n\n // Resolved here rather than at factory time: one bundle exports BOTH this handler and the\n // buffered one, so building the client eagerly would open a second DynamoDB client on every\n // cold start of whichever function isn't streaming. `root` runs once, lazily.\n await registerWebinyApiRoot(\n container,\n config,\n config.documentClient ?? getDocumentClient()\n );\n },\n\n child: async container => {\n await registerWebinyApiChild(container, config);\n }\n });\n}\n"],"names":["createWebinyStreamApiHandler","config","createStreamLambdaHandler","container","FunctionUrlStreamFeature","FunctionUrlStreamIdentityLoaderDecorator","FunctionUrlStreamTenantLoaderDecorator","FunctionUrlStreamAssumePermissionsDecorator","BackgroundTasksAwsFeature","registerWebinyApiRoot","getDocumentClient","registerWebinyApiChild"],"mappings":";;;;;;;AAgCO,SAASA,6BAA6BC,MAA0C;IACnF,OAAOC,0BAA0B;QAC7B,MAAM,OAAMC;YAKRC,yBAAyB,QAAQ,CAACD;YASlCA,UAAU,iBAAiB,CAACE;YAC5BF,UAAU,iBAAiB,CAACG;YAG5BH,UAAU,iBAAiB,CAACI;YAQ5BC,0BAA0B,QAAQ,CAACL;YAKnC,MAAMM,sBACFN,WACAF,QACAA,OAAO,cAAc,IAAIS;QAEjC;QAEA,OAAO,OAAMP;YACT,MAAMQ,uBAAuBR,WAAWF;QAC5C;IACJ;AACJ"}
@@ -0,0 +1,23 @@
1
+ import type { APIGatewayProxyEvent } from "@webiny/aws-sdk/types/index.js";
2
+ import { ApiGatewayEventHandler } from "@webiny/event-handler-aws";
3
+ import { RawAssumePermissions } from "@webiny/api-core/features/requestContext/index.js";
4
+ import type { EventContext } from "@webiny/event-handler-core";
5
+ import type { NextFunction } from "@webiny/event-handler-core";
6
+ /**
7
+ * EXTRACT (transport-specific): reads the `x-webiny-assume-permissions` header of an API Gateway
8
+ * event into RawAssumePermissions, so AssumedPermissions can evaluate the request against that
9
+ * role instead of the caller's own. There is no LOAD step: the holder is read lazily, the first
10
+ * time something asks for permissions.
11
+ *
12
+ * A missing header leaves RawAssumePermissions null, which is the normal case.
13
+ */
14
+ declare class ApiGatewayAssumePermissionsDecoratorImpl implements ApiGatewayEventHandler.Interface {
15
+ private rawAssumePermissions;
16
+ private decoratee;
17
+ constructor(rawAssumePermissions: RawAssumePermissions.Interface, decoratee: ApiGatewayEventHandler.Interface);
18
+ execute(ctx: EventContext<APIGatewayProxyEvent>, next: NextFunction): Promise<any>;
19
+ }
20
+ export declare const ApiGatewayAssumePermissionsDecorator: typeof ApiGatewayAssumePermissionsDecoratorImpl & {
21
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/event-handler-aws").IApiGatewayEventHandler>;
22
+ };
23
+ export {};
@@ -0,0 +1,23 @@
1
+ import { ApiGatewayEventHandler } from "@webiny/event-handler-aws";
2
+ import { RawAssumePermissions, extractAssumePermissions } from "@webiny/api-core/features/requestContext/index.js";
3
+ class ApiGatewayAssumePermissionsDecoratorImpl {
4
+ constructor(rawAssumePermissions, decoratee){
5
+ this.rawAssumePermissions = rawAssumePermissions;
6
+ this.decoratee = decoratee;
7
+ }
8
+ async execute(ctx, next) {
9
+ const headers = ctx.event?.headers;
10
+ const requested = extractAssumePermissions(headers);
11
+ this.rawAssumePermissions.set(requested);
12
+ return this.decoratee.execute(ctx, next);
13
+ }
14
+ }
15
+ const ApiGatewayAssumePermissionsDecorator = ApiGatewayEventHandler.createDecorator({
16
+ decorator: ApiGatewayAssumePermissionsDecoratorImpl,
17
+ dependencies: [
18
+ RawAssumePermissions
19
+ ]
20
+ });
21
+ export { ApiGatewayAssumePermissionsDecorator };
22
+
23
+ //# sourceMappingURL=ApiGatewayAssumePermissionsDecorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers/ApiGatewayAssumePermissionsDecorator.js","sources":["../../src/handlers/ApiGatewayAssumePermissionsDecorator.ts"],"sourcesContent":["import type { APIGatewayProxyEvent } from \"@webiny/aws-sdk/types/index.js\";\nimport { ApiGatewayEventHandler } from \"@webiny/event-handler-aws\";\nimport { RawAssumePermissions } from \"@webiny/api-core/features/requestContext/index.js\";\nimport { extractAssumePermissions } from \"@webiny/api-core/features/requestContext/index.js\";\nimport type { EventContext } from \"@webiny/event-handler-core\";\nimport type { NextFunction } from \"@webiny/event-handler-core\";\n\n/**\n * EXTRACT (transport-specific): reads the `x-webiny-assume-permissions` header of an API Gateway\n * event into RawAssumePermissions, so AssumedPermissions can evaluate the request against that\n * role instead of the caller's own. There is no LOAD step: the holder is read lazily, the first\n * time something asks for permissions.\n *\n * A missing header leaves RawAssumePermissions null, which is the normal case.\n */\nclass ApiGatewayAssumePermissionsDecoratorImpl implements ApiGatewayEventHandler.Interface {\n constructor(\n private rawAssumePermissions: RawAssumePermissions.Interface,\n private decoratee: ApiGatewayEventHandler.Interface\n ) {}\n\n async execute(ctx: EventContext<APIGatewayProxyEvent>, next: NextFunction): Promise<any> {\n const headers = ctx.event?.headers;\n const requested = extractAssumePermissions(headers);\n\n this.rawAssumePermissions.set(requested);\n\n return this.decoratee.execute(ctx, next);\n }\n}\n\nexport const ApiGatewayAssumePermissionsDecorator = ApiGatewayEventHandler.createDecorator({\n decorator: ApiGatewayAssumePermissionsDecoratorImpl,\n dependencies: [RawAssumePermissions]\n});\n"],"names":["ApiGatewayAssumePermissionsDecoratorImpl","rawAssumePermissions","decoratee","ctx","next","headers","requested","extractAssumePermissions","ApiGatewayAssumePermissionsDecorator","ApiGatewayEventHandler","RawAssumePermissions"],"mappings":";;AAeA,MAAMA;IACF,YACYC,oBAAoD,EACpDC,SAA2C,CACrD;aAFUD,oBAAoB,GAApBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,GAAuC,EAAEC,IAAkB,EAAgB;QACrF,MAAMC,UAAUF,IAAI,KAAK,EAAE;QAC3B,MAAMG,YAAYC,yBAAyBF;QAE3C,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAACC;QAE9B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACH,KAAKC;IACvC;AACJ;AAEO,MAAMI,uCAAuCC,uBAAuB,eAAe,CAAC;IACvF,WAAWT;IACX,cAAc;QAACU;KAAqB;AACxC"}
@@ -0,0 +1,25 @@
1
+ import type { APIGatewayProxyEvent } from "@webiny/aws-sdk/types/index.js";
2
+ import { ApiGatewayEventHandler } from "@webiny/event-handler-aws";
3
+ import { RawAuthToken } from "@webiny/api-core/features/requestContext/index.js";
4
+ import type { IRequestIdentityLoader } from "@webiny/api-core/features/requestContext/abstractions.js";
5
+ import type { EventContext, NextFunction } from "@webiny/event-handler-core";
6
+ /**
7
+ * EXTRACT (transport-specific): reads the auth token from an API Gateway event — see
8
+ * {@link extractAuthToken} for the header precedence — into RawAuthToken, then invokes the shared LOAD
9
+ * step (RequestIdentityLoader) which authenticates it and sets IdentityContext.
10
+ *
11
+ * A missing token leaves RawAuthToken null → the loader authenticates as anonymous.
12
+ * Registered BEFORE ApiGatewayTenantLoaderDecorator so identity is established before tenant
13
+ * (see ApiGatewayFeature).
14
+ */
15
+ declare class ApiGatewayIdentityLoaderDecoratorImpl implements ApiGatewayEventHandler.Interface {
16
+ private rawAuthToken;
17
+ private identityLoader;
18
+ private decoratee;
19
+ constructor(rawAuthToken: RawAuthToken.Interface, identityLoader: IRequestIdentityLoader, decoratee: ApiGatewayEventHandler.Interface);
20
+ execute(ctx: EventContext<APIGatewayProxyEvent>, next: NextFunction): Promise<any>;
21
+ }
22
+ export declare const ApiGatewayIdentityLoaderDecorator: typeof ApiGatewayIdentityLoaderDecoratorImpl & {
23
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/event-handler-aws").IApiGatewayEventHandler>;
24
+ };
25
+ export {};
@@ -0,0 +1,27 @@
1
+ import { ApiGatewayEventHandler } from "@webiny/event-handler-aws";
2
+ import { RawAuthToken, RequestIdentityLoader } from "@webiny/api-core/features/requestContext/index.js";
3
+ import { extractAuthToken } from "./extractRequestAuth.js";
4
+ class ApiGatewayIdentityLoaderDecoratorImpl {
5
+ constructor(rawAuthToken, identityLoader, decoratee){
6
+ this.rawAuthToken = rawAuthToken;
7
+ this.identityLoader = identityLoader;
8
+ this.decoratee = decoratee;
9
+ }
10
+ async execute(ctx, next) {
11
+ const headers = ctx.event?.headers;
12
+ const authToken = extractAuthToken(headers);
13
+ this.rawAuthToken.set(authToken);
14
+ await this.identityLoader.establish();
15
+ return this.decoratee.execute(ctx, next);
16
+ }
17
+ }
18
+ const ApiGatewayIdentityLoaderDecorator = ApiGatewayEventHandler.createDecorator({
19
+ decorator: ApiGatewayIdentityLoaderDecoratorImpl,
20
+ dependencies: [
21
+ RawAuthToken,
22
+ RequestIdentityLoader
23
+ ]
24
+ });
25
+ export { ApiGatewayIdentityLoaderDecorator };
26
+
27
+ //# sourceMappingURL=ApiGatewayIdentityLoaderDecorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers/ApiGatewayIdentityLoaderDecorator.js","sources":["../../src/handlers/ApiGatewayIdentityLoaderDecorator.ts"],"sourcesContent":["import type { APIGatewayProxyEvent } from \"@webiny/aws-sdk/types/index.js\";\nimport { ApiGatewayEventHandler } from \"@webiny/event-handler-aws\";\nimport {\n RawAuthToken,\n RequestIdentityLoader\n} from \"@webiny/api-core/features/requestContext/index.js\";\nimport type { IRequestIdentityLoader } from \"@webiny/api-core/features/requestContext/abstractions.js\";\nimport type { EventContext, NextFunction } from \"@webiny/event-handler-core\";\nimport { extractAuthToken } from \"./extractRequestAuth.js\";\n\n/**\n * EXTRACT (transport-specific): reads the auth token from an API Gateway event — see\n * {@link extractAuthToken} for the header precedence — into RawAuthToken, then invokes the shared LOAD\n * step (RequestIdentityLoader) which authenticates it and sets IdentityContext.\n *\n * A missing token leaves RawAuthToken null → the loader authenticates as anonymous.\n * Registered BEFORE ApiGatewayTenantLoaderDecorator so identity is established before tenant\n * (see ApiGatewayFeature).\n */\nclass ApiGatewayIdentityLoaderDecoratorImpl implements ApiGatewayEventHandler.Interface {\n constructor(\n private rawAuthToken: RawAuthToken.Interface,\n private identityLoader: IRequestIdentityLoader,\n private decoratee: ApiGatewayEventHandler.Interface\n ) {}\n\n async execute(ctx: EventContext<APIGatewayProxyEvent>, next: NextFunction): Promise<any> {\n const headers = ctx.event?.headers as Record<string, string>;\n const authToken = extractAuthToken(headers);\n\n this.rawAuthToken.set(authToken);\n\n await this.identityLoader.establish();\n return this.decoratee.execute(ctx, next);\n }\n}\n\nexport const ApiGatewayIdentityLoaderDecorator = ApiGatewayEventHandler.createDecorator({\n decorator: ApiGatewayIdentityLoaderDecoratorImpl,\n dependencies: [RawAuthToken, RequestIdentityLoader]\n});\n"],"names":["ApiGatewayIdentityLoaderDecoratorImpl","rawAuthToken","identityLoader","decoratee","ctx","next","headers","authToken","extractAuthToken","ApiGatewayIdentityLoaderDecorator","ApiGatewayEventHandler","RawAuthToken","RequestIdentityLoader"],"mappings":";;;AAmBA,MAAMA;IACF,YACYC,YAAoC,EACpCC,cAAsC,EACtCC,SAA2C,CACrD;aAHUF,YAAY,GAAZA;aACAC,cAAc,GAAdA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,GAAuC,EAAEC,IAAkB,EAAgB;QACrF,MAAMC,UAAUF,IAAI,KAAK,EAAE;QAC3B,MAAMG,YAAYC,iBAAiBF;QAEnC,IAAI,CAAC,YAAY,CAAC,GAAG,CAACC;QAEtB,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS;QACnC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACH,KAAKC;IACvC;AACJ;AAEO,MAAMI,oCAAoCC,uBAAuB,eAAe,CAAC;IACpF,WAAWV;IACX,cAAc;QAACW;QAAcC;KAAsB;AACvD"}
@@ -0,0 +1,24 @@
1
+ import type { APIGatewayProxyEvent } from "@webiny/aws-sdk/types/index.js";
2
+ import { ApiGatewayEventHandler } from "@webiny/event-handler-aws";
3
+ import { RawTenantId } from "@webiny/api-core/features/requestContext/index.js";
4
+ import type { IRequestTenantLoader } from "@webiny/api-core/features/requestContext/abstractions.js";
5
+ import type { EventContext, NextFunction } from "@webiny/event-handler-core";
6
+ /**
7
+ * EXTRACT (transport-specific): reads the tenant id from the `x-tenant` header of an API Gateway
8
+ * event into RawTenantId, then invokes the shared LOAD step (RequestTenantLoader) which
9
+ * resolves the Tenant and sets TenantContext. A missing header leaves RawTenantId null → the
10
+ * loader defaults to the "root" tenant.
11
+ *
12
+ * Registered AFTER ApiGatewayIdentityLoaderDecorator (see ApiGatewayFeature).
13
+ */
14
+ declare class ApiGatewayTenantLoaderDecoratorImpl implements ApiGatewayEventHandler.Interface {
15
+ private rawTenantId;
16
+ private tenantLoader;
17
+ private decoratee;
18
+ constructor(rawTenantId: RawTenantId.Interface, tenantLoader: IRequestTenantLoader, decoratee: ApiGatewayEventHandler.Interface);
19
+ execute(ctx: EventContext<APIGatewayProxyEvent>, next: NextFunction): Promise<any>;
20
+ }
21
+ export declare const ApiGatewayTenantLoaderDecorator: typeof ApiGatewayTenantLoaderDecoratorImpl & {
22
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/event-handler-aws").IApiGatewayEventHandler>;
23
+ };
24
+ export {};
@@ -0,0 +1,25 @@
1
+ import { ApiGatewayEventHandler } from "@webiny/event-handler-aws";
2
+ import { RawTenantId, RequestTenantLoader } from "@webiny/api-core/features/requestContext/index.js";
3
+ class ApiGatewayTenantLoaderDecoratorImpl {
4
+ constructor(rawTenantId, tenantLoader, decoratee){
5
+ this.rawTenantId = rawTenantId;
6
+ this.tenantLoader = tenantLoader;
7
+ this.decoratee = decoratee;
8
+ }
9
+ async execute(ctx, next) {
10
+ const headers = ctx.event?.headers;
11
+ this.rawTenantId.set(headers ? headers["x-tenant"] ?? headers["X-Tenant"] ?? null : null);
12
+ await this.tenantLoader.establish();
13
+ return this.decoratee.execute(ctx, next);
14
+ }
15
+ }
16
+ const ApiGatewayTenantLoaderDecorator = ApiGatewayEventHandler.createDecorator({
17
+ decorator: ApiGatewayTenantLoaderDecoratorImpl,
18
+ dependencies: [
19
+ RawTenantId,
20
+ RequestTenantLoader
21
+ ]
22
+ });
23
+ export { ApiGatewayTenantLoaderDecorator };
24
+
25
+ //# sourceMappingURL=ApiGatewayTenantLoaderDecorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers/ApiGatewayTenantLoaderDecorator.js","sources":["../../src/handlers/ApiGatewayTenantLoaderDecorator.ts"],"sourcesContent":["import type { APIGatewayProxyEvent } from \"@webiny/aws-sdk/types/index.js\";\nimport { ApiGatewayEventHandler } from \"@webiny/event-handler-aws\";\nimport {\n RawTenantId,\n RequestTenantLoader\n} from \"@webiny/api-core/features/requestContext/index.js\";\nimport type { IRequestTenantLoader } from \"@webiny/api-core/features/requestContext/abstractions.js\";\nimport type { EventContext, NextFunction } from \"@webiny/event-handler-core\";\n\n/**\n * EXTRACT (transport-specific): reads the tenant id from the `x-tenant` header of an API Gateway\n * event into RawTenantId, then invokes the shared LOAD step (RequestTenantLoader) which\n * resolves the Tenant and sets TenantContext. A missing header leaves RawTenantId null → the\n * loader defaults to the \"root\" tenant.\n *\n * Registered AFTER ApiGatewayIdentityLoaderDecorator (see ApiGatewayFeature).\n */\nclass ApiGatewayTenantLoaderDecoratorImpl implements ApiGatewayEventHandler.Interface {\n constructor(\n private rawTenantId: RawTenantId.Interface,\n private tenantLoader: IRequestTenantLoader,\n private decoratee: ApiGatewayEventHandler.Interface\n ) {}\n\n async execute(ctx: EventContext<APIGatewayProxyEvent>, next: NextFunction): Promise<any> {\n const headers = ctx.event?.headers;\n this.rawTenantId.set(headers ? (headers[\"x-tenant\"] ?? headers[\"X-Tenant\"] ?? null) : null);\n await this.tenantLoader.establish();\n return this.decoratee.execute(ctx, next);\n }\n}\n\nexport const ApiGatewayTenantLoaderDecorator = ApiGatewayEventHandler.createDecorator({\n decorator: ApiGatewayTenantLoaderDecoratorImpl,\n dependencies: [RawTenantId, RequestTenantLoader]\n});\n"],"names":["ApiGatewayTenantLoaderDecoratorImpl","rawTenantId","tenantLoader","decoratee","ctx","next","headers","ApiGatewayTenantLoaderDecorator","ApiGatewayEventHandler","RawTenantId","RequestTenantLoader"],"mappings":";;AAiBA,MAAMA;IACF,YACYC,WAAkC,EAClCC,YAAkC,EAClCC,SAA2C,CACrD;aAHUF,WAAW,GAAXA;aACAC,YAAY,GAAZA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,GAAuC,EAAEC,IAAkB,EAAgB;QACrF,MAAMC,UAAUF,IAAI,KAAK,EAAE;QAC3B,IAAI,CAAC,WAAW,CAAC,GAAG,CAACE,UAAWA,OAAO,CAAC,WAAW,IAAIA,OAAO,CAAC,WAAW,IAAI,OAAQ;QACtF,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS;QACjC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACF,KAAKC;IACvC;AACJ;AAEO,MAAME,kCAAkCC,uBAAuB,eAAe,CAAC;IAClF,WAAWR;IACX,cAAc;QAACS;QAAaC;KAAoB;AACpD"}
@@ -0,0 +1,18 @@
1
+ import { FunctionUrlStreamEventHandler } from "@webiny/event-handler-aws";
2
+ import { RawAssumePermissions } from "@webiny/api-core/features/requestContext/index.js";
3
+ import type { EventContext } from "@webiny/event-handler-core";
4
+ import type { NextFunction } from "@webiny/event-handler-core";
5
+ /**
6
+ * EXTRACT (transport-specific): reads the `x-webiny-assume-permissions` header of a Function URL
7
+ * event into RawAssumePermissions. Function URL mirror of ApiGatewayAssumePermissionsDecorator.
8
+ */
9
+ declare class FunctionUrlStreamAssumePermissionsDecoratorImpl implements FunctionUrlStreamEventHandler.Interface {
10
+ private rawAssumePermissions;
11
+ private decoratee;
12
+ constructor(rawAssumePermissions: RawAssumePermissions.Interface, decoratee: FunctionUrlStreamEventHandler.Interface);
13
+ execute(ctx: EventContext<any>, next: NextFunction): Promise<void>;
14
+ }
15
+ export declare const FunctionUrlStreamAssumePermissionsDecorator: typeof FunctionUrlStreamAssumePermissionsDecoratorImpl & {
16
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/event-handler-aws").IFunctionUrlStreamEventHandler>;
17
+ };
18
+ export {};
@@ -0,0 +1,24 @@
1
+ import { FunctionUrlStreamEventHandler } from "@webiny/event-handler-aws";
2
+ import { RawAssumePermissions, extractAssumePermissions } from "@webiny/api-core/features/requestContext/index.js";
3
+ import { headersFromFunctionUrlEvent } from "./extractRequestAuth.js";
4
+ class FunctionUrlStreamAssumePermissionsDecoratorImpl {
5
+ constructor(rawAssumePermissions, decoratee){
6
+ this.rawAssumePermissions = rawAssumePermissions;
7
+ this.decoratee = decoratee;
8
+ }
9
+ async execute(ctx, next) {
10
+ const headers = headersFromFunctionUrlEvent(ctx.event);
11
+ const requested = extractAssumePermissions(headers);
12
+ this.rawAssumePermissions.set(requested);
13
+ return this.decoratee.execute(ctx, next);
14
+ }
15
+ }
16
+ const FunctionUrlStreamAssumePermissionsDecorator = FunctionUrlStreamEventHandler.createDecorator({
17
+ decorator: FunctionUrlStreamAssumePermissionsDecoratorImpl,
18
+ dependencies: [
19
+ RawAssumePermissions
20
+ ]
21
+ });
22
+ export { FunctionUrlStreamAssumePermissionsDecorator };
23
+
24
+ //# sourceMappingURL=FunctionUrlStreamAssumePermissionsDecorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers/FunctionUrlStreamAssumePermissionsDecorator.js","sources":["../../src/handlers/FunctionUrlStreamAssumePermissionsDecorator.ts"],"sourcesContent":["import { FunctionUrlStreamEventHandler } from \"@webiny/event-handler-aws\";\nimport { RawAssumePermissions } from \"@webiny/api-core/features/requestContext/index.js\";\nimport { extractAssumePermissions } from \"@webiny/api-core/features/requestContext/index.js\";\nimport type { EventContext } from \"@webiny/event-handler-core\";\nimport type { NextFunction } from \"@webiny/event-handler-core\";\nimport { headersFromFunctionUrlEvent } from \"./extractRequestAuth.js\";\n\n/**\n * EXTRACT (transport-specific): reads the `x-webiny-assume-permissions` header of a Function URL\n * event into RawAssumePermissions. Function URL mirror of ApiGatewayAssumePermissionsDecorator.\n */\nclass FunctionUrlStreamAssumePermissionsDecoratorImpl\n implements FunctionUrlStreamEventHandler.Interface\n{\n constructor(\n private rawAssumePermissions: RawAssumePermissions.Interface,\n private decoratee: FunctionUrlStreamEventHandler.Interface\n ) {}\n\n async execute(ctx: EventContext<any>, next: NextFunction): Promise<void> {\n const headers = headersFromFunctionUrlEvent(ctx.event);\n const requested = extractAssumePermissions(headers);\n\n this.rawAssumePermissions.set(requested);\n\n return this.decoratee.execute(ctx, next);\n }\n}\n\nexport const FunctionUrlStreamAssumePermissionsDecorator =\n FunctionUrlStreamEventHandler.createDecorator({\n decorator: FunctionUrlStreamAssumePermissionsDecoratorImpl,\n dependencies: [RawAssumePermissions]\n });\n"],"names":["FunctionUrlStreamAssumePermissionsDecoratorImpl","rawAssumePermissions","decoratee","ctx","next","headers","headersFromFunctionUrlEvent","requested","extractAssumePermissions","FunctionUrlStreamAssumePermissionsDecorator","FunctionUrlStreamEventHandler","RawAssumePermissions"],"mappings":";;;AAWA,MAAMA;IAGF,YACYC,oBAAoD,EACpDC,SAAkD,CAC5D;aAFUD,oBAAoB,GAApBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,GAAsB,EAAEC,IAAkB,EAAiB;QACrE,MAAMC,UAAUC,4BAA4BH,IAAI,KAAK;QACrD,MAAMI,YAAYC,yBAAyBH;QAE3C,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAACE;QAE9B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACJ,KAAKC;IACvC;AACJ;AAEO,MAAMK,8CACTC,8BAA8B,eAAe,CAAC;IAC1C,WAAWV;IACX,cAAc;QAACW;KAAqB;AACxC"}
@@ -0,0 +1,22 @@
1
+ import { FunctionUrlStreamEventHandler } from "@webiny/event-handler-aws";
2
+ import { RawAuthToken } from "@webiny/api-core/features/requestContext/index.js";
3
+ import type { IRequestIdentityLoader } from "@webiny/api-core/features/requestContext/abstractions.js";
4
+ import type { EventContext, NextFunction } from "@webiny/event-handler-core";
5
+ /**
6
+ * EXTRACT (transport-specific): the Function URL streaming counterpart of
7
+ * `ApiGatewayIdentityLoaderDecorator`. Same shared LOAD step; the only difference is that Function URL
8
+ * events carry cookies as an array, so the headers are normalised first.
9
+ *
10
+ * Registered BEFORE FunctionUrlStreamTenantLoaderDecorator so identity is established before tenant.
11
+ */
12
+ declare class FunctionUrlStreamIdentityLoaderDecoratorImpl implements FunctionUrlStreamEventHandler.Interface {
13
+ private rawAuthToken;
14
+ private identityLoader;
15
+ private decoratee;
16
+ constructor(rawAuthToken: RawAuthToken.Interface, identityLoader: IRequestIdentityLoader, decoratee: FunctionUrlStreamEventHandler.Interface);
17
+ execute(ctx: EventContext<any>, next: NextFunction): Promise<void>;
18
+ }
19
+ export declare const FunctionUrlStreamIdentityLoaderDecorator: typeof FunctionUrlStreamIdentityLoaderDecoratorImpl & {
20
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/event-handler-aws").IFunctionUrlStreamEventHandler>;
21
+ };
22
+ export {};
@@ -0,0 +1,27 @@
1
+ import { FunctionUrlStreamEventHandler } from "@webiny/event-handler-aws";
2
+ import { RawAuthToken, RequestIdentityLoader } from "@webiny/api-core/features/requestContext/index.js";
3
+ import { extractAuthToken, headersFromFunctionUrlEvent } from "./extractRequestAuth.js";
4
+ class FunctionUrlStreamIdentityLoaderDecoratorImpl {
5
+ constructor(rawAuthToken, identityLoader, decoratee){
6
+ this.rawAuthToken = rawAuthToken;
7
+ this.identityLoader = identityLoader;
8
+ this.decoratee = decoratee;
9
+ }
10
+ async execute(ctx, next) {
11
+ const headers = headersFromFunctionUrlEvent(ctx.event);
12
+ const authToken = extractAuthToken(headers);
13
+ this.rawAuthToken.set(authToken);
14
+ await this.identityLoader.establish();
15
+ return this.decoratee.execute(ctx, next);
16
+ }
17
+ }
18
+ const FunctionUrlStreamIdentityLoaderDecorator = FunctionUrlStreamEventHandler.createDecorator({
19
+ decorator: FunctionUrlStreamIdentityLoaderDecoratorImpl,
20
+ dependencies: [
21
+ RawAuthToken,
22
+ RequestIdentityLoader
23
+ ]
24
+ });
25
+ export { FunctionUrlStreamIdentityLoaderDecorator };
26
+
27
+ //# sourceMappingURL=FunctionUrlStreamIdentityLoaderDecorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers/FunctionUrlStreamIdentityLoaderDecorator.js","sources":["../../src/handlers/FunctionUrlStreamIdentityLoaderDecorator.ts"],"sourcesContent":["import { FunctionUrlStreamEventHandler } from \"@webiny/event-handler-aws\";\nimport {\n RawAuthToken,\n RequestIdentityLoader\n} from \"@webiny/api-core/features/requestContext/index.js\";\nimport type { IRequestIdentityLoader } from \"@webiny/api-core/features/requestContext/abstractions.js\";\nimport type { EventContext, NextFunction } from \"@webiny/event-handler-core\";\nimport { extractAuthToken, headersFromFunctionUrlEvent } from \"./extractRequestAuth.js\";\n\n/**\n * EXTRACT (transport-specific): the Function URL streaming counterpart of\n * `ApiGatewayIdentityLoaderDecorator`. Same shared LOAD step; the only difference is that Function URL\n * events carry cookies as an array, so the headers are normalised first.\n *\n * Registered BEFORE FunctionUrlStreamTenantLoaderDecorator so identity is established before tenant.\n */\nclass FunctionUrlStreamIdentityLoaderDecoratorImpl\n implements FunctionUrlStreamEventHandler.Interface\n{\n constructor(\n private rawAuthToken: RawAuthToken.Interface,\n private identityLoader: IRequestIdentityLoader,\n private decoratee: FunctionUrlStreamEventHandler.Interface\n ) {}\n\n async execute(ctx: EventContext<any>, next: NextFunction): Promise<void> {\n const headers = headersFromFunctionUrlEvent(ctx.event);\n const authToken = extractAuthToken(headers);\n\n this.rawAuthToken.set(authToken);\n\n await this.identityLoader.establish();\n return this.decoratee.execute(ctx, next);\n }\n}\n\nexport const FunctionUrlStreamIdentityLoaderDecorator =\n FunctionUrlStreamEventHandler.createDecorator({\n decorator: FunctionUrlStreamIdentityLoaderDecoratorImpl,\n dependencies: [RawAuthToken, RequestIdentityLoader]\n });\n"],"names":["FunctionUrlStreamIdentityLoaderDecoratorImpl","rawAuthToken","identityLoader","decoratee","ctx","next","headers","headersFromFunctionUrlEvent","authToken","extractAuthToken","FunctionUrlStreamIdentityLoaderDecorator","FunctionUrlStreamEventHandler","RawAuthToken","RequestIdentityLoader"],"mappings":";;;AAgBA,MAAMA;IAGF,YACYC,YAAoC,EACpCC,cAAsC,EACtCC,SAAkD,CAC5D;aAHUF,YAAY,GAAZA;aACAC,cAAc,GAAdA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,GAAsB,EAAEC,IAAkB,EAAiB;QACrE,MAAMC,UAAUC,4BAA4BH,IAAI,KAAK;QACrD,MAAMI,YAAYC,iBAAiBH;QAEnC,IAAI,CAAC,YAAY,CAAC,GAAG,CAACE;QAEtB,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS;QACnC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACJ,KAAKC;IACvC;AACJ;AAEO,MAAMK,2CACTC,8BAA8B,eAAe,CAAC;IAC1C,WAAWX;IACX,cAAc;QAACY;QAAcC;KAAsB;AACvD"}
@@ -0,0 +1,22 @@
1
+ import { FunctionUrlStreamEventHandler } from "@webiny/event-handler-aws";
2
+ import { RawTenantId } from "@webiny/api-core/features/requestContext/index.js";
3
+ import type { IRequestTenantLoader } from "@webiny/api-core/features/requestContext/abstractions.js";
4
+ import type { EventContext, NextFunction } from "@webiny/event-handler-core";
5
+ /**
6
+ * EXTRACT (transport-specific): reads the tenant id from the `x-tenant` header of a Function URL event
7
+ * into RawTenantId, then invokes the shared LOAD step (RequestTenantLoader). A missing header leaves
8
+ * RawTenantId null → the loader defaults to the "root" tenant.
9
+ *
10
+ * Registered AFTER FunctionUrlStreamIdentityLoaderDecorator.
11
+ */
12
+ declare class FunctionUrlStreamTenantLoaderDecoratorImpl implements FunctionUrlStreamEventHandler.Interface {
13
+ private rawTenantId;
14
+ private tenantLoader;
15
+ private decoratee;
16
+ constructor(rawTenantId: RawTenantId.Interface, tenantLoader: IRequestTenantLoader, decoratee: FunctionUrlStreamEventHandler.Interface);
17
+ execute(ctx: EventContext<any>, next: NextFunction): Promise<void>;
18
+ }
19
+ export declare const FunctionUrlStreamTenantLoaderDecorator: typeof FunctionUrlStreamTenantLoaderDecoratorImpl & {
20
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/event-handler-aws").IFunctionUrlStreamEventHandler>;
21
+ };
22
+ export {};
@@ -0,0 +1,27 @@
1
+ import { FunctionUrlStreamEventHandler } from "@webiny/event-handler-aws";
2
+ import { RawTenantId, RequestTenantLoader } from "@webiny/api-core/features/requestContext/index.js";
3
+ import { extractTenantId, headersFromFunctionUrlEvent } from "./extractRequestAuth.js";
4
+ class FunctionUrlStreamTenantLoaderDecoratorImpl {
5
+ constructor(rawTenantId, tenantLoader, decoratee){
6
+ this.rawTenantId = rawTenantId;
7
+ this.tenantLoader = tenantLoader;
8
+ this.decoratee = decoratee;
9
+ }
10
+ async execute(ctx, next) {
11
+ const headers = headersFromFunctionUrlEvent(ctx.event);
12
+ const tenantId = extractTenantId(headers);
13
+ this.rawTenantId.set(tenantId);
14
+ await this.tenantLoader.establish();
15
+ return this.decoratee.execute(ctx, next);
16
+ }
17
+ }
18
+ const FunctionUrlStreamTenantLoaderDecorator = FunctionUrlStreamEventHandler.createDecorator({
19
+ decorator: FunctionUrlStreamTenantLoaderDecoratorImpl,
20
+ dependencies: [
21
+ RawTenantId,
22
+ RequestTenantLoader
23
+ ]
24
+ });
25
+ export { FunctionUrlStreamTenantLoaderDecorator };
26
+
27
+ //# sourceMappingURL=FunctionUrlStreamTenantLoaderDecorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers/FunctionUrlStreamTenantLoaderDecorator.js","sources":["../../src/handlers/FunctionUrlStreamTenantLoaderDecorator.ts"],"sourcesContent":["import { FunctionUrlStreamEventHandler } from \"@webiny/event-handler-aws\";\nimport {\n RawTenantId,\n RequestTenantLoader\n} from \"@webiny/api-core/features/requestContext/index.js\";\nimport type { IRequestTenantLoader } from \"@webiny/api-core/features/requestContext/abstractions.js\";\nimport type { EventContext, NextFunction } from \"@webiny/event-handler-core\";\nimport { extractTenantId, headersFromFunctionUrlEvent } from \"./extractRequestAuth.js\";\n\n/**\n * EXTRACT (transport-specific): reads the tenant id from the `x-tenant` header of a Function URL event\n * into RawTenantId, then invokes the shared LOAD step (RequestTenantLoader). A missing header leaves\n * RawTenantId null → the loader defaults to the \"root\" tenant.\n *\n * Registered AFTER FunctionUrlStreamIdentityLoaderDecorator.\n */\nclass FunctionUrlStreamTenantLoaderDecoratorImpl\n implements FunctionUrlStreamEventHandler.Interface\n{\n constructor(\n private rawTenantId: RawTenantId.Interface,\n private tenantLoader: IRequestTenantLoader,\n private decoratee: FunctionUrlStreamEventHandler.Interface\n ) {}\n\n async execute(ctx: EventContext<any>, next: NextFunction): Promise<void> {\n const headers = headersFromFunctionUrlEvent(ctx.event);\n const tenantId = extractTenantId(headers);\n\n this.rawTenantId.set(tenantId);\n\n await this.tenantLoader.establish();\n return this.decoratee.execute(ctx, next);\n }\n}\n\nexport const FunctionUrlStreamTenantLoaderDecorator = FunctionUrlStreamEventHandler.createDecorator(\n {\n decorator: FunctionUrlStreamTenantLoaderDecoratorImpl,\n dependencies: [RawTenantId, RequestTenantLoader]\n }\n);\n"],"names":["FunctionUrlStreamTenantLoaderDecoratorImpl","rawTenantId","tenantLoader","decoratee","ctx","next","headers","headersFromFunctionUrlEvent","tenantId","extractTenantId","FunctionUrlStreamTenantLoaderDecorator","FunctionUrlStreamEventHandler","RawTenantId","RequestTenantLoader"],"mappings":";;;AAgBA,MAAMA;IAGF,YACYC,WAAkC,EAClCC,YAAkC,EAClCC,SAAkD,CAC5D;aAHUF,WAAW,GAAXA;aACAC,YAAY,GAAZA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,GAAsB,EAAEC,IAAkB,EAAiB;QACrE,MAAMC,UAAUC,4BAA4BH,IAAI,KAAK;QACrD,MAAMI,WAAWC,gBAAgBH;QAEjC,IAAI,CAAC,WAAW,CAAC,GAAG,CAACE;QAErB,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS;QACjC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACJ,KAAKC;IACvC;AACJ;AAEO,MAAMK,yCAAyCC,8BAA8B,eAAe,CAC/F;IACI,WAAWX;IACX,cAAc;QAACY;QAAaC;KAAoB;AACpD"}
@@ -0,0 +1,22 @@
1
+ import type { S3Event } from "@webiny/aws-sdk/types/index.js";
2
+ import { S3EventHandler } from "@webiny/event-handler-aws";
3
+ import { RawTenantId } from "@webiny/api-core/features/requestContext/index.js";
4
+ import type { IRequestTenantLoader } from "@webiny/api-core/features/requestContext/abstractions.js";
5
+ import type { EventContext, NextFunction } from "@webiny/event-handler-core";
6
+ /**
7
+ * EXTRACT (transport-specific): reads the tenant id from an S3 event's bucket name (convention
8
+ * "<tenant>-…" → "<tenant>") into RawTenantId, then invokes the shared LOAD step
9
+ * (RequestTenantLoader). Mirrors the API Gateway tenant decorator — same shared load, different
10
+ * extract. S3 events carry no user identity, so no auth token is extracted.
11
+ */
12
+ declare class S3TenantLoaderDecoratorImpl implements S3EventHandler.Interface {
13
+ private rawTenantId;
14
+ private tenantLoader;
15
+ private decoratee;
16
+ constructor(rawTenantId: RawTenantId.Interface, tenantLoader: IRequestTenantLoader, decoratee: S3EventHandler.Interface);
17
+ execute(ctx: EventContext<S3Event>, next: NextFunction): Promise<any>;
18
+ }
19
+ export declare const S3TenantLoaderDecorator: typeof S3TenantLoaderDecoratorImpl & {
20
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/event-handler-aws").IS3EventHandler>;
21
+ };
22
+ export {};
@@ -0,0 +1,25 @@
1
+ import { S3EventHandler } from "@webiny/event-handler-aws";
2
+ import { RawTenantId, RequestTenantLoader } from "@webiny/api-core/features/requestContext/index.js";
3
+ class S3TenantLoaderDecoratorImpl {
4
+ constructor(rawTenantId, tenantLoader, decoratee){
5
+ this.rawTenantId = rawTenantId;
6
+ this.tenantLoader = tenantLoader;
7
+ this.decoratee = decoratee;
8
+ }
9
+ async execute(ctx, next) {
10
+ const bucket = ctx.event?.Records?.[0]?.s3?.bucket?.name;
11
+ this.rawTenantId.set(bucket ? bucket.split("-")[0] ?? null : null);
12
+ await this.tenantLoader.establish();
13
+ return this.decoratee.execute(ctx, next);
14
+ }
15
+ }
16
+ const S3TenantLoaderDecorator = S3EventHandler.createDecorator({
17
+ decorator: S3TenantLoaderDecoratorImpl,
18
+ dependencies: [
19
+ RawTenantId,
20
+ RequestTenantLoader
21
+ ]
22
+ });
23
+ export { S3TenantLoaderDecorator };
24
+
25
+ //# sourceMappingURL=S3TenantLoaderDecorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers/S3TenantLoaderDecorator.js","sources":["../../src/handlers/S3TenantLoaderDecorator.ts"],"sourcesContent":["import type { S3Event } from \"@webiny/aws-sdk/types/index.js\";\nimport { S3EventHandler } from \"@webiny/event-handler-aws\";\nimport {\n RawTenantId,\n RequestTenantLoader\n} from \"@webiny/api-core/features/requestContext/index.js\";\nimport type { IRequestTenantLoader } from \"@webiny/api-core/features/requestContext/abstractions.js\";\nimport type { EventContext, NextFunction } from \"@webiny/event-handler-core\";\n\n/**\n * EXTRACT (transport-specific): reads the tenant id from an S3 event's bucket name (convention\n * \"<tenant>-…\" → \"<tenant>\") into RawTenantId, then invokes the shared LOAD step\n * (RequestTenantLoader). Mirrors the API Gateway tenant decorator — same shared load, different\n * extract. S3 events carry no user identity, so no auth token is extracted.\n */\nclass S3TenantLoaderDecoratorImpl implements S3EventHandler.Interface {\n constructor(\n private rawTenantId: RawTenantId.Interface,\n private tenantLoader: IRequestTenantLoader,\n private decoratee: S3EventHandler.Interface\n ) {}\n\n async execute(ctx: EventContext<S3Event>, next: NextFunction): Promise<any> {\n const bucket = ctx.event?.Records?.[0]?.s3?.bucket?.name;\n this.rawTenantId.set(bucket ? (bucket.split(\"-\")[0] ?? null) : null);\n await this.tenantLoader.establish();\n return this.decoratee.execute(ctx, next);\n }\n}\n\nexport const S3TenantLoaderDecorator = S3EventHandler.createDecorator({\n decorator: S3TenantLoaderDecoratorImpl,\n dependencies: [RawTenantId, RequestTenantLoader]\n});\n"],"names":["S3TenantLoaderDecoratorImpl","rawTenantId","tenantLoader","decoratee","ctx","next","bucket","S3TenantLoaderDecorator","S3EventHandler","RawTenantId","RequestTenantLoader"],"mappings":";;AAeA,MAAMA;IACF,YACYC,WAAkC,EAClCC,YAAkC,EAClCC,SAAmC,CAC7C;aAHUF,WAAW,GAAXA;aACAC,YAAY,GAAZA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,GAA0B,EAAEC,IAAkB,EAAgB;QACxE,MAAMC,SAASF,IAAI,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,QAAQ;QACpD,IAAI,CAAC,WAAW,CAAC,GAAG,CAACE,SAAUA,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,OAAQ;QAC/D,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS;QACjC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACF,KAAKC;IACvC;AACJ;AAEO,MAAME,0BAA0BC,eAAe,eAAe,CAAC;IAClE,WAAWR;IACX,cAAc;QAACS;QAAaC;KAAoB;AACpD"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Header parsing shared by the API Gateway and Function URL auth/tenant decorators, so the two
3
+ * transports can't drift on how a caller authenticates.
4
+ */
5
+ export declare const WEBINY_AUTHORIZATION_HEADER = "x-webiny-authorization";
6
+ /**
7
+ * Reads the auth token, preferring `x-webiny-authorization` over `Authorization`.
8
+ *
9
+ * That order exists for CloudFront → Lambda Function URL with Origin Access Control: OAC signs the
10
+ * request with SigV4, which occupies the `Authorization` header, so a viewer's bearer token cannot
11
+ * survive to the origin. Clients that may traverse an OAC-signed origin send the token in the
12
+ * `x-webiny-authorization` header instead. Plain `Authorization` stays supported for every other
13
+ * caller, and the `wby-id-token` cookie remains the last resort.
14
+ */
15
+ export declare function extractAuthToken(headers: Record<string, string> | undefined): string | null;
16
+ export declare function extractTenantId(headers: Record<string, string> | undefined): string | null;
17
+ /**
18
+ * Function URL events (payload format 2.0) deliver cookies as a `cookies` ARRAY rather than a `cookie`
19
+ * header. Fold them back so the extractors above see a normal header map.
20
+ */
21
+ export declare function headersFromFunctionUrlEvent(event: any): Record<string, string>;
@@ -0,0 +1,34 @@
1
+ const WEBINY_AUTHORIZATION_HEADER = "x-webiny-authorization";
2
+ function parseCookieHeader(cookieHeader) {
3
+ return cookieHeader.split(";").reduce((acc, pair)=>{
4
+ const idx = pair.indexOf("=");
5
+ if (idx > 0) acc[pair.slice(0, idx).trim()] = decodeURIComponent(pair.slice(idx + 1).trim());
6
+ return acc;
7
+ }, {});
8
+ }
9
+ function getHeader(headers, name) {
10
+ if (!headers) return "";
11
+ for (const key of Object.keys(headers))if (key.toLowerCase() === name) return headers[key] ?? "";
12
+ return "";
13
+ }
14
+ function extractAuthToken(headers) {
15
+ const webinyAuth = getHeader(headers, WEBINY_AUTHORIZATION_HEADER).replace(/^Bearer\s+/i, "");
16
+ if (webinyAuth) return webinyAuth;
17
+ const bearer = getHeader(headers, "authorization").replace(/^Bearer\s+/i, "");
18
+ if (bearer) return bearer;
19
+ const cookieHeader = getHeader(headers, "cookie");
20
+ return parseCookieHeader(cookieHeader)["wby-id-token"] ?? null;
21
+ }
22
+ function extractTenantId(headers) {
23
+ return getHeader(headers, "x-tenant") || null;
24
+ }
25
+ function headersFromFunctionUrlEvent(event) {
26
+ const headers = {
27
+ ...event?.headers || {}
28
+ };
29
+ if (Array.isArray(event?.cookies) && event.cookies.length > 0) headers.cookie = event.cookies.join("; ");
30
+ return headers;
31
+ }
32
+ export { WEBINY_AUTHORIZATION_HEADER, extractAuthToken, extractTenantId, headersFromFunctionUrlEvent };
33
+
34
+ //# sourceMappingURL=extractRequestAuth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers/extractRequestAuth.js","sources":["../../src/handlers/extractRequestAuth.ts"],"sourcesContent":["/**\n * Header parsing shared by the API Gateway and Function URL auth/tenant decorators, so the two\n * transports can't drift on how a caller authenticates.\n */\n\nexport const WEBINY_AUTHORIZATION_HEADER = \"x-webiny-authorization\";\n\nfunction parseCookieHeader(cookieHeader: string): Record<string, string> {\n return cookieHeader.split(\";\").reduce<Record<string, string>>((acc, pair) => {\n const idx = pair.indexOf(\"=\");\n if (idx > 0) {\n acc[pair.slice(0, idx).trim()] = decodeURIComponent(pair.slice(idx + 1).trim());\n }\n return acc;\n }, {});\n}\n\nfunction getHeader(headers: Record<string, string> | undefined, name: string): string {\n if (!headers) {\n return \"\";\n }\n // Header names are case-insensitive, and the casing that reaches us depends on the transport and\n // on the client, so match on the lowercased key rather than guessing a spelling.\n for (const key of Object.keys(headers)) {\n if (key.toLowerCase() === name) {\n return headers[key] ?? \"\";\n }\n }\n return \"\";\n}\n\n/**\n * Reads the auth token, preferring `x-webiny-authorization` over `Authorization`.\n *\n * That order exists for CloudFront → Lambda Function URL with Origin Access Control: OAC signs the\n * request with SigV4, which occupies the `Authorization` header, so a viewer's bearer token cannot\n * survive to the origin. Clients that may traverse an OAC-signed origin send the token in the\n * `x-webiny-authorization` header instead. Plain `Authorization` stays supported for every other\n * caller, and the `wby-id-token` cookie remains the last resort.\n */\nexport function extractAuthToken(headers: Record<string, string> | undefined): string | null {\n const webinyAuth = getHeader(headers, WEBINY_AUTHORIZATION_HEADER).replace(/^Bearer\\s+/i, \"\");\n if (webinyAuth) {\n return webinyAuth;\n }\n\n const bearer = getHeader(headers, \"authorization\").replace(/^Bearer\\s+/i, \"\");\n if (bearer) {\n return bearer;\n }\n\n const cookieHeader = getHeader(headers, \"cookie\");\n return parseCookieHeader(cookieHeader)[\"wby-id-token\"] ?? null;\n}\n\nexport function extractTenantId(headers: Record<string, string> | undefined): string | null {\n return getHeader(headers, \"x-tenant\") || null;\n}\n\n/**\n * Function URL events (payload format 2.0) deliver cookies as a `cookies` ARRAY rather than a `cookie`\n * header. Fold them back so the extractors above see a normal header map.\n */\nexport function headersFromFunctionUrlEvent(event: any): Record<string, string> {\n const headers: Record<string, string> = {\n ...((event?.headers as Record<string, string>) || {})\n };\n\n if (Array.isArray(event?.cookies) && event.cookies.length > 0) {\n headers.cookie = event.cookies.join(\"; \");\n }\n\n return headers;\n}\n"],"names":["WEBINY_AUTHORIZATION_HEADER","parseCookieHeader","cookieHeader","acc","pair","idx","decodeURIComponent","getHeader","headers","name","key","Object","extractAuthToken","webinyAuth","bearer","extractTenantId","headersFromFunctionUrlEvent","event","Array"],"mappings":"AAKO,MAAMA,8BAA8B;AAE3C,SAASC,kBAAkBC,YAAoB;IAC3C,OAAOA,aAAa,KAAK,CAAC,KAAK,MAAM,CAAyB,CAACC,KAAKC;QAChE,MAAMC,MAAMD,KAAK,OAAO,CAAC;QACzB,IAAIC,MAAM,GACNF,GAAG,CAACC,KAAK,KAAK,CAAC,GAAGC,KAAK,IAAI,GAAG,GAAGC,mBAAmBF,KAAK,KAAK,CAACC,MAAM,GAAG,IAAI;QAEhF,OAAOF;IACX,GAAG,CAAC;AACR;AAEA,SAASI,UAAUC,OAA2C,EAAEC,IAAY;IACxE,IAAI,CAACD,SACD,OAAO;IAIX,KAAK,MAAME,OAAOC,OAAO,IAAI,CAACH,SAC1B,IAAIE,IAAI,WAAW,OAAOD,MACtB,OAAOD,OAAO,CAACE,IAAI,IAAI;IAG/B,OAAO;AACX;AAWO,SAASE,iBAAiBJ,OAA2C;IACxE,MAAMK,aAAaN,UAAUC,SAASR,6BAA6B,OAAO,CAAC,eAAe;IAC1F,IAAIa,YACA,OAAOA;IAGX,MAAMC,SAASP,UAAUC,SAAS,iBAAiB,OAAO,CAAC,eAAe;IAC1E,IAAIM,QACA,OAAOA;IAGX,MAAMZ,eAAeK,UAAUC,SAAS;IACxC,OAAOP,kBAAkBC,aAAa,CAAC,eAAe,IAAI;AAC9D;AAEO,SAASa,gBAAgBP,OAA2C;IACvE,OAAOD,UAAUC,SAAS,eAAe;AAC7C;AAMO,SAASQ,4BAA4BC,KAAU;IAClD,MAAMT,UAAkC;QACpC,GAAKS,OAAO,WAAsC,CAAC,CAAC;IACxD;IAEA,IAAIC,MAAM,OAAO,CAACD,OAAO,YAAYA,MAAM,OAAO,CAAC,MAAM,GAAG,GACxDT,QAAQ,MAAM,GAAGS,MAAM,OAAO,CAAC,IAAI,CAAC;IAGxC,OAAOT;AACX"}
@@ -0,0 +1,8 @@
1
+ export * from "./ApiGatewayIdentityLoaderDecorator.js";
2
+ export * from "./FunctionUrlStreamIdentityLoaderDecorator.js";
3
+ export * from "./FunctionUrlStreamTenantLoaderDecorator.js";
4
+ export * from "./extractRequestAuth.js";
5
+ export * from "./ApiGatewayTenantLoaderDecorator.js";
6
+ export * from "./S3TenantLoaderDecorator.js";
7
+ export * from "./ApiGatewayAssumePermissionsDecorator.js";
8
+ export * from "./FunctionUrlStreamAssumePermissionsDecorator.js";
@@ -0,0 +1,8 @@
1
+ export * from "./ApiGatewayIdentityLoaderDecorator.js";
2
+ export * from "./FunctionUrlStreamIdentityLoaderDecorator.js";
3
+ export * from "./FunctionUrlStreamTenantLoaderDecorator.js";
4
+ export * from "./extractRequestAuth.js";
5
+ export * from "./ApiGatewayTenantLoaderDecorator.js";
6
+ export * from "./S3TenantLoaderDecorator.js";
7
+ export * from "./ApiGatewayAssumePermissionsDecorator.js";
8
+ export * from "./FunctionUrlStreamAssumePermissionsDecorator.js";
package/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export { createWebinyApiHandler } from "./createWebinyApiHandler.js";
2
+ export type { CreateWebinyApiHandlerConfig, RegisterRootStorageContext } from "./createWebinyApiHandler.js";
3
+ export { createWebinyStreamApiHandler } from "./createWebinyStreamApiHandler.js";
4
+ export type { CreateWebinyStreamApiHandlerConfig } from "./createWebinyStreamApiHandler.js";
5
+ export type { WebinyApiCompositionConfig } from "./composition/index.js";
6
+ export * from "./handlers/index.js";
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./handlers/index.js";
2
+ export { createWebinyApiHandler } from "./createWebinyApiHandler.js";
3
+ export { createWebinyStreamApiHandler } from "./createWebinyStreamApiHandler.js";
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@webiny/api-event-handler-aws",
3
+ "version": "0.0.0-unstable.0156a4c312",
4
+ "type": "module",
5
+ "main": "index.js",
6
+ "exports": {
7
+ ".": "./index.js",
8
+ "./*": "./*"
9
+ },
10
+ "types": "index.d.ts",
11
+ "description": "Composition layer: assembles the Webiny API handler for the AWS Lambda transport.",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/webiny/webiny-js.git"
15
+ },
16
+ "contributors": [
17
+ "Webiny Team"
18
+ ],
19
+ "license": "MIT",
20
+ "dependencies": {
21
+ "@webiny/api-core": "0.0.0-unstable.0156a4c312",
22
+ "@webiny/api-event-handler-core": "0.0.0-unstable.0156a4c312",
23
+ "@webiny/api-file-manager-s3": "0.0.0-unstable.0156a4c312",
24
+ "@webiny/api-graphql": "0.0.0-unstable.0156a4c312",
25
+ "@webiny/api-headless-cms-bulk-actions-aws": "0.0.0-unstable.0156a4c312",
26
+ "@webiny/api-scheduler": "0.0.0-unstable.0156a4c312",
27
+ "@webiny/api-scheduler-aws": "0.0.0-unstable.0156a4c312",
28
+ "@webiny/api-websockets-aws": "0.0.0-unstable.0156a4c312",
29
+ "@webiny/aws-sdk": "0.0.0-unstable.0156a4c312",
30
+ "@webiny/background-tasks-aws": "0.0.0-unstable.0156a4c312",
31
+ "@webiny/db-dynamodb": "0.0.0-unstable.0156a4c312",
32
+ "@webiny/event-handler-aws": "0.0.0-unstable.0156a4c312",
33
+ "@webiny/event-handler-core": "0.0.0-unstable.0156a4c312",
34
+ "@webiny/feature": "0.0.0-unstable.0156a4c312",
35
+ "@webiny/handler": "0.0.0-unstable.0156a4c312",
36
+ "@webiny/logger": "0.0.0-unstable.0156a4c312",
37
+ "pino": "10.4.0",
38
+ "pino-lambda": "4.4.1"
39
+ },
40
+ "peerDependencies": {
41
+ "@webiny/di": "^2.0.0"
42
+ },
43
+ "devDependencies": {
44
+ "@webiny/build-tools": "0.0.0-unstable.0156a4c312",
45
+ "@webiny/di": "2.0.0",
46
+ "rimraf": "6.1.3",
47
+ "typescript": "7.0.2",
48
+ "vitest": "5.0.5"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "webiny": {
54
+ "publishFrom": "dist"
55
+ },
56
+ "adio": {
57
+ "ignore": {
58
+ "dependencies": [
59
+ "pino"
60
+ ]
61
+ }
62
+ }
63
+ }
@@ -0,0 +1,15 @@
1
+ import { PublicUrl } from "@webiny/api-core/features/publicUrls/index.js";
2
+ import { PublicUrls } from "@webiny/api-core/features/publicUrls/index.js";
3
+ /**
4
+ * AWS: the `api` and `admin` Pulumi apps write their public URL (custom domain if set, CloudFront
5
+ * otherwise) into the service manifest at deploy time. The API is deployed before the Admin app, so
6
+ * the Admin URL is unknown until the Admin app has been deployed.
7
+ */
8
+ declare class ManifestPublicUrlsImpl implements PublicUrls.Interface {
9
+ getApiUrl(): Promise<PublicUrl>;
10
+ getAdminUrl(): Promise<PublicUrl>;
11
+ }
12
+ export declare const ManifestPublicUrls: typeof ManifestPublicUrlsImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/publicUrls/abstractions").IPublicUrls>;
14
+ };
15
+ export {};
@@ -0,0 +1,19 @@
1
+ import { PublicUrl, PublicUrls } from "@webiny/api-core/features/publicUrls/index.js";
2
+ import { ServiceDiscovery } from "@webiny/api-core/features/serviceDiscovery/index.js";
3
+ class ManifestPublicUrlsImpl {
4
+ async getApiUrl() {
5
+ const manifest = await ServiceDiscovery.load();
6
+ return PublicUrl.from(manifest?.api?.url);
7
+ }
8
+ async getAdminUrl() {
9
+ const manifest = await ServiceDiscovery.load();
10
+ return PublicUrl.from(manifest?.admin?.url);
11
+ }
12
+ }
13
+ const ManifestPublicUrls = PublicUrls.createImplementation({
14
+ implementation: ManifestPublicUrlsImpl,
15
+ dependencies: []
16
+ });
17
+ export { ManifestPublicUrls };
18
+
19
+ //# sourceMappingURL=ManifestPublicUrls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publicUrls/ManifestPublicUrls.js","sources":["../../src/publicUrls/ManifestPublicUrls.ts"],"sourcesContent":["import { PublicUrl } from \"@webiny/api-core/features/publicUrls/index.js\";\nimport { PublicUrls } from \"@webiny/api-core/features/publicUrls/index.js\";\nimport { ServiceDiscovery } from \"@webiny/api-core/features/serviceDiscovery/index.js\";\n\n/**\n * AWS: the `api` and `admin` Pulumi apps write their public URL (custom domain if set, CloudFront\n * otherwise) into the service manifest at deploy time. The API is deployed before the Admin app, so\n * the Admin URL is unknown until the Admin app has been deployed.\n */\nclass ManifestPublicUrlsImpl implements PublicUrls.Interface {\n async getApiUrl() {\n const manifest = await ServiceDiscovery.load();\n return PublicUrl.from(manifest?.api?.url);\n }\n\n async getAdminUrl() {\n const manifest = await ServiceDiscovery.load();\n return PublicUrl.from(manifest?.admin?.url);\n }\n}\n\nexport const ManifestPublicUrls = PublicUrls.createImplementation({\n implementation: ManifestPublicUrlsImpl,\n dependencies: []\n});\n"],"names":["ManifestPublicUrlsImpl","manifest","ServiceDiscovery","PublicUrl","ManifestPublicUrls","PublicUrls"],"mappings":";;AASA,MAAMA;IACF,MAAM,YAAY;QACd,MAAMC,WAAW,MAAMC,iBAAiB,IAAI;QAC5C,OAAOC,UAAU,IAAI,CAACF,UAAU,KAAK;IACzC;IAEA,MAAM,cAAc;QAChB,MAAMA,WAAW,MAAMC,iBAAiB,IAAI;QAC5C,OAAOC,UAAU,IAAI,CAACF,UAAU,OAAO;IAC3C;AACJ;AAEO,MAAMG,qBAAqBC,WAAW,oBAAoB,CAAC;IAC9D,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,4 @@
1
+ export declare const ManifestPublicUrlsFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { ManifestPublicUrls } from "./ManifestPublicUrls.js";
3
+ const ManifestPublicUrlsFeature = createFeature({
4
+ name: "ManifestPublicUrlsFeature",
5
+ register (container) {
6
+ container.register(ManifestPublicUrls);
7
+ }
8
+ });
9
+ export { ManifestPublicUrlsFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publicUrls/feature.js","sources":["../../src/publicUrls/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ManifestPublicUrls } from \"./ManifestPublicUrls.js\";\n\nexport const ManifestPublicUrlsFeature = createFeature({\n name: \"ManifestPublicUrlsFeature\",\n register(container) {\n container.register(ManifestPublicUrls);\n }\n});\n"],"names":["ManifestPublicUrlsFeature","createFeature","container","ManifestPublicUrls"],"mappings":";;AAGO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}