@ddd-ts-kit/http 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +388 -2
- package/dist/criteria/coerce-value.d.ts +8 -0
- package/dist/criteria/coerce-value.d.ts.map +1 -0
- package/dist/criteria/coerce-value.js +29 -0
- package/dist/criteria/coerce-value.js.map +1 -0
- package/dist/criteria/criteria-from.d.ts +11 -0
- package/dist/criteria/criteria-from.d.ts.map +1 -0
- package/dist/criteria/criteria-from.js +17 -0
- package/dist/criteria/criteria-from.js.map +1 -0
- package/dist/criteria/criteria-parameters.d.ts +10 -0
- package/dist/criteria/criteria-parameters.d.ts.map +1 -0
- package/dist/criteria/criteria-parameters.js +45 -0
- package/dist/criteria/criteria-parameters.js.map +1 -0
- package/dist/criteria/criteria-query-options.d.ts +6 -0
- package/dist/criteria/criteria-query-options.d.ts.map +1 -0
- package/dist/criteria/criteria-query-options.js +2 -0
- package/dist/criteria/criteria-query-options.js.map +1 -0
- package/dist/criteria/criteria-query-schema.d.ts +10 -0
- package/dist/criteria/criteria-query-schema.d.ts.map +1 -0
- package/dist/criteria/criteria-query-schema.js +12 -0
- package/dist/criteria/criteria-query-schema.js.map +1 -0
- package/dist/criteria/filter-entries.d.ts +9 -0
- package/dist/criteria/filter-entries.d.ts.map +1 -0
- package/dist/criteria/filter-entries.js +28 -0
- package/dist/criteria/filter-entries.js.map +1 -0
- package/dist/criteria/filter-entry.d.ts +6 -0
- package/dist/criteria/filter-entry.d.ts.map +1 -0
- package/dist/criteria/filter-entry.js +2 -0
- package/dist/criteria/filter-entry.js.map +1 -0
- package/dist/criteria/parse-condition.d.ts +7 -0
- package/dist/criteria/parse-condition.d.ts.map +1 -0
- package/dist/criteria/parse-condition.js +52 -0
- package/dist/criteria/parse-condition.js.map +1 -0
- package/dist/criteria/parse-criteria-query.d.ts +5 -0
- package/dist/criteria/parse-criteria-query.d.ts.map +1 -0
- package/dist/criteria/parse-criteria-query.js +31 -0
- package/dist/criteria/parse-criteria-query.js.map +1 -0
- package/dist/criteria/parse-filters.d.ts +15 -0
- package/dist/criteria/parse-filters.d.ts.map +1 -0
- package/dist/criteria/parse-filters.js +52 -0
- package/dist/criteria/parse-filters.js.map +1 -0
- package/dist/criteria/sortable-fields.d.ts +4 -0
- package/dist/criteria/sortable-fields.d.ts.map +1 -0
- package/dist/criteria/sortable-fields.js +6 -0
- package/dist/criteria/sortable-fields.js.map +1 -0
- package/dist/criteria/split-list.d.ts +3 -0
- package/dist/criteria/split-list.d.ts.map +1 -0
- package/dist/criteria/split-list.js +19 -0
- package/dist/criteria/split-list.js.map +1 -0
- package/dist/docs/docs-page.d.ts +11 -0
- package/dist/docs/docs-page.d.ts.map +1 -0
- package/dist/docs/docs-page.js +18 -0
- package/dist/docs/docs-page.js.map +1 -0
- package/dist/docs/docs-ui.d.ts +2 -0
- package/dist/docs/docs-ui.d.ts.map +1 -0
- package/dist/docs/docs-ui.js +2 -0
- package/dist/docs/docs-ui.js.map +1 -0
- package/dist/docs/open-api-docs-routes.d.ts +22 -0
- package/dist/docs/open-api-docs-routes.d.ts.map +1 -0
- package/dist/docs/open-api-docs-routes.js +54 -0
- package/dist/docs/open-api-docs-routes.js.map +1 -0
- package/dist/docs.d.ts +3 -0
- package/dist/docs.d.ts.map +1 -0
- package/dist/docs.js +2 -0
- package/dist/docs.js.map +1 -0
- package/dist/error/create-error-mapper.d.ts +10 -0
- package/dist/error/create-error-mapper.d.ts.map +1 -0
- package/dist/error/create-error-mapper.js +12 -0
- package/dist/error/create-error-mapper.js.map +1 -0
- package/dist/error/default-error-mapping.d.ts +3 -0
- package/dist/error/default-error-mapping.d.ts.map +1 -0
- package/dist/error/default-error-mapping.js +9 -0
- package/dist/error/default-error-mapping.js.map +1 -0
- package/dist/error/error-mapper.d.ts +12 -0
- package/dist/error/error-mapper.d.ts.map +1 -0
- package/dist/error/error-mapper.js +8 -0
- package/dist/error/error-mapper.js.map +1 -0
- package/dist/error/error-mapping.d.ts +3 -0
- package/dist/error/error-mapping.d.ts.map +1 -0
- package/dist/error/error-mapping.js +2 -0
- package/dist/error/error-mapping.js.map +1 -0
- package/dist/error/forbidden-error.d.ts +5 -0
- package/dist/error/forbidden-error.d.ts.map +1 -0
- package/dist/error/forbidden-error.js +5 -0
- package/dist/error/forbidden-error.js.map +1 -0
- package/dist/error/internal-error-code.d.ts +2 -0
- package/dist/error/internal-error-code.d.ts.map +1 -0
- package/dist/error/internal-error-code.js +2 -0
- package/dist/error/internal-error-code.js.map +1 -0
- package/dist/error/problem.d.ts +11 -0
- package/dist/error/problem.d.ts.map +1 -0
- package/dist/error/problem.js +2 -0
- package/dist/error/problem.js.map +1 -0
- package/dist/error/response-contract-error.d.ts +7 -0
- package/dist/error/response-contract-error.d.ts.map +1 -0
- package/dist/error/response-contract-error.js +10 -0
- package/dist/error/response-contract-error.js.map +1 -0
- package/dist/error/status-title.d.ts +2 -0
- package/dist/error/status-title.d.ts.map +1 -0
- package/dist/error/status-title.js +28 -0
- package/dist/error/status-title.js.map +1 -0
- package/dist/error/to-problem.d.ts +4 -0
- package/dist/error/to-problem.d.ts.map +1 -0
- package/dist/error/to-problem.js +34 -0
- package/dist/error/to-problem.js.map +1 -0
- package/dist/error/unauthorized-error.d.ts +5 -0
- package/dist/error/unauthorized-error.d.ts.map +1 -0
- package/dist/error/unauthorized-error.js +5 -0
- package/dist/error/unauthorized-error.js.map +1 -0
- package/dist/express/mount-express.d.ts +10 -0
- package/dist/express/mount-express.d.ts.map +1 -0
- package/dist/express/mount-express.js +38 -0
- package/dist/express/mount-express.js.map +1 -0
- package/dist/express.d.ts +2 -0
- package/dist/express.d.ts.map +1 -0
- package/dist/express.js +2 -0
- package/dist/express.js.map +1 -0
- package/dist/fastify/fastify-mount-options.d.ts +3 -0
- package/dist/fastify/fastify-mount-options.d.ts.map +1 -0
- package/dist/fastify/fastify-mount-options.js +2 -0
- package/dist/fastify/fastify-mount-options.js.map +1 -0
- package/dist/fastify/fastify-routes.d.ts +6 -0
- package/dist/fastify/fastify-routes.d.ts.map +1 -0
- package/dist/fastify/fastify-routes.js +10 -0
- package/dist/fastify/fastify-routes.js.map +1 -0
- package/dist/fastify/mount-fastify.d.ts +6 -0
- package/dist/fastify/mount-fastify.d.ts.map +1 -0
- package/dist/fastify/mount-fastify.js +19 -0
- package/dist/fastify/mount-fastify.js.map +1 -0
- package/dist/fastify.d.ts +4 -0
- package/dist/fastify.d.ts.map +1 -0
- package/dist/fastify.js +3 -0
- package/dist/fastify.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/nest/create-routes-module.d.ts +15 -0
- package/dist/nest/create-routes-module.d.ts.map +1 -0
- package/dist/nest/create-routes-module.js +54 -0
- package/dist/nest/create-routes-module.js.map +1 -0
- package/dist/nest/routes-factory.d.ts +8 -0
- package/dist/nest/routes-factory.d.ts.map +1 -0
- package/dist/nest/routes-factory.js +2 -0
- package/dist/nest/routes-factory.js.map +1 -0
- package/dist/nest/routes-mounter.d.ts +9 -0
- package/dist/nest/routes-mounter.d.ts.map +1 -0
- package/dist/nest/routes-mounter.js +8 -0
- package/dist/nest/routes-mounter.js.map +1 -0
- package/dist/nest.d.ts +4 -0
- package/dist/nest.d.ts.map +1 -0
- package/dist/nest.js +3 -0
- package/dist/nest.js.map +1 -0
- package/dist/openapi/check-open-api-drift.d.ts +6 -0
- package/dist/openapi/check-open-api-drift.d.ts.map +1 -0
- package/dist/openapi/check-open-api-drift.js +6 -0
- package/dist/openapi/check-open-api-drift.js.map +1 -0
- package/dist/openapi/compare.d.ts +3 -0
- package/dist/openapi/compare.d.ts.map +1 -0
- package/dist/openapi/compare.js +5 -0
- package/dist/openapi/compare.js.map +1 -0
- package/dist/openapi/definitions.d.ts +14 -0
- package/dist/openapi/definitions.d.ts.map +1 -0
- package/dist/openapi/definitions.js +61 -0
- package/dist/openapi/definitions.js.map +1 -0
- package/dist/openapi/generate-open-api.d.ts +21 -0
- package/dist/openapi/generate-open-api.d.ts.map +1 -0
- package/dist/openapi/generate-open-api.js +43 -0
- package/dist/openapi/generate-open-api.js.map +1 -0
- package/dist/openapi/open-api-document.d.ts +18 -0
- package/dist/openapi/open-api-document.d.ts.map +1 -0
- package/dist/openapi/open-api-document.js +2 -0
- package/dist/openapi/open-api-document.js.map +1 -0
- package/dist/openapi/open-api-info.d.ts +6 -0
- package/dist/openapi/open-api-info.d.ts.map +1 -0
- package/dist/openapi/open-api-info.js +2 -0
- package/dist/openapi/open-api-info.js.map +1 -0
- package/dist/openapi/open-api-path.d.ts +2 -0
- package/dist/openapi/open-api-path.d.ts.map +1 -0
- package/dist/openapi/open-api-path.js +4 -0
- package/dist/openapi/open-api-path.js.map +1 -0
- package/dist/openapi/open-api-server.d.ts +5 -0
- package/dist/openapi/open-api-server.d.ts.map +1 -0
- package/dist/openapi/open-api-server.js +2 -0
- package/dist/openapi/open-api-server.js.map +1 -0
- package/dist/openapi/path-items.d.ts +7 -0
- package/dist/openapi/path-items.d.ts.map +1 -0
- package/dist/openapi/path-items.js +43 -0
- package/dist/openapi/path-items.js.map +1 -0
- package/dist/openapi/path-parameters.d.ts +4 -0
- package/dist/openapi/path-parameters.d.ts.map +1 -0
- package/dist/openapi/path-parameters.js +13 -0
- package/dist/openapi/path-parameters.js.map +1 -0
- package/dist/openapi/problem-schema.d.ts +3 -0
- package/dist/openapi/problem-schema.d.ts.map +1 -0
- package/dist/openapi/problem-schema.js +27 -0
- package/dist/openapi/problem-schema.js.map +1 -0
- package/dist/openapi/requirement.d.ts +3 -0
- package/dist/openapi/requirement.d.ts.map +1 -0
- package/dist/openapi/requirement.js +5 -0
- package/dist/openapi/requirement.js.map +1 -0
- package/dist/openapi/responses.d.ts +7 -0
- package/dist/openapi/responses.d.ts.map +1 -0
- package/dist/openapi/responses.js +50 -0
- package/dist/openapi/responses.js.map +1 -0
- package/dist/openapi/schema-parameters.d.ts +5 -0
- package/dist/openapi/schema-parameters.d.ts.map +1 -0
- package/dist/openapi/schema-parameters.js +24 -0
- package/dist/openapi/schema-parameters.js.map +1 -0
- package/dist/openapi/stringify-open-api.d.ts +4 -0
- package/dist/openapi/stringify-open-api.d.ts.map +1 -0
- package/dist/openapi/stringify-open-api.js +5 -0
- package/dist/openapi/stringify-open-api.js.map +1 -0
- package/dist/openapi.d.ts +7 -0
- package/dist/openapi.d.ts.map +1 -0
- package/dist/openapi.js +4 -0
- package/dist/openapi.js.map +1 -0
- package/dist/pagination/issue.d.ts +3 -0
- package/dist/pagination/issue.d.ts.map +1 -0
- package/dist/pagination/issue.js +4 -0
- package/dist/pagination/issue.js.map +1 -0
- package/dist/pagination/limits-of.d.ts +3 -0
- package/dist/pagination/limits-of.d.ts.map +1 -0
- package/dist/pagination/limits-of.js +8 -0
- package/dist/pagination/limits-of.js.map +1 -0
- package/dist/pagination/page-body.d.ts +7 -0
- package/dist/pagination/page-body.d.ts.map +1 -0
- package/dist/pagination/page-body.js +2 -0
- package/dist/pagination/page-body.js.map +1 -0
- package/dist/pagination/page-query-options.d.ts +8 -0
- package/dist/pagination/page-query-options.d.ts.map +1 -0
- package/dist/pagination/page-query-options.js +2 -0
- package/dist/pagination/page-query-options.js.map +1 -0
- package/dist/pagination/page-query-schema.d.ts +6 -0
- package/dist/pagination/page-query-schema.d.ts.map +1 -0
- package/dist/pagination/page-query-schema.js +8 -0
- package/dist/pagination/page-query-schema.js.map +1 -0
- package/dist/pagination/page-request-from.d.ts +9 -0
- package/dist/pagination/page-request-from.d.ts.map +1 -0
- package/dist/pagination/page-request-from.js +16 -0
- package/dist/pagination/page-request-from.js.map +1 -0
- package/dist/pagination/page-request-parameters.d.ts +9 -0
- package/dist/pagination/page-request-parameters.d.ts.map +1 -0
- package/dist/pagination/page-request-parameters.js +30 -0
- package/dist/pagination/page-request-parameters.js.map +1 -0
- package/dist/pagination/page-response.d.ts +5 -0
- package/dist/pagination/page-response.d.ts.map +1 -0
- package/dist/pagination/page-response.js +9 -0
- package/dist/pagination/page-response.js.map +1 -0
- package/dist/pagination/page-schema-of.d.ts +9 -0
- package/dist/pagination/page-schema-of.d.ts.map +1 -0
- package/dist/pagination/page-schema-of.js +60 -0
- package/dist/pagination/page-schema-of.js.map +1 -0
- package/dist/pagination/parse-page-query.d.ts +5 -0
- package/dist/pagination/parse-page-query.d.ts.map +1 -0
- package/dist/pagination/parse-page-query.js +108 -0
- package/dist/pagination/parse-page-query.js.map +1 -0
- package/dist/pipeline/assert-declared-response.d.ts +4 -0
- package/dist/pipeline/assert-declared-response.d.ts.map +1 -0
- package/dist/pipeline/assert-declared-response.js +18 -0
- package/dist/pipeline/assert-declared-response.js.map +1 -0
- package/dist/pipeline/correlation-header.d.ts +2 -0
- package/dist/pipeline/correlation-header.d.ts.map +1 -0
- package/dist/pipeline/correlation-header.js +2 -0
- package/dist/pipeline/correlation-header.js.map +1 -0
- package/dist/pipeline/correlation-id-of.d.ts +4 -0
- package/dist/pipeline/correlation-id-of.d.ts.map +1 -0
- package/dist/pipeline/correlation-id-of.js +7 -0
- package/dist/pipeline/correlation-id-of.js.map +1 -0
- package/dist/pipeline/error-context.d.ts +15 -0
- package/dist/pipeline/error-context.d.ts.map +1 -0
- package/dist/pipeline/error-context.js +2 -0
- package/dist/pipeline/error-context.js.map +1 -0
- package/dist/pipeline/execute-options.d.ts +40 -0
- package/dist/pipeline/execute-options.d.ts.map +1 -0
- package/dist/pipeline/execute-options.js +2 -0
- package/dist/pipeline/execute-options.js.map +1 -0
- package/dist/pipeline/execute-route.d.ts +6 -0
- package/dist/pipeline/execute-route.d.ts.map +1 -0
- package/dist/pipeline/execute-route.js +108 -0
- package/dist/pipeline/execute-route.js.map +1 -0
- package/dist/pipeline/execution-of-request.d.ts +16 -0
- package/dist/pipeline/execution-of-request.d.ts.map +1 -0
- package/dist/pipeline/execution-of-request.js +44 -0
- package/dist/pipeline/execution-of-request.js.map +1 -0
- package/dist/pipeline/raw-request.d.ts +10 -0
- package/dist/pipeline/raw-request.d.ts.map +1 -0
- package/dist/pipeline/raw-request.js +2 -0
- package/dist/pipeline/raw-request.js.map +1 -0
- package/dist/pipeline/report-http-errors.d.ts +11 -0
- package/dist/pipeline/report-http-errors.d.ts.map +1 -0
- package/dist/pipeline/report-http-errors.js +17 -0
- package/dist/pipeline/report-http-errors.js.map +1 -0
- package/dist/pipeline/route-around.d.ts +5 -0
- package/dist/pipeline/route-around.d.ts.map +1 -0
- package/dist/pipeline/route-around.js +2 -0
- package/dist/pipeline/route-around.js.map +1 -0
- package/dist/pipeline/route-response.d.ts +7 -0
- package/dist/pipeline/route-response.d.ts.map +1 -0
- package/dist/pipeline/route-response.js +2 -0
- package/dist/pipeline/route-response.js.map +1 -0
- package/dist/pipeline/serialize-body.d.ts +7 -0
- package/dist/pipeline/serialize-body.d.ts.map +1 -0
- package/dist/pipeline/serialize-body.js +16 -0
- package/dist/pipeline/serialize-body.js.map +1 -0
- package/dist/pipeline/validate-request.d.ts +8 -0
- package/dist/pipeline/validate-request.d.ts.map +1 -0
- package/dist/pipeline/validate-request.js +30 -0
- package/dist/pipeline/validate-request.js.map +1 -0
- package/dist/pipeline/well-formed-identifier.d.ts +3 -0
- package/dist/pipeline/well-formed-identifier.d.ts.map +1 -0
- package/dist/pipeline/well-formed-identifier.js +6 -0
- package/dist/pipeline/well-formed-identifier.js.map +1 -0
- package/dist/route/assert-unique-routes.d.ts +3 -0
- package/dist/route/assert-unique-routes.d.ts.map +1 -0
- package/dist/route/assert-unique-routes.js +22 -0
- package/dist/route/assert-unique-routes.js.map +1 -0
- package/dist/route/define-route.d.ts +7 -0
- package/dist/route/define-route.d.ts.map +1 -0
- package/dist/route/define-route.js +17 -0
- package/dist/route/define-route.js.map +1 -0
- package/dist/route/define-routes.d.ts +4 -0
- package/dist/route/define-routes.d.ts.map +1 -0
- package/dist/route/define-routes.js +11 -0
- package/dist/route/define-routes.js.map +1 -0
- package/dist/route/duplicate-route-error.d.ts +4 -0
- package/dist/route/duplicate-route-error.d.ts.map +1 -0
- package/dist/route/duplicate-route-error.js +7 -0
- package/dist/route/duplicate-route-error.js.map +1 -0
- package/dist/route/handler-input.d.ts +23 -0
- package/dist/route/handler-input.d.ts.map +1 -0
- package/dist/route/handler-input.js +2 -0
- package/dist/route/handler-input.js.map +1 -0
- package/dist/route/handler-result.d.ts +20 -0
- package/dist/route/handler-result.d.ts.map +1 -0
- package/dist/route/handler-result.js +2 -0
- package/dist/route/handler-result.js.map +1 -0
- package/dist/route/http-method.d.ts +2 -0
- package/dist/route/http-method.d.ts.map +1 -0
- package/dist/route/http-method.js +2 -0
- package/dist/route/http-method.js.map +1 -0
- package/dist/route/prefix-routes.d.ts +4 -0
- package/dist/route/prefix-routes.d.ts.map +1 -0
- package/dist/route/prefix-routes.js +10 -0
- package/dist/route/prefix-routes.js.map +1 -0
- package/dist/route/raw-headers.d.ts +2 -0
- package/dist/route/raw-headers.d.ts.map +1 -0
- package/dist/route/raw-headers.js +2 -0
- package/dist/route/raw-headers.js.map +1 -0
- package/dist/route/request-context.d.ts +13 -0
- package/dist/route/request-context.d.ts.map +1 -0
- package/dist/route/request-context.js +2 -0
- package/dist/route/request-context.js.map +1 -0
- package/dist/route/request-schemas.d.ts +8 -0
- package/dist/route/request-schemas.d.ts.map +1 -0
- package/dist/route/request-schemas.js +2 -0
- package/dist/route/request-schemas.js.map +1 -0
- package/dist/route/response-spec.d.ts +6 -0
- package/dist/route/response-spec.d.ts.map +1 -0
- package/dist/route/response-spec.js +2 -0
- package/dist/route/response-spec.js.map +1 -0
- package/dist/route/responses-spec.d.ts +5 -0
- package/dist/route/responses-spec.d.ts.map +1 -0
- package/dist/route/responses-spec.js +2 -0
- package/dist/route/responses-spec.js.map +1 -0
- package/dist/route/route-handler.d.ts +6 -0
- package/dist/route/route-handler.d.ts.map +1 -0
- package/dist/route/route-handler.js +2 -0
- package/dist/route/route-handler.js.map +1 -0
- package/dist/route/route-input.d.ts +10 -0
- package/dist/route/route-input.d.ts.map +1 -0
- package/dist/route/route-input.js +2 -0
- package/dist/route/route-input.js.map +1 -0
- package/dist/route/route-output.d.ts +6 -0
- package/dist/route/route-output.d.ts.map +1 -0
- package/dist/route/route-output.js +2 -0
- package/dist/route/route-output.js.map +1 -0
- package/dist/route/route-spec.d.ts +23 -0
- package/dist/route/route-spec.d.ts.map +1 -0
- package/dist/route/route-spec.js +2 -0
- package/dist/route/route-spec.js.map +1 -0
- package/dist/route/route.d.ts +11 -0
- package/dist/route/route.d.ts.map +1 -0
- package/dist/route/route.js +2 -0
- package/dist/route/route.js.map +1 -0
- package/dist/route/without-trailing-slashes.d.ts +3 -0
- package/dist/route/without-trailing-slashes.d.ts.map +1 -0
- package/dist/route/without-trailing-slashes.js +9 -0
- package/dist/route/without-trailing-slashes.js.map +1 -0
- package/dist/support/is-record.d.ts +2 -0
- package/dist/support/is-record.d.ts.map +1 -0
- package/dist/support/is-record.js +4 -0
- package/dist/support/is-record.js.map +1 -0
- package/package.json +82 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"problem.d.ts","sourceRoot":"","sources":["../../src/error/problem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"problem.js","sourceRoot":"","sources":["../../src/error/problem.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ValidationIssue } from '@ddd-ts-kit/validation';
|
|
2
|
+
/** The route answered something its declaration does not allow; reported as a 500. */
|
|
3
|
+
export declare class ResponseContractError extends Error {
|
|
4
|
+
readonly issues: readonly ValidationIssue[];
|
|
5
|
+
constructor(message: string, issues?: readonly ValidationIssue[]);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=response-contract-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-contract-error.d.ts","sourceRoot":"","sources":["../../src/error/response-contract-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,sFAAsF;AACtF,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IAE5C,YAAY,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,SAAS,eAAe,EAAO,EAInE;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The route answered something its declaration does not allow; reported as a 500. */
|
|
2
|
+
export class ResponseContractError extends Error {
|
|
3
|
+
issues;
|
|
4
|
+
constructor(message, issues = []) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = 'ResponseContractError';
|
|
7
|
+
this.issues = issues;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=response-contract-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-contract-error.js","sourceRoot":"","sources":["../../src/error/response-contract-error.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACrC,MAAM,CAA6B;IAE5C,YAAY,OAAe,EAAE,MAAM,GAA+B,EAAE;QAClE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-title.d.ts","sourceRoot":"","sources":["../../src/error/status-title.ts"],"names":[],"mappings":"AAyBA,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const STATUS_TITLES = {
|
|
2
|
+
400: 'Bad Request',
|
|
3
|
+
401: 'Unauthorized',
|
|
4
|
+
402: 'Payment Required',
|
|
5
|
+
403: 'Forbidden',
|
|
6
|
+
404: 'Not Found',
|
|
7
|
+
405: 'Method Not Allowed',
|
|
8
|
+
406: 'Not Acceptable',
|
|
9
|
+
408: 'Request Timeout',
|
|
10
|
+
409: 'Conflict',
|
|
11
|
+
410: 'Gone',
|
|
12
|
+
412: 'Precondition Failed',
|
|
13
|
+
413: 'Content Too Large',
|
|
14
|
+
415: 'Unsupported Media Type',
|
|
15
|
+
422: 'Unprocessable Content',
|
|
16
|
+
423: 'Locked',
|
|
17
|
+
428: 'Precondition Required',
|
|
18
|
+
429: 'Too Many Requests',
|
|
19
|
+
500: 'Internal Server Error',
|
|
20
|
+
501: 'Not Implemented',
|
|
21
|
+
502: 'Bad Gateway',
|
|
22
|
+
503: 'Service Unavailable',
|
|
23
|
+
504: 'Gateway Timeout',
|
|
24
|
+
};
|
|
25
|
+
export function statusTitle(status) {
|
|
26
|
+
return STATUS_TITLES[status] ?? (status >= 500 ? 'Server Error' : 'Client Error');
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=status-title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-title.js","sourceRoot":"","sources":["../../src/error/status-title.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAqC;IACtD,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,wBAAwB;IAC7B,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,iBAAiB;CACvB,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-problem.d.ts","sourceRoot":"","sources":["../../src/error/to-problem.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAqBzF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DomainError } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { ValidationError } from '@ddd-ts-kit/validation';
|
|
3
|
+
import { INTERNAL_ERROR_CODE } from './internal-error-code.js';
|
|
4
|
+
import { statusTitle } from './status-title.js';
|
|
5
|
+
export function toProblem(error, mapper, requestId) {
|
|
6
|
+
if (!(error instanceof DomainError)) {
|
|
7
|
+
return internalProblem(requestId);
|
|
8
|
+
}
|
|
9
|
+
const status = mapper.statusOf(error.code);
|
|
10
|
+
if (status >= 500) {
|
|
11
|
+
// A domain error mapped to a server fault is no longer the client's business.
|
|
12
|
+
return { ...internalProblem(requestId), status, title: statusTitle(status), code: error.code };
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
type: mapper.typeOf(error.code),
|
|
16
|
+
title: statusTitle(status),
|
|
17
|
+
status,
|
|
18
|
+
code: error.code,
|
|
19
|
+
detail: error.message,
|
|
20
|
+
...(error instanceof ValidationError ? { issues: error.issues } : {}),
|
|
21
|
+
requestId,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
// The message of an unexpected error quotes data and internals: it never leaves the process.
|
|
25
|
+
function internalProblem(requestId) {
|
|
26
|
+
return {
|
|
27
|
+
type: 'about:blank',
|
|
28
|
+
title: 'Internal Server Error',
|
|
29
|
+
status: 500,
|
|
30
|
+
code: INTERNAL_ERROR_CODE,
|
|
31
|
+
requestId,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=to-problem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-problem.js","sourceRoot":"","sources":["../../src/error/to-problem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,SAAS,CAAC,KAAc,EAAE,MAAmB,EAAE,SAAiB;IAC9E,IAAI,CAAC,CAAC,KAAK,YAAY,WAAW,CAAC,EAAE,CAAC;QACpC,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE3C,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QAClB,8EAA8E;QAC9E,OAAO,EAAE,GAAG,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IACjG,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;QAC/B,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC;QAC1B,MAAM;QACN,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,MAAM,EAAE,KAAK,CAAC,OAAO;QACrB,GAAG,CAAC,KAAK,YAAY,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrE,SAAS;KACV,CAAC;AACJ,CAAC;AAED,6FAA6F;AAC7F,SAAS,eAAe,CAAC,SAAiB;IACxC,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,uBAAuB;QAC9B,MAAM,EAAE,GAAG;QACX,IAAI,EAAE,mBAAmB;QACzB,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unauthorized-error.d.ts","sourceRoot":"","sources":["../../src/error/unauthorized-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,IAAI,kBAAkB;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unauthorized-error.js","sourceRoot":"","sources":["../../src/error/unauthorized-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IACvC,IAAI,GAAG,cAAc,CAAC;CAChC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IRouter } from 'express';
|
|
2
|
+
import type { ExecuteOptions } from '../pipeline/execute-options.js';
|
|
3
|
+
import type { Route } from '../route/route.js';
|
|
4
|
+
export type ExpressMountOptions = ExecuteOptions;
|
|
5
|
+
/**
|
|
6
|
+
* Registers the routes on an Express 5 application or router. A JSON body parser
|
|
7
|
+
* (`express.json()`) must be installed before, otherwise bodies reach validation as `undefined`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function mountExpress(target: IRouter, routes: readonly Route[], options?: ExpressMountOptions): void;
|
|
10
|
+
//# sourceMappingURL=mount-express.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-express.d.ts","sourceRoot":"","sources":["../../src/express/mount-express.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,SAAS,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAMjD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,OAAO,GAAE,mBAAwB,GAAG,IAAI,CAQ/G"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { executeRoute } from '../pipeline/execute-route.js';
|
|
2
|
+
import { serializeBody } from '../pipeline/serialize-body.js';
|
|
3
|
+
import { assertUniqueRoutes } from '../route/assert-unique-routes.js';
|
|
4
|
+
/**
|
|
5
|
+
* Registers the routes on an Express 5 application or router. A JSON body parser
|
|
6
|
+
* (`express.json()`) must be installed before, otherwise bodies reach validation as `undefined`.
|
|
7
|
+
*/
|
|
8
|
+
export function mountExpress(target, routes, options = {}) {
|
|
9
|
+
assertUniqueRoutes(routes);
|
|
10
|
+
const register = registrarOf(target);
|
|
11
|
+
for (const route of routes) {
|
|
12
|
+
register[route.method](route.path, handlerOf(route, options));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function registrarOf(target) {
|
|
16
|
+
return {
|
|
17
|
+
GET: (path, handler) => target.get(path, handler),
|
|
18
|
+
POST: (path, handler) => target.post(path, handler),
|
|
19
|
+
PUT: (path, handler) => target.put(path, handler),
|
|
20
|
+
PATCH: (path, handler) => target.patch(path, handler),
|
|
21
|
+
DELETE: (path, handler) => target.delete(path, handler),
|
|
22
|
+
HEAD: (path, handler) => target.head(path, handler),
|
|
23
|
+
OPTIONS: (path, handler) => target.options(path, handler),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function handlerOf(route, options) {
|
|
27
|
+
return async (request, response) => {
|
|
28
|
+
const { params, query, headers } = request;
|
|
29
|
+
const body = request.body;
|
|
30
|
+
const result = await executeRoute(route, { params, query, headers, body, raw: request }, options);
|
|
31
|
+
response.status(result.status);
|
|
32
|
+
for (const [name, value] of Object.entries(result.headers)) {
|
|
33
|
+
response.setHeader(name, value);
|
|
34
|
+
}
|
|
35
|
+
response.end(serializeBody(result));
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=mount-express.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-express.js","sourceRoot":"","sources":["../../src/express/mount-express.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAUtE;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAe,EAAE,MAAwB,EAAE,OAAO,GAAwB,EAAE;IACvG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAErC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,MAAe;IAClC,OAAO;QACL,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;QACjD,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC;QACnD,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;QACjD,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;QACrD,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;QACvD,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC;QACnD,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;KAC1D,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,KAAY,EAAE,OAA4B;IAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;QACjC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAC3C,MAAM,IAAI,GAAY,OAAO,CAAC,IAAI,CAAC;QACnC,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QAElG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAE/B,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3D,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;QAED,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../src/express.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/express.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.js","sourceRoot":"","sources":["../src/express.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA4B,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify-mount-options.d.ts","sourceRoot":"","sources":["../../src/fastify/fastify-mount-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify-mount-options.js","sourceRoot":"","sources":["../../src/fastify/fastify-mount-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FastifyPluginAsync } from 'fastify';
|
|
2
|
+
import type { Route } from '../route/route.js';
|
|
3
|
+
import type { FastifyMountOptions } from './fastify-mount-options.js';
|
|
4
|
+
/** The same as `mountFastify`, as a plugin: `app.register(fastifyRoutes(routes), { prefix })`. */
|
|
5
|
+
export declare function fastifyRoutes(routes: readonly Route[], options?: FastifyMountOptions): FastifyPluginAsync;
|
|
6
|
+
//# sourceMappingURL=fastify-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify-routes.d.ts","sourceRoot":"","sources":["../../src/fastify/fastify-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,OAAO,GAAE,mBAAwB,GAAG,kBAAkB,CAM7G"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { assertUniqueRoutes } from '../route/assert-unique-routes.js';
|
|
2
|
+
import { mountFastify } from './mount-fastify.js';
|
|
3
|
+
/** The same as `mountFastify`, as a plugin: `app.register(fastifyRoutes(routes), { prefix })`. */
|
|
4
|
+
export function fastifyRoutes(routes, options = {}) {
|
|
5
|
+
assertUniqueRoutes(routes);
|
|
6
|
+
return async (instance) => {
|
|
7
|
+
mountFastify(instance, routes, options);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=fastify-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify-routes.js","sourceRoot":"","sources":["../../src/fastify/fastify-routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,kGAAkG;AAClG,MAAM,UAAU,aAAa,CAAC,MAAwB,EAAE,OAAO,GAAwB,EAAE;IACvF,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,OAAO,KAAK,EAAE,QAAQ,EAAE,EAAE;QACxB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
2
|
+
import type { Route } from '../route/route.js';
|
|
3
|
+
import type { FastifyMountOptions } from './fastify-mount-options.js';
|
|
4
|
+
/** Registers the routes on a Fastify 5 instance. Validation stays in the shared pipeline. */
|
|
5
|
+
export declare function mountFastify(instance: FastifyInstance, routes: readonly Route[], options?: FastifyMountOptions): void;
|
|
6
|
+
//# sourceMappingURL=mount-fastify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-fastify.d.ts","sourceRoot":"","sources":["../../src/fastify/mount-fastify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,6FAA6F;AAC7F,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,SAAS,KAAK,EAAE,EACxB,OAAO,GAAE,mBAAwB,GAChC,IAAI,CAeN"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { executeRoute } from '../pipeline/execute-route.js';
|
|
2
|
+
import { serializeBody } from '../pipeline/serialize-body.js';
|
|
3
|
+
import { assertUniqueRoutes } from '../route/assert-unique-routes.js';
|
|
4
|
+
/** Registers the routes on a Fastify 5 instance. Validation stays in the shared pipeline. */
|
|
5
|
+
export function mountFastify(instance, routes, options = {}) {
|
|
6
|
+
assertUniqueRoutes(routes);
|
|
7
|
+
for (const route of routes) {
|
|
8
|
+
instance.route({
|
|
9
|
+
method: route.method,
|
|
10
|
+
url: route.path,
|
|
11
|
+
handler: async (request, reply) => {
|
|
12
|
+
const { params, query, headers, body } = request;
|
|
13
|
+
const result = await executeRoute(route, { params, query, headers, body, raw: request }, options);
|
|
14
|
+
return reply.code(result.status).headers(result.headers).send(serializeBody(result));
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=mount-fastify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-fastify.js","sourceRoot":"","sources":["../../src/fastify/mount-fastify.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAItE,6FAA6F;AAC7F,MAAM,UAAU,YAAY,CAC1B,QAAyB,EACzB,MAAwB,EACxB,OAAO,GAAwB,EAAE;IAEjC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,QAAQ,CAAC,KAAK,CAAC;YACb,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,GAAG,EAAE,KAAK,CAAC,IAAI;YACf,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;gBAChC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;gBACjD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;gBAElG,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;YACvF,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/fastify.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify.js","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export { criteriaFrom } from './criteria/criteria-from.js';
|
|
2
|
+
export { criteriaParameters } from './criteria/criteria-parameters.js';
|
|
3
|
+
export type { CriteriaQueryOptions } from './criteria/criteria-query-options.js';
|
|
4
|
+
export { criteriaQuerySchema } from './criteria/criteria-query-schema.js';
|
|
5
|
+
export { createErrorMapper, type ErrorMapperOptions } from './error/create-error-mapper.js';
|
|
6
|
+
export { DEFAULT_ERROR_MAPPING } from './error/default-error-mapping.js';
|
|
7
|
+
export { ErrorMapper } from './error/error-mapper.js';
|
|
8
|
+
export type { ErrorMapping } from './error/error-mapping.js';
|
|
9
|
+
export { ForbiddenError } from './error/forbidden-error.js';
|
|
10
|
+
export { INTERNAL_ERROR_CODE } from './error/internal-error-code.js';
|
|
11
|
+
export type { Problem } from './error/problem.js';
|
|
12
|
+
export { ResponseContractError } from './error/response-contract-error.js';
|
|
13
|
+
export { statusTitle } from './error/status-title.js';
|
|
14
|
+
export { toProblem } from './error/to-problem.js';
|
|
15
|
+
export { UnauthorizedError } from './error/unauthorized-error.js';
|
|
16
|
+
export type { PageBody } from './pagination/page-body.js';
|
|
17
|
+
export type { PageQueryOptions } from './pagination/page-query-options.js';
|
|
18
|
+
export { pageQuerySchema } from './pagination/page-query-schema.js';
|
|
19
|
+
export { pageRequestFrom } from './pagination/page-request-from.js';
|
|
20
|
+
export { pageRequestParameters } from './pagination/page-request-parameters.js';
|
|
21
|
+
export { pageResponse } from './pagination/page-response.js';
|
|
22
|
+
export { pageSchemaOf } from './pagination/page-schema-of.js';
|
|
23
|
+
export { CORRELATION_HEADER } from './pipeline/correlation-header.js';
|
|
24
|
+
export type { ErrorContext } from './pipeline/error-context.js';
|
|
25
|
+
export type { ExecuteOptions } from './pipeline/execute-options.js';
|
|
26
|
+
export { executeRoute } from './pipeline/execute-route.js';
|
|
27
|
+
export type { RawRequest } from './pipeline/raw-request.js';
|
|
28
|
+
export type { RouteAround } from './pipeline/route-around.js';
|
|
29
|
+
export { reportHttpErrors } from './pipeline/report-http-errors.js';
|
|
30
|
+
export type { RouteResponse } from './pipeline/route-response.js';
|
|
31
|
+
export { serializeBody } from './pipeline/serialize-body.js';
|
|
32
|
+
export { assertUniqueRoutes } from './route/assert-unique-routes.js';
|
|
33
|
+
export { defineRoute } from './route/define-route.js';
|
|
34
|
+
export { defineRoutes } from './route/define-routes.js';
|
|
35
|
+
export { DuplicateRouteError } from './route/duplicate-route-error.js';
|
|
36
|
+
export type { HandlerInput } from './route/handler-input.js';
|
|
37
|
+
export type { HandlerResult } from './route/handler-result.js';
|
|
38
|
+
export type { HttpMethod } from './route/http-method.js';
|
|
39
|
+
export { prefixRoutes } from './route/prefix-routes.js';
|
|
40
|
+
export type { RawHeaders } from './route/raw-headers.js';
|
|
41
|
+
export type { RequestContext } from './route/request-context.js';
|
|
42
|
+
export type { RequestSchemas } from './route/request-schemas.js';
|
|
43
|
+
export type { ResponseSpec } from './route/response-spec.js';
|
|
44
|
+
export type { ResponsesSpec } from './route/responses-spec.js';
|
|
45
|
+
export type { RouteHandler } from './route/route-handler.js';
|
|
46
|
+
export type { RouteInput } from './route/route-input.js';
|
|
47
|
+
export type { RouteOutput } from './route/route-output.js';
|
|
48
|
+
export type { RouteSpec } from './route/route-spec.js';
|
|
49
|
+
export type { Route } from './route/route.js';
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,YAAY,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,YAAY,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export { criteriaFrom } from './criteria/criteria-from.js';
|
|
2
|
+
export { criteriaParameters } from './criteria/criteria-parameters.js';
|
|
3
|
+
export { criteriaQuerySchema } from './criteria/criteria-query-schema.js';
|
|
4
|
+
export { createErrorMapper } from './error/create-error-mapper.js';
|
|
5
|
+
export { DEFAULT_ERROR_MAPPING } from './error/default-error-mapping.js';
|
|
6
|
+
export { ErrorMapper } from './error/error-mapper.js';
|
|
7
|
+
export { ForbiddenError } from './error/forbidden-error.js';
|
|
8
|
+
export { INTERNAL_ERROR_CODE } from './error/internal-error-code.js';
|
|
9
|
+
export { ResponseContractError } from './error/response-contract-error.js';
|
|
10
|
+
export { statusTitle } from './error/status-title.js';
|
|
11
|
+
export { toProblem } from './error/to-problem.js';
|
|
12
|
+
export { UnauthorizedError } from './error/unauthorized-error.js';
|
|
13
|
+
export { pageQuerySchema } from './pagination/page-query-schema.js';
|
|
14
|
+
export { pageRequestFrom } from './pagination/page-request-from.js';
|
|
15
|
+
export { pageRequestParameters } from './pagination/page-request-parameters.js';
|
|
16
|
+
export { pageResponse } from './pagination/page-response.js';
|
|
17
|
+
export { pageSchemaOf } from './pagination/page-schema-of.js';
|
|
18
|
+
export { CORRELATION_HEADER } from './pipeline/correlation-header.js';
|
|
19
|
+
export { executeRoute } from './pipeline/execute-route.js';
|
|
20
|
+
export { reportHttpErrors } from './pipeline/report-http-errors.js';
|
|
21
|
+
export { serializeBody } from './pipeline/serialize-body.js';
|
|
22
|
+
export { assertUniqueRoutes } from './route/assert-unique-routes.js';
|
|
23
|
+
export { defineRoute } from './route/define-route.js';
|
|
24
|
+
export { defineRoutes } from './route/define-routes.js';
|
|
25
|
+
export { DuplicateRouteError } from './route/duplicate-route-error.js';
|
|
26
|
+
export { prefixRoutes } from './route/prefix-routes.js';
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAA2B,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAIvE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DynamicModule, ModuleMetadata } from '@nestjs/common';
|
|
2
|
+
import type { ExecuteOptions } from '../pipeline/execute-options.js';
|
|
3
|
+
import type { Route } from '../route/route.js';
|
|
4
|
+
import type { RoutesFactory } from './routes-factory.js';
|
|
5
|
+
export interface RoutesModuleOptions extends ExecuteOptions {
|
|
6
|
+
/** Modules exporting the tokens listed in `inject`. */
|
|
7
|
+
readonly imports?: ModuleMetadata['imports'];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A Nest module that mounts framework-free routes on the underlying HTTP server, Express or
|
|
11
|
+
* Fastify. The routes bypass Nest's own pipeline (pipes, guards, interceptors, filters, global
|
|
12
|
+
* prefix): validation and error mapping are those of `executeRoute`, as with the other adapters.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createRoutesModule(routes: readonly Route[] | RoutesFactory, options?: RoutesModuleOptions): DynamicModule;
|
|
15
|
+
//# sourceMappingURL=create-routes-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-routes-module.d.ts","sourceRoot":"","sources":["../../src/nest/create-routes-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD,uDAAuD;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,aAAa,EACxC,OAAO,GAAE,mBAAwB,GAChC,aAAa,CAwBf"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { HttpAdapterHost } from '@nestjs/core';
|
|
2
|
+
import { mountExpress } from '../express/mount-express.js';
|
|
3
|
+
import { mountFastify } from '../fastify/mount-fastify.js';
|
|
4
|
+
import { assertUniqueRoutes } from '../route/assert-unique-routes.js';
|
|
5
|
+
import { RoutesMounter } from './routes-mounter.js';
|
|
6
|
+
/**
|
|
7
|
+
* A Nest module that mounts framework-free routes on the underlying HTTP server, Express or
|
|
8
|
+
* Fastify. The routes bypass Nest's own pipeline (pipes, guards, interceptors, filters, global
|
|
9
|
+
* prefix): validation and error mapping are those of `executeRoute`, as with the other adapters.
|
|
10
|
+
*/
|
|
11
|
+
export function createRoutesModule(routes, options = {}) {
|
|
12
|
+
// One class per call: Nest identifies a module by its class, and two route sets must not merge.
|
|
13
|
+
class RoutesModule {
|
|
14
|
+
}
|
|
15
|
+
const { imports, ...executeOptions } = options;
|
|
16
|
+
const factory = isFactory(routes) ? routes : { inject: [], useFactory: () => routes };
|
|
17
|
+
return {
|
|
18
|
+
module: RoutesModule,
|
|
19
|
+
imports: imports ?? [],
|
|
20
|
+
providers: [
|
|
21
|
+
{
|
|
22
|
+
provide: RoutesMounter,
|
|
23
|
+
inject: [HttpAdapterHost, ...factory.inject],
|
|
24
|
+
useFactory: (host, ...dependencies) => ({
|
|
25
|
+
// Module init runs after Nest installed its body parsers and before it installs its
|
|
26
|
+
// not-found handler, which is the window where a route can still be added.
|
|
27
|
+
onModuleInit() {
|
|
28
|
+
mountOn(host, factory.useFactory(...dependencies), executeOptions);
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function isFactory(routes) {
|
|
36
|
+
return !Array.isArray(routes);
|
|
37
|
+
}
|
|
38
|
+
function mountOn(host, routes, options) {
|
|
39
|
+
assertUniqueRoutes(routes);
|
|
40
|
+
const adapter = host.httpAdapter;
|
|
41
|
+
const type = adapter.getType();
|
|
42
|
+
if (type === 'express') {
|
|
43
|
+
const instance = adapter.getInstance();
|
|
44
|
+
mountExpress(instance, routes, options);
|
|
45
|
+
}
|
|
46
|
+
else if (type === 'fastify') {
|
|
47
|
+
const instance = adapter.getInstance();
|
|
48
|
+
mountFastify(instance, routes, options);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
throw new Error(`Unsupported Nest HTTP platform "${type}".`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=create-routes-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-routes-module.js","sourceRoot":"","sources":["../../src/nest/create-routes-module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAwC,EACxC,OAAO,GAAwB,EAAE;IAEjC,gGAAgG;IAChG,MAAM,YAAY;KAAG;IAErB,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,GAAG,OAAO,CAAC;IAC/C,MAAM,OAAO,GAAkB,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;IAErG,OAAO;QACL,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,OAAO,IAAI,EAAE;QACtB,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,aAAa;gBACtB,MAAM,EAAE,CAAC,eAAe,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;gBAC5C,UAAU,EAAE,CAAC,IAAqB,EAAE,GAAG,YAAuB,EAAiB,EAAE,CAAC,CAAC;oBACjF,oFAAoF;oBACpF,2EAA2E;oBAC3E,YAAY;wBACV,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,EAAE,cAAc,CAAC,CAAC;oBACrE,CAAC;iBACF,CAAC;aACH;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,MAAwC;IACzD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,OAAO,CAAC,IAAqB,EAAE,MAAwB,EAAE,OAAuB;IACvF,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC;IACjC,MAAM,IAAI,GAAW,OAAO,CAAC,OAAO,EAAE,CAAC;IAEvC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAY,OAAO,CAAC,WAAW,EAAE,CAAC;QAEhD,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;SAAM,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAoB,OAAO,CAAC,WAAW,EAAE,CAAC;QAExD,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,mCAAmC,IAAI,IAAI,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { InjectionToken } from '@nestjs/common';
|
|
2
|
+
import type { Route } from '../route/route.js';
|
|
3
|
+
/** Routes whose handlers close over injected dependencies. */
|
|
4
|
+
export interface RoutesFactory {
|
|
5
|
+
readonly inject: readonly InjectionToken[];
|
|
6
|
+
useFactory(...dependencies: unknown[]): readonly Route[];
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=routes-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-factory.d.ts","sourceRoot":"","sources":["../../src/nest/routes-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,8DAA8D;AAC9D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;IAI3C,UAAU,CAAC,GAAG,YAAY,EAAE,OAAO,EAAE,GAAG,SAAS,KAAK,EAAE,CAAC;CAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-factory.js","sourceRoot":"","sources":["../../src/nest/routes-factory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Nest provider every routes module registers: it mounts the routes of its module when Nest
|
|
3
|
+
* initialises it. The class is the provider token.
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class RoutesMounter {
|
|
6
|
+
static readonly tokenKey = "http.RoutesMounter";
|
|
7
|
+
abstract onModuleInit(): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=routes-mounter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-mounter.d.ts","sourceRoot":"","sources":["../../src/nest/routes-mounter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,8BAAsB,aAAa;IACjC,MAAM,CAAC,QAAQ,CAAC,QAAQ,wBAAwB;IAEhD,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC;CAC/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Nest provider every routes module registers: it mounts the routes of its module when Nest
|
|
3
|
+
* initialises it. The class is the provider token.
|
|
4
|
+
*/
|
|
5
|
+
export class RoutesMounter {
|
|
6
|
+
static tokenKey = 'http.RoutesMounter';
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=routes-mounter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-mounter.js","sourceRoot":"","sources":["../../src/nest/routes-mounter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAgB,aAAa;IACjC,MAAM,CAAU,QAAQ,GAAG,oBAAoB,CAAC;CAGjD"}
|
package/dist/nest.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest.d.ts","sourceRoot":"","sources":["../src/nest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC9F,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/nest.js
ADDED
package/dist/nest.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest.js","sourceRoot":"","sources":["../src/nest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA4B,MAAM,gCAAgC,CAAC;AAE9F,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OpenApiDocument } from './open-api-document.js';
|
|
2
|
+
/** Compares the generated contract with the committed one, ignoring line-ending style. */
|
|
3
|
+
export declare function checkOpenApiDrift(document: OpenApiDocument, existingFileContent: string): {
|
|
4
|
+
drift: boolean;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=check-open-api-drift.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-open-api-drift.d.ts","sourceRoot":"","sources":["../../src/openapi/check-open-api-drift.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,CAE5G"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { stringifyOpenApi } from './stringify-open-api.js';
|
|
2
|
+
/** Compares the generated contract with the committed one, ignoring line-ending style. */
|
|
3
|
+
export function checkOpenApiDrift(document, existingFileContent) {
|
|
4
|
+
return { drift: stringifyOpenApi(document) !== existingFileContent.replaceAll('\r\n', '\n') };
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=check-open-api-drift.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-open-api-drift.js","sourceRoot":"","sources":["../../src/openapi/check-open-api-drift.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,0FAA0F;AAC1F,MAAM,UAAU,iBAAiB,CAAC,QAAyB,EAAE,mBAA2B;IACtF,OAAO,EAAE,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,KAAK,mBAAmB,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;AAChG,CAAC"}
|