@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/projections/io.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Fields } from '../field/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* The two dual projections of a field set onto a client surface — membership only. The
|
|
4
|
-
* create/patch MODE changes omissibility, which the view carries, never membership.
|
|
5
|
-
*
|
|
6
|
-
* ⚠️ The audience lives here and not in the data: no axis says "client". Surfaces are
|
|
7
|
-
* supposed to read these two functions, and the GraphQL input, the judge and the CLI each
|
|
8
|
-
* restate the rules with a different set — the judge being the most permissive.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Ingress: what a CLIENT may supply. Excluded —
|
|
12
|
-
* - `role.primary` → identity is system-owned
|
|
13
|
-
* - `lifecycle.create === 'now'` → managed timestamps are stamped, not supplied
|
|
14
|
-
* - `role.relation.kind 'many'` → the collection lives on the other side
|
|
15
|
-
* - `boundary.in === 'closed'` → read-only, never accepted from a client
|
|
16
|
-
*/
|
|
17
|
-
export declare function inputFields(fields: Fields): Fields;
|
|
18
|
-
/**
|
|
19
|
-
* Egress: what a CLIENT may read. Excluded —
|
|
20
|
-
* - `boundary.out === 'closed'` → write-only (password), never emitted
|
|
21
|
-
* (`encodeFields` also omits them at runtime; types and payloads agree.)
|
|
22
|
-
*/
|
|
23
|
-
export declare function outputFields(fields: Fields): Fields;
|
|
24
|
-
//# sourceMappingURL=io.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../src/projections/io.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUlD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAOnD"}
|
package/dist/projections/io.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { boundaryOf } from '../field/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* The two dual projections of a field set onto a client surface — membership only. The
|
|
4
|
-
* create/patch MODE changes omissibility, which the view carries, never membership.
|
|
5
|
-
*
|
|
6
|
-
* ⚠️ The audience lives here and not in the data: no axis says "client". Surfaces are
|
|
7
|
-
* supposed to read these two functions, and the GraphQL input, the judge and the CLI each
|
|
8
|
-
* restate the rules with a different set — the judge being the most permissive.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Ingress: what a CLIENT may supply. Excluded —
|
|
12
|
-
* - `role.primary` → identity is system-owned
|
|
13
|
-
* - `lifecycle.create === 'now'` → managed timestamps are stamped, not supplied
|
|
14
|
-
* - `role.relation.kind 'many'` → the collection lives on the other side
|
|
15
|
-
* - `boundary.in === 'closed'` → read-only, never accepted from a client
|
|
16
|
-
*/
|
|
17
|
-
export function inputFields(fields) {
|
|
18
|
-
const result = {};
|
|
19
|
-
for (const [name, field] of Object.entries(fields)) {
|
|
20
|
-
if (field.role?.primary)
|
|
21
|
-
continue;
|
|
22
|
-
if (field.lifecycle?.create === 'now')
|
|
23
|
-
continue;
|
|
24
|
-
if (field.role?.relation?.kind === 'many')
|
|
25
|
-
continue;
|
|
26
|
-
if (boundaryOf(field).in === 'closed')
|
|
27
|
-
continue;
|
|
28
|
-
result[name] = field;
|
|
29
|
-
}
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Egress: what a CLIENT may read. Excluded —
|
|
34
|
-
* - `boundary.out === 'closed'` → write-only (password), never emitted
|
|
35
|
-
* (`encodeFields` also omits them at runtime; types and payloads agree.)
|
|
36
|
-
*/
|
|
37
|
-
export function outputFields(fields) {
|
|
38
|
-
const result = {};
|
|
39
|
-
for (const [name, field] of Object.entries(fields)) {
|
|
40
|
-
if (boundaryOf(field).out === 'closed')
|
|
41
|
-
continue;
|
|
42
|
-
result[name] = field;
|
|
43
|
-
}
|
|
44
|
-
return result;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=io.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../src/projections/io.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,MAAM,MAAM,GAAW,EAAE,CAAC;IAC1B,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,IAAI,KAAK,CAAC,IAAI,EAAE,OAAO;YAAE,SAAS;QAClC,IAAI,KAAK,CAAC,SAAS,EAAE,MAAM,KAAK,KAAK;YAAE,SAAS;QAChD,IAAI,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,KAAK,MAAM;YAAE,SAAS;QACpD,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,QAAQ;YAAE,SAAS;QAChD,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,MAAM,GAAW,EAAE,CAAC;IAC1B,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,QAAQ;YAAE,SAAS;QACjD,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The lifecycle axis, realized — once, for every storage.
|
|
3
|
-
*
|
|
4
|
-
* The judge answers "is this value legal" and never fills a hole; filling it — stamp
|
|
5
|
-
* `'now'`, apply `{ value }`, call `{ generate }` — belongs to the storage at the point of
|
|
6
|
-
* persistence. Shipping the rule without its realization made each storage rewrite it, and
|
|
7
|
-
* they drifted: one entity with a `default` answered `'draft'` on SQL and `undefined` on
|
|
8
|
-
* Mongo. `update: 'forbidden'` is NOT here — refusing is a judgment.
|
|
9
|
-
*/
|
|
10
|
-
import { type Fields } from '../field/index.js';
|
|
11
|
-
type Row = Record<string, unknown>;
|
|
12
|
-
/**
|
|
13
|
-
* Fill what the entity says the system writes at creation.
|
|
14
|
-
*
|
|
15
|
-
* A value the caller supplied is never touched, including `null` — presence is the
|
|
16
|
-
* test, not truthiness, so `archivedAt: null` stays null rather than being re-filled.
|
|
17
|
-
*
|
|
18
|
-
* `'now'` produces a `Date`, the value the field declares. The storage converts it if
|
|
19
|
-
* its driver needs something else (`schema-sql/src/values.ts` does exactly that) —
|
|
20
|
-
* which is the same direction every other value travels.
|
|
21
|
-
*/
|
|
22
|
-
export declare function applyCreate(fields: Fields, input: Row): Row;
|
|
23
|
-
/**
|
|
24
|
-
* Fill what the entity says the system writes at every update — `updated()`, and
|
|
25
|
-
* nothing else. A supplied value wins, same rule as create.
|
|
26
|
-
*/
|
|
27
|
-
export declare function applyUpdate(fields: Fields, patch: Row): Row;
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/projections/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAsC,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGpF,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAsBnC;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG,CAqB3D;AAgBD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG,CAS3D"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The lifecycle axis, realized — once, for every storage.
|
|
3
|
-
*
|
|
4
|
-
* The judge answers "is this value legal" and never fills a hole; filling it — stamp
|
|
5
|
-
* `'now'`, apply `{ value }`, call `{ generate }` — belongs to the storage at the point of
|
|
6
|
-
* persistence. Shipping the rule without its realization made each storage rewrite it, and
|
|
7
|
-
* they drifted: one entity with a `default` answered `'draft'` on SQL and `undefined` on
|
|
8
|
-
* Mongo. `update: 'forbidden'` is NOT here — refusing is a judgment.
|
|
9
|
-
*/
|
|
10
|
-
import { resolveCustomGenerator } from '../field/index.js';
|
|
11
|
-
import { createId } from '@paralleldrive/cuid2';
|
|
12
|
-
/** Resolve a generator TOKEN to a function — a registered name wins over a built-in. */
|
|
13
|
-
function generatorFor(ref) {
|
|
14
|
-
const custom = resolveCustomGenerator(ref);
|
|
15
|
-
if (custom)
|
|
16
|
-
return custom;
|
|
17
|
-
switch (ref) {
|
|
18
|
-
case 'cuid2': return createId;
|
|
19
|
-
case 'uuid': return () => globalThis.crypto.randomUUID();
|
|
20
|
-
case 'nanoid': {
|
|
21
|
-
return () => {
|
|
22
|
-
const bytes = new Uint8Array(21);
|
|
23
|
-
globalThis.crypto.getRandomValues(bytes);
|
|
24
|
-
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
|
|
25
|
-
return Array.from(bytes, (b) => alphabet[b & 63]).join('');
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
default:
|
|
29
|
-
throw new Error(`Unknown generator '${ref}' — register it with registerGenerator('${ref}', fn)`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Fill what the entity says the system writes at creation.
|
|
34
|
-
*
|
|
35
|
-
* A value the caller supplied is never touched, including `null` — presence is the
|
|
36
|
-
* test, not truthiness, so `archivedAt: null` stays null rather than being re-filled.
|
|
37
|
-
*
|
|
38
|
-
* `'now'` produces a `Date`, the value the field declares. The storage converts it if
|
|
39
|
-
* its driver needs something else (`schema-sql/src/values.ts` does exactly that) —
|
|
40
|
-
* which is the same direction every other value travels.
|
|
41
|
-
*/
|
|
42
|
-
export function applyCreate(fields, input) {
|
|
43
|
-
const out = { ...input };
|
|
44
|
-
const instant = Date.now();
|
|
45
|
-
for (const [name, field] of Object.entries(fields)) {
|
|
46
|
-
if (name in out)
|
|
47
|
-
continue;
|
|
48
|
-
const create = field.lifecycle?.create;
|
|
49
|
-
if (create === 'now') {
|
|
50
|
-
// One instant, one Date PER FIELD. `created()` and `updated()` on the same entity
|
|
51
|
-
// would otherwise hold the same object, so mutating `updatedAt` would move an
|
|
52
|
-
// immutable `createdAt` with it — invisible where a storage serializes on write
|
|
53
|
-
// (SQL), lasting where it does not (an in-memory store keeps the row as handed).
|
|
54
|
-
out[name] = new Date(instant);
|
|
55
|
-
}
|
|
56
|
-
else if (typeof create === 'object' && create !== null) {
|
|
57
|
-
if ('value' in create)
|
|
58
|
-
out[name] = freshValue(create.value);
|
|
59
|
-
else if ('generate' in create)
|
|
60
|
-
out[name] = generatorFor(String(create.generate))();
|
|
61
|
-
}
|
|
62
|
-
// `'optional'` and an absent rule both mean: the system writes nothing here.
|
|
63
|
-
}
|
|
64
|
-
return out;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* A declared default is written into every row, so handing out the declaration itself
|
|
68
|
-
* would alias every row to it — mutate one, mutate the field and all its siblings.
|
|
69
|
-
*
|
|
70
|
-
* Every default the vocabulary can express is a primitive (`text`, `number`, `bool`,
|
|
71
|
-
* `oneOf`; `list` and `json` take none), so this only pays for itself under the escape
|
|
72
|
-
* hatch — `new Field({ shape, lifecycle: { create: { value: {…} } } })`. Cheap insurance
|
|
73
|
-
* against the one failure mode nobody would ever debug from the symptom.
|
|
74
|
-
*/
|
|
75
|
-
function freshValue(value) {
|
|
76
|
-
if (value === null || typeof value !== 'object')
|
|
77
|
-
return value;
|
|
78
|
-
return structuredClone(value);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Fill what the entity says the system writes at every update — `updated()`, and
|
|
82
|
-
* nothing else. A supplied value wins, same rule as create.
|
|
83
|
-
*/
|
|
84
|
-
export function applyUpdate(fields, patch) {
|
|
85
|
-
const out = { ...patch };
|
|
86
|
-
const instant = Date.now();
|
|
87
|
-
for (const [name, field] of Object.entries(fields)) {
|
|
88
|
-
if (field.lifecycle?.update === 'now' && !(name in out))
|
|
89
|
-
out[name] = new Date(instant);
|
|
90
|
-
}
|
|
91
|
-
return out;
|
|
92
|
-
}
|
|
93
|
-
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/projections/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,sBAAsB,EAA2B,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIhD,wFAAwF;AACxF,SAAS,YAAY,CAAC,GAAW;I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{ Field, type Fields } from '../field/index.js';
|
|
2
|
-
import { type SchemaConstructor, type SchemaView, type Row } from '../schema/index.js';
|
|
3
|
-
import { type SchemaBundle, type SchemaDescriptor } from './card.js';
|
|
4
|
-
/**
|
|
5
|
-
* The field map a stated row shape implies. A card describes rows as they are READ, so
|
|
6
|
-
* `required` answers what a creation payload must carry — a question a synced consumer
|
|
7
|
-
* never asks, since it calls the host rather than constructing.
|
|
8
|
-
*/
|
|
9
|
-
type FieldsOf<T> = {
|
|
10
|
-
[K in keyof T]-?: Field<T[K]>;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Read a lone card back into a working schema — THE single reconstructor. The result
|
|
14
|
-
* carries its `~standard` (live validation) rebuilt locally: the descriptor crosses
|
|
15
|
-
* the wire as data, the behaviour is reconstituted here. Relations stay name stand-ins
|
|
16
|
-
* (no set to resolve against — use {@link reconstructSet} for live targets).
|
|
17
|
-
*
|
|
18
|
-
* `T` states the row, which is what makes a rebuilt schema a CLASS and not a type beside a
|
|
19
|
-
* value: `class Post extends reconstruct<{…}>(card) {}`, one declaration carrying both.
|
|
20
|
-
* Without it the instance type is an index signature, so `post.titel` compiled.
|
|
21
|
-
*/
|
|
22
|
-
export declare function reconstruct<T = Row<Fields>>(descriptor: SchemaDescriptor): SchemaConstructor<FieldsOf<T>>;
|
|
23
|
-
/**
|
|
24
|
-
* Read a whole bundle back into live schemas, keyed by name — THE set reconstructor.
|
|
25
|
-
* Every entity is rebuilt against a shared `$defs` resolver, so a relation's `to()`
|
|
26
|
-
* hands back the real reconstructed target (feeds adapters), not a name stand-in.
|
|
27
|
-
* Targets absent from the set (external/cross-frond `$ref`) keep the stand-in.
|
|
28
|
-
*/
|
|
29
|
-
export declare function reconstructSet(bundle: SchemaBundle): Record<string, SchemaView>;
|
|
30
|
-
export {};
|
|
31
|
-
//# sourceMappingURL=reconstruct.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reconstruct.d.ts","sourceRoot":"","sources":["../../src/projections/reconstruct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAEL,KAAK,MAAM,EAGZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAU,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AAyHnB;;;;GAIG;AACH,KAAK,QAAQ,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EACzC,UAAU,EAAE,gBAAgB,GAC3B,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAEhC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAa/E"}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Field, } from '../field/index.js';
|
|
2
|
-
import { Schema } from '../schema/index.js';
|
|
3
|
-
import { clean, } from './card.js';
|
|
4
|
-
// ─── reconstruct — card → schema (the single reconstructor) ────────
|
|
5
|
-
/**
|
|
6
|
-
* Read a JSON Schema property back into a Fougère shape. The `type` travels
|
|
7
|
-
* VERBATIM — nullability is the `[T,'null']` union on both sides, so there is
|
|
8
|
-
* nothing to split; only the keyword subset of the base type is picked.
|
|
9
|
-
*/
|
|
10
|
-
function reconstructShape(prop) {
|
|
11
|
-
const types = Array.isArray(prop.type) ? prop.type : prop.type ? [prop.type] : [];
|
|
12
|
-
const base = types.find((t) => t !== 'null');
|
|
13
|
-
if (base === undefined)
|
|
14
|
-
return undefined;
|
|
15
|
-
const type = prop.type;
|
|
16
|
-
// `array` with `items` is a value list, without it a `many` relation whose elements
|
|
17
|
-
// live on the other side. Both are array shapes; only the role tells them apart, and
|
|
18
|
-
// it travels in `x-fougere`. Nothing to branch on here — the keywords copy back.
|
|
19
|
-
if (base === 'array') {
|
|
20
|
-
const items = prop.items ? reconstructShape(prop.items) : undefined;
|
|
21
|
-
return clean({ type, items, minItems: prop.minItems, maxItems: prop.maxItems });
|
|
22
|
-
}
|
|
23
|
-
switch (base) {
|
|
24
|
-
case 'string':
|
|
25
|
-
return clean({ type, minLength: prop.minLength, maxLength: prop.maxLength, pattern: prop.pattern, enum: prop.enum, format: prop.format });
|
|
26
|
-
case 'number':
|
|
27
|
-
case 'integer':
|
|
28
|
-
return clean({ type, minimum: prop.minimum, maximum: prop.maximum });
|
|
29
|
-
case 'boolean':
|
|
30
|
-
return { type };
|
|
31
|
-
default: // 'object' or anything unrecognised → opaque value (nesting travels verbatim)
|
|
32
|
-
return clean({ type, properties: prop.properties, required: prop.required });
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function reconstructRole(role, resolve) {
|
|
36
|
-
const out = {};
|
|
37
|
-
if (role.primary)
|
|
38
|
-
out.primary = true;
|
|
39
|
-
// Members arrive spelled out and stay that way — a single-member group read back as the
|
|
40
|
-
// empty self-reference would re-describe identically but lose the distinction for no
|
|
41
|
-
// gain. `uniqueMembers` treats a named group as already resolved.
|
|
42
|
-
if (role.unique?.length)
|
|
43
|
-
out.unique = role.unique.map((group) => [...group]);
|
|
44
|
-
if (role.index)
|
|
45
|
-
out.index = true;
|
|
46
|
-
if (role.relation) {
|
|
47
|
-
const name = role.relation.to;
|
|
48
|
-
out.relation = {
|
|
49
|
-
// `to` is the `$ref` (a name). With a resolver (a bundle), it hands back the real
|
|
50
|
-
// reconstructed target — adapters can read its fields. Lazy, so circular relations
|
|
51
|
-
// resolve fine. Without one (a lone card), a name-only stand-in: enough to validate
|
|
52
|
-
// (`kind`) and re-describe identically, but not to feed an adapter.
|
|
53
|
-
to: () => resolve?.(name) ?? { name },
|
|
54
|
-
kind: role.relation.kind,
|
|
55
|
-
...(role.relation.onDelete ? { onDelete: role.relation.onDelete } : {}),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
return out;
|
|
59
|
-
}
|
|
60
|
-
function reconstructField(prop, key, resolve) {
|
|
61
|
-
const ext = prop['x-fougere'];
|
|
62
|
-
const shape = reconstructShape(prop);
|
|
63
|
-
// A card that names no type for a property cannot become a field: every field states a
|
|
64
|
-
// shape. Loud and local, at the property that is missing it — the alternative is a field
|
|
65
|
-
// that judges nothing, which is what this whole rule exists to stop.
|
|
66
|
-
if (!shape) {
|
|
67
|
-
throw new Error(`Field '${key}': the card carries no \`type\` for it, so there is no shape to rebuild. `
|
|
68
|
-
+ `A field always states one.`);
|
|
69
|
-
}
|
|
70
|
-
return new Field({
|
|
71
|
-
shape,
|
|
72
|
-
role: ext?.role ? reconstructRole(ext.role, resolve) : undefined,
|
|
73
|
-
// The normal forms are pure JSON — they travelled verbatim, they read back verbatim.
|
|
74
|
-
lifecycle: ext?.lifecycle,
|
|
75
|
-
boundary: ext?.boundary,
|
|
76
|
-
meta: prop.description !== undefined ? { description: prop.description } : undefined,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* The entity-level groups implied by the fields — the inverse of
|
|
81
|
-
* `projectUniqueOntoFields`. Only groups of more than one member: a lone `unique(slug)`
|
|
82
|
-
* is fully stated by the field's own role, and listing it here would make `getUnique()`
|
|
83
|
-
* answer a composite the author never declared.
|
|
84
|
-
*/
|
|
85
|
-
function compositeFromFields(fields) {
|
|
86
|
-
const seen = new Map();
|
|
87
|
-
for (const field of Object.values(fields)) {
|
|
88
|
-
for (const group of field.role?.unique ?? []) {
|
|
89
|
-
if (group.length < 2)
|
|
90
|
-
continue;
|
|
91
|
-
// `JSON.stringify` and not a separator byte: a NUL made `grep` read the file as binary.
|
|
92
|
-
seen.set(JSON.stringify(group), [...group]);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return seen.size ? [...seen.values()] : undefined;
|
|
96
|
-
}
|
|
97
|
-
/** Build a live schema from a card; `resolve` wires relation targets when in a bundle. */
|
|
98
|
-
function buildSchema(descriptor, resolve) {
|
|
99
|
-
const fields = {};
|
|
100
|
-
for (const [key, prop] of Object.entries(descriptor.properties)) {
|
|
101
|
-
fields[key] = reconstructField(prop, key, resolve);
|
|
102
|
-
}
|
|
103
|
-
// The card holds the fact once per MEMBER, so a group of two arrives twice — de-duplicate
|
|
104
|
-
// it and `getUnique()` answers what the author wrote.
|
|
105
|
-
const schema = Schema.of(fields, undefined, undefined, {}, compositeFromFields(fields));
|
|
106
|
-
// The name is what everything downstream keys on — the table, the GraphQL type, a
|
|
107
|
-
// relation's `to`. `reconstructSet` overrides it with the bundle key, more specific.
|
|
108
|
-
if (descriptor.title) {
|
|
109
|
-
Object.defineProperty(schema, 'name', { value: descriptor.title, configurable: true });
|
|
110
|
-
}
|
|
111
|
-
return schema;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Read a lone card back into a working schema — THE single reconstructor. The result
|
|
115
|
-
* carries its `~standard` (live validation) rebuilt locally: the descriptor crosses
|
|
116
|
-
* the wire as data, the behaviour is reconstituted here. Relations stay name stand-ins
|
|
117
|
-
* (no set to resolve against — use {@link reconstructSet} for live targets).
|
|
118
|
-
*
|
|
119
|
-
* `T` states the row, which is what makes a rebuilt schema a CLASS and not a type beside a
|
|
120
|
-
* value: `class Post extends reconstruct<{…}>(card) {}`, one declaration carrying both.
|
|
121
|
-
* Without it the instance type is an index signature, so `post.titel` compiled.
|
|
122
|
-
*/
|
|
123
|
-
export function reconstruct(descriptor) {
|
|
124
|
-
return buildSchema(descriptor);
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Read a whole bundle back into live schemas, keyed by name — THE set reconstructor.
|
|
128
|
-
* Every entity is rebuilt against a shared `$defs` resolver, so a relation's `to()`
|
|
129
|
-
* hands back the real reconstructed target (feeds adapters), not a name stand-in.
|
|
130
|
-
* Targets absent from the set (external/cross-frond `$ref`) keep the stand-in.
|
|
131
|
-
*/
|
|
132
|
-
export function reconstructSet(bundle) {
|
|
133
|
-
const map = {};
|
|
134
|
-
const resolve = (name) => map[name.toLowerCase()];
|
|
135
|
-
const out = {};
|
|
136
|
-
for (const [name, descriptor] of Object.entries(bundle.$defs)) {
|
|
137
|
-
const schema = buildSchema(descriptor, resolve);
|
|
138
|
-
// Named after its key so re-describing yields the same `to`. `to` is lazy, so the map
|
|
139
|
-
// need only be full before the first call — true once this loop ends.
|
|
140
|
-
Object.defineProperty(schema, 'name', { value: name, configurable: true });
|
|
141
|
-
map[name.toLowerCase()] = schema;
|
|
142
|
-
out[name] = schema;
|
|
143
|
-
}
|
|
144
|
-
return out;
|
|
145
|
-
}
|
|
146
|
-
//# sourceMappingURL=reconstruct.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reconstruct.js","sourceRoot":"","sources":["../../src/projections/reconstruct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAKN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAqD,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EACL,KAAK,GAKN,MAAM,WAAW,CAAC;AAEnB,sEAAsE;AAEtE;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,IAAqB;IAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClF,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;IAC7C,IAAI,IAAI,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AC,GAAG,MAAsC,CAAC;QACjE,GAAG,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IACrB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Fields } from '../field/index.js';
|
|
2
|
-
import type { SchemaView } from '../schema/index.js';
|
|
3
|
-
import type { SchemaDescriptor } from './card.js';
|
|
4
|
-
/**
|
|
5
|
-
* The two forms a schema reaches an adapter in. In-process it gets the class; from a
|
|
6
|
-
* remote or foreign frond it gets the card, because a class does not cross a wire. Naming
|
|
7
|
-
* the union is what lets one projection serve both.
|
|
8
|
-
*/
|
|
9
|
-
export type SchemaSource = SchemaView | SchemaDescriptor;
|
|
10
|
-
/**
|
|
11
|
-
* Normalize a source to a live schema. Call it ONCE, at the adapter's boundary:
|
|
12
|
-
* `reconstruct` runs per call (6.5 µs for 17 fields), so reading fields in two places
|
|
13
|
-
* would rebuild the schema twice and hold two unrelated field objects.
|
|
14
|
-
*/
|
|
15
|
-
export declare function schemaOf(source: SchemaSource): SchemaView;
|
|
16
|
-
/** The fields an adapter projects from, whichever form it was handed. */
|
|
17
|
-
export declare function fieldsOf(source: SchemaSource): Fields;
|
|
18
|
-
//# sourceMappingURL=source.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/projections/source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGlD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,gBAAgB,CAAC;AAOzD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAEzD;AAED,yEAAyE;AACzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAErD"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { reconstruct } from './reconstruct.js';
|
|
2
|
-
/** A card is the plain document — no behaviour, so no `getFields`. */
|
|
3
|
-
function isDescriptor(source) {
|
|
4
|
-
return typeof source.getFields !== 'function';
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Normalize a source to a live schema. Call it ONCE, at the adapter's boundary:
|
|
8
|
-
* `reconstruct` runs per call (6.5 µs for 17 fields), so reading fields in two places
|
|
9
|
-
* would rebuild the schema twice and hold two unrelated field objects.
|
|
10
|
-
*/
|
|
11
|
-
export function schemaOf(source) {
|
|
12
|
-
return isDescriptor(source) ? reconstruct(source) : source;
|
|
13
|
-
}
|
|
14
|
-
/** The fields an adapter projects from, whichever form it was handed. */
|
|
15
|
-
export function fieldsOf(source) {
|
|
16
|
-
return schemaOf(source).getFields();
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=source.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/projections/source.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAS/C,sEAAsE;AACtE,SAAS,YAAY,CAAC,MAAoB;IACxC,OAAO,OAAQ,MAAqB,CAAC,SAAS,KAAK,UAAU,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAoB;IAC3C,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAC7D,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,QAAQ,CAAC,MAAoB;IAC3C,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|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KAAK,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,KAAK;QAC7C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;QACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB;IAED,KAAK,UAAU,CAAC,MAAM,SAAS,gBAAgB,IAAI,WAAW,CAC5D,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAC7B,CAAC,OAAO,CAAC,CAAC;IAEX,KAAK,WAAW,CAAC,MAAM,SAAS,gBAAgB,IAAI,WAAW,CAC7D,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAC7B,CAAC,QAAQ,CAAC,CAAC;CACb"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standard Schema v1 — types inlined from @standard-schema/spec.
|
|
3
|
-
*
|
|
4
|
-
* We inline instead of depending on the package to keep @fougere/schema zero-dep.
|
|
5
|
-
* The spec is stable (v1) and unlikely to change.
|
|
6
|
-
*
|
|
7
|
-
* @see https://standardschema.dev/
|
|
8
|
-
*/
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=standard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"standard.js","sourceRoot":"","sources":["../../src/projections/standard.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { SchemaDescriptor } from './card.js';
|
|
2
|
-
export interface TypeSourceOptions {
|
|
3
|
-
/** Name of the emitted interface. Defaults to the card's `title`, capitalized. */
|
|
4
|
-
name?: string;
|
|
5
|
-
exported?: boolean;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* The anonymous object type one card describes — the members, nothing around them.
|
|
9
|
-
* Internal: `entitySourceOf` is what a consumer calls, and it emits this above the judge.
|
|
10
|
-
*
|
|
11
|
-
* Every property is present: `required` on a Fougère card answers "what must a CALLER
|
|
12
|
-
* supply at creation", not "what is always there when read" — an `id` the system
|
|
13
|
-
* generates is absent from `required` and always present on a row. Typing the read
|
|
14
|
-
* shape from the create rule would make `post.id` possibly-undefined for everyone.
|
|
15
|
-
*/
|
|
16
|
-
export declare function shapeTypeOf(descriptor: SchemaDescriptor, indent?: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* Emit the entity a card describes — ONE class, judge and shape together, because a class
|
|
19
|
-
* is the language's own answer to "a name that is both a value and a type".
|
|
20
|
-
*
|
|
21
|
-
* The card travels inline, so the rebuilt judge and the shape above it read off the same
|
|
22
|
-
* source. Requires `reconstruct` in scope: only the caller knows how the consumer imports.
|
|
23
|
-
*/
|
|
24
|
-
export declare function entitySourceOf(descriptor: SchemaDescriptor, options?: TypeSourceOptions): string;
|
|
25
|
-
/** One operation, as much of it as a card can say. */
|
|
26
|
-
export interface OpDescriptor {
|
|
27
|
-
name: string;
|
|
28
|
-
description?: string;
|
|
29
|
-
output?: SchemaDescriptor;
|
|
30
|
-
/** How much `output` describes. Absent means the card did not say. */
|
|
31
|
-
cardinality?: 'one' | 'maybe' | 'many' | 'page' | 'none';
|
|
32
|
-
}
|
|
33
|
-
/** Emit the type of a façade — every operation an entity serves, as a callable surface. */
|
|
34
|
-
export declare function facadeTypeSourceOf(ops: readonly OpDescriptor[], options?: TypeSourceOptions & {
|
|
35
|
-
rowType?: string;
|
|
36
|
-
}): string;
|
|
37
|
-
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/projections/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,gBAAgB,EAAE,MAAM,WAAW,CAAC;AA8EnE,MAAM,WAAW,iBAAiB;IAChC,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAK,GAAG,MAAM,CAS7E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,gBAAgB,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CASpG;AAmBD,sDAAsD;AACtD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,sEAAsE;IACtE,WAAW,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CAC1D;AAyBD,2FAA2F;AAC3F,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,SAAS,YAAY,EAAE,EAC5B,OAAO,GAAE,iBAAiB,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACrD,MAAM,CAYR"}
|