@astrale-os/kernel-dsl 1.0.0-beta.34 → 1.0.0-beta.36
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/dist/v1/builder/lowering/schema/lifetime.js +3 -5
- package/dist/v1/builder/lowering/value/zod.js +3 -1
- package/dist/v1/compiled/admission/semantics/policy/callable.js +7 -29
- package/dist/v1/compiled/admission/semantics/policy/parity.js +4 -11
- package/dist/v1/compiled/admission/wire/core.js +2 -6
- package/dist/v1/compiled/admission/wire/property.js +6 -19
- package/dist/v1/domain/projection/classes.js +5 -7
- package/dist/v1/language/class/inheritance.d.ts +26 -2
- package/dist/v1/language/class/inheritance.js +63 -40
- package/dist/v1/language/class/lifetime.d.ts +7 -15
- package/dist/v1/language/class/lifetime.js +19 -40
- package/dist/v1/language/class/property-values.d.ts +13 -0
- package/dist/v1/language/class/property-values.js +35 -4
- package/dist/v1/language/class/unique.d.ts +1 -1
- package/dist/v1/language/class/unique.js +3 -13
- package/dist/v1/language/index.d.ts +2 -0
- package/dist/v1/language/index.js +2 -0
- package/dist/v1/language/limits.d.ts +3 -1
- package/dist/v1/language/limits.js +3 -1
- package/dist/v1/language/policy/analysis/branches.d.ts +5 -1
- package/dist/v1/language/policy/analysis/branches.js +21 -5
- package/dist/v1/language/policy/analysis/budgets.d.ts +2 -0
- package/dist/v1/language/policy/analysis/budgets.js +7 -1
- package/dist/v1/language/policy/analysis/typing.d.ts +9 -1
- package/dist/v1/language/policy/analysis/typing.js +44 -49
- package/dist/v1/language/state/topology.d.ts +24 -0
- package/dist/v1/language/state/topology.js +60 -19
- package/dist/v1/language/validation/rule.js +1 -1
- package/dist/v1/language/value/evaluate/evaluator.js +4 -0
- package/dist/v1/language/value/evaluate/validity.optimization.js +4 -1
- package/dist/v1/language/value/inclusion/evidence.js +1 -1
- package/dist/v1/language/value/model/date.d.ts +8 -0
- package/dist/v1/language/value/model/date.js +19 -0
- package/dist/v1/language/value/model/instant.d.ts +0 -1
- package/dist/v1/language/value/model/instant.js +2 -15
- package/dist/v1/language/value/ordering.d.ts +6 -2
- package/dist/v1/language/value/ordering.js +36 -8
- package/dist/v1/language/value/profile/rules.js +3 -2
- package/dist/v1/language/value/profile/vocabulary.d.ts +1 -1
- package/dist/v1/language/value/profile/vocabulary.js +5 -0
- package/dist/v1/language/value/syntax/node-path/schema.d.ts +7 -0
- package/dist/v1/language/value/syntax/node-path/schema.js +32 -0
- package/dist/v1/schema/.spec/schemas/domain-schema.schema.json +3 -0
- package/dist/v1/schema/compatibility/comparators/classes.js +10 -21
- package/dist/v1/schema/enforcement/derived.d.ts +5 -0
- package/dist/v1/schema/enforcement/derived.js +7 -2
- package/dist/v1/schema/enforcement/dispose.d.ts +16 -6
- package/dist/v1/schema/enforcement/dispose.js +16 -6
- package/dist/v1/schema/resolution/origins.js +3 -5
- package/dist/v1/schema/rule.js +4 -3
- package/dist/v1/schema/validation/class.js +39 -47
- package/dist/v1/schema/validation/policy/budgets.js +1 -0
- package/dist/v1/schema/validation/policy/typing.js +7 -20
- package/dist/v1/schema/validation/policy/uses.js +5 -25
- package/dist/v1/schema/validation/value-api.d.ts +2 -1
- package/dist/v1/schema/validation/value-api.js +2 -1
- package/dist/v1/schema/validation/value.json-schema.js +3 -3
- package/dist/value/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2,10 +2,10 @@ import { equalDefinitionRefs } from '../../addressing/definition-ref.js';
|
|
|
2
2
|
import { Key } from '../../addressing/key.js';
|
|
3
3
|
import { definitionRefIndex } from '../../addressing/ordering.js';
|
|
4
4
|
import { isMethodExecutable } from '../../language/callable/executable.js';
|
|
5
|
-
import { classSatisfies as satisfiesClass, edgeContractRefines as refinesEdgeContract, } from '../../language/class/inheritance.js';
|
|
5
|
+
import { classSatisfies as satisfiesClass, contractEndpoints, edgeContractRefines as refinesEdgeContract, } from '../../language/class/inheritance.js';
|
|
6
6
|
import { lifetimeBreaches, lifetimeScope } from '../../language/class/lifetime.js';
|
|
7
7
|
import { keyableProperty } from '../../language/class/unique.js';
|
|
8
|
-
import {
|
|
8
|
+
import { holdsStates, validateStateTopology } from '../../language/state/topology.js';
|
|
9
9
|
import { isBlobValueSchema } from '../../language/value/model/blob.js';
|
|
10
10
|
import { classifyOrdering } from '../../language/value/ordering.js';
|
|
11
11
|
import { escapePointerToken } from '../../language/value/syntax/pointer.js';
|
|
@@ -58,24 +58,10 @@ function validateFacet(valueRegistry, declaration, pointer, diagnostics) {
|
|
|
58
58
|
diagnostics.push(diagnostic('DV_VALUE_SCHEMA', `${propertyPointer}/schema/x-astrale-value-kind`, 'Blob values are allowed only on non-automatic, non-state Node properties.'));
|
|
59
59
|
}
|
|
60
60
|
if (property.state !== undefined) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const schemaMatches = schema !== null &&
|
|
66
|
-
typeof schema === 'object' &&
|
|
67
|
-
!Array.isArray(schema) &&
|
|
68
|
-
Object.keys(schema).length === 2 &&
|
|
69
|
-
schema.type === 'string' &&
|
|
70
|
-
Array.isArray(schema.enum) &&
|
|
71
|
-
schema.enum.length === expected.length &&
|
|
72
|
-
[...schema.enum].sort().every((state, index) => state === expected[index]);
|
|
73
|
-
if (!property.required || property.auto !== undefined || !schemaMatches) {
|
|
74
|
-
diagnostics.push(diagnostic('DV_PROPERTY_STATE', `${propertyPointer}/state`, 'A State Property is required, non-automatic, and has exactly its declared states.'));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
diagnostics.push(diagnostic('DV_PROPERTY_STATE', `${propertyPointer}/state`, error instanceof Error ? error.message : 'Invalid State topology.'));
|
|
61
|
+
const result = validateStateTopology(property.state);
|
|
62
|
+
const breach = result.ok ? stateContractBreach(property, result.topology) : result.message;
|
|
63
|
+
if (breach !== undefined) {
|
|
64
|
+
diagnostics.push(diagnostic('DV_PROPERTY_STATE', `${propertyPointer}/state`, breach));
|
|
79
65
|
}
|
|
80
66
|
}
|
|
81
67
|
if (property.immutable !== undefined) {
|
|
@@ -129,26 +115,27 @@ function validateParents(environment, owner, ownerKind, parents, diagnostics) {
|
|
|
129
115
|
}
|
|
130
116
|
}
|
|
131
117
|
}
|
|
118
|
+
/** Why an authored State Property cannot hold the States of `topology`, if it cannot. */
|
|
119
|
+
function stateContractBreach(property, topology) {
|
|
120
|
+
try {
|
|
121
|
+
if (holdsStates(property, property.schema, topology, 'any'))
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
// Sorting the enum as strings throws for a member with its own `toString`: reported as before.
|
|
126
|
+
if (!(error instanceof TypeError))
|
|
127
|
+
throw error;
|
|
128
|
+
return error.message;
|
|
129
|
+
}
|
|
130
|
+
return 'A State Property is required, non-automatic, and has exactly its declared states.';
|
|
131
|
+
}
|
|
132
132
|
function validateEdgeContract(environment, owner, declaration, pointer, diagnostics) {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
: declaration.endpoints;
|
|
137
|
-
const keys = directed ? ['source', 'target'] : ['0', '1'];
|
|
138
|
-
if (endpoints[0].role === endpoints[1].role) {
|
|
139
|
-
diagnostics.push(diagnostic('DV_EDGE_ROLE', `${pointer}/endpoints/${keys[1]}/role`, `${formatDefinitionRef(owner)} has equal endpoint roles.`));
|
|
133
|
+
const [first, second] = contractEndpoints(declaration);
|
|
134
|
+
if (first.endpoint.role === second.endpoint.role) {
|
|
135
|
+
diagnostics.push(diagnostic('DV_EDGE_ROLE', `${pointer}/endpoints/${second.key}/role`, `${formatDefinitionRef(owner)} has equal endpoint roles.`));
|
|
140
136
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
['outgoing', declaration.endpoints.source.outgoing],
|
|
144
|
-
['incoming', declaration.endpoints.target.incoming],
|
|
145
|
-
]
|
|
146
|
-
: [
|
|
147
|
-
['incident', declaration.endpoints[0].incident],
|
|
148
|
-
['incident', declaration.endpoints[1].incident],
|
|
149
|
-
];
|
|
150
|
-
validateEndpoint(environment, owner, endpoints[0], counts[0], directed ? 'source' : 'first endpoint', `${pointer}/endpoints/${keys[0]}`, diagnostics);
|
|
151
|
-
validateEndpoint(environment, owner, endpoints[1], counts[1], directed ? 'target' : 'second endpoint', `${pointer}/endpoints/${keys[1]}`, diagnostics);
|
|
137
|
+
validateEndpoint(environment, owner, first, pointer, diagnostics);
|
|
138
|
+
validateEndpoint(environment, owner, second, pointer, diagnostics);
|
|
152
139
|
}
|
|
153
140
|
/**
|
|
154
141
|
* Each Property a key tuple names is one of the Class's own or inherited Properties, and keyable:
|
|
@@ -174,7 +161,7 @@ function validateUniqueProperties(registryOf, analysis, owner, declaration, poin
|
|
|
174
161
|
const registry = registryOf(property.owner.origin);
|
|
175
162
|
const ordering = registry === undefined ? undefined : classifyOrdering(property.schema, registry);
|
|
176
163
|
if (!keyableProperty(ordering, property.auto)) {
|
|
177
|
-
diagnostics.push(diagnostic(code, at, 'A key Property is a string, number, boolean or
|
|
164
|
+
diagnostics.push(diagnostic(code, at, 'A key Property is a string, number, boolean, instant or date that no automatic program writes.'));
|
|
178
165
|
}
|
|
179
166
|
};
|
|
180
167
|
if (declaration.kind === 'node') {
|
|
@@ -186,13 +173,22 @@ function validateUniqueProperties(registryOf, analysis, owner, declaration, poin
|
|
|
186
173
|
check(field.property, `${pointer}/unique/${t}/${f}/property`);
|
|
187
174
|
}));
|
|
188
175
|
}
|
|
176
|
+
/** How a refusal names an endpoint by its key: by its direction, or by its position. */
|
|
177
|
+
const sides = {
|
|
178
|
+
source: 'source',
|
|
179
|
+
target: 'target',
|
|
180
|
+
0: 'first endpoint',
|
|
181
|
+
1: 'second endpoint',
|
|
182
|
+
};
|
|
189
183
|
// The structure refuses a repeated accepted Class before semantics: `accepts` is a set.
|
|
190
|
-
function validateEndpoint(environment, owner, endpoint,
|
|
184
|
+
function validateEndpoint(environment, owner, { key, endpoint, countKey, count }, classPointer, diagnostics) {
|
|
185
|
+
const pointer = `${classPointer}/endpoints/${key}`;
|
|
186
|
+
const side = sides[key];
|
|
191
187
|
// An Edge Class binds only the Nodes of its Domain and its dependents: it cannot oblige the
|
|
192
188
|
// Nodes of a Class another Domain owns to carry its Edges.
|
|
193
189
|
const foreign = endpoint.accepts.find((ref) => ref.origin !== owner.origin);
|
|
194
190
|
if (foreign !== undefined && (count === '1' || count === '1..*')) {
|
|
195
|
-
diagnostics.push(diagnostic('DV_EDGE_FOREIGN_MINIMUM', `${pointer}/${
|
|
191
|
+
diagnostics.push(diagnostic('DV_EDGE_FOREIGN_MINIMUM', `${pointer}/${countKey}`, `${formatDefinitionRef(owner)} ${side} accepts ${formatDefinitionRef(foreign)} of another Domain and cannot require ${count} Edges.`));
|
|
196
192
|
}
|
|
197
193
|
for (const [index, ref] of endpoint.accepts.entries()) {
|
|
198
194
|
const resolved = environment.resolve(ref);
|
|
@@ -208,12 +204,8 @@ function validateEndpoint(environment, owner, endpoint, [countField, count], sid
|
|
|
208
204
|
* declares nothing is never refused here: a stored Registry decoded again keeps it.
|
|
209
205
|
*/
|
|
210
206
|
function validateEdgeLifetimes(scope, owner, declaration, pointer, diagnostics) {
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
: ['first endpoint', 'second endpoint'];
|
|
214
|
-
const keys = declaration.orientation === 'directed' ? ['source', 'target'] : ['0', '1'];
|
|
215
|
-
for (const { index, reason } of lifetimeBreaches(declaration, scope)) {
|
|
216
|
-
diagnostics.push(diagnostic('DV_EDGE_LIFETIME', `${pointer}/endpoints/${keys[index]}/onDelete`, `${formatDefinitionRef(owner)} ${sides[index]} ${reason}`));
|
|
207
|
+
for (const { key, reason } of lifetimeBreaches(declaration, scope)) {
|
|
208
|
+
diagnostics.push(diagnostic('DV_EDGE_LIFETIME', `${pointer}/endpoints/${key}/onDelete`, `${formatDefinitionRef(owner)} ${sides[key]} ${reason}`));
|
|
217
209
|
}
|
|
218
210
|
}
|
|
219
211
|
/**
|
|
@@ -70,6 +70,7 @@ export function validateCheckBudget(context, pointer, measure) {
|
|
|
70
70
|
const REFUSAL = {
|
|
71
71
|
inputs: (measure) => `Policy declares ${measure.inputs} Node inputs. The maximum is ${limits.policy.inputs}.`,
|
|
72
72
|
patternDepth: (measure) => `Expanded Pattern depth ${measure.patternDepth} exceeds ${limits.policy.patternDepth}.`,
|
|
73
|
+
existsDepth: (measure) => `Pattern nests ${measure.existsDepth} exists scopes; the maximum is ${limits.policy.existsDepth}.`,
|
|
73
74
|
normalizedBranches: () => `Expanded Pattern has more than ${limits.policy.normalizedBranches} normalized branches.`,
|
|
74
75
|
edgePredicates: (measure) => `A normalized branch contains ${measure.edgePredicates} graph predicates; the maximum is ${limits.policy.edgePredicates}.`,
|
|
75
76
|
referencedDomains: (measure) => `Expanded Pattern references ${measure.referencedDomains} Domains; the maximum is ${limits.policy.referencedDomains}.`,
|
|
@@ -1,34 +1,21 @@
|
|
|
1
|
-
import { targetMode } from '../../../language/policy/analysis/branches.js';
|
|
2
1
|
import { escapePointerToken } from '../../../language/value/syntax/pointer.js';
|
|
3
2
|
/** Type every expanded branch of each named Policy at its own default use. */
|
|
4
3
|
export function validatePolicyTyping(context, typing) {
|
|
5
4
|
for (const name of Object.keys(context.environment.candidate.policies)) {
|
|
6
|
-
const branches = typing.expandedBranches(name
|
|
5
|
+
const branches = typing.expandedBranches(name);
|
|
7
6
|
if (branches === undefined)
|
|
8
7
|
continue;
|
|
9
8
|
if (!typing.validDeclaration(name)) {
|
|
10
9
|
context.add('PL_USE', '/policies/' + escapePointerToken(name), 'Policy branches and operands must agree with the declared input names and Classes.');
|
|
11
10
|
continue;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
if (mode === undefined) {
|
|
18
|
-
if (!('match' in context.environment.candidate.policies[name].expression)) {
|
|
19
|
-
context.add('PL_TARGET', `/policies/${escapePointerToken(name)}`, `Expanded normalized branch ${index} must use object or at least one of source and target, without mixing target modes.`);
|
|
20
|
-
}
|
|
21
|
-
continue;
|
|
12
|
+
const path = `/policies/${escapePointerToken(name)}`;
|
|
13
|
+
for (const { index, kind } of typing.defaultUseFaults(branches)) {
|
|
14
|
+
if (kind === 'typing') {
|
|
15
|
+
context.add('PL_TYPING', path, `Expanded normalized branch ${index} has contradictory endpoint or repeat contracts.`);
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
: {
|
|
26
|
-
kind: 'edge',
|
|
27
|
-
source: { kind: 'default' },
|
|
28
|
-
target: { kind: 'default' },
|
|
29
|
-
};
|
|
30
|
-
if (!typing.branchIsTyped(branch, use)) {
|
|
31
|
-
context.add('PL_TYPING', `/policies/${escapePointerToken(name)}`, `Expanded normalized branch ${index} has contradictory endpoint or repeat contracts.`);
|
|
17
|
+
else if (!('match' in context.environment.candidate.policies[name].expression)) {
|
|
18
|
+
context.add('PL_TARGET', path, `Expanded normalized branch ${index} must use object or at least one of source and target, without mixing target modes.`);
|
|
32
19
|
}
|
|
33
20
|
}
|
|
34
21
|
}
|
|
@@ -4,7 +4,7 @@ import { isBinaryInput } from '../../../language/callable/model/callable.js';
|
|
|
4
4
|
import { neverAdmittedClasses, } from '../../../language/policy/analysis/checks.js';
|
|
5
5
|
import { CLASS_OPERATIONS, checksNameTheCaller, isClassRuleChecks, PolicyComposition, } from '../../../language/policy/model/policy.js';
|
|
6
6
|
import { normalizePolicyChecks } from '../../../language/policy/normalization/normalize.js';
|
|
7
|
-
import {
|
|
7
|
+
import { singleNodePathFieldAccepts } from '../../../language/value/syntax/node-path/schema.js';
|
|
8
8
|
import { escapePointerToken } from '../../../language/value/syntax/pointer.js';
|
|
9
9
|
import { declaredContracts } from '../callable.js';
|
|
10
10
|
import { referenceContracts } from './objects.js';
|
|
@@ -172,30 +172,13 @@ function selfContracts(validation, context, pointer) {
|
|
|
172
172
|
return [contractOfNodeDefinition(context.receiver)];
|
|
173
173
|
}
|
|
174
174
|
function inputContracts(validation, context, field, pointer) {
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const required = input?.required;
|
|
179
|
-
const rootValid = input?.type === 'object' &&
|
|
180
|
-
properties !== undefined &&
|
|
181
|
-
Array.isArray(required) &&
|
|
182
|
-
required.includes(field) &&
|
|
183
|
-
input.additionalProperties === false &&
|
|
184
|
-
!hasCombinator(input);
|
|
185
|
-
const annotation = asRecord(fieldSchema?.['x-astrale-path']);
|
|
186
|
-
const fieldValid = rootValid &&
|
|
187
|
-
fieldSchema?.$ref === GRAPH_NODE_PATH_SCHEMA_ID &&
|
|
188
|
-
!hasCombinator(fieldSchema) &&
|
|
189
|
-
annotation?.target === 'node' &&
|
|
190
|
-
annotation.cardinality === 'one' &&
|
|
191
|
-
Array.isArray(annotation.accepts) &&
|
|
192
|
-
annotation.accepts.length > 0;
|
|
193
|
-
if (!fieldValid) {
|
|
194
|
-
validation.add('PL_USE', pointer, `input.${field} must be one direct required single-Node x-astrale-path field of a closed object input.`);
|
|
175
|
+
const accepts = singleNodePathFieldAccepts(context.input, field);
|
|
176
|
+
if (accepts === undefined) {
|
|
177
|
+
validation.add('PL_USE', pointer, `input.${field} must be one direct required single-Node x-astrale-path field of a closed object input, neither carrying a combinator.`);
|
|
195
178
|
return undefined;
|
|
196
179
|
}
|
|
197
180
|
const contracts = [];
|
|
198
|
-
for (const ref of
|
|
181
|
+
for (const ref of accepts) {
|
|
199
182
|
if (!isDefinitionRef(ref)) {
|
|
200
183
|
validation.add('PL_USE', pointer, `input.${field} has a non-Node acceptance ref.`);
|
|
201
184
|
return undefined;
|
|
@@ -214,9 +197,6 @@ function asRecord(value) {
|
|
|
214
197
|
? value
|
|
215
198
|
: undefined;
|
|
216
199
|
}
|
|
217
|
-
function hasCombinator(value) {
|
|
218
|
-
return ['allOf', 'anyOf', 'oneOf', 'not', 'if', 'then', 'else'].some((key) => Object.hasOwn(value, key));
|
|
219
|
-
}
|
|
220
200
|
function isDefinitionRef(value) {
|
|
221
201
|
const record = asRecord(value);
|
|
222
202
|
return (record !== undefined &&
|
|
@@ -12,6 +12,7 @@ export type { FileOptions, FileSchema } from '../../language/value/model/file.js
|
|
|
12
12
|
export { filePositions, locateFiles } from '../../language/value/files.js';
|
|
13
13
|
export type { FilePosition, FileSegment, LocatedFile } from '../../language/value/files.js';
|
|
14
14
|
export type { JsonSchema as Schema, JsonSchemaObject as SchemaObject, PathAnnotation, PropertyObjectSchema as PropertySchema, ValueSchemaContext as Context, } from '../../language/value/model/schema.js';
|
|
15
|
+
export { date } from '../../language/value/model/date.js';
|
|
15
16
|
export { instant } from '../../language/value/model/instant.js';
|
|
16
17
|
export type { OrderingKind } from '../../language/value/ordering.js';
|
|
17
18
|
export { VALUE_KINDS } from '../../language/value/ordering.js';
|
|
@@ -27,7 +28,7 @@ export declare function classifyOrdering(owner: DomainSchema, contract: JsonSche
|
|
|
27
28
|
/**
|
|
28
29
|
* The value kind of a property schema: what a graph language may test on the property (Y4). It is
|
|
29
30
|
* the one kind of every non-null value the schema admits: `text` for strings, `number` for numbers
|
|
30
|
-
* and integers, `instant` for
|
|
31
|
+
* and integers, `instant` and `date` for their respective declared string kinds, `enum` for a finite
|
|
31
32
|
* set of strings (`const` or `enum`), `boolean`, and `set` for arrays of `uniqueItems`. An
|
|
32
33
|
* ambiguous union, an object, an array with repetitions, a blob or a schema that admits no value is
|
|
33
34
|
* `json`. `$ref`, `allOf`, `anyOf` and `oneOf` are followed; `null` is a point of every kind.
|
|
@@ -9,6 +9,7 @@ export { VALUE_SCHEMA_DIALECT as DIALECT, VALUE_SCHEMA_VOCABULARY as VOCABULARY,
|
|
|
9
9
|
export { blob, isBlobReceipt, isBlobValueSchema as isBlob, } from '../../language/value/model/blob.js';
|
|
10
10
|
export { file, isFileValueSchema as isFile } from '../../language/value/model/file.js';
|
|
11
11
|
export { filePositions, locateFiles } from '../../language/value/files.js';
|
|
12
|
+
export { date } from '../../language/value/model/date.js';
|
|
12
13
|
export { instant } from '../../language/value/model/instant.js';
|
|
13
14
|
export { VALUE_KINDS } from '../../language/value/ordering.js';
|
|
14
15
|
export { GRAPH_NODE_PATH_SCHEMA_ID as NODE_PATH } from '../../language/value/syntax/node-path/schema.js';
|
|
@@ -25,7 +26,7 @@ export function classifyOrdering(owner, contract) {
|
|
|
25
26
|
/**
|
|
26
27
|
* The value kind of a property schema: what a graph language may test on the property (Y4). It is
|
|
27
28
|
* the one kind of every non-null value the schema admits: `text` for strings, `number` for numbers
|
|
28
|
-
* and integers, `instant` for
|
|
29
|
+
* and integers, `instant` and `date` for their respective declared string kinds, `enum` for a finite
|
|
29
30
|
* set of strings (`const` or `enum`), `boolean`, and `set` for arrays of `uniqueItems`. An
|
|
30
31
|
* ambiguous union, an object, an array with repetitions, a blob or a schema that admits no value is
|
|
31
32
|
* `json`. `$ref`, `allOf`, `anyOf` and `oneOf` are followed; `null` is a point of every kind.
|
|
@@ -63,7 +63,7 @@ export function valueSchemaJsonSchema() {
|
|
|
63
63
|
objectOrBoolean({
|
|
64
64
|
properties: {
|
|
65
65
|
$schema: { const: VALUE_SCHEMA_DIALECT },
|
|
66
|
-
[KIND]: named({ enum: ['instant', 'blob', 'file'] }, 'value-blob', 'value-file'),
|
|
66
|
+
[KIND]: named({ enum: ['instant', 'date', 'blob', 'file'] }, 'value-blob', 'value-file'),
|
|
67
67
|
},
|
|
68
68
|
}),
|
|
69
69
|
],
|
|
@@ -97,7 +97,7 @@ export function valueSchemaJsonSchema() {
|
|
|
97
97
|
})),
|
|
98
98
|
},
|
|
99
99
|
// An instant and a file are strings.
|
|
100
|
-
if: { required: [KIND], properties: { [KIND]: { enum: ['instant', 'file'] } } },
|
|
100
|
+
if: { required: [KIND], properties: { [KIND]: { enum: ['instant', 'date', 'file'] } } },
|
|
101
101
|
// oxlint-disable-next-line unicorn/no-thenable -- the JSON Schema keyword
|
|
102
102
|
then: { required: ['type'], properties: { type: { const: 'string' } } },
|
|
103
103
|
}),
|
|
@@ -138,7 +138,7 @@ export function valueSchemaJsonSchema() {
|
|
|
138
138
|
objectOrBoolean({
|
|
139
139
|
properties: {
|
|
140
140
|
$schema: false,
|
|
141
|
-
[KIND]: named({ enum: ['instant', 'file'] }, 'value-file'),
|
|
141
|
+
[KIND]: named({ enum: ['instant', 'date', 'file'] }, 'value-file'),
|
|
142
142
|
},
|
|
143
143
|
}),
|
|
144
144
|
],
|
package/dist/value/types.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export type Value = Primitive | Array | Object;
|
|
|
9
9
|
* graph language may test on its values. The schema of the property derives it; `null` is a point
|
|
10
10
|
* of every kind, outside every order (R6).
|
|
11
11
|
*/
|
|
12
|
-
export type ValueKind = 'text' | 'number' | 'instant' | 'enum' | 'boolean' | 'set' | 'json';
|
|
12
|
+
export type ValueKind = 'text' | 'number' | 'instant' | 'date' | 'enum' | 'boolean' | 'set' | 'json';
|