@geekmidas/constructs 0.0.22 → 0.2.0
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/README.md +90 -0
- package/dist/{AWSLambdaFunction-qWpalqfr.d.mts → AWSLambdaFunction-D9RZhm0N.d.mts} +3 -3
- package/dist/{AWSLambdaSubscriberAdaptor-CWbBNRz3.d.mts → AWSLambdaSubscriberAdaptor-C0aZBU64.d.mts} +2 -2
- package/dist/{AmazonApiGatewayEndpointAdaptor-DXssXsJi.cjs → AmazonApiGatewayEndpointAdaptor-Bk6ssx3K.cjs} +40 -27
- package/dist/AmazonApiGatewayEndpointAdaptor-Bk6ssx3K.cjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-Da9BR5On.d.cts → AmazonApiGatewayEndpointAdaptor-CbJqLU6I.d.cts} +2 -2
- package/dist/{AmazonApiGatewayEndpointAdaptor-BQ0IJdaI.d.mts → AmazonApiGatewayEndpointAdaptor-DC3N7zY_.d.mts} +3 -3
- package/dist/{AmazonApiGatewayEndpointAdaptor-CacGag6F.mjs → AmazonApiGatewayEndpointAdaptor-pEWzF2uY.mjs} +40 -27
- package/dist/AmazonApiGatewayEndpointAdaptor-pEWzF2uY.mjs.map +1 -0
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-C4_AZ1ek.d.mts → AmazonApiGatewayV1EndpointAdaptor-BVxgQ-7J.d.mts} +4 -4
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-CSm3NsWz.d.cts → AmazonApiGatewayV1EndpointAdaptor-CVwJ5k16.d.cts} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-BpnG55R7.mjs → AmazonApiGatewayV1EndpointAdaptor-MJpRbIaQ.mjs} +2 -2
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-BpnG55R7.mjs.map → AmazonApiGatewayV1EndpointAdaptor-MJpRbIaQ.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-Df4kszio.cjs → AmazonApiGatewayV1EndpointAdaptor-uBp_4zLf.cjs} +2 -2
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-Df4kszio.cjs.map → AmazonApiGatewayV1EndpointAdaptor-uBp_4zLf.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-6hsBFVLf.d.cts → AmazonApiGatewayV2EndpointAdaptor-1oBZdQH3.d.cts} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DdM8Tr1X.d.mts → AmazonApiGatewayV2EndpointAdaptor-C3H8Hpv7.d.mts} +4 -4
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-ZORzMEET.mjs → AmazonApiGatewayV2EndpointAdaptor-ChO8BlDz.mjs} +2 -2
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-ZORzMEET.mjs.map → AmazonApiGatewayV2EndpointAdaptor-ChO8BlDz.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-5SIvqPby.cjs → AmazonApiGatewayV2EndpointAdaptor-I1W23Nvn.cjs} +2 -2
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-5SIvqPby.cjs.map → AmazonApiGatewayV2EndpointAdaptor-I1W23Nvn.cjs.map} +1 -1
- package/dist/Authorizer-C0ge_tc8.cjs +92 -0
- package/dist/Authorizer-C0ge_tc8.cjs.map +1 -0
- package/dist/Authorizer-CpSUMTIs.d.cts +125 -0
- package/dist/Authorizer-Cpx59w_q.d.mts +125 -0
- package/dist/Authorizer-r9U3y_ms.mjs +68 -0
- package/dist/Authorizer-r9U3y_ms.mjs.map +1 -0
- package/dist/{BaseFunctionBuilder-Ct6zY6Jq.d.mts → BaseFunctionBuilder-CoV7J45W.d.mts} +2 -2
- package/dist/{Construct-DDR0295I.d.mts → Construct-jBKqb-Zi.d.mts} +1 -1
- package/dist/Construct.d.mts +1 -1
- package/dist/{Cron-DnMRWPFR.d.mts → Cron-JZkp_fHy.d.mts} +2 -2
- package/dist/{CronBuilder-RLDitFmP.d.mts → CronBuilder-BmFDO0Dm.d.mts} +4 -4
- package/dist/{Endpoint-DbPsw13b.mjs → Endpoint-B70_KKhu.mjs} +8 -2
- package/dist/Endpoint-B70_KKhu.mjs.map +1 -0
- package/dist/{Endpoint-CA-byrDr.cjs → Endpoint-BJo9Hhwm.cjs} +8 -2
- package/dist/Endpoint-BJo9Hhwm.cjs.map +1 -0
- package/dist/{Endpoint-PtQ-wLIS.d.mts → Endpoint-C5djXyae.d.mts} +69 -6
- package/dist/{Endpoint-D2Imgihs.d.cts → Endpoint-CC2RGjkl.d.cts} +67 -4
- package/dist/{EndpointBuilder-BPHpUekp.d.mts → EndpointBuilder-CD8LkBda.d.mts} +43 -5
- package/dist/{EndpointBuilder-CYkeYpsL.cjs → EndpointBuilder-DeswNQdG.cjs} +69 -4
- package/dist/EndpointBuilder-DeswNQdG.cjs.map +1 -0
- package/dist/{EndpointBuilder-W5fdXxYQ.mjs → EndpointBuilder-FyyoFTJ5.mjs} +69 -4
- package/dist/EndpointBuilder-FyyoFTJ5.mjs.map +1 -0
- package/dist/{EndpointBuilder-TApJQhtG.d.cts → EndpointBuilder-vXk6eIJk.d.cts} +41 -3
- package/dist/{EndpointFactory-CNlfBDuD.d.mts → EndpointFactory-3g-7Rznt.d.cts} +68 -21
- package/dist/{EndpointFactory-B5fOINuc.d.cts → EndpointFactory-DaFR9LQG.d.mts} +68 -21
- package/dist/{EndpointFactory-D5lFZXqY.cjs → EndpointFactory-DcT_g9M_.cjs} +117 -14
- package/dist/EndpointFactory-DcT_g9M_.cjs.map +1 -0
- package/dist/{EndpointFactory-B27nfeiE.mjs → EndpointFactory-KJAjBWmO.mjs} +117 -14
- package/dist/EndpointFactory-KJAjBWmO.mjs.map +1 -0
- package/dist/{Function-CD3rXWfa.d.mts → Function-Vh1t-Qjj.d.mts} +2 -2
- package/dist/{FunctionBuilder-j2VkwuGf.d.mts → FunctionBuilder-3jsoFffg.d.mts} +4 -4
- package/dist/{FunctionExecutionWrapper-B0WP-Vec.d.mts → FunctionExecutionWrapper-CI3CaoCo.d.mts} +2 -2
- package/dist/{HonoEndpointAdaptor-CLOpobdq.d.cts → HonoEndpointAdaptor-BJh4J-J9.d.cts} +4 -4
- package/dist/{HonoEndpointAdaptor-Bg_vTyA5.mjs → HonoEndpointAdaptor-CcvXzoYV.mjs} +43 -30
- package/dist/HonoEndpointAdaptor-CcvXzoYV.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-B_gJPWGD.cjs → HonoEndpointAdaptor-DodwLM0-.cjs} +43 -30
- package/dist/HonoEndpointAdaptor-DodwLM0-.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-C9gYYBWu.d.mts → HonoEndpointAdaptor-kb1ByjUL.d.mts} +5 -5
- package/dist/{Subscriber-D-FPWts6.cjs → Subscriber-DOt3svUC.cjs} +1 -1
- package/dist/{Subscriber-D-FPWts6.cjs.map → Subscriber-DOt3svUC.cjs.map} +1 -1
- package/dist/{Subscriber-itwm7ugy.d.mts → Subscriber-aNr1qkxR.d.mts} +2 -2
- package/dist/{Subscriber-CGb8LjZa.mjs → Subscriber-kCHbH2fZ.mjs} +1 -1
- package/dist/{Subscriber-CGb8LjZa.mjs.map → Subscriber-kCHbH2fZ.mjs.map} +1 -1
- package/dist/{SubscriberBuilder-9j3JCu8-.d.mts → SubscriberBuilder-CWS4tdbp.d.mts} +2 -2
- package/dist/{SubscriberBuilder-BfE2cL1q.cjs → SubscriberBuilder-Cj2u9k5Q.cjs} +2 -2
- package/dist/{SubscriberBuilder-BfE2cL1q.cjs.map → SubscriberBuilder-Cj2u9k5Q.cjs.map} +1 -1
- package/dist/{SubscriberBuilder-BcAspHv9.mjs → SubscriberBuilder-DmxMU89X.mjs} +2 -2
- package/dist/{SubscriberBuilder-BcAspHv9.mjs.map → SubscriberBuilder-DmxMU89X.mjs.map} +1 -1
- package/dist/{TestEndpointAdaptor-JONQJeXc.mjs → TestEndpointAdaptor-1pPixE6y.mjs} +4 -4
- package/dist/{TestEndpointAdaptor-JONQJeXc.mjs.map → TestEndpointAdaptor-1pPixE6y.mjs.map} +1 -1
- package/dist/{TestEndpointAdaptor-C-c8v7VI.d.mts → TestEndpointAdaptor-5-unBV8O.d.mts} +3 -3
- package/dist/{TestEndpointAdaptor-BYCwwiYk.d.cts → TestEndpointAdaptor-Bm0UjDtV.d.cts} +2 -2
- package/dist/{TestEndpointAdaptor-Bew9lWsx.cjs → TestEndpointAdaptor-wA-fmq4v.cjs} +4 -4
- package/dist/{TestEndpointAdaptor-Bew9lWsx.cjs.map → TestEndpointAdaptor-wA-fmq4v.cjs.map} +1 -1
- package/dist/adaptors/aws.cjs +5 -5
- package/dist/adaptors/aws.d.cts +5 -5
- package/dist/adaptors/aws.d.mts +15 -15
- package/dist/adaptors/aws.mjs +5 -5
- package/dist/adaptors/hono.cjs +4 -4
- package/dist/adaptors/hono.d.cts +3 -3
- package/dist/adaptors/hono.d.mts +9 -9
- package/dist/adaptors/hono.mjs +4 -4
- package/dist/adaptors/testing.cjs +3 -3
- package/dist/adaptors/testing.d.cts +3 -3
- package/dist/adaptors/testing.d.mts +9 -9
- package/dist/adaptors/testing.mjs +3 -3
- package/dist/crons/Cron.d.mts +6 -6
- package/dist/crons/CronBuilder.d.mts +7 -7
- package/dist/crons/index.d.cts +4 -4
- package/dist/crons/index.d.mts +7 -7
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +3 -3
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +3 -3
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +9 -9
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +3 -3
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +4 -4
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +4 -4
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +10 -10
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +4 -4
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +4 -4
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +4 -4
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +10 -10
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +4 -4
- package/dist/endpoints/Authorizer.cjs +5 -14
- package/dist/endpoints/Authorizer.d.cts +2 -2
- package/dist/endpoints/Authorizer.d.mts +2 -2
- package/dist/endpoints/Authorizer.mjs +2 -13
- package/dist/endpoints/Endpoint.cjs +1 -1
- package/dist/endpoints/Endpoint.d.cts +2 -2
- package/dist/endpoints/Endpoint.d.mts +8 -8
- package/dist/endpoints/Endpoint.mjs +1 -1
- package/dist/endpoints/EndpointBuilder.cjs +4 -2
- package/dist/endpoints/EndpointBuilder.d.cts +3 -3
- package/dist/endpoints/EndpointBuilder.d.mts +9 -9
- package/dist/endpoints/EndpointBuilder.mjs +4 -2
- package/dist/endpoints/EndpointFactory.cjs +5 -3
- package/dist/endpoints/EndpointFactory.d.cts +4 -4
- package/dist/endpoints/EndpointFactory.d.mts +10 -10
- package/dist/endpoints/EndpointFactory.mjs +5 -3
- package/dist/endpoints/HonoEndpointAdaptor.cjs +4 -4
- package/dist/endpoints/HonoEndpointAdaptor.d.cts +3 -3
- package/dist/endpoints/HonoEndpointAdaptor.d.mts +9 -9
- package/dist/endpoints/HonoEndpointAdaptor.mjs +4 -4
- package/dist/endpoints/TestEndpointAdaptor.cjs +3 -3
- package/dist/endpoints/TestEndpointAdaptor.d.cts +3 -3
- package/dist/endpoints/TestEndpointAdaptor.d.mts +9 -9
- package/dist/endpoints/TestEndpointAdaptor.mjs +3 -3
- package/dist/endpoints/audit.d.cts +2 -2
- package/dist/endpoints/audit.d.mts +8 -8
- package/dist/endpoints/helpers.cjs +2 -2
- package/dist/endpoints/helpers.d.cts +2 -2
- package/dist/endpoints/helpers.d.mts +8 -8
- package/dist/endpoints/helpers.mjs +2 -2
- package/dist/endpoints/index.cjs +6 -3
- package/dist/endpoints/index.cjs.map +1 -1
- package/dist/endpoints/index.d.cts +7 -7
- package/dist/endpoints/index.d.mts +13 -13
- package/dist/endpoints/index.mjs +6 -4
- package/dist/endpoints/index.mjs.map +1 -1
- package/dist/endpoints/processAudits.cjs +1 -1
- package/dist/endpoints/processAudits.d.cts +24 -5
- package/dist/endpoints/processAudits.d.mts +30 -11
- package/dist/endpoints/processAudits.mjs +1 -1
- package/dist/endpoints/rls.cjs +3 -0
- package/dist/endpoints/rls.d.cts +9 -0
- package/dist/endpoints/rls.d.mts +9 -0
- package/dist/endpoints/rls.mjs +3 -0
- package/dist/functions/AWSLambdaFunction.d.mts +4 -4
- package/dist/functions/BaseFunctionBuilder.d.mts +2 -2
- package/dist/functions/Function.d.mts +2 -2
- package/dist/functions/FunctionBuilder.d.mts +4 -4
- package/dist/functions/FunctionExecutionWrapper.d.mts +3 -3
- package/dist/functions/TestFunctionAdaptor.d.mts +2 -2
- package/dist/functions/index.d.mts +5 -5
- package/dist/{helpers-CrrdyA04.mjs → helpers-C3B2lVrM.mjs} +2 -2
- package/dist/{helpers-CrrdyA04.mjs.map → helpers-C3B2lVrM.mjs.map} +1 -1
- package/dist/{helpers-DiPZVJQC.cjs → helpers-DxxSpLfw.cjs} +2 -2
- package/dist/{helpers-DiPZVJQC.cjs.map → helpers-DxxSpLfw.cjs.map} +1 -1
- package/dist/index-CFyaRrck.d.mts +10 -0
- package/dist/index.d.mts +2 -2
- package/dist/{processAudits-BFokHhCO.cjs → processAudits-CzHkPokQ.cjs} +13 -7
- package/dist/processAudits-CzHkPokQ.cjs.map +1 -0
- package/dist/{processAudits-DfcB-X-4.mjs → processAudits-Dj8UGqcW.mjs} +13 -7
- package/dist/processAudits-Dj8UGqcW.mjs.map +1 -0
- package/dist/publisher.d.mts +1 -1
- package/dist/rls-Bf3FRwto.mjs +9 -0
- package/dist/rls-Bf3FRwto.mjs.map +1 -0
- package/dist/rls-CmJ7bRsz.cjs +15 -0
- package/dist/rls-CmJ7bRsz.cjs.map +1 -0
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.mts +3 -3
- package/dist/subscribers/Subscriber.cjs +1 -1
- package/dist/subscribers/Subscriber.d.mts +2 -2
- package/dist/subscribers/Subscriber.mjs +1 -1
- package/dist/subscribers/SubscriberBuilder.cjs +2 -2
- package/dist/subscribers/SubscriberBuilder.d.mts +3 -3
- package/dist/subscribers/SubscriberBuilder.mjs +2 -2
- package/dist/subscribers/index.cjs +2 -2
- package/dist/subscribers/index.d.cts +2 -2
- package/dist/subscribers/index.d.mts +5 -5
- package/dist/subscribers/index.mjs +2 -2
- package/dist/{types-DKf0juBf.d.mts → types-CScirkHt.d.mts} +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +4 -3
- package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +59 -26
- package/src/endpoints/Authorizer.ts +119 -1
- package/src/endpoints/Endpoint.ts +19 -0
- package/src/endpoints/EndpointBuilder.ts +80 -6
- package/src/endpoints/EndpointFactory.ts +263 -27
- package/src/endpoints/HonoEndpointAdaptor.ts +68 -37
- package/src/endpoints/TestEndpointAdaptor.ts +2 -0
- package/src/endpoints/index.ts +7 -0
- package/src/endpoints/processAudits.ts +39 -16
- package/src/endpoints/rls.ts +67 -0
- package/dist/AmazonApiGatewayEndpointAdaptor-CacGag6F.mjs.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-DXssXsJi.cjs.map +0 -1
- package/dist/Authorizer-BTmly8ps.d.cts +0 -29
- package/dist/Authorizer-pmPvIVgv.d.mts +0 -29
- package/dist/Endpoint-CA-byrDr.cjs.map +0 -1
- package/dist/Endpoint-DbPsw13b.mjs.map +0 -1
- package/dist/EndpointBuilder-CYkeYpsL.cjs.map +0 -1
- package/dist/EndpointBuilder-W5fdXxYQ.mjs.map +0 -1
- package/dist/EndpointFactory-B27nfeiE.mjs.map +0 -1
- package/dist/EndpointFactory-D5lFZXqY.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-B_gJPWGD.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-Bg_vTyA5.mjs.map +0 -1
- package/dist/endpoints/Authorizer.cjs.map +0 -1
- package/dist/endpoints/Authorizer.mjs.map +0 -1
- package/dist/index-licEVXjh.d.mts +0 -10
- package/dist/processAudits-BFokHhCO.cjs.map +0 -1
- package/dist/processAudits-DfcB-X-4.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-ChO8BlDz.mjs","names":["e: APIGatewayProxyEventV2","processedParams: Record<string, string | string[]>","event: APIGatewayProxyEventV2","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n TRoute,\n TMethod,\n TInput,\n TOutSchema,\n TServices,\n TLogger,\n TSession,\n TEventPublisher\n >"],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { HttpMethod } from '../types';\nimport type { Endpoint, EndpointSchemas } from './Endpoint';\n\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Service } from '@geekmidas/services';\nimport type { APIGatewayProxyEventV2, Context } from 'aws-lambda';\nimport {\n AmazonApiGatewayEndpoint,\n type AmazonApiGatewayV2EndpointHandler,\n type GetInputResponse,\n type LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV2Endpoint<\n TRoute extends string,\n TMethod extends HttpMethod,\n TInput extends EndpointSchemas = {},\n TOutSchema extends StandardSchemaV1 | undefined = undefined,\n TServices extends Service[] = [],\n TLogger extends Logger = Logger,\n TSession = unknown,\n TEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n AmazonApiGatewayV2EndpointHandler,\n APIGatewayProxyEventV2,\n TRoute,\n TMethod,\n TInput,\n TOutSchema,\n TServices,\n TLogger,\n TSession,\n TEventPublisher\n> {\n getInput(e: APIGatewayProxyEventV2): GetInputResponse {\n // API Gateway V2 handles arrays as comma-separated values\n const queryParams = e.queryStringParameters || {};\n const processedParams: Record<string, string | string[]> = {};\n\n for (const [key, value] of Object.entries(queryParams)) {\n if (value !== undefined) {\n // Check if value contains comma and could be an array\n // Be careful not to split values that legitimately contain commas\n if (value.includes(',') && !value.includes('\"')) {\n processedParams[key] = value.split(',').map((v) => v.trim());\n } else {\n processedParams[key] = value;\n }\n }\n }\n\n return {\n body: e.body ? JSON.parse(e.body) : undefined,\n query: parseQueryParams(processedParams),\n params: e.pathParameters || {},\n };\n }\n getLoggerContext(\n event: APIGatewayProxyEventV2,\n context: Context,\n ): LoggerContext {\n return {\n fn: {\n name: context.functionName,\n version: context.functionVersion,\n },\n req: {\n id: event.requestContext.requestId,\n awsRequestId: context.awsRequestId,\n ip: event.requestContext.http.sourceIp,\n userAgent: event.requestContext.http.userAgent || undefined,\n path: event.requestContext.http.path,\n },\n };\n }\n constructor(\n protected envParser: EnvironmentParser<{}>,\n protected readonly endpoint: Endpoint<\n TRoute,\n TMethod,\n TInput,\n TOutSchema,\n TServices,\n TLogger,\n TSession,\n TEventPublisher\n >,\n ) {\n super(envParser, endpoint);\n }\n}\n"],"mappings":";;;;AAiBA,IAAa,6BAAb,cASU,yBAWR;CACA,SAASA,GAA6C;EAEpD,MAAM,cAAc,EAAE,yBAAyB,CAAE;EACjD,MAAMC,kBAAqD,CAAE;AAE7D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,CACpD,KAAI,iBAGF,KAAI,MAAM,SAAS,IAAI,KAAK,MAAM,SAAS,KAAI,CAC7C,iBAAgB,OAAO,MAAM,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;MAE5D,iBAAgB,OAAO;AAK7B,SAAO;GACL,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,KAAK;GACjC,OAAO,iBAAiB,gBAAgB;GACxC,QAAQ,EAAE,kBAAkB,CAAE;EAC/B;CACF;CACD,iBACEC,OACAC,SACe;AACf,SAAO;GACL,IAAI;IACF,MAAM,QAAQ;IACd,SAAS,QAAQ;GAClB;GACD,KAAK;IACH,IAAI,MAAM,eAAe;IACzB,cAAc,QAAQ;IACtB,IAAI,MAAM,eAAe,KAAK;IAC9B,WAAW,MAAM,eAAe,KAAK;IACrC,MAAM,MAAM,eAAe,KAAK;GACjC;EACF;CACF;CACD,YACYC,WACSC,UAUnB;AACA,QAAM,WAAW,SAAS;EAZhB;EACS;CAYpB;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_AmazonApiGatewayEndpointAdaptor = require('./AmazonApiGatewayEndpointAdaptor-
|
|
1
|
+
const require_AmazonApiGatewayEndpointAdaptor = require('./AmazonApiGatewayEndpointAdaptor-Bk6ssx3K.cjs');
|
|
2
2
|
const require_parseQueryParams = require('./parseQueryParams-CwvXXwkW.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts
|
|
@@ -43,4 +43,4 @@ Object.defineProperty(exports, 'AmazonApiGatewayV2Endpoint', {
|
|
|
43
43
|
return AmazonApiGatewayV2Endpoint;
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
//# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-
|
|
46
|
+
//# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-I1W23Nvn.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-
|
|
1
|
+
{"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-I1W23Nvn.cjs","names":["AmazonApiGatewayEndpoint","e: APIGatewayProxyEventV2","processedParams: Record<string, string | string[]>","event: APIGatewayProxyEventV2","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n TRoute,\n TMethod,\n TInput,\n TOutSchema,\n TServices,\n TLogger,\n TSession,\n TEventPublisher\n >"],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { HttpMethod } from '../types';\nimport type { Endpoint, EndpointSchemas } from './Endpoint';\n\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Service } from '@geekmidas/services';\nimport type { APIGatewayProxyEventV2, Context } from 'aws-lambda';\nimport {\n AmazonApiGatewayEndpoint,\n type AmazonApiGatewayV2EndpointHandler,\n type GetInputResponse,\n type LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV2Endpoint<\n TRoute extends string,\n TMethod extends HttpMethod,\n TInput extends EndpointSchemas = {},\n TOutSchema extends StandardSchemaV1 | undefined = undefined,\n TServices extends Service[] = [],\n TLogger extends Logger = Logger,\n TSession = unknown,\n TEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n AmazonApiGatewayV2EndpointHandler,\n APIGatewayProxyEventV2,\n TRoute,\n TMethod,\n TInput,\n TOutSchema,\n TServices,\n TLogger,\n TSession,\n TEventPublisher\n> {\n getInput(e: APIGatewayProxyEventV2): GetInputResponse {\n // API Gateway V2 handles arrays as comma-separated values\n const queryParams = e.queryStringParameters || {};\n const processedParams: Record<string, string | string[]> = {};\n\n for (const [key, value] of Object.entries(queryParams)) {\n if (value !== undefined) {\n // Check if value contains comma and could be an array\n // Be careful not to split values that legitimately contain commas\n if (value.includes(',') && !value.includes('\"')) {\n processedParams[key] = value.split(',').map((v) => v.trim());\n } else {\n processedParams[key] = value;\n }\n }\n }\n\n return {\n body: e.body ? JSON.parse(e.body) : undefined,\n query: parseQueryParams(processedParams),\n params: e.pathParameters || {},\n };\n }\n getLoggerContext(\n event: APIGatewayProxyEventV2,\n context: Context,\n ): LoggerContext {\n return {\n fn: {\n name: context.functionName,\n version: context.functionVersion,\n },\n req: {\n id: event.requestContext.requestId,\n awsRequestId: context.awsRequestId,\n ip: event.requestContext.http.sourceIp,\n userAgent: event.requestContext.http.userAgent || undefined,\n path: event.requestContext.http.path,\n },\n };\n }\n constructor(\n protected envParser: EnvironmentParser<{}>,\n protected readonly endpoint: Endpoint<\n TRoute,\n TMethod,\n TInput,\n TOutSchema,\n TServices,\n TLogger,\n TSession,\n TEventPublisher\n >,\n ) {\n super(envParser, endpoint);\n }\n}\n"],"mappings":";;;;AAiBA,IAAa,6BAAb,cASUA,iEAWR;CACA,SAASC,GAA6C;EAEpD,MAAM,cAAc,EAAE,yBAAyB,CAAE;EACjD,MAAMC,kBAAqD,CAAE;AAE7D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,CACpD,KAAI,iBAGF,KAAI,MAAM,SAAS,IAAI,KAAK,MAAM,SAAS,KAAI,CAC7C,iBAAgB,OAAO,MAAM,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;MAE5D,iBAAgB,OAAO;AAK7B,SAAO;GACL,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,KAAK;GACjC,OAAO,0CAAiB,gBAAgB;GACxC,QAAQ,EAAE,kBAAkB,CAAE;EAC/B;CACF;CACD,iBACEC,OACAC,SACe;AACf,SAAO;GACL,IAAI;IACF,MAAM,QAAQ;IACd,SAAS,QAAQ;GAClB;GACD,KAAK;IACH,IAAI,MAAM,eAAe;IACzB,cAAc,QAAQ;IACtB,IAAI,MAAM,eAAe,KAAK;IAC9B,WAAW,MAAM,eAAe,KAAK;IACrC,MAAM,MAAM,eAAe,KAAK;GACjC;EACF;CACF;CACD,YACYC,WACSC,UAUnB;AACA,QAAM,WAAW,SAAS;EAZhB;EACS;CAYpB;AACF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/endpoints/Authorizer.ts
|
|
3
|
+
/**
|
|
4
|
+
* Built-in security schemes available by default.
|
|
5
|
+
* Users can use these without defining them via .securitySchemes().
|
|
6
|
+
*/
|
|
7
|
+
const BUILT_IN_SECURITY_SCHEMES = {
|
|
8
|
+
jwt: {
|
|
9
|
+
type: "http",
|
|
10
|
+
scheme: "bearer",
|
|
11
|
+
bearerFormat: "JWT",
|
|
12
|
+
description: "JWT Bearer token authentication"
|
|
13
|
+
},
|
|
14
|
+
bearer: {
|
|
15
|
+
type: "http",
|
|
16
|
+
scheme: "bearer",
|
|
17
|
+
description: "Bearer token authentication"
|
|
18
|
+
},
|
|
19
|
+
apiKey: {
|
|
20
|
+
type: "apiKey",
|
|
21
|
+
in: "header",
|
|
22
|
+
name: "X-API-Key",
|
|
23
|
+
description: "API key authentication via header"
|
|
24
|
+
},
|
|
25
|
+
oauth2: {
|
|
26
|
+
type: "oauth2",
|
|
27
|
+
flows: {},
|
|
28
|
+
description: "OAuth 2.0 authentication"
|
|
29
|
+
},
|
|
30
|
+
oidc: {
|
|
31
|
+
type: "openIdConnect",
|
|
32
|
+
openIdConnectUrl: "",
|
|
33
|
+
description: "OpenID Connect authentication"
|
|
34
|
+
},
|
|
35
|
+
iam: {
|
|
36
|
+
type: "apiKey",
|
|
37
|
+
in: "header",
|
|
38
|
+
name: "Authorization",
|
|
39
|
+
description: "AWS IAM Signature Version 4 authentication",
|
|
40
|
+
"x-amazon-apigateway-authtype": "awsSigv4"
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Helper to create an authorizer configuration
|
|
45
|
+
*/
|
|
46
|
+
function createAuthorizer(name, options) {
|
|
47
|
+
return {
|
|
48
|
+
name,
|
|
49
|
+
...options
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check if a name is a built-in security scheme
|
|
54
|
+
*/
|
|
55
|
+
function isBuiltInSecurityScheme(name) {
|
|
56
|
+
return name in BUILT_IN_SECURITY_SCHEMES;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get a security scheme by name (built-in or custom)
|
|
60
|
+
*/
|
|
61
|
+
function getSecurityScheme(name, customSchemes) {
|
|
62
|
+
if (customSchemes && name in customSchemes) return customSchemes[name];
|
|
63
|
+
if (isBuiltInSecurityScheme(name)) return BUILT_IN_SECURITY_SCHEMES[name];
|
|
64
|
+
return void 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
Object.defineProperty(exports, 'BUILT_IN_SECURITY_SCHEMES', {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () {
|
|
71
|
+
return BUILT_IN_SECURITY_SCHEMES;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(exports, 'createAuthorizer', {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function () {
|
|
77
|
+
return createAuthorizer;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, 'getSecurityScheme', {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () {
|
|
83
|
+
return getSecurityScheme;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
Object.defineProperty(exports, 'isBuiltInSecurityScheme', {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function () {
|
|
89
|
+
return isBuiltInSecurityScheme;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=Authorizer-C0ge_tc8.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Authorizer-C0ge_tc8.cjs","names":["name: string","options?: Omit<Authorizer, 'name'>","customSchemes?: Record<string, SecurityScheme>"],"sources":["../src/endpoints/Authorizer.ts"],"sourcesContent":["/**\n * OpenAPI 3.1 compliant security scheme definition.\n * @see https://spec.openapis.org/oas/v3.1.0#security-scheme-object\n */\nexport interface SecurityScheme {\n /** The type of the security scheme */\n type: 'apiKey' | 'http' | 'mutualTLS' | 'oauth2' | 'openIdConnect';\n /** A description for security scheme */\n description?: string;\n /** Required for apiKey. The name of the header, query or cookie parameter */\n name?: string;\n /** Required for apiKey. The location of the API key */\n in?: 'query' | 'header' | 'cookie';\n /** Required for http. The name of the HTTP Authorization scheme (e.g., 'bearer') */\n scheme?: string;\n /** Optional for http bearer. A hint to the format of the bearer token */\n bearerFormat?: string;\n /** Required for oauth2. An object containing configuration for the flow types */\n flows?: OAuthFlows;\n /** Required for openIdConnect. The URL to discover OAuth2 configuration */\n openIdConnectUrl?: string;\n /** Vendor extensions (e.g., x-amazon-apigateway-authtype) */\n [key: `x-${string}`]: unknown;\n}\n\n/**\n * OAuth2 flow configuration\n */\nexport interface OAuthFlows {\n implicit?: OAuthFlow;\n password?: OAuthFlow;\n clientCredentials?: OAuthFlow;\n authorizationCode?: OAuthFlow;\n}\n\nexport interface OAuthFlow {\n authorizationUrl?: string;\n tokenUrl?: string;\n refreshUrl?: string;\n scopes: Record<string, string>;\n}\n\n/**\n * Built-in security schemes available by default.\n * Users can use these without defining them via .securitySchemes().\n */\nexport const BUILT_IN_SECURITY_SCHEMES = {\n jwt: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n description: 'JWT Bearer token authentication',\n },\n bearer: {\n type: 'http',\n scheme: 'bearer',\n description: 'Bearer token authentication',\n },\n apiKey: {\n type: 'apiKey',\n in: 'header',\n name: 'X-API-Key',\n description: 'API key authentication via header',\n },\n oauth2: {\n type: 'oauth2',\n flows: {},\n description: 'OAuth 2.0 authentication',\n },\n oidc: {\n type: 'openIdConnect',\n openIdConnectUrl: '',\n description: 'OpenID Connect authentication',\n },\n iam: {\n type: 'apiKey',\n in: 'header',\n name: 'Authorization',\n description: 'AWS IAM Signature Version 4 authentication',\n 'x-amazon-apigateway-authtype': 'awsSigv4',\n },\n} as const satisfies Record<string, SecurityScheme>;\n\n/** Names of built-in security schemes */\nexport type BuiltInSecuritySchemeId = keyof typeof BUILT_IN_SECURITY_SCHEMES;\n\n/**\n * Represents an authorizer configuration for endpoints\n */\nexport interface Authorizer {\n /**\n * Unique identifier for the authorizer\n */\n name: string;\n /**\n * The OpenAPI security scheme definition for this authorizer\n */\n securityScheme?: SecurityScheme;\n /**\n * Type of authorizer (e.g., 'iam', 'jwt', 'custom')\n * @deprecated Use securityScheme.type instead\n */\n type?: string;\n /**\n * Description of what this authorizer does\n * @deprecated Use securityScheme.description instead\n */\n description?: string;\n /**\n * Additional metadata specific to the authorizer type\n * @deprecated Use securityScheme with x-* extensions instead\n */\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Helper to create an authorizer configuration\n */\nexport function createAuthorizer(\n name: string,\n options?: Omit<Authorizer, 'name'>,\n): Authorizer {\n return {\n name,\n ...options,\n };\n}\n\n/**\n * Check if a name is a built-in security scheme\n */\nexport function isBuiltInSecurityScheme(\n name: string,\n): name is BuiltInSecuritySchemeId {\n return name in BUILT_IN_SECURITY_SCHEMES;\n}\n\n/**\n * Get a security scheme by name (built-in or custom)\n */\nexport function getSecurityScheme(\n name: string,\n customSchemes?: Record<string, SecurityScheme>,\n): SecurityScheme | undefined {\n if (customSchemes && name in customSchemes) {\n return customSchemes[name];\n }\n if (isBuiltInSecurityScheme(name)) {\n return BUILT_IN_SECURITY_SCHEMES[name];\n }\n return undefined;\n}\n"],"mappings":";;;;;;AA8CA,MAAa,4BAA4B;CACvC,KAAK;EACH,MAAM;EACN,QAAQ;EACR,cAAc;EACd,aAAa;CACd;CACD,QAAQ;EACN,MAAM;EACN,QAAQ;EACR,aAAa;CACd;CACD,QAAQ;EACN,MAAM;EACN,IAAI;EACJ,MAAM;EACN,aAAa;CACd;CACD,QAAQ;EACN,MAAM;EACN,OAAO,CAAE;EACT,aAAa;CACd;CACD,MAAM;EACJ,MAAM;EACN,kBAAkB;EAClB,aAAa;CACd;CACD,KAAK;EACH,MAAM;EACN,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gCAAgC;CACjC;AACF;;;;AAqCD,SAAgB,iBACdA,MACAC,SACY;AACZ,QAAO;EACL;EACA,GAAG;CACJ;AACF;;;;AAKD,SAAgB,wBACdD,MACiC;AACjC,QAAO,QAAQ;AAChB;;;;AAKD,SAAgB,kBACdA,MACAE,eAC4B;AAC5B,KAAI,iBAAiB,QAAQ,cAC3B,QAAO,cAAc;AAEvB,KAAI,wBAAwB,KAAK,CAC/B,QAAO,0BAA0B;AAEnC;AACD"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
//#region src/endpoints/Authorizer.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* OpenAPI 3.1 compliant security scheme definition.
|
|
4
|
+
* @see https://spec.openapis.org/oas/v3.1.0#security-scheme-object
|
|
5
|
+
*/
|
|
6
|
+
interface SecurityScheme {
|
|
7
|
+
/** The type of the security scheme */
|
|
8
|
+
type: 'apiKey' | 'http' | 'mutualTLS' | 'oauth2' | 'openIdConnect';
|
|
9
|
+
/** A description for security scheme */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** Required for apiKey. The name of the header, query or cookie parameter */
|
|
12
|
+
name?: string;
|
|
13
|
+
/** Required for apiKey. The location of the API key */
|
|
14
|
+
in?: 'query' | 'header' | 'cookie';
|
|
15
|
+
/** Required for http. The name of the HTTP Authorization scheme (e.g., 'bearer') */
|
|
16
|
+
scheme?: string;
|
|
17
|
+
/** Optional for http bearer. A hint to the format of the bearer token */
|
|
18
|
+
bearerFormat?: string;
|
|
19
|
+
/** Required for oauth2. An object containing configuration for the flow types */
|
|
20
|
+
flows?: OAuthFlows;
|
|
21
|
+
/** Required for openIdConnect. The URL to discover OAuth2 configuration */
|
|
22
|
+
openIdConnectUrl?: string;
|
|
23
|
+
/** Vendor extensions (e.g., x-amazon-apigateway-authtype) */
|
|
24
|
+
[key: `x-${string}`]: unknown;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* OAuth2 flow configuration
|
|
28
|
+
*/
|
|
29
|
+
interface OAuthFlows {
|
|
30
|
+
implicit?: OAuthFlow;
|
|
31
|
+
password?: OAuthFlow;
|
|
32
|
+
clientCredentials?: OAuthFlow;
|
|
33
|
+
authorizationCode?: OAuthFlow;
|
|
34
|
+
}
|
|
35
|
+
interface OAuthFlow {
|
|
36
|
+
authorizationUrl?: string;
|
|
37
|
+
tokenUrl?: string;
|
|
38
|
+
refreshUrl?: string;
|
|
39
|
+
scopes: Record<string, string>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Built-in security schemes available by default.
|
|
43
|
+
* Users can use these without defining them via .securitySchemes().
|
|
44
|
+
*/
|
|
45
|
+
declare const BUILT_IN_SECURITY_SCHEMES: {
|
|
46
|
+
readonly jwt: {
|
|
47
|
+
readonly type: "http";
|
|
48
|
+
readonly scheme: "bearer";
|
|
49
|
+
readonly bearerFormat: "JWT";
|
|
50
|
+
readonly description: "JWT Bearer token authentication";
|
|
51
|
+
};
|
|
52
|
+
readonly bearer: {
|
|
53
|
+
readonly type: "http";
|
|
54
|
+
readonly scheme: "bearer";
|
|
55
|
+
readonly description: "Bearer token authentication";
|
|
56
|
+
};
|
|
57
|
+
readonly apiKey: {
|
|
58
|
+
readonly type: "apiKey";
|
|
59
|
+
readonly in: "header";
|
|
60
|
+
readonly name: "X-API-Key";
|
|
61
|
+
readonly description: "API key authentication via header";
|
|
62
|
+
};
|
|
63
|
+
readonly oauth2: {
|
|
64
|
+
readonly type: "oauth2";
|
|
65
|
+
readonly flows: {};
|
|
66
|
+
readonly description: "OAuth 2.0 authentication";
|
|
67
|
+
};
|
|
68
|
+
readonly oidc: {
|
|
69
|
+
readonly type: "openIdConnect";
|
|
70
|
+
readonly openIdConnectUrl: "";
|
|
71
|
+
readonly description: "OpenID Connect authentication";
|
|
72
|
+
};
|
|
73
|
+
readonly iam: {
|
|
74
|
+
readonly type: "apiKey";
|
|
75
|
+
readonly in: "header";
|
|
76
|
+
readonly name: "Authorization";
|
|
77
|
+
readonly description: "AWS IAM Signature Version 4 authentication";
|
|
78
|
+
readonly 'x-amazon-apigateway-authtype': "awsSigv4";
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
/** Names of built-in security schemes */
|
|
82
|
+
type BuiltInSecuritySchemeId = keyof typeof BUILT_IN_SECURITY_SCHEMES;
|
|
83
|
+
/**
|
|
84
|
+
* Represents an authorizer configuration for endpoints
|
|
85
|
+
*/
|
|
86
|
+
interface Authorizer {
|
|
87
|
+
/**
|
|
88
|
+
* Unique identifier for the authorizer
|
|
89
|
+
*/
|
|
90
|
+
name: string;
|
|
91
|
+
/**
|
|
92
|
+
* The OpenAPI security scheme definition for this authorizer
|
|
93
|
+
*/
|
|
94
|
+
securityScheme?: SecurityScheme;
|
|
95
|
+
/**
|
|
96
|
+
* Type of authorizer (e.g., 'iam', 'jwt', 'custom')
|
|
97
|
+
* @deprecated Use securityScheme.type instead
|
|
98
|
+
*/
|
|
99
|
+
type?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Description of what this authorizer does
|
|
102
|
+
* @deprecated Use securityScheme.description instead
|
|
103
|
+
*/
|
|
104
|
+
description?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Additional metadata specific to the authorizer type
|
|
107
|
+
* @deprecated Use securityScheme with x-* extensions instead
|
|
108
|
+
*/
|
|
109
|
+
metadata?: Record<string, unknown>;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Helper to create an authorizer configuration
|
|
113
|
+
*/
|
|
114
|
+
declare function createAuthorizer(name: string, options?: Omit<Authorizer, 'name'>): Authorizer;
|
|
115
|
+
/**
|
|
116
|
+
* Check if a name is a built-in security scheme
|
|
117
|
+
*/
|
|
118
|
+
declare function isBuiltInSecurityScheme(name: string): name is BuiltInSecuritySchemeId;
|
|
119
|
+
/**
|
|
120
|
+
* Get a security scheme by name (built-in or custom)
|
|
121
|
+
*/
|
|
122
|
+
declare function getSecurityScheme(name: string, customSchemes?: Record<string, SecurityScheme>): SecurityScheme | undefined;
|
|
123
|
+
//#endregion
|
|
124
|
+
export { Authorizer, BUILT_IN_SECURITY_SCHEMES, BuiltInSecuritySchemeId, OAuthFlow, OAuthFlows, SecurityScheme, createAuthorizer, getSecurityScheme, isBuiltInSecurityScheme };
|
|
125
|
+
//# sourceMappingURL=Authorizer-CpSUMTIs.d.cts.map
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
//#region src/endpoints/Authorizer.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* OpenAPI 3.1 compliant security scheme definition.
|
|
4
|
+
* @see https://spec.openapis.org/oas/v3.1.0#security-scheme-object
|
|
5
|
+
*/
|
|
6
|
+
interface SecurityScheme {
|
|
7
|
+
/** The type of the security scheme */
|
|
8
|
+
type: 'apiKey' | 'http' | 'mutualTLS' | 'oauth2' | 'openIdConnect';
|
|
9
|
+
/** A description for security scheme */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** Required for apiKey. The name of the header, query or cookie parameter */
|
|
12
|
+
name?: string;
|
|
13
|
+
/** Required for apiKey. The location of the API key */
|
|
14
|
+
in?: 'query' | 'header' | 'cookie';
|
|
15
|
+
/** Required for http. The name of the HTTP Authorization scheme (e.g., 'bearer') */
|
|
16
|
+
scheme?: string;
|
|
17
|
+
/** Optional for http bearer. A hint to the format of the bearer token */
|
|
18
|
+
bearerFormat?: string;
|
|
19
|
+
/** Required for oauth2. An object containing configuration for the flow types */
|
|
20
|
+
flows?: OAuthFlows;
|
|
21
|
+
/** Required for openIdConnect. The URL to discover OAuth2 configuration */
|
|
22
|
+
openIdConnectUrl?: string;
|
|
23
|
+
/** Vendor extensions (e.g., x-amazon-apigateway-authtype) */
|
|
24
|
+
[key: `x-${string}`]: unknown;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* OAuth2 flow configuration
|
|
28
|
+
*/
|
|
29
|
+
interface OAuthFlows {
|
|
30
|
+
implicit?: OAuthFlow;
|
|
31
|
+
password?: OAuthFlow;
|
|
32
|
+
clientCredentials?: OAuthFlow;
|
|
33
|
+
authorizationCode?: OAuthFlow;
|
|
34
|
+
}
|
|
35
|
+
interface OAuthFlow {
|
|
36
|
+
authorizationUrl?: string;
|
|
37
|
+
tokenUrl?: string;
|
|
38
|
+
refreshUrl?: string;
|
|
39
|
+
scopes: Record<string, string>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Built-in security schemes available by default.
|
|
43
|
+
* Users can use these without defining them via .securitySchemes().
|
|
44
|
+
*/
|
|
45
|
+
declare const BUILT_IN_SECURITY_SCHEMES: {
|
|
46
|
+
readonly jwt: {
|
|
47
|
+
readonly type: "http";
|
|
48
|
+
readonly scheme: "bearer";
|
|
49
|
+
readonly bearerFormat: "JWT";
|
|
50
|
+
readonly description: "JWT Bearer token authentication";
|
|
51
|
+
};
|
|
52
|
+
readonly bearer: {
|
|
53
|
+
readonly type: "http";
|
|
54
|
+
readonly scheme: "bearer";
|
|
55
|
+
readonly description: "Bearer token authentication";
|
|
56
|
+
};
|
|
57
|
+
readonly apiKey: {
|
|
58
|
+
readonly type: "apiKey";
|
|
59
|
+
readonly in: "header";
|
|
60
|
+
readonly name: "X-API-Key";
|
|
61
|
+
readonly description: "API key authentication via header";
|
|
62
|
+
};
|
|
63
|
+
readonly oauth2: {
|
|
64
|
+
readonly type: "oauth2";
|
|
65
|
+
readonly flows: {};
|
|
66
|
+
readonly description: "OAuth 2.0 authentication";
|
|
67
|
+
};
|
|
68
|
+
readonly oidc: {
|
|
69
|
+
readonly type: "openIdConnect";
|
|
70
|
+
readonly openIdConnectUrl: "";
|
|
71
|
+
readonly description: "OpenID Connect authentication";
|
|
72
|
+
};
|
|
73
|
+
readonly iam: {
|
|
74
|
+
readonly type: "apiKey";
|
|
75
|
+
readonly in: "header";
|
|
76
|
+
readonly name: "Authorization";
|
|
77
|
+
readonly description: "AWS IAM Signature Version 4 authentication";
|
|
78
|
+
readonly 'x-amazon-apigateway-authtype': "awsSigv4";
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
/** Names of built-in security schemes */
|
|
82
|
+
type BuiltInSecuritySchemeId = keyof typeof BUILT_IN_SECURITY_SCHEMES;
|
|
83
|
+
/**
|
|
84
|
+
* Represents an authorizer configuration for endpoints
|
|
85
|
+
*/
|
|
86
|
+
interface Authorizer {
|
|
87
|
+
/**
|
|
88
|
+
* Unique identifier for the authorizer
|
|
89
|
+
*/
|
|
90
|
+
name: string;
|
|
91
|
+
/**
|
|
92
|
+
* The OpenAPI security scheme definition for this authorizer
|
|
93
|
+
*/
|
|
94
|
+
securityScheme?: SecurityScheme;
|
|
95
|
+
/**
|
|
96
|
+
* Type of authorizer (e.g., 'iam', 'jwt', 'custom')
|
|
97
|
+
* @deprecated Use securityScheme.type instead
|
|
98
|
+
*/
|
|
99
|
+
type?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Description of what this authorizer does
|
|
102
|
+
* @deprecated Use securityScheme.description instead
|
|
103
|
+
*/
|
|
104
|
+
description?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Additional metadata specific to the authorizer type
|
|
107
|
+
* @deprecated Use securityScheme with x-* extensions instead
|
|
108
|
+
*/
|
|
109
|
+
metadata?: Record<string, unknown>;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Helper to create an authorizer configuration
|
|
113
|
+
*/
|
|
114
|
+
declare function createAuthorizer(name: string, options?: Omit<Authorizer, 'name'>): Authorizer;
|
|
115
|
+
/**
|
|
116
|
+
* Check if a name is a built-in security scheme
|
|
117
|
+
*/
|
|
118
|
+
declare function isBuiltInSecurityScheme(name: string): name is BuiltInSecuritySchemeId;
|
|
119
|
+
/**
|
|
120
|
+
* Get a security scheme by name (built-in or custom)
|
|
121
|
+
*/
|
|
122
|
+
declare function getSecurityScheme(name: string, customSchemes?: Record<string, SecurityScheme>): SecurityScheme | undefined;
|
|
123
|
+
//#endregion
|
|
124
|
+
export { Authorizer, BUILT_IN_SECURITY_SCHEMES, BuiltInSecuritySchemeId, OAuthFlow, OAuthFlows, SecurityScheme, createAuthorizer, getSecurityScheme, isBuiltInSecurityScheme };
|
|
125
|
+
//# sourceMappingURL=Authorizer-Cpx59w_q.d.mts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region src/endpoints/Authorizer.ts
|
|
2
|
+
/**
|
|
3
|
+
* Built-in security schemes available by default.
|
|
4
|
+
* Users can use these without defining them via .securitySchemes().
|
|
5
|
+
*/
|
|
6
|
+
const BUILT_IN_SECURITY_SCHEMES = {
|
|
7
|
+
jwt: {
|
|
8
|
+
type: "http",
|
|
9
|
+
scheme: "bearer",
|
|
10
|
+
bearerFormat: "JWT",
|
|
11
|
+
description: "JWT Bearer token authentication"
|
|
12
|
+
},
|
|
13
|
+
bearer: {
|
|
14
|
+
type: "http",
|
|
15
|
+
scheme: "bearer",
|
|
16
|
+
description: "Bearer token authentication"
|
|
17
|
+
},
|
|
18
|
+
apiKey: {
|
|
19
|
+
type: "apiKey",
|
|
20
|
+
in: "header",
|
|
21
|
+
name: "X-API-Key",
|
|
22
|
+
description: "API key authentication via header"
|
|
23
|
+
},
|
|
24
|
+
oauth2: {
|
|
25
|
+
type: "oauth2",
|
|
26
|
+
flows: {},
|
|
27
|
+
description: "OAuth 2.0 authentication"
|
|
28
|
+
},
|
|
29
|
+
oidc: {
|
|
30
|
+
type: "openIdConnect",
|
|
31
|
+
openIdConnectUrl: "",
|
|
32
|
+
description: "OpenID Connect authentication"
|
|
33
|
+
},
|
|
34
|
+
iam: {
|
|
35
|
+
type: "apiKey",
|
|
36
|
+
in: "header",
|
|
37
|
+
name: "Authorization",
|
|
38
|
+
description: "AWS IAM Signature Version 4 authentication",
|
|
39
|
+
"x-amazon-apigateway-authtype": "awsSigv4"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Helper to create an authorizer configuration
|
|
44
|
+
*/
|
|
45
|
+
function createAuthorizer(name, options) {
|
|
46
|
+
return {
|
|
47
|
+
name,
|
|
48
|
+
...options
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Check if a name is a built-in security scheme
|
|
53
|
+
*/
|
|
54
|
+
function isBuiltInSecurityScheme(name) {
|
|
55
|
+
return name in BUILT_IN_SECURITY_SCHEMES;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get a security scheme by name (built-in or custom)
|
|
59
|
+
*/
|
|
60
|
+
function getSecurityScheme(name, customSchemes) {
|
|
61
|
+
if (customSchemes && name in customSchemes) return customSchemes[name];
|
|
62
|
+
if (isBuiltInSecurityScheme(name)) return BUILT_IN_SECURITY_SCHEMES[name];
|
|
63
|
+
return void 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
export { BUILT_IN_SECURITY_SCHEMES, createAuthorizer, getSecurityScheme, isBuiltInSecurityScheme };
|
|
68
|
+
//# sourceMappingURL=Authorizer-r9U3y_ms.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Authorizer-r9U3y_ms.mjs","names":["name: string","options?: Omit<Authorizer, 'name'>","customSchemes?: Record<string, SecurityScheme>"],"sources":["../src/endpoints/Authorizer.ts"],"sourcesContent":["/**\n * OpenAPI 3.1 compliant security scheme definition.\n * @see https://spec.openapis.org/oas/v3.1.0#security-scheme-object\n */\nexport interface SecurityScheme {\n /** The type of the security scheme */\n type: 'apiKey' | 'http' | 'mutualTLS' | 'oauth2' | 'openIdConnect';\n /** A description for security scheme */\n description?: string;\n /** Required for apiKey. The name of the header, query or cookie parameter */\n name?: string;\n /** Required for apiKey. The location of the API key */\n in?: 'query' | 'header' | 'cookie';\n /** Required for http. The name of the HTTP Authorization scheme (e.g., 'bearer') */\n scheme?: string;\n /** Optional for http bearer. A hint to the format of the bearer token */\n bearerFormat?: string;\n /** Required for oauth2. An object containing configuration for the flow types */\n flows?: OAuthFlows;\n /** Required for openIdConnect. The URL to discover OAuth2 configuration */\n openIdConnectUrl?: string;\n /** Vendor extensions (e.g., x-amazon-apigateway-authtype) */\n [key: `x-${string}`]: unknown;\n}\n\n/**\n * OAuth2 flow configuration\n */\nexport interface OAuthFlows {\n implicit?: OAuthFlow;\n password?: OAuthFlow;\n clientCredentials?: OAuthFlow;\n authorizationCode?: OAuthFlow;\n}\n\nexport interface OAuthFlow {\n authorizationUrl?: string;\n tokenUrl?: string;\n refreshUrl?: string;\n scopes: Record<string, string>;\n}\n\n/**\n * Built-in security schemes available by default.\n * Users can use these without defining them via .securitySchemes().\n */\nexport const BUILT_IN_SECURITY_SCHEMES = {\n jwt: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n description: 'JWT Bearer token authentication',\n },\n bearer: {\n type: 'http',\n scheme: 'bearer',\n description: 'Bearer token authentication',\n },\n apiKey: {\n type: 'apiKey',\n in: 'header',\n name: 'X-API-Key',\n description: 'API key authentication via header',\n },\n oauth2: {\n type: 'oauth2',\n flows: {},\n description: 'OAuth 2.0 authentication',\n },\n oidc: {\n type: 'openIdConnect',\n openIdConnectUrl: '',\n description: 'OpenID Connect authentication',\n },\n iam: {\n type: 'apiKey',\n in: 'header',\n name: 'Authorization',\n description: 'AWS IAM Signature Version 4 authentication',\n 'x-amazon-apigateway-authtype': 'awsSigv4',\n },\n} as const satisfies Record<string, SecurityScheme>;\n\n/** Names of built-in security schemes */\nexport type BuiltInSecuritySchemeId = keyof typeof BUILT_IN_SECURITY_SCHEMES;\n\n/**\n * Represents an authorizer configuration for endpoints\n */\nexport interface Authorizer {\n /**\n * Unique identifier for the authorizer\n */\n name: string;\n /**\n * The OpenAPI security scheme definition for this authorizer\n */\n securityScheme?: SecurityScheme;\n /**\n * Type of authorizer (e.g., 'iam', 'jwt', 'custom')\n * @deprecated Use securityScheme.type instead\n */\n type?: string;\n /**\n * Description of what this authorizer does\n * @deprecated Use securityScheme.description instead\n */\n description?: string;\n /**\n * Additional metadata specific to the authorizer type\n * @deprecated Use securityScheme with x-* extensions instead\n */\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Helper to create an authorizer configuration\n */\nexport function createAuthorizer(\n name: string,\n options?: Omit<Authorizer, 'name'>,\n): Authorizer {\n return {\n name,\n ...options,\n };\n}\n\n/**\n * Check if a name is a built-in security scheme\n */\nexport function isBuiltInSecurityScheme(\n name: string,\n): name is BuiltInSecuritySchemeId {\n return name in BUILT_IN_SECURITY_SCHEMES;\n}\n\n/**\n * Get a security scheme by name (built-in or custom)\n */\nexport function getSecurityScheme(\n name: string,\n customSchemes?: Record<string, SecurityScheme>,\n): SecurityScheme | undefined {\n if (customSchemes && name in customSchemes) {\n return customSchemes[name];\n }\n if (isBuiltInSecurityScheme(name)) {\n return BUILT_IN_SECURITY_SCHEMES[name];\n }\n return undefined;\n}\n"],"mappings":";;;;;AA8CA,MAAa,4BAA4B;CACvC,KAAK;EACH,MAAM;EACN,QAAQ;EACR,cAAc;EACd,aAAa;CACd;CACD,QAAQ;EACN,MAAM;EACN,QAAQ;EACR,aAAa;CACd;CACD,QAAQ;EACN,MAAM;EACN,IAAI;EACJ,MAAM;EACN,aAAa;CACd;CACD,QAAQ;EACN,MAAM;EACN,OAAO,CAAE;EACT,aAAa;CACd;CACD,MAAM;EACJ,MAAM;EACN,kBAAkB;EAClB,aAAa;CACd;CACD,KAAK;EACH,MAAM;EACN,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gCAAgC;CACjC;AACF;;;;AAqCD,SAAgB,iBACdA,MACAC,SACY;AACZ,QAAO;EACL;EACA,GAAG;CACJ;AACF;;;;AAKD,SAAgB,wBACdD,MACiC;AACjC,QAAO,QAAQ;AAChB;;;;AAKD,SAAgB,kBACdA,MACAE,eAC4B;AAC5B,KAAI,iBAAiB,QAAQ,cAC3B,QAAO,cAAc;AAEvB,KAAI,wBAAwB,KAAK,CAC/B,QAAO,0BAA0B;AAEnC;AACD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConstructType } from "./Construct-
|
|
1
|
+
import { ConstructType } from "./Construct-jBKqb-Zi.mjs";
|
|
2
2
|
import { Service } from "@geekmidas/services";
|
|
3
3
|
import { AuditStorage } from "@geekmidas/audit";
|
|
4
4
|
import { EventPublisher, MappedEvent } from "@geekmidas/events";
|
|
@@ -37,4 +37,4 @@ declare abstract class BaseFunctionBuilder<TInput extends ComposableStandardSche
|
|
|
37
37
|
}
|
|
38
38
|
//#endregion
|
|
39
39
|
export { BaseFunctionBuilder };
|
|
40
|
-
//# sourceMappingURL=BaseFunctionBuilder-
|
|
40
|
+
//# sourceMappingURL=BaseFunctionBuilder-CoV7J45W.d.mts.map
|
package/dist/Construct.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Construct, ConstructType } from "./Construct-
|
|
1
|
+
import { Construct, ConstructType } from "./Construct-jBKqb-Zi.mjs";
|
|
2
2
|
export { Construct, ConstructType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Function, FunctionHandler } from "./Function-
|
|
1
|
+
import { Function, FunctionHandler } from "./Function-Vh1t-Qjj.mjs";
|
|
2
2
|
import { Service } from "@geekmidas/services";
|
|
3
3
|
import { AuditableAction } from "@geekmidas/audit";
|
|
4
4
|
import { EventPublisher } from "@geekmidas/events";
|
|
@@ -23,4 +23,4 @@ type CronExpression = `cron(${CronMinute} ${CronHour} ${CronDay} ${CronMonth} ${
|
|
|
23
23
|
type ScheduleExpression = RateExpression | CronExpression;
|
|
24
24
|
//#endregion
|
|
25
25
|
export { Cron, CronExpression, RateExpression, ScheduleExpression };
|
|
26
|
-
//# sourceMappingURL=Cron-
|
|
26
|
+
//# sourceMappingURL=Cron-JZkp_fHy.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FunctionHandler } from "./Function-
|
|
2
|
-
import { FunctionBuilder } from "./FunctionBuilder-
|
|
3
|
-
import { Cron, ScheduleExpression } from "./Cron-
|
|
1
|
+
import { FunctionHandler } from "./Function-Vh1t-Qjj.mjs";
|
|
2
|
+
import { FunctionBuilder } from "./FunctionBuilder-3jsoFffg.mjs";
|
|
3
|
+
import { Cron, ScheduleExpression } from "./Cron-JZkp_fHy.mjs";
|
|
4
4
|
import { Service } from "@geekmidas/services";
|
|
5
5
|
import { EventPublisher } from "@geekmidas/events";
|
|
6
6
|
import { Logger } from "@geekmidas/logger";
|
|
@@ -27,4 +27,4 @@ declare class CronBuilder<TInput extends ComposableStandardSchema, TServices ext
|
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
29
|
export { CronBuilder };
|
|
30
|
-
//# sourceMappingURL=CronBuilder-
|
|
30
|
+
//# sourceMappingURL=CronBuilder-BmFDO0Dm.d.mts.map
|
|
@@ -57,6 +57,10 @@ var Endpoint = class Endpoint extends Function {
|
|
|
57
57
|
actorExtractor;
|
|
58
58
|
/** Declarative audit definitions */
|
|
59
59
|
audits = [];
|
|
60
|
+
/** RLS configuration for this endpoint */
|
|
61
|
+
rlsConfig;
|
|
62
|
+
/** Whether to bypass RLS for this endpoint */
|
|
63
|
+
rlsBypass;
|
|
60
64
|
/** The endpoint handler function */
|
|
61
65
|
endpointFn;
|
|
62
66
|
/**
|
|
@@ -331,7 +335,7 @@ var Endpoint = class Endpoint extends Function {
|
|
|
331
335
|
* @param options.status - Success HTTP status code (default: 200)
|
|
332
336
|
* @param options.authorizer - Optional authorizer configuration
|
|
333
337
|
*/
|
|
334
|
-
constructor({ fn, method, route, description, tags, input, logger, output: outputSchema, services, timeout, memorySize, getSession, authorize, rateLimit, status = SuccessStatus.OK, publisherService, events, authorizer, auditorStorageService, actorExtractor, audits, databaseService }) {
|
|
338
|
+
constructor({ fn, method, route, description, tags, input, logger, output: outputSchema, services, timeout, memorySize, getSession, authorize, rateLimit, status = SuccessStatus.OK, publisherService, events, authorizer, auditorStorageService, actorExtractor, audits, databaseService, rlsConfig, rlsBypass }) {
|
|
335
339
|
super(fn, timeout, ConstructType.Endpoint, input, outputSchema, services, logger, publisherService, events, memorySize, auditorStorageService);
|
|
336
340
|
this.route = route;
|
|
337
341
|
this.method = method;
|
|
@@ -346,6 +350,8 @@ var Endpoint = class Endpoint extends Function {
|
|
|
346
350
|
if (actorExtractor) this.actorExtractor = actorExtractor;
|
|
347
351
|
if (audits) this.audits = audits;
|
|
348
352
|
if (databaseService) this.databaseService = databaseService;
|
|
353
|
+
if (rlsConfig) this.rlsConfig = rlsConfig;
|
|
354
|
+
if (rlsBypass) this.rlsBypass = rlsBypass;
|
|
349
355
|
}
|
|
350
356
|
};
|
|
351
357
|
/**
|
|
@@ -413,4 +419,4 @@ let SuccessStatus = /* @__PURE__ */ function(SuccessStatus$1) {
|
|
|
413
419
|
|
|
414
420
|
//#endregion
|
|
415
421
|
export { Endpoint, ResponseBuilder, SuccessStatus };
|
|
416
|
-
//# sourceMappingURL=Endpoint-
|
|
422
|
+
//# sourceMappingURL=Endpoint-B70_KKhu.mjs.map
|