@altopelago/sansa 0.14.0 → 0.14.2
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 +40 -0
- package/conformance/cts-claims.json +1 -1
- package/docs/api-contract.md +34 -0
- package/docs/capabilities.json +1 -1
- package/docs/releasing.md +4 -1
- package/package.json +1 -1
- package/src/index.js +93 -54
- package/tools/mutate-web/runtime.mjs +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,46 @@ versions may still include breaking changes when the SANSA specifications move.
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## 0.14.2 - 2026-10-16
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Preserved scalar value families in JavaScript Query when a host namespace
|
|
15
|
+
exposes portable PascalCase representation kinds such as `DateTimeLiteral`
|
|
16
|
+
or `WTCDateTimeLiteral`. Temporal bindings now reach temporal functions rather
|
|
17
|
+
than being mistaken for strings; other portable scalar families retain their
|
|
18
|
+
distinct comparison domains without changing representation-kind filters.
|
|
19
|
+
|
|
20
|
+
## 0.14.1 - 2026-10-16
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Aligned JavaScript and Rust temporal literals and AEON target validation with
|
|
25
|
+
AEON 0.14.0's year/month date ticks composed with clocks. Exact authored
|
|
26
|
+
fractional seconds, second 60, offset anchors and opaque WTC contexts remain
|
|
27
|
+
intact; GP/schema limits are not imposed by the parser.
|
|
28
|
+
- Rejected malformed clock/date fields, noncanonical `Local` case variants,
|
|
29
|
+
and comment-looking suffixes inside WTC contexts, including nested expressions.
|
|
30
|
+
Rust target validation checks the complete payload rather than parsing away
|
|
31
|
+
trailing trivia. Temporal relation helpers fail closed on malformed descriptors
|
|
32
|
+
and unsupported disjoint date/clock completion sets without panicking or
|
|
33
|
+
inventing omitted calendar fields.
|
|
34
|
+
- Updated AEON mutation target validation for the recent reserved `base64`
|
|
35
|
+
decodability rule, while retaining opaque `encoding`, `inline` and `embed`
|
|
36
|
+
payload semantics. Clone/pointer reference addresses are validated as addresses,
|
|
37
|
+
including native Rust descriptors, not decoded as literal Base64URL data.
|
|
38
|
+
- Protected decoded multiline prose/trimtick gutters when the mutation
|
|
39
|
+
workbench writes AEON source. AEON target validation rejects payloads whose
|
|
40
|
+
trailing newlines or whitespace-only content lines cannot survive trimtick
|
|
41
|
+
normalization; ordinary string and Telex payloads are not narrowed.
|
|
42
|
+
|
|
43
|
+
### Tests
|
|
44
|
+
|
|
45
|
+
- Added one shared JavaScript/Rust value fixture and a 1,109-case valid
|
|
46
|
+
calendar/clock matrix, plus malformed boundaries, Base64URL and symbol probes.
|
|
47
|
+
Tests exercise Query, JavaScript Instruction, native Rust scalar descriptors,
|
|
48
|
+
target validation and round trips through an available AEON Core runtime.
|
|
49
|
+
|
|
10
50
|
## 0.14.0 - 2026-10-15
|
|
11
51
|
|
|
12
52
|
### Added
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"claim_format": "aeonite.cts-claims.v1",
|
|
3
3
|
"repository": "AltoPelago/sansa",
|
|
4
4
|
"implementation": "@altopelago/sansa",
|
|
5
|
-
"implementation_version": "0.14.
|
|
5
|
+
"implementation_version": "0.14.2",
|
|
6
6
|
"cts_repository": "aeonite-org/aeonite-cts",
|
|
7
7
|
"cts_protocol": "cts.protocol.v1",
|
|
8
8
|
"claims": [
|
package/docs/api-contract.md
CHANGED
|
@@ -888,6 +888,12 @@ For simple hosts, bindings may expose fields directly:
|
|
|
888
888
|
|
|
889
889
|
`scalarKind`, `valueKind`, or `literalKind` may be used by host-neutral fixtures to preserve scalar forms that JSON cannot express directly, such as `nan`, `infinity`, and explicit `null`. `nullReason` carries the surfaced AEON null reason, such as `notSet` or `notApplicable`.
|
|
890
890
|
|
|
891
|
+
Query also recognizes the portable scalar representation names directly, including
|
|
892
|
+
`DateLiteral`, `TimeLiteral`, `DateTimeLiteral`, `WTCDateTimeLiteral` and
|
|
893
|
+
`SymbolicLiteral`, whether supplied by a namespace's `representationKind()` hook
|
|
894
|
+
or a binding field. This internal value-family classification does not rename
|
|
895
|
+
the exposed representation kinds or change `%RepresentationKind` filters.
|
|
896
|
+
|
|
891
897
|
Exact member and position selectors select direct children. This implementation caps position indexes and position range endpoints at `999999`; SANSA v1 portability requires implementations to support at least one million addressable positions, expressed as indexes `0` through `999999` inclusive. Larger accepted values are implementation-defined and non-portable. Implementations that accept larger values should surface `SANSA_NON_PORTABLE_POSITION_INDEX` when their host API supports non-fatal diagnostics. Position ranges select inclusive positional children exposed by the host binding; open start means position `0`, open end means through the final exposed positional child, and reversed ranges resolve to an empty binding set. `.^` selects an exposed parent binding, resolves empty at the effective resolution root unless stricter policy is requested, and fails explicitly when parent traversal is unsupported or forbidden. `.*` returns direct children. `.**` returns descendants in deterministic preorder, excluding the current binding. Descendant expansion follows structural children only; it does not implicitly enter attribute or local address spaces. `.("pattern")` selects direct children whose binding name matches the complete glob pattern, where `?` matches one Unicode code point and `*` matches zero or more Unicode code points. Within the decoded pattern payload, `\?`, `\*`, and `\\` match literal question mark, asterisk, and backslash characters respectively. Pattern matching operates on the exact exposed binding name without normalization or locale-sensitive comparison.
|
|
892
898
|
|
|
893
899
|
`#name` filters the current binding set by semantic type. The default matcher accepts exact semantic type names and base names before `<...>` or `[...]`. `%name` filters the current binding set by representation kind.
|
|
@@ -1099,6 +1105,34 @@ literals compare through the active temporal profile; the default profile uses
|
|
|
1099
1105
|
canonical payload order.
|
|
1100
1106
|
Explicit null literals are tested through null predicates rather than equality.
|
|
1101
1107
|
|
|
1108
|
+
The temporal literal boundary follows Core rather than the general-purpose
|
|
1109
|
+
schema: year/month date ticks can compose with clocks (`2024-T10:Z`,
|
|
1110
|
+
`2024-02T10:&Europe`), second `60` remains structurally valid, and arbitrary
|
|
1111
|
+
authored fractional digits are preserved. WTC `local` is case-sensitive; named
|
|
1112
|
+
contexts remain opaque ASCII payloads. Invalid fields and comment-looking
|
|
1113
|
+
punctuation inside a contiguous WTC token are not reinterpreted as trivia.
|
|
1114
|
+
|
|
1115
|
+
The built-in temporal relation helper handles contiguous date extents and
|
|
1116
|
+
complete-date clock extents. Clock-bearing year/month ticks can denote disjoint
|
|
1117
|
+
daily sets; those comparisons currently return `incomparable` rather than
|
|
1118
|
+
inventing a month/day or flattening the sets into a single interval. This
|
|
1119
|
+
conservative comparison limitation does not reject the literal or its AEON
|
|
1120
|
+
target representation. Default representation equality/order is unchanged.
|
|
1121
|
+
|
|
1122
|
+
AEON target validation also distinguishes reserved `base64` (decodable
|
|
1123
|
+
Base64URL, including valid padding and zero unused tail bits) from opaque
|
|
1124
|
+
`encoding`, `inline` and `embed` payloads. For `prose`/`trimtick`, exact multiline
|
|
1125
|
+
values must survive Core gutter normalization: trailing newlines and nonempty
|
|
1126
|
+
whitespace-only content lines cannot be preserved and produce a target-phase
|
|
1127
|
+
diagnostic before apply. The workbench protects representable leading empty
|
|
1128
|
+
lines and mixed payload indentation when re-emitting trimticks. Ordinary
|
|
1129
|
+
quoted-string values and direct Telex string payloads retain their full domain.
|
|
1130
|
+
|
|
1131
|
+
These datatype-specific literal checks do not decode reference addresses as
|
|
1132
|
+
payload data. Clone/pointer references (including native Rust reference-form
|
|
1133
|
+
descriptors) retain address validation; `base64` describes the referred value,
|
|
1134
|
+
not the bytes or Base64URL tail bits of its address.
|
|
1135
|
+
|
|
1102
1136
|
Current comparison policy:
|
|
1103
1137
|
|
|
1104
1138
|
| Operands | Equality | Ordering | Result |
|
package/docs/capabilities.json
CHANGED
package/docs/releasing.md
CHANGED
|
@@ -77,7 +77,10 @@ are published by the workflow using short-lived OIDC credentials.
|
|
|
77
77
|
3. Add the dated `X.Y.Z` release section and human-authored notes to
|
|
78
78
|
`CHANGELOG.md`.
|
|
79
79
|
4. Run `npm run version:check`, the test suite, CTS, stress tests, and package
|
|
80
|
-
dry-run.
|
|
80
|
+
dry-run. Keep the CTS checkout pinned to the same reviewed commit in CI and
|
|
81
|
+
both publish workflows. CI and npm publication also run the Query and Mutate
|
|
82
|
+
`next` manifests as supplemental AEON value-alignment checks; these do not
|
|
83
|
+
promote development snapshots into stable conformance claims.
|
|
81
84
|
5. Merge the release-prep PR into `main`.
|
|
82
85
|
6. Confirm CI passes on `main`.
|
|
83
86
|
7. Create tag `vX.Y.Z` from the checked `main` commit.
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -2049,6 +2049,16 @@ function validateAeonTargetValue(value, hints, path, operationIndex) {
|
|
|
2049
2049
|
if (representation === 'node') return validateAeonTargetNodeValue(value, path, operationIndex);
|
|
2050
2050
|
const scalarValidation = validateAeonTargetScalarValue(value, representation, path, operationIndex);
|
|
2051
2051
|
if (!scalarValidation.ok) return scalarValidation;
|
|
2052
|
+
// A reference payload is an address, not the referred value's literal data.
|
|
2053
|
+
if (['cloneReference', 'pointerReference', 'referenceForm'].includes(representation)) return { ok: true };
|
|
2054
|
+
if (typeof hints.datatype === 'string' && ['prose', 'trimtick'].includes(datatypeBaseName(hints.datatype))
|
|
2055
|
+
&& typeof value === 'string' && !isRepresentableTrimtickPayload(value)) {
|
|
2056
|
+
return invalidAeonTargetValue('Trimtick normalization cannot preserve trailing newlines or whitespace-only content lines', path, operationIndex);
|
|
2057
|
+
}
|
|
2058
|
+
if (typeof hints.datatype === 'string' && datatypeBaseName(hints.datatype) === 'base64'
|
|
2059
|
+
&& (typeof value !== 'string' || !isDecodableBase64UrlPayload(value))) {
|
|
2060
|
+
return invalidAeonTargetValue('base64 requires decodable Base64URL with zero unused tail bits', path, operationIndex);
|
|
2061
|
+
}
|
|
2052
2062
|
if (Array.isArray(value)) {
|
|
2053
2063
|
for (let index = 0; index < value.length; index += 1) {
|
|
2054
2064
|
const result = validateAeonTargetValue(value[index], {}, `${path}[${index}]`, operationIndex);
|
|
@@ -2121,7 +2131,7 @@ function validateAeonTargetScalarValue(value, representation, path, operationInd
|
|
|
2121
2131
|
? { ok: true }
|
|
2122
2132
|
: invalidAeonTargetValue('Boolean literals must use boolean payloads', path, operationIndex);
|
|
2123
2133
|
case 'hex':
|
|
2124
|
-
return typeof value === 'string' && /^[0-9A-Fa-f]+$/.test(value)
|
|
2134
|
+
return typeof value === 'string' && value.trim() === value && /^[0-9A-Fa-f]+$/.test(value)
|
|
2125
2135
|
? { ok: true }
|
|
2126
2136
|
: invalidAeonTargetValue('Hex literals must be non-empty hexadecimal text without the # prefix', path, operationIndex);
|
|
2127
2137
|
case 'radix':
|
|
@@ -5388,6 +5398,7 @@ export function compareTemporalClaims(left, right) {
|
|
|
5388
5398
|
function parseTemporalCompletionSet(input) {
|
|
5389
5399
|
const semanticType = String(input?.semanticType ?? 'temporal');
|
|
5390
5400
|
const payload = String(input?.payload ?? input?.value ?? '');
|
|
5401
|
+
if (!isQueryTemporalLiteral(payload, semanticType)) return null;
|
|
5391
5402
|
if (semanticType === 'date') {
|
|
5392
5403
|
const date = parseTemporalDate(payload);
|
|
5393
5404
|
if (date === null) return null;
|
|
@@ -5425,7 +5436,10 @@ function parseTemporalCompletionSet(input) {
|
|
|
5425
5436
|
const marker = base.indexOf('T');
|
|
5426
5437
|
if (marker === -1) return null;
|
|
5427
5438
|
date = parseTemporalDate(base.slice(0, marker));
|
|
5428
|
-
|
|
5439
|
+
// Clock-bearing year/month ticks have disjoint daily completion sets. This
|
|
5440
|
+
// conservative interval comparator must not invent a month/day or flatten
|
|
5441
|
+
// those sets into one interval. Rust returns incomparable for these too.
|
|
5442
|
+
if (date === null || date.month === null || date.day === null) return null;
|
|
5429
5443
|
clockText = base.slice(marker + 1);
|
|
5430
5444
|
}
|
|
5431
5445
|
const clock = parseTemporalClock(clockText, semanticType === 'time');
|
|
@@ -5471,6 +5485,7 @@ function temporalCompletionDomain(semanticType, anchor, context) {
|
|
|
5471
5485
|
}
|
|
5472
5486
|
|
|
5473
5487
|
function parseTemporalDate(value) {
|
|
5488
|
+
if (value.trim() !== value) return null;
|
|
5474
5489
|
const yearOnly = /^(\d{4})-$/.exec(value);
|
|
5475
5490
|
if (yearOnly !== null) {
|
|
5476
5491
|
const year = Number(yearOnly[1]);
|
|
@@ -5490,9 +5505,10 @@ function parseTemporalDate(value) {
|
|
|
5490
5505
|
}
|
|
5491
5506
|
|
|
5492
5507
|
function parseTemporalClock(value, requireColon) {
|
|
5508
|
+
if (value.trim() !== value) return null;
|
|
5493
5509
|
const pattern = requireColon
|
|
5494
|
-
? /^(\d{2}):(?:(\d{2})
|
|
5495
|
-
: /^(\d{2})(?::(\d{2})
|
|
5510
|
+
? /^(\d{2}):(?:(\d{2})(?::(\d{2})(?:\.(\d+))?)?)?(Z|[+-]\d{2}:\d{2})?$/
|
|
5511
|
+
: /^(\d{2})(?::(?:(\d{2})(?::(\d{2})(?:\.(\d+))?)?)?)?(Z|[+-]\d{2}:\d{2})?$/;
|
|
5496
5512
|
const match = pattern.exec(value);
|
|
5497
5513
|
if (match === null) return null;
|
|
5498
5514
|
const hour = Number(match[1]);
|
|
@@ -6477,15 +6493,33 @@ function isContainerBinding(namespace, binding) {
|
|
|
6477
6493
|
return containerKindFromBinding(namespace, binding) !== undefined;
|
|
6478
6494
|
}
|
|
6479
6495
|
|
|
6496
|
+
const PORTABLE_SCALAR_QUERY_KINDS = new Map([
|
|
6497
|
+
['StringLiteral', 'string'],
|
|
6498
|
+
['NumberLiteral', 'number'],
|
|
6499
|
+
['BooleanLiteral', 'boolean'],
|
|
6500
|
+
['ToggleLiteral', 'toggle'],
|
|
6501
|
+
['HexLiteral', 'hex'],
|
|
6502
|
+
['RadixLiteral', 'radix'],
|
|
6503
|
+
['EncodingLiteral', 'encoding'],
|
|
6504
|
+
['SeparatorLiteral', 'separator'],
|
|
6505
|
+
['SymbolicLiteral', 'symbol'],
|
|
6506
|
+
['SansaAddressLiteral', 'sansaAddress'],
|
|
6507
|
+
['DateLiteral', 'date'],
|
|
6508
|
+
['TimeLiteral', 'time'],
|
|
6509
|
+
['DateTimeLiteral', 'datetime'],
|
|
6510
|
+
['WTCDateTimeLiteral', 'wtc'],
|
|
6511
|
+
['NullLiteral', 'null'],
|
|
6512
|
+
['NaNLiteral', 'nan'],
|
|
6513
|
+
['InfinityLiteral', 'infinity'],
|
|
6514
|
+
]);
|
|
6515
|
+
|
|
6480
6516
|
function getBindingScalarKind(namespace, binding) {
|
|
6481
6517
|
const actual = typeof namespace.representationKind === 'function'
|
|
6482
6518
|
? namespace.representationKind(binding)
|
|
6483
6519
|
: binding.scalarKind ?? binding.valueKind ?? binding.literalKind ?? binding.representationKind ?? binding.kind ?? binding.type;
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
if (actual === 'SymbolicLiteral') return 'symbol';
|
|
6488
|
-
return typeof actual === 'string' ? lowerFirst(actual) : undefined;
|
|
6520
|
+
return typeof actual === 'string'
|
|
6521
|
+
? PORTABLE_SCALAR_QUERY_KINDS.get(actual) ?? lowerFirst(actual)
|
|
6522
|
+
: undefined;
|
|
6489
6523
|
}
|
|
6490
6524
|
|
|
6491
6525
|
function getBindingSemanticType(namespace, binding) {
|
|
@@ -8272,7 +8306,7 @@ class QueryExpressionParser {
|
|
|
8272
8306
|
|
|
8273
8307
|
startsTemporalLiteral() {
|
|
8274
8308
|
const rest = this.input.slice(this.index);
|
|
8275
|
-
return /^\d{4}
|
|
8309
|
+
return /^\d{4}-/.test(rest)
|
|
8276
8310
|
|| /^\d{2}:/.test(rest);
|
|
8277
8311
|
}
|
|
8278
8312
|
|
|
@@ -8495,7 +8529,17 @@ function stripQueryComments(input) {
|
|
|
8495
8529
|
output += char;
|
|
8496
8530
|
continue;
|
|
8497
8531
|
}
|
|
8498
|
-
if (char === '/' && next === '/' &&
|
|
8532
|
+
if (char === '/' && (next === '/' || next === '*') && isTemporalZoneCommentContext(input, index)) {
|
|
8533
|
+
// Preserve the rest of this invalid zone token once, avoiding repeated
|
|
8534
|
+
// backwards scans for a long run of comment-looking slashes.
|
|
8535
|
+
while (index < input.length && !isLayout(input[index]) && ![',', ')', '}', ']'].includes(input[index])) {
|
|
8536
|
+
output += input[index];
|
|
8537
|
+
index += 1;
|
|
8538
|
+
}
|
|
8539
|
+
index -= 1;
|
|
8540
|
+
continue;
|
|
8541
|
+
}
|
|
8542
|
+
if (char === '/' && next === '/') {
|
|
8499
8543
|
output += ' ';
|
|
8500
8544
|
index += 1;
|
|
8501
8545
|
while (index + 1 < input.length && input[index + 1] !== '\n' && input[index + 1] !== '\r') {
|
|
@@ -8504,7 +8548,7 @@ function stripQueryComments(input) {
|
|
|
8504
8548
|
}
|
|
8505
8549
|
continue;
|
|
8506
8550
|
}
|
|
8507
|
-
if (char === '/' && next === '*'
|
|
8551
|
+
if (char === '/' && next === '*') {
|
|
8508
8552
|
const start = index;
|
|
8509
8553
|
output += ' ';
|
|
8510
8554
|
index += 1;
|
|
@@ -8533,13 +8577,11 @@ function stripQueryComments(input) {
|
|
|
8533
8577
|
|
|
8534
8578
|
function isTemporalZoneCommentContext(input, index) {
|
|
8535
8579
|
let cursor = index - 1;
|
|
8536
|
-
while (cursor >= 0 && !isLayout(input[cursor]) && ![',', ')', '}', ']'].includes(input[cursor])) {
|
|
8580
|
+
while (cursor >= 0 && !isLayout(input[cursor]) && ![',', '(', ')', '{', '}', '[', ']', '=', '<', '>', '!'].includes(input[cursor])) {
|
|
8537
8581
|
cursor -= 1;
|
|
8538
8582
|
}
|
|
8539
8583
|
const tokenPrefix = input.slice(cursor + 1, index);
|
|
8540
|
-
|
|
8541
|
-
const datetimeTime = String.raw`\d{2}(?::(?:\d{2})?)?(?::\d{2})?(?:Z|[+-]\d{2}:\d{2})?`;
|
|
8542
|
-
return new RegExp(`^${date}T${datetimeTime}&[A-Za-z0-9_+\\-/]*$`).test(tokenPrefix);
|
|
8584
|
+
return /^\d{4}-/.test(tokenPrefix) && tokenPrefix.includes('T') && tokenPrefix.includes('&');
|
|
8543
8585
|
}
|
|
8544
8586
|
|
|
8545
8587
|
function renderInstruction(instruction) {
|
|
@@ -9051,30 +9093,24 @@ function isQueryCurrentPositionalShorthand(source) {
|
|
|
9051
9093
|
}
|
|
9052
9094
|
|
|
9053
9095
|
function isQueryTemporalLiteral(source, kind) {
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
const zone = String.raw`[A-Za-z0-9_+.\-]+(?:/[A-Za-z0-9_+.\-]+)*`;
|
|
9058
|
-
if (kind === 'date') {
|
|
9059
|
-
return parseTemporalDate(source) !== null;
|
|
9060
|
-
}
|
|
9061
|
-
if (kind === 'time') {
|
|
9062
|
-
const match = new RegExp(`^${time}$`).exec(source);
|
|
9063
|
-
return Boolean(match) && isValidTimeMatch(match);
|
|
9064
|
-
}
|
|
9065
|
-
if (kind === 'datetime') {
|
|
9066
|
-
const match = new RegExp(`^${date}T${datetimeTime}$`).exec(source);
|
|
9067
|
-
return Boolean(match)
|
|
9068
|
-
&& isValidDateParts(match[1], match[2], match[3])
|
|
9069
|
-
&& isValidTimeMatch(match, 4);
|
|
9070
|
-
}
|
|
9096
|
+
if (kind === 'date') return parseTemporalDate(source) !== null;
|
|
9097
|
+
if (kind === 'time') return parseTemporalClock(source, true) !== null;
|
|
9098
|
+
let datetime = source;
|
|
9071
9099
|
if (kind === 'wtc') {
|
|
9072
|
-
const
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9100
|
+
const marker = source.indexOf('&');
|
|
9101
|
+
if (marker === -1) return false;
|
|
9102
|
+
datetime = source.slice(0, marker);
|
|
9103
|
+
const zone = source.slice(marker + 1);
|
|
9104
|
+
if (!zone || zone.trim() !== zone
|
|
9105
|
+
|| (zone.toLowerCase() === 'local' && zone !== 'local')
|
|
9106
|
+
|| !/^[A-Za-z0-9_+.\-]+(?:\/[A-Za-z0-9_+.\-]+)*$/.test(zone)) return false;
|
|
9107
|
+
} else if (kind !== 'datetime') {
|
|
9108
|
+
return false;
|
|
9076
9109
|
}
|
|
9077
|
-
|
|
9110
|
+
const marker = datetime.indexOf('T');
|
|
9111
|
+
return marker !== -1
|
|
9112
|
+
&& parseTemporalDate(datetime.slice(0, marker)) !== null
|
|
9113
|
+
&& parseTemporalClock(datetime.slice(marker + 1), false) !== null;
|
|
9078
9114
|
}
|
|
9079
9115
|
|
|
9080
9116
|
function isValidDateParts(yearText, monthText, dayText) {
|
|
@@ -9090,26 +9126,29 @@ function isLeapYear(year) {
|
|
|
9090
9126
|
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
9091
9127
|
}
|
|
9092
9128
|
|
|
9093
|
-
function isValidTimeMatch(match, offset = 1) {
|
|
9094
|
-
const hour = Number(match[offset]);
|
|
9095
|
-
const minute = match[offset + 1] === undefined ? null : Number(match[offset + 1]);
|
|
9096
|
-
const second = match[offset + 2] === undefined ? null : Number(match[offset + 2]);
|
|
9097
|
-
const zoneHour = match[offset + 5] === undefined ? null : Number(match[offset + 5]);
|
|
9098
|
-
const zoneMinute = match[offset + 6] === undefined ? null : Number(match[offset + 6]);
|
|
9099
|
-
if (hour < 0 || hour > 23) return false;
|
|
9100
|
-
if (minute !== null && (minute < 0 || minute > 59)) return false;
|
|
9101
|
-
if (second !== null && (second < 0 || second > 60)) return false;
|
|
9102
|
-
if (zoneHour !== null && (zoneHour < 0 || zoneHour > 23)) return false;
|
|
9103
|
-
if (zoneMinute !== null && (zoneMinute < 0 || zoneMinute > 59)) return false;
|
|
9104
|
-
return true;
|
|
9105
|
-
}
|
|
9106
|
-
|
|
9107
9129
|
function isAeonRadixPayload(payload) {
|
|
9108
|
-
return
|
|
9130
|
+
return payload.trim() === payload
|
|
9131
|
+
&& /^[+-]?(?:[0-9A-Za-z&!](?:_?[0-9A-Za-z&!])*)(?:\.(?:[0-9A-Za-z&!](?:_?[0-9A-Za-z&!])*))?$|^[+-]?\.(?:[0-9A-Za-z&!](?:_?[0-9A-Za-z&!])*)$/.test(payload);
|
|
9109
9132
|
}
|
|
9110
9133
|
|
|
9111
9134
|
function isAeonEncodingPayload(payload) {
|
|
9112
|
-
return /^[A-Za-z0-9_-]+={0,2}$/.test(payload);
|
|
9135
|
+
return payload.trim() === payload && /^[A-Za-z0-9_-]+={0,2}$/.test(payload);
|
|
9136
|
+
}
|
|
9137
|
+
|
|
9138
|
+
function isRepresentableTrimtickPayload(payload) {
|
|
9139
|
+
return !payload.includes('\n') || (!payload.endsWith('\n')
|
|
9140
|
+
&& payload.split('\n').every((line) => line.length === 0 || !/^[ \t]+$/.test(line)));
|
|
9141
|
+
}
|
|
9142
|
+
|
|
9143
|
+
function isDecodableBase64UrlPayload(payload) {
|
|
9144
|
+
if (!isAeonEncodingPayload(payload)) return false;
|
|
9145
|
+
const body = payload.replace(/=+$/, '');
|
|
9146
|
+
const padding = payload.length - body.length;
|
|
9147
|
+
const remainder = body.length % 4;
|
|
9148
|
+
if (remainder === 1 || (padding !== 0 && payload.length % 4 !== 0)
|
|
9149
|
+
|| (padding === 1 && remainder !== 3) || (padding === 2 && remainder !== 2)) return false;
|
|
9150
|
+
const last = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'.indexOf(body.at(-1));
|
|
9151
|
+
return remainder === 2 ? (last & 15) === 0 : remainder === 3 ? (last & 3) === 0 : true;
|
|
9113
9152
|
}
|
|
9114
9153
|
|
|
9115
9154
|
function isAeonSeparatorPayload(payload) {
|
|
@@ -1435,7 +1435,19 @@ function renderScalarValue(binding) {
|
|
|
1435
1435
|
}
|
|
1436
1436
|
|
|
1437
1437
|
function renderBlockString(value) {
|
|
1438
|
-
|
|
1438
|
+
let text = String(value ?? '');
|
|
1439
|
+
if (text.includes('\n')) {
|
|
1440
|
+
// Core trims after escape decoding. Protect nonblank lines with an opposite
|
|
1441
|
+
// gutter so one common character is removed without touching payload indent.
|
|
1442
|
+
const first = text.split('\n').find((line) => line.length > 0) ?? '';
|
|
1443
|
+
const gutter = first.startsWith(' ') ? '\t' : ' ';
|
|
1444
|
+
const leadingNewline = text.startsWith('\n');
|
|
1445
|
+
text = text.split('\n').map((line) => line.length === 0 ? '' : gutter + line).join('\n');
|
|
1446
|
+
if (leadingNewline) text = '\n' + text;
|
|
1447
|
+
}
|
|
1448
|
+
text = text
|
|
1449
|
+
.replace(/\\/g, '\\\\').replace(/`/g, '\\`')
|
|
1450
|
+
.replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\t/g, '\\t');
|
|
1439
1451
|
return `>\`${text}\``;
|
|
1440
1452
|
}
|
|
1441
1453
|
|