@cbortech/cbor 0.27.0 → 0.27.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/README.ja.md +100 -0
- package/README.md +103 -0
- package/dist/ast/CborAppSeqResult.d.ts +37 -4
- package/dist/ast/CborArray.d.ts +2 -2
- package/dist/ast/CborByteString.d.ts +2 -2
- package/dist/ast/CborEmbeddedCBOR.d.ts +1 -1
- package/dist/ast/CborFloat.d.ts +1 -1
- package/dist/ast/CborIndefiniteByteString.d.ts +1 -1
- package/dist/ast/CborIndefiniteTextString.d.ts +1 -1
- package/dist/ast/CborItem.d.ts +314 -9
- package/dist/ast/CborMap.d.ts +2 -2
- package/dist/ast/CborNint.d.ts +1 -1
- package/dist/ast/CborTag.d.ts +26 -4
- package/dist/ast/CborTextString.d.ts +2 -2
- package/dist/ast/CborUint.d.ts +1 -1
- package/dist/ast/CborUnresolvedAppExt.d.ts +9 -0
- package/dist/ast/index.cjs +1 -1
- package/dist/ast/index.js +2 -2
- package/dist/cbor/tagLabels.d.ts +26 -0
- package/dist/cddl/eRefScope.d.ts +241 -0
- package/dist/cddl/eref.d.ts +64 -0
- package/dist/cddl/implicitTags.d.ts +28 -0
- package/dist/cddl/index.cjs +2 -2
- package/dist/cddl/index.cjs.map +1 -1
- package/dist/cddl/index.d.ts +2 -0
- package/dist/cddl/index.js +26 -25
- package/dist/cddl/index.js.map +1 -1
- package/dist/cddl/validator.d.ts +98 -2
- package/dist/cdn/index.cjs +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/serialize-utils.d.ts +50 -15
- package/dist/extensions/cri.d.ts +2 -2
- package/dist/extensions/dt.d.ts +4 -4
- package/dist/extensions/eref.d.ts +135 -0
- package/dist/extensions/ip.d.ts +3 -3
- package/dist/extensions/types.d.ts +40 -1
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +190 -81
- package/dist/index.js.map +1 -1
- package/dist/js/fromJS.d.ts +23 -1
- package/dist/mapEntries-8zshEr-t.js +7085 -0
- package/dist/mapEntries-8zshEr-t.js.map +1 -0
- package/dist/mapEntries-DwHPAzCN.cjs +68 -0
- package/dist/mapEntries-DwHPAzCN.cjs.map +1 -0
- package/dist/schema-7r2xjpMK.js +345 -0
- package/dist/schema-7r2xjpMK.js.map +1 -0
- package/dist/schema-YiigSWjR.cjs +8 -0
- package/dist/schema-YiigSWjR.cjs.map +1 -0
- package/dist/{serialize-utils-BuIZPaUc.js → serialize-utils-BQtutOo6.js} +70 -52
- package/dist/serialize-utils-BQtutOo6.js.map +1 -0
- package/dist/{serialize-utils-CjTqQivB.cjs → serialize-utils-DQ8T3Mzw.cjs} +9 -9
- package/dist/serialize-utils-DQ8T3Mzw.cjs.map +1 -0
- package/dist/types.d.ts +426 -4
- package/dist/utils/hexfloat.d.ts +10 -2
- package/package.json +13 -14
- package/dist/mapEntries-C1f7G0AM.cjs +0 -13
- package/dist/mapEntries-C1f7G0AM.cjs.map +0 -1
- package/dist/mapEntries-CvLdiN0h.js +0 -3946
- package/dist/mapEntries-CvLdiN0h.js.map +0 -1
- package/dist/schema-CNfrVRYp.js +0 -1977
- package/dist/schema-CNfrVRYp.js.map +0 -1
- package/dist/schema-iXpYtKQl.cjs +0 -63
- package/dist/schema-iXpYtKQl.cjs.map +0 -1
- package/dist/serialize-utils-BuIZPaUc.js.map +0 -1
- package/dist/serialize-utils-CjTqQivB.cjs.map +0 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { CddlSchema } from './schema';
|
|
2
|
+
import { CddlGroupEntry, CddlMemberKey, CddlType, CddlType1 } from './ast';
|
|
3
|
+
import { CborItem } from '../ast/CborItem';
|
|
4
|
+
import { ValidateOptions } from './validator';
|
|
5
|
+
/**
|
|
6
|
+
* The CDDL type governing one position in a JS value tree — opaque outside
|
|
7
|
+
* this module; obtain one via `resolveRootScope()`, then `resolveNestedScope()`
|
|
8
|
+
* for each property that itself holds a nested object.
|
|
9
|
+
*/
|
|
10
|
+
export interface ERefScope {
|
|
11
|
+
/**
|
|
12
|
+
* Every distinct alternative shape this position's type could resolve
|
|
13
|
+
* to — one array per `/`/`//` choice alternative (including every
|
|
14
|
+
* `/=`/`//=` extension of the rule), each holding *that* alternative's
|
|
15
|
+
* own complete group entries. Kept separate, not merged into one flat
|
|
16
|
+
* list, so `scopeNameToValue()` can tell "this name means the same thing
|
|
17
|
+
* in every alternative that mentions it, and isn't plain text in any of
|
|
18
|
+
* them" (safe) apart from "different alternatives disagree about it"
|
|
19
|
+
* (unsafe) — see the module doc.
|
|
20
|
+
*/
|
|
21
|
+
readonly alternatives: readonly (readonly CddlGroupEntry[])[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The scope for the schema's own root rule (or `ruleName`, matching
|
|
25
|
+
* `ValidateOptions.rule` — `fromJS()`'s own eRefKeys resolution should
|
|
26
|
+
* start from the same rule the caller will actually validate against).
|
|
27
|
+
* `undefined` when the named rule doesn't exist, isn't a map type, or
|
|
28
|
+
* can't be resolved this way at all — see the module doc's Scope note.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveRootScope(schema: CddlSchema, ruleName?: string): ERefScope | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The CDDL type governing an *array* position — the counterpart of
|
|
33
|
+
* `ERefScope` for a value that is a `CborArray`/JS array rather than a
|
|
34
|
+
* map/object. One positional element-type list per array alternative this
|
|
35
|
+
* position's type could resolve to (kept separate, the same way
|
|
36
|
+
* `ERefScope.alternatives` is). Only produced for arrays whose every entry
|
|
37
|
+
* is exactly one element (no `?`/`*`/`+`), so element *i* of an array of
|
|
38
|
+
* length *n* is governed by entry *i* of every alternative of length *n* —
|
|
39
|
+
* no matching against the data required. An alternative of a different
|
|
40
|
+
* length simply can't be the one the data matched, so it's skipped
|
|
41
|
+
* (`resolveElementPosition()`).
|
|
42
|
+
*/
|
|
43
|
+
export interface ERefArrayScope {
|
|
44
|
+
readonly elementTypes: readonly (readonly CddlType[])[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Everything known about one position in the value tree: its scope if the
|
|
48
|
+
* value there is a map (`map`), and its positional element types if it's an
|
|
49
|
+
* array (`array`). Both may be set when the governing type is a `/` choice
|
|
50
|
+
* between a map and an array; the walker uses whichever matches the value
|
|
51
|
+
* actually found there.
|
|
52
|
+
*/
|
|
53
|
+
export interface ERefPosition {
|
|
54
|
+
readonly map?: ERefScope;
|
|
55
|
+
readonly array?: ERefArrayScope;
|
|
56
|
+
}
|
|
57
|
+
/** A position nothing is known about — no names apply anywhere below it. */
|
|
58
|
+
export declare const NO_POSITION: ERefPosition;
|
|
59
|
+
/**
|
|
60
|
+
* `resolveRootScope()`'s own counterpart covering an array root too —
|
|
61
|
+
* e.g. `COSE_Sign1 = [protected: …, unprotected: header_map, …]`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function resolveRootPosition(schema: CddlSchema, ruleName?: string): ERefPosition;
|
|
64
|
+
/**
|
|
65
|
+
* `resolveNestedScope()`'s own counterpart covering an array value too —
|
|
66
|
+
* the position of `identifier`'s own value within map scope `scope`.
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveNestedPosition(schema: CddlSchema, scope: ERefScope, identifier: string | bigint, respectDeclarationOrder?: boolean): ERefPosition;
|
|
69
|
+
/**
|
|
70
|
+
* The position of element `index` within an array of `length` elements
|
|
71
|
+
* governed by `arrayScope` — the union of entry `index`'s own type across
|
|
72
|
+
* every alternative of exactly that length (see `ERefArrayScope`'s own
|
|
73
|
+
* doc). `NO_POSITION` when no alternative has that length.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolveElementPosition(schema: CddlSchema, arrayScope: ERefArrayScope, index: number, length: number): ERefPosition;
|
|
76
|
+
/**
|
|
77
|
+
* The e-ref name a member key gives the integer key `keyValue` it
|
|
78
|
+
* consumed — the member's own `&(name: value)` binding for that value (from
|
|
79
|
+
* a fully literal enum group, the only kind that pins the key down to one
|
|
80
|
+
* named value), or a bare reference to a constant rule with that value.
|
|
81
|
+
* `undefined` for any other member key (a bareword/literal key, a wildcard,
|
|
82
|
+
* a controlled or non-literal key), or when the reference is a generic
|
|
83
|
+
* parameter (`paramBound`), which names no rule at all.
|
|
84
|
+
*/
|
|
85
|
+
export declare function memberKeyName(schema: CddlSchema, mk: CddlMemberKey, keyValue: bigint, paramBound: (name: string) => boolean): string | undefined;
|
|
86
|
+
/** A type that is just a reference to rule `name` (the validation root). */
|
|
87
|
+
export declare function ruleRefType(name: string): CddlType;
|
|
88
|
+
/**
|
|
89
|
+
* `type`'s own fixed-shape array alternatives (see `ERefArrayScope`), or
|
|
90
|
+
* `undefined` when it may be an array of some other shape.
|
|
91
|
+
*/
|
|
92
|
+
export declare function arrayScopeOfType(schema: CddlSchema, type: CddlType): ERefArrayScope | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* The array alternatives in `arrayScope` a decoded array's `items`
|
|
95
|
+
* actually satisfy — same length, and every element matching its own
|
|
96
|
+
* entry's type. An element whose check runs out of budget keeps its
|
|
97
|
+
* alternative (including an extra alternative only ever makes annotation
|
|
98
|
+
* more conservative, never wrong).
|
|
99
|
+
*/
|
|
100
|
+
export declare function matchingArrayAlternatives(schema: CddlSchema, arrayScope: ERefArrayScope, items: readonly CborItem[], options?: ValidateOptions): ERefArrayScope;
|
|
101
|
+
/**
|
|
102
|
+
* `type`'s own `/` alternatives with parentheses and (non-generic) type-rule
|
|
103
|
+
* references expanded in place — including every `/=` extension of a
|
|
104
|
+
* referenced rule — so each result is a `type1` that is neither of those.
|
|
105
|
+
* A controlled alternative (`bstr .cbor T`) is kept whole, never looked
|
|
106
|
+
* into. `undefined` when some alternative can't be expanded this way (a
|
|
107
|
+
* generic reference, a rule defined nowhere, or a group rule referenced as
|
|
108
|
+
* a type). A reference cycle contributes no alternatives of its own.
|
|
109
|
+
*/
|
|
110
|
+
export declare function typeAlternatives(schema: CddlSchema, type: CddlType, seen?: ReadonlySet<string>): CddlType1[] | undefined;
|
|
111
|
+
/** One `CddlType` whose alternatives are all of `types`' own, combined. */
|
|
112
|
+
export declare function mergeTypes(types: readonly CddlType[]): CddlType;
|
|
113
|
+
/**
|
|
114
|
+
* Name → value, from every `&(name: value)`/bare-constant-reference entry
|
|
115
|
+
* directly at a member-key position among `scope`'s own alternatives (not
|
|
116
|
+
* entries nested inside a further nested map) — the names `fromJS()` may
|
|
117
|
+
* convert *this* object's own direct property names against.
|
|
118
|
+
*
|
|
119
|
+
* A name is included only when it's *consistently* eRefKeys-eligible
|
|
120
|
+
* across every one of `scope`'s own alternatives: excluded entirely if
|
|
121
|
+
* *any* alternative uses it as a plain bareword/quoted-text member key
|
|
122
|
+
* (that alternative wants a literal text key there, and which alternative
|
|
123
|
+
* the JS value being converted actually corresponds to isn't known without
|
|
124
|
+
* validating it — something this module doesn't attempt), and excluded if
|
|
125
|
+
* the alternatives that *do* bind it via `&(name: value)`/a bare
|
|
126
|
+
* constant-rule reference disagree on the value. An alternative that
|
|
127
|
+
* doesn't mention the name at all is simply silent on it, not a conflict.
|
|
128
|
+
*
|
|
129
|
+
* A `&(name: value)` binding's own value is computed fresh per scope —
|
|
130
|
+
* unlike a bare reference to a constant rule (`? group_mode => bool`),
|
|
131
|
+
* whose value comes from the rule's own, genuinely schema-wide definition,
|
|
132
|
+
* so it's looked up via `getERefTables(schema).ruleConstantValues` — never
|
|
133
|
+
* plain `byName`, which also mixes in any `&(name: value)` enum *label*
|
|
134
|
+
* bound to `name` elsewhere in the schema (irrelevant here: a bare type
|
|
135
|
+
* reference names a *rule*, not "this spelling however it's used
|
|
136
|
+
* anywhere" — see `ruleConstantValues`'s own doc).
|
|
137
|
+
*
|
|
138
|
+
* This *value* is safe to use positionally as-is — it's exactly the
|
|
139
|
+
* integer this position's own schema names, independent of anything
|
|
140
|
+
* elsewhere in the document. Whether the resulting key should also be
|
|
141
|
+
* *labeled* `e'name'` is a separate question `resolvesGloballyTo()`
|
|
142
|
+
* answers — see its own doc for why.
|
|
143
|
+
*
|
|
144
|
+
* `respectDeclarationOrder` (default `true`) controls whether a name
|
|
145
|
+
* declared before a same-alternative wildcard is included per that
|
|
146
|
+
* relaxation — see the module doc's own note on why `fromJS()` must pass
|
|
147
|
+
* `false` here instead, falling back to the plain "any open entry anywhere
|
|
148
|
+
* in this alternative excludes every name in it" behavior.
|
|
149
|
+
*/
|
|
150
|
+
export declare function scopeNameToValue(schema: CddlSchema, scope: ERefScope, respectDeclarationOrder?: boolean): ReadonlyMap<string, bigint>;
|
|
151
|
+
/**
|
|
152
|
+
* Whether `name` labeling `value` here would also resolve the *same* way
|
|
153
|
+
* through `parseAppString()` (`e'name'`'s own parse direction), which
|
|
154
|
+
* consults `getERefTables(schema).byName` — a single, genuinely
|
|
155
|
+
* schema-wide table, unlike `scopeNameToValue()`'s own position-scoped
|
|
156
|
+
* one. A name can be locally unambiguous at one member-key position (safe
|
|
157
|
+
* to use as *this* key's integer value — see `scopeNameToValue()`) while
|
|
158
|
+
* being bound to a *different* value, or ambiguously to more than one, at
|
|
159
|
+
* some other, unrelated member-key position elsewhere in the same schema.
|
|
160
|
+
* Labeling the key `e'name'` in that case would round-trip incorrectly (or
|
|
161
|
+
* not at all) through `fromCDN()` against the very same schema, so
|
|
162
|
+
* `fromJS()` only does so when this returns `true` — otherwise the key
|
|
163
|
+
* still gets the correct integer value, just as a plain, unlabeled
|
|
164
|
+
* integer (see `js/fromJS.ts`'s own use of this).
|
|
165
|
+
*/
|
|
166
|
+
export declare function resolvesGloballyTo(schema: CddlSchema, name: string, value: bigint): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* `scopeNameToValue()`'s own result, inverted — dropping any value bound to
|
|
169
|
+
* more than one *different* name at this position, since picking either
|
|
170
|
+
* would be an arbitrary, unjustified choice this position's own schema
|
|
171
|
+
* doesn't actually make (each individual name is still unambiguous on its
|
|
172
|
+
* own — see `scopeNameToValue()`'s own doc — this is only about two
|
|
173
|
+
* *different* names colliding on the same value). Used wherever a caller
|
|
174
|
+
* already has an integer *value* (not a name) — e.g. an already-decoded map
|
|
175
|
+
* key, or a `MapEntries` entry whose key is a plain number rather than a
|
|
176
|
+
* string — and needs to know which name, if any, unambiguously describes
|
|
177
|
+
* it at this position, so it can resolve a nested scope for that entry's
|
|
178
|
+
* own value the same way a literal string key's name would (see
|
|
179
|
+
* `extensions/eref.ts` and `js/fromJS.ts`'s own uses).
|
|
180
|
+
*/
|
|
181
|
+
export declare function scopeValueToName(schema: CddlSchema, scope: ERefScope): ReadonlyMap<bigint, string>;
|
|
182
|
+
/**
|
|
183
|
+
* The scope for `identifier`'s own nested value — matching, across every
|
|
184
|
+
* one of `scope`'s own alternatives, an entry whose member key is either a
|
|
185
|
+
* literal bareword/quoted-text key equal to `identifier` (a `string`), the
|
|
186
|
+
* `&(name: value)`/bare-reference entry that names it (only when
|
|
187
|
+
* `identifier` is itself one of `scope`'s own `scopeNameToValue()` names),
|
|
188
|
+
* *or* a differently-spelled member key that resolves to that exact same
|
|
189
|
+
* integer value — e.g. a literal `1: …` entry in one alternative and
|
|
190
|
+
* `&(data: 1) => …` in another both govern the same wire position, even
|
|
191
|
+
* though only the second one *names* it. Passing `identifier` as a
|
|
192
|
+
* `bigint` instead skips name resolution entirely and matches purely by
|
|
193
|
+
* that integer value — for a wire key with no name of its own at all, e.g.
|
|
194
|
+
* a literal `1: &(AES-CCM-16-64-128: 10)` entry, whose value can still be
|
|
195
|
+
* resolved this way even though the key `1` itself was never eRefKeys
|
|
196
|
+
* -eligible (see `extensions/eref.ts`'s own use of this for exactly this
|
|
197
|
+
* case). Every matching entry's own value type is resolved into the
|
|
198
|
+
* nested scope's own alternatives (kept separate from each other the same
|
|
199
|
+
* way `scope`'s own were — see the module doc); `undefined` when nothing
|
|
200
|
+
* matches `identifier` at all, when what matches doesn't resolve to a map
|
|
201
|
+
* type anywhere, or when an open/wildcard member key (`firstOpenIndex()`)
|
|
202
|
+
* at or before the matching entry, *within that same alternative*, could
|
|
203
|
+
* equally claim the same wire key with a shape this resolver can't pin
|
|
204
|
+
* down — see `firstOpenIndex()`'s own doc for exactly when that does and
|
|
205
|
+
* doesn't apply. The object being converted might just as well belong to
|
|
206
|
+
* that open entry instead of whichever named one matched literally, so
|
|
207
|
+
* descending as if it definitely doesn't would risk exactly the same
|
|
208
|
+
* "wrong alternative" misconversion `scopeNameToValue()`'s own doc
|
|
209
|
+
* describes for `scope`'s own direct names.
|
|
210
|
+
*
|
|
211
|
+
* `respectDeclarationOrder` (default `true`) — see `scopeNameToValue()`'s
|
|
212
|
+
* own doc; `fromJS()` passes `false` when descending from a JS property
|
|
213
|
+
* name it hasn't (or can't) also convert to an integer key this same way,
|
|
214
|
+
* so the nested scope it resolves stays consistent with that decision.
|
|
215
|
+
*/
|
|
216
|
+
export declare function resolveNestedScope(schema: CddlSchema, scope: ERefScope, identifier: string | bigint, respectDeclarationOrder?: boolean): ERefScope | undefined;
|
|
217
|
+
/**
|
|
218
|
+
* The name safely labeling `value` when it's the value of `identifier`'s
|
|
219
|
+
* own entry within `scope` — resolving that entry's own value type
|
|
220
|
+
* (`matchingValueType()`, the same position-aware matching
|
|
221
|
+
* `resolveNestedScope()` uses) via `resolveEnumNames()`. Symmetric with
|
|
222
|
+
* `resolveNestedScope()`, but for a value whose *type* is (or resolves to)
|
|
223
|
+
* a closed `&(name: value)` choice of named integer constants — e.g.
|
|
224
|
+
* `? &(gp_enc_alg: -4) => &(AES-CCM-16-64-128: 10, …)` — rather than a
|
|
225
|
+
* nested map. `identifier` may be a `bigint` to match purely by the key's
|
|
226
|
+
* own value when it has no name of its own at all (see
|
|
227
|
+
* `resolveNestedScope()`'s own doc). `undefined` when no matching entry's
|
|
228
|
+
* value type names `value` this way, when any matching entry's value type
|
|
229
|
+
* can't be confidently resolved (see `resolveEnumNames()`'s own doc), or
|
|
230
|
+
* when `scope` has an open/wildcard member key. Always uses the relaxed,
|
|
231
|
+
* declaration-order-aware matching (see `scopeNameToValue()`'s own doc) —
|
|
232
|
+
* every caller is on the annotation side, resolving an already-decoded
|
|
233
|
+
* wire value, never `fromJS()`'s own forward conversion.
|
|
234
|
+
*/
|
|
235
|
+
export declare function resolveValueEnumName(schema: CddlSchema, scope: ERefScope, identifier: string | bigint, value: bigint): string | undefined;
|
|
236
|
+
/**
|
|
237
|
+
* The name `type` — a value's own type, e.g. the merged types of the members that consumed it —
|
|
238
|
+
* safely gives integer `value`: resolved via `resolveEnumNames()`, so any
|
|
239
|
+
* choice accepting the same integer under no name blocks it.
|
|
240
|
+
*/
|
|
241
|
+
export declare function enumNameOfType(schema: CddlSchema, type: CddlType, value: bigint): string | undefined;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { CddlSchema } from './schema';
|
|
2
|
+
import { CddlType } from './ast';
|
|
3
|
+
export interface ERefTables {
|
|
4
|
+
/** Name → value, for resolving `e'name'` while parsing CDN. */
|
|
5
|
+
readonly byName: ReadonlyMap<string, bigint>;
|
|
6
|
+
/**
|
|
7
|
+
* Value → name, for annotating a validated integer map key with a name —
|
|
8
|
+
* populated only from a binding at a genuine map-member-key position
|
|
9
|
+
* (a `&(name: value)` literal, or a bare reference to a constant rule
|
|
10
|
+
* used as the member key itself — never from either construct appearing
|
|
11
|
+
* anywhere else, and never from a general constant rule that isn't
|
|
12
|
+
* referenced at a member-key position at all) and only when neither the
|
|
13
|
+
* name nor the value is ambiguous (see the module doc and
|
|
14
|
+
* `ambiguousNames`).
|
|
15
|
+
*/
|
|
16
|
+
readonly byValue: ReadonlyMap<bigint, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Name → value, the exact inverse of `byValue` (safe and unambiguous by
|
|
19
|
+
* construction: every name appearing in `byValue` appears there with
|
|
20
|
+
* exactly one value, since a name bound to more than one value is already
|
|
21
|
+
* excluded — see `ambiguousNames`). Used for the reverse direction:
|
|
22
|
+
* `fromJS()`'s `eRefKeys` option converting a plain-object property name
|
|
23
|
+
* back to the integer key it names, symmetric with `ToJSOptions.eRefKeys`.
|
|
24
|
+
*/
|
|
25
|
+
readonly nameToValue: ReadonlyMap<string, bigint>;
|
|
26
|
+
/**
|
|
27
|
+
* Names that were seen bound to more than one different value anywhere in
|
|
28
|
+
* the schema, and so were excluded from `byName` (and, transitively, from
|
|
29
|
+
* every `byValue`/`nameToValue` entry that would have named a value after
|
|
30
|
+
* one of them) — kept separately only to produce a clearer "ambiguous"
|
|
31
|
+
* error message than a plain "not defined" one would.
|
|
32
|
+
*/
|
|
33
|
+
readonly ambiguousNames: ReadonlySet<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Name → value, from `name = <int literal>` rule definitions **only**
|
|
36
|
+
* (including every `/=`/`//=` extension of the same name, when they all
|
|
37
|
+
* agree on a single value) — deliberately excludes a name that's *only*
|
|
38
|
+
* ever used as an `&(name: value)` enum label somewhere in the schema,
|
|
39
|
+
* even though that label also feeds `byName`/`nameToValue` (a
|
|
40
|
+
* general-purpose lookup that doesn't distinguish the two, correctly, for
|
|
41
|
+
* `e'name'`'s own CDN parse direction). A *bare* type reference at a
|
|
42
|
+
* member-key position (`? group_mode => bool`, or a wildcard's own key
|
|
43
|
+
* type, `* group_mode => …`) means "this rule's own constant value" —
|
|
44
|
+
* e.g. `group_mode = 3` — never "this spelling, however it's used
|
|
45
|
+
* anywhere in the schema"; conflating the two would let an unrelated
|
|
46
|
+
* `&(group_mode: 2) => …` enum label elsewhere make a wildcard whose key
|
|
47
|
+
* type is the *rule* `group_mode` (which might not even be an integer
|
|
48
|
+
* type at all) look like a closed, safe reference when it isn't — see
|
|
49
|
+
* `cddl/eRefScope.ts`'s own use of this.
|
|
50
|
+
*/
|
|
51
|
+
readonly ruleConstantValues: ReadonlyMap<string, bigint>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Extract (and cache, per schema instance) the `e'...'` name tables for a
|
|
55
|
+
* compiled CDDL schema.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getERefTables(schema: CddlSchema): ERefTables;
|
|
58
|
+
/**
|
|
59
|
+
* The literal integer value of a `type`, when it reduces to a single
|
|
60
|
+
* `type1` alternative with no range/control operator. `undefined` for
|
|
61
|
+
* anything else. Exported for `eRefScope.ts`'s own, position-aware name
|
|
62
|
+
* extraction, which needs the exact same check for an entry's own value.
|
|
63
|
+
*/
|
|
64
|
+
export declare function literalIntOfType(type: CddlType): bigint | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CddlSchema } from './schema';
|
|
2
|
+
import { TagRecord, ValidateOptions } from './validator';
|
|
3
|
+
import { CborItem } from '../ast/CborItem';
|
|
4
|
+
/**
|
|
5
|
+
* `item` with every tag the schema implies — but that the item lacks —
|
|
6
|
+
* added via `makeTag`, when that is what makes it valid. Returns `item`
|
|
7
|
+
* itself (unchanged) when it already validates, or when even inference
|
|
8
|
+
* cannot make it valid (the caller's own validation then reports why).
|
|
9
|
+
* Nodes are replaced in place inside their containers; the returned root
|
|
10
|
+
* differs from `item` only when the root itself gets tagged.
|
|
11
|
+
*/
|
|
12
|
+
export declare function inferImplicitTags(schema: CddlSchema, item: CborItem, options: ValidateOptions | undefined, makeTag: (tag: bigint, inner: CborItem) => CborItem): CborItem;
|
|
13
|
+
/**
|
|
14
|
+
* Flag (`CborTag._implicit`) every tag in `item` that the schema implies
|
|
15
|
+
* and that `inferImplicitTags()` would restore exactly if it were left off;
|
|
16
|
+
* clear the flag on every other tag. `trail` holds the records of the
|
|
17
|
+
* caller's own successful validation of `item` (its candidates: every tag
|
|
18
|
+
* matched by a literal `#6.N`).
|
|
19
|
+
*
|
|
20
|
+
* The candidate set shrinks until stripping it and inferring again yields
|
|
21
|
+
* back exactly that set: a tag that isn't restored (another alternative
|
|
22
|
+
* accepts the untagged content, the untagged tree already validates, …)
|
|
23
|
+
* drops out, and dropping one can change what the rest infer, hence the
|
|
24
|
+
* rounds. If inference would ever tag something that wasn't tagged, or
|
|
25
|
+
* the rounds run out, nothing is flagged — omission is an optimization,
|
|
26
|
+
* never worth a round trip that changes the data.
|
|
27
|
+
*/
|
|
28
|
+
export declare function markImplicitTags(schema: CddlSchema, item: CborItem, options: ValidateOptions | undefined, trail: readonly TagRecord[]): void;
|
package/dist/cddl/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../schema-
|
|
2
|
-
`?(e++,n=1):n++;r.push({type:`ERROR`,value:t.slice(o),raw:t.slice(o),line:e,col:n,offset:o,endOffset:t.length})}return{tokens:r,comments:n.comments,error:a}}}exports.CDDL=
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../mapEntries-DwHPAzCN.cjs"),t=require("../schema-YiigSWjR.cjs");function n(e,t){let n=Math.max(0,Math.min(t,e.length)),r=1,i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===10&&(r++,i=t+1);return{line:r,column:n-i+1}}var r=class{static compile(e,n){return t.n(e,n)}};function i(t){let n=new e.p(t),r=[];for(;;){let e=n.consume();if(e.type===`EOF`)break;r.push(e)}return{tokens:r,comments:n.comments}}function a(t){let n=new e.p(t),r=[];try{for(;;){let e=n.consume();if(e.type===`EOF`)break;r.push(e)}return{tokens:r,comments:n.comments}}catch(i){let a=i instanceof e.$?i:new e.$(i instanceof Error?i.message:String(i)),o=n.lastEndOffset;if(o<t.length){let e=1,n=1;for(let r=0;r<o;r++)t[r]===`
|
|
2
|
+
`?(e++,n=1):n++;r.push({type:`ERROR`,value:t.slice(o),raw:t.slice(o),line:e,col:n,offset:o,endOffset:t.length})}return{tokens:r,comments:n.comments,error:a}}}exports.CDDL=r,exports.default=r,exports.CddlMismatchError=e.Z,exports.CddlSchema=t.t,exports.CddlSemanticError=e.Q,exports.CddlSyntaxError=e.$,exports.PRELUDE_CDDL=e.u,exports.getERefTables=e.m,exports.getPreludeRules=e.d,exports.parseCDDL=e.f,exports.positionAt=n,exports.tokenize=i,exports.tokenizeLenient=a;
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cddl/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/cddl/position.ts","../../src/cddl/index.ts"],"sourcesContent":["/**\n * Convert a character offset (as carried by CDDL AST nodes, CddlWarning,\n * and CddlValidationError.schemaStart/schemaEnd or start/end for CDN input)\n * into a 1-based line/column position, for CLI-style `file:line:col`\n * reporting.\n *\n * Offsets are JS string indices (UTF-16 code units), matching everything\n * else in this library. Offsets past the end of the text clamp to its end.\n */\nexport function positionAt(\n text: string,\n offset: number\n): { line: number; column: number } {\n const end = Math.max(0, Math.min(offset, text.length));\n let line = 1;\n let lineStart = 0;\n for (let i = 0; i < end; i++) {\n if (text.charCodeAt(i) === 0x0a) {\n line++;\n lineStart = i + 1;\n }\n }\n return { line, column: end - lineStart + 1 };\n}\n","/**\n * Public CDDL API (`@cbortech/cbor/cddl`).\n *\n * Phase 1 covers the grammar layer of RFC 8610 + RFC 9682: compiling CDDL\n * text into a checked rule table (`CDDL.compile`), re-serializing it\n * (`schema.format()`), and the lower-level tokenization API used by tooling\n * such as syntax highlighters. Validating CBOR/CDN data against a schema is\n * a later phase.\n */\n\nimport { CddlTokenizer, type CddlComment, type CddlToken } from './tokenizer';\nimport { CddlSyntaxError } from './errors';\nimport { compile, CddlSchema, type CompileOptions } from './schema';\n\nexport type { CddlToken, CddlTokenType, CddlComment } from './tokenizer';\nexport {\n CddlSyntaxError,\n CddlSemanticError,\n CddlMismatchError,\n} from './errors';\nexport type {\n CddlWarning,\n CddlValidationError,\n CddlValidationWarning,\n ValidationResult,\n} from './errors';\nexport type { ValidateOptions } from './validator';\nexport { CddlSchema } from './schema';\nexport type { CompileOptions } from './schema';\nexport { parseCDDL } from './parser';\nexport type { ParseCddlResult } from './parser';\nexport { PRELUDE_CDDL, getPreludeRules } from './prelude';\nexport { positionAt } from './position';\nexport type { CddlFormatOptions } from './writer';\nexport type {\n CddlRule,\n CddlType,\n CddlType1,\n CddlType2,\n CddlValue,\n CddlRef,\n CddlParenType,\n CddlMapType,\n CddlArrayType,\n CddlUnwrap,\n CddlEnum,\n CddlTagged,\n CddlMajor,\n CddlAny,\n CddlGroup,\n CddlGroupEntry,\n CddlEntryValue,\n CddlEntryGroup,\n CddlOccur,\n CddlMemberKey,\n CddlNodeBase,\n} from './ast';\n\n/** Main CDDL facade — mirrors the shape of the `CBOR` facade. */\nexport class CDDL {\n /**\n * Parse and compile a CDDL data model.\n *\n * @example\n * const schema = CDDL.compile(`person = { name: tstr, ? age: uint }`);\n * schema.root.name; // 'person'\n */\n static compile(text: string, options?: CompileOptions): CddlSchema {\n return compile(text, options);\n }\n}\n\nexport default CDDL;\n\nexport interface TokenizeResult {\n /** Scanned tokens in source order, excluding the final EOF token. */\n tokens: CddlToken[];\n /** Comments encountered while scanning, in source order. */\n comments: CddlComment[];\n}\n\nexport interface TokenizeLenientResult extends TokenizeResult {\n /**\n * The scan failure, if any. When set, `tokens` ends with a synthetic\n * `ERROR` token covering the source from the last clean token to the end\n * of the input.\n */\n error?: CddlSyntaxError;\n}\n\n/**\n * Tokenize CDDL text. Throws {@link CddlSyntaxError} on invalid input.\n */\nexport function tokenize(text: string): TokenizeResult {\n const tokenizer = new CddlTokenizer(text);\n const tokens: CddlToken[] = [];\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n}\n\n/**\n * Error-tolerant tokenization for editors and highlighters: never throws on\n * invalid input. Tokens before the failure are returned as scanned; the\n * remainder of the input is covered by a single synthetic `ERROR` token and\n * the failure is reported in `error`.\n */\nexport function tokenizeLenient(text: string): TokenizeLenientResult {\n const tokenizer = new CddlTokenizer(text);\n const tokens: CddlToken[] = [];\n try {\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n } catch (e) {\n const error =\n e instanceof CddlSyntaxError\n ? e\n : new CddlSyntaxError(e instanceof Error ? e.message : String(e));\n const start = tokenizer.lastEndOffset;\n if (start < text.length) {\n let line = 1;\n let col = 1;\n for (let i = 0; i < start; i++) {\n if (text[i] === '\\n') {\n line++;\n col = 1;\n } else {\n col++;\n }\n }\n tokens.push({\n type: 'ERROR',\n value: text.slice(start),\n raw: text.slice(start),\n line,\n col,\n offset: start,\n endOffset: text.length,\n });\n }\n return { tokens, comments: tokenizer.comments, error };\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/cddl/position.ts","../../src/cddl/index.ts"],"sourcesContent":["/**\n * Convert a character offset (as carried by CDDL AST nodes, CddlWarning,\n * and CddlValidationError.schemaStart/schemaEnd or start/end for CDN input)\n * into a 1-based line/column position, for CLI-style `file:line:col`\n * reporting.\n *\n * Offsets are JS string indices (UTF-16 code units), matching everything\n * else in this library. Offsets past the end of the text clamp to its end.\n */\nexport function positionAt(\n text: string,\n offset: number\n): { line: number; column: number } {\n const end = Math.max(0, Math.min(offset, text.length));\n let line = 1;\n let lineStart = 0;\n for (let i = 0; i < end; i++) {\n if (text.charCodeAt(i) === 0x0a) {\n line++;\n lineStart = i + 1;\n }\n }\n return { line, column: end - lineStart + 1 };\n}\n","/**\n * Public CDDL API (`@cbortech/cbor/cddl`).\n *\n * Phase 1 covers the grammar layer of RFC 8610 + RFC 9682: compiling CDDL\n * text into a checked rule table (`CDDL.compile`), re-serializing it\n * (`schema.format()`), and the lower-level tokenization API used by tooling\n * such as syntax highlighters. Validating CBOR/CDN data against a schema is\n * a later phase.\n */\n\nimport { CddlTokenizer, type CddlComment, type CddlToken } from './tokenizer';\nimport { CddlSyntaxError } from './errors';\nimport { compile, CddlSchema, type CompileOptions } from './schema';\n\nexport type { CddlToken, CddlTokenType, CddlComment } from './tokenizer';\nexport {\n CddlSyntaxError,\n CddlSemanticError,\n CddlMismatchError,\n} from './errors';\nexport type {\n CddlWarning,\n CddlValidationError,\n CddlValidationWarning,\n ValidationResult,\n} from './errors';\nexport type { ValidateOptions } from './validator';\nexport { CddlSchema } from './schema';\nexport type { CompileOptions } from './schema';\nexport { parseCDDL } from './parser';\nexport type { ParseCddlResult } from './parser';\nexport { PRELUDE_CDDL, getPreludeRules } from './prelude';\nexport { getERefTables } from './eref';\nexport type { ERefTables } from './eref';\nexport { positionAt } from './position';\nexport type { CddlFormatOptions } from './writer';\nexport type {\n CddlRule,\n CddlType,\n CddlType1,\n CddlType2,\n CddlValue,\n CddlRef,\n CddlParenType,\n CddlMapType,\n CddlArrayType,\n CddlUnwrap,\n CddlEnum,\n CddlTagged,\n CddlMajor,\n CddlAny,\n CddlGroup,\n CddlGroupEntry,\n CddlEntryValue,\n CddlEntryGroup,\n CddlOccur,\n CddlMemberKey,\n CddlNodeBase,\n} from './ast';\n\n/** Main CDDL facade — mirrors the shape of the `CBOR` facade. */\nexport class CDDL {\n /**\n * Parse and compile a CDDL data model.\n *\n * @example\n * const schema = CDDL.compile(`person = { name: tstr, ? age: uint }`);\n * schema.root.name; // 'person'\n */\n static compile(text: string, options?: CompileOptions): CddlSchema {\n return compile(text, options);\n }\n}\n\nexport default CDDL;\n\nexport interface TokenizeResult {\n /** Scanned tokens in source order, excluding the final EOF token. */\n tokens: CddlToken[];\n /** Comments encountered while scanning, in source order. */\n comments: CddlComment[];\n}\n\nexport interface TokenizeLenientResult extends TokenizeResult {\n /**\n * The scan failure, if any. When set, `tokens` ends with a synthetic\n * `ERROR` token covering the source from the last clean token to the end\n * of the input.\n */\n error?: CddlSyntaxError;\n}\n\n/**\n * Tokenize CDDL text. Throws {@link CddlSyntaxError} on invalid input.\n */\nexport function tokenize(text: string): TokenizeResult {\n const tokenizer = new CddlTokenizer(text);\n const tokens: CddlToken[] = [];\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n}\n\n/**\n * Error-tolerant tokenization for editors and highlighters: never throws on\n * invalid input. Tokens before the failure are returned as scanned; the\n * remainder of the input is covered by a single synthetic `ERROR` token and\n * the failure is reported in `error`.\n */\nexport function tokenizeLenient(text: string): TokenizeLenientResult {\n const tokenizer = new CddlTokenizer(text);\n const tokens: CddlToken[] = [];\n try {\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n } catch (e) {\n const error =\n e instanceof CddlSyntaxError\n ? e\n : new CddlSyntaxError(e instanceof Error ? e.message : String(e));\n const start = tokenizer.lastEndOffset;\n if (start < text.length) {\n let line = 1;\n let col = 1;\n for (let i = 0; i < start; i++) {\n if (text[i] === '\\n') {\n line++;\n col = 1;\n } else {\n col++;\n }\n }\n tokens.push({\n type: 'ERROR',\n value: text.slice(start),\n raw: text.slice(start),\n line,\n col,\n offset: start,\n endOffset: text.length,\n });\n }\n return { tokens, comments: tokenizer.comments, error };\n }\n}\n"],"mappings":"iLASA,SAAgB,EACd,EACA,EACkC,CAClC,IAAM,EAAM,KAAK,IAAI,EAAG,KAAK,IAAI,EAAQ,EAAK,MAAM,CAAC,EACjD,EAAO,EACP,EAAY,EAChB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,IACnB,EAAK,WAAW,CAAC,IAAM,KACzB,IACA,EAAY,EAAI,GAGpB,MAAO,CAAE,OAAM,OAAQ,EAAM,EAAY,CAAE,CAC7C,CCsCA,IAAa,EAAb,KAAkB,CAQhB,OAAO,QAAQ,EAAc,EAAsC,CACjE,OAAO,EAAA,EAAQ,EAAM,CAAO,CAC9B,CACF,EAuBA,SAAgB,EAAS,EAA8B,CACrD,IAAM,EAAY,IAAI,EAAA,EAAc,CAAI,EAClC,EAAsB,CAAC,EAC7B,OAAS,CACP,IAAM,EAAM,EAAU,QAAQ,EAC9B,GAAI,EAAI,OAAS,MAAO,MACxB,EAAO,KAAK,CAAG,CACjB,CACA,MAAO,CAAE,SAAQ,SAAU,EAAU,QAAS,CAChD,CAQA,SAAgB,EAAgB,EAAqC,CACnE,IAAM,EAAY,IAAI,EAAA,EAAc,CAAI,EAClC,EAAsB,CAAC,EAC7B,GAAI,CACF,OAAS,CACP,IAAM,EAAM,EAAU,QAAQ,EAC9B,GAAI,EAAI,OAAS,MAAO,MACxB,EAAO,KAAK,CAAG,CACjB,CACA,MAAO,CAAE,SAAQ,SAAU,EAAU,QAAS,CAChD,OAAS,EAAG,CACV,IAAM,EACJ,aAAa,EAAA,EACT,EACA,IAAI,EAAA,EAAgB,aAAa,MAAQ,EAAE,QAAU,OAAO,CAAC,CAAC,EAC9D,EAAQ,EAAU,cACxB,GAAI,EAAQ,EAAK,OAAQ,CACvB,IAAI,EAAO,EACP,EAAM,EACV,IAAK,IAAI,EAAI,EAAG,EAAI,EAAO,IACrB,EAAK,KAAO;GACd,IACA,EAAM,GAEN,IAGJ,EAAO,KAAK,CACV,KAAM,QACN,MAAO,EAAK,MAAM,CAAK,EACvB,IAAK,EAAK,MAAM,CAAK,EACrB,OACA,MACA,OAAQ,EACR,UAAW,EAAK,MAClB,CAAC,CACH,CACA,MAAO,CAAE,SAAQ,SAAU,EAAU,SAAU,OAAM,CACvD,CACF"}
|
package/dist/cddl/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export type { CompileOptions } from './schema';
|
|
|
10
10
|
export { parseCDDL } from './parser';
|
|
11
11
|
export type { ParseCddlResult } from './parser';
|
|
12
12
|
export { PRELUDE_CDDL, getPreludeRules } from './prelude';
|
|
13
|
+
export { getERefTables } from './eref';
|
|
14
|
+
export type { ERefTables } from './eref';
|
|
13
15
|
export { positionAt } from './position';
|
|
14
16
|
export type { CddlFormatOptions } from './writer';
|
|
15
17
|
export type { CddlRule, CddlType, CddlType1, CddlType2, CddlValue, CddlRef, CddlParenType, CddlMapType, CddlArrayType, CddlUnwrap, CddlEnum, CddlTagged, CddlMajor, CddlAny, CddlGroup, CddlGroupEntry, CddlEntryValue, CddlEntryGroup, CddlOccur, CddlMemberKey, CddlNodeBase, } from './ast';
|
package/dist/cddl/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as e, Q as t, Z as n, d as r, f as i, m as a, p as o, u as s } from "../mapEntries-8zshEr-t.js";
|
|
2
|
+
import { n as c, t as l } from "../schema-7r2xjpMK.js";
|
|
2
3
|
//#region src/cddl/position.ts
|
|
3
|
-
function
|
|
4
|
+
function u(e, t) {
|
|
4
5
|
let n = Math.max(0, Math.min(t, e.length)), r = 1, i = 0;
|
|
5
6
|
for (let t = 0; t < n; t++) e.charCodeAt(t) === 10 && (r++, i = t + 1);
|
|
6
7
|
return {
|
|
@@ -10,13 +11,13 @@ function l(e, t) {
|
|
|
10
11
|
}
|
|
11
12
|
//#endregion
|
|
12
13
|
//#region src/cddl/index.ts
|
|
13
|
-
var
|
|
14
|
+
var d = class {
|
|
14
15
|
static compile(e, t) {
|
|
15
|
-
return
|
|
16
|
+
return c(e, t);
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
|
-
function
|
|
19
|
-
let t = new
|
|
19
|
+
function f(e) {
|
|
20
|
+
let t = new o(e), n = [];
|
|
20
21
|
for (;;) {
|
|
21
22
|
let e = t.consume();
|
|
22
23
|
if (e.type === "EOF") break;
|
|
@@ -27,41 +28,41 @@ function d(e) {
|
|
|
27
28
|
comments: t.comments
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
let
|
|
31
|
+
function p(t) {
|
|
32
|
+
let n = new o(t), r = [];
|
|
32
33
|
try {
|
|
33
34
|
for (;;) {
|
|
34
|
-
let e =
|
|
35
|
+
let e = n.consume();
|
|
35
36
|
if (e.type === "EOF") break;
|
|
36
|
-
|
|
37
|
+
r.push(e);
|
|
37
38
|
}
|
|
38
39
|
return {
|
|
39
|
-
tokens:
|
|
40
|
-
comments:
|
|
40
|
+
tokens: r,
|
|
41
|
+
comments: n.comments
|
|
41
42
|
};
|
|
42
43
|
} catch (i) {
|
|
43
|
-
let a = i instanceof
|
|
44
|
-
if (o <
|
|
45
|
-
let
|
|
46
|
-
for (let
|
|
47
|
-
|
|
44
|
+
let a = i instanceof e ? i : new e(i instanceof Error ? i.message : String(i)), o = n.lastEndOffset;
|
|
45
|
+
if (o < t.length) {
|
|
46
|
+
let e = 1, n = 1;
|
|
47
|
+
for (let r = 0; r < o; r++) t[r] === "\n" ? (e++, n = 1) : n++;
|
|
48
|
+
r.push({
|
|
48
49
|
type: "ERROR",
|
|
49
|
-
value:
|
|
50
|
-
raw:
|
|
51
|
-
line:
|
|
52
|
-
col:
|
|
50
|
+
value: t.slice(o),
|
|
51
|
+
raw: t.slice(o),
|
|
52
|
+
line: e,
|
|
53
|
+
col: n,
|
|
53
54
|
offset: o,
|
|
54
|
-
endOffset:
|
|
55
|
+
endOffset: t.length
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
return {
|
|
58
|
-
tokens:
|
|
59
|
-
comments:
|
|
59
|
+
tokens: r,
|
|
60
|
+
comments: n.comments,
|
|
60
61
|
error: a
|
|
61
62
|
};
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
//#endregion
|
|
65
|
-
export {
|
|
66
|
+
export { d as CDDL, d as default, n as CddlMismatchError, l as CddlSchema, t as CddlSemanticError, e as CddlSyntaxError, s as PRELUDE_CDDL, a as getERefTables, r as getPreludeRules, i as parseCDDL, u as positionAt, f as tokenize, p as tokenizeLenient };
|
|
66
67
|
|
|
67
68
|
//# sourceMappingURL=index.js.map
|
package/dist/cddl/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/cddl/position.ts","../../src/cddl/index.ts"],"sourcesContent":["/**\n * Convert a character offset (as carried by CDDL AST nodes, CddlWarning,\n * and CddlValidationError.schemaStart/schemaEnd or start/end for CDN input)\n * into a 1-based line/column position, for CLI-style `file:line:col`\n * reporting.\n *\n * Offsets are JS string indices (UTF-16 code units), matching everything\n * else in this library. Offsets past the end of the text clamp to its end.\n */\nexport function positionAt(\n text: string,\n offset: number\n): { line: number; column: number } {\n const end = Math.max(0, Math.min(offset, text.length));\n let line = 1;\n let lineStart = 0;\n for (let i = 0; i < end; i++) {\n if (text.charCodeAt(i) === 0x0a) {\n line++;\n lineStart = i + 1;\n }\n }\n return { line, column: end - lineStart + 1 };\n}\n","/**\n * Public CDDL API (`@cbortech/cbor/cddl`).\n *\n * Phase 1 covers the grammar layer of RFC 8610 + RFC 9682: compiling CDDL\n * text into a checked rule table (`CDDL.compile`), re-serializing it\n * (`schema.format()`), and the lower-level tokenization API used by tooling\n * such as syntax highlighters. Validating CBOR/CDN data against a schema is\n * a later phase.\n */\n\nimport { CddlTokenizer, type CddlComment, type CddlToken } from './tokenizer';\nimport { CddlSyntaxError } from './errors';\nimport { compile, CddlSchema, type CompileOptions } from './schema';\n\nexport type { CddlToken, CddlTokenType, CddlComment } from './tokenizer';\nexport {\n CddlSyntaxError,\n CddlSemanticError,\n CddlMismatchError,\n} from './errors';\nexport type {\n CddlWarning,\n CddlValidationError,\n CddlValidationWarning,\n ValidationResult,\n} from './errors';\nexport type { ValidateOptions } from './validator';\nexport { CddlSchema } from './schema';\nexport type { CompileOptions } from './schema';\nexport { parseCDDL } from './parser';\nexport type { ParseCddlResult } from './parser';\nexport { PRELUDE_CDDL, getPreludeRules } from './prelude';\nexport { positionAt } from './position';\nexport type { CddlFormatOptions } from './writer';\nexport type {\n CddlRule,\n CddlType,\n CddlType1,\n CddlType2,\n CddlValue,\n CddlRef,\n CddlParenType,\n CddlMapType,\n CddlArrayType,\n CddlUnwrap,\n CddlEnum,\n CddlTagged,\n CddlMajor,\n CddlAny,\n CddlGroup,\n CddlGroupEntry,\n CddlEntryValue,\n CddlEntryGroup,\n CddlOccur,\n CddlMemberKey,\n CddlNodeBase,\n} from './ast';\n\n/** Main CDDL facade — mirrors the shape of the `CBOR` facade. */\nexport class CDDL {\n /**\n * Parse and compile a CDDL data model.\n *\n * @example\n * const schema = CDDL.compile(`person = { name: tstr, ? age: uint }`);\n * schema.root.name; // 'person'\n */\n static compile(text: string, options?: CompileOptions): CddlSchema {\n return compile(text, options);\n }\n}\n\nexport default CDDL;\n\nexport interface TokenizeResult {\n /** Scanned tokens in source order, excluding the final EOF token. */\n tokens: CddlToken[];\n /** Comments encountered while scanning, in source order. */\n comments: CddlComment[];\n}\n\nexport interface TokenizeLenientResult extends TokenizeResult {\n /**\n * The scan failure, if any. When set, `tokens` ends with a synthetic\n * `ERROR` token covering the source from the last clean token to the end\n * of the input.\n */\n error?: CddlSyntaxError;\n}\n\n/**\n * Tokenize CDDL text. Throws {@link CddlSyntaxError} on invalid input.\n */\nexport function tokenize(text: string): TokenizeResult {\n const tokenizer = new CddlTokenizer(text);\n const tokens: CddlToken[] = [];\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n}\n\n/**\n * Error-tolerant tokenization for editors and highlighters: never throws on\n * invalid input. Tokens before the failure are returned as scanned; the\n * remainder of the input is covered by a single synthetic `ERROR` token and\n * the failure is reported in `error`.\n */\nexport function tokenizeLenient(text: string): TokenizeLenientResult {\n const tokenizer = new CddlTokenizer(text);\n const tokens: CddlToken[] = [];\n try {\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n } catch (e) {\n const error =\n e instanceof CddlSyntaxError\n ? e\n : new CddlSyntaxError(e instanceof Error ? e.message : String(e));\n const start = tokenizer.lastEndOffset;\n if (start < text.length) {\n let line = 1;\n let col = 1;\n for (let i = 0; i < start; i++) {\n if (text[i] === '\\n') {\n line++;\n col = 1;\n } else {\n col++;\n }\n }\n tokens.push({\n type: 'ERROR',\n value: text.slice(start),\n raw: text.slice(start),\n line,\n col,\n offset: start,\n endOffset: text.length,\n });\n }\n return { tokens, comments: tokenizer.comments, error };\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/cddl/position.ts","../../src/cddl/index.ts"],"sourcesContent":["/**\n * Convert a character offset (as carried by CDDL AST nodes, CddlWarning,\n * and CddlValidationError.schemaStart/schemaEnd or start/end for CDN input)\n * into a 1-based line/column position, for CLI-style `file:line:col`\n * reporting.\n *\n * Offsets are JS string indices (UTF-16 code units), matching everything\n * else in this library. Offsets past the end of the text clamp to its end.\n */\nexport function positionAt(\n text: string,\n offset: number\n): { line: number; column: number } {\n const end = Math.max(0, Math.min(offset, text.length));\n let line = 1;\n let lineStart = 0;\n for (let i = 0; i < end; i++) {\n if (text.charCodeAt(i) === 0x0a) {\n line++;\n lineStart = i + 1;\n }\n }\n return { line, column: end - lineStart + 1 };\n}\n","/**\n * Public CDDL API (`@cbortech/cbor/cddl`).\n *\n * Phase 1 covers the grammar layer of RFC 8610 + RFC 9682: compiling CDDL\n * text into a checked rule table (`CDDL.compile`), re-serializing it\n * (`schema.format()`), and the lower-level tokenization API used by tooling\n * such as syntax highlighters. Validating CBOR/CDN data against a schema is\n * a later phase.\n */\n\nimport { CddlTokenizer, type CddlComment, type CddlToken } from './tokenizer';\nimport { CddlSyntaxError } from './errors';\nimport { compile, CddlSchema, type CompileOptions } from './schema';\n\nexport type { CddlToken, CddlTokenType, CddlComment } from './tokenizer';\nexport {\n CddlSyntaxError,\n CddlSemanticError,\n CddlMismatchError,\n} from './errors';\nexport type {\n CddlWarning,\n CddlValidationError,\n CddlValidationWarning,\n ValidationResult,\n} from './errors';\nexport type { ValidateOptions } from './validator';\nexport { CddlSchema } from './schema';\nexport type { CompileOptions } from './schema';\nexport { parseCDDL } from './parser';\nexport type { ParseCddlResult } from './parser';\nexport { PRELUDE_CDDL, getPreludeRules } from './prelude';\nexport { getERefTables } from './eref';\nexport type { ERefTables } from './eref';\nexport { positionAt } from './position';\nexport type { CddlFormatOptions } from './writer';\nexport type {\n CddlRule,\n CddlType,\n CddlType1,\n CddlType2,\n CddlValue,\n CddlRef,\n CddlParenType,\n CddlMapType,\n CddlArrayType,\n CddlUnwrap,\n CddlEnum,\n CddlTagged,\n CddlMajor,\n CddlAny,\n CddlGroup,\n CddlGroupEntry,\n CddlEntryValue,\n CddlEntryGroup,\n CddlOccur,\n CddlMemberKey,\n CddlNodeBase,\n} from './ast';\n\n/** Main CDDL facade — mirrors the shape of the `CBOR` facade. */\nexport class CDDL {\n /**\n * Parse and compile a CDDL data model.\n *\n * @example\n * const schema = CDDL.compile(`person = { name: tstr, ? age: uint }`);\n * schema.root.name; // 'person'\n */\n static compile(text: string, options?: CompileOptions): CddlSchema {\n return compile(text, options);\n }\n}\n\nexport default CDDL;\n\nexport interface TokenizeResult {\n /** Scanned tokens in source order, excluding the final EOF token. */\n tokens: CddlToken[];\n /** Comments encountered while scanning, in source order. */\n comments: CddlComment[];\n}\n\nexport interface TokenizeLenientResult extends TokenizeResult {\n /**\n * The scan failure, if any. When set, `tokens` ends with a synthetic\n * `ERROR` token covering the source from the last clean token to the end\n * of the input.\n */\n error?: CddlSyntaxError;\n}\n\n/**\n * Tokenize CDDL text. Throws {@link CddlSyntaxError} on invalid input.\n */\nexport function tokenize(text: string): TokenizeResult {\n const tokenizer = new CddlTokenizer(text);\n const tokens: CddlToken[] = [];\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n}\n\n/**\n * Error-tolerant tokenization for editors and highlighters: never throws on\n * invalid input. Tokens before the failure are returned as scanned; the\n * remainder of the input is covered by a single synthetic `ERROR` token and\n * the failure is reported in `error`.\n */\nexport function tokenizeLenient(text: string): TokenizeLenientResult {\n const tokenizer = new CddlTokenizer(text);\n const tokens: CddlToken[] = [];\n try {\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n } catch (e) {\n const error =\n e instanceof CddlSyntaxError\n ? e\n : new CddlSyntaxError(e instanceof Error ? e.message : String(e));\n const start = tokenizer.lastEndOffset;\n if (start < text.length) {\n let line = 1;\n let col = 1;\n for (let i = 0; i < start; i++) {\n if (text[i] === '\\n') {\n line++;\n col = 1;\n } else {\n col++;\n }\n }\n tokens.push({\n type: 'ERROR',\n value: text.slice(start),\n raw: text.slice(start),\n line,\n col,\n offset: start,\n endOffset: text.length,\n });\n }\n return { tokens, comments: tokenizer.comments, error };\n }\n}\n"],"mappings":";;;AASA,SAAgB,EACd,GACA,GACkC;CAClC,IAAM,IAAM,KAAK,IAAI,GAAG,KAAK,IAAI,GAAQ,EAAK,MAAM,CAAC,GACjD,IAAO,GACP,IAAY;CAChB,KAAK,IAAI,IAAI,GAAG,IAAI,GAAK,KACvB,AAAI,EAAK,WAAW,CAAC,MAAM,OACzB,KACA,IAAY,IAAI;CAGpB,OAAO;EAAE;EAAM,QAAQ,IAAM,IAAY;CAAE;AAC7C;;;ACsCA,IAAa,IAAb,MAAkB;CAQhB,OAAO,QAAQ,GAAc,GAAsC;EACjE,OAAO,EAAQ,GAAM,CAAO;CAC9B;AACF;AAuBA,SAAgB,EAAS,GAA8B;CACrD,IAAM,IAAY,IAAI,EAAc,CAAI,GAClC,IAAsB,CAAC;CAC7B,SAAS;EACP,IAAM,IAAM,EAAU,QAAQ;EAC9B,IAAI,EAAI,SAAS,OAAO;EACxB,EAAO,KAAK,CAAG;CACjB;CACA,OAAO;EAAE;EAAQ,UAAU,EAAU;CAAS;AAChD;AAQA,SAAgB,EAAgB,GAAqC;CACnE,IAAM,IAAY,IAAI,EAAc,CAAI,GAClC,IAAsB,CAAC;CAC7B,IAAI;EACF,SAAS;GACP,IAAM,IAAM,EAAU,QAAQ;GAC9B,IAAI,EAAI,SAAS,OAAO;GACxB,EAAO,KAAK,CAAG;EACjB;EACA,OAAO;GAAE;GAAQ,UAAU,EAAU;EAAS;CAChD,SAAS,GAAG;EACV,IAAM,IACJ,aAAa,IACT,IACA,IAAI,EAAgB,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC,GAC9D,IAAQ,EAAU;EACxB,IAAI,IAAQ,EAAK,QAAQ;GACvB,IAAI,IAAO,GACP,IAAM;GACV,KAAK,IAAI,IAAI,GAAG,IAAI,GAAO,KACzB,AAAI,EAAK,OAAO,QACd,KACA,IAAM,KAEN;GAGJ,EAAO,KAAK;IACV,MAAM;IACN,OAAO,EAAK,MAAM,CAAK;IACvB,KAAK,EAAK,MAAM,CAAK;IACrB;IACA;IACA,QAAQ;IACR,WAAW,EAAK;GAClB,CAAC;EACH;EACA,OAAO;GAAE;GAAQ,UAAU,EAAU;GAAU;EAAM;CACvD;AACF"}
|
package/dist/cddl/validator.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { CddlSchema } from './schema';
|
|
2
2
|
import { CborItem } from '../ast/CborItem';
|
|
3
|
+
import { CborMap } from '../ast/CborMap';
|
|
4
|
+
import { CborTag } from '../ast/CborTag';
|
|
3
5
|
import { ValidationResult } from './errors';
|
|
4
|
-
import { CddlValue } from './ast';
|
|
6
|
+
import { CddlGroup, CddlMemberKey, CddlType, CddlType1, CddlValue } from './ast';
|
|
5
7
|
export interface ValidateOptions {
|
|
6
8
|
/** Recursion guard for rule references and nested groups (default 256). */
|
|
7
9
|
maxDepth?: number;
|
|
@@ -26,5 +28,99 @@ export interface ValidateOptions {
|
|
|
26
28
|
*/
|
|
27
29
|
rule?: string;
|
|
28
30
|
}
|
|
29
|
-
|
|
31
|
+
/**
|
|
32
|
+
* One tag on a successful match path: `item` is a `CborTag` matched by a
|
|
33
|
+
* `#6.N(type)` with literal tag number `tag`, or — `inferred` — an
|
|
34
|
+
* untagged item that matched only as the content of such a type (see
|
|
35
|
+
* `TagTracing.infer`).
|
|
36
|
+
*/
|
|
37
|
+
export interface TagRecord {
|
|
38
|
+
readonly item: CborItem;
|
|
39
|
+
readonly tag: bigint;
|
|
40
|
+
readonly inferred: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* For an inferred record, how many inferred tags enclose this one around
|
|
43
|
+
* the same item (0 = outermost): `#6.101(#6.100(int))` records 101 at
|
|
44
|
+
* layer 0 and 100 at layer 1. Re-checking one layer (`.and`, …) repeats
|
|
45
|
+
* its layer; a genuinely nested tag, even of the same number, doesn't.
|
|
46
|
+
* Always 0 for a matched tag.
|
|
47
|
+
*/
|
|
48
|
+
readonly layer: number;
|
|
49
|
+
}
|
|
50
|
+
/** Tag bookkeeping for {@link validateItem}'s internal callers. */
|
|
51
|
+
export interface TagTracing {
|
|
52
|
+
/**
|
|
53
|
+
* Let `#6.N(type)` (literal N) accept an untagged item matching `type`,
|
|
54
|
+
* recording it as inferred. Only a fallback: at every type, rule and
|
|
55
|
+
* map-group choice, alternatives are first tried without inference.
|
|
56
|
+
*/
|
|
57
|
+
readonly infer?: boolean;
|
|
58
|
+
/** Tags to match as if absent (their content in their place). */
|
|
59
|
+
readonly stripped?: ReadonlySet<CborTag>;
|
|
60
|
+
/** Receives the successful path's records (left empty on failure). */
|
|
61
|
+
readonly trail: TagRecord[];
|
|
62
|
+
}
|
|
63
|
+
/** Generic parameter bindings; each binding closes over its defining env. */
|
|
64
|
+
type Env = Map<string, {
|
|
65
|
+
type1: CddlType1;
|
|
66
|
+
env: Env;
|
|
67
|
+
}> | undefined;
|
|
68
|
+
export declare function validateItem(schema: CddlSchema, item: CborItem, options?: ValidateOptions, tags?: TagTracing): ValidationResult;
|
|
69
|
+
/**
|
|
70
|
+
* Whether `item` matches `type` on its own, exactly as validation would
|
|
71
|
+
* check it at a position of that type (no generic bindings). `undefined`
|
|
72
|
+
* when the step/depth budget runs out.
|
|
73
|
+
*/
|
|
74
|
+
export declare function itemMatchesType(schema: CddlSchema, item: CborItem, type: CddlType, options?: ValidateOptions): boolean | undefined;
|
|
75
|
+
/** Opaque generic-parameter bindings in force at some point of a match. */
|
|
76
|
+
export type CddlEnv = Env;
|
|
77
|
+
/**
|
|
78
|
+
* The group member that consumed one map entry on the validator's own
|
|
79
|
+
* successful path — its member key, value type, and the generic bindings
|
|
80
|
+
* in force there.
|
|
81
|
+
*/
|
|
82
|
+
export interface MapMember {
|
|
83
|
+
readonly memberKey: CddlMemberKey;
|
|
84
|
+
readonly type: CddlType;
|
|
85
|
+
readonly env: CddlEnv;
|
|
86
|
+
}
|
|
87
|
+
/** One map group a type can denote, with its generic bindings. */
|
|
88
|
+
export interface MapGroupTarget {
|
|
89
|
+
readonly group: CddlGroup;
|
|
90
|
+
readonly env: CddlEnv;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Every map group (`{...}`) `type` can denote, following references,
|
|
94
|
+
* parentheses, choices and generic bindings exactly as `matchType()` does.
|
|
95
|
+
* `undefined` when some alternative could still match a map some *other*
|
|
96
|
+
* way this can't see into — `any`/`#5`, a control operator, `~unwrap`, an
|
|
97
|
+
* `&(...)` type, an undefined name — so no single group's assignment is
|
|
98
|
+
* known to be the one validation used.
|
|
99
|
+
*/
|
|
100
|
+
export declare function mapGroupsOfType(schema: CddlSchema, type: CddlType, env: CddlEnv): MapGroupTarget[] | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* The literal text a member key requires, when it requires exactly one:
|
|
103
|
+
* `name:`, `"name":`, or `"name" =>` (a text-literal key type).
|
|
104
|
+
*/
|
|
105
|
+
export declare function plainTextSpelling(mk: CddlMemberKey): string | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Every spelling used as a plain text member key anywhere in `target`'s
|
|
108
|
+
* group — `name:`, `"name":`, or a key type that accepts a text literal
|
|
109
|
+
* (`"name" =>`, a rule or `/` choice of such literals, or a generic
|
|
110
|
+
* parameter bound to one, e.g. `K => …` in `G<"name">`) — through inline
|
|
111
|
+
* sub-groups, bare group references and `~unwrap`ped groups, expanded
|
|
112
|
+
* exactly as matching expands them (`expandEntry()`), across every choice
|
|
113
|
+
* and every distinct generic instantiation. `undefined` when the expansion
|
|
114
|
+
* runs out of budget.
|
|
115
|
+
*/
|
|
116
|
+
export declare function plainTextMemberKeys(schema: CddlSchema, target: MapGroupTarget): ReadonlySet<string> | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Match `map` against one map group exactly as validation does
|
|
119
|
+
* (`matchMapGroup()`), returning which member consumed each of its entries
|
|
120
|
+
* on the successful path (`false` for one left unconsumed, e.g. an elided
|
|
121
|
+
* `...` entry). `null` when it doesn't match; `undefined` when the budget
|
|
122
|
+
* runs out.
|
|
123
|
+
*/
|
|
124
|
+
export declare function traceMapGroup(schema: CddlSchema, map: CborMap, target: MapGroupTarget, options?: ValidateOptions): readonly (MapMember | false)[] | null | undefined;
|
|
30
125
|
export declare function matchesLiteral(item: CborItem, v: CddlValue): boolean;
|
|
126
|
+
export {};
|
package/dist/cdn/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../serialize-utils-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../serialize-utils-DQ8T3Mzw.cjs");function t(t){let n=new e.A(t),r=[];for(;;){let e=n.consume();if(e.type===`EOF`)break;r.push(e)}return{tokens:r,comments:n.comments}}function n(t){let n=new e.A(t),r=[];try{for(;;){let e=n.consume();if(e.type===`EOF`)break;r.push(e)}return{tokens:r,comments:n.comments}}catch(i){let a=i instanceof e.I?i:new e.I(i instanceof Error?i.message:String(i)),o=n.lastEndOffset;if(o<t.length){let e=1,n=1;for(let r=0;r<o;r++)t[r]===`
|
|
2
2
|
`?(e++,n=1):n++;r.push({type:`ERROR`,value:t.slice(o),raw:t.slice(o),line:e,col:n,offset:o,endOffset:t.length})}return{tokens:r,comments:n.comments,error:a}}}exports.CdnSyntaxError=e.I,exports.adjustAppSeqIndicator=e.t,exports.adjustRawAppSeqSource=e.n,exports.canonicalEncodingWidth=e.r,exports.decideTaggedAppSeqRendering=e.o,exports.resolveEiSuffix=e.C,exports.tokenize=t,exports.tokenizeLenient=n;
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cdn/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as e, C as t, I as n, n as r, o as i, r as a, t as o } from "../serialize-utils-
|
|
1
|
+
import { A as e, C as t, I as n, n as r, o as i, r as a, t as o } from "../serialize-utils-BQtutOo6.js";
|
|
2
2
|
//#region src/cdn/index.ts
|
|
3
3
|
function s(t) {
|
|
4
4
|
let n = new e(t), r = [];
|