@geekmidas/constructs 3.0.5 → 3.0.6
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/CHANGELOG.md +6 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-D7mhDtSL.cjs → AmazonApiGatewayEndpointAdaptor-BIltcbAc.cjs} +2 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-BIltcbAc.cjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-Cmm9d_Po.mjs → AmazonApiGatewayEndpointAdaptor-BpYtYCeW.mjs} +2 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-BpYtYCeW.mjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-DisDeEF0.d.cts → AmazonApiGatewayEndpointAdaptor-DqNcQGMf.d.cts} +2 -2
- package/dist/{AmazonApiGatewayEndpointAdaptor-DisDeEF0.d.cts.map → AmazonApiGatewayEndpointAdaptor-DqNcQGMf.d.cts.map} +1 -1
- package/dist/{AmazonApiGatewayEndpointAdaptor-CS-m4WZy.d.mts → AmazonApiGatewayEndpointAdaptor-Hi8Pbp2d.d.mts} +2 -2
- package/dist/{AmazonApiGatewayEndpointAdaptor-CS-m4WZy.d.mts.map → AmazonApiGatewayEndpointAdaptor-Hi8Pbp2d.d.mts.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-zrlehWUG.mjs → AmazonApiGatewayV1EndpointAdaptor-CRwyWT6t.mjs} +2 -2
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-zrlehWUG.mjs.map → AmazonApiGatewayV1EndpointAdaptor-CRwyWT6t.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-DstIoQBv.cjs → AmazonApiGatewayV1EndpointAdaptor-DEETT6Wj.cjs} +2 -2
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-DstIoQBv.cjs.map → AmazonApiGatewayV1EndpointAdaptor-DEETT6Wj.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-D6wNqjth.d.cts → AmazonApiGatewayV1EndpointAdaptor-DcN2fYsv.d.cts} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-D6wNqjth.d.cts.map → AmazonApiGatewayV1EndpointAdaptor-DcN2fYsv.d.cts.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-DSMe7dZ4.d.mts → AmazonApiGatewayV1EndpointAdaptor-cpwJzU4W.d.mts} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-DSMe7dZ4.d.mts.map → AmazonApiGatewayV1EndpointAdaptor-cpwJzU4W.d.mts.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DaAHSnqs.cjs → AmazonApiGatewayV2EndpointAdaptor-C2qO8FN6.cjs} +2 -2
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DaAHSnqs.cjs.map → AmazonApiGatewayV2EndpointAdaptor-C2qO8FN6.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-PcMFUEF9.d.cts → AmazonApiGatewayV2EndpointAdaptor-Cn9UoRgB.d.cts} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-PcMFUEF9.d.cts.map → AmazonApiGatewayV2EndpointAdaptor-Cn9UoRgB.d.cts.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-ByljgCnY.d.mts → AmazonApiGatewayV2EndpointAdaptor-LzH3hkB-.d.mts} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-ByljgCnY.d.mts.map → AmazonApiGatewayV2EndpointAdaptor-LzH3hkB-.d.mts.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-Dj5v-I6S.mjs → AmazonApiGatewayV2EndpointAdaptor-m9YKI294.mjs} +2 -2
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-Dj5v-I6S.mjs.map → AmazonApiGatewayV2EndpointAdaptor-m9YKI294.mjs.map} +1 -1
- package/dist/Endpoint-BcxvF4F3.cjs.map +1 -1
- package/dist/{Endpoint-BPh52sXZ.d.cts → Endpoint-CGdCGJkC.d.cts} +6 -6
- package/dist/Endpoint-CGdCGJkC.d.cts.map +1 -0
- package/dist/{Endpoint-BIvS-rKH.d.mts → Endpoint-DtFQFL63.d.mts} +6 -6
- package/dist/Endpoint-DtFQFL63.d.mts.map +1 -0
- package/dist/Endpoint-DvY3aqAy.mjs.map +1 -1
- package/dist/EndpointBuilder-CMzbGG2c.mjs.map +1 -1
- package/dist/{EndpointBuilder-3xH8Gllw.d.mts → EndpointBuilder-DIAsH97h.d.mts} +4 -4
- package/dist/EndpointBuilder-DIAsH97h.d.mts.map +1 -0
- package/dist/{EndpointBuilder-BmVTFp1A.d.cts → EndpointBuilder-Dzqcm8Yv.d.cts} +4 -4
- package/dist/EndpointBuilder-Dzqcm8Yv.d.cts.map +1 -0
- package/dist/EndpointBuilder-QdDf3x87.cjs.map +1 -1
- package/dist/EndpointFactory-AsfUsn-v.cjs.map +1 -1
- package/dist/{EndpointFactory-DaDXPRAg.d.cts → EndpointFactory-C1rh407J.d.cts} +5 -5
- package/dist/EndpointFactory-C1rh407J.d.cts.map +1 -0
- package/dist/EndpointFactory-CkPaFZA0.mjs.map +1 -1
- package/dist/{EndpointFactory-DKHnUYl8.d.mts → EndpointFactory-pCuCu_1H.d.mts} +5 -5
- package/dist/EndpointFactory-pCuCu_1H.d.mts.map +1 -0
- package/dist/{HonoEndpointAdaptor-Jbptyuxv.cjs → HonoEndpointAdaptor-B5fKdLi7.cjs} +2 -1
- package/dist/HonoEndpointAdaptor-B5fKdLi7.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-Cb45sqM9.d.mts → HonoEndpointAdaptor-BXga7Jqh.d.mts} +4 -4
- package/dist/{HonoEndpointAdaptor-Cb45sqM9.d.mts.map → HonoEndpointAdaptor-BXga7Jqh.d.mts.map} +1 -1
- package/dist/{HonoEndpointAdaptor-VStaYQHr.d.cts → HonoEndpointAdaptor-D3IgM-0B.d.cts} +2 -2
- package/dist/{HonoEndpointAdaptor-VStaYQHr.d.cts.map → HonoEndpointAdaptor-D3IgM-0B.d.cts.map} +1 -1
- package/dist/{HonoEndpointAdaptor-D7N5oiO0.mjs → HonoEndpointAdaptor-DOUODM7n.mjs} +2 -1
- package/dist/HonoEndpointAdaptor-DOUODM7n.mjs.map +1 -0
- package/dist/{TestEndpointAdaptor-UKhHj1RR.d.cts → TestEndpointAdaptor-Clz_L8Xj.d.cts} +2 -2
- package/dist/{TestEndpointAdaptor-Bt-uW6SC.d.mts.map → TestEndpointAdaptor-Clz_L8Xj.d.cts.map} +1 -1
- package/dist/{TestEndpointAdaptor-Bt-uW6SC.d.mts → TestEndpointAdaptor-DxXJoBBf.d.mts} +2 -2
- package/dist/{TestEndpointAdaptor-UKhHj1RR.d.cts.map → TestEndpointAdaptor-DxXJoBBf.d.mts.map} +1 -1
- package/dist/{TestEndpointAdaptor-DHVaHmhw.mjs → TestEndpointAdaptor-G2T789bH.mjs} +2 -1
- package/dist/TestEndpointAdaptor-G2T789bH.mjs.map +1 -0
- package/dist/{TestEndpointAdaptor-BKoJpTGT.cjs → TestEndpointAdaptor-YlwOEisx.cjs} +2 -1
- package/dist/TestEndpointAdaptor-YlwOEisx.cjs.map +1 -0
- package/dist/adaptors/aws.cjs +3 -3
- package/dist/adaptors/aws.d.cts +4 -4
- package/dist/adaptors/aws.d.mts +5 -5
- package/dist/adaptors/aws.mjs +3 -3
- package/dist/adaptors/hono.cjs +1 -1
- package/dist/adaptors/hono.d.cts +2 -2
- package/dist/adaptors/hono.d.mts +3 -3
- package/dist/adaptors/hono.mjs +1 -1
- package/dist/adaptors/testing.cjs +1 -1
- package/dist/adaptors/testing.d.cts +2 -2
- package/dist/adaptors/testing.d.mts +3 -3
- package/dist/adaptors/testing.mjs +1 -1
- package/dist/crons/Cron.d.mts +1 -1
- package/dist/crons/CronBuilder.d.mts +1 -1
- package/dist/crons/index.d.mts +1 -1
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +1 -1
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +2 -2
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +3 -3
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +1 -1
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +2 -2
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +3 -3
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +4 -4
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +2 -2
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +2 -2
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +3 -3
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +4 -4
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +2 -2
- package/dist/endpoints/Endpoint.d.cts +1 -1
- package/dist/endpoints/Endpoint.d.mts +2 -2
- package/dist/endpoints/EndpointBuilder.d.cts +2 -2
- package/dist/endpoints/EndpointBuilder.d.mts +3 -3
- package/dist/endpoints/EndpointFactory.d.cts +3 -3
- package/dist/endpoints/EndpointFactory.d.mts +4 -4
- package/dist/endpoints/HonoEndpointAdaptor.cjs +1 -1
- package/dist/endpoints/HonoEndpointAdaptor.d.cts +2 -2
- package/dist/endpoints/HonoEndpointAdaptor.d.mts +3 -3
- package/dist/endpoints/HonoEndpointAdaptor.mjs +1 -1
- package/dist/endpoints/TestEndpointAdaptor.cjs +1 -1
- package/dist/endpoints/TestEndpointAdaptor.d.cts +2 -2
- package/dist/endpoints/TestEndpointAdaptor.d.mts +3 -3
- package/dist/endpoints/TestEndpointAdaptor.mjs +1 -1
- package/dist/endpoints/audit.d.cts +1 -1
- package/dist/endpoints/audit.d.mts +2 -2
- package/dist/endpoints/helpers.d.cts +1 -1
- package/dist/endpoints/helpers.d.mts +2 -2
- package/dist/endpoints/index.d.cts +6 -6
- package/dist/endpoints/index.d.mts +7 -7
- package/dist/endpoints/lazyAccessors.d.cts +2 -2
- package/dist/endpoints/lazyAccessors.d.mts +3 -3
- package/dist/endpoints/processAudits.d.cts +1 -1
- package/dist/endpoints/processAudits.d.mts +2 -2
- package/dist/endpoints/rls.d.cts +1 -1
- package/dist/endpoints/rls.d.mts +2 -2
- package/dist/functions/index.d.mts +1 -1
- package/dist/index-DQo_Csy7.d.mts +12 -0
- package/dist/{index-CtMNRkV7.d.mts.map → index-DQo_Csy7.d.mts.map} +1 -1
- package/dist/{lazyAccessors-Ba8HxeIC.d.cts → lazyAccessors-Bled3FVc.d.mts} +2 -2
- package/dist/{lazyAccessors-Ba8HxeIC.d.cts.map → lazyAccessors-Bled3FVc.d.mts.map} +1 -1
- package/dist/{lazyAccessors-D9tzUZaz.d.mts → lazyAccessors-C8AF1hNi.d.cts} +2 -2
- package/dist/{lazyAccessors-D9tzUZaz.d.mts.map → lazyAccessors-C8AF1hNi.d.cts.map} +1 -1
- package/dist/subscribers/index.d.cts +2 -2
- package/dist/subscribers/index.d.cts.map +1 -1
- package/dist/subscribers/index.d.mts +2 -2
- package/dist/subscribers/index.d.mts.map +1 -1
- package/package.json +11 -11
- package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +3 -0
- package/src/endpoints/Endpoint.ts +15 -5
- package/src/endpoints/EndpointBuilder.ts +5 -2
- package/src/endpoints/EndpointFactory.ts +18 -4
- package/src/endpoints/HonoEndpointAdaptor.ts +2 -1
- package/src/endpoints/TestEndpointAdaptor.ts +2 -1
- package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +54 -0
- package/dist/AmazonApiGatewayEndpointAdaptor-Cmm9d_Po.mjs.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-D7mhDtSL.cjs.map +0 -1
- package/dist/Endpoint-BIvS-rKH.d.mts.map +0 -1
- package/dist/Endpoint-BPh52sXZ.d.cts.map +0 -1
- package/dist/EndpointBuilder-3xH8Gllw.d.mts.map +0 -1
- package/dist/EndpointBuilder-BmVTFp1A.d.cts.map +0 -1
- package/dist/EndpointFactory-DKHnUYl8.d.mts.map +0 -1
- package/dist/EndpointFactory-DaDXPRAg.d.cts.map +0 -1
- package/dist/HonoEndpointAdaptor-D7N5oiO0.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-Jbptyuxv.cjs.map +0 -1
- package/dist/TestEndpointAdaptor-BKoJpTGT.cjs.map +0 -1
- package/dist/TestEndpointAdaptor-DHVaHmhw.mjs.map +0 -1
- package/dist/index-CtMNRkV7.d.mts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @geekmidas/constructs
|
|
2
2
|
|
|
3
|
+
## 3.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ✨ [`3941ae6`](https://github.com/geekmidas/toolbox/commit/3941ae6c9027fddb32999b9f98af813a12867877) Thanks [@geekmidas](https://github.com/geekmidas)! - Add db to authorizer
|
|
8
|
+
|
|
3
9
|
## 3.0.5
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -94,6 +94,7 @@ var AmazonApiGatewayEndpoint = class {
|
|
|
94
94
|
services,
|
|
95
95
|
logger,
|
|
96
96
|
session,
|
|
97
|
+
...req.event.db !== void 0 && { db: req.event.db },
|
|
97
98
|
body: req.event.body,
|
|
98
99
|
query: req.event.query,
|
|
99
100
|
params: req.event.params
|
|
@@ -273,4 +274,4 @@ Object.defineProperty(exports, 'AmazonApiGatewayEndpoint', {
|
|
|
273
274
|
return AmazonApiGatewayEndpoint;
|
|
274
275
|
}
|
|
275
276
|
});
|
|
276
|
-
//# sourceMappingURL=AmazonApiGatewayEndpointAdaptor-
|
|
277
|
+
//# sourceMappingURL=AmazonApiGatewayEndpointAdaptor-BIltcbAc.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayEndpointAdaptor-BIltcbAc.cjs","names":["envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditAction\n\t\t>","options: AmazonApiGatewayEndpointOptions","body: string | undefined | null","isBase64Encoded: boolean | undefined","contentType: string | undefined","e: TEvent","UnprocessableEntityError","UnauthorizedError","event: Event<TEvent, TInput, TServices, TLogger, TSession>","db: any","ResponseBuilder","metadata","output","trx: any","result","lambdaResponse: AmazonApiGatewayEndpointHandlerResponse","setCookieHeaders: string[]","ctx: any","event: TEvent","context: Context"],"sources":["../src/endpoints/AmazonApiGatewayEndpointAdaptor.ts"],"sourcesContent":["import type { AuditableAction, AuditStorage } from '@geekmidas/audit';\nimport { withRlsContext } from '@geekmidas/db/rls';\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { Logger } from '@geekmidas/logger';\nimport middy, { type MiddlewareObj } from '@middy/core';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type {\n\tAPIGatewayProxyEvent,\n\tAPIGatewayProxyEventV2,\n\tContext,\n} from 'aws-lambda';\nimport set from 'lodash.set';\nimport type { Telemetry } from '../telemetry';\nimport type { HttpMethod } from '../types';\nimport { Endpoint, type EndpointSchemas, ResponseBuilder } from './Endpoint';\n\n/**\n * Telescope integration for request recording.\n * Uses Middy middleware pattern for compatibility with existing telescope package.\n */\nexport interface TelescopeIntegration {\n\tmiddleware: MiddlewareObj<any, any, Error, Context>;\n}\n\nimport {\n\tUnauthorizedError,\n\tUnprocessableEntityError,\n\twrapError,\n} from '@geekmidas/errors';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type {\n\tInferComposableStandardSchema,\n\tInferStandardSchema,\n} from '@geekmidas/schema';\nimport {\n\trunWithRequestContext,\n\ttype Service,\n\tServiceDiscovery,\n\ttype ServiceRecord,\n} from '@geekmidas/services';\nimport { publishConstructEvents } from '../publisher';\nimport type { MappedAudit } from './audit';\nimport type { CookieFn, HeaderFn } from './Endpoint';\nimport {\n\tcreateAuditContext,\n\texecuteWithAuditTransaction,\n} from './processAudits';\n\n// Helper function to publish events\n\n/**\n * Options for Amazon API Gateway endpoint adaptors\n */\nexport interface AmazonApiGatewayEndpointOptions {\n\t/**\n\t * Telescope integration for request recording and monitoring.\n\t *\n\t * @example\n\t * ```typescript\n\t * import { telescopeMiddleware } from '@geekmidas/telescope/lambda';\n\t *\n\t * const adaptor = new AmazonApiGatewayV2Endpoint(envParser, endpoint, {\n\t * telescope: { middleware: telescopeMiddleware(telescope) },\n\t * });\n\t * ```\n\t */\n\ttelescope?: TelescopeIntegration;\n\n\t/**\n\t * Telemetry integration for distributed tracing.\n\t * Works with any OpenTelemetry-compatible backend.\n\t *\n\t * @example\n\t * ```typescript\n\t * import { OTelTelemetry } from '@geekmidas/telescope/instrumentation';\n\t *\n\t * const adaptor = new AmazonApiGatewayV2Endpoint(envParser, endpoint, {\n\t * telemetry: new OTelTelemetry(),\n\t * });\n\t * ```\n\t */\n\ttelemetry?: Telemetry;\n}\n\nexport abstract class AmazonApiGatewayEndpoint<\n\tTHandler extends\n\t\t| AmazonApiGatewayV1EndpointHandler\n\t\t| AmazonApiGatewayV2EndpointHandler,\n\tTEvent extends HandlerEvent<THandler>,\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\tTEventPublisherServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n> {\n\tprotected options: AmazonApiGatewayEndpointOptions;\n\n\tconstructor(\n\t\tprotected envParser: EnvironmentParser<{}>,\n\t\tprotected readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditAction\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tthis.options = options;\n\t}\n\n\tprivate error(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tonError: (req) => {\n\t\t\t\t(req.event.logger || this.endpoint.logger).error(\n\t\t\t\t\treq.error || {},\n\t\t\t\t\t'Error processing request',\n\t\t\t\t);\n\t\t\t\tconst wrappedError = wrapError(req.error);\n\n\t\t\t\t// Set the response with the proper status code from the HttpError\n\t\t\t\treq.response = {\n\t\t\t\t\tstatusCode: wrappedError.statusCode,\n\t\t\t\t\tbody: wrappedError.body,\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t}\n\tabstract getInput(e: TEvent): GetInputResponse;\n\n\t/**\n\t * Decodes the raw body from an API Gateway event.\n\t * Uses Content-Type to decide parsing strategy (like Express/Fastify/Hono):\n\t * - `application/json` (or missing) → JSON.parse the decoded string\n\t * - Anything else → return decoded string as-is, let the schema handle it\n\t *\n\t * Defaults to JSON when no Content-Type is provided for backwards compatibility.\n\t */\n\tstatic decodeBody(\n\t\tbody: string | undefined | null,\n\t\tisBase64Encoded: boolean | undefined,\n\t\tcontentType: string | undefined,\n\t): any {\n\t\tif (!body) return undefined;\n\n\t\tconst raw = isBase64Encoded\n\t\t\t? Buffer.from(body, 'base64').toString('utf-8')\n\t\t\t: body;\n\n\t\tconst isJson =\n\t\t\t!contentType || contentType.toLowerCase().includes('application/json');\n\t\tif (isJson) {\n\t\t\treturn JSON.parse(raw);\n\t\t}\n\n\t\treturn raw;\n\t}\n\n\tprotected getCookies(e: TEvent): CookieFn {\n\t\tconst headers = e.headers as Record<string, string>;\n\t\treturn Endpoint.createCookies(headers?.cookie);\n\t}\n\n\tprivate input(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tbefore: async (req) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst { body, query, params } = this.getInput(req.event);\n\t\t\t\t\tconst headers = req.event.headers as Record<string, string>;\n\t\t\t\t\tconst header = Endpoint.createHeaders(headers);\n\t\t\t\t\tconst cookie = this.getCookies(req.event);\n\n\t\t\t\t\tset(req.event, 'body', await this.endpoint.parseInput(body, 'body'));\n\n\t\t\t\t\tset(\n\t\t\t\t\t\treq.event,\n\t\t\t\t\t\t'query',\n\t\t\t\t\t\tawait this.endpoint.parseInput(query, 'query'),\n\t\t\t\t\t);\n\t\t\t\t\tset(\n\t\t\t\t\t\treq.event,\n\t\t\t\t\t\t'params',\n\t\t\t\t\t\tawait this.endpoint.parseInput(params, 'params'),\n\t\t\t\t\t);\n\t\t\t\t\tset(req.event, 'header', header);\n\t\t\t\t\tset(req.event, 'cookie', cookie);\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// Convert validation errors to 422 Unprocessable Entity\n\t\t\t\t\tif (error && typeof error === 'object' && Array.isArray(error)) {\n\t\t\t\t\t\tthrow new UnprocessableEntityError('Validation failed', error);\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tabstract getLoggerContext(data: TEvent, context: Context): LoggerContext;\n\n\tprivate logger(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tbefore: (req) => {\n\t\t\t\treq.event.logger = this.endpoint.logger.child({\n\t\t\t\t\troute: this.endpoint.route,\n\t\t\t\t\thost: req.event.headers?.host,\n\t\t\t\t\tmethod: this.endpoint.method,\n\t\t\t\t\t...this.getLoggerContext(req.event, req.context),\n\t\t\t\t}) as TLogger;\n\t\t\t},\n\t\t};\n\t}\n\tprivate services(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tbefore: async (req) => {\n\t\t\t\tconst _logger = req.event.logger as TLogger;\n\t\t\t\tconst serviceDiscovery = ServiceDiscovery.getInstance<\n\t\t\t\t\tServiceRecord<TServices>\n\t\t\t\t>(this.envParser);\n\n\t\t\t\tconst services = await serviceDiscovery.register(\n\t\t\t\t\tthis.endpoint.services,\n\t\t\t\t);\n\n\t\t\t\treq.event.services = services;\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate authorize(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tbefore: async (req) => {\n\t\t\t\tconst logger = req.event.logger as TLogger;\n\t\t\t\tconst services = req.event.services;\n\t\t\t\tconst header = req.event.header;\n\t\t\t\tconst cookie = req.event.cookie;\n\t\t\t\tconst session = req.event.session as TSession;\n\n\t\t\t\tconst isAuthorized = await this.endpoint.authorize({\n\t\t\t\t\theader,\n\t\t\t\t\tcookie,\n\t\t\t\t\tservices,\n\t\t\t\t\tlogger,\n\t\t\t\t\tsession,\n\t\t\t\t\t...((req.event as any).db !== undefined && {\n\t\t\t\t\t\tdb: (req.event as any).db,\n\t\t\t\t\t}),\n\t\t\t\t\tbody: (req.event as any).body,\n\t\t\t\t\tquery: (req.event as any).query,\n\t\t\t\t\tparams: (req.event as any).params,\n\t\t\t\t} as any);\n\n\t\t\t\tif (!isAuthorized) {\n\t\t\t\t\tlogger.warn('Unauthorized access attempt');\n\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t'Unauthorized access to the endpoint',\n\t\t\t\t\t\t'You do not have permission to access this resource.',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate database(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tbefore: async (req) => {\n\t\t\t\tif (!this.endpoint.databaseService) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst _logger = req.event.logger as TLogger;\n\t\t\t\tconst serviceDiscovery = ServiceDiscovery.getInstance<\n\t\t\t\t\tServiceRecord<TServices>\n\t\t\t\t>(this.envParser);\n\n\t\t\t\tconst db = await serviceDiscovery\n\t\t\t\t\t.register([this.endpoint.databaseService])\n\t\t\t\t\t.then(\n\t\t\t\t\t\t(s) =>\n\t\t\t\t\t\t\ts[this.endpoint.databaseService?.serviceName as keyof typeof s],\n\t\t\t\t\t);\n\n\t\t\t\t(req.event as any).db = db;\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate session(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tbefore: async (req) => {\n\t\t\t\tconst logger = req.event.logger as TLogger;\n\t\t\t\tconst services = req.event.services;\n\t\t\t\tconst db = (req.event as any).db;\n\t\t\t\treq.event.session = (await this.endpoint.getSession({\n\t\t\t\t\tlogger,\n\t\t\t\t\tservices,\n\t\t\t\t\theader: req.event.header,\n\t\t\t\t\tcookie: req.event.cookie,\n\t\t\t\t\t...(db !== undefined && { db }),\n\t\t\t\t} as any)) as TSession;\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate events(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tafter: async (req) => {\n\t\t\t\tconst event = req.event;\n\t\t\t\tconst response = (event as any)\n\t\t\t\t\t.__response as InferStandardSchema<TOutSchema>;\n\t\t\t\tconst statusCode = req.response?.statusCode ?? this.endpoint.status;\n\n\t\t\t\t// Only publish events on successful responses (2xx status codes)\n\t\t\t\t// Note: Audits are processed inside the handler's transaction\n\t\t\t\tif (Endpoint.isSuccessStatus(statusCode)) {\n\t\t\t\t\tconst logger = event.logger as TLogger;\n\t\t\t\t\tconst serviceDiscovery = ServiceDiscovery.getInstance<\n\t\t\t\t\t\tServiceRecord<TServices>\n\t\t\t\t\t>(this.envParser);\n\n\t\t\t\t\t// Publish events\n\t\t\t\t\tawait publishConstructEvents(\n\t\t\t\t\t\tthis.endpoint,\n\t\t\t\t\t\tresponse,\n\t\t\t\t\t\tserviceDiscovery,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate async _handler(\n\t\tevent: Event<TEvent, TInput, TServices, TLogger, TSession>,\n\t) {\n\t\tconst input = this.endpoint.refineInput(event);\n\t\tconst logger = event.logger as TLogger;\n\t\tconst serviceDiscovery = ServiceDiscovery.getInstance<\n\t\t\tServiceRecord<TServices>\n\t\t>(this.envParser);\n\n\t\t// Create audit context if audit storage is configured\n\t\tconst auditContext = await createAuditContext(\n\t\t\tthis.endpoint,\n\t\t\tserviceDiscovery,\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\tsession: event.session,\n\t\t\t\theader: event.header,\n\t\t\t\tcookie: event.cookie,\n\t\t\t\tservices: event.services as Record<string, unknown>,\n\t\t\t},\n\t\t);\n\n\t\t// Warn if declarative audits are configured but no audit storage\n\t\tconst audits = this.endpoint.audits as MappedAudit<\n\t\t\tTAuditAction,\n\t\t\tTOutSchema\n\t\t>[];\n\t\tif (!auditContext && audits?.length) {\n\t\t\tlogger.warn('No auditor storage service available');\n\t\t}\n\n\t\t// Get pre-resolved database from middleware\n\t\tconst rawDb = (event as any).db;\n\n\t\t// Extract RLS context if configured and not bypassed\n\t\tconst rlsActive =\n\t\t\tthis.endpoint.rlsConfig &&\n\t\t\t!this.endpoint.rlsBypass &&\n\t\t\trawDb !== undefined;\n\t\tconst rlsContext = rlsActive\n\t\t\t? await this.endpoint.rlsConfig?.extractor({\n\t\t\t\t\tservices: event.services as ServiceRecord<TServices>,\n\t\t\t\t\tsession: event.session,\n\t\t\t\t\theader: event.header,\n\t\t\t\t\tcookie: event.cookie,\n\t\t\t\t\tlogger,\n\t\t\t\t})\n\t\t\t: undefined;\n\n\t\t// Execute handler with automatic audit transaction support\n\t\tconst result = await executeWithAuditTransaction(\n\t\t\tauditContext,\n\t\t\tasync (auditor) => {\n\t\t\t\t// Use audit transaction as db only if the storage uses the same database service\n\t\t\t\tconst sameDatabase =\n\t\t\t\t\tauditContext?.storage?.databaseServiceName &&\n\t\t\t\t\tauditContext.storage.databaseServiceName ===\n\t\t\t\t\t\tthis.endpoint.databaseService?.serviceName;\n\t\t\t\tconst baseDb = sameDatabase\n\t\t\t\t\t? (auditor?.getTransaction?.() ?? rawDb)\n\t\t\t\t\t: rawDb;\n\n\t\t\t\t// Helper to execute handler with given db\n\t\t\t\tconst executeHandler = async (db: any) => {\n\t\t\t\t\tconst responseBuilder = new ResponseBuilder();\n\t\t\t\t\tconst response = await this.endpoint.handler(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\theader: event.header,\n\t\t\t\t\t\t\tcookie: event.cookie,\n\t\t\t\t\t\t\tlogger: event.logger,\n\t\t\t\t\t\t\tservices: event.services,\n\t\t\t\t\t\t\tsession: event.session,\n\t\t\t\t\t\t\tauditor,\n\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\t...input,\n\t\t\t\t\t\t} as any,\n\t\t\t\t\t\tresponseBuilder,\n\t\t\t\t\t);\n\n\t\t\t\t\t// Check if response has metadata\n\t\t\t\t\tlet data = response;\n\t\t\t\t\tlet metadata = responseBuilder.getMetadata();\n\n\t\t\t\t\tif (Endpoint.hasMetadata(response)) {\n\t\t\t\t\t\tdata = response.data;\n\t\t\t\t\t\tmetadata = response.metadata;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst output = this.endpoint.outputSchema\n\t\t\t\t\t\t? await this.endpoint.parseOutput(data)\n\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\treturn { output, metadata, responseBuilder };\n\t\t\t\t};\n\n\t\t\t\t// If RLS is active, wrap handler with RLS context\n\t\t\t\tif (rlsActive && rlsContext && baseDb) {\n\t\t\t\t\treturn withRlsContext(\n\t\t\t\t\t\tbaseDb,\n\t\t\t\t\t\trlsContext,\n\t\t\t\t\t\tasync (trx: any) => executeHandler(trx),\n\t\t\t\t\t\t{ prefix: this.endpoint.rlsConfig?.prefix },\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn executeHandler(baseDb);\n\t\t\t},\n\t\t\t// Process declarative audits after handler (inside transaction)\n\t\t\tasync (result, auditor) => {\n\t\t\t\tif (!audits?.length) return;\n\n\t\t\t\tfor (const audit of audits) {\n\t\t\t\t\tif (audit.when && !audit.when(result.output as any)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst payload = audit.payload(result.output as any);\n\t\t\t\t\tconst entityId = audit.entityId?.(result.output as any);\n\t\t\t\t\tauditor.audit(audit.type as any, payload as any, {\n\t\t\t\t\t\ttable: audit.table,\n\t\t\t\t\t\tentityId,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t\t// Pass rawDb so storage can reuse existing transactions\n\t\t\t{ db: rawDb },\n\t\t);\n\n\t\tconst { output, metadata } = result;\n\t\tconst body = output !== undefined ? JSON.stringify(output) : undefined;\n\n\t\t// Store response for middleware access\n\t\t(event as any).__response = output;\n\n\t\t// Build response with metadata\n\t\tconst lambdaResponse: AmazonApiGatewayEndpointHandlerResponse = {\n\t\t\tstatusCode: metadata.status ?? this.endpoint.status,\n\t\t\tbody,\n\t\t};\n\n\t\t// Add custom headers\n\t\tif (metadata.headers && Object.keys(metadata.headers).length > 0) {\n\t\t\tlambdaResponse.headers = { ...metadata.headers };\n\t\t}\n\n\t\t// Format cookies as Set-Cookie headers\n\t\tif (metadata.cookies && metadata.cookies.size > 0) {\n\t\t\tconst setCookieHeaders: string[] = [];\n\t\t\tfor (const [name, { value, options }] of metadata.cookies) {\n\t\t\t\tsetCookieHeaders.push(\n\t\t\t\t\tEndpoint.formatCookieHeader(name, value, options),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (setCookieHeaders.length > 0) {\n\t\t\t\tlambdaResponse.multiValueHeaders = {\n\t\t\t\t\t...lambdaResponse.multiValueHeaders,\n\t\t\t\t\t'Set-Cookie': setCookieHeaders,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn lambdaResponse;\n\t}\n\n\t/**\n\t * Convert Telemetry interface to Middy middleware\n\t */\n\tprivate telemetry(): Middleware<TEvent, TInput, TServices, TLogger> | null {\n\t\tif (!this.options.telemetry) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst telemetry = this.options.telemetry;\n\t\tlet ctx: any;\n\n\t\treturn {\n\t\t\tbefore: (request) => {\n\t\t\t\tctx = telemetry.onRequestStart({\n\t\t\t\t\tevent: request.event,\n\t\t\t\t\tcontext: request.context,\n\t\t\t\t});\n\t\t\t},\n\t\t\tafter: (request) => {\n\t\t\t\tif (ctx) {\n\t\t\t\t\ttelemetry.onRequestEnd(ctx, {\n\t\t\t\t\t\tstatusCode: request.response?.statusCode ?? 200,\n\t\t\t\t\t\tbody: request.response?.body,\n\t\t\t\t\t\theaders: request.response?.headers,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t\tonError: (request) => {\n\t\t\t\tif (ctx && request.error) {\n\t\t\t\t\ttelemetry.onRequestError(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\trequest.error instanceof Error\n\t\t\t\t\t\t\t? request.error\n\t\t\t\t\t\t\t: new Error(String(request.error)),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tget handler() {\n\t\tconst handler = this._handler.bind(this);\n\t\tlet chain = middy(handler)\n\t\t\t.use(this.logger())\n\t\t\t.use(this.error())\n\t\t\t.use(this.services())\n\t\t\t.use(this.input())\n\t\t\t.use(this.database())\n\t\t\t.use(this.session())\n\t\t\t.use(this.authorize())\n\t\t\t.use(this.events());\n\n\t\t// Add telemetry middleware if configured (runs early for span creation)\n\t\tconst telemetryMiddleware = this.telemetry();\n\t\tif (telemetryMiddleware) {\n\t\t\tchain = chain.use(telemetryMiddleware);\n\t\t}\n\n\t\t// Add Telescope middleware if configured (runs first/last in chain)\n\t\tif (this.options.telescope?.middleware) {\n\t\t\tchain = chain.use(this.options.telescope.middleware);\n\t\t}\n\n\t\t// Wrap entire Middy chain in request context for service access\n\t\tconst wrappedHandler = async (event: TEvent, context: Context) => {\n\t\t\tconst startTime = Date.now();\n\t\t\tconst requestId = context.awsRequestId;\n\t\t\tconst logger = this.endpoint.logger.child({ requestId }) as TLogger;\n\n\t\t\t// Cast event to any since Middy middlewares enrich the event with\n\t\t\t// services, logger, session, etc. during the middleware chain execution\n\t\t\treturn runWithRequestContext({ logger, requestId, startTime }, () =>\n\t\t\t\tchain(event as unknown as Parameters<typeof chain>[0], context),\n\t\t\t);\n\t\t};\n\n\t\treturn wrappedHandler as unknown as THandler;\n\t}\n}\n\nexport type Event<\n\tTEvent extends APIGatewayProxyEvent | APIGatewayProxyEventV2,\n\tTInput extends EndpointSchemas = {},\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n> = {\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n\theader: HeaderFn;\n\tcookie: CookieFn;\n\tsession: TSession;\n} & TEvent &\n\tInferComposableStandardSchema<TInput>;\n\ntype Middleware<\n\tTEvent extends APIGatewayProxyEvent | APIGatewayProxyEventV2,\n\tTInput extends EndpointSchemas = {},\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n> = MiddlewareObj<Event<TEvent, TInput, TServices, TLogger, TSession>>;\n\nexport type AmazonApiGatewayEndpointHandlerResponse = {\n\tstatusCode: number;\n\tbody: string | undefined;\n\theaders?: Record<string, string>;\n\tmultiValueHeaders?: Record<string, string[]>;\n};\n\nexport type LoggerContext = {\n\tfn: {\n\t\tname: string;\n\t\tversion: string;\n\t};\n\treq: {\n\t\tid: string | undefined;\n\t\tawsRequestId: string;\n\t\tpath: string;\n\t\tip: string | undefined;\n\t\tuserAgent: string | undefined;\n\t};\n};\n\nexport type GetInputResponse = {\n\tbody: any;\n\tquery: any;\n\tparams: any;\n};\n\nexport type AmazonApiGatewayV1EndpointHandler = (\n\tevent: APIGatewayProxyEvent,\n\tcontext: Context,\n) => Promise<AmazonApiGatewayEndpointHandlerResponse>;\n\nexport type AmazonApiGatewayV2EndpointHandler = (\n\tevent: APIGatewayProxyEventV2,\n\tcontext: Context,\n) => Promise<AmazonApiGatewayEndpointHandlerResponse>;\n\nexport type HandlerEvent<T extends Function> = T extends (\n\tevent: infer E,\n\tcontext: Context,\n) => any\n\t? E\n\t: never;\n"],"mappings":";;;;;;;;;;;AAoFA,IAAsB,2BAAtB,MAoBE;CACD,AAAU;CAEV,YACWA,WACSC,UAcnBC,UAA2C,CAAE,GAC5C;EAhBS;EACS;AAgBnB,OAAK,UAAU;CACf;CAED,AAAQ,QAAwD;AAC/D,SAAO,EACN,SAAS,CAAC,QAAQ;AACjB,IAAC,IAAI,MAAM,UAAU,KAAK,SAAS,QAAQ,MAC1C,IAAI,SAAS,CAAE,GACf,2BACA;GACD,MAAM,eAAe,kCAAU,IAAI,MAAM;AAGzC,OAAI,WAAW;IACd,YAAY,aAAa;IACzB,MAAM,aAAa;GACnB;EACD,EACD;CACD;;;;;;;;;CAWD,OAAO,WACNC,MACAC,iBACAC,aACM;AACN,OAAK,KAAM;EAEX,MAAM,MAAM,kBACT,OAAO,KAAK,MAAM,SAAS,CAAC,SAAS,QAAQ,GAC7C;EAEH,MAAM,UACJ,eAAe,YAAY,aAAa,CAAC,SAAS,mBAAmB;AACvE,MAAI,OACH,QAAO,KAAK,MAAM,IAAI;AAGvB,SAAO;CACP;CAED,AAAU,WAAWC,GAAqB;EACzC,MAAM,UAAU,EAAE;AAClB,SAAO,0BAAS,cAAc,SAAS,OAAO;CAC9C;CAED,AAAQ,QAAwD;AAC/D,SAAO,EACN,QAAQ,OAAO,QAAQ;AACtB,OAAI;IACH,MAAM,EAAE,MAAM,OAAO,Q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MAC9D,MAAM,OAAiD,QAAQ,CAC/D;EACD;AAED,SAAO;CACP;AACD"}
|
|
@@ -93,6 +93,7 @@ var AmazonApiGatewayEndpoint = class {
|
|
|
93
93
|
services,
|
|
94
94
|
logger,
|
|
95
95
|
session,
|
|
96
|
+
...req.event.db !== void 0 && { db: req.event.db },
|
|
96
97
|
body: req.event.body,
|
|
97
98
|
query: req.event.query,
|
|
98
99
|
params: req.event.params
|
|
@@ -267,4 +268,4 @@ var AmazonApiGatewayEndpoint = class {
|
|
|
267
268
|
|
|
268
269
|
//#endregion
|
|
269
270
|
export { AmazonApiGatewayEndpoint };
|
|
270
|
-
//# sourceMappingURL=AmazonApiGatewayEndpointAdaptor-
|
|
271
|
+
//# sourceMappingURL=AmazonApiGatewayEndpointAdaptor-BpYtYCeW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayEndpointAdaptor-BpYtYCeW.mjs","names":["envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditAction\n\t\t>","options: AmazonApiGatewayEndpointOptions","body: string | undefined | null","isBase64Encoded: boolean | undefined","contentType: string | undefined","e: TEvent","event: Event<TEvent, TInput, TServices, TLogger, TSession>","db: any","metadata","output","trx: any","result","lambdaResponse: AmazonApiGatewayEndpointHandlerResponse","setCookieHeaders: string[]","ctx: any","event: TEvent","context: Context"],"sources":["../src/endpoints/AmazonApiGatewayEndpointAdaptor.ts"],"sourcesContent":["import type { AuditableAction, AuditStorage } from '@geekmidas/audit';\nimport { withRlsContext } from '@geekmidas/db/rls';\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { Logger } from '@geekmidas/logger';\nimport middy, { type MiddlewareObj } from '@middy/core';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type {\n\tAPIGatewayProxyEvent,\n\tAPIGatewayProxyEventV2,\n\tContext,\n} from 'aws-lambda';\nimport set from 'lodash.set';\nimport type { Telemetry } from '../telemetry';\nimport type { HttpMethod } from '../types';\nimport { Endpoint, type EndpointSchemas, ResponseBuilder } from './Endpoint';\n\n/**\n * Telescope integration for request recording.\n * Uses Middy middleware pattern for compatibility with existing telescope package.\n */\nexport interface TelescopeIntegration {\n\tmiddleware: MiddlewareObj<any, any, Error, Context>;\n}\n\nimport {\n\tUnauthorizedError,\n\tUnprocessableEntityError,\n\twrapError,\n} from '@geekmidas/errors';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type {\n\tInferComposableStandardSchema,\n\tInferStandardSchema,\n} from '@geekmidas/schema';\nimport {\n\trunWithRequestContext,\n\ttype Service,\n\tServiceDiscovery,\n\ttype ServiceRecord,\n} from '@geekmidas/services';\nimport { publishConstructEvents } from '../publisher';\nimport type { MappedAudit } from './audit';\nimport type { CookieFn, HeaderFn } from './Endpoint';\nimport {\n\tcreateAuditContext,\n\texecuteWithAuditTransaction,\n} from './processAudits';\n\n// Helper function to publish events\n\n/**\n * Options for Amazon API Gateway endpoint adaptors\n */\nexport interface AmazonApiGatewayEndpointOptions {\n\t/**\n\t * Telescope integration for request recording and monitoring.\n\t *\n\t * @example\n\t * ```typescript\n\t * import { telescopeMiddleware } from '@geekmidas/telescope/lambda';\n\t *\n\t * const adaptor = new AmazonApiGatewayV2Endpoint(envParser, endpoint, {\n\t * telescope: { middleware: telescopeMiddleware(telescope) },\n\t * });\n\t * ```\n\t */\n\ttelescope?: TelescopeIntegration;\n\n\t/**\n\t * Telemetry integration for distributed tracing.\n\t * Works with any OpenTelemetry-compatible backend.\n\t *\n\t * @example\n\t * ```typescript\n\t * import { OTelTelemetry } from '@geekmidas/telescope/instrumentation';\n\t *\n\t * const adaptor = new AmazonApiGatewayV2Endpoint(envParser, endpoint, {\n\t * telemetry: new OTelTelemetry(),\n\t * });\n\t * ```\n\t */\n\ttelemetry?: Telemetry;\n}\n\nexport abstract class AmazonApiGatewayEndpoint<\n\tTHandler extends\n\t\t| AmazonApiGatewayV1EndpointHandler\n\t\t| AmazonApiGatewayV2EndpointHandler,\n\tTEvent extends HandlerEvent<THandler>,\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\tTEventPublisherServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n> {\n\tprotected options: AmazonApiGatewayEndpointOptions;\n\n\tconstructor(\n\t\tprotected envParser: EnvironmentParser<{}>,\n\t\tprotected readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditAction\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tthis.options = options;\n\t}\n\n\tprivate error(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tonError: (req) => {\n\t\t\t\t(req.event.logger || this.endpoint.logger).error(\n\t\t\t\t\treq.error || {},\n\t\t\t\t\t'Error processing request',\n\t\t\t\t);\n\t\t\t\tconst wrappedError = wrapError(req.error);\n\n\t\t\t\t// Set the response with the proper status code from the HttpError\n\t\t\t\treq.response = {\n\t\t\t\t\tstatusCode: wrappedError.statusCode,\n\t\t\t\t\tbody: wrappedError.body,\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t}\n\tabstract getInput(e: TEvent): GetInputResponse;\n\n\t/**\n\t * Decodes the raw body from an API Gateway event.\n\t * Uses Content-Type to decide parsing strategy (like Express/Fastify/Hono):\n\t * - `application/json` (or missing) → JSON.parse the decoded string\n\t * - Anything else → return decoded string as-is, let the schema handle it\n\t *\n\t * Defaults to JSON when no Content-Type is provided for backwards compatibility.\n\t */\n\tstatic decodeBody(\n\t\tbody: string | undefined | null,\n\t\tisBase64Encoded: boolean | undefined,\n\t\tcontentType: string | undefined,\n\t): any {\n\t\tif (!body) return undefined;\n\n\t\tconst raw = isBase64Encoded\n\t\t\t? Buffer.from(body, 'base64').toString('utf-8')\n\t\t\t: body;\n\n\t\tconst isJson =\n\t\t\t!contentType || contentType.toLowerCase().includes('application/json');\n\t\tif (isJson) {\n\t\t\treturn JSON.parse(raw);\n\t\t}\n\n\t\treturn raw;\n\t}\n\n\tprotected getCookies(e: TEvent): CookieFn {\n\t\tconst headers = e.headers as Record<string, string>;\n\t\treturn Endpoint.createCookies(headers?.cookie);\n\t}\n\n\tprivate input(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tbefore: async (req) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst { body, query, params } = this.getInput(req.event);\n\t\t\t\t\tconst headers = req.event.headers as Record<string, string>;\n\t\t\t\t\tconst header = Endpoint.createHeaders(headers);\n\t\t\t\t\tconst cookie = this.getCookies(req.event);\n\n\t\t\t\t\tset(req.event, 'body', await this.endpoint.parseInput(body, 'body'));\n\n\t\t\t\t\tset(\n\t\t\t\t\t\treq.event,\n\t\t\t\t\t\t'query',\n\t\t\t\t\t\tawait this.endpoint.parseInput(query, 'query'),\n\t\t\t\t\t);\n\t\t\t\t\tset(\n\t\t\t\t\t\treq.event,\n\t\t\t\t\t\t'params',\n\t\t\t\t\t\tawait this.endpoint.parseInput(params, 'params'),\n\t\t\t\t\t);\n\t\t\t\t\tset(req.event, 'header', header);\n\t\t\t\t\tset(req.event, 'cookie', cookie);\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// Convert validation errors to 422 Unprocessable Entity\n\t\t\t\t\tif (error && typeof error === 'object' && Array.isArray(error)) {\n\t\t\t\t\t\tthrow new UnprocessableEntityError('Validation failed', error);\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tabstract getLoggerContext(data: TEvent, context: Context): LoggerContext;\n\n\tprivate logger(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tbefore: (req) => {\n\t\t\t\treq.event.logger = this.endpoint.logger.child({\n\t\t\t\t\troute: this.endpoint.route,\n\t\t\t\t\thost: req.event.headers?.host,\n\t\t\t\t\tmethod: this.endpoint.method,\n\t\t\t\t\t...this.getLoggerContext(req.event, req.context),\n\t\t\t\t}) as TLogger;\n\t\t\t},\n\t\t};\n\t}\n\tprivate services(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tbefore: async (req) => {\n\t\t\t\tconst _logger = req.event.logger as TLogger;\n\t\t\t\tconst serviceDiscovery = ServiceDiscovery.getInstance<\n\t\t\t\t\tServiceRecord<TServices>\n\t\t\t\t>(this.envParser);\n\n\t\t\t\tconst services = await serviceDiscovery.register(\n\t\t\t\t\tthis.endpoint.services,\n\t\t\t\t);\n\n\t\t\t\treq.event.services = services;\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate authorize(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tbefore: async (req) => {\n\t\t\t\tconst logger = req.event.logger as TLogger;\n\t\t\t\tconst services = req.event.services;\n\t\t\t\tconst header = req.event.header;\n\t\t\t\tconst cookie = req.event.cookie;\n\t\t\t\tconst session = req.event.session as TSession;\n\n\t\t\t\tconst isAuthorized = await this.endpoint.authorize({\n\t\t\t\t\theader,\n\t\t\t\t\tcookie,\n\t\t\t\t\tservices,\n\t\t\t\t\tlogger,\n\t\t\t\t\tsession,\n\t\t\t\t\t...((req.event as any).db !== undefined && {\n\t\t\t\t\t\tdb: (req.event as any).db,\n\t\t\t\t\t}),\n\t\t\t\t\tbody: (req.event as any).body,\n\t\t\t\t\tquery: (req.event as any).query,\n\t\t\t\t\tparams: (req.event as any).params,\n\t\t\t\t} as any);\n\n\t\t\t\tif (!isAuthorized) {\n\t\t\t\t\tlogger.warn('Unauthorized access attempt');\n\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t'Unauthorized access to the endpoint',\n\t\t\t\t\t\t'You do not have permission to access this resource.',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate database(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tbefore: async (req) => {\n\t\t\t\tif (!this.endpoint.databaseService) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst _logger = req.event.logger as TLogger;\n\t\t\t\tconst serviceDiscovery = ServiceDiscovery.getInstance<\n\t\t\t\t\tServiceRecord<TServices>\n\t\t\t\t>(this.envParser);\n\n\t\t\t\tconst db = await serviceDiscovery\n\t\t\t\t\t.register([this.endpoint.databaseService])\n\t\t\t\t\t.then(\n\t\t\t\t\t\t(s) =>\n\t\t\t\t\t\t\ts[this.endpoint.databaseService?.serviceName as keyof typeof s],\n\t\t\t\t\t);\n\n\t\t\t\t(req.event as any).db = db;\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate session(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tbefore: async (req) => {\n\t\t\t\tconst logger = req.event.logger as TLogger;\n\t\t\t\tconst services = req.event.services;\n\t\t\t\tconst db = (req.event as any).db;\n\t\t\t\treq.event.session = (await this.endpoint.getSession({\n\t\t\t\t\tlogger,\n\t\t\t\t\tservices,\n\t\t\t\t\theader: req.event.header,\n\t\t\t\t\tcookie: req.event.cookie,\n\t\t\t\t\t...(db !== undefined && { db }),\n\t\t\t\t} as any)) as TSession;\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate events(): Middleware<TEvent, TInput, TServices, TLogger> {\n\t\treturn {\n\t\t\tafter: async (req) => {\n\t\t\t\tconst event = req.event;\n\t\t\t\tconst response = (event as any)\n\t\t\t\t\t.__response as InferStandardSchema<TOutSchema>;\n\t\t\t\tconst statusCode = req.response?.statusCode ?? this.endpoint.status;\n\n\t\t\t\t// Only publish events on successful responses (2xx status codes)\n\t\t\t\t// Note: Audits are processed inside the handler's transaction\n\t\t\t\tif (Endpoint.isSuccessStatus(statusCode)) {\n\t\t\t\t\tconst logger = event.logger as TLogger;\n\t\t\t\t\tconst serviceDiscovery = ServiceDiscovery.getInstance<\n\t\t\t\t\t\tServiceRecord<TServices>\n\t\t\t\t\t>(this.envParser);\n\n\t\t\t\t\t// Publish events\n\t\t\t\t\tawait publishConstructEvents(\n\t\t\t\t\t\tthis.endpoint,\n\t\t\t\t\t\tresponse,\n\t\t\t\t\t\tserviceDiscovery,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate async _handler(\n\t\tevent: Event<TEvent, TInput, TServices, TLogger, TSession>,\n\t) {\n\t\tconst input = this.endpoint.refineInput(event);\n\t\tconst logger = event.logger as TLogger;\n\t\tconst serviceDiscovery = ServiceDiscovery.getInstance<\n\t\t\tServiceRecord<TServices>\n\t\t>(this.envParser);\n\n\t\t// Create audit context if audit storage is configured\n\t\tconst auditContext = await createAuditContext(\n\t\t\tthis.endpoint,\n\t\t\tserviceDiscovery,\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\tsession: event.session,\n\t\t\t\theader: event.header,\n\t\t\t\tcookie: event.cookie,\n\t\t\t\tservices: event.services as Record<string, unknown>,\n\t\t\t},\n\t\t);\n\n\t\t// Warn if declarative audits are configured but no audit storage\n\t\tconst audits = this.endpoint.audits as MappedAudit<\n\t\t\tTAuditAction,\n\t\t\tTOutSchema\n\t\t>[];\n\t\tif (!auditContext && audits?.length) {\n\t\t\tlogger.warn('No auditor storage service available');\n\t\t}\n\n\t\t// Get pre-resolved database from middleware\n\t\tconst rawDb = (event as any).db;\n\n\t\t// Extract RLS context if configured and not bypassed\n\t\tconst rlsActive =\n\t\t\tthis.endpoint.rlsConfig &&\n\t\t\t!this.endpoint.rlsBypass &&\n\t\t\trawDb !== undefined;\n\t\tconst rlsContext = rlsActive\n\t\t\t? await this.endpoint.rlsConfig?.extractor({\n\t\t\t\t\tservices: event.services as ServiceRecord<TServices>,\n\t\t\t\t\tsession: event.session,\n\t\t\t\t\theader: event.header,\n\t\t\t\t\tcookie: event.cookie,\n\t\t\t\t\tlogger,\n\t\t\t\t})\n\t\t\t: undefined;\n\n\t\t// Execute handler with automatic audit transaction support\n\t\tconst result = await executeWithAuditTransaction(\n\t\t\tauditContext,\n\t\t\tasync (auditor) => {\n\t\t\t\t// Use audit transaction as db only if the storage uses the same database service\n\t\t\t\tconst sameDatabase =\n\t\t\t\t\tauditContext?.storage?.databaseServiceName &&\n\t\t\t\t\tauditContext.storage.databaseServiceName ===\n\t\t\t\t\t\tthis.endpoint.databaseService?.serviceName;\n\t\t\t\tconst baseDb = sameDatabase\n\t\t\t\t\t? (auditor?.getTransaction?.() ?? rawDb)\n\t\t\t\t\t: rawDb;\n\n\t\t\t\t// Helper to execute handler with given db\n\t\t\t\tconst executeHandler = async (db: any) => {\n\t\t\t\t\tconst responseBuilder = new ResponseBuilder();\n\t\t\t\t\tconst response = await this.endpoint.handler(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\theader: event.header,\n\t\t\t\t\t\t\tcookie: event.cookie,\n\t\t\t\t\t\t\tlogger: event.logger,\n\t\t\t\t\t\t\tservices: event.services,\n\t\t\t\t\t\t\tsession: event.session,\n\t\t\t\t\t\t\tauditor,\n\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\t...input,\n\t\t\t\t\t\t} as any,\n\t\t\t\t\t\tresponseBuilder,\n\t\t\t\t\t);\n\n\t\t\t\t\t// Check if response has metadata\n\t\t\t\t\tlet data = response;\n\t\t\t\t\tlet metadata = responseBuilder.getMetadata();\n\n\t\t\t\t\tif (Endpoint.hasMetadata(response)) {\n\t\t\t\t\t\tdata = response.data;\n\t\t\t\t\t\tmetadata = response.metadata;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst output = this.endpoint.outputSchema\n\t\t\t\t\t\t? await this.endpoint.parseOutput(data)\n\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\treturn { output, metadata, responseBuilder };\n\t\t\t\t};\n\n\t\t\t\t// If RLS is active, wrap handler with RLS context\n\t\t\t\tif (rlsActive && rlsContext && baseDb) {\n\t\t\t\t\treturn withRlsContext(\n\t\t\t\t\t\tbaseDb,\n\t\t\t\t\t\trlsContext,\n\t\t\t\t\t\tasync (trx: any) => executeHandler(trx),\n\t\t\t\t\t\t{ prefix: this.endpoint.rlsConfig?.prefix },\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn executeHandler(baseDb);\n\t\t\t},\n\t\t\t// Process declarative audits after handler (inside transaction)\n\t\t\tasync (result, auditor) => {\n\t\t\t\tif (!audits?.length) return;\n\n\t\t\t\tfor (const audit of audits) {\n\t\t\t\t\tif (audit.when && !audit.when(result.output as any)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst payload = audit.payload(result.output as any);\n\t\t\t\t\tconst entityId = audit.entityId?.(result.output as any);\n\t\t\t\t\tauditor.audit(audit.type as any, payload as any, {\n\t\t\t\t\t\ttable: audit.table,\n\t\t\t\t\t\tentityId,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t\t// Pass rawDb so storage can reuse existing transactions\n\t\t\t{ db: rawDb },\n\t\t);\n\n\t\tconst { output, metadata } = result;\n\t\tconst body = output !== undefined ? JSON.stringify(output) : undefined;\n\n\t\t// Store response for middleware access\n\t\t(event as any).__response = output;\n\n\t\t// Build response with metadata\n\t\tconst lambdaResponse: AmazonApiGatewayEndpointHandlerResponse = {\n\t\t\tstatusCode: metadata.status ?? this.endpoint.status,\n\t\t\tbody,\n\t\t};\n\n\t\t// Add custom headers\n\t\tif (metadata.headers && Object.keys(metadata.headers).length > 0) {\n\t\t\tlambdaResponse.headers = { ...metadata.headers };\n\t\t}\n\n\t\t// Format cookies as Set-Cookie headers\n\t\tif (metadata.cookies && metadata.cookies.size > 0) {\n\t\t\tconst setCookieHeaders: string[] = [];\n\t\t\tfor (const [name, { value, options }] of metadata.cookies) {\n\t\t\t\tsetCookieHeaders.push(\n\t\t\t\t\tEndpoint.formatCookieHeader(name, value, options),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (setCookieHeaders.length > 0) {\n\t\t\t\tlambdaResponse.multiValueHeaders = {\n\t\t\t\t\t...lambdaResponse.multiValueHeaders,\n\t\t\t\t\t'Set-Cookie': setCookieHeaders,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn lambdaResponse;\n\t}\n\n\t/**\n\t * Convert Telemetry interface to Middy middleware\n\t */\n\tprivate telemetry(): Middleware<TEvent, TInput, TServices, TLogger> | null {\n\t\tif (!this.options.telemetry) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst telemetry = this.options.telemetry;\n\t\tlet ctx: any;\n\n\t\treturn {\n\t\t\tbefore: (request) => {\n\t\t\t\tctx = telemetry.onRequestStart({\n\t\t\t\t\tevent: request.event,\n\t\t\t\t\tcontext: request.context,\n\t\t\t\t});\n\t\t\t},\n\t\t\tafter: (request) => {\n\t\t\t\tif (ctx) {\n\t\t\t\t\ttelemetry.onRequestEnd(ctx, {\n\t\t\t\t\t\tstatusCode: request.response?.statusCode ?? 200,\n\t\t\t\t\t\tbody: request.response?.body,\n\t\t\t\t\t\theaders: request.response?.headers,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t\tonError: (request) => {\n\t\t\t\tif (ctx && request.error) {\n\t\t\t\t\ttelemetry.onRequestError(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\trequest.error instanceof Error\n\t\t\t\t\t\t\t? request.error\n\t\t\t\t\t\t\t: new Error(String(request.error)),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tget handler() {\n\t\tconst handler = this._handler.bind(this);\n\t\tlet chain = middy(handler)\n\t\t\t.use(this.logger())\n\t\t\t.use(this.error())\n\t\t\t.use(this.services())\n\t\t\t.use(this.input())\n\t\t\t.use(this.database())\n\t\t\t.use(this.session())\n\t\t\t.use(this.authorize())\n\t\t\t.use(this.events());\n\n\t\t// Add telemetry middleware if configured (runs early for span creation)\n\t\tconst telemetryMiddleware = this.telemetry();\n\t\tif (telemetryMiddleware) {\n\t\t\tchain = chain.use(telemetryMiddleware);\n\t\t}\n\n\t\t// Add Telescope middleware if configured (runs first/last in chain)\n\t\tif (this.options.telescope?.middleware) {\n\t\t\tchain = chain.use(this.options.telescope.middleware);\n\t\t}\n\n\t\t// Wrap entire Middy chain in request context for service access\n\t\tconst wrappedHandler = async (event: TEvent, context: Context) => {\n\t\t\tconst startTime = Date.now();\n\t\t\tconst requestId = context.awsRequestId;\n\t\t\tconst logger = this.endpoint.logger.child({ requestId }) as TLogger;\n\n\t\t\t// Cast event to any since Middy middlewares enrich the event with\n\t\t\t// services, logger, session, etc. during the middleware chain execution\n\t\t\treturn runWithRequestContext({ logger, requestId, startTime }, () =>\n\t\t\t\tchain(event as unknown as Parameters<typeof chain>[0], context),\n\t\t\t);\n\t\t};\n\n\t\treturn wrappedHandler as unknown as THandler;\n\t}\n}\n\nexport type Event<\n\tTEvent extends APIGatewayProxyEvent | APIGatewayProxyEventV2,\n\tTInput extends EndpointSchemas = {},\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n> = {\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n\theader: HeaderFn;\n\tcookie: CookieFn;\n\tsession: TSession;\n} & TEvent &\n\tInferComposableStandardSchema<TInput>;\n\ntype Middleware<\n\tTEvent extends APIGatewayProxyEvent | APIGatewayProxyEventV2,\n\tTInput extends EndpointSchemas = {},\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n> = MiddlewareObj<Event<TEvent, TInput, TServices, TLogger, TSession>>;\n\nexport type AmazonApiGatewayEndpointHandlerResponse = {\n\tstatusCode: number;\n\tbody: string | undefined;\n\theaders?: Record<string, string>;\n\tmultiValueHeaders?: Record<string, string[]>;\n};\n\nexport type LoggerContext = {\n\tfn: {\n\t\tname: string;\n\t\tversion: string;\n\t};\n\treq: {\n\t\tid: string | undefined;\n\t\tawsRequestId: string;\n\t\tpath: string;\n\t\tip: string | undefined;\n\t\tuserAgent: string | undefined;\n\t};\n};\n\nexport type GetInputResponse = {\n\tbody: any;\n\tquery: any;\n\tparams: any;\n};\n\nexport type AmazonApiGatewayV1EndpointHandler = (\n\tevent: APIGatewayProxyEvent,\n\tcontext: Context,\n) => Promise<AmazonApiGatewayEndpointHandlerResponse>;\n\nexport type AmazonApiGatewayV2EndpointHandler = (\n\tevent: APIGatewayProxyEventV2,\n\tcontext: Context,\n) => Promise<AmazonApiGatewayEndpointHandlerResponse>;\n\nexport type HandlerEvent<T extends Function> = T extends (\n\tevent: infer E,\n\tcontext: Context,\n) => any\n\t? E\n\t: never;\n"],"mappings":";;;;;;;;;;AAoFA,IAAsB,2BAAtB,MAoBE;CACD,AAAU;CAEV,YACWA,WACSC,UAcnBC,UAA2C,CAAE,GAC5C;EAhBS;EACS;AAgBnB,OAAK,UAAU;CACf;CAED,AAAQ,QAAwD;AAC/D,SAAO,EACN,SAAS,CAAC,QAAQ;AACjB,IAAC,IAAI,MAAM,UAAU,KAAK,SAAS,QAAQ,MAC1C,IAAI,SAAS,CAAE,GACf,2BACA;GACD,MAAM,eAAe,UAAU,IAAI,MAAM;AAGzC,OAAI,WAAW;IACd,Y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,CAAC,CACpB,IAAI,KAAK,SAAS,CAAC,CACnB,IAAI,KAAK,WAAW,CAAC,CACrB,IAAI,KAAK,QAAQ,CAAC;EAGpB,MAAM,sBAAsB,KAAK,WAAW;AAC5C,MAAI,oBACH,SAAQ,MAAM,IAAI,oBAAoB;AAIvC,MAAI,KAAK,QAAQ,WAAW,WAC3B,SAAQ,MAAM,IAAI,KAAK,QAAQ,UAAU,WAAW;EAIrD,MAAM,iBAAiB,OAAOC,OAAeC,YAAqB;GACjE,MAAM,YAAY,KAAK,KAAK;GAC5B,MAAM,YAAY,QAAQ;GAC1B,MAAM,SAAS,KAAK,SAAS,OAAO,MAAM,EAAE,UAAW,EAAC;AAIxD,UAAO,sBAAsB;IAAE;IAAQ;IAAW;GAAW,GAAE,MAC9D,MAAM,OAAiD,QAAQ,CAC/D;EACD;AAED,SAAO;CACP;AACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpMethod } from "./types-B5H3piDg.cjs";
|
|
2
2
|
import { Telemetry } from "./telemetry-BTaiRqPo.cjs";
|
|
3
|
-
import { CookieFn, Endpoint, EndpointSchemas, HeaderFn } from "./Endpoint-
|
|
3
|
+
import { CookieFn, Endpoint, EndpointSchemas, HeaderFn } from "./Endpoint-CGdCGJkC.cjs";
|
|
4
4
|
import { AuditStorage, AuditableAction } from "@geekmidas/audit";
|
|
5
5
|
import { EventPublisher } from "@geekmidas/events";
|
|
6
6
|
import { Logger } from "@geekmidas/logger";
|
|
@@ -121,4 +121,4 @@ type HandlerEvent<T extends Function> = T extends ((event: infer E, context: Con
|
|
|
121
121
|
|
|
122
122
|
//#endregion
|
|
123
123
|
export { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointHandlerResponse, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV1EndpointHandler, AmazonApiGatewayV2EndpointHandler, Event, GetInputResponse, HandlerEvent, LoggerContext, TelescopeIntegration };
|
|
124
|
-
//# sourceMappingURL=AmazonApiGatewayEndpointAdaptor-
|
|
124
|
+
//# sourceMappingURL=AmazonApiGatewayEndpointAdaptor-DqNcQGMf.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonApiGatewayEndpointAdaptor-
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayEndpointAdaptor-DqNcQGMf.d.cts","names":[],"sources":["../src/endpoints/AmazonApiGatewayEndpointAdaptor.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;UAoBiB,oBAAA;EAAA,UAAA,EACJ,aADwB,CAAA,GAAA,EAAA,GAAA,EACA,KADA,EACO,OADP,CAAA;;AAiCrC;;;AA4Ba,UA5BI,+BAAA,CA4BJ;EAAS;AAGtB;;;;;;;;;;;EAUuB,SAAG,CAAA,EA5Bb,oBA4Ba;EAAM;;;;;;;;;;;;;EAuBd,SACf,CAAA,EArCU,SAqCV;;AAEA,uBApCmB,wBAoCnB,CAAA,iBAlCC,iCAkCD,GAjCC,iCAiCD,EAAA,eAhCa,YAgCb,CAhC0B,QAgC1B,CAAA,EAAA,eAAA,MAAA,EAAA,gBA9Bc,UA8Bd,EAAA,eA7Ba,eA6Bb,GAAA,CAAA,CAAA,EAAA,mBA5BiB,gBA4BjB,GAAA,SAAA,GAAA,SAAA,EAAA,kBA3BgB,OA2BhB,EAAA,GAAA,EAAA,EAAA,gBA1Bc,MA0Bd,GA1BuB,MA0BvB,EAAA,WAAA,OAAA,EAAA,wBAxBsB,cAwBtB,CAAA,GAAA,CAAA,GAAA,SAAA,GAAA,SAAA,EAAA,mCAAA,MAAA,GAAA,MAAA,EAAA,sBAtBoB,YAsBpB,GAAA,SAAA,GAAA,SAAA,EAAA,iCAAA,MAAA,GAAA,MAAA,EAAA,qBApBmB,eAoBnB,CAAA,MAAA,EAAA,OAAA,CAAA,GApBsD,eAoBtD,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,CAAA;EAAwB,UACxB,SAAA,EAboB,iBAapB,CAAA,CAAA,CAAA,CAAA;EAA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AF9B,CAAA,GAE0C,CAF1C,UAAA,CAAA,KAAA,EAAA,KAAA,EAAA,EAAA,OAAA,EAIK,OAJL,EAAA,GAAA,GAAA,IAMF,CANE,GAAA,KAAA;AAAO"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpMethod } from "./types-aFmq5cKh.mjs";
|
|
2
2
|
import { Telemetry } from "./telemetry-C-kNOW3C.mjs";
|
|
3
|
-
import { CookieFn, Endpoint, EndpointSchemas, HeaderFn } from "./Endpoint-
|
|
3
|
+
import { CookieFn, Endpoint, EndpointSchemas, HeaderFn } from "./Endpoint-DtFQFL63.mjs";
|
|
4
4
|
import { MiddlewareObj } from "@middy/core";
|
|
5
5
|
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
6
6
|
import { AuditStorage, AuditableAction } from "@geekmidas/audit";
|
|
@@ -121,4 +121,4 @@ type HandlerEvent<T extends Function> = T extends ((event: infer E, context: Con
|
|
|
121
121
|
|
|
122
122
|
//#endregion
|
|
123
123
|
export { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointHandlerResponse, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV1EndpointHandler, AmazonApiGatewayV2EndpointHandler, Event, GetInputResponse, HandlerEvent, LoggerContext, TelescopeIntegration };
|
|
124
|
-
//# sourceMappingURL=AmazonApiGatewayEndpointAdaptor-
|
|
124
|
+
//# sourceMappingURL=AmazonApiGatewayEndpointAdaptor-Hi8Pbp2d.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonApiGatewayEndpointAdaptor-
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayEndpointAdaptor-Hi8Pbp2d.d.mts","names":[],"sources":["../src/endpoints/AmazonApiGatewayEndpointAdaptor.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;UAoBiB,oBAAA;EAAA,UAAA,EACJ,aADwB,CAAA,GAAA,EAAA,GAAA,EACA,KADA,EACO,OADP,CAAA;;AAiCr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AA,MAAA;EAAQ,IACP,EAAA,MAAA,GAAA,SAAA;EAAQ,OACd,CAAA,EAcO,MAdP,CAAA,MAAA,EAAA,MAAA,CAAA;EAAM,iBACqB,CAAA,EAcV,MAdU,CAAA,MAAA,EAAA,MAAA,EAAA,CAAA;CAAM;AAAP,KAiBlB,aAAA,GAjBkB;EAUlB,EAAA,EAAA;IAAuC,IAAA,EAAA,MAAA;IAGxC,OAAA,EAAA,MAAA;EAAM,CAAA;EACU,GAAA,EAAA;IAGf,EAAA,EAAA,MAAA,GAAa,SAAA;IAcb,YAAA,EAAA,MAAgB;IAMhB,IAAA,EAAA,MAAA;IAAiC,EAAA,EAAA,MAAA,GAAA,SAAA;IACrC,SAAA,EAAA,MAAA,GAAA,SAAA;EAAoB,CAAA;CACX;AACZ,KATO,gBAAA,GASP;EAAO,IAAA,EAAA,GAAA;EAEA,KAAA,EAAA,GAAA;EAAiC,MAAA,EAAA,GAAA;CAAA;AAEnC,KAPE,iCAAA,GAOF,CAAA,KAAA,EANF,oBAME,EAAA,OAAA,EALA,OAKA,EAAA,GAJL,OAIK,CAJG,uCAIH,CAAA;AACG,KAHD,iCAAA,GAGC,CAAA,KAAA,EAFL,sBAEK,EAAA,OAAA,EADH,OACG,EAAA,GAAR,OAAQ,CAAA,uCAAA,CAAA;AAAR,KAEO,YAFP,CAAA,UAE8B,QAF9B,CAAA,GAE0C,CAF1C,UAAA,CAAA,KAAA,EAAA,KAAA,EAAA,EAAA,OAAA,EAIK,OAJL,EAAA,GAAA,GAAA,IAMF,CANE,GAAA,KAAA;AAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AmazonApiGatewayEndpoint } from "./AmazonApiGatewayEndpointAdaptor-
|
|
1
|
+
import { AmazonApiGatewayEndpoint } from "./AmazonApiGatewayEndpointAdaptor-BpYtYCeW.mjs";
|
|
2
2
|
import { parseQueryParams } from "./parseQueryParams-DS3Qmrbd.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts
|
|
@@ -39,4 +39,4 @@ var AmazonApiGatewayV1Endpoint = class extends AmazonApiGatewayEndpoint {
|
|
|
39
39
|
|
|
40
40
|
//#endregion
|
|
41
41
|
export { AmazonApiGatewayV1Endpoint };
|
|
42
|
-
//# sourceMappingURL=AmazonApiGatewayV1EndpointAdaptor-
|
|
42
|
+
//# sourceMappingURL=AmazonApiGatewayV1EndpointAdaptor-CRwyWT6t.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonApiGatewayV1EndpointAdaptor-
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayV1EndpointAdaptor-CRwyWT6t.mjs","names":["e: APIGatewayProxyEvent","mergedParams: Record<string, string | string[]>","data: APIGatewayProxyEvent","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEvent, Context } from 'aws-lambda';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV1EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { Endpoint, EndpointSchemas } from './Endpoint';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV1Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV1EndpointHandler,\n\tAPIGatewayProxyEvent,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getInput(e: APIGatewayProxyEvent): GetInputResponse {\n\t\t// For arrays, AWS API Gateway V1 provides multiValueQueryStringParameters\n\t\tconst multiValueParams = e.multiValueQueryStringParameters || {};\n\t\tconst singleValueParams = e.queryStringParameters || {};\n\n\t\t// Merge single and multi-value parameters\n\t\tconst mergedParams: Record<string, string | string[]> = {};\n\n\t\t// Add single value parameters\n\t\tfor (const [key, value] of Object.entries(singleValueParams)) {\n\t\t\tif (value !== undefined) {\n\t\t\t\tmergedParams[key] = value;\n\t\t\t}\n\t\t}\n\n\t\t// Override with multi-value parameters where applicable\n\t\tfor (const [key, values] of Object.entries(multiValueParams)) {\n\t\t\tif (values && values.length > 1) {\n\t\t\t\tmergedParams[key] = values;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tbody: AmazonApiGatewayEndpoint.decodeBody(\n\t\t\t\te.body,\n\t\t\t\te.isBase64Encoded,\n\t\t\t\te.headers?.['Content-Type'] ?? e.headers?.['content-type'],\n\t\t\t),\n\t\t\tquery: parseQueryParams(mergedParams),\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tdata: APIGatewayProxyEvent,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: data.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: data.requestContext.identity.sourceIp,\n\t\t\t\tuserAgent: data.requestContext.identity.userAgent || undefined,\n\t\t\t\tpath: data.requestContext.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n"],"mappings":";;;;AAiBA,IAAa,6BAAb,cASU,yBAWR;CACD,AAAS,SAASA,GAA2C;EAE5D,MAAM,mBAAmB,EAAE,mCAAmC,CAAE;EAChE,MAAM,oBAAoB,EAAE,yBAAyB,CAAE;EAGvD,MAAMC,eAAkD,CAAE;AAG1D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,kBAAkB,CAC3D,KAAI,iBACH,cAAa,OAAO;AAKtB,OAAK,MAAM,CAAC,KAAK,OAAO,IAAI,OAAO,QAAQ,iBAAiB,CAC3D,KAAI,UAAU,OAAO,SAAS,EAC7B,cAAa,OAAO;AAItB,SAAO;GACN,MAAM,yBAAyB,WAC9B,EAAE,MACF,EAAE,iBACF,EAAE,UAAU,mBAAmB,EAAE,UAAU,gBAC3C;GACD,OAAO,iBAAiB,aAAa;GACrC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,MACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,KAAK,eAAe;IACxB,cAAc,QAAQ;IACtB,IAAI,KAAK,eAAe,SAAS;IACjC,WAAW,KAAK,eAAe,SAAS;IACxC,MAAM,KAAK,eAAe;GAC1B;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_AmazonApiGatewayEndpointAdaptor = require('./AmazonApiGatewayEndpointAdaptor-
|
|
1
|
+
const require_AmazonApiGatewayEndpointAdaptor = require('./AmazonApiGatewayEndpointAdaptor-BIltcbAc.cjs');
|
|
2
2
|
const require_parseQueryParams = require('./parseQueryParams-B4RK1za3.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts
|
|
@@ -44,4 +44,4 @@ Object.defineProperty(exports, 'AmazonApiGatewayV1Endpoint', {
|
|
|
44
44
|
return AmazonApiGatewayV1Endpoint;
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
//# sourceMappingURL=AmazonApiGatewayV1EndpointAdaptor-
|
|
47
|
+
//# sourceMappingURL=AmazonApiGatewayV1EndpointAdaptor-DEETT6Wj.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonApiGatewayV1EndpointAdaptor-
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayV1EndpointAdaptor-DEETT6Wj.cjs","names":["AmazonApiGatewayEndpoint","e: APIGatewayProxyEvent","mergedParams: Record<string, string | string[]>","data: APIGatewayProxyEvent","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEvent, Context } from 'aws-lambda';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV1EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { Endpoint, EndpointSchemas } from './Endpoint';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV1Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV1EndpointHandler,\n\tAPIGatewayProxyEvent,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getInput(e: APIGatewayProxyEvent): GetInputResponse {\n\t\t// For arrays, AWS API Gateway V1 provides multiValueQueryStringParameters\n\t\tconst multiValueParams = e.multiValueQueryStringParameters || {};\n\t\tconst singleValueParams = e.queryStringParameters || {};\n\n\t\t// Merge single and multi-value parameters\n\t\tconst mergedParams: Record<string, string | string[]> = {};\n\n\t\t// Add single value parameters\n\t\tfor (const [key, value] of Object.entries(singleValueParams)) {\n\t\t\tif (value !== undefined) {\n\t\t\t\tmergedParams[key] = value;\n\t\t\t}\n\t\t}\n\n\t\t// Override with multi-value parameters where applicable\n\t\tfor (const [key, values] of Object.entries(multiValueParams)) {\n\t\t\tif (values && values.length > 1) {\n\t\t\t\tmergedParams[key] = values;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tbody: AmazonApiGatewayEndpoint.decodeBody(\n\t\t\t\te.body,\n\t\t\t\te.isBase64Encoded,\n\t\t\t\te.headers?.['Content-Type'] ?? e.headers?.['content-type'],\n\t\t\t),\n\t\t\tquery: parseQueryParams(mergedParams),\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tdata: APIGatewayProxyEvent,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: data.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: data.requestContext.identity.sourceIp,\n\t\t\t\tuserAgent: data.requestContext.identity.userAgent || undefined,\n\t\t\t\tpath: data.requestContext.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n"],"mappings":";;;;AAiBA,IAAa,6BAAb,cASUA,iEAWR;CACD,AAAS,SAASC,GAA2C;EAE5D,MAAM,mBAAmB,EAAE,mCAAmC,CAAE;EAChE,MAAM,oBAAoB,EAAE,yBAAyB,CAAE;EAGvD,MAAMC,eAAkD,CAAE;AAG1D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,kBAAkB,CAC3D,KAAI,iBACH,cAAa,OAAO;AAKtB,OAAK,MAAM,CAAC,KAAK,OAAO,IAAI,OAAO,QAAQ,iBAAiB,CAC3D,KAAI,UAAU,OAAO,SAAS,EAC7B,cAAa,OAAO;AAItB,SAAO;GACN,MAAM,iEAAyB,WAC9B,EAAE,MACF,EAAE,iBACF,EAAE,UAAU,mBAAmB,EAAE,UAAU,gBAC3C;GACD,OAAO,0CAAiB,aAAa;GACrC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,MACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,KAAK,eAAe;IACxB,cAAc,QAAQ;IACtB,IAAI,KAAK,eAAe,SAAS;IACjC,WAAW,KAAK,eAAe,SAAS;IACxC,MAAM,KAAK,eAAe;GAC1B;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpMethod } from "./types-B5H3piDg.cjs";
|
|
2
|
-
import { Endpoint, EndpointSchemas } from "./Endpoint-
|
|
3
|
-
import { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV1EndpointHandler, GetInputResponse, LoggerContext } from "./AmazonApiGatewayEndpointAdaptor-
|
|
2
|
+
import { Endpoint, EndpointSchemas } from "./Endpoint-CGdCGJkC.cjs";
|
|
3
|
+
import { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV1EndpointHandler, GetInputResponse, LoggerContext } from "./AmazonApiGatewayEndpointAdaptor-DqNcQGMf.cjs";
|
|
4
4
|
import { EventPublisher } from "@geekmidas/events";
|
|
5
5
|
import { Logger } from "@geekmidas/logger";
|
|
6
6
|
import { Service } from "@geekmidas/services";
|
|
@@ -20,4 +20,4 @@ declare class AmazonApiGatewayV1Endpoint<TRoute extends string, TMethod extends
|
|
|
20
20
|
|
|
21
21
|
//#endregion
|
|
22
22
|
export { AmazonApiGatewayV1Endpoint };
|
|
23
|
-
//# sourceMappingURL=AmazonApiGatewayV1EndpointAdaptor-
|
|
23
|
+
//# sourceMappingURL=AmazonApiGatewayV1EndpointAdaptor-DcN2fYsv.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonApiGatewayV1EndpointAdaptor-
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayV1EndpointAdaptor-DcN2fYsv.d.cts","names":[],"sources":["../src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cAiBa,kEAEI,2BACD,yCACI,4DACD,gCACF,SAAS,oDAED,qDACf,yBACT,mCACA,sBACA,QACA,SACA,QACA,YACA,WACA,SACA,UACA;uBAqD+B;EAxEnB,mBAAA,QAAA,EAyE2B,QAzED,CA0EpC,MA1EoC,EA2EpC,OA3EoC,EA4EpC,MA5EoC,EA6EpC,UA7EoC,EA8EpC,SA9EoC,EA+EpC,OA/EoC,EAgFpC,QAhFoC,EAiFpC,eAjFoC,CAAA;EAAA,QAAA,CAAA,CAAA,EAqBjB,oBArBiB,CAAA,EAqBM,gBArBN;EAAA,gBAEtB,CAAA,IAAA,EAoDT,oBApDS,EAAA,OAAA,EAqDN,OArDM,CAAA,EAsDb,aAtDa;EAAU,WACX,CAAA,SAAA,EAqEgB,iBArEhB,CAAA,CAAA,CAAA,CAAA,EAAA,QAAA,EAsEwB,QAtExB,CAuEb,MAvEa,EAwEb,OAxEa,EAyEb,MAzEa,EA0Eb,UA1Ea,EA2Eb,SA3Ea,EA4Eb,OA5Ea,EA6Eb,QA7Ea,EA8Eb,eA9Ea,CAAA,EAAA,OAAA,CAAA,EAgFL,+BAhFK"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpMethod } from "./types-aFmq5cKh.mjs";
|
|
2
|
-
import { Endpoint, EndpointSchemas } from "./Endpoint-
|
|
3
|
-
import { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV1EndpointHandler, GetInputResponse, LoggerContext } from "./AmazonApiGatewayEndpointAdaptor-
|
|
2
|
+
import { Endpoint, EndpointSchemas } from "./Endpoint-DtFQFL63.mjs";
|
|
3
|
+
import { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV1EndpointHandler, GetInputResponse, LoggerContext } from "./AmazonApiGatewayEndpointAdaptor-Hi8Pbp2d.mjs";
|
|
4
4
|
import { Service } from "@geekmidas/services";
|
|
5
5
|
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
6
6
|
import { EventPublisher } from "@geekmidas/events";
|
|
@@ -20,4 +20,4 @@ declare class AmazonApiGatewayV1Endpoint<TRoute extends string, TMethod extends
|
|
|
20
20
|
|
|
21
21
|
//#endregion
|
|
22
22
|
export { AmazonApiGatewayV1Endpoint };
|
|
23
|
-
//# sourceMappingURL=AmazonApiGatewayV1EndpointAdaptor-
|
|
23
|
+
//# sourceMappingURL=AmazonApiGatewayV1EndpointAdaptor-cpwJzU4W.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonApiGatewayV1EndpointAdaptor-
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayV1EndpointAdaptor-cpwJzU4W.d.mts","names":[],"sources":["../src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cAiBa,kEAEI,2BACD,yCACI,4DACD,gCACF,SAAS,oDAED,qDACf,yBACT,mCACA,sBACA,QACA,SACA,QACA,YACA,WACA,SACA,UACA;uBAqD+B;EAxEnB,mBAAA,QAAA,EAyE2B,QAzED,CA0EpC,MA1EoC,EA2EpC,OA3EoC,EA4EpC,MA5EoC,EA6EpC,UA7EoC,EA8EpC,SA9EoC,EA+EpC,OA/EoC,EAgFpC,QAhFoC,EAiFpC,eAjFoC,CAAA;EAAA,QAAA,CAAA,CAAA,EAqBjB,oBArBiB,CAAA,EAqBM,gBArBN;EAAA,gBAEtB,CAAA,IAAA,EAoDT,oBApDS,EAAA,OAAA,EAqDN,OArDM,CAAA,EAsDb,aAtDa;EAAU,WACX,CAAA,SAAA,EAqEgB,iBArEhB,CAAA,CAAA,CAAA,CAAA,EAAA,QAAA,EAsEwB,QAtExB,CAuEb,MAvEa,EAwEb,OAxEa,EAyEb,MAzEa,EA0Eb,UA1Ea,EA2Eb,SA3Ea,EA4Eb,OA5Ea,EA6Eb,QA7Ea,EA8Eb,eA9Ea,CAAA,EAAA,OAAA,CAAA,EAgFL,+BAhFK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_AmazonApiGatewayEndpointAdaptor = require('./AmazonApiGatewayEndpointAdaptor-
|
|
2
|
+
const require_AmazonApiGatewayEndpointAdaptor = require('./AmazonApiGatewayEndpointAdaptor-BIltcbAc.cjs');
|
|
3
3
|
const require_lazyAccessors = require('./lazyAccessors-BVEtB9lU.cjs');
|
|
4
4
|
const qs = require_chunk.__toESM(require("qs"));
|
|
5
5
|
|
|
@@ -45,4 +45,4 @@ Object.defineProperty(exports, 'AmazonApiGatewayV2Endpoint', {
|
|
|
45
45
|
return AmazonApiGatewayV2Endpoint;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
//# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-
|
|
48
|
+
//# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-C2qO8FN6.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-C2qO8FN6.cjs","names":["AmazonApiGatewayEndpoint","e: APIGatewayProxyEventV2","event: APIGatewayProxyEventV2","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEventV2, Context } from 'aws-lambda';\nimport qs from 'qs';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV2EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { CookieFn, Endpoint, EndpointSchemas } from './Endpoint';\nimport { createApiGatewayCookies } from './lazyAccessors';\n\nexport class AmazonApiGatewayV2Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV2EndpointHandler,\n\tAPIGatewayProxyEventV2,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getCookies(e: APIGatewayProxyEventV2): CookieFn {\n\t\treturn createApiGatewayCookies(\n\t\t\te.cookies,\n\t\t\t(e.headers as Record<string, string>)?.cookie,\n\t\t);\n\t}\n\n\toverride getInput(e: APIGatewayProxyEventV2): GetInputResponse {\n\t\tconst raw = AmazonApiGatewayEndpoint.decodeBody(\n\t\t\te.body,\n\t\t\te.isBase64Encoded,\n\t\t\te.headers?.['content-type'],\n\t\t);\n\n\t\treturn {\n\t\t\tbody: raw,\n\t\t\tquery: qs.parse(e.rawQueryString) as Record<string, any>,\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tevent: APIGatewayProxyEventV2,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: event.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: event.requestContext.http.sourceIp,\n\t\t\t\tuserAgent: event.requestContext.http.userAgent || undefined,\n\t\t\t\tpath: event.requestContext.http.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n\n// Re-export options type for convenience\nexport type { AmazonApiGatewayEndpointOptions };\n"],"mappings":";;;;;;AAkBA,IAAa,6BAAb,cASUA,iEAWR;CACD,AAAS,WAAWC,GAAqC;AACxD,SAAO,8CACN,EAAE,SACD,EAAE,SAAoC,OACvC;CACD;CAED,AAAS,SAASA,GAA6C;EAC9D,MAAM,MAAM,iEAAyB,WACpC,EAAE,MACF,EAAE,iBACF,EAAE,UAAU,gBACZ;AAED,SAAO;GACN,MAAM;GACN,OAAO,WAAG,MAAM,EAAE,eAAe;GACjC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,OACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,MAAM,eAAe;IACzB,cAAc,QAAQ;IACtB,IAAI,MAAM,eAAe,KAAK;IAC9B,WAAW,MAAM,eAAe,KAAK;IACrC,MAAM,MAAM,eAAe,KAAK;GAChC;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpMethod } from "./types-B5H3piDg.cjs";
|
|
2
|
-
import { CookieFn, Endpoint, EndpointSchemas } from "./Endpoint-
|
|
3
|
-
import { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV2EndpointHandler, GetInputResponse, LoggerContext } from "./AmazonApiGatewayEndpointAdaptor-
|
|
2
|
+
import { CookieFn, Endpoint, EndpointSchemas } from "./Endpoint-CGdCGJkC.cjs";
|
|
3
|
+
import { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV2EndpointHandler, GetInputResponse, LoggerContext } from "./AmazonApiGatewayEndpointAdaptor-DqNcQGMf.cjs";
|
|
4
4
|
import { EventPublisher } from "@geekmidas/events";
|
|
5
5
|
import { Logger } from "@geekmidas/logger";
|
|
6
6
|
import { Service } from "@geekmidas/services";
|
|
@@ -19,4 +19,4 @@ declare class AmazonApiGatewayV2Endpoint<TRoute extends string, TMethod extends
|
|
|
19
19
|
}
|
|
20
20
|
//#endregion
|
|
21
21
|
export { AmazonApiGatewayV2Endpoint };
|
|
22
|
-
//# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-
|
|
22
|
+
//# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-Cn9UoRgB.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-Cn9UoRgB.d.cts","names":[],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cAkBa,kEAEI,2BACD,yCACI,4DACD,gCACF,SAAS,oDAED,qDACf,yBACT,mCACA,wBACA,QACA,SACA,QACA,YACA,WACA,SACA,UACA;uBAyC+B;EA5DnB,mBAAA,QAAA,EA6D2B,QA7DD,CA8DpC,MA9DoC,EA+DpC,OA/DoC,EAgEpC,MAhEoC,EAiEpC,UAjEoC,EAkEpC,SAlEoC,EAmEpC,OAnEoC,EAoEpC,QApEoC,EAqEpC,eArEoC,CAAA;EAAA,UAAA,CAAA,CAAA,EAqBf,sBArBe,CAAA,EAqBU,QArBV;EAAA,QAEtB,CAAA,CAAA,EA0BK,sBA1BL,CAAA,EA0B8B,gBA1B9B;EAAU,gBACX,CAAA,KAAA,EAuCP,sBAvCO,EAAA,OAAA,EAwCL,OAxCK,CAAA,EAyCZ,aAzCY;EAAe,WACX,CAAA,SAAA,EAwDY,iBAxDZ,CAAA,CAAA,CAAA,CAAA,EAAA,QAAA,EAyDoB,QAzDpB,CA0DjB,MA1DiB,EA2DjB,OA3DiB,EA4DjB,MA5DiB,EA6DjB,UA7DiB,EA8DjB,SA9DiB,EA+DjB,OA/DiB,EAgEjB,QAhEiB,EAiEjB,eAjEiB,CAAA,EAAA,OAAA,CAAA,EAmET,+BAnES"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpMethod } from "./types-aFmq5cKh.mjs";
|
|
2
|
-
import { CookieFn, Endpoint, EndpointSchemas } from "./Endpoint-
|
|
3
|
-
import { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV2EndpointHandler, GetInputResponse, LoggerContext } from "./AmazonApiGatewayEndpointAdaptor-
|
|
2
|
+
import { CookieFn, Endpoint, EndpointSchemas } from "./Endpoint-DtFQFL63.mjs";
|
|
3
|
+
import { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV2EndpointHandler, GetInputResponse, LoggerContext } from "./AmazonApiGatewayEndpointAdaptor-Hi8Pbp2d.mjs";
|
|
4
4
|
import { Service } from "@geekmidas/services";
|
|
5
5
|
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
6
6
|
import { EventPublisher } from "@geekmidas/events";
|
|
@@ -19,4 +19,4 @@ declare class AmazonApiGatewayV2Endpoint<TRoute extends string, TMethod extends
|
|
|
19
19
|
}
|
|
20
20
|
//#endregion
|
|
21
21
|
export { AmazonApiGatewayV2Endpoint };
|
|
22
|
-
//# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-
|
|
22
|
+
//# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-LzH3hkB-.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-LzH3hkB-.d.mts","names":[],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cAkBa,kEAEI,2BACD,yCACI,4DACD,gCACF,SAAS,oDAED,qDACf,yBACT,mCACA,wBACA,QACA,SACA,QACA,YACA,WACA,SACA,UACA;uBAyC+B;EA5DnB,mBAAA,QAAA,EA6D2B,QA7DD,CA8DpC,MA9DoC,EA+DpC,OA/DoC,EAgEpC,MAhEoC,EAiEpC,UAjEoC,EAkEpC,SAlEoC,EAmEpC,OAnEoC,EAoEpC,QApEoC,EAqEpC,eArEoC,CAAA;EAAA,UAAA,CAAA,CAAA,EAqBf,sBArBe,CAAA,EAqBU,QArBV;EAAA,QAEtB,CAAA,CAAA,EA0BK,sBA1BL,CAAA,EA0B8B,gBA1B9B;EAAU,gBACX,CAAA,KAAA,EAuCP,sBAvCO,EAAA,OAAA,EAwCL,OAxCK,CAAA,EAyCZ,aAzCY;EAAe,WACX,CAAA,SAAA,EAwDY,iBAxDZ,CAAA,CAAA,CAAA,CAAA,EAAA,QAAA,EAyDoB,QAzDpB,CA0DjB,MA1DiB,EA2DjB,OA3DiB,EA4DjB,MA5DiB,EA6DjB,UA7DiB,EA8DjB,SA9DiB,EA+DjB,OA/DiB,EAgEjB,QAhEiB,EAiEjB,eAjEiB,CAAA,EAAA,OAAA,CAAA,EAmET,+BAnES"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AmazonApiGatewayEndpoint } from "./AmazonApiGatewayEndpointAdaptor-
|
|
1
|
+
import { AmazonApiGatewayEndpoint } from "./AmazonApiGatewayEndpointAdaptor-BpYtYCeW.mjs";
|
|
2
2
|
import { createApiGatewayCookies } from "./lazyAccessors-DM6HcXQk.mjs";
|
|
3
3
|
import qs from "qs";
|
|
4
4
|
|
|
@@ -39,4 +39,4 @@ var AmazonApiGatewayV2Endpoint = class extends AmazonApiGatewayEndpoint {
|
|
|
39
39
|
|
|
40
40
|
//#endregion
|
|
41
41
|
export { AmazonApiGatewayV2Endpoint };
|
|
42
|
-
//# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-
|
|
42
|
+
//# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-m9YKI294.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-m9YKI294.mjs","names":["e: APIGatewayProxyEventV2","event: APIGatewayProxyEventV2","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEventV2, Context } from 'aws-lambda';\nimport qs from 'qs';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV2EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { CookieFn, Endpoint, EndpointSchemas } from './Endpoint';\nimport { createApiGatewayCookies } from './lazyAccessors';\n\nexport class AmazonApiGatewayV2Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV2EndpointHandler,\n\tAPIGatewayProxyEventV2,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getCookies(e: APIGatewayProxyEventV2): CookieFn {\n\t\treturn createApiGatewayCookies(\n\t\t\te.cookies,\n\t\t\t(e.headers as Record<string, string>)?.cookie,\n\t\t);\n\t}\n\n\toverride getInput(e: APIGatewayProxyEventV2): GetInputResponse {\n\t\tconst raw = AmazonApiGatewayEndpoint.decodeBody(\n\t\t\te.body,\n\t\t\te.isBase64Encoded,\n\t\t\te.headers?.['content-type'],\n\t\t);\n\n\t\treturn {\n\t\t\tbody: raw,\n\t\t\tquery: qs.parse(e.rawQueryString) as Record<string, any>,\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tevent: APIGatewayProxyEventV2,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: event.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: event.requestContext.http.sourceIp,\n\t\t\t\tuserAgent: event.requestContext.http.userAgent || undefined,\n\t\t\t\tpath: event.requestContext.http.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n\n// Re-export options type for convenience\nexport type { AmazonApiGatewayEndpointOptions };\n"],"mappings":";;;;;AAkBA,IAAa,6BAAb,cASU,yBAWR;CACD,AAAS,WAAWA,GAAqC;AACxD,SAAO,wBACN,EAAE,SACD,EAAE,SAAoC,OACvC;CACD;CAED,AAAS,SAASA,GAA6C;EAC9D,MAAM,MAAM,yBAAyB,WACpC,EAAE,MACF,EAAE,iBACF,EAAE,UAAU,gBACZ;AAED,SAAO;GACN,MAAM;GACN,OAAO,GAAG,MAAM,EAAE,eAAe;GACjC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,OACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,MAAM,eAAe;IACzB,cAAc,QAAQ;IACtB,IAAI,MAAM,eAAe,KAAK;IAC9B,WAAW,MAAM,eAAe,KAAK;IACrC,MAAM,MAAM,eAAe,KAAK;GAChC;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
|