@alanszp/express-common-fn 10.0.0 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonErrorsHandler.d.ts +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/node_modules/@alanszp/audit/.gitignore +3 -0
- package/node_modules/@alanszp/audit/.npmignore +3 -0
- package/node_modules/@alanszp/audit/LICENSE +21 -0
- package/node_modules/@alanszp/audit/dist/audit.d.ts +9 -0
- package/node_modules/@alanszp/audit/dist/audit.js +25 -0
- package/node_modules/@alanszp/audit/dist/audit.js.map +1 -0
- package/node_modules/@alanszp/audit/dist/auditWithState.d.ts +10 -0
- package/node_modules/@alanszp/audit/dist/auditWithState.js +22 -0
- package/node_modules/@alanszp/audit/dist/auditWithState.js.map +1 -0
- package/node_modules/@alanszp/audit/dist/errors/AuditError.d.ts +3 -0
- package/node_modules/@alanszp/audit/dist/errors/AuditError.js +8 -0
- package/node_modules/@alanszp/audit/dist/errors/AuditError.js.map +1 -0
- package/node_modules/@alanszp/audit/dist/errors/MissingAuditFieldsError.d.ts +9 -0
- package/node_modules/@alanszp/audit/dist/errors/MissingAuditFieldsError.js +23 -0
- package/node_modules/@alanszp/audit/dist/errors/MissingAuditFieldsError.js.map +1 -0
- package/node_modules/@alanszp/audit/dist/errors/index.d.ts +2 -0
- package/node_modules/@alanszp/audit/dist/errors/index.js +19 -0
- package/node_modules/@alanszp/audit/dist/errors/index.js.map +1 -0
- package/node_modules/@alanszp/audit/dist/factory.d.ts +4 -0
- package/node_modules/@alanszp/audit/dist/factory.js +16 -0
- package/node_modules/@alanszp/audit/dist/factory.js.map +1 -0
- package/node_modules/@alanszp/audit/dist/index.d.ts +5 -0
- package/node_modules/@alanszp/audit/dist/index.js +22 -0
- package/node_modules/@alanszp/audit/dist/index.js.map +1 -0
- package/node_modules/@alanszp/audit/dist/interfaces.d.ts +19 -0
- package/node_modules/@alanszp/audit/dist/interfaces.js +18 -0
- package/node_modules/@alanszp/audit/dist/interfaces.js.map +1 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/README.md +15 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/assert.d.ts +996 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/async_hooks.d.ts +539 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/buffer.d.ts +2362 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/child_process.d.ts +1540 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/cluster.d.ts +432 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/console.d.ts +415 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/constants.d.ts +19 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/crypto.d.ts +4487 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/dgram.d.ts +596 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/diagnostics_channel.d.ts +545 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/dns/promises.d.ts +425 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/dns.d.ts +809 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/dom-events.d.ts +122 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/domain.d.ts +170 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/events.d.ts +879 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/fs/promises.d.ts +1239 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/fs.d.ts +4311 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/globals.d.ts +411 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/http.d.ts +1887 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/http2.d.ts +2382 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/https.d.ts +550 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/index.d.ts +88 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/inspector.d.ts +2747 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/module.d.ts +315 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/net.d.ts +949 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/os.d.ts +478 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/package.json +229 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/path.d.ts +191 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/perf_hooks.d.ts +645 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/process.d.ts +1561 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/querystring.d.ts +141 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/readline.d.ts +539 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/repl.d.ts +430 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/stream/web.d.ts +366 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/stream.d.ts +1701 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/test.d.ts +1465 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/timers.d.ts +240 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/tls.d.ts +1210 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/trace_events.d.ts +182 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/assert.d.ts +996 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/async_hooks.d.ts +539 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/buffer.d.ts +2362 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/child_process.d.ts +1540 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/cluster.d.ts +432 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/console.d.ts +415 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/crypto.d.ts +4487 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/dgram.d.ts +596 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +545 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/dns/promises.d.ts +425 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/dns.d.ts +809 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/dom-events.d.ts +122 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/events.d.ts +879 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/fs/promises.d.ts +1239 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/fs.d.ts +4311 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/globals.d.ts +411 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/http.d.ts +1887 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/http2.d.ts +2382 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/https.d.ts +550 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/inspector.d.ts +2747 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/module.d.ts +315 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/net.d.ts +949 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/os.d.ts +478 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/perf_hooks.d.ts +645 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/process.d.ts +1561 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/querystring.d.ts +141 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/readline/promises.d.ts +150 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/readline.d.ts +539 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/repl.d.ts +430 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/stream/promises.d.ts +83 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/stream/web.d.ts +366 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/stream.d.ts +1701 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/test.d.ts +1465 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/timers.d.ts +240 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/tls.d.ts +1210 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/url.d.ts +927 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/util.d.ts +2183 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/v8.d.ts +764 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/vm.d.ts +903 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/wasi.d.ts +179 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/worker_threads.d.ts +691 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/tty.d.ts +208 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/url.d.ts +927 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/util.d.ts +2183 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/v8.d.ts +764 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/vm.d.ts +903 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/wasi.d.ts +179 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/worker_threads.d.ts +691 -0
- package/node_modules/@alanszp/audit/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/@alanszp/audit/package.json +30 -0
- package/node_modules/@alanszp/audit/src/audit.ts +31 -0
- package/node_modules/@alanszp/audit/src/auditWithState.ts +27 -0
- package/node_modules/@alanszp/audit/src/errors/AuditError.ts +3 -0
- package/node_modules/@alanszp/audit/src/errors/MissingAuditFieldsError.ts +28 -0
- package/node_modules/@alanszp/audit/src/errors/index.ts +2 -0
- package/node_modules/@alanszp/audit/src/factory.ts +16 -0
- package/node_modules/@alanszp/audit/src/index.ts +5 -0
- package/node_modules/@alanszp/audit/src/interfaces.ts +33 -0
- package/node_modules/@alanszp/audit/tsconfig.json +15 -0
- package/node_modules/@alanszp/errors/.gitignore +3 -0
- package/node_modules/@alanszp/errors/.npmignore +3 -0
- package/node_modules/@alanszp/errors/LICENSE +21 -0
- package/node_modules/@alanszp/errors/dist/errors/BaseError.d.ts +3 -0
- package/node_modules/@alanszp/errors/dist/errors/BaseError.js +18 -0
- package/node_modules/@alanszp/errors/dist/errors/BaseError.js.map +1 -0
- package/node_modules/@alanszp/errors/dist/errors/RenderableError.d.ts +6 -0
- package/node_modules/@alanszp/errors/dist/errors/RenderableError.js +3 -0
- package/node_modules/@alanszp/errors/dist/errors/RenderableError.js.map +1 -0
- package/node_modules/@alanszp/errors/dist/errors/http/BadRequestError.d.ts +8 -0
- package/node_modules/@alanszp/errors/dist/errors/http/BadRequestError.js +20 -0
- package/node_modules/@alanszp/errors/dist/errors/http/BadRequestError.js.map +1 -0
- package/node_modules/@alanszp/errors/dist/errors/http/HttpError.d.ts +8 -0
- package/node_modules/@alanszp/errors/dist/errors/http/HttpError.js +18 -0
- package/node_modules/@alanszp/errors/dist/errors/http/HttpError.js.map +1 -0
- package/node_modules/@alanszp/errors/dist/errors/http/InternalServerError.d.ts +8 -0
- package/node_modules/@alanszp/errors/dist/errors/http/InternalServerError.js +32 -0
- package/node_modules/@alanszp/errors/dist/errors/http/InternalServerError.js.map +1 -0
- package/node_modules/@alanszp/errors/dist/errors/http/NotFoundError.d.ts +4 -0
- package/node_modules/@alanszp/errors/dist/errors/http/NotFoundError.js +11 -0
- package/node_modules/@alanszp/errors/dist/errors/http/NotFoundError.js.map +1 -0
- package/node_modules/@alanszp/errors/dist/errors/http/UnauthorizedError.d.ts +8 -0
- package/node_modules/@alanszp/errors/dist/errors/http/UnauthorizedError.js +20 -0
- package/node_modules/@alanszp/errors/dist/errors/http/UnauthorizedError.js.map +1 -0
- package/node_modules/@alanszp/errors/dist/errors/http/index.d.ts +5 -0
- package/node_modules/@alanszp/errors/dist/errors/http/index.js +18 -0
- package/node_modules/@alanszp/errors/dist/errors/http/index.js.map +1 -0
- package/node_modules/@alanszp/errors/dist/index.d.ts +3 -0
- package/node_modules/@alanszp/errors/dist/index.js +16 -0
- package/node_modules/@alanszp/errors/dist/index.js.map +1 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/README.md +15 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/assert.d.ts +996 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/async_hooks.d.ts +539 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/buffer.d.ts +2362 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/child_process.d.ts +1540 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/cluster.d.ts +432 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/console.d.ts +415 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/constants.d.ts +19 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/crypto.d.ts +4487 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/dgram.d.ts +596 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/diagnostics_channel.d.ts +545 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/dns/promises.d.ts +425 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/dns.d.ts +809 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/dom-events.d.ts +122 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/domain.d.ts +170 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/events.d.ts +879 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/fs/promises.d.ts +1239 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/fs.d.ts +4311 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/globals.d.ts +411 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/http.d.ts +1887 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/http2.d.ts +2382 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/https.d.ts +550 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/index.d.ts +88 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/inspector.d.ts +2747 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/module.d.ts +315 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/net.d.ts +949 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/os.d.ts +478 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/package.json +229 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/path.d.ts +191 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/perf_hooks.d.ts +645 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/process.d.ts +1561 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/querystring.d.ts +141 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/readline.d.ts +539 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/repl.d.ts +430 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/stream/web.d.ts +366 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/stream.d.ts +1701 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/test.d.ts +1465 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/timers.d.ts +240 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/tls.d.ts +1210 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/trace_events.d.ts +182 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/assert.d.ts +996 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/async_hooks.d.ts +539 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/buffer.d.ts +2362 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/child_process.d.ts +1540 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/cluster.d.ts +432 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/console.d.ts +415 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/crypto.d.ts +4487 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/dgram.d.ts +596 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +545 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/dns/promises.d.ts +425 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/dns.d.ts +809 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/dom-events.d.ts +122 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/events.d.ts +879 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/fs/promises.d.ts +1239 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/fs.d.ts +4311 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/globals.d.ts +411 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/http.d.ts +1887 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/http2.d.ts +2382 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/https.d.ts +550 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/inspector.d.ts +2747 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/module.d.ts +315 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/net.d.ts +949 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/os.d.ts +478 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/perf_hooks.d.ts +645 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/process.d.ts +1561 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/querystring.d.ts +141 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/readline/promises.d.ts +150 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/readline.d.ts +539 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/repl.d.ts +430 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/stream/promises.d.ts +83 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/stream/web.d.ts +366 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/stream.d.ts +1701 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/test.d.ts +1465 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/timers.d.ts +240 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/tls.d.ts +1210 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/url.d.ts +927 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/util.d.ts +2183 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/v8.d.ts +764 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/vm.d.ts +903 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/wasi.d.ts +179 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/worker_threads.d.ts +691 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/tty.d.ts +208 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/url.d.ts +927 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/util.d.ts +2183 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/v8.d.ts +764 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/vm.d.ts +903 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/wasi.d.ts +179 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/worker_threads.d.ts +691 -0
- package/node_modules/@alanszp/errors/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/@alanszp/errors/package.json +27 -0
- package/node_modules/@alanszp/errors/src/errors/BaseError.ts +14 -0
- package/node_modules/@alanszp/errors/src/errors/RenderableError.ts +7 -0
- package/node_modules/@alanszp/errors/src/errors/http/BadRequestError.ts +21 -0
- package/node_modules/@alanszp/errors/src/errors/http/HttpError.ts +19 -0
- package/node_modules/@alanszp/errors/src/errors/http/InternalServerError.ts +34 -0
- package/node_modules/@alanszp/errors/src/errors/http/NotFoundError.ts +7 -0
- package/node_modules/@alanszp/errors/src/errors/http/UnauthorizedError.ts +21 -0
- package/node_modules/@alanszp/errors/src/errors/http/index.ts +5 -0
- package/node_modules/@alanszp/errors/src/index.ts +3 -0
- package/node_modules/@alanszp/errors/tsconfig.json +15 -0
- package/node_modules/@alanszp/express/.gitignore +3 -0
- package/node_modules/@alanszp/express/.npmignore +3 -0
- package/node_modules/@alanszp/express/LICENSE +21 -0
- package/node_modules/@alanszp/express/babel.config.js +7 -0
- package/node_modules/@alanszp/express/dist/helpers/appIdentifier.d.ts +1 -0
- package/node_modules/@alanszp/express/dist/helpers/appIdentifier.js +10 -0
- package/node_modules/@alanszp/express/dist/helpers/appIdentifier.js.map +1 -0
- package/node_modules/@alanszp/express/dist/helpers/getIp.d.ts +2 -0
- package/node_modules/@alanszp/express/dist/helpers/getIp.js +9 -0
- package/node_modules/@alanszp/express/dist/helpers/getIp.js.map +1 -0
- package/node_modules/@alanszp/express/dist/helpers/getRequestLogger.d.ts +2 -0
- package/node_modules/@alanszp/express/dist/helpers/getRequestLogger.js +10 -0
- package/node_modules/@alanszp/express/dist/helpers/getRequestLogger.js.map +1 -0
- package/node_modules/@alanszp/express/dist/helpers/now.d.ts +1 -0
- package/node_modules/@alanszp/express/dist/helpers/now.js +8 -0
- package/node_modules/@alanszp/express/dist/helpers/now.js.map +1 -0
- package/node_modules/@alanszp/express/dist/index.d.ts +11 -0
- package/node_modules/@alanszp/express/dist/index.js +24 -0
- package/node_modules/@alanszp/express/dist/index.js.map +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/accessLogger.d.ts +3 -0
- package/node_modules/@alanszp/express/dist/middlewares/accessLogger.js +30 -0
- package/node_modules/@alanszp/express/dist/middlewares/accessLogger.js.map +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/auditLog.d.ts +8 -0
- package/node_modules/@alanszp/express/dist/middlewares/auditLog.js +43 -0
- package/node_modules/@alanszp/express/dist/middlewares/auditLog.js.map +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/authedForOrg.d.ts +3 -0
- package/node_modules/@alanszp/express/dist/middlewares/authedForOrg.js +46 -0
- package/node_modules/@alanszp/express/dist/middlewares/authedForOrg.js.map +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/authenticateUser.d.ts +25 -0
- package/node_modules/@alanszp/express/dist/middlewares/authenticateUser.js +115 -0
- package/node_modules/@alanszp/express/dist/middlewares/authenticateUser.js.map +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/authenticateUser.test.d.ts +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/authenticateUser.test.js +308 -0
- package/node_modules/@alanszp/express/dist/middlewares/authenticateUser.test.js.map +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/createContext.d.ts +6 -0
- package/node_modules/@alanszp/express/dist/middlewares/createContext.js +36 -0
- package/node_modules/@alanszp/express/dist/middlewares/createContext.js.map +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/createContext.test.d.ts +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/createContext.test.js +50 -0
- package/node_modules/@alanszp/express/dist/middlewares/createContext.test.js.map +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/hasRoles.d.ts +3 -0
- package/node_modules/@alanszp/express/dist/middlewares/hasRoles.js +23 -0
- package/node_modules/@alanszp/express/dist/middlewares/hasRoles.js.map +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/jsonBodyParser.d.ts +4 -0
- package/node_modules/@alanszp/express/dist/middlewares/jsonBodyParser.js +23 -0
- package/node_modules/@alanszp/express/dist/middlewares/jsonBodyParser.js.map +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/returnInternalServerError.d.ts +4 -0
- package/node_modules/@alanszp/express/dist/middlewares/returnInternalServerError.js +11 -0
- package/node_modules/@alanszp/express/dist/middlewares/returnInternalServerError.js.map +1 -0
- package/node_modules/@alanszp/express/dist/middlewares/returnNotFound.d.ts +3 -0
- package/node_modules/@alanszp/express/dist/middlewares/returnNotFound.js +10 -0
- package/node_modules/@alanszp/express/dist/middlewares/returnNotFound.js.map +1 -0
- package/node_modules/@alanszp/express/dist/test/mocks/authOptionsMocks.d.ts +8 -0
- package/node_modules/@alanszp/express/dist/test/mocks/authOptionsMocks.js +30 -0
- package/node_modules/@alanszp/express/dist/test/mocks/authOptionsMocks.js.map +1 -0
- package/node_modules/@alanszp/express/dist/test/mocks/expressMocks.d.ts +6 -0
- package/node_modules/@alanszp/express/dist/test/mocks/expressMocks.js +26 -0
- package/node_modules/@alanszp/express/dist/test/mocks/expressMocks.js.map +1 -0
- package/node_modules/@alanszp/express/dist/test/mocks/jwtUserMocks.d.ts +3 -0
- package/node_modules/@alanszp/express/dist/test/mocks/jwtUserMocks.js +20 -0
- package/node_modules/@alanszp/express/dist/test/mocks/jwtUserMocks.js.map +1 -0
- package/node_modules/@alanszp/express/dist/test/setup.d.ts +1 -0
- package/node_modules/@alanszp/express/dist/test/setup.js +5 -0
- package/node_modules/@alanszp/express/dist/test/setup.js.map +1 -0
- package/node_modules/@alanszp/express/dist/test/setup.test.d.ts +1 -0
- package/node_modules/@alanszp/express/dist/test/setup.test.js +14 -0
- package/node_modules/@alanszp/express/dist/test/setup.test.js.map +1 -0
- package/node_modules/@alanszp/express/dist/types/AuthMethod.d.ts +10 -0
- package/node_modules/@alanszp/express/dist/types/AuthMethod.js +3 -0
- package/node_modules/@alanszp/express/dist/types/AuthMethod.js.map +1 -0
- package/node_modules/@alanszp/express/dist/types/GenericRequest.d.ts +2 -0
- package/node_modules/@alanszp/express/dist/types/GenericRequest.js +3 -0
- package/node_modules/@alanszp/express/dist/types/GenericRequest.js.map +1 -0
- package/node_modules/@alanszp/express/dist/views/errorView.d.ts +2 -0
- package/node_modules/@alanszp/express/dist/views/errorView.js +14 -0
- package/node_modules/@alanszp/express/dist/views/errorView.js.map +1 -0
- package/node_modules/@alanszp/express/jest.config.js +10 -0
- package/node_modules/@alanszp/express/node_modules/@jest/expect-utils/LICENSE +21 -0
- package/node_modules/@alanszp/express/node_modules/@jest/expect-utils/README.md +5 -0
- package/node_modules/@alanszp/express/node_modules/@jest/expect-utils/build/index.d.ts +93 -0
- package/node_modules/@alanszp/express/node_modules/@jest/expect-utils/build/index.js +37 -0
- package/node_modules/@alanszp/express/node_modules/@jest/expect-utils/build/jasmineUtils.js +282 -0
- package/node_modules/@alanszp/express/node_modules/@jest/expect-utils/build/types.js +1 -0
- package/node_modules/@alanszp/express/node_modules/@jest/expect-utils/build/utils.js +457 -0
- package/node_modules/@alanszp/express/node_modules/@jest/expect-utils/package.json +33 -0
- package/node_modules/@alanszp/express/node_modules/@jest/types/LICENSE +21 -0
- package/node_modules/@alanszp/express/node_modules/@jest/types/README.md +30 -0
- package/node_modules/@alanszp/express/node_modules/@jest/types/build/Circus.js +1 -0
- package/node_modules/@alanszp/express/node_modules/@jest/types/build/Config.js +1 -0
- package/node_modules/@alanszp/express/node_modules/@jest/types/build/Global.js +1 -0
- package/node_modules/@alanszp/express/node_modules/@jest/types/build/TestResult.js +1 -0
- package/node_modules/@alanszp/express/node_modules/@jest/types/build/Transform.js +1 -0
- package/node_modules/@alanszp/express/node_modules/@jest/types/build/index.d.ts +1166 -0
- package/node_modules/@alanszp/express/node_modules/@jest/types/build/index.js +1 -0
- package/node_modules/@alanszp/express/node_modules/@jest/types/package.json +38 -0
- package/node_modules/@alanszp/express/node_modules/@types/jest/LICENSE +21 -0
- package/node_modules/@alanszp/express/node_modules/@types/jest/README.md +17 -0
- package/node_modules/@alanszp/express/node_modules/@types/jest/index.d.ts +1608 -0
- package/node_modules/@alanszp/express/node_modules/@types/jest/package.json +159 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/README.md +15 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/assert.d.ts +996 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/async_hooks.d.ts +539 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/buffer.d.ts +2362 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/child_process.d.ts +1540 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/cluster.d.ts +432 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/console.d.ts +415 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/constants.d.ts +19 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/crypto.d.ts +4487 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/dgram.d.ts +596 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/diagnostics_channel.d.ts +545 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/dns/promises.d.ts +425 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/dns.d.ts +809 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/dom-events.d.ts +122 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/domain.d.ts +170 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/events.d.ts +879 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/fs/promises.d.ts +1239 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/fs.d.ts +4311 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/globals.d.ts +411 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/http.d.ts +1887 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/http2.d.ts +2382 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/https.d.ts +550 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/index.d.ts +88 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/inspector.d.ts +2747 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/module.d.ts +315 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/net.d.ts +949 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/os.d.ts +478 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/package.json +229 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/path.d.ts +191 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/perf_hooks.d.ts +645 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/process.d.ts +1561 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/querystring.d.ts +141 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/readline.d.ts +539 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/repl.d.ts +430 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/stream/web.d.ts +366 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/stream.d.ts +1701 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/test.d.ts +1465 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/timers.d.ts +240 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/tls.d.ts +1210 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/trace_events.d.ts +182 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/assert.d.ts +996 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/async_hooks.d.ts +539 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/buffer.d.ts +2362 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/child_process.d.ts +1540 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/cluster.d.ts +432 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/console.d.ts +415 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/crypto.d.ts +4487 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/dgram.d.ts +596 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +545 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/dns/promises.d.ts +425 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/dns.d.ts +809 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/dom-events.d.ts +122 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/events.d.ts +879 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/fs/promises.d.ts +1239 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/fs.d.ts +4311 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/globals.d.ts +411 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/http.d.ts +1887 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/http2.d.ts +2382 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/https.d.ts +550 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/inspector.d.ts +2747 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/module.d.ts +315 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/net.d.ts +949 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/os.d.ts +478 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/perf_hooks.d.ts +645 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/process.d.ts +1561 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/querystring.d.ts +141 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/readline/promises.d.ts +150 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/readline.d.ts +539 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/repl.d.ts +430 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/stream/promises.d.ts +83 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/stream/web.d.ts +366 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/stream.d.ts +1701 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/test.d.ts +1465 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/timers.d.ts +240 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/tls.d.ts +1210 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/url.d.ts +927 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/util.d.ts +2183 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/v8.d.ts +764 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/vm.d.ts +903 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/wasi.d.ts +179 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/worker_threads.d.ts +691 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/tty.d.ts +208 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/url.d.ts +927 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/util.d.ts +2183 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/v8.d.ts +764 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/vm.d.ts +903 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/wasi.d.ts +179 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/worker_threads.d.ts +691 -0
- package/node_modules/@alanszp/express/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/@alanszp/express/package.json +49 -0
- package/node_modules/@alanszp/express/src/helpers/appIdentifier.ts +5 -0
- package/node_modules/@alanszp/express/src/helpers/getIp.ts +5 -0
- package/node_modules/@alanszp/express/src/helpers/getRequestLogger.ts +6 -0
- package/node_modules/@alanszp/express/src/helpers/now.ts +3 -0
- package/node_modules/@alanszp/express/src/index.ts +11 -0
- package/node_modules/@alanszp/express/src/middlewares/accessLogger.ts +34 -0
- package/node_modules/@alanszp/express/src/middlewares/auditLog.ts +49 -0
- package/node_modules/@alanszp/express/src/middlewares/authedForOrg.ts +51 -0
- package/node_modules/@alanszp/express/src/middlewares/authenticateUser.test.ts +403 -0
- package/node_modules/@alanszp/express/src/middlewares/authenticateUser.ts +171 -0
- package/node_modules/@alanszp/express/src/middlewares/createContext.test.ts +85 -0
- package/node_modules/@alanszp/express/src/middlewares/createContext.ts +46 -0
- package/node_modules/@alanszp/express/src/middlewares/hasRoles.ts +26 -0
- package/node_modules/@alanszp/express/src/middlewares/jsonBodyParser.ts +23 -0
- package/node_modules/@alanszp/express/src/middlewares/returnInternalServerError.ts +16 -0
- package/node_modules/@alanszp/express/src/middlewares/returnNotFound.ts +12 -0
- package/node_modules/@alanszp/express/src/test/mocks/authOptionsMocks.ts +35 -0
- package/node_modules/@alanszp/express/src/test/mocks/expressMocks.ts +33 -0
- package/node_modules/@alanszp/express/src/test/mocks/jwtUserMocks.ts +19 -0
- package/node_modules/@alanszp/express/src/test/setup.test.ts +15 -0
- package/node_modules/@alanszp/express/src/test/setup.ts +3 -0
- package/node_modules/@alanszp/express/src/types/AuthMethod.ts +27 -0
- package/node_modules/@alanszp/express/src/types/GenericRequest.ts +3 -0
- package/node_modules/@alanszp/express/src/types/custom.d.ts +20 -0
- package/node_modules/@alanszp/express/src/views/errorView.ts +11 -0
- package/node_modules/@alanszp/express/tsconfig.json +18 -0
- package/node_modules/@alanszp/jwt/.gitignore +3 -0
- package/node_modules/@alanszp/jwt/.npmignore +3 -0
- package/node_modules/@alanszp/jwt/LICENSE +21 -0
- package/node_modules/@alanszp/jwt/dist/index.d.ts +2 -0
- package/node_modules/@alanszp/jwt/dist/index.js +15 -0
- package/node_modules/@alanszp/jwt/dist/index.js.map +1 -0
- package/node_modules/@alanszp/jwt/dist/jwt.d.ts +12 -0
- package/node_modules/@alanszp/jwt/dist/jwt.js +89 -0
- package/node_modules/@alanszp/jwt/dist/jwt.js.map +1 -0
- package/node_modules/@alanszp/jwt/dist/types.d.ts +26 -0
- package/node_modules/@alanszp/jwt/dist/types.js +3 -0
- package/node_modules/@alanszp/jwt/dist/types.js.map +1 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/README.md +15 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/assert.d.ts +996 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/async_hooks.d.ts +539 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/buffer.d.ts +2362 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/child_process.d.ts +1540 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/cluster.d.ts +432 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/console.d.ts +415 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/constants.d.ts +19 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/crypto.d.ts +4487 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/dgram.d.ts +596 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/diagnostics_channel.d.ts +545 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/dns/promises.d.ts +425 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/dns.d.ts +809 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/dom-events.d.ts +122 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/domain.d.ts +170 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/events.d.ts +879 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/fs/promises.d.ts +1239 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/fs.d.ts +4311 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/globals.d.ts +411 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/http.d.ts +1887 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/http2.d.ts +2382 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/https.d.ts +550 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/index.d.ts +88 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/inspector.d.ts +2747 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/module.d.ts +315 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/net.d.ts +949 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/os.d.ts +478 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/package.json +229 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/path.d.ts +191 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/perf_hooks.d.ts +645 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/process.d.ts +1561 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/querystring.d.ts +141 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/readline.d.ts +539 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/repl.d.ts +430 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/stream/web.d.ts +366 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/stream.d.ts +1701 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/test.d.ts +1465 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/timers.d.ts +240 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/tls.d.ts +1210 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/trace_events.d.ts +182 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/assert.d.ts +996 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/async_hooks.d.ts +539 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/buffer.d.ts +2362 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/child_process.d.ts +1540 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/cluster.d.ts +432 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/console.d.ts +415 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/crypto.d.ts +4487 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/dgram.d.ts +596 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +545 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/dns/promises.d.ts +425 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/dns.d.ts +809 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/dom-events.d.ts +122 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/events.d.ts +879 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/fs/promises.d.ts +1239 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/fs.d.ts +4311 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/globals.d.ts +411 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/http.d.ts +1887 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/http2.d.ts +2382 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/https.d.ts +550 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/inspector.d.ts +2747 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/module.d.ts +315 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/net.d.ts +949 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/os.d.ts +478 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/perf_hooks.d.ts +645 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/process.d.ts +1561 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/querystring.d.ts +141 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/readline/promises.d.ts +150 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/readline.d.ts +539 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/repl.d.ts +430 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/stream/promises.d.ts +83 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/stream/web.d.ts +366 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/stream.d.ts +1701 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/test.d.ts +1465 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/timers.d.ts +240 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/tls.d.ts +1210 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/url.d.ts +927 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/util.d.ts +2183 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/v8.d.ts +764 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/vm.d.ts +903 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/wasi.d.ts +179 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/worker_threads.d.ts +691 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/tty.d.ts +208 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/url.d.ts +927 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/util.d.ts +2183 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/v8.d.ts +764 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/vm.d.ts +903 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/wasi.d.ts +179 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/worker_threads.d.ts +691 -0
- package/node_modules/@alanszp/jwt/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/@alanszp/jwt/package.json +30 -0
- package/node_modules/@alanszp/jwt/src/index.ts +2 -0
- package/node_modules/@alanszp/jwt/src/jwt.ts +106 -0
- package/node_modules/@alanszp/jwt/src/types.ts +31 -0
- package/node_modules/@alanszp/jwt/tsconfig.json +15 -0
- package/node_modules/@alanszp/logger/.gitignore +3 -0
- package/node_modules/@alanszp/logger/.npmignore +3 -0
- package/node_modules/@alanszp/logger/LICENSE +21 -0
- package/node_modules/@alanszp/logger/dist/config.d.ts +28 -0
- package/node_modules/@alanszp/logger/dist/config.js +3 -0
- package/node_modules/@alanszp/logger/dist/config.js.map +1 -0
- package/node_modules/@alanszp/logger/dist/factory.d.ts +5 -0
- package/node_modules/@alanszp/logger/dist/factory.js +55 -0
- package/node_modules/@alanszp/logger/dist/factory.js.map +1 -0
- package/node_modules/@alanszp/logger/dist/index.d.ts +5 -0
- package/node_modules/@alanszp/logger/dist/index.js +20 -0
- package/node_modules/@alanszp/logger/dist/index.js.map +1 -0
- package/node_modules/@alanszp/logger/dist/interfaces.d.ts +23 -0
- package/node_modules/@alanszp/logger/dist/interfaces.js +18 -0
- package/node_modules/@alanszp/logger/dist/interfaces.js.map +1 -0
- package/node_modules/@alanszp/logger/dist/logger.d.ts +14 -0
- package/node_modules/@alanszp/logger/dist/logger.js +45 -0
- package/node_modules/@alanszp/logger/dist/logger.js.map +1 -0
- package/node_modules/@alanszp/logger/dist/mock.d.ts +11 -0
- package/node_modules/@alanszp/logger/dist/mock.js +32 -0
- package/node_modules/@alanszp/logger/dist/mock.js.map +1 -0
- package/node_modules/@alanszp/logger/dist/serializer.d.ts +5 -0
- package/node_modules/@alanszp/logger/dist/serializer.js +67 -0
- package/node_modules/@alanszp/logger/dist/serializer.js.map +1 -0
- package/node_modules/@alanszp/logger/dist/slackBunyan.d.ts +16 -0
- package/node_modules/@alanszp/logger/dist/slackBunyan.js +108 -0
- package/node_modules/@alanszp/logger/dist/slackBunyan.js.map +1 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/README.md +15 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/assert.d.ts +996 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/async_hooks.d.ts +539 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/buffer.d.ts +2362 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/child_process.d.ts +1540 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/cluster.d.ts +432 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/console.d.ts +415 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/constants.d.ts +19 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/crypto.d.ts +4487 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/dgram.d.ts +596 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/diagnostics_channel.d.ts +545 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/dns/promises.d.ts +425 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/dns.d.ts +809 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/dom-events.d.ts +122 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/domain.d.ts +170 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/events.d.ts +879 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/fs/promises.d.ts +1239 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/fs.d.ts +4311 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/globals.d.ts +411 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/http.d.ts +1887 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/http2.d.ts +2382 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/https.d.ts +550 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/index.d.ts +88 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/inspector.d.ts +2747 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/module.d.ts +315 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/net.d.ts +949 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/os.d.ts +478 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/package.json +229 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/path.d.ts +191 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/perf_hooks.d.ts +645 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/process.d.ts +1561 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/querystring.d.ts +141 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/readline.d.ts +539 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/repl.d.ts +430 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/stream/web.d.ts +366 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/stream.d.ts +1701 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/test.d.ts +1465 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/timers.d.ts +240 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/tls.d.ts +1210 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/trace_events.d.ts +182 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/assert.d.ts +996 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/async_hooks.d.ts +539 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/buffer.d.ts +2362 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/child_process.d.ts +1540 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/cluster.d.ts +432 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/console.d.ts +415 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/crypto.d.ts +4487 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/dgram.d.ts +596 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +545 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/dns/promises.d.ts +425 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/dns.d.ts +809 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/dom-events.d.ts +122 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/events.d.ts +879 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/fs/promises.d.ts +1239 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/fs.d.ts +4311 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/globals.d.ts +411 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/http.d.ts +1887 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/http2.d.ts +2382 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/https.d.ts +550 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/inspector.d.ts +2747 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/module.d.ts +315 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/net.d.ts +949 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/os.d.ts +478 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/perf_hooks.d.ts +645 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/process.d.ts +1561 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/querystring.d.ts +141 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/readline/promises.d.ts +150 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/readline.d.ts +539 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/repl.d.ts +430 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/stream/promises.d.ts +83 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/stream/web.d.ts +366 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/stream.d.ts +1701 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/test.d.ts +1465 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/timers.d.ts +240 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/tls.d.ts +1210 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/url.d.ts +927 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/util.d.ts +2183 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/v8.d.ts +764 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/vm.d.ts +903 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/wasi.d.ts +179 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/worker_threads.d.ts +691 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/tty.d.ts +208 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/url.d.ts +927 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/util.d.ts +2183 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/v8.d.ts +764 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/vm.d.ts +903 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/wasi.d.ts +179 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/worker_threads.d.ts +691 -0
- package/node_modules/@alanszp/logger/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/@alanszp/logger/package.json +36 -0
- package/node_modules/@alanszp/logger/src/config.ts +34 -0
- package/node_modules/@alanszp/logger/src/factory.ts +68 -0
- package/node_modules/@alanszp/logger/src/index.ts +5 -0
- package/node_modules/@alanszp/logger/src/interfaces.ts +26 -0
- package/node_modules/@alanszp/logger/src/logger.ts +54 -0
- package/node_modules/@alanszp/logger/src/mock.ts +35 -0
- package/node_modules/@alanszp/logger/src/serializer.ts +65 -0
- package/node_modules/@alanszp/logger/src/slackBunyan.ts +133 -0
- package/node_modules/@alanszp/logger/tsconfig.json +15 -0
- package/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/node/README.md +15 -0
- package/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@types/node/assert.d.ts +996 -0
- package/node_modules/@types/node/async_hooks.d.ts +539 -0
- package/node_modules/@types/node/buffer.d.ts +2362 -0
- package/node_modules/@types/node/child_process.d.ts +1540 -0
- package/node_modules/@types/node/cluster.d.ts +432 -0
- package/node_modules/@types/node/console.d.ts +415 -0
- package/node_modules/@types/node/constants.d.ts +19 -0
- package/node_modules/@types/node/crypto.d.ts +4487 -0
- package/node_modules/@types/node/dgram.d.ts +596 -0
- package/node_modules/@types/node/diagnostics_channel.d.ts +545 -0
- package/node_modules/@types/node/dns/promises.d.ts +425 -0
- package/node_modules/@types/node/dns.d.ts +809 -0
- package/node_modules/@types/node/dom-events.d.ts +122 -0
- package/node_modules/@types/node/domain.d.ts +170 -0
- package/node_modules/@types/node/events.d.ts +879 -0
- package/node_modules/@types/node/fs/promises.d.ts +1239 -0
- package/node_modules/@types/node/fs.d.ts +4311 -0
- package/node_modules/@types/node/globals.d.ts +411 -0
- package/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@types/node/http.d.ts +1887 -0
- package/node_modules/@types/node/http2.d.ts +2382 -0
- package/node_modules/@types/node/https.d.ts +550 -0
- package/node_modules/@types/node/index.d.ts +88 -0
- package/node_modules/@types/node/inspector.d.ts +2747 -0
- package/node_modules/@types/node/module.d.ts +315 -0
- package/node_modules/@types/node/net.d.ts +949 -0
- package/node_modules/@types/node/os.d.ts +478 -0
- package/node_modules/@types/node/package.json +229 -0
- package/node_modules/@types/node/path.d.ts +191 -0
- package/node_modules/@types/node/perf_hooks.d.ts +645 -0
- package/node_modules/@types/node/process.d.ts +1561 -0
- package/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@types/node/querystring.d.ts +141 -0
- package/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/node_modules/@types/node/readline.d.ts +539 -0
- package/node_modules/@types/node/repl.d.ts +430 -0
- package/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/node_modules/@types/node/stream/web.d.ts +366 -0
- package/node_modules/@types/node/stream.d.ts +1701 -0
- package/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@types/node/test.d.ts +1465 -0
- package/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/node_modules/@types/node/timers.d.ts +240 -0
- package/node_modules/@types/node/tls.d.ts +1210 -0
- package/node_modules/@types/node/trace_events.d.ts +182 -0
- package/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/node_modules/@types/node/ts4.8/assert.d.ts +996 -0
- package/node_modules/@types/node/ts4.8/async_hooks.d.ts +539 -0
- package/node_modules/@types/node/ts4.8/buffer.d.ts +2362 -0
- package/node_modules/@types/node/ts4.8/child_process.d.ts +1540 -0
- package/node_modules/@types/node/ts4.8/cluster.d.ts +432 -0
- package/node_modules/@types/node/ts4.8/console.d.ts +415 -0
- package/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
- package/node_modules/@types/node/ts4.8/crypto.d.ts +4487 -0
- package/node_modules/@types/node/ts4.8/dgram.d.ts +596 -0
- package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +545 -0
- package/node_modules/@types/node/ts4.8/dns/promises.d.ts +425 -0
- package/node_modules/@types/node/ts4.8/dns.d.ts +809 -0
- package/node_modules/@types/node/ts4.8/dom-events.d.ts +122 -0
- package/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/node_modules/@types/node/ts4.8/events.d.ts +879 -0
- package/node_modules/@types/node/ts4.8/fs/promises.d.ts +1239 -0
- package/node_modules/@types/node/ts4.8/fs.d.ts +4311 -0
- package/node_modules/@types/node/ts4.8/globals.d.ts +411 -0
- package/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/node_modules/@types/node/ts4.8/http.d.ts +1887 -0
- package/node_modules/@types/node/ts4.8/http2.d.ts +2382 -0
- package/node_modules/@types/node/ts4.8/https.d.ts +550 -0
- package/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/node_modules/@types/node/ts4.8/inspector.d.ts +2747 -0
- package/node_modules/@types/node/ts4.8/module.d.ts +315 -0
- package/node_modules/@types/node/ts4.8/net.d.ts +949 -0
- package/node_modules/@types/node/ts4.8/os.d.ts +478 -0
- package/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +645 -0
- package/node_modules/@types/node/ts4.8/process.d.ts +1561 -0
- package/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/node_modules/@types/node/ts4.8/querystring.d.ts +141 -0
- package/node_modules/@types/node/ts4.8/readline/promises.d.ts +150 -0
- package/node_modules/@types/node/ts4.8/readline.d.ts +539 -0
- package/node_modules/@types/node/ts4.8/repl.d.ts +430 -0
- package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/node_modules/@types/node/ts4.8/stream/promises.d.ts +83 -0
- package/node_modules/@types/node/ts4.8/stream/web.d.ts +366 -0
- package/node_modules/@types/node/ts4.8/stream.d.ts +1701 -0
- package/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/node_modules/@types/node/ts4.8/test.d.ts +1465 -0
- package/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/node_modules/@types/node/ts4.8/timers.d.ts +240 -0
- package/node_modules/@types/node/ts4.8/tls.d.ts +1210 -0
- package/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
- package/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
- package/node_modules/@types/node/ts4.8/url.d.ts +927 -0
- package/node_modules/@types/node/ts4.8/util.d.ts +2183 -0
- package/node_modules/@types/node/ts4.8/v8.d.ts +764 -0
- package/node_modules/@types/node/ts4.8/vm.d.ts +903 -0
- package/node_modules/@types/node/ts4.8/wasi.d.ts +179 -0
- package/node_modules/@types/node/ts4.8/worker_threads.d.ts +691 -0
- package/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/node_modules/@types/node/tty.d.ts +208 -0
- package/node_modules/@types/node/url.d.ts +927 -0
- package/node_modules/@types/node/util.d.ts +2183 -0
- package/node_modules/@types/node/v8.d.ts +764 -0
- package/node_modules/@types/node/vm.d.ts +903 -0
- package/node_modules/@types/node/wasi.d.ts +179 -0
- package/node_modules/@types/node/worker_threads.d.ts +691 -0
- package/node_modules/@types/node/zlib.d.ts +517 -0
- package/package.json +9 -7
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { NotFoundError, UnauthorizedError } from "@alanszp/errors";
|
|
2
|
+
import { errorView } from "../views/errorView";
|
|
3
|
+
import { NextFunction, Response } from "express";
|
|
4
|
+
import { getRequestLogger } from "../helpers/getRequestLogger";
|
|
5
|
+
import { GenericRequest } from "../types/GenericRequest";
|
|
6
|
+
|
|
7
|
+
function response401(res: Response): void {
|
|
8
|
+
res.status(401).json(errorView(new UnauthorizedError(["jwt"])));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function authForOrg(
|
|
12
|
+
req: GenericRequest,
|
|
13
|
+
res: Response,
|
|
14
|
+
next: NextFunction
|
|
15
|
+
): void {
|
|
16
|
+
const { orgReference } = req.params;
|
|
17
|
+
const logger = getRequestLogger(req).child({ org: orgReference });
|
|
18
|
+
try {
|
|
19
|
+
if (!orgReference) {
|
|
20
|
+
logger.error("middleware.authForOrg.error.noOrgReferenceInPath");
|
|
21
|
+
return response401(res);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!req.context?.jwtUser?.organizationReference) {
|
|
25
|
+
logger.info("middleware.authForOrg.error.noOrgInJwt", {
|
|
26
|
+
jwtUser: req.context?.jwtUser || null,
|
|
27
|
+
});
|
|
28
|
+
return response401(res);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const jwtOrg = req.context.jwtUser.organizationReference;
|
|
32
|
+
if (jwtOrg !== orgReference) {
|
|
33
|
+
if (jwtOrg === "lara") {
|
|
34
|
+
req.context.jwtUser.organizationReference = orgReference;
|
|
35
|
+
return next();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
logger.info("middleware.authForOrg.error.nonMatch", {
|
|
39
|
+
jwtOrg,
|
|
40
|
+
});
|
|
41
|
+
return response401(res);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return next();
|
|
45
|
+
} catch (error: unknown) {
|
|
46
|
+
logger.info("middleware.authForOrg.error.noOrganization", {
|
|
47
|
+
error,
|
|
48
|
+
});
|
|
49
|
+
res.status(404).json(errorView(new NotFoundError()));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { AuthMethods, createAuthContext } from "./authenticateUser";
|
|
2
|
+
import { verifyJWT } from "@alanszp/jwt";
|
|
3
|
+
import {
|
|
4
|
+
mockNext,
|
|
5
|
+
mockRequest,
|
|
6
|
+
mockResponse,
|
|
7
|
+
} from "../test/mocks/expressMocks";
|
|
8
|
+
import { laraJwtUserMock, userJwtUserMock } from "../test/mocks/jwtUserMocks";
|
|
9
|
+
import {
|
|
10
|
+
apiKeyAuthOptions,
|
|
11
|
+
bothMethodsAuthOptions,
|
|
12
|
+
jwtAuthOptions,
|
|
13
|
+
verifyOptions,
|
|
14
|
+
} from "../test/mocks/authOptionsMocks";
|
|
15
|
+
|
|
16
|
+
jest.mock("@alanszp/jwt");
|
|
17
|
+
|
|
18
|
+
describe("AuthenticateUser", () => {
|
|
19
|
+
describe("authentication with only JWT", () => {
|
|
20
|
+
describe("when jwt verifies correctly", () => {
|
|
21
|
+
it("should authenticate correctly and call next", async () => {
|
|
22
|
+
(verifyJWT as jest.Mock).mockResolvedValueOnce(userJwtUserMock);
|
|
23
|
+
|
|
24
|
+
const req = mockRequest("Bearer token");
|
|
25
|
+
const res = mockResponse();
|
|
26
|
+
const next = mockNext();
|
|
27
|
+
|
|
28
|
+
await createAuthContext(jwtAuthOptions)([AuthMethods.JWT])(
|
|
29
|
+
req,
|
|
30
|
+
res,
|
|
31
|
+
next
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
expect(verifyJWT).toBeCalledWith("publicKey", "token", verifyOptions);
|
|
35
|
+
expect(res.status).toHaveBeenCalledTimes(0);
|
|
36
|
+
expect(res.json).toHaveBeenCalledTimes(0);
|
|
37
|
+
expect(req.context.jwtUser).toMatchObject(userJwtUserMock);
|
|
38
|
+
expect(req.context.authenticated).toStrictEqual(["jwt"]);
|
|
39
|
+
expect(next).toBeCalledWith();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe("when jwt verifies incorrectly", () => {
|
|
44
|
+
it("should not authenticate, should not call next, and it should return 401", async () => {
|
|
45
|
+
(verifyJWT as jest.Mock).mockResolvedValueOnce(undefined);
|
|
46
|
+
|
|
47
|
+
const req = mockRequest("Bearer token");
|
|
48
|
+
const res = mockResponse();
|
|
49
|
+
const next = mockNext();
|
|
50
|
+
|
|
51
|
+
await createAuthContext(jwtAuthOptions)([AuthMethods.JWT])(
|
|
52
|
+
req,
|
|
53
|
+
res,
|
|
54
|
+
next
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
expect(verifyJWT).toBeCalledWith("publicKey", "token", verifyOptions);
|
|
58
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
59
|
+
expect(res.json).toHaveBeenCalledTimes(1);
|
|
60
|
+
expect(req.context.jwtUser).toBe(undefined);
|
|
61
|
+
expect(req.context.authenticated).toEqual([]);
|
|
62
|
+
expect(next).toHaveBeenCalledTimes(0);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe("when jwt doesn't exist", () => {
|
|
67
|
+
it("should not verify JWT, should not authenticate, should not call next, and it should return 401", async () => {
|
|
68
|
+
const req = mockRequest("aa");
|
|
69
|
+
const res = mockResponse();
|
|
70
|
+
const next = mockNext();
|
|
71
|
+
|
|
72
|
+
await createAuthContext(jwtAuthOptions)([AuthMethods.JWT])(
|
|
73
|
+
req,
|
|
74
|
+
res,
|
|
75
|
+
next
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
expect(verifyJWT).toHaveBeenCalledTimes(0);
|
|
79
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
80
|
+
expect(res.json).toHaveBeenCalledTimes(1);
|
|
81
|
+
expect(req.context.jwtUser).toBe(undefined);
|
|
82
|
+
expect(req.context.authenticated).toEqual([]);
|
|
83
|
+
expect(next).toHaveBeenCalledTimes(0);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe("authentication with only API KEY", () => {
|
|
89
|
+
describe("when api key verifies correctly", () => {
|
|
90
|
+
it("should authenticate correctly and call next", async () => {
|
|
91
|
+
const req = mockRequest("token");
|
|
92
|
+
const res = mockResponse();
|
|
93
|
+
const next = mockNext();
|
|
94
|
+
|
|
95
|
+
await createAuthContext(apiKeyAuthOptions)([AuthMethods.API_KEY])(
|
|
96
|
+
req,
|
|
97
|
+
res,
|
|
98
|
+
next
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
expect(verifyJWT).toHaveBeenCalledTimes(0);
|
|
102
|
+
expect(res.status).toHaveBeenCalledTimes(0);
|
|
103
|
+
expect(res.json).toHaveBeenCalledTimes(0);
|
|
104
|
+
expect(req.context.jwtUser).toMatchObject(laraJwtUserMock);
|
|
105
|
+
expect(req.context.authenticated).toStrictEqual(["api_key"]);
|
|
106
|
+
expect(next).toBeCalledWith();
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe("when api key verifies incorrectly", () => {
|
|
111
|
+
it("should not authenticate, should not call next, and it should return 401", async () => {
|
|
112
|
+
const req = mockRequest("invalidToken");
|
|
113
|
+
const res = mockResponse();
|
|
114
|
+
const next = mockNext();
|
|
115
|
+
|
|
116
|
+
await createAuthContext(apiKeyAuthOptions)([AuthMethods.API_KEY])(
|
|
117
|
+
req,
|
|
118
|
+
res,
|
|
119
|
+
next
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
expect(verifyJWT).toHaveBeenCalledTimes(0);
|
|
123
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
124
|
+
expect(res.json).toHaveBeenCalledTimes(1);
|
|
125
|
+
expect(req.context.jwtUser).toBe(undefined);
|
|
126
|
+
expect(req.context.authenticated).toEqual([]);
|
|
127
|
+
expect(next).toHaveBeenCalledTimes(0);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe("when api key doesn't exist", () => {
|
|
132
|
+
it("should not verify api key, should not authenticate, should not call next, and it should return 401", async () => {
|
|
133
|
+
const req = mockRequest(undefined as any);
|
|
134
|
+
const res = mockResponse();
|
|
135
|
+
const next = mockNext();
|
|
136
|
+
|
|
137
|
+
await createAuthContext(apiKeyAuthOptions)([AuthMethods.API_KEY])(
|
|
138
|
+
req,
|
|
139
|
+
res,
|
|
140
|
+
next
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
expect(verifyJWT).toHaveBeenCalledTimes(0);
|
|
144
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
145
|
+
expect(res.json).toHaveBeenCalledTimes(1);
|
|
146
|
+
expect(req.context.jwtUser).toBe(undefined);
|
|
147
|
+
expect(req.context.authenticated).toEqual([]);
|
|
148
|
+
expect(next).toHaveBeenCalledTimes(0);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
describe("authentication with JWT and API KEY", () => {
|
|
154
|
+
describe("using both methods", () => {
|
|
155
|
+
describe("when api key verifies correctly", () => {
|
|
156
|
+
it("should authenticate correctly and call next", async () => {
|
|
157
|
+
const req = mockRequest("token");
|
|
158
|
+
const res = mockResponse();
|
|
159
|
+
const next = mockNext();
|
|
160
|
+
|
|
161
|
+
await createAuthContext(bothMethodsAuthOptions)([
|
|
162
|
+
AuthMethods.API_KEY,
|
|
163
|
+
AuthMethods.JWT,
|
|
164
|
+
])(req, res, next);
|
|
165
|
+
|
|
166
|
+
expect(verifyJWT).toHaveBeenCalledTimes(0);
|
|
167
|
+
expect(res.status).toHaveBeenCalledTimes(0);
|
|
168
|
+
expect(res.json).toHaveBeenCalledTimes(0);
|
|
169
|
+
expect(req.context.jwtUser).toMatchObject(laraJwtUserMock);
|
|
170
|
+
expect(req.context.authenticated).toStrictEqual(["api_key"]);
|
|
171
|
+
expect(next).toHaveBeenCalledWith();
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
describe("when api key verifies incorrectly", () => {
|
|
176
|
+
it("should not authenticate, should not call next, and it should return 401", async () => {
|
|
177
|
+
const req = mockRequest("invalidToken");
|
|
178
|
+
const res = mockResponse();
|
|
179
|
+
const next = mockNext();
|
|
180
|
+
|
|
181
|
+
await createAuthContext(bothMethodsAuthOptions)([
|
|
182
|
+
AuthMethods.API_KEY,
|
|
183
|
+
AuthMethods.JWT,
|
|
184
|
+
])(req, res, next);
|
|
185
|
+
|
|
186
|
+
expect(verifyJWT).toHaveBeenCalledTimes(0);
|
|
187
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
188
|
+
expect(res.json).toHaveBeenCalledTimes(1);
|
|
189
|
+
expect(req.context.jwtUser).toBe(undefined);
|
|
190
|
+
expect(req.context.authenticated).toEqual([]);
|
|
191
|
+
expect(next).toHaveBeenCalledTimes(0);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
describe("when jwt verifies correctly", () => {
|
|
196
|
+
it("should authenticate correctly and call next", async () => {
|
|
197
|
+
(verifyJWT as jest.Mock).mockResolvedValueOnce(userJwtUserMock);
|
|
198
|
+
|
|
199
|
+
const req = mockRequest("Bearer token");
|
|
200
|
+
const res = mockResponse();
|
|
201
|
+
const next = mockNext();
|
|
202
|
+
|
|
203
|
+
await createAuthContext(bothMethodsAuthOptions)([
|
|
204
|
+
AuthMethods.API_KEY,
|
|
205
|
+
AuthMethods.JWT,
|
|
206
|
+
])(req, res, next);
|
|
207
|
+
|
|
208
|
+
expect(verifyJWT).toBeCalledWith("publicKey", "token", {
|
|
209
|
+
issuer: "issuer",
|
|
210
|
+
audience: "audience",
|
|
211
|
+
});
|
|
212
|
+
expect(res.status).toHaveBeenCalledTimes(0);
|
|
213
|
+
expect(res.json).toHaveBeenCalledTimes(0);
|
|
214
|
+
|
|
215
|
+
expect(req.context.jwtUser).toMatchObject(userJwtUserMock);
|
|
216
|
+
|
|
217
|
+
expect(req.context.authenticated).toStrictEqual(["jwt"]);
|
|
218
|
+
|
|
219
|
+
expect(next).toHaveBeenCalledWith();
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
describe("when jwt verifies incorrectly", () => {
|
|
224
|
+
it("should not authenticate, should not call next, and it should return 401", async () => {
|
|
225
|
+
(verifyJWT as jest.Mock).mockResolvedValueOnce(undefined);
|
|
226
|
+
|
|
227
|
+
const req = mockRequest("Bearer token");
|
|
228
|
+
const res = mockResponse();
|
|
229
|
+
const next = mockNext();
|
|
230
|
+
|
|
231
|
+
await createAuthContext(bothMethodsAuthOptions)([
|
|
232
|
+
AuthMethods.API_KEY,
|
|
233
|
+
AuthMethods.JWT,
|
|
234
|
+
])(req, res, next);
|
|
235
|
+
|
|
236
|
+
expect(verifyJWT).toBeCalledWith("publicKey", "token", {
|
|
237
|
+
issuer: "issuer",
|
|
238
|
+
audience: "audience",
|
|
239
|
+
});
|
|
240
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
241
|
+
expect(res.json).toHaveBeenCalledTimes(1);
|
|
242
|
+
expect(req.context.jwtUser).toBe(undefined);
|
|
243
|
+
expect(req.context.authenticated).toEqual([]);
|
|
244
|
+
expect(next).toHaveBeenCalledTimes(0);
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
describe("when jwt doesnt exist", () => {
|
|
249
|
+
it("should not authenticate, should not call next, and it should return 401", async () => {
|
|
250
|
+
const req = mockRequest(undefined as any);
|
|
251
|
+
const res = mockResponse();
|
|
252
|
+
const next = mockNext();
|
|
253
|
+
|
|
254
|
+
await createAuthContext(bothMethodsAuthOptions)([
|
|
255
|
+
AuthMethods.API_KEY,
|
|
256
|
+
AuthMethods.JWT,
|
|
257
|
+
])(req, res, next);
|
|
258
|
+
|
|
259
|
+
expect(verifyJWT).toHaveBeenCalledTimes(0);
|
|
260
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
261
|
+
expect(res.json).toHaveBeenCalledTimes(1);
|
|
262
|
+
expect(req.context.jwtUser).toBe(undefined);
|
|
263
|
+
expect(req.context.authenticated).toEqual([]);
|
|
264
|
+
expect(next).toHaveBeenCalledTimes(0);
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
describe("using jwt method", () => {
|
|
270
|
+
describe("when jwt verifies correctly", () => {
|
|
271
|
+
it("should authenticate correctly and call next", async () => {
|
|
272
|
+
(verifyJWT as jest.Mock).mockResolvedValueOnce(userJwtUserMock);
|
|
273
|
+
|
|
274
|
+
const req = mockRequest("Bearer token");
|
|
275
|
+
const res = mockResponse();
|
|
276
|
+
const next = mockNext();
|
|
277
|
+
|
|
278
|
+
await createAuthContext(bothMethodsAuthOptions)([AuthMethods.JWT])(
|
|
279
|
+
req,
|
|
280
|
+
res,
|
|
281
|
+
next
|
|
282
|
+
);
|
|
283
|
+
|
|
284
|
+
expect(verifyJWT).toBeCalledWith("publicKey", "token", {
|
|
285
|
+
issuer: "issuer",
|
|
286
|
+
audience: "audience",
|
|
287
|
+
});
|
|
288
|
+
expect(res.status).toHaveBeenCalledTimes(0);
|
|
289
|
+
expect(res.json).toHaveBeenCalledTimes(0);
|
|
290
|
+
expect(req.context.jwtUser).toMatchObject(userJwtUserMock);
|
|
291
|
+
expect(req.context.authenticated).toStrictEqual(["jwt"]);
|
|
292
|
+
expect(next).toHaveBeenCalledWith();
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
describe("when jwt verifies incorrectly", () => {
|
|
297
|
+
it("should not authenticate, should not call next, and it should return 401", async () => {
|
|
298
|
+
(verifyJWT as jest.Mock).mockResolvedValueOnce(undefined);
|
|
299
|
+
|
|
300
|
+
const req = mockRequest("Bearer invalidToken");
|
|
301
|
+
const res = mockResponse();
|
|
302
|
+
const next = mockNext();
|
|
303
|
+
|
|
304
|
+
await createAuthContext(bothMethodsAuthOptions)([AuthMethods.JWT])(
|
|
305
|
+
req,
|
|
306
|
+
res,
|
|
307
|
+
next
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
expect(verifyJWT).toBeCalledWith("publicKey", "invalidToken", {
|
|
311
|
+
issuer: "issuer",
|
|
312
|
+
audience: "audience",
|
|
313
|
+
});
|
|
314
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
315
|
+
expect(res.json).toHaveBeenCalledTimes(1);
|
|
316
|
+
expect(req.context.jwtUser).toBe(undefined);
|
|
317
|
+
expect(req.context.authenticated).toEqual([]);
|
|
318
|
+
expect(next).toHaveBeenCalledTimes(0);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
describe("when api key verifies correctly", () => {
|
|
323
|
+
it("should authenticate correctly and call next", async () => {
|
|
324
|
+
const req = mockRequest("token");
|
|
325
|
+
const res = mockResponse();
|
|
326
|
+
const next = mockNext();
|
|
327
|
+
|
|
328
|
+
await createAuthContext(bothMethodsAuthOptions)([
|
|
329
|
+
AuthMethods.API_KEY,
|
|
330
|
+
])(req, res, next);
|
|
331
|
+
|
|
332
|
+
expect(verifyJWT).toHaveBeenCalledTimes(0);
|
|
333
|
+
expect(res.status).toHaveBeenCalledTimes(0);
|
|
334
|
+
expect(res.json).toHaveBeenCalledTimes(0);
|
|
335
|
+
|
|
336
|
+
expect(req.context.jwtUser).toMatchObject(laraJwtUserMock);
|
|
337
|
+
expect(req.context.authenticated).toStrictEqual(["api_key"]);
|
|
338
|
+
expect(next).toHaveBeenCalledWith();
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
describe("when api key verifies incorrectly", () => {
|
|
343
|
+
it("should not authenticate, should not call next, and it should return 401", async () => {
|
|
344
|
+
const req = mockRequest("invalidToken");
|
|
345
|
+
const res = mockResponse();
|
|
346
|
+
const next = mockNext();
|
|
347
|
+
|
|
348
|
+
await createAuthContext(bothMethodsAuthOptions)([
|
|
349
|
+
AuthMethods.API_KEY,
|
|
350
|
+
AuthMethods.JWT,
|
|
351
|
+
])(req, res, next);
|
|
352
|
+
|
|
353
|
+
expect(verifyJWT).toHaveBeenCalledTimes(0);
|
|
354
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
355
|
+
expect(res.json).toHaveBeenCalledTimes(1);
|
|
356
|
+
expect(req.context.jwtUser).toBe(undefined);
|
|
357
|
+
expect(req.context.authenticated).toEqual([]);
|
|
358
|
+
expect(next).toHaveBeenCalledTimes(0);
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
describe("when jwt doesnt exist", () => {
|
|
363
|
+
it("should not authenticate, should not call next, and it should return 401", async () => {
|
|
364
|
+
const req = mockRequest("aaa");
|
|
365
|
+
const res = mockResponse();
|
|
366
|
+
const next = mockNext();
|
|
367
|
+
|
|
368
|
+
await createAuthContext(bothMethodsAuthOptions)([AuthMethods.JWT])(
|
|
369
|
+
req,
|
|
370
|
+
res,
|
|
371
|
+
next
|
|
372
|
+
);
|
|
373
|
+
|
|
374
|
+
expect(verifyJWT).toHaveBeenCalledTimes(0);
|
|
375
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
376
|
+
expect(res.json).toHaveBeenCalledTimes(1);
|
|
377
|
+
expect(req.context.jwtUser).toBe(undefined);
|
|
378
|
+
expect(req.context.authenticated).toEqual([]);
|
|
379
|
+
expect(next).toHaveBeenCalledTimes(0);
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
describe("when api key doesnt exist", () => {
|
|
384
|
+
it("should not authenticate, should not call next, and it should return 401", async () => {
|
|
385
|
+
const req = mockRequest(undefined as any);
|
|
386
|
+
const res = mockResponse();
|
|
387
|
+
const next = mockNext();
|
|
388
|
+
|
|
389
|
+
await createAuthContext(bothMethodsAuthOptions)([
|
|
390
|
+
AuthMethods.API_KEY,
|
|
391
|
+
])(req, res, next);
|
|
392
|
+
|
|
393
|
+
expect(verifyJWT).toHaveBeenCalledTimes(0);
|
|
394
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
395
|
+
expect(res.json).toHaveBeenCalledTimes(1);
|
|
396
|
+
expect(req.context.jwtUser).toBe(undefined);
|
|
397
|
+
expect(req.context.authenticated).toEqual([]);
|
|
398
|
+
expect(next).toHaveBeenCalledTimes(0);
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { JWTUser, verifyJWT, VerifyOptions } from "@alanszp/jwt";
|
|
2
|
+
import { UnauthorizedError } from "@alanszp/errors";
|
|
3
|
+
import { errorView } from "../views/errorView";
|
|
4
|
+
import { NextFunction, Response } from "express";
|
|
5
|
+
import { getRequestLogger } from "../helpers/getRequestLogger";
|
|
6
|
+
import { GenericRequest } from "../types/GenericRequest";
|
|
7
|
+
import { ILogger } from "@alanszp/logger";
|
|
8
|
+
import { compact, isEmpty, omit } from "lodash";
|
|
9
|
+
|
|
10
|
+
function parseAuthorizationHeader(
|
|
11
|
+
authorization: string | undefined
|
|
12
|
+
): string | undefined {
|
|
13
|
+
if (!authorization) return undefined;
|
|
14
|
+
const [bearer, jwt, ...other] = authorization.split(" ");
|
|
15
|
+
|
|
16
|
+
if (bearer !== "Bearer" || other.length > 0) return undefined;
|
|
17
|
+
|
|
18
|
+
return jwt;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export enum AuthMethods {
|
|
22
|
+
JWT = "JWT",
|
|
23
|
+
API_KEY = "API_KEY",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface JWTVerifyOptions extends Partial<VerifyOptions> {
|
|
27
|
+
publicKey: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface JWTOptions {
|
|
31
|
+
jwtVerifyOptions: JWTVerifyOptions;
|
|
32
|
+
types: [AuthMethods.JWT];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ApiKeyOptions {
|
|
36
|
+
validApiKeys: string[];
|
|
37
|
+
types: [AuthMethods.API_KEY];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface BothMethodsOptions {
|
|
41
|
+
jwtVerifyOptions: JWTVerifyOptions;
|
|
42
|
+
validApiKeys: string[];
|
|
43
|
+
types:
|
|
44
|
+
| [AuthMethods.JWT, AuthMethods.API_KEY]
|
|
45
|
+
| [AuthMethods.API_KEY, AuthMethods.JWT];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type AuthOptions = JWTOptions | ApiKeyOptions | BothMethodsOptions;
|
|
49
|
+
|
|
50
|
+
const middlewareGetterByAuthType: Record<
|
|
51
|
+
AuthMethods,
|
|
52
|
+
(
|
|
53
|
+
tokenOrJwt: string | null | undefined,
|
|
54
|
+
options: AuthOptions,
|
|
55
|
+
logger: ILogger
|
|
56
|
+
) => Promise<JWTUser | null | undefined>
|
|
57
|
+
> = {
|
|
58
|
+
[AuthMethods.JWT]: async (
|
|
59
|
+
jwt: string | null | undefined,
|
|
60
|
+
options: Exclude<AuthOptions, ApiKeyOptions>,
|
|
61
|
+
logger: ILogger
|
|
62
|
+
) => {
|
|
63
|
+
try {
|
|
64
|
+
if (!jwt) return undefined;
|
|
65
|
+
const jwtUser = await verifyJWT(
|
|
66
|
+
options.jwtVerifyOptions.publicKey,
|
|
67
|
+
jwt,
|
|
68
|
+
omit(options.jwtVerifyOptions, "publicKey")
|
|
69
|
+
);
|
|
70
|
+
logger.debug("auth.authWithJwt.authed", {
|
|
71
|
+
user: jwtUser.id,
|
|
72
|
+
org: jwtUser.organizationReference,
|
|
73
|
+
});
|
|
74
|
+
return jwtUser;
|
|
75
|
+
} catch (error: unknown) {
|
|
76
|
+
logger.info("auth.authWithJwt.invalidJwt", { jwt, error });
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
[AuthMethods.API_KEY]: async (
|
|
81
|
+
token: string | null | undefined,
|
|
82
|
+
options: Exclude<AuthOptions, JWTOptions>,
|
|
83
|
+
logger: ILogger
|
|
84
|
+
): Promise<JWTUser | null | undefined> => {
|
|
85
|
+
try {
|
|
86
|
+
if (!token) return undefined;
|
|
87
|
+
if (options.validApiKeys.includes(token)) {
|
|
88
|
+
logger.debug("auth.authWithApiKey.authed", {
|
|
89
|
+
user: "0",
|
|
90
|
+
org: "lara",
|
|
91
|
+
});
|
|
92
|
+
return Promise.resolve({
|
|
93
|
+
id: "0",
|
|
94
|
+
employeeReference: "0",
|
|
95
|
+
organizationReference: "lara",
|
|
96
|
+
roles: [],
|
|
97
|
+
segmentReference: null,
|
|
98
|
+
permissions: [],
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
} catch (error: unknown) {
|
|
104
|
+
logger.info("auth.authWithApiKey.invalidApiKey", { token, error });
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export function createAuthContext<Options extends AuthOptions>(
|
|
111
|
+
options: Options
|
|
112
|
+
) {
|
|
113
|
+
return function getMiddlewareForMethods(
|
|
114
|
+
authMethods: Options["types"][number][]
|
|
115
|
+
) {
|
|
116
|
+
return async function authWithGivenMethods(
|
|
117
|
+
req: GenericRequest,
|
|
118
|
+
res: Response,
|
|
119
|
+
next: NextFunction
|
|
120
|
+
): Promise<void> {
|
|
121
|
+
const logger = getRequestLogger(req);
|
|
122
|
+
const cookies = (req.cookies as Record<string, string | undefined>) || {};
|
|
123
|
+
const jwt =
|
|
124
|
+
cookies.jwt || parseAuthorizationHeader(req.headers.authorization);
|
|
125
|
+
|
|
126
|
+
try {
|
|
127
|
+
const authAttempts = await Promise.all(
|
|
128
|
+
authMethods.map((method) =>
|
|
129
|
+
middlewareGetterByAuthType[method](
|
|
130
|
+
method === AuthMethods.JWT ? jwt : req.headers.authorization,
|
|
131
|
+
options,
|
|
132
|
+
logger
|
|
133
|
+
)
|
|
134
|
+
)
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const successfulAuthAttempts = compact(authAttempts);
|
|
138
|
+
|
|
139
|
+
if (isEmpty(successfulAuthAttempts)) {
|
|
140
|
+
res
|
|
141
|
+
.status(401)
|
|
142
|
+
.json(
|
|
143
|
+
errorView(
|
|
144
|
+
new UnauthorizedError([
|
|
145
|
+
authAttempts.includes(null)
|
|
146
|
+
? `Token invalid for methods ${authMethods}`
|
|
147
|
+
: `Token not set for methods ${authMethods}`,
|
|
148
|
+
])
|
|
149
|
+
)
|
|
150
|
+
);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const jwtUser: JWTUser = successfulAuthAttempts[0];
|
|
155
|
+
req.context.jwtUser = jwtUser;
|
|
156
|
+
req.context.authenticated.push(
|
|
157
|
+
jwtUser.employeeReference !== "0" ? "jwt" : "api_key"
|
|
158
|
+
);
|
|
159
|
+
next();
|
|
160
|
+
} catch (error: unknown) {
|
|
161
|
+
logger.info("auth.authenticateUser.error", {
|
|
162
|
+
jwt,
|
|
163
|
+
token: req.headers.authorization,
|
|
164
|
+
methods: AuthMethods,
|
|
165
|
+
error,
|
|
166
|
+
});
|
|
167
|
+
res.status(401).json(errorView(new UnauthorizedError(authMethods)));
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createContext } from "./createContext";
|
|
2
|
+
import { SharedContext } from "@alanszp/shared-context";
|
|
3
|
+
import { createMockLogger } from "@alanszp/logger";
|
|
4
|
+
import { createAuditLogger } from "@alanszp/audit";
|
|
5
|
+
import {
|
|
6
|
+
mockNext,
|
|
7
|
+
mockRequest,
|
|
8
|
+
mockRequestWithBody,
|
|
9
|
+
mockResponse,
|
|
10
|
+
} from "../test/mocks/expressMocks";
|
|
11
|
+
import { appIdentifier } from "../helpers/appIdentifier";
|
|
12
|
+
jest.mock("@alanszp/shared-context");
|
|
13
|
+
|
|
14
|
+
const logger = createMockLogger({});
|
|
15
|
+
const sharedContext = new SharedContext();
|
|
16
|
+
const lifecycleId = "123";
|
|
17
|
+
const lifecycleChain = "node:test";
|
|
18
|
+
|
|
19
|
+
describe("CreateContext", () => {
|
|
20
|
+
describe("when has lifecycle headers", () => {
|
|
21
|
+
beforeAll(() => {
|
|
22
|
+
(SharedContext as jest.Mock).mockClear();
|
|
23
|
+
});
|
|
24
|
+
it("should get lifecycle identifiers from there", () => {
|
|
25
|
+
const middleware = createContext(
|
|
26
|
+
sharedContext,
|
|
27
|
+
logger,
|
|
28
|
+
createAuditLogger(logger)
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
middleware(
|
|
32
|
+
mockRequest("authToken", {
|
|
33
|
+
"x-lifecycle-chain": lifecycleChain,
|
|
34
|
+
"x-lifecycle-id": lifecycleId,
|
|
35
|
+
}),
|
|
36
|
+
mockResponse(),
|
|
37
|
+
mockNext()
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
expect(sharedContext.run).toHaveBeenCalledWith(
|
|
41
|
+
expect.anything(),
|
|
42
|
+
expect.objectContaining({
|
|
43
|
+
lifecycleId,
|
|
44
|
+
lifecycleChain: `${lifecycleChain},${appIdentifier()}`,
|
|
45
|
+
})
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe("when doesn't have lifecycle headers", () => {
|
|
51
|
+
beforeAll(() => {
|
|
52
|
+
(SharedContext as jest.Mock).mockClear();
|
|
53
|
+
});
|
|
54
|
+
it("should get lifecycle identifiers from body.detail", () => {
|
|
55
|
+
const middleware = createContext(
|
|
56
|
+
sharedContext,
|
|
57
|
+
logger,
|
|
58
|
+
createAuditLogger(logger)
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
middleware(
|
|
62
|
+
mockRequestWithBody(
|
|
63
|
+
"authToken",
|
|
64
|
+
{},
|
|
65
|
+
{
|
|
66
|
+
detail: {
|
|
67
|
+
lch: lifecycleChain,
|
|
68
|
+
lid: lifecycleId,
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
mockResponse(),
|
|
73
|
+
mockNext()
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
expect(sharedContext.run).toHaveBeenCalledWith(
|
|
77
|
+
expect.anything(),
|
|
78
|
+
expect.objectContaining({
|
|
79
|
+
lifecycleId,
|
|
80
|
+
lifecycleChain: `${lifecycleChain},${appIdentifier()}`,
|
|
81
|
+
})
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|