@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.
- package/LICENSE +201 -0
- package/README.md +524 -2
- package/dist/boolean/assembler.d.ts +53 -0
- package/dist/boolean/assembler.d.ts.map +1 -0
- package/dist/boolean/assembler.js +78 -0
- package/dist/boolean/assembler.js.map +1 -0
- package/dist/boolean/index.d.ts +86 -0
- package/dist/boolean/index.d.ts.map +1 -0
- package/dist/boolean/index.js +99 -0
- package/dist/boolean/index.js.map +1 -0
- package/dist/boolean/validator.d.ts +30 -0
- package/dist/boolean/validator.d.ts.map +1 -0
- package/dist/boolean/validator.js +68 -0
- package/dist/boolean/validator.js.map +1 -0
- package/dist/dictionary/assembler.d.ts +70 -0
- package/dist/dictionary/assembler.d.ts.map +1 -0
- package/dist/dictionary/assembler.js +178 -0
- package/dist/dictionary/assembler.js.map +1 -0
- package/dist/dictionary/index.d.ts +237 -0
- package/dist/dictionary/index.d.ts.map +1 -0
- package/dist/dictionary/index.js +43 -0
- package/dist/dictionary/index.js.map +1 -0
- package/dist/dictionary/inference.d.ts +42 -0
- package/dist/dictionary/inference.d.ts.map +1 -0
- package/dist/dictionary/inference.js +17 -0
- package/dist/dictionary/inference.js.map +1 -0
- package/dist/dictionary/validator.d.ts +37 -0
- package/dist/dictionary/validator.d.ts.map +1 -0
- package/dist/dictionary/validator.js +106 -0
- package/dist/dictionary/validator.js.map +1 -0
- package/dist/index.core.d.ts +33 -0
- package/dist/index.core.d.ts.map +1 -0
- package/dist/index.core.js +149 -0
- package/dist/index.core.js.map +1 -0
- package/dist/index.d.ts +333 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +378 -0
- package/dist/index.js.map +1 -0
- package/dist/number/assembler.d.ts +70 -0
- package/dist/number/assembler.d.ts.map +1 -0
- package/dist/number/assembler.js +188 -0
- package/dist/number/assembler.js.map +1 -0
- package/dist/number/index.d.ts +329 -0
- package/dist/number/index.d.ts.map +1 -0
- package/dist/number/index.js +312 -0
- package/dist/number/index.js.map +1 -0
- package/dist/number/validator.d.ts +31 -0
- package/dist/number/validator.d.ts.map +1 -0
- package/dist/number/validator.js +57 -0
- package/dist/number/validator.js.map +1 -0
- package/dist/reference/accessors.d.ts +29 -0
- package/dist/reference/accessors.d.ts.map +1 -0
- package/dist/reference/accessors.js +38 -0
- package/dist/reference/accessors.js.map +1 -0
- package/dist/reference/assembler.d.ts +63 -0
- package/dist/reference/assembler.d.ts.map +1 -0
- package/dist/reference/assembler.js +127 -0
- package/dist/reference/assembler.js.map +1 -0
- package/dist/reference/index.d.ts +108 -0
- package/dist/reference/index.d.ts.map +1 -0
- package/dist/reference/index.js +40 -0
- package/dist/reference/index.js.map +1 -0
- package/dist/reference/validator.d.ts +33 -0
- package/dist/reference/validator.d.ts.map +1 -0
- package/dist/reference/validator.js +56 -0
- package/dist/reference/validator.js.map +1 -0
- package/dist/resource/accessors.d.ts +140 -0
- package/dist/resource/accessors.d.ts.map +1 -0
- package/dist/resource/accessors.js +173 -0
- package/dist/resource/accessors.js.map +1 -0
- package/dist/resource/assembler.d.ts +265 -0
- package/dist/resource/assembler.d.ts.map +1 -0
- package/dist/resource/assembler.js +816 -0
- package/dist/resource/assembler.js.map +1 -0
- package/dist/resource/index.d.ts +903 -0
- package/dist/resource/index.d.ts.map +1 -0
- package/dist/resource/index.js +160 -0
- package/dist/resource/index.js.map +1 -0
- package/dist/resource/inference.d.ts +310 -0
- package/dist/resource/inference.d.ts.map +1 -0
- package/dist/resource/inference.js +17 -0
- package/dist/resource/inference.js.map +1 -0
- package/dist/resource/validator.d.ts +158 -0
- package/dist/resource/validator.d.ts.map +1 -0
- package/dist/resource/validator.js +1013 -0
- package/dist/resource/validator.js.map +1 -0
- package/dist/string/assembler.d.ts +69 -0
- package/dist/string/assembler.d.ts.map +1 -0
- package/dist/string/assembler.js +143 -0
- package/dist/string/assembler.js.map +1 -0
- package/dist/string/index.d.ts +431 -0
- package/dist/string/index.d.ts.map +1 -0
- package/dist/string/index.js +528 -0
- package/dist/string/index.js.map +1 -0
- package/dist/string/validator.d.ts +30 -0
- package/dist/string/validator.d.ts.map +1 -0
- package/dist/string/validator.js +69 -0
- package/dist/string/validator.js.map +1 -0
- package/dist/union/accessors.d.ts +137 -0
- package/dist/union/accessors.d.ts.map +1 -0
- package/dist/union/accessors.js +253 -0
- package/dist/union/accessors.js.map +1 -0
- package/dist/union/assembler.d.ts +56 -0
- package/dist/union/assembler.d.ts.map +1 -0
- package/dist/union/assembler.js +140 -0
- package/dist/union/assembler.js.map +1 -0
- package/dist/union/index.d.ts +172 -0
- package/dist/union/index.d.ts.map +1 -0
- package/dist/union/index.js +45 -0
- package/dist/union/index.js.map +1 -0
- package/dist/union/inference.d.ts +30 -0
- package/dist/union/inference.d.ts.map +1 -0
- package/dist/union/inference.js +17 -0
- package/dist/union/inference.js.map +1 -0
- package/dist/union/validator.d.ts +94 -0
- package/dist/union/validator.d.ts.map +1 -0
- package/dist/union/validator.js +171 -0
- package/dist/union/validator.js.map +1 -0
- package/dist/value/accessors.d.ts +151 -0
- package/dist/value/accessors.d.ts.map +1 -0
- package/dist/value/accessors.js +468 -0
- package/dist/value/accessors.js.map +1 -0
- package/dist/value/assembler.d.ts +129 -0
- package/dist/value/assembler.d.ts.map +1 -0
- package/dist/value/assembler.js +248 -0
- package/dist/value/assembler.js.map +1 -0
- package/dist/value/index.d.ts +309 -0
- package/dist/value/index.d.ts.map +1 -0
- package/dist/value/index.js +26 -0
- package/dist/value/index.js.map +1 -0
- package/dist/value/inference.d.ts +292 -0
- package/dist/value/inference.d.ts.map +1 -0
- package/dist/value/inference.js +17 -0
- package/dist/value/inference.js.map +1 -0
- package/dist/value/validator.d.ts +76 -0
- package/dist/value/validator.d.ts.map +1 -0
- package/dist/value/validator.js +111 -0
- package/dist/value/validator.js.map +1 -0
- package/package.json +95 -4
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Union shape types and operations.
|
|
3
|
+
*
|
|
4
|
+
* Defines the shape describing a value drawn from one of several alternatives and its branch types, and provides the
|
|
5
|
+
* {@link union} factory stating them and the accessors reading the branches, so that a member whose vocabulary ranges
|
|
6
|
+
* over unrelated types is described by a single shape. Alternatives are stated positionally, and a value is stored as
|
|
7
|
+
* it stands under the one branch it belongs to.
|
|
8
|
+
*
|
|
9
|
+
* **Defining polymorphic members**
|
|
10
|
+
*
|
|
11
|
+
* State the alternatives positionally; cardinality belongs to the enclosing member rather than to a branch:
|
|
12
|
+
*
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { optional, resource } from '@grafctory/blue/resource';
|
|
15
|
+
* import { reference } from '@grafctory/blue/reference';
|
|
16
|
+
* import { string } from '@grafctory/blue/string';
|
|
17
|
+
* import { union } from '@grafctory/blue/union';
|
|
18
|
+
*
|
|
19
|
+
* const Contact = resource({
|
|
20
|
+
* address: optional(union(
|
|
21
|
+
* string(),
|
|
22
|
+
* reference(PostalAddress)
|
|
23
|
+
* ))
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Either alternative is accepted at the same position, stored as it stands with no wrapping:
|
|
28
|
+
*
|
|
29
|
+
* ```json
|
|
30
|
+
* { "address": "123 Main St" }
|
|
31
|
+
*
|
|
32
|
+
* { "address": "https://data.example.com/addresses/456" }
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* **Reading the alternatives off a shape**
|
|
36
|
+
*
|
|
37
|
+
* The accessors list the alternatives a shape admits values from, treating a shape that is not a union as a single
|
|
38
|
+
* branch, so a caller handles polymorphic and plain shapes alike. They also pick the branches an input is matched
|
|
39
|
+
* against: the one branch a stored value, a relational bound or a set-matching option singles out, and every branch a
|
|
40
|
+
* retrieval placeholder may draw from.
|
|
41
|
+
*
|
|
42
|
+
* @module
|
|
43
|
+
*
|
|
44
|
+
* @document ./index.md
|
|
45
|
+
*
|
|
46
|
+
* @see [Unions — Design](./index.md)
|
|
47
|
+
* @see {@link https://www.w3.org/TR/shacl/#XoneConstraintComponent SHACL § 4.6.4 sh:xone}
|
|
48
|
+
* @see {@link https://www.w3.org/TR/shacl/#OrConstraintComponent SHACL § 4.6.2 sh:or}
|
|
49
|
+
*/
|
|
50
|
+
import type { Lazy } from "@grafctory/core";
|
|
51
|
+
import type { Shape } from "../value/index.js";
|
|
52
|
+
export { getShapeBranches, getStateBranch, getBoundBranch, getOptionBranch, getModelBranches } from "./accessors.js";
|
|
53
|
+
/**
|
|
54
|
+
* Describes a value drawn from one of several alternatives.
|
|
55
|
+
*
|
|
56
|
+
* Admits whatever any of its branches admits, so that a property whose vocabulary ranges over unrelated types (a plain
|
|
57
|
+
* string or any of several structured resources, say) is described by a single shape. A branch is a shape in its own
|
|
58
|
+
* right, a union included, possibly deferred to break definition cycles.
|
|
59
|
+
*
|
|
60
|
+
* **Matching**
|
|
61
|
+
*
|
|
62
|
+
* Which branches an operation is carried out against is decided by the input the caller supplies, under the regime
|
|
63
|
+
* that input belongs to:
|
|
64
|
+
*
|
|
65
|
+
* - a **data value** being stored singles out **exactly one** branch, matched against all its constraints, as it is a
|
|
66
|
+
* legal value of the branch it selects and that branch fixes how it is stored;
|
|
67
|
+
* - a **relational bound** singles out **exactly one** branch as well, but keys on syntactic traits alone (the value's
|
|
68
|
+
* `kind` and, where branches share it, their lexical `pattern`), as a bound filters by order and need not be a legal
|
|
69
|
+
* value of the branch it selects. A localised branch takes a plain string bound, and links and embedded resources
|
|
70
|
+
* take none;
|
|
71
|
+
* - a **set-matching option** singles out **exactly one** branch as well, but keys on the value's `kind` alone and
|
|
72
|
+
* ignores any lexical `pattern`, as an option is tested by equality and an option outside the domain is a legal
|
|
73
|
+
* filter matching nothing. A localised branch takes a plain string option or a map of options keyed by language tag;
|
|
74
|
+
* - a **retrieval placeholder** matches **at least one** branch and retrieves each branch it fits, as it carries no
|
|
75
|
+
* value of its own and discriminates nothing: the atomic placeholder matches by form alone, ignoring every
|
|
76
|
+
* constraint, and so reaches every branch coming back as a value, an embedded resource excepted, as it names no
|
|
77
|
+
* identifier to come back as; a nested template matches every resource branch admitting at least one of the
|
|
78
|
+
* members it asks for, and may thus span several, each answering the members it admits; a map of tag ranges
|
|
79
|
+
* matches the localised branches alone. A template need not ask for every member a branch declares, but each member
|
|
80
|
+
* it asks for must fit at least one branch, which may declare that member with a shape of its own. A tag range may
|
|
81
|
+
* also be a member name, so an object whose keys each name a member of a resource branch is read as a template, and
|
|
82
|
+
* any other object as a map of tag ranges.
|
|
83
|
+
*
|
|
84
|
+
* An input matching no branch is rejected as unsatisfiable, and one required to single out a branch but matching
|
|
85
|
+
* several is rejected as ambiguous. A text search singles out no branch at all: it filters every textual branch
|
|
86
|
+
* at once.
|
|
87
|
+
*
|
|
88
|
+
* > [!IMPORTANT]
|
|
89
|
+
* > Branches are expected to be **disjoint**: no legal value satisfies two of them at once. Disjointness is a
|
|
90
|
+
* > modelling contract rather than a property proved as the shape is built, so overlapping branches are accepted and
|
|
91
|
+
* > an offending value is rejected only when it is matched. A union filtered by relational bounds is held to a
|
|
92
|
+
* > stricter grade, as a bound is told apart by syntax alone: it admits at most one numeric and one boolean branch,
|
|
93
|
+
* > and string branches only under mutually exclusive patterns. One filtered by set-matching options is held to a
|
|
94
|
+
* > stricter grade still, as an option is told apart by kind alone: it admits at most one branch of each kind. Under
|
|
95
|
+
* > either grade, a plain string over a string branch and a localised one is ambiguous.
|
|
96
|
+
*
|
|
97
|
+
* > [!IMPORTANT]
|
|
98
|
+
* > Branches describing or linking to resources are expected to be **coherent**: a member name several of them
|
|
99
|
+
* > declare denotes the same property throughout the union, agreeing on its kind, its `forward` and `reverse`
|
|
100
|
+
* > predicates and its `captive` and `foreign` flags, while its range, cardinality and value domain may differ.
|
|
101
|
+
* > Branches may be deferred, so coherence is checked as the branches are first resolved rather than as the union is
|
|
102
|
+
* > built, and an incoherent union is rejected there.
|
|
103
|
+
*
|
|
104
|
+
* **Inheritance**
|
|
105
|
+
*
|
|
106
|
+
* Where a {@link resource!ResourceShape} extends the shapes it lists as `parents`, union-valued members are merged
|
|
107
|
+
* according to the following rules. The *child* is the extending shape; the *parent* is the inherited one.
|
|
108
|
+
*
|
|
109
|
+
* | Field | Override Rule |
|
|
110
|
+
* | ---------- | ----------------------------------------------------------------------------------------- |
|
|
111
|
+
* | `kind` | Cannot be overridden |
|
|
112
|
+
* | `branches` | Each child branch narrows exactly one parent branch; unpaired parent branches are dropped |
|
|
113
|
+
*
|
|
114
|
+
* A child narrowing a branch that no parent branch matches, one that several match, or one already taken by another
|
|
115
|
+
* child branch is reported as an error. A child declaring a single non-union shape narrows the one parent branch it
|
|
116
|
+
* matches and collapses the member to that shape, leaving the value no longer polymorphic.
|
|
117
|
+
*
|
|
118
|
+
* @typeParam B The alternatives a value may be drawn from
|
|
119
|
+
*
|
|
120
|
+
* @see {@link https://www.w3.org/TR/shacl/#XoneConstraintComponent SHACL § 4.6.4 sh:xone}
|
|
121
|
+
* @see {@link https://www.w3.org/TR/shacl/#OrConstraintComponent SHACL § 4.6.2 sh:or}
|
|
122
|
+
*/
|
|
123
|
+
export type UnionShape<B extends UnionBranches = UnionBranches> = {
|
|
124
|
+
/**
|
|
125
|
+
* Discriminator identifying this as a union shape.
|
|
126
|
+
*
|
|
127
|
+
* **Inheritance** — cannot be overridden.
|
|
128
|
+
*/
|
|
129
|
+
readonly kind: "union";
|
|
130
|
+
/**
|
|
131
|
+
* The alternatives a value may be drawn from.
|
|
132
|
+
*
|
|
133
|
+
* Stated flat: a branch that is itself a union is replaced, as the shape is built, by the alternatives it holds, so
|
|
134
|
+
* that a caller routing a value walks one list however the union was assembled. A branch left deferred is flattened
|
|
135
|
+
* where it is resolved rather than where it is stated.
|
|
136
|
+
*
|
|
137
|
+
* **Inheritance** — each child branch narrows exactly one parent branch; unpaired parent branches are dropped.
|
|
138
|
+
*/
|
|
139
|
+
readonly branches: B;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* The alternatives a union admits.
|
|
143
|
+
*
|
|
144
|
+
* Retains the order the alternatives were declared in, so that a value matching or failing to match them is reported
|
|
145
|
+
* against a stable sequence; order carries no priority, as every alternative is matched.
|
|
146
|
+
*/
|
|
147
|
+
export type UnionBranches = readonly Lazy<Shape>[];
|
|
148
|
+
/**
|
|
149
|
+
* Creates a union shape.
|
|
150
|
+
*
|
|
151
|
+
* Alternatives are accepted as they are stated: a union that exists proves nothing about the distinguishability of its
|
|
152
|
+
* branches, which is a {@link UnionShape | modelling contract} settled when a value is matched. An alternative that is
|
|
153
|
+
* itself a union contributes the alternatives it holds rather than nesting, so that a union of unions reads as the
|
|
154
|
+
* single flat list of alternatives it admits values from.
|
|
155
|
+
*
|
|
156
|
+
* @typeParam B The alternatives a value may be drawn from
|
|
157
|
+
*
|
|
158
|
+
* @param branches The shapes a value may be drawn from, each possibly deferred to break definition cycles
|
|
159
|
+
*
|
|
160
|
+
* @returns An immutable shape admitting the values any of the branches admits
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
*
|
|
164
|
+
* ```typescript
|
|
165
|
+
* const location = optional(union(
|
|
166
|
+
* string(),
|
|
167
|
+
* reference(PostalAddress)
|
|
168
|
+
* ));
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
export declare function union<B extends readonly [Lazy<Shape>, ...Lazy<Shape>[]]>(...branches: B): UnionShape<B>;
|
|
172
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/union/index.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGrH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,IAAI;IAEjE;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IAEtB;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;CAEpB,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GACxB,SAAS,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;AAKvB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAIvG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
import { assemble } from "./assembler.js";
|
|
17
|
+
export { getShapeBranches, getStateBranch, getBoundBranch, getOptionBranch, getModelBranches } from "./accessors.js";
|
|
18
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
19
|
+
/**
|
|
20
|
+
* Creates a union shape.
|
|
21
|
+
*
|
|
22
|
+
* Alternatives are accepted as they are stated: a union that exists proves nothing about the distinguishability of its
|
|
23
|
+
* branches, which is a {@link UnionShape | modelling contract} settled when a value is matched. An alternative that is
|
|
24
|
+
* itself a union contributes the alternatives it holds rather than nesting, so that a union of unions reads as the
|
|
25
|
+
* single flat list of alternatives it admits values from.
|
|
26
|
+
*
|
|
27
|
+
* @typeParam B The alternatives a value may be drawn from
|
|
28
|
+
*
|
|
29
|
+
* @param branches The shapes a value may be drawn from, each possibly deferred to break definition cycles
|
|
30
|
+
*
|
|
31
|
+
* @returns An immutable shape admitting the values any of the branches admits
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
*
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const location = optional(union(
|
|
37
|
+
* string(),
|
|
38
|
+
* reference(PostalAddress)
|
|
39
|
+
* ));
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function union(...branches) {
|
|
43
|
+
return assemble(branches);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/union/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAsDH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAyGrH,wHAAwH;AAExH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,KAAK,CAAqD,GAAG,QAAW;IAEvF,OAAO,QAAQ,CAAI,QAAQ,CAAC,CAAC;AAE9B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Union alternative inference.
|
|
3
|
+
*
|
|
4
|
+
* Resolves the alternatives a union describes, and those any range admits, so that the value of a union is resolved
|
|
5
|
+
* branch by branch and the alternatives of a range can be told apart by kind.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { Eager, Lazy } from "@grafctory/core";
|
|
10
|
+
import type { Shape } from "../value/index.js";
|
|
11
|
+
import type { UnionShape } from "./index.js";
|
|
12
|
+
/**
|
|
13
|
+
* Resolves the alternatives a union describes.
|
|
14
|
+
*
|
|
15
|
+
* Yields every branch at once, each as declared, so that a value of the union is resolved by resolving each branch in
|
|
16
|
+
* turn, as {@link value!State} does; a shape that is not a union has no branch at all.
|
|
17
|
+
*
|
|
18
|
+
* @typeParam S The describing shape, possibly deferred to break definition cycles
|
|
19
|
+
*/
|
|
20
|
+
export type Branch<S extends Lazy<Shape>> = Eager<S> extends UnionShape<infer B> ? B[number] : never;
|
|
21
|
+
/**
|
|
22
|
+
* Resolves the alternatives a range admits, each eager.
|
|
23
|
+
*
|
|
24
|
+
* Yields every branch of a union and a shape of any other kind as it stands, so that the branches can be told apart by
|
|
25
|
+
* kind; a bare {@link value!Shape}, standing for any kind at all, admits no alternative.
|
|
26
|
+
*
|
|
27
|
+
* @typeParam R The range describing the values, possibly deferred to break definition cycles
|
|
28
|
+
*/
|
|
29
|
+
export type Variant<R extends Lazy<Shape>> = Shape extends Eager<R> ? never : [Branch<R>] extends [never] ? Eager<R> : Eager<Branch<R>>;
|
|
30
|
+
//# sourceMappingURL=inference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../src/union/inference.ts"],"names":[],"mappings":"AAgBA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C;;;;;;;GAOG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,IACvC,KAAK,CAAC,CAAC,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,CAAA;AAEzD;;;;;;;GAOG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,IACxC,KAAK,SAAS,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,GAC3B,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GACrC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,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/union/inference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Union value validation.
|
|
3
|
+
*
|
|
4
|
+
* Holds a value to the alternatives a union admits, reporting a value no branch admits and, where the strictness asks
|
|
5
|
+
* for it, one several branches admit at once. Also holds a relational bound, a set-matching option and a retrieval
|
|
6
|
+
* placeholder to the branches they are matched against.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { type Optional } from "@grafctory/core";
|
|
11
|
+
import { type Trace } from "@grafctory/core/trace";
|
|
12
|
+
import type { Shape } from "../value/index.js";
|
|
13
|
+
import { type Scope } from "../value/validator.js";
|
|
14
|
+
import type { UnionShape } from "./index.js";
|
|
15
|
+
/**
|
|
16
|
+
* Validates values against a union.
|
|
17
|
+
*
|
|
18
|
+
* Matches each value against the branches and reports how many admit it, under the regime the
|
|
19
|
+
* {@link Scope | strictness} names: a `"state"` value must single out **exactly one** branch, as it fixes the branch
|
|
20
|
+
* that drives storage, while a `"model"` placeholder need only fit **at least one**, retrieving each it fits. A value
|
|
21
|
+
* fitting no branch is reported as unsatisfiable and one required to single out a branch but fitting several as
|
|
22
|
+
* ambiguous.
|
|
23
|
+
*
|
|
24
|
+
* @param values The values to validate
|
|
25
|
+
* @param shape The shape the values are matched against
|
|
26
|
+
* @param opts Validation options
|
|
27
|
+
* @param opts.scope The {@link Scope | strictness} the branches are matched at, defaulting to `"state"`
|
|
28
|
+
*
|
|
29
|
+
* @returns A trace of the violations found, keyed by element, or `undefined` where every value matches a branch
|
|
30
|
+
* admissibly
|
|
31
|
+
*/
|
|
32
|
+
export declare function validateUnion(values: readonly unknown[], shape: UnionShape, { scope }?: {
|
|
33
|
+
scope?: Scope;
|
|
34
|
+
}): Optional<Trace>;
|
|
35
|
+
/**
|
|
36
|
+
* Tells whether a placeholder object asks for a nested resource rather than for tag ranges.
|
|
37
|
+
*
|
|
38
|
+
* A tag range may also be a member name, so the object form alone does not tell a template from a map of tag ranges.
|
|
39
|
+
* The branches settle it: an object is a template if each of its keys names a member of a resource branch, reached
|
|
40
|
+
* directly or through a link, and a map of tag ranges otherwise. A map of tag ranges whose ranges all name such members
|
|
41
|
+
* therefore cannot be asked for.
|
|
42
|
+
*
|
|
43
|
+
* @param model The placeholder to read
|
|
44
|
+
* @param branches The branches the placeholder is matched against
|
|
45
|
+
*
|
|
46
|
+
* @returns `true` if `model` is an object to be read as a template; `false` otherwise
|
|
47
|
+
*/
|
|
48
|
+
export declare function isTemplateModel(model: unknown, branches: readonly Shape[]): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Selects the branches admitting a value.
|
|
51
|
+
*
|
|
52
|
+
* Matches a value against each branch at the strictness the caller asks for, in the order the branches were stated, so
|
|
53
|
+
* that a caller routing a value over a union reads the alternatives it fits off a single list.
|
|
54
|
+
*
|
|
55
|
+
* @typeParam B The branch type, carried through from the branches supplied
|
|
56
|
+
*
|
|
57
|
+
* @param value The value to match
|
|
58
|
+
* @param branches The branches to match against
|
|
59
|
+
* @param scope The {@link Scope | strictness} the branches are matched at
|
|
60
|
+
*
|
|
61
|
+
* @returns The branches admitting `value`, in the order they were stated
|
|
62
|
+
*/
|
|
63
|
+
export declare function matching<B extends Shape>(value: unknown, branches: readonly B[], scope: Scope): readonly B[];
|
|
64
|
+
/**
|
|
65
|
+
* Checks whether a relational bound can filter against a branch.
|
|
66
|
+
*
|
|
67
|
+
* A bound must be of the branch kind and, on a string branch, match its pattern. A localised branch takes a plain
|
|
68
|
+
* string, while links and embedded resources take no bound.
|
|
69
|
+
*
|
|
70
|
+
* Template validation and {@link union!getBoundBranch | getBoundBranch} share this rule, so a bound accepted against a
|
|
71
|
+
* branch also routes to it.
|
|
72
|
+
*
|
|
73
|
+
* @param bound The bound to check
|
|
74
|
+
* @param branch The branch it is to filter against
|
|
75
|
+
*
|
|
76
|
+
* @returns A trace of the reasons `bound` cannot filter against `branch`, or `undefined` where it can
|
|
77
|
+
*/
|
|
78
|
+
export declare function checkBound(bound: unknown, branch: Shape): Optional<Trace>;
|
|
79
|
+
/**
|
|
80
|
+
* Checks whether a set-matching option can be tested against a branch.
|
|
81
|
+
*
|
|
82
|
+
* An option must be of the branch kind, whatever its pattern, and a link or resource branch takes a reference. A
|
|
83
|
+
* localised branch takes a plain string or a map of strings keyed by language tag. A `null` option fits any branch.
|
|
84
|
+
*
|
|
85
|
+
* Template validation and {@link union!getOptionBranch | getOptionBranch} share this rule, so an option accepted
|
|
86
|
+
* against a branch also routes to it.
|
|
87
|
+
*
|
|
88
|
+
* @param option The option to check, stated singly rather than as the set a filter lists
|
|
89
|
+
* @param branch The branch it is to be tested against
|
|
90
|
+
*
|
|
91
|
+
* @returns A trace of the reasons `option` cannot be tested against `branch`, or `undefined` where it can
|
|
92
|
+
*/
|
|
93
|
+
export declare function checkOption(option: unknown, branch: Shape): Optional<Trace>;
|
|
94
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/union/validator.ts"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AAEH,OAAO,EAAoD,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAElG,OAAO,EAAiB,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAIlE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,KAAK,EAAiB,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,EAE5E,KAAe,EAEf,GAAE;IAEF,KAAK,CAAC,EAAE,KAAK,CAAA;CAER,GAAG,QAAQ,CAAC,KAAK,CAAC,CAcvB;AAKD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,KAAK,EAAE,GAAG,OAAO,CAMnF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC,EAAE,CAI5G;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAQzE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAU3E"}
|
|
@@ -0,0 +1,171 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Union value validation.
|
|
18
|
+
*
|
|
19
|
+
* Holds a value to the alternatives a union admits, reporting a value no branch admits and, where the strictness asks
|
|
20
|
+
* for it, one several branches admit at once. Also holds a relational bound, a set-matching option and a retrieval
|
|
21
|
+
* placeholder to the branches they are matched against.
|
|
22
|
+
*
|
|
23
|
+
* @module
|
|
24
|
+
*/
|
|
25
|
+
import { isArray, isBoolean, isNumber, isObject, isString } from "@grafctory/core";
|
|
26
|
+
import { isTag } from "@grafctory/core/language";
|
|
27
|
+
import { array, object } from "@grafctory/core/trace";
|
|
28
|
+
import { isAtomic } from "@grafctory/qest/model";
|
|
29
|
+
import { isReference } from "@grafctory/qest/state";
|
|
30
|
+
import { getShapeTarget } from "../reference/index.js";
|
|
31
|
+
import { validateShape } from "../value/validator.js";
|
|
32
|
+
import { getShapeBranches } from "./accessors.js";
|
|
33
|
+
/**
|
|
34
|
+
* Validates values against a union.
|
|
35
|
+
*
|
|
36
|
+
* Matches each value against the branches and reports how many admit it, under the regime the
|
|
37
|
+
* {@link Scope | strictness} names: a `"state"` value must single out **exactly one** branch, as it fixes the branch
|
|
38
|
+
* that drives storage, while a `"model"` placeholder need only fit **at least one**, retrieving each it fits. A value
|
|
39
|
+
* fitting no branch is reported as unsatisfiable and one required to single out a branch but fitting several as
|
|
40
|
+
* ambiguous.
|
|
41
|
+
*
|
|
42
|
+
* @param values The values to validate
|
|
43
|
+
* @param shape The shape the values are matched against
|
|
44
|
+
* @param opts Validation options
|
|
45
|
+
* @param opts.scope The {@link Scope | strictness} the branches are matched at, defaulting to `"state"`
|
|
46
|
+
*
|
|
47
|
+
* @returns A trace of the violations found, keyed by element, or `undefined` where every value matches a branch
|
|
48
|
+
* admissibly
|
|
49
|
+
*/
|
|
50
|
+
export function validateUnion(values, shape, { scope = "state" } = {}) {
|
|
51
|
+
const branches = getShapeBranches(shape);
|
|
52
|
+
return array((value) => {
|
|
53
|
+
const matched = matching(value, branches, scope);
|
|
54
|
+
return matched.length === 0 ? ["{branches} no branch admits the value"]
|
|
55
|
+
: scope !== "model" && matched.length > 1 ? ["{branches} several branches admit the value"]
|
|
56
|
+
: undefined;
|
|
57
|
+
})(values);
|
|
58
|
+
}
|
|
59
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
60
|
+
/**
|
|
61
|
+
* Tells whether a placeholder object asks for a nested resource rather than for tag ranges.
|
|
62
|
+
*
|
|
63
|
+
* A tag range may also be a member name, so the object form alone does not tell a template from a map of tag ranges.
|
|
64
|
+
* The branches settle it: an object is a template if each of its keys names a member of a resource branch, reached
|
|
65
|
+
* directly or through a link, and a map of tag ranges otherwise. A map of tag ranges whose ranges all name such members
|
|
66
|
+
* therefore cannot be asked for.
|
|
67
|
+
*
|
|
68
|
+
* @param model The placeholder to read
|
|
69
|
+
* @param branches The branches the placeholder is matched against
|
|
70
|
+
*
|
|
71
|
+
* @returns `true` if `model` is an object to be read as a template; `false` otherwise
|
|
72
|
+
*/
|
|
73
|
+
export function isTemplateModel(model, branches) {
|
|
74
|
+
const names = new Set(branches.flatMap(branch => Object.keys(getShapeTarget(branch)?.members ?? {})));
|
|
75
|
+
return !isAtomic(model) && isObject(model) && Object.keys(model).every(key => names.has(key));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Selects the branches admitting a value.
|
|
79
|
+
*
|
|
80
|
+
* Matches a value against each branch at the strictness the caller asks for, in the order the branches were stated, so
|
|
81
|
+
* that a caller routing a value over a union reads the alternatives it fits off a single list.
|
|
82
|
+
*
|
|
83
|
+
* @typeParam B The branch type, carried through from the branches supplied
|
|
84
|
+
*
|
|
85
|
+
* @param value The value to match
|
|
86
|
+
* @param branches The branches to match against
|
|
87
|
+
* @param scope The {@link Scope | strictness} the branches are matched at
|
|
88
|
+
*
|
|
89
|
+
* @returns The branches admitting `value`, in the order they were stated
|
|
90
|
+
*/
|
|
91
|
+
export function matching(value, branches, scope) {
|
|
92
|
+
return branches.filter(branch => validateShape([value], branch, { scope }) === undefined);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Checks whether a relational bound can filter against a branch.
|
|
96
|
+
*
|
|
97
|
+
* A bound must be of the branch kind and, on a string branch, match its pattern. A localised branch takes a plain
|
|
98
|
+
* string, while links and embedded resources take no bound.
|
|
99
|
+
*
|
|
100
|
+
* Template validation and {@link union!getBoundBranch | getBoundBranch} share this rule, so a bound accepted against a
|
|
101
|
+
* branch also routes to it.
|
|
102
|
+
*
|
|
103
|
+
* @param bound The bound to check
|
|
104
|
+
* @param branch The branch it is to filter against
|
|
105
|
+
*
|
|
106
|
+
* @returns A trace of the reasons `bound` cannot filter against `branch`, or `undefined` where it can
|
|
107
|
+
*/
|
|
108
|
+
export function checkBound(bound, branch) {
|
|
109
|
+
// a localised value is filtered through the strings it carries, a string through its lexical pattern
|
|
110
|
+
return branch.kind === "dictionary" ? isString(bound) ? undefined : ["expected string value"]
|
|
111
|
+
: branch.kind === "string" && isString(bound) ? lexical(bound, branch.pattern)
|
|
112
|
+
: literal(bound, branch, () => [`unsupported constraint for <${branch.kind}> value`]);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Checks whether a set-matching option can be tested against a branch.
|
|
116
|
+
*
|
|
117
|
+
* An option must be of the branch kind, whatever its pattern, and a link or resource branch takes a reference. A
|
|
118
|
+
* localised branch takes a plain string or a map of strings keyed by language tag. A `null` option fits any branch.
|
|
119
|
+
*
|
|
120
|
+
* Template validation and {@link union!getOptionBranch | getOptionBranch} share this rule, so an option accepted
|
|
121
|
+
* against a branch also routes to it.
|
|
122
|
+
*
|
|
123
|
+
* @param option The option to check, stated singly rather than as the set a filter lists
|
|
124
|
+
* @param branch The branch it is to be tested against
|
|
125
|
+
*
|
|
126
|
+
* @returns A trace of the reasons `option` cannot be tested against `branch`, or `undefined` where it can
|
|
127
|
+
*/
|
|
128
|
+
export function checkOption(option, branch) {
|
|
129
|
+
// an option stated as nothing at all matches any value type
|
|
130
|
+
return option === null ? undefined
|
|
131
|
+
: branch.kind === "dictionary" ? isString(option) ? undefined
|
|
132
|
+
: isObject(option) ? tags(option)
|
|
133
|
+
: [`unsupported constraint for <${branch.kind}> value`]
|
|
134
|
+
: literal(option, branch, () => isReference(option) ? undefined : ["expected <reference> value"]);
|
|
135
|
+
}
|
|
136
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
137
|
+
/**
|
|
138
|
+
* Holds a value to the literal branch it is matched against, deferring any other kind to the caller.
|
|
139
|
+
*/
|
|
140
|
+
function literal(value, branch, otherwise) {
|
|
141
|
+
switch (branch.kind) {
|
|
142
|
+
case "boolean":
|
|
143
|
+
return isBoolean(value) ? undefined : [`expected <${branch.kind}> value`];
|
|
144
|
+
case "number":
|
|
145
|
+
return isNumber(value) ? undefined : [`expected <${branch.kind}> value`];
|
|
146
|
+
case "string":
|
|
147
|
+
return isString(value) ? undefined : [`expected <${branch.kind}> value`];
|
|
148
|
+
default:
|
|
149
|
+
return otherwise();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Matches a string against the lexical pattern of a branch, admitting every string where it states none.
|
|
154
|
+
*/
|
|
155
|
+
function lexical(value, pattern) {
|
|
156
|
+
return pattern === undefined || new RegExp(pattern).test(value) ? undefined
|
|
157
|
+
: [`{pattern} expected string matching </${pattern}/>`];
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Validates a set of options stated as a tag map, grouped by the tag they are to match under.
|
|
161
|
+
*
|
|
162
|
+
* The map states the options a filter tests against rather than a value a resource holds, so a tag carries as many as
|
|
163
|
+
* the filter lists whatever the member admits, and the strings, being matched for equality, need not be legal values
|
|
164
|
+
* of the shape.
|
|
165
|
+
*/
|
|
166
|
+
function tags(value) {
|
|
167
|
+
return object(([tag, asked]) => !isTag(tag) ? [{ [tag]: ["invalid tag"] }]
|
|
168
|
+
: isString(asked) || isArray(asked, isString) ? undefined
|
|
169
|
+
: [{ [tag]: ["expected string or string array option"] }])(value);
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/union/validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,SAAS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