@altopelago/sansa 0.11.1 → 0.12.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/CHANGELOG.md +71 -0
- package/README.md +23 -2
- package/conformance/cts-claims.json +9 -2
- package/docs/api-contract.md +101 -13
- package/docs/capabilities.json +3 -1
- package/docs/query-tool.md +42 -2
- package/docs/releasing.md +11 -8
- package/fixtures/query-inventory.aeon +7 -0
- package/fixtures/query-inventory.telex.aes +5 -0
- package/package.json +1 -1
- package/scripts/cts-value-semantics.mjs +1 -1
- package/scripts/query.mjs +17 -0
- package/src/index.d.ts +79 -4
- package/src/index.js +942 -53
- package/tools/mutate-web/runtime.mjs +30 -1
- package/tools/query-web/examples.mjs +44 -1
- package/tools/query-web/index.html +2 -0
- package/tools/query-web/runtime.mjs +97 -3
package/src/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export type SansaParseErrorCode =
|
|
|
47
47
|
| 'SANSA_QUERY_INVALID_RADIX_LITERAL'
|
|
48
48
|
| 'SANSA_QUERY_INVALID_ENCODING_LITERAL'
|
|
49
49
|
| 'SANSA_QUERY_INVALID_SEPARATOR_LITERAL'
|
|
50
|
+
| 'SANSA_QUERY_INVALID_SYMBOL_LITERAL'
|
|
50
51
|
| 'SANSA_QUERY_INVALID_NULL_LITERAL'
|
|
51
52
|
| 'SANSA_QUERY_INVALID_TEMPORAL_LITERAL'
|
|
52
53
|
| 'SANSA_QUERY_INVALID_RESOLUTION_EXPRESSION'
|
|
@@ -278,6 +279,12 @@ export interface SansaResolveBinding {
|
|
|
278
279
|
readonly valueKind?: string;
|
|
279
280
|
readonly literalKind?: string;
|
|
280
281
|
readonly nullReason?: string;
|
|
282
|
+
/** Canonical finite AEON numeric text used for lossless comparison. */
|
|
283
|
+
readonly numericLexeme?: string;
|
|
284
|
+
/** Resolved base for an AEON radix-family value. */
|
|
285
|
+
readonly radixBase?: number;
|
|
286
|
+
/** Count of represented fractional radix digits, excluding visual separators. */
|
|
287
|
+
readonly radixScale?: number;
|
|
281
288
|
readonly value?: unknown;
|
|
282
289
|
readonly scalar?: unknown;
|
|
283
290
|
readonly origin?: string;
|
|
@@ -311,7 +318,7 @@ export interface SansaResolveNamespace<TBinding extends object = SansaResolveBin
|
|
|
311
318
|
readonly root: TBinding | (() => TBinding | undefined);
|
|
312
319
|
readonly contextualRoot?: TBinding;
|
|
313
320
|
readonly children?: (binding: TBinding) => Iterable<TBinding> | readonly TBinding[] | undefined;
|
|
314
|
-
readonly parent?: (binding: TBinding) => TBinding | undefined;
|
|
321
|
+
readonly parent?: (binding: TBinding) => TBinding | null | undefined;
|
|
315
322
|
readonly member?: (binding: TBinding, name: string) => TBinding | undefined;
|
|
316
323
|
readonly position?: (binding: TBinding, index: number) => TBinding | undefined;
|
|
317
324
|
readonly attributeSpace?: (binding: TBinding) => TBinding | undefined;
|
|
@@ -322,14 +329,35 @@ export interface SansaResolveNamespace<TBinding extends object = SansaResolveBin
|
|
|
322
329
|
readonly representationKind?: (binding: TBinding) => string | undefined;
|
|
323
330
|
readonly value?: (binding: TBinding) => unknown;
|
|
324
331
|
readonly nullReason?: (binding: TBinding) => string | undefined;
|
|
332
|
+
/** Return canonical finite numeric text without host-number coercion. */
|
|
333
|
+
readonly numericLexeme?: (binding: TBinding) => string | undefined;
|
|
334
|
+
/** Return the resolved base for a radix-family binding. */
|
|
335
|
+
readonly radixBase?: (binding: TBinding) => number | undefined;
|
|
336
|
+
/** Return the represented fractional radix digit count. */
|
|
337
|
+
readonly radixScale?: (binding: TBinding) => number | undefined;
|
|
325
338
|
readonly semanticTypeMatches?: (binding: TBinding, expected: string) => boolean;
|
|
326
339
|
readonly representationKindMatches?: (binding: TBinding, expected: string) => boolean;
|
|
340
|
+
/**
|
|
341
|
+
* Optionally compare two same-kind container bindings without materializing them.
|
|
342
|
+
* The result must implement the active value-semantics profile. Return
|
|
343
|
+
* undefined to decline and use SANSA's generic structural comparison.
|
|
344
|
+
*/
|
|
345
|
+
readonly structurallyEqual?: (
|
|
346
|
+
left: TBinding,
|
|
347
|
+
right: TBinding,
|
|
348
|
+
context: SansaStructuralEqualityContext,
|
|
349
|
+
) => boolean | undefined;
|
|
327
350
|
readonly bindingHandle?: (binding: TBinding) => unknown;
|
|
328
351
|
readonly observedState?: (binding: TBinding) => unknown;
|
|
329
352
|
readonly namespaceState?: (() => unknown) | unknown;
|
|
330
353
|
readonly mutate?: SansaMutationAdapter<TBinding>;
|
|
331
354
|
}
|
|
332
355
|
|
|
356
|
+
export interface SansaStructuralEqualityContext {
|
|
357
|
+
readonly operator: '==' | '!=';
|
|
358
|
+
readonly valueSemantics: AeonValueSemanticsProfile;
|
|
359
|
+
}
|
|
360
|
+
|
|
333
361
|
export interface SansaGraphRelationshipDeclaration {
|
|
334
362
|
readonly id: string;
|
|
335
363
|
readonly direction: 'directed';
|
|
@@ -912,7 +940,13 @@ export interface SansaQueryObjectValue {
|
|
|
912
940
|
readonly value: Record<string, unknown>;
|
|
913
941
|
}
|
|
914
942
|
|
|
915
|
-
export type AeonValueSemanticsOperation =
|
|
943
|
+
export type AeonValueSemanticsOperation =
|
|
944
|
+
| 'equal'
|
|
945
|
+
| 'notEqual'
|
|
946
|
+
| 'compare'
|
|
947
|
+
| 'isValue'
|
|
948
|
+
| 'radixScale'
|
|
949
|
+
| 'temporalRelation';
|
|
916
950
|
|
|
917
951
|
export type AeonValueSemanticsCategory =
|
|
918
952
|
| 'finiteNumber'
|
|
@@ -926,6 +960,7 @@ export type AeonValueSemanticsCategory =
|
|
|
926
960
|
| 'radix'
|
|
927
961
|
| 'encoding'
|
|
928
962
|
| 'separator'
|
|
963
|
+
| 'symbol'
|
|
929
964
|
| 'sansaAddress'
|
|
930
965
|
| 'referenceForm'
|
|
931
966
|
| 'temporal'
|
|
@@ -942,8 +977,10 @@ export interface AeonValueSemanticsProfile {
|
|
|
942
977
|
readonly stringOrder?: string;
|
|
943
978
|
readonly temporalOrder?: string;
|
|
944
979
|
readonly caseMapping?: string;
|
|
980
|
+
readonly radixComparison?: string;
|
|
945
981
|
readonly compareStrings: (left: string, right: string) => number;
|
|
946
982
|
readonly compareTemporal: (left: AeonTemporalSemanticValue, right: AeonTemporalSemanticValue) => number;
|
|
983
|
+
readonly compareRadix?: (left: AeonRadixSemanticValue, right: AeonRadixSemanticValue) => number | null;
|
|
947
984
|
readonly lowerString: (value: string) => string;
|
|
948
985
|
readonly upperString: (value: string) => string;
|
|
949
986
|
}
|
|
@@ -953,6 +990,21 @@ export interface AeonTemporalSemanticValue {
|
|
|
953
990
|
readonly semanticType?: string;
|
|
954
991
|
}
|
|
955
992
|
|
|
993
|
+
export type AeonTemporalClaimRelation =
|
|
994
|
+
| 'equal'
|
|
995
|
+
| 'before'
|
|
996
|
+
| 'after'
|
|
997
|
+
| 'contains'
|
|
998
|
+
| 'containedBy'
|
|
999
|
+
| 'overlaps'
|
|
1000
|
+
| 'incomparable';
|
|
1001
|
+
|
|
1002
|
+
export interface AeonRadixSemanticValue {
|
|
1003
|
+
readonly payload: string;
|
|
1004
|
+
readonly base: number;
|
|
1005
|
+
readonly semanticType?: string;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
956
1008
|
export interface AeonValueSemanticsProfileOptions {
|
|
957
1009
|
readonly id?: string;
|
|
958
1010
|
readonly locale?: string | readonly string[];
|
|
@@ -962,6 +1014,7 @@ export interface AeonValueSemanticsProfileOptions {
|
|
|
962
1014
|
readonly numeric?: boolean;
|
|
963
1015
|
readonly caseFirst?: 'upper' | 'lower' | 'false';
|
|
964
1016
|
readonly compareTemporal?: (left: AeonTemporalSemanticValue, right: AeonTemporalSemanticValue) => number;
|
|
1017
|
+
readonly compareRadix?: (left: AeonRadixSemanticValue, right: AeonRadixSemanticValue) => number | null;
|
|
965
1018
|
}
|
|
966
1019
|
|
|
967
1020
|
export type AeonValueSemanticsProfileInput =
|
|
@@ -976,6 +1029,8 @@ export interface AeonValueSemanticsValueDescriptor {
|
|
|
976
1029
|
readonly value?: unknown;
|
|
977
1030
|
readonly reason?: string;
|
|
978
1031
|
readonly semanticType?: string;
|
|
1032
|
+
readonly radixBase?: number;
|
|
1033
|
+
readonly radixScale?: number;
|
|
979
1034
|
readonly containerKind?: string;
|
|
980
1035
|
readonly count?: number;
|
|
981
1036
|
}
|
|
@@ -1001,8 +1056,8 @@ export type AeonValueSemanticsResult =
|
|
|
1001
1056
|
| {
|
|
1002
1057
|
readonly ok: true;
|
|
1003
1058
|
readonly outcome: 'value';
|
|
1004
|
-
readonly value?: boolean;
|
|
1005
|
-
readonly relation?: 'less' | 'equal' | 'greater';
|
|
1059
|
+
readonly value?: boolean | number;
|
|
1060
|
+
readonly relation?: 'less' | 'equal' | 'greater' | AeonTemporalClaimRelation;
|
|
1006
1061
|
}
|
|
1007
1062
|
| {
|
|
1008
1063
|
readonly ok: false;
|
|
@@ -1027,6 +1082,25 @@ export function createFrenchValueSemanticsProfile(
|
|
|
1027
1082
|
options?: Omit<AeonValueSemanticsProfileOptions, 'locale'> & { readonly locale?: 'fr' | 'fr-FR' },
|
|
1028
1083
|
): AeonValueSemanticsProfile;
|
|
1029
1084
|
export function createNaturalAsciiValueSemanticsProfile(options?: Omit<AeonValueSemanticsProfileOptions, 'locale'>): AeonValueSemanticsProfile;
|
|
1085
|
+
export function createRadixNumericValueSemanticsProfile(
|
|
1086
|
+
options?: { readonly id?: string },
|
|
1087
|
+
): AeonValueSemanticsProfile;
|
|
1088
|
+
export function createCrossBaseRadixNumericValueSemanticsProfile(
|
|
1089
|
+
options?: { readonly id?: string },
|
|
1090
|
+
): AeonValueSemanticsProfile;
|
|
1091
|
+
export function compareExactRadixValues(left: string, right: string, base: number): -1 | 0 | 1 | null;
|
|
1092
|
+
export function compareExactCrossBaseRadixValues(
|
|
1093
|
+
left: string,
|
|
1094
|
+
leftBase: number,
|
|
1095
|
+
right: string,
|
|
1096
|
+
rightBase: number,
|
|
1097
|
+
): -1 | 0 | 1 | null;
|
|
1098
|
+
export function compareTemporalClaims(
|
|
1099
|
+
left: AeonTemporalSemanticValue,
|
|
1100
|
+
right: AeonTemporalSemanticValue,
|
|
1101
|
+
): AeonTemporalClaimRelation;
|
|
1102
|
+
/** Return represented fractional radix digits, excluding `_`, or `null` for an invalid payload. */
|
|
1103
|
+
export function radixScaleOf(value: string, base?: number): number | null;
|
|
1030
1104
|
|
|
1031
1105
|
export interface SansaAddress {
|
|
1032
1106
|
readonly type: 'SansaAddress';
|
|
@@ -1112,6 +1186,7 @@ export interface SansaQueryLiteralExpression {
|
|
|
1112
1186
|
| 'radix'
|
|
1113
1187
|
| 'encoding'
|
|
1114
1188
|
| 'separator'
|
|
1189
|
+
| 'symbol'
|
|
1115
1190
|
| 'date'
|
|
1116
1191
|
| 'time'
|
|
1117
1192
|
| 'datetime'
|