@fougere/schema 0.6.0-alpha.0 → 0.8.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 (435) hide show
  1. package/README.md +5 -4
  2. package/dist/{schema/Schema.d.ts → Schema.d.ts} +17 -27
  3. package/dist/Schema.d.ts.map +1 -0
  4. package/dist/{schema/Schema.js → Schema.js} +22 -62
  5. package/dist/Schema.js.map +1 -0
  6. package/dist/SchemaDefinition.d.ts +73 -0
  7. package/dist/SchemaDefinition.d.ts.map +1 -0
  8. package/dist/SchemaDefinition.js +184 -0
  9. package/dist/SchemaDefinition.js.map +1 -0
  10. package/dist/SchemaDerivation.d.ts +16 -0
  11. package/dist/SchemaDerivation.d.ts.map +1 -0
  12. package/dist/SchemaDerivation.js +31 -0
  13. package/dist/SchemaDerivation.js.map +1 -0
  14. package/dist/{schema/SchemaView.d.ts → SchemaView.d.ts} +9 -9
  15. package/dist/SchemaView.d.ts.map +1 -0
  16. package/dist/{schema/SchemaView.js.map → SchemaView.js.map} +1 -1
  17. package/dist/{schema/axis → axis}/Axis.d.ts +2 -2
  18. package/dist/axis/Axis.d.ts.map +1 -0
  19. package/dist/axis/Axis.js.map +1 -0
  20. package/dist/axis/Meta.d.ts.map +1 -0
  21. package/dist/{schema/axis → axis}/Meta.js.map +1 -1
  22. package/dist/axis/boundary/Boundaries.d.ts +21 -0
  23. package/dist/axis/boundary/Boundaries.d.ts.map +1 -0
  24. package/dist/axis/boundary/Boundaries.js +25 -0
  25. package/dist/axis/boundary/Boundaries.js.map +1 -0
  26. package/dist/{schema/axis → axis}/boundary/Boundary.d.ts +3 -1
  27. package/dist/axis/boundary/Boundary.d.ts.map +1 -0
  28. package/dist/{schema/axis → axis}/boundary/Boundary.js +8 -6
  29. package/dist/axis/boundary/Boundary.js.map +1 -0
  30. package/dist/axis/boundary/BoundaryAxis.d.ts.map +1 -0
  31. package/dist/{schema/axis → axis}/boundary/BoundaryAxis.js +4 -4
  32. package/dist/axis/boundary/BoundaryAxis.js.map +1 -0
  33. package/dist/{schema/axis → axis}/lifecycle/Clock.d.ts +1 -1
  34. package/dist/axis/lifecycle/Clock.d.ts.map +1 -0
  35. package/dist/{schema/axis → axis}/lifecycle/Clock.js +1 -1
  36. package/dist/axis/lifecycle/Clock.js.map +1 -0
  37. package/dist/axis/lifecycle/Generators.d.ts +10 -0
  38. package/dist/axis/lifecycle/Generators.d.ts.map +1 -0
  39. package/dist/axis/lifecycle/Generators.js +20 -0
  40. package/dist/axis/lifecycle/Generators.js.map +1 -0
  41. package/dist/axis/lifecycle/Lifecycle.d.ts.map +1 -0
  42. package/dist/axis/lifecycle/Lifecycle.js.map +1 -0
  43. package/dist/axis/lifecycle/LifecycleAxis.d.ts.map +1 -0
  44. package/dist/{schema/axis → axis}/lifecycle/LifecycleAxis.js +11 -6
  45. package/dist/axis/lifecycle/LifecycleAxis.js.map +1 -0
  46. package/dist/axis/lifecycle/apply.d.ts +15 -0
  47. package/dist/axis/lifecycle/apply.d.ts.map +1 -0
  48. package/dist/axis/lifecycle/apply.js +50 -0
  49. package/dist/axis/lifecycle/apply.js.map +1 -0
  50. package/dist/{schema/axis → axis}/role/Relation.d.ts +3 -2
  51. package/dist/axis/role/Relation.d.ts.map +1 -0
  52. package/dist/{schema/axis → axis}/role/Relation.js +6 -5
  53. package/dist/axis/role/Relation.js.map +1 -0
  54. package/dist/{schema/axis → axis}/role/Role.d.ts +6 -6
  55. package/dist/axis/role/Role.d.ts.map +1 -0
  56. package/dist/axis/role/Role.js +36 -0
  57. package/dist/axis/role/Role.js.map +1 -0
  58. package/dist/{schema/axis → axis}/role/RoleAxis.d.ts +1 -1
  59. package/dist/axis/role/RoleAxis.d.ts.map +1 -0
  60. package/dist/{schema/axis → axis}/role/RoleAxis.js +28 -36
  61. package/dist/axis/role/RoleAxis.js.map +1 -0
  62. package/dist/axis/shape/Formats.d.ts +11 -0
  63. package/dist/axis/shape/Formats.d.ts.map +1 -0
  64. package/dist/axis/shape/Formats.js +9 -0
  65. package/dist/axis/shape/Formats.js.map +1 -0
  66. package/dist/{schema/axis → axis}/shape/Shape.d.ts +12 -3
  67. package/dist/axis/shape/Shape.d.ts.map +1 -0
  68. package/dist/axis/shape/Shape.js +77 -0
  69. package/dist/axis/shape/Shape.js.map +1 -0
  70. package/dist/entity/EntityAdapterSet.d.ts +22 -0
  71. package/dist/entity/EntityAdapterSet.d.ts.map +1 -0
  72. package/dist/entity/EntityAdapterSet.js +63 -0
  73. package/dist/entity/EntityAdapterSet.js.map +1 -0
  74. package/dist/entity/EntityAdapters.d.ts +1 -24
  75. package/dist/entity/EntityAdapters.d.ts.map +1 -1
  76. package/dist/entity/EntityAdapters.js +1 -74
  77. package/dist/entity/EntityAdapters.js.map +1 -1
  78. package/dist/entity/EntityDeclarations.d.ts +1 -1
  79. package/dist/entity/EntityDeclarations.d.ts.map +1 -1
  80. package/dist/entity.d.ts +7 -2
  81. package/dist/entity.d.ts.map +1 -1
  82. package/dist/entity.js +6 -1
  83. package/dist/entity.js.map +1 -1
  84. package/dist/{schema/fields → field}/Field.d.ts +3 -5
  85. package/dist/field/Field.d.ts.map +1 -0
  86. package/dist/field/Field.js +35 -0
  87. package/dist/field/Field.js.map +1 -0
  88. package/dist/field/FieldSet.d.ts +22 -0
  89. package/dist/field/FieldSet.d.ts.map +1 -0
  90. package/dist/field/FieldSet.js +58 -0
  91. package/dist/field/FieldSet.js.map +1 -0
  92. package/dist/index.d.ts +26 -56
  93. package/dist/index.d.ts.map +1 -1
  94. package/dist/index.js +21 -47
  95. package/dist/index.js.map +1 -1
  96. package/dist/lib/Registry.d.ts +12 -0
  97. package/dist/lib/Registry.d.ts.map +1 -0
  98. package/dist/lib/Registry.js +29 -0
  99. package/dist/lib/Registry.js.map +1 -0
  100. package/dist/lib/index.d.ts +3 -0
  101. package/dist/lib/index.d.ts.map +1 -0
  102. package/dist/lib/index.js +3 -0
  103. package/dist/lib/index.js.map +1 -0
  104. package/dist/lib/utils.d.ts.map +1 -0
  105. package/dist/lib/utils.js.map +1 -0
  106. package/dist/projection/Cases.d.ts +9 -20
  107. package/dist/projection/Cases.d.ts.map +1 -1
  108. package/dist/projection/Cases.js +44 -39
  109. package/dist/projection/Cases.js.map +1 -1
  110. package/dist/projection/Visibility.d.ts +2 -1
  111. package/dist/projection/Visibility.d.ts.map +1 -1
  112. package/dist/projection/Visibility.js +4 -3
  113. package/dist/projection/Visibility.js.map +1 -1
  114. package/dist/projection/card/Bundle.d.ts +1 -1
  115. package/dist/projection/card/Bundle.d.ts.map +1 -1
  116. package/dist/projection/card/Bundle.js +7 -7
  117. package/dist/projection/card/Bundle.js.map +1 -1
  118. package/dist/projection/card/Card.d.ts +7 -13
  119. package/dist/projection/card/Card.d.ts.map +1 -1
  120. package/dist/projection/card/Card.js +101 -70
  121. package/dist/projection/card/Card.js.map +1 -1
  122. package/dist/projection/card/Descriptor.d.ts +7 -7
  123. package/dist/projection/card/Descriptor.d.ts.map +1 -1
  124. package/dist/projection/card/admission.d.ts +21 -5
  125. package/dist/projection/card/admission.d.ts.map +1 -1
  126. package/dist/projection/card/admission.js +33 -5
  127. package/dist/projection/card/admission.js.map +1 -1
  128. package/dist/projection/card/diff.d.ts +2 -2
  129. package/dist/projection/card/diff.d.ts.map +1 -1
  130. package/dist/{judge/result.d.ts → validation.d.ts} +1 -1
  131. package/dist/validation.d.ts.map +1 -0
  132. package/dist/validation.js +2 -0
  133. package/dist/validation.js.map +1 -0
  134. package/dist/validator/AdapterFieldValidator.d.ts +14 -0
  135. package/dist/validator/AdapterFieldValidator.d.ts.map +1 -0
  136. package/dist/validator/AdapterFieldValidator.js +36 -0
  137. package/dist/validator/AdapterFieldValidator.js.map +1 -0
  138. package/dist/validator/FieldDeclarationValidator.d.ts +9 -0
  139. package/dist/validator/FieldDeclarationValidator.d.ts.map +1 -0
  140. package/dist/{judge/FieldJudge.js → validator/FieldDeclarationValidator.js} +8 -8
  141. package/dist/validator/FieldDeclarationValidator.js.map +1 -0
  142. package/dist/validator/FieldValueValidator.d.ts +13 -0
  143. package/dist/validator/FieldValueValidator.d.ts.map +1 -0
  144. package/dist/{judge/ValueJudge.js → validator/FieldValueValidator.js} +12 -11
  145. package/dist/validator/FieldValueValidator.js.map +1 -0
  146. package/dist/validator/InputRefusal.d.ts +8 -0
  147. package/dist/validator/InputRefusal.d.ts.map +1 -0
  148. package/dist/validator/InputRefusal.js +8 -0
  149. package/dist/validator/InputRefusal.js.map +1 -0
  150. package/dist/validator/InputValidator.d.ts +15 -0
  151. package/dist/validator/InputValidator.d.ts.map +1 -0
  152. package/dist/{judge/RowJudge.js → validator/InputValidator.js} +25 -21
  153. package/dist/validator/InputValidator.js.map +1 -0
  154. package/dist/vocabulary/bool.d.ts +6 -1
  155. package/dist/vocabulary/bool.d.ts.map +1 -1
  156. package/dist/vocabulary/bool.js +6 -1
  157. package/dist/vocabulary/bool.js.map +1 -1
  158. package/dist/vocabulary/created.d.ts +6 -1
  159. package/dist/vocabulary/created.d.ts.map +1 -1
  160. package/dist/vocabulary/created.js +5 -0
  161. package/dist/vocabulary/created.js.map +1 -1
  162. package/dist/vocabulary/date.d.ts +6 -1
  163. package/dist/vocabulary/date.d.ts.map +1 -1
  164. package/dist/vocabulary/date.js +6 -1
  165. package/dist/vocabulary/date.js.map +1 -1
  166. package/dist/vocabulary/email.d.ts +6 -1
  167. package/dist/vocabulary/email.d.ts.map +1 -1
  168. package/dist/vocabulary/email.js +5 -0
  169. package/dist/vocabulary/email.js.map +1 -1
  170. package/dist/vocabulary/immutable.d.ts +6 -1
  171. package/dist/vocabulary/immutable.d.ts.map +1 -1
  172. package/dist/vocabulary/immutable.js +5 -0
  173. package/dist/vocabulary/immutable.js.map +1 -1
  174. package/dist/vocabulary/index.d.ts +23 -0
  175. package/dist/vocabulary/index.d.ts.map +1 -0
  176. package/dist/vocabulary/index.js +23 -0
  177. package/dist/vocabulary/index.js.map +1 -0
  178. package/dist/vocabulary/indexed.d.ts +6 -1
  179. package/dist/vocabulary/indexed.d.ts.map +1 -1
  180. package/dist/vocabulary/indexed.js +5 -0
  181. package/dist/vocabulary/indexed.js.map +1 -1
  182. package/dist/vocabulary/json.d.ts +2 -2
  183. package/dist/vocabulary/json.d.ts.map +1 -1
  184. package/dist/vocabulary/json.js +9 -4
  185. package/dist/vocabulary/json.js.map +1 -1
  186. package/dist/vocabulary/list.d.ts +6 -1
  187. package/dist/vocabulary/list.d.ts.map +1 -1
  188. package/dist/vocabulary/list.js +6 -1
  189. package/dist/vocabulary/list.js.map +1 -1
  190. package/dist/vocabulary/many.d.ts +7 -2
  191. package/dist/vocabulary/many.d.ts.map +1 -1
  192. package/dist/vocabulary/many.js +7 -2
  193. package/dist/vocabulary/many.js.map +1 -1
  194. package/dist/vocabulary/nullable.d.ts +6 -1
  195. package/dist/vocabulary/nullable.d.ts.map +1 -1
  196. package/dist/vocabulary/nullable.js +7 -2
  197. package/dist/vocabulary/nullable.js.map +1 -1
  198. package/dist/vocabulary/number.d.ts +6 -1
  199. package/dist/vocabulary/number.d.ts.map +1 -1
  200. package/dist/vocabulary/number.js +6 -1
  201. package/dist/vocabulary/number.js.map +1 -1
  202. package/dist/vocabulary/oneOf.d.ts +1 -1
  203. package/dist/vocabulary/oneOf.d.ts.map +1 -1
  204. package/dist/vocabulary/oneOf.js +6 -1
  205. package/dist/vocabulary/oneOf.js.map +1 -1
  206. package/dist/vocabulary/optional.d.ts +6 -1
  207. package/dist/vocabulary/optional.d.ts.map +1 -1
  208. package/dist/vocabulary/optional.js +7 -2
  209. package/dist/vocabulary/optional.js.map +1 -1
  210. package/dist/vocabulary/primary.d.ts +2 -2
  211. package/dist/vocabulary/primary.d.ts.map +1 -1
  212. package/dist/vocabulary/primary.js +7 -2
  213. package/dist/vocabulary/primary.js.map +1 -1
  214. package/dist/vocabulary/readOnly.d.ts +6 -1
  215. package/dist/vocabulary/readOnly.d.ts.map +1 -1
  216. package/dist/vocabulary/readOnly.js +6 -1
  217. package/dist/vocabulary/readOnly.js.map +1 -1
  218. package/dist/vocabulary/ref.d.ts +7 -2
  219. package/dist/vocabulary/ref.d.ts.map +1 -1
  220. package/dist/vocabulary/ref.js +7 -2
  221. package/dist/vocabulary/ref.js.map +1 -1
  222. package/dist/vocabulary/text.d.ts +7 -2
  223. package/dist/vocabulary/text.d.ts.map +1 -1
  224. package/dist/vocabulary/text.js +6 -1
  225. package/dist/vocabulary/text.js.map +1 -1
  226. package/dist/vocabulary/unique.d.ts +6 -1
  227. package/dist/vocabulary/unique.d.ts.map +1 -1
  228. package/dist/vocabulary/unique.js +7 -3
  229. package/dist/vocabulary/unique.js.map +1 -1
  230. package/dist/vocabulary/updated.d.ts +6 -1
  231. package/dist/vocabulary/updated.d.ts.map +1 -1
  232. package/dist/vocabulary/updated.js +5 -0
  233. package/dist/vocabulary/updated.js.map +1 -1
  234. package/dist/vocabulary/url.d.ts +6 -1
  235. package/dist/vocabulary/url.d.ts.map +1 -1
  236. package/dist/vocabulary/url.js +5 -0
  237. package/dist/vocabulary/url.js.map +1 -1
  238. package/dist/vocabulary/vocabulary.d.ts +6 -1
  239. package/dist/vocabulary/vocabulary.d.ts.map +1 -1
  240. package/dist/vocabulary/vocabulary.js +22 -12
  241. package/dist/vocabulary/vocabulary.js.map +1 -1
  242. package/dist/vocabulary/writeOnly.d.ts +6 -1
  243. package/dist/vocabulary/writeOnly.d.ts.map +1 -1
  244. package/dist/vocabulary/writeOnly.js +6 -1
  245. package/dist/vocabulary/writeOnly.js.map +1 -1
  246. package/package.json +1 -1
  247. package/src/{schema/Schema.ts → Schema.ts} +32 -75
  248. package/src/SchemaDefinition.ts +257 -0
  249. package/src/SchemaDerivation.ts +44 -0
  250. package/src/{schema/SchemaView.ts → SchemaView.ts} +9 -9
  251. package/src/{schema/axis → axis}/Axis.ts +2 -2
  252. package/src/axis/boundary/Boundaries.ts +37 -0
  253. package/src/{schema/axis → axis}/boundary/Boundary.ts +9 -7
  254. package/src/{schema/axis → axis}/boundary/BoundaryAxis.ts +4 -4
  255. package/src/{schema/axis → axis}/lifecycle/Clock.ts +1 -1
  256. package/src/axis/lifecycle/Generators.ts +29 -0
  257. package/src/{schema/axis → axis}/lifecycle/LifecycleAxis.ts +12 -7
  258. package/src/axis/lifecycle/apply.ts +53 -0
  259. package/src/{schema/axis → axis}/role/Relation.ts +6 -5
  260. package/src/axis/role/Role.ts +52 -0
  261. package/src/{schema/axis → axis}/role/RoleAxis.ts +28 -40
  262. package/src/axis/shape/Formats.ts +20 -0
  263. package/src/{schema/axis → axis}/shape/Shape.ts +45 -18
  264. package/src/entity/EntityAdapterSet.ts +81 -0
  265. package/src/entity/EntityAdapters.ts +4 -96
  266. package/src/entity/EntityDeclarations.ts +1 -1
  267. package/src/entity.ts +7 -2
  268. package/src/{schema/fields → field}/Field.ts +8 -28
  269. package/src/field/FieldSet.ts +75 -0
  270. package/src/index.ts +34 -91
  271. package/src/lib/Registry.ts +37 -0
  272. package/src/lib/index.ts +2 -0
  273. package/src/projection/Cases.ts +56 -55
  274. package/src/projection/Visibility.ts +5 -4
  275. package/src/projection/card/Bundle.ts +9 -9
  276. package/src/projection/card/Card.ts +109 -75
  277. package/src/projection/card/Descriptor.ts +7 -7
  278. package/src/projection/card/admission.ts +37 -6
  279. package/src/projection/card/diff.ts +2 -2
  280. package/src/validator/AdapterFieldValidator.ts +40 -0
  281. package/src/{judge/FieldJudge.ts → validator/FieldDeclarationValidator.ts} +10 -10
  282. package/src/{judge/ValueJudge.ts → validator/FieldValueValidator.ts} +14 -13
  283. package/src/validator/InputRefusal.ts +7 -0
  284. package/src/{judge/RowJudge.ts → validator/InputValidator.ts} +31 -24
  285. package/src/vocabulary/bool.ts +6 -1
  286. package/src/vocabulary/created.ts +6 -1
  287. package/src/vocabulary/date.ts +6 -1
  288. package/src/vocabulary/email.ts +6 -1
  289. package/src/vocabulary/immutable.ts +6 -1
  290. package/src/vocabulary/index.ts +22 -0
  291. package/src/vocabulary/indexed.ts +6 -1
  292. package/src/vocabulary/json.ts +10 -5
  293. package/src/vocabulary/list.ts +6 -1
  294. package/src/vocabulary/many.ts +7 -2
  295. package/src/vocabulary/nullable.ts +8 -3
  296. package/src/vocabulary/number.ts +6 -1
  297. package/src/vocabulary/oneOf.ts +6 -1
  298. package/src/vocabulary/optional.ts +8 -3
  299. package/src/vocabulary/primary.ts +7 -2
  300. package/src/vocabulary/readOnly.ts +7 -2
  301. package/src/vocabulary/ref.ts +7 -2
  302. package/src/vocabulary/text.ts +7 -2
  303. package/src/vocabulary/unique.ts +8 -4
  304. package/src/vocabulary/updated.ts +6 -1
  305. package/src/vocabulary/url.ts +6 -1
  306. package/src/vocabulary/vocabulary.ts +22 -12
  307. package/src/vocabulary/writeOnly.ts +7 -2
  308. package/dist/judge/FieldJudge.d.ts +0 -9
  309. package/dist/judge/FieldJudge.d.ts.map +0 -1
  310. package/dist/judge/FieldJudge.js.map +0 -1
  311. package/dist/judge/RowJudge.d.ts +0 -12
  312. package/dist/judge/RowJudge.d.ts.map +0 -1
  313. package/dist/judge/RowJudge.js.map +0 -1
  314. package/dist/judge/RowRefusal.d.ts +0 -17
  315. package/dist/judge/RowRefusal.d.ts.map +0 -1
  316. package/dist/judge/RowRefusal.js +0 -16
  317. package/dist/judge/RowRefusal.js.map +0 -1
  318. package/dist/judge/ValueJudge.d.ts +0 -12
  319. package/dist/judge/ValueJudge.d.ts.map +0 -1
  320. package/dist/judge/ValueJudge.js.map +0 -1
  321. package/dist/judge/options.d.ts +0 -4
  322. package/dist/judge/options.d.ts.map +0 -1
  323. package/dist/judge/options.js +0 -2
  324. package/dist/judge/options.js.map +0 -1
  325. package/dist/judge/result.d.ts.map +0 -1
  326. package/dist/judge/result.js +0 -2
  327. package/dist/judge/result.js.map +0 -1
  328. package/dist/projection/SchemaOrCard.d.ts +0 -7
  329. package/dist/projection/SchemaOrCard.d.ts.map +0 -1
  330. package/dist/projection/SchemaOrCard.js +0 -11
  331. package/dist/projection/SchemaOrCard.js.map +0 -1
  332. package/dist/projection/card/EntityTypeSource.d.ts +0 -12
  333. package/dist/projection/card/EntityTypeSource.d.ts.map +0 -1
  334. package/dist/projection/card/EntityTypeSource.js +0 -78
  335. package/dist/projection/card/EntityTypeSource.js.map +0 -1
  336. package/dist/projection/card/FacadeTypeSource.d.ts +0 -19
  337. package/dist/projection/card/FacadeTypeSource.d.ts.map +0 -1
  338. package/dist/projection/card/FacadeTypeSource.js +0 -40
  339. package/dist/projection/card/FacadeTypeSource.js.map +0 -1
  340. package/dist/schema/Schema.d.ts.map +0 -1
  341. package/dist/schema/Schema.js.map +0 -1
  342. package/dist/schema/SchemaDefinition.d.ts +0 -60
  343. package/dist/schema/SchemaDefinition.d.ts.map +0 -1
  344. package/dist/schema/SchemaDefinition.js +0 -85
  345. package/dist/schema/SchemaDefinition.js.map +0 -1
  346. package/dist/schema/SchemaDerivation.d.ts +0 -34
  347. package/dist/schema/SchemaDerivation.d.ts.map +0 -1
  348. package/dist/schema/SchemaDerivation.js +0 -51
  349. package/dist/schema/SchemaDerivation.js.map +0 -1
  350. package/dist/schema/SchemaView.d.ts.map +0 -1
  351. package/dist/schema/axis/Axis.d.ts.map +0 -1
  352. package/dist/schema/axis/Axis.js.map +0 -1
  353. package/dist/schema/axis/Meta.d.ts.map +0 -1
  354. package/dist/schema/axis/boundary/Boundaries.d.ts +0 -20
  355. package/dist/schema/axis/boundary/Boundaries.d.ts.map +0 -1
  356. package/dist/schema/axis/boundary/Boundaries.js +0 -31
  357. package/dist/schema/axis/boundary/Boundaries.js.map +0 -1
  358. package/dist/schema/axis/boundary/Boundary.d.ts.map +0 -1
  359. package/dist/schema/axis/boundary/Boundary.js.map +0 -1
  360. package/dist/schema/axis/boundary/BoundaryAxis.d.ts.map +0 -1
  361. package/dist/schema/axis/boundary/BoundaryAxis.js.map +0 -1
  362. package/dist/schema/axis/lifecycle/Clock.d.ts.map +0 -1
  363. package/dist/schema/axis/lifecycle/Clock.js.map +0 -1
  364. package/dist/schema/axis/lifecycle/Generators.d.ts +0 -18
  365. package/dist/schema/axis/lifecycle/Generators.d.ts.map +0 -1
  366. package/dist/schema/axis/lifecycle/Generators.js +0 -38
  367. package/dist/schema/axis/lifecycle/Generators.js.map +0 -1
  368. package/dist/schema/axis/lifecycle/Lifecycle.d.ts.map +0 -1
  369. package/dist/schema/axis/lifecycle/Lifecycle.js.map +0 -1
  370. package/dist/schema/axis/lifecycle/LifecycleAxis.d.ts.map +0 -1
  371. package/dist/schema/axis/lifecycle/LifecycleAxis.js.map +0 -1
  372. package/dist/schema/axis/lifecycle/apply.d.ts +0 -6
  373. package/dist/schema/axis/lifecycle/apply.d.ts.map +0 -1
  374. package/dist/schema/axis/lifecycle/apply.js +0 -34
  375. package/dist/schema/axis/lifecycle/apply.js.map +0 -1
  376. package/dist/schema/axis/role/Relation.d.ts.map +0 -1
  377. package/dist/schema/axis/role/Relation.js.map +0 -1
  378. package/dist/schema/axis/role/Role.d.ts.map +0 -1
  379. package/dist/schema/axis/role/Role.js +0 -40
  380. package/dist/schema/axis/role/Role.js.map +0 -1
  381. package/dist/schema/axis/role/RoleAxis.d.ts.map +0 -1
  382. package/dist/schema/axis/role/RoleAxis.js.map +0 -1
  383. package/dist/schema/axis/shape/Formats.d.ts +0 -8
  384. package/dist/schema/axis/shape/Formats.d.ts.map +0 -1
  385. package/dist/schema/axis/shape/Formats.js +0 -10
  386. package/dist/schema/axis/shape/Formats.js.map +0 -1
  387. package/dist/schema/axis/shape/Shape.d.ts.map +0 -1
  388. package/dist/schema/axis/shape/Shape.js +0 -52
  389. package/dist/schema/axis/shape/Shape.js.map +0 -1
  390. package/dist/schema/fields/Field.d.ts.map +0 -1
  391. package/dist/schema/fields/Field.js +0 -52
  392. package/dist/schema/fields/Field.js.map +0 -1
  393. package/dist/schema/fields/FieldSet.d.ts +0 -28
  394. package/dist/schema/fields/FieldSet.d.ts.map +0 -1
  395. package/dist/schema/fields/FieldSet.js +0 -55
  396. package/dist/schema/fields/FieldSet.js.map +0 -1
  397. package/dist/schema/fields/constraint/FieldGroup.d.ts +0 -21
  398. package/dist/schema/fields/constraint/FieldGroup.d.ts.map +0 -1
  399. package/dist/schema/fields/constraint/FieldGroup.js +0 -65
  400. package/dist/schema/fields/constraint/FieldGroup.js.map +0 -1
  401. package/dist/schema/fields/constraint/Unique.d.ts +0 -4
  402. package/dist/schema/fields/constraint/Unique.d.ts.map +0 -1
  403. package/dist/schema/fields/constraint/Unique.js +0 -4
  404. package/dist/schema/fields/constraint/Unique.js.map +0 -1
  405. package/dist/utils.d.ts.map +0 -1
  406. package/dist/utils.js.map +0 -1
  407. package/src/judge/RowRefusal.ts +0 -17
  408. package/src/judge/options.ts +0 -3
  409. package/src/projection/SchemaOrCard.ts +0 -18
  410. package/src/projection/card/EntityTypeSource.ts +0 -90
  411. package/src/projection/card/FacadeTypeSource.ts +0 -55
  412. package/src/schema/SchemaDefinition.ts +0 -150
  413. package/src/schema/SchemaDerivation.ts +0 -65
  414. package/src/schema/axis/boundary/Boundaries.ts +0 -44
  415. package/src/schema/axis/lifecycle/Generators.ts +0 -46
  416. package/src/schema/axis/lifecycle/apply.ts +0 -39
  417. package/src/schema/axis/role/Role.ts +0 -56
  418. package/src/schema/axis/shape/Formats.ts +0 -22
  419. package/src/schema/fields/FieldSet.ts +0 -63
  420. package/src/schema/fields/constraint/FieldGroup.ts +0 -84
  421. package/src/schema/fields/constraint/Unique.ts +0 -3
  422. /package/dist/{schema/SchemaView.js → SchemaView.js} +0 -0
  423. /package/dist/{schema/axis → axis}/Axis.js +0 -0
  424. /package/dist/{schema/axis → axis}/Meta.d.ts +0 -0
  425. /package/dist/{schema/axis → axis}/Meta.js +0 -0
  426. /package/dist/{schema/axis → axis}/boundary/BoundaryAxis.d.ts +0 -0
  427. /package/dist/{schema/axis → axis}/lifecycle/Lifecycle.d.ts +0 -0
  428. /package/dist/{schema/axis → axis}/lifecycle/Lifecycle.js +0 -0
  429. /package/dist/{schema/axis → axis}/lifecycle/LifecycleAxis.d.ts +0 -0
  430. /package/dist/{utils.d.ts → lib/utils.d.ts} +0 -0
  431. /package/dist/{utils.js → lib/utils.js} +0 -0
  432. /package/src/{schema/axis → axis}/Meta.ts +0 -0
  433. /package/src/{schema/axis → axis}/lifecycle/Lifecycle.ts +0 -0
  434. /package/src/{utils.ts → lib/utils.ts} +0 -0
  435. /package/src/{judge/result.ts → validation.ts} +0 -0
package/src/index.ts CHANGED
@@ -1,69 +1,33 @@
1
- export { Field, type Fields } from './schema/fields/Field.js';
2
- export { FieldSet } from './schema/fields/FieldSet.js';
3
- export { type Shape, Anatomy } from './schema/axis/shape/Shape.js';
4
- export {
5
- type StringFormat,
6
- type FormatPredicate,
7
- Formats,
8
- } from './schema/axis/shape/Formats.js';
9
- export { Role, type RoleRules } from './schema/axis/role/Role.js';
10
- export { type Relation, type EntityConstructor } from './schema/axis/role/Relation.js';
11
- export { Lifecycle, type LifecycleRules } from './schema/axis/lifecycle/Lifecycle.js';
12
- export { type GeneratorRef, Generators } from './schema/axis/lifecycle/Generators.js';
13
- export { Clock } from './schema/axis/lifecycle/Clock.js';
14
- export {
15
- Boundary,
16
- type BoundaryRules,
17
- type BoundaryRef,
18
- } from './schema/axis/boundary/Boundary.js';
19
- export { type Decoder, type Encoder, Boundaries } from './schema/axis/boundary/Boundaries.js';
20
- export { type Meta } from './schema/axis/Meta.js';
21
- export { FieldGroup } from './schema/fields/constraint/FieldGroup.js';
22
- export { Unique } from './schema/fields/constraint/Unique.js';
1
+ export { entity } from './entity.js';
23
2
 
24
- export {
25
- Schema,
26
- ANONYMOUS_SCHEMA_NAME,
27
- type SchemaConstructor,
28
- } from './schema/Schema.js';
29
- export { SchemaDerivation } from './schema/SchemaDerivation.js';
30
- export { Cases, type Case } from './projection/Cases.js';
31
- export { RowRefusal } from './judge/RowRefusal.js';
32
- export { type SchemaView, type Row, type PartialRow } from './schema/SchemaView.js';
33
- export { type FougereEntityAdapters, type EntityAdapters } from './entity/EntityAdapters.js';
34
- export {
35
- type EntityDeclarations,
36
- type CompositeUnique,
37
- type PreviousNames,
38
- } from './entity/EntityDeclarations.js';
39
- export { lowerFirst, upperFirst, isObject } from './utils.js';
3
+ export * from './vocabulary/index.js';
40
4
 
41
- export { primary } from './vocabulary/primary.js';
42
- export { text } from './vocabulary/text.js';
43
- export { email } from './vocabulary/email.js';
44
- export { url } from './vocabulary/url.js';
45
- export { list } from './vocabulary/list.js';
46
- export { number } from './vocabulary/number.js';
47
- export { bool } from './vocabulary/bool.js';
48
- export { date } from './vocabulary/date.js';
49
- export { created } from './vocabulary/created.js';
50
- export { updated } from './vocabulary/updated.js';
51
- export { oneOf } from './vocabulary/oneOf.js';
52
- export { ref } from './vocabulary/ref.js';
53
- export { many } from './vocabulary/many.js';
54
- export { optional } from './vocabulary/optional.js';
55
- export { nullable } from './vocabulary/nullable.js';
56
- export { immutable } from './vocabulary/immutable.js';
57
- export { unique } from './vocabulary/unique.js';
58
- export { indexed } from './vocabulary/indexed.js';
59
- export { readOnly } from './vocabulary/readOnly.js';
60
- export { writeOnly } from './vocabulary/writeOnly.js';
61
- export { json } from './vocabulary/json.js';
5
+ export { Schema, ANONYMOUS_SCHEMA_NAME, type SchemaConstructor } from './Schema.js';
6
+ export { type SchemaView } from './SchemaView.js';
7
+ export { Field, type Fields } from './field/Field.js';
8
+ export { FieldSet } from './field/FieldSet.js';
9
+ export { type Shape, Shapes } from './axis/shape/Shape.js';
10
+ export { Role } from './axis/role/Role.js';
11
+ export { type EntityConstructor } from './axis/role/Relation.js';
12
+ export { Lifecycle, type LifecycleRules } from './axis/lifecycle/Lifecycle.js';
13
+ export { Boundary, type BoundaryRef } from './axis/boundary/Boundary.js';
14
+ export { applyCreate, applyUpdate } from './axis/lifecycle/apply.js';
15
+ export { InputRefusal } from './validator/InputRefusal.js';
16
+ export { type ValidationError, type ValidationResult } from './validation.js';
62
17
 
63
- export { applyCreate, applyUpdate } from './schema/axis/lifecycle/apply.js';
64
- export { Visibility } from './projection/Visibility.js';
65
18
  export { Card } from './projection/card/Card.js';
66
19
  export { Bundle } from './projection/card/Bundle.js';
20
+ export { Visibility } from './projection/Visibility.js';
21
+ export { Cases, type ValidationCase } from './projection/Cases.js';
22
+ export type {
23
+ SchemaBundle,
24
+ SchemaDescriptor,
25
+ DerivedFrom,
26
+ FieldDescriptor,
27
+ FieldExtension,
28
+ RoleDescriptor,
29
+ RelationDescriptor,
30
+ } from './projection/card/Descriptor.js';
67
31
  export type {
68
32
  Change,
69
33
  Diff,
@@ -73,34 +37,13 @@ export type {
73
37
  RenameCandidate,
74
38
  TypeSet,
75
39
  } from './projection/card/diff.js';
76
- export {
77
- EntityTypeSource,
78
- type EntityTypeSourceOptions,
79
- } from './projection/card/EntityTypeSource.js';
80
- export {
81
- FacadeTypeSource,
82
- type FacadeTypeSourceOptions,
83
- type OpDescriptor,
84
- } from './projection/card/FacadeTypeSource.js';
85
- export {
86
- type SchemaBundle,
87
- type SchemaDescriptor,
88
- type FieldDescriptor,
89
- type FieldExtension,
90
- type RoleDescriptor,
91
- type RelationDescriptor,
92
- } from './projection/card/Descriptor.js';
93
- export { type SchemaOrCard, schemaOf, fieldsOf } from './projection/SchemaOrCard.js';
94
- export type { StandardSchemaV1 } from './projection/standard.js';
95
-
96
- export { entity } from './entity.js';
97
40
 
98
- export { FieldJudge } from './judge/FieldJudge.js';
99
- export { ValueJudge } from './judge/ValueJudge.js';
100
- export { RowJudge } from './judge/RowJudge.js';
101
- export { type ValidateOptions } from './judge/options.js';
102
- export {
103
- type ValidationError,
104
- type ValidationResult,
105
- type Checked,
106
- } from './judge/result.js';
41
+ export * from './lib/index.js';
42
+ export { Formats } from './axis/shape/Formats.js';
43
+ export { Generators } from './axis/lifecycle/Generators.js';
44
+ export { Boundaries } from './axis/boundary/Boundaries.js';
45
+ export { Clock } from './axis/lifecycle/Clock.js';
46
+ export { type FougereEntityAdapters } from './entity/EntityAdapters.js';
47
+ export { InputValidator } from './validator/InputValidator.js';
48
+ export { FieldValueValidator } from './validator/FieldValueValidator.js';
49
+ export { AdapterFieldValidator } from './validator/AdapterFieldValidator.js';
@@ -0,0 +1,37 @@
1
+ export class Registry<T> {
2
+ private readonly entries: Map<string, T>;
3
+
4
+ /** `Unknown boundary decoder 'celsius' — call Boundaries.decoders.register(name, fn).` */
5
+ constructor(
6
+ private readonly label: string,
7
+ private readonly hint?: string,
8
+ builtins?: Iterable<readonly [string, T]>,
9
+ ) {
10
+ this.entries = new Map(builtins);
11
+ }
12
+
13
+ register(name: string, value: T): T {
14
+ this.entries.set(name, value);
15
+
16
+ return value;
17
+ }
18
+
19
+ find(name: string): T | undefined {
20
+ return this.entries.get(name);
21
+ }
22
+
23
+ resolve(name: string, path?: string): T {
24
+ const found = this.find(name);
25
+
26
+ if (found !== undefined) return found;
27
+
28
+ throw new Error(
29
+ `${path ? `${path}: ` : ''}Unknown ${this.label} '${name}'${this.hint ? ` — ${this.hint}` : ''}. ` +
30
+ `This process answers ${this.names.join(', ') || 'nothing yet'}.`,
31
+ );
32
+ }
33
+
34
+ private get names(): string[] {
35
+ return [...this.entries.keys()];
36
+ }
37
+ }
@@ -0,0 +1,2 @@
1
+ export * from './Registry.js';
2
+ export * from './utils.js';
@@ -1,70 +1,74 @@
1
- import { Anatomy } from '../schema/axis/shape/Shape.js';
2
- import { Boundary } from '../schema/axis/boundary/Boundary.js';
3
- import { Lifecycle } from '../schema/axis/lifecycle/Lifecycle.js';
4
- import { Role } from '../schema/axis/role/Role.js';
5
- import type { Field } from '../schema/fields/Field.js';
6
- import type { SchemaView } from '../schema/SchemaView.js';
7
- import { RowJudge } from '../judge/RowJudge.js';
8
- import { RowRefusal } from '../judge/RowRefusal.js';
1
+ import { Shapes } from '../axis/shape/Shape.js';
2
+ import { Boundary } from '../axis/boundary/Boundary.js';
3
+ import { Lifecycle } from '../axis/lifecycle/Lifecycle.js';
4
+ import { Role } from '../axis/role/Role.js';
5
+ import type { Field } from '../field/Field.js';
6
+ import type { SchemaView } from '../SchemaView.js';
7
+ import { InputValidator } from '../validator/InputValidator.js';
8
+ import { InputRefusal } from '../validator/InputRefusal.js';
9
9
 
10
10
  /**
11
- * One input, and what the judge must answer.
11
+ * One input, and what the validator must answer.
12
12
  *
13
13
  * `expect` carries the PATH of the field at fault and never the message. We know which
14
14
  * field must be refused because we are the ones who broke it; naming the message would
15
- * make this list a second judge, and the two would then have to be kept in step by hand —
15
+ * make this list a second validator, and the two would then have to be kept in step by hand —
16
16
  * which is the duplication the whole thing exists to remove.
17
17
  */
18
- export interface Case {
18
+ export interface ValidationCase {
19
19
  /** What this input does, in one clause — carried into the assertion so a failure reads. */
20
20
  why: string;
21
- body: unknown;
22
- /**
23
- * Judged as an update rather than a creation. The two modes refuse different things:
24
- * an absence is `Required` on create and legal on patch, an immutable field is legal
25
- * on create and refused on patch.
26
- */
21
+ input: unknown;
22
+ /** Judged as an update rather than a creation. */
27
23
  patch: boolean;
28
24
  expect: 'accept' | { reject: string };
29
25
  }
30
26
 
31
- /** A value of the wrong type for the declared shape — the one violation every field has. */
27
+ /**
28
+ * So every field has at least one case, whatever else it declares.
29
+ * FR : pour que chaque champ ait un cas, quoi qu'il déclare par ailleurs.
30
+ * `text()` → `42`; `number()` → `'not-a-value-of-this-shape'`
31
+ */
32
32
  function wrongTypeFor(field: Field): unknown {
33
33
  const declared = (field.shape as { type?: string | readonly string[] }).type;
34
34
  const names = Array.isArray(declared) ? declared : [declared];
35
35
  return names.includes('string') ? 42 : 'not-a-value-of-this-shape';
36
36
  }
37
37
 
38
- /** Values that break a stated bound. Empty when the field states none. */
38
+ /**
39
+ * So a bound stated in a shape produces the case that breaks it, and none is invented.
40
+ * FR : pour qu'une borne énoncée produise le cas qui la casse, et aucun autre.
41
+ * `text({ maxLength: 3 })` → one case with `'xxxx'`; `text()` → no case
42
+ */
39
43
  function outOfBoundsFor(field: Field): { why: string; value: unknown }[] {
40
- // Through `Anatomy`, not a cast: the cast admitted any keyword, and it declared
44
+ // Through `Shapes`, not a cast: the cast admitted any keyword, and it declared
41
45
  // `maxItems` — which no branch below ever produced. In the one function whose job is
42
46
  // to be exhaustive, a bound the type does not carry is a case nobody notices missing.
43
- const shape = Anatomy.of(field.shape).base;
44
- const out: { why: string; value: unknown }[] = [];
47
+ const shape = Shapes.of(field.shape).base;
48
+ const cases: { why: string; value: unknown }[] = [];
45
49
  if (shape?.type === 'string') {
46
50
  if (typeof shape.minLength === 'number' && shape.minLength > 0)
47
- out.push({ why: 'shorter than min', value: 'x'.repeat(shape.minLength - 1) });
51
+ cases.push({ why: 'shorter than min', value: 'x'.repeat(shape.minLength - 1) });
48
52
  if (typeof shape.maxLength === 'number')
49
- out.push({ why: 'longer than max', value: 'x'.repeat(shape.maxLength + 1) });
50
- if (shape.enum) out.push({ why: 'outside the stated set', value: '__not-in-enum__' });
53
+ cases.push({ why: 'longer than max', value: 'x'.repeat(shape.maxLength + 1) });
54
+ if (shape.enum) cases.push({ why: 'outside the stated set', value: '__not-in-enum__' });
51
55
  }
52
56
  if (shape?.type === 'number' || shape?.type === 'integer') {
53
57
  if (typeof shape.minimum === 'number')
54
- out.push({ why: 'below minimum', value: shape.minimum - 1 });
58
+ cases.push({ why: 'below minimum', value: shape.minimum - 1 });
55
59
  if (typeof shape.maximum === 'number')
56
- out.push({ why: 'above maximum', value: shape.maximum + 1 });
60
+ cases.push({ why: 'above maximum', value: shape.maximum + 1 });
57
61
  }
58
62
  if (shape?.type === 'array') {
59
63
  if (typeof shape.minItems === 'number' && shape.minItems > 0)
60
- out.push({ why: 'fewer items than min', value: [] });
64
+ cases.push({ why: 'fewer items than min', value: [] });
61
65
  if (typeof shape.maxItems === 'number')
62
- out.push({
66
+ cases.push({
63
67
  why: 'more items than max',
64
68
  value: Array.from({ length: shape.maxItems + 1 }, () => null),
65
69
  });
66
70
  }
67
- return out;
71
+ return cases;
68
72
  }
69
73
 
70
74
  /**
@@ -74,20 +78,14 @@ function outOfBoundsFor(field: Field): { why: string; value: unknown }[] {
74
78
  * supplies a valid row; generating data belongs to the testing package.
75
79
  */
76
80
  export class Cases {
77
- private constructor(readonly all: readonly Case[]) {}
81
+ private constructor(readonly all: readonly ValidationCase[]) {}
78
82
 
79
83
  static of(entity: SchemaView, valid: Record<string, unknown>): Cases {
80
84
  return new Cases(enumerate(entity, valid));
81
85
  }
82
86
 
83
- /**
84
- * Whether a verdict is the one a case expected.
85
- *
86
- * Takes the RESULT rather than the input so the same reader serves the local judge, the
87
- * façade and a door — the three that have to agree.
88
- */
89
87
  static holds(
90
- expected: Case['expect'],
88
+ expected: ValidationCase['expect'],
91
89
  result: { success: boolean; errors?: { path: string }[] },
92
90
  ): boolean {
93
91
  if (expected === 'accept') return result.success;
@@ -95,32 +93,35 @@ export class Cases {
95
93
  return (result.errors ?? []).some((error) => error.path === expected.reject);
96
94
  }
97
95
 
98
- /** Every way a row is refused for its structure — the closed set this table must cover. */
99
96
  static get refusals(): string[] {
100
- return Object.values(RowRefusal);
97
+ return Object.values(InputRefusal);
101
98
  }
102
99
 
103
- [Symbol.iterator](): Iterator<Case> {
100
+ [Symbol.iterator](): Iterator<ValidationCase> {
104
101
  return this.all[Symbol.iterator]();
105
102
  }
106
103
  }
107
104
 
108
- function enumerate(entity: SchemaView, valid: Record<string, unknown>): Case[] {
105
+ /**
106
+ * So the four axes decide which cases exist, and no list of them is maintained by hand.
107
+ * FR : pour que les axes décident des cas, sans liste tenue à la main.
108
+ */
109
+ function enumerate(entity: SchemaView, valid: Record<string, unknown>): ValidationCase[] {
109
110
  const fields = entity.getFields();
110
- const judge = RowJudge.of(fields);
111
- const cases: Case[] = [];
111
+ const validator = InputValidator.of(fields);
112
+ const cases: ValidationCase[] = [];
112
113
  const withField = (name: string, value: unknown) => ({ ...valid, [name]: value });
113
114
 
114
- cases.push({ why: 'a valid body', body: valid, patch: false, expect: 'accept' });
115
+ cases.push({ why: 'a valid input', input: valid, patch: false, expect: 'accept' });
115
116
  cases.push({
116
117
  why: 'a key outside the contract',
117
- body: { ...valid, __unknown__: 'x' },
118
+ input: { ...valid, __unknown__: 'x' },
118
119
  patch: false,
119
120
  expect: { reject: '__unknown__' },
120
121
  });
121
122
  cases.push({
122
123
  why: 'not an object at all',
123
- body: 'a string',
124
+ input: 'a string',
124
125
  patch: false,
125
126
  expect: { reject: '.' },
126
127
  });
@@ -130,16 +131,16 @@ function enumerate(entity: SchemaView, valid: Record<string, unknown>): Case[] {
130
131
  // get to invent a second one, so the only case we can state about it is the bound one.
131
132
  const isRef = Role.of(field).isReference;
132
133
 
133
- if (judge.onAbsent(field) === null && name in valid) {
134
- const body = { ...valid };
135
- delete body[name];
136
- cases.push({ why: `${name} absent`, body, patch: false, expect: { reject: name } });
134
+ if (validator.onAbsent(field) === null && name in valid) {
135
+ const input = { ...valid };
136
+ delete input[name];
137
+ cases.push({ why: `${name} absent`, input, patch: false, expect: { reject: name } });
137
138
  }
138
139
 
139
140
  if (Boundary.of(field).readOnly) {
140
141
  cases.push({
141
142
  why: `${name} supplied although read-only`,
142
- body: withField(name, wrongTypeFor(field)),
143
+ input: withField(name, wrongTypeFor(field)),
143
144
  patch: false,
144
145
  expect: { reject: name },
145
146
  });
@@ -148,7 +149,7 @@ function enumerate(entity: SchemaView, valid: Record<string, unknown>): Case[] {
148
149
  if (Lifecycle.of(field).immutable && !Role.of(field).isPrimary) {
149
150
  cases.push({
150
151
  why: `${name} supplied on an update`,
151
- body: { [name]: valid[name] ?? wrongTypeFor(field) },
152
+ input: { [name]: valid[name] ?? wrongTypeFor(field) },
152
153
  patch: true,
153
154
  expect: { reject: name },
154
155
  });
@@ -157,14 +158,14 @@ function enumerate(entity: SchemaView, valid: Record<string, unknown>): Case[] {
157
158
  if (name in valid && !isRef) {
158
159
  cases.push({
159
160
  why: `${name} of the wrong type`,
160
- body: withField(name, wrongTypeFor(field)),
161
+ input: withField(name, wrongTypeFor(field)),
161
162
  patch: false,
162
163
  expect: { reject: name },
163
164
  });
164
165
  for (const { why, value } of outOfBoundsFor(field))
165
166
  cases.push({
166
167
  why: `${name} ${why}`,
167
- body: withField(name, value),
168
+ input: withField(name, value),
168
169
  patch: false,
169
170
  expect: { reject: name },
170
171
  });
@@ -1,7 +1,7 @@
1
- import { Boundary } from '../schema/axis/boundary/Boundary.js';
2
- import { Lifecycle } from '../schema/axis/lifecycle/Lifecycle.js';
3
- import { Role } from '../schema/axis/role/Role.js';
4
- import type { Fields } from '../schema/fields/Field.js';
1
+ import { Boundary } from '../axis/boundary/Boundary.js';
2
+ import { Lifecycle } from '../axis/lifecycle/Lifecycle.js';
3
+ import { Role } from '../axis/role/Role.js';
4
+ import type { Fields } from '../field/Field.js';
5
5
 
6
6
  export class Visibility {
7
7
  private constructor(private readonly fields: Fields) {}
@@ -10,6 +10,7 @@ export class Visibility {
10
10
  return new Visibility(fields);
11
11
  }
12
12
 
13
+ /** A write-only secret is absent from the type, not just from the value. */
13
14
  get input(): Fields {
14
15
  const result: Fields = {};
15
16
  for (const [name, field] of Object.entries(this.fields)) {
@@ -1,7 +1,7 @@
1
- import type { Resolver } from '../../schema/axis/Axis.js';
2
- import type { EntityConstructor } from '../../schema/axis/role/Relation.js';
3
- import { lowerFirst } from '../../utils.js';
4
- import type { SchemaView } from '../../schema/SchemaView.js';
1
+ import type { Resolver } from '../../axis/Axis.js';
2
+ import type { EntityConstructor } from '../../axis/role/Relation.js';
3
+ import { lowerFirst } from '../../lib/utils.js';
4
+ import type { SchemaView } from '../../SchemaView.js';
5
5
  import { Card } from './Card.js';
6
6
  import type { SchemaBundle, SchemaDescriptor } from './Descriptor.js';
7
7
  import type { Diff, SetDiff, SetDiffOptions } from './diff.js';
@@ -47,12 +47,12 @@ export class Bundle {
47
47
  }
48
48
 
49
49
  toSchemas(): Record<string, SchemaView> {
50
- const map: Record<string, EntityConstructor> = {};
51
- const resolve: Resolver = (name) => map[name.toLowerCase()];
50
+ const byName: Record<string, EntityConstructor> = {};
51
+ const resolve: Resolver = (name) => byName[name.toLowerCase()];
52
52
  const schemas: Record<string, SchemaView> = {};
53
53
  for (const [name, descriptor] of Object.entries(this.descriptor.$defs)) {
54
54
  const schema = Card.fromDescriptor(descriptor).toSchema(resolve, name);
55
- map[name.toLowerCase()] = schema as unknown as EntityConstructor;
55
+ byName[name.toLowerCase()] = schema as unknown as EntityConstructor;
56
56
  schemas[name] = schema;
57
57
  }
58
58
  return schemas;
@@ -65,11 +65,11 @@ export class Bundle {
65
65
  for (const [name, descriptor] of Object.entries(before)) {
66
66
  const target = after[name];
67
67
  if (target === undefined) continue;
68
- const answer = Card.fromDescriptor(descriptor).diff(
68
+ const diff = Card.fromDescriptor(descriptor).diff(
69
69
  Card.fromDescriptor(target),
70
70
  { renamed: options.renamed?.[name] ?? {} },
71
71
  );
72
- if (answer.changes.length > 0 || answer.ambiguous.length > 0) entities[name] = answer;
72
+ if (diff.changes.length > 0 || diff.ambiguous.length > 0) entities[name] = diff;
73
73
  }
74
74
  return {
75
75
  entitiesAdded: Object.keys(after).filter((name) => !(name in before)),