@ddd-ts-kit/http 0.0.0-stage → 0.1.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/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":"filter-entries.js","sourceRoot":"","sources":["../../src/criteria/filter-entries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGnD,MAAM,IAAI,GAAG,4BAA4B,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAwC;IACpE,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC1D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAErC,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CA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@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-entry.d.ts","sourceRoot":"","sources":["../../src/criteria/filter-entry.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-entry.js","sourceRoot":"","sources":["../../src/criteria/filter-entry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FieldDeclaration, FilterNode } from '@ddd-ts-kit/kernel';
|
|
2
|
+
/**
|
|
3
|
+
* The condition `<operator>:<value>` writes on a field, `undefined` when a value does not read
|
|
4
|
+
* as the type of the field. Without an operator the text is the value of `eq`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseCondition(field: string, declared: FieldDeclaration, text: string): FilterNode | undefined;
|
|
7
|
+
//# sourceMappingURL=parse-condition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-condition.d.ts","sourceRoot":"","sources":["../../src/criteria/parse-condition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAc,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAyBnG;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAK9G"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { coerceValue } from './coerce-value.js';
|
|
2
|
+
import { splitList } from './split-list.js';
|
|
3
|
+
const OPERATORS = [
|
|
4
|
+
'eq',
|
|
5
|
+
'ne',
|
|
6
|
+
'in',
|
|
7
|
+
'gt',
|
|
8
|
+
'gte',
|
|
9
|
+
'lt',
|
|
10
|
+
'lte',
|
|
11
|
+
'contains',
|
|
12
|
+
'startsWith',
|
|
13
|
+
'isNull',
|
|
14
|
+
'between',
|
|
15
|
+
];
|
|
16
|
+
const WRITTEN = /^([A-Za-z]+)(?::(.*))?$/s;
|
|
17
|
+
/**
|
|
18
|
+
* The condition `<operator>:<value>` writes on a field, `undefined` when a value does not read
|
|
19
|
+
* as the type of the field. Without an operator the text is the value of `eq`.
|
|
20
|
+
*/
|
|
21
|
+
export function parseCondition(field, declared, text) {
|
|
22
|
+
const { operator, text: rest } = writtenOf(text);
|
|
23
|
+
const value = operandOf(declared, operator, rest);
|
|
24
|
+
return value === undefined ? undefined : { kind: 'condition', field, operator, value };
|
|
25
|
+
}
|
|
26
|
+
function writtenOf(text) {
|
|
27
|
+
const [, name, rest] = WRITTEN.exec(text) ?? [];
|
|
28
|
+
const operator = OPERATORS.find((known) => known === name);
|
|
29
|
+
if (operator === undefined || (rest === undefined && operator !== 'isNull')) {
|
|
30
|
+
return { operator: 'eq', text };
|
|
31
|
+
}
|
|
32
|
+
return { operator, text: rest ?? 'true' };
|
|
33
|
+
}
|
|
34
|
+
function operandOf(declared, operator, text) {
|
|
35
|
+
switch (operator) {
|
|
36
|
+
case 'isNull':
|
|
37
|
+
return coerceValue('boolean', text);
|
|
38
|
+
case 'contains':
|
|
39
|
+
case 'startsWith':
|
|
40
|
+
return text;
|
|
41
|
+
case 'in':
|
|
42
|
+
case 'between':
|
|
43
|
+
return listOf(declared, text);
|
|
44
|
+
default:
|
|
45
|
+
return coerceValue(declared.type, text);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function listOf(declared, text) {
|
|
49
|
+
const values = splitList(text).flatMap((item) => coerceValue(declared.type, item) ?? []);
|
|
50
|
+
return values.length === splitList(text).length ? values : undefined;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=parse-condition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-condition.js","source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AI,IAAI,MAAM,EAAE,CAAC;AAC5C,CAAC;AAED,SAAS,SAAS,CAChB,QAA0B,EAC1B,QAAwB,EACxB,IAAY;IAEZ,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACtC,KAAK,UAAU,CAAC;QAChB,KAAK,YAAY;YACf,OAAO,IAAI,CAAC;QACd,KAAK,IAAI,CAAC;QACV,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAChC;YACE,OAAO,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,QAA0B,EAAE,IAAY;IACtD,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAEzF,OAAO,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Criteria, type CriteriaDefinition, type Result } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import type { ValidationIssue } from '@ddd-ts-kit/validation';
|
|
3
|
+
import type { CriteriaQueryOptions } from './criteria-query-options.js';
|
|
4
|
+
export declare function parseCriteriaQuery<Row>(input: unknown, definition: CriteriaDefinition<Row>, options?: CriteriaQueryOptions): Result<Criteria<Row>, ValidationIssue[]>;
|
|
5
|
+
//# sourceMappingURL=parse-criteria-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-criteria-query.d.ts","sourceRoot":"","sources":["../../src/criteria/parse-criteria-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA6B,KAAK,kBAAkB,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC/G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAQxE,wBAAgB,kBAAkB,CAAC,GAAG,EACpC,KAAK,EAAE,OAAO,EACd,UAAU,EAAE,kBAAkB,CAAC,GAAG,CAAC,EACnC,OAAO,GAAE,oBAAyB,GACjC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,eAAe,EAAE,CAAC,CA0B1C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Criteria, err, ok, validateCriteria } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { parsePageQuery } from '../pagination/parse-page-query.js';
|
|
3
|
+
import { isRecord } from '../support/is-record.js';
|
|
4
|
+
import { filterEntries } from './filter-entries.js';
|
|
5
|
+
import { parseFilters } from './parse-filters.js';
|
|
6
|
+
import { sortableFields } from './sortable-fields.js';
|
|
7
|
+
/** `page.limit` of a criteria is the `limit` parameter of the query, and so on. */
|
|
8
|
+
const PARAMETERS = { 'page.limit': 'limit', 'page.cursor': 'cursor' };
|
|
9
|
+
export function parseCriteriaQuery(input, definition, options = {}) {
|
|
10
|
+
const query = isRecord(input) ? input : {};
|
|
11
|
+
const { defaultPageSize, maxPageSize } = definition.limits;
|
|
12
|
+
const issues = [];
|
|
13
|
+
const filters = parseFilters(filterEntries(query), { definition, issues });
|
|
14
|
+
const page = parsePageQuery(query, {
|
|
15
|
+
...options,
|
|
16
|
+
sortable: sortableFields(definition),
|
|
17
|
+
defaultSize: defaultPageSize,
|
|
18
|
+
maxSize: maxPageSize,
|
|
19
|
+
});
|
|
20
|
+
if (!page.ok) {
|
|
21
|
+
return err([...issues, ...page.error]);
|
|
22
|
+
}
|
|
23
|
+
const criteria = Criteria.from({ filters, page: page.value });
|
|
24
|
+
const refused = validateCriteria(definition, criteria).map(({ path, code, message }) => ({
|
|
25
|
+
path: PARAMETERS[path] ?? path,
|
|
26
|
+
code,
|
|
27
|
+
message,
|
|
28
|
+
}));
|
|
29
|
+
return issues.length + refused.length > 0 ? err([...issues, ...refused]) : ok(criteria);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=parse-criteria-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-criteria-query.js","sourceRoot":"","sources":["../../src/criteria/parse-criteria-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,EAAE,gBAAgB,EAAwC,MAAM,oBAAoB,CAAC;AAE/G,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,mFAAmF;AACnF,MAAM,UAAU,GAAqC,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;AAExG,MAAM,UAAU,kBAAkB,CAChC,KAAc,EACd,UAAmC,EACnC,OAAO,GAAyB,EAAE;IAElC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC;IAC3D,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IAE3E,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,EAAE;QACjC,GAAG,OAAO;QACV,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC;QACpC,WAAW,EAAE,eAAe;QAC5B,OAAO,EAAE,WAAW;KACrB,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACb,OAAO,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAEnE,MAAM,OAAO,GAAG,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QACvF,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI;QAC9B,IAAI;QACJ,OAAO;KACR,CAAC,CAAC,CAAC;IAEJ,OAAO,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CriteriaDefinition, FilterNode } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import type { ValidationIssue } from '@ddd-ts-kit/validation';
|
|
3
|
+
import type { FilterEntry } from './filter-entry.js';
|
|
4
|
+
interface Reading<Row> {
|
|
5
|
+
readonly definition: CriteriaDefinition<Row>;
|
|
6
|
+
readonly issues: ValidationIssue[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The filters the `filter[...]` parameters of a query write, in the order they come. What
|
|
10
|
+
* cannot be read is added to `issues` under `filter.<field>`; whether the read port accepts
|
|
11
|
+
* what was read is for `validateCriteria` to say.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseFilters<Row>(entries: readonly FilterEntry[], reading: Reading<Row>): FilterNode[];
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=parse-filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-filters.d.ts","sourceRoot":"","sources":["../../src/criteria/parse-filters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMrD,UAAU,OAAO,CAAC,GAAG;IACnB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC;CACpC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,EAAE,CAoBtG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { parseCondition } from './parse-condition.js';
|
|
2
|
+
const GROUPS = ['and', 'or', 'not'];
|
|
3
|
+
const INDEX = /^\d+$/;
|
|
4
|
+
/**
|
|
5
|
+
* The filters the `filter[...]` parameters of a query write, in the order they come. What
|
|
6
|
+
* cannot be read is added to `issues` under `filter.<field>`; whether the read port accepts
|
|
7
|
+
* what was read is for `validateCriteria` to say.
|
|
8
|
+
*/
|
|
9
|
+
export function parseFilters(entries, reading) {
|
|
10
|
+
const heads = [...new Set(entries.map(({ path }) => path[0] ?? ''))];
|
|
11
|
+
return heads.flatMap((head) => {
|
|
12
|
+
const under = entries
|
|
13
|
+
.filter(({ path }) => (path[0] ?? '') === head)
|
|
14
|
+
.map(({ path, values }) => ({ path: path.slice(1), values }));
|
|
15
|
+
const group = GROUPS.find((kind) => kind === head);
|
|
16
|
+
if (group !== undefined) {
|
|
17
|
+
return [{ kind: group, filters: parseFilters(under, reading) }];
|
|
18
|
+
}
|
|
19
|
+
if (INDEX.test(head)) {
|
|
20
|
+
return member(parseFilters(under, reading));
|
|
21
|
+
}
|
|
22
|
+
return under.flatMap((entry) => conditions(head, entry, reading));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** The filters written under one index of a group: one filter, or all of them together. */
|
|
26
|
+
function member(filters) {
|
|
27
|
+
return filters.length === 1 ? filters : [{ kind: 'and', filters }];
|
|
28
|
+
}
|
|
29
|
+
function conditions(field, { path, values }, { definition, issues }) {
|
|
30
|
+
const declared = Object.hasOwn(definition.fields, field) ? definition.fields[field] : undefined;
|
|
31
|
+
const texts = values.filter((value) => typeof value === 'string');
|
|
32
|
+
if (field === '' || path.length > 0 || texts.length !== values.length) {
|
|
33
|
+
issues.push({
|
|
34
|
+
path: field === '' ? 'filter' : `filter.${field}`,
|
|
35
|
+
code: 'invalid_filter',
|
|
36
|
+
message: 'A filter is written filter[<field>]=<operator>:<value>.',
|
|
37
|
+
});
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
// Left for the read port to refuse: it answers the same `unknown_field` whoever built the criteria.
|
|
41
|
+
if (declared === undefined) {
|
|
42
|
+
return [{ kind: 'condition', field, operator: 'eq', value: '' }];
|
|
43
|
+
}
|
|
44
|
+
return texts.flatMap((text) => {
|
|
45
|
+
const condition = parseCondition(field, declared, text);
|
|
46
|
+
if (condition === undefined) {
|
|
47
|
+
issues.push({ path: `filter.${field}`, code: 'invalid_value', message: `Must read as a ${declared.type}.` });
|
|
48
|
+
}
|
|
49
|
+
return condition ?? [];
|
|
50
|
+
});
|
|
51
|
+
}
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IACZ,CAAC;IAED,oGAAoG;IACpG,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC5B,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QAExD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,KAAK,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,kBAAkB,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;QAC/G,CAAC;QAED,OAAO,SAAS,IAAI,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CriteriaDefinition } from '@ddd-ts-kit/kernel';
|
|
2
|
+
/** The fields a client may sort by: those declared sortable, and the tie-breaker. */
|
|
3
|
+
export declare function sortableFields<Row>(definition: CriteriaDefinition<Row>): string[];
|
|
4
|
+
//# sourceMappingURL=sortable-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortable-fields.d.ts","sourceRoot":"","sources":["../../src/criteria/sortable-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,MAAM,EAAE,CAIjF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The fields a client may sort by: those declared sortable, and the tie-breaker. */
|
|
2
|
+
export function sortableFields(definition) {
|
|
3
|
+
const declared = Object.entries(definition.fields).flatMap(([field, { sortable }]) => (sortable ? [field] : []));
|
|
4
|
+
return [...new Set([...declared, definition.tieBreaker])];
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=sortable-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortable-fields.js","sourceRoot":"","sources":["../../src/criteria/sortable-fields.ts"],"names":[],"mappings":"AAEA,qFAAqF;AACrF,MAAM,UAAU,cAAc,CAAM,UAAmC;IACrE,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEjH,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-list.d.ts","sourceRoot":"","sources":["../../src/criteria/split-list.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBhD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** The values of a comma-separated list. A comma inside a value is written `\,`, a backslash `\\`. */
|
|
2
|
+
export function splitList(text) {
|
|
3
|
+
const values = [''];
|
|
4
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
5
|
+
const character = text.charAt(index);
|
|
6
|
+
const escaped = character === '\\' && index + 1 < text.length;
|
|
7
|
+
if (character === ',') {
|
|
8
|
+
values.push('');
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
values[values.length - 1] += escaped ? text.charAt(index + 1) : character;
|
|
12
|
+
}
|
|
13
|
+
if (escaped) {
|
|
14
|
+
index += 1;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return values;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=split-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-list.js","sourceRoot":"","sources":["../../src/criteria/split-list.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,MAAM,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC;IAEpB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrC,MAAM,OAAO,GAAG,SAAS,KAAK,IAAI,IAAI,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAE9D,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC5E,CAAC;QAED,IAAI,OAAO,EAAE,CAAC;YACZ,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DocsUi } from './docs-ui.js';
|
|
2
|
+
interface DocsPage {
|
|
3
|
+
readonly ui: DocsUi;
|
|
4
|
+
readonly title: string;
|
|
5
|
+
readonly specUrl: string;
|
|
6
|
+
readonly assets: string;
|
|
7
|
+
}
|
|
8
|
+
/** The HTML page that loads the chosen UI and points it at the contract. */
|
|
9
|
+
export declare function docsPage({ ui, title, specUrl, assets }: DocsPage): string;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=docs-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-page.d.ts","sourceRoot":"","sources":["../../src/docs/docs-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,UAAU,QAAQ;IAChB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,4EAA4E;AAC5E,wBAAgB,QAAQ,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAG,MAAM,CAazE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The HTML page that loads the chosen UI and points it at the contract. */
|
|
2
|
+
export function docsPage({ ui, title, specUrl, assets }) {
|
|
3
|
+
const head = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${escapeHtml(title)}</title>`;
|
|
4
|
+
const spec = escapeHtml(specUrl);
|
|
5
|
+
const base = escapeHtml(assets);
|
|
6
|
+
switch (ui) {
|
|
7
|
+
case 'swagger':
|
|
8
|
+
return `${head}<link rel="stylesheet" href="${base}/swagger-ui.css"></head><body><div id="ui"></div><script src="${base}/swagger-ui-bundle.js"></script><script>SwaggerUIBundle({ url: ${JSON.stringify(specUrl)}, dom_id: '#ui' });</script></body></html>`;
|
|
9
|
+
case 'scalar':
|
|
10
|
+
return `${head}</head><body><script id="api-reference" data-url="${spec}"></script><script src="${base}"></script></body></html>`;
|
|
11
|
+
case 'redoc':
|
|
12
|
+
return `${head}</head><body><redoc spec-url="${spec}"></redoc><script src="${base}/redoc.standalone.js"></script></body></html>`;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function escapeHtml(value) {
|
|
16
|
+
return value.replace(/[&<>"']/g, (char) => `&#${char.charCodeAt(0)};`);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=docs-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-page.js","sourceRoot":"","sources":["../../src/docs/docs-page.ts"],"names":[],"mappings":"AASA,4EAA4E;AAC5E,MAAM,UAAU,QAAQ,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAY;IAC/D,MAAM,IAAI,GAAG,wIAAwI,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC;IACjL,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAEhC,QAAQ,EAAE,EAAE,CAAC;QACX,KAAK,SAAS;YACZ,OAAO,GAAG,IAAI,gCAAgC,IAAI,iEAAiE,IAAI,kEAAkE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,4CAA4C,CAAC;QAC/P,KAAK,QAAQ;YACX,OAAO,GAAG,IAAI,qDAAqD,IAAI,2BAA2B,IAAI,2BAA2B,CAAC;QACpI,KAAK,OAAO;YACV,OAAO,GAAG,IAAI,iCAAiC,IAAI,0BAA0B,IAAI,+CAA+C,CAAC;IACrI,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-ui.d.ts","sourceRoot":"","sources":["../../src/docs/docs-ui.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-ui.js","sourceRoot":"","sources":["../../src/docs/docs-ui.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { OpenApiDocument } from '../openapi/open-api-document.js';
|
|
2
|
+
import type { Route } from '../route/route.js';
|
|
3
|
+
import type { DocsUi } from './docs-ui.js';
|
|
4
|
+
export interface DocsRoutesOptions {
|
|
5
|
+
/** Where the JSON contract is served. Default `/openapi.json`. */
|
|
6
|
+
readonly jsonPath?: string;
|
|
7
|
+
/** Where the interactive page is served. Default `/docs`. */
|
|
8
|
+
readonly uiPath?: string;
|
|
9
|
+
readonly ui?: DocsUi;
|
|
10
|
+
/**
|
|
11
|
+
* Base URL of the UI assets. Defaults to a public CDN, pinned to a major version. Point it
|
|
12
|
+
* at self-hosted files when the page must work offline or under a strict CSP.
|
|
13
|
+
*/
|
|
14
|
+
readonly assetsUrl?: string;
|
|
15
|
+
readonly title?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Two routes serving the generated contract and an interactive page for it. Mount them next
|
|
19
|
+
* to the application routes; they are deliberately not part of the contract they display.
|
|
20
|
+
*/
|
|
21
|
+
export declare function openApiDocsRoutes(document: OpenApiDocument, options?: DocsRoutesOptions): readonly Route[];
|
|
22
|
+
//# sourceMappingURL=open-api-docs-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-api-docs-routes.d.ts","sourceRoot":"","sources":["../../src/docs/open-api-docs-routes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,WAAW,iBAAiB;IAChC,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAmBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,GAAE,iBAAsB,GAAG,SAAS,KAAK,EAAE,CA6B9G"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ok } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { customSchema } from '@ddd-ts-kit/validation';
|
|
3
|
+
import { stringifyOpenApi } from '../openapi/stringify-open-api.js';
|
|
4
|
+
import { defineRoute } from '../route/define-route.js';
|
|
5
|
+
import { docsPage } from './docs-page.js';
|
|
6
|
+
const DEFAULT_ASSETS = {
|
|
7
|
+
swagger: 'https://cdn.jsdelivr.net/npm/swagger-ui-dist@5',
|
|
8
|
+
scalar: 'https://cdn.jsdelivr.net/npm/@scalar/api-reference@1',
|
|
9
|
+
redoc: 'https://cdn.jsdelivr.net/npm/redoc@2/bundles',
|
|
10
|
+
};
|
|
11
|
+
const text = customSchema((input) => ok(String(input)), { type: 'string' });
|
|
12
|
+
/**
|
|
13
|
+
* Two routes serving the generated contract and an interactive page for it. Mount them next
|
|
14
|
+
* to the application routes; they are deliberately not part of the contract they display.
|
|
15
|
+
*/
|
|
16
|
+
export function openApiDocsRoutes(document, options = {}) {
|
|
17
|
+
const jsonPath = options.jsonPath ?? '/openapi.json';
|
|
18
|
+
const ui = options.ui ?? 'swagger';
|
|
19
|
+
const html = docsPage({
|
|
20
|
+
ui,
|
|
21
|
+
title: options.title ?? document.info.title,
|
|
22
|
+
specUrl: jsonPath,
|
|
23
|
+
assets: options.assetsUrl ?? DEFAULT_ASSETS[ui],
|
|
24
|
+
});
|
|
25
|
+
return [
|
|
26
|
+
textRoute({
|
|
27
|
+
path: jsonPath,
|
|
28
|
+
operationId: 'getOpenApiDocument',
|
|
29
|
+
summary: 'OpenAPI contract',
|
|
30
|
+
description: 'The OpenAPI 3.1 document.',
|
|
31
|
+
contentType: 'application/json; charset=utf-8',
|
|
32
|
+
body: stringifyOpenApi(document),
|
|
33
|
+
}),
|
|
34
|
+
textRoute({
|
|
35
|
+
path: options.uiPath ?? '/docs',
|
|
36
|
+
operationId: 'getOpenApiUi',
|
|
37
|
+
summary: 'Interactive API documentation',
|
|
38
|
+
description: 'An HTML page.',
|
|
39
|
+
contentType: 'text/html; charset=utf-8',
|
|
40
|
+
body: html,
|
|
41
|
+
}),
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
function textRoute(route) {
|
|
45
|
+
return defineRoute({
|
|
46
|
+
method: 'GET',
|
|
47
|
+
path: route.path,
|
|
48
|
+
operationId: route.operationId,
|
|
49
|
+
summary: route.summary,
|
|
50
|
+
responses: { 200: { description: route.description, body: text } },
|
|
51
|
+
security: false,
|
|
52
|
+
}, async () => ({ status: 200, body: route.body, headers: { 'content-type': route.contentType } }));
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=open-api-docs-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-api-docs-routes.js","sourceRoot":"","sources":["../../src/docs/open-api-docs-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,WAAW,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,CAAC;AAED,SAAS,SAAS,CAAC,KAAgB;IACjC,OAAO,WAAW,CAChB;QACE,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,SAAS,EAAE,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAClE,QAAQ,EAAE,KAAK;KAChB,EACD,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC,CAChG,CAAC;AACJ,CAAC"}
|
package/dist/docs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../src/docs.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC"}
|
package/dist/docs.js
ADDED
package/dist/docs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../src/docs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAA0B,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ErrorMapper } from './error-mapper.js';
|
|
2
|
+
import type { ErrorMapping } from './error-mapping.js';
|
|
3
|
+
export interface ErrorMapperOptions {
|
|
4
|
+
/** Status of a `DomainError` whose code is not mapped. Defaults to 422. */
|
|
5
|
+
readonly fallbackStatus?: number;
|
|
6
|
+
/** Builds the problem `type` URI of a code. Defaults to `urn:problem:<code-in-kebab-case>`. */
|
|
7
|
+
readonly typeOf?: (code: string) => string;
|
|
8
|
+
}
|
|
9
|
+
export declare function createErrorMapper(overrides?: ErrorMapping, options?: ErrorMapperOptions): ErrorMapper;
|
|
10
|
+
//# sourceMappingURL=create-error-mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-error-mapper.d.ts","sourceRoot":"","sources":["../../src/error/create-error-mapper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,+FAA+F;IAC/F,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAED,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,YAAiB,EAAE,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAW7G"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DEFAULT_ERROR_MAPPING } from './default-error-mapping.js';
|
|
2
|
+
export function createErrorMapper(overrides = {}, options = {}) {
|
|
3
|
+
const mapping = { ...DEFAULT_ERROR_MAPPING, ...overrides };
|
|
4
|
+
const fallbackStatus = options.fallbackStatus ?? 422;
|
|
5
|
+
const typeOf = options.typeOf ?? ((code) => `urn:problem:${code.toLowerCase().replaceAll('_', '-')}`);
|
|
6
|
+
return {
|
|
7
|
+
mapping,
|
|
8
|
+
statusOf: (code) => mapping[code] ?? fallbackStatus,
|
|
9
|
+
typeOf,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=create-error-mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-error-mapper.js","sourceRoot":"","sources":["../../src/error/create-error-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAWnE,MAAM,UAAU,iBAAiB,CAAC,SAAS,GAAiB,EAAE,EAAE,OAAO,GAAuB,EAAE;IAC9F,MAAM,OAAO,GAAiB,EAAE,GAAG,qBAAqB,EAAE,GAAG,SAAS,EAAE,CAAC;IACzE,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,GAAG,CAAC;IAErD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,eAAe,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IAE9G,OAAO;QACL,OAAO;QACP,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,cAAc;QACnD,MAAM;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-error-mapping.d.ts","sourceRoot":"","sources":["../../src/error/default-error-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,eAAO,MAAM,qBAAqB,EAAE,YAOnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-error-mapping.js","sourceRoot":"","sources":["../../src/error/default-error-mapping.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,iBAAiB,EAAE,GAAG;IACtB,SAAS,EAAE,GAAG;IACd,QAAQ,EAAE,GAAG;IACb,mBAAmB,EAAE,GAAG;IACxB,YAAY,EAAE,GAAG;IACjB,SAAS,EAAE,GAAG;CACf,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ErrorMapping } from './error-mapping.js';
|
|
2
|
+
/**
|
|
3
|
+
* Says which status and which problem `type` a domain error code answers. One per application:
|
|
4
|
+
* the server and the contract generator must be given the same one.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class ErrorMapper {
|
|
7
|
+
static readonly tokenKey = "http.ErrorMapper";
|
|
8
|
+
abstract readonly mapping: ErrorMapping;
|
|
9
|
+
abstract statusOf(code: string): number;
|
|
10
|
+
abstract typeOf(code: string): string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=error-mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-mapper.d.ts","sourceRoot":"","sources":["../../src/error/error-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;GAGG;AACH,8BAAsB,WAAW;IAC/B,MAAM,CAAC,QAAQ,CAAC,QAAQ,sBAAsB;IAE9C,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAExC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAExC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACvC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Says which status and which problem `type` a domain error code answers. One per application:
|
|
3
|
+
* the server and the contract generator must be given the same one.
|
|
4
|
+
*/
|
|
5
|
+
export class ErrorMapper {
|
|
6
|
+
static tokenKey = 'http.ErrorMapper';
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=error-mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-mapper.js","sourceRoot":"","sources":["../../src/error/error-mapper.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAgB,WAAW;IAC/B,MAAM,CAAU,QAAQ,GAAG,kBAAkB,CAAC;CAO/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-mapping.d.ts","sourceRoot":"","sources":["../../src/error/error-mapping.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-mapping.js","sourceRoot":"","sources":["../../src/error/error-mapping.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forbidden-error.d.ts","sourceRoot":"","sources":["../../src/error/forbidden-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,qBAAa,cAAe,SAAQ,WAAW;IAC7C,QAAQ,CAAC,IAAI,eAAe;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forbidden-error.js","sourceRoot":"","sources":["../../src/error/forbidden-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,OAAO,cAAe,SAAQ,WAAW;IACpC,IAAI,GAAG,WAAW,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-error-code.d.ts","sourceRoot":"","sources":["../../src/error/internal-error-code.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-error-code.js","sourceRoot":"","sources":["../../src/error/internal-error-code.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ValidationIssue } from '@ddd-ts-kit/validation';
|
|
2
|
+
export interface Problem {
|
|
3
|
+
readonly type: string;
|
|
4
|
+
readonly title: string;
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly detail?: string;
|
|
8
|
+
readonly issues?: readonly ValidationIssue[];
|
|
9
|
+
readonly requestId: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=problem.d.ts.map
|