@fougere/schema 0.8.1-alpha.0 → 0.8.3-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/dist/axis/boundary/BoundaryAxis.js +2 -2
- package/dist/axis/boundary/BoundaryAxis.js.map +1 -1
- package/dist/axis/lifecycle/LifecycleAxis.js +5 -5
- package/dist/axis/lifecycle/LifecycleAxis.js.map +1 -1
- package/dist/axis/role/RoleAxis.js +6 -6
- package/dist/axis/role/RoleAxis.js.map +1 -1
- package/dist/field/Field.d.ts +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Meta.d.ts.map +1 -0
- package/dist/{axis → field}/Meta.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +1 -0
- package/dist/lib/utils.js.map +1 -1
- package/dist/validator/FieldDeclarationValidator.js +4 -4
- package/dist/validator/FieldDeclarationValidator.js.map +1 -1
- package/dist/vocabulary/index.d.ts +21 -21
- package/dist/vocabulary/index.d.ts.map +1 -1
- package/dist/vocabulary/index.js +21 -21
- package/dist/vocabulary/index.js.map +1 -1
- package/dist/vocabulary/{created.d.ts → preset/created.d.ts} +1 -1
- package/dist/vocabulary/preset/created.d.ts.map +1 -0
- package/dist/vocabulary/{created.js → preset/created.js} +1 -1
- package/dist/vocabulary/preset/created.js.map +1 -0
- package/dist/vocabulary/{email.d.ts → preset/email.d.ts} +2 -2
- package/dist/vocabulary/preset/email.d.ts.map +1 -0
- package/dist/vocabulary/{email.js → preset/email.js} +1 -1
- package/dist/vocabulary/preset/email.js.map +1 -0
- package/dist/vocabulary/{updated.d.ts → preset/updated.d.ts} +1 -1
- package/dist/vocabulary/preset/updated.d.ts.map +1 -0
- package/dist/vocabulary/preset/updated.js.map +1 -0
- package/dist/vocabulary/{url.d.ts → preset/url.d.ts} +2 -2
- package/dist/vocabulary/preset/url.d.ts.map +1 -0
- package/dist/vocabulary/{url.js → preset/url.js} +1 -1
- package/dist/vocabulary/preset/url.js.map +1 -0
- package/dist/vocabulary/{bool.d.ts → primitive/bool.d.ts} +1 -1
- package/dist/vocabulary/primitive/bool.d.ts.map +1 -0
- package/dist/vocabulary/{bool.js → primitive/bool.js} +1 -1
- package/dist/vocabulary/primitive/bool.js.map +1 -0
- package/dist/vocabulary/{date.d.ts → primitive/date.d.ts} +1 -1
- package/dist/vocabulary/primitive/date.d.ts.map +1 -0
- package/dist/vocabulary/{date.js → primitive/date.js} +1 -1
- package/dist/vocabulary/primitive/date.js.map +1 -0
- package/dist/vocabulary/{json.d.ts → primitive/json.d.ts} +2 -2
- package/dist/vocabulary/primitive/json.d.ts.map +1 -0
- package/dist/vocabulary/{json.js → primitive/json.js} +2 -2
- package/dist/vocabulary/primitive/json.js.map +1 -0
- package/dist/vocabulary/{list.d.ts → primitive/list.d.ts} +1 -1
- package/dist/vocabulary/primitive/list.d.ts.map +1 -0
- package/dist/vocabulary/{list.js → primitive/list.js} +1 -1
- package/dist/vocabulary/primitive/list.js.map +1 -0
- package/dist/vocabulary/{many.d.ts → primitive/many.d.ts} +2 -2
- package/dist/vocabulary/primitive/many.d.ts.map +1 -0
- package/dist/vocabulary/{many.js → primitive/many.js} +2 -2
- package/dist/vocabulary/primitive/many.js.map +1 -0
- package/dist/vocabulary/{number.d.ts → primitive/number.d.ts} +1 -1
- package/dist/vocabulary/primitive/number.d.ts.map +1 -0
- package/dist/vocabulary/{number.js → primitive/number.js} +1 -1
- package/dist/vocabulary/primitive/number.js.map +1 -0
- package/dist/vocabulary/{oneOf.d.ts → primitive/oneOf.d.ts} +1 -1
- package/dist/vocabulary/primitive/oneOf.d.ts.map +1 -0
- package/dist/vocabulary/{oneOf.js → primitive/oneOf.js} +1 -1
- package/dist/vocabulary/primitive/oneOf.js.map +1 -0
- package/dist/vocabulary/{primary.d.ts → primitive/primary.d.ts} +2 -2
- package/dist/vocabulary/primitive/primary.d.ts.map +1 -0
- package/dist/vocabulary/{primary.js → primitive/primary.js} +2 -2
- package/dist/vocabulary/primitive/primary.js.map +1 -0
- package/dist/vocabulary/{ref.d.ts → primitive/ref.d.ts} +2 -2
- package/dist/vocabulary/primitive/ref.d.ts.map +1 -0
- package/dist/vocabulary/{ref.js → primitive/ref.js} +2 -2
- package/dist/vocabulary/primitive/ref.js.map +1 -0
- package/dist/vocabulary/{text.d.ts → primitive/text.d.ts} +2 -2
- package/dist/vocabulary/primitive/text.d.ts.map +1 -0
- package/dist/vocabulary/{text.js → primitive/text.js} +1 -1
- package/dist/vocabulary/primitive/text.js.map +1 -0
- package/dist/vocabulary/{immutable.d.ts → rule/immutable.d.ts} +1 -1
- package/dist/vocabulary/rule/immutable.d.ts.map +1 -0
- package/dist/vocabulary/{immutable.js → rule/immutable.js} +1 -1
- package/dist/vocabulary/rule/immutable.js.map +1 -0
- package/dist/vocabulary/{indexed.d.ts → rule/indexed.d.ts} +1 -1
- package/dist/vocabulary/rule/indexed.d.ts.map +1 -0
- package/dist/vocabulary/{indexed.js → rule/indexed.js} +1 -1
- package/dist/vocabulary/rule/indexed.js.map +1 -0
- package/dist/vocabulary/{nullable.d.ts → rule/nullable.d.ts} +1 -1
- package/dist/vocabulary/rule/nullable.d.ts.map +1 -0
- package/dist/vocabulary/{nullable.js → rule/nullable.js} +2 -2
- package/dist/vocabulary/rule/nullable.js.map +1 -0
- package/dist/vocabulary/{optional.d.ts → rule/optional.d.ts} +1 -1
- package/dist/vocabulary/rule/optional.d.ts.map +1 -0
- package/dist/vocabulary/{optional.js → rule/optional.js} +2 -2
- package/dist/vocabulary/rule/optional.js.map +1 -0
- package/dist/vocabulary/{readOnly.d.ts → rule/readOnly.d.ts} +1 -1
- package/dist/vocabulary/rule/readOnly.d.ts.map +1 -0
- package/dist/vocabulary/{readOnly.js → rule/readOnly.js} +2 -2
- package/dist/vocabulary/rule/readOnly.js.map +1 -0
- package/dist/vocabulary/{unique.d.ts → rule/unique.d.ts} +1 -1
- package/dist/vocabulary/rule/unique.d.ts.map +1 -0
- package/dist/vocabulary/{unique.js → rule/unique.js} +1 -1
- package/dist/vocabulary/rule/unique.js.map +1 -0
- package/dist/vocabulary/{writeOnly.d.ts → rule/writeOnly.d.ts} +1 -1
- package/dist/vocabulary/rule/writeOnly.d.ts.map +1 -0
- package/dist/vocabulary/{writeOnly.js → rule/writeOnly.js} +2 -2
- package/dist/vocabulary/rule/writeOnly.js.map +1 -0
- package/package.json +1 -1
- package/src/axis/boundary/BoundaryAxis.ts +2 -2
- package/src/axis/lifecycle/LifecycleAxis.ts +5 -5
- package/src/axis/role/RoleAxis.ts +6 -6
- package/src/field/Field.ts +1 -1
- package/src/index.ts +1 -1
- package/src/lib/utils.ts +2 -0
- package/src/validator/FieldDeclarationValidator.ts +4 -4
- package/src/vocabulary/index.ts +24 -21
- package/src/vocabulary/{created.ts → preset/created.ts} +2 -2
- package/src/vocabulary/{email.ts → preset/email.ts} +2 -2
- package/src/vocabulary/{updated.ts → preset/updated.ts} +1 -1
- package/src/vocabulary/{url.ts → preset/url.ts} +2 -2
- package/src/vocabulary/{bool.ts → primitive/bool.ts} +1 -1
- package/src/vocabulary/{date.ts → primitive/date.ts} +1 -1
- package/src/vocabulary/{json.ts → primitive/json.ts} +3 -3
- package/src/vocabulary/{list.ts → primitive/list.ts} +1 -1
- package/src/vocabulary/{many.ts → primitive/many.ts} +2 -2
- package/src/vocabulary/{number.ts → primitive/number.ts} +1 -1
- package/src/vocabulary/{oneOf.ts → primitive/oneOf.ts} +1 -1
- package/src/vocabulary/{primary.ts → primitive/primary.ts} +2 -2
- package/src/vocabulary/{ref.ts → primitive/ref.ts} +2 -2
- package/src/vocabulary/{text.ts → primitive/text.ts} +2 -2
- package/src/vocabulary/{immutable.ts → rule/immutable.ts} +2 -2
- package/src/vocabulary/{indexed.ts → rule/indexed.ts} +2 -2
- package/src/vocabulary/{nullable.ts → rule/nullable.ts} +3 -3
- package/src/vocabulary/{optional.ts → rule/optional.ts} +3 -3
- package/src/vocabulary/{readOnly.ts → rule/readOnly.ts} +3 -3
- package/src/vocabulary/{unique.ts → rule/unique.ts} +2 -2
- package/src/vocabulary/{writeOnly.ts → rule/writeOnly.ts} +3 -3
- package/dist/axis/Meta.d.ts.map +0 -1
- package/dist/vocabulary/bool.d.ts.map +0 -1
- package/dist/vocabulary/bool.js.map +0 -1
- package/dist/vocabulary/created.d.ts.map +0 -1
- package/dist/vocabulary/created.js.map +0 -1
- package/dist/vocabulary/date.d.ts.map +0 -1
- package/dist/vocabulary/date.js.map +0 -1
- package/dist/vocabulary/email.d.ts.map +0 -1
- package/dist/vocabulary/email.js.map +0 -1
- package/dist/vocabulary/immutable.d.ts.map +0 -1
- package/dist/vocabulary/immutable.js.map +0 -1
- package/dist/vocabulary/indexed.d.ts.map +0 -1
- package/dist/vocabulary/indexed.js.map +0 -1
- package/dist/vocabulary/json.d.ts.map +0 -1
- package/dist/vocabulary/json.js.map +0 -1
- package/dist/vocabulary/list.d.ts.map +0 -1
- package/dist/vocabulary/list.js.map +0 -1
- package/dist/vocabulary/many.d.ts.map +0 -1
- package/dist/vocabulary/many.js.map +0 -1
- package/dist/vocabulary/nullable.d.ts.map +0 -1
- package/dist/vocabulary/nullable.js.map +0 -1
- package/dist/vocabulary/number.d.ts.map +0 -1
- package/dist/vocabulary/number.js.map +0 -1
- package/dist/vocabulary/oneOf.d.ts.map +0 -1
- package/dist/vocabulary/oneOf.js.map +0 -1
- package/dist/vocabulary/optional.d.ts.map +0 -1
- package/dist/vocabulary/optional.js.map +0 -1
- package/dist/vocabulary/primary.d.ts.map +0 -1
- package/dist/vocabulary/primary.js.map +0 -1
- package/dist/vocabulary/readOnly.d.ts.map +0 -1
- package/dist/vocabulary/readOnly.js.map +0 -1
- package/dist/vocabulary/ref.d.ts.map +0 -1
- package/dist/vocabulary/ref.js.map +0 -1
- package/dist/vocabulary/text.d.ts.map +0 -1
- package/dist/vocabulary/text.js.map +0 -1
- package/dist/vocabulary/unique.d.ts.map +0 -1
- package/dist/vocabulary/unique.js.map +0 -1
- package/dist/vocabulary/updated.d.ts.map +0 -1
- package/dist/vocabulary/updated.js.map +0 -1
- package/dist/vocabulary/url.d.ts.map +0 -1
- package/dist/vocabulary/url.js.map +0 -1
- package/dist/vocabulary/writeOnly.d.ts.map +0 -1
- package/dist/vocabulary/writeOnly.js.map +0 -1
- /package/dist/{axis → field}/Meta.d.ts +0 -0
- /package/dist/{axis → field}/Meta.js +0 -0
- /package/dist/vocabulary/{updated.js → preset/updated.js} +0 -0
- /package/src/{axis → field}/Meta.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Relation } from '
|
|
2
|
-
import { Field } from '
|
|
1
|
+
import { Relation } from '../../axis/role/Relation.js';
|
|
2
|
+
import { Field } from '../../field/Field.js';
|
|
3
3
|
/**
|
|
4
4
|
* So the other side of a reference is declared, and holds no column.
|
|
5
5
|
* FR : pour que l'autre côté d'une référence soit déclaré, sans porter de colonne.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"many.js","sourceRoot":"","sources":["../../../src/vocabulary/primitive/many.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA0B,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAClB,MAAqB;IAErB,OAAO,IAAI,KAAK,CAAoB;QAClC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QACxB,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;KAC1C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src/vocabulary/primitive/number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,CAW1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../src/vocabulary/primitive/number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAU7C;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,IAAoB;IACzC,OAAO,IAAI,KAAK,CAAS;QACvB,KAAK,EAAE;YACL,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;YAC1C,OAAO,EAAE,IAAI,EAAE,GAAG;YAClB,OAAO,EAAE,IAAI,EAAE,GAAG;SACnB;QACD,SAAS,EACP,IAAI,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS;QAC/E,IAAI,EAAE,IAAI,EAAE,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS;KACtF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oneOf.d.ts","sourceRoot":"","sources":["../../../src/vocabulary/primitive/oneOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,UAAU,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,CAAC;CACb;AAED,wBAAgB,KAAK,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE,EACrD,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,GAChB,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACpB,wBAAgB,KAAK,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE,EACrD,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GACvC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Field } from '
|
|
1
|
+
import { Field } from '../../field/Field.js';
|
|
2
2
|
/**
|
|
3
3
|
* So the set is in the type and in the CHECK constraint, from one declaration.
|
|
4
4
|
* FR : pour que l'ensemble soit dans le type et dans la contrainte CHECK, d'une déclaration.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oneOf.js","sourceRoot":"","sources":["../../../src/vocabulary/primitive/oneOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAa7C;;;;GAIG;AACH,MAAM,UAAU,KAAK,CACnB,GAAG,IAA8C;IAEjD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAiC,CAAC;IACpF,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAE,IAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;IACnD,OAAO,IAAI,KAAK,CAAY;QAC1B,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE;QACvC,SAAS,EACP,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS;QAC9E,IAAI,EAAE,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS;KACrF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Field } from '
|
|
2
|
-
import { type GeneratorRef } from '
|
|
1
|
+
import { Field } from '../../field/Field.js';
|
|
2
|
+
import { type GeneratorRef } from '../../axis/lifecycle/Generators.js';
|
|
3
3
|
interface PrimaryOptions {
|
|
4
4
|
generate?: GeneratorRef | [name: string, fn: () => string];
|
|
5
5
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primary.d.ts","sourceRoot":"","sources":["../../../src/vocabulary/primitive/primary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEnF,UAAU,cAAc;IACtB,QAAQ,CAAC,EAAE,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC,CAAC;CAC5D;AAED,wBAAgB,OAAO,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAC9D,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Field } from '
|
|
2
|
-
import { Generators } from '
|
|
1
|
+
import { Field } from '../../field/Field.js';
|
|
2
|
+
import { Generators } from '../../axis/lifecycle/Generators.js';
|
|
3
3
|
/**
|
|
4
4
|
* So an id is generated and write-once by declaring nothing else.
|
|
5
5
|
* FR : pour qu'un identifiant soit généré et écrit une fois sans rien déclarer d'autre.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primary.js","sourceRoot":"","sources":["../../../src/vocabulary/primitive/primary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAqB,MAAM,oCAAoC,CAAC;AAQnF;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,cAAuC;IAC7D,IAAI,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,cAAc,CAAC;QAC7B,OAAO,KAAK,CAAC,IAAI,CAAC;YAChB,IAAI,EAAE,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;YACtC,SAAS,EAAE,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE;SACvD,CAAC,CAAC;IACL,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,cAAc,IAAI,EAAE,CAAmB,CAAC;IACtD,IAAI,QAAsB,CAAC;IAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QACjC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC9B,QAAQ,GAAG,IAAI,CAAC;IAClB,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,KAAK,CAAS;QACvB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QACvB,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE;KACzD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type EntityConstructor } from '
|
|
2
|
-
import { Field } from '
|
|
1
|
+
import { type EntityConstructor } from '../../axis/role/Relation.js';
|
|
2
|
+
import { Field } from '../../field/Field.js';
|
|
3
3
|
export interface RefOptions {
|
|
4
4
|
cascade?: boolean;
|
|
5
5
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref.d.ts","sourceRoot":"","sources":["../../../src/vocabulary/primitive/ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,iBAAiB,EAC7C,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EACrB,IAAI,CAAC,EAAE,UAAU,GAChB,KAAK,CAAC,MAAM,CAAC,CAKf"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Relation } from '
|
|
2
|
-
import { Field } from '
|
|
1
|
+
import { Relation } from '../../axis/role/Relation.js';
|
|
2
|
+
import { Field } from '../../field/Field.js';
|
|
3
3
|
/**
|
|
4
4
|
* So a reference names the target entity, and the column type follows from it.
|
|
5
5
|
* FR : pour qu'une référence nomme l'entité cible, la colonne en découlant.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../src/vocabulary/primitive/ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA0B,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAM7C;;;;GAIG;AACH,MAAM,UAAU,GAAG,CACjB,MAAqB,EACrB,IAAiB;IAEjB,OAAO,IAAI,KAAK,CAAS;QACvB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE;KACxD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Field } from '
|
|
2
|
-
import { type StringFormat } from '
|
|
1
|
+
import { Field } from '../../field/Field.js';
|
|
2
|
+
import { type StringFormat } from '../../axis/shape/Formats.js';
|
|
3
3
|
export interface TextOptions {
|
|
4
4
|
min?: number;
|
|
5
5
|
max?: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/vocabulary/primitive/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAatD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/vocabulary/primitive/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAY7C;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,IAAkB;IACrC,OAAO,IAAI,KAAK,CAAS;QACvB,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI,EAAE,GAAG;YACpB,SAAS,EAAE,IAAI,EAAE,GAAG;YACpB,OAAO,EAAE,IAAI,EAAE,OAAO;YACtB,MAAM,EAAE,IAAI,EAAE,MAAM;SACrB;QACD,SAAS,EACP,IAAI,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS;QAC/E,IAAI,EAAE,IAAI,EAAE,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS;KACtF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"immutable.d.ts","sourceRoot":"","sources":["../../../src/vocabulary/rule/immutable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAKtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"immutable.js","sourceRoot":"","sources":["../../../src/vocabulary/rule/immutable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAqC,UAAU,CACnE,WAAW,EACX,GAAG,EAAE,CAAC,CAAC;IACL,SAAS,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE;CACnC,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexed.d.ts","sourceRoot":"","sources":["../../../src/vocabulary/rule/indexed.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAElD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexed.js","sourceRoot":"","sources":["../../../src/vocabulary/rule/indexed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAqC,UAAU,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;IACpF,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;CACtB,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Field } from '
|
|
1
|
+
import { type Field } from '../../field/Field.js';
|
|
2
2
|
/**
|
|
3
3
|
* So `null` becomes a legal value, without touching whether the field is required.
|
|
4
4
|
* FR : pour que `null` devienne légal, sans toucher au caractère obligatoire du champ.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nullable.d.ts","sourceRoot":"","sources":["../../../src/vocabulary/rule/nullable.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,IAAI,CAK5D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { vocabulary } from '
|
|
2
|
-
import { Shapes } from '
|
|
1
|
+
import { vocabulary } from '../vocabulary.js';
|
|
2
|
+
import { Shapes } from '../../axis/shape/Shape.js';
|
|
3
3
|
/**
|
|
4
4
|
* So `null` becomes a legal value, without touching whether the field is required.
|
|
5
5
|
* FR : pour que `null` devienne légal, sans toucher au caractère obligatoire du champ.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../src/vocabulary/rule/nullable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAGnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA4C,UAAU,CACzE,UAAU,EACV,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACV,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;CACpC,CAAC,CACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Field } from '
|
|
1
|
+
import { type Field } from '../../field/Field.js';
|
|
2
2
|
/**
|
|
3
3
|
* So the two questions are settled at once: `null` is legal, and absence is too.
|
|
4
4
|
* FR : pour que les deux questions soient réglées d'un coup : `null` légal, absence permise.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional.d.ts","sourceRoot":"","sources":["../../../src/vocabulary/rule/optional.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,IAAI,CAQ5D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { vocabulary } from '
|
|
2
|
-
import { Shapes } from '
|
|
1
|
+
import { vocabulary } from '../vocabulary.js';
|
|
2
|
+
import { Shapes } from '../../axis/shape/Shape.js';
|
|
3
3
|
/**
|
|
4
4
|
* So the two questions are settled at once: `null` is legal, and absence is too.
|
|
5
5
|
* FR : pour que les deux questions soient réglées d'un coup : `null` légal, absence permise.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../src/vocabulary/rule/optional.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAGnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA4C,UAAU,CACzE,UAAU,EACV,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACV,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;IACnC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,KAAK,SAAS;QACvC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,UAAmB,EAAE,EAAE;QAChD,CAAC,CAAC,EAAE,CAAC;CACR,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readOnly.d.ts","sourceRoot":"","sources":["../../../src/vocabulary/rule/readOnly.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAKrD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { vocabulary } from '
|
|
2
|
-
import { Boundary } from '
|
|
1
|
+
import { vocabulary } from '../vocabulary.js';
|
|
2
|
+
import { Boundary } from '../../axis/boundary/Boundary.js';
|
|
3
3
|
/**
|
|
4
4
|
* So a field a client may read but never write says so once, on the field.
|
|
5
5
|
* FR : pour qu'un champ lisible mais non écrivable le dise une fois, sur le champ.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readOnly.js","sourceRoot":"","sources":["../../../src/vocabulary/rule/readOnly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAG3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAqC,UAAU,CAClE,UAAU,EACV,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACV,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;CAC1D,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unique.d.ts","sourceRoot":"","sources":["../../../src/vocabulary/rule/unique.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAEjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unique.js","sourceRoot":"","sources":["../../../src/vocabulary/rule/unique.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAqC,UAAU,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IAClF,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;CACvB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeOnly.d.ts","sourceRoot":"","sources":["../../../src/vocabulary/rule/writeOnly.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAKtD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { vocabulary } from '
|
|
2
|
-
import { Boundary } from '
|
|
1
|
+
import { vocabulary } from '../vocabulary.js';
|
|
2
|
+
import { Boundary } from '../../axis/boundary/Boundary.js';
|
|
3
3
|
/**
|
|
4
4
|
* So a secret leaves no response, the dual of `readOnly` on the same axis.
|
|
5
5
|
* FR : pour qu'un secret ne reparte dans aucune réponse, dual de `readOnly`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeOnly.js","sourceRoot":"","sources":["../../../src/vocabulary/rule/writeOnly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAG3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAqC,UAAU,CACnE,WAAW,EACX,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACV,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;CAC3D,CAAC,CACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Axis } from '../Axis.js';
|
|
2
2
|
import { admitWire } from '../../projection/card/admission.js';
|
|
3
|
-
import { isObject } from '../../lib/utils.js';
|
|
3
|
+
import { isObject, shown } from '../../lib/utils.js';
|
|
4
4
|
import type { BoundaryRef } from './Boundary.js';
|
|
5
5
|
|
|
6
6
|
export const boundaryAxis: Axis<BoundaryRef, BoundaryRef> = {
|
|
@@ -11,7 +11,7 @@ export const boundaryAxis: Axis<BoundaryRef, BoundaryRef> = {
|
|
|
11
11
|
if (!isObject(value)) {
|
|
12
12
|
errors.push({
|
|
13
13
|
path: 'boundary',
|
|
14
|
-
message: `Expected an alias name or { in, out } — got ${
|
|
14
|
+
message: `Expected an alias name or { in, out } — got ${shown(value)}`,
|
|
15
15
|
});
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Axis } from '../Axis.js';
|
|
2
2
|
import type { ValidationError } from '../../validation.js';
|
|
3
3
|
import { admitWire, oneOfTokens } from '../../projection/card/admission.js';
|
|
4
|
-
import { isObject } from '../../lib/utils.js';
|
|
4
|
+
import { isObject, shown } from '../../lib/utils.js';
|
|
5
5
|
import { CREATE_TOKENS, UPDATE_TOKENS, type LifecycleRules } from './Lifecycle.js';
|
|
6
6
|
|
|
7
7
|
export const lifecycleAxis: Axis<LifecycleRules, LifecycleRules> = {
|
|
@@ -9,14 +9,14 @@ export const lifecycleAxis: Axis<LifecycleRules, LifecycleRules> = {
|
|
|
9
9
|
|
|
10
10
|
validator(value, errors) {
|
|
11
11
|
if (!isObject(value)) {
|
|
12
|
-
errors.push({ path: 'lifecycle', message: `Expected an object — got ${
|
|
12
|
+
errors.push({ path: 'lifecycle', message: `Expected an object — got ${shown(value)}` });
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
if (value.create !== undefined) validateCreate(value.create, errors);
|
|
16
16
|
if (value.update !== undefined && !oneOfTokens(value.update, UPDATE_TOKENS)) {
|
|
17
17
|
errors.push({
|
|
18
18
|
path: 'lifecycle.update',
|
|
19
|
-
message: `Expected 'now' or 'forbidden' — got ${
|
|
19
|
+
message: `Expected 'now' or 'forbidden' — got ${shown(value.update)}`,
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
},
|
|
@@ -41,7 +41,7 @@ function validateCreate(rule: unknown, errors: ValidationError[]): void {
|
|
|
41
41
|
if (typeof rule.generate !== 'string') {
|
|
42
42
|
errors.push({
|
|
43
43
|
path: 'lifecycle.create.generate',
|
|
44
|
-
message: `Expected a generator name — got ${
|
|
44
|
+
message: `Expected a generator name — got ${shown(rule.generate)}`,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
return;
|
|
@@ -49,6 +49,6 @@ function validateCreate(rule: unknown, errors: ValidationError[]): void {
|
|
|
49
49
|
}
|
|
50
50
|
errors.push({
|
|
51
51
|
path: 'lifecycle.create',
|
|
52
|
-
message: `Expected 'now', 'optional', { value } or { generate } — got ${
|
|
52
|
+
message: `Expected 'now', 'optional', { value } or { generate } — got ${shown(rule)}`,
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Axis, Resolver } from '../Axis.js';
|
|
2
2
|
import { refuse, oneOfTokens } from '../../projection/card/admission.js';
|
|
3
|
-
import { isObject, lowerFirst } from '../../lib/utils.js';
|
|
3
|
+
import { isObject, lowerFirst, shown } from '../../lib/utils.js';
|
|
4
4
|
import type { ValidationError } from '../../validation.js';
|
|
5
5
|
import { ON_DELETE, RELATION_KINDS, type EntityConstructor, type Relation } from './Relation.js';
|
|
6
6
|
import { type RoleRules } from './Role.js';
|
|
@@ -11,14 +11,14 @@ export const roleAxis: Axis<RoleRules, RoleDescriptor> = {
|
|
|
11
11
|
|
|
12
12
|
validator(value, errors) {
|
|
13
13
|
if (!isObject(value)) {
|
|
14
|
-
errors.push({ path: 'role', message: `Expected an object — got ${
|
|
14
|
+
errors.push({ path: 'role', message: `Expected an object — got ${shown(value)}` });
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
for (const flag of ['primary', 'index', 'unique'] as const) {
|
|
18
18
|
if (value[flag] !== undefined && typeof value[flag] !== 'boolean') {
|
|
19
19
|
errors.push({
|
|
20
20
|
path: `role.${flag}`,
|
|
21
|
-
message: `Expected a boolean — got ${
|
|
21
|
+
message: `Expected a boolean — got ${shown(value[flag])}`,
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -79,13 +79,13 @@ export const roleAxis: Axis<RoleRules, RoleDescriptor> = {
|
|
|
79
79
|
*/
|
|
80
80
|
function validateRelation(relation: unknown, errors: ValidationError[]): void {
|
|
81
81
|
if (!isObject(relation)) {
|
|
82
|
-
errors.push({ path: 'role.relation', message: `Expected an object — got ${
|
|
82
|
+
errors.push({ path: 'role.relation', message: `Expected an object — got ${shown(relation)}` });
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
if (!oneOfTokens(relation.kind, RELATION_KINDS)) {
|
|
86
86
|
errors.push({
|
|
87
87
|
path: 'role.relation.kind',
|
|
88
|
-
message: `Expected 'one' or 'many' — got ${
|
|
88
|
+
message: `Expected 'one' or 'many' — got ${shown(relation.kind)}`,
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
if (typeof relation.to !== 'function') {
|
|
@@ -94,7 +94,7 @@ function validateRelation(relation: unknown, errors: ValidationError[]): void {
|
|
|
94
94
|
if (relation.onDelete !== undefined && !oneOfTokens(relation.onDelete, ON_DELETE)) {
|
|
95
95
|
errors.push({
|
|
96
96
|
path: 'role.relation.onDelete',
|
|
97
|
-
message: `Expected 'cascade', 'restrict' or 'set null' — got ${
|
|
97
|
+
message: `Expected 'cascade', 'restrict' or 'set null' — got ${shown(relation.onDelete)}`,
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
}
|
package/src/field/Field.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Shape } from '../axis/shape/Shape.js';
|
|
|
2
2
|
import type { RoleRules } from '../axis/role/Role.js';
|
|
3
3
|
import type { LifecycleRules } from '../axis/lifecycle/Lifecycle.js';
|
|
4
4
|
import type { BoundaryRef } from '../axis/boundary/Boundary.js';
|
|
5
|
-
import type { Meta } from '
|
|
5
|
+
import type { Meta } from './Meta.js';
|
|
6
6
|
import type { Axis } from '../axis/Axis.js';
|
|
7
7
|
import { FieldDeclarationValidator } from '../validator/FieldDeclarationValidator.js';
|
|
8
8
|
import { FieldValueValidator } from '../validator/FieldValueValidator.js';
|
package/src/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { type SchemaView } from './SchemaView.js';
|
|
|
7
7
|
export { Field, type Fields } from './field/Field.js';
|
|
8
8
|
export { FieldSet } from './field/FieldSet.js';
|
|
9
9
|
export { type Shape, Shapes } from './axis/shape/Shape.js';
|
|
10
|
-
export { Role } from './axis/role/Role.js';
|
|
10
|
+
export { Role, type RoleRules } from './axis/role/Role.js';
|
|
11
11
|
export { type EntityConstructor } from './axis/role/Relation.js';
|
|
12
12
|
export { Lifecycle, type LifecycleRules } from './axis/lifecycle/Lifecycle.js';
|
|
13
13
|
export { Boundary, type BoundaryRef } from './axis/boundary/Boundary.js';
|
package/src/lib/utils.ts
CHANGED
|
@@ -14,3 +14,5 @@ export function clean<T extends Record<string, unknown>>(obj: T): T {
|
|
|
14
14
|
|
|
15
15
|
export const isObject = (value: unknown): value is Record<string, unknown> =>
|
|
16
16
|
typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
17
|
+
|
|
18
|
+
export const shown = (value: unknown): string => JSON.stringify(value) ?? typeof value;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EXTENSION_AXES } from '../axis/Axis.js';
|
|
2
2
|
import { Shapes } from '../axis/shape/Shape.js';
|
|
3
3
|
import type { Field } from '../field/Field.js';
|
|
4
|
-
import { isObject } from '../lib/utils.js';
|
|
4
|
+
import { isObject, shown } from '../lib/utils.js';
|
|
5
5
|
import type { ValidationError, ValidationResult } from '../validation.js';
|
|
6
6
|
|
|
7
7
|
export class FieldDeclarationValidator {
|
|
@@ -20,7 +20,7 @@ export class FieldDeclarationValidator {
|
|
|
20
20
|
errors: [
|
|
21
21
|
{
|
|
22
22
|
path: '.',
|
|
23
|
-
message: `Expected an object — got ${
|
|
23
|
+
message: `Expected an object — got ${shown(declaration)}`,
|
|
24
24
|
},
|
|
25
25
|
],
|
|
26
26
|
};
|
|
@@ -31,7 +31,7 @@ export class FieldDeclarationValidator {
|
|
|
31
31
|
if (!Shapes.is(declaration.shape)) {
|
|
32
32
|
errors.push({
|
|
33
33
|
path: 'shape',
|
|
34
|
-
message: `Every field states a shape — got ${
|
|
34
|
+
message: `Every field states a shape — got ${shown(declaration.shape)}`,
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -44,7 +44,7 @@ export class FieldDeclarationValidator {
|
|
|
44
44
|
if (!isObject(declaration.meta)) {
|
|
45
45
|
errors.push({
|
|
46
46
|
path: 'meta',
|
|
47
|
-
message: `Expected an object — got ${
|
|
47
|
+
message: `Expected an object — got ${shown(declaration.meta)}`,
|
|
48
48
|
});
|
|
49
49
|
} else if (
|
|
50
50
|
declaration.meta.description !== undefined &&
|
package/src/vocabulary/index.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
export * from './bool.js';
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './
|
|
20
|
-
export * from './
|
|
1
|
+
export * from './primitive/bool.js';
|
|
2
|
+
export * from './primitive/date.js';
|
|
3
|
+
export * from './primitive/json.js';
|
|
4
|
+
export * from './primitive/list.js';
|
|
5
|
+
export * from './primitive/many.js';
|
|
6
|
+
export * from './primitive/number.js';
|
|
7
|
+
export * from './primitive/oneOf.js';
|
|
8
|
+
export * from './primitive/primary.js';
|
|
9
|
+
export * from './primitive/ref.js';
|
|
10
|
+
export * from './primitive/text.js';
|
|
11
|
+
|
|
12
|
+
export * from './preset/created.js';
|
|
13
|
+
export * from './preset/email.js';
|
|
14
|
+
export * from './preset/updated.js';
|
|
15
|
+
export * from './preset/url.js';
|
|
16
|
+
|
|
17
|
+
export * from './rule/immutable.js';
|
|
18
|
+
export * from './rule/indexed.js';
|
|
19
|
+
export * from './rule/nullable.js';
|
|
20
|
+
export * from './rule/optional.js';
|
|
21
|
+
export * from './rule/readOnly.js';
|
|
22
|
+
export * from './rule/unique.js';
|
|
23
|
+
export * from './rule/writeOnly.js';
|
|
24
|
+
|
|
21
25
|
export * from './vocabulary.js';
|
|
22
|
-
export * from './writeOnly.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { text, type TextOptions } from '
|
|
2
|
-
import type { Field } from '
|
|
1
|
+
import { text, type TextOptions } from '../primitive/text.js';
|
|
2
|
+
import type { Field } from '../../field/Field.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* So the format is stated once, where everyone would otherwise write the same regex.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { text, type TextOptions } from '
|
|
2
|
-
import type { Field } from '
|
|
1
|
+
import { text, type TextOptions } from '../primitive/text.js';
|
|
2
|
+
import type { Field } from '../../field/Field.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* So a URL is a text with a stated format, not a type of its own.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Field } from '
|
|
2
|
-
import type { SchemaView } from '
|
|
3
|
-
import { InputValidator } from '
|
|
1
|
+
import { Field } from '../../field/Field.js';
|
|
2
|
+
import type { SchemaView } from '../../SchemaView.js';
|
|
3
|
+
import { InputValidator } from '../../validator/InputValidator.js';
|
|
4
4
|
|
|
5
5
|
export function json<T = unknown>(): Field<T>;
|
|
6
6
|
export function json<E extends SchemaView & (new (...args: any[]) => any)>(
|