@fougere/schema 0.2.0-alpha.2 → 0.3.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 (343) hide show
  1. package/dist/EntityDeclarations.d.ts +22 -0
  2. package/dist/EntityDeclarations.d.ts.map +1 -0
  3. package/dist/{hints.js → EntityDeclarations.js} +1 -5
  4. package/dist/EntityDeclarations.js.map +1 -0
  5. package/dist/Field.d.ts +21 -0
  6. package/dist/Field.d.ts.map +1 -0
  7. package/dist/Field.js +50 -0
  8. package/dist/Field.js.map +1 -0
  9. package/dist/{schema/schema.d.ts → Schema.d.ts} +27 -34
  10. package/dist/Schema.d.ts.map +1 -0
  11. package/dist/{schema/schema.js → Schema.js} +49 -59
  12. package/dist/Schema.js.map +1 -0
  13. package/dist/SchemaView.d.ts +18 -0
  14. package/dist/SchemaView.d.ts.map +1 -0
  15. package/dist/SchemaView.js +2 -0
  16. package/dist/SchemaView.js.map +1 -0
  17. package/dist/axis/Axis.d.ts +10 -0
  18. package/dist/axis/Axis.d.ts.map +1 -0
  19. package/dist/axis/Axis.js +9 -0
  20. package/dist/axis/Axis.js.map +1 -0
  21. package/dist/axis/Meta.d.ts +4 -0
  22. package/dist/axis/Meta.d.ts.map +1 -0
  23. package/dist/axis/Meta.js +2 -0
  24. package/dist/axis/Meta.js.map +1 -0
  25. package/dist/axis/boundary/Boundaries.d.ts +20 -0
  26. package/dist/axis/boundary/Boundaries.d.ts.map +1 -0
  27. package/dist/axis/boundary/Boundaries.js +31 -0
  28. package/dist/axis/boundary/Boundaries.js.map +1 -0
  29. package/dist/axis/boundary/Boundary.d.ts +26 -0
  30. package/dist/axis/boundary/Boundary.d.ts.map +1 -0
  31. package/dist/axis/boundary/Boundary.js +53 -0
  32. package/dist/axis/boundary/Boundary.js.map +1 -0
  33. package/dist/axis/boundary/axis.d.ts +4 -0
  34. package/dist/axis/boundary/axis.d.ts.map +1 -0
  35. package/dist/axis/boundary/axis.js +29 -0
  36. package/dist/axis/boundary/axis.js.map +1 -0
  37. package/dist/axis/lifecycle/Generators.d.ts +4 -0
  38. package/dist/axis/lifecycle/Generators.d.ts.map +1 -0
  39. package/dist/axis/lifecycle/Generators.js +8 -0
  40. package/dist/axis/lifecycle/Generators.js.map +1 -0
  41. package/dist/axis/lifecycle/Lifecycle.d.ts +28 -0
  42. package/dist/axis/lifecycle/Lifecycle.d.ts.map +1 -0
  43. package/dist/axis/lifecycle/Lifecycle.js +38 -0
  44. package/dist/axis/lifecycle/Lifecycle.js.map +1 -0
  45. package/dist/axis/lifecycle/apply.d.ts +8 -0
  46. package/dist/axis/lifecycle/apply.d.ts.map +1 -0
  47. package/dist/axis/lifecycle/apply.js +72 -0
  48. package/dist/axis/lifecycle/apply.js.map +1 -0
  49. package/dist/axis/lifecycle/axis.d.ts +4 -0
  50. package/dist/axis/lifecycle/axis.d.ts.map +1 -0
  51. package/dist/axis/lifecycle/axis.js +46 -0
  52. package/dist/axis/lifecycle/axis.js.map +1 -0
  53. package/dist/axis/role/Relation.d.ts +10 -0
  54. package/dist/axis/role/Relation.d.ts.map +1 -0
  55. package/dist/axis/role/Relation.js +6 -0
  56. package/dist/axis/role/Relation.js.map +1 -0
  57. package/dist/axis/role/Role.d.ts +38 -0
  58. package/dist/axis/role/Role.d.ts.map +1 -0
  59. package/dist/axis/role/Role.js +50 -0
  60. package/dist/axis/role/Role.js.map +1 -0
  61. package/dist/axis/role/axis.d.ts +5 -0
  62. package/dist/axis/role/axis.d.ts.map +1 -0
  63. package/dist/axis/role/axis.js +101 -0
  64. package/dist/axis/role/axis.js.map +1 -0
  65. package/dist/axis/shape/Formats.d.ts +8 -0
  66. package/dist/axis/shape/Formats.d.ts.map +1 -0
  67. package/dist/axis/shape/Formats.js +10 -0
  68. package/dist/axis/shape/Formats.js.map +1 -0
  69. package/dist/axis/shape/Shape.d.ts +58 -0
  70. package/dist/axis/shape/Shape.d.ts.map +1 -0
  71. package/dist/{field/shape.js → axis/shape/Shape.js} +10 -25
  72. package/dist/axis/shape/Shape.js.map +1 -0
  73. package/dist/card/Descriptor.d.ts +55 -0
  74. package/dist/card/Descriptor.d.ts.map +1 -0
  75. package/dist/card/Descriptor.js +2 -0
  76. package/dist/card/Descriptor.js.map +1 -0
  77. package/dist/card/describe.d.ts +12 -0
  78. package/dist/card/describe.d.ts.map +1 -0
  79. package/dist/card/describe.js +83 -0
  80. package/dist/card/describe.js.map +1 -0
  81. package/dist/card/diff.d.ts +140 -0
  82. package/dist/card/diff.d.ts.map +1 -0
  83. package/dist/card/diff.js +123 -0
  84. package/dist/card/diff.js.map +1 -0
  85. package/dist/card/reconstruct.d.ts +11 -0
  86. package/dist/card/reconstruct.d.ts.map +1 -0
  87. package/dist/card/reconstruct.js +83 -0
  88. package/dist/card/reconstruct.js.map +1 -0
  89. package/dist/card/typescript.d.ts +17 -0
  90. package/dist/card/typescript.d.ts.map +1 -0
  91. package/dist/card/typescript.js +93 -0
  92. package/dist/card/typescript.js.map +1 -0
  93. package/dist/clean.d.ts +2 -0
  94. package/dist/clean.d.ts.map +1 -0
  95. package/dist/{projections/card.js → clean.js} +1 -2
  96. package/dist/clean.js.map +1 -0
  97. package/dist/constraint/FieldGroup.d.ts +21 -0
  98. package/dist/constraint/FieldGroup.d.ts.map +1 -0
  99. package/dist/constraint/FieldGroup.js +65 -0
  100. package/dist/constraint/FieldGroup.js.map +1 -0
  101. package/dist/constraint/Unique.d.ts +4 -0
  102. package/dist/constraint/Unique.d.ts.map +1 -0
  103. package/dist/constraint/Unique.js +4 -0
  104. package/dist/constraint/Unique.js.map +1 -0
  105. package/dist/entity.d.ts +4 -19
  106. package/dist/entity.d.ts.map +1 -1
  107. package/dist/entity.js +13 -39
  108. package/dist/entity.js.map +1 -1
  109. package/dist/index.d.ts +54 -37
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +46 -48
  112. package/dist/index.js.map +1 -1
  113. package/dist/judge/Judge.d.ts +14 -0
  114. package/dist/judge/Judge.d.ts.map +1 -0
  115. package/dist/judge/Judge.js +161 -0
  116. package/dist/judge/Judge.js.map +1 -0
  117. package/dist/judge/cases.d.ts +50 -0
  118. package/dist/judge/cases.d.ts.map +1 -0
  119. package/dist/judge/cases.js +100 -0
  120. package/dist/judge/cases.js.map +1 -0
  121. package/dist/judge/form.d.ts +11 -0
  122. package/dist/judge/form.d.ts.map +1 -0
  123. package/dist/judge/form.js +18 -0
  124. package/dist/judge/form.js.map +1 -0
  125. package/dist/judge/options.d.ts +4 -0
  126. package/dist/judge/options.d.ts.map +1 -0
  127. package/dist/judge/options.js +2 -0
  128. package/dist/judge/options.js.map +1 -0
  129. package/dist/judge/result.d.ts +17 -0
  130. package/dist/judge/result.d.ts.map +1 -0
  131. package/dist/judge/result.js +2 -0
  132. package/dist/judge/result.js.map +1 -0
  133. package/dist/name.d.ts +1 -6
  134. package/dist/name.d.ts.map +1 -1
  135. package/dist/name.js +3 -6
  136. package/dist/name.js.map +1 -1
  137. package/dist/projection/encode.d.ts +3 -0
  138. package/dist/projection/encode.d.ts.map +1 -0
  139. package/dist/projection/encode.js +19 -0
  140. package/dist/projection/encode.js.map +1 -0
  141. package/dist/projection/io.d.ts +4 -0
  142. package/dist/projection/io.d.ts.map +1 -0
  143. package/dist/projection/io.js +29 -0
  144. package/dist/projection/io.js.map +1 -0
  145. package/dist/projection/source.d.ts +7 -0
  146. package/dist/projection/source.d.ts.map +1 -0
  147. package/dist/projection/source.js +11 -0
  148. package/dist/projection/source.js.map +1 -0
  149. package/dist/{projections → projection}/standard.d.ts +0 -8
  150. package/dist/projection/standard.d.ts.map +1 -0
  151. package/dist/projection/standard.js +2 -0
  152. package/dist/projection/standard.js.map +1 -0
  153. package/dist/same.d.ts +6 -0
  154. package/dist/same.d.ts.map +1 -0
  155. package/dist/same.js +35 -0
  156. package/dist/same.js.map +1 -0
  157. package/dist/vocabulary/bool.d.ts +1 -1
  158. package/dist/vocabulary/bool.d.ts.map +1 -1
  159. package/dist/vocabulary/bool.js +1 -1
  160. package/dist/vocabulary/bool.js.map +1 -1
  161. package/dist/vocabulary/created.d.ts +1 -5
  162. package/dist/vocabulary/created.d.ts.map +1 -1
  163. package/dist/vocabulary/created.js +1 -5
  164. package/dist/vocabulary/created.js.map +1 -1
  165. package/dist/vocabulary/date.d.ts +1 -1
  166. package/dist/vocabulary/date.d.ts.map +1 -1
  167. package/dist/vocabulary/date.js +1 -1
  168. package/dist/vocabulary/date.js.map +1 -1
  169. package/dist/vocabulary/email.d.ts +1 -2
  170. package/dist/vocabulary/email.d.ts.map +1 -1
  171. package/dist/vocabulary/email.js +0 -1
  172. package/dist/vocabulary/email.js.map +1 -1
  173. package/dist/vocabulary/immutable.d.ts +2 -6
  174. package/dist/vocabulary/immutable.d.ts.map +1 -1
  175. package/dist/vocabulary/immutable.js +4 -7
  176. package/dist/vocabulary/immutable.js.map +1 -1
  177. package/dist/vocabulary/indexed.d.ts +2 -7
  178. package/dist/vocabulary/indexed.d.ts.map +1 -1
  179. package/dist/vocabulary/indexed.js +2 -8
  180. package/dist/vocabulary/indexed.js.map +1 -1
  181. package/dist/vocabulary/json.d.ts +2 -10
  182. package/dist/vocabulary/json.d.ts.map +1 -1
  183. package/dist/vocabulary/json.js +10 -7
  184. package/dist/vocabulary/json.js.map +1 -1
  185. package/dist/vocabulary/list.d.ts +1 -12
  186. package/dist/vocabulary/list.d.ts.map +1 -1
  187. package/dist/vocabulary/list.js +1 -14
  188. package/dist/vocabulary/list.js.map +1 -1
  189. package/dist/vocabulary/many.d.ts +2 -5
  190. package/dist/vocabulary/many.d.ts.map +1 -1
  191. package/dist/vocabulary/many.js +2 -5
  192. package/dist/vocabulary/many.js.map +1 -1
  193. package/dist/vocabulary/nullable.d.ts +2 -6
  194. package/dist/vocabulary/nullable.d.ts.map +1 -1
  195. package/dist/vocabulary/nullable.js +5 -8
  196. package/dist/vocabulary/nullable.js.map +1 -1
  197. package/dist/vocabulary/number.d.ts +1 -1
  198. package/dist/vocabulary/number.d.ts.map +1 -1
  199. package/dist/vocabulary/number.js +1 -1
  200. package/dist/vocabulary/number.js.map +1 -1
  201. package/dist/vocabulary/oneOf.d.ts +1 -8
  202. package/dist/vocabulary/oneOf.d.ts.map +1 -1
  203. package/dist/vocabulary/oneOf.js +1 -1
  204. package/dist/vocabulary/oneOf.js.map +1 -1
  205. package/dist/vocabulary/optional.d.ts +2 -9
  206. package/dist/vocabulary/optional.d.ts.map +1 -1
  207. package/dist/vocabulary/optional.js +6 -14
  208. package/dist/vocabulary/optional.js.map +1 -1
  209. package/dist/vocabulary/primary.d.ts +2 -15
  210. package/dist/vocabulary/primary.d.ts.map +1 -1
  211. package/dist/vocabulary/primary.js +3 -9
  212. package/dist/vocabulary/primary.js.map +1 -1
  213. package/dist/vocabulary/readOnly.d.ts +2 -6
  214. package/dist/vocabulary/readOnly.d.ts.map +1 -1
  215. package/dist/vocabulary/readOnly.js +5 -8
  216. package/dist/vocabulary/readOnly.js.map +1 -1
  217. package/dist/vocabulary/ref.d.ts +2 -7
  218. package/dist/vocabulary/ref.d.ts.map +1 -1
  219. package/dist/vocabulary/ref.js +2 -7
  220. package/dist/vocabulary/ref.js.map +1 -1
  221. package/dist/vocabulary/text.d.ts +2 -2
  222. package/dist/vocabulary/text.d.ts.map +1 -1
  223. package/dist/vocabulary/text.js +1 -1
  224. package/dist/vocabulary/text.js.map +1 -1
  225. package/dist/vocabulary/unique.d.ts +2 -12
  226. package/dist/vocabulary/unique.d.ts.map +1 -1
  227. package/dist/vocabulary/unique.js +5 -13
  228. package/dist/vocabulary/unique.js.map +1 -1
  229. package/dist/vocabulary/updated.d.ts +1 -6
  230. package/dist/vocabulary/updated.d.ts.map +1 -1
  231. package/dist/vocabulary/updated.js +0 -5
  232. package/dist/vocabulary/updated.js.map +1 -1
  233. package/dist/vocabulary/url.d.ts +1 -2
  234. package/dist/vocabulary/url.d.ts.map +1 -1
  235. package/dist/vocabulary/url.js +0 -1
  236. package/dist/vocabulary/url.js.map +1 -1
  237. package/dist/vocabulary/vocabulary.d.ts +5 -0
  238. package/dist/vocabulary/vocabulary.d.ts.map +1 -0
  239. package/dist/vocabulary/vocabulary.js +31 -0
  240. package/dist/vocabulary/vocabulary.js.map +1 -0
  241. package/dist/vocabulary/writeOnly.d.ts +2 -6
  242. package/dist/vocabulary/writeOnly.d.ts.map +1 -1
  243. package/dist/vocabulary/writeOnly.js +5 -8
  244. package/dist/vocabulary/writeOnly.js.map +1 -1
  245. package/package.json +1 -1
  246. package/dist/field/boundary.d.ts +0 -69
  247. package/dist/field/boundary.d.ts.map +0 -1
  248. package/dist/field/boundary.js +0 -82
  249. package/dist/field/boundary.js.map +0 -1
  250. package/dist/field/field.d.ts +0 -21
  251. package/dist/field/field.d.ts.map +0 -1
  252. package/dist/field/field.js +0 -24
  253. package/dist/field/field.js.map +0 -1
  254. package/dist/field/format.d.ts +0 -29
  255. package/dist/field/format.d.ts.map +0 -1
  256. package/dist/field/format.js +0 -24
  257. package/dist/field/format.js.map +0 -1
  258. package/dist/field/index.d.ts +0 -8
  259. package/dist/field/index.d.ts.map +0 -1
  260. package/dist/field/index.js +0 -10
  261. package/dist/field/index.js.map +0 -1
  262. package/dist/field/lifecycle.d.ts +0 -31
  263. package/dist/field/lifecycle.d.ts.map +0 -1
  264. package/dist/field/lifecycle.js +0 -20
  265. package/dist/field/lifecycle.js.map +0 -1
  266. package/dist/field/meta.d.ts +0 -5
  267. package/dist/field/meta.d.ts.map +0 -1
  268. package/dist/field/meta.js +0 -5
  269. package/dist/field/meta.js.map +0 -1
  270. package/dist/field/role.d.ts +0 -47
  271. package/dist/field/role.d.ts.map +0 -1
  272. package/dist/field/role.js +0 -35
  273. package/dist/field/role.js.map +0 -1
  274. package/dist/field/shape.d.ts +0 -89
  275. package/dist/field/shape.d.ts.map +0 -1
  276. package/dist/field/shape.js.map +0 -1
  277. package/dist/hints.d.ts +0 -28
  278. package/dist/hints.d.ts.map +0 -1
  279. package/dist/hints.js.map +0 -1
  280. package/dist/projections/card.d.ts +0 -98
  281. package/dist/projections/card.d.ts.map +0 -1
  282. package/dist/projections/card.js.map +0 -1
  283. package/dist/projections/describe.d.ts +0 -25
  284. package/dist/projections/describe.d.ts.map +0 -1
  285. package/dist/projections/describe.js +0 -131
  286. package/dist/projections/describe.js.map +0 -1
  287. package/dist/projections/encode.d.ts +0 -11
  288. package/dist/projections/encode.d.ts.map +0 -1
  289. package/dist/projections/encode.js +0 -26
  290. package/dist/projections/encode.js.map +0 -1
  291. package/dist/projections/io.d.ts +0 -24
  292. package/dist/projections/io.d.ts.map +0 -1
  293. package/dist/projections/io.js +0 -46
  294. package/dist/projections/io.js.map +0 -1
  295. package/dist/projections/lifecycle.d.ts +0 -29
  296. package/dist/projections/lifecycle.d.ts.map +0 -1
  297. package/dist/projections/lifecycle.js +0 -93
  298. package/dist/projections/lifecycle.js.map +0 -1
  299. package/dist/projections/reconstruct.d.ts +0 -31
  300. package/dist/projections/reconstruct.d.ts.map +0 -1
  301. package/dist/projections/reconstruct.js +0 -146
  302. package/dist/projections/reconstruct.js.map +0 -1
  303. package/dist/projections/source.d.ts +0 -18
  304. package/dist/projections/source.d.ts.map +0 -1
  305. package/dist/projections/source.js +0 -18
  306. package/dist/projections/source.js.map +0 -1
  307. package/dist/projections/standard.d.ts.map +0 -1
  308. package/dist/projections/standard.js +0 -10
  309. package/dist/projections/standard.js.map +0 -1
  310. package/dist/projections/typescript.d.ts +0 -37
  311. package/dist/projections/typescript.d.ts.map +0 -1
  312. package/dist/projections/typescript.js +0 -157
  313. package/dist/projections/typescript.js.map +0 -1
  314. package/dist/schema/index.d.ts +0 -3
  315. package/dist/schema/index.d.ts.map +0 -1
  316. package/dist/schema/index.js +0 -2
  317. package/dist/schema/index.js.map +0 -1
  318. package/dist/schema/schema.d.ts.map +0 -1
  319. package/dist/schema/schema.js.map +0 -1
  320. package/dist/schema/view.d.ts +0 -26
  321. package/dist/schema/view.d.ts.map +0 -1
  322. package/dist/schema/view.js +0 -2
  323. package/dist/schema/view.js.map +0 -1
  324. package/dist/unique.d.ts +0 -40
  325. package/dist/unique.d.ts.map +0 -1
  326. package/dist/unique.js +0 -57
  327. package/dist/unique.js.map +0 -1
  328. package/dist/validation/index.d.ts +0 -4
  329. package/dist/validation/index.d.ts.map +0 -1
  330. package/dist/validation/index.js +0 -2
  331. package/dist/validation/index.js.map +0 -1
  332. package/dist/validation/judge.d.ts +0 -55
  333. package/dist/validation/judge.d.ts.map +0 -1
  334. package/dist/validation/judge.js +0 -351
  335. package/dist/validation/judge.js.map +0 -1
  336. package/dist/validation/options.d.ts +0 -6
  337. package/dist/validation/options.d.ts.map +0 -1
  338. package/dist/validation/options.js +0 -3
  339. package/dist/validation/options.js.map +0 -1
  340. package/dist/validation/result.d.ts +0 -20
  341. package/dist/validation/result.d.ts.map +0 -1
  342. package/dist/validation/result.js +0 -3
  343. package/dist/validation/result.js.map +0 -1
@@ -1,82 +0,0 @@
1
- import { Anatomy } from './shape.js';
2
- // ─── Registries (open, extensible — same spirit as FougereHints) ──
3
- export class Boundaries {
4
- static decoders = new Map();
5
- static encoders = new Map();
6
- static aliases = new Map();
7
- static registerDecoder(name, fn) { this.decoders.set(name, fn); }
8
- static registerEncoder(name, fn) { this.encoders.set(name, fn); }
9
- /** Name a pair of directional rules, so a field declares `boundary: 'moneyCents'`. */
10
- static registerAlias(name, boundary) { this.aliases.set(name, boundary); }
11
- static alias(name) { return this.aliases.get(name); }
12
- static decoder(name) { return this.named(this.decoders, name, 'decoder'); }
13
- static encoder(name) { return this.named(this.encoders, name, 'encoder'); }
14
- static named(registry, name, kind) {
15
- const fn = registry.get(name);
16
- if (!fn) {
17
- throw new Error(`Unknown boundary ${kind}: '${name}'. Register it with ` +
18
- `Boundaries.register${kind[0].toUpperCase()}${kind.slice(1)}('${name}', …).`);
19
- }
20
- return fn;
21
- }
22
- }
23
- const identityDecoder = (value) => ({ value });
24
- const identityEncoder = (value) => value;
25
- // `isoDate`: the only non-identity built-in. Inbound accepts a Date or an ISO-ish
26
- // string and yields a Date; outbound yields an ISO string. Validity is already
27
- // guaranteed by `shape` (the date predicate) before decode runs.
28
- Boundaries.registerDecoder('isoDate', (value) => {
29
- if (value instanceof Date)
30
- return { value };
31
- if (typeof value === 'string') {
32
- const d = new Date(value);
33
- return Number.isNaN(d.getTime()) ? { error: 'Invalid date' } : { value: d };
34
- }
35
- return { error: 'Expected a date' };
36
- });
37
- Boundaries.registerEncoder('isoDate', (value) => value instanceof Date ? value.toISOString() : value);
38
- Boundaries.registerAlias('isoDate', { in: { decode: 'isoDate' }, out: { encode: 'isoDate' } });
39
- /** Default boundary derived from a field's shape. A date-time string → isoDate, else identity. */
40
- function defaultBoundaryForShape(shape) {
41
- const base = Anatomy.of(shape).base;
42
- if (base && base.type === 'string' && base.format === 'date-time')
43
- return Boundaries.alias('isoDate');
44
- return {};
45
- }
46
- // ─── Resolution ──────────────────────────────────────
47
- /** The field's DECLARED boundary in normal form (alias resolved) — no derived default. */
48
- export function declaredBoundary(field) {
49
- const ref = field.boundary;
50
- if (ref === undefined)
51
- return {};
52
- if (typeof ref === 'string') {
53
- const alias = Boundaries.alias(ref);
54
- if (!alias)
55
- throw new Error(`Unknown boundary alias: '${ref}'`);
56
- return alias;
57
- }
58
- return ref;
59
- }
60
- /**
61
- * The field's EFFECTIVE boundary: declared rules win per direction, the
62
- * shape-derived default fills the rest. This is the reader every consumer of
63
- * the axis goes through — `boundaryOf(f).in === 'closed'` is the read-only
64
- * test, `.out === 'closed'` the write-only one.
65
- */
66
- export function boundaryOf(field) {
67
- const declared = declaredBoundary(field);
68
- const derived = defaultBoundaryForShape(field.shape);
69
- return { in: declared.in ?? derived.in, out: declared.out ?? derived.out };
70
- }
71
- /**
72
- * A field's effective conversion functions. A closed direction converts as identity — the
73
- * permission facet is judged by the façade, not here.
74
- */
75
- export function resolveBoundary(field) {
76
- const boundary = boundaryOf(field);
77
- return {
78
- decode: typeof boundary.in === 'object' ? Boundaries.decoder(boundary.in.decode) : identityDecoder,
79
- encode: typeof boundary.out === 'object' ? Boundaries.encoder(boundary.out.encode) : identityEncoder,
80
- };
81
- }
82
- //# sourceMappingURL=boundary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"boundary.js","sourceRoot":"","sources":["../../src/field/boundary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAc,MAAM,YAAY,CAAC;AAmCjD,qEAAqE;AAErE,MAAM,OAAO,UAAU;IACb,MAAM,CAAU,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;IACtD,MAAM,CAAU,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;IACtD,MAAM,CAAU,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;IAE9D,MAAM,CAAC,eAAe,CAAC,IAAY,EAAE,EAAW,IAAU,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACxF,MAAM,CAAC,eAAe,CAAC,IAAY,EAAE,EAAW,IAAU,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAExF,sFAAsF;IACtF,MAAM,CAAC,aAAa,CAAC,IAAY,EAAE,QAAkB,IAAU,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAElG,MAAM,CAAC,KAAK,CAAC,IAAY,IAA0B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEnF,MAAM,CAAC,OAAO,CAAC,IAAY,IAAa,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5F,MAAM,CAAC,OAAO,CAAC,IAAY,IAAa,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC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EAAE,QAAQ,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AAC7E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAY;IAC1C,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACnC,OAAO;QACL,MAAM,EAAE,OAAO,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe;QAClG,MAAM,EAAE,OAAO,QAAQ,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe;KACrG,CAAC;AACJ,CAAC"}
@@ -1,21 +0,0 @@
1
- import type { Shape } from "./shape.js";
2
- import type { Role } from "./role.js";
3
- import type { Lifecycle } from "./lifecycle.js";
4
- import type { BoundaryRef } from "./boundary.js";
5
- import type { Meta } from "./meta.js";
6
- export declare class Field<T = unknown> {
7
- readonly shape: Shape;
8
- readonly role?: Role;
9
- readonly lifecycle?: Lifecycle;
10
- readonly boundary?: BoundaryRef;
11
- readonly meta?: Meta;
12
- readonly _type?: T;
13
- constructor(init: FieldData, key?: string);
14
- with<U = T>(overrides: Partial<FieldData>): Field<U>;
15
- }
16
- /** A record of fields — the input to `entity()` and every derivation. */
17
- export type Fields = Record<string, Field>;
18
- export type FieldData = {
19
- [K in keyof Field as Field[K] extends (...args: never[]) => unknown ? never : K]: Field[K];
20
- };
21
- //# sourceMappingURL=field.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/field/field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,qBAAa,KAAK,CAAC,CAAC,GAAG,OAAO;IAC5B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,SAAiB,KAAK,CAAC,EAAE,CAAC,CAAC;IAE3B,YAAY,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,MAAM,EAexC;IAED,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAEnD;CACF;AAED,yEAAyE;AACzE,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG;KACrB,CAAC,IAAI,MAAM,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,GAC/D,KAAK,GACL,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;CACjB,CAAC"}
@@ -1,24 +0,0 @@
1
- import { Judge } from "../validation/index.js";
2
- export class Field {
3
- shape;
4
- role;
5
- lifecycle;
6
- boundary;
7
- meta;
8
- constructor(init, key) {
9
- const verdict = Judge.field(init);
10
- if (!verdict.success) {
11
- throw new Error(`${key ? `Field '${key}': ` : ""}` +
12
- verdict.errors.map((e) => `${e.path}: ${e.message}`).join("; "));
13
- }
14
- this.shape = init.shape;
15
- this.role = init.role;
16
- this.lifecycle = init.lifecycle;
17
- this.boundary = init.boundary;
18
- this.meta = init.meta;
19
- }
20
- with(overrides) {
21
- return new Field({ ...this, ...overrides });
22
- }
23
- }
24
- //# sourceMappingURL=field.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field.js","sourceRoot":"","sources":["../../src/field/field.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAM/C,MAAM,OAAO,KAAK;IACP,KAAK,CAAQ;IACb,IAAI,CAAQ;IACZ,SAAS,CAAa;IACtB,QAAQ,CAAe;IACvB,IAAI,CAAQ;IAGrB,YAAY,IAAe,EAAE,GAAY;QACvC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAElC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CACb,GAAG,GAAG,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;gBAChC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAClE,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC;IAED,IAAI,CAAQ,SAA6B;QACvC,OAAO,IAAI,KAAK,CAAI,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;IACjD,CAAC;CACF"}
@@ -1,29 +0,0 @@
1
- /**
2
- * The `format` keyword — JSON Schema's one openly extensible vocabulary, which is why a
3
- * custom predicate rides here and not in a keyword of our own.
4
- */
5
- export type StringFormat = 'date-time' | 'date' | 'time' | 'email' | 'uuid' | 'uri' | (string & {});
6
- /**
7
- * A custom format's predicate: one value, one verdict.
8
- *
9
- * No message, deliberately — a custom format fails exactly like `email` does,
10
- * because the NAME is the contract and a consumer reading the card cannot tell
11
- * ours from the standard's.
12
- */
13
- export type FormatPredicate = (value: string) => boolean;
14
- /**
15
- * Register a format the engine does not ship — `Formats.register('siret', luhn)` makes
16
- * `text({ format: 'siret' })` judged. The field declares a NAME and a module supplies the
17
- * realization, so the rule crosses a process or a language: the card carries
18
- * `"format": "siret"`, legal JSON Schema, and each runtime resolves it locally.
19
- *
20
- * Registering a name the engine already judges is cumulative — both predicates must pass.
21
- */
22
- export declare class Formats {
23
- private static readonly registry;
24
- /** Register a format the engine does not ship — `text({ format: 'siret' })` becomes judged. */
25
- static register(name: string, predicate: FormatPredicate): void;
26
- /** A registered custom predicate, or undefined — the reader the judge goes through. */
27
- static resolve(name: string): FormatPredicate | undefined;
28
- }
29
- //# sourceMappingURL=format.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/field/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,KAAK,GACL,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAIlB;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;AAEzD;;;;;;;GAOG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAsC;IAEtE,+FAA+F;IAC/F,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,GAAG,IAAI,CAE9D;IAED,uFAAuF;IACvF,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAExD;CACF"}
@@ -1,24 +0,0 @@
1
- /**
2
- * The `format` keyword — JSON Schema's one openly extensible vocabulary, which is why a
3
- * custom predicate rides here and not in a keyword of our own.
4
- */
5
- /**
6
- * Register a format the engine does not ship — `Formats.register('siret', luhn)` makes
7
- * `text({ format: 'siret' })` judged. The field declares a NAME and a module supplies the
8
- * realization, so the rule crosses a process or a language: the card carries
9
- * `"format": "siret"`, legal JSON Schema, and each runtime resolves it locally.
10
- *
11
- * Registering a name the engine already judges is cumulative — both predicates must pass.
12
- */
13
- export class Formats {
14
- static registry = new Map();
15
- /** Register a format the engine does not ship — `text({ format: 'siret' })` becomes judged. */
16
- static register(name, predicate) {
17
- this.registry.set(name, predicate);
18
- }
19
- /** A registered custom predicate, or undefined — the reader the judge goes through. */
20
- static resolve(name) {
21
- return this.registry.get(name);
22
- }
23
- }
24
- //# sourceMappingURL=format.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/field/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH;;;;;;;GAOG;AACH,MAAM,OAAO,OAAO;IACV,MAAM,CAAU,QAAQ,GAAG,IAAI,GAAG,EAA2B,CAAC;IAEtE,+FAA+F;IAC/F,MAAM,CAAC,QAAQ,CAAC,IAAY,EAAE,SAA0B;QACtD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC;IAED,uFAAuF;IACvF,MAAM,CAAC,OAAO,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACF"}
@@ -1,8 +0,0 @@
1
- export { type Shape, SHAPE_TYPES, isShape, type ShapeType, type BaseShape, type ShapeAnatomy, nullableShape, Anatomy, } from "./shape.js";
2
- export { Formats, type FormatPredicate, type StringFormat } from "./format.js";
3
- export { type Role, type Relation, type EntityConstructor, toTargetThunk, uniqueMembers, } from "./role.js";
4
- export { type Lifecycle, type GeneratorRef, registerGenerator, resolveCustomGenerator, } from "./lifecycle.js";
5
- export { type Boundary, type BoundaryRef, type Decoder, type Encoder, resolveBoundary, declaredBoundary, boundaryOf, Boundaries, } from "./boundary.js";
6
- export { type Meta } from "./meta.js";
7
- export { Field, type Fields, type FieldData, } from "./field.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/field/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,KAAK,EACV,WAAW,EACX,OAAO,EACP,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,aAAa,EACb,OAAO,GACR,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EACL,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,aAAa,EACb,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,KAAK,EACL,KAAK,MAAM,EACX,KAAK,SAAS,GACf,MAAM,YAAY,CAAC"}
@@ -1,10 +0,0 @@
1
- // The primitive — a Field decomposed on four orthogonal axes plus the meta
2
- // compartment. Each axis lives in its own file; this barrel is the
3
- // package-internal (and index-level) view.
4
- export { SHAPE_TYPES, isShape, nullableShape, Anatomy, } from "./shape.js";
5
- export { Formats } from "./format.js";
6
- export { toTargetThunk, uniqueMembers, } from "./role.js";
7
- export { registerGenerator, resolveCustomGenerator, } from "./lifecycle.js";
8
- export { resolveBoundary, declaredBoundary, boundaryOf, Boundaries, } from "./boundary.js";
9
- export { Field, } from "./field.js";
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/field/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,mEAAmE;AACnE,2CAA2C;AAC3C,OAAO,EAEL,WAAW,EACX,OAAO,EAIP,aAAa,EACb,OAAO,GACR,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,OAAO,EAA2C,MAAM,aAAa,CAAC;AAC/E,OAAO,EAIL,aAAa,EACb,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAGL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAKL,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,UAAU,GACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,KAAK,GAGN,MAAM,YAAY,CAAC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Generator TOKEN — a preset, or a name registered via {@link registerGenerator}. Never a
3
- * closure: a function vanishes through describe/reconstruct without an error, and the
4
- * remote frond pays. A name fails loudly and locally instead.
5
- */
6
- export type GeneratorRef = 'cuid2' | 'uuid' | 'nanoid' | (string & {});
7
- /** The moments a value can be written at — the runtime list, from which the types derive. */
8
- export declare const CREATE_TOKENS: readonly ['now', 'optional'];
9
- export declare const UPDATE_TOKENS: readonly ['now', 'forbidden'];
10
- export interface Lifecycle {
11
- /**
12
- * What happens when the input omits the value. Absent → required. `{ value }` fills a
13
- * literal, `'now'` stamps, `{ generate }` has the storage stamp an id, `'optional'`
14
- * permits absence and produces nothing. A supplied value is always accepted.
15
- */
16
- create?: {
17
- value: unknown;
18
- } | {
19
- generate: GeneratorRef;
20
- } | (typeof CREATE_TOKENS)[number];
21
- /**
22
- * What happens on a patch. Absent → written only if supplied. `'now'` stamps at every
23
- * update (the canonical `updatedAt`). `'forbidden'` makes supplying it an error.
24
- * The judge only JUDGES; stamping is the storage's, at the point of persistence.
25
- */
26
- update?: (typeof UPDATE_TOKENS)[number];
27
- }
28
- export declare function registerGenerator(name: string, fn: () => string): void;
29
- /** A registered custom generator, or undefined (built-in presets live storage-side). */
30
- export declare function resolveCustomGenerator(ref: GeneratorRef): (() => string) | undefined;
31
- //# sourceMappingURL=lifecycle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/field/lifecycle.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEvE,6FAA6F;AAC7F,eAAO,MAAM,aAAa,YAAI,KAAK,EAAE,UAAU,CAAU,CAAC;AAC1D,eAAO,MAAM,aAAa,YAAI,KAAK,EAAE,WAAW,CAAU,CAAC;AAE3D,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG;QAAE,QAAQ,EAAE,YAAY,CAAA;KAAE,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1F;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;CACzC;AASD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,MAAM,GAAG,IAAI,CAEtE;AAED,wFAAwF;AACxF,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,GAAG,SAAS,CAEpF"}
@@ -1,20 +0,0 @@
1
- // ─── Axis 3 · lifecycle — WHO WRITES THE VALUE, AT WHICH MOMENT ────
2
- // Indexed by the write moment; reading is a key access and a switch on a named token,
3
- // never an interpreter. Declarative and named — never a closure, which would be a value
4
- // mutation invisible to adapters. Coercion is the `boundary` axis, not this one.
5
- /** The moments a value can be written at — the runtime list, from which the types derive. */
6
- export const CREATE_TOKENS = ['now', 'optional'];
7
- export const UPDATE_TOKENS = ['now', 'forbidden'];
8
- // ─── Generator registry ──────────────────────────────────
9
- // `registerGenerator('monId', fn)` → `primary({ generate: 'monId' })`. The built-in
10
- // presets live with the realization (`projections/lifecycle.ts`), which consults this
11
- // first — resolving them per adapter is what made two adapters honour `cuid2` differently.
12
- const generators = new Map();
13
- export function registerGenerator(name, fn) {
14
- generators.set(name, fn);
15
- }
16
- /** A registered custom generator, or undefined (built-in presets live storage-side). */
17
- export function resolveCustomGenerator(ref) {
18
- return generators.get(ref);
19
- }
20
- //# sourceMappingURL=lifecycle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/field/lifecycle.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sFAAsF;AACtF,wFAAwF;AACxF,iFAAiF;AASjF,6FAA6F;AAC7F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,UAAU,CAAU,CAAC;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,WAAW,CAAU,CAAC;AAiB3D,4DAA4D;AAC5D,oFAAoF;AACpF,sFAAsF;AACtF,2FAA2F;AAE3F,MAAM,UAAU,GAAG,IAAI,GAAG,EAAwB,CAAC;AAEnD,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,EAAgB;IAC9D,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,sBAAsB,CAAC,GAAiB;IACtD,OAAO,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC"}
@@ -1,5 +0,0 @@
1
- export interface Meta {
2
- /** Read by CLI help and carried by the card — that is the whole reach today. */
3
- description?: string;
4
- }
5
- //# sourceMappingURL=meta.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/field/meta.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,IAAI;IACnB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -1,5 +0,0 @@
1
- // ─── meta — the documentary compartment (NOT an axis) ────────────
2
- // Human-facing only. NO consumer ever DECIDES by reading meta — the axes govern
3
- // behaviour. Per-consumer specifics belong to `hints`.
4
- export {};
5
- //# sourceMappingURL=meta.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/field/meta.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,gFAAgF;AAChF,uDAAuD"}
@@ -1,47 +0,0 @@
1
- export type EntityConstructor = abstract new (...args: any[]) => any;
2
- /**
3
- * Normalize a relation target to a lazy thunk. A target may be given as the entity
4
- * class directly (`ref(Author)`) or as a thunk (`ref(() => Author)`) — the thunk
5
- * form is needed for circular/forward references, where the class isn't defined yet
6
- * when `entity({...})` is evaluated. An entity class is recognized by its static
7
- * `getFields`; anything else is treated as the thunk itself.
8
- */
9
- export declare function toTargetThunk<E extends EntityConstructor>(target: E | (() => E)): () => E;
10
- /** A relation's closed vocabularies — the runtime lists the types derive from. */
11
- export declare const RELATION_KINDS: readonly ['one', 'many'];
12
- export declare const ON_DELETE: readonly ['cascade', 'restrict', 'set null'];
13
- export interface Relation {
14
- to: () => EntityConstructor;
15
- kind: (typeof RELATION_KINDS)[number];
16
- onDelete?: (typeof ON_DELETE)[number];
17
- }
18
- export interface Role {
19
- primary?: boolean;
20
- /**
21
- * The constraints this field belongs to — one member list each. A lone `unique(slug)` is
22
- * the degenerate case, a set of one, so there is one shape and not two.
23
- *
24
- * **An empty list denotes the field carrying it** — it does not know its own key. A named
25
- * group comes from the entity's own declaration, where a fact about a pair belongs.
26
- * NEVER read a group directly: {@link uniqueMembers} is the accessor.
27
- *
28
- * `describe` resolves it on the way out, so a card always names its members. Keeping it
29
- * unresolved in memory is what makes `rename()` free: nothing to remap.
30
- */
31
- unique?: ReadonlyArray<ReadonlyArray<string>>;
32
- index?: boolean;
33
- relation?: Relation;
34
- }
35
- /**
36
- * The constraint a member list denotes, resolved against the field carrying it — the
37
- * accessor every reader of `role.unique` goes through.
38
- *
39
- * ```ts
40
- * uniqueMembers([], 'slug') // ['slug'] — the self-reference
41
- * uniqueMembers(['listId', 'docId'], 'docId') // ['listId','docId'] — already named
42
- * ```
43
- *
44
- * `ownKey` is the half the field is missing: iterate `Object.entries(getFields())`.
45
- */
46
- export declare function uniqueMembers(group: ReadonlyArray<string>, ownKey: string): string[];
47
- //# sourceMappingURL=role.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/field/role.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAErE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,iBAAiB,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAEzF;AAED,kFAAkF;AAClF,eAAO,MAAM,cAAc,YAAI,KAAK,EAAE,MAAM,CAAU,CAAC;AACvD,eAAO,MAAM,SAAS,YAAI,SAAS,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AAEtE,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,iBAAiB,CAAC;IAC5B,IAAI,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,IAAI;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAEpF"}
@@ -1,35 +0,0 @@
1
- // ─── Axis 2 · role — place in the entity graph ────────────
2
- // Identity and relations. Read by the storage and transport adapters, and by the judge:
3
- // `relation.kind === 'many'` makes an absent collection default to `[]`.
4
- //
5
- // `unique` and `index` are the only axis members realized OUTSIDE the framework — the DDL
6
- // emits them and the database enforces them, so a collision surfaces as the driver's
7
- // error, never as a `validate()` failure.
8
- /**
9
- * Normalize a relation target to a lazy thunk. A target may be given as the entity
10
- * class directly (`ref(Author)`) or as a thunk (`ref(() => Author)`) — the thunk
11
- * form is needed for circular/forward references, where the class isn't defined yet
12
- * when `entity({...})` is evaluated. An entity class is recognized by its static
13
- * `getFields`; anything else is treated as the thunk itself.
14
- */
15
- export function toTargetThunk(target) {
16
- return 'getFields' in target ? () => target : target;
17
- }
18
- /** A relation's closed vocabularies — the runtime lists the types derive from. */
19
- export const RELATION_KINDS = ['one', 'many'];
20
- export const ON_DELETE = ['cascade', 'restrict', 'set null'];
21
- /**
22
- * The constraint a member list denotes, resolved against the field carrying it — the
23
- * accessor every reader of `role.unique` goes through.
24
- *
25
- * ```ts
26
- * uniqueMembers([], 'slug') // ['slug'] — the self-reference
27
- * uniqueMembers(['listId', 'docId'], 'docId') // ['listId','docId'] — already named
28
- * ```
29
- *
30
- * `ownKey` is the half the field is missing: iterate `Object.entries(getFields())`.
31
- */
32
- export function uniqueMembers(group, ownKey) {
33
- return group.length === 0 ? [ownKey] : [...group];
34
- }
35
- //# sourceMappingURL=role.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"role.js","sourceRoot":"","sources":["../../src/field/role.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,wFAAwF;AACxF,yEAAyE;AACzE,EAAE;AACF,0FAA0F;AAC1F,qFAAqF;AACrF,0CAA0C;AAI1C;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAA8B,MAAqB;IAC9E,OAAO,WAAW,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAW,CAAC,CAAC,CAAE,MAAkB,CAAC;AACzE,CAAC;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU,CAAC;AACvD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AA0BtE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,KAA4B,EAAE,MAAc;IACxE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;AACpD,CAAC"}
@@ -1,89 +0,0 @@
1
- import type { StringFormat } from './format.js';
2
- /** A base type name, alone or in the nullable union form. */
3
- type Nullably<T extends string> = T | readonly [T, 'null'];
4
- interface StringConstraints {
5
- minLength?: number;
6
- maxLength?: number;
7
- pattern?: string;
8
- enum?: readonly (string | null)[];
9
- format?: StringFormat;
10
- }
11
- interface NumericConstraints {
12
- minimum?: number;
13
- maximum?: number;
14
- }
15
- interface ArrayConstraints {
16
- items?: Shape;
17
- minItems?: number;
18
- maxItems?: number;
19
- }
20
- interface ObjectConstraints {
21
- properties?: Record<string, unknown>;
22
- required?: readonly string[];
23
- }
24
- export type Shape = ({
25
- type: Nullably<'string'>;
26
- } & StringConstraints) | ({
27
- type: Nullably<'number'> | Nullably<'integer'>;
28
- } & NumericConstraints) | {
29
- type: Nullably<'boolean'>;
30
- } | ({
31
- type: Nullably<'array'>;
32
- } & ArrayConstraints) | ({
33
- type: Nullably<'object'>;
34
- } & ObjectConstraints);
35
- /**
36
- * The BASE type names — what `Anatomy.of(shape).base?.type` narrows to for a dispatch.
37
- *
38
- * The runtime list is the source and the type derives from it, not the reverse: a type
39
- * union cannot be enumerated at runtime, so writing both by hand means two lists that
40
- * drift. {@link isShape} needs the values, so it is the values that are declared.
41
- */
42
- export declare const SHAPE_TYPES: readonly ['string', 'number', 'integer', 'boolean', 'array', 'object'];
43
- export type ShapeType = (typeof SHAPE_TYPES)[number];
44
- /** Is this a shape? Asked of its `type`, against {@link SHAPE_TYPES}. */
45
- export declare function isShape(value: unknown): value is Shape;
46
- /**
47
- * `Shape` with `type` guaranteed scalar — what `anatomy` returns as `base`, the
48
- * ONLY form consumers dispatch on. A scalar literal is a real discriminant, so
49
- * `switch (base?.type)` narrows; the raw `Shape` union can't (the `[T,'null']`
50
- * tuple is not a unit type).
51
- */
52
- export type BaseShape = ({
53
- type: 'string';
54
- } & StringConstraints) | ({
55
- type: 'number' | 'integer';
56
- } & NumericConstraints) | {
57
- type: 'boolean';
58
- } | ({
59
- type: 'array';
60
- } & ArrayConstraints) | ({
61
- type: 'object';
62
- } & ObjectConstraints);
63
- /**
64
- * Write side: make a shape's grammar accept `null` — the type becomes the union
65
- * `[T, 'null']`, and `null` joins `enum` when present (an enum is a closed value
66
- * set; null must be IN it to be legal). Idempotent.
67
- */
68
- export declare function nullableShape(shape: Shape): Shape;
69
- /** A shape split back into its base grammar and its nullability. */
70
- export interface ShapeAnatomy {
71
- /** The shape stripped of `null` (scalar `type`, `enum` without null) — dispatch on THIS. */
72
- base?: BaseShape;
73
- nullable: boolean;
74
- }
75
- /**
76
- * The read side — the single customs post at the standard's border. Every consumer that
77
- * dispatches on a shape's type comes through here: `shape.type` may be the union
78
- * `[T,'null']`, and a direct comparison fails silently on it.
79
- */
80
- export declare class Anatomy {
81
- /** Cached per shape reference — derivations copy field refs, they never rebuild shapes. */
82
- private static readonly cache;
83
- private static readonly none;
84
- static of(shape?: Shape): ShapeAnatomy;
85
- /** Sugar for the most common read: does this shape's grammar accept `null`? */
86
- static isNullable(shape?: Shape): boolean;
87
- }
88
- export {};
89
- //# sourceMappingURL=shape.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../src/field/shape.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAwBhD,6DAA6D;AAC7D,KAAK,QAAQ,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAI3D,UAAU,iBAAiB;IAAG,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,YAAY,CAAA;CAAE;AAClJ,UAAU,kBAAkB;IAAG,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;AAOnE,UAAU,gBAAgB;IAAG,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE;AAIlF,UAAU,iBAAiB;IAAG,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,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AAM,IAAI,GAAG,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAe,CAAC;gBACvD,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;oBAC/B,IAA6C,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;gBAC5F,CAAC;gBACD,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YAC/B,CAAC;iBAAM,CAAC;gBACN,CAAC,GAAG,EAAE,IAAI,EAAE,KAAkB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;YACpD,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,+EAA+E;IAC/E,MAAM,CAAC,UAAU,CAAC,KAAa;QAC7B,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;IACjC,CAAC;CACF"}
package/dist/hints.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import type { Fields } from "./field/index.js";
2
- /**
3
- * Per-consumer hints — the escape hatch for what a neutral field cannot carry ("store
4
- * `body` as a `tsvector`"), which validation and the API ignore.
5
- *
6
- * EMPTY here: this package names no adapter. Each augments it from its own package, and
7
- * `K` — the entity's field-key union — constrains a hint's inner keys to real fields.
8
- *
9
- * ```ts
10
- * declare module '@fougere/schema' {
11
- * interface FougereHints<K extends string> {
12
- * sql?: Partial<Record<K, { columnType?: string; index?: string }>>;
13
- * }
14
- * }
15
- * ```
16
- */
17
- export interface FougereHints<K extends string> {
18
- }
19
- /** Keyed by registered adapter — an unknown adapter, field or option is refused at the call site. */
20
- export type Hints<TFields extends Fields> = {
21
- [A in keyof FougereHints<Extract<keyof TFields, string>>]?: FougereHints<Extract<keyof TFields, string>>[A];
22
- };
23
- /**
24
- * Carry hints across a key transform — a derivation preserves what it does not change.
25
- * `transform` maps an old key to its new name, or to `undefined` when the field is dropped.
26
- */
27
- export declare function deriveHints(hints: Hints<Fields> | undefined, transform: (key: string) => string | undefined): Hints<Fields> | undefined;
28
- //# sourceMappingURL=hints.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hints.d.ts","sourceRoot":"","sources":["../src/hints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM;CAAI;AAElD,qGAAqG;AACrG,MAAM,MAAM,KAAK,CAAC,OAAO,SAAS,MAAM,IAAI;KACzC,CAAC,IAAI,MAAM,YAAY,CAAC,OAAO,CAAC,MAAM,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,CACtE,OAAO,CAAC,MAAM,OAAO,EAAE,MAAM,CAAC,CAC/B,CAAC,CAAC,CAAC;CACL,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,EAChC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAC7C,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAa3B"}
package/dist/hints.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"hints.js","sourceRoot":"","sources":["../src/hints.ts"],"names":[],"mappings":"AA2BA;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,KAAgC,EAChC,SAA8C;IAE9C,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,GAAG,GAA4C,EAAE,CAAC;IACxD,KAAK,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,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