quidproquo-webserver 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/lib/commonjs/actionProcessor/api/getHttpApiEventAutoRespondActionProcessor.js +5 -1
  2. package/lib/commonjs/actionProcessor/api/getHttpApiEventAutoRespondActionProcessor.js.map +1 -1
  3. package/lib/commonjs/actionProcessor/api/getHttpApiEventGetStorySessionActionProcessor.js +5 -1
  4. package/lib/commonjs/actionProcessor/api/getHttpApiEventGetStorySessionActionProcessor.js.map +1 -1
  5. package/lib/commonjs/actionProcessor/routeAuthValidation/getRouteAuthValidationDecodeActionProcessor.js +5 -3
  6. package/lib/commonjs/actionProcessor/routeAuthValidation/getRouteAuthValidationDecodeActionProcessor.js.map +1 -1
  7. package/lib/commonjs/actions/routeAuthValidation/RouteAuthDecodeOutcome.d.ts +5 -0
  8. package/lib/commonjs/actions/routeAuthValidation/RouteAuthDecodeOutcome.js +15 -0
  9. package/lib/commonjs/actions/routeAuthValidation/RouteAuthDecodeOutcome.js.map +1 -0
  10. package/lib/commonjs/actions/routeAuthValidation/RouteAuthDecodeResult.d.ts +10 -0
  11. package/lib/commonjs/actions/routeAuthValidation/RouteAuthDecodeResult.js +3 -0
  12. package/lib/commonjs/actions/routeAuthValidation/RouteAuthDecodeResult.js.map +1 -0
  13. package/lib/commonjs/actions/routeAuthValidation/askRouteAuthValidationDecode.d.ts +2 -2
  14. package/lib/commonjs/actions/routeAuthValidation/askRouteAuthValidationDecode.js.map +1 -1
  15. package/lib/commonjs/actions/routeAuthValidation/index.d.ts +2 -0
  16. package/lib/commonjs/actions/routeAuthValidation/index.js +2 -0
  17. package/lib/commonjs/actions/routeAuthValidation/index.js.map +1 -1
  18. package/lib/commonjs/stories/askGetHttpApiEventStorySession.js +21 -18
  19. package/lib/commonjs/stories/askGetHttpApiEventStorySession.js.map +1 -1
  20. package/lib/commonjs/stories/askRouteAuthValidationDecodeDefault.d.ts +3 -3
  21. package/lib/commonjs/stories/askRouteAuthValidationDecodeDefault.js +10 -6
  22. package/lib/commonjs/stories/askRouteAuthValidationDecodeDefault.js.map +1 -1
  23. package/lib/commonjs/stories/askValidateRouteAuth.js +8 -7
  24. package/lib/commonjs/stories/askValidateRouteAuth.js.map +1 -1
  25. package/lib/commonjs/utils/qpqConfigAccessorsUtils.js +2 -2
  26. package/lib/commonjs/utils/qpqConfigAccessorsUtils.js.map +1 -1
  27. package/lib/esm/actionProcessor/api/getHttpApiEventAutoRespondActionProcessor.js +6 -2
  28. package/lib/esm/actionProcessor/api/getHttpApiEventAutoRespondActionProcessor.js.map +1 -1
  29. package/lib/esm/actionProcessor/api/getHttpApiEventGetStorySessionActionProcessor.js +6 -2
  30. package/lib/esm/actionProcessor/api/getHttpApiEventGetStorySessionActionProcessor.js.map +1 -1
  31. package/lib/esm/actionProcessor/routeAuthValidation/getRouteAuthValidationDecodeActionProcessor.js +6 -4
  32. package/lib/esm/actionProcessor/routeAuthValidation/getRouteAuthValidationDecodeActionProcessor.js.map +1 -1
  33. package/lib/esm/actions/routeAuthValidation/RouteAuthDecodeOutcome.d.ts +5 -0
  34. package/lib/esm/actions/routeAuthValidation/RouteAuthDecodeOutcome.js +12 -0
  35. package/lib/esm/actions/routeAuthValidation/RouteAuthDecodeOutcome.js.map +1 -0
  36. package/lib/esm/actions/routeAuthValidation/RouteAuthDecodeResult.d.ts +10 -0
  37. package/lib/esm/actions/routeAuthValidation/RouteAuthDecodeResult.js +2 -0
  38. package/lib/esm/actions/routeAuthValidation/RouteAuthDecodeResult.js.map +1 -0
  39. package/lib/esm/actions/routeAuthValidation/askRouteAuthValidationDecode.d.ts +2 -2
  40. package/lib/esm/actions/routeAuthValidation/askRouteAuthValidationDecode.js.map +1 -1
  41. package/lib/esm/actions/routeAuthValidation/index.d.ts +2 -0
  42. package/lib/esm/actions/routeAuthValidation/index.js +2 -0
  43. package/lib/esm/actions/routeAuthValidation/index.js.map +1 -1
  44. package/lib/esm/stories/askGetHttpApiEventStorySession.js +23 -20
  45. package/lib/esm/stories/askGetHttpApiEventStorySession.js.map +1 -1
  46. package/lib/esm/stories/askRouteAuthValidationDecodeDefault.d.ts +3 -3
  47. package/lib/esm/stories/askRouteAuthValidationDecodeDefault.js +10 -6
  48. package/lib/esm/stories/askRouteAuthValidationDecodeDefault.js.map +1 -1
  49. package/lib/esm/stories/askValidateRouteAuth.js +9 -8
  50. package/lib/esm/stories/askValidateRouteAuth.js.map +1 -1
  51. package/lib/esm/utils/qpqConfigAccessorsUtils.js +2 -2
  52. package/lib/esm/utils/qpqConfigAccessorsUtils.js.map +1 -1
  53. package/package.json +3 -3
@@ -41,7 +41,11 @@ const getProcessAutoRespond = (qpqConfig) => {
41
41
  event: qpqEventRecord,
42
42
  routeAuthSettings: (_b = matchResult.config) === null || _b === void 0 ? void 0 : _b.routeAuthSettings,
43
43
  };
44
- const [authValid, authError] = yield validateAuth(authPayload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader);
44
+ // The matched route's processor overrides must be visible HERE, in the
45
+ // framework preamble: auth decode runs before the route story, so without
46
+ // this merge a per-route auth override would never see its own requests.
47
+ const mergedActionProcessorList = yield (0, quidproquo_core_1.mergeRuntimeActionProcessors)(qpqConfig, matchResult.runtime, actionProcessorList, dynamicModuleLoader);
48
+ const [authValid, authError] = yield validateAuth(authPayload, session, mergedActionProcessorList, logger, updateSession, dynamicModuleLoader);
45
49
  if (authError || !authValid) {
46
50
  return (0, quidproquo_core_1.actionResult)({
47
51
  status: 401,
@@ -1 +1 @@
1
- {"version":3,"file":"getHttpApiEventAutoRespondActionProcessor.js","sourceRoot":"","sources":["../../../../src/actionProcessor/api/getHttpApiEventAutoRespondActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAUyB;AAGzB,6EAAoG;AACpG,qDAA8F;AAC9F,yDAAyD;AAIzD,MAAM,4BAA4B,GAA4C;IAC5E,CAAC,mCAAuB,CAAC,YAAY,CAA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AAE,mBAAmB,CAAC,CAAC;QAEzI,IAAI,SAAS,IAAI,CAAC,SAAS,EAAE,CAAC;YAC5B,OAAO,IAAA,8BAAY,EAAC;gBAClB,MAAM,EAAE,GAAG;gBACX,eAAe,EAAE,KAAK;gBACtB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,OAAO,EAAE,8CAA8C;iBACxD,CAAC;gBACF,OAAO,EAAE,IAAA,4BAAc,EAAC,SAAS,EAAE,WAAW,CAAC,MAAM,IAAI,EAAE,EAAE,cAAc,CAAC,OAAO,CAAC;aACrF,CAAC,CAAC;QACL,CAAC;QAED,2FAA2F;QAC3F,IAAI,cAAc,CAAC,eAAe,EAAE,CAAC;YACnC,OAAO,IAAA,8BAAY,EAAC;gBAClB,MAAM,EAAE,4BAA4B,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,GAAG;gBACrF,eAAe,EAAE,KAAK;gBACtB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,SAAS,EAAE,cAAc,CAAC,eAAe,CAAC,SAAS;oBACnD,SAAS,EAAE,cAAc,CAAC,eAAe,CAAC,OAAO;iBAClD,CAAC;gBACF,OAAO,EAAE,IAAA,4BAAc,EAAC,SAAS,EAAE,WAAW,CAAC,MAAM,IAAI,EAAE,EAAE,cAAc,CAAC,OAAO,CAAC;aACrF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,IAAA,8BAAY,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,yCAAyC,GAAG,IAAA,uCAAqB,EAAC,yCAAuB,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n askEventAutoRespondBase,\n createActionProcessor,\n EventActionType,\n generateUuid,\n getProcessCustomImplementation,\n MatchStoryResult,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport { RouteOptions } from '../../config/settings/route';\nimport { askValidateRouteAuth, ValidateRouteAuthPayload } from '../../stories/askValidateRouteAuth';\nimport { FileUploadErrorTypeEnum, HTTPEvent, HTTPEventResponse } from '../../types/HTTPEvent';\nimport { getCorsHeaders } from '../../utils/headerUtils';\n\ntype InternalMatchResult = MatchStoryResult<any, RouteOptions>;\n\nconst fileUploadErrorHttpStatusMap: Record<FileUploadErrorTypeEnum, number> = {\n [FileUploadErrorTypeEnum.fileTooLarge]: 413,\n [FileUploadErrorTypeEnum.tooManyFiles]: 413,\n [FileUploadErrorTypeEnum.tooManyFields]: 400,\n [FileUploadErrorTypeEnum.disallowedMimeType]: 415,\n [FileUploadErrorTypeEnum.malformed]: 400,\n};\n\nconst getProcessAutoRespond = (qpqConfig: QPQConfig): ProcessorFor<typeof askEventAutoRespondBase> => {\n const validateAuth = getProcessCustomImplementation<any>(\n qpqConfig,\n askValidateRouteAuth,\n 'API Auth Validation',\n null,\n () => new Date().toISOString(),\n generateUuid,\n );\n\n return async ({ qpqEventRecord: rawEventRecord, matchResult }, session, actionProcessorList, logger, updateSession, dynamicModuleLoader) => {\n // This processor is registered only for the http api event source, so the base's\n // source-agnostic record is an HTTPEvent here.\n const qpqEventRecord = rawEventRecord as HTTPEvent;\n // Just auto respond for options requests\n if (qpqEventRecord.method === 'OPTIONS') {\n return actionResult({\n status: 200,\n isBase64Encoded: false,\n body: '',\n headers: getCorsHeaders(qpqConfig, matchResult.config || {}, qpqEventRecord.headers),\n });\n }\n\n const authPayload: ValidateRouteAuthPayload = {\n event: qpqEventRecord,\n routeAuthSettings: matchResult.config?.routeAuthSettings,\n };\n\n const [authValid, authError] = await validateAuth(authPayload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader);\n\n if (authError || !authValid) {\n return actionResult({\n status: 401,\n isBase64Encoded: false,\n body: JSON.stringify({\n message: 'You are unauthorized to access this resource',\n }),\n headers: getCorsHeaders(qpqConfig, matchResult.config || {}, qpqEventRecord.headers),\n });\n }\n\n // Reject invalid multipart uploads before the route story runs (after auth, so a 401 wins)\n if (qpqEventRecord.fileUploadError) {\n return actionResult({\n status: fileUploadErrorHttpStatusMap[qpqEventRecord.fileUploadError.errorType] || 400,\n isBase64Encoded: false,\n body: JSON.stringify({\n errorType: qpqEventRecord.fileUploadError.errorType,\n errorText: qpqEventRecord.fileUploadError.message,\n }),\n headers: getCorsHeaders(qpqConfig, matchResult.config || {}, qpqEventRecord.headers),\n });\n }\n\n return actionResult(null);\n };\n};\n\nexport const getHttpApiEventAutoRespondActionProcessor = createActionProcessor(askEventAutoRespondBase, getProcessAutoRespond);\n"]}
1
+ {"version":3,"file":"getHttpApiEventAutoRespondActionProcessor.js","sourceRoot":"","sources":["../../../../src/actionProcessor/api/getHttpApiEventAutoRespondActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAWyB;AAGzB,6EAAoG;AACpG,qDAA8F;AAC9F,yDAAyD;AAIzD,MAAM,4BAA4B,GAA4C;IAC5E,CAAC,mCAAuB,CAAC,YAAY,CAAC,EAAE,GAAG;IAC3C,CAAC,mCAAuB,CAAC,YAAY,CAAC,EAAE,GAAG;IAC3C,CAAC,mCAAuB,CAAC,aAAa,CAAC,EAAE,GAAG;IAC5C,CAAC,mCAAuB,CAAC,kBAAkB,CAAC,EAAE,GAAG;IACjD,CAAC,mCAAuB,CAAC,SAAS,CAAC,EAAE,GAAG;CACzC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,SAAoB,EAAgD,EAAE;IACnG,MAAM,YAAY,GAAG,IAAA,gDAA8B,EACjD,SAAS,EACT,2CAAoB,EACpB,qBAAqB,EACrB,IAAI,EACJ,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAC9B,8BAAY,CACb,CAAC;IAEF,OAAO,yFAAkI,EAAE,gIAA7H,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB;;QACrI,iFAAiF;QACjF,+CAA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AAC;gBAClB,MAAM,EAAE,4BAA4B,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,GAAG;gBACrF,eAAe,EAAE,KAAK;gBACtB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,SAAS,EAAE,cAAc,CAAC,eAAe,CAAC,SAAS;oBACnD,SAAS,EAAE,cAAc,CAAC,eAAe,CAAC,OAAO;iBAClD,CAAC;gBACF,OAAO,EAAE,IAAA,4BAAc,EAAC,SAAS,EAAE,WAAW,CAAC,MAAM,IAAI,EAAE,EAAE,cAAc,CAAC,OAAO,CAAC;aACrF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,IAAA,8BAAY,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,yCAAyC,GAAG,IAAA,uCAAqB,EAAC,yCAAuB,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n askEventAutoRespondBase,\n createActionProcessor,\n EventActionType,\n generateUuid,\n getProcessCustomImplementation,\n MatchStoryResult,\n mergeRuntimeActionProcessors,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport { RouteOptions } from '../../config/settings/route';\nimport { askValidateRouteAuth, ValidateRouteAuthPayload } from '../../stories/askValidateRouteAuth';\nimport { FileUploadErrorTypeEnum, HTTPEvent, HTTPEventResponse } from '../../types/HTTPEvent';\nimport { getCorsHeaders } from '../../utils/headerUtils';\n\ntype InternalMatchResult = MatchStoryResult<any, RouteOptions>;\n\nconst fileUploadErrorHttpStatusMap: Record<FileUploadErrorTypeEnum, number> = {\n [FileUploadErrorTypeEnum.fileTooLarge]: 413,\n [FileUploadErrorTypeEnum.tooManyFiles]: 413,\n [FileUploadErrorTypeEnum.tooManyFields]: 400,\n [FileUploadErrorTypeEnum.disallowedMimeType]: 415,\n [FileUploadErrorTypeEnum.malformed]: 400,\n};\n\nconst getProcessAutoRespond = (qpqConfig: QPQConfig): ProcessorFor<typeof askEventAutoRespondBase> => {\n const validateAuth = getProcessCustomImplementation<any>(\n qpqConfig,\n askValidateRouteAuth,\n 'API Auth Validation',\n null,\n () => new Date().toISOString(),\n generateUuid,\n );\n\n return async ({ qpqEventRecord: rawEventRecord, matchResult }, session, actionProcessorList, logger, updateSession, dynamicModuleLoader) => {\n // This processor is registered only for the http api event source, so the base's\n // source-agnostic record is an HTTPEvent here.\n const qpqEventRecord = rawEventRecord as HTTPEvent;\n // Just auto respond for options requests\n if (qpqEventRecord.method === 'OPTIONS') {\n return actionResult({\n status: 200,\n isBase64Encoded: false,\n body: '',\n headers: getCorsHeaders(qpqConfig, matchResult.config || {}, qpqEventRecord.headers),\n });\n }\n\n const authPayload: ValidateRouteAuthPayload = {\n event: qpqEventRecord,\n routeAuthSettings: matchResult.config?.routeAuthSettings,\n };\n\n // The matched route's processor overrides must be visible HERE, in the\n // framework preamble: auth decode runs before the route story, so without\n // this merge a per-route auth override would never see its own requests.\n const mergedActionProcessorList = await mergeRuntimeActionProcessors(qpqConfig, matchResult.runtime, actionProcessorList, dynamicModuleLoader);\n\n const [authValid, authError] = await validateAuth(authPayload, session, mergedActionProcessorList, logger, updateSession, dynamicModuleLoader);\n\n if (authError || !authValid) {\n return actionResult({\n status: 401,\n isBase64Encoded: false,\n body: JSON.stringify({\n message: 'You are unauthorized to access this resource',\n }),\n headers: getCorsHeaders(qpqConfig, matchResult.config || {}, qpqEventRecord.headers),\n });\n }\n\n // Reject invalid multipart uploads before the route story runs (after auth, so a 401 wins)\n if (qpqEventRecord.fileUploadError) {\n return actionResult({\n status: fileUploadErrorHttpStatusMap[qpqEventRecord.fileUploadError.errorType] || 400,\n isBase64Encoded: false,\n body: JSON.stringify({\n errorType: qpqEventRecord.fileUploadError.errorType,\n errorText: qpqEventRecord.fileUploadError.message,\n }),\n headers: getCorsHeaders(qpqConfig, matchResult.config || {}, qpqEventRecord.headers),\n });\n }\n\n return actionResult(null);\n };\n};\n\nexport const getHttpApiEventAutoRespondActionProcessor = createActionProcessor(askEventAutoRespondBase, getProcessAutoRespond);\n"]}
@@ -23,7 +23,11 @@ const getProcessGetStorySession = (qpqConfig) => {
23
23
  routeAuthSettings: (_b = matchStoryResult.config) === null || _b === void 0 ? void 0 : _b.routeAuthSettings,
24
24
  session,
25
25
  };
26
- const [storySession, error] = yield getSession(payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader);
26
+ // Same merge as the auto-respond preamble: the session-seeding decode must
27
+ // also see the matched route's processor overrides, or a custom validator's
28
+ // decoded identity would never reach the story session.
29
+ const mergedActionProcessorList = yield (0, quidproquo_core_1.mergeRuntimeActionProcessors)(qpqConfig, matchStoryResult.runtime, actionProcessorList, dynamicModuleLoader);
30
+ const [storySession, error] = yield getSession(payload, session, mergedActionProcessorList, logger, updateSession, dynamicModuleLoader);
27
31
  if (error) {
28
32
  return (0, quidproquo_core_1.actionResult)(void 0);
29
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getHttpApiEventGetStorySessionActionProcessor.js","sourceRoot":"","sources":["../../../../src/actionProcessor/api/getHttpApiEventGetStorySessionActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAWyB;AAGzB,iGAAkI;AAKlI,MAAM,yBAAyB,GAAG,CAAC,SAAoB,EAAoD,EAAE;IAC3G,MAAM,UAAU,GAAG,IAAA,gDAA8B,EAC/C,SAAS,EACT,+DAA8B,EAC9B,uBAAuB,EACvB,IAAI,EACJ,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAC9B,8BAAY,CACb,CAAC;IAEF,OAAO,yFAAuH,EAAE,gIAAlH,EAAE,gBAAgB,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB;;QAC1H,MAAM,OAAO,GAAuC;YAClD,+EAA+E;YAC/E,+BAA+B;YAC/B,KAAK,EAAE,cAA2B;YAClC,iBAAiB,EAAE,MAAA,gBAAgB,CAAC,MAAM,0CAAE,iBAAiB;YAC7D,OAAO;SACR,CAAC;QAEF,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC;QAElI,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAA,8BAAY,EAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,CAAC;QAED,OAAO,IAAA,8BAAY,EAAC,YAAY,CAAC,CAAC;IACpC,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,6CAA6C,GAAG,IAAA,uCAAqB,EAAC,6CAA2B,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n askEventGetStorySessionBase,\n createActionProcessor,\n EventActionType,\n generateUuid,\n getProcessCustomImplementation,\n MatchStoryResult,\n ProcessorFor,\n QPQConfig,\n StorySession,\n} from 'quidproquo-core';\n\nimport { RouteOptions } from '../../config/settings/route';\nimport { askGetHttpApiEventStorySession, GetHttpApiEventStorySessionPayload } from '../../stories/askGetHttpApiEventStorySession';\nimport { HTTPEvent } from '../../types/HTTPEvent';\n\ntype InternalMatchResult = MatchStoryResult<any, RouteOptions>;\n\nconst getProcessGetStorySession = (qpqConfig: QPQConfig): ProcessorFor<typeof askEventGetStorySessionBase> => {\n const getSession = getProcessCustomImplementation<any>(\n qpqConfig,\n askGetHttpApiEventStorySession,\n 'API Get Story Session',\n null,\n () => new Date().toISOString(),\n generateUuid,\n );\n\n return async ({ matchStoryResult, qpqEventRecord }, session, actionProcessorList, logger, updateSession, dynamicModuleLoader) => {\n const payload: GetHttpApiEventStorySessionPayload = {\n // Registered only for the http api event source, so the base's source-agnostic\n // record is an HTTPEvent here.\n event: qpqEventRecord as HTTPEvent,\n routeAuthSettings: matchStoryResult.config?.routeAuthSettings,\n session,\n };\n\n const [storySession, error] = await getSession(payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader);\n\n if (error) {\n return actionResult(void 0);\n }\n\n return actionResult(storySession);\n };\n};\n\nexport const getHttpApiEventGetStorySessionActionProcessor = createActionProcessor(askEventGetStorySessionBase, getProcessGetStorySession);\n"]}
1
+ {"version":3,"file":"getHttpApiEventGetStorySessionActionProcessor.js","sourceRoot":"","sources":["../../../../src/actionProcessor/api/getHttpApiEventGetStorySessionActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAYyB;AAGzB,iGAAkI;AAKlI,MAAM,yBAAyB,GAAG,CAAC,SAAoB,EAAoD,EAAE;IAC3G,MAAM,UAAU,GAAG,IAAA,gDAA8B,EAC/C,SAAS,EACT,+DAA8B,EAC9B,uBAAuB,EACvB,IAAI,EACJ,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAC9B,8BAAY,CACb,CAAC;IAEF,OAAO,yFAAuH,EAAE,gIAAlH,EAAE,gBAAgB,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB;;QAC1H,MAAM,OAAO,GAAuC;YAClD,+EAA+E;YAC/E,+BAA+B;YAC/B,KAAK,EAAE,cAA2B;YAClC,iBAAiB,EAAE,MAAA,gBAAgB,CAAC,MAAM,0CAAE,iBAAiB;YAC7D,OAAO;SACR,CAAC;QAEF,2EAA2E;QAC3E,4EAA4E;QAC5E,wDAAwD;QACxD,MAAM,yBAAyB,GAAG,MAAM,IAAA,8CAA4B,EAClE,SAAS,EACT,gBAAgB,CAAC,OAAO,EACxB,mBAAmB,EACnB,mBAAmB,CACpB,CAAC;QAEF,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC;QAExI,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAA,8BAAY,EAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,CAAC;QAED,OAAO,IAAA,8BAAY,EAAC,YAAY,CAAC,CAAC;IACpC,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,6CAA6C,GAAG,IAAA,uCAAqB,EAAC,6CAA2B,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n askEventGetStorySessionBase,\n createActionProcessor,\n EventActionType,\n generateUuid,\n getProcessCustomImplementation,\n MatchStoryResult,\n mergeRuntimeActionProcessors,\n ProcessorFor,\n QPQConfig,\n StorySession,\n} from 'quidproquo-core';\n\nimport { RouteOptions } from '../../config/settings/route';\nimport { askGetHttpApiEventStorySession, GetHttpApiEventStorySessionPayload } from '../../stories/askGetHttpApiEventStorySession';\nimport { HTTPEvent } from '../../types/HTTPEvent';\n\ntype InternalMatchResult = MatchStoryResult<any, RouteOptions>;\n\nconst getProcessGetStorySession = (qpqConfig: QPQConfig): ProcessorFor<typeof askEventGetStorySessionBase> => {\n const getSession = getProcessCustomImplementation<any>(\n qpqConfig,\n askGetHttpApiEventStorySession,\n 'API Get Story Session',\n null,\n () => new Date().toISOString(),\n generateUuid,\n );\n\n return async ({ matchStoryResult, qpqEventRecord }, session, actionProcessorList, logger, updateSession, dynamicModuleLoader) => {\n const payload: GetHttpApiEventStorySessionPayload = {\n // Registered only for the http api event source, so the base's source-agnostic\n // record is an HTTPEvent here.\n event: qpqEventRecord as HTTPEvent,\n routeAuthSettings: matchStoryResult.config?.routeAuthSettings,\n session,\n };\n\n // Same merge as the auto-respond preamble: the session-seeding decode must\n // also see the matched route's processor overrides, or a custom validator's\n // decoded identity would never reach the story session.\n const mergedActionProcessorList = await mergeRuntimeActionProcessors(\n qpqConfig,\n matchStoryResult.runtime,\n actionProcessorList,\n dynamicModuleLoader,\n );\n\n const [storySession, error] = await getSession(payload, session, mergedActionProcessorList, logger, updateSession, dynamicModuleLoader);\n\n if (error) {\n return actionResult(void 0);\n }\n\n return actionResult(storySession);\n };\n};\n\nexport const getHttpApiEventGetStorySessionActionProcessor = createActionProcessor(askEventGetStorySessionBase, getProcessGetStorySession);\n"]}
@@ -17,10 +17,12 @@ const getProcessRouteAuthValidationDecode = (qpqConfig) => {
17
17
  const decodeAuth = (0, quidproquo_core_1.getProcessCustomImplementation)(qpqConfig, askRouteAuthValidationDecodeDefault_1.askRouteAuthValidationDecodeDefault, 'Route Auth Validation Decode', null, () => new Date().toISOString(), quidproquo_core_1.generateUuid);
18
18
  return (payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader, streamRegistry) => __awaiter(void 0, void 0, void 0, function* () {
19
19
  const [result, error] = yield decodeAuth(payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader, streamRegistry);
20
- if (error) {
21
- return (0, quidproquo_core_1.actionResult)(null);
20
+ // A decode that errored (or returned nothing) is invalid, never
21
+ // notApplicable: failing open here would skip token auth entirely.
22
+ if (error || !result) {
23
+ return (0, quidproquo_core_1.actionResult)({ outcome: routeAuthValidation_1.RouteAuthDecodeOutcome.invalid });
22
24
  }
23
- return (0, quidproquo_core_1.actionResult)(result !== null && result !== void 0 ? result : null);
25
+ return (0, quidproquo_core_1.actionResult)(result);
24
26
  });
25
27
  };
26
28
  exports.getRouteAuthValidationDecodeActionProcessor = (0, quidproquo_core_1.createActionProcessor)(routeAuthValidation_1.askRouteAuthValidationDecode, getProcessRouteAuthValidationDecode);
@@ -1 +1 @@
1
- {"version":3,"file":"getRouteAuthValidationDecodeActionProcessor.js","sourceRoot":"","sources":["../../../../src/actionProcessor/routeAuthValidation/getRouteAuthValidationDecodeActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA6I;AAE7I,2EAAgH;AAChH,2GAAwG;AAExG,MAAM,mCAAmC,GAAG,CAAC,SAAoB,EAAqD,EAAE;IACtH,MAAM,UAAU,GAAG,IAAA,gDAA8B,EAC/C,SAAS,EACT,yEAAmC,EACnC,8BAA8B,EAC9B,IAAI,EACJ,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAC9B,8BAAY,CACb,CAAC;IAEF,OAAO,CAAO,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,EAAE;QACjH,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAAC;QAE5I,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAA,8BAAY,EAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAED,OAAO,IAAA,8BAAY,EAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,CAAC,CAAC;IACtC,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,2CAA2C,GAAG,IAAA,uCAAqB,EAAC,kDAA4B,EAAE,mCAAmC,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, generateUuid, getProcessCustomImplementation, ProcessorFor, QPQConfig } from 'quidproquo-core';\n\nimport { askRouteAuthValidationDecode, RouteAuthValidationActionType } from '../../actions/routeAuthValidation';\nimport { askRouteAuthValidationDecodeDefault } from '../../stories/askRouteAuthValidationDecodeDefault';\n\nconst getProcessRouteAuthValidationDecode = (qpqConfig: QPQConfig): ProcessorFor<typeof askRouteAuthValidationDecode> => {\n const decodeAuth = getProcessCustomImplementation<ProcessorFor<typeof askRouteAuthValidationDecode>>(\n qpqConfig,\n askRouteAuthValidationDecodeDefault,\n 'Route Auth Validation Decode',\n null,\n () => new Date().toISOString(),\n generateUuid,\n );\n\n return async (payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader, streamRegistry) => {\n const [result, error] = await decodeAuth(payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader, streamRegistry);\n\n if (error) {\n return actionResult(null);\n }\n\n return actionResult(result ?? null);\n };\n};\n\nexport const getRouteAuthValidationDecodeActionProcessor = createActionProcessor(askRouteAuthValidationDecode, getProcessRouteAuthValidationDecode);\n"]}
1
+ {"version":3,"file":"getRouteAuthValidationDecodeActionProcessor.js","sourceRoot":"","sources":["../../../../src/actionProcessor/routeAuthValidation/getRouteAuthValidationDecodeActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA6I;AAE7I,2EAAwI;AACxI,2GAAwG;AAExG,MAAM,mCAAmC,GAAG,CAAC,SAAoB,EAAqD,EAAE;IACtH,MAAM,UAAU,GAAG,IAAA,gDAA8B,EAC/C,SAAS,EACT,yEAAmC,EACnC,8BAA8B,EAC9B,IAAI,EACJ,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAC9B,8BAAY,CACb,CAAC;IAEF,OAAO,CAAO,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,EAAE;QACjH,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAAC;QAE5I,gEAAgE;QAChE,mEAAmE;QACnE,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;YACrB,OAAO,IAAA,8BAAY,EAAC,EAAE,OAAO,EAAE,4CAAsB,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,IAAA,8BAAY,EAAC,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,2CAA2C,GAAG,IAAA,uCAAqB,EAAC,kDAA4B,EAAE,mCAAmC,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, generateUuid, getProcessCustomImplementation, ProcessorFor, QPQConfig } from 'quidproquo-core';\n\nimport { askRouteAuthValidationDecode, RouteAuthDecodeOutcome, RouteAuthValidationActionType } from '../../actions/routeAuthValidation';\nimport { askRouteAuthValidationDecodeDefault } from '../../stories/askRouteAuthValidationDecodeDefault';\n\nconst getProcessRouteAuthValidationDecode = (qpqConfig: QPQConfig): ProcessorFor<typeof askRouteAuthValidationDecode> => {\n const decodeAuth = getProcessCustomImplementation<ProcessorFor<typeof askRouteAuthValidationDecode>>(\n qpqConfig,\n askRouteAuthValidationDecodeDefault,\n 'Route Auth Validation Decode',\n null,\n () => new Date().toISOString(),\n generateUuid,\n );\n\n return async (payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader, streamRegistry) => {\n const [result, error] = await decodeAuth(payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader, streamRegistry);\n\n // A decode that errored (or returned nothing) is invalid, never\n // notApplicable: failing open here would skip token auth entirely.\n if (error || !result) {\n return actionResult({ outcome: RouteAuthDecodeOutcome.invalid });\n }\n\n return actionResult(result);\n };\n};\n\nexport const getRouteAuthValidationDecodeActionProcessor = createActionProcessor(askRouteAuthValidationDecode, getProcessRouteAuthValidationDecode);\n"]}
@@ -0,0 +1,5 @@
1
+ export declare enum RouteAuthDecodeOutcome {
2
+ notApplicable = "notApplicable",
3
+ valid = "valid",
4
+ invalid = "invalid"
5
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RouteAuthDecodeOutcome = void 0;
4
+ var RouteAuthDecodeOutcome;
5
+ (function (RouteAuthDecodeOutcome) {
6
+ // No token auth is configured for the route: the request passes with an
7
+ // anonymous session.
8
+ RouteAuthDecodeOutcome["notApplicable"] = "notApplicable";
9
+ // The token decoded and validated: the request passes and the decoded token
10
+ // is seeded onto the story session.
11
+ RouteAuthDecodeOutcome["valid"] = "valid";
12
+ // Token auth applies and the request did not satisfy it: 401.
13
+ RouteAuthDecodeOutcome["invalid"] = "invalid";
14
+ })(RouteAuthDecodeOutcome || (exports.RouteAuthDecodeOutcome = RouteAuthDecodeOutcome = {}));
15
+ //# sourceMappingURL=RouteAuthDecodeOutcome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouteAuthDecodeOutcome.js","sourceRoot":"","sources":["../../../../src/actions/routeAuthValidation/RouteAuthDecodeOutcome.ts"],"names":[],"mappings":";;;AAAA,IAAY,sBAWX;AAXD,WAAY,sBAAsB;IAChC,wEAAwE;IACxE,qBAAqB;IACrB,yDAA+B,CAAA;IAE/B,4EAA4E;IAC5E,oCAAoC;IACpC,yCAAe,CAAA;IAEf,8DAA8D;IAC9D,6CAAmB,CAAA;AACrB,CAAC,EAXW,sBAAsB,sCAAtB,sBAAsB,QAWjC","sourcesContent":["export enum RouteAuthDecodeOutcome {\n // No token auth is configured for the route: the request passes with an\n // anonymous session.\n notApplicable = 'notApplicable',\n\n // The token decoded and validated: the request passes and the decoded token\n // is seeded onto the story session.\n valid = 'valid',\n\n // Token auth applies and the request did not satisfy it: 401.\n invalid = 'invalid',\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { DecodedAccessToken } from 'quidproquo-core';
2
+ import { RouteAuthDecodeOutcome } from './RouteAuthDecodeOutcome';
3
+ export type RouteAuthDecodeResult = {
4
+ outcome: RouteAuthDecodeOutcome.notApplicable;
5
+ } | {
6
+ outcome: RouteAuthDecodeOutcome.valid;
7
+ decodedAccessToken: DecodedAccessToken;
8
+ } | {
9
+ outcome: RouteAuthDecodeOutcome.invalid;
10
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=RouteAuthDecodeResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouteAuthDecodeResult.js","sourceRoot":"","sources":["../../../../src/actions/routeAuthValidation/RouteAuthDecodeResult.ts"],"names":[],"mappings":"","sourcesContent":["import { DecodedAccessToken } from 'quidproquo-core';\n\nimport { RouteAuthDecodeOutcome } from './RouteAuthDecodeOutcome';\n\n// The tri-state result of the route auth decode action. The outcomes are\n// explicit (no null overloading) because \"no token auth configured\" and\n// \"token auth failed\" must never be conflated: the first passes as anonymous,\n// the second is a 401.\nexport type RouteAuthDecodeResult =\n | { outcome: RouteAuthDecodeOutcome.notApplicable }\n | { outcome: RouteAuthDecodeOutcome.valid; decodedAccessToken: DecodedAccessToken }\n | { outcome: RouteAuthDecodeOutcome.invalid };\n"]}
@@ -1,6 +1,6 @@
1
- import { DecodedAccessToken } from 'quidproquo-core';
2
1
  import { RouteAuthSettings } from '../../config/settings/route';
3
2
  import { HTTPEvent } from '../../types/HTTPEvent';
3
+ import { RouteAuthDecodeResult } from './RouteAuthDecodeResult';
4
4
  import { RouteAuthValidationActionType } from './RouteAuthValidationActionType';
5
5
  export interface RouteAuthValidationDecodeActionPayload {
6
6
  event: HTTPEvent;
@@ -11,4 +11,4 @@ export declare const askRouteAuthValidationDecode: import("quidproquo-core").Act
11
11
  event: HTTPEvent;
12
12
  routeAuthSettings: RouteAuthSettings;
13
13
  ignoreExpiration: boolean;
14
- }, DecodedAccessToken | null, never>;
14
+ }, RouteAuthDecodeResult, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"askRouteAuthValidationDecode.js","sourceRoot":"","sources":["../../../../src/actions/routeAuthValidation/askRouteAuthValidationDecode.ts"],"names":[],"mappings":";;;AAAA,qDAA4E;AAI5E,mFAAgF;AAQnE,QAAA,4BAA4B,GAAG,IAAA,uCAAqB,GAA6B,CAAC;IAC7F,UAAU,EAAE,6DAA6B,CAAC,MAAM;IAChD,UAAU,EAAE,CAAC,KAAgB,EAAE,iBAAoC,EAAE,gBAAyB,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CACpJ,CAAC,CAAC","sourcesContent":["import { createActionRequester, DecodedAccessToken } from 'quidproquo-core';\n\nimport { RouteAuthSettings } from '../../config/settings/route';\nimport { HTTPEvent } from '../../types/HTTPEvent';\nimport { RouteAuthValidationActionType } from './RouteAuthValidationActionType';\n\nexport interface RouteAuthValidationDecodeActionPayload {\n event: HTTPEvent;\n routeAuthSettings: RouteAuthSettings;\n ignoreExpiration: boolean;\n}\n\nexport const askRouteAuthValidationDecode = createActionRequester<DecodedAccessToken | null>()({\n actionType: RouteAuthValidationActionType.Decode,\n getPayload: (event: HTTPEvent, routeAuthSettings: RouteAuthSettings, ignoreExpiration: boolean) => ({ event, routeAuthSettings, ignoreExpiration }),\n});\n"]}
1
+ {"version":3,"file":"askRouteAuthValidationDecode.js","sourceRoot":"","sources":["../../../../src/actions/routeAuthValidation/askRouteAuthValidationDecode.ts"],"names":[],"mappings":";;;AAAA,qDAAwD;AAKxD,mFAAgF;AAQnE,QAAA,4BAA4B,GAAG,IAAA,uCAAqB,GAAyB,CAAC;IACzF,UAAU,EAAE,6DAA6B,CAAC,MAAM;IAChD,UAAU,EAAE,CAAC,KAAgB,EAAE,iBAAoC,EAAE,gBAAyB,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CACpJ,CAAC,CAAC","sourcesContent":["import { createActionRequester } from 'quidproquo-core';\n\nimport { RouteAuthSettings } from '../../config/settings/route';\nimport { HTTPEvent } from '../../types/HTTPEvent';\nimport { RouteAuthDecodeResult } from './RouteAuthDecodeResult';\nimport { RouteAuthValidationActionType } from './RouteAuthValidationActionType';\n\nexport interface RouteAuthValidationDecodeActionPayload {\n event: HTTPEvent;\n routeAuthSettings: RouteAuthSettings;\n ignoreExpiration: boolean;\n}\n\nexport const askRouteAuthValidationDecode = createActionRequester<RouteAuthDecodeResult>()({\n actionType: RouteAuthValidationActionType.Decode,\n getPayload: (event: HTTPEvent, routeAuthSettings: RouteAuthSettings, ignoreExpiration: boolean) => ({ event, routeAuthSettings, ignoreExpiration }),\n});\n"]}
@@ -1,2 +1,4 @@
1
1
  export * from './askRouteAuthValidationDecode';
2
+ export * from './RouteAuthDecodeOutcome';
3
+ export * from './RouteAuthDecodeResult';
2
4
  export * from './RouteAuthValidationActionType';
@@ -15,5 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./askRouteAuthValidationDecode"), exports);
18
+ __exportStar(require("./RouteAuthDecodeOutcome"), exports);
19
+ __exportStar(require("./RouteAuthDecodeResult"), exports);
18
20
  __exportStar(require("./RouteAuthValidationActionType"), exports);
19
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/routeAuthValidation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,kEAAgD","sourcesContent":["export * from './askRouteAuthValidationDecode';\nexport * from './RouteAuthValidationActionType';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/routeAuthValidation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,2DAAyC;AACzC,0DAAwC;AACxC,kEAAgD","sourcesContent":["export * from './askRouteAuthValidationDecode';\nexport * from './RouteAuthDecodeOutcome';\nexport * from './RouteAuthDecodeResult';\nexport * from './RouteAuthValidationActionType';\n"]}
@@ -5,27 +5,30 @@ const routeAuthValidation_1 = require("../actions/routeAuthValidation");
5
5
  const headerUtils_1 = require("../utils/headerUtils");
6
6
  const jwtUtils_1 = require("../utils/jwtUtils");
7
7
  function* askGetHttpApiEventStorySession({ event, routeAuthSettings, session, }) {
8
- const accessToken = (0, headerUtils_1.getAccessTokenFromHeaders)(event.headers);
9
- if (!accessToken) {
10
- return void 0;
8
+ // Always yield the decode, mirroring askValidateRouteAuth, so a per-route
9
+ // processor override's identity reaches the session. Auth already ran in the
10
+ // auto-respond preamble, hence ignoreExpiration: true.
11
+ const decodeResult = yield* (0, routeAuthValidation_1.askRouteAuthValidationDecode)(event, routeAuthSettings || {}, true);
12
+ if (decodeResult.outcome === routeAuthValidation_1.RouteAuthDecodeOutcome.valid) {
13
+ return Object.assign(Object.assign({}, session), { decodedAccessToken: decodeResult.decodedAccessToken });
11
14
  }
12
- // If this endpoint has no auth settings, BUT we do have an access token
13
- // then we want to just attempt to extract info for logs, but we will say that its wasValid = false
14
- if (!(routeAuthSettings === null || routeAuthSettings === void 0 ? void 0 : routeAuthSettings.userDirectoryName)) {
15
- const info = (0, jwtUtils_1.unsafeDecodeJWTPayload)(accessToken);
16
- return Object.assign(Object.assign({}, session), { decodedAccessToken: {
17
- exp: (info === null || info === void 0 ? void 0 : info.exp) || 0,
18
- userDirectory: '',
19
- userId: (info === null || info === void 0 ? void 0 : info.sub) || (info === null || info === void 0 ? void 0 : info.id) || (info === null || info === void 0 ? void 0 : info.userId) || (info === null || info === void 0 ? void 0 : info.username) || '',
20
- username: (info === null || info === void 0 ? void 0 : info.username) || (info === null || info === void 0 ? void 0 : info.userId) || (info === null || info === void 0 ? void 0 : info.sub) || (info === null || info === void 0 ? void 0 : info.id) || '',
21
- wasValid: false,
22
- } });
15
+ // Normally unreachable: an invalid request already 401'd in the preamble.
16
+ if (decodeResult.outcome === routeAuthValidation_1.RouteAuthDecodeOutcome.invalid) {
17
+ return void 0;
23
18
  }
24
- // Auth was already validated in auto-respond, so we can use ignoreExpiration: true
25
- const decoded = yield* (0, routeAuthValidation_1.askRouteAuthValidationDecode)(event, routeAuthSettings, true);
26
- if (!decoded) {
19
+ // Not applicable: no token auth configured for this route. If an access token
20
+ // was sent anyway, extract info for the logs only, marked wasValid: false.
21
+ const accessToken = (0, headerUtils_1.getAccessTokenFromHeaders)(event.headers);
22
+ if (!accessToken) {
27
23
  return void 0;
28
24
  }
29
- return Object.assign(Object.assign({}, session), { decodedAccessToken: decoded });
25
+ const info = (0, jwtUtils_1.unsafeDecodeJWTPayload)(accessToken);
26
+ return Object.assign(Object.assign({}, session), { decodedAccessToken: {
27
+ exp: (info === null || info === void 0 ? void 0 : info.exp) || 0,
28
+ userDirectory: '',
29
+ userId: (info === null || info === void 0 ? void 0 : info.sub) || (info === null || info === void 0 ? void 0 : info.id) || (info === null || info === void 0 ? void 0 : info.userId) || (info === null || info === void 0 ? void 0 : info.username) || '',
30
+ username: (info === null || info === void 0 ? void 0 : info.username) || (info === null || info === void 0 ? void 0 : info.userId) || (info === null || info === void 0 ? void 0 : info.sub) || (info === null || info === void 0 ? void 0 : info.id) || '',
31
+ wasValid: false,
32
+ } });
30
33
  }
31
34
  //# sourceMappingURL=askGetHttpApiEventStorySession.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"askGetHttpApiEventStorySession.js","sourceRoot":"","sources":["../../../src/stories/askGetHttpApiEventStorySession.ts"],"names":[],"mappings":";;AAcA,wEA+CC;AA3DD,wEAA8E;AAG9E,sDAAiE;AACjE,gDAA2D;AAQ3D,QAAe,CAAC,CAAC,8BAA8B,CAAC,EAC9C,KAAK,EACL,iBAAiB,EACjB,OAAO,GAC4B;IACnC,MAAM,WAAW,GAAG,IAAA,uCAAyB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE7D,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC,CAAC;IAChB,CAAC;IAED,wEAAwE;IACxE,mGAAmG;IACnG,IAAI,CAAC,CAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,iBAAiB,CAAA,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,IAAA,iCAAsB,EAMhC,WAAW,CAAC,CAAC;QAEhB,uCACK,OAAO,KAEV,kBAAkB,EAAE;gBAClB,GAAG,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,KAAI,CAAC;gBACnB,aAAa,EAAE,EAAE;gBACjB,MAAM,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,MAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAA,KAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAA,KAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,CAAA,IAAI,EAAE;gBACrE,QAAQ,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,MAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAA,KAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,CAAA,KAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAA,IAAI,EAAE;gBACvE,QAAQ,EAAE,KAAK;aAChB,IACD;IACJ,CAAC;IAED,mFAAmF;IACnF,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,IAAA,kDAA4B,EAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;IAEpF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAC,CAAC;IAChB,CAAC;IAED,uCACK,OAAO,KAEV,kBAAkB,EAAE,OAAO,IAC3B;AACJ,CAAC","sourcesContent":["import { AskResponse, StorySession } from 'quidproquo-core';\n\nimport { askRouteAuthValidationDecode } from '../actions/routeAuthValidation';\nimport { RouteAuthSettings } from '../config/settings/route';\nimport { HTTPEvent } from '../types/HTTPEvent';\nimport { getAccessTokenFromHeaders } from '../utils/headerUtils';\nimport { unsafeDecodeJWTPayload } from '../utils/jwtUtils';\n\nexport interface GetHttpApiEventStorySessionPayload {\n event: HTTPEvent;\n routeAuthSettings?: RouteAuthSettings;\n session: StorySession;\n}\n\nexport function* askGetHttpApiEventStorySession({\n event,\n routeAuthSettings,\n session,\n}: GetHttpApiEventStorySessionPayload): AskResponse<StorySession | undefined> {\n const accessToken = getAccessTokenFromHeaders(event.headers);\n\n if (!accessToken) {\n return void 0;\n }\n\n // If this endpoint has no auth settings, BUT we do have an access token\n // then we want to just attempt to extract info for logs, but we will say that its wasValid = false\n if (!routeAuthSettings?.userDirectoryName) {\n const info = unsafeDecodeJWTPayload<{\n sub?: string;\n userId?: string;\n username?: string;\n id?: string;\n exp?: number;\n }>(accessToken);\n\n return {\n ...session,\n\n decodedAccessToken: {\n exp: info?.exp || 0,\n userDirectory: '',\n userId: info?.sub || info?.id || info?.userId || info?.username || '',\n username: info?.username || info?.userId || info?.sub || info?.id || '',\n wasValid: false,\n },\n };\n }\n\n // Auth was already validated in auto-respond, so we can use ignoreExpiration: true\n const decoded = yield* askRouteAuthValidationDecode(event, routeAuthSettings, true);\n\n if (!decoded) {\n return void 0;\n }\n\n return {\n ...session,\n\n decodedAccessToken: decoded,\n };\n}\n"]}
1
+ {"version":3,"file":"askGetHttpApiEventStorySession.js","sourceRoot":"","sources":["../../../src/stories/askGetHttpApiEventStorySession.ts"],"names":[],"mappings":";;AAcA,wEAkDC;AA9DD,wEAAsG;AAGtG,sDAAiE;AACjE,gDAA2D;AAQ3D,QAAe,CAAC,CAAC,8BAA8B,CAAC,EAC9C,KAAK,EACL,iBAAiB,EACjB,OAAO,GAC4B;IACnC,0EAA0E;IAC1E,6EAA6E;IAC7E,uDAAuD;IACvD,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,IAAA,kDAA4B,EAAC,KAAK,EAAE,iBAAiB,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;IAE/F,IAAI,YAAY,CAAC,OAAO,KAAK,4CAAsB,CAAC,KAAK,EAAE,CAAC;QAC1D,uCACK,OAAO,KAEV,kBAAkB,EAAE,YAAY,CAAC,kBAAkB,IACnD;IACJ,CAAC;IAED,0EAA0E;IAC1E,IAAI,YAAY,CAAC,OAAO,KAAK,4CAAsB,CAAC,OAAO,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC,CAAC;IAChB,CAAC;IAED,8EAA8E;IAC9E,2EAA2E;IAC3E,MAAM,WAAW,GAAG,IAAA,uCAAyB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE7D,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC,CAAC;IAChB,CAAC;IAED,MAAM,IAAI,GAAG,IAAA,iCAAsB,EAMhC,WAAW,CAAC,CAAC;IAEhB,uCACK,OAAO,KAEV,kBAAkB,EAAE;YAClB,GAAG,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,KAAI,CAAC;YACnB,aAAa,EAAE,EAAE;YACjB,MAAM,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,MAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAA,KAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAA,KAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,CAAA,IAAI,EAAE;YACrE,QAAQ,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,MAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAA,KAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,CAAA,KAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAA,IAAI,EAAE;YACvE,QAAQ,EAAE,KAAK;SAChB,IACD;AACJ,CAAC","sourcesContent":["import { AskResponse, StorySession } from 'quidproquo-core';\n\nimport { askRouteAuthValidationDecode, RouteAuthDecodeOutcome } from '../actions/routeAuthValidation';\nimport { RouteAuthSettings } from '../config/settings/route';\nimport { HTTPEvent } from '../types/HTTPEvent';\nimport { getAccessTokenFromHeaders } from '../utils/headerUtils';\nimport { unsafeDecodeJWTPayload } from '../utils/jwtUtils';\n\nexport interface GetHttpApiEventStorySessionPayload {\n event: HTTPEvent;\n routeAuthSettings?: RouteAuthSettings;\n session: StorySession;\n}\n\nexport function* askGetHttpApiEventStorySession({\n event,\n routeAuthSettings,\n session,\n}: GetHttpApiEventStorySessionPayload): AskResponse<StorySession | undefined> {\n // Always yield the decode, mirroring askValidateRouteAuth, so a per-route\n // processor override's identity reaches the session. Auth already ran in the\n // auto-respond preamble, hence ignoreExpiration: true.\n const decodeResult = yield* askRouteAuthValidationDecode(event, routeAuthSettings || {}, true);\n\n if (decodeResult.outcome === RouteAuthDecodeOutcome.valid) {\n return {\n ...session,\n\n decodedAccessToken: decodeResult.decodedAccessToken,\n };\n }\n\n // Normally unreachable: an invalid request already 401'd in the preamble.\n if (decodeResult.outcome === RouteAuthDecodeOutcome.invalid) {\n return void 0;\n }\n\n // Not applicable: no token auth configured for this route. If an access token\n // was sent anyway, extract info for the logs only, marked wasValid: false.\n const accessToken = getAccessTokenFromHeaders(event.headers);\n\n if (!accessToken) {\n return void 0;\n }\n\n const info = unsafeDecodeJWTPayload<{\n sub?: string;\n userId?: string;\n username?: string;\n id?: string;\n exp?: number;\n }>(accessToken);\n\n return {\n ...session,\n\n decodedAccessToken: {\n exp: info?.exp || 0,\n userDirectory: '',\n userId: info?.sub || info?.id || info?.userId || info?.username || '',\n username: info?.username || info?.userId || info?.sub || info?.id || '',\n wasValid: false,\n },\n };\n}\n"]}
@@ -1,3 +1,3 @@
1
- import { AskResponse, DecodedAccessToken } from 'quidproquo-core';
2
- import { RouteAuthValidationDecodeActionPayload } from '../actions/routeAuthValidation';
3
- export declare function askRouteAuthValidationDecodeDefault({ event, routeAuthSettings, ignoreExpiration, }: RouteAuthValidationDecodeActionPayload): AskResponse<DecodedAccessToken | null>;
1
+ import { AskResponse } from 'quidproquo-core';
2
+ import { RouteAuthDecodeResult, RouteAuthValidationDecodeActionPayload } from '../actions/routeAuthValidation';
3
+ export declare function askRouteAuthValidationDecodeDefault({ event, routeAuthSettings, ignoreExpiration, }: RouteAuthValidationDecodeActionPayload): AskResponse<RouteAuthDecodeResult>;
@@ -2,23 +2,27 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.askRouteAuthValidationDecodeDefault = askRouteAuthValidationDecodeDefault;
4
4
  const quidproquo_core_1 = require("quidproquo-core");
5
+ const routeAuthValidation_1 = require("../actions/routeAuthValidation");
5
6
  const headerUtils_1 = require("../utils/headerUtils");
6
7
  function* askRouteAuthValidationDecodeDefault({ event, routeAuthSettings, ignoreExpiration, }) {
8
+ // No user directory means the route has no token auth under the default
9
+ // processor: not applicable, the request passes as anonymous. A per-route
10
+ // override that implements its own auth never reaches this story.
7
11
  if (!routeAuthSettings.userDirectoryName) {
8
- return null;
12
+ return { outcome: routeAuthValidation_1.RouteAuthDecodeOutcome.notApplicable };
9
13
  }
10
14
  const authHeader = (0, headerUtils_1.getHeaderValue)('Authorization', event.headers);
11
15
  if (!authHeader) {
12
- return null;
16
+ return { outcome: routeAuthValidation_1.RouteAuthDecodeOutcome.invalid };
13
17
  }
14
18
  const [authType, accessToken] = authHeader.split(' ');
15
19
  if (authType !== 'Bearer' || !accessToken) {
16
- return null;
20
+ return { outcome: routeAuthValidation_1.RouteAuthDecodeOutcome.invalid };
17
21
  }
18
22
  const result = yield* (0, quidproquo_core_1.askCatch)((0, quidproquo_core_1.askUserDirectoryDecodeAccessToken)(routeAuthSettings.userDirectoryName, ignoreExpiration, accessToken));
19
- if (!result.success) {
20
- return null;
23
+ if (!result.success || !result.result.wasValid) {
24
+ return { outcome: routeAuthValidation_1.RouteAuthDecodeOutcome.invalid };
21
25
  }
22
- return result.result;
26
+ return { outcome: routeAuthValidation_1.RouteAuthDecodeOutcome.valid, decodedAccessToken: result.result };
23
27
  }
24
28
  //# sourceMappingURL=askRouteAuthValidationDecodeDefault.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"askRouteAuthValidationDecodeDefault.js","sourceRoot":"","sources":["../../../src/stories/askRouteAuthValidationDecodeDefault.ts"],"names":[],"mappings":";;AAKA,kFA0BC;AA/BD,qDAA+G;AAG/G,sDAAsD;AAEtD,QAAe,CAAC,CAAC,mCAAmC,CAAC,EACnD,KAAK,EACL,iBAAiB,EACjB,gBAAgB,GACuB;IACvC,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,UAAU,GAAG,IAAA,4BAAc,EAAC,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAClE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtD,IAAI,QAAQ,KAAK,QAAQ,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,IAAA,0BAAQ,EAAC,IAAA,mDAAiC,EAAC,iBAAiB,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC;IAEtI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC","sourcesContent":["import { askCatch, AskResponse, askUserDirectoryDecodeAccessToken, DecodedAccessToken } from 'quidproquo-core';\n\nimport { RouteAuthValidationDecodeActionPayload } from '../actions/routeAuthValidation';\nimport { getHeaderValue } from '../utils/headerUtils';\n\nexport function* askRouteAuthValidationDecodeDefault({\n event,\n routeAuthSettings,\n ignoreExpiration,\n}: RouteAuthValidationDecodeActionPayload): AskResponse<DecodedAccessToken | null> {\n if (!routeAuthSettings.userDirectoryName) {\n return null;\n }\n\n const authHeader = getHeaderValue('Authorization', event.headers);\n if (!authHeader) {\n return null;\n }\n\n const [authType, accessToken] = authHeader.split(' ');\n if (authType !== 'Bearer' || !accessToken) {\n return null;\n }\n\n const result = yield* askCatch(askUserDirectoryDecodeAccessToken(routeAuthSettings.userDirectoryName, ignoreExpiration, accessToken));\n\n if (!result.success) {\n return null;\n }\n\n return result.result;\n}\n"]}
1
+ {"version":3,"file":"askRouteAuthValidationDecodeDefault.js","sourceRoot":"","sources":["../../../src/stories/askRouteAuthValidationDecodeDefault.ts"],"names":[],"mappings":";;AAKA,kFA6BC;AAlCD,qDAA2F;AAE3F,wEAAuI;AACvI,sDAAsD;AAEtD,QAAe,CAAC,CAAC,mCAAmC,CAAC,EACnD,KAAK,EACL,iBAAiB,EACjB,gBAAgB,GACuB;IACvC,wEAAwE;IACxE,0EAA0E;IAC1E,kEAAkE;IAClE,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;QACzC,OAAO,EAAE,OAAO,EAAE,4CAAsB,CAAC,aAAa,EAAE,CAAC;IAC3D,CAAC;IAED,MAAM,UAAU,GAAG,IAAA,4BAAc,EAAC,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAClE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,OAAO,EAAE,4CAAsB,CAAC,OAAO,EAAE,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtD,IAAI,QAAQ,KAAK,QAAQ,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,OAAO,EAAE,OAAO,EAAE,4CAAsB,CAAC,OAAO,EAAE,CAAC;IACrD,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,IAAA,0BAAQ,EAAC,IAAA,mDAAiC,EAAC,iBAAiB,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC;IAEtI,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC/C,OAAO,EAAE,OAAO,EAAE,4CAAsB,CAAC,OAAO,EAAE,CAAC;IACrD,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,4CAAsB,CAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;AACtF,CAAC","sourcesContent":["import { askCatch, AskResponse, askUserDirectoryDecodeAccessToken } from 'quidproquo-core';\n\nimport { RouteAuthDecodeOutcome, RouteAuthDecodeResult, RouteAuthValidationDecodeActionPayload } from '../actions/routeAuthValidation';\nimport { getHeaderValue } from '../utils/headerUtils';\n\nexport function* askRouteAuthValidationDecodeDefault({\n event,\n routeAuthSettings,\n ignoreExpiration,\n}: RouteAuthValidationDecodeActionPayload): AskResponse<RouteAuthDecodeResult> {\n // No user directory means the route has no token auth under the default\n // processor: not applicable, the request passes as anonymous. A per-route\n // override that implements its own auth never reaches this story.\n if (!routeAuthSettings.userDirectoryName) {\n return { outcome: RouteAuthDecodeOutcome.notApplicable };\n }\n\n const authHeader = getHeaderValue('Authorization', event.headers);\n if (!authHeader) {\n return { outcome: RouteAuthDecodeOutcome.invalid };\n }\n\n const [authType, accessToken] = authHeader.split(' ');\n if (authType !== 'Bearer' || !accessToken) {\n return { outcome: RouteAuthDecodeOutcome.invalid };\n }\n\n const result = yield* askCatch(askUserDirectoryDecodeAccessToken(routeAuthSettings.userDirectoryName, ignoreExpiration, accessToken));\n\n if (!result.success || !result.result.wasValid) {\n return { outcome: RouteAuthDecodeOutcome.invalid };\n }\n\n return { outcome: RouteAuthDecodeOutcome.valid, decodedAccessToken: result.result };\n}\n"]}
@@ -8,14 +8,15 @@ function* askValidateRouteAuth({ event, routeAuthSettings }) {
8
8
  if (!routeAuthSettings) {
9
9
  return true;
10
10
  }
11
- // Token auth validation via swappable action
12
- if (routeAuthSettings.userDirectoryName) {
13
- const decoded = yield* (0, routeAuthValidation_1.askRouteAuthValidationDecode)(event, routeAuthSettings, false);
14
- if (!decoded || !decoded.wasValid) {
15
- return false;
16
- }
11
+ // Token auth via the swappable decode action: always yielded, so a per-route
12
+ // processor override can implement completely custom auth. The default
13
+ // processor keeps the user-directory check internally and returns
14
+ // notApplicable when the route has no token auth configured.
15
+ const decodeResult = yield* (0, routeAuthValidation_1.askRouteAuthValidationDecode)(event, routeAuthSettings, false);
16
+ if (decodeResult.outcome === routeAuthValidation_1.RouteAuthDecodeOutcome.invalid) {
17
+ return false;
17
18
  }
18
- // API key validation via action
19
+ // API key validation via action, composing with AND semantics
19
20
  const apiKeys = routeAuthSettings.apiKeys || [];
20
21
  if (apiKeys.length > 0) {
21
22
  const apiKeyHeader = (0, headerUtils_1.getHeaderValue)('x-api-key', event.headers);
@@ -1 +1 @@
1
- {"version":3,"file":"askValidateRouteAuth.js","sourceRoot":"","sources":["../../../src/stories/askValidateRouteAuth.ts"],"names":[],"mappings":";;AAaA,oDA4BC;AAvCD,kEAA0E;AAC1E,wEAA8E;AAG9E,sDAAsD;AAOtD,QAAe,CAAC,CAAC,oBAAoB,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAA4B;IAC1F,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6CAA6C;IAC7C,IAAI,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,IAAA,kDAA4B,EAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC;QACrF,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,gCAAgC;IAChC,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,IAAI,EAAE,CAAC;IAChD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,YAAY,GAAG,IAAA,4BAAc,EAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAChE,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,IAAA,8CAA2B,EAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { AskResponse } from 'quidproquo-core';\n\nimport { askApiKeyValidationValidate } from '../actions/apiKeyValidation';\nimport { askRouteAuthValidationDecode } from '../actions/routeAuthValidation';\nimport { RouteAuthSettings } from '../config/settings/route';\nimport { HTTPEvent } from '../types/HTTPEvent';\nimport { getHeaderValue } from '../utils/headerUtils';\n\nexport interface ValidateRouteAuthPayload {\n event: HTTPEvent;\n routeAuthSettings?: RouteAuthSettings;\n}\n\nexport function* askValidateRouteAuth({ event, routeAuthSettings }: ValidateRouteAuthPayload): AskResponse<boolean> {\n if (!routeAuthSettings) {\n return true;\n }\n\n // Token auth validation via swappable action\n if (routeAuthSettings.userDirectoryName) {\n const decoded = yield* askRouteAuthValidationDecode(event, routeAuthSettings, false);\n if (!decoded || !decoded.wasValid) {\n return false;\n }\n }\n\n // API key validation via action\n const apiKeys = routeAuthSettings.apiKeys || [];\n if (apiKeys.length > 0) {\n const apiKeyHeader = getHeaderValue('x-api-key', event.headers);\n if (!apiKeyHeader) {\n return false;\n }\n\n const valid = yield* askApiKeyValidationValidate(apiKeyHeader, apiKeys);\n if (!valid) {\n return false;\n }\n }\n\n return true;\n}\n"]}
1
+ {"version":3,"file":"askValidateRouteAuth.js","sourceRoot":"","sources":["../../../src/stories/askValidateRouteAuth.ts"],"names":[],"mappings":";;AAaA,oDA6BC;AAxCD,kEAA0E;AAC1E,wEAAsG;AAGtG,sDAAsD;AAOtD,QAAe,CAAC,CAAC,oBAAoB,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAA4B;IAC1F,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6EAA6E;IAC7E,uEAAuE;IACvE,kEAAkE;IAClE,6DAA6D;IAC7D,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,IAAA,kDAA4B,EAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC;IAC1F,IAAI,YAAY,CAAC,OAAO,KAAK,4CAAsB,CAAC,OAAO,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,8DAA8D;IAC9D,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,IAAI,EAAE,CAAC;IAChD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,YAAY,GAAG,IAAA,4BAAc,EAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAChE,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,IAAA,8CAA2B,EAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { AskResponse } from 'quidproquo-core';\n\nimport { askApiKeyValidationValidate } from '../actions/apiKeyValidation';\nimport { askRouteAuthValidationDecode, RouteAuthDecodeOutcome } from '../actions/routeAuthValidation';\nimport { RouteAuthSettings } from '../config/settings/route';\nimport { HTTPEvent } from '../types/HTTPEvent';\nimport { getHeaderValue } from '../utils/headerUtils';\n\nexport interface ValidateRouteAuthPayload {\n event: HTTPEvent;\n routeAuthSettings?: RouteAuthSettings;\n}\n\nexport function* askValidateRouteAuth({ event, routeAuthSettings }: ValidateRouteAuthPayload): AskResponse<boolean> {\n if (!routeAuthSettings) {\n return true;\n }\n\n // Token auth via the swappable decode action: always yielded, so a per-route\n // processor override can implement completely custom auth. The default\n // processor keeps the user-directory check internally and returns\n // notApplicable when the route has no token auth configured.\n const decodeResult = yield* askRouteAuthValidationDecode(event, routeAuthSettings, false);\n if (decodeResult.outcome === RouteAuthDecodeOutcome.invalid) {\n return false;\n }\n\n // API key validation via action, composing with AND semantics\n const apiKeys = routeAuthSettings.apiKeys || [];\n if (apiKeys.length > 0) {\n const apiKeyHeader = getHeaderValue('x-api-key', event.headers);\n if (!apiKeyHeader) {\n return false;\n }\n\n const valid = yield* askApiKeyValidationValidate(apiKeyHeader, apiKeys);\n if (!valid) {\n return false;\n }\n }\n\n return true;\n}\n"]}
@@ -47,13 +47,13 @@ exports.getAllWebsocketSrcEntries = getAllWebsocketSrcEntries;
47
47
  // Used in bundlers to know where and what to build and index
48
48
  // Events, routes, etc
49
49
  const getAllSrcEntries = (configs) => {
50
- return [
50
+ return quidproquo_core_1.qpqCoreUtils.expandSrcEntriesWithActionProcessors([
51
51
  ...(0, exports.getAllRoutes)(configs).map((r) => r.runtime),
52
52
  // ...getAllOpenApiSpecs(configs).map((r) => r.openApiSpecPath),
53
53
  ...(0, exports.getAllSeo)(configs).map((seo) => seo.runtime),
54
54
  ...(0, exports.getAllServiceFunctions)(configs).map((sf) => sf.runtime),
55
55
  ...(0, exports.getAllWebsocketSrcEntries)(configs),
56
- ];
56
+ ]);
57
57
  };
58
58
  exports.getAllSrcEntries = getAllSrcEntries;
59
59
  const getDomainName = (configs) => {
@@ -1 +1 @@
1
- {"version":3,"file":"qpqConfigAccessorsUtils.js","sourceRoot":"","sources":["../../../src/utils/qpqConfigAccessorsUtils.ts"],"names":[],"mappings":";;;AAAA,qDAAyF;AAEzF,sCAkBmB;AAGZ,MAAM,YAAY,GAAG,CAAC,SAAoB,EAAoC,EAAE;IACrF,MAAM,MAAM,GAAG,8BAAY,CAAC,iBAAiB,CAAiC,SAAS,EAAE,sCAA6B,CAAC,KAAK,CAAC,CAAC;IAE9H,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAJW,QAAA,YAAY,gBAIvB;AAEK,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,SAAoB,EAAoC,EAAE;IAC5G,MAA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AAS,CAAC,CACpD,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B;AAEK,MAAM,sBAAsB,GAAG,CAAC,SAAoB,EAA0C,EAAE;IACrG,MAAM,mBAAmB,GACvB,8BAAY,CAAC,iBAAiB,CAAuC,SAAS,EAAE,sCAA6B,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAEnI,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC;AALW,QAAA,sBAAsB,0BAKjC;AAEK,MAAM,oBAAoB,GAAG,CAAC,SAAoB,EAAwC,EAAE;IACjG,MAAM,iBAAiB,GACrB,8BAAY,CAAC,iBAAiB,CAAqC,SAAS,EAAE,sCAA6B,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAE/H,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AALW,QAAA,oBAAoB,wBAK/B;AAEK,MAAM,yBAAyB,GAAG,CAAC,SAAoB,EAAwC,EAAE;IACtG,MAAM,iBAAiB,GAAG,IAAA,4BAAoB,EAAC,SAAS,CAAC,CAAC;IAE1D,OAAO,8BAAY,CAAC,aAAa,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;AAClE,CAAC,CAAC;AAJW,QAAA,yBAAyB,6BAIpC","sourcesContent":["import { isDefined, QPQConfig, qpqCoreUtils, QpqFunctionRuntime } from 'quidproquo-core';\n\nimport {\n ApiKeyQPQWebServerConfigSetting,\n CacheQPQWebServerConfigSetting,\n CertificateQPQWebServerConfigSetting,\n DefaultRouteOptionsQPQWebServerConfigSetting,\n DnsQPQWebServerConfigSetting,\n DomainProxyQPQWebServerConfigSetting,\n EmailSenderQPQWebServerConfigSetting,\n FileUploadSettings,\n FileUploadSettingsQPQWebServerConfigSetting,\n OpenApiQPQWebServerConfigSetting,\n QPQWebServerConfigSettingType,\n RouteQPQWebServerConfigSetting,\n SeoQPQWebServerConfigSetting,\n ServiceFunctionQPQWebServerConfigSetting,\n StorageDriveCorsSettingsQPQWebServerConfigSetting,\n SubdomainRedirectQPQWebServerConfigSetting,\n WebSocketQPQWebServerConfigSetting,\n} from '../config';\nimport { ApiQPQWebServerConfigSetting, WebEntryQPQWebServerConfigSetting } from '../config';\n\nexport const getAllRoutes = (qpqConfig: QPQConfig): RouteQPQWebServerConfigSetting[] => {\n const routes = qpqCoreUtils.getConfigSettings<RouteQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Route);\n\n return routes;\n};\n\nexport const getAllRoutesForApi = (apiName: string, qpqConfig: QPQConfig): RouteQPQWebServerConfigSetting[] => {\n const routes = getAllRoutes(qpqConfig);\n\n return routes;\n};\n\nexport const getAllApiKeyConfigs = (qpqConfig: QPQConfig): ApiKeyQPQWebServerConfigSetting[] => {\n const apiKeyConfigs = qpqCoreUtils.getConfigSettings<ApiKeyQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.ApiKey);\n\n return apiKeyConfigs;\n};\n\nexport const getAllSeo = (qpqConfig: QPQConfig): SeoQPQWebServerConfigSetting[] => {\n const seoConfigs = qpqCoreUtils.getConfigSettings<SeoQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Seo);\n\n return seoConfigs;\n};\n\nexport const getAllServiceFunctions = (qpqConfig: QPQConfig): ServiceFunctionQPQWebServerConfigSetting[] => {\n const serviceFunctions = qpqCoreUtils.getConfigSettings<ServiceFunctionQPQWebServerConfigSetting>(\n qpqConfig,\n QPQWebServerConfigSettingType.ServiceFunction,\n );\n\n return serviceFunctions;\n};\n\nexport const getOwnedServiceFunctions = (qpqConfig: QPQConfig): ServiceFunctionQPQWebServerConfigSetting[] => {\n const serviceFunctions = getAllServiceFunctions(qpqConfig);\n\n return qpqCoreUtils.getOwnedItems(serviceFunctions, qpqConfig);\n};\n\nexport const getAllOpenApiSpecs = (configs: QPQConfig): OpenApiQPQWebServerConfigSetting[] => {\n const openApiSpecs = qpqCoreUtils.getConfigSettings<OpenApiQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.OpenApi);\n\n return openApiSpecs;\n};\n\nexport const getAllWebsocketSrcEntries = (qpqConfig: QPQConfig): QpqFunctionRuntime[] => {\n return getOwnedWebsocketSettings(qpqConfig)\n .flatMap((s) => [s.eventProcessors.onConnect, s.eventProcessors.onDisconnect, s.eventProcessors.onMessage])\n .filter(isDefined);\n};\n\n// Used in bundlers to know where and what to build and index\n// Events, routes, etc\nexport const getAllSrcEntries = (configs: QPQConfig): QpqFunctionRuntime[] => {\n return [\n ...getAllRoutes(configs).map((r) => r.runtime),\n // ...getAllOpenApiSpecs(configs).map((r) => r.openApiSpecPath),\n ...getAllSeo(configs).map((seo) => seo.runtime),\n ...getAllServiceFunctions(configs).map((sf) => sf.runtime),\n ...getAllWebsocketSrcEntries(configs),\n ];\n};\n\nexport const getDomainName = (configs: QPQConfig): string => {\n const dnsSettings = qpqCoreUtils.getConfigSetting<DnsQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.Dns);\n\n return dnsSettings?.dnsBase || '';\n};\n\nexport const getWebEntry = (configs: QPQConfig): string => {\n const webEntry = qpqCoreUtils.getConfigSetting<WebEntryQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.WebEntry);\n\n if (!webEntry?.buildPath) {\n throw new Error('please use defineWebEntry in your qpq config');\n }\n\n return webEntry?.buildPath;\n};\n\nexport const getWebsocketEntryByApiName = (apiName: string, qpqConfig: QPQConfig): WebSocketQPQWebServerConfigSetting => {\n const websocketSettings = getWebsocketSettings(qpqConfig);\n\n const websocketSetting = websocketSettings.find((s) => s.apiName === apiName);\n\n if (!websocketSetting) {\n throw new Error(`No websocket setting found for api [${apiName}]`);\n }\n\n return websocketSetting;\n};\n\nexport const getSubdomainRedirects = (configs: QPQConfig): SubdomainRedirectQPQWebServerConfigSetting[] => {\n const subdomainRedirects = qpqCoreUtils.getConfigSettings<SubdomainRedirectQPQWebServerConfigSetting>(\n configs,\n QPQWebServerConfigSettingType.SubdomainRedirect,\n );\n\n return subdomainRedirects;\n};\n\nexport const getApiConfigs = (configs: QPQConfig): ApiQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<ApiQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.Api);\n};\n\nexport const getDnsConfigs = (configs: QPQConfig): DnsQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<DnsQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.Dns);\n};\n\nexport const getWebEntryConfigs = (configs: QPQConfig): WebEntryQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<WebEntryQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.WebEntry);\n};\n\nexport const getDomainProxyConfigs = (configs: QPQConfig): DomainProxyQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<DomainProxyQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.DomainProxy);\n};\n\nexport const getAllOwnedCacheConfigs = (qpqConfig: QPQConfig): CacheQPQWebServerConfigSetting[] => {\n const cacheSettings = qpqCoreUtils.getConfigSettings<CacheQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Cache);\n\n return qpqCoreUtils.getOwnedItems(cacheSettings, qpqConfig);\n};\n\nexport const getAllOwnedCertifcateConfigs = (qpqConfig: QPQConfig): CertificateQPQWebServerConfigSetting[] => {\n const certificateSettings = qpqCoreUtils.getConfigSettings<CertificateQPQWebServerConfigSetting>(\n qpqConfig,\n QPQWebServerConfigSettingType.Certificate,\n );\n\n return qpqCoreUtils.getOwnedItems(certificateSettings, qpqConfig);\n};\n\nexport const getCacheConfigByName = (cacheConfigName: string, qpqConfig: QPQConfig): CacheQPQWebServerConfigSetting => {\n const cacheSetting = qpqCoreUtils\n .getConfigSettings<CacheQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Cache)\n .find((c) => c.name === cacheConfigName);\n\n if (!cacheSetting) {\n throw new Error(`No cache config found for name [${cacheConfigName}]`);\n }\n\n return cacheSetting;\n};\n\nexport const getEnvironmentDomainName = (configs: QPQConfig): string => {\n const environment = qpqCoreUtils.getApplicationModuleEnvironment(configs);\n const apexDomainName = getDomainName(configs);\n\n if (environment === 'production') {\n return apexDomainName;\n }\n\n return `${environment}.${apexDomainName}`;\n};\n\nexport const getBaseDomainName = (qpqConfig: QPQConfig): string => {\n const environmentDomain = getEnvironmentDomainName(qpqConfig);\n const feature = qpqCoreUtils.getApplicationModuleFeature(qpqConfig);\n\n if (feature) {\n return `${feature}.${environmentDomain}`;\n }\n\n return environmentDomain;\n};\n\nexport const getServiceDomainName = (qpqConfig: QPQConfig): string => {\n const service = qpqCoreUtils.getApplicationModuleName(qpqConfig);\n const domainBase = getBaseDomainName(qpqConfig);\n\n return `${service}.${domainBase}`;\n};\n\n/**\n * Resolve browser CORS origins for a service resource. An explicit list wins;\n * otherwise scope to this service's own domain (apex + one-level subdomain\n * wildcard, which S3/CloudFront both support). Falls back to '*' only when the\n * service declares no domain at all (nothing browser-facing).\n *\n * Note: key off the raw dns base (`getDomainName`) to detect \"no domain\" —\n * `getBaseDomainName` still returns an env prefix like `development.` here.\n */\nexport const resolveServiceScopedCorsAllowedOrigins = (qpqConfig: QPQConfig, explicitOrigins?: string[]): string[] => {\n if (explicitOrigins) {\n return explicitOrigins;\n }\n\n if (!getDomainName(qpqConfig)) {\n return ['*'];\n }\n\n const baseDomain = getBaseDomainName(qpqConfig);\n return [`https://${baseDomain}`, `https://*.${baseDomain}`];\n};\n\n/**\n * Browser origins allowed to read/write a storage drive's objects cross-origin\n * (e.g. presigned uploads/downloads), looked up by the drive's name. An explicit\n * `defineStorageDriveCorsSettings` wins; otherwise the service-scoped default.\n */\nexport const getStorageDriveCorsAllowedOrigins = (qpqConfig: QPQConfig, storageDriveName: string): string[] => {\n const corsSetting = qpqCoreUtils\n .getConfigSettings<StorageDriveCorsSettingsQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.StorageDriveCorsSettings)\n .find((setting) => setting.storageDriveName === storageDriveName);\n\n return resolveServiceScopedCorsAllowedOrigins(qpqConfig, corsSetting?.allowedOrigins);\n};\n\n/**\n * Whether any web entry in this service serves its assets from the named storage\n * drive (`storageDrive.sourceStorageDrive`) — i.e. the drive's bucket is a\n * CloudFront origin. Drives with no web entry consumer need no CloudFront access\n * to their bucket at all.\n */\nexport const isStorageDriveWebEntryOrigin = (qpqConfig: QPQConfig, storageDriveName: string): boolean => {\n return getWebEntryConfigs(qpqConfig).some((webEntry) => webEntry.storageDrive.sourceStorageDrive === storageDriveName);\n};\n\n// API Gateway caps request payloads at 10MB, so the default per-file ceiling matches it;\n// the other defaults exist to bound parser memory rather than to be hit in practice.\nexport const defaultFileUploadSettings: FileUploadSettings = {\n maxFileSizeBytes: 10 * 1024 * 1024,\n maxFileCount: 10,\n maxFieldCount: 100,\n maxFieldSizeBytes: 1024 * 1024,\n};\n\nexport const getFileUploadSettings = (qpqConfig: QPQConfig): FileUploadSettings => {\n const setting = qpqCoreUtils.getConfigSetting<FileUploadSettingsQPQWebServerConfigSetting>(\n qpqConfig,\n QPQWebServerConfigSettingType.FileUploadSettings,\n );\n\n return {\n ...defaultFileUploadSettings,\n ...Object.fromEntries(Object.entries(setting?.fileUploadSettings || {}).filter(([, value]) => isDefined(value))),\n };\n};\n\nexport const resolveApexDomainNameFromDomainConfig = (qpqConfig: QPQConfig, rootDomain: string, onRootDomain: boolean): string => {\n const feature = qpqCoreUtils.getApplicationModuleFeature(qpqConfig);\n const environment = qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);\n\n const apexDomain = onRootDomain\n ? getDomainRoot(rootDomain, environment, feature)\n : constructServiceDomainName(rootDomain, environment, qpqCoreUtils.getApplicationModuleName(qpqConfig), feature);\n\n return apexDomain;\n};\n\nexport const constructServiceDomainName = (rootDomain: string, environment: string, service: string, feature?: string) => {\n const domainBase = getDomainRoot(rootDomain, environment, feature);\n\n return `${service}.${domainBase}`;\n};\n\nexport const constructEnvironmentDomainName = (environment: string, domain: string): string => {\n if (environment === 'production') {\n return domain;\n }\n\n return `${environment}.${domain}`;\n};\n\nexport const getDefaultRouteSettings = (qpqConfig: QPQConfig): DefaultRouteOptionsQPQWebServerConfigSetting[] => {\n const defaultRouteSettings =\n qpqCoreUtils.getConfigSettings<DefaultRouteOptionsQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.DefaultRouteOptions) || [];\n\n return defaultRouteSettings;\n};\n\nexport const getDomainRoot = (rootDomain: string, environment: string, feature?: string): string => {\n let domainPrefix = environment !== 'production' ? `${environment}.` : '';\n if (feature) {\n domainPrefix = `${feature}.${domainPrefix}`;\n }\n\n return `${domainPrefix}${rootDomain}`;\n};\n\nexport const resolveDomainRoot = (rootDomain: string, qpqConfig: QPQConfig): string => {\n const domain = getDomainRoot(\n rootDomain,\n qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig),\n qpqCoreUtils.getApplicationModuleFeature(qpqConfig),\n );\n\n return domain;\n};\n\nexport const getEmailSenderSettings = (qpqConfig: QPQConfig): EmailSenderQPQWebServerConfigSetting[] => {\n const emailSenderSettings =\n qpqCoreUtils.getConfigSettings<EmailSenderQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.EmailSender) || [];\n\n return emailSenderSettings;\n};\n\nexport const getWebsocketSettings = (qpqConfig: QPQConfig): WebSocketQPQWebServerConfigSetting[] => {\n const websocketSettings =\n qpqCoreUtils.getConfigSettings<WebSocketQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.WebSocket) || [];\n\n return websocketSettings;\n};\n\nexport const getOwnedWebsocketSettings = (qpqConfig: QPQConfig): WebSocketQPQWebServerConfigSetting[] => {\n const websocketSettings = getWebsocketSettings(qpqConfig);\n\n return qpqCoreUtils.getOwnedItems(websocketSettings, qpqConfig);\n};\n"]}
1
+ {"version":3,"file":"qpqConfigAccessorsUtils.js","sourceRoot":"","sources":["../../../src/utils/qpqConfigAccessorsUtils.ts"],"names":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} from 'quidproquo-core';\n\nimport {\n ApiKeyQPQWebServerConfigSetting,\n CacheQPQWebServerConfigSetting,\n CertificateQPQWebServerConfigSetting,\n DefaultRouteOptionsQPQWebServerConfigSetting,\n DnsQPQWebServerConfigSetting,\n DomainProxyQPQWebServerConfigSetting,\n EmailSenderQPQWebServerConfigSetting,\n FileUploadSettings,\n FileUploadSettingsQPQWebServerConfigSetting,\n OpenApiQPQWebServerConfigSetting,\n QPQWebServerConfigSettingType,\n RouteQPQWebServerConfigSetting,\n SeoQPQWebServerConfigSetting,\n ServiceFunctionQPQWebServerConfigSetting,\n StorageDriveCorsSettingsQPQWebServerConfigSetting,\n SubdomainRedirectQPQWebServerConfigSetting,\n WebSocketQPQWebServerConfigSetting,\n} from '../config';\nimport { ApiQPQWebServerConfigSetting, WebEntryQPQWebServerConfigSetting } from '../config';\n\nexport const getAllRoutes = (qpqConfig: QPQConfig): RouteQPQWebServerConfigSetting[] => {\n const routes = qpqCoreUtils.getConfigSettings<RouteQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Route);\n\n return routes;\n};\n\nexport const getAllRoutesForApi = (apiName: string, qpqConfig: QPQConfig): RouteQPQWebServerConfigSetting[] => {\n const routes = getAllRoutes(qpqConfig);\n\n return routes;\n};\n\nexport const getAllApiKeyConfigs = (qpqConfig: QPQConfig): ApiKeyQPQWebServerConfigSetting[] => {\n const apiKeyConfigs = qpqCoreUtils.getConfigSettings<ApiKeyQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.ApiKey);\n\n return apiKeyConfigs;\n};\n\nexport const getAllSeo = (qpqConfig: QPQConfig): SeoQPQWebServerConfigSetting[] => {\n const seoConfigs = qpqCoreUtils.getConfigSettings<SeoQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Seo);\n\n return seoConfigs;\n};\n\nexport const getAllServiceFunctions = (qpqConfig: QPQConfig): ServiceFunctionQPQWebServerConfigSetting[] => {\n const serviceFunctions = qpqCoreUtils.getConfigSettings<ServiceFunctionQPQWebServerConfigSetting>(\n qpqConfig,\n QPQWebServerConfigSettingType.ServiceFunction,\n );\n\n return serviceFunctions;\n};\n\nexport const getOwnedServiceFunctions = (qpqConfig: QPQConfig): ServiceFunctionQPQWebServerConfigSetting[] => {\n const serviceFunctions = getAllServiceFunctions(qpqConfig);\n\n return qpqCoreUtils.getOwnedItems(serviceFunctions, qpqConfig);\n};\n\nexport const getAllOpenApiSpecs = (configs: QPQConfig): OpenApiQPQWebServerConfigSetting[] => {\n const openApiSpecs = qpqCoreUtils.getConfigSettings<OpenApiQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.OpenApi);\n\n return openApiSpecs;\n};\n\nexport const getAllWebsocketSrcEntries = (qpqConfig: QPQConfig): QpqFunctionRuntime[] => {\n return getOwnedWebsocketSettings(qpqConfig)\n .flatMap((s) => [s.eventProcessors.onConnect, s.eventProcessors.onDisconnect, s.eventProcessors.onMessage])\n .filter(isDefined);\n};\n\n// Used in bundlers to know where and what to build and index\n// Events, routes, etc\nexport const getAllSrcEntries = (configs: QPQConfig): QpqFunctionRuntime[] => {\n return qpqCoreUtils.expandSrcEntriesWithActionProcessors([\n ...getAllRoutes(configs).map((r) => r.runtime),\n // ...getAllOpenApiSpecs(configs).map((r) => r.openApiSpecPath),\n ...getAllSeo(configs).map((seo) => seo.runtime),\n ...getAllServiceFunctions(configs).map((sf) => sf.runtime),\n ...getAllWebsocketSrcEntries(configs),\n ]);\n};\n\nexport const getDomainName = (configs: QPQConfig): string => {\n const dnsSettings = qpqCoreUtils.getConfigSetting<DnsQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.Dns);\n\n return dnsSettings?.dnsBase || '';\n};\n\nexport const getWebEntry = (configs: QPQConfig): string => {\n const webEntry = qpqCoreUtils.getConfigSetting<WebEntryQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.WebEntry);\n\n if (!webEntry?.buildPath) {\n throw new Error('please use defineWebEntry in your qpq config');\n }\n\n return webEntry?.buildPath;\n};\n\nexport const getWebsocketEntryByApiName = (apiName: string, qpqConfig: QPQConfig): WebSocketQPQWebServerConfigSetting => {\n const websocketSettings = getWebsocketSettings(qpqConfig);\n\n const websocketSetting = websocketSettings.find((s) => s.apiName === apiName);\n\n if (!websocketSetting) {\n throw new Error(`No websocket setting found for api [${apiName}]`);\n }\n\n return websocketSetting;\n};\n\nexport const getSubdomainRedirects = (configs: QPQConfig): SubdomainRedirectQPQWebServerConfigSetting[] => {\n const subdomainRedirects = qpqCoreUtils.getConfigSettings<SubdomainRedirectQPQWebServerConfigSetting>(\n configs,\n QPQWebServerConfigSettingType.SubdomainRedirect,\n );\n\n return subdomainRedirects;\n};\n\nexport const getApiConfigs = (configs: QPQConfig): ApiQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<ApiQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.Api);\n};\n\nexport const getDnsConfigs = (configs: QPQConfig): DnsQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<DnsQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.Dns);\n};\n\nexport const getWebEntryConfigs = (configs: QPQConfig): WebEntryQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<WebEntryQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.WebEntry);\n};\n\nexport const getDomainProxyConfigs = (configs: QPQConfig): DomainProxyQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<DomainProxyQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.DomainProxy);\n};\n\nexport const getAllOwnedCacheConfigs = (qpqConfig: QPQConfig): CacheQPQWebServerConfigSetting[] => {\n const cacheSettings = qpqCoreUtils.getConfigSettings<CacheQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Cache);\n\n return qpqCoreUtils.getOwnedItems(cacheSettings, qpqConfig);\n};\n\nexport const getAllOwnedCertifcateConfigs = (qpqConfig: QPQConfig): CertificateQPQWebServerConfigSetting[] => {\n const certificateSettings = qpqCoreUtils.getConfigSettings<CertificateQPQWebServerConfigSetting>(\n qpqConfig,\n QPQWebServerConfigSettingType.Certificate,\n );\n\n return qpqCoreUtils.getOwnedItems(certificateSettings, qpqConfig);\n};\n\nexport const getCacheConfigByName = (cacheConfigName: string, qpqConfig: QPQConfig): CacheQPQWebServerConfigSetting => {\n const cacheSetting = qpqCoreUtils\n .getConfigSettings<CacheQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Cache)\n .find((c) => c.name === cacheConfigName);\n\n if (!cacheSetting) {\n throw new Error(`No cache config found for name [${cacheConfigName}]`);\n }\n\n return cacheSetting;\n};\n\nexport const getEnvironmentDomainName = (configs: QPQConfig): string => {\n const environment = qpqCoreUtils.getApplicationModuleEnvironment(configs);\n const apexDomainName = getDomainName(configs);\n\n if (environment === 'production') {\n return apexDomainName;\n }\n\n return `${environment}.${apexDomainName}`;\n};\n\nexport const getBaseDomainName = (qpqConfig: QPQConfig): string => {\n const environmentDomain = getEnvironmentDomainName(qpqConfig);\n const feature = qpqCoreUtils.getApplicationModuleFeature(qpqConfig);\n\n if (feature) {\n return `${feature}.${environmentDomain}`;\n }\n\n return environmentDomain;\n};\n\nexport const getServiceDomainName = (qpqConfig: QPQConfig): string => {\n const service = qpqCoreUtils.getApplicationModuleName(qpqConfig);\n const domainBase = getBaseDomainName(qpqConfig);\n\n return `${service}.${domainBase}`;\n};\n\n/**\n * Resolve browser CORS origins for a service resource. An explicit list wins;\n * otherwise scope to this service's own domain (apex + one-level subdomain\n * wildcard, which S3/CloudFront both support). Falls back to '*' only when the\n * service declares no domain at all (nothing browser-facing).\n *\n * Note: key off the raw dns base (`getDomainName`) to detect \"no domain\" —\n * `getBaseDomainName` still returns an env prefix like `development.` here.\n */\nexport const resolveServiceScopedCorsAllowedOrigins = (qpqConfig: QPQConfig, explicitOrigins?: string[]): string[] => {\n if (explicitOrigins) {\n return explicitOrigins;\n }\n\n if (!getDomainName(qpqConfig)) {\n return ['*'];\n }\n\n const baseDomain = getBaseDomainName(qpqConfig);\n return [`https://${baseDomain}`, `https://*.${baseDomain}`];\n};\n\n/**\n * Browser origins allowed to read/write a storage drive's objects cross-origin\n * (e.g. presigned uploads/downloads), looked up by the drive's name. An explicit\n * `defineStorageDriveCorsSettings` wins; otherwise the service-scoped default.\n */\nexport const getStorageDriveCorsAllowedOrigins = (qpqConfig: QPQConfig, storageDriveName: string): string[] => {\n const corsSetting = qpqCoreUtils\n .getConfigSettings<StorageDriveCorsSettingsQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.StorageDriveCorsSettings)\n .find((setting) => setting.storageDriveName === storageDriveName);\n\n return resolveServiceScopedCorsAllowedOrigins(qpqConfig, corsSetting?.allowedOrigins);\n};\n\n/**\n * Whether any web entry in this service serves its assets from the named storage\n * drive (`storageDrive.sourceStorageDrive`) — i.e. the drive's bucket is a\n * CloudFront origin. Drives with no web entry consumer need no CloudFront access\n * to their bucket at all.\n */\nexport const isStorageDriveWebEntryOrigin = (qpqConfig: QPQConfig, storageDriveName: string): boolean => {\n return getWebEntryConfigs(qpqConfig).some((webEntry) => webEntry.storageDrive.sourceStorageDrive === storageDriveName);\n};\n\n// API Gateway caps request payloads at 10MB, so the default per-file ceiling matches it;\n// the other defaults exist to bound parser memory rather than to be hit in practice.\nexport const defaultFileUploadSettings: FileUploadSettings = {\n maxFileSizeBytes: 10 * 1024 * 1024,\n maxFileCount: 10,\n maxFieldCount: 100,\n maxFieldSizeBytes: 1024 * 1024,\n};\n\nexport const getFileUploadSettings = (qpqConfig: QPQConfig): FileUploadSettings => {\n const setting = qpqCoreUtils.getConfigSetting<FileUploadSettingsQPQWebServerConfigSetting>(\n qpqConfig,\n QPQWebServerConfigSettingType.FileUploadSettings,\n );\n\n return {\n ...defaultFileUploadSettings,\n ...Object.fromEntries(Object.entries(setting?.fileUploadSettings || {}).filter(([, value]) => isDefined(value))),\n };\n};\n\nexport const resolveApexDomainNameFromDomainConfig = (qpqConfig: QPQConfig, rootDomain: string, onRootDomain: boolean): string => {\n const feature = qpqCoreUtils.getApplicationModuleFeature(qpqConfig);\n const environment = qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);\n\n const apexDomain = onRootDomain\n ? getDomainRoot(rootDomain, environment, feature)\n : constructServiceDomainName(rootDomain, environment, qpqCoreUtils.getApplicationModuleName(qpqConfig), feature);\n\n return apexDomain;\n};\n\nexport const constructServiceDomainName = (rootDomain: string, environment: string, service: string, feature?: string) => {\n const domainBase = getDomainRoot(rootDomain, environment, feature);\n\n return `${service}.${domainBase}`;\n};\n\nexport const constructEnvironmentDomainName = (environment: string, domain: string): string => {\n if (environment === 'production') {\n return domain;\n }\n\n return `${environment}.${domain}`;\n};\n\nexport const getDefaultRouteSettings = (qpqConfig: QPQConfig): DefaultRouteOptionsQPQWebServerConfigSetting[] => {\n const defaultRouteSettings =\n qpqCoreUtils.getConfigSettings<DefaultRouteOptionsQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.DefaultRouteOptions) || [];\n\n return defaultRouteSettings;\n};\n\nexport const getDomainRoot = (rootDomain: string, environment: string, feature?: string): string => {\n let domainPrefix = environment !== 'production' ? `${environment}.` : '';\n if (feature) {\n domainPrefix = `${feature}.${domainPrefix}`;\n }\n\n return `${domainPrefix}${rootDomain}`;\n};\n\nexport const resolveDomainRoot = (rootDomain: string, qpqConfig: QPQConfig): string => {\n const domain = getDomainRoot(\n rootDomain,\n qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig),\n qpqCoreUtils.getApplicationModuleFeature(qpqConfig),\n );\n\n return domain;\n};\n\nexport const getEmailSenderSettings = (qpqConfig: QPQConfig): EmailSenderQPQWebServerConfigSetting[] => {\n const emailSenderSettings =\n qpqCoreUtils.getConfigSettings<EmailSenderQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.EmailSender) || [];\n\n return emailSenderSettings;\n};\n\nexport const getWebsocketSettings = (qpqConfig: QPQConfig): WebSocketQPQWebServerConfigSetting[] => {\n const websocketSettings =\n qpqCoreUtils.getConfigSettings<WebSocketQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.WebSocket) || [];\n\n return websocketSettings;\n};\n\nexport const getOwnedWebsocketSettings = (qpqConfig: QPQConfig): WebSocketQPQWebServerConfigSetting[] => {\n const websocketSettings = getWebsocketSettings(qpqConfig);\n\n return qpqCoreUtils.getOwnedItems(websocketSettings, qpqConfig);\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { actionResult, askEventAutoRespondBase, createActionProcessor, generateUuid, getProcessCustomImplementation, } from 'quidproquo-core';
1
+ import { actionResult, askEventAutoRespondBase, createActionProcessor, generateUuid, getProcessCustomImplementation, mergeRuntimeActionProcessors, } from 'quidproquo-core';
2
2
  import { askValidateRouteAuth } from '../../stories/askValidateRouteAuth';
3
3
  import { FileUploadErrorTypeEnum } from '../../types/HTTPEvent';
4
4
  import { getCorsHeaders } from '../../utils/headerUtils';
@@ -28,7 +28,11 @@ const getProcessAutoRespond = (qpqConfig) => {
28
28
  event: qpqEventRecord,
29
29
  routeAuthSettings: matchResult.config?.routeAuthSettings,
30
30
  };
31
- const [authValid, authError] = await validateAuth(authPayload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader);
31
+ // The matched route's processor overrides must be visible HERE, in the
32
+ // framework preamble: auth decode runs before the route story, so without
33
+ // this merge a per-route auth override would never see its own requests.
34
+ const mergedActionProcessorList = await mergeRuntimeActionProcessors(qpqConfig, matchResult.runtime, actionProcessorList, dynamicModuleLoader);
35
+ const [authValid, authError] = await validateAuth(authPayload, session, mergedActionProcessorList, logger, updateSession, dynamicModuleLoader);
32
36
  if (authError || !authValid) {
33
37
  return actionResult({
34
38
  status: 401,
@@ -1 +1 @@
1
- {"version":3,"file":"getHttpApiEventAutoRespondActionProcessor.js","sourceRoot":"","sources":["../../../../src/actionProcessor/api/getHttpApiEventAutoRespondActionProcessor.ts"],"names":[],"mappings":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M,CAAC,MAAM,yCAAyC,GAAG,qBAAqB,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n askEventAutoRespondBase,\n createActionProcessor,\n EventActionType,\n generateUuid,\n getProcessCustomImplementation,\n MatchStoryResult,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport { RouteOptions } from '../../config/settings/route';\nimport { askValidateRouteAuth, ValidateRouteAuthPayload } from '../../stories/askValidateRouteAuth';\nimport { FileUploadErrorTypeEnum, HTTPEvent, HTTPEventResponse } from '../../types/HTTPEvent';\nimport { getCorsHeaders } from '../../utils/headerUtils';\n\ntype InternalMatchResult = MatchStoryResult<any, RouteOptions>;\n\nconst fileUploadErrorHttpStatusMap: Record<FileUploadErrorTypeEnum, number> = {\n [FileUploadErrorTypeEnum.fileTooLarge]: 413,\n [FileUploadErrorTypeEnum.tooManyFiles]: 413,\n [FileUploadErrorTypeEnum.tooManyFields]: 400,\n [FileUploadErrorTypeEnum.disallowedMimeType]: 415,\n [FileUploadErrorTypeEnum.malformed]: 400,\n};\n\nconst getProcessAutoRespond = (qpqConfig: QPQConfig): ProcessorFor<typeof askEventAutoRespondBase> => {\n const validateAuth = getProcessCustomImplementation<any>(\n qpqConfig,\n askValidateRouteAuth,\n 'API Auth Validation',\n null,\n () => new Date().toISOString(),\n generateUuid,\n );\n\n return async ({ qpqEventRecord: rawEventRecord, matchResult }, session, actionProcessorList, logger, updateSession, dynamicModuleLoader) => {\n // This processor is registered only for the http api event source, so the base's\n // source-agnostic record is an HTTPEvent here.\n const qpqEventRecord = rawEventRecord as HTTPEvent;\n // Just auto respond for options requests\n if (qpqEventRecord.method === 'OPTIONS') {\n return actionResult({\n status: 200,\n isBase64Encoded: false,\n body: '',\n headers: getCorsHeaders(qpqConfig, matchResult.config || {}, qpqEventRecord.headers),\n });\n }\n\n const authPayload: ValidateRouteAuthPayload = {\n event: qpqEventRecord,\n routeAuthSettings: matchResult.config?.routeAuthSettings,\n };\n\n const [authValid, authError] = await validateAuth(authPayload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader);\n\n if (authError || !authValid) {\n return actionResult({\n status: 401,\n isBase64Encoded: false,\n body: JSON.stringify({\n message: 'You are unauthorized to access this resource',\n }),\n headers: getCorsHeaders(qpqConfig, matchResult.config || {}, qpqEventRecord.headers),\n });\n }\n\n // Reject invalid multipart uploads before the route story runs (after auth, so a 401 wins)\n if (qpqEventRecord.fileUploadError) {\n return actionResult({\n status: fileUploadErrorHttpStatusMap[qpqEventRecord.fileUploadError.errorType] || 400,\n isBase64Encoded: false,\n body: JSON.stringify({\n errorType: qpqEventRecord.fileUploadError.errorType,\n errorText: qpqEventRecord.fileUploadError.message,\n }),\n headers: getCorsHeaders(qpqConfig, matchResult.config || {}, qpqEventRecord.headers),\n });\n }\n\n return actionResult(null);\n };\n};\n\nexport const getHttpApiEventAutoRespondActionProcessor = createActionProcessor(askEventAutoRespondBase, getProcessAutoRespond);\n"]}
1
+ {"version":3,"file":"getHttpApiEventAutoRespondActionProcessor.js","sourceRoot":"","sources":["../../../../src/actionProcessor/api/getHttpApiEventAutoRespondActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EAErB,YAAY,EACZ,8BAA8B,EAE9B,4BAA4B,GAG7B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,oBAAoB,EAA4B,MAAM,oCAAoC,CAAC;AACpG,OAAO,EAAE,uBAAuB,EAAgC,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAIzD,MAAM,4BAA4B,GAA4C;IAC5E,CAAC,uBAAuB,CAAC,YAAY,CAAC,EAAE,GAAG;IAC3C,CAAC,uBAAuB,CAAC,YAAY,CAAC,EAAE,GAAG;IAC3C,CAAC,uBAAuB,CAAC,aAAa,CAAC,EAAE,GAAG;IAC5C,CAAC,uBAAuB,CAAC,kBAAkB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,CAAC;QAE/I,IAAI,SAAS,IAAI,CAAC,SAAS,EAAE,CAAC;YAC5B,OAAO,YAAY,CAAC;gBAClB,MAAM,EAAE,GAAG;gBACX,eAAe,EAAE,KAAK;gBACtB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,OAAO,EAAE,8CAA8C;iBACxD,CAAC;gBACF,OAAO,EAAE,cAAc,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,IAAI,EAAE,EAAE,cAAc,CAAC,OAAO,CAAC;aACrF,CAAC,CAAC;QACL,CAAC;QAED,2FAA2F;QAC3F,IAAI,cAAc,CAAC,eAAe,EAAE,CAAC;YACnC,OAAO,YAAY,CAAC;gBAClB,MAAM,EAAE,4BAA4B,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,GAAG;gBACrF,eAAe,EAAE,KAAK;gBACtB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,SAAS,EAAE,cAAc,CAAC,eAAe,CAAC,SAAS;oBACnD,SAAS,EAAE,cAAc,CAAC,eAAe,CAAC,OAAO;iBAClD,CAAC;gBACF,OAAO,EAAE,cAAc,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,IAAI,EAAE,EAAE,cAAc,CAAC,OAAO,CAAC;aACrF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yCAAyC,GAAG,qBAAqB,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n askEventAutoRespondBase,\n createActionProcessor,\n EventActionType,\n generateUuid,\n getProcessCustomImplementation,\n MatchStoryResult,\n mergeRuntimeActionProcessors,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport { RouteOptions } from '../../config/settings/route';\nimport { askValidateRouteAuth, ValidateRouteAuthPayload } from '../../stories/askValidateRouteAuth';\nimport { FileUploadErrorTypeEnum, HTTPEvent, HTTPEventResponse } from '../../types/HTTPEvent';\nimport { getCorsHeaders } from '../../utils/headerUtils';\n\ntype InternalMatchResult = MatchStoryResult<any, RouteOptions>;\n\nconst fileUploadErrorHttpStatusMap: Record<FileUploadErrorTypeEnum, number> = {\n [FileUploadErrorTypeEnum.fileTooLarge]: 413,\n [FileUploadErrorTypeEnum.tooManyFiles]: 413,\n [FileUploadErrorTypeEnum.tooManyFields]: 400,\n [FileUploadErrorTypeEnum.disallowedMimeType]: 415,\n [FileUploadErrorTypeEnum.malformed]: 400,\n};\n\nconst getProcessAutoRespond = (qpqConfig: QPQConfig): ProcessorFor<typeof askEventAutoRespondBase> => {\n const validateAuth = getProcessCustomImplementation<any>(\n qpqConfig,\n askValidateRouteAuth,\n 'API Auth Validation',\n null,\n () => new Date().toISOString(),\n generateUuid,\n );\n\n return async ({ qpqEventRecord: rawEventRecord, matchResult }, session, actionProcessorList, logger, updateSession, dynamicModuleLoader) => {\n // This processor is registered only for the http api event source, so the base's\n // source-agnostic record is an HTTPEvent here.\n const qpqEventRecord = rawEventRecord as HTTPEvent;\n // Just auto respond for options requests\n if (qpqEventRecord.method === 'OPTIONS') {\n return actionResult({\n status: 200,\n isBase64Encoded: false,\n body: '',\n headers: getCorsHeaders(qpqConfig, matchResult.config || {}, qpqEventRecord.headers),\n });\n }\n\n const authPayload: ValidateRouteAuthPayload = {\n event: qpqEventRecord,\n routeAuthSettings: matchResult.config?.routeAuthSettings,\n };\n\n // The matched route's processor overrides must be visible HERE, in the\n // framework preamble: auth decode runs before the route story, so without\n // this merge a per-route auth override would never see its own requests.\n const mergedActionProcessorList = await mergeRuntimeActionProcessors(qpqConfig, matchResult.runtime, actionProcessorList, dynamicModuleLoader);\n\n const [authValid, authError] = await validateAuth(authPayload, session, mergedActionProcessorList, logger, updateSession, dynamicModuleLoader);\n\n if (authError || !authValid) {\n return actionResult({\n status: 401,\n isBase64Encoded: false,\n body: JSON.stringify({\n message: 'You are unauthorized to access this resource',\n }),\n headers: getCorsHeaders(qpqConfig, matchResult.config || {}, qpqEventRecord.headers),\n });\n }\n\n // Reject invalid multipart uploads before the route story runs (after auth, so a 401 wins)\n if (qpqEventRecord.fileUploadError) {\n return actionResult({\n status: fileUploadErrorHttpStatusMap[qpqEventRecord.fileUploadError.errorType] || 400,\n isBase64Encoded: false,\n body: JSON.stringify({\n errorType: qpqEventRecord.fileUploadError.errorType,\n errorText: qpqEventRecord.fileUploadError.message,\n }),\n headers: getCorsHeaders(qpqConfig, matchResult.config || {}, qpqEventRecord.headers),\n });\n }\n\n return actionResult(null);\n };\n};\n\nexport const getHttpApiEventAutoRespondActionProcessor = createActionProcessor(askEventAutoRespondBase, getProcessAutoRespond);\n"]}
@@ -1,4 +1,4 @@
1
- import { actionResult, askEventGetStorySessionBase, createActionProcessor, generateUuid, getProcessCustomImplementation, } from 'quidproquo-core';
1
+ import { actionResult, askEventGetStorySessionBase, createActionProcessor, generateUuid, getProcessCustomImplementation, mergeRuntimeActionProcessors, } from 'quidproquo-core';
2
2
  import { askGetHttpApiEventStorySession } from '../../stories/askGetHttpApiEventStorySession';
3
3
  const getProcessGetStorySession = (qpqConfig) => {
4
4
  const getSession = getProcessCustomImplementation(qpqConfig, askGetHttpApiEventStorySession, 'API Get Story Session', null, () => new Date().toISOString(), generateUuid);
@@ -10,7 +10,11 @@ const getProcessGetStorySession = (qpqConfig) => {
10
10
  routeAuthSettings: matchStoryResult.config?.routeAuthSettings,
11
11
  session,
12
12
  };
13
- const [storySession, error] = await getSession(payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader);
13
+ // Same merge as the auto-respond preamble: the session-seeding decode must
14
+ // also see the matched route's processor overrides, or a custom validator's
15
+ // decoded identity would never reach the story session.
16
+ const mergedActionProcessorList = await mergeRuntimeActionProcessors(qpqConfig, matchStoryResult.runtime, actionProcessorList, dynamicModuleLoader);
17
+ const [storySession, error] = await getSession(payload, session, mergedActionProcessorList, logger, updateSession, dynamicModuleLoader);
14
18
  if (error) {
15
19
  return actionResult(void 0);
16
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getHttpApiEventGetStorySessionActionProcessor.js","sourceRoot":"","sources":["../../../../src/actionProcessor/api/getHttpApiEventGetStorySessionActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,qBAAqB,EAErB,YAAY,EACZ,8BAA8B,GAK/B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,8BAA8B,EAAsC,MAAM,8CAA8C,CAAC;AAKlI,MAAM,yBAAyB,GAAG,CAAC,SAAoB,EAAoD,EAAE;IAC3G,MAAM,UAAU,GAAG,8BAA8B,CAC/C,SAAS,EACT,8BAA8B,EAC9B,uBAAuB,EACvB,IAAI,EACJ,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAC9B,YAAY,CACb,CAAC;IAEF,OAAO,KAAK,EAAE,EAAE,gBAAgB,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,EAAE;QAC9H,MAAM,OAAO,GAAuC;YAClD,+EAA+E;YAC/E,+BAA+B;YAC/B,KAAK,EAAE,cAA2B;YAClC,iBAAiB,EAAE,gBAAgB,CAAC,MAAM,EAAE,iBAAiB;YAC7D,OAAO;SACR,CAAC;QAEF,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC;QAElI,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,CAAC;QAED,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6CAA6C,GAAG,qBAAqB,CAAC,2BAA2B,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n askEventGetStorySessionBase,\n createActionProcessor,\n EventActionType,\n generateUuid,\n getProcessCustomImplementation,\n MatchStoryResult,\n ProcessorFor,\n QPQConfig,\n StorySession,\n} from 'quidproquo-core';\n\nimport { RouteOptions } from '../../config/settings/route';\nimport { askGetHttpApiEventStorySession, GetHttpApiEventStorySessionPayload } from '../../stories/askGetHttpApiEventStorySession';\nimport { HTTPEvent } from '../../types/HTTPEvent';\n\ntype InternalMatchResult = MatchStoryResult<any, RouteOptions>;\n\nconst getProcessGetStorySession = (qpqConfig: QPQConfig): ProcessorFor<typeof askEventGetStorySessionBase> => {\n const getSession = getProcessCustomImplementation<any>(\n qpqConfig,\n askGetHttpApiEventStorySession,\n 'API Get Story Session',\n null,\n () => new Date().toISOString(),\n generateUuid,\n );\n\n return async ({ matchStoryResult, qpqEventRecord }, session, actionProcessorList, logger, updateSession, dynamicModuleLoader) => {\n const payload: GetHttpApiEventStorySessionPayload = {\n // Registered only for the http api event source, so the base's source-agnostic\n // record is an HTTPEvent here.\n event: qpqEventRecord as HTTPEvent,\n routeAuthSettings: matchStoryResult.config?.routeAuthSettings,\n session,\n };\n\n const [storySession, error] = await getSession(payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader);\n\n if (error) {\n return actionResult(void 0);\n }\n\n return actionResult(storySession);\n };\n};\n\nexport const getHttpApiEventGetStorySessionActionProcessor = createActionProcessor(askEventGetStorySessionBase, getProcessGetStorySession);\n"]}
1
+ {"version":3,"file":"getHttpApiEventGetStorySessionActionProcessor.js","sourceRoot":"","sources":["../../../../src/actionProcessor/api/getHttpApiEventGetStorySessionActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,qBAAqB,EAErB,YAAY,EACZ,8BAA8B,EAE9B,4BAA4B,GAI7B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,8BAA8B,EAAsC,MAAM,8CAA8C,CAAC;AAKlI,MAAM,yBAAyB,GAAG,CAAC,SAAoB,EAAoD,EAAE;IAC3G,MAAM,UAAU,GAAG,8BAA8B,CAC/C,SAAS,EACT,8BAA8B,EAC9B,uBAAuB,EACvB,IAAI,EACJ,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAC9B,YAAY,CACb,CAAC;IAEF,OAAO,KAAK,EAAE,EAAE,gBAAgB,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,EAAE;QAC9H,MAAM,OAAO,GAAuC;YAClD,+EAA+E;YAC/E,+BAA+B;YAC/B,KAAK,EAAE,cAA2B;YAClC,iBAAiB,EAAE,gBAAgB,CAAC,MAAM,EAAE,iBAAiB;YAC7D,OAAO;SACR,CAAC;QAEF,2EAA2E;QAC3E,4EAA4E;QAC5E,wDAAwD;QACxD,MAAM,yBAAyB,GAAG,MAAM,4BAA4B,CAClE,SAAS,EACT,gBAAgB,CAAC,OAAO,EACxB,mBAAmB,EACnB,mBAAmB,CACpB,CAAC;QAEF,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC;QAExI,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,CAAC;QAED,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6CAA6C,GAAG,qBAAqB,CAAC,2BAA2B,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n askEventGetStorySessionBase,\n createActionProcessor,\n EventActionType,\n generateUuid,\n getProcessCustomImplementation,\n MatchStoryResult,\n mergeRuntimeActionProcessors,\n ProcessorFor,\n QPQConfig,\n StorySession,\n} from 'quidproquo-core';\n\nimport { RouteOptions } from '../../config/settings/route';\nimport { askGetHttpApiEventStorySession, GetHttpApiEventStorySessionPayload } from '../../stories/askGetHttpApiEventStorySession';\nimport { HTTPEvent } from '../../types/HTTPEvent';\n\ntype InternalMatchResult = MatchStoryResult<any, RouteOptions>;\n\nconst getProcessGetStorySession = (qpqConfig: QPQConfig): ProcessorFor<typeof askEventGetStorySessionBase> => {\n const getSession = getProcessCustomImplementation<any>(\n qpqConfig,\n askGetHttpApiEventStorySession,\n 'API Get Story Session',\n null,\n () => new Date().toISOString(),\n generateUuid,\n );\n\n return async ({ matchStoryResult, qpqEventRecord }, session, actionProcessorList, logger, updateSession, dynamicModuleLoader) => {\n const payload: GetHttpApiEventStorySessionPayload = {\n // Registered only for the http api event source, so the base's source-agnostic\n // record is an HTTPEvent here.\n event: qpqEventRecord as HTTPEvent,\n routeAuthSettings: matchStoryResult.config?.routeAuthSettings,\n session,\n };\n\n // Same merge as the auto-respond preamble: the session-seeding decode must\n // also see the matched route's processor overrides, or a custom validator's\n // decoded identity would never reach the story session.\n const mergedActionProcessorList = await mergeRuntimeActionProcessors(\n qpqConfig,\n matchStoryResult.runtime,\n actionProcessorList,\n dynamicModuleLoader,\n );\n\n const [storySession, error] = await getSession(payload, session, mergedActionProcessorList, logger, updateSession, dynamicModuleLoader);\n\n if (error) {\n return actionResult(void 0);\n }\n\n return actionResult(storySession);\n };\n};\n\nexport const getHttpApiEventGetStorySessionActionProcessor = createActionProcessor(askEventGetStorySessionBase, getProcessGetStorySession);\n"]}
@@ -1,14 +1,16 @@
1
1
  import { actionResult, createActionProcessor, generateUuid, getProcessCustomImplementation } from 'quidproquo-core';
2
- import { askRouteAuthValidationDecode } from '../../actions/routeAuthValidation';
2
+ import { askRouteAuthValidationDecode, RouteAuthDecodeOutcome } from '../../actions/routeAuthValidation';
3
3
  import { askRouteAuthValidationDecodeDefault } from '../../stories/askRouteAuthValidationDecodeDefault';
4
4
  const getProcessRouteAuthValidationDecode = (qpqConfig) => {
5
5
  const decodeAuth = getProcessCustomImplementation(qpqConfig, askRouteAuthValidationDecodeDefault, 'Route Auth Validation Decode', null, () => new Date().toISOString(), generateUuid);
6
6
  return async (payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader, streamRegistry) => {
7
7
  const [result, error] = await decodeAuth(payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader, streamRegistry);
8
- if (error) {
9
- return actionResult(null);
8
+ // A decode that errored (or returned nothing) is invalid, never
9
+ // notApplicable: failing open here would skip token auth entirely.
10
+ if (error || !result) {
11
+ return actionResult({ outcome: RouteAuthDecodeOutcome.invalid });
10
12
  }
11
- return actionResult(result ?? null);
13
+ return actionResult(result);
12
14
  };
13
15
  };
14
16
  export const getRouteAuthValidationDecodeActionProcessor = createActionProcessor(askRouteAuthValidationDecode, getProcessRouteAuthValidationDecode);
@@ -1 +1 @@
1
- {"version":3,"file":"getRouteAuthValidationDecodeActionProcessor.js","sourceRoot":"","sources":["../../../../src/actionProcessor/routeAuthValidation/getRouteAuthValidationDecodeActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,YAAY,EAAE,8BAA8B,EAA2B,MAAM,iBAAiB,CAAC;AAE7I,OAAO,EAAE,4BAA4B,EAAiC,MAAM,mCAAmC,CAAC;AAChH,OAAO,EAAE,mCAAmC,EAAE,MAAM,mDAAmD,CAAC;AAExG,MAAM,mCAAmC,GAAG,CAAC,SAAoB,EAAqD,EAAE;IACtH,MAAM,UAAU,GAAG,8BAA8B,CAC/C,SAAS,EACT,mCAAmC,EACnC,8BAA8B,EAC9B,IAAI,EACJ,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAC9B,YAAY,CACb,CAAC;IAEF,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,EAAE;QACjH,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAAC;QAE5I,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAED,OAAO,YAAY,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2CAA2C,GAAG,qBAAqB,CAAC,4BAA4B,EAAE,mCAAmC,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, generateUuid, getProcessCustomImplementation, ProcessorFor, QPQConfig } from 'quidproquo-core';\n\nimport { askRouteAuthValidationDecode, RouteAuthValidationActionType } from '../../actions/routeAuthValidation';\nimport { askRouteAuthValidationDecodeDefault } from '../../stories/askRouteAuthValidationDecodeDefault';\n\nconst getProcessRouteAuthValidationDecode = (qpqConfig: QPQConfig): ProcessorFor<typeof askRouteAuthValidationDecode> => {\n const decodeAuth = getProcessCustomImplementation<ProcessorFor<typeof askRouteAuthValidationDecode>>(\n qpqConfig,\n askRouteAuthValidationDecodeDefault,\n 'Route Auth Validation Decode',\n null,\n () => new Date().toISOString(),\n generateUuid,\n );\n\n return async (payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader, streamRegistry) => {\n const [result, error] = await decodeAuth(payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader, streamRegistry);\n\n if (error) {\n return actionResult(null);\n }\n\n return actionResult(result ?? null);\n };\n};\n\nexport const getRouteAuthValidationDecodeActionProcessor = createActionProcessor(askRouteAuthValidationDecode, getProcessRouteAuthValidationDecode);\n"]}
1
+ {"version":3,"file":"getRouteAuthValidationDecodeActionProcessor.js","sourceRoot":"","sources":["../../../../src/actionProcessor/routeAuthValidation/getRouteAuthValidationDecodeActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,YAAY,EAAE,8BAA8B,EAA2B,MAAM,iBAAiB,CAAC;AAE7I,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAiC,MAAM,mCAAmC,CAAC;AACxI,OAAO,EAAE,mCAAmC,EAAE,MAAM,mDAAmD,CAAC;AAExG,MAAM,mCAAmC,GAAG,CAAC,SAAoB,EAAqD,EAAE;IACtH,MAAM,UAAU,GAAG,8BAA8B,CAC/C,SAAS,EACT,mCAAmC,EACnC,8BAA8B,EAC9B,IAAI,EACJ,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAC9B,YAAY,CACb,CAAC;IAEF,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,EAAE;QACjH,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAAC;QAE5I,gEAAgE;QAChE,mEAAmE;QACnE,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;YACrB,OAAO,YAAY,CAAC,EAAE,OAAO,EAAE,sBAAsB,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2CAA2C,GAAG,qBAAqB,CAAC,4BAA4B,EAAE,mCAAmC,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, generateUuid, getProcessCustomImplementation, ProcessorFor, QPQConfig } from 'quidproquo-core';\n\nimport { askRouteAuthValidationDecode, RouteAuthDecodeOutcome, RouteAuthValidationActionType } from '../../actions/routeAuthValidation';\nimport { askRouteAuthValidationDecodeDefault } from '../../stories/askRouteAuthValidationDecodeDefault';\n\nconst getProcessRouteAuthValidationDecode = (qpqConfig: QPQConfig): ProcessorFor<typeof askRouteAuthValidationDecode> => {\n const decodeAuth = getProcessCustomImplementation<ProcessorFor<typeof askRouteAuthValidationDecode>>(\n qpqConfig,\n askRouteAuthValidationDecodeDefault,\n 'Route Auth Validation Decode',\n null,\n () => new Date().toISOString(),\n generateUuid,\n );\n\n return async (payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader, streamRegistry) => {\n const [result, error] = await decodeAuth(payload, session, actionProcessorList, logger, updateSession, dynamicModuleLoader, streamRegistry);\n\n // A decode that errored (or returned nothing) is invalid, never\n // notApplicable: failing open here would skip token auth entirely.\n if (error || !result) {\n return actionResult({ outcome: RouteAuthDecodeOutcome.invalid });\n }\n\n return actionResult(result);\n };\n};\n\nexport const getRouteAuthValidationDecodeActionProcessor = createActionProcessor(askRouteAuthValidationDecode, getProcessRouteAuthValidationDecode);\n"]}
@@ -0,0 +1,5 @@
1
+ export declare enum RouteAuthDecodeOutcome {
2
+ notApplicable = "notApplicable",
3
+ valid = "valid",
4
+ invalid = "invalid"
5
+ }
@@ -0,0 +1,12 @@
1
+ export var RouteAuthDecodeOutcome;
2
+ (function (RouteAuthDecodeOutcome) {
3
+ // No token auth is configured for the route: the request passes with an
4
+ // anonymous session.
5
+ RouteAuthDecodeOutcome["notApplicable"] = "notApplicable";
6
+ // The token decoded and validated: the request passes and the decoded token
7
+ // is seeded onto the story session.
8
+ RouteAuthDecodeOutcome["valid"] = "valid";
9
+ // Token auth applies and the request did not satisfy it: 401.
10
+ RouteAuthDecodeOutcome["invalid"] = "invalid";
11
+ })(RouteAuthDecodeOutcome || (RouteAuthDecodeOutcome = {}));
12
+ //# sourceMappingURL=RouteAuthDecodeOutcome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouteAuthDecodeOutcome.js","sourceRoot":"","sources":["../../../../src/actions/routeAuthValidation/RouteAuthDecodeOutcome.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,sBAWX;AAXD,WAAY,sBAAsB;IAChC,wEAAwE;IACxE,qBAAqB;IACrB,yDAA+B,CAAA;IAE/B,4EAA4E;IAC5E,oCAAoC;IACpC,yCAAe,CAAA;IAEf,8DAA8D;IAC9D,6CAAmB,CAAA;AACrB,CAAC,EAXW,sBAAsB,KAAtB,sBAAsB,QAWjC","sourcesContent":["export enum RouteAuthDecodeOutcome {\n // No token auth is configured for the route: the request passes with an\n // anonymous session.\n notApplicable = 'notApplicable',\n\n // The token decoded and validated: the request passes and the decoded token\n // is seeded onto the story session.\n valid = 'valid',\n\n // Token auth applies and the request did not satisfy it: 401.\n invalid = 'invalid',\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { DecodedAccessToken } from 'quidproquo-core';
2
+ import { RouteAuthDecodeOutcome } from './RouteAuthDecodeOutcome';
3
+ export type RouteAuthDecodeResult = {
4
+ outcome: RouteAuthDecodeOutcome.notApplicable;
5
+ } | {
6
+ outcome: RouteAuthDecodeOutcome.valid;
7
+ decodedAccessToken: DecodedAccessToken;
8
+ } | {
9
+ outcome: RouteAuthDecodeOutcome.invalid;
10
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RouteAuthDecodeResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouteAuthDecodeResult.js","sourceRoot":"","sources":["../../../../src/actions/routeAuthValidation/RouteAuthDecodeResult.ts"],"names":[],"mappings":"","sourcesContent":["import { DecodedAccessToken } from 'quidproquo-core';\n\nimport { RouteAuthDecodeOutcome } from './RouteAuthDecodeOutcome';\n\n// The tri-state result of the route auth decode action. The outcomes are\n// explicit (no null overloading) because \"no token auth configured\" and\n// \"token auth failed\" must never be conflated: the first passes as anonymous,\n// the second is a 401.\nexport type RouteAuthDecodeResult =\n | { outcome: RouteAuthDecodeOutcome.notApplicable }\n | { outcome: RouteAuthDecodeOutcome.valid; decodedAccessToken: DecodedAccessToken }\n | { outcome: RouteAuthDecodeOutcome.invalid };\n"]}
@@ -1,6 +1,6 @@
1
- import { DecodedAccessToken } from 'quidproquo-core';
2
1
  import { RouteAuthSettings } from '../../config/settings/route';
3
2
  import { HTTPEvent } from '../../types/HTTPEvent';
3
+ import { RouteAuthDecodeResult } from './RouteAuthDecodeResult';
4
4
  import { RouteAuthValidationActionType } from './RouteAuthValidationActionType';
5
5
  export interface RouteAuthValidationDecodeActionPayload {
6
6
  event: HTTPEvent;
@@ -11,4 +11,4 @@ export declare const askRouteAuthValidationDecode: import("quidproquo-core").Act
11
11
  event: HTTPEvent;
12
12
  routeAuthSettings: RouteAuthSettings;
13
13
  ignoreExpiration: boolean;
14
- }, DecodedAccessToken | null, never>;
14
+ }, RouteAuthDecodeResult, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"askRouteAuthValidationDecode.js","sourceRoot":"","sources":["../../../../src/actions/routeAuthValidation/askRouteAuthValidationDecode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAsB,MAAM,iBAAiB,CAAC;AAI5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAQhF,MAAM,CAAC,MAAM,4BAA4B,GAAG,qBAAqB,EAA6B,CAAC;IAC7F,UAAU,EAAE,6BAA6B,CAAC,MAAM;IAChD,UAAU,EAAE,CAAC,KAAgB,EAAE,iBAAoC,EAAE,gBAAyB,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CACpJ,CAAC,CAAC","sourcesContent":["import { createActionRequester, DecodedAccessToken } from 'quidproquo-core';\n\nimport { RouteAuthSettings } from '../../config/settings/route';\nimport { HTTPEvent } from '../../types/HTTPEvent';\nimport { RouteAuthValidationActionType } from './RouteAuthValidationActionType';\n\nexport interface RouteAuthValidationDecodeActionPayload {\n event: HTTPEvent;\n routeAuthSettings: RouteAuthSettings;\n ignoreExpiration: boolean;\n}\n\nexport const askRouteAuthValidationDecode = createActionRequester<DecodedAccessToken | null>()({\n actionType: RouteAuthValidationActionType.Decode,\n getPayload: (event: HTTPEvent, routeAuthSettings: RouteAuthSettings, ignoreExpiration: boolean) => ({ event, routeAuthSettings, ignoreExpiration }),\n});\n"]}
1
+ {"version":3,"file":"askRouteAuthValidationDecode.js","sourceRoot":"","sources":["../../../../src/actions/routeAuthValidation/askRouteAuthValidationDecode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAKxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAQhF,MAAM,CAAC,MAAM,4BAA4B,GAAG,qBAAqB,EAAyB,CAAC;IACzF,UAAU,EAAE,6BAA6B,CAAC,MAAM;IAChD,UAAU,EAAE,CAAC,KAAgB,EAAE,iBAAoC,EAAE,gBAAyB,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CACpJ,CAAC,CAAC","sourcesContent":["import { createActionRequester } from 'quidproquo-core';\n\nimport { RouteAuthSettings } from '../../config/settings/route';\nimport { HTTPEvent } from '../../types/HTTPEvent';\nimport { RouteAuthDecodeResult } from './RouteAuthDecodeResult';\nimport { RouteAuthValidationActionType } from './RouteAuthValidationActionType';\n\nexport interface RouteAuthValidationDecodeActionPayload {\n event: HTTPEvent;\n routeAuthSettings: RouteAuthSettings;\n ignoreExpiration: boolean;\n}\n\nexport const askRouteAuthValidationDecode = createActionRequester<RouteAuthDecodeResult>()({\n actionType: RouteAuthValidationActionType.Decode,\n getPayload: (event: HTTPEvent, routeAuthSettings: RouteAuthSettings, ignoreExpiration: boolean) => ({ event, routeAuthSettings, ignoreExpiration }),\n});\n"]}
@@ -1,2 +1,4 @@
1
1
  export * from './askRouteAuthValidationDecode';
2
+ export * from './RouteAuthDecodeOutcome';
3
+ export * from './RouteAuthDecodeResult';
2
4
  export * from './RouteAuthValidationActionType';
@@ -1,3 +1,5 @@
1
1
  export * from './askRouteAuthValidationDecode';
2
+ export * from './RouteAuthDecodeOutcome';
3
+ export * from './RouteAuthDecodeResult';
2
4
  export * from './RouteAuthValidationActionType';
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/routeAuthValidation/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC","sourcesContent":["export * from './askRouteAuthValidationDecode';\nexport * from './RouteAuthValidationActionType';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/routeAuthValidation/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC","sourcesContent":["export * from './askRouteAuthValidationDecode';\nexport * from './RouteAuthDecodeOutcome';\nexport * from './RouteAuthDecodeResult';\nexport * from './RouteAuthValidationActionType';\n"]}
@@ -1,34 +1,37 @@
1
- import { askRouteAuthValidationDecode } from '../actions/routeAuthValidation';
1
+ import { askRouteAuthValidationDecode, RouteAuthDecodeOutcome } from '../actions/routeAuthValidation';
2
2
  import { getAccessTokenFromHeaders } from '../utils/headerUtils';
3
3
  import { unsafeDecodeJWTPayload } from '../utils/jwtUtils';
4
4
  export function* askGetHttpApiEventStorySession({ event, routeAuthSettings, session, }) {
5
- const accessToken = getAccessTokenFromHeaders(event.headers);
6
- if (!accessToken) {
7
- return void 0;
8
- }
9
- // If this endpoint has no auth settings, BUT we do have an access token
10
- // then we want to just attempt to extract info for logs, but we will say that its wasValid = false
11
- if (!routeAuthSettings?.userDirectoryName) {
12
- const info = unsafeDecodeJWTPayload(accessToken);
5
+ // Always yield the decode, mirroring askValidateRouteAuth, so a per-route
6
+ // processor override's identity reaches the session. Auth already ran in the
7
+ // auto-respond preamble, hence ignoreExpiration: true.
8
+ const decodeResult = yield* askRouteAuthValidationDecode(event, routeAuthSettings || {}, true);
9
+ if (decodeResult.outcome === RouteAuthDecodeOutcome.valid) {
13
10
  return {
14
11
  ...session,
15
- decodedAccessToken: {
16
- exp: info?.exp || 0,
17
- userDirectory: '',
18
- userId: info?.sub || info?.id || info?.userId || info?.username || '',
19
- username: info?.username || info?.userId || info?.sub || info?.id || '',
20
- wasValid: false,
21
- },
12
+ decodedAccessToken: decodeResult.decodedAccessToken,
22
13
  };
23
14
  }
24
- // Auth was already validated in auto-respond, so we can use ignoreExpiration: true
25
- const decoded = yield* askRouteAuthValidationDecode(event, routeAuthSettings, true);
26
- if (!decoded) {
15
+ // Normally unreachable: an invalid request already 401'd in the preamble.
16
+ if (decodeResult.outcome === RouteAuthDecodeOutcome.invalid) {
17
+ return void 0;
18
+ }
19
+ // Not applicable: no token auth configured for this route. If an access token
20
+ // was sent anyway, extract info for the logs only, marked wasValid: false.
21
+ const accessToken = getAccessTokenFromHeaders(event.headers);
22
+ if (!accessToken) {
27
23
  return void 0;
28
24
  }
25
+ const info = unsafeDecodeJWTPayload(accessToken);
29
26
  return {
30
27
  ...session,
31
- decodedAccessToken: decoded,
28
+ decodedAccessToken: {
29
+ exp: info?.exp || 0,
30
+ userDirectory: '',
31
+ userId: info?.sub || info?.id || info?.userId || info?.username || '',
32
+ username: info?.username || info?.userId || info?.sub || info?.id || '',
33
+ wasValid: false,
34
+ },
32
35
  };
33
36
  }
34
37
  //# sourceMappingURL=askGetHttpApiEventStorySession.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"askGetHttpApiEventStorySession.js","sourceRoot":"","sources":["../../../src/stories/askGetHttpApiEventStorySession.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAG9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAQ3D,MAAM,SAAS,CAAC,CAAC,8BAA8B,CAAC,EAC9C,KAAK,EACL,iBAAiB,EACjB,OAAO,GAC4B;IACnC,MAAM,WAAW,GAAG,yBAAyB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE7D,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC,CAAC;IAChB,CAAC;IAED,wEAAwE;IACxE,mGAAmG;IACnG,IAAI,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,sBAAsB,CAMhC,WAAW,CAAC,CAAC;QAEhB,OAAO;YACL,GAAG,OAAO;YAEV,kBAAkB,EAAE;gBAClB,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;gBACnB,aAAa,EAAE,EAAE;gBACjB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,IAAI,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,IAAI,IAAI,EAAE,QAAQ,IAAI,EAAE;gBACrE,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,IAAI,EAAE,MAAM,IAAI,IAAI,EAAE,GAAG,IAAI,IAAI,EAAE,EAAE,IAAI,EAAE;gBACvE,QAAQ,EAAE,KAAK;aAChB;SACF,CAAC;IACJ,CAAC;IAED,mFAAmF;IACnF,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,4BAA4B,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;IAEpF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAC,CAAC;IAChB,CAAC;IAED,OAAO;QACL,GAAG,OAAO;QAEV,kBAAkB,EAAE,OAAO;KAC5B,CAAC;AACJ,CAAC","sourcesContent":["import { AskResponse, StorySession } from 'quidproquo-core';\n\nimport { askRouteAuthValidationDecode } from '../actions/routeAuthValidation';\nimport { RouteAuthSettings } from '../config/settings/route';\nimport { HTTPEvent } from '../types/HTTPEvent';\nimport { getAccessTokenFromHeaders } from '../utils/headerUtils';\nimport { unsafeDecodeJWTPayload } from '../utils/jwtUtils';\n\nexport interface GetHttpApiEventStorySessionPayload {\n event: HTTPEvent;\n routeAuthSettings?: RouteAuthSettings;\n session: StorySession;\n}\n\nexport function* askGetHttpApiEventStorySession({\n event,\n routeAuthSettings,\n session,\n}: GetHttpApiEventStorySessionPayload): AskResponse<StorySession | undefined> {\n const accessToken = getAccessTokenFromHeaders(event.headers);\n\n if (!accessToken) {\n return void 0;\n }\n\n // If this endpoint has no auth settings, BUT we do have an access token\n // then we want to just attempt to extract info for logs, but we will say that its wasValid = false\n if (!routeAuthSettings?.userDirectoryName) {\n const info = unsafeDecodeJWTPayload<{\n sub?: string;\n userId?: string;\n username?: string;\n id?: string;\n exp?: number;\n }>(accessToken);\n\n return {\n ...session,\n\n decodedAccessToken: {\n exp: info?.exp || 0,\n userDirectory: '',\n userId: info?.sub || info?.id || info?.userId || info?.username || '',\n username: info?.username || info?.userId || info?.sub || info?.id || '',\n wasValid: false,\n },\n };\n }\n\n // Auth was already validated in auto-respond, so we can use ignoreExpiration: true\n const decoded = yield* askRouteAuthValidationDecode(event, routeAuthSettings, true);\n\n if (!decoded) {\n return void 0;\n }\n\n return {\n ...session,\n\n decodedAccessToken: decoded,\n };\n}\n"]}
1
+ {"version":3,"file":"askGetHttpApiEventStorySession.js","sourceRoot":"","sources":["../../../src/stories/askGetHttpApiEventStorySession.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAGtG,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAQ3D,MAAM,SAAS,CAAC,CAAC,8BAA8B,CAAC,EAC9C,KAAK,EACL,iBAAiB,EACjB,OAAO,GAC4B;IACnC,0EAA0E;IAC1E,6EAA6E;IAC7E,uDAAuD;IACvD,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,4BAA4B,CAAC,KAAK,EAAE,iBAAiB,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;IAE/F,IAAI,YAAY,CAAC,OAAO,KAAK,sBAAsB,CAAC,KAAK,EAAE,CAAC;QAC1D,OAAO;YACL,GAAG,OAAO;YAEV,kBAAkB,EAAE,YAAY,CAAC,kBAAkB;SACpD,CAAC;IACJ,CAAC;IAED,0EAA0E;IAC1E,IAAI,YAAY,CAAC,OAAO,KAAK,sBAAsB,CAAC,OAAO,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC,CAAC;IAChB,CAAC;IAED,8EAA8E;IAC9E,2EAA2E;IAC3E,MAAM,WAAW,GAAG,yBAAyB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE7D,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC,CAAC;IAChB,CAAC;IAED,MAAM,IAAI,GAAG,sBAAsB,CAMhC,WAAW,CAAC,CAAC;IAEhB,OAAO;QACL,GAAG,OAAO;QAEV,kBAAkB,EAAE;YAClB,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;YACnB,aAAa,EAAE,EAAE;YACjB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,IAAI,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,IAAI,IAAI,EAAE,QAAQ,IAAI,EAAE;YACrE,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,IAAI,EAAE,MAAM,IAAI,IAAI,EAAE,GAAG,IAAI,IAAI,EAAE,EAAE,IAAI,EAAE;YACvE,QAAQ,EAAE,KAAK;SAChB;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { AskResponse, StorySession } from 'quidproquo-core';\n\nimport { askRouteAuthValidationDecode, RouteAuthDecodeOutcome } from '../actions/routeAuthValidation';\nimport { RouteAuthSettings } from '../config/settings/route';\nimport { HTTPEvent } from '../types/HTTPEvent';\nimport { getAccessTokenFromHeaders } from '../utils/headerUtils';\nimport { unsafeDecodeJWTPayload } from '../utils/jwtUtils';\n\nexport interface GetHttpApiEventStorySessionPayload {\n event: HTTPEvent;\n routeAuthSettings?: RouteAuthSettings;\n session: StorySession;\n}\n\nexport function* askGetHttpApiEventStorySession({\n event,\n routeAuthSettings,\n session,\n}: GetHttpApiEventStorySessionPayload): AskResponse<StorySession | undefined> {\n // Always yield the decode, mirroring askValidateRouteAuth, so a per-route\n // processor override's identity reaches the session. Auth already ran in the\n // auto-respond preamble, hence ignoreExpiration: true.\n const decodeResult = yield* askRouteAuthValidationDecode(event, routeAuthSettings || {}, true);\n\n if (decodeResult.outcome === RouteAuthDecodeOutcome.valid) {\n return {\n ...session,\n\n decodedAccessToken: decodeResult.decodedAccessToken,\n };\n }\n\n // Normally unreachable: an invalid request already 401'd in the preamble.\n if (decodeResult.outcome === RouteAuthDecodeOutcome.invalid) {\n return void 0;\n }\n\n // Not applicable: no token auth configured for this route. If an access token\n // was sent anyway, extract info for the logs only, marked wasValid: false.\n const accessToken = getAccessTokenFromHeaders(event.headers);\n\n if (!accessToken) {\n return void 0;\n }\n\n const info = unsafeDecodeJWTPayload<{\n sub?: string;\n userId?: string;\n username?: string;\n id?: string;\n exp?: number;\n }>(accessToken);\n\n return {\n ...session,\n\n decodedAccessToken: {\n exp: info?.exp || 0,\n userDirectory: '',\n userId: info?.sub || info?.id || info?.userId || info?.username || '',\n username: info?.username || info?.userId || info?.sub || info?.id || '',\n wasValid: false,\n },\n };\n}\n"]}
@@ -1,3 +1,3 @@
1
- import { AskResponse, DecodedAccessToken } from 'quidproquo-core';
2
- import { RouteAuthValidationDecodeActionPayload } from '../actions/routeAuthValidation';
3
- export declare function askRouteAuthValidationDecodeDefault({ event, routeAuthSettings, ignoreExpiration, }: RouteAuthValidationDecodeActionPayload): AskResponse<DecodedAccessToken | null>;
1
+ import { AskResponse } from 'quidproquo-core';
2
+ import { RouteAuthDecodeResult, RouteAuthValidationDecodeActionPayload } from '../actions/routeAuthValidation';
3
+ export declare function askRouteAuthValidationDecodeDefault({ event, routeAuthSettings, ignoreExpiration, }: RouteAuthValidationDecodeActionPayload): AskResponse<RouteAuthDecodeResult>;
@@ -1,21 +1,25 @@
1
1
  import { askCatch, askUserDirectoryDecodeAccessToken } from 'quidproquo-core';
2
+ import { RouteAuthDecodeOutcome } from '../actions/routeAuthValidation';
2
3
  import { getHeaderValue } from '../utils/headerUtils';
3
4
  export function* askRouteAuthValidationDecodeDefault({ event, routeAuthSettings, ignoreExpiration, }) {
5
+ // No user directory means the route has no token auth under the default
6
+ // processor: not applicable, the request passes as anonymous. A per-route
7
+ // override that implements its own auth never reaches this story.
4
8
  if (!routeAuthSettings.userDirectoryName) {
5
- return null;
9
+ return { outcome: RouteAuthDecodeOutcome.notApplicable };
6
10
  }
7
11
  const authHeader = getHeaderValue('Authorization', event.headers);
8
12
  if (!authHeader) {
9
- return null;
13
+ return { outcome: RouteAuthDecodeOutcome.invalid };
10
14
  }
11
15
  const [authType, accessToken] = authHeader.split(' ');
12
16
  if (authType !== 'Bearer' || !accessToken) {
13
- return null;
17
+ return { outcome: RouteAuthDecodeOutcome.invalid };
14
18
  }
15
19
  const result = yield* askCatch(askUserDirectoryDecodeAccessToken(routeAuthSettings.userDirectoryName, ignoreExpiration, accessToken));
16
- if (!result.success) {
17
- return null;
20
+ if (!result.success || !result.result.wasValid) {
21
+ return { outcome: RouteAuthDecodeOutcome.invalid };
18
22
  }
19
- return result.result;
23
+ return { outcome: RouteAuthDecodeOutcome.valid, decodedAccessToken: result.result };
20
24
  }
21
25
  //# sourceMappingURL=askRouteAuthValidationDecodeDefault.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"askRouteAuthValidationDecodeDefault.js","sourceRoot":"","sources":["../../../src/stories/askRouteAuthValidationDecodeDefault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,iCAAiC,EAAsB,MAAM,iBAAiB,CAAC;AAG/G,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,SAAS,CAAC,CAAC,mCAAmC,CAAC,EACnD,KAAK,EACL,iBAAiB,EACjB,gBAAgB,GACuB;IACvC,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,UAAU,GAAG,cAAc,CAAC,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAClE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtD,IAAI,QAAQ,KAAK,QAAQ,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC;IAEtI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC","sourcesContent":["import { askCatch, AskResponse, askUserDirectoryDecodeAccessToken, DecodedAccessToken } from 'quidproquo-core';\n\nimport { RouteAuthValidationDecodeActionPayload } from '../actions/routeAuthValidation';\nimport { getHeaderValue } from '../utils/headerUtils';\n\nexport function* askRouteAuthValidationDecodeDefault({\n event,\n routeAuthSettings,\n ignoreExpiration,\n}: RouteAuthValidationDecodeActionPayload): AskResponse<DecodedAccessToken | null> {\n if (!routeAuthSettings.userDirectoryName) {\n return null;\n }\n\n const authHeader = getHeaderValue('Authorization', event.headers);\n if (!authHeader) {\n return null;\n }\n\n const [authType, accessToken] = authHeader.split(' ');\n if (authType !== 'Bearer' || !accessToken) {\n return null;\n }\n\n const result = yield* askCatch(askUserDirectoryDecodeAccessToken(routeAuthSettings.userDirectoryName, ignoreExpiration, accessToken));\n\n if (!result.success) {\n return null;\n }\n\n return result.result;\n}\n"]}
1
+ {"version":3,"file":"askRouteAuthValidationDecodeDefault.js","sourceRoot":"","sources":["../../../src/stories/askRouteAuthValidationDecodeDefault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AAE3F,OAAO,EAAE,sBAAsB,EAAiE,MAAM,gCAAgC,CAAC;AACvI,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,SAAS,CAAC,CAAC,mCAAmC,CAAC,EACnD,KAAK,EACL,iBAAiB,EACjB,gBAAgB,GACuB;IACvC,wEAAwE;IACxE,0EAA0E;IAC1E,kEAAkE;IAClE,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;QACzC,OAAO,EAAE,OAAO,EAAE,sBAAsB,CAAC,aAAa,EAAE,CAAC;IAC3D,CAAC;IAED,MAAM,UAAU,GAAG,cAAc,CAAC,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAClE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,OAAO,EAAE,sBAAsB,CAAC,OAAO,EAAE,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtD,IAAI,QAAQ,KAAK,QAAQ,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,OAAO,EAAE,OAAO,EAAE,sBAAsB,CAAC,OAAO,EAAE,CAAC;IACrD,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC;IAEtI,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC/C,OAAO,EAAE,OAAO,EAAE,sBAAsB,CAAC,OAAO,EAAE,CAAC;IACrD,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;AACtF,CAAC","sourcesContent":["import { askCatch, AskResponse, askUserDirectoryDecodeAccessToken } from 'quidproquo-core';\n\nimport { RouteAuthDecodeOutcome, RouteAuthDecodeResult, RouteAuthValidationDecodeActionPayload } from '../actions/routeAuthValidation';\nimport { getHeaderValue } from '../utils/headerUtils';\n\nexport function* askRouteAuthValidationDecodeDefault({\n event,\n routeAuthSettings,\n ignoreExpiration,\n}: RouteAuthValidationDecodeActionPayload): AskResponse<RouteAuthDecodeResult> {\n // No user directory means the route has no token auth under the default\n // processor: not applicable, the request passes as anonymous. A per-route\n // override that implements its own auth never reaches this story.\n if (!routeAuthSettings.userDirectoryName) {\n return { outcome: RouteAuthDecodeOutcome.notApplicable };\n }\n\n const authHeader = getHeaderValue('Authorization', event.headers);\n if (!authHeader) {\n return { outcome: RouteAuthDecodeOutcome.invalid };\n }\n\n const [authType, accessToken] = authHeader.split(' ');\n if (authType !== 'Bearer' || !accessToken) {\n return { outcome: RouteAuthDecodeOutcome.invalid };\n }\n\n const result = yield* askCatch(askUserDirectoryDecodeAccessToken(routeAuthSettings.userDirectoryName, ignoreExpiration, accessToken));\n\n if (!result.success || !result.result.wasValid) {\n return { outcome: RouteAuthDecodeOutcome.invalid };\n }\n\n return { outcome: RouteAuthDecodeOutcome.valid, decodedAccessToken: result.result };\n}\n"]}
@@ -1,18 +1,19 @@
1
1
  import { askApiKeyValidationValidate } from '../actions/apiKeyValidation';
2
- import { askRouteAuthValidationDecode } from '../actions/routeAuthValidation';
2
+ import { askRouteAuthValidationDecode, RouteAuthDecodeOutcome } from '../actions/routeAuthValidation';
3
3
  import { getHeaderValue } from '../utils/headerUtils';
4
4
  export function* askValidateRouteAuth({ event, routeAuthSettings }) {
5
5
  if (!routeAuthSettings) {
6
6
  return true;
7
7
  }
8
- // Token auth validation via swappable action
9
- if (routeAuthSettings.userDirectoryName) {
10
- const decoded = yield* askRouteAuthValidationDecode(event, routeAuthSettings, false);
11
- if (!decoded || !decoded.wasValid) {
12
- return false;
13
- }
8
+ // Token auth via the swappable decode action: always yielded, so a per-route
9
+ // processor override can implement completely custom auth. The default
10
+ // processor keeps the user-directory check internally and returns
11
+ // notApplicable when the route has no token auth configured.
12
+ const decodeResult = yield* askRouteAuthValidationDecode(event, routeAuthSettings, false);
13
+ if (decodeResult.outcome === RouteAuthDecodeOutcome.invalid) {
14
+ return false;
14
15
  }
15
- // API key validation via action
16
+ // API key validation via action, composing with AND semantics
16
17
  const apiKeys = routeAuthSettings.apiKeys || [];
17
18
  if (apiKeys.length > 0) {
18
19
  const apiKeyHeader = getHeaderValue('x-api-key', event.headers);
@@ -1 +1 @@
1
- {"version":3,"file":"askValidateRouteAuth.js","sourceRoot":"","sources":["../../../src/stories/askValidateRouteAuth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAG9E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAOtD,MAAM,SAAS,CAAC,CAAC,oBAAoB,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAA4B;IAC1F,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6CAA6C;IAC7C,IAAI,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,4BAA4B,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC;QACrF,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,gCAAgC;IAChC,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,IAAI,EAAE,CAAC;IAChD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,YAAY,GAAG,cAAc,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAChE,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,2BAA2B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { AskResponse } from 'quidproquo-core';\n\nimport { askApiKeyValidationValidate } from '../actions/apiKeyValidation';\nimport { askRouteAuthValidationDecode } from '../actions/routeAuthValidation';\nimport { RouteAuthSettings } from '../config/settings/route';\nimport { HTTPEvent } from '../types/HTTPEvent';\nimport { getHeaderValue } from '../utils/headerUtils';\n\nexport interface ValidateRouteAuthPayload {\n event: HTTPEvent;\n routeAuthSettings?: RouteAuthSettings;\n}\n\nexport function* askValidateRouteAuth({ event, routeAuthSettings }: ValidateRouteAuthPayload): AskResponse<boolean> {\n if (!routeAuthSettings) {\n return true;\n }\n\n // Token auth validation via swappable action\n if (routeAuthSettings.userDirectoryName) {\n const decoded = yield* askRouteAuthValidationDecode(event, routeAuthSettings, false);\n if (!decoded || !decoded.wasValid) {\n return false;\n }\n }\n\n // API key validation via action\n const apiKeys = routeAuthSettings.apiKeys || [];\n if (apiKeys.length > 0) {\n const apiKeyHeader = getHeaderValue('x-api-key', event.headers);\n if (!apiKeyHeader) {\n return false;\n }\n\n const valid = yield* askApiKeyValidationValidate(apiKeyHeader, apiKeys);\n if (!valid) {\n return false;\n }\n }\n\n return true;\n}\n"]}
1
+ {"version":3,"file":"askValidateRouteAuth.js","sourceRoot":"","sources":["../../../src/stories/askValidateRouteAuth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAGtG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAOtD,MAAM,SAAS,CAAC,CAAC,oBAAoB,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAA4B;IAC1F,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6EAA6E;IAC7E,uEAAuE;IACvE,kEAAkE;IAClE,6DAA6D;IAC7D,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,4BAA4B,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC;IAC1F,IAAI,YAAY,CAAC,OAAO,KAAK,sBAAsB,CAAC,OAAO,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,8DAA8D;IAC9D,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,IAAI,EAAE,CAAC;IAChD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,YAAY,GAAG,cAAc,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAChE,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,2BAA2B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { AskResponse } from 'quidproquo-core';\n\nimport { askApiKeyValidationValidate } from '../actions/apiKeyValidation';\nimport { askRouteAuthValidationDecode, RouteAuthDecodeOutcome } from '../actions/routeAuthValidation';\nimport { RouteAuthSettings } from '../config/settings/route';\nimport { HTTPEvent } from '../types/HTTPEvent';\nimport { getHeaderValue } from '../utils/headerUtils';\n\nexport interface ValidateRouteAuthPayload {\n event: HTTPEvent;\n routeAuthSettings?: RouteAuthSettings;\n}\n\nexport function* askValidateRouteAuth({ event, routeAuthSettings }: ValidateRouteAuthPayload): AskResponse<boolean> {\n if (!routeAuthSettings) {\n return true;\n }\n\n // Token auth via the swappable decode action: always yielded, so a per-route\n // processor override can implement completely custom auth. The default\n // processor keeps the user-directory check internally and returns\n // notApplicable when the route has no token auth configured.\n const decodeResult = yield* askRouteAuthValidationDecode(event, routeAuthSettings, false);\n if (decodeResult.outcome === RouteAuthDecodeOutcome.invalid) {\n return false;\n }\n\n // API key validation via action, composing with AND semantics\n const apiKeys = routeAuthSettings.apiKeys || [];\n if (apiKeys.length > 0) {\n const apiKeyHeader = getHeaderValue('x-api-key', event.headers);\n if (!apiKeyHeader) {\n return false;\n }\n\n const valid = yield* askApiKeyValidationValidate(apiKeyHeader, apiKeys);\n if (!valid) {\n return false;\n }\n }\n\n return true;\n}\n"]}
@@ -36,13 +36,13 @@ export const getAllWebsocketSrcEntries = (qpqConfig) => {
36
36
  // Used in bundlers to know where and what to build and index
37
37
  // Events, routes, etc
38
38
  export const getAllSrcEntries = (configs) => {
39
- return [
39
+ return qpqCoreUtils.expandSrcEntriesWithActionProcessors([
40
40
  ...getAllRoutes(configs).map((r) => r.runtime),
41
41
  // ...getAllOpenApiSpecs(configs).map((r) => r.openApiSpecPath),
42
42
  ...getAllSeo(configs).map((seo) => seo.runtime),
43
43
  ...getAllServiceFunctions(configs).map((sf) => sf.runtime),
44
44
  ...getAllWebsocketSrcEntries(configs),
45
- ];
45
+ ]);
46
46
  };
47
47
  export const getDomainName = (configs) => {
48
48
  const dnsSettings = qpqCoreUtils.getConfigSetting(configs, QPQWebServerConfigSettingType.Dns);
@@ -1 +1 @@
1
- {"version":3,"file":"qpqConfigAccessorsUtils.js","sourceRoot":"","sources":["../../../src/utils/qpqConfigAccessorsUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,YAAY,EAAsB,MAAM,iBAAiB,CAAC;AAEzF,OAAO,EAWL,6BAA6B,GAO9B,MAAM,WAAW,CAAC;AAGnB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAoB,EAAoC,EAAE;IACrF,MAAM,MAAM,GAAG,YAAY,CAAC,iBAAiB,CAAiC,SAAS,EAAE,6BAA6B,CAAC,KAAK,CAAC,CAAC;IAE9H,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,SAAoB,EAAoC,EAAE;IAC5G,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAEvC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAoB,EAAqC,EAAE;IAC7F,MAAM,aAAa,GAAG,YAAY,CAAC,iBAAiB,CAAkC,SAAS,EAAE,6BAA6B,CAAC,MAAM,CAAC,CAAC;IAEvI,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,SAAoB,EAAkC,EAAE;IAChF,MAAM,UAAU,GAAG,YAAY,CAAC,iBAAiB,CAA+B,SAAS,EAAE,6BAA6B,CAAC,GAAG,CAAC,CAAC;IAE9H,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAoB,EAA8C,EAAE;IACzG,MAAM,gBAAgB,GAAG,YAAY,CAAC,iBAAiB,CACrD,SAAS,EACT,6BAA6B,CAAC,eAAe,CAC9C,CAA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BAA6B,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAEnI,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAAoB,EAAwC,EAAE;IACjG,MAAM,iBAAiB,GACrB,YAAY,CAAC,iBAAiB,CAAqC,SAAS,EAAE,6BAA6B,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAE/H,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,SAAoB,EAAwC,EAAE;IACtG,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAE1D,OAAO,YAAY,CAAC,aAAa,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;AAClE,CAAC,CAAC","sourcesContent":["import { isDefined, QPQConfig, qpqCoreUtils, QpqFunctionRuntime } from 'quidproquo-core';\n\nimport {\n ApiKeyQPQWebServerConfigSetting,\n CacheQPQWebServerConfigSetting,\n CertificateQPQWebServerConfigSetting,\n DefaultRouteOptionsQPQWebServerConfigSetting,\n DnsQPQWebServerConfigSetting,\n DomainProxyQPQWebServerConfigSetting,\n EmailSenderQPQWebServerConfigSetting,\n FileUploadSettings,\n FileUploadSettingsQPQWebServerConfigSetting,\n OpenApiQPQWebServerConfigSetting,\n QPQWebServerConfigSettingType,\n RouteQPQWebServerConfigSetting,\n SeoQPQWebServerConfigSetting,\n ServiceFunctionQPQWebServerConfigSetting,\n StorageDriveCorsSettingsQPQWebServerConfigSetting,\n SubdomainRedirectQPQWebServerConfigSetting,\n WebSocketQPQWebServerConfigSetting,\n} from '../config';\nimport { ApiQPQWebServerConfigSetting, WebEntryQPQWebServerConfigSetting } from '../config';\n\nexport const getAllRoutes = (qpqConfig: QPQConfig): RouteQPQWebServerConfigSetting[] => {\n const routes = qpqCoreUtils.getConfigSettings<RouteQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Route);\n\n return routes;\n};\n\nexport const getAllRoutesForApi = (apiName: string, qpqConfig: QPQConfig): RouteQPQWebServerConfigSetting[] => {\n const routes = getAllRoutes(qpqConfig);\n\n return routes;\n};\n\nexport const getAllApiKeyConfigs = (qpqConfig: QPQConfig): ApiKeyQPQWebServerConfigSetting[] => {\n const apiKeyConfigs = qpqCoreUtils.getConfigSettings<ApiKeyQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.ApiKey);\n\n return apiKeyConfigs;\n};\n\nexport const getAllSeo = (qpqConfig: QPQConfig): SeoQPQWebServerConfigSetting[] => {\n const seoConfigs = qpqCoreUtils.getConfigSettings<SeoQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Seo);\n\n return seoConfigs;\n};\n\nexport const getAllServiceFunctions = (qpqConfig: QPQConfig): ServiceFunctionQPQWebServerConfigSetting[] => {\n const serviceFunctions = qpqCoreUtils.getConfigSettings<ServiceFunctionQPQWebServerConfigSetting>(\n qpqConfig,\n QPQWebServerConfigSettingType.ServiceFunction,\n );\n\n return serviceFunctions;\n};\n\nexport const getOwnedServiceFunctions = (qpqConfig: QPQConfig): ServiceFunctionQPQWebServerConfigSetting[] => {\n const serviceFunctions = getAllServiceFunctions(qpqConfig);\n\n return qpqCoreUtils.getOwnedItems(serviceFunctions, qpqConfig);\n};\n\nexport const getAllOpenApiSpecs = (configs: QPQConfig): OpenApiQPQWebServerConfigSetting[] => {\n const openApiSpecs = qpqCoreUtils.getConfigSettings<OpenApiQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.OpenApi);\n\n return openApiSpecs;\n};\n\nexport const getAllWebsocketSrcEntries = (qpqConfig: QPQConfig): QpqFunctionRuntime[] => {\n return getOwnedWebsocketSettings(qpqConfig)\n .flatMap((s) => [s.eventProcessors.onConnect, s.eventProcessors.onDisconnect, s.eventProcessors.onMessage])\n .filter(isDefined);\n};\n\n// Used in bundlers to know where and what to build and index\n// Events, routes, etc\nexport const getAllSrcEntries = (configs: QPQConfig): QpqFunctionRuntime[] => {\n return [\n ...getAllRoutes(configs).map((r) => r.runtime),\n // ...getAllOpenApiSpecs(configs).map((r) => r.openApiSpecPath),\n ...getAllSeo(configs).map((seo) => seo.runtime),\n ...getAllServiceFunctions(configs).map((sf) => sf.runtime),\n ...getAllWebsocketSrcEntries(configs),\n ];\n};\n\nexport const getDomainName = (configs: QPQConfig): string => {\n const dnsSettings = qpqCoreUtils.getConfigSetting<DnsQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.Dns);\n\n return dnsSettings?.dnsBase || '';\n};\n\nexport const getWebEntry = (configs: QPQConfig): string => {\n const webEntry = qpqCoreUtils.getConfigSetting<WebEntryQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.WebEntry);\n\n if (!webEntry?.buildPath) {\n throw new Error('please use defineWebEntry in your qpq config');\n }\n\n return webEntry?.buildPath;\n};\n\nexport const getWebsocketEntryByApiName = (apiName: string, qpqConfig: QPQConfig): WebSocketQPQWebServerConfigSetting => {\n const websocketSettings = getWebsocketSettings(qpqConfig);\n\n const websocketSetting = websocketSettings.find((s) => s.apiName === apiName);\n\n if (!websocketSetting) {\n throw new Error(`No websocket setting found for api [${apiName}]`);\n }\n\n return websocketSetting;\n};\n\nexport const getSubdomainRedirects = (configs: QPQConfig): SubdomainRedirectQPQWebServerConfigSetting[] => {\n const subdomainRedirects = qpqCoreUtils.getConfigSettings<SubdomainRedirectQPQWebServerConfigSetting>(\n configs,\n QPQWebServerConfigSettingType.SubdomainRedirect,\n );\n\n return subdomainRedirects;\n};\n\nexport const getApiConfigs = (configs: QPQConfig): ApiQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<ApiQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.Api);\n};\n\nexport const getDnsConfigs = (configs: QPQConfig): DnsQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<DnsQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.Dns);\n};\n\nexport const getWebEntryConfigs = (configs: QPQConfig): WebEntryQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<WebEntryQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.WebEntry);\n};\n\nexport const getDomainProxyConfigs = (configs: QPQConfig): DomainProxyQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<DomainProxyQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.DomainProxy);\n};\n\nexport const getAllOwnedCacheConfigs = (qpqConfig: QPQConfig): CacheQPQWebServerConfigSetting[] => {\n const cacheSettings = qpqCoreUtils.getConfigSettings<CacheQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Cache);\n\n return qpqCoreUtils.getOwnedItems(cacheSettings, qpqConfig);\n};\n\nexport const getAllOwnedCertifcateConfigs = (qpqConfig: QPQConfig): CertificateQPQWebServerConfigSetting[] => {\n const certificateSettings = qpqCoreUtils.getConfigSettings<CertificateQPQWebServerConfigSetting>(\n qpqConfig,\n QPQWebServerConfigSettingType.Certificate,\n );\n\n return qpqCoreUtils.getOwnedItems(certificateSettings, qpqConfig);\n};\n\nexport const getCacheConfigByName = (cacheConfigName: string, qpqConfig: QPQConfig): CacheQPQWebServerConfigSetting => {\n const cacheSetting = qpqCoreUtils\n .getConfigSettings<CacheQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Cache)\n .find((c) => c.name === cacheConfigName);\n\n if (!cacheSetting) {\n throw new Error(`No cache config found for name [${cacheConfigName}]`);\n }\n\n return cacheSetting;\n};\n\nexport const getEnvironmentDomainName = (configs: QPQConfig): string => {\n const environment = qpqCoreUtils.getApplicationModuleEnvironment(configs);\n const apexDomainName = getDomainName(configs);\n\n if (environment === 'production') {\n return apexDomainName;\n }\n\n return `${environment}.${apexDomainName}`;\n};\n\nexport const getBaseDomainName = (qpqConfig: QPQConfig): string => {\n const environmentDomain = getEnvironmentDomainName(qpqConfig);\n const feature = qpqCoreUtils.getApplicationModuleFeature(qpqConfig);\n\n if (feature) {\n return `${feature}.${environmentDomain}`;\n }\n\n return environmentDomain;\n};\n\nexport const getServiceDomainName = (qpqConfig: QPQConfig): string => {\n const service = qpqCoreUtils.getApplicationModuleName(qpqConfig);\n const domainBase = getBaseDomainName(qpqConfig);\n\n return `${service}.${domainBase}`;\n};\n\n/**\n * Resolve browser CORS origins for a service resource. An explicit list wins;\n * otherwise scope to this service's own domain (apex + one-level subdomain\n * wildcard, which S3/CloudFront both support). Falls back to '*' only when the\n * service declares no domain at all (nothing browser-facing).\n *\n * Note: key off the raw dns base (`getDomainName`) to detect \"no domain\" —\n * `getBaseDomainName` still returns an env prefix like `development.` here.\n */\nexport const resolveServiceScopedCorsAllowedOrigins = (qpqConfig: QPQConfig, explicitOrigins?: string[]): string[] => {\n if (explicitOrigins) {\n return explicitOrigins;\n }\n\n if (!getDomainName(qpqConfig)) {\n return ['*'];\n }\n\n const baseDomain = getBaseDomainName(qpqConfig);\n return [`https://${baseDomain}`, `https://*.${baseDomain}`];\n};\n\n/**\n * Browser origins allowed to read/write a storage drive's objects cross-origin\n * (e.g. presigned uploads/downloads), looked up by the drive's name. An explicit\n * `defineStorageDriveCorsSettings` wins; otherwise the service-scoped default.\n */\nexport const getStorageDriveCorsAllowedOrigins = (qpqConfig: QPQConfig, storageDriveName: string): string[] => {\n const corsSetting = qpqCoreUtils\n .getConfigSettings<StorageDriveCorsSettingsQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.StorageDriveCorsSettings)\n .find((setting) => setting.storageDriveName === storageDriveName);\n\n return resolveServiceScopedCorsAllowedOrigins(qpqConfig, corsSetting?.allowedOrigins);\n};\n\n/**\n * Whether any web entry in this service serves its assets from the named storage\n * drive (`storageDrive.sourceStorageDrive`) — i.e. the drive's bucket is a\n * CloudFront origin. Drives with no web entry consumer need no CloudFront access\n * to their bucket at all.\n */\nexport const isStorageDriveWebEntryOrigin = (qpqConfig: QPQConfig, storageDriveName: string): boolean => {\n return getWebEntryConfigs(qpqConfig).some((webEntry) => webEntry.storageDrive.sourceStorageDrive === storageDriveName);\n};\n\n// API Gateway caps request payloads at 10MB, so the default per-file ceiling matches it;\n// the other defaults exist to bound parser memory rather than to be hit in practice.\nexport const defaultFileUploadSettings: FileUploadSettings = {\n maxFileSizeBytes: 10 * 1024 * 1024,\n maxFileCount: 10,\n maxFieldCount: 100,\n maxFieldSizeBytes: 1024 * 1024,\n};\n\nexport const getFileUploadSettings = (qpqConfig: QPQConfig): FileUploadSettings => {\n const setting = qpqCoreUtils.getConfigSetting<FileUploadSettingsQPQWebServerConfigSetting>(\n qpqConfig,\n QPQWebServerConfigSettingType.FileUploadSettings,\n );\n\n return {\n ...defaultFileUploadSettings,\n ...Object.fromEntries(Object.entries(setting?.fileUploadSettings || {}).filter(([, value]) => isDefined(value))),\n };\n};\n\nexport const resolveApexDomainNameFromDomainConfig = (qpqConfig: QPQConfig, rootDomain: string, onRootDomain: boolean): string => {\n const feature = qpqCoreUtils.getApplicationModuleFeature(qpqConfig);\n const environment = qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);\n\n const apexDomain = onRootDomain\n ? getDomainRoot(rootDomain, environment, feature)\n : constructServiceDomainName(rootDomain, environment, qpqCoreUtils.getApplicationModuleName(qpqConfig), feature);\n\n return apexDomain;\n};\n\nexport const constructServiceDomainName = (rootDomain: string, environment: string, service: string, feature?: string) => {\n const domainBase = getDomainRoot(rootDomain, environment, feature);\n\n return `${service}.${domainBase}`;\n};\n\nexport const constructEnvironmentDomainName = (environment: string, domain: string): string => {\n if (environment === 'production') {\n return domain;\n }\n\n return `${environment}.${domain}`;\n};\n\nexport const getDefaultRouteSettings = (qpqConfig: QPQConfig): DefaultRouteOptionsQPQWebServerConfigSetting[] => {\n const defaultRouteSettings =\n qpqCoreUtils.getConfigSettings<DefaultRouteOptionsQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.DefaultRouteOptions) || [];\n\n return defaultRouteSettings;\n};\n\nexport const getDomainRoot = (rootDomain: string, environment: string, feature?: string): string => {\n let domainPrefix = environment !== 'production' ? `${environment}.` : '';\n if (feature) {\n domainPrefix = `${feature}.${domainPrefix}`;\n }\n\n return `${domainPrefix}${rootDomain}`;\n};\n\nexport const resolveDomainRoot = (rootDomain: string, qpqConfig: QPQConfig): string => {\n const domain = getDomainRoot(\n rootDomain,\n qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig),\n qpqCoreUtils.getApplicationModuleFeature(qpqConfig),\n );\n\n return domain;\n};\n\nexport const getEmailSenderSettings = (qpqConfig: QPQConfig): EmailSenderQPQWebServerConfigSetting[] => {\n const emailSenderSettings =\n qpqCoreUtils.getConfigSettings<EmailSenderQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.EmailSender) || [];\n\n return emailSenderSettings;\n};\n\nexport const getWebsocketSettings = (qpqConfig: QPQConfig): WebSocketQPQWebServerConfigSetting[] => {\n const websocketSettings =\n qpqCoreUtils.getConfigSettings<WebSocketQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.WebSocket) || [];\n\n return websocketSettings;\n};\n\nexport const getOwnedWebsocketSettings = (qpqConfig: QPQConfig): WebSocketQPQWebServerConfigSetting[] => {\n const websocketSettings = getWebsocketSettings(qpqConfig);\n\n return qpqCoreUtils.getOwnedItems(websocketSettings, qpqConfig);\n};\n"]}
1
+ {"version":3,"file":"qpqConfigAccessorsUtils.js","sourceRoot":"","sources":["../../../src/utils/qpqConfigAccessorsUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,YAAY,EAAsB,MAAM,iBAAiB,CAAC;AAEzF,OAAO,EAWL,6BAA6B,GAO9B,MAAM,WAAW,CAAC;AAGnB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAoB,EAAoC,EAAE;IACrF,MAAM,MAAM,GAAG,YAAY,CAAC,iBAAiB,CAAiC,SAAS,EAAE,6BAA6B,CAAC,KAAK,CAAC,CAA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B,CAAC,SAAS,CAAC,CAAC;IAE1D,OAAO,YAAY,CAAC,aAAa,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;AAClE,CAAC,CAAC","sourcesContent":["import { isDefined, QPQConfig, qpqCoreUtils, QpqFunctionRuntime } from 'quidproquo-core';\n\nimport {\n ApiKeyQPQWebServerConfigSetting,\n CacheQPQWebServerConfigSetting,\n CertificateQPQWebServerConfigSetting,\n DefaultRouteOptionsQPQWebServerConfigSetting,\n DnsQPQWebServerConfigSetting,\n DomainProxyQPQWebServerConfigSetting,\n EmailSenderQPQWebServerConfigSetting,\n FileUploadSettings,\n FileUploadSettingsQPQWebServerConfigSetting,\n OpenApiQPQWebServerConfigSetting,\n QPQWebServerConfigSettingType,\n RouteQPQWebServerConfigSetting,\n SeoQPQWebServerConfigSetting,\n ServiceFunctionQPQWebServerConfigSetting,\n StorageDriveCorsSettingsQPQWebServerConfigSetting,\n SubdomainRedirectQPQWebServerConfigSetting,\n WebSocketQPQWebServerConfigSetting,\n} from '../config';\nimport { ApiQPQWebServerConfigSetting, WebEntryQPQWebServerConfigSetting } from '../config';\n\nexport const getAllRoutes = (qpqConfig: QPQConfig): RouteQPQWebServerConfigSetting[] => {\n const routes = qpqCoreUtils.getConfigSettings<RouteQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Route);\n\n return routes;\n};\n\nexport const getAllRoutesForApi = (apiName: string, qpqConfig: QPQConfig): RouteQPQWebServerConfigSetting[] => {\n const routes = getAllRoutes(qpqConfig);\n\n return routes;\n};\n\nexport const getAllApiKeyConfigs = (qpqConfig: QPQConfig): ApiKeyQPQWebServerConfigSetting[] => {\n const apiKeyConfigs = qpqCoreUtils.getConfigSettings<ApiKeyQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.ApiKey);\n\n return apiKeyConfigs;\n};\n\nexport const getAllSeo = (qpqConfig: QPQConfig): SeoQPQWebServerConfigSetting[] => {\n const seoConfigs = qpqCoreUtils.getConfigSettings<SeoQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Seo);\n\n return seoConfigs;\n};\n\nexport const getAllServiceFunctions = (qpqConfig: QPQConfig): ServiceFunctionQPQWebServerConfigSetting[] => {\n const serviceFunctions = qpqCoreUtils.getConfigSettings<ServiceFunctionQPQWebServerConfigSetting>(\n qpqConfig,\n QPQWebServerConfigSettingType.ServiceFunction,\n );\n\n return serviceFunctions;\n};\n\nexport const getOwnedServiceFunctions = (qpqConfig: QPQConfig): ServiceFunctionQPQWebServerConfigSetting[] => {\n const serviceFunctions = getAllServiceFunctions(qpqConfig);\n\n return qpqCoreUtils.getOwnedItems(serviceFunctions, qpqConfig);\n};\n\nexport const getAllOpenApiSpecs = (configs: QPQConfig): OpenApiQPQWebServerConfigSetting[] => {\n const openApiSpecs = qpqCoreUtils.getConfigSettings<OpenApiQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.OpenApi);\n\n return openApiSpecs;\n};\n\nexport const getAllWebsocketSrcEntries = (qpqConfig: QPQConfig): QpqFunctionRuntime[] => {\n return getOwnedWebsocketSettings(qpqConfig)\n .flatMap((s) => [s.eventProcessors.onConnect, s.eventProcessors.onDisconnect, s.eventProcessors.onMessage])\n .filter(isDefined);\n};\n\n// Used in bundlers to know where and what to build and index\n// Events, routes, etc\nexport const getAllSrcEntries = (configs: QPQConfig): QpqFunctionRuntime[] => {\n return qpqCoreUtils.expandSrcEntriesWithActionProcessors([\n ...getAllRoutes(configs).map((r) => r.runtime),\n // ...getAllOpenApiSpecs(configs).map((r) => r.openApiSpecPath),\n ...getAllSeo(configs).map((seo) => seo.runtime),\n ...getAllServiceFunctions(configs).map((sf) => sf.runtime),\n ...getAllWebsocketSrcEntries(configs),\n ]);\n};\n\nexport const getDomainName = (configs: QPQConfig): string => {\n const dnsSettings = qpqCoreUtils.getConfigSetting<DnsQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.Dns);\n\n return dnsSettings?.dnsBase || '';\n};\n\nexport const getWebEntry = (configs: QPQConfig): string => {\n const webEntry = qpqCoreUtils.getConfigSetting<WebEntryQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.WebEntry);\n\n if (!webEntry?.buildPath) {\n throw new Error('please use defineWebEntry in your qpq config');\n }\n\n return webEntry?.buildPath;\n};\n\nexport const getWebsocketEntryByApiName = (apiName: string, qpqConfig: QPQConfig): WebSocketQPQWebServerConfigSetting => {\n const websocketSettings = getWebsocketSettings(qpqConfig);\n\n const websocketSetting = websocketSettings.find((s) => s.apiName === apiName);\n\n if (!websocketSetting) {\n throw new Error(`No websocket setting found for api [${apiName}]`);\n }\n\n return websocketSetting;\n};\n\nexport const getSubdomainRedirects = (configs: QPQConfig): SubdomainRedirectQPQWebServerConfigSetting[] => {\n const subdomainRedirects = qpqCoreUtils.getConfigSettings<SubdomainRedirectQPQWebServerConfigSetting>(\n configs,\n QPQWebServerConfigSettingType.SubdomainRedirect,\n );\n\n return subdomainRedirects;\n};\n\nexport const getApiConfigs = (configs: QPQConfig): ApiQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<ApiQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.Api);\n};\n\nexport const getDnsConfigs = (configs: QPQConfig): DnsQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<DnsQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.Dns);\n};\n\nexport const getWebEntryConfigs = (configs: QPQConfig): WebEntryQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<WebEntryQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.WebEntry);\n};\n\nexport const getDomainProxyConfigs = (configs: QPQConfig): DomainProxyQPQWebServerConfigSetting[] => {\n return qpqCoreUtils.getConfigSettings<DomainProxyQPQWebServerConfigSetting>(configs, QPQWebServerConfigSettingType.DomainProxy);\n};\n\nexport const getAllOwnedCacheConfigs = (qpqConfig: QPQConfig): CacheQPQWebServerConfigSetting[] => {\n const cacheSettings = qpqCoreUtils.getConfigSettings<CacheQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Cache);\n\n return qpqCoreUtils.getOwnedItems(cacheSettings, qpqConfig);\n};\n\nexport const getAllOwnedCertifcateConfigs = (qpqConfig: QPQConfig): CertificateQPQWebServerConfigSetting[] => {\n const certificateSettings = qpqCoreUtils.getConfigSettings<CertificateQPQWebServerConfigSetting>(\n qpqConfig,\n QPQWebServerConfigSettingType.Certificate,\n );\n\n return qpqCoreUtils.getOwnedItems(certificateSettings, qpqConfig);\n};\n\nexport const getCacheConfigByName = (cacheConfigName: string, qpqConfig: QPQConfig): CacheQPQWebServerConfigSetting => {\n const cacheSetting = qpqCoreUtils\n .getConfigSettings<CacheQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.Cache)\n .find((c) => c.name === cacheConfigName);\n\n if (!cacheSetting) {\n throw new Error(`No cache config found for name [${cacheConfigName}]`);\n }\n\n return cacheSetting;\n};\n\nexport const getEnvironmentDomainName = (configs: QPQConfig): string => {\n const environment = qpqCoreUtils.getApplicationModuleEnvironment(configs);\n const apexDomainName = getDomainName(configs);\n\n if (environment === 'production') {\n return apexDomainName;\n }\n\n return `${environment}.${apexDomainName}`;\n};\n\nexport const getBaseDomainName = (qpqConfig: QPQConfig): string => {\n const environmentDomain = getEnvironmentDomainName(qpqConfig);\n const feature = qpqCoreUtils.getApplicationModuleFeature(qpqConfig);\n\n if (feature) {\n return `${feature}.${environmentDomain}`;\n }\n\n return environmentDomain;\n};\n\nexport const getServiceDomainName = (qpqConfig: QPQConfig): string => {\n const service = qpqCoreUtils.getApplicationModuleName(qpqConfig);\n const domainBase = getBaseDomainName(qpqConfig);\n\n return `${service}.${domainBase}`;\n};\n\n/**\n * Resolve browser CORS origins for a service resource. An explicit list wins;\n * otherwise scope to this service's own domain (apex + one-level subdomain\n * wildcard, which S3/CloudFront both support). Falls back to '*' only when the\n * service declares no domain at all (nothing browser-facing).\n *\n * Note: key off the raw dns base (`getDomainName`) to detect \"no domain\" —\n * `getBaseDomainName` still returns an env prefix like `development.` here.\n */\nexport const resolveServiceScopedCorsAllowedOrigins = (qpqConfig: QPQConfig, explicitOrigins?: string[]): string[] => {\n if (explicitOrigins) {\n return explicitOrigins;\n }\n\n if (!getDomainName(qpqConfig)) {\n return ['*'];\n }\n\n const baseDomain = getBaseDomainName(qpqConfig);\n return [`https://${baseDomain}`, `https://*.${baseDomain}`];\n};\n\n/**\n * Browser origins allowed to read/write a storage drive's objects cross-origin\n * (e.g. presigned uploads/downloads), looked up by the drive's name. An explicit\n * `defineStorageDriveCorsSettings` wins; otherwise the service-scoped default.\n */\nexport const getStorageDriveCorsAllowedOrigins = (qpqConfig: QPQConfig, storageDriveName: string): string[] => {\n const corsSetting = qpqCoreUtils\n .getConfigSettings<StorageDriveCorsSettingsQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.StorageDriveCorsSettings)\n .find((setting) => setting.storageDriveName === storageDriveName);\n\n return resolveServiceScopedCorsAllowedOrigins(qpqConfig, corsSetting?.allowedOrigins);\n};\n\n/**\n * Whether any web entry in this service serves its assets from the named storage\n * drive (`storageDrive.sourceStorageDrive`) — i.e. the drive's bucket is a\n * CloudFront origin. Drives with no web entry consumer need no CloudFront access\n * to their bucket at all.\n */\nexport const isStorageDriveWebEntryOrigin = (qpqConfig: QPQConfig, storageDriveName: string): boolean => {\n return getWebEntryConfigs(qpqConfig).some((webEntry) => webEntry.storageDrive.sourceStorageDrive === storageDriveName);\n};\n\n// API Gateway caps request payloads at 10MB, so the default per-file ceiling matches it;\n// the other defaults exist to bound parser memory rather than to be hit in practice.\nexport const defaultFileUploadSettings: FileUploadSettings = {\n maxFileSizeBytes: 10 * 1024 * 1024,\n maxFileCount: 10,\n maxFieldCount: 100,\n maxFieldSizeBytes: 1024 * 1024,\n};\n\nexport const getFileUploadSettings = (qpqConfig: QPQConfig): FileUploadSettings => {\n const setting = qpqCoreUtils.getConfigSetting<FileUploadSettingsQPQWebServerConfigSetting>(\n qpqConfig,\n QPQWebServerConfigSettingType.FileUploadSettings,\n );\n\n return {\n ...defaultFileUploadSettings,\n ...Object.fromEntries(Object.entries(setting?.fileUploadSettings || {}).filter(([, value]) => isDefined(value))),\n };\n};\n\nexport const resolveApexDomainNameFromDomainConfig = (qpqConfig: QPQConfig, rootDomain: string, onRootDomain: boolean): string => {\n const feature = qpqCoreUtils.getApplicationModuleFeature(qpqConfig);\n const environment = qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);\n\n const apexDomain = onRootDomain\n ? getDomainRoot(rootDomain, environment, feature)\n : constructServiceDomainName(rootDomain, environment, qpqCoreUtils.getApplicationModuleName(qpqConfig), feature);\n\n return apexDomain;\n};\n\nexport const constructServiceDomainName = (rootDomain: string, environment: string, service: string, feature?: string) => {\n const domainBase = getDomainRoot(rootDomain, environment, feature);\n\n return `${service}.${domainBase}`;\n};\n\nexport const constructEnvironmentDomainName = (environment: string, domain: string): string => {\n if (environment === 'production') {\n return domain;\n }\n\n return `${environment}.${domain}`;\n};\n\nexport const getDefaultRouteSettings = (qpqConfig: QPQConfig): DefaultRouteOptionsQPQWebServerConfigSetting[] => {\n const defaultRouteSettings =\n qpqCoreUtils.getConfigSettings<DefaultRouteOptionsQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.DefaultRouteOptions) || [];\n\n return defaultRouteSettings;\n};\n\nexport const getDomainRoot = (rootDomain: string, environment: string, feature?: string): string => {\n let domainPrefix = environment !== 'production' ? `${environment}.` : '';\n if (feature) {\n domainPrefix = `${feature}.${domainPrefix}`;\n }\n\n return `${domainPrefix}${rootDomain}`;\n};\n\nexport const resolveDomainRoot = (rootDomain: string, qpqConfig: QPQConfig): string => {\n const domain = getDomainRoot(\n rootDomain,\n qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig),\n qpqCoreUtils.getApplicationModuleFeature(qpqConfig),\n );\n\n return domain;\n};\n\nexport const getEmailSenderSettings = (qpqConfig: QPQConfig): EmailSenderQPQWebServerConfigSetting[] => {\n const emailSenderSettings =\n qpqCoreUtils.getConfigSettings<EmailSenderQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.EmailSender) || [];\n\n return emailSenderSettings;\n};\n\nexport const getWebsocketSettings = (qpqConfig: QPQConfig): WebSocketQPQWebServerConfigSetting[] => {\n const websocketSettings =\n qpqCoreUtils.getConfigSettings<WebSocketQPQWebServerConfigSetting>(qpqConfig, QPQWebServerConfigSettingType.WebSocket) || [];\n\n return websocketSettings;\n};\n\nexport const getOwnedWebsocketSettings = (qpqConfig: QPQConfig): WebSocketQPQWebServerConfigSetting[] => {\n const websocketSettings = getWebsocketSettings(qpqConfig);\n\n return qpqCoreUtils.getOwnedItems(websocketSettings, qpqConfig);\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-webserver",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -35,10 +35,10 @@
35
35
  },
36
36
  "homepage": "https://github.com/qpqjs/quidproquo#readme",
37
37
  "dependencies": {
38
- "quidproquo-core": "0.1.17"
38
+ "quidproquo-core": "0.1.18"
39
39
  },
40
40
  "devDependencies": {
41
- "quidproquo-tsconfig": "0.1.17",
41
+ "quidproquo-tsconfig": "0.1.18",
42
42
  "typescript": "^5.8.2"
43
43
  }
44
44
  }