@fougere/schema 0.9.2-alpha.0 → 0.10.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.
Files changed (349) hide show
  1. package/dist/PartialValues.d.ts +4 -0
  2. package/dist/PartialValues.d.ts.map +1 -0
  3. package/dist/PartialValues.js +2 -0
  4. package/dist/PartialValues.js.map +1 -0
  5. package/dist/Schema.d.ts +9 -21
  6. package/dist/Schema.d.ts.map +1 -1
  7. package/dist/Schema.js.map +1 -1
  8. package/dist/SchemaConstraints.d.ts +24 -0
  9. package/dist/SchemaConstraints.d.ts.map +1 -0
  10. package/dist/SchemaConstraints.js +39 -0
  11. package/dist/SchemaConstraints.js.map +1 -0
  12. package/dist/SchemaConstructor.d.ts +25 -0
  13. package/dist/SchemaConstructor.d.ts.map +1 -0
  14. package/dist/SchemaConstructor.js +2 -0
  15. package/dist/SchemaConstructor.js.map +1 -0
  16. package/dist/SchemaDefinition.d.ts +5 -23
  17. package/dist/SchemaDefinition.d.ts.map +1 -1
  18. package/dist/SchemaDefinition.js +1 -38
  19. package/dist/SchemaDefinition.js.map +1 -1
  20. package/dist/SchemaDerivation.d.ts +1 -1
  21. package/dist/SchemaDerivation.d.ts.map +1 -1
  22. package/dist/SchemaView.d.ts +6 -8
  23. package/dist/SchemaView.d.ts.map +1 -1
  24. package/dist/Values.d.ts +6 -0
  25. package/dist/Values.d.ts.map +1 -0
  26. package/dist/Values.js +2 -0
  27. package/dist/Values.js.map +1 -0
  28. package/dist/axis/Axis.d.ts +2 -2
  29. package/dist/axis/Axis.d.ts.map +1 -1
  30. package/dist/axis/Axis.js.map +1 -1
  31. package/dist/axis/Resolver.d.ts +2 -0
  32. package/dist/axis/Resolver.d.ts.map +1 -0
  33. package/dist/axis/Resolver.js +2 -0
  34. package/dist/axis/Resolver.js.map +1 -0
  35. package/dist/axis/boundary/Boundaries.d.ts +3 -12
  36. package/dist/axis/boundary/Boundaries.d.ts.map +1 -1
  37. package/dist/axis/boundary/Boundaries.js.map +1 -1
  38. package/dist/axis/boundary/Boundary.d.ts +3 -10
  39. package/dist/axis/boundary/Boundary.d.ts.map +1 -1
  40. package/dist/axis/boundary/Boundary.js +1 -1
  41. package/dist/axis/boundary/Boundary.js.map +1 -1
  42. package/dist/axis/boundary/BoundaryAxis.d.ts +1 -1
  43. package/dist/axis/boundary/BoundaryAxis.d.ts.map +1 -1
  44. package/dist/axis/boundary/BoundaryRef.d.ts +3 -0
  45. package/dist/axis/boundary/BoundaryRef.d.ts.map +1 -0
  46. package/dist/axis/boundary/BoundaryRef.js +2 -0
  47. package/dist/axis/boundary/BoundaryRef.js.map +1 -0
  48. package/dist/axis/boundary/BoundaryRules.d.ts +9 -0
  49. package/dist/axis/boundary/BoundaryRules.d.ts.map +1 -0
  50. package/dist/axis/boundary/BoundaryRules.js +2 -0
  51. package/dist/axis/boundary/BoundaryRules.js.map +1 -0
  52. package/dist/axis/boundary/Decoder.d.ts +26 -0
  53. package/dist/axis/boundary/Decoder.d.ts.map +1 -0
  54. package/dist/axis/boundary/Decoder.js +25 -0
  55. package/dist/axis/boundary/Decoder.js.map +1 -0
  56. package/dist/axis/boundary/Encoder.d.ts +2 -0
  57. package/dist/axis/boundary/Encoder.d.ts.map +1 -0
  58. package/dist/axis/boundary/Encoder.js +2 -0
  59. package/dist/axis/boundary/Encoder.js.map +1 -0
  60. package/dist/axis/lifecycle/Lifecycle.d.ts +1 -10
  61. package/dist/axis/lifecycle/Lifecycle.d.ts.map +1 -1
  62. package/dist/axis/lifecycle/Lifecycle.js +0 -2
  63. package/dist/axis/lifecycle/Lifecycle.js.map +1 -1
  64. package/dist/axis/lifecycle/LifecycleAxis.d.ts +1 -1
  65. package/dist/axis/lifecycle/LifecycleAxis.d.ts.map +1 -1
  66. package/dist/axis/lifecycle/LifecycleAxis.js +1 -1
  67. package/dist/axis/lifecycle/LifecycleAxis.js.map +1 -1
  68. package/dist/axis/lifecycle/LifecycleRules.d.ts +12 -0
  69. package/dist/axis/lifecycle/LifecycleRules.d.ts.map +1 -0
  70. package/dist/axis/lifecycle/LifecycleRules.js +3 -0
  71. package/dist/axis/lifecycle/LifecycleRules.js.map +1 -0
  72. package/dist/axis/lifecycle/apply.d.ts +1 -1
  73. package/dist/axis/lifecycle/apply.d.ts.map +1 -1
  74. package/dist/axis/lifecycle/apply.js.map +1 -1
  75. package/dist/axis/role/EntityConstructor.d.ts +2 -0
  76. package/dist/axis/role/EntityConstructor.d.ts.map +1 -0
  77. package/dist/axis/role/EntityConstructor.js +2 -0
  78. package/dist/axis/role/EntityConstructor.js.map +1 -0
  79. package/dist/axis/role/Relation.d.ts +1 -1
  80. package/dist/axis/role/Relation.d.ts.map +1 -1
  81. package/dist/axis/role/Relation.js.map +1 -1
  82. package/dist/axis/role/Role.d.ts +3 -7
  83. package/dist/axis/role/Role.d.ts.map +1 -1
  84. package/dist/axis/role/Role.js.map +1 -1
  85. package/dist/axis/role/RoleAxis.d.ts +2 -2
  86. package/dist/axis/role/RoleAxis.d.ts.map +1 -1
  87. package/dist/axis/role/RoleAxis.js.map +1 -1
  88. package/dist/axis/role/RoleRules.d.ts +8 -0
  89. package/dist/axis/role/RoleRules.d.ts.map +1 -0
  90. package/dist/axis/role/RoleRules.js +2 -0
  91. package/dist/axis/role/RoleRules.js.map +1 -0
  92. package/dist/axis/shape/FormatPredicate.d.ts +2 -0
  93. package/dist/axis/shape/FormatPredicate.d.ts.map +1 -0
  94. package/dist/axis/shape/FormatPredicate.js +2 -0
  95. package/dist/axis/shape/FormatPredicate.js.map +1 -0
  96. package/dist/axis/shape/Formats.d.ts +1 -2
  97. package/dist/axis/shape/Formats.d.ts.map +1 -1
  98. package/dist/axis/shape/Formats.js.map +1 -1
  99. package/dist/axis/shape/Shape.d.ts +3 -9
  100. package/dist/axis/shape/Shape.d.ts.map +1 -1
  101. package/dist/axis/shape/Shape.js +1 -1
  102. package/dist/axis/shape/Shape.js.map +1 -1
  103. package/dist/axis/shape/ShapeType.d.ts +8 -0
  104. package/dist/axis/shape/ShapeType.d.ts.map +1 -0
  105. package/dist/axis/shape/ShapeType.js +2 -0
  106. package/dist/axis/shape/ShapeType.js.map +1 -0
  107. package/dist/axis/shape/StringFormat.d.ts +2 -0
  108. package/dist/axis/shape/StringFormat.d.ts.map +1 -0
  109. package/dist/axis/shape/StringFormat.js +2 -0
  110. package/dist/axis/shape/StringFormat.js.map +1 -0
  111. package/dist/entity/CompositeUnique.d.ts +4 -0
  112. package/dist/entity/CompositeUnique.d.ts.map +1 -0
  113. package/dist/entity/CompositeUnique.js +2 -0
  114. package/dist/entity/CompositeUnique.js.map +1 -0
  115. package/dist/entity/EntityAdapterSet.d.ts +1 -1
  116. package/dist/entity/EntityAdapterSet.d.ts.map +1 -1
  117. package/dist/entity/EntityAdapters.d.ts +3 -3
  118. package/dist/entity/EntityAdapters.d.ts.map +1 -1
  119. package/dist/entity/EntityDeclarations.d.ts +3 -3
  120. package/dist/entity/EntityDeclarations.d.ts.map +1 -1
  121. package/dist/entity/FougereEntityAdapters.d.ts +3 -0
  122. package/dist/entity/FougereEntityAdapters.d.ts.map +1 -0
  123. package/dist/entity/FougereEntityAdapters.js +2 -0
  124. package/dist/entity/FougereEntityAdapters.js.map +1 -0
  125. package/dist/entity/PreviousNames.d.ts +4 -0
  126. package/dist/entity/PreviousNames.d.ts.map +1 -0
  127. package/dist/entity/PreviousNames.js +2 -0
  128. package/dist/entity/PreviousNames.js.map +1 -0
  129. package/dist/entity.d.ts +2 -2
  130. package/dist/entity.d.ts.map +1 -1
  131. package/dist/entity.js.map +1 -1
  132. package/dist/field/Field.d.ts +3 -5
  133. package/dist/field/Field.d.ts.map +1 -1
  134. package/dist/field/Field.js +1 -1
  135. package/dist/field/Field.js.map +1 -1
  136. package/dist/field/FieldName.d.ts +3 -0
  137. package/dist/field/FieldName.d.ts.map +1 -0
  138. package/dist/field/FieldName.js +2 -0
  139. package/dist/field/FieldName.js.map +1 -0
  140. package/dist/field/FieldSet.d.ts +3 -2
  141. package/dist/field/FieldSet.d.ts.map +1 -1
  142. package/dist/field/FieldSet.js.map +1 -1
  143. package/dist/field/Fields.d.ts +3 -0
  144. package/dist/field/Fields.d.ts.map +1 -0
  145. package/dist/field/Fields.js +2 -0
  146. package/dist/field/Fields.js.map +1 -0
  147. package/dist/index.d.ts +21 -10
  148. package/dist/index.d.ts.map +1 -1
  149. package/dist/index.js +3 -3
  150. package/dist/index.js.map +1 -1
  151. package/dist/lib/Checked.d.ts +11 -0
  152. package/dist/lib/Checked.d.ts.map +1 -0
  153. package/dist/lib/Checked.js +2 -0
  154. package/dist/lib/Checked.js.map +1 -0
  155. package/dist/lib/ValidationError.d.ts +10 -0
  156. package/dist/lib/ValidationError.d.ts.map +1 -0
  157. package/dist/lib/ValidationError.js +2 -0
  158. package/dist/lib/ValidationError.js.map +1 -0
  159. package/dist/lib/ValidationResult.d.ts +14 -0
  160. package/dist/lib/ValidationResult.d.ts.map +1 -0
  161. package/dist/lib/{validation.js → ValidationResult.js} +1 -1
  162. package/dist/lib/ValidationResult.js.map +1 -0
  163. package/dist/projection/Cases.d.ts +1 -18
  164. package/dist/projection/Cases.d.ts.map +1 -1
  165. package/dist/projection/Cases.js.map +1 -1
  166. package/dist/projection/ValidationCase.d.ts +19 -0
  167. package/dist/projection/ValidationCase.d.ts.map +1 -0
  168. package/dist/projection/ValidationCase.js +2 -0
  169. package/dist/projection/ValidationCase.js.map +1 -0
  170. package/dist/projection/Visibility.d.ts +1 -1
  171. package/dist/projection/Visibility.d.ts.map +1 -1
  172. package/dist/projection/card/Bundle.d.ts +3 -2
  173. package/dist/projection/card/Bundle.d.ts.map +1 -1
  174. package/dist/projection/card/Bundle.js.map +1 -1
  175. package/dist/projection/card/Card.d.ts +10 -6
  176. package/dist/projection/card/Card.d.ts.map +1 -1
  177. package/dist/projection/card/Card.js +3 -3
  178. package/dist/projection/card/Card.js.map +1 -1
  179. package/dist/projection/card/Change.d.ts +70 -0
  180. package/dist/projection/card/Change.d.ts.map +1 -0
  181. package/dist/projection/card/Change.js +2 -0
  182. package/dist/projection/card/Change.js.map +1 -0
  183. package/dist/projection/card/DerivedFrom.d.ts +12 -0
  184. package/dist/projection/card/DerivedFrom.d.ts.map +1 -0
  185. package/dist/projection/card/DerivedFrom.js +2 -0
  186. package/dist/projection/card/DerivedFrom.js.map +1 -0
  187. package/dist/projection/card/Diff.d.ts +18 -0
  188. package/dist/projection/card/Diff.d.ts.map +1 -0
  189. package/dist/projection/card/{diff.js → Diff.js} +1 -1
  190. package/dist/projection/card/{diff.js.map → Diff.js.map} +1 -1
  191. package/dist/projection/card/DiffOptions.d.ts +5 -0
  192. package/dist/projection/card/DiffOptions.d.ts.map +1 -0
  193. package/dist/projection/card/DiffOptions.js +2 -0
  194. package/dist/projection/card/DiffOptions.js.map +1 -0
  195. package/dist/projection/card/FieldDescriptor.d.ts +11 -0
  196. package/dist/projection/card/FieldDescriptor.d.ts.map +1 -0
  197. package/dist/projection/card/FieldDescriptor.js +2 -0
  198. package/dist/projection/card/FieldDescriptor.js.map +1 -0
  199. package/dist/projection/card/FieldExtension.d.ts +9 -0
  200. package/dist/projection/card/FieldExtension.d.ts.map +1 -0
  201. package/dist/projection/card/FieldExtension.js +2 -0
  202. package/dist/projection/card/FieldExtension.js.map +1 -0
  203. package/dist/projection/card/RelationDescriptor.d.ts +5 -0
  204. package/dist/projection/card/RelationDescriptor.d.ts.map +1 -0
  205. package/dist/projection/card/RelationDescriptor.js +2 -0
  206. package/dist/projection/card/RelationDescriptor.js.map +1 -0
  207. package/dist/projection/card/RenameCandidate.d.ts +6 -0
  208. package/dist/projection/card/RenameCandidate.d.ts.map +1 -0
  209. package/dist/projection/card/RenameCandidate.js +2 -0
  210. package/dist/projection/card/RenameCandidate.js.map +1 -0
  211. package/dist/projection/card/RoleDescriptor.d.ts +7 -0
  212. package/dist/projection/card/RoleDescriptor.d.ts.map +1 -0
  213. package/dist/projection/card/RoleDescriptor.js +2 -0
  214. package/dist/projection/card/RoleDescriptor.js.map +1 -0
  215. package/dist/projection/card/SchemaBundle.d.ts +7 -0
  216. package/dist/projection/card/SchemaBundle.d.ts.map +1 -0
  217. package/dist/projection/card/SchemaBundle.js +2 -0
  218. package/dist/projection/card/SchemaBundle.js.map +1 -0
  219. package/dist/projection/card/SchemaDescriptor.d.ts +12 -0
  220. package/dist/projection/card/SchemaDescriptor.d.ts.map +1 -0
  221. package/dist/projection/card/SchemaDescriptor.js +2 -0
  222. package/dist/projection/card/SchemaDescriptor.js.map +1 -0
  223. package/dist/projection/card/SetDiff.d.ts +10 -0
  224. package/dist/projection/card/SetDiff.d.ts.map +1 -0
  225. package/dist/projection/card/SetDiff.js +2 -0
  226. package/dist/projection/card/SetDiff.js.map +1 -0
  227. package/dist/projection/card/SetDiffOptions.d.ts +5 -0
  228. package/dist/projection/card/SetDiffOptions.d.ts.map +1 -0
  229. package/dist/projection/card/SetDiffOptions.js +2 -0
  230. package/dist/projection/card/SetDiffOptions.js.map +1 -0
  231. package/dist/projection/card/ShapeKeywords.d.ts +7 -0
  232. package/dist/projection/card/ShapeKeywords.d.ts.map +1 -0
  233. package/dist/projection/card/ShapeKeywords.js +2 -0
  234. package/dist/projection/card/ShapeKeywords.js.map +1 -0
  235. package/dist/projection/card/TypeSet.d.ts +3 -0
  236. package/dist/projection/card/TypeSet.d.ts.map +1 -0
  237. package/dist/projection/card/TypeSet.js +2 -0
  238. package/dist/projection/card/TypeSet.js.map +1 -0
  239. package/dist/projection/card/admission.d.ts +2 -2
  240. package/dist/projection/card/admission.d.ts.map +1 -1
  241. package/dist/projection/card/admission.js +2 -2
  242. package/dist/projection/card/admission.js.map +1 -1
  243. package/dist/validator/FieldDeclarationValidator.d.ts +1 -1
  244. package/dist/validator/FieldDeclarationValidator.d.ts.map +1 -1
  245. package/dist/validator/FieldDeclarationValidator.js.map +1 -1
  246. package/dist/validator/FieldValueValidator.d.ts +1 -1
  247. package/dist/validator/FieldValueValidator.d.ts.map +1 -1
  248. package/dist/validator/FieldValueValidator.js.map +1 -1
  249. package/dist/validator/InputValidator.d.ts +4 -5
  250. package/dist/validator/InputValidator.d.ts.map +1 -1
  251. package/dist/validator/InputValidator.js.map +1 -1
  252. package/dist/validator/ValidateOptions.d.ts +4 -0
  253. package/dist/validator/ValidateOptions.d.ts.map +1 -0
  254. package/dist/validator/ValidateOptions.js +2 -0
  255. package/dist/validator/ValidateOptions.js.map +1 -0
  256. package/dist/vocabulary/primitive/many.d.ts +1 -1
  257. package/dist/vocabulary/primitive/many.d.ts.map +1 -1
  258. package/dist/vocabulary/primitive/many.js.map +1 -1
  259. package/dist/vocabulary/primitive/ref.d.ts +1 -1
  260. package/dist/vocabulary/primitive/ref.d.ts.map +1 -1
  261. package/dist/vocabulary/primitive/ref.js.map +1 -1
  262. package/dist/vocabulary/primitive/text.d.ts +1 -1
  263. package/dist/vocabulary/primitive/text.d.ts.map +1 -1
  264. package/package.json +1 -1
  265. package/src/PartialValues.ts +4 -0
  266. package/src/Schema.ts +12 -32
  267. package/src/SchemaConstraints.ts +46 -0
  268. package/src/SchemaConstructor.ts +32 -0
  269. package/src/SchemaDefinition.ts +6 -50
  270. package/src/SchemaDerivation.ts +1 -1
  271. package/src/SchemaView.ts +6 -10
  272. package/src/Values.ts +6 -0
  273. package/src/axis/Axis.ts +2 -3
  274. package/src/axis/Resolver.ts +1 -0
  275. package/src/axis/boundary/Boundaries.ts +3 -9
  276. package/src/axis/boundary/Boundary.ts +7 -10
  277. package/src/axis/boundary/BoundaryAxis.ts +1 -1
  278. package/src/axis/boundary/BoundaryRef.ts +3 -0
  279. package/src/axis/boundary/BoundaryRules.ts +4 -0
  280. package/src/axis/boundary/Decoder.ts +42 -0
  281. package/src/axis/boundary/Encoder.ts +1 -0
  282. package/src/axis/lifecycle/Lifecycle.ts +1 -8
  283. package/src/axis/lifecycle/LifecycleAxis.ts +3 -2
  284. package/src/axis/lifecycle/LifecycleRules.ts +9 -0
  285. package/src/axis/lifecycle/apply.ts +2 -1
  286. package/src/axis/role/EntityConstructor.ts +1 -0
  287. package/src/axis/role/Relation.ts +2 -1
  288. package/src/axis/role/Role.ts +3 -8
  289. package/src/axis/role/RoleAxis.ts +7 -5
  290. package/src/axis/role/RoleRules.ts +8 -0
  291. package/src/axis/shape/FormatPredicate.ts +1 -0
  292. package/src/axis/shape/Formats.ts +1 -11
  293. package/src/axis/shape/Shape.ts +20 -24
  294. package/src/axis/shape/ShapeType.ts +12 -0
  295. package/src/axis/shape/StringFormat.ts +8 -0
  296. package/src/entity/CompositeUnique.ts +6 -0
  297. package/src/entity/EntityAdapterSet.ts +1 -1
  298. package/src/entity/EntityAdapters.ts +3 -4
  299. package/src/entity/EntityDeclarations.ts +3 -9
  300. package/src/entity/FougereEntityAdapters.ts +2 -0
  301. package/src/entity/PreviousNames.ts +6 -0
  302. package/src/entity.ts +3 -2
  303. package/src/field/Field.ts +4 -8
  304. package/src/field/FieldName.ts +3 -0
  305. package/src/field/FieldSet.ts +4 -2
  306. package/src/field/Fields.ts +3 -0
  307. package/src/index.ts +21 -19
  308. package/src/lib/Checked.ts +5 -0
  309. package/src/lib/ValidationError.ts +9 -0
  310. package/src/lib/ValidationResult.ts +11 -0
  311. package/src/projection/Cases.ts +1 -17
  312. package/src/projection/ValidationCase.ts +16 -0
  313. package/src/projection/Visibility.ts +1 -1
  314. package/src/projection/card/Bundle.ts +7 -4
  315. package/src/projection/card/Card.ts +16 -13
  316. package/src/projection/card/Change.ts +24 -0
  317. package/src/projection/card/DerivedFrom.ts +11 -0
  318. package/src/projection/card/{diff.ts → Diff.ts} +7 -49
  319. package/src/projection/card/DiffOptions.ts +4 -0
  320. package/src/projection/card/FieldDescriptor.ts +11 -0
  321. package/src/projection/card/FieldExtension.ts +9 -0
  322. package/src/projection/card/RelationDescriptor.ts +3 -0
  323. package/src/projection/card/RenameCandidate.ts +5 -0
  324. package/src/projection/card/RoleDescriptor.ts +7 -0
  325. package/src/projection/card/SchemaBundle.ts +7 -0
  326. package/src/projection/card/SchemaDescriptor.ts +12 -0
  327. package/src/projection/card/SetDiff.ts +10 -0
  328. package/src/projection/card/SetDiffOptions.ts +4 -0
  329. package/src/projection/card/ShapeKeywords.ts +7 -0
  330. package/src/projection/card/TypeSet.ts +2 -0
  331. package/src/projection/card/admission.ts +3 -3
  332. package/src/validator/FieldDeclarationValidator.ts +2 -1
  333. package/src/validator/FieldValueValidator.ts +5 -3
  334. package/src/validator/InputValidator.ts +5 -6
  335. package/src/validator/ValidateOptions.ts +3 -0
  336. package/src/vocabulary/primitive/many.ts +2 -1
  337. package/src/vocabulary/primitive/ref.ts +2 -1
  338. package/src/vocabulary/primitive/text.ts +1 -1
  339. package/dist/lib/validation.d.ts +0 -32
  340. package/dist/lib/validation.d.ts.map +0 -1
  341. package/dist/lib/validation.js.map +0 -1
  342. package/dist/projection/card/Descriptor.d.ts +0 -55
  343. package/dist/projection/card/Descriptor.d.ts.map +0 -1
  344. package/dist/projection/card/Descriptor.js +0 -2
  345. package/dist/projection/card/Descriptor.js.map +0 -1
  346. package/dist/projection/card/diff.d.ts +0 -104
  347. package/dist/projection/card/diff.d.ts.map +0 -1
  348. package/src/lib/validation.ts +0 -25
  349. package/src/projection/card/Descriptor.ts +0 -60
@@ -1,22 +1,15 @@
1
1
  import type { JSONSchema7, JSONSchema7TypeName } from 'json-schema';
2
- import type { StringFormat } from './Formats.js';
3
-
4
- /**
5
- * The standard's own list, less `null` — a shape states that as the `[T,'null']` union —
6
- * and with `string` in the three forms every projection here tells apart: a `date()`, a
7
- * bounded set, and everything else. Those three are the whole of what this package adds.
8
- */
9
- export type ShapeType =
10
- | Exclude<JSONSchema7TypeName, 'null' | 'string'>
11
- | 'text'
12
- | 'date'
13
- | 'choice';
2
+ import type { StringFormat } from './StringFormat.js';
3
+ import type { ShapeType } from './ShapeType.js';
14
4
 
15
5
  type Nullably<T extends string> = T | readonly [T, 'null'];
16
6
 
17
7
  interface StringConstraints { minLength?: number; maxLength?: number; pattern?: string; enum?: readonly (string | null)[]; format?: StringFormat }
8
+
18
9
  interface NumericConstraints { minimum?: number; maximum?: number }
10
+
19
11
  interface ArrayConstraints { items?: Shape; minItems?: number; maxItems?: number }
12
+
20
13
  interface ObjectConstraints { properties?: Record<string, unknown>; required?: readonly string[]; additionalProperties?: boolean | Shape; propertyNames?: Shape }
21
14
 
22
15
  export type Shape =
@@ -40,6 +33,20 @@ interface ShapeParts {
40
33
  nullable: boolean;
41
34
  }
42
35
 
36
+ type Assert<T extends true> = T;
37
+
38
+ type ShapeKeys<T> = T extends unknown ? keyof T : never;
39
+
40
+ type _ShapeConformsToJsonSchema = Assert<
41
+ [Exclude<ShapeKeys<Shape>, keyof JSONSchema7>] extends [never] ? true : false
42
+ >;
43
+
44
+ type _ShapeTypesAreTheStandardsLessNull = Assert<
45
+ [Exclude<Exclude<JSONSchema7TypeName, 'null'>, (typeof SHAPE_TYPES)[number]>] extends [never]
46
+ ? true
47
+ : false
48
+ >;
49
+
43
50
  export class Shapes {
44
51
  static is(value: unknown): value is Shape {
45
52
  if (typeof value !== 'object' || value === null) return false;
@@ -55,7 +62,7 @@ export class Shapes {
55
62
  /**
56
63
  * Every `pattern` a shape states, the nested ones included — `items`, `properties`.
57
64
  *
58
- * Two readers ask two questions of the same list: the card door asks whether each one
65
+ * Two readers ask two questions of the same list: the card facade asks whether each one
59
66
  * compiles, `fougere check` whether each one backtracks. Neither owns the walk.
60
67
  */
61
68
  static patterns(shape: unknown): string[] {
@@ -129,14 +136,3 @@ export class Shapes {
129
136
  return base.enum?.length ? 'choice' : 'text';
130
137
  }
131
138
  }
132
-
133
- type Assert<T extends true> = T;
134
- type ShapeKeys<T> = T extends unknown ? keyof T : never;
135
- type _ShapeConformsToJsonSchema = Assert<
136
- [Exclude<ShapeKeys<Shape>, keyof JSONSchema7>] extends [never] ? true : false
137
- >;
138
- type _ShapeTypesAreTheStandardsLessNull = Assert<
139
- [Exclude<Exclude<JSONSchema7TypeName, 'null'>, (typeof SHAPE_TYPES)[number]>] extends [never]
140
- ? true
141
- : false
142
- >;
@@ -0,0 +1,12 @@
1
+ import type { JSONSchema7TypeName } from 'json-schema';
2
+
3
+ /**
4
+ * The standard's own list, less `null` — a shape states that as the `[T,'null']` union —
5
+ * and with `string` in the three forms every projection here tells apart: a `date()`, a
6
+ * bounded set, and everything else. Those three are the whole of what this package adds.
7
+ */
8
+ export type ShapeType =
9
+ | Exclude<JSONSchema7TypeName, 'null' | 'string'>
10
+ | 'text'
11
+ | 'date'
12
+ | 'choice';
@@ -0,0 +1,8 @@
1
+ export type StringFormat =
2
+ | 'date-time'
3
+ | 'date'
4
+ | 'time'
5
+ | 'email'
6
+ | 'uuid'
7
+ | 'uri'
8
+ | (string & {});
@@ -0,0 +1,6 @@
1
+ import type { FieldName } from '../field/FieldName.js';
2
+ import type { Fields } from '../field/Fields.js';
3
+
4
+ // Ex: [['title', 'name'], ['id']]
5
+ export type CompositeUnique<TFields extends Fields> =
6
+ readonly (readonly FieldName<TFields>[])[];
@@ -1,4 +1,4 @@
1
- import type { Fields } from '../field/Field.js';
1
+ import type { Fields } from '../field/Fields.js';
2
2
  import { isObject } from '../lib/utils.js';
3
3
  import type { EntityAdapters } from './EntityAdapters.js';
4
4
 
@@ -1,7 +1,6 @@
1
- import type { FieldName, Fields } from '../field/Field.js';
2
-
3
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-object-type
4
- export interface FougereEntityAdapters<K extends string> {}
1
+ import type { FieldName } from '../field/FieldName.js';
2
+ import type { Fields } from '../field/Fields.js';
3
+ import type { FougereEntityAdapters } from './FougereEntityAdapters.js';
5
4
 
6
5
  export type EntityAdapters<TFields extends Fields> = Readonly<
7
6
  Partial<FougereEntityAdapters<FieldName<TFields>>>
@@ -1,13 +1,7 @@
1
- import type { FieldName, Fields } from '../field/Field.js';
1
+ import type { Fields } from '../field/Fields.js';
2
2
  import type { EntityAdapters } from './EntityAdapters.js';
3
-
4
- // Ex: [['title', 'name'], ['id']]
5
- export type CompositeUnique<TFields extends Fields> =
6
- readonly (readonly FieldName<TFields>[])[];
7
-
8
- export type PreviousNames<TFields extends Fields> = Readonly<
9
- Partial<Record<FieldName<TFields>, string>>
10
- >;
3
+ import type { CompositeUnique } from './CompositeUnique.js';
4
+ import type { PreviousNames } from './PreviousNames.js';
11
5
 
12
6
  export interface EntityDeclarations<TFields extends Fields> {
13
7
  adapters?: EntityAdapters<TFields>;
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-object-type
2
+ export interface FougereEntityAdapters<K extends string> {}
@@ -0,0 +1,6 @@
1
+ import type { FieldName } from '../field/FieldName.js';
2
+ import type { Fields } from '../field/Fields.js';
3
+
4
+ export type PreviousNames<TFields extends Fields> = Readonly<
5
+ Partial<Record<FieldName<TFields>, string>>
6
+ >;
package/src/entity.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { type Fields } from './field/Field.js';
1
+ import { type Fields } from './field/Fields.js';
2
2
  import { type EntityDeclarations } from './entity/EntityDeclarations.js';
3
- import { Schema, type SchemaConstructor } from './Schema.js';
3
+ import { Schema } from './Schema.js';
4
+ import { type SchemaConstructor } from './SchemaConstructor.js';
4
5
 
5
6
  /**
6
7
  * The one call everything derives from: the fields, and what the entity states about them.
@@ -1,16 +1,12 @@
1
1
  import type { Shape } from '../axis/shape/Shape.js';
2
- import type { RoleRules } from '../axis/role/Role.js';
3
- import type { LifecycleRules } from '../axis/lifecycle/Lifecycle.js';
4
- import type { BoundaryRef } from '../axis/boundary/Boundary.js';
2
+ import type { RoleRules } from '../axis/role/RoleRules.js';
3
+ import type { LifecycleRules } from '../axis/lifecycle/LifecycleRules.js';
4
+ import type { BoundaryRef } from '../axis/boundary/BoundaryRef.js';
5
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';
9
- import { dotted } from '../lib/validation.js';
10
-
11
- export type Fields = Record<string, Field>;
12
-
13
- export type FieldName<TFields extends Fields> = Extract<keyof TFields, string>;
9
+ import { dotted } from '../lib/ValidationResult.js';
14
10
 
15
11
  type FieldDeclaration = Pick<Field, 'shape' | Axis['slot'] | 'meta'>;
16
12
 
@@ -0,0 +1,3 @@
1
+ import type { Fields } from './Fields.js';
2
+
3
+ export type FieldName<TFields extends Fields> = Extract<keyof TFields, string>;
@@ -1,6 +1,8 @@
1
1
  import { Role } from '../axis/role/Role.js';
2
- import type { CompositeUnique } from '../entity/EntityDeclarations.js';
3
- import { Field, type FieldName, type Fields } from './Field.js';
2
+ import type { CompositeUnique } from '../entity/CompositeUnique.js';
3
+ import { Field } from './Field.js';
4
+ import { type FieldName } from './FieldName.js';
5
+ import { type Fields } from './Fields.js';
4
6
 
5
7
  export class FieldSet<TFields extends Fields = Fields> {
6
8
  private constructor(private readonly fields: TFields) {}
@@ -0,0 +1,3 @@
1
+ import type { Field } from './Field.js';
2
+
3
+ export type Fields = Record<string, Field>;
package/src/index.ts CHANGED
@@ -2,41 +2,43 @@ export { entity } from './entity.js';
2
2
 
3
3
  export * from './vocabulary/index.js';
4
4
 
5
- export { Schema, ANONYMOUS_SCHEMA_NAME, type SchemaConstructor } from './Schema.js';
5
+ export { ANONYMOUS_SCHEMA_NAME, Schema } from './Schema.js';
6
+ export { type SchemaConstructor } from './SchemaConstructor.js';
6
7
  export { type SchemaView } from './SchemaView.js';
7
- export { Field, type Fields } from './field/Field.js';
8
+ export { Field } from './field/Field.js';
9
+ export { type Fields } from './field/Fields.js';
8
10
  export { FieldSet } from './field/FieldSet.js';
9
- export { type Shape, type ShapeType, Shapes } from './axis/shape/Shape.js';
11
+ export { type Shape } from './axis/shape/Shape.js';
12
+ export { type ShapeType } from './axis/shape/ShapeType.js';
13
+ export { Shapes } from './axis/shape/Shape.js';
10
14
  export { Role } from './axis/role/Role.js';
11
- export { type EntityConstructor } from './axis/role/Relation.js';
15
+ export { type EntityConstructor } from './axis/role/EntityConstructor.js';
12
16
  export { Lifecycle } from './axis/lifecycle/Lifecycle.js';
13
17
  export { Boundary } from './axis/boundary/Boundary.js';
14
18
  export { applyCreate, applyUpdate } from './axis/lifecycle/apply.js';
15
19
  export { InputRefusal } from './validator/InputRefusal.js';
16
- export { dotted, type ValidationError, type ValidationResult } from './lib/validation.js';
20
+ export { type ValidationError } from './lib/ValidationError.js';
21
+ export { dotted, type ValidationResult } from './lib/ValidationResult.js';
17
22
 
18
23
  export { Card } from './projection/card/Card.js';
19
24
  export { Bundle } from './projection/card/Bundle.js';
20
25
  export { Visibility } from './projection/Visibility.js';
21
- export { Cases, type ValidationCase } from './projection/Cases.js';
22
- export type {
23
- SchemaBundle,
24
- SchemaDescriptor,
25
- FieldDescriptor,
26
- } from './projection/card/Descriptor.js';
27
- export type {
28
- Change,
29
- Diff,
30
- SetDiff,
31
- SetDiffOptions,
32
- } from './projection/card/diff.js';
26
+ export { Cases } from './projection/Cases.js';
27
+ export { type ValidationCase } from './projection/ValidationCase.js';
28
+ export type { FieldDescriptor } from './projection/card/FieldDescriptor.js';
29
+ export type { SchemaBundle } from './projection/card/SchemaBundle.js';
30
+ export type { SchemaDescriptor } from './projection/card/SchemaDescriptor.js';
31
+ export type { Change } from './projection/card/Change.js';
32
+ export type { Diff } from './projection/card/Diff.js';
33
+ export type { SetDiff } from './projection/card/SetDiff.js';
34
+ export type { SetDiffOptions } from './projection/card/SetDiffOptions.js';
33
35
 
34
36
  export * from './lib/index.js';
35
37
  export { Formats } from './axis/shape/Formats.js';
36
38
  export { Generators } from './axis/lifecycle/Generators.js';
37
- export { Boundaries } from './axis/boundary/Boundaries.js';
39
+ export { Boundaries } from './axis/boundary/Decoder.js';
38
40
  export { Clock } from './axis/lifecycle/Clock.js';
39
- export { type FougereEntityAdapters } from './entity/EntityAdapters.js';
41
+ export { type FougereEntityAdapters } from './entity/FougereEntityAdapters.js';
40
42
  export { InputValidator } from './validator/InputValidator.js';
41
43
  export { FieldValueValidator } from './validator/FieldValueValidator.js';
42
44
  export { AdapterFieldValidator } from './validator/AdapterFieldValidator.js';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * A field's verdict. `path` is where INSIDE the value the refusal happened — empty when the
3
+ * field itself is refused, `['street']` when the shape below it is.
4
+ */
5
+ export type Checked = { value: unknown } | { error: string; path?: readonly string[] };
@@ -0,0 +1,9 @@
1
+ export interface ValidationError {
2
+ /**
3
+ * Where the refusal happened: the field, then where under it the shape refused.
4
+ * Empty when the input itself is refused. Segments, never a sentence — a field may
5
+ * legally be named `a.b`, and re-parsing a joined path invents a segment it never had.
6
+ */
7
+ path: readonly string[];
8
+ message: string;
9
+ }
@@ -0,0 +1,11 @@
1
+ import type { ValidationError } from './ValidationError.js';
2
+
3
+ export type ValidationResult<T> =
4
+ | { success: true; data: T }
5
+ | { success: false; errors: ValidationError[] };
6
+
7
+ /**
8
+ * A path as a message writes it — `addr.street`. One rendering among others, and the
9
+ * reason the value stays segmented: this one cannot be read back.
10
+ */
11
+ export const dotted = (path: readonly string[]): string => path.join('.');
@@ -6,23 +6,7 @@ import type { Field } from '../field/Field.js';
6
6
  import type { SchemaView } from '../SchemaView.js';
7
7
  import { InputValidator } from '../validator/InputValidator.js';
8
8
  import { InputRefusal } from '../validator/InputRefusal.js';
9
-
10
- /**
11
- * One input, and what the validator must answer.
12
- *
13
- * `expect` carries the PATH of the field at fault and never the message. We know which
14
- * field must be refused because we are the ones who broke it; naming the message would
15
- * make this list a second validator, and the two would then have to be kept in step by hand —
16
- * which is the duplication the whole thing exists to remove.
17
- */
18
- export interface ValidationCase {
19
- /** What this input does, in one clause — carried into the assertion so a failure reads. */
20
- why: string;
21
- input: unknown;
22
- /** Judged as an update rather than a creation. */
23
- patch: boolean;
24
- expect: 'accept' | { reject: string };
25
- }
9
+ import type { ValidationCase } from './ValidationCase.js';
26
10
 
27
11
  /**
28
12
  * A value of the wrong type, so every field yields at least one case whatever it declares.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * One input, and what the validator must answer.
3
+ *
4
+ * `expect` carries the PATH of the field at fault and never the message. We know which
5
+ * field must be refused because we are the ones who broke it; naming the message would
6
+ * make this list a second validator, and the two would then have to be kept in step by hand —
7
+ * which is the duplication the whole thing exists to remove.
8
+ */
9
+ export interface ValidationCase {
10
+ /** What this input does, in one clause — carried into the assertion so a failure reads. */
11
+ why: string;
12
+ input: unknown;
13
+ /** Judged as an update rather than a creation. */
14
+ patch: boolean;
15
+ expect: 'accept' | { reject: string };
16
+ }
@@ -1,7 +1,7 @@
1
1
  import { Boundary } from '../axis/boundary/Boundary.js';
2
2
  import { Lifecycle } from '../axis/lifecycle/Lifecycle.js';
3
3
  import { Role } from '../axis/role/Role.js';
4
- import type { Fields } from '../field/Field.js';
4
+ import type { Fields } from '../field/Fields.js';
5
5
 
6
6
  export class Visibility {
7
7
  private constructor(private readonly fields: Fields) {}
@@ -1,10 +1,13 @@
1
- import type { Resolver } from '../../axis/Axis.js';
2
- import type { EntityConstructor } from '../../axis/role/Relation.js';
1
+ import type { Resolver } from '../../axis/Resolver.js';
2
+ import type { EntityConstructor } from '../../axis/role/EntityConstructor.js';
3
3
  import { lowerFirst } from '../../lib/utils.js';
4
4
  import type { SchemaView } from '../../SchemaView.js';
5
5
  import { Card } from './Card.js';
6
- import type { SchemaBundle, SchemaDescriptor } from './Descriptor.js';
7
- import type { Diff, SetDiff, SetDiffOptions } from './diff.js';
6
+ import type { SchemaBundle } from './SchemaBundle.js';
7
+ import type { SchemaDescriptor } from './SchemaDescriptor.js';
8
+ import type { Diff } from './Diff.js';
9
+ import type { SetDiff } from './SetDiff.js';
10
+ import type { SetDiffOptions } from './SetDiffOptions.js';
8
11
 
9
12
  type SchemaSet = Record<string, SchemaView> | SchemaView[];
10
13
 
@@ -1,18 +1,21 @@
1
- import { EXTENSION_AXES, type Resolver } from '../../axis/Axis.js';
1
+ import { EXTENSION_AXES } from '../../axis/Axis.js';
2
+ import { type Resolver } from '../../axis/Resolver.js';
2
3
  import { clean, isObject } from '../../lib/utils.js';
3
- import { Field, type Fields } from '../../field/Field.js';
4
- import { SchemaConstraints } from '../../SchemaDefinition.js';
4
+ import { Field } from '../../field/Field.js';
5
+ import { type Fields } from '../../field/Fields.js';
6
+ import { SchemaConstraints } from '../../SchemaConstraints.js';
5
7
  import { InputValidator } from '../../validator/InputValidator.js';
6
- import { Schema, type SchemaConstructor } from '../../Schema.js';
7
- import type { Values, SchemaView } from '../../SchemaView.js';
8
+ import { Schema } from '../../Schema.js';
9
+ import { type SchemaConstructor } from '../../SchemaConstructor.js';
10
+ import type { SchemaView } from '../../SchemaView.js';
11
+ import type { Values } from '../../Values.js';
8
12
  import { admitPatterns, refuse } from './admission.js';
9
- import type {
10
- DerivedFrom,
11
- FieldDescriptor,
12
- FieldExtension,
13
- SchemaDescriptor,
14
- } from './Descriptor.js';
15
- import { compare, type Diff, type DiffOptions } from './diff.js';
13
+ import type { DerivedFrom } from './DerivedFrom.js';
14
+ import type { FieldDescriptor } from './FieldDescriptor.js';
15
+ import type { FieldExtension } from './FieldExtension.js';
16
+ import type { SchemaDescriptor } from './SchemaDescriptor.js';
17
+ import { compare, type Diff } from './Diff.js';
18
+ import { type DiffOptions } from './DiffOptions.js';
16
19
 
17
20
  type FieldsOf<T> = { [K in keyof T]-?: Field<T[K]> };
18
21
 
@@ -74,7 +77,7 @@ export class Card<T = Values<Fields>> {
74
77
  const descriptor = this.descriptor;
75
78
  const subject = name ? `schema '${name}'` : 'this schema';
76
79
  if (!isObject(descriptor))
77
- refuse(`${subject} is not an object`, 'A card carries one JSON Schema per door.');
80
+ refuse(`${subject} is not an object`, 'A card carries one JSON Schema per facade.');
78
81
  const version = descriptor['x-fougere-version'];
79
82
  if (version !== 1) {
80
83
  refuse(
@@ -0,0 +1,24 @@
1
+ import type { BoundaryRef } from '../../axis/boundary/BoundaryRef.js';
2
+ import type { LifecycleRules } from '../../axis/lifecycle/LifecycleRules.js';
3
+ import type { FieldDescriptor } from './FieldDescriptor.js';
4
+ import type { RoleDescriptor } from './RoleDescriptor.js';
5
+ import type { TypeSet } from './TypeSet.js';
6
+
7
+ /** One named difference, at one place. Each kind exists because a reader asks for it. */
8
+ export type Change =
9
+ /** DDL: add the column. Codec: the old caller never sends it. Boot: refuse when required. */
10
+ | { kind: 'added'; field: string; to: FieldDescriptor; required: boolean }
11
+ /** DDL: drop the column. Codec: the old caller still sends it, and it goes nowhere. */
12
+ | { kind: 'removed'; field: string; from: FieldDescriptor; required: boolean }
13
+ /** DDL: rename the column. Codec and storage: one more entry in the field-to-column map. */
14
+ | { kind: 'renamed'; from: string; to: string; field: FieldDescriptor }
15
+ /** DDL: alter the type. Codec: convert the value, when it can. */
16
+ | { kind: 'retyped'; field: string; from: TypeSet; to: TypeSet }
17
+ /** Same type, different bounds: a CHECK moves, and a value legal yesterday may not be. */
18
+ | { kind: 'reshaped'; field: string; from: FieldDescriptor; to: FieldDescriptor }
19
+ /** NOT NULL in either direction. Boot: an old writer cannot fill what it never knew. */
20
+ | { kind: 'required'; field: string; from: boolean; to: boolean }
21
+ /** An axis other than shape was restated. */
22
+ | { kind: 'restated'; field: string; axis: 'role'; from?: RoleDescriptor; to?: RoleDescriptor }
23
+ | { kind: 'restated'; field: string; axis: 'lifecycle'; from?: LifecycleRules; to?: LifecycleRules }
24
+ | { kind: 'restated'; field: string; axis: 'boundary'; from?: BoundaryRef; to?: BoundaryRef };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * What a derivation was cut from, and what the cut left — `nameOf` keyed by the
3
+ * ORIGIN's field names. Absent on a declaration that derives from nothing.
4
+ *
5
+ * A dropped field is `null` and never `undefined`: JSON.stringify erases the second,
6
+ * which would leave the card saying only what remains — what `properties` already says.
7
+ */
8
+ export interface DerivedFrom {
9
+ from: string;
10
+ nameOf: Record<string, string | null>;
11
+ }
@@ -1,36 +1,13 @@
1
- import type { BoundaryRef } from '../../axis/boundary/Boundary.js';
2
- import type { LifecycleRules } from '../../axis/lifecycle/Lifecycle.js';
3
1
  import { dequal } from 'dequal';
4
2
  import { EXTENSION_SLOTS } from '../../axis/Axis.js';
5
- import type { FieldDescriptor, FieldExtension, RoleDescriptor, SchemaDescriptor } from './Descriptor.js';
3
+ import type { FieldDescriptor } from './FieldDescriptor.js';
4
+ import type { FieldExtension } from './FieldExtension.js';
6
5
 
7
- /** One named difference, at one place. Each kind exists because a reader asks for it. */
8
- export type Change =
9
- /** DDL: add the column. Codec: the old caller never sends it. Boot: refuse when required. */
10
- | { kind: 'added'; field: string; to: FieldDescriptor; required: boolean }
11
- /** DDL: drop the column. Codec: the old caller still sends it, and it goes nowhere. */
12
- | { kind: 'removed'; field: string; from: FieldDescriptor; required: boolean }
13
- /** DDL: rename the column. Codec and storage: one more entry in the field-to-column map. */
14
- | { kind: 'renamed'; from: string; to: string; field: FieldDescriptor }
15
- /** DDL: alter the type. Codec: convert the value, when it can. */
16
- | { kind: 'retyped'; field: string; from: TypeSet; to: TypeSet }
17
- /** Same type, different bounds: a CHECK moves, and a value legal yesterday may not be. */
18
- | { kind: 'reshaped'; field: string; from: FieldDescriptor; to: FieldDescriptor }
19
- /** NOT NULL in either direction. Boot: an old writer cannot fill what it never knew. */
20
- | { kind: 'required'; field: string; from: boolean; to: boolean }
21
- /** An axis other than shape was restated. */
22
- | { kind: 'restated'; field: string; axis: 'role'; from?: RoleDescriptor; to?: RoleDescriptor }
23
- | { kind: 'restated'; field: string; axis: 'lifecycle'; from?: LifecycleRules; to?: LifecycleRules }
24
- | { kind: 'restated'; field: string; axis: 'boundary'; from?: BoundaryRef; to?: BoundaryRef };
25
-
26
- /** A field's declared types, always represented as a set. */
27
- export type TypeSet = string[];
28
-
29
- /** A removal and an addition that could be one rename: same shape, different name. */
30
- export interface RenameCandidate {
31
- removed: string;
32
- added: string;
33
- }
6
+ import type { SchemaDescriptor } from './SchemaDescriptor.js';
7
+ import type { Change } from './Change.js';
8
+ import type { TypeSet } from './TypeSet.js';
9
+ import type { RenameCandidate } from './RenameCandidate.js';
10
+ import type { DiffOptions } from './DiffOptions.js';
34
11
 
35
12
  export interface Diff {
36
13
  changes: Change[];
@@ -38,25 +15,6 @@ export interface Diff {
38
15
  ambiguous: RenameCandidate[];
39
16
  }
40
17
 
41
- export interface DiffOptions {
42
- /** Renames as declared at the time: old name to new name. */
43
- renamed?: Record<string, string>;
44
- }
45
-
46
- export interface SetDiff {
47
- /** Entities the target bundle has and the source bundle had not. */
48
- entitiesAdded: string[];
49
- /** Entities the source bundle had and the target bundle has not. */
50
- entitiesRemoved: string[];
51
- /** Differences for entities present in both bundles; unchanged entities are absent. */
52
- entities: Record<string, Diff>;
53
- }
54
-
55
- export interface SetDiffOptions {
56
- /** Declared renames, per entity: `{ post: { body: 'content' } }`. */
57
- renamed?: Record<string, Record<string, string>>;
58
- }
59
-
60
18
  /**
61
19
  * What changed between two descriptions of the same entity, read from the wire form alone.
62
20
  * FR : ce qui a changé entre deux descriptions d'une même entité, lu du seul format du fil.
@@ -0,0 +1,4 @@
1
+ export interface DiffOptions {
2
+ /** Renames as declared at the time: old name to new name. */
3
+ renamed?: Record<string, string>;
4
+ }
@@ -0,0 +1,11 @@
1
+ import type { ShapeKeywords } from './ShapeKeywords.js';
2
+ import type { JSONSchema7TypeName } from 'json-schema';
3
+ import type { FieldExtension } from './FieldExtension.js';
4
+
5
+ export type FieldDescriptor = ShapeKeywords & {
6
+ type?: JSONSchema7TypeName | JSONSchema7TypeName[];
7
+ items?: FieldDescriptor;
8
+ properties?: Record<string, FieldDescriptor>;
9
+ description?: string;
10
+ 'x-fougere'?: FieldExtension;
11
+ };
@@ -0,0 +1,9 @@
1
+ import type { BoundaryRef } from '../../axis/boundary/BoundaryRef.js';
2
+ import type { LifecycleRules } from '../../axis/lifecycle/LifecycleRules.js';
3
+ import type { RoleDescriptor } from './RoleDescriptor.js';
4
+
5
+ export interface FieldExtension {
6
+ role?: RoleDescriptor;
7
+ lifecycle?: LifecycleRules;
8
+ boundary?: BoundaryRef;
9
+ }
@@ -0,0 +1,3 @@
1
+ import type { Relation } from '../../axis/role/Relation.js';
2
+
3
+ export type RelationDescriptor = Pick<Relation, 'kind' | 'onDelete'> & { to: string };
@@ -0,0 +1,5 @@
1
+ /** A removal and an addition that could be one rename: same shape, different name. */
2
+ export interface RenameCandidate {
3
+ removed: string;
4
+ added: string;
5
+ }
@@ -0,0 +1,7 @@
1
+ import type { RoleRules } from '../../axis/role/RoleRules.js';
2
+ import type { RelationDescriptor } from './RelationDescriptor.js';
3
+
4
+ export type RoleDescriptor = Pick<RoleRules, 'primary' | 'index'> & {
5
+ unique?: string[][];
6
+ relation?: RelationDescriptor;
7
+ };
@@ -0,0 +1,7 @@
1
+ import type { SchemaDescriptor } from './SchemaDescriptor.js';
2
+
3
+ export interface SchemaBundle {
4
+ $defs: Record<string, SchemaDescriptor>;
5
+ 'x-fougere-version': 1;
6
+ 'x-fougere-vendor': 'fougere';
7
+ }
@@ -0,0 +1,12 @@
1
+ import type { FieldDescriptor } from './FieldDescriptor.js';
2
+ import type { DerivedFrom } from './DerivedFrom.js';
3
+
4
+ export interface SchemaDescriptor {
5
+ title?: string;
6
+ type: 'object';
7
+ properties: Record<string, FieldDescriptor>;
8
+ required?: string[];
9
+ 'x-fougere-derived'?: DerivedFrom;
10
+ 'x-fougere-version': 1;
11
+ 'x-fougere-vendor': 'fougere';
12
+ }
@@ -0,0 +1,10 @@
1
+ import type { Diff } from './Diff.js';
2
+
3
+ export interface SetDiff {
4
+ /** Entities the target bundle has and the source bundle had not. */
5
+ entitiesAdded: string[];
6
+ /** Entities the source bundle had and the target bundle has not. */
7
+ entitiesRemoved: string[];
8
+ /** Differences for entities present in both bundles; unchanged entities are absent. */
9
+ entities: Record<string, Diff>;
10
+ }
@@ -0,0 +1,4 @@
1
+ export interface SetDiffOptions {
2
+ /** Declared renames, per entity: `{ post: { body: 'content' } }`. */
3
+ renamed?: Record<string, Record<string, string>>;
4
+ }
@@ -0,0 +1,7 @@
1
+ import type { Shape } from '../../axis/shape/Shape.js';
2
+
3
+ type KeywordsOf<S> = S extends unknown ? Partial<Omit<S, 'type' | 'items' | 'properties'>> : never;
4
+ type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
5
+
6
+ /** Every keyword any shape may carry, flattened — what a descriptor records of one. */
7
+ export type ShapeKeywords = UnionToIntersection<KeywordsOf<Shape>>;