@astrale-os/kernel-dsl 1.0.0-beta.35 → 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/value/zod.js +3 -1
- package/dist/v1/language/class/unique.d.ts +1 -1
- package/dist/v1/language/class/unique.js +1 -1
- package/dist/v1/language/index.d.ts +2 -0
- package/dist/v1/language/index.js +2 -0
- 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/schema/.spec/schemas/domain-schema.schema.json +3 -0
- package/dist/v1/schema/enforcement/derived.d.ts +5 -0
- package/dist/v1/schema/enforcement/derived.js +6 -1
- package/dist/v1/schema/enforcement/dispose.d.ts +16 -6
- package/dist/v1/schema/enforcement/dispose.js +16 -6
- package/dist/v1/schema/rule.js +2 -2
- package/dist/v1/schema/validation/class.js +1 -1
- 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
|
@@ -169,7 +169,9 @@ function inspectCheck(def, pointer, diagnostics) {
|
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
171
|
if (def.check === 'string_format' && def.format !== 'regex') {
|
|
172
|
-
diagnostics.push(diagnostic('ZOD_SCHEMA_NOT_LOSSLESS', pointer,
|
|
172
|
+
diagnostics.push(diagnostic('ZOD_SCHEMA_NOT_LOSSLESS', pointer, def.format === 'date'
|
|
173
|
+
? 'Declare a calendar date with schema.values.date. Zod date formats are not lowered.'
|
|
174
|
+
: `Zod format ${String(def.format)} asserts acceptance, while V1 format is annotation-only.`));
|
|
173
175
|
return;
|
|
174
176
|
}
|
|
175
177
|
if (def.check === 'string_format' && def.format === 'regex' && def.pattern instanceof RegExp) {
|
|
@@ -80,7 +80,7 @@ export declare function edgeUniqueForm(value: unknown): EdgeUniqueForm | undefin
|
|
|
80
80
|
export declare function enforcesEdgeUniqueTuple(forms: readonly EdgeUniqueForm[], value: unknown): boolean;
|
|
81
81
|
/**
|
|
82
82
|
* Whether a Property may be a key field (D-S1): a single-kind scalar by its ordering facet, a
|
|
83
|
-
* string, number, boolean or
|
|
83
|
+
* string, number, boolean, instant or date, that no automatic program writes.
|
|
84
84
|
*/
|
|
85
85
|
export declare function keyableProperty(ordering: OrderingKind | undefined, auto: unknown): boolean;
|
|
86
86
|
/**
|
|
@@ -140,7 +140,7 @@ export function enforcesEdgeUniqueTuple(forms, value) {
|
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
142
|
* Whether a Property may be a key field (D-S1): a single-kind scalar by its ordering facet, a
|
|
143
|
-
* string, number, boolean or
|
|
143
|
+
* string, number, boolean, instant or date, that no automatic program writes.
|
|
144
144
|
*/
|
|
145
145
|
export function keyableProperty(ordering, auto) {
|
|
146
146
|
return ordering !== undefined && auto === undefined;
|
|
@@ -4,9 +4,11 @@ export { isBinaryInput } from './callable/model/callable.js';
|
|
|
4
4
|
export type { ClassRef, CoreRef, DefinitionBase, DefinitionKey, DefinitionRef, FunctionRef, MethodKey, PolicyRef, PropertyKey, ViewRef, } from '../addressing/index.js';
|
|
5
5
|
export type { Value as PropertyValue } from '@astrale-os/kernel-dsl/value';
|
|
6
6
|
export type { JsonSchema as ValueSchema, JsonSchemaObject as ValueSchemaObject, } from './value/model/schema.js';
|
|
7
|
+
export { isOrderingValue, valueProgramKind } from './value/ordering.js';
|
|
7
8
|
export type { OrderingKind } from './value/ordering.js';
|
|
8
9
|
export type { ValueProgram } from './value/compile/model.js';
|
|
9
10
|
export { valueProgramIncludes } from './value/inclusion/includes.js';
|
|
11
|
+
export { isDateValue } from './value/model/date.js';
|
|
10
12
|
export { isInstantValue } from './value/model/instant.js';
|
|
11
13
|
export { stateMachine } from './state/index.js';
|
|
12
14
|
export type { EventOf, StateMachine, StateOf, StateTopology } from './state/index.js';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { admissionInputFields, isAdmissionMaxAge, MAXIMUM_ADMISSION_AGE_SECONDS, } from './callable/admission.js';
|
|
2
2
|
export { isMethodExecutable } from './callable/executable.js';
|
|
3
3
|
export { isBinaryInput } from './callable/model/callable.js';
|
|
4
|
+
export { isOrderingValue, valueProgramKind } from './value/ordering.js';
|
|
4
5
|
export { valueProgramIncludes } from './value/inclusion/includes.js';
|
|
6
|
+
export { isDateValue } from './value/model/date.js';
|
|
5
7
|
export { isInstantValue } from './value/model/instant.js';
|
|
6
8
|
export { stateMachine } from './state/index.js';
|
|
7
9
|
export { admitsForeignSubclass, inheritanceOf } from './class/inheritance.js';
|
|
@@ -98,7 +98,7 @@ export const VALUE_RULES = deepFreeze({
|
|
|
98
98
|
VS_VALUE_KIND: {
|
|
99
99
|
stage: 'schema',
|
|
100
100
|
positions: ['{/path*}/x-astrale-value-kind', '{/path*}/x-astrale-file'],
|
|
101
|
-
statement: 'x-astrale-value-kind declares instant beside type string at any location, blob as the whole schema of a Property, exactly as values.blob writes it, or file at any location of a callable input, exactly as values.file writes it, the only place x-astrale-file stands.',
|
|
101
|
+
statement: 'x-astrale-value-kind declares date or instant beside type string at any location, blob as the whole schema of a Property, exactly as values.blob writes it, or file at any location of a callable input, exactly as values.file writes it, the only place x-astrale-file stands.',
|
|
102
102
|
conditions: ['#/$defs/value-location/anyOf/1/if'],
|
|
103
103
|
},
|
|
104
104
|
VS_VALUE_KIND_JSON: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { equal } from '@astrale-os/kernel-dsl/value';
|
|
2
2
|
import { runSuspended } from '../../suspended.js';
|
|
3
3
|
import { isCanonicalBlobRef } from '../model/blob.js';
|
|
4
|
+
import { isDateValue } from '../model/date.js';
|
|
4
5
|
import { isInstantValue } from '../model/instant.js';
|
|
5
6
|
import { isValueObject as isJsonObject } from '../model/object.js';
|
|
6
7
|
import { appendPointer } from '../syntax/pointer.js';
|
|
@@ -140,6 +141,9 @@ class InstanceEvaluator {
|
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
evaluateCommonAssertions(schema, input, instancePointer, failures) {
|
|
144
|
+
if (schema['x-astrale-value-kind'] === 'date' && !isDateValue(input)) {
|
|
145
|
+
failures.add(invalid(instancePointer, 'x-astrale-value-kind', 'Expected a Gregorian calendar date in YYYY-MM-DD form.'));
|
|
146
|
+
}
|
|
143
147
|
if (schema['x-astrale-value-kind'] === 'instant' && !isInstantValue(input)) {
|
|
144
148
|
failures.add(invalid(instancePointer, 'x-astrale-value-kind', 'Value is not an exact UTC millisecond Instant.'));
|
|
145
149
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { equal } from '@astrale-os/kernel-dsl/value';
|
|
2
2
|
import { isCanonicalBlobRef } from '../model/blob.js';
|
|
3
|
+
import { isDateValue } from '../model/date.js';
|
|
3
4
|
import { isInstantValue } from '../model/instant.js';
|
|
4
5
|
import { isValueObject as isJsonObject } from '../model/object.js';
|
|
5
6
|
import { isJsonSchema, schemaList } from '../syntax/walk.js';
|
|
@@ -156,7 +157,9 @@ function compileCompositions(schema, child, parts) {
|
|
|
156
157
|
function compileCommon(schema, parts) {
|
|
157
158
|
const kind = schema['x-astrale-value-kind'];
|
|
158
159
|
if (kind === 'instant')
|
|
159
|
-
parts.push(
|
|
160
|
+
parts.push(isInstantValue);
|
|
161
|
+
if (kind === 'date')
|
|
162
|
+
parts.push(isDateValue);
|
|
160
163
|
if (kind === 'blob')
|
|
161
164
|
parts.push((value) => isCanonicalBlobRef(value));
|
|
162
165
|
const type = schema.type;
|
|
@@ -50,7 +50,7 @@ export function evidenceOf(location) {
|
|
|
50
50
|
const valueKind = schema['x-astrale-value-kind'];
|
|
51
51
|
if (typeof valueKind === 'string') {
|
|
52
52
|
valueKinds.add(valueKind);
|
|
53
|
-
if (valueKind === 'instant')
|
|
53
|
+
if (valueKind === 'instant' || valueKind === 'date')
|
|
54
54
|
kinds &= STRING;
|
|
55
55
|
if (valueKind === 'blob')
|
|
56
56
|
kinds &= OBJECT;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** A civil day in the proleptic Gregorian calendar, including year zero. */
|
|
2
|
+
export declare const date: Readonly<{
|
|
3
|
+
readonly type: 'string';
|
|
4
|
+
readonly 'x-astrale-value-kind': 'date';
|
|
5
|
+
}>;
|
|
6
|
+
export declare function isDateValue(input: unknown): input is string;
|
|
7
|
+
/** The fields are unsigned integers read from the fixed-width date or instant grammar. */
|
|
8
|
+
export declare function isCalendarDay(year: number, month: number, day: number): boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** A civil day in the proleptic Gregorian calendar, including year zero. */
|
|
2
|
+
export const date = Object.freeze({ type: 'string', 'x-astrale-value-kind': 'date' });
|
|
3
|
+
const DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/u;
|
|
4
|
+
export function isDateValue(input) {
|
|
5
|
+
if (typeof input !== 'string')
|
|
6
|
+
return false;
|
|
7
|
+
const match = DATE_PATTERN.exec(input);
|
|
8
|
+
return match !== null && isCalendarDay(Number(match[1]), Number(match[2]), Number(match[3]));
|
|
9
|
+
}
|
|
10
|
+
/** The fields are unsigned integers read from the fixed-width date or instant grammar. */
|
|
11
|
+
export function isCalendarDay(year, month, day) {
|
|
12
|
+
if (month < 1 || month > 12 || day < 1)
|
|
13
|
+
return false;
|
|
14
|
+
if (month === 2) {
|
|
15
|
+
const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
16
|
+
return day <= (leap ? 29 : 28);
|
|
17
|
+
}
|
|
18
|
+
return day <= (month === 4 || month === 6 || month === 9 || month === 11 ? 30 : 31);
|
|
19
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isCalendarDay } from './date.js';
|
|
1
2
|
/** Exact portable UTC millisecond Instant used by the V1 value-schema dialect. */
|
|
2
3
|
/** Canonical value-language annotation for an Instant string. */
|
|
3
4
|
const INSTANT_VALUE_KIND = 'instant';
|
|
@@ -19,19 +20,5 @@ export function isInstantValue(input) {
|
|
|
19
20
|
const hour = Number(match[4]);
|
|
20
21
|
const minute = Number(match[5]);
|
|
21
22
|
const second = Number(match[6]);
|
|
22
|
-
return (month
|
|
23
|
-
month <= 12 &&
|
|
24
|
-
day >= 1 &&
|
|
25
|
-
day <= daysInMonth(year, month) &&
|
|
26
|
-
hour <= 23 &&
|
|
27
|
-
minute <= 59 &&
|
|
28
|
-
second <= 59);
|
|
29
|
-
}
|
|
30
|
-
function daysInMonth(year, month) {
|
|
31
|
-
if (month === 2)
|
|
32
|
-
return isLeapYear(year) ? 29 : 28;
|
|
33
|
-
return month === 4 || month === 6 || month === 9 || month === 11 ? 30 : 31;
|
|
34
|
-
}
|
|
35
|
-
function isLeapYear(year) {
|
|
36
|
-
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
23
|
+
return isCalendarDay(year, month, day) && hour <= 23 && minute <= 59 && second <= 59;
|
|
37
24
|
}
|
|
@@ -3,7 +3,9 @@ import type { ValueProgram } from './compile/model.js';
|
|
|
3
3
|
import type { CompiledInstanceSchema } from './evaluate/types.js';
|
|
4
4
|
import type { JsonSchema } from './model/schema.js';
|
|
5
5
|
import type { ValueSchemaRegistry } from './reference/registry.js';
|
|
6
|
-
export type OrderingKind = 'boolean' | 'number' | 'string' | 'instant';
|
|
6
|
+
export type OrderingKind = 'boolean' | 'number' | 'string' | 'instant' | 'date';
|
|
7
|
+
/** Whether an external rank or literal belongs to a declared ordering domain. */
|
|
8
|
+
export declare function isOrderingValue(input: unknown, kind: OrderingKind): input is boolean | number | string;
|
|
7
9
|
/**
|
|
8
10
|
* Classify a schema only when every value it can admit belongs to one sortable scalar domain.
|
|
9
11
|
*
|
|
@@ -22,8 +24,10 @@ export declare const VALUE_KINDS: readonly ValueKind[];
|
|
|
22
24
|
/**
|
|
23
25
|
* The value kind of a property schema (page "Fondations Query v7", § Atoms et value kinds, Y4):
|
|
24
26
|
* the one kind its non-null values admit, `null` being a point of every kind. An annotated
|
|
25
|
-
* instant is `instant`, a finite set of strings `enum`, an array of unique items `set`; an
|
|
27
|
+
* instant is `instant`, a declared day `date`, a finite set of strings `enum`, an array of unique items `set`; an
|
|
26
28
|
* ambiguous union, an object, an array with repetitions or a domain without values is `json`.
|
|
27
29
|
*/
|
|
28
30
|
export declare function classifyValueKind(contract: JsonSchema, registry: ValueSchemaRegistry): ValueKind;
|
|
31
|
+
/** Derive the non-null kind of a resolved Property, following its bound references. */
|
|
32
|
+
export declare function valueProgramKind(program: ValueProgram): ValueKind;
|
|
29
33
|
export declare function classifyPreparedValueKind(compiled: CompiledInstanceSchema): ValueKind;
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { runSuspended } from '../suspended.js';
|
|
2
2
|
import { loadValueProgram } from './compile/load.js';
|
|
3
3
|
import { prepareValueSchema } from './evaluate/preparation.js';
|
|
4
|
+
import { isDateValue } from './model/date.js';
|
|
5
|
+
import { isInstantValue } from './model/instant.js';
|
|
4
6
|
import { schemaList } from './syntax/walk.js';
|
|
7
|
+
/** Whether an external rank or literal belongs to a declared ordering domain. */
|
|
8
|
+
export function isOrderingValue(input, kind) {
|
|
9
|
+
switch (kind) {
|
|
10
|
+
case 'boolean':
|
|
11
|
+
return typeof input === 'boolean';
|
|
12
|
+
case 'number':
|
|
13
|
+
return typeof input === 'number' && Number.isFinite(input);
|
|
14
|
+
case 'string':
|
|
15
|
+
return typeof input === 'string';
|
|
16
|
+
case 'date':
|
|
17
|
+
return isDateValue(input);
|
|
18
|
+
case 'instant':
|
|
19
|
+
return isInstantValue(input);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
5
22
|
const ALL_JSON_KINDS = new Set([
|
|
6
23
|
'null',
|
|
7
24
|
'boolean',
|
|
@@ -32,7 +49,11 @@ export function classifyPreparedOrdering(compiled) {
|
|
|
32
49
|
if (candidates.size !== 1)
|
|
33
50
|
return undefined;
|
|
34
51
|
const [kind] = candidates;
|
|
35
|
-
return kind === 'boolean' ||
|
|
52
|
+
return kind === 'boolean' ||
|
|
53
|
+
kind === 'number' ||
|
|
54
|
+
kind === 'string' ||
|
|
55
|
+
kind === 'instant' ||
|
|
56
|
+
kind === 'date'
|
|
36
57
|
? kind
|
|
37
58
|
: undefined;
|
|
38
59
|
}
|
|
@@ -40,6 +61,7 @@ const valueKinds = {
|
|
|
40
61
|
text: true,
|
|
41
62
|
number: true,
|
|
42
63
|
instant: true,
|
|
64
|
+
date: true,
|
|
43
65
|
enum: true,
|
|
44
66
|
boolean: true,
|
|
45
67
|
set: true,
|
|
@@ -53,7 +75,7 @@ export const VALUE_KINDS = Object.freeze(Object.keys(valueKinds));
|
|
|
53
75
|
/**
|
|
54
76
|
* The value kind of a property schema (page "Fondations Query v7", § Atoms et value kinds, Y4):
|
|
55
77
|
* the one kind its non-null values admit, `null` being a point of every kind. An annotated
|
|
56
|
-
* instant is `instant`, a finite set of strings `enum`, an array of unique items `set`; an
|
|
78
|
+
* instant is `instant`, a declared day `date`, a finite set of strings `enum`, an array of unique items `set`; an
|
|
57
79
|
* ambiguous union, an object, an array with repetitions or a domain without values is `json`.
|
|
58
80
|
*/
|
|
59
81
|
export function classifyValueKind(contract, registry) {
|
|
@@ -62,6 +84,10 @@ export function classifyValueKind(contract, registry) {
|
|
|
62
84
|
return 'json';
|
|
63
85
|
return classifyPreparedValueKind(prepared.value);
|
|
64
86
|
}
|
|
87
|
+
/** Derive the non-null kind of a resolved Property, following its bound references. */
|
|
88
|
+
export function valueProgramKind(program) {
|
|
89
|
+
return classifyPreparedValueKind(loadValueProgram(program));
|
|
90
|
+
}
|
|
65
91
|
export function classifyPreparedValueKind(compiled) {
|
|
66
92
|
const candidates = new Set(candidatesOf(compiled));
|
|
67
93
|
candidates.delete('null');
|
|
@@ -73,6 +99,7 @@ export function classifyPreparedValueKind(compiled) {
|
|
|
73
99
|
return 'text';
|
|
74
100
|
case 'number':
|
|
75
101
|
case 'boolean':
|
|
102
|
+
case 'date':
|
|
76
103
|
case 'instant':
|
|
77
104
|
case 'enum':
|
|
78
105
|
case 'set':
|
|
@@ -107,10 +134,11 @@ function* classifySchema(compiled, location, read) {
|
|
|
107
134
|
const schema = location.schema;
|
|
108
135
|
let candidates = ALL_JSON_KINDS;
|
|
109
136
|
if (Object.hasOwn(schema, 'x-astrale-value-kind')) {
|
|
110
|
-
|
|
137
|
+
const kind = schema['x-astrale-value-kind'];
|
|
138
|
+
if ((kind !== 'instant' && kind !== 'date') || schema.type !== 'string') {
|
|
111
139
|
return new Set();
|
|
112
140
|
}
|
|
113
|
-
candidates = intersect(candidates, new Set([
|
|
141
|
+
candidates = intersect(candidates, new Set([kind]));
|
|
114
142
|
}
|
|
115
143
|
const declaredTypes = typesOf(schema.type);
|
|
116
144
|
if (declaredTypes !== undefined)
|
|
@@ -201,6 +229,8 @@ function meet(left, right) {
|
|
|
201
229
|
* orders as instants.
|
|
202
230
|
*/
|
|
203
231
|
const NARROWER = [
|
|
232
|
+
['date', 'string'],
|
|
233
|
+
['date', 'enum'],
|
|
204
234
|
['instant', 'string'],
|
|
205
235
|
['enum', 'string'],
|
|
206
236
|
['instant', 'enum'],
|
|
@@ -222,12 +252,10 @@ function union(left, right) {
|
|
|
222
252
|
}
|
|
223
253
|
/** A kind absorbs its subsets; strings of two subsets are strings. */
|
|
224
254
|
function normalize(input) {
|
|
225
|
-
if (input.has('enum') && input.has('instant'))
|
|
226
|
-
input.delete('enum');
|
|
227
|
-
input.delete('instant');
|
|
255
|
+
if (input.has('enum') && (input.has('instant') || input.has('date')))
|
|
228
256
|
input.add('string');
|
|
229
|
-
}
|
|
230
257
|
if (input.has('string')) {
|
|
258
|
+
input.delete('date');
|
|
231
259
|
input.delete('instant');
|
|
232
260
|
input.delete('enum');
|
|
233
261
|
}
|
|
@@ -58,8 +58,9 @@ function validateValueKind(schema, context, depth, pointer, diagnostics) {
|
|
|
58
58
|
diagnostics.push(diagnostic('VS_VALUE_KIND', `${pointer}/x-astrale-value-kind`, 'blob must be the exact schema.values.blob output at the root of a Node property.'));
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
else if (schema['x-astrale-value-kind'] !== 'instant'
|
|
62
|
-
|
|
61
|
+
else if ((schema['x-astrale-value-kind'] !== 'instant' && schema['x-astrale-value-kind'] !== 'date') ||
|
|
62
|
+
schema.type !== 'string') {
|
|
63
|
+
diagnostics.push(diagnostic('VS_VALUE_KIND', `${pointer}/x-astrale-value-kind`, 'Expected date or instant beside type string, a blob Property, or a callable input file.'));
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
function isCanonicalBlobSchema(input) {
|
|
@@ -32,5 +32,5 @@ export interface DeclaredValueKind {
|
|
|
32
32
|
readonly statement: string;
|
|
33
33
|
}
|
|
34
34
|
/** The value kinds `x-astrale-value-kind` declares; it admits no other value. */
|
|
35
|
-
export declare const DECLARED_VALUE_KINDS: Readonly<Record<'instant' | 'blob' | 'file', DeclaredValueKind>>;
|
|
35
|
+
export declare const DECLARED_VALUE_KINDS: Readonly<Record<'instant' | 'date' | 'blob' | 'file', DeclaredValueKind>>;
|
|
36
36
|
export {};
|
|
@@ -108,6 +108,11 @@ export const DECLARED_VALUE_KINDS = Object.freeze({
|
|
|
108
108
|
placement: 'any',
|
|
109
109
|
statement: 'A UTC instant written YYYY-MM-DDTHH:mm:ss.sssZ, in the years 0000 to 9999, whose text order is its chronological order.',
|
|
110
110
|
}),
|
|
111
|
+
date: Object.freeze({
|
|
112
|
+
type: 'string',
|
|
113
|
+
placement: 'any',
|
|
114
|
+
statement: 'A calendar day written YYYY-MM-DD, in proleptic Gregorian years 0000 to 9999, whose text order is its chronological order.',
|
|
115
|
+
}),
|
|
111
116
|
blob: Object.freeze({
|
|
112
117
|
type: 'object',
|
|
113
118
|
placement: 'node-property',
|
|
@@ -2509,6 +2509,7 @@
|
|
|
2509
2509
|
"x-astrale-value-kind": {
|
|
2510
2510
|
"enum": [
|
|
2511
2511
|
"instant",
|
|
2512
|
+
"date",
|
|
2512
2513
|
"file"
|
|
2513
2514
|
]
|
|
2514
2515
|
}
|
|
@@ -2566,6 +2567,7 @@
|
|
|
2566
2567
|
"x-astrale-value-kind": {
|
|
2567
2568
|
"enum": [
|
|
2568
2569
|
"instant",
|
|
2570
|
+
"date",
|
|
2569
2571
|
"blob",
|
|
2570
2572
|
"file"
|
|
2571
2573
|
]
|
|
@@ -2593,6 +2595,7 @@
|
|
|
2593
2595
|
"x-astrale-value-kind": {
|
|
2594
2596
|
"enum": [
|
|
2595
2597
|
"instant",
|
|
2598
|
+
"date",
|
|
2596
2599
|
"file"
|
|
2597
2600
|
]
|
|
2598
2601
|
}
|
|
@@ -124,6 +124,11 @@ declare const rows: {
|
|
|
124
124
|
statement: string;
|
|
125
125
|
laws: [string, string];
|
|
126
126
|
};
|
|
127
|
+
VALUE_DATE: {
|
|
128
|
+
subjects: ["property.schema", "value"];
|
|
129
|
+
statement: string;
|
|
130
|
+
laws: [string];
|
|
131
|
+
};
|
|
127
132
|
VALUE_INSTANT: {
|
|
128
133
|
subjects: ["property.schema", "value"];
|
|
129
134
|
statement: string;
|
|
@@ -62,7 +62,7 @@ const rows = {
|
|
|
62
62
|
},
|
|
63
63
|
PROPERTY_ORDERING: {
|
|
64
64
|
subjects: ['property.schema'],
|
|
65
|
-
statement: 'A Property orders as boolean, number, string or
|
|
65
|
+
statement: 'A Property orders as boolean, number, string, instant or date only when every value its schema admits is of that one scalar kind, as a conservative reading of the schema shows. A schema that also admits null, an array or an object, or one the reading does not settle, such as one that rules the other kinds out through `not` or `if`, gives it no ordering. Only the schema decides: no annotation keyword, example or stored value does.',
|
|
66
66
|
laws: ['VS-ORDERING-CLASSIFICATION', 'COMPILED-PROPERTY-ORDERING'],
|
|
67
67
|
},
|
|
68
68
|
AUTO_EXPLICIT: {
|
|
@@ -135,6 +135,11 @@ const rows = {
|
|
|
135
135
|
statement: 'The canonical text of a value is its RFC 8785 JSON. Decoding reads exactly one strict JSON value, and refuses a duplicate name, a number past the binary64 range and one that resolves to negative zero. Any other number reads as its nearest binary64, as `1e-999` reads as 0.',
|
|
136
136
|
laws: ['VALUE-CANONICAL', 'VALUE-DECODE'],
|
|
137
137
|
},
|
|
138
|
+
VALUE_DATE: {
|
|
139
|
+
subjects: ['property.schema', 'value'],
|
|
140
|
+
statement: 'A calendar date is an existing proleptic Gregorian day written YYYY-MM-DD, from year 0000 through 9999. Code-point order gives chronological order.',
|
|
141
|
+
laws: ['VS-VALUE-KIND'],
|
|
142
|
+
},
|
|
138
143
|
VALUE_INSTANT: {
|
|
139
144
|
subjects: ['property.schema', 'value'],
|
|
140
145
|
statement: 'An instant is a proleptic-Gregorian YYYY-MM-DDTHH:mm:ss.sssZ from year 0000 through 9999, in UTC, with three millisecond digits and no leap second. Code-point order of its text is chronological order, and two different texts are two different milliseconds.',
|
|
@@ -36,10 +36,19 @@ export declare const DISPOSE: Readonly<{
|
|
|
36
36
|
readonly reason: 'restricted-deletion';
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
|
-
readonly statement: "An Edge of a Class that stays, the Kernel's aside,
|
|
39
|
+
readonly statement: "An Edge of a Class that stays, the Kernel's aside, in contract at a Node that leaves keeps that Node unless every role holding it at that end detaches: an end no role accepts it at restricts, in a Class read because a role of it restricts or accepted a Class the target no longer declares concrete. A Node a destructive change retires is read under its previous contract, any other under the target. The end is named by the previous orientation and its roles by the target, so an Edge Class such a change also makes undirected restricts a Core Node that leaves, whatever the target declares. An Edge out of contract keeps no Node, as DISPOSE.EDGE_OUT_OF_CONTRACT_CUT states.";
|
|
40
40
|
readonly accepted: 'DV_EDGE_LIFETIME';
|
|
41
41
|
readonly laws: readonly ["SD-LIFETIMES", "SD-REMOVED-CORE-REFERENCE"];
|
|
42
42
|
};
|
|
43
|
+
readonly EDGE_OUT_OF_CONTRACT_CUT: {
|
|
44
|
+
readonly phase: 'dispose';
|
|
45
|
+
readonly layer: 'structure';
|
|
46
|
+
readonly subjects: readonly ["endpoint.accepts", "fact.edge"];
|
|
47
|
+
readonly does: 'apply';
|
|
48
|
+
readonly modes: readonly DisposeMode[];
|
|
49
|
+
readonly statement: 'An Edge of a Class that stays at a Node that leaves is out of contract when a role of its Class in the Registry in force does not accept the Class of the Node at its end, an earlier Kernel having let a lineage narrow below it. No Mutation locates it, and it goes with the Node whatever its lifetimes: the activation cuts it with its tombstone and keeps it, in one count and the first 20 in key order, as the cut of the Execution it serves, and refuses with no effect when it serves none.';
|
|
50
|
+
readonly laws: readonly ["SD-LIFETIMES", "SCHEMA-RETIREMENT-CUT"];
|
|
51
|
+
};
|
|
43
52
|
readonly INSPECTION_EXCEEDED: {
|
|
44
53
|
readonly phase: 'dispose';
|
|
45
54
|
readonly layer: 'limit';
|
|
@@ -127,9 +136,9 @@ export declare const DISPOSE: Readonly<{
|
|
|
127
136
|
readonly subjects: readonly ["fact.edge"];
|
|
128
137
|
readonly does: 'apply';
|
|
129
138
|
readonly modes: readonly ["destructive"];
|
|
130
|
-
readonly statement: 'The activation deletes every Edge of a target Class at a retiring Node, and every Edge of a retiring Class at a Node it deletes, each with its tombstone.';
|
|
131
|
-
readonly divergence: 'On PostgreSQL the cost follows the smaller of the retiring Nodes and the Edges of the
|
|
132
|
-
readonly laws: readonly ["SCHEMA-RETIREMENT-ISLAND"];
|
|
139
|
+
readonly statement: 'The activation deletes every Edge of a target Class at a retiring Node, and every Edge of a retiring Class at a Node it deletes, each with its tombstone. The uninstall reports, in one count and the first 20 in key order, every Edge of a target Class it deleted, at the activation or in the purge.';
|
|
140
|
+
readonly divergence: 'On PostgreSQL the cost follows the smaller of the retiring Nodes and the Edges of the concrete Edge Classes of the target. Reference scans every Edge.';
|
|
141
|
+
readonly laws: readonly ["SCHEMA-RETIREMENT-ISLAND", "SCHEMA-RETIREMENT-CUT"];
|
|
133
142
|
};
|
|
134
143
|
readonly RETIRING_FACT_UNREADABLE: {
|
|
135
144
|
readonly phase: 'dispose';
|
|
@@ -137,7 +146,8 @@ export declare const DISPOSE: Readonly<{
|
|
|
137
146
|
readonly subjects: readonly ["fact.schema"];
|
|
138
147
|
readonly does: 'apply';
|
|
139
148
|
readonly modes: readonly DisposeMode[];
|
|
140
|
-
readonly statement: 'A retiring fact stays stored until the purge erases it, and no Query or Path
|
|
149
|
+
readonly statement: 'A retiring fact stays stored until the purge erases it, and no Query or Path answers it, nor an Edge of a Class that stays an earlier Kernel left at a retiring Node. A Mutation names none, and meets one only as DISPOSE.RETIRING_ID_HELD and DISPOSE.RETIRING_EDGE_ERASED state.';
|
|
150
|
+
readonly divergence: 'Until the purge cuts such an Edge, Reference answers every read as if neither it nor its retiring Node were stored. PostgreSQL leaves it out of the extent of its Class, but refuses QUERY_RESULT_INVALID a Query whose Path reaches the retiring Node through it.';
|
|
141
151
|
readonly laws: readonly ["SCHEMA-RETIREMENT-AT-ACTIVATION", "POSTGRES-RETIRING-ABSENT"];
|
|
142
152
|
};
|
|
143
153
|
readonly RETIRING_ID_HELD: {
|
|
@@ -171,7 +181,7 @@ export declare const DISPOSE: Readonly<{
|
|
|
171
181
|
readonly subjects: readonly ["fact.schema"];
|
|
172
182
|
readonly does: 'apply';
|
|
173
183
|
readonly modes: readonly DisposeMode[];
|
|
174
|
-
readonly statement: 'The purge erases retiring facts in batches of at most its limit, every Edge before every Node, each with the tombstone of an ordinary deletion. A
|
|
184
|
+
readonly statement: 'The purge erases retiring facts in batches of at most its limit, every Edge before every Node, each with the tombstone of an ordinary deletion. A retiring Node leaves once no Edge is at it: the purge first deletes the Edges of Classes that stay still there, which an earlier Kernel could leave, each counting against the limit and spread over as many batches as it takes, so every batch deletes a fact. A batch sent again erases the next facts. A purge and the record of its end ask again when the Instance admission moved, up to four times.';
|
|
175
185
|
readonly laws: readonly ["SCHEMA-PURGE-BATCH", "SCHEMA-PURGE-REPLAY", "UNINSTALL-WORKFLOW-PURGE", "POSTGRES-RETIREMENT-PURGE", "SA-PURGE-EVIDENCE"];
|
|
176
186
|
};
|
|
177
187
|
readonly SERVICE_AWAITS_PURGE: {
|
|
@@ -30,10 +30,19 @@ export const DISPOSE = deepFreeze({
|
|
|
30
30
|
does: 'refuse',
|
|
31
31
|
modes: LEAVING,
|
|
32
32
|
refusal: { requirement: { operation: 'remove-facts', reason: 'restricted-deletion' } },
|
|
33
|
-
statement: "An Edge of a Class that stays, the Kernel's aside,
|
|
33
|
+
statement: "An Edge of a Class that stays, the Kernel's aside, in contract at a Node that leaves keeps that Node unless every role holding it at that end detaches: an end no role accepts it at restricts, in a Class read because a role of it restricts or accepted a Class the target no longer declares concrete. A Node a destructive change retires is read under its previous contract, any other under the target. The end is named by the previous orientation and its roles by the target, so an Edge Class such a change also makes undirected restricts a Core Node that leaves, whatever the target declares. An Edge out of contract keeps no Node, as DISPOSE.EDGE_OUT_OF_CONTRACT_CUT states.",
|
|
34
34
|
accepted: 'DV_EDGE_LIFETIME',
|
|
35
35
|
laws: ['SD-LIFETIMES', 'SD-REMOVED-CORE-REFERENCE'],
|
|
36
36
|
},
|
|
37
|
+
EDGE_OUT_OF_CONTRACT_CUT: {
|
|
38
|
+
phase: 'dispose',
|
|
39
|
+
layer: 'structure',
|
|
40
|
+
subjects: ['endpoint.accepts', 'fact.edge'],
|
|
41
|
+
does: 'apply',
|
|
42
|
+
modes: LEAVING,
|
|
43
|
+
statement: 'An Edge of a Class that stays at a Node that leaves is out of contract when a role of its Class in the Registry in force does not accept the Class of the Node at its end, an earlier Kernel having let a lineage narrow below it. No Mutation locates it, and it goes with the Node whatever its lifetimes: the activation cuts it with its tombstone and keeps it, in one count and the first 20 in key order, as the cut of the Execution it serves, and refuses with no effect when it serves none.',
|
|
44
|
+
laws: ['SD-LIFETIMES', 'SCHEMA-RETIREMENT-CUT'],
|
|
45
|
+
},
|
|
37
46
|
INSPECTION_EXCEEDED: {
|
|
38
47
|
phase: 'dispose',
|
|
39
48
|
layer: 'limit',
|
|
@@ -116,9 +125,9 @@ export const DISPOSE = deepFreeze({
|
|
|
116
125
|
subjects: ['fact.edge'],
|
|
117
126
|
does: 'apply',
|
|
118
127
|
modes: ['destructive'],
|
|
119
|
-
statement: 'The activation deletes every Edge of a target Class at a retiring Node, and every Edge of a retiring Class at a Node it deletes, each with its tombstone.',
|
|
120
|
-
divergence: 'On PostgreSQL the cost follows the smaller of the retiring Nodes and the Edges of the
|
|
121
|
-
laws: ['SCHEMA-RETIREMENT-ISLAND'],
|
|
128
|
+
statement: 'The activation deletes every Edge of a target Class at a retiring Node, and every Edge of a retiring Class at a Node it deletes, each with its tombstone. The uninstall reports, in one count and the first 20 in key order, every Edge of a target Class it deleted, at the activation or in the purge.',
|
|
129
|
+
divergence: 'On PostgreSQL the cost follows the smaller of the retiring Nodes and the Edges of the concrete Edge Classes of the target. Reference scans every Edge.',
|
|
130
|
+
laws: ['SCHEMA-RETIREMENT-ISLAND', 'SCHEMA-RETIREMENT-CUT'],
|
|
122
131
|
},
|
|
123
132
|
RETIRING_FACT_UNREADABLE: {
|
|
124
133
|
phase: 'dispose',
|
|
@@ -126,7 +135,8 @@ export const DISPOSE = deepFreeze({
|
|
|
126
135
|
subjects: ['fact.schema'],
|
|
127
136
|
does: 'apply',
|
|
128
137
|
modes: RETIRING,
|
|
129
|
-
statement: 'A retiring fact stays stored until the purge erases it, and no Query or Path
|
|
138
|
+
statement: 'A retiring fact stays stored until the purge erases it, and no Query or Path answers it, nor an Edge of a Class that stays an earlier Kernel left at a retiring Node. A Mutation names none, and meets one only as DISPOSE.RETIRING_ID_HELD and DISPOSE.RETIRING_EDGE_ERASED state.',
|
|
139
|
+
divergence: 'Until the purge cuts such an Edge, Reference answers every read as if neither it nor its retiring Node were stored. PostgreSQL leaves it out of the extent of its Class, but refuses QUERY_RESULT_INVALID a Query whose Path reaches the retiring Node through it.',
|
|
130
140
|
laws: ['SCHEMA-RETIREMENT-AT-ACTIVATION', 'POSTGRES-RETIRING-ABSENT'],
|
|
131
141
|
},
|
|
132
142
|
RETIRING_ID_HELD: {
|
|
@@ -155,7 +165,7 @@ export const DISPOSE = deepFreeze({
|
|
|
155
165
|
subjects: ['fact.schema'],
|
|
156
166
|
does: 'apply',
|
|
157
167
|
modes: RETIRING,
|
|
158
|
-
statement: 'The purge erases retiring facts in batches of at most its limit, every Edge before every Node, each with the tombstone of an ordinary deletion. A
|
|
168
|
+
statement: 'The purge erases retiring facts in batches of at most its limit, every Edge before every Node, each with the tombstone of an ordinary deletion. A retiring Node leaves once no Edge is at it: the purge first deletes the Edges of Classes that stay still there, which an earlier Kernel could leave, each counting against the limit and spread over as many batches as it takes, so every batch deletes a fact. A batch sent again erases the next facts. A purge and the record of its end ask again when the Instance admission moved, up to four times.',
|
|
159
169
|
laws: [
|
|
160
170
|
'SCHEMA-PURGE-BATCH',
|
|
161
171
|
'SCHEMA-PURGE-REPLAY',
|
package/dist/v1/schema/rule.js
CHANGED
|
@@ -174,7 +174,7 @@ const DECLARED = {
|
|
|
174
174
|
DV_EDGE_UNIQUE: {
|
|
175
175
|
stage: 'context',
|
|
176
176
|
positions: ['/classes/{class}/unique/{index}/{index}/property'],
|
|
177
|
-
statement: 'Each Property a unique tuple of an Edge Class names is a Property of the Class, own or inherited, that is keyable: a string, number, boolean or
|
|
177
|
+
statement: 'Each Property a unique tuple of an Edge Class names is a Property of the Class, own or inherited, that is keyable: a string, number, boolean, instant or date that no automatic program writes.',
|
|
178
178
|
},
|
|
179
179
|
DV_ENTRYPOINT: {
|
|
180
180
|
stage: 'rule',
|
|
@@ -210,7 +210,7 @@ const DECLARED = {
|
|
|
210
210
|
DV_NODE_UNIQUE: {
|
|
211
211
|
stage: 'context',
|
|
212
212
|
positions: ['/classes/{class}/unique/{index}/{index}'],
|
|
213
|
-
statement: 'Each Property a unique tuple of a Node Class names is a Property of the Class, own or inherited, that is keyable: a string, number, boolean or
|
|
213
|
+
statement: 'Each Property a unique tuple of a Node Class names is a Property of the Class, own or inherited, that is keyable: a string, number, boolean, instant or date that no automatic program writes.',
|
|
214
214
|
},
|
|
215
215
|
DV_PROPERTY_AUTO: {
|
|
216
216
|
stage: 'context',
|
|
@@ -161,7 +161,7 @@ function validateUniqueProperties(registryOf, analysis, owner, declaration, poin
|
|
|
161
161
|
const registry = registryOf(property.owner.origin);
|
|
162
162
|
const ordering = registry === undefined ? undefined : classifyOrdering(property.schema, registry);
|
|
163
163
|
if (!keyableProperty(ordering, property.auto)) {
|
|
164
|
-
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.'));
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
167
|
if (declaration.kind === 'node') {
|
|
@@ -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';
|