@fougere/schema 0.2.0-alpha.2 → 0.4.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/EntityAdapters.d.ts +26 -0
- package/dist/EntityAdapters.d.ts.map +1 -0
- package/dist/EntityAdapters.js +71 -0
- package/dist/EntityAdapters.js.map +1 -0
- package/dist/EntityDeclarations.d.ts +15 -0
- package/dist/EntityDeclarations.d.ts.map +1 -0
- package/dist/EntityDeclarations.js +2 -0
- package/dist/EntityDeclarations.js.map +1 -0
- package/dist/axis/Axis.d.ts +12 -0
- package/dist/axis/Axis.d.ts.map +1 -0
- package/dist/axis/Axis.js +11 -0
- package/dist/axis/Axis.js.map +1 -0
- package/dist/axis/Meta.d.ts +4 -0
- package/dist/axis/Meta.d.ts.map +1 -0
- package/dist/axis/Meta.js +2 -0
- package/dist/axis/Meta.js.map +1 -0
- package/dist/axis/boundary/Boundaries.d.ts +20 -0
- package/dist/axis/boundary/Boundaries.d.ts.map +1 -0
- package/dist/axis/boundary/Boundaries.js +31 -0
- package/dist/axis/boundary/Boundaries.js.map +1 -0
- package/dist/axis/boundary/Boundary.d.ts +26 -0
- package/dist/axis/boundary/Boundary.d.ts.map +1 -0
- package/dist/axis/boundary/Boundary.js +53 -0
- package/dist/axis/boundary/Boundary.js.map +1 -0
- package/dist/axis/boundary/BoundaryAxis.d.ts +4 -0
- package/dist/axis/boundary/BoundaryAxis.d.ts.map +1 -0
- package/dist/axis/boundary/BoundaryAxis.js +30 -0
- package/dist/axis/boundary/BoundaryAxis.js.map +1 -0
- package/dist/axis/lifecycle/Clock.d.ts +18 -0
- package/dist/axis/lifecycle/Clock.d.ts.map +1 -0
- package/dist/axis/lifecycle/Clock.js +25 -0
- package/dist/axis/lifecycle/Clock.js.map +1 -0
- package/dist/axis/lifecycle/Generators.d.ts +18 -0
- package/dist/axis/lifecycle/Generators.d.ts.map +1 -0
- package/dist/axis/lifecycle/Generators.js +38 -0
- package/dist/axis/lifecycle/Generators.js.map +1 -0
- package/dist/axis/lifecycle/Lifecycle.d.ts +28 -0
- package/dist/axis/lifecycle/Lifecycle.d.ts.map +1 -0
- package/dist/axis/lifecycle/Lifecycle.js +38 -0
- package/dist/axis/lifecycle/Lifecycle.js.map +1 -0
- package/dist/axis/lifecycle/LifecycleAxis.d.ts +4 -0
- package/dist/axis/lifecycle/LifecycleAxis.d.ts.map +1 -0
- package/dist/axis/lifecycle/LifecycleAxis.js +47 -0
- package/dist/axis/lifecycle/LifecycleAxis.js.map +1 -0
- package/dist/axis/lifecycle/apply.d.ts +6 -0
- package/dist/axis/lifecycle/apply.d.ts.map +1 -0
- package/dist/axis/lifecycle/apply.js +34 -0
- package/dist/axis/lifecycle/apply.js.map +1 -0
- package/dist/axis/role/Relation.d.ts +20 -0
- package/dist/axis/role/Relation.d.ts.map +1 -0
- package/dist/axis/role/Relation.js +21 -0
- package/dist/axis/role/Relation.js.map +1 -0
- package/dist/axis/role/Role.d.ts +26 -0
- package/dist/axis/role/Role.d.ts.map +1 -0
- package/dist/axis/role/Role.js +40 -0
- package/dist/axis/role/Role.js.map +1 -0
- package/dist/axis/role/RoleAxis.d.ts +5 -0
- package/dist/axis/role/RoleAxis.d.ts.map +1 -0
- package/dist/axis/role/RoleAxis.js +102 -0
- package/dist/axis/role/RoleAxis.js.map +1 -0
- package/dist/axis/shape/Formats.d.ts +8 -0
- package/dist/axis/shape/Formats.d.ts.map +1 -0
- package/dist/axis/shape/Formats.js +10 -0
- package/dist/axis/shape/Formats.js.map +1 -0
- package/dist/axis/shape/Shape.d.ts +58 -0
- package/dist/axis/shape/Shape.d.ts.map +1 -0
- package/dist/{field/shape.js → axis/shape/Shape.js} +10 -25
- package/dist/axis/shape/Shape.js.map +1 -0
- package/dist/card/Bundle.d.ts +15 -0
- package/dist/card/Bundle.d.ts.map +1 -0
- package/dist/card/Bundle.js +67 -0
- package/dist/card/Bundle.js.map +1 -0
- package/dist/card/Card.d.ts +27 -0
- package/dist/card/Card.d.ts.map +1 -0
- package/dist/card/Card.js +230 -0
- package/dist/card/Card.js.map +1 -0
- package/dist/card/Descriptor.d.ts +55 -0
- package/dist/card/Descriptor.d.ts.map +1 -0
- package/dist/card/Descriptor.js +2 -0
- package/dist/card/Descriptor.js.map +1 -0
- package/dist/card/EntityTypeSource.d.ts +12 -0
- package/dist/card/EntityTypeSource.d.ts.map +1 -0
- package/dist/card/EntityTypeSource.js +78 -0
- package/dist/card/EntityTypeSource.js.map +1 -0
- package/dist/card/FacadeTypeSource.d.ts +19 -0
- package/dist/card/FacadeTypeSource.d.ts.map +1 -0
- package/dist/card/FacadeTypeSource.js +40 -0
- package/dist/card/FacadeTypeSource.js.map +1 -0
- package/dist/card/admission.d.ts +9 -0
- package/dist/card/admission.d.ts.map +1 -0
- package/dist/card/admission.js +16 -0
- package/dist/card/admission.js.map +1 -0
- package/dist/card/diff.d.ts +96 -0
- package/dist/card/diff.d.ts.map +1 -0
- package/dist/card/diff.js +2 -0
- package/dist/card/diff.js.map +1 -0
- package/dist/constraint/FieldGroup.d.ts +21 -0
- package/dist/constraint/FieldGroup.d.ts.map +1 -0
- package/dist/constraint/FieldGroup.js +65 -0
- package/dist/constraint/FieldGroup.js.map +1 -0
- package/dist/constraint/Unique.d.ts +4 -0
- package/dist/constraint/Unique.d.ts.map +1 -0
- package/dist/constraint/Unique.js +4 -0
- package/dist/constraint/Unique.js.map +1 -0
- package/dist/entity.d.ts +4 -19
- package/dist/entity.d.ts.map +1 -1
- package/dist/entity.js +8 -39
- package/dist/entity.js.map +1 -1
- package/dist/fields/Field.d.ts +24 -0
- package/dist/fields/Field.d.ts.map +1 -0
- package/dist/fields/Field.js +52 -0
- package/dist/fields/Field.js.map +1 -0
- package/dist/fields/FieldSet.d.ts +28 -0
- package/dist/fields/FieldSet.d.ts.map +1 -0
- package/dist/fields/FieldSet.js +55 -0
- package/dist/fields/FieldSet.js.map +1 -0
- package/dist/index.d.ts +59 -37
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -48
- package/dist/index.js.map +1 -1
- package/dist/judge/Cases.d.ts +50 -0
- package/dist/judge/Cases.d.ts.map +1 -0
- package/dist/judge/Cases.js +108 -0
- package/dist/judge/Cases.js.map +1 -0
- package/dist/judge/FieldJudge.d.ts +9 -0
- package/dist/judge/FieldJudge.d.ts.map +1 -0
- package/dist/judge/FieldJudge.js +54 -0
- package/dist/judge/FieldJudge.js.map +1 -0
- package/dist/judge/RowJudge.d.ts +12 -0
- package/dist/judge/RowJudge.d.ts.map +1 -0
- package/dist/judge/RowJudge.js +81 -0
- package/dist/judge/RowJudge.js.map +1 -0
- package/dist/judge/RowRefusal.d.ts +17 -0
- package/dist/judge/RowRefusal.d.ts.map +1 -0
- package/dist/judge/RowRefusal.js +16 -0
- package/dist/judge/RowRefusal.js.map +1 -0
- package/dist/judge/ValueForm.d.ts +3 -0
- package/dist/judge/ValueForm.d.ts.map +1 -0
- package/dist/judge/ValueForm.js +3 -0
- package/dist/judge/ValueForm.js.map +1 -0
- package/dist/judge/ValueJudge.d.ts +12 -0
- package/dist/judge/ValueJudge.d.ts.map +1 -0
- package/dist/judge/ValueJudge.js +60 -0
- package/dist/judge/ValueJudge.js.map +1 -0
- package/dist/judge/options.d.ts +4 -0
- package/dist/judge/options.d.ts.map +1 -0
- package/dist/judge/options.js +2 -0
- package/dist/judge/options.js.map +1 -0
- package/dist/judge/result.d.ts +17 -0
- package/dist/judge/result.d.ts.map +1 -0
- package/dist/judge/result.js +2 -0
- package/dist/judge/result.js.map +1 -0
- package/dist/projection/SchemaOrCard.d.ts +7 -0
- package/dist/projection/SchemaOrCard.d.ts.map +1 -0
- package/dist/projection/SchemaOrCard.js +11 -0
- package/dist/projection/SchemaOrCard.js.map +1 -0
- package/dist/projection/Visibility.d.ts +10 -0
- package/dist/projection/Visibility.d.ts.map +1 -0
- package/dist/projection/Visibility.js +55 -0
- package/dist/projection/Visibility.js.map +1 -0
- package/dist/{projections → projection}/standard.d.ts +2 -10
- package/dist/projection/standard.d.ts.map +1 -0
- package/dist/projection/standard.js +2 -0
- package/dist/projection/standard.js.map +1 -0
- package/dist/schema/Schema.d.ts +63 -0
- package/dist/schema/Schema.d.ts.map +1 -0
- package/dist/schema/Schema.js +129 -0
- package/dist/schema/Schema.js.map +1 -0
- package/dist/schema/SchemaDefinition.d.ts +46 -0
- package/dist/schema/SchemaDefinition.d.ts.map +1 -0
- package/dist/schema/SchemaDefinition.js +64 -0
- package/dist/schema/SchemaDefinition.js.map +1 -0
- package/dist/schema/SchemaDerivation.d.ts +28 -0
- package/dist/schema/SchemaDerivation.d.ts.map +1 -0
- package/dist/schema/SchemaDerivation.js +37 -0
- package/dist/schema/SchemaDerivation.js.map +1 -0
- package/dist/schema/SchemaView.d.ts +23 -0
- package/dist/schema/SchemaView.d.ts.map +1 -0
- package/dist/schema/SchemaView.js +2 -0
- package/dist/schema/SchemaView.js.map +1 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +13 -0
- package/dist/utils.js.map +1 -0
- package/dist/vocabulary/bool.d.ts +1 -1
- package/dist/vocabulary/bool.d.ts.map +1 -1
- package/dist/vocabulary/bool.js +1 -1
- package/dist/vocabulary/bool.js.map +1 -1
- package/dist/vocabulary/created.d.ts +1 -5
- package/dist/vocabulary/created.d.ts.map +1 -1
- package/dist/vocabulary/created.js +1 -5
- package/dist/vocabulary/created.js.map +1 -1
- package/dist/vocabulary/date.d.ts +1 -1
- package/dist/vocabulary/date.d.ts.map +1 -1
- package/dist/vocabulary/date.js +1 -1
- package/dist/vocabulary/date.js.map +1 -1
- package/dist/vocabulary/email.d.ts +1 -2
- package/dist/vocabulary/email.d.ts.map +1 -1
- package/dist/vocabulary/email.js +0 -1
- package/dist/vocabulary/email.js.map +1 -1
- package/dist/vocabulary/immutable.d.ts +2 -6
- package/dist/vocabulary/immutable.d.ts.map +1 -1
- package/dist/vocabulary/immutable.js +4 -7
- package/dist/vocabulary/immutable.js.map +1 -1
- package/dist/vocabulary/indexed.d.ts +2 -7
- package/dist/vocabulary/indexed.d.ts.map +1 -1
- package/dist/vocabulary/indexed.js +2 -8
- package/dist/vocabulary/indexed.js.map +1 -1
- package/dist/vocabulary/json.d.ts +2 -10
- package/dist/vocabulary/json.d.ts.map +1 -1
- package/dist/vocabulary/json.js +12 -7
- package/dist/vocabulary/json.js.map +1 -1
- package/dist/vocabulary/list.d.ts +1 -12
- package/dist/vocabulary/list.d.ts.map +1 -1
- package/dist/vocabulary/list.js +1 -14
- package/dist/vocabulary/list.js.map +1 -1
- package/dist/vocabulary/many.d.ts +2 -5
- package/dist/vocabulary/many.d.ts.map +1 -1
- package/dist/vocabulary/many.js +3 -6
- package/dist/vocabulary/many.js.map +1 -1
- package/dist/vocabulary/nullable.d.ts +2 -6
- package/dist/vocabulary/nullable.d.ts.map +1 -1
- package/dist/vocabulary/nullable.js +5 -8
- package/dist/vocabulary/nullable.js.map +1 -1
- package/dist/vocabulary/number.d.ts +1 -1
- package/dist/vocabulary/number.d.ts.map +1 -1
- package/dist/vocabulary/number.js +1 -1
- package/dist/vocabulary/number.js.map +1 -1
- package/dist/vocabulary/oneOf.d.ts +1 -8
- package/dist/vocabulary/oneOf.d.ts.map +1 -1
- package/dist/vocabulary/oneOf.js +1 -1
- package/dist/vocabulary/oneOf.js.map +1 -1
- package/dist/vocabulary/optional.d.ts +2 -9
- package/dist/vocabulary/optional.d.ts.map +1 -1
- package/dist/vocabulary/optional.js +6 -14
- package/dist/vocabulary/optional.js.map +1 -1
- package/dist/vocabulary/primary.d.ts +2 -15
- package/dist/vocabulary/primary.d.ts.map +1 -1
- package/dist/vocabulary/primary.js +4 -11
- package/dist/vocabulary/primary.js.map +1 -1
- package/dist/vocabulary/readOnly.d.ts +2 -6
- package/dist/vocabulary/readOnly.d.ts.map +1 -1
- package/dist/vocabulary/readOnly.js +5 -8
- package/dist/vocabulary/readOnly.js.map +1 -1
- package/dist/vocabulary/ref.d.ts +2 -7
- package/dist/vocabulary/ref.d.ts.map +1 -1
- package/dist/vocabulary/ref.js +3 -14
- package/dist/vocabulary/ref.js.map +1 -1
- package/dist/vocabulary/text.d.ts +2 -2
- package/dist/vocabulary/text.d.ts.map +1 -1
- package/dist/vocabulary/text.js +1 -1
- package/dist/vocabulary/text.js.map +1 -1
- package/dist/vocabulary/unique.d.ts +2 -12
- package/dist/vocabulary/unique.d.ts.map +1 -1
- package/dist/vocabulary/unique.js +5 -13
- package/dist/vocabulary/unique.js.map +1 -1
- package/dist/vocabulary/updated.d.ts +1 -6
- package/dist/vocabulary/updated.d.ts.map +1 -1
- package/dist/vocabulary/updated.js +0 -5
- package/dist/vocabulary/updated.js.map +1 -1
- package/dist/vocabulary/url.d.ts +1 -2
- package/dist/vocabulary/url.d.ts.map +1 -1
- package/dist/vocabulary/url.js +0 -1
- package/dist/vocabulary/url.js.map +1 -1
- package/dist/vocabulary/vocabulary.d.ts +4 -0
- package/dist/vocabulary/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary/vocabulary.js +31 -0
- package/dist/vocabulary/vocabulary.js.map +1 -0
- package/dist/vocabulary/writeOnly.d.ts +2 -6
- package/dist/vocabulary/writeOnly.d.ts.map +1 -1
- package/dist/vocabulary/writeOnly.js +5 -8
- package/dist/vocabulary/writeOnly.js.map +1 -1
- package/package.json +8 -4
- package/src/EntityAdapters.ts +95 -0
- package/src/EntityDeclarations.ts +19 -0
- package/src/axis/Axis.ts +25 -0
- package/src/axis/Meta.ts +3 -0
- package/src/axis/boundary/Boundaries.ts +44 -0
- package/src/axis/boundary/Boundary.ts +69 -0
- package/src/axis/boundary/BoundaryAxis.ts +32 -0
- package/src/axis/lifecycle/Clock.ts +26 -0
- package/src/axis/lifecycle/Generators.ts +46 -0
- package/src/axis/lifecycle/Lifecycle.ts +53 -0
- package/src/axis/lifecycle/LifecycleAxis.ts +49 -0
- package/src/axis/lifecycle/apply.ts +38 -0
- package/src/axis/role/Relation.ts +31 -0
- package/src/axis/role/Role.ts +56 -0
- package/src/axis/role/RoleAxis.ts +115 -0
- package/src/axis/shape/Formats.ts +22 -0
- package/src/axis/shape/Shape.ts +91 -0
- package/src/card/Bundle.ts +80 -0
- package/src/card/Card.ts +256 -0
- package/src/card/Descriptor.ts +68 -0
- package/src/card/EntityTypeSource.ts +90 -0
- package/src/card/FacadeTypeSource.ts +55 -0
- package/src/card/admission.ts +25 -0
- package/src/card/diff.ts +56 -0
- package/src/constraint/FieldGroup.ts +91 -0
- package/src/constraint/Unique.ts +3 -0
- package/src/entity.ts +15 -0
- package/src/fields/Field.ts +80 -0
- package/src/fields/FieldSet.ts +62 -0
- package/src/index.ts +64 -0
- package/src/judge/Cases.ts +139 -0
- package/src/judge/FieldJudge.ts +61 -0
- package/src/judge/RowJudge.ts +84 -0
- package/src/judge/RowRefusal.ts +17 -0
- package/src/judge/ValueForm.ts +7 -0
- package/src/judge/ValueJudge.ts +72 -0
- package/src/judge/options.ts +3 -0
- package/src/judge/result.ts +10 -0
- package/src/projection/SchemaOrCard.ts +18 -0
- package/src/projection/Visibility.ts +47 -0
- package/src/projection/standard.ts +47 -0
- package/src/schema/Schema.ts +167 -0
- package/src/schema/SchemaDefinition.ts +87 -0
- package/src/schema/SchemaDerivation.ts +46 -0
- package/src/schema/SchemaView.ts +25 -0
- package/src/utils.ts +13 -0
- package/src/vocabulary/bool.ts +9 -0
- package/src/vocabulary/created.ts +8 -0
- package/src/vocabulary/date.ts +5 -0
- package/src/vocabulary/email.ts +6 -0
- package/src/vocabulary/immutable.ts +6 -0
- package/src/vocabulary/indexed.ts +4 -0
- package/src/vocabulary/json.ts +22 -0
- package/src/vocabulary/list.ts +13 -0
- package/src/vocabulary/many.ts +9 -0
- package/src/vocabulary/nullable.ts +7 -0
- package/src/vocabulary/number.ts +17 -0
- package/src/vocabulary/oneOf.ts +24 -0
- package/src/vocabulary/optional.ts +8 -0
- package/src/vocabulary/primary.ts +33 -0
- package/src/vocabulary/readOnly.ts +7 -0
- package/src/vocabulary/ref.ts +13 -0
- package/src/vocabulary/text.ts +19 -0
- package/src/vocabulary/unique.ts +10 -0
- package/src/vocabulary/updated.ts +7 -0
- package/src/vocabulary/url.ts +6 -0
- package/src/vocabulary/vocabulary.ts +40 -0
- package/src/vocabulary/writeOnly.ts +7 -0
- package/dist/field/boundary.d.ts +0 -69
- package/dist/field/boundary.d.ts.map +0 -1
- package/dist/field/boundary.js +0 -82
- package/dist/field/boundary.js.map +0 -1
- package/dist/field/field.d.ts +0 -21
- package/dist/field/field.d.ts.map +0 -1
- package/dist/field/field.js +0 -24
- package/dist/field/field.js.map +0 -1
- package/dist/field/format.d.ts +0 -29
- package/dist/field/format.d.ts.map +0 -1
- package/dist/field/format.js +0 -24
- package/dist/field/format.js.map +0 -1
- package/dist/field/index.d.ts +0 -8
- package/dist/field/index.d.ts.map +0 -1
- package/dist/field/index.js +0 -10
- package/dist/field/index.js.map +0 -1
- package/dist/field/lifecycle.d.ts +0 -31
- package/dist/field/lifecycle.d.ts.map +0 -1
- package/dist/field/lifecycle.js +0 -20
- package/dist/field/lifecycle.js.map +0 -1
- package/dist/field/meta.d.ts +0 -5
- package/dist/field/meta.d.ts.map +0 -1
- package/dist/field/meta.js +0 -5
- package/dist/field/meta.js.map +0 -1
- package/dist/field/role.d.ts +0 -47
- package/dist/field/role.d.ts.map +0 -1
- package/dist/field/role.js +0 -35
- package/dist/field/role.js.map +0 -1
- package/dist/field/shape.d.ts +0 -89
- package/dist/field/shape.d.ts.map +0 -1
- package/dist/field/shape.js.map +0 -1
- package/dist/hints.d.ts +0 -28
- package/dist/hints.d.ts.map +0 -1
- package/dist/hints.js +0 -23
- package/dist/hints.js.map +0 -1
- package/dist/name.d.ts +0 -8
- package/dist/name.d.ts.map +0 -1
- package/dist/name.js +0 -10
- package/dist/name.js.map +0 -1
- package/dist/projections/card.d.ts +0 -98
- package/dist/projections/card.d.ts.map +0 -1
- package/dist/projections/card.js +0 -8
- package/dist/projections/card.js.map +0 -1
- package/dist/projections/describe.d.ts +0 -25
- package/dist/projections/describe.d.ts.map +0 -1
- package/dist/projections/describe.js +0 -131
- package/dist/projections/describe.js.map +0 -1
- package/dist/projections/encode.d.ts +0 -11
- package/dist/projections/encode.d.ts.map +0 -1
- package/dist/projections/encode.js +0 -26
- package/dist/projections/encode.js.map +0 -1
- package/dist/projections/io.d.ts +0 -24
- package/dist/projections/io.d.ts.map +0 -1
- package/dist/projections/io.js +0 -46
- package/dist/projections/io.js.map +0 -1
- package/dist/projections/lifecycle.d.ts +0 -29
- package/dist/projections/lifecycle.d.ts.map +0 -1
- package/dist/projections/lifecycle.js +0 -93
- package/dist/projections/lifecycle.js.map +0 -1
- package/dist/projections/reconstruct.d.ts +0 -31
- package/dist/projections/reconstruct.d.ts.map +0 -1
- package/dist/projections/reconstruct.js +0 -146
- package/dist/projections/reconstruct.js.map +0 -1
- package/dist/projections/source.d.ts +0 -18
- package/dist/projections/source.d.ts.map +0 -1
- package/dist/projections/source.js +0 -18
- package/dist/projections/source.js.map +0 -1
- package/dist/projections/standard.d.ts.map +0 -1
- package/dist/projections/standard.js +0 -10
- package/dist/projections/standard.js.map +0 -1
- package/dist/projections/typescript.d.ts +0 -37
- package/dist/projections/typescript.d.ts.map +0 -1
- package/dist/projections/typescript.js +0 -157
- package/dist/projections/typescript.js.map +0 -1
- package/dist/schema/index.d.ts +0 -3
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js +0 -2
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/schema.d.ts +0 -74
- package/dist/schema/schema.d.ts.map +0 -1
- package/dist/schema/schema.js +0 -162
- package/dist/schema/schema.js.map +0 -1
- package/dist/schema/view.d.ts +0 -26
- package/dist/schema/view.d.ts.map +0 -1
- package/dist/schema/view.js +0 -2
- package/dist/schema/view.js.map +0 -1
- package/dist/unique.d.ts +0 -40
- package/dist/unique.d.ts.map +0 -1
- package/dist/unique.js +0 -57
- package/dist/unique.js.map +0 -1
- package/dist/validation/index.d.ts +0 -4
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js +0 -2
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/judge.d.ts +0 -55
- package/dist/validation/judge.d.ts.map +0 -1
- package/dist/validation/judge.js +0 -351
- package/dist/validation/judge.js.map +0 -1
- package/dist/validation/options.d.ts +0 -6
- package/dist/validation/options.d.ts.map +0 -1
- package/dist/validation/options.js +0 -3
- package/dist/validation/options.js.map +0 -1
- package/dist/validation/result.d.ts +0 -20
- package/dist/validation/result.d.ts.map +0 -1
- package/dist/validation/result.js +0 -3
- package/dist/validation/result.js.map +0 -1
package/dist/field/role.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export type EntityConstructor = abstract new (...args: any[]) => any;
|
|
2
|
-
/**
|
|
3
|
-
* Normalize a relation target to a lazy thunk. A target may be given as the entity
|
|
4
|
-
* class directly (`ref(Author)`) or as a thunk (`ref(() => Author)`) — the thunk
|
|
5
|
-
* form is needed for circular/forward references, where the class isn't defined yet
|
|
6
|
-
* when `entity({...})` is evaluated. An entity class is recognized by its static
|
|
7
|
-
* `getFields`; anything else is treated as the thunk itself.
|
|
8
|
-
*/
|
|
9
|
-
export declare function toTargetThunk<E extends EntityConstructor>(target: E | (() => E)): () => E;
|
|
10
|
-
/** A relation's closed vocabularies — the runtime lists the types derive from. */
|
|
11
|
-
export declare const RELATION_KINDS: readonly ['one', 'many'];
|
|
12
|
-
export declare const ON_DELETE: readonly ['cascade', 'restrict', 'set null'];
|
|
13
|
-
export interface Relation {
|
|
14
|
-
to: () => EntityConstructor;
|
|
15
|
-
kind: (typeof RELATION_KINDS)[number];
|
|
16
|
-
onDelete?: (typeof ON_DELETE)[number];
|
|
17
|
-
}
|
|
18
|
-
export interface Role {
|
|
19
|
-
primary?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* The constraints this field belongs to — one member list each. A lone `unique(slug)` is
|
|
22
|
-
* the degenerate case, a set of one, so there is one shape and not two.
|
|
23
|
-
*
|
|
24
|
-
* **An empty list denotes the field carrying it** — it does not know its own key. A named
|
|
25
|
-
* group comes from the entity's own declaration, where a fact about a pair belongs.
|
|
26
|
-
* NEVER read a group directly: {@link uniqueMembers} is the accessor.
|
|
27
|
-
*
|
|
28
|
-
* `describe` resolves it on the way out, so a card always names its members. Keeping it
|
|
29
|
-
* unresolved in memory is what makes `rename()` free: nothing to remap.
|
|
30
|
-
*/
|
|
31
|
-
unique?: ReadonlyArray<ReadonlyArray<string>>;
|
|
32
|
-
index?: boolean;
|
|
33
|
-
relation?: Relation;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* The constraint a member list denotes, resolved against the field carrying it — the
|
|
37
|
-
* accessor every reader of `role.unique` goes through.
|
|
38
|
-
*
|
|
39
|
-
* ```ts
|
|
40
|
-
* uniqueMembers([], 'slug') // ['slug'] — the self-reference
|
|
41
|
-
* uniqueMembers(['listId', 'docId'], 'docId') // ['listId','docId'] — already named
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* `ownKey` is the half the field is missing: iterate `Object.entries(getFields())`.
|
|
45
|
-
*/
|
|
46
|
-
export declare function uniqueMembers(group: ReadonlyArray<string>, ownKey: string): string[];
|
|
47
|
-
//# sourceMappingURL=role.d.ts.map
|
package/dist/field/role.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/field/role.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAErE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,iBAAiB,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAEzF;AAED,kFAAkF;AAClF,eAAO,MAAM,cAAc,YAAI,KAAK,EAAE,MAAM,CAAU,CAAC;AACvD,eAAO,MAAM,SAAS,YAAI,SAAS,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AAEtE,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,iBAAiB,CAAC;IAC5B,IAAI,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,IAAI;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAEpF"}
|
package/dist/field/role.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// ─── Axis 2 · role — place in the entity graph ────────────
|
|
2
|
-
// Identity and relations. Read by the storage and transport adapters, and by the judge:
|
|
3
|
-
// `relation.kind === 'many'` makes an absent collection default to `[]`.
|
|
4
|
-
//
|
|
5
|
-
// `unique` and `index` are the only axis members realized OUTSIDE the framework — the DDL
|
|
6
|
-
// emits them and the database enforces them, so a collision surfaces as the driver's
|
|
7
|
-
// error, never as a `validate()` failure.
|
|
8
|
-
/**
|
|
9
|
-
* Normalize a relation target to a lazy thunk. A target may be given as the entity
|
|
10
|
-
* class directly (`ref(Author)`) or as a thunk (`ref(() => Author)`) — the thunk
|
|
11
|
-
* form is needed for circular/forward references, where the class isn't defined yet
|
|
12
|
-
* when `entity({...})` is evaluated. An entity class is recognized by its static
|
|
13
|
-
* `getFields`; anything else is treated as the thunk itself.
|
|
14
|
-
*/
|
|
15
|
-
export function toTargetThunk(target) {
|
|
16
|
-
return 'getFields' in target ? () => target : target;
|
|
17
|
-
}
|
|
18
|
-
/** A relation's closed vocabularies — the runtime lists the types derive from. */
|
|
19
|
-
export const RELATION_KINDS = ['one', 'many'];
|
|
20
|
-
export const ON_DELETE = ['cascade', 'restrict', 'set null'];
|
|
21
|
-
/**
|
|
22
|
-
* The constraint a member list denotes, resolved against the field carrying it — the
|
|
23
|
-
* accessor every reader of `role.unique` goes through.
|
|
24
|
-
*
|
|
25
|
-
* ```ts
|
|
26
|
-
* uniqueMembers([], 'slug') // ['slug'] — the self-reference
|
|
27
|
-
* uniqueMembers(['listId', 'docId'], 'docId') // ['listId','docId'] — already named
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* `ownKey` is the half the field is missing: iterate `Object.entries(getFields())`.
|
|
31
|
-
*/
|
|
32
|
-
export function uniqueMembers(group, ownKey) {
|
|
33
|
-
return group.length === 0 ? [ownKey] : [...group];
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=role.js.map
|
package/dist/field/role.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role.js","sourceRoot":"","sources":["../../src/field/role.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,wFAAwF;AACxF,yEAAyE;AACzE,EAAE;AACF,0FAA0F;AAC1F,qFAAqF;AACrF,0CAA0C;AAI1C;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAA8B,MAAqB;IAC9E,OAAO,WAAW,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAW,CAAC,CAAC,CAAE,MAAkB,CAAC;AACzE,CAAC;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU,CAAC;AACvD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AA0BtE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,KAA4B,EAAE,MAAc;IACxE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;AACpD,CAAC"}
|
package/dist/field/shape.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { StringFormat } from './format.js';
|
|
2
|
-
/** A base type name, alone or in the nullable union form. */
|
|
3
|
-
type Nullably<T extends string> = T | readonly [T, 'null'];
|
|
4
|
-
interface StringConstraints {
|
|
5
|
-
minLength?: number;
|
|
6
|
-
maxLength?: number;
|
|
7
|
-
pattern?: string;
|
|
8
|
-
enum?: readonly (string | null)[];
|
|
9
|
-
format?: StringFormat;
|
|
10
|
-
}
|
|
11
|
-
interface NumericConstraints {
|
|
12
|
-
minimum?: number;
|
|
13
|
-
maximum?: number;
|
|
14
|
-
}
|
|
15
|
-
interface ArrayConstraints {
|
|
16
|
-
items?: Shape;
|
|
17
|
-
minItems?: number;
|
|
18
|
-
maxItems?: number;
|
|
19
|
-
}
|
|
20
|
-
interface ObjectConstraints {
|
|
21
|
-
properties?: Record<string, unknown>;
|
|
22
|
-
required?: readonly string[];
|
|
23
|
-
}
|
|
24
|
-
export type Shape = ({
|
|
25
|
-
type: Nullably<'string'>;
|
|
26
|
-
} & StringConstraints) | ({
|
|
27
|
-
type: Nullably<'number'> | Nullably<'integer'>;
|
|
28
|
-
} & NumericConstraints) | {
|
|
29
|
-
type: Nullably<'boolean'>;
|
|
30
|
-
} | ({
|
|
31
|
-
type: Nullably<'array'>;
|
|
32
|
-
} & ArrayConstraints) | ({
|
|
33
|
-
type: Nullably<'object'>;
|
|
34
|
-
} & ObjectConstraints);
|
|
35
|
-
/**
|
|
36
|
-
* The BASE type names — what `Anatomy.of(shape).base?.type` narrows to for a dispatch.
|
|
37
|
-
*
|
|
38
|
-
* The runtime list is the source and the type derives from it, not the reverse: a type
|
|
39
|
-
* union cannot be enumerated at runtime, so writing both by hand means two lists that
|
|
40
|
-
* drift. {@link isShape} needs the values, so it is the values that are declared.
|
|
41
|
-
*/
|
|
42
|
-
export declare const SHAPE_TYPES: readonly ['string', 'number', 'integer', 'boolean', 'array', 'object'];
|
|
43
|
-
export type ShapeType = (typeof SHAPE_TYPES)[number];
|
|
44
|
-
/** Is this a shape? Asked of its `type`, against {@link SHAPE_TYPES}. */
|
|
45
|
-
export declare function isShape(value: unknown): value is Shape;
|
|
46
|
-
/**
|
|
47
|
-
* `Shape` with `type` guaranteed scalar — what `anatomy` returns as `base`, the
|
|
48
|
-
* ONLY form consumers dispatch on. A scalar literal is a real discriminant, so
|
|
49
|
-
* `switch (base?.type)` narrows; the raw `Shape` union can't (the `[T,'null']`
|
|
50
|
-
* tuple is not a unit type).
|
|
51
|
-
*/
|
|
52
|
-
export type BaseShape = ({
|
|
53
|
-
type: 'string';
|
|
54
|
-
} & StringConstraints) | ({
|
|
55
|
-
type: 'number' | 'integer';
|
|
56
|
-
} & NumericConstraints) | {
|
|
57
|
-
type: 'boolean';
|
|
58
|
-
} | ({
|
|
59
|
-
type: 'array';
|
|
60
|
-
} & ArrayConstraints) | ({
|
|
61
|
-
type: 'object';
|
|
62
|
-
} & ObjectConstraints);
|
|
63
|
-
/**
|
|
64
|
-
* Write side: make a shape's grammar accept `null` — the type becomes the union
|
|
65
|
-
* `[T, 'null']`, and `null` joins `enum` when present (an enum is a closed value
|
|
66
|
-
* set; null must be IN it to be legal). Idempotent.
|
|
67
|
-
*/
|
|
68
|
-
export declare function nullableShape(shape: Shape): Shape;
|
|
69
|
-
/** A shape split back into its base grammar and its nullability. */
|
|
70
|
-
export interface ShapeAnatomy {
|
|
71
|
-
/** The shape stripped of `null` (scalar `type`, `enum` without null) — dispatch on THIS. */
|
|
72
|
-
base?: BaseShape;
|
|
73
|
-
nullable: boolean;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* The read side — the single customs post at the standard's border. Every consumer that
|
|
77
|
-
* dispatches on a shape's type comes through here: `shape.type` may be the union
|
|
78
|
-
* `[T,'null']`, and a direct comparison fails silently on it.
|
|
79
|
-
*/
|
|
80
|
-
export declare class Anatomy {
|
|
81
|
-
/** Cached per shape reference — derivations copy field refs, they never rebuild shapes. */
|
|
82
|
-
private static readonly cache;
|
|
83
|
-
private static readonly none;
|
|
84
|
-
static of(shape?: Shape): ShapeAnatomy;
|
|
85
|
-
/** Sugar for the most common read: does this shape's grammar accept `null`? */
|
|
86
|
-
static isNullable(shape?: Shape): boolean;
|
|
87
|
-
}
|
|
88
|
-
export {};
|
|
89
|
-
//# sourceMappingURL=shape.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../src/field/shape.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAwBhD,6DAA6D;AAC7D,KAAK,QAAQ,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAI3D,UAAU,iBAAiB;IAAG,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,YAAY,CAAA;CAAE;AAClJ,UAAU,kBAAkB;IAAG,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;AAOnE,UAAU,gBAAgB;IAAG,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE;AAIlF,UAAU,iBAAiB;IAAG,UAAU,CAAC,EAAE,MAAM,CAAC,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CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;gBACtD,MAAM,IAAI,GAAG,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAe,CAAC;gBACvD,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;oBAC/B,IAA6C,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;gBAC5F,CAAC;gBACD,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YAC/B,CAAC;iBAAM,CAAC;gBACN,CAAC,GAAG,EAAE,IAAI,EAAE,KAAkB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;YACpD,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,+EAA+E;IAC/E,MAAM,CAAC,UAAU,CAAC,KAAa;QAC7B,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;IACjC,CAAC;CACF"}
|
package/dist/hints.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Fields } from "./field/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Per-consumer hints — the escape hatch for what a neutral field cannot carry ("store
|
|
4
|
-
* `body` as a `tsvector`"), which validation and the API ignore.
|
|
5
|
-
*
|
|
6
|
-
* EMPTY here: this package names no adapter. Each augments it from its own package, and
|
|
7
|
-
* `K` — the entity's field-key union — constrains a hint's inner keys to real fields.
|
|
8
|
-
*
|
|
9
|
-
* ```ts
|
|
10
|
-
* declare module '@fougere/schema' {
|
|
11
|
-
* interface FougereHints<K extends string> {
|
|
12
|
-
* sql?: Partial<Record<K, { columnType?: string; index?: string }>>;
|
|
13
|
-
* }
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export interface FougereHints<K extends string> {
|
|
18
|
-
}
|
|
19
|
-
/** Keyed by registered adapter — an unknown adapter, field or option is refused at the call site. */
|
|
20
|
-
export type Hints<TFields extends Fields> = {
|
|
21
|
-
[A in keyof FougereHints<Extract<keyof TFields, string>>]?: FougereHints<Extract<keyof TFields, string>>[A];
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Carry hints across a key transform — a derivation preserves what it does not change.
|
|
25
|
-
* `transform` maps an old key to its new name, or to `undefined` when the field is dropped.
|
|
26
|
-
*/
|
|
27
|
-
export declare function deriveHints(hints: Hints<Fields> | undefined, transform: (key: string) => string | undefined): Hints<Fields> | undefined;
|
|
28
|
-
//# sourceMappingURL=hints.d.ts.map
|
package/dist/hints.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hints.d.ts","sourceRoot":"","sources":["../src/hints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM;CAAI;AAElD,qGAAqG;AACrG,MAAM,MAAM,KAAK,CAAC,OAAO,SAAS,MAAM,IAAI;KACzC,CAAC,IAAI,MAAM,YAAY,CAAC,OAAO,CAAC,MAAM,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,CACtE,OAAO,CAAC,MAAM,OAAO,EAAE,MAAM,CAAC,CAC/B,CAAC,CAAC,CAAC;CACL,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,EAChC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAC7C,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAa3B"}
|
package/dist/hints.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Carry hints across a key transform — a derivation preserves what it does not change.
|
|
3
|
-
* `transform` maps an old key to its new name, or to `undefined` when the field is dropped.
|
|
4
|
-
*/
|
|
5
|
-
export function deriveHints(hints, transform) {
|
|
6
|
-
if (!hints)
|
|
7
|
-
return undefined;
|
|
8
|
-
const out = {};
|
|
9
|
-
for (const [adapter, perField] of Object.entries(hints)) {
|
|
10
|
-
if (!perField || typeof perField !== 'object')
|
|
11
|
-
continue;
|
|
12
|
-
const mapped = {};
|
|
13
|
-
for (const [key, hint] of Object.entries(perField)) {
|
|
14
|
-
const next = transform(key);
|
|
15
|
-
if (next !== undefined)
|
|
16
|
-
mapped[next] = hint;
|
|
17
|
-
}
|
|
18
|
-
if (Object.keys(mapped).length)
|
|
19
|
-
out[adapter] = mapped;
|
|
20
|
-
}
|
|
21
|
-
return Object.keys(out).length ? out : undefined;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=hints.js.map
|
package/dist/hints.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hints.js","sourceRoot":"","sources":["../src/hints.ts"],"names":[],"mappings":"AA2BA;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,KAAgC,EAChC,SAA8C;IAE9C,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,GAAG,GAA4C,EAAE,CAAC;IACxD,KAAK,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAA4D,CAAC,EAAE,CAAC;QAC/G,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ;YAAE,SAAS;QACxD,MAAM,MAAM,GAA4B,EAAE,CAAC;QAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,IAAI,KAAK,SAAS;gBAAE,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAC9C,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM;YAAE,GAAG,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;IACxD,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,GAAqB,CAAC,CAAC,CAAC,SAAS,CAAC;AACtE,CAAC"}
|
package/dist/name.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The key a class name is filed under — `AuthorUser` → `authorUser`. THE canonical
|
|
3
|
-
* spelling, stated once because three places disagreed and only ever met on one-word
|
|
4
|
-
* names: on `AuthorUser` the card wrote `authoruser` and the derived FK pointed at a
|
|
5
|
-
* table no pass creates. Idempotent, so a card re-describes identically.
|
|
6
|
-
*/
|
|
7
|
-
export declare function registrationKeyOf(className: string): string;
|
|
8
|
-
//# sourceMappingURL=name.d.ts.map
|
package/dist/name.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../src/name.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3D"}
|
package/dist/name.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The key a class name is filed under — `AuthorUser` → `authorUser`. THE canonical
|
|
3
|
-
* spelling, stated once because three places disagreed and only ever met on one-word
|
|
4
|
-
* names: on `AuthorUser` the card wrote `authoruser` and the derived FK pointed at a
|
|
5
|
-
* table no pass creates. Idempotent, so a card re-describes identically.
|
|
6
|
-
*/
|
|
7
|
-
export function registrationKeyOf(className) {
|
|
8
|
-
return className ? className[0].toLowerCase() + className.slice(1) : className;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=name.js.map
|
package/dist/name.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"name.js","sourceRoot":"","sources":["../src/name.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACjF,CAAC"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import type { BoundaryRef, Lifecycle, Relation, Role, Shape } from '../field/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* The portable schema descriptor — an entity's "carte d'identité".
|
|
4
|
-
*
|
|
5
|
-
* A JSON Schema document: the `shape` axis at the top level, the three axes JSON Schema
|
|
6
|
-
* cannot express under one `x-fougere` key per field. The normal forms ARE the wire form —
|
|
7
|
-
* lifecycle and boundary travel verbatim, no descriptor twin to maintain.
|
|
8
|
-
*
|
|
9
|
-
* What cannot travel becomes a NAME, re-resolved against the consumer's registry: a
|
|
10
|
-
* relation's thunk, a custom generator, a boundary codec.
|
|
11
|
-
*/
|
|
12
|
-
/** JSON Schema's `type` values, plus `null` for the nullable union form. */
|
|
13
|
-
export type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
|
|
14
|
-
/**
|
|
15
|
-
* A shape's constraint keywords, all optional and flattened — the union's branches merged.
|
|
16
|
-
* `type` is NOT here: intersecting the branches would make the discriminant impossible,
|
|
17
|
-
* and the wire genuinely allows a form memory never produces (see below).
|
|
18
|
-
*/
|
|
19
|
-
type ShapeKeywords = UnionToIntersection<KeywordsOf<Shape>>;
|
|
20
|
-
type KeywordsOf<S> = S extends unknown ? Partial<Omit<S, 'type' | 'items' | 'properties'>> : never;
|
|
21
|
-
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
22
|
-
/**
|
|
23
|
-
* One field as a JSON Schema property. The shape keywords sit at the top level
|
|
24
|
-
* (so an external JSON Schema tool reads them directly); the Fougère-only axes
|
|
25
|
-
* live under `x-fougere`. A nullable field folds into the union `type: ['T','null']`.
|
|
26
|
-
*/
|
|
27
|
-
export type FieldDescriptor = ShapeKeywords & {
|
|
28
|
-
/**
|
|
29
|
-
* WIDER than `Shape`, which only ever emits `T` or the canonical `[T,'null']` tuple.
|
|
30
|
-
* A card can come from another language, so the door judges the form; `reconstruct`
|
|
31
|
-
* refuses what it cannot represent rather than pretending it read it.
|
|
32
|
-
*/
|
|
33
|
-
type?: JsonSchemaType | JsonSchemaType[];
|
|
34
|
-
/** A value list's element shape (`list(text())`). A bare `many` relation has none. */
|
|
35
|
-
items?: FieldDescriptor;
|
|
36
|
-
/** An embedded value object (`json(Entity)`): the nested shape-only properties. */
|
|
37
|
-
properties?: Record<string, FieldDescriptor>;
|
|
38
|
-
/** JSON Schema standard keyword — mirrors the field's `description`. */
|
|
39
|
-
description?: string;
|
|
40
|
-
'x-fougere'?: FieldExtension;
|
|
41
|
-
};
|
|
42
|
-
/** The three axes JSON Schema can't express, namespaced under a field's `x-fougere`. */
|
|
43
|
-
export interface FieldExtension {
|
|
44
|
-
role?: RoleDescriptor;
|
|
45
|
-
/** The normal form travels verbatim — named tokens, pure JSON. */
|
|
46
|
-
lifecycle?: Lifecycle;
|
|
47
|
-
boundary?: BoundaryRef;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* The role, with its one unportable member replaced: `unique` names its members on the
|
|
51
|
-
* wire, where in memory a lone `unique()` holds `[]` — a field does not know its own key,
|
|
52
|
-
* a reader of the card must not have to guess it.
|
|
53
|
-
*
|
|
54
|
-
* Names what it KEEPS, like `describeRole` and `reconstructRole` do. Two of the four
|
|
55
|
-
* members do not travel as they are, so portability is not the default a new one gets.
|
|
56
|
-
*/
|
|
57
|
-
export type RoleDescriptor = Pick<Role, 'primary' | 'index'> & {
|
|
58
|
-
unique?: string[][];
|
|
59
|
-
relation?: RelationDescriptor;
|
|
60
|
-
};
|
|
61
|
-
/** The relation, with its thunk replaced: the target is a NAME. */
|
|
62
|
-
export type RelationDescriptor = Pick<Relation, 'kind' | 'onDelete'> & {
|
|
63
|
-
to: string;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* A whole entity as a JSON Schema object document. `version`/`vendor` mirror Standard
|
|
67
|
-
* Schema's own (versioned + vendored), under `x-` extension keywords so the document
|
|
68
|
-
* stays a valid JSON Schema for external tooling.
|
|
69
|
-
*/
|
|
70
|
-
export interface SchemaDescriptor {
|
|
71
|
-
title?: string;
|
|
72
|
-
type: 'object';
|
|
73
|
-
properties: Record<string, FieldDescriptor>;
|
|
74
|
-
/**
|
|
75
|
-
* Create-time semantics: the names a caller MUST supply — no `lifecycle.create`
|
|
76
|
-
* rule answers absence (nor a `many` relation, absent → `[]`). Presence only:
|
|
77
|
-
* a nullable-but-required field IS listed (supply `null`, don't omit the key).
|
|
78
|
-
* Narrower than JSON Schema's context-free `required`: it answers "what must a
|
|
79
|
-
* creation payload carry?", not "what is always present when read?".
|
|
80
|
-
*/
|
|
81
|
-
required?: string[];
|
|
82
|
-
'x-fougere-version': 1;
|
|
83
|
-
'x-fougere-vendor': 'fougere';
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* A self-contained set of entity cards. Every entity lives under `$defs`, keyed by name,
|
|
87
|
-
* and a relation's `to` is that key — a pointer, never an inlined sub-schema, so
|
|
88
|
-
* `Post → Author → Post` is two references and not infinite nesting.
|
|
89
|
-
*/
|
|
90
|
-
export interface SchemaBundle {
|
|
91
|
-
$defs: Record<string, SchemaDescriptor>;
|
|
92
|
-
'x-fougere-version': 1;
|
|
93
|
-
'x-fougere-vendor': 'fougere';
|
|
94
|
-
}
|
|
95
|
-
/** Drop keys whose value is `undefined`, so the descriptor stays clean JSON. */
|
|
96
|
-
export declare function clean<T extends Record<string, unknown>>(obj: T): T;
|
|
97
|
-
export {};
|
|
98
|
-
//# sourceMappingURL=card.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/projections/card.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEvF;;;;;;;;;GASG;AAEH,4EAA4E;AAC5E,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,QAAQ,GACR,OAAO,GACP,MAAM,CAAC;AAEX;;;;GAIG;AACH,KAAK,aAAa,GAAG,mBAAmB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AAI5D,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,YAAY,CAAC,CAAC,GAAG,KAAK,CAAC;AACnG,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC;AAEpH;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG;IAC5C;;;;OAIG;IACH,IAAI,CAAC,EAAE,cAAc,GAAG,cAAc,EAAE,CAAC;IACzC,sFAAsF;IACtF,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EA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,CAAC,CAGlE"}
|
package/dist/projections/card.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../src/projections/card.ts"],"names":[],"mappings":"AAgHA,gFAAgF;AAChF,MAAM,UAAU,KAAK,CAAoC,GAAM;IAC7D,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;IAChF,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { SchemaView } from '../schema/index.js';
|
|
2
|
-
import { type SchemaBundle, type SchemaDescriptor } from './card.js';
|
|
3
|
-
/**
|
|
4
|
-
* Produce the portable card for a schema — THE single canonical serialiser
|
|
5
|
-
* (the hand-rolled copies in adapters call this). `name` titles the entity; it
|
|
6
|
-
* falls back to the schema's source/class name when omitted.
|
|
7
|
-
*/
|
|
8
|
-
export declare function describe(schema: SchemaView, name?: string): SchemaDescriptor;
|
|
9
|
-
/**
|
|
10
|
-
* The name of the schema a view came from — `Post` for `Post`, and `Post` for
|
|
11
|
-
* `Post.pick('title')` too, since a derivation carries its `source`.
|
|
12
|
-
*
|
|
13
|
-
* Exported because two projections need the SAME answer: the card titles an entity with it,
|
|
14
|
-
* and GraphQL names a field's enum type with it — an enum named after the view would give
|
|
15
|
-
* `Post.status` and `CreatePostInput.status` two incompatible types for one set of values.
|
|
16
|
-
*/
|
|
17
|
-
export declare function sourceNameOf(schema: SchemaView): string | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Describe a whole set of entities as one self-contained bundle (the `$defs`
|
|
20
|
-
* document). Accepts a name→schema record or an array (names taken from the
|
|
21
|
-
* schemas). Keys carry the registration key, the same spelling `describe` gives a
|
|
22
|
-
* relation's `to`, so `$ref`-by-name resolves cleanly in {@link reconstructSet}.
|
|
23
|
-
*/
|
|
24
|
-
export declare function describeSet(schemas: Record<string, SchemaView> | SchemaView[]): SchemaBundle;
|
|
25
|
-
//# sourceMappingURL=describe.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/projections/describe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AAmEnB;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAiB5E;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAGnE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,UAAU,EAAE,GAAG,YAAY,CAU5F"}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { uniqueMembers, boundaryOf } from '../field/index.js';
|
|
2
|
-
import { registrationKeyOf } from '../name.js';
|
|
3
|
-
import { clean, } from './card.js';
|
|
4
|
-
// ─── describe — schema → card (the single canonical serialiser) ────
|
|
5
|
-
/**
|
|
6
|
-
* A caller must supply this field: no create rule answers absence, and it is not
|
|
7
|
-
* a `many` relation (absent → `[]`). Presence only — nullability is the OTHER
|
|
8
|
-
* axis: a `nullable()` field stays required (the caller may supply `null`, not
|
|
9
|
-
* omit the key), exactly what `validateFields` enforces.
|
|
10
|
-
*/
|
|
11
|
-
function isRequired(field) {
|
|
12
|
-
// Read `boundary` for the same reason `validateFields` does: a server-owned
|
|
13
|
-
// field is one a caller may never supply, so listing it as required states a
|
|
14
|
-
// demand the door then refuses with `Read-only`. Same stance as OpenAPI's
|
|
15
|
-
// readOnly+required, and the two readers now answer from the same axis.
|
|
16
|
-
if (boundaryOf(field).in === 'closed')
|
|
17
|
-
return false;
|
|
18
|
-
if (field.lifecycle?.create !== undefined)
|
|
19
|
-
return false;
|
|
20
|
-
if (field.role?.relation?.kind === 'many')
|
|
21
|
-
return false;
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
function describeRole(role, key) {
|
|
25
|
-
const out = {};
|
|
26
|
-
if (role.primary)
|
|
27
|
-
out.primary = true;
|
|
28
|
-
// Members are spelled out on the wire: in memory a lone `unique()` holds the empty
|
|
29
|
-
// self-reference (a field cannot name its own key), and a consumer has no way to know
|
|
30
|
-
// which field a group hangs on. `key` is that missing half, so it is resolved here.
|
|
31
|
-
if (role.unique?.length)
|
|
32
|
-
out.unique = role.unique.map((group) => uniqueMembers(group, key));
|
|
33
|
-
if (role.index)
|
|
34
|
-
out.index = true;
|
|
35
|
-
if (role.relation) {
|
|
36
|
-
out.relation = clean({
|
|
37
|
-
to: registrationKeyOf(role.relation.to().name ?? ''), // thunk → name
|
|
38
|
-
kind: role.relation.kind,
|
|
39
|
-
onDelete: role.relation.onDelete,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return Object.keys(out).length ? out : undefined;
|
|
43
|
-
}
|
|
44
|
-
function describeExtension(field, key) {
|
|
45
|
-
const ext = {};
|
|
46
|
-
if (field.role)
|
|
47
|
-
ext.role = describeRole(field.role, key);
|
|
48
|
-
// The normal forms are named tokens, pure JSON — they travel verbatim
|
|
49
|
-
// (a custom generator travels by NAME, re-resolved against the consumer's registry).
|
|
50
|
-
if (field.lifecycle)
|
|
51
|
-
ext.lifecycle = field.lifecycle;
|
|
52
|
-
// Carry only an explicit override; the derived default (date → isoDate) is
|
|
53
|
-
// re-derived from `shape.format` on reconstruction (convention over config).
|
|
54
|
-
if (field.boundary !== undefined)
|
|
55
|
-
ext.boundary = field.boundary;
|
|
56
|
-
clean(ext);
|
|
57
|
-
return Object.keys(ext).length ? ext : undefined;
|
|
58
|
-
}
|
|
59
|
-
function describeField(field, key) {
|
|
60
|
-
const out = {};
|
|
61
|
-
// Shape is already JSON Schema's vocabulary — nullability included, as the
|
|
62
|
-
// `[T,'null']` type union — so its keywords copy verbatim (an embedded object's
|
|
63
|
-
// `properties`/`required` too, themselves shape-only).
|
|
64
|
-
for (const [key, value] of Object.entries(field.shape)) {
|
|
65
|
-
if (value === undefined)
|
|
66
|
-
continue;
|
|
67
|
-
out[key] = value;
|
|
68
|
-
}
|
|
69
|
-
if (field.meta?.description)
|
|
70
|
-
out.description = field.meta.description;
|
|
71
|
-
const ext = describeExtension(field, key);
|
|
72
|
-
if (ext)
|
|
73
|
-
out['x-fougere'] = ext;
|
|
74
|
-
return out;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Produce the portable card for a schema — THE single canonical serialiser
|
|
78
|
-
* (the hand-rolled copies in adapters call this). `name` titles the entity; it
|
|
79
|
-
* falls back to the schema's source/class name when omitted.
|
|
80
|
-
*/
|
|
81
|
-
export function describe(schema, name) {
|
|
82
|
-
const properties = {};
|
|
83
|
-
const required = [];
|
|
84
|
-
for (const [key, field] of Object.entries(schema.getFields())) {
|
|
85
|
-
properties[key] = describeField(field, key);
|
|
86
|
-
if (isRequired(field))
|
|
87
|
-
required.push(key);
|
|
88
|
-
}
|
|
89
|
-
const descriptor = {
|
|
90
|
-
type: 'object',
|
|
91
|
-
properties,
|
|
92
|
-
'x-fougere-version': 1,
|
|
93
|
-
'x-fougere-vendor': 'fougere',
|
|
94
|
-
};
|
|
95
|
-
const title = name ?? sourceNameOf(schema);
|
|
96
|
-
if (title)
|
|
97
|
-
descriptor.title = title;
|
|
98
|
-
if (required.length)
|
|
99
|
-
descriptor.required = required;
|
|
100
|
-
return descriptor;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* The name of the schema a view came from — `Post` for `Post`, and `Post` for
|
|
104
|
-
* `Post.pick('title')` too, since a derivation carries its `source`.
|
|
105
|
-
*
|
|
106
|
-
* Exported because two projections need the SAME answer: the card titles an entity with it,
|
|
107
|
-
* and GraphQL names a field's enum type with it — an enum named after the view would give
|
|
108
|
-
* `Post.status` and `CreatePostInput.status` two incompatible types for one set of values.
|
|
109
|
-
*/
|
|
110
|
-
export function sourceNameOf(schema) {
|
|
111
|
-
const s = schema;
|
|
112
|
-
return s.source?.name ?? s.name;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Describe a whole set of entities as one self-contained bundle (the `$defs`
|
|
116
|
-
* document). Accepts a name→schema record or an array (names taken from the
|
|
117
|
-
* schemas). Keys carry the registration key, the same spelling `describe` gives a
|
|
118
|
-
* relation's `to`, so `$ref`-by-name resolves cleanly in {@link reconstructSet}.
|
|
119
|
-
*/
|
|
120
|
-
export function describeSet(schemas) {
|
|
121
|
-
const entries = Array.isArray(schemas)
|
|
122
|
-
? schemas.map((s) => [sourceNameOf(s) ?? '', s])
|
|
123
|
-
: Object.entries(schemas);
|
|
124
|
-
const $defs = {};
|
|
125
|
-
for (const [name, schema] of entries) {
|
|
126
|
-
const key = registrationKeyOf(name);
|
|
127
|
-
$defs[key] = describe(schema, key);
|
|
128
|
-
}
|
|
129
|
-
return { $defs, 'x-fougere-version': 1, 'x-fougere-vendor': 'fougere' };
|
|
130
|
-
}
|
|
131
|
-
//# sourceMappingURL=describe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/projections/describe.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,KAAK,GAON,MAAM,WAAW,CAAC;AAEnB,sEAAsE;AAEtE;;;;;GAKG;AACH,SAAS,UAAU,CAAC,KAAY;IAC9B,4EAA4E;IAC5E,6EAA6E;IAC7E,0EAA0E;IAC1E,wEAAwE;IACxE,IAAI,UAAU,C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AAC;IAC5B,MAAM,KAAK,GAAqC,EAAE,CAAC;IACnD,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACpC,KAAK,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC,EAAE,kBAAkB,EAAE,SAAS,EAAE,CAAC;AAC1E,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Fields } from '../field/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Egress: encode a domain record into its wire form, field by field — the dual of
|
|
4
|
-
* `validateFields` (which decodes on ingress). A write-only field (boundary
|
|
5
|
-
* `out: 'closed'`, e.g. a password) is OMITTED — it never crosses outbound.
|
|
6
|
-
* Keys absent from `fields` (e.g. presenter computed fields) pass through
|
|
7
|
-
* untouched; null/undefined are left as-is.
|
|
8
|
-
* Shallow by design: a relation's nested rows are not deep-encoded here.
|
|
9
|
-
*/
|
|
10
|
-
export declare function encodeFields(fields: Fields, record: Record<string, unknown>): Record<string, unknown>;
|
|
11
|
-
//# sourceMappingURL=encode.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../src/projections/encode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUrG"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { boundaryOf, resolveBoundary } from '../field/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Egress: encode a domain record into its wire form, field by field — the dual of
|
|
4
|
-
* `validateFields` (which decodes on ingress). A write-only field (boundary
|
|
5
|
-
* `out: 'closed'`, e.g. a password) is OMITTED — it never crosses outbound.
|
|
6
|
-
* Keys absent from `fields` (e.g. presenter computed fields) pass through
|
|
7
|
-
* untouched; null/undefined are left as-is.
|
|
8
|
-
* Shallow by design: a relation's nested rows are not deep-encoded here.
|
|
9
|
-
*/
|
|
10
|
-
export function encodeFields(fields, record) {
|
|
11
|
-
const out = { ...record };
|
|
12
|
-
for (const [key, field] of Object.entries(fields)) {
|
|
13
|
-
if (!(key in record))
|
|
14
|
-
continue;
|
|
15
|
-
if (boundaryOf(field).out === 'closed') {
|
|
16
|
-
delete out[key];
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
const value = record[key];
|
|
20
|
-
if (value === null || value === undefined)
|
|
21
|
-
continue;
|
|
22
|
-
out[key] = resolveBoundary(field).encode(value);
|
|
23
|
-
}
|
|
24
|
-
return out;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=encode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encode.js","sourceRoot":"","sources":["../../src/projections/encode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,MAA+B;IAC1E,MAAM,GAAG,GAA4B,EAAE,GAAG,MAAM,EAAE,CAAC;IACnD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC;YAAE,SAAS;QAC/B,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;YAAC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;YAAC,SAAS;QAAC,CAAC;QACtE,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QACpD,GAAG,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|