@entifix/core 0.1.0-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/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/base-entities/configuration-client/configuration-client-singleton.d.ts +39 -0
- package/dist/base-entities/configuration-client/configuration-client-singleton.d.ts.map +1 -0
- package/dist/base-entities/configuration-client/configuration-client-singleton.js +164 -0
- package/dist/base-entities/configuration-client/configuration-client-singleton.js.map +1 -0
- package/dist/base-entities/configuration-client/index.d.ts +4 -0
- package/dist/base-entities/configuration-client/index.d.ts.map +1 -0
- package/dist/base-entities/configuration-client/index.js +5 -0
- package/dist/base-entities/configuration-client/index.js.map +1 -0
- package/dist/base-entities/configuration-client/read-configuration-from-process.d.ts +11 -0
- package/dist/base-entities/configuration-client/read-configuration-from-process.d.ts.map +1 -0
- package/dist/base-entities/configuration-client/read-configuration-from-process.js +26 -0
- package/dist/base-entities/configuration-client/read-configuration-from-process.js.map +1 -0
- package/dist/base-entities/configuration-client/types.d.ts +38 -0
- package/dist/base-entities/configuration-client/types.d.ts.map +1 -0
- package/dist/base-entities/configuration-client/types.js +3 -0
- package/dist/base-entities/configuration-client/types.js.map +1 -0
- package/dist/base-entities/entifix-error/entifix-error.d.ts +31 -0
- package/dist/base-entities/entifix-error/entifix-error.d.ts.map +1 -0
- package/dist/base-entities/entifix-error/entifix-error.js +56 -0
- package/dist/base-entities/entifix-error/entifix-error.js.map +1 -0
- package/dist/base-entities/entifix-error/index.d.ts +2 -0
- package/dist/base-entities/entifix-error/index.d.ts.map +1 -0
- package/dist/base-entities/entifix-error/index.js +3 -0
- package/dist/base-entities/entifix-error/index.js.map +1 -0
- package/dist/command-palette/command-matching.d.ts +79 -0
- package/dist/command-palette/command-matching.d.ts.map +1 -0
- package/dist/command-palette/command-matching.js +116 -0
- package/dist/command-palette/command-matching.js.map +1 -0
- package/dist/command-palette/command-source.d.ts +109 -0
- package/dist/command-palette/command-source.d.ts.map +1 -0
- package/dist/command-palette/command-source.js +11 -0
- package/dist/command-palette/command-source.js.map +1 -0
- package/dist/command-palette/index.d.ts +3 -0
- package/dist/command-palette/index.d.ts.map +1 -0
- package/dist/command-palette/index.js +4 -0
- package/dist/command-palette/index.js.map +1 -0
- package/dist/entity-definition/decorators/accessor/accessor.d.ts +3 -0
- package/dist/entity-definition/decorators/accessor/accessor.d.ts.map +1 -0
- package/dist/entity-definition/decorators/accessor/accessor.js +11 -0
- package/dist/entity-definition/decorators/accessor/accessor.js.map +1 -0
- package/dist/entity-definition/decorators/accessor/index.d.ts +2 -0
- package/dist/entity-definition/decorators/accessor/index.d.ts.map +1 -0
- package/dist/entity-definition/decorators/accessor/index.js +3 -0
- package/dist/entity-definition/decorators/accessor/index.js.map +1 -0
- package/dist/entity-definition/decorators/entity/entity.d.ts +4 -0
- package/dist/entity-definition/decorators/entity/entity.d.ts.map +1 -0
- package/dist/entity-definition/decorators/entity/entity.js +9 -0
- package/dist/entity-definition/decorators/entity/entity.js.map +1 -0
- package/dist/entity-definition/decorators/entity/index.d.ts +2 -0
- package/dist/entity-definition/decorators/entity/index.d.ts.map +1 -0
- package/dist/entity-definition/decorators/entity/index.js +3 -0
- package/dist/entity-definition/decorators/entity/index.js.map +1 -0
- package/dist/entity-definition/decorators/method/index.d.ts +2 -0
- package/dist/entity-definition/decorators/method/index.d.ts.map +1 -0
- package/dist/entity-definition/decorators/method/index.js +3 -0
- package/dist/entity-definition/decorators/method/index.js.map +1 -0
- package/dist/entity-definition/decorators/method/method.d.ts +3 -0
- package/dist/entity-definition/decorators/method/method.d.ts.map +1 -0
- package/dist/entity-definition/decorators/method/method.js +10 -0
- package/dist/entity-definition/decorators/method/method.js.map +1 -0
- package/dist/entity-definition/decorators/use-case/index.d.ts +2 -0
- package/dist/entity-definition/decorators/use-case/index.d.ts.map +1 -0
- package/dist/entity-definition/decorators/use-case/index.js +3 -0
- package/dist/entity-definition/decorators/use-case/index.js.map +1 -0
- package/dist/entity-definition/decorators/use-case/use-case.d.ts +18 -0
- package/dist/entity-definition/decorators/use-case/use-case.d.ts.map +1 -0
- package/dist/entity-definition/decorators/use-case/use-case.js +26 -0
- package/dist/entity-definition/decorators/use-case/use-case.js.map +1 -0
- package/dist/entity-definition/describe/describe-child-columns.d.ts +33 -0
- package/dist/entity-definition/describe/describe-child-columns.d.ts.map +1 -0
- package/dist/entity-definition/describe/describe-child-columns.js +44 -0
- package/dist/entity-definition/describe/describe-child-columns.js.map +1 -0
- package/dist/entity-definition/describe/describe-entity-columns.d.ts +83 -0
- package/dist/entity-definition/describe/describe-entity-columns.d.ts.map +1 -0
- package/dist/entity-definition/describe/describe-entity-columns.js +112 -0
- package/dist/entity-definition/describe/describe-entity-columns.js.map +1 -0
- package/dist/entity-definition/describe/describe-entity-use-cases.d.ts +34 -0
- package/dist/entity-definition/describe/describe-entity-use-cases.d.ts.map +1 -0
- package/dist/entity-definition/describe/describe-entity-use-cases.js +24 -0
- package/dist/entity-definition/describe/describe-entity-use-cases.js.map +1 -0
- package/dist/entity-definition/describe/index.d.ts +4 -0
- package/dist/entity-definition/describe/index.d.ts.map +1 -0
- package/dist/entity-definition/describe/index.js +5 -0
- package/dist/entity-definition/describe/index.js.map +1 -0
- package/dist/entity-definition/field-path.d.ts +49 -0
- package/dist/entity-definition/field-path.d.ts.map +1 -0
- package/dist/entity-definition/field-path.js +58 -0
- package/dist/entity-definition/field-path.js.map +1 -0
- package/dist/entity-definition/helpers/entity-definition-helpers.d.ts +59 -0
- package/dist/entity-definition/helpers/entity-definition-helpers.d.ts.map +1 -0
- package/dist/entity-definition/helpers/entity-definition-helpers.js +115 -0
- package/dist/entity-definition/helpers/entity-definition-helpers.js.map +1 -0
- package/dist/entity-definition/helpers/index.d.ts +2 -0
- package/dist/entity-definition/helpers/index.d.ts.map +1 -0
- package/dist/entity-definition/helpers/index.js +3 -0
- package/dist/entity-definition/helpers/index.js.map +1 -0
- package/dist/entity-definition/links/apply-entity-links/apply-entity-links.d.ts +48 -0
- package/dist/entity-definition/links/apply-entity-links/apply-entity-links.d.ts.map +1 -0
- package/dist/entity-definition/links/apply-entity-links/apply-entity-links.js +88 -0
- package/dist/entity-definition/links/apply-entity-links/apply-entity-links.js.map +1 -0
- package/dist/entity-definition/links/apply-entity-links/index.d.ts +2 -0
- package/dist/entity-definition/links/apply-entity-links/index.d.ts.map +1 -0
- package/dist/entity-definition/links/apply-entity-links/index.js +3 -0
- package/dist/entity-definition/links/apply-entity-links/index.js.map +1 -0
- package/dist/entity-definition/links/entity-collection-link/entity-collection-link.d.ts +29 -0
- package/dist/entity-definition/links/entity-collection-link/entity-collection-link.d.ts.map +1 -0
- package/dist/entity-definition/links/entity-collection-link/entity-collection-link.js +61 -0
- package/dist/entity-definition/links/entity-collection-link/entity-collection-link.js.map +1 -0
- package/dist/entity-definition/links/entity-collection-link/index.d.ts +2 -0
- package/dist/entity-definition/links/entity-collection-link/index.d.ts.map +1 -0
- package/dist/entity-definition/links/entity-collection-link/index.js +3 -0
- package/dist/entity-definition/links/entity-collection-link/index.js.map +1 -0
- package/dist/entity-definition/links/entity-link/entity-link.d.ts +58 -0
- package/dist/entity-definition/links/entity-link/entity-link.d.ts.map +1 -0
- package/dist/entity-definition/links/entity-link/entity-link.js +79 -0
- package/dist/entity-definition/links/entity-link/entity-link.js.map +1 -0
- package/dist/entity-definition/links/entity-link/index.d.ts +2 -0
- package/dist/entity-definition/links/entity-link/index.d.ts.map +1 -0
- package/dist/entity-definition/links/entity-link/index.js +3 -0
- package/dist/entity-definition/links/entity-link/index.js.map +1 -0
- package/dist/entity-definition/links/entity-link-source/entity-link-source.d.ts +74 -0
- package/dist/entity-definition/links/entity-link-source/entity-link-source.d.ts.map +1 -0
- package/dist/entity-definition/links/entity-link-source/entity-link-source.js +11 -0
- package/dist/entity-definition/links/entity-link-source/entity-link-source.js.map +1 -0
- package/dist/entity-definition/links/entity-link-source/index.d.ts +2 -0
- package/dist/entity-definition/links/entity-link-source/index.d.ts.map +1 -0
- package/dist/entity-definition/links/entity-link-source/index.js +3 -0
- package/dist/entity-definition/links/entity-link-source/index.js.map +1 -0
- package/dist/entity-definition/meta-entities/meta-accessor/index.d.ts +2 -0
- package/dist/entity-definition/meta-entities/meta-accessor/index.d.ts.map +1 -0
- package/dist/entity-definition/meta-entities/meta-accessor/index.js +3 -0
- package/dist/entity-definition/meta-entities/meta-accessor/index.js.map +1 -0
- package/dist/entity-definition/meta-entities/meta-accessor/meta-accessor.d.ts +137 -0
- package/dist/entity-definition/meta-entities/meta-accessor/meta-accessor.d.ts.map +1 -0
- package/dist/entity-definition/meta-entities/meta-accessor/meta-accessor.js +52 -0
- package/dist/entity-definition/meta-entities/meta-accessor/meta-accessor.js.map +1 -0
- package/dist/entity-definition/meta-entities/meta-entity/index.d.ts +2 -0
- package/dist/entity-definition/meta-entities/meta-entity/index.d.ts.map +1 -0
- package/dist/entity-definition/meta-entities/meta-entity/index.js +3 -0
- package/dist/entity-definition/meta-entities/meta-entity/index.js.map +1 -0
- package/dist/entity-definition/meta-entities/meta-entity/meta-entity.d.ts +17 -0
- package/dist/entity-definition/meta-entities/meta-entity/meta-entity.d.ts.map +1 -0
- package/dist/entity-definition/meta-entities/meta-entity/meta-entity.js +13 -0
- package/dist/entity-definition/meta-entities/meta-entity/meta-entity.js.map +1 -0
- package/dist/entity-definition/meta-entities/meta-method/index.d.ts +2 -0
- package/dist/entity-definition/meta-entities/meta-method/index.d.ts.map +1 -0
- package/dist/entity-definition/meta-entities/meta-method/index.js +3 -0
- package/dist/entity-definition/meta-entities/meta-method/index.js.map +1 -0
- package/dist/entity-definition/meta-entities/meta-method/meta-method.d.ts +16 -0
- package/dist/entity-definition/meta-entities/meta-method/meta-method.d.ts.map +1 -0
- package/dist/entity-definition/meta-entities/meta-method/meta-method.js +11 -0
- package/dist/entity-definition/meta-entities/meta-method/meta-method.js.map +1 -0
- package/dist/entity-definition/meta-entities/meta-use-case/index.d.ts +2 -0
- package/dist/entity-definition/meta-entities/meta-use-case/index.d.ts.map +1 -0
- package/dist/entity-definition/meta-entities/meta-use-case/index.js +3 -0
- package/dist/entity-definition/meta-entities/meta-use-case/index.js.map +1 -0
- package/dist/entity-definition/meta-entities/meta-use-case/meta-use-case.d.ts +94 -0
- package/dist/entity-definition/meta-entities/meta-use-case/meta-use-case.d.ts.map +1 -0
- package/dist/entity-definition/meta-entities/meta-use-case/meta-use-case.js +17 -0
- package/dist/entity-definition/meta-entities/meta-use-case/meta-use-case.js.map +1 -0
- package/dist/entity-definition/metadata/entity-metadata-document.d.ts +23 -0
- package/dist/entity-definition/metadata/entity-metadata-document.d.ts.map +1 -0
- package/dist/entity-definition/metadata/entity-metadata-document.js +16 -0
- package/dist/entity-definition/metadata/entity-metadata-document.js.map +1 -0
- package/dist/entity-definition/metadata/entity-metadata-source.d.ts +19 -0
- package/dist/entity-definition/metadata/entity-metadata-source.d.ts.map +1 -0
- package/dist/entity-definition/metadata/entity-metadata-source.js +15 -0
- package/dist/entity-definition/metadata/entity-metadata-source.js.map +1 -0
- package/dist/entity-definition/metadata/index.d.ts +3 -0
- package/dist/entity-definition/metadata/index.d.ts.map +1 -0
- package/dist/entity-definition/metadata/index.js +4 -0
- package/dist/entity-definition/metadata/index.js.map +1 -0
- package/dist/entity-definition/reconstruct/clone-entity-draft.d.ts +34 -0
- package/dist/entity-definition/reconstruct/clone-entity-draft.d.ts.map +1 -0
- package/dist/entity-definition/reconstruct/clone-entity-draft.js +75 -0
- package/dist/entity-definition/reconstruct/clone-entity-draft.js.map +1 -0
- package/dist/entity-definition/reconstruct/coerce-field-value.d.ts +34 -0
- package/dist/entity-definition/reconstruct/coerce-field-value.d.ts.map +1 -0
- package/dist/entity-definition/reconstruct/coerce-field-value.js +42 -0
- package/dist/entity-definition/reconstruct/coerce-field-value.js.map +1 -0
- package/dist/entity-definition/reconstruct/index.d.ts +5 -0
- package/dist/entity-definition/reconstruct/index.d.ts.map +1 -0
- package/dist/entity-definition/reconstruct/index.js +6 -0
- package/dist/entity-definition/reconstruct/index.js.map +1 -0
- package/dist/entity-definition/reconstruct/reconstruct-child.d.ts +35 -0
- package/dist/entity-definition/reconstruct/reconstruct-child.d.ts.map +1 -0
- package/dist/entity-definition/reconstruct/reconstruct-child.js +47 -0
- package/dist/entity-definition/reconstruct/reconstruct-child.js.map +1 -0
- package/dist/entity-definition/reconstruct/reconstruct-entity.d.ts +49 -0
- package/dist/entity-definition/reconstruct/reconstruct-entity.d.ts.map +1 -0
- package/dist/entity-definition/reconstruct/reconstruct-entity.js +116 -0
- package/dist/entity-definition/reconstruct/reconstruct-entity.js.map +1 -0
- package/dist/entity-definition/serializer/deserialize.d.ts +13 -0
- package/dist/entity-definition/serializer/deserialize.d.ts.map +1 -0
- package/dist/entity-definition/serializer/deserialize.js +145 -0
- package/dist/entity-definition/serializer/deserialize.js.map +1 -0
- package/dist/entity-definition/serializer/index.d.ts +3 -0
- package/dist/entity-definition/serializer/index.d.ts.map +1 -0
- package/dist/entity-definition/serializer/index.js +4 -0
- package/dist/entity-definition/serializer/index.js.map +1 -0
- package/dist/entity-definition/serializer/serialize.d.ts +26 -0
- package/dist/entity-definition/serializer/serialize.d.ts.map +1 -0
- package/dist/entity-definition/serializer/serialize.js +64 -0
- package/dist/entity-definition/serializer/serialize.js.map +1 -0
- package/dist/envelope/event-pattern.d.ts +14 -0
- package/dist/envelope/event-pattern.d.ts.map +1 -0
- package/dist/envelope/event-pattern.js +30 -0
- package/dist/envelope/event-pattern.js.map +1 -0
- package/dist/envelope/index.d.ts +5 -0
- package/dist/envelope/index.d.ts.map +1 -0
- package/dist/envelope/index.js +6 -0
- package/dist/envelope/index.js.map +1 -0
- package/dist/envelope/make-envelope.d.ts +45 -0
- package/dist/envelope/make-envelope.d.ts.map +1 -0
- package/dist/envelope/make-envelope.js +111 -0
- package/dist/envelope/make-envelope.js.map +1 -0
- package/dist/envelope/read-envelope.d.ts +48 -0
- package/dist/envelope/read-envelope.d.ts.map +1 -0
- package/dist/envelope/read-envelope.js +138 -0
- package/dist/envelope/read-envelope.js.map +1 -0
- package/dist/envelope/types.d.ts +173 -0
- package/dist/envelope/types.d.ts.map +1 -0
- package/dist/envelope/types.js +6 -0
- package/dist/envelope/types.js.map +1 -0
- package/dist/http/session-cookies.d.ts +25 -0
- package/dist/http/session-cookies.d.ts.map +1 -0
- package/dist/http/session-cookies.js +22 -0
- package/dist/http/session-cookies.js.map +1 -0
- package/dist/i18n/format.d.ts +22 -0
- package/dist/i18n/format.d.ts.map +1 -0
- package/dist/i18n/format.js +49 -0
- package/dist/i18n/format.js.map +1 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +5 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/locales.d.ts +23 -0
- package/dist/i18n/locales.d.ts.map +1 -0
- package/dist/i18n/locales.js +25 -0
- package/dist/i18n/locales.js.map +1 -0
- package/dist/i18n/negotiate.d.ts +39 -0
- package/dist/i18n/negotiate.d.ts.map +1 -0
- package/dist/i18n/negotiate.js +63 -0
- package/dist/i18n/negotiate.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/rsql/coerce-rsql.d.ts +27 -0
- package/dist/rsql/coerce-rsql.d.ts.map +1 -0
- package/dist/rsql/coerce-rsql.js +121 -0
- package/dist/rsql/coerce-rsql.js.map +1 -0
- package/dist/rsql/index.d.ts +8 -0
- package/dist/rsql/index.d.ts.map +1 -0
- package/dist/rsql/index.js +9 -0
- package/dist/rsql/index.js.map +1 -0
- package/dist/rsql/load-request-url.d.ts +30 -0
- package/dist/rsql/load-request-url.d.ts.map +1 -0
- package/dist/rsql/load-request-url.js +67 -0
- package/dist/rsql/load-request-url.js.map +1 -0
- package/dist/rsql/parse-rsql.d.ts +35 -0
- package/dist/rsql/parse-rsql.d.ts.map +1 -0
- package/dist/rsql/parse-rsql.js +235 -0
- package/dist/rsql/parse-rsql.js.map +1 -0
- package/dist/rsql/rsql-operators.d.ts +36 -0
- package/dist/rsql/rsql-operators.d.ts.map +1 -0
- package/dist/rsql/rsql-operators.js +65 -0
- package/dist/rsql/rsql-operators.js.map +1 -0
- package/dist/rsql/rsql-values.d.ts +11 -0
- package/dist/rsql/rsql-values.d.ts.map +1 -0
- package/dist/rsql/rsql-values.js +26 -0
- package/dist/rsql/rsql-values.js.map +1 -0
- package/dist/rsql/serialize-rsql.d.ts +19 -0
- package/dist/rsql/serialize-rsql.d.ts.map +1 -0
- package/dist/rsql/serialize-rsql.js +71 -0
- package/dist/rsql/serialize-rsql.js.map +1 -0
- package/dist/rsql/sort-param.d.ts +20 -0
- package/dist/rsql/sort-param.d.ts.map +1 -0
- package/dist/rsql/sort-param.js +66 -0
- package/dist/rsql/sort-param.js.map +1 -0
- package/dist/types/BulkOutcome.d.ts +27 -0
- package/dist/types/BulkOutcome.d.ts.map +1 -0
- package/dist/types/BulkOutcome.js +8 -0
- package/dist/types/BulkOutcome.js.map +1 -0
- package/dist/types/Entity.d.ts +6 -0
- package/dist/types/Entity.d.ts.map +1 -0
- package/dist/types/Entity.js +3 -0
- package/dist/types/Entity.js.map +1 -0
- package/dist/types/EntityAction.d.ts +15 -0
- package/dist/types/EntityAction.d.ts.map +1 -0
- package/dist/types/EntityAction.js +18 -0
- package/dist/types/EntityAction.js.map +1 -0
- package/dist/types/EntityDraft.d.ts +47 -0
- package/dist/types/EntityDraft.d.ts.map +1 -0
- package/dist/types/EntityDraft.js +14 -0
- package/dist/types/EntityDraft.js.map +1 -0
- package/dist/types/EntityFiltering.d.ts +45 -0
- package/dist/types/EntityFiltering.d.ts.map +1 -0
- package/dist/types/EntityFiltering.js +30 -0
- package/dist/types/EntityFiltering.js.map +1 -0
- package/dist/types/EntityLoadRequest.d.ts +10 -0
- package/dist/types/EntityLoadRequest.d.ts.map +1 -0
- package/dist/types/EntityLoadRequest.js +3 -0
- package/dist/types/EntityLoadRequest.js.map +1 -0
- package/dist/types/EntityPage.d.ts +8 -0
- package/dist/types/EntityPage.d.ts.map +1 -0
- package/dist/types/EntityPage.js +3 -0
- package/dist/types/EntityPage.js.map +1 -0
- package/dist/types/EntityRowDraft.d.ts +79 -0
- package/dist/types/EntityRowDraft.d.ts.map +1 -0
- package/dist/types/EntityRowDraft.js +65 -0
- package/dist/types/EntityRowDraft.js.map +1 -0
- package/dist/types/EntitySelection.d.ts +117 -0
- package/dist/types/EntitySelection.d.ts.map +1 -0
- package/dist/types/EntitySelection.js +107 -0
- package/dist/types/EntitySelection.js.map +1 -0
- package/dist/types/EntitySorting.d.ts +7 -0
- package/dist/types/EntitySorting.d.ts.map +1 -0
- package/dist/types/EntitySorting.js +3 -0
- package/dist/types/EntitySorting.js.map +1 -0
- package/dist/types/Json.d.ts +37 -0
- package/dist/types/Json.d.ts.map +1 -0
- package/dist/types/Json.js +43 -0
- package/dist/types/Json.js.map +1 -0
- package/dist/types/StandardSchema.d.ts +45 -0
- package/dist/types/StandardSchema.d.ts.map +1 -0
- package/dist/types/StandardSchema.js +15 -0
- package/dist/types/StandardSchema.js.map +1 -0
- package/dist/types/UseCase.d.ts +10 -0
- package/dist/types/UseCase.d.ts.map +1 -0
- package/dist/types/UseCase.js +10 -0
- package/dist/types/UseCase.js.map +1 -0
- package/dist/wizard/index.d.ts +4 -0
- package/dist/wizard/index.d.ts.map +1 -0
- package/dist/wizard/index.js +5 -0
- package/dist/wizard/index.js.map +1 -0
- package/dist/wizard/wizard-definition.d.ts +108 -0
- package/dist/wizard/wizard-definition.d.ts.map +1 -0
- package/dist/wizard/wizard-definition.js +125 -0
- package/dist/wizard/wizard-definition.js.map +1 -0
- package/dist/wizard/wizard-navigation.d.ts +81 -0
- package/dist/wizard/wizard-navigation.d.ts.map +1 -0
- package/dist/wizard/wizard-navigation.js +139 -0
- package/dist/wizard/wizard-navigation.js.map +1 -0
- package/dist/wizard/wizard-state.d.ts +89 -0
- package/dist/wizard/wizard-state.d.ts.map +1 -0
- package/dist/wizard/wizard-state.js +103 -0
- package/dist/wizard/wizard-state.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import { EntifixBuildError } from '../../base-entities/entifix-error/index.js';
|
|
3
|
+
import { extractMetaAccessors } from '../helpers/index.js';
|
|
4
|
+
import { EntityCollectionLink } from '../links/entity-collection-link/index.js';
|
|
5
|
+
import { EntityLink } from '../links/entity-link/index.js';
|
|
6
|
+
//#region Validations
|
|
7
|
+
function assertEntityObject(entityConstructor, entityData) {
|
|
8
|
+
if (typeof entityData !== 'object') {
|
|
9
|
+
throw new EntifixBuildError(`Failed to deserialize entity of type ${entityConstructor.name}. Expected an object but got ${typeof entityData}`, undefined, {
|
|
10
|
+
entityData,
|
|
11
|
+
entityConstructor: entityConstructor.name
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function assertEntityCollection(entityConstructor, entityCollectionData) {
|
|
16
|
+
if (!Array.isArray(entityCollectionData)) {
|
|
17
|
+
throw new EntifixBuildError(`Failed to deserialize entity collection of type ${entityConstructor.name}. Expected an array but got ${typeof entityCollectionData}`, undefined, {
|
|
18
|
+
entityCollectionData,
|
|
19
|
+
entityConstructor: entityConstructor.name
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region Recursive deserialization
|
|
25
|
+
function isEmbeddedData(value) {
|
|
26
|
+
return value != null && typeof value === 'object' && !Array.isArray(value);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Populates a to-one relation from its raw value. An object is treated as
|
|
30
|
+
* embedded data and deserialized into an instance; any scalar is treated as a
|
|
31
|
+
* foreign key and stored as the link id (resolved lazily via `reload`).
|
|
32
|
+
*/ function populateEntityLink(link, rawValue) {
|
|
33
|
+
if (rawValue == null) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (isEmbeddedData(rawValue)) {
|
|
37
|
+
link.setValue(buildEntityInstance(link.entityConstructor, rawValue));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
link.setId(rawValue);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Populates a to-many relation from its raw array, mixing embedded objects
|
|
44
|
+
* (deserialized) and scalar foreign keys as they appear.
|
|
45
|
+
*/ function populateEntityCollectionLink(link, rawValue) {
|
|
46
|
+
if (!Array.isArray(rawValue)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const values = [];
|
|
50
|
+
const ids = [];
|
|
51
|
+
for (const item of rawValue){
|
|
52
|
+
if (isEmbeddedData(item)) {
|
|
53
|
+
values.push(buildEntityInstance(link.entityConstructor, item));
|
|
54
|
+
} else if (item != null) {
|
|
55
|
+
ids.push(item);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (values.length > 0) {
|
|
59
|
+
link.setValues(values);
|
|
60
|
+
} else if (ids.length > 0) {
|
|
61
|
+
link.setIds(ids);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function buildEntityInstance(entityConstructor, entityData) {
|
|
65
|
+
const metaAccessors = extractMetaAccessors(entityConstructor);
|
|
66
|
+
const newInstance = new entityConstructor();
|
|
67
|
+
metaAccessors// Entities decorate their accessors on the getter, so the writable property
|
|
68
|
+
// list comes from getter-kind metadata; read-only/hidden ones are skipped.
|
|
69
|
+
// The value is then assigned through the instance's JS setter.
|
|
70
|
+
.filter((metaAccessor)=>!metaAccessor.hidden && !metaAccessor.readonly && metaAccessor.kind === 'getter').forEach((metaAccessor)=>{
|
|
71
|
+
var _metaAccessor_alias;
|
|
72
|
+
const propertyName = (_metaAccessor_alias = metaAccessor.alias) != null ? _metaAccessor_alias : metaAccessor.name;
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
|
+
const current = newInstance[metaAccessor.name];
|
|
75
|
+
// Relations are pre-initialized as link instances by the entity
|
|
76
|
+
// constructor. Their accessors are read-only getters, so populate the
|
|
77
|
+
// existing link from the raw value rather than assigning through a setter.
|
|
78
|
+
if (current instanceof EntityLink) {
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
80
|
+
populateEntityLink(current, entityData[propertyName]);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (current instanceof EntityCollectionLink) {
|
|
84
|
+
populateEntityCollectionLink(current, entityData[propertyName]);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// Owned rows are rebuilt through the child's own accessors, the mirror of
|
|
88
|
+
// what `serializeEntity` wrote. Without this the member would hold plain
|
|
89
|
+
// objects while its declared type says otherwise — and a child whose
|
|
90
|
+
// accessor carries an `alias` would keep the storage column name as its
|
|
91
|
+
// property, which is exactly the mapping layer the serializer exists to
|
|
92
|
+
// remove.
|
|
93
|
+
if (metaAccessor.type === 'composition' && metaAccessor.childType) {
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
+
const rows = entityData[propertyName];
|
|
96
|
+
if (Array.isArray(rows)) {
|
|
97
|
+
const childType = metaAccessor.childType();
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
|
+
newInstance[metaAccessor.name] = rows.map((row)=>buildEntityInstance(childType, row));
|
|
100
|
+
}
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (propertyName in entityData && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
104
|
+
entityData[propertyName] !== undefined) {
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
106
|
+
newInstance[metaAccessor.name] = entityData[propertyName];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return newInstance;
|
|
110
|
+
}
|
|
111
|
+
function deserializeEntity(entityConstructor, entityData) {
|
|
112
|
+
if (entityData == null) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
assertEntityObject(entityConstructor, entityData);
|
|
116
|
+
return buildEntityInstance(entityConstructor, entityData);
|
|
117
|
+
}
|
|
118
|
+
function deserializeCollection(entityConstructor, entityCollectionData, failOnNull) {
|
|
119
|
+
if (entityCollectionData == null && !failOnNull) {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
assertEntityCollection(entityConstructor, entityCollectionData);
|
|
123
|
+
// Recurse into nested arrays so a collection can hold arrays of arrays,
|
|
124
|
+
// and reuse the single-entity validation/build for the leaf items.
|
|
125
|
+
return entityCollectionData.map((item)=>Array.isArray(item) ? deserializeCollection(entityConstructor, item, failOnNull) : deserializeEntity(entityConstructor, item));
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region Effect factories
|
|
129
|
+
const toEntifixBuildError = (message, context)=>(error)=>error instanceof EntifixBuildError ? error : new EntifixBuildError(message, error, context);
|
|
130
|
+
export const deserializeSingleEntity = (entityConstructor, entityData)=>Effect.try({
|
|
131
|
+
try: ()=>deserializeEntity(entityConstructor, entityData),
|
|
132
|
+
catch: toEntifixBuildError(`Failed to deserialize entity of type ${entityConstructor.name}`, {
|
|
133
|
+
entityData,
|
|
134
|
+
entityConstructor: entityConstructor.name
|
|
135
|
+
})
|
|
136
|
+
});
|
|
137
|
+
export const deserializeEntityCollection = (entityConstructor, entityCollectionData, failOnNull = false)=>Effect.try({
|
|
138
|
+
try: ()=>deserializeCollection(entityConstructor, entityCollectionData, failOnNull),
|
|
139
|
+
catch: toEntifixBuildError(`Failed to deserialize entity collection of type ${entityConstructor.name}`, {
|
|
140
|
+
entityCollectionData,
|
|
141
|
+
entityConstructor: entityConstructor.name
|
|
142
|
+
})
|
|
143
|
+
}); //#endregion
|
|
144
|
+
|
|
145
|
+
//# sourceMappingURL=deserialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/entity-definition/serializer/deserialize.ts"],"sourcesContent":["import { Effect } from 'effect';\n\nimport { EntifixBuildError } from '../../base-entities/entifix-error/index.js';\nimport { Entity, EntityConstructor, EntityId } from '../../types/Entity.js';\nimport { extractMetaAccessors } from '../helpers/index.js';\nimport { EntityCollectionLink } from '../links/entity-collection-link/index.js';\nimport { EntityLink } from '../links/entity-link/index.js';\n\n/**\n * Result of deserializing a value against an entity constructor. A value can be\n * a single entity, a missing entity (`undefined`) or an arbitrarily nested\n * array of those — which lets collections recurse into arrays of arrays.\n */\ntype DeserializedEntity<TEntity extends Entity> =\n TEntity | undefined | DeserializedEntity<TEntity>[];\n\n//#region Validations\n\nfunction assertEntityObject<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n entityData: unknown,\n): asserts entityData is object {\n if (typeof entityData !== 'object') {\n throw new EntifixBuildError(\n `Failed to deserialize entity of type ${\n entityConstructor.name\n }. Expected an object but got ${typeof entityData}`,\n undefined,\n {\n entityData,\n entityConstructor: entityConstructor.name,\n },\n );\n }\n}\n\nfunction assertEntityCollection<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n entityCollectionData: unknown,\n): asserts entityCollectionData is unknown[] {\n if (!Array.isArray(entityCollectionData)) {\n throw new EntifixBuildError(\n `Failed to deserialize entity collection of type ${\n entityConstructor.name\n }. Expected an array but got ${typeof entityCollectionData}`,\n undefined,\n {\n entityCollectionData,\n entityConstructor: entityConstructor.name,\n },\n );\n }\n}\n\n//#endregion\n\n//#region Recursive deserialization\n\nfunction isEmbeddedData(value: unknown): value is object {\n return value != null && typeof value === 'object' && !Array.isArray(value);\n}\n\n/**\n * Populates a to-one relation from its raw value. An object is treated as\n * embedded data and deserialized into an instance; any scalar is treated as a\n * foreign key and stored as the link id (resolved lazily via `reload`).\n */\nfunction populateEntityLink<TEntity extends Entity>(\n link: EntityLink<TEntity>,\n rawValue: unknown,\n): void {\n if (rawValue == null) {\n return;\n }\n if (isEmbeddedData(rawValue)) {\n link.setValue(buildEntityInstance(link.entityConstructor, rawValue));\n return;\n }\n link.setId(rawValue as EntityId);\n}\n\n/**\n * Populates a to-many relation from its raw array, mixing embedded objects\n * (deserialized) and scalar foreign keys as they appear.\n */\nfunction populateEntityCollectionLink<TEntity extends Entity>(\n link: EntityCollectionLink<TEntity>,\n rawValue: unknown,\n): void {\n if (!Array.isArray(rawValue)) {\n return;\n }\n const values: TEntity[] = [];\n const ids: EntityId[] = [];\n for (const item of rawValue) {\n if (isEmbeddedData(item)) {\n values.push(buildEntityInstance(link.entityConstructor, item));\n } else if (item != null) {\n ids.push(item as EntityId);\n }\n }\n if (values.length > 0) {\n link.setValues(values);\n } else if (ids.length > 0) {\n link.setIds(ids);\n }\n}\n\nfunction buildEntityInstance<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n entityData: object,\n): TEntity {\n const metaAccessors = extractMetaAccessors(entityConstructor);\n\n const newInstance = new entityConstructor();\n metaAccessors\n // Entities decorate their accessors on the getter, so the writable property\n // list comes from getter-kind metadata; read-only/hidden ones are skipped.\n // The value is then assigned through the instance's JS setter.\n .filter(\n metaAccessor =>\n !metaAccessor.hidden &&\n !metaAccessor.readonly &&\n metaAccessor.kind === 'getter',\n )\n .forEach(metaAccessor => {\n const propertyName = metaAccessor.alias ?? metaAccessor.name;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const current = (newInstance as any)[metaAccessor.name];\n\n // Relations are pre-initialized as link instances by the entity\n // constructor. Their accessors are read-only getters, so populate the\n // existing link from the raw value rather than assigning through a setter.\n if (current instanceof EntityLink) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n populateEntityLink(current, (entityData as any)[propertyName]);\n return;\n }\n if (current instanceof EntityCollectionLink) {\n populateEntityCollectionLink(\n current,\n (entityData as any)[propertyName],\n );\n return;\n }\n\n // Owned rows are rebuilt through the child's own accessors, the mirror of\n // what `serializeEntity` wrote. Without this the member would hold plain\n // objects while its declared type says otherwise — and a child whose\n // accessor carries an `alias` would keep the storage column name as its\n // property, which is exactly the mapping layer the serializer exists to\n // remove.\n if (metaAccessor.type === 'composition' && metaAccessor.childType) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const rows = (entityData as any)[propertyName];\n if (Array.isArray(rows)) {\n const childType =\n metaAccessor.childType() as EntityConstructor<Entity>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (newInstance as any)[metaAccessor.name] = rows.map(row =>\n buildEntityInstance(childType, row as object),\n );\n }\n return;\n }\n\n if (\n propertyName in entityData &&\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (entityData as any)[propertyName] !== undefined\n ) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (newInstance as any)[metaAccessor.name] = (entityData as any)[\n propertyName\n ];\n }\n });\n\n return newInstance;\n}\n\nfunction deserializeEntity<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n entityData: unknown,\n): TEntity | undefined {\n if (entityData == null) {\n return undefined;\n }\n assertEntityObject(entityConstructor, entityData);\n return buildEntityInstance(entityConstructor, entityData);\n}\n\nfunction deserializeCollection<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n entityCollectionData: unknown,\n failOnNull: boolean,\n): DeserializedEntity<TEntity>[] {\n if (entityCollectionData == null && !failOnNull) {\n return [];\n }\n assertEntityCollection(entityConstructor, entityCollectionData);\n\n // Recurse into nested arrays so a collection can hold arrays of arrays,\n // and reuse the single-entity validation/build for the leaf items.\n return entityCollectionData.map(item =>\n Array.isArray(item)\n ? deserializeCollection(entityConstructor, item, failOnNull)\n : deserializeEntity(entityConstructor, item),\n );\n}\n\n//#endregion\n\n//#region Effect factories\n\nconst toEntifixBuildError =\n (message: string, context: Record<string, unknown>) => (error: unknown) =>\n error instanceof EntifixBuildError\n ? error\n : new EntifixBuildError(message, error, context);\n\nexport const deserializeSingleEntity = <TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n entityData: unknown,\n) =>\n Effect.try({\n try: () => deserializeEntity(entityConstructor, entityData),\n catch: toEntifixBuildError(\n `Failed to deserialize entity of type ${entityConstructor.name}`,\n {\n entityData,\n entityConstructor: entityConstructor.name,\n },\n ),\n });\n\nexport const deserializeEntityCollection = <TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n entityCollectionData: unknown,\n failOnNull = false,\n) =>\n Effect.try({\n try: () =>\n deserializeCollection(\n entityConstructor,\n entityCollectionData,\n failOnNull,\n ),\n catch: toEntifixBuildError(\n `Failed to deserialize entity collection of type ${entityConstructor.name}`,\n {\n entityCollectionData,\n entityConstructor: entityConstructor.name,\n },\n ),\n });\n\n//#endregion\n"],"names":["Effect","EntifixBuildError","extractMetaAccessors","EntityCollectionLink","EntityLink","assertEntityObject","entityConstructor","entityData","name","undefined","assertEntityCollection","entityCollectionData","Array","isArray","isEmbeddedData","value","populateEntityLink","link","rawValue","setValue","buildEntityInstance","setId","populateEntityCollectionLink","values","ids","item","push","length","setValues","setIds","metaAccessors","newInstance","filter","metaAccessor","hidden","readonly","kind","forEach","propertyName","alias","current","type","childType","rows","map","row","deserializeEntity","deserializeCollection","failOnNull","toEntifixBuildError","message","context","error","deserializeSingleEntity","try","catch","deserializeEntityCollection"],"mappings":"AAAA,SAASA,MAAM,QAAQ,SAAS;AAEhC,SAASC,iBAAiB,QAAQ,6CAA6C;AAE/E,SAASC,oBAAoB,QAAQ,sBAAsB;AAC3D,SAASC,oBAAoB,QAAQ,2CAA2C;AAChF,SAASC,UAAU,QAAQ,gCAAgC;AAU3D,qBAAqB;AAErB,SAASC,mBACPC,iBAA6C,EAC7CC,UAAmB;IAEnB,IAAI,OAAOA,eAAe,UAAU;QAClC,MAAM,IAAIN,kBACR,CAAC,qCAAqC,EACpCK,kBAAkBE,IAAI,CACvB,6BAA6B,EAAE,OAAOD,YAAY,EACnDE,WACA;YACEF;YACAD,mBAAmBA,kBAAkBE,IAAI;QAC3C;IAEJ;AACF;AAEA,SAASE,uBACPJ,iBAA6C,EAC7CK,oBAA6B;IAE7B,IAAI,CAACC,MAAMC,OAAO,CAACF,uBAAuB;QACxC,MAAM,IAAIV,kBACR,CAAC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,mBAAmBC;AAChD;AAEA,SAASwC,sBACPzC,iBAA6C,EAC7CK,oBAA6B,EAC7BqC,UAAmB;IAEnB,IAAIrC,wBAAwB,QAAQ,CAACqC,YAAY;QAC/C,OAAO,EAAE;IACX;IACAtC,uBAAuBJ,mBAAmBK;IAE1C,wEAAwE;IACxE,mEAAmE;IACnE,OAAOA,qBAAqBiC,GAAG,CAACnB,CAAAA,OAC9Bb,MAAMC,OAAO,CAACY,QACVsB,sBAAsBzC,mBAAmBmB,MAAMuB,cAC/CF,kBAAkBxC,mBAAmBmB;AAE7C;AAEA,YAAY;AAEZ,0BAA0B;AAE1B,MAAMwB,sBACJ,CAACC,SAAiBC,UAAqC,CAACC,QACtDA,iBAAiBnD,oBACbmD,QACA,IAAInD,kBAAkBiD,SAASE,OAAOD;AAE9C,OAAO,MAAME,0BAA0B,CACrC/C,mBACAC,aAEAP,OAAOsD,GAAG,CAAC;QACTA,KAAK,IAAMR,kBAAkBxC,mBAAmBC;QAChDgD,OAAON,oBACL,CAAC,qCAAqC,EAAE3C,kBAAkBE,IAAI,EAAE,EAChE;YACED;YACAD,mBAAmBA,kBAAkBE,IAAI;QAC3C;IAEJ,GAAG;AAEL,OAAO,MAAMgD,8BAA8B,CACzClD,mBACAK,sBACAqC,aAAa,KAAK,GAElBhD,OAAOsD,GAAG,CAAC;QACTA,KAAK,IACHP,sBACEzC,mBACAK,sBACAqC;QAEJO,OAAON,oBACL,CAAC,gDAAgD,EAAE3C,kBAAkBE,IAAI,EAAE,EAC3E;YACEG;YACAL,mBAAmBA,kBAAkBE,IAAI;QAC3C;IAEJ,GAAG,CAEL,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entity-definition/serializer/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/entity-definition/serializer/index.ts"],"sourcesContent":["export * from './deserialize.js';\nexport * from './serialize.js';\n"],"names":[],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,iBAAiB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Entity, EntityConstructor } from '../../types/Entity.js';
|
|
2
|
+
/**
|
|
3
|
+
* A plain, JSON-safe representation of an entity — the inverse of
|
|
4
|
+
* {@link buildEntityInstance}. Relations collapse to the shape the deserializer
|
|
5
|
+
* expects to round-trip:
|
|
6
|
+
* - an {@link EntityLink} → the embedded plain object when loaded, otherwise the
|
|
7
|
+
* scalar foreign-key id.
|
|
8
|
+
* - an {@link EntityCollectionLink} → an array mixing embedded objects (loaded)
|
|
9
|
+
* or scalar ids.
|
|
10
|
+
* - a `composition` member → an array of plain child objects, each walked with
|
|
11
|
+
* the child's own accessor metadata.
|
|
12
|
+
*
|
|
13
|
+
* This one serialization serves both persistence (entity → Mongo document) and
|
|
14
|
+
* transport (entity → HTTP wire shape), so a value written by an adapter reads
|
|
15
|
+
* back identically through {@link deserializeSingleEntity}.
|
|
16
|
+
*/
|
|
17
|
+
export type SerializedEntity = Record<string, unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* Serializes an entity instance into a plain object, walking the same accessor
|
|
20
|
+
* metadata the deserializer reads (getter-kind, not hidden/readonly), keyed by
|
|
21
|
+
* `alias ?? name`. `undefined` values are omitted so absent optionals and
|
|
22
|
+
* unresolved relations don't pollute the output.
|
|
23
|
+
*/
|
|
24
|
+
export declare function serializeEntity<TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, instance: TEntity): SerializedEntity;
|
|
25
|
+
export declare function serializeEntityCollection<TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, instances: readonly TEntity[]): SerializedEntity[];
|
|
26
|
+
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/entity-definition/serializer/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAMlE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA4CvD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAS,MAAM,EACpD,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAC7C,QAAQ,EAAE,OAAO,GAChB,gBAAgB,CAoClB;AAED,wBAAgB,yBAAyB,CAAC,OAAO,SAAS,MAAM,EAC9D,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAC7C,SAAS,EAAE,SAAS,OAAO,EAAE,GAC5B,gBAAgB,EAAE,CAIpB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { extractMetaAccessors } from '../helpers/index.js';
|
|
2
|
+
import { EntityCollectionLink } from '../links/entity-collection-link/index.js';
|
|
3
|
+
import { EntityLink } from '../links/entity-link/index.js';
|
|
4
|
+
function serializeLink(link) {
|
|
5
|
+
var _link_id;
|
|
6
|
+
if (link.isLoaded && link.value !== undefined) {
|
|
7
|
+
return serializeEntity(link.entityConstructor, link.value);
|
|
8
|
+
}
|
|
9
|
+
return (_link_id = link.id) != null ? _link_id : undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Owned rows, each flattened through the child's own accessors.
|
|
13
|
+
*
|
|
14
|
+
* A child is a class whose private fields carry its state, so passing the array
|
|
15
|
+
* through untouched would put `[{}, {}]` on the wire and in the database — the
|
|
16
|
+
* rows would silently never persist. Walking each one is also what keeps a
|
|
17
|
+
* child's `alias` meaning what it means everywhere else: its column name.
|
|
18
|
+
*
|
|
19
|
+
* It reads a plain object just as happily as an instance, which is deliberate:
|
|
20
|
+
* a row that never went through the deserializer (a fixture, a hand-built
|
|
21
|
+
* command payload) serializes to the same document.
|
|
22
|
+
*/ function serializeComposition(rows, childType) {
|
|
23
|
+
return rows.map((row)=>serializeEntity(childType, row));
|
|
24
|
+
}
|
|
25
|
+
function serializeCollectionLink(link) {
|
|
26
|
+
if (link.isLoaded && link.values !== undefined) {
|
|
27
|
+
return link.values.map((value)=>serializeEntity(link.entityConstructor, value));
|
|
28
|
+
}
|
|
29
|
+
const ids = link.ids;
|
|
30
|
+
return ids.length > 0 ? ids : undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Serializes an entity instance into a plain object, walking the same accessor
|
|
34
|
+
* metadata the deserializer reads (getter-kind, not hidden/readonly), keyed by
|
|
35
|
+
* `alias ?? name`. `undefined` values are omitted so absent optionals and
|
|
36
|
+
* unresolved relations don't pollute the output.
|
|
37
|
+
*/ export function serializeEntity(entityConstructor, instance) {
|
|
38
|
+
const result = {};
|
|
39
|
+
extractMetaAccessors(entityConstructor).filter((metaAccessor)=>!metaAccessor.hidden && !metaAccessor.readonly && metaAccessor.kind === 'getter').forEach((metaAccessor)=>{
|
|
40
|
+
var _metaAccessor_alias;
|
|
41
|
+
const propertyName = (_metaAccessor_alias = metaAccessor.alias) != null ? _metaAccessor_alias : metaAccessor.name;
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
const value = instance[metaAccessor.name];
|
|
44
|
+
let serialized;
|
|
45
|
+
if (value instanceof EntityLink) {
|
|
46
|
+
serialized = serializeLink(value);
|
|
47
|
+
} else if (value instanceof EntityCollectionLink) {
|
|
48
|
+
serialized = serializeCollectionLink(value);
|
|
49
|
+
} else if (metaAccessor.type === 'composition' && metaAccessor.childType !== undefined && Array.isArray(value)) {
|
|
50
|
+
serialized = serializeComposition(value, metaAccessor.childType());
|
|
51
|
+
} else {
|
|
52
|
+
serialized = value;
|
|
53
|
+
}
|
|
54
|
+
if (serialized !== undefined) {
|
|
55
|
+
result[propertyName] = serialized;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
export function serializeEntityCollection(entityConstructor, instances) {
|
|
61
|
+
return instances.map((instance)=>serializeEntity(entityConstructor, instance));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=serialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/entity-definition/serializer/serialize.ts"],"sourcesContent":["import { Entity, EntityConstructor } from '../../types/Entity.js';\nimport { extractMetaAccessors } from '../helpers/index.js';\nimport { EntityCollectionLink } from '../links/entity-collection-link/index.js';\nimport { EntityLink } from '../links/entity-link/index.js';\nimport type { ChildConstructor } from '../meta-entities/meta-accessor/index.js';\n\n/**\n * A plain, JSON-safe representation of an entity — the inverse of\n * {@link buildEntityInstance}. Relations collapse to the shape the deserializer\n * expects to round-trip:\n * - an {@link EntityLink} → the embedded plain object when loaded, otherwise the\n * scalar foreign-key id.\n * - an {@link EntityCollectionLink} → an array mixing embedded objects (loaded)\n * or scalar ids.\n * - a `composition` member → an array of plain child objects, each walked with\n * the child's own accessor metadata.\n *\n * This one serialization serves both persistence (entity → Mongo document) and\n * transport (entity → HTTP wire shape), so a value written by an adapter reads\n * back identically through {@link deserializeSingleEntity}.\n */\nexport type SerializedEntity = Record<string, unknown>;\n\nfunction serializeLink<TEntity extends Entity>(\n link: EntityLink<TEntity>,\n): unknown {\n if (link.isLoaded && link.value !== undefined) {\n return serializeEntity(link.entityConstructor, link.value);\n }\n return link.id ?? undefined;\n}\n\n/**\n * Owned rows, each flattened through the child's own accessors.\n *\n * A child is a class whose private fields carry its state, so passing the array\n * through untouched would put `[{}, {}]` on the wire and in the database — the\n * rows would silently never persist. Walking each one is also what keeps a\n * child's `alias` meaning what it means everywhere else: its column name.\n *\n * It reads a plain object just as happily as an instance, which is deliberate:\n * a row that never went through the deserializer (a fixture, a hand-built\n * command payload) serializes to the same document.\n */\nfunction serializeComposition(\n rows: readonly unknown[],\n childType: ChildConstructor,\n): unknown {\n return rows.map(row =>\n serializeEntity(childType as EntityConstructor<Entity>, row as Entity),\n );\n}\n\nfunction serializeCollectionLink<TEntity extends Entity>(\n link: EntityCollectionLink<TEntity>,\n): unknown {\n if (link.isLoaded && link.values !== undefined) {\n return link.values.map(value =>\n serializeEntity(link.entityConstructor, value),\n );\n }\n const ids = link.ids;\n return ids.length > 0 ? ids : undefined;\n}\n\n/**\n * Serializes an entity instance into a plain object, walking the same accessor\n * metadata the deserializer reads (getter-kind, not hidden/readonly), keyed by\n * `alias ?? name`. `undefined` values are omitted so absent optionals and\n * unresolved relations don't pollute the output.\n */\nexport function serializeEntity<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n instance: TEntity,\n): SerializedEntity {\n const result: SerializedEntity = {};\n\n extractMetaAccessors(entityConstructor)\n .filter(\n metaAccessor =>\n !metaAccessor.hidden &&\n !metaAccessor.readonly &&\n metaAccessor.kind === 'getter',\n )\n .forEach(metaAccessor => {\n const propertyName = metaAccessor.alias ?? metaAccessor.name;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const value = (instance as any)[metaAccessor.name];\n\n let serialized: unknown;\n if (value instanceof EntityLink) {\n serialized = serializeLink(value);\n } else if (value instanceof EntityCollectionLink) {\n serialized = serializeCollectionLink(value);\n } else if (\n metaAccessor.type === 'composition' &&\n metaAccessor.childType !== undefined &&\n Array.isArray(value)\n ) {\n serialized = serializeComposition(value, metaAccessor.childType());\n } else {\n serialized = value;\n }\n\n if (serialized !== undefined) {\n result[propertyName as string] = serialized;\n }\n });\n\n return result;\n}\n\nexport function serializeEntityCollection<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n instances: readonly TEntity[],\n): SerializedEntity[] {\n return instances.map(instance =>\n serializeEntity(entityConstructor, instance),\n );\n}\n"],"names":["extractMetaAccessors","EntityCollectionLink","EntityLink","serializeLink","link","isLoaded","value","undefined","serializeEntity","entityConstructor","id","serializeComposition","rows","childType","map","row","serializeCollectionLink","values","ids","length","instance","result","filter","metaAccessor","hidden","readonly","kind","forEach","propertyName","alias","name","serialized","type","Array","isArray","serializeEntityCollection","instances"],"mappings":"AACA,SAASA,oBAAoB,QAAQ,sBAAsB;AAC3D,SAASC,oBAAoB,QAAQ,2CAA2C;AAChF,SAASC,UAAU,QAAQ,gCAAgC;AAoB3D,SAASC,cACPC,IAAyB;QAKlBA;IAHP,IAAIA,KAAKC,QAAQ,IAAID,KAAKE,KAAK,KAAKC,WAAW;QAC7C,OAAOC,gBAAgBJ,KAAKK,iBAAiB,EAAEL,KAAKE,KAAK;IAC3D;IACA,QAAOF,WAAAA,KAAKM,EAAE,YAAPN,WAAWG;AACpB;AAEA;;;;;;;;;;;CAWC,GACD,SAASI,qBACPC,IAAwB,EACxBC,SAA2B;IAE3B,OAAOD,KAAKE,GAAG,CAACC,CAAAA,MACdP,gBAAgBK,WAAwCE;AAE5D;AAEA,SAASC,wBACPZ,IAAmC;IAEnC,IAAIA,KAAKC,QAAQ,IAAID,KAAKa,MAAM,KAAKV,WAAW;QAC9C,OAAOH,KAAKa,MAAM,CAACH,GAAG,CAACR,CAAAA,QACrBE,gBAAgBJ,KAAKK,iBAAiB,EAAEH;IAE5C;IACA,MAAMY,MAAMd,KAAKc,GAAG;IACpB,OAAOA,IAAIC,MAAM,GAAG,IAAID,MAAMX;AAChC;AAEA;;;;;CAKC,GACD,OAAO,SAASC,gBACdC,iBAA6C,EAC7CW,QAAiB;IAEjB,MAAMC,SAA2B,CAAC;IAElCrB,qBAAqBS,mBAClBa,MAAM,CACLC,CAAAA,eACE,CAACA,aAAaC,MAAM,IACpB,CAACD,aAAaE,QAAQ,IACtBF,aAAaG,IAAI,KAAK,UAEzBC,OAAO,CAACJ,CAAAA;YACcA;QAArB,MAAMK,gBAAeL,sBAAAA,aAAaM,KAAK,YAAlBN,sBAAsBA,aAAaO,IAAI;QAC5D,8DAA8D;QAC9D,MAAMxB,QAAQ,AAACc,QAAgB,CAACG,aAAaO,IAAI,CAAC;QAElD,IAAIC;QACJ,IAAIzB,iBAAiBJ,YAAY;YAC/B6B,aAAa5B,cAAcG;QAC7B,OAAO,IAAIA,iBAAiBL,sBAAsB;YAChD8B,aAAaf,wBAAwBV;QACvC,OAAO,IACLiB,aAAaS,IAAI,KAAK,iBACtBT,aAAaV,SAAS,KAAKN,aAC3B0B,MAAMC,OAAO,CAAC5B,QACd;YACAyB,aAAapB,qBAAqBL,OAAOiB,aAAaV,SAAS;QACjE,OAAO;YACLkB,aAAazB;QACf;QAEA,IAAIyB,eAAexB,WAAW;YAC5Bc,MAAM,CAACO,aAAuB,GAAGG;QACnC;IACF;IAEF,OAAOV;AACT;AAEA,OAAO,SAASc,0BACd1B,iBAA6C,EAC7C2B,SAA6B;IAE7B,OAAOA,UAAUtB,GAAG,CAACM,CAAAA,WACnBZ,gBAAgBC,mBAAmBW;AAEvC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether an event name is matched by a subscription pattern, using AMQP topic
|
|
3
|
+
* semantics: `*` matches exactly one dot-separated word, `#` matches zero or
|
|
4
|
+
* more.
|
|
5
|
+
*
|
|
6
|
+
* The broker does this itself in production — a subscriber binds its pattern and
|
|
7
|
+
* never sees a non-matching message. This exists for the places that have no
|
|
8
|
+
* broker: the in-memory bus double, and any register check that has to decide
|
|
9
|
+
* whether a declared `subscriptions` entry is covered by someone's
|
|
10
|
+
* `publishedEvents`. Keeping one implementation of the semantics is what stops a
|
|
11
|
+
* test passing against a rule the real exchange applies differently.
|
|
12
|
+
*/
|
|
13
|
+
export declare function matchesEventPattern(pattern: string, name: string): boolean;
|
|
14
|
+
//# sourceMappingURL=event-pattern.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-pattern.d.ts","sourceRoot":"","sources":["../../src/envelope/event-pattern.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAyB1E"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether an event name is matched by a subscription pattern, using AMQP topic
|
|
3
|
+
* semantics: `*` matches exactly one dot-separated word, `#` matches zero or
|
|
4
|
+
* more.
|
|
5
|
+
*
|
|
6
|
+
* The broker does this itself in production — a subscriber binds its pattern and
|
|
7
|
+
* never sees a non-matching message. This exists for the places that have no
|
|
8
|
+
* broker: the in-memory bus double, and any register check that has to decide
|
|
9
|
+
* whether a declared `subscriptions` entry is covered by someone's
|
|
10
|
+
* `publishedEvents`. Keeping one implementation of the semantics is what stops a
|
|
11
|
+
* test passing against a rule the real exchange applies differently.
|
|
12
|
+
*/ export function matchesEventPattern(pattern, name) {
|
|
13
|
+
const match = (patternWords, nameWords)=>{
|
|
14
|
+
if (patternWords.length === 0) {
|
|
15
|
+
return nameWords.length === 0;
|
|
16
|
+
}
|
|
17
|
+
const [head, ...rest] = patternWords;
|
|
18
|
+
if (head === '#') {
|
|
19
|
+
// Zero words, or one more consumed and `#` tried again.
|
|
20
|
+
return match(rest, nameWords) || nameWords.length > 0 && match(patternWords, nameWords.slice(1));
|
|
21
|
+
}
|
|
22
|
+
if (nameWords.length === 0) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return (head === '*' || head === nameWords[0]) && match(rest, nameWords.slice(1));
|
|
26
|
+
};
|
|
27
|
+
return match(pattern.split('.'), name.split('.'));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=event-pattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/envelope/event-pattern.ts"],"sourcesContent":["/**\n * Whether an event name is matched by a subscription pattern, using AMQP topic\n * semantics: `*` matches exactly one dot-separated word, `#` matches zero or\n * more.\n *\n * The broker does this itself in production — a subscriber binds its pattern and\n * never sees a non-matching message. This exists for the places that have no\n * broker: the in-memory bus double, and any register check that has to decide\n * whether a declared `subscriptions` entry is covered by someone's\n * `publishedEvents`. Keeping one implementation of the semantics is what stops a\n * test passing against a rule the real exchange applies differently.\n */\nexport function matchesEventPattern(pattern: string, name: string): boolean {\n const match = (\n patternWords: readonly string[],\n nameWords: readonly string[],\n ): boolean => {\n if (patternWords.length === 0) {\n return nameWords.length === 0;\n }\n const [head, ...rest] = patternWords;\n if (head === '#') {\n // Zero words, or one more consumed and `#` tried again.\n return (\n match(rest, nameWords) ||\n (nameWords.length > 0 && match(patternWords, nameWords.slice(1)))\n );\n }\n if (nameWords.length === 0) {\n return false;\n }\n return (\n (head === '*' || head === nameWords[0]) && match(rest, nameWords.slice(1))\n );\n };\n\n return match(pattern.split('.'), name.split('.'));\n}\n"],"names":["matchesEventPattern","pattern","name","match","patternWords","nameWords","length","head","rest","slice","split"],"mappings":"AAAA;;;;;;;;;;;CAWC,GACD,OAAO,SAASA,oBAAoBC,OAAe,EAAEC,IAAY;IAC/D,MAAMC,QAAQ,CACZC,cACAC;QAEA,IAAID,aAAaE,MAAM,KAAK,GAAG;YAC7B,OAAOD,UAAUC,MAAM,KAAK;QAC9B;QACA,MAAM,CAACC,MAAM,GAAGC,KAAK,GAAGJ;QACxB,IAAIG,SAAS,KAAK;YAChB,wDAAwD;YACxD,OACEJ,MAAMK,MAAMH,cACXA,UAAUC,MAAM,GAAG,KAAKH,MAAMC,cAAcC,UAAUI,KAAK,CAAC;QAEjE;QACA,IAAIJ,UAAUC,MAAM,KAAK,GAAG;YAC1B,OAAO;QACT;QACA,OACE,AAACC,CAAAA,SAAS,OAAOA,SAASF,SAAS,CAAC,EAAE,AAAD,KAAMF,MAAMK,MAAMH,UAAUI,KAAK,CAAC;IAE3E;IAEA,OAAON,MAAMF,QAAQS,KAAK,CAAC,MAAMR,KAAKQ,KAAK,CAAC;AAC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/envelope/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/envelope/index.ts"],"sourcesContent":["export * from './event-pattern.js';\nexport * from './make-envelope.js';\nexport * from './read-envelope.js';\nexport * from './types.js';\n"],"names":[],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,aAAa"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { EntityMetadataDocument } from '../entity-definition/metadata/index.js';
|
|
2
|
+
import type { Entity, EntityConstructor } from '../types/Entity.js';
|
|
3
|
+
import type { EntityPage } from '../types/EntityPage.js';
|
|
4
|
+
import type { DomainEvent, EntifixEnvelope, EntifixEnvelopeLink, EntifixEnvelopeType, EntityCollectionEnvelope, EntityEnvelope, EntityMetadataEnvelope, EntityPageEnvelope, EventEnvelope } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* The transport-free envelope builder for payloads that are not serialized
|
|
7
|
+
* entities — `command`/`transactionRecord` messages carry their own `data`
|
|
8
|
+
* shapes (defined by the transactions layer), so they cannot go through the
|
|
9
|
+
* entity builders. `entity` is still the routing label (`meta.entity`): the
|
|
10
|
+
* target entity's `key` for a command, or the entity/transaction subject for an
|
|
11
|
+
* event.
|
|
12
|
+
*/
|
|
13
|
+
export declare function makeEnvelope<TData>(type: EntifixEnvelopeType, entity: string, data: TData, links?: EntifixEnvelopeLink[]): EntifixEnvelope<TData>;
|
|
14
|
+
/**
|
|
15
|
+
* The entity name carried in `meta.entity` — the same `key ?? name` resolution
|
|
16
|
+
* every adapter uses for collections and endpoints.
|
|
17
|
+
*/
|
|
18
|
+
export declare function envelopeEntityName<TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>): string;
|
|
19
|
+
export declare function makeEntityEnvelope<TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, instance: TEntity, links?: EntifixEnvelopeLink[]): EntityEnvelope;
|
|
20
|
+
export declare function makeEntityCollectionEnvelope<TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, instances: readonly TEntity[], links?: EntifixEnvelopeLink[]): EntityCollectionEnvelope;
|
|
21
|
+
export declare function makeEntityPageEnvelope<TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, page: EntityPage<TEntity>, links?: EntifixEnvelopeLink[]): EntityPageEnvelope<TEntity>;
|
|
22
|
+
/**
|
|
23
|
+
* The response to `GET /api/<entity>/$metadata`.
|
|
24
|
+
*
|
|
25
|
+
* Unlike its neighbours this serializes nothing: the document is already a plain
|
|
26
|
+
* shape of catalog keys and verbs, and it describes the class rather than any
|
|
27
|
+
* instance of it. `meta.entity` is still the target entity's key, which is what
|
|
28
|
+
* makes the document per entity rather than per service.
|
|
29
|
+
*/
|
|
30
|
+
export declare function makeEntityMetadataEnvelope<TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, document: EntityMetadataDocument, links?: EntifixEnvelopeLink[]): EntityMetadataEnvelope;
|
|
31
|
+
/**
|
|
32
|
+
* Frames a domain event for the bus.
|
|
33
|
+
*
|
|
34
|
+
* The split is mechanical and worth stating: everything about the *message*
|
|
35
|
+
* (name, id, source, time, correlation) goes to `meta.event`; the payload — what
|
|
36
|
+
* actually happened — is `data`. A consumer therefore never has to reach into
|
|
37
|
+
* metadata to read its own domain object, and never has to reach into the
|
|
38
|
+
* payload to find the routing key.
|
|
39
|
+
*
|
|
40
|
+
* `meta.entity` is deliberately left unset. A bus message says what it *is* in
|
|
41
|
+
* `meta.event.name`; only the HTTP arm needs an entity label, and inventing one
|
|
42
|
+
* here would put `settlement` on a message about a settlement *run*.
|
|
43
|
+
*/
|
|
44
|
+
export declare function makeEventEnvelope<TData>(event: DomainEvent<TData>): EventEnvelope<TData>;
|
|
45
|
+
//# sourceMappingURL=make-envelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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AAC,OAAO,CAAC,EACzB,KAAK,CAAC,EAAE,mBAAmB,EAAE,GAC5B,kBAAkB,CAAC,OAAO,CAAC,CAa7B;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,SAAS,MAAM,EAC/D,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAC7C,QAAQ,EAAE,sBAAsB,EAChC,KAAK,CAAC,EAAE,mBAAmB,EAAE,GAC5B,sBAAsB,CASxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EACrC,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,GACxB,aAAa,CAAC,KAAK,CAAC,CAMtB"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
3
|
+
import { extractMetaEntity } from '../entity-definition/helpers/index.js';
|
|
4
|
+
import { serializeEntity, serializeEntityCollection } from '../entity-definition/serializer/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* The transport-free envelope builder for payloads that are not serialized
|
|
7
|
+
* entities — `command`/`transactionRecord` messages carry their own `data`
|
|
8
|
+
* shapes (defined by the transactions layer), so they cannot go through the
|
|
9
|
+
* entity builders. `entity` is still the routing label (`meta.entity`): the
|
|
10
|
+
* target entity's `key` for a command, or the entity/transaction subject for an
|
|
11
|
+
* event.
|
|
12
|
+
*/ export function makeEnvelope(type, entity, data, links) {
|
|
13
|
+
return {
|
|
14
|
+
meta: _extends({
|
|
15
|
+
type,
|
|
16
|
+
entity
|
|
17
|
+
}, links ? {
|
|
18
|
+
links
|
|
19
|
+
} : {}),
|
|
20
|
+
data
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The entity name carried in `meta.entity` — the same `key ?? name` resolution
|
|
25
|
+
* every adapter uses for collections and endpoints.
|
|
26
|
+
*/ export function envelopeEntityName(entityConstructor) {
|
|
27
|
+
var _metaEntity_key;
|
|
28
|
+
const metaEntity = extractMetaEntity(entityConstructor);
|
|
29
|
+
return (_metaEntity_key = metaEntity.key) != null ? _metaEntity_key : metaEntity.name;
|
|
30
|
+
}
|
|
31
|
+
export function makeEntityEnvelope(entityConstructor, instance, links) {
|
|
32
|
+
return {
|
|
33
|
+
meta: _extends({
|
|
34
|
+
type: 'entity',
|
|
35
|
+
entity: envelopeEntityName(entityConstructor)
|
|
36
|
+
}, links ? {
|
|
37
|
+
links
|
|
38
|
+
} : {}),
|
|
39
|
+
data: serializeEntity(entityConstructor, instance)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function makeEntityCollectionEnvelope(entityConstructor, instances, links) {
|
|
43
|
+
return {
|
|
44
|
+
meta: _extends({
|
|
45
|
+
type: 'entityCollection',
|
|
46
|
+
entity: envelopeEntityName(entityConstructor)
|
|
47
|
+
}, links ? {
|
|
48
|
+
links
|
|
49
|
+
} : {}),
|
|
50
|
+
data: serializeEntityCollection(entityConstructor, instances)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function makeEntityPageEnvelope(entityConstructor, page, links) {
|
|
54
|
+
return {
|
|
55
|
+
meta: _extends({
|
|
56
|
+
type: 'entityPage',
|
|
57
|
+
entity: envelopeEntityName(entityConstructor)
|
|
58
|
+
}, links ? {
|
|
59
|
+
links
|
|
60
|
+
} : {}),
|
|
61
|
+
data: {
|
|
62
|
+
items: serializeEntityCollection(entityConstructor, page.items),
|
|
63
|
+
total: page.total,
|
|
64
|
+
request: page.request
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The response to `GET /api/<entity>/$metadata`.
|
|
70
|
+
*
|
|
71
|
+
* Unlike its neighbours this serializes nothing: the document is already a plain
|
|
72
|
+
* shape of catalog keys and verbs, and it describes the class rather than any
|
|
73
|
+
* instance of it. `meta.entity` is still the target entity's key, which is what
|
|
74
|
+
* makes the document per entity rather than per service.
|
|
75
|
+
*/ export function makeEntityMetadataEnvelope(entityConstructor, document, links) {
|
|
76
|
+
return {
|
|
77
|
+
meta: _extends({
|
|
78
|
+
type: 'entityMetadata',
|
|
79
|
+
entity: envelopeEntityName(entityConstructor)
|
|
80
|
+
}, links ? {
|
|
81
|
+
links
|
|
82
|
+
} : {}),
|
|
83
|
+
data: document
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Frames a domain event for the bus.
|
|
88
|
+
*
|
|
89
|
+
* The split is mechanical and worth stating: everything about the *message*
|
|
90
|
+
* (name, id, source, time, correlation) goes to `meta.event`; the payload — what
|
|
91
|
+
* actually happened — is `data`. A consumer therefore never has to reach into
|
|
92
|
+
* metadata to read its own domain object, and never has to reach into the
|
|
93
|
+
* payload to find the routing key.
|
|
94
|
+
*
|
|
95
|
+
* `meta.entity` is deliberately left unset. A bus message says what it *is* in
|
|
96
|
+
* `meta.event.name`; only the HTTP arm needs an entity label, and inventing one
|
|
97
|
+
* here would put `settlement` on a message about a settlement *run*.
|
|
98
|
+
*/ export function makeEventEnvelope(event) {
|
|
99
|
+
const { data } = event, eventMeta = _object_without_properties_loose(event, [
|
|
100
|
+
"data"
|
|
101
|
+
]);
|
|
102
|
+
return {
|
|
103
|
+
meta: {
|
|
104
|
+
type: 'event',
|
|
105
|
+
event: eventMeta
|
|
106
|
+
},
|
|
107
|
+
data
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//# sourceMappingURL=make-envelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/envelope/make-envelope.ts"],"sourcesContent":["import { extractMetaEntity } from '../entity-definition/helpers/index.js';\nimport type { EntityMetadataDocument } from '../entity-definition/metadata/index.js';\nimport {\n serializeEntity,\n serializeEntityCollection,\n} from '../entity-definition/serializer/index.js';\nimport type { Entity, EntityConstructor } from '../types/Entity.js';\nimport type { EntityPage } from '../types/EntityPage.js';\nimport type {\n DomainEvent,\n EntifixEnvelope,\n EntifixEnvelopeLink,\n EntifixEnvelopeType,\n EntityCollectionEnvelope,\n EntityEnvelope,\n EntityMetadataEnvelope,\n EntityPageEnvelope,\n EventEnvelope,\n} from './types.js';\n\n/**\n * The transport-free envelope builder for payloads that are not serialized\n * entities — `command`/`transactionRecord` messages carry their own `data`\n * shapes (defined by the transactions layer), so they cannot go through the\n * entity builders. `entity` is still the routing label (`meta.entity`): the\n * target entity's `key` for a command, or the entity/transaction subject for an\n * event.\n */\nexport function makeEnvelope<TData>(\n type: EntifixEnvelopeType,\n entity: string,\n data: TData,\n links?: EntifixEnvelopeLink[],\n): EntifixEnvelope<TData> {\n return {\n meta: {\n type,\n entity,\n ...(links ? { links } : {}),\n },\n data,\n };\n}\n\n/**\n * The entity name carried in `meta.entity` — the same `key ?? name` resolution\n * every adapter uses for collections and endpoints.\n */\nexport function envelopeEntityName<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n): string {\n const metaEntity = extractMetaEntity(entityConstructor);\n return metaEntity.key ?? metaEntity.name;\n}\n\nexport function makeEntityEnvelope<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n instance: TEntity,\n links?: EntifixEnvelopeLink[],\n): EntityEnvelope {\n return {\n meta: {\n type: 'entity',\n entity: envelopeEntityName(entityConstructor),\n ...(links ? { links } : {}),\n },\n data: serializeEntity(entityConstructor, instance),\n };\n}\n\nexport function makeEntityCollectionEnvelope<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n instances: readonly TEntity[],\n links?: EntifixEnvelopeLink[],\n): EntityCollectionEnvelope {\n return {\n meta: {\n type: 'entityCollection',\n entity: envelopeEntityName(entityConstructor),\n ...(links ? { links } : {}),\n },\n data: serializeEntityCollection(entityConstructor, instances),\n };\n}\n\nexport function makeEntityPageEnvelope<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n page: EntityPage<TEntity>,\n links?: EntifixEnvelopeLink[],\n): EntityPageEnvelope<TEntity> {\n return {\n meta: {\n type: 'entityPage',\n entity: envelopeEntityName(entityConstructor),\n ...(links ? { links } : {}),\n },\n data: {\n items: serializeEntityCollection(entityConstructor, page.items),\n total: page.total,\n request: page.request,\n },\n };\n}\n\n/**\n * The response to `GET /api/<entity>/$metadata`.\n *\n * Unlike its neighbours this serializes nothing: the document is already a plain\n * shape of catalog keys and verbs, and it describes the class rather than any\n * instance of it. `meta.entity` is still the target entity's key, which is what\n * makes the document per entity rather than per service.\n */\nexport function makeEntityMetadataEnvelope<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n document: EntityMetadataDocument,\n links?: EntifixEnvelopeLink[],\n): EntityMetadataEnvelope {\n return {\n meta: {\n type: 'entityMetadata',\n entity: envelopeEntityName(entityConstructor),\n ...(links ? { links } : {}),\n },\n data: document,\n };\n}\n\n/**\n * Frames a domain event for the bus.\n *\n * The split is mechanical and worth stating: everything about the *message*\n * (name, id, source, time, correlation) goes to `meta.event`; the payload — what\n * actually happened — is `data`. A consumer therefore never has to reach into\n * metadata to read its own domain object, and never has to reach into the\n * payload to find the routing key.\n *\n * `meta.entity` is deliberately left unset. A bus message says what it *is* in\n * `meta.event.name`; only the HTTP arm needs an entity label, and inventing one\n * here would put `settlement` on a message about a settlement *run*.\n */\nexport function makeEventEnvelope<TData>(\n event: DomainEvent<TData>,\n): EventEnvelope<TData> {\n const { data, ...eventMeta } = event;\n return {\n meta: { type: 'event', event: eventMeta },\n data,\n };\n}\n"],"names":["extractMetaEntity","serializeEntity","serializeEntityCollection","makeEnvelope","type","entity","data","links","meta","envelopeEntityName","entityConstructor","metaEntity","key","name","makeEntityEnvelope","instance","makeEntityCollectionEnvelope","instances","makeEntityPageEnvelope","page","items","total","request","makeEntityMetadataEnvelope","document","makeEventEnvelope","event","eventMeta"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,wCAAwC;AAE1E,SACEC,eAAe,EACfC,yBAAyB,QAC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AQ;YAAEA;QAAM,IAAI,CAAC;QAE3BD,MAAMkB;IACR;AACF;AAEA;;;;;;;;;;;;CAYC,GACD,OAAO,SAASC,kBACdC,KAAyB;IAEzB,MAAM,EAAEpB,IAAI,EAAgB,GAAGoB,OAAdC,6CAAcD;;;IAC/B,OAAO;QACLlB,MAAM;YAAEJ,MAAM;YAASsB,OAAOC;QAAU;QACxCrB;IACF;AACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import { EntifixBuildError } from '../base-entities/entifix-error/index.js';
|
|
3
|
+
import type { EntityMetadataDocument } from '../entity-definition/metadata/index.js';
|
|
4
|
+
import type { Entity, EntityConstructor } from '../types/Entity.js';
|
|
5
|
+
import type { DomainEvent, EntifixEnvelope, EntifixEnvelopeType } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Structural check only — `meta.type` is validated separately so a mismatch
|
|
8
|
+
* reports the expected/actual types rather than a generic "not an envelope".
|
|
9
|
+
*/
|
|
10
|
+
export declare function isEntifixEnvelope(body: unknown): body is EntifixEnvelope;
|
|
11
|
+
/**
|
|
12
|
+
* Narrows an arbitrary body to an envelope of the expected `meta.type` without
|
|
13
|
+
* requiring an entity constructor — for `command`/`transactionRecord` messages
|
|
14
|
+
* whose `data` is not a serialized entity. `label` only sharpens error text.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readEnvelope<TData>(body: unknown, expected: EntifixEnvelopeType, label?: string): Effect.Effect<EntifixEnvelope<TData>, EntifixBuildError>;
|
|
17
|
+
export declare const readEntityEnvelope: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, body: unknown) => Effect.Effect<TEntity, EntifixBuildError, never>;
|
|
18
|
+
export declare const readEntityCollectionEnvelope: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, body: unknown) => Effect.Effect<TEntity[], EntifixBuildError, never>;
|
|
19
|
+
export declare const readEntityPageEnvelope: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, body: unknown) => Effect.Effect<{
|
|
20
|
+
items: TEntity[];
|
|
21
|
+
total: number;
|
|
22
|
+
request: import("../index.js").EntityLoadRequest<TEntity>;
|
|
23
|
+
}, EntifixBuildError, never>;
|
|
24
|
+
/**
|
|
25
|
+
* Reads a `$metadata` response back into its document.
|
|
26
|
+
*
|
|
27
|
+
* No deserialization step, and no defaulting of the members either: an envelope
|
|
28
|
+
* whose `data` is missing a list would leave a form guessing whether "no
|
|
29
|
+
* actions" meant "denied" or "malformed", so a broken payload fails loudly here
|
|
30
|
+
* the way a half-populated entity does.
|
|
31
|
+
*/
|
|
32
|
+
export declare const readEntityMetadataEnvelope: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, body: unknown) => Effect.Effect<EntityMetadataDocument, EntifixBuildError, never>;
|
|
33
|
+
/**
|
|
34
|
+
* Reads a bus message back into a {@link DomainEvent}.
|
|
35
|
+
*
|
|
36
|
+
* The metadata is validated rather than defaulted, and that is the point: a
|
|
37
|
+
* message missing `id` cannot be deduplicated and a message missing `name`
|
|
38
|
+
* cannot be routed, so both are failures a consumer must see rather than
|
|
39
|
+
* absences it silently works around. It is the same call
|
|
40
|
+
* {@link readEntityMetadataEnvelope} makes — a broken payload fails loudly
|
|
41
|
+
* instead of arriving half-populated.
|
|
42
|
+
*
|
|
43
|
+
* Note this does not validate `data`. The transport has no idea what a
|
|
44
|
+
* `catalog.published` payload should look like, and inventing an opinion here
|
|
45
|
+
* is how the bus would start knowing about domains.
|
|
46
|
+
*/
|
|
47
|
+
export declare function readEventEnvelope<TData = unknown>(body: unknown): Effect.Effect<DomainEvent<TData>, EntifixBuildError>;
|
|
48
|
+
//# sourceMappingURL=read-envelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-envelope.d.ts","sourceRoot":"","sources":["../../src/envelope/read-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,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