@webpieces/http-server 0.3.262 → 0.3.271

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 (36) hide show
  1. package/package.json +8 -4
  2. package/src/WebpiecesMiddleware.d.ts +1 -1
  3. package/src/WebpiecesMiddleware.js +34 -34
  4. package/src/WebpiecesMiddleware.js.map +1 -1
  5. package/src/WebpiecesRouteCreator.js +2 -2
  6. package/src/WebpiecesRouteCreator.js.map +1 -1
  7. package/src/WebpiecesServerImpl.js +3 -4
  8. package/src/WebpiecesServerImpl.js.map +1 -1
  9. package/src/filters/ContextFilter.d.ts +1 -1
  10. package/src/filters/ContextFilter.js +5 -5
  11. package/src/filters/ContextFilter.js.map +1 -1
  12. package/src/filters/LogApiFilter.d.ts +1 -1
  13. package/src/filters/LogApiFilter.js +8 -8
  14. package/src/filters/LogApiFilter.js.map +1 -1
  15. package/src/filters/RecordingFilter.d.ts +1 -1
  16. package/src/filters/RecordingFilter.js +10 -10
  17. package/src/filters/RecordingFilter.js.map +1 -1
  18. package/src/filters/ServiceAuthFilter.d.ts +19 -0
  19. package/src/filters/ServiceAuthFilter.js +83 -0
  20. package/src/filters/ServiceAuthFilter.js.map +1 -0
  21. package/src/headers/WebpiecesCoreHeaders.d.ts +2 -2
  22. package/src/headers/WebpiecesCoreHeaders.js +3 -3
  23. package/src/headers/WebpiecesCoreHeaders.js.map +1 -1
  24. package/src/index.d.ts +2 -1
  25. package/src/index.js +6 -4
  26. package/src/index.js.map +1 -1
  27. package/src/modules/WebpiecesModule.js +9 -9
  28. package/src/modules/WebpiecesModule.js.map +1 -1
  29. package/src/recorder/SpecGenerator.d.ts +1 -1
  30. package/src/recorder/SpecGenerator.js +1 -1
  31. package/src/recorder/SpecGenerator.js.map +1 -1
  32. package/src/recorder/TestCaseRecorderImpl.d.ts +1 -1
  33. package/src/recorder/TestCaseRecorderImpl.js +7 -7
  34. package/src/recorder/TestCaseRecorderImpl.js.map +1 -1
  35. package/src/recorder/recordable.js +5 -5
  36. package/src/recorder/recordable.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"recordable.js","sourceRoot":"","sources":["../../../../../../packages/http/http-server/src/recorder/recordable.ts"],"names":[],"mappings":";;AAwBA,gCAgCC;AAxDD,kDAM6B;AAC7B,0DAAyD;AAEzD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,UAAU,CAAmB,OAAe,EAAE,IAAO;IACjE,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE;QACnB,mFAAmF;QACnF,GAAG,CAAC,MAAS,EAAE,IAAqB,EAAE,QAAiB;YACnD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YACrD,IAAI,OAAO,QAAQ,KAAK,UAAU,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7D,OAAO,QAAQ,CAAC;YACpB,CAAC;YAED,2FAA2F;YAC3F,OAAO,KAAK,EAAE,GAAG,IAAe,EAAoB,EAAE;gBAClD,MAAM,QAAQ,GAAG,6BAAc,CAAC,SAAS,CAAC,uBAAY,CAAC,QAAQ,CAAiC,CAAC;gBACjG,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACZ,OAAO,MAAM,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBAC9C,CAAC;gBAED,MAAM,QAAQ,GAAG,IAAI,2BAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC3D,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;gBAEnC,4HAA4H;gBAC5H,IAAI,CAAC;oBACD,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;oBACpD,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC;oBACpC,OAAO,QAAQ,CAAC;gBACpB,CAAC;gBAAC,OAAO,GAAY,EAAE,CAAC;oBACpB,MAAM,KAAK,GAAG,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;oBAC3B,QAAQ,CAAC,eAAe,GAAG,IAAI,wBAAa,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;oBACxE,MAAM,GAAG,CAAC;gBACd,CAAC;YACL,CAAC,CAAC;QACN,CAAC;KACJ,CAAC,CAAC;AACP,CAAC","sourcesContent":["import {\n RecordedEndpoint,\n RecordedError,\n RecorderKeys,\n TestCaseRecorder,\n toError,\n} from '@webpieces/http-api';\nimport { RequestContext } from '@webpieces/core-context';\n\n/**\n * recordable - Wrap an IN-PROCESS api implementation (simulator, local impl)\n * so its calls are captured by an active TestCaseRecorder, exactly like\n * outbound HTTP client calls are. Port of Java ApiRecorder/ApiRecorderCreator.\n *\n * When no recorder is in the request context (the normal case) calls pass\n * straight through with no overhead beyond one context read.\n *\n * Use at DI-binding time:\n * ```typescript\n * bind<RemoteApi>(TYPES.RemoteApi)\n * .toDynamicValue(() => recordable('RemoteApi', new RemoteServiceSimulator()))\n * .inSingletonScope();\n * ```\n */\nexport function recordable<T extends object>(apiName: string, impl: T): T {\n return new Proxy(impl, {\n // webpieces-disable no-any-unknown -- Proxy get trap returns heterogeneous members\n get(target: T, prop: string | symbol, receiver: unknown): unknown {\n const original = Reflect.get(target, prop, receiver);\n if (typeof original !== 'function' || typeof prop !== 'string') {\n return original;\n }\n\n // webpieces-disable no-any-unknown -- api method args/returns are type-erased in the proxy\n return async (...args: unknown[]): Promise<unknown> => {\n const recorder = RequestContext.getHeader(RecorderKeys.RECORDER) as TestCaseRecorder | undefined;\n if (!recorder) {\n return await original.apply(target, args);\n }\n\n const recorded = new RecordedEndpoint(apiName, prop, args);\n recorder.addEndpointInfo(recorded);\n\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- capture failure into the recording, then rethrow unchanged\n try {\n const response = await original.apply(target, args);\n recorded.successResponse = response;\n return response;\n } catch (err: unknown) {\n const error = toError(err);\n recorded.failureResponse = new RecordedError(error.name, error.message);\n throw err;\n }\n };\n },\n });\n}\n"]}
1
+ {"version":3,"file":"recordable.js","sourceRoot":"","sources":["../../../../../../packages/http/http-server/src/recorder/recordable.ts"],"names":[],"mappings":";;AAwBA,gCAgCC;AAxDD,oDAM8B;AAC9B,0DAAyD;AAEzD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,UAAU,CAAmB,OAAe,EAAE,IAAO;IACjE,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE;QACnB,mFAAmF;QACnF,GAAG,CAAC,MAAS,EAAE,IAAqB,EAAE,QAAiB;YACnD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YACrD,IAAI,OAAO,QAAQ,KAAK,UAAU,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7D,OAAO,QAAQ,CAAC;YACpB,CAAC;YAED,2FAA2F;YAC3F,OAAO,KAAK,EAAE,GAAG,IAAe,EAAoB,EAAE;gBAClD,MAAM,QAAQ,GAAG,6BAAc,CAAC,SAAS,CAAC,wBAAY,CAAC,QAAQ,CAAiC,CAAC;gBACjG,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACZ,OAAO,MAAM,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBAC9C,CAAC;gBAED,MAAM,QAAQ,GAAG,IAAI,4BAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC3D,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;gBAEnC,4HAA4H;gBAC5H,IAAI,CAAC;oBACD,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;oBACpD,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC;oBACpC,OAAO,QAAQ,CAAC;gBACpB,CAAC;gBAAC,OAAO,GAAY,EAAE,CAAC;oBACpB,MAAM,KAAK,GAAG,IAAA,mBAAO,EAAC,GAAG,CAAC,CAAC;oBAC3B,QAAQ,CAAC,eAAe,GAAG,IAAI,yBAAa,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;oBACxE,MAAM,GAAG,CAAC;gBACd,CAAC;YACL,CAAC,CAAC;QACN,CAAC;KACJ,CAAC,CAAC;AACP,CAAC","sourcesContent":["import {\n RecordedEndpoint,\n RecordedError,\n RecorderKeys,\n TestCaseRecorder,\n toError,\n} from '@webpieces/core-util';\nimport { RequestContext } from '@webpieces/core-context';\n\n/**\n * recordable - Wrap an IN-PROCESS api implementation (simulator, local impl)\n * so its calls are captured by an active TestCaseRecorder, exactly like\n * outbound HTTP client calls are. Port of Java ApiRecorder/ApiRecorderCreator.\n *\n * When no recorder is in the request context (the normal case) calls pass\n * straight through with no overhead beyond one context read.\n *\n * Use at DI-binding time:\n * ```typescript\n * bind<RemoteApi>(TYPES.RemoteApi)\n * .toDynamicValue(() => recordable('RemoteApi', new RemoteServiceSimulator()))\n * .inSingletonScope();\n * ```\n */\nexport function recordable<T extends object>(apiName: string, impl: T): T {\n return new Proxy(impl, {\n // webpieces-disable no-any-unknown -- Proxy get trap returns heterogeneous members\n get(target: T, prop: string | symbol, receiver: unknown): unknown {\n const original = Reflect.get(target, prop, receiver);\n if (typeof original !== 'function' || typeof prop !== 'string') {\n return original;\n }\n\n // webpieces-disable no-any-unknown -- api method args/returns are type-erased in the proxy\n return async (...args: unknown[]): Promise<unknown> => {\n const recorder = RequestContext.getHeader(RecorderKeys.RECORDER) as TestCaseRecorder | undefined;\n if (!recorder) {\n return await original.apply(target, args);\n }\n\n const recorded = new RecordedEndpoint(apiName, prop, args);\n recorder.addEndpointInfo(recorded);\n\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- capture failure into the recording, then rethrow unchanged\n try {\n const response = await original.apply(target, args);\n recorded.successResponse = response;\n return response;\n } catch (err: unknown) {\n const error = toError(err);\n recorded.failureResponse = new RecordedError(error.name, error.message);\n throw err;\n }\n };\n },\n });\n}\n"]}