@dialecte/core 0.5.4 → 0.6.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/dist/document/query/any/any-query.d.ts +2 -2
- package/dist/document/query/any/any-query.d.ts.map +1 -1
- package/dist/document/query/find/by-attribute/find-by-attributes.d.ts +3 -0
- package/dist/document/query/find/by-attribute/find-by-attributes.d.ts.map +1 -1
- package/dist/document/query/find/by-attribute/find-by-attributes.types.d.ts +21 -1
- package/dist/document/query/find/by-attribute/find-by-attributes.types.d.ts.map +1 -1
- package/dist/document/query/get/attribute/get-attributes.d.ts +4 -6
- package/dist/document/query/get/attribute/get-attributes.d.ts.map +1 -1
- package/dist/document/query/get/definition/get-definition.d.ts +2 -2
- package/dist/document/query/get/definition/get-definition.d.ts.map +1 -1
- package/dist/document/query/main.d.ts +11 -10
- package/dist/document/query/main.d.ts.map +1 -1
- package/dist/document/query/tree-filter/omit.d.ts +7 -1
- package/dist/document/query/tree-filter/omit.d.ts.map +1 -1
- package/dist/document/transaction/create/create.d.ts.map +1 -1
- package/dist/document/transaction/create/create.types.d.ts +5 -5
- package/dist/document/transaction/create/create.types.d.ts.map +1 -1
- package/dist/document/transaction/update/update.d.ts.map +1 -1
- package/dist/errors/codes.d.ts +12 -0
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/helpers/assert-fixed.d.ts +3 -2
- package/dist/helpers/assert-fixed.d.ts.map +1 -1
- package/dist/helpers/assert-xsi-type.d.ts +28 -0
- package/dist/helpers/assert-xsi-type.d.ts.map +1 -0
- package/dist/helpers/constant.d.ts +4 -0
- package/dist/helpers/constant.d.ts.map +1 -1
- package/dist/helpers/converter.d.ts +9 -1
- package/dist/helpers/converter.d.ts.map +1 -1
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/standardizing.d.ts.map +1 -1
- package/dist/helpers.js +195 -107
- package/dist/index.js +3 -3
- package/dist/{project-BdNBOjAX.js → project-DwtNI4J5.js} +2086 -1956
- package/dist/test/assert-valid-xml/assert-valid-xml.d.ts.map +1 -1
- package/dist/test/assert-valid-xml/assert-valid-xml.types.d.ts +10 -4
- package/dist/test/assert-valid-xml/assert-valid-xml.types.d.ts.map +1 -1
- package/dist/test/config.d.ts +972 -740
- package/dist/test/config.d.ts.map +1 -1
- package/dist/test/generated/constants.generated.d.ts +59 -4
- package/dist/test/generated/constants.generated.d.ts.map +1 -1
- package/dist/test/generated/definition.generated.d.ts +920 -736
- package/dist/test/generated/definition.generated.d.ts.map +1 -1
- package/dist/test/generated/types.generated.d.ts +401 -1
- package/dist/test/generated/types.generated.d.ts.map +1 -1
- package/dist/test/run-test-cases.d.ts +972 -740
- package/dist/test/run-test-cases.d.ts.map +1 -1
- package/dist/test/test-record.d.ts +9979 -8123
- package/dist/test/test-record.d.ts.map +1 -1
- package/dist/test.js +1234 -735
- package/dist/types/definition.d.ts +80 -68
- package/dist/types/definition.d.ts.map +1 -1
- package/dist/types/dialecte-config.d.ts +8 -7
- package/dist/types/dialecte-config.d.ts.map +1 -1
- package/dist/utils/attribute-rules.d.ts +5 -49
- package/dist/utils/attribute-rules.d.ts.map +1 -1
- package/dist/utils/datatype.d.ts +12 -0
- package/dist/utils/datatype.d.ts.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/namespaces.d.ts +47 -0
- package/dist/utils/namespaces.d.ts.map +1 -0
- package/dist/utils/resolve-definition.d.ts +29 -11
- package/dist/utils/resolve-definition.d.ts.map +1 -1
- package/dist/utils/resolve-definition.types.d.ts +6 -0
- package/dist/utils/resolve-definition.types.d.ts.map +1 -0
- package/dist/utils/xsi-type.d.ts +55 -0
- package/dist/utils/xsi-type.d.ts.map +1 -0
- package/dist/utils/xsi-type.types.d.ts +10 -0
- package/dist/utils/xsi-type.types.d.ts.map +1 -0
- package/dist/{utils-Cgqv3qwv.js → utils-CZ12wsuC.js} +216 -61
- package/dist/utils.js +2 -2
- package/dist/xml/build/build-xml-document.d.ts.map +1 -1
- package/dist/xml/parse/parser.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
import { Namespace } from './records';
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
2
|
+
/** A name test of a selector or field step: absent name or namespace = any (`*`, `p:*`); `namespace: ''` = none. */
|
|
3
|
+
export type NameTest = {
|
|
4
|
+
readonly name?: string;
|
|
5
|
+
readonly namespace?: string;
|
|
6
6
|
};
|
|
7
|
+
/** One alternative of a selector: the steps from the element the constraint is declared on (`[]` = itself). */
|
|
7
8
|
export type SelectorPath = {
|
|
8
9
|
readonly deep?: true;
|
|
9
|
-
readonly steps: readonly
|
|
10
|
+
readonly steps: readonly NameTest[];
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
-
export type
|
|
13
|
-
readonly
|
|
14
|
-
readonly value?: string;
|
|
15
|
-
readonly isAttribute?: true;
|
|
16
|
-
};
|
|
17
|
-
export type ConstraintField = {
|
|
18
|
-
readonly deep?: true;
|
|
19
|
-
readonly steps?: readonly XPathStep[];
|
|
20
|
-
readonly target: FieldTarget;
|
|
12
|
+
/** One alternative of a field: the attribute it reads, or without one the text of the element its steps reach. */
|
|
13
|
+
export type FieldPath = SelectorPath & {
|
|
14
|
+
readonly attribute?: NameTest;
|
|
21
15
|
};
|
|
22
16
|
export type IdentityConstraint = {
|
|
23
17
|
readonly kind: 'unique' | 'key' | 'keyref';
|
|
24
18
|
readonly name: string;
|
|
25
|
-
readonly
|
|
26
|
-
|
|
19
|
+
readonly namespace: string;
|
|
20
|
+
/** The key or unique a keyref refers to. */
|
|
21
|
+
readonly refer?: {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly namespace: string;
|
|
24
|
+
};
|
|
27
25
|
readonly selector: readonly SelectorPath[];
|
|
28
|
-
|
|
26
|
+
/** Each field is a union of paths. */
|
|
27
|
+
readonly fields: readonly (readonly FieldPath[])[];
|
|
29
28
|
};
|
|
29
|
+
/** The facets a restriction adds; ranges as the schema writes them, patterns one list per level (JS sources, `u`). */
|
|
30
30
|
export type Facets = {
|
|
31
31
|
readonly enumeration?: readonly string[];
|
|
32
|
-
|
|
32
|
+
/** Every level must match, one pattern of a level is enough. */
|
|
33
|
+
readonly pattern?: readonly (readonly string[])[];
|
|
34
|
+
readonly length?: number;
|
|
33
35
|
readonly minLength?: number;
|
|
34
36
|
readonly maxLength?: number;
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
-
readonly maxExclusive?: number | string;
|
|
37
|
+
readonly minInclusive?: string;
|
|
38
|
+
readonly maxInclusive?: string;
|
|
39
|
+
readonly minExclusive?: string;
|
|
40
|
+
readonly maxExclusive?: string;
|
|
40
41
|
readonly totalDigits?: number;
|
|
41
42
|
readonly fractionDigits?: number;
|
|
42
43
|
readonly whiteSpace?: 'preserve' | 'replace' | 'collapse';
|
|
@@ -57,28 +58,20 @@ export type AttributeDefinition = {
|
|
|
57
58
|
readonly default?: string;
|
|
58
59
|
readonly fixed?: string;
|
|
59
60
|
readonly namespace?: Namespace;
|
|
60
|
-
readonly facets?: Facets;
|
|
61
61
|
/** Absent for a plain string. */
|
|
62
62
|
readonly type?: DataType;
|
|
63
63
|
};
|
|
64
|
-
export type
|
|
65
|
-
|
|
66
|
-
readonly
|
|
67
|
-
readonly
|
|
68
|
-
readonly
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*/
|
|
76
|
-
readonly namespace?: Namespace;
|
|
77
|
-
readonly nillable?: true;
|
|
78
|
-
readonly attributes?: ElementDefinition['attributes'];
|
|
79
|
-
readonly children?: ElementDefinition['children'];
|
|
80
|
-
readonly contentModel?: Particle;
|
|
81
|
-
readonly textContent?: TextContent;
|
|
64
|
+
export type TextContent = {
|
|
65
|
+
/** Absent for untyped (mixed) text. */
|
|
66
|
+
readonly type?: DataType;
|
|
67
|
+
readonly default?: string;
|
|
68
|
+
readonly fixed?: string;
|
|
69
|
+
};
|
|
70
|
+
/** A wildcard: the namespaces it admits (`''` = none), or those it excludes, and how what it admits is checked. */
|
|
71
|
+
export type Wildcard = {
|
|
72
|
+
readonly namespace?: readonly string[];
|
|
73
|
+
readonly notNamespace?: readonly string[];
|
|
74
|
+
readonly processContents: 'strict' | 'lax' | 'skip';
|
|
82
75
|
};
|
|
83
76
|
/** One node of a content model as the schema wrote it. */
|
|
84
77
|
export type Particle = {
|
|
@@ -89,51 +82,70 @@ export type Particle = {
|
|
|
89
82
|
} | {
|
|
90
83
|
readonly kind: 'element';
|
|
91
84
|
readonly name: string;
|
|
85
|
+
/** Absent when the element is in its holder's namespace. */
|
|
86
|
+
readonly namespace?: string;
|
|
87
|
+
/** The declaration it holds, for a tag declared several ways. */
|
|
88
|
+
readonly declaration?: string;
|
|
92
89
|
readonly minOccurs?: number;
|
|
93
90
|
readonly maxOccurs?: number;
|
|
94
|
-
} | {
|
|
91
|
+
} | ({
|
|
95
92
|
readonly kind: 'any';
|
|
96
|
-
readonly namespace?: readonly string[];
|
|
97
|
-
readonly processContents?: string;
|
|
98
93
|
readonly minOccurs?: number;
|
|
99
94
|
readonly maxOccurs?: number;
|
|
95
|
+
} & Wildcard);
|
|
96
|
+
/** A child declared several ways: per namespace it is held in, the declarations its particles hold. */
|
|
97
|
+
export type ChildDefinition = {
|
|
98
|
+
readonly declarations: Readonly<Record<string, readonly string[]>>;
|
|
100
99
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
readonly type?: DataType;
|
|
104
|
-
readonly default?: string;
|
|
105
|
-
readonly fixed?: string;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* What an element is: the union of its declarations when a schema declares the tag differently
|
|
109
|
-
* under different parents. What it holds under one parent is on that parent's edge
|
|
110
|
-
* (`children.details[tag]`); `resolveDefinition` returns the definition in that context.
|
|
111
|
-
*/
|
|
112
|
-
export type ElementDefinition = {
|
|
113
|
-
readonly tag: string;
|
|
114
|
-
readonly namespace: Namespace;
|
|
115
|
-
readonly documentation?: string;
|
|
116
|
-
readonly parents: readonly string[];
|
|
117
|
-
readonly nillable?: true;
|
|
100
|
+
/** What an element, one of its declarations or a type lets an element hold. */
|
|
101
|
+
export type ContentDefinition = {
|
|
118
102
|
readonly attributes: {
|
|
119
103
|
readonly sequence: readonly string[];
|
|
120
|
-
readonly any?:
|
|
121
|
-
readonly
|
|
122
|
-
readonly details: Record<string, AttributeDefinition>;
|
|
104
|
+
readonly any?: Wildcard;
|
|
105
|
+
readonly details: Readonly<Record<string, AttributeDefinition>>;
|
|
123
106
|
readonly identityFields?: readonly string[];
|
|
124
107
|
};
|
|
125
108
|
readonly children: {
|
|
109
|
+
/** Every element it may hold, its variants' included. */
|
|
126
110
|
readonly sequence: readonly string[];
|
|
127
111
|
readonly any?: true;
|
|
128
|
-
|
|
112
|
+
/** Only the children declared several ways. */
|
|
113
|
+
readonly details: Readonly<Record<string, ChildDefinition>>;
|
|
129
114
|
};
|
|
130
115
|
readonly contentModel?: Particle;
|
|
131
|
-
readonly constraints?: readonly IdentityConstraint[];
|
|
132
116
|
readonly textContent?: TextContent;
|
|
133
117
|
};
|
|
118
|
+
/** One way a tag is declared, or the tag level of a tag declared one way. */
|
|
119
|
+
export type DeclarationDefinition = ContentDefinition & {
|
|
120
|
+
readonly namespace: Namespace;
|
|
121
|
+
readonly documentation?: string;
|
|
122
|
+
readonly global?: true;
|
|
123
|
+
readonly nillable?: true;
|
|
124
|
+
readonly constraints?: readonly IdentityConstraint[];
|
|
125
|
+
/** The declared type when it is named (Clark name): an instance may name it with xsi:type too. */
|
|
126
|
+
readonly type?: string;
|
|
127
|
+
/** The types an instance may name with xsi:type instead (Clark names, keys of the dialecte's `TYPES`). */
|
|
128
|
+
readonly variants?: readonly string[];
|
|
129
|
+
/** The declared type is abstract: an instance must name a variant. */
|
|
130
|
+
readonly abstractType?: true;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* What an element is: its declaration when the schema declares the tag one way; otherwise the union of its
|
|
134
|
+
* `declarations` (required, default, fixed, constraints, variants only where they all agree), each one under its
|
|
135
|
+
* number. `resolveDefinition` returns the one that applies to a record.
|
|
136
|
+
*/
|
|
137
|
+
export type ElementDefinition = DeclarationDefinition & {
|
|
138
|
+
readonly tag: string;
|
|
139
|
+
readonly parents: readonly string[];
|
|
140
|
+
readonly declarations?: Readonly<Record<string, DeclarationDefinition>>;
|
|
141
|
+
};
|
|
142
|
+
/** The definition that applies to one record: its declaration (and xsi:type), with what the tag says whatever it. */
|
|
143
|
+
export type ResolvedDefinition = Omit<ElementDefinition, 'declarations'>;
|
|
134
144
|
/**
|
|
135
145
|
* Complete definition — maps element names to their definitions.
|
|
136
146
|
* Each dialecte should define its own specific type extending this.
|
|
137
147
|
*/
|
|
138
148
|
export type AnyDefinition = Record<string, ElementDefinition>;
|
|
149
|
+
/** The types elements may take with xsi:type, by Clark name (`{uri}local`, bare `local` in no namespace). */
|
|
150
|
+
export type AnyTypes = Readonly<Record<string, ContentDefinition>>;
|
|
139
151
|
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/types/definition.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAI1C,
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/types/definition.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAI1C,oHAAoH;AACpH,MAAM,MAAM,QAAQ,GAAG;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,+GAA+G;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GAAG,qBAAqB,GAAG;IACvD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAA;CACvE,CAAA;AAED,qHAAqH;AACrH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAA;AAExE;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;AAE7D,6GAA6G;AAC7G,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyDefinition } from './definition';
|
|
1
|
+
import { AnyDefinition, AnyTypes } from './definition';
|
|
2
2
|
import { ImportOptions, ExportOptions, IOHooks } from './io';
|
|
3
3
|
import { Operation } from './operations';
|
|
4
4
|
import { Namespace, RawRecord, TreeRecord } from './records';
|
|
@@ -28,6 +28,8 @@ export type RawDialecteConfig<GenericElementNames extends readonly string[], Gen
|
|
|
28
28
|
database: DatabaseConfig;
|
|
29
29
|
io: IOConfig;
|
|
30
30
|
definition: AnyDefinition;
|
|
31
|
+
/** The types elements may take with xsi:type: the `TYPES` the generator writes beside `DEFINITION`. */
|
|
32
|
+
types: AnyTypes;
|
|
31
33
|
};
|
|
32
34
|
/**
|
|
33
35
|
* All lifecycle hooks a dialecte can provide, applied to every Document opened
|
|
@@ -227,10 +229,6 @@ type PrefixesUsedByElement<GenericConfig extends AnyDialecteConfig, GenericEleme
|
|
|
227
229
|
export type NamespaceKeysUsedByElement<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = {
|
|
228
230
|
[K in NamespaceKeysOf<GenericConfig>]: PrefixOfNamespaceKey<GenericConfig, K> extends PrefixesUsedByElement<GenericConfig, GenericElement> ? K : never;
|
|
229
231
|
}[NamespaceKeysOf<GenericConfig>];
|
|
230
|
-
/** Value object of an element's default-namespace (unprefixed) attributes only. */
|
|
231
|
-
export type DefaultAttributesValueObjectOf<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericParent extends ElementsOf<GenericConfig> = never> = {
|
|
232
|
-
[K in keyof AttributesValueObjectOf<GenericConfig, GenericElement, GenericParent> as K extends `${string}:${string}` ? never : K]: AttributesValueObjectOf<GenericConfig, GenericElement, GenericParent>[K];
|
|
233
|
-
};
|
|
234
232
|
/**
|
|
235
233
|
* Value object of an element's attributes within a given namespace key, re-keyed
|
|
236
234
|
* by **local** name (the prefix is stripped since the scope already fixes it).
|
|
@@ -240,7 +238,10 @@ export type NamespacedAttributesValueObjectOf<GenericConfig extends AnyDialecteC
|
|
|
240
238
|
};
|
|
241
239
|
/** Local attribute names available under a namespace key for an element. */
|
|
242
240
|
export type LocalAttributeNamesInNamespace<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericNamespaceKey extends NamespaceKeysOf<GenericConfig>> = keyof NamespacedAttributesValueObjectOf<GenericConfig, GenericElement, GenericNamespaceKey> & string;
|
|
243
|
-
/**
|
|
244
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Default-namespace (unprefixed) attribute names for an element - what the array form of a write names without a
|
|
243
|
+
* namespace; `xsi:type` and every other prefixed name are not.
|
|
244
|
+
*/
|
|
245
|
+
export type DefaultAttributeNamesOf<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericParent extends ElementsOf<GenericConfig> = never> = Exclude<AttributesOf<GenericConfig, GenericElement, GenericParent>, `${string}:${string}`>;
|
|
245
246
|
export {};
|
|
246
247
|
//# sourceMappingURL=dialecte-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialecte-config.d.ts","sourceRoot":"","sources":["../../src/types/dialecte-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"dialecte-config.d.ts","sourceRoot":"","sources":["../../src/types/dialecte-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,iBAAiB,CAC5B,mBAAmB,SAAS,SAAS,MAAM,EAAE,EAC7C,kBAAkB,SAAS,mBAAmB,CAAC,MAAM,CAAC,EACtD,iBAAiB,SAAS,eAAe,EACzC,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,EACzD,cAAc,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,EACxD,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,EAC5D,gBAAgB,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,IACvD;IACH,eAAe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AAC,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC,CAAA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AttributeDefaults, AttributeRules } from './attribute-rules.types';
|
|
2
|
-
import {
|
|
2
|
+
import { ResolvableRecord } from './resolve-definition.types';
|
|
3
|
+
import { AnyDialecteConfig } from '../types';
|
|
3
4
|
export type { AttributeDefaults, AttributeRules } from './attribute-rules.types';
|
|
4
5
|
export declare function getAttributeRules(params: {
|
|
5
6
|
dialecteConfig: AnyDialecteConfig;
|
|
6
7
|
/** The element and its parent: the rules are those of its definition there. */
|
|
7
|
-
record:
|
|
8
|
+
record: ResolvableRecord;
|
|
8
9
|
attributeName: string;
|
|
9
10
|
}): AttributeRules;
|
|
10
11
|
/**
|
|
@@ -15,7 +16,7 @@ export declare function getAttributeRules(params: {
|
|
|
15
16
|
*/
|
|
16
17
|
export declare function resolveSchemaAttributeValue(params: {
|
|
17
18
|
dialecteConfig: AnyDialecteConfig;
|
|
18
|
-
record:
|
|
19
|
+
record: ResolvableRecord;
|
|
19
20
|
attributeName: string;
|
|
20
21
|
defaults: AttributeDefaults;
|
|
21
22
|
}): string | undefined;
|
|
@@ -27,55 +28,10 @@ export declare function resolveSchemaAttributeValue(params: {
|
|
|
27
28
|
*/
|
|
28
29
|
export declare function isSchemaDefaultValue(params: {
|
|
29
30
|
dialecteConfig: AnyDialecteConfig;
|
|
30
|
-
record:
|
|
31
|
+
record: ResolvableRecord;
|
|
31
32
|
attributeName: string;
|
|
32
33
|
value: string;
|
|
33
34
|
}): boolean;
|
|
34
35
|
/** Local part of an attribute name — strips a namespace prefix if present (`a:b` → `b`). */
|
|
35
36
|
export declare function extractLocalName(name: string): string;
|
|
36
|
-
/**
|
|
37
|
-
* Resolve a namespace declared in the config by its prefix (e.g. `ext`,
|
|
38
|
-
* `dev`). Returns `undefined` for an empty prefix or an unknown one —
|
|
39
|
-
* consumers cannot extend `config.namespaces`, so an unknown prefix is a caller error.
|
|
40
|
-
*/
|
|
41
|
-
export declare function resolveNamespaceByPrefix(dialecteConfig: AnyDialecteConfig, prefix: string): Namespace | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Resolve a namespace *scope* string to its full `Namespace`. A scope is normally a
|
|
44
|
-
* `config.namespaces` key (e.g. `ext`, `dev`); as a fallback it is matched
|
|
45
|
-
* against declared prefixes. Returns `undefined` when the scope is neither a known
|
|
46
|
-
* key nor a known prefix — an authoring error, since a registered namespace must be
|
|
47
|
-
* referenced by key (use a full `{ prefix, uri }` object for custom namespaces).
|
|
48
|
-
*/
|
|
49
|
-
export declare function resolveNamespaceByScope(dialecteConfig: AnyDialecteConfig, scope: string): Namespace | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* Resolve the XML prefix to store attributes under for a namespace *scope*.
|
|
52
|
-
* The scope is normally a config namespace **key** (e.g. `ext`, `dev`), which we map
|
|
53
|
-
* to its declared prefix. If the scope is not a declared key it is treated as a raw
|
|
54
|
-
* prefix, so callers can still target custom namespaces the config is unaware of.
|
|
55
|
-
*/
|
|
56
|
-
export declare function resolvePrefixByNamespaceScope(dialecteConfig: AnyDialecteConfig, namespaceScope: string): string;
|
|
57
|
-
/**
|
|
58
|
-
* Stable, deterministic ordering for attributes that fall outside an element's
|
|
59
|
-
* schema `sequence` (extra namespaced attributes: `xmlns`/`xmlns:*` and
|
|
60
|
-
* foreign-namespace attributes). Sorted by namespace URI, then name, so two
|
|
61
|
-
* records carrying the same attribute set compare equal regardless of the order
|
|
62
|
-
* they were parsed, cloned, or updated in.
|
|
63
|
-
*/
|
|
64
|
-
export declare function compareQualifiedAttributes(a: {
|
|
65
|
-
name: string;
|
|
66
|
-
namespace?: Namespace;
|
|
67
|
-
}, b: {
|
|
68
|
-
name: string;
|
|
69
|
-
namespace?: Namespace;
|
|
70
|
-
}): number;
|
|
71
|
-
/**
|
|
72
|
-
* Put an element's attributes into canonical order: schema-sequence attributes
|
|
73
|
-
* first (in `sequence` order), then everything else sorted deterministically.
|
|
74
|
-
* Never drops attributes — reorders only — so it is safe to re-apply after an
|
|
75
|
-
* `afterStandardizedRecord` hook to normalize whatever the hook added or moved.
|
|
76
|
-
*/
|
|
77
|
-
export declare function orderAttributesBySequence<GenericAttribute extends {
|
|
78
|
-
name: string;
|
|
79
|
-
namespace?: Namespace;
|
|
80
|
-
}>(attributes: readonly GenericAttribute[], sequence: readonly string[]): GenericAttribute[];
|
|
81
37
|
//# sourceMappingURL=attribute-rules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribute-rules.d.ts","sourceRoot":"","sources":["../../src/utils/attribute-rules.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAChF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"attribute-rules.d.ts","sourceRoot":"","sources":["../../src/utils/attribute-rules.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAEhF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACzC,cAAc,EAAE,iBAAiB,CAAA;IACjC,+EAA+E;IAC/E,MAAM,EAAE,gBAAgB,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;CACrB,GAAG,cAAc,CAgBjB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE;IACnD,cAAc,EAAE,iBAAiB,CAAA;IACjC,MAAM,EAAE,gBAAgB,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,iBAAiB,CAAA;CAC3B,GAAG,MAAM,GAAG,SAAS,CAerB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC5C,cAAc,EAAE,iBAAiB,CAAA;IACjC,MAAM,EAAE,gBAAgB,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAKV;AAED,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGrD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DataType } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The values a datatype enumerates: its own enumeration, else those its union members enumerate - a member
|
|
4
|
+
* restricted by a pattern alone enumerates none. A qualified name's values are written `{uri}local`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function enumeratedValues(datatype: DataType | undefined): readonly string[];
|
|
7
|
+
/**
|
|
8
|
+
* The patterns of a datatype's own levels, each anchored to the whole value and compiled with the `u` flag the
|
|
9
|
+
* definition writes them for: a value must match every one (one pattern of a level is enough within it).
|
|
10
|
+
*/
|
|
11
|
+
export declare function valuePatterns(datatype: DataType | undefined): readonly RegExp[];
|
|
12
|
+
//# sourceMappingURL=datatype.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datatype.d.ts","sourceRoot":"","sources":["../../src/utils/datatype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,MAAM,EAAE,CAKlF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,MAAM,EAAE,CAI/E"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export * from './attribute-rules';
|
|
2
|
+
export * from './datatype';
|
|
2
3
|
export * from './format-xml';
|
|
3
4
|
export * from './invariant';
|
|
5
|
+
export * from './namespaces';
|
|
4
6
|
export * from './order-children';
|
|
5
7
|
export * from './save-to-disk';
|
|
6
8
|
export * from './resolve-definition';
|
|
9
|
+
export { canonicalXsiType, resolveXsiType } from './xsi-type';
|
|
10
|
+
export type { NamespaceLookup, XsiTypeName } from './xsi-type';
|
|
7
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC7D,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AnyDialecteConfig, Namespace } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a namespace declared in the config by its prefix (e.g. `ext`,
|
|
4
|
+
* `dev`). Returns `undefined` for an empty prefix or an unknown one —
|
|
5
|
+
* consumers cannot extend `config.namespaces`, so an unknown prefix is a caller error.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveNamespaceByPrefix(dialecteConfig: Pick<AnyDialecteConfig, 'namespaces'>, prefix: string): Namespace | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve a namespace *scope* string to its full `Namespace`. A scope is normally a
|
|
10
|
+
* `config.namespaces` key (e.g. `ext`, `dev`); as a fallback it is matched
|
|
11
|
+
* against declared prefixes. Returns `undefined` when the scope is neither a known
|
|
12
|
+
* key nor a known prefix — an authoring error, since a registered namespace must be
|
|
13
|
+
* referenced by key (use a full `{ prefix, uri }` object for custom namespaces).
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveNamespaceByScope(dialecteConfig: Pick<AnyDialecteConfig, 'namespaces'>, scope: string): Namespace | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the XML prefix to store attributes under for a namespace *scope*.
|
|
18
|
+
* The scope is normally a config namespace **key** (e.g. `ext`, `dev`), which we map
|
|
19
|
+
* to its declared prefix. If the scope is not a declared key it is treated as a raw
|
|
20
|
+
* prefix, so callers can still target custom namespaces the config is unaware of.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolvePrefixByNamespaceScope(dialecteConfig: Pick<AnyDialecteConfig, 'namespaces'>, namespaceScope: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Stable, deterministic ordering for attributes that fall outside an element's
|
|
25
|
+
* schema `sequence` (extra namespaced attributes: `xmlns`/`xmlns:*` and
|
|
26
|
+
* foreign-namespace attributes). Sorted by namespace URI, then name, so two
|
|
27
|
+
* records carrying the same attribute set compare equal regardless of the order
|
|
28
|
+
* they were parsed, cloned, or updated in.
|
|
29
|
+
*/
|
|
30
|
+
export declare function compareQualifiedAttributes(a: {
|
|
31
|
+
name: string;
|
|
32
|
+
namespace?: Namespace;
|
|
33
|
+
}, b: {
|
|
34
|
+
name: string;
|
|
35
|
+
namespace?: Namespace;
|
|
36
|
+
}): number;
|
|
37
|
+
/**
|
|
38
|
+
* Put an element's attributes into canonical order: schema-sequence attributes
|
|
39
|
+
* first (in `sequence` order), then everything else sorted deterministically.
|
|
40
|
+
* Never drops attributes — reorders only — so it is safe to re-apply after an
|
|
41
|
+
* `afterStandardizedRecord` hook to normalize whatever the hook added or moved.
|
|
42
|
+
*/
|
|
43
|
+
export declare function orderAttributesBySequence<GenericAttribute extends {
|
|
44
|
+
name: string;
|
|
45
|
+
namespace?: Namespace;
|
|
46
|
+
}>(attributes: readonly GenericAttribute[], sequence: readonly string[]): GenericAttribute[];
|
|
47
|
+
//# sourceMappingURL=namespaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespaces.d.ts","sourceRoot":"","sources":["../../src/utils/namespaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAE3D;;;;GAIG;AACH,wBAAgB,wBAAwB,CACvC,cAAc,EAAE,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,EACrD,MAAM,EAAE,MAAM,GACZ,SAAS,GAAG,SAAS,CAIvB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACtC,cAAc,EAAE,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,EACrD,KAAK,EAAE,MAAM,GACX,SAAS,GAAG,SAAS,CAGvB;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC5C,cAAc,EAAE,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,EACrD,cAAc,EAAE,MAAM,GACpB,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACzC,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAE,EAC1C,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAE,GACxC,MAAM,CAMR;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACxC,gBAAgB,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAE,EAC/D,UAAU,EAAE,SAAS,gBAAgB,EAAE,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAS1F"}
|
|
@@ -1,15 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ResolvableRecord } from './resolve-definition.types';
|
|
2
|
+
import { AnyDialecteConfig, DeclarationDefinition, ResolvedDefinition } from '../types';
|
|
3
|
+
export type { ResolvableRecord } from './resolve-definition.types';
|
|
4
|
+
/** What resolving reads of a dialecte: its definition, its types and its namespaces. */
|
|
5
|
+
type DefinitionConfig = Pick<AnyDialecteConfig, 'definition' | 'types' | 'namespaces'>;
|
|
2
6
|
/**
|
|
3
|
-
* The definition
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* The definition that applies to a record - the one rule every reader of the definition follows.
|
|
8
|
+
* A tag declared one way is its tag level. A tag declared several ways takes the declaration its
|
|
9
|
+
* parent holds in the record's namespace (the only namespace held there, for a record that has none
|
|
10
|
+
* yet); a parent whose wildcard admits it, or no parent, gives the global declaration of that
|
|
11
|
+
* namespace; a parent leaving it to the particle the record matches gives the tag level, the union,
|
|
12
|
+
* lenient where the declarations differ. The parent is read at its tag level unless the caller gives
|
|
13
|
+
* its resolved definition (`parentDefinition`, a top-down walk does). Then the record's `xsi:type`,
|
|
14
|
+
* when its declaration admits the type, gives what the type lets it hold.
|
|
15
|
+
* It takes a record, whose `parent` is always known (`null` for the root); a ref carries no parent,
|
|
16
|
+
* so a caller holding one uses `query.getDefinition(ref)`, which fetches the record first.
|
|
10
17
|
*/
|
|
11
18
|
export declare function resolveDefinition(params: {
|
|
12
|
-
dialecteConfig:
|
|
13
|
-
record:
|
|
14
|
-
|
|
19
|
+
dialecteConfig: DefinitionConfig;
|
|
20
|
+
record: ResolvableRecord;
|
|
21
|
+
parentDefinition?: DeclarationDefinition;
|
|
22
|
+
}): ResolvedDefinition | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The types the record may name with xsi:type (Clark names): its declared type when named and not abstract, and its
|
|
25
|
+
* variants; where its parent leaves the declaration open, those any declaration of the tag admits. The record's own
|
|
26
|
+
* xsi:type is not read.
|
|
27
|
+
*/
|
|
28
|
+
export declare function admittedXsiTypes(params: {
|
|
29
|
+
dialecteConfig: DefinitionConfig;
|
|
30
|
+
record: ResolvableRecord;
|
|
31
|
+
parentDefinition?: DeclarationDefinition;
|
|
32
|
+
}): readonly string[];
|
|
15
33
|
//# sourceMappingURL=resolve-definition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-definition.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-definition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-definition.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-definition.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,KAAK,EACX,iBAAiB,EAEjB,qBAAqB,EAErB,kBAAkB,EAClB,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAElE,wFAAwF;AACxF,KAAK,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,OAAO,GAAG,YAAY,CAAC,CAAA;AAEtF;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACzC,cAAc,EAAE,gBAAgB,CAAA;IAChC,MAAM,EAAE,gBAAgB,CAAA;IACxB,gBAAgB,CAAC,EAAE,qBAAqB,CAAA;CACxC,GAAG,kBAAkB,GAAG,SAAS,CAoBjC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACxC,cAAc,EAAE,gBAAgB,CAAA;IAChC,MAAM,EAAE,gBAAgB,CAAA;IACxB,gBAAgB,CAAC,EAAE,qBAAqB,CAAA;CACxC,GAAG,SAAS,MAAM,EAAE,CAcpB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AnyRawRecord, Namespace } from '../types';
|
|
2
|
+
/** What resolving a record's definition reads: its tag, parent, attributes (xsi:type, xmlns) and namespace, once known. */
|
|
3
|
+
export type ResolvableRecord = Pick<AnyRawRecord, 'tagName' | 'parent' | 'attributes'> & {
|
|
4
|
+
namespace?: Namespace;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=resolve-definition.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-definition.types.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-definition.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEtD,2HAA2H;AAC3H,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,QAAQ,GAAG,YAAY,CAAC,GAAG;IACxF,SAAS,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { NamespaceLookup, XsiTypeName } from './xsi-type.types';
|
|
2
|
+
import { AnyDialecteConfig, Namespace } from '../types';
|
|
3
|
+
export type { NamespaceLookup, XsiTypeName } from './xsi-type.types';
|
|
4
|
+
type NamespacesConfig = Pick<AnyDialecteConfig, 'namespaces'>;
|
|
5
|
+
type AttributeLike = {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly value: unknown;
|
|
8
|
+
readonly namespace?: Namespace;
|
|
9
|
+
};
|
|
10
|
+
/** Whether an attribute is xsi:type: `type` in the XSI namespace, whatever prefix the document gave it. */
|
|
11
|
+
export declare function isXsiTypeAttribute(attribute: AttributeLike): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The type a QName value names, read with `namespaceOf`: `prefix:local`, `local` (the default namespace, none when
|
|
14
|
+
* no default is bound) or a Clark name `{uri}local`. `undefined` when its prefix is bound nowhere.
|
|
15
|
+
*/
|
|
16
|
+
export declare function xsiTypeNameOf(params: {
|
|
17
|
+
value: string;
|
|
18
|
+
namespaceOf: NamespaceLookup;
|
|
19
|
+
}): XsiTypeName | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The type a record names with xsi:type, read as core stores it (`storedNamespaceLookup`); `undefined` without
|
|
22
|
+
* xsi:type or when its prefix is bound nowhere.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveXsiType(params: {
|
|
25
|
+
dialecteConfig: NamespacesConfig;
|
|
26
|
+
record: {
|
|
27
|
+
readonly attributes: readonly AttributeLike[];
|
|
28
|
+
};
|
|
29
|
+
}): XsiTypeName | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* How core reads a stored xsi:type value: unprefixed is the dialecte's default namespace, a dialecte prefix its
|
|
32
|
+
* namespace (the canonical form); another prefix is read where the record itself binds it (a value kept as written).
|
|
33
|
+
*/
|
|
34
|
+
export declare function storedNamespaceLookup(params: {
|
|
35
|
+
dialecteConfig: NamespacesConfig;
|
|
36
|
+
attributes: readonly AttributeLike[];
|
|
37
|
+
}): NamespaceLookup;
|
|
38
|
+
/**
|
|
39
|
+
* The form core stores an xsi:type value in: the local name for a type in the dialecte's default namespace, the
|
|
40
|
+
* dialecte's prefix and the local name for a type in another namespace it declares. A value whose prefix is bound
|
|
41
|
+
* nowhere, or naming a namespace the dialecte does not declare, is kept as written. The value keeps what XML says it
|
|
42
|
+
* means: only the prefix it is written with changes.
|
|
43
|
+
*/
|
|
44
|
+
export declare function canonicalXsiType(params: {
|
|
45
|
+
dialecteConfig: NamespacesConfig;
|
|
46
|
+
value: string;
|
|
47
|
+
namespaceOf: NamespaceLookup;
|
|
48
|
+
}): string;
|
|
49
|
+
/** The attributes with the xsi:type value, if any, in the form core stores (`canonicalXsiType`). */
|
|
50
|
+
export declare function withCanonicalXsiType<GenericAttribute extends AttributeLike>(params: {
|
|
51
|
+
dialecteConfig: NamespacesConfig;
|
|
52
|
+
attributes: readonly GenericAttribute[];
|
|
53
|
+
namespaceOf: NamespaceLookup;
|
|
54
|
+
}): GenericAttribute[];
|
|
55
|
+
//# sourceMappingURL=xsi-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xsi-type.d.ts","sourceRoot":"","sources":["../../src/utils/xsi-type.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAE3D,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEpE,KAAK,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAA;AAC7D,KAAK,aAAa,GAAG;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAC9B,CAAA;AAED,2GAA2G;AAC3G,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,aAAa,GAAG,OAAO,CAIpE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,eAAe,CAAA;CAC5B,GAAG,WAAW,GAAG,SAAS,CAe1B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACtC,cAAc,EAAE,gBAAgB,CAAA;IAChC,MAAM,EAAE;QAAE,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAA;KAAE,CAAA;CACzD,GAAG,WAAW,GAAG,SAAS,CAM1B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;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