@grafctory/blue 0.0.0-stage → 0.16.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 (139) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +524 -2
  3. package/dist/boolean/assembler.d.ts +53 -0
  4. package/dist/boolean/assembler.d.ts.map +1 -0
  5. package/dist/boolean/assembler.js +78 -0
  6. package/dist/boolean/assembler.js.map +1 -0
  7. package/dist/boolean/index.d.ts +86 -0
  8. package/dist/boolean/index.d.ts.map +1 -0
  9. package/dist/boolean/index.js +99 -0
  10. package/dist/boolean/index.js.map +1 -0
  11. package/dist/boolean/validator.d.ts +30 -0
  12. package/dist/boolean/validator.d.ts.map +1 -0
  13. package/dist/boolean/validator.js +68 -0
  14. package/dist/boolean/validator.js.map +1 -0
  15. package/dist/dictionary/assembler.d.ts +70 -0
  16. package/dist/dictionary/assembler.d.ts.map +1 -0
  17. package/dist/dictionary/assembler.js +178 -0
  18. package/dist/dictionary/assembler.js.map +1 -0
  19. package/dist/dictionary/index.d.ts +237 -0
  20. package/dist/dictionary/index.d.ts.map +1 -0
  21. package/dist/dictionary/index.js +43 -0
  22. package/dist/dictionary/index.js.map +1 -0
  23. package/dist/dictionary/inference.d.ts +42 -0
  24. package/dist/dictionary/inference.d.ts.map +1 -0
  25. package/dist/dictionary/inference.js +17 -0
  26. package/dist/dictionary/inference.js.map +1 -0
  27. package/dist/dictionary/validator.d.ts +37 -0
  28. package/dist/dictionary/validator.d.ts.map +1 -0
  29. package/dist/dictionary/validator.js +106 -0
  30. package/dist/dictionary/validator.js.map +1 -0
  31. package/dist/index.core.d.ts +33 -0
  32. package/dist/index.core.d.ts.map +1 -0
  33. package/dist/index.core.js +149 -0
  34. package/dist/index.core.js.map +1 -0
  35. package/dist/index.d.ts +333 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +378 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/number/assembler.d.ts +70 -0
  40. package/dist/number/assembler.d.ts.map +1 -0
  41. package/dist/number/assembler.js +188 -0
  42. package/dist/number/assembler.js.map +1 -0
  43. package/dist/number/index.d.ts +329 -0
  44. package/dist/number/index.d.ts.map +1 -0
  45. package/dist/number/index.js +312 -0
  46. package/dist/number/index.js.map +1 -0
  47. package/dist/number/validator.d.ts +31 -0
  48. package/dist/number/validator.d.ts.map +1 -0
  49. package/dist/number/validator.js +57 -0
  50. package/dist/number/validator.js.map +1 -0
  51. package/dist/reference/accessors.d.ts +29 -0
  52. package/dist/reference/accessors.d.ts.map +1 -0
  53. package/dist/reference/accessors.js +38 -0
  54. package/dist/reference/accessors.js.map +1 -0
  55. package/dist/reference/assembler.d.ts +63 -0
  56. package/dist/reference/assembler.d.ts.map +1 -0
  57. package/dist/reference/assembler.js +127 -0
  58. package/dist/reference/assembler.js.map +1 -0
  59. package/dist/reference/index.d.ts +108 -0
  60. package/dist/reference/index.d.ts.map +1 -0
  61. package/dist/reference/index.js +40 -0
  62. package/dist/reference/index.js.map +1 -0
  63. package/dist/reference/validator.d.ts +33 -0
  64. package/dist/reference/validator.d.ts.map +1 -0
  65. package/dist/reference/validator.js +56 -0
  66. package/dist/reference/validator.js.map +1 -0
  67. package/dist/resource/accessors.d.ts +140 -0
  68. package/dist/resource/accessors.d.ts.map +1 -0
  69. package/dist/resource/accessors.js +173 -0
  70. package/dist/resource/accessors.js.map +1 -0
  71. package/dist/resource/assembler.d.ts +265 -0
  72. package/dist/resource/assembler.d.ts.map +1 -0
  73. package/dist/resource/assembler.js +816 -0
  74. package/dist/resource/assembler.js.map +1 -0
  75. package/dist/resource/index.d.ts +903 -0
  76. package/dist/resource/index.d.ts.map +1 -0
  77. package/dist/resource/index.js +160 -0
  78. package/dist/resource/index.js.map +1 -0
  79. package/dist/resource/inference.d.ts +310 -0
  80. package/dist/resource/inference.d.ts.map +1 -0
  81. package/dist/resource/inference.js +17 -0
  82. package/dist/resource/inference.js.map +1 -0
  83. package/dist/resource/validator.d.ts +158 -0
  84. package/dist/resource/validator.d.ts.map +1 -0
  85. package/dist/resource/validator.js +1013 -0
  86. package/dist/resource/validator.js.map +1 -0
  87. package/dist/string/assembler.d.ts +69 -0
  88. package/dist/string/assembler.d.ts.map +1 -0
  89. package/dist/string/assembler.js +143 -0
  90. package/dist/string/assembler.js.map +1 -0
  91. package/dist/string/index.d.ts +431 -0
  92. package/dist/string/index.d.ts.map +1 -0
  93. package/dist/string/index.js +528 -0
  94. package/dist/string/index.js.map +1 -0
  95. package/dist/string/validator.d.ts +30 -0
  96. package/dist/string/validator.d.ts.map +1 -0
  97. package/dist/string/validator.js +69 -0
  98. package/dist/string/validator.js.map +1 -0
  99. package/dist/union/accessors.d.ts +137 -0
  100. package/dist/union/accessors.d.ts.map +1 -0
  101. package/dist/union/accessors.js +253 -0
  102. package/dist/union/accessors.js.map +1 -0
  103. package/dist/union/assembler.d.ts +56 -0
  104. package/dist/union/assembler.d.ts.map +1 -0
  105. package/dist/union/assembler.js +140 -0
  106. package/dist/union/assembler.js.map +1 -0
  107. package/dist/union/index.d.ts +172 -0
  108. package/dist/union/index.d.ts.map +1 -0
  109. package/dist/union/index.js +45 -0
  110. package/dist/union/index.js.map +1 -0
  111. package/dist/union/inference.d.ts +30 -0
  112. package/dist/union/inference.d.ts.map +1 -0
  113. package/dist/union/inference.js +17 -0
  114. package/dist/union/inference.js.map +1 -0
  115. package/dist/union/validator.d.ts +94 -0
  116. package/dist/union/validator.d.ts.map +1 -0
  117. package/dist/union/validator.js +171 -0
  118. package/dist/union/validator.js.map +1 -0
  119. package/dist/value/accessors.d.ts +151 -0
  120. package/dist/value/accessors.d.ts.map +1 -0
  121. package/dist/value/accessors.js +468 -0
  122. package/dist/value/accessors.js.map +1 -0
  123. package/dist/value/assembler.d.ts +129 -0
  124. package/dist/value/assembler.d.ts.map +1 -0
  125. package/dist/value/assembler.js +248 -0
  126. package/dist/value/assembler.js.map +1 -0
  127. package/dist/value/index.d.ts +309 -0
  128. package/dist/value/index.d.ts.map +1 -0
  129. package/dist/value/index.js +26 -0
  130. package/dist/value/index.js.map +1 -0
  131. package/dist/value/inference.d.ts +292 -0
  132. package/dist/value/inference.d.ts.map +1 -0
  133. package/dist/value/inference.js +17 -0
  134. package/dist/value/inference.js.map +1 -0
  135. package/dist/value/validator.d.ts +76 -0
  136. package/dist/value/validator.d.ts.map +1 -0
  137. package/dist/value/validator.js +111 -0
  138. package/dist/value/validator.js.map +1 -0
  139. package/package.json +95 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resource/index.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4JG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EACN,aAAa,EACb,eAAe,EACf,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,KAAK,KAAK,EACV,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,MAAM,aAAa,CAC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3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { assemble, declare } from "./assembler.js";
17
+ export { getShapeClass, getShapeClasses, getShapeId, getShapeType, getShapeProperties, getStateId, getStateEntries } from "./accessors.js";
18
+ /**
19
+ * Creates a resource shape.
20
+ */
21
+ export function resource(...args) {
22
+ return assemble(args);
23
+ }
24
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
25
+ /**
26
+ * Creates the member naming a resource.
27
+ *
28
+ * Marks the member it is declared under as carrying the resource's identifier, mapping it to the JSON-LD `@id`
29
+ * keyword. A shape states at most one, counted once inheritance has merged the members: a marker reaching the shape
30
+ * under one name through several parents, or redeclared over an inherited one, is a single member, while two markers
31
+ * under distinct names are rejected.
32
+ *
33
+ * @param constraints Optional member constraints
34
+ * @param constraints.hidden Excludes the member from default serialisation
35
+ *
36
+ * @returns An immutable member naming the resource
37
+ *
38
+ * @see {@link https://www.w3.org/TR/json-ld11/#node-identifiers JSON-LD 1.1 § 3.3 Node Identifiers}
39
+ */
40
+ export function id(constraints = {}) {
41
+ return declare({ kind: "id", ...constraints });
42
+ }
43
+ /**
44
+ * Creates the member typing a resource.
45
+ *
46
+ * Marks the member it is declared under as carrying the resource's class, mapping it to the JSON-LD `@type` keyword.
47
+ * The value is derived from the {@link ResourceConstraints.class | class} the shape states, so the member is active
48
+ * only on a shape stating one and a shape stating none rejects every value supplied for it: a shared supershape may
49
+ * thus declare the member once for the shapes extending it, each activating it by stating a class of its own. A shape
50
+ * states at most one, counted as {@link id} is.
51
+ *
52
+ * @param constraints Optional member constraints
53
+ * @param constraints.hidden Excludes the member from default serialisation
54
+ *
55
+ * @returns An immutable member typing the resource
56
+ *
57
+ * @see {@link https://www.w3.org/TR/json-ld11/#specifying-the-type JSON-LD 1.1 § 3.5 Specifying the Type}
58
+ */
59
+ export function type(constraints = {}) {
60
+ return declare({ kind: "type", ...constraints });
61
+ }
62
+ /**
63
+ * Creates a member carrying any number of values.
64
+ *
65
+ * @typeParam R The shape the values are drawn from
66
+ * @typeParam C The stated constraints
67
+ *
68
+ * @param range The shape the values are drawn from, possibly deferred to break definition cycles
69
+ * @param constraints Optional member {@link PropertyConstraints constraints}
70
+ *
71
+ * @returns An immutable member admitting any number of values of `range`
72
+ */
73
+ export function multiple(range, constraints) {
74
+ return member(range, constraints, undefined, undefined);
75
+ }
76
+ /**
77
+ * Creates a member carrying at least one value.
78
+ *
79
+ * @typeParam R The shape the values are drawn from
80
+ * @typeParam C The stated constraints
81
+ *
82
+ * @param range The shape the values are drawn from, possibly deferred to break definition cycles
83
+ * @param constraints Optional member {@link PropertyConstraints constraints}
84
+ *
85
+ * @returns An immutable member requiring at least one value of `range`
86
+ */
87
+ export function nonempty(range, constraints) {
88
+ return member(range, constraints, 1, undefined);
89
+ }
90
+ /**
91
+ * Creates a member carrying at most one value.
92
+ *
93
+ * @typeParam R The shape the value is drawn from
94
+ * @typeParam C The stated constraints
95
+ *
96
+ * @param range The shape the value is drawn from, possibly deferred to break definition cycles
97
+ * @param constraints Optional member {@link PropertyConstraints constraints}
98
+ *
99
+ * @returns An immutable member admitting at most one value of `range`
100
+ */
101
+ export function optional(range, constraints) {
102
+ return member(range, constraints, undefined, 1);
103
+ }
104
+ /**
105
+ * Creates a member carrying exactly one value.
106
+ *
107
+ * @typeParam R The shape the value is drawn from
108
+ * @typeParam C The stated constraints
109
+ *
110
+ * @param range The shape the value is drawn from, possibly deferred to break definition cycles
111
+ * @param constraints Optional member {@link PropertyConstraints constraints}
112
+ *
113
+ * @returns An immutable member requiring exactly one value of `range`
114
+ */
115
+ export function required(range, constraints) {
116
+ return member(range, constraints, 1, 1);
117
+ }
118
+ /**
119
+ * Creates a member carrying a stated number of values.
120
+ *
121
+ * Reads the cardinality off the `minCount` and `maxCount` the {@link PropertyBounds | constraints} state, for the
122
+ * bounds the four named factories leave uncovered; a bound left unstated leaves that end unbounded. The bounds are
123
+ * carried by the range of the built {@link Property | property} alone, not restated beside its other constraints.
124
+ *
125
+ * @typeParam R The shape the values are drawn from
126
+ * @typeParam C The stated constraints and cardinality bounds
127
+ *
128
+ * @param range The shape the values are drawn from, possibly deferred to break definition cycles
129
+ * @param constraints Optional member {@link PropertyBounds constraints and bounds}
130
+ *
131
+ * @returns An immutable member admitting the stated number of values of `range`
132
+ *
133
+ * @throws {@link !TypeError TypeError} Where a bound is stated as a negative number, or the bounds cross, admitting no
134
+ * value at all
135
+ *
136
+ * @example
137
+ *
138
+ * ```typescript
139
+ * const Product = resource({
140
+ * tags: property(string(), { minCount: 2, maxCount: 5 })
141
+ * });
142
+ * ```
143
+ */
144
+ export function property(range, constraints) {
145
+ return member(range, constraints, constraints?.minCount, constraints?.maxCount);
146
+ }
147
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
148
+ /**
149
+ * Declares the member a cardinality factory states, at the bounds it fixes.
150
+ */
151
+ function member(shape, constraints, minCount, maxCount) {
152
+ // the bounds a caller states alongside the constraints are carried by the range alone
153
+ const { minCount: _stated, maxCount: _bound, ...stated } = constraints ?? {};
154
+ return declare({
155
+ kind: "property",
156
+ ...stated,
157
+ range: { minCount, maxCount, shape }
158
+ });
159
+ }
160
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resource/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAqKH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,EACN,aAAa,EACb,eAAe,EACf,UAAU,EACV,YAAY,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H,MAAM,UAAU,QAAQ,CAIvB,KAAQ,EAAE,WAAe;IAGzB,OAAO,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AAEjF,CAAC;AAGD,wHAAwH;AAExH;;GAEG;AACH,SAAS,MAAM,CACd,KAAkB,EAClB,WAAqC,EACrC,QAA0B,EAC1B,QAA0B;IAG1B,sFAAsF;IAEtF,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,WAAW,IAAI,EAAE,CAAC;IAE7E,OAAO,OAAO,CAAC;QAEd,IAAI,EAAE,UAAU;QAEhB,GAAG,MAAM;QAET,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE;KAEpC,CAAC,CAAC;AAEJ,CAAC"}
@@ -0,0 +1,310 @@
1
+ /**
2
+ * Resource type inference.
3
+ *
4
+ * Resolves the state a resource carries, merging the members a shape declares over the ones it inherits and mapping
5
+ * each to the form its range and cardinality admit, so that a resource type and the shape describing it cannot drift,
6
+ * and singles out the members it carries as its identifier or as arrays of values.
7
+ *
8
+ * @module
9
+ */
10
+ import type { Eager, Lazy, Optional } from "@grafctory/core";
11
+ import type { Reference } from "@grafctory/qest/state";
12
+ import type { DictionaryShape } from "../dictionary/index.js";
13
+ import type { ReferenceShape } from "../reference/index.js";
14
+ import type { Variant } from "../union/inference.js";
15
+ import type { Shape, State } from "../value/index.js";
16
+ import type { Id, Parents, Property, PropertyBounds, ResourceShape, Type } from "./index.js";
17
+ /**
18
+ * Resolves the members a resource carries.
19
+ *
20
+ * Returns the members the shape declares merged over the ones it inherits, and no member at all for a shape that
21
+ * describes something other than a resource. A declared member restricting every definition it overrides is kept,
22
+ * and any other is voided, so an extending resource may tighten what it inherits but never relax it.
23
+ *
24
+ * @typeParam S The describing shape, possibly deferred to break definition cycles
25
+ */
26
+ export type Carried<S extends Lazy<Shape>> = Eager<S> extends ResourceShape<infer P, infer M> ? Merged<P, M> : {};
27
+ /**
28
+ * Resolves the name of the member a resource carries as its identifier.
29
+ *
30
+ * Yields the carried member, declared or inherited, holding the IRI of the resource itself, so that the state of a
31
+ * resource to be persisted can leave it out where the target of the operation identifies the resource or the store
32
+ * assigns it. A shape declaring no identifier names no member.
33
+ *
34
+ * @typeParam S The describing shape, possibly deferred to break definition cycles
35
+ */
36
+ export type Identifier<S extends Lazy<ResourceShape>> = {
37
+ [field in keyof Carried<S>]: Carried<S>[field] extends {
38
+ readonly kind: "id";
39
+ } ? field : never;
40
+ }[keyof Carried<S>];
41
+ /**
42
+ * Resolves the names of the members a resource carries as an array of values.
43
+ *
44
+ * Yields the carried members, declared or inherited, whose values an instance holds as an array, so that an argument
45
+ * naming a collection of items can be constrained to the members able to hold one. A member admitting at most one
46
+ * value, one carrying localised text, which is held as a tag-keyed map, and one voided by a conflicting override are
47
+ * never named.
48
+ *
49
+ * @typeParam S The describing shape, possibly deferred to break definition cycles
50
+ */
51
+ export type Repeated<S extends Lazy<Shape>> = {
52
+ [field in keyof Carried<S> & string]: Arrayed<Carried<S>[field]> extends true ? field : never;
53
+ }[keyof Carried<S> & string];
54
+ /**
55
+ * Checks whether a member holds its values as an array.
56
+ *
57
+ * Yields `true` for a property whose content, where present, is always an array, and `false` for any other member,
58
+ * a voided one included.
59
+ *
60
+ * @typeParam M The member to check
61
+ */
62
+ export type Arrayed<M> = [
63
+ M
64
+ ] extends [never] ? false : [Exclude<Content<M>, undefined>] extends [readonly unknown[]] ? true : false;
65
+ /**
66
+ * Resolves the value an instance of a resource carries.
67
+ *
68
+ * Maps every member the shape carries to its content, leaving optional the ones a resource may leave out.
69
+ *
70
+ * @typeParam S The describing shape, possibly deferred to break definition cycles
71
+ */
72
+ export type Retrieved<S extends Lazy<Shape>> = Loose<Carried<S>> extends infer M ? {
73
+ readonly [field in keyof M]: Content<M[field]>;
74
+ } : never;
75
+ /**
76
+ * Marks optional the members a resource may leave out.
77
+ *
78
+ * Yields the members as they stand, optional where a resource may leave them out, so that a value mapped over them
79
+ * requires exactly the members the resource is bound to carry.
80
+ *
81
+ * @typeParam M The members to mark
82
+ */
83
+ export type Loose<M> = Joined<{
84
+ readonly [field in keyof M as Omitted<M[field]> extends true ? never : field]: M[field];
85
+ } & {
86
+ readonly [field in keyof M as Omitted<M[field]> extends true ? field : never]?: M[field];
87
+ }>;
88
+ /**
89
+ * Joins the parts of a record into a single one.
90
+ *
91
+ * Yields one record carrying every member the parts declare, with its modifiers, so that a resource resolved from
92
+ * required and optional members reads and compares as one type rather than as an intersection.
93
+ *
94
+ * @typeParam T The parts to join
95
+ */
96
+ export type Joined<T> = {
97
+ [field in keyof T]: T[field];
98
+ };
99
+ /**
100
+ * Resolves the value a member carries in an instance.
101
+ *
102
+ * Yields an IRI for an identifier, an optional IRI for a type and, for a property, the
103
+ * {@link Slot | form its range and cardinality admit}. A voided member carries no value at all, so a conflicting
104
+ * override reads as a member nothing satisfies.
105
+ *
106
+ * @typeParam M The member to resolve
107
+ */
108
+ export type Content<M> = M extends Id ? Reference : M extends Type ? Optional<Reference> : M extends Property<infer R, infer L, infer U> ? Slot<R, L, U> : never;
109
+ /**
110
+ * Resolves the form a property carries its values in, holding localised text apart.
111
+ *
112
+ * Yields the {@link Arity | arity} form of the values a range describes, except that localised text is carried whole:
113
+ * a language map holds its strings per tag at the arity its own shape states, so it is never wrapped in an array and
114
+ * never sits in one beside the values of sibling branches. A range admitting localised text alone reads as the bare
115
+ * map, whatever the upper bound; one admitting it beside other branches reads as either the map or the arity form of
116
+ * the other values, as a resource carries one or the other and never both. Either form is optional where the lower
117
+ * bound lets the property be left out.
118
+ *
119
+ * The map is the form localised text is stored in. A retrieval asking for the text coalesced passes the negotiated
120
+ * form as `T` instead, and that form takes the place of the map under the same arity rules.
121
+ *
122
+ * @typeParam R The range describing the values, possibly deferred to break definition cycles
123
+ * @typeParam L The least number of values admitted
124
+ * @typeParam U The greatest number of values admitted
125
+ * @typeParam T The form localised text is carried in, defaulting to the tag-keyed map the range describes
126
+ */
127
+ export type Slot<R extends Lazy<Shape>, L extends Optional<number>, U extends Optional<number>, T = State<Localised<R>>> = [
128
+ R
129
+ ] extends [never] ? never : [Localised<R>] extends [never] ? Arity<State<R>, L, U> : [Valued<R>] extends [never] ? Arity<T, L, 1> : Arity<State<Valued<R>>, L, U> | Arity<T, L, 1>;
130
+ /**
131
+ * Resolves the form a value takes at the arity its bounds admit.
132
+ *
133
+ * Yields a bare value where the range admits at most one, an array otherwise, marking the form optional unless at
134
+ * least one value is known to be required. Bounds beyond the four the cardinality factories name are honoured all
135
+ * the same, so a lower bound of two admits the same non-empty form as one.
136
+ *
137
+ * @typeParam V The value the range describes
138
+ * @typeParam L The least number of values admitted
139
+ * @typeParam U The greatest number of values admitted
140
+ */
141
+ export type Arity<V, L extends Optional<number>, U extends Optional<number>> = Skippable<L> extends true ? Optional<[U] extends [1] ? V : readonly V[]> : [U] extends [1] ? V : readonly [V, ...V[]];
142
+ /**
143
+ * Checks whether a lower bound lets the values be left out.
144
+ *
145
+ * Yields `true` unless at least one value is known to be required, so a bound stated as zero and a bound left
146
+ * unstated both admit absence, as does one stated only as a number.
147
+ *
148
+ * @typeParam L The least number of values admitted
149
+ */
150
+ export type Skippable<L extends Optional<number>> = [
151
+ Extract<Optional<0>, L>
152
+ ] extends [never] ? false : true;
153
+ /**
154
+ * Resolves a cardinality bound stated in a constraints object.
155
+ *
156
+ * Yields the bound where the object states one and `undefined` where it does not, so a property built from
157
+ * constraints carries the bounds it was given rather than the widest ones.
158
+ *
159
+ * @typeParam C The stated constraints
160
+ * @typeParam K The bound to resolve
161
+ */
162
+ export type Declared<C extends PropertyBounds, K extends keyof PropertyBounds> = K extends keyof C ? C[K] : undefined;
163
+ /**
164
+ * Resolves the constraints a property carries in its own right.
165
+ *
166
+ * Yields the stated constraints stripped of the cardinality bounds, which the range of the built property carries
167
+ * alone, so a property built from constraints restates no bound beside its range.
168
+ *
169
+ * @typeParam C The stated constraints
170
+ */
171
+ export type Unbounded<C extends PropertyBounds> = [
172
+ Exclude<keyof C, "minCount" | "maxCount">
173
+ ] extends [never] ? {} : Omit<C, "minCount" | "maxCount">;
174
+ /**
175
+ * Merges declared members over inherited ones.
176
+ *
177
+ * Returns one record carrying the declared members and every member the extended shapes state, so a constraint stated
178
+ * anywhere up the chain reaches every extending resource. A resource the extending shape admits is an instance of
179
+ * each extended shape. An undeclared member therefore takes the {@link Narrowest | narrowest} inherited definition.
180
+ * A declared member is kept if it {@link Restricts | restricts} every inherited definition and voided otherwise. The
181
+ * result never depends on the order the shapes are listed in, and a conflict surfaces where the state is resolved.
182
+ *
183
+ * @typeParam P The extended shapes, possibly deferred to break definition cycles
184
+ * @typeParam M The members the extending resource declares in its own right
185
+ */
186
+ type Merged<P extends Parents, M> = {
187
+ readonly [field in Fields<Extended<P>> | keyof M]: field extends keyof M ? Restricts<M[field], Stated<Extended<P>, field>> extends true ? M[field] : never : Narrowest<Stated<Extended<P>, field>>;
188
+ };
189
+ /**
190
+ * Resolves the shapes in a list of extended shapes.
191
+ *
192
+ * Returns the listed shapes as a union. A list of unknown length, as the generic resource shape states, resolves to
193
+ * `never`, so a generic shape carries the members it declares rather than an endless inheritance chain.
194
+ *
195
+ * @typeParam P The extended shapes, possibly deferred to break definition cycles
196
+ */
197
+ type Extended<P extends Parents> = number extends P["length"] ? never : P[number];
198
+ /**
199
+ * Resolves the names of the members a set of extended shapes states.
200
+ *
201
+ * Returns, as a union, the names of the members each shape declares or inherits. The names are read off the
202
+ * declarations rather than off the {@link Carried | carried} members: the carried record is keyed on this very
203
+ * resolution, so reading the names off that record would make the type circular.
204
+ *
205
+ * @typeParam S The extended shapes, as a union each member of which is read on its own
206
+ */
207
+ type Fields<S extends Lazy<ResourceShape>> = S extends unknown ? Eager<S> extends ResourceShape<infer P, infer M> ? keyof M | Fields<Extended<P>> : never : never;
208
+ /**
209
+ * Resolves the definitions a set of extended shapes states for a member.
210
+ *
211
+ * Returns, as a union, the member each shape declares or inherits under the name. The result is `never` if no
212
+ * extended shape carries a member under that name, as for a member the extending shape declares on its own.
213
+ *
214
+ * @typeParam S The extended shapes, as a union each member of which is read on its own
215
+ * @typeParam F The name of the member
216
+ */
217
+ type Stated<S extends Lazy<ResourceShape>, F extends PropertyKey> = S extends unknown ? F extends keyof Carried<S> ? Carried<S>[F] : never : never;
218
+ /**
219
+ * Selects, among the definitions stated for a member, the ones restricting all the others.
220
+ *
221
+ * Returns each definition that {@link Restricts | restricts} every other one, so definitions the shapes agree on
222
+ * resolve to the one they share. The result is `never` if no definition restricts all the others, for instance where
223
+ * two shapes link unrelated targets and the extending shape leaves the member undeclared.
224
+ *
225
+ * @typeParam D The definitions stated for the member, as a union
226
+ * @typeParam C The candidate definitions, each tested on its own; defaults to `D` and is never passed explicitly
227
+ */
228
+ type Narrowest<D, C = D> = C extends unknown ? Restricts<C, D> extends true ? C : never : never;
229
+ /**
230
+ * Checks whether a member restricts every one of a set of definitions.
231
+ *
232
+ * Returns `true` if, for each definition, the {@link Outline | outline} of the member is assignable to the outline of
233
+ * the definition and, where the definition links to a resource, the member target {@link Descends | descends} from
234
+ * the definition target, as the shape factory requires of a re-pointed link. An empty set of definitions, as for a
235
+ * member no extended shape states, is always restricted, so a member new to the extending shape is kept as stated.
236
+ *
237
+ * @typeParam M The member held to the definitions
238
+ * @typeParam D The definitions, as a union each member of which the member is held to on its own
239
+ */
240
+ type Restricts<M, D> = false extends (D extends unknown ? Outline<M> extends Outline<D> ? [Linked<D>] extends [never] ? true : Descends<Linked<M>, Linked<D>> : false : never) ? false : true;
241
+ /**
242
+ * Resolves the outline a member may be narrowed within.
243
+ *
244
+ * Returns, for a property, the kind of its range in the form its cardinality admits, and an identifier or a type as
245
+ * it stands. Link targets aside, a member restricts another exactly when its outline is assignable to the other's.
246
+ * The outline keeps the range kind, telling apart two ranges that project the same state. It also ensures a required
247
+ * value is never made optional and a repeated property is never capped at a single value, which would swap an array
248
+ * for a bare value wherever the state of the extending resource is read or written.
249
+ *
250
+ * @typeParam M The member to outline
251
+ */
252
+ type Outline<M> = M extends Property<infer R, infer L, infer U> ? Arity<Eager<R>["kind"], L, U> : M;
253
+ /**
254
+ * Resolves the resource a member links to.
255
+ *
256
+ * Returns the target of a property ranging over a link, possibly deferred to break definition cycles, and `never` for
257
+ * any other member. An embedded resource resolves to `never` as well, as it stands in no extension chain of its own.
258
+ *
259
+ * @typeParam M The member to reach through
260
+ */
261
+ type Linked<M> = M extends Property<infer R> ? Eager<R> extends ReferenceShape<infer T> ? T : never : never;
262
+ /**
263
+ * Checks whether a resource shape descends from another.
264
+ *
265
+ * Returns `true` if the wider shape is the narrower one itself or one of its {@link Ancestors | ancestors}, so a link
266
+ * re-pointed at the narrower shape admits only resources the wider one admits as well.
267
+ *
268
+ * @typeParam N The narrower shape, possibly deferred to break definition cycles
269
+ * @typeParam W The wider shape, possibly deferred to break definition cycles
270
+ */
271
+ type Descends<N extends Lazy<ResourceShape>, W extends Lazy<ResourceShape>> = [
272
+ Extract<Ancestors<N>, Eager<W>>
273
+ ] extends [never] ? false : true;
274
+ /**
275
+ * Resolves the shapes a resource shape descends from.
276
+ *
277
+ * Returns, as a union, the shape itself and every shape it extends, directly or transitively.
278
+ *
279
+ * @typeParam S The shape, possibly deferred to break definition cycles, or a union of shapes each read on its own
280
+ */
281
+ type Ancestors<S extends Lazy<ResourceShape>> = S extends unknown ? Eager<S> | Ancestors<Extended<Eager<S>["parents"]>> : never;
282
+ /**
283
+ * Checks whether a member may be left out of a resource.
284
+ *
285
+ * Yields `true` for a type and for a property whose lower bound is skippable, so that a resource states only the
286
+ * members it is bound to carry. A voided member is never left out, so that a conflict surfaces where the state is
287
+ * resolved.
288
+ *
289
+ * @typeParam M The member to check
290
+ */
291
+ type Omitted<M> = [
292
+ M
293
+ ] extends [never] ? false : M extends Type ? true : M extends Property<Lazy<Shape>, infer L, Optional<number>> ? Skippable<L> : false;
294
+ /**
295
+ * Resolves the alternatives of a range carrying localised text.
296
+ *
297
+ * Resolves to the dictionary shapes among the variants of the range, and to `never` for a range admitting no localised
298
+ * text, so the localised part of a range can be typed apart from the other values it admits.
299
+ *
300
+ * @typeParam R The range describing the values, possibly deferred to break definition cycles
301
+ */
302
+ export type Localised<R extends Lazy<Shape>> = Extract<Variant<R>, DictionaryShape>;
303
+ /**
304
+ * Resolves the alternatives of a range carrying anything but localised text.
305
+ *
306
+ * @typeParam R The range describing the values, possibly deferred to break definition cycles
307
+ */
308
+ type Valued<R extends Lazy<Shape>> = Exclude<Variant<R>, DictionaryShape>;
309
+ export {};
310
+ //# sourceMappingURL=inference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../src/resource/inference.ts"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAK7F;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,IACxC,KAAK,CAAC,CAAC,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG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,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI,CAAA;AAEjE;;;;;;GAMG;AACH,KAAK,SAAS,CAAC,CAAC,SAAS,IAAI,CAAC,aAAa,CAAC,IAC3C,CAAC,SAAS,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;AAEhF;;;;;;;;GAQG;AACH,KAAK,OAAO,CAAC,CAAC,IACb;IAAC,CAAC;CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GACxB,CAAC,SAAS,IAAI,GAAG,IAAI,GACpB,CAAC,SAAS,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GACxE,KAAK,CAAA;AAEX;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,IAC1C,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAA;AAErC;;;;GAIG;AACH,KAAK,MAAM,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,IAChC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAA"}
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright © 2025-2026 Metreeca srl
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
17
+ //# sourceMappingURL=inference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inference.js","sourceRoot":"","sources":["../../src/resource/inference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}