@fougere/schema 0.8.0-alpha.0 → 0.8.2-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.
Files changed (183) hide show
  1. package/dist/axis/boundary/BoundaryAxis.js +2 -2
  2. package/dist/axis/boundary/BoundaryAxis.js.map +1 -1
  3. package/dist/axis/lifecycle/LifecycleAxis.js +5 -5
  4. package/dist/axis/lifecycle/LifecycleAxis.js.map +1 -1
  5. package/dist/axis/role/RoleAxis.js +6 -6
  6. package/dist/axis/role/RoleAxis.js.map +1 -1
  7. package/dist/field/Field.d.ts +1 -1
  8. package/dist/field/Field.d.ts.map +1 -1
  9. package/dist/field/Meta.d.ts.map +1 -0
  10. package/dist/{axis → field}/Meta.js.map +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/lib/utils.d.ts +1 -0
  15. package/dist/lib/utils.d.ts.map +1 -1
  16. package/dist/lib/utils.js +1 -0
  17. package/dist/lib/utils.js.map +1 -1
  18. package/dist/validator/FieldDeclarationValidator.js +4 -4
  19. package/dist/validator/FieldDeclarationValidator.js.map +1 -1
  20. package/dist/vocabulary/index.d.ts +21 -21
  21. package/dist/vocabulary/index.d.ts.map +1 -1
  22. package/dist/vocabulary/index.js +21 -21
  23. package/dist/vocabulary/index.js.map +1 -1
  24. package/dist/vocabulary/{created.d.ts → preset/created.d.ts} +1 -1
  25. package/dist/vocabulary/preset/created.d.ts.map +1 -0
  26. package/dist/vocabulary/{created.js → preset/created.js} +1 -1
  27. package/dist/vocabulary/preset/created.js.map +1 -0
  28. package/dist/vocabulary/{email.d.ts → preset/email.d.ts} +2 -2
  29. package/dist/vocabulary/preset/email.d.ts.map +1 -0
  30. package/dist/vocabulary/{email.js → preset/email.js} +1 -1
  31. package/dist/vocabulary/preset/email.js.map +1 -0
  32. package/dist/vocabulary/{updated.d.ts → preset/updated.d.ts} +1 -1
  33. package/dist/vocabulary/preset/updated.d.ts.map +1 -0
  34. package/dist/vocabulary/preset/updated.js.map +1 -0
  35. package/dist/vocabulary/{url.d.ts → preset/url.d.ts} +2 -2
  36. package/dist/vocabulary/preset/url.d.ts.map +1 -0
  37. package/dist/vocabulary/{url.js → preset/url.js} +1 -1
  38. package/dist/vocabulary/preset/url.js.map +1 -0
  39. package/dist/vocabulary/{bool.d.ts → primitive/bool.d.ts} +1 -1
  40. package/dist/vocabulary/primitive/bool.d.ts.map +1 -0
  41. package/dist/vocabulary/{bool.js → primitive/bool.js} +1 -1
  42. package/dist/vocabulary/primitive/bool.js.map +1 -0
  43. package/dist/vocabulary/{date.d.ts → primitive/date.d.ts} +1 -1
  44. package/dist/vocabulary/primitive/date.d.ts.map +1 -0
  45. package/dist/vocabulary/{date.js → primitive/date.js} +1 -1
  46. package/dist/vocabulary/primitive/date.js.map +1 -0
  47. package/dist/vocabulary/{json.d.ts → primitive/json.d.ts} +2 -2
  48. package/dist/vocabulary/primitive/json.d.ts.map +1 -0
  49. package/dist/vocabulary/{json.js → primitive/json.js} +2 -2
  50. package/dist/vocabulary/primitive/json.js.map +1 -0
  51. package/dist/vocabulary/{list.d.ts → primitive/list.d.ts} +1 -1
  52. package/dist/vocabulary/primitive/list.d.ts.map +1 -0
  53. package/dist/vocabulary/{list.js → primitive/list.js} +1 -1
  54. package/dist/vocabulary/primitive/list.js.map +1 -0
  55. package/dist/vocabulary/{many.d.ts → primitive/many.d.ts} +2 -2
  56. package/dist/vocabulary/primitive/many.d.ts.map +1 -0
  57. package/dist/vocabulary/{many.js → primitive/many.js} +2 -2
  58. package/dist/vocabulary/primitive/many.js.map +1 -0
  59. package/dist/vocabulary/{number.d.ts → primitive/number.d.ts} +1 -1
  60. package/dist/vocabulary/primitive/number.d.ts.map +1 -0
  61. package/dist/vocabulary/{number.js → primitive/number.js} +1 -1
  62. package/dist/vocabulary/primitive/number.js.map +1 -0
  63. package/dist/vocabulary/{oneOf.d.ts → primitive/oneOf.d.ts} +1 -1
  64. package/dist/vocabulary/primitive/oneOf.d.ts.map +1 -0
  65. package/dist/vocabulary/{oneOf.js → primitive/oneOf.js} +1 -1
  66. package/dist/vocabulary/primitive/oneOf.js.map +1 -0
  67. package/dist/vocabulary/{primary.d.ts → primitive/primary.d.ts} +2 -2
  68. package/dist/vocabulary/primitive/primary.d.ts.map +1 -0
  69. package/dist/vocabulary/{primary.js → primitive/primary.js} +2 -2
  70. package/dist/vocabulary/primitive/primary.js.map +1 -0
  71. package/dist/vocabulary/{ref.d.ts → primitive/ref.d.ts} +2 -2
  72. package/dist/vocabulary/primitive/ref.d.ts.map +1 -0
  73. package/dist/vocabulary/{ref.js → primitive/ref.js} +2 -2
  74. package/dist/vocabulary/primitive/ref.js.map +1 -0
  75. package/dist/vocabulary/{text.d.ts → primitive/text.d.ts} +2 -2
  76. package/dist/vocabulary/primitive/text.d.ts.map +1 -0
  77. package/dist/vocabulary/{text.js → primitive/text.js} +1 -1
  78. package/dist/vocabulary/primitive/text.js.map +1 -0
  79. package/dist/vocabulary/{immutable.d.ts → rule/immutable.d.ts} +1 -1
  80. package/dist/vocabulary/rule/immutable.d.ts.map +1 -0
  81. package/dist/vocabulary/{immutable.js → rule/immutable.js} +1 -1
  82. package/dist/vocabulary/rule/immutable.js.map +1 -0
  83. package/dist/vocabulary/{indexed.d.ts → rule/indexed.d.ts} +1 -1
  84. package/dist/vocabulary/rule/indexed.d.ts.map +1 -0
  85. package/dist/vocabulary/{indexed.js → rule/indexed.js} +1 -1
  86. package/dist/vocabulary/rule/indexed.js.map +1 -0
  87. package/dist/vocabulary/{nullable.d.ts → rule/nullable.d.ts} +1 -1
  88. package/dist/vocabulary/rule/nullable.d.ts.map +1 -0
  89. package/dist/vocabulary/{nullable.js → rule/nullable.js} +2 -2
  90. package/dist/vocabulary/rule/nullable.js.map +1 -0
  91. package/dist/vocabulary/{optional.d.ts → rule/optional.d.ts} +1 -1
  92. package/dist/vocabulary/rule/optional.d.ts.map +1 -0
  93. package/dist/vocabulary/{optional.js → rule/optional.js} +2 -2
  94. package/dist/vocabulary/rule/optional.js.map +1 -0
  95. package/dist/vocabulary/{readOnly.d.ts → rule/readOnly.d.ts} +1 -1
  96. package/dist/vocabulary/rule/readOnly.d.ts.map +1 -0
  97. package/dist/vocabulary/{readOnly.js → rule/readOnly.js} +2 -2
  98. package/dist/vocabulary/rule/readOnly.js.map +1 -0
  99. package/dist/vocabulary/{unique.d.ts → rule/unique.d.ts} +1 -1
  100. package/dist/vocabulary/rule/unique.d.ts.map +1 -0
  101. package/dist/vocabulary/{unique.js → rule/unique.js} +1 -1
  102. package/dist/vocabulary/rule/unique.js.map +1 -0
  103. package/dist/vocabulary/{writeOnly.d.ts → rule/writeOnly.d.ts} +1 -1
  104. package/dist/vocabulary/rule/writeOnly.d.ts.map +1 -0
  105. package/dist/vocabulary/{writeOnly.js → rule/writeOnly.js} +2 -2
  106. package/dist/vocabulary/rule/writeOnly.js.map +1 -0
  107. package/package.json +1 -1
  108. package/src/axis/boundary/BoundaryAxis.ts +2 -2
  109. package/src/axis/lifecycle/LifecycleAxis.ts +5 -5
  110. package/src/axis/role/RoleAxis.ts +6 -6
  111. package/src/field/Field.ts +1 -1
  112. package/src/index.ts +1 -1
  113. package/src/lib/utils.ts +2 -0
  114. package/src/validator/FieldDeclarationValidator.ts +4 -4
  115. package/src/vocabulary/index.ts +24 -21
  116. package/src/vocabulary/{created.ts → preset/created.ts} +2 -2
  117. package/src/vocabulary/{email.ts → preset/email.ts} +2 -2
  118. package/src/vocabulary/{updated.ts → preset/updated.ts} +1 -1
  119. package/src/vocabulary/{url.ts → preset/url.ts} +2 -2
  120. package/src/vocabulary/{bool.ts → primitive/bool.ts} +1 -1
  121. package/src/vocabulary/{date.ts → primitive/date.ts} +1 -1
  122. package/src/vocabulary/{json.ts → primitive/json.ts} +3 -3
  123. package/src/vocabulary/{list.ts → primitive/list.ts} +1 -1
  124. package/src/vocabulary/{many.ts → primitive/many.ts} +2 -2
  125. package/src/vocabulary/{number.ts → primitive/number.ts} +1 -1
  126. package/src/vocabulary/{oneOf.ts → primitive/oneOf.ts} +1 -1
  127. package/src/vocabulary/{primary.ts → primitive/primary.ts} +2 -2
  128. package/src/vocabulary/{ref.ts → primitive/ref.ts} +2 -2
  129. package/src/vocabulary/{text.ts → primitive/text.ts} +2 -2
  130. package/src/vocabulary/{immutable.ts → rule/immutable.ts} +2 -2
  131. package/src/vocabulary/{indexed.ts → rule/indexed.ts} +2 -2
  132. package/src/vocabulary/{nullable.ts → rule/nullable.ts} +3 -3
  133. package/src/vocabulary/{optional.ts → rule/optional.ts} +3 -3
  134. package/src/vocabulary/{readOnly.ts → rule/readOnly.ts} +3 -3
  135. package/src/vocabulary/{unique.ts → rule/unique.ts} +2 -2
  136. package/src/vocabulary/{writeOnly.ts → rule/writeOnly.ts} +3 -3
  137. package/dist/axis/Meta.d.ts.map +0 -1
  138. package/dist/vocabulary/bool.d.ts.map +0 -1
  139. package/dist/vocabulary/bool.js.map +0 -1
  140. package/dist/vocabulary/created.d.ts.map +0 -1
  141. package/dist/vocabulary/created.js.map +0 -1
  142. package/dist/vocabulary/date.d.ts.map +0 -1
  143. package/dist/vocabulary/date.js.map +0 -1
  144. package/dist/vocabulary/email.d.ts.map +0 -1
  145. package/dist/vocabulary/email.js.map +0 -1
  146. package/dist/vocabulary/immutable.d.ts.map +0 -1
  147. package/dist/vocabulary/immutable.js.map +0 -1
  148. package/dist/vocabulary/indexed.d.ts.map +0 -1
  149. package/dist/vocabulary/indexed.js.map +0 -1
  150. package/dist/vocabulary/json.d.ts.map +0 -1
  151. package/dist/vocabulary/json.js.map +0 -1
  152. package/dist/vocabulary/list.d.ts.map +0 -1
  153. package/dist/vocabulary/list.js.map +0 -1
  154. package/dist/vocabulary/many.d.ts.map +0 -1
  155. package/dist/vocabulary/many.js.map +0 -1
  156. package/dist/vocabulary/nullable.d.ts.map +0 -1
  157. package/dist/vocabulary/nullable.js.map +0 -1
  158. package/dist/vocabulary/number.d.ts.map +0 -1
  159. package/dist/vocabulary/number.js.map +0 -1
  160. package/dist/vocabulary/oneOf.d.ts.map +0 -1
  161. package/dist/vocabulary/oneOf.js.map +0 -1
  162. package/dist/vocabulary/optional.d.ts.map +0 -1
  163. package/dist/vocabulary/optional.js.map +0 -1
  164. package/dist/vocabulary/primary.d.ts.map +0 -1
  165. package/dist/vocabulary/primary.js.map +0 -1
  166. package/dist/vocabulary/readOnly.d.ts.map +0 -1
  167. package/dist/vocabulary/readOnly.js.map +0 -1
  168. package/dist/vocabulary/ref.d.ts.map +0 -1
  169. package/dist/vocabulary/ref.js.map +0 -1
  170. package/dist/vocabulary/text.d.ts.map +0 -1
  171. package/dist/vocabulary/text.js.map +0 -1
  172. package/dist/vocabulary/unique.d.ts.map +0 -1
  173. package/dist/vocabulary/unique.js.map +0 -1
  174. package/dist/vocabulary/updated.d.ts.map +0 -1
  175. package/dist/vocabulary/updated.js.map +0 -1
  176. package/dist/vocabulary/url.d.ts.map +0 -1
  177. package/dist/vocabulary/url.js.map +0 -1
  178. package/dist/vocabulary/writeOnly.d.ts.map +0 -1
  179. package/dist/vocabulary/writeOnly.js.map +0 -1
  180. /package/dist/{axis → field}/Meta.d.ts +0 -0
  181. /package/dist/{axis → field}/Meta.js +0 -0
  182. /package/dist/vocabulary/{updated.js → preset/updated.js} +0 -0
  183. /package/src/{axis → field}/Meta.ts +0 -0
@@ -1,5 +1,5 @@
1
- import { Relation } from '../axis/role/Relation.js';
2
- import { Field } from '../field/Field.js';
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"}
@@ -1,4 +1,4 @@
1
- import { Field } from '../field/Field.js';
1
+ import { Field } from '../../field/Field.js';
2
2
  export interface NumberOptions {
3
3
  min?: number;
4
4
  max?: number;
@@ -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"}
@@ -1,4 +1,4 @@
1
- import { Field } from '../field/Field.js';
1
+ import { Field } from '../../field/Field.js';
2
2
  /**
3
3
  * So `integer` is a shape, not a second word to remember.
4
4
  * FR : pour qu'`integer` soit une forme, pas un second mot à retenir.
@@ -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"}
@@ -1,4 +1,4 @@
1
- import { Field } from '../field/Field.js';
1
+ import { Field } from '../../field/Field.js';
2
2
  interface OneOfOptions<V extends string = string> {
3
3
  description?: string;
4
4
  default?: V;
@@ -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 '../field/Field.js';
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 '../field/Field.js';
2
- import { type GeneratorRef } from '../axis/lifecycle/Generators.js';
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 '../field/Field.js';
2
- import { Generators } from '../axis/lifecycle/Generators.js';
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 '../axis/role/Relation.js';
2
- import { Field } from '../field/Field.js';
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 '../axis/role/Relation.js';
2
- import { Field } from '../field/Field.js';
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 '../field/Field.js';
2
- import { type StringFormat } from '../axis/shape/Formats.js';
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"}
@@ -1,4 +1,4 @@
1
- import { Field } from '../field/Field.js';
1
+ import { Field } from '../../field/Field.js';
2
2
  /**
3
3
  * So a string field states its bounds where the DDL and the validator both read them.
4
4
  * FR : pour qu'un champ texte énonce ses bornes là où le DDL et le juge les lisent.
@@ -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"}
@@ -1,4 +1,4 @@
1
- import { Field } from '../field/Field.js';
1
+ import { Field } from '../../field/Field.js';
2
2
  /**
3
3
  * So a write-once field is refused on a patch by the validator, not by the table.
4
4
  * FR : pour qu'un champ écrit une fois soit refusé par le juge sur une modification.
@@ -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"}
@@ -1,4 +1,4 @@
1
- import { vocabulary } from './vocabulary.js';
1
+ import { vocabulary } from '../vocabulary.js';
2
2
  /**
3
3
  * So a write-once field is refused on a patch by the validator, not by the table.
4
4
  * FR : pour qu'un champ écrit une fois soit refusé par le juge sur une modification.
@@ -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"}
@@ -1,4 +1,4 @@
1
- import { Field } from '../field/Field.js';
1
+ import { Field } from '../../field/Field.js';
2
2
  /**
3
3
  * So the entity states the index, and the DDL is the one that emits it.
4
4
  * FR : pour que l'entité énonce l'index, le DDL étant celui qui l'émet.
@@ -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"}
@@ -1,4 +1,4 @@
1
- import { vocabulary } from './vocabulary.js';
1
+ import { vocabulary } from '../vocabulary.js';
2
2
  /**
3
3
  * So the entity states the index, and the DDL is the one that emits it.
4
4
  * FR : pour que l'entité énonce l'index, le DDL étant celui qui l'émet.
@@ -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 '../field/Field.js';
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 './vocabulary.js';
2
- import { Shapes } from '../axis/shape/Shape.js';
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 '../field/Field.js';
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 './vocabulary.js';
2
- import { Shapes } from '../axis/shape/Shape.js';
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"}
@@ -1,4 +1,4 @@
1
- import { Field } from '../field/Field.js';
1
+ import { Field } from '../../field/Field.js';
2
2
  /**
3
3
  * So a field a client may read but never write says so once, on the field.
4
4
  * FR : pour qu'un champ lisible mais non écrivable le dise une fois, sur le champ.
@@ -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 './vocabulary.js';
2
- import { Boundary } from '../axis/boundary/Boundary.js';
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"}
@@ -1,4 +1,4 @@
1
- import { Field } from '../field/Field.js';
1
+ import { Field } from '../../field/Field.js';
2
2
  /**
3
3
  * So a field is unique on its own, whatever key it ends up under.
4
4
  * FR : pour qu'un champ soit unique à lui seul, quelle que soit sa clé.
@@ -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"}
@@ -1,4 +1,4 @@
1
- import { vocabulary } from './vocabulary.js';
1
+ import { vocabulary } from '../vocabulary.js';
2
2
  /**
3
3
  * So a field is unique on its own, whatever key it ends up under.
4
4
  * FR : pour qu'un champ soit unique à lui seul, quelle que soit sa clé.
@@ -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"}
@@ -1,4 +1,4 @@
1
- import { Field } from '../field/Field.js';
1
+ import { Field } from '../../field/Field.js';
2
2
  /**
3
3
  * So a secret leaves no response, the dual of `readOnly` on the same axis.
4
4
  * FR : pour qu'un secret ne reparte dans aucune réponse, dual de `readOnly`.
@@ -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 './vocabulary.js';
2
- import { Boundary } from '../axis/boundary/Boundary.js';
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
  {
2
2
  "name": "@fougere/schema",
3
- "version": "0.8.0-alpha.0",
3
+ "version": "0.8.2-alpha.0",
4
4
  "description": "The entity and its 4 axes — shape, role, lifecycle, boundary. Subject-owned judgments, edge-safe.",
5
5
  "keywords": [
6
6
  "fougere",
@@ -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 ${JSON.stringify(value)}`,
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 ${JSON.stringify(value)}` });
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 ${JSON.stringify(value.update)}`,
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 ${JSON.stringify(rule.generate)}`,
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 ${JSON.stringify(rule)}`,
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 ${JSON.stringify(value)}` });
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 ${JSON.stringify(value[flag])}`,
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 ${JSON.stringify(relation)}` });
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 ${JSON.stringify(relation.kind)}`,
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 ${JSON.stringify(relation.onDelete)}`,
97
+ message: `Expected 'cascade', 'restrict' or 'set null' — got ${shown(relation.onDelete)}`,
98
98
  });
99
99
  }
100
100
  }
@@ -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 '../axis/Meta.js';
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 ${JSON.stringify(declaration)}`,
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 ${JSON.stringify(declaration.shape)}`,
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 ${JSON.stringify(declaration.meta)}`,
47
+ message: `Expected an object — got ${shown(declaration.meta)}`,
48
48
  });
49
49
  } else if (
50
50
  declaration.meta.description !== undefined &&
@@ -1,22 +1,25 @@
1
- export * from './bool.js';
2
- export * from './created.js';
3
- export * from './date.js';
4
- export * from './email.js';
5
- export * from './immutable.js';
6
- export * from './indexed.js';
7
- export * from './json.js';
8
- export * from './list.js';
9
- export * from './many.js';
10
- export * from './nullable.js';
11
- export * from './number.js';
12
- export * from './oneOf.js';
13
- export * from './optional.js';
14
- export * from './primary.js';
15
- export * from './readOnly.js';
16
- export * from './ref.js';
17
- export * from './text.js';
18
- export * from './unique.js';
19
- export * from './updated.js';
20
- export * from './url.js';
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 { Field } from '../field/Field.js';
2
- import { date } from './date.js';
1
+ import { Field } from '../../field/Field.js';
2
+ import { date } from '../primitive/date.js';
3
3
 
4
4
  /**
5
5
  * So a creation stamp is written by the storage and refused from a client.
@@ -1,5 +1,5 @@
1
- import { text, type TextOptions } from './text.js';
2
- import type { Field } from '../field/Field.js';
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
1
  import { created } from './created.js';
2
- import { Field } from '../field/Field.js';
2
+ import { Field } from '../../field/Field.js';
3
3
 
4
4
  /**
5
5
  * So the dual of `created()` is re-stamped at every write, by the same hand.
@@ -1,5 +1,5 @@
1
- import { text, type TextOptions } from './text.js';
2
- import type { Field } from '../field/Field.js';
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,4 +1,4 @@
1
- import { Field } from '../field/Field.js';
1
+ import { Field } from '../../field/Field.js';
2
2
 
3
3
  /**
4
4
  * So a default is a lifecycle rule, not a value the handler remembers to set.
@@ -1,4 +1,4 @@
1
- import { Field } from '../field/Field.js';
1
+ import { Field } from '../../field/Field.js';
2
2
 
3
3
  /**
4
4
  * So a date is a string on the wire and a `Date` in a handler, with no word said.
@@ -1,6 +1,6 @@
1
- import { Field } from '../field/Field.js';
2
- import type { SchemaView } from '../SchemaView.js';
3
- import { InputValidator } from '../validator/InputValidator.js';
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)>(