@dialecte/core 0.4.2 → 0.4.5
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/bind-extensions.d.ts +5 -1
- package/dist/document/bind-extensions.d.ts.map +1 -1
- package/dist/document/query/any/any-query.d.ts +9 -0
- package/dist/document/query/any/any-query.d.ts.map +1 -1
- package/dist/document/query/get/attribute/get-attribute.d.ts +19 -10
- package/dist/document/query/get/attribute/get-attribute.d.ts.map +1 -1
- package/dist/document/query/get/attribute/get-attributes.d.ts +21 -7
- package/dist/document/query/get/attribute/get-attributes.d.ts.map +1 -1
- package/dist/document/query/main.d.ts +51 -11
- package/dist/document/query/main.d.ts.map +1 -1
- package/dist/document/query/snapshot/snapshot.types.d.ts +7 -0
- package/dist/document/query/snapshot/snapshot.types.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 +32 -2
- 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/document/types.extensions.d.ts +23 -8
- package/dist/document/types.extensions.d.ts.map +1 -1
- package/dist/errors/codes.d.ts +8 -0
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/helpers/assert-fixed.d.ts +14 -0
- package/dist/helpers/assert-fixed.d.ts.map +1 -0
- package/dist/helpers/converter.d.ts +2 -2
- 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 +2 -2
- package/dist/helpers/standardizing.d.ts.map +1 -1
- package/dist/helpers.js +105 -84
- package/dist/index.js +3 -3
- package/dist/project/project.d.ts +24 -0
- package/dist/project/project.d.ts.map +1 -1
- package/dist/{project-E32sEthh.js → project-wohrish5.js} +1444 -1239
- package/dist/store/in-memory/in-memory-store.d.ts +10 -0
- package/dist/store/in-memory/in-memory-store.d.ts.map +1 -1
- package/dist/store/local/dexie-store.d.ts +38 -0
- package/dist/store/local/dexie-store.d.ts.map +1 -1
- package/dist/store/store.types.d.ts +17 -0
- package/dist/store/store.types.d.ts.map +1 -1
- package/dist/test.js +1 -1
- package/dist/types/dialecte-config.d.ts +70 -20
- package/dist/types/dialecte-config.d.ts.map +1 -1
- package/dist/utils/attribute-rules.d.ts +43 -27
- package/dist/utils/attribute-rules.d.ts.map +1 -1
- package/dist/utils/attribute-rules.types.d.ts +41 -0
- package/dist/utils/attribute-rules.types.d.ts.map +1 -0
- package/dist/{utils-DgKwrT2n.js → utils-C5_11hqg.js} +42 -8
- package/dist/utils.js +2 -2
- package/dist/xml/build/build-xml-document.d.ts.map +1 -1
- package/dist/xml/build/build-xml-document.types.d.ts +8 -0
- package/dist/xml/build/build-xml-document.types.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -4,7 +4,11 @@ import { BoundExtensionMap, ExtensionMap, QueryExtensionFn, TransactionExtension
|
|
|
4
4
|
* Each function in the map gets `instance` prepended as its first argument,
|
|
5
5
|
* so the public API signature has that argument stripped.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Groups may be nested to arbitrary depth: a value is either an extension
|
|
8
|
+
* function (a leaf, bound to the instance) or a nested group (recursed into).
|
|
9
|
+
* So `{ a: { aa: { getItems } } }` yields `instance.a.aa.getItems`.
|
|
10
|
+
*
|
|
11
|
+
* Returns an object mirroring the map's shape with each function bound.
|
|
8
12
|
*/
|
|
9
13
|
export declare function bindExtensions<GenericExtensionsMap extends ExtensionMap<QueryExtensionFn | TransactionExtensionFn>>(extensionMap: GenericExtensionsMap | undefined, instance: unknown): BoundExtensionMap<GenericExtensionsMap>;
|
|
10
14
|
//# sourceMappingURL=bind-extensions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bind-extensions.d.ts","sourceRoot":"","sources":["../../src/document/bind-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,MAAM,oBAAoB,CAAA;AAE3B
|
|
1
|
+
{"version":3,"file":"bind-extensions.d.ts","sourceRoot":"","sources":["../../src/document/bind-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,MAAM,oBAAoB,CAAA;AAE3B;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC7B,oBAAoB,SAAS,YAAY,CAAC,gBAAgB,GAAG,sBAAsB,CAAC,EAEpF,YAAY,EAAE,oBAAoB,GAAG,SAAS,EAC9C,QAAQ,EAAE,OAAO,GACf,iBAAiB,CAAC,oBAAoB,CAAC,CAIzC"}
|
|
@@ -3,6 +3,7 @@ import { GetTreeParams } from '../get';
|
|
|
3
3
|
import { GetSnapshotOptions, SnapshotResult } from '../snapshot';
|
|
4
4
|
import { AnyRef, AnyRefOrRecord } from '../..';
|
|
5
5
|
import { AnyAttribute, AnyDialecteConfig, AnyTrackedRecord, AnyTreeRecord, ElementsOf } from '../../../types';
|
|
6
|
+
import { AttributeDefaults } from '../../../utils';
|
|
6
7
|
/**
|
|
7
8
|
* Untyped query namespace - bypasses ElementsOf/ChildrenOf constraints.
|
|
8
9
|
* Use for custom/private elements or dynamic contexts where the type system is a burden.
|
|
@@ -20,17 +21,25 @@ export declare class AnyQuery<GenericConfig extends AnyDialecteConfig> {
|
|
|
20
21
|
getRecordsByTagName(tagName: string): Promise<AnyTrackedRecord[]>;
|
|
21
22
|
getAttribute(refOrRecord: AnyRefOrRecord | undefined, params: {
|
|
22
23
|
name: string;
|
|
24
|
+
namespace?: string;
|
|
23
25
|
fullObject?: false;
|
|
26
|
+
defaults?: AttributeDefaults;
|
|
24
27
|
}): Promise<string>;
|
|
25
28
|
getAttribute(refOrRecord: AnyRefOrRecord | undefined, params: {
|
|
26
29
|
name: string;
|
|
30
|
+
namespace?: string;
|
|
27
31
|
fullObject: true;
|
|
32
|
+
defaults?: AttributeDefaults;
|
|
28
33
|
}): Promise<AnyAttribute | undefined>;
|
|
29
34
|
getAttributes(refOrRecord: AnyRefOrRecord | undefined, params?: {
|
|
35
|
+
namespace?: string;
|
|
30
36
|
fullObject?: false;
|
|
37
|
+
defaults?: AttributeDefaults;
|
|
31
38
|
}): Promise<Record<string, string>>;
|
|
32
39
|
getAttributes(refOrRecord: AnyRefOrRecord | undefined, params: {
|
|
40
|
+
namespace?: string;
|
|
33
41
|
fullObject: true;
|
|
42
|
+
defaults?: AttributeDefaults;
|
|
34
43
|
}): Promise<AnyAttribute[]>;
|
|
35
44
|
getTree(refOrRecord: AnyRefOrRecord | undefined, options?: GetTreeParams<AnyDialecteConfig, ElementsOf<AnyDialecteConfig>>): Promise<AnyTreeRecord | undefined>;
|
|
36
45
|
getSnapshot(options?: GetSnapshotOptions<AnyDialecteConfig> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any-query.d.ts","sourceRoot":"","sources":["../../../../src/document/query/any/any-query.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAyB,MAAM,YAAY,CAAA;AAC/E,OAAO,KAAK,EACX,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"any-query.d.ts","sourceRoot":"","sources":["../../../../src/document/query/any/any-query.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAC3C,OA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BAAiB,CAAC,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAC7D,OAAO,CAAC,cAAc,CAAC;IAUpB,eAAe,CACpB,WAAW,EAAE,cAAc,GAAG,SAAS,GACrC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAUxC,aAAa,CAAC,WAAW,EAAE,cAAc,GAAG,SAAS,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAQnF,gBAAgB,CAAC,MAAM,EAAE;QAC9B,OAAO,EAAE,MAAM,CAAA;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;KAC7C,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAO/B"}
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { Context, Ref } from '../../..';
|
|
2
|
-
import { AnyDialecteConfig,
|
|
2
|
+
import { AnyDialecteConfig, ElementsOf, FullAttributeObjectOf } from '../../../../types';
|
|
3
|
+
import { AttributeDefaults } from '../../../../utils';
|
|
3
4
|
/**
|
|
4
5
|
* Fetch a single attribute for the given ref.
|
|
5
6
|
*
|
|
6
|
-
* Resolves the record via context (staged → cache → store),
|
|
7
|
-
*
|
|
7
|
+
* Resolves the record via context (staged → cache → store), then extracts the named
|
|
8
|
+
* attribute. Pass `namespace` to scope by a namespace key (a local `name` is resolved
|
|
9
|
+
* to the stored `prefix:local` key). `defaults` (default `'optional'`) controls the
|
|
10
|
+
* fallback for an absent attribute: `'none'` → `''`; `'optional'` → `fixed` /
|
|
11
|
+
* non-empty `default` (else `''`); `'required'` → required/fixed materialized value.
|
|
8
12
|
*
|
|
9
13
|
* @example
|
|
10
|
-
* getAttribute({ context, ref, name: '
|
|
14
|
+
* getAttribute({ context, ref, name: 'aA' }) // → string | ''
|
|
15
|
+
* getAttribute({ context, ref, name: 'cA', namespace: 'ext' }) // → ext:cA value
|
|
11
16
|
*/
|
|
12
17
|
export declare function getAttribute<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericAttribute extends FullAttributeObjectOf<GenericConfig, GenericElement>>(params: {
|
|
13
18
|
context: Context<GenericConfig>;
|
|
14
19
|
ref: Ref<GenericConfig, GenericElement>;
|
|
15
|
-
name:
|
|
20
|
+
name: string;
|
|
21
|
+
namespace?: string;
|
|
22
|
+
defaults?: AttributeDefaults;
|
|
16
23
|
}): Promise<GenericAttribute['value'] | ''>;
|
|
17
24
|
/**
|
|
18
|
-
* Fetch a single attribute for the given ref
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
25
|
+
* Fetch a single attribute for the given ref as a full object (name + value +
|
|
26
|
+
* namespace). `defaults` (default `'optional'`) fills an absent schema attribute by
|
|
27
|
+
* synthesizing its object; `'none'` returns `undefined` when the attribute is not
|
|
28
|
+
* stored.
|
|
22
29
|
*
|
|
23
30
|
* @example
|
|
24
31
|
* getAttribute({ context, ref, name: 'name', fullObject: true }) // → FullAttributeObject | undefined
|
|
@@ -26,6 +33,8 @@ export declare function getAttribute<GenericConfig extends AnyDialecteConfig, Ge
|
|
|
26
33
|
export declare function getAttributeFullObject<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericAttribute extends FullAttributeObjectOf<GenericConfig, GenericElement>>(params: {
|
|
27
34
|
context: Context<GenericConfig>;
|
|
28
35
|
ref: Ref<GenericConfig, GenericElement>;
|
|
29
|
-
name:
|
|
36
|
+
name: string;
|
|
37
|
+
namespace?: string;
|
|
38
|
+
defaults?: AttributeDefaults;
|
|
30
39
|
}): Promise<GenericAttribute | undefined>;
|
|
31
40
|
//# sourceMappingURL=get-attribute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-attribute.d.ts","sourceRoot":"","sources":["../../../../../src/document/query/get/attribute/get-attribute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-attribute.d.ts","sourceRo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 @@
|
|
|
1
1
|
import { Context, Ref } from '../../..';
|
|
2
2
|
import { AnyDialecteConfig, AttributesValueObjectOf, ElementsOf, FullAttributeObjectOf } from '../../../../types';
|
|
3
|
+
import { AttributeDefaults } from '../../../../utils';
|
|
3
4
|
/**
|
|
4
|
-
* Fetch
|
|
5
|
+
* Fetch attributes for the given ref as a destructurable value object, scoped to a
|
|
6
|
+
* single namespace and re-keyed by **local** name.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
+
* Without `namespace`, only default-namespace (unprefixed) attributes are returned.
|
|
9
|
+
* With a `namespace` key, only that namespace's attributes are returned, with the
|
|
10
|
+
* prefix stripped from the keys (`ext:cA` → `cA`). `xmlns` declarations are
|
|
11
|
+
* always excluded.
|
|
12
|
+
*
|
|
13
|
+
* `defaults` (default `'optional'`) controls how absent schema attributes are filled:
|
|
14
|
+
* `'none'` = stored only; `'optional'` = read view (fixed / non-empty default);
|
|
15
|
+
* `'required'` = XSD/export view (required as `''` + fixed). Stored values always win.
|
|
8
16
|
*
|
|
9
17
|
* @example
|
|
10
|
-
* getAttributes({ context, ref })
|
|
18
|
+
* getAttributes({ context, ref }) // → { aA: '', bA: '', ... }
|
|
19
|
+
* getAttributes({ context, ref, namespace: 'ext' }) // → { cA: '...' }
|
|
11
20
|
*/
|
|
12
21
|
export declare function getAttributes<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericAttribute extends FullAttributeObjectOf<GenericConfig, GenericElement>>(params: {
|
|
13
22
|
context: Context<GenericConfig>;
|
|
14
23
|
ref: Ref<GenericConfig, GenericElement>;
|
|
24
|
+
namespace?: string;
|
|
25
|
+
defaults?: AttributeDefaults;
|
|
15
26
|
}): Promise<AttributesValueObjectOf<GenericConfig, GenericElement>>;
|
|
16
27
|
/**
|
|
17
|
-
* Fetch all attributes
|
|
28
|
+
* Fetch all attributes of a record as a full array (name + value + namespace).
|
|
18
29
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
30
|
+
* `defaults` (default `'optional'`) fills absent schema attributes just like
|
|
31
|
+
* {@link getAttributes}: `'none'` returns the faithful stored-only set;
|
|
32
|
+
* `'optional'`/`'required'` synthesize missing schema attributes (with their
|
|
33
|
+
* schema-derived namespace).
|
|
21
34
|
*
|
|
22
35
|
* @example
|
|
23
36
|
* getAttributes({ context, ref, fullObject: true }) // → FullAttributeObject[]
|
|
@@ -25,5 +38,6 @@ export declare function getAttributes<GenericConfig extends AnyDialecteConfig, G
|
|
|
25
38
|
export declare function getAttributesFullObject<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericAttribute extends FullAttributeObjectOf<GenericConfig, GenericElement>>(params: {
|
|
26
39
|
context: Context<GenericConfig>;
|
|
27
40
|
ref: Ref<GenericConfig, GenericElement>;
|
|
41
|
+
defaults?: AttributeDefaults;
|
|
28
42
|
}): Promise<GenericAttribute[]>;
|
|
29
43
|
//# sourceMappingURL=get-attributes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-attributes.d.ts","sourceRoot":"","sources":["../../../../../src/document/query/get/attribute/get-attributes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-attributes.d.ts","sourceRoot":"","sources":["../../../../../src/document/query/get/attribute/get-attributes.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EACX,iBAAiB,EACjB,uBAAuB,EACvB,UAAU,EACV,qBAAqB,EACrB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAAsB,aAAa,CAClC,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAChD,gBAAgB,SAAS,qBAAqB,CAAC,aAAa,EAAE,cAAc,CAAC,EAC5E,MAAM,EAAE;IACT,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,GAAG,EAAE,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC5B,GAAG,OAAO,CAAC,uBAAuB,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAqClE;AAED;;;;;;;;;;GAUG;AAEH,wBAAsB,uBAAuB,CAC5C,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAChD,gBAAgB,SAAS,qBAAqB,CAAC,aAAa,EAAE,cAAc,CAAC,EAC5E,MAAM,EAAE;IACT,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,GAAG,EAAE,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IACvC,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC5B,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA4B9B"}
|
|
@@ -4,8 +4,10 @@ import { FindAncestorsOptions, FilterAttributes, Collect, FindDescendantsParams,
|
|
|
4
4
|
import { GetTreeParams } from './get';
|
|
5
5
|
import { GetSnapshotOptions, SnapshotResult } from './snapshot';
|
|
6
6
|
import { RefOrRecord } from '..';
|
|
7
|
+
import { DocumentRecord } from '../../project';
|
|
7
8
|
import { Store } from '../../store';
|
|
8
|
-
import { AnyDialecteConfig, AnyTreeRecord, AttributesOf,
|
|
9
|
+
import { AnyDialecteConfig, AnyTreeRecord, AttributesOf, DefaultAttributesValueObjectOf, DescendantsOf, ElementsOf, ChildrenOf, FullAttributeObjectOf, NamespacedAttributesValueObjectOf, NamespaceKeysUsedByElement, TrackedRecord, TreeRecord, Operation, RootElementOf } from '../../types';
|
|
10
|
+
import { AttributeDefaults } from '../../utils';
|
|
9
11
|
/**
|
|
10
12
|
* Query — query-only access to a dialecte's store.
|
|
11
13
|
*
|
|
@@ -34,15 +36,17 @@ export declare class Query<GenericConfig extends AnyDialecteConfig> {
|
|
|
34
36
|
*/
|
|
35
37
|
protected get context(): Context<GenericConfig>;
|
|
36
38
|
/**
|
|
37
|
-
* Get the
|
|
38
|
-
*
|
|
39
|
+
* Get the full metadata record of this document.
|
|
40
|
+
*
|
|
41
|
+
* @returns The document record: `id`, `name`, `extension`, `configKey`,
|
|
42
|
+
* `createdAt`, and optional `metadata`.
|
|
39
43
|
*
|
|
40
44
|
* @example
|
|
41
45
|
* ```ts
|
|
42
|
-
* const
|
|
46
|
+
* const { name, extension } = await query.getDocumentInfo()
|
|
43
47
|
* ```
|
|
44
48
|
*/
|
|
45
|
-
|
|
49
|
+
getDocumentInfo(): Promise<DocumentRecord>;
|
|
46
50
|
/**
|
|
47
51
|
* Get the root element of the document.
|
|
48
52
|
*
|
|
@@ -186,27 +190,34 @@ export declare class Query<GenericConfig extends AnyDialecteConfig> {
|
|
|
186
190
|
* Get a single attribute value from a record.
|
|
187
191
|
*
|
|
188
192
|
* @param refOrRecord - The element to read from.
|
|
189
|
-
* @param params - Attribute name.
|
|
193
|
+
* @param params - Attribute `name` and an optional `namespace` scope. Without a
|
|
194
|
+
* scope, `name` is a canonical attribute name; with a `namespace` key, `name`
|
|
195
|
+
* is the local name within that namespace (`{ name: 'cA', namespace: 'ext' }`).
|
|
190
196
|
* @returns The attribute value, or `''` if absent.
|
|
191
197
|
*
|
|
192
198
|
* @example
|
|
193
199
|
* ```ts
|
|
194
200
|
* const val = await query.getAttribute(a, { name: 'aA' })
|
|
201
|
+
* const cA = await query.getAttribute(a, { name: 'cA', namespace: 'ext' })
|
|
195
202
|
* ```
|
|
196
203
|
*/
|
|
197
204
|
getAttribute<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: {
|
|
198
|
-
name: AttributesOf<GenericConfig, GenericElement
|
|
205
|
+
name: AttributesOf<GenericConfig, GenericElement> | (string & {});
|
|
206
|
+
namespace?: NamespaceKeysUsedByElement<GenericConfig, GenericElement> | (string & {});
|
|
199
207
|
fullObject?: false;
|
|
208
|
+
defaults?: AttributeDefaults;
|
|
200
209
|
}): Promise<FullAttributeObjectOf<GenericConfig, GenericElement>['value'] | ''>;
|
|
201
210
|
getAttribute<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: {
|
|
202
|
-
name: AttributesOf<GenericConfig, GenericElement
|
|
211
|
+
name: AttributesOf<GenericConfig, GenericElement> | (string & {});
|
|
212
|
+
namespace?: NamespaceKeysUsedByElement<GenericConfig, GenericElement> | (string & {});
|
|
203
213
|
fullObject: true;
|
|
214
|
+
defaults?: AttributeDefaults;
|
|
204
215
|
}): Promise<FullAttributeObjectOf<GenericConfig, GenericElement> | undefined>;
|
|
205
216
|
/**
|
|
206
|
-
* Get
|
|
217
|
+
* Get a record's default-namespace attributes as a destructurable value object.
|
|
207
218
|
*
|
|
208
219
|
* @param refOrRecord - The element to read from.
|
|
209
|
-
* @returns A `{
|
|
220
|
+
* @returns A `{ aA, bA, ... }` object of the unprefixed attributes.
|
|
210
221
|
*
|
|
211
222
|
* @example
|
|
212
223
|
* ```ts
|
|
@@ -214,8 +225,36 @@ export declare class Query<GenericConfig extends AnyDialecteConfig> {
|
|
|
214
225
|
* ```
|
|
215
226
|
*/
|
|
216
227
|
getAttributes<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params?: {
|
|
228
|
+
namespace?: undefined;
|
|
229
|
+
fullObject?: false;
|
|
230
|
+
defaults?: AttributeDefaults;
|
|
231
|
+
}): Promise<DefaultAttributesValueObjectOf<GenericConfig, GenericElement>>;
|
|
232
|
+
/**
|
|
233
|
+
* Get a record's attributes for a namespace scope, keyed by **local** name.
|
|
234
|
+
*
|
|
235
|
+
* @param refOrRecord - The element to read from.
|
|
236
|
+
* @param params - A `namespace` key (e.g. `'ext'`) whose attributes to return.
|
|
237
|
+
* @returns A `{ cA: '...' }` object with the namespace prefix stripped.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```ts
|
|
241
|
+
* const { cA } = await query.getAttributes(a, { namespace: 'ext' })
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
getAttributes<GenericElement extends ElementsOf<GenericConfig>, GenericNamespaceKey extends NamespaceKeysUsedByElement<GenericConfig, GenericElement>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: {
|
|
245
|
+
namespace: GenericNamespaceKey;
|
|
246
|
+
fullObject?: false;
|
|
247
|
+
defaults?: AttributeDefaults;
|
|
248
|
+
}): Promise<NamespacedAttributesValueObjectOf<GenericConfig, GenericElement, GenericNamespaceKey>>;
|
|
249
|
+
/**
|
|
250
|
+
* Get a record's attributes for a custom namespace scope not declared in the
|
|
251
|
+
* config, keyed by local name.
|
|
252
|
+
*/
|
|
253
|
+
getAttributes<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: {
|
|
254
|
+
namespace: string;
|
|
217
255
|
fullObject?: false;
|
|
218
|
-
|
|
256
|
+
defaults?: AttributeDefaults;
|
|
257
|
+
}): Promise<Record<string, string>>;
|
|
219
258
|
/**
|
|
220
259
|
* Get all attributes of a record as an array of full attribute objects.
|
|
221
260
|
*
|
|
@@ -229,6 +268,7 @@ export declare class Query<GenericConfig extends AnyDialecteConfig> {
|
|
|
229
268
|
*/
|
|
230
269
|
getAttributes<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: {
|
|
231
270
|
fullObject: true;
|
|
271
|
+
defaults?: AttributeDefaults;
|
|
232
272
|
}): Promise<FullAttributeObjectOf<GenericConfig, GenericElement>[]>;
|
|
233
273
|
/**
|
|
234
274
|
* Find records matching specific attribute values.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/document/query/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAehC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,KAAK,EACX,oBAAoB,EACpB,gBAAgB,EAChB,OAAO,EACP,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACpE,OAAO,KAAK,EAAO,WAAW,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,KAAK,EACX,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/document/query/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAehC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,KAAK,EACX,oBAAoB,EACpB,gBAAgB,EAChB,OAAO,EACP,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACpE,OAAO,KAAK,EAAO,WAAW,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,KAAK,EACX,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,8BAA8B,EAC9B,aAAa,E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E,MAAM,EAAE;QAAE,UAAU,EAAE,IAAI,CAAC;QAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAA;KAAE,GACxD,OAAO,CAAC,qBAAqB,CAAC,aAAa,EAAE,cAAc,CAAC,EAAE,CAAC;IAclE;;;;;;;;;;;;;OAaG;IACG,gBAAgB,CAAC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE;QAChF,OAAO,EAAE,cAAc,CAAA;QACvB,UAAU,EAAE,gBAAgB,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;KAC3D,GAAG,OAAO,CAAC,aAAa,CAAC,aAAa,EAAE,cAAc,CAAC,EAAE,CAAC;CAG3D"}
|
|
@@ -35,6 +35,13 @@ export type GetSnapshotOptions<GenericConfig extends AnyDialecteConfig, GenericE
|
|
|
35
35
|
omit?: OmitEntry<GenericConfig>[];
|
|
36
36
|
unwrap?: ElementsOf<GenericConfig>[];
|
|
37
37
|
as?: SnapshotFormat;
|
|
38
|
+
/**
|
|
39
|
+
* For `as: 'xml'` / `'both'`: emit namespace declarations (`xmlns` / `xmlns:*`).
|
|
40
|
+
* Defaults to `true`. Set `false` to render a bare fragment (literal, possibly
|
|
41
|
+
* prefixed tag names, no namespace declarations) that reads like an excerpt
|
|
42
|
+
* nested in its file rather than a standalone document.
|
|
43
|
+
*/
|
|
44
|
+
declareNamespaces?: boolean;
|
|
38
45
|
};
|
|
39
46
|
export type SnapshotResult = {
|
|
40
47
|
tree: AnyTreeRecord;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.types.d.ts","sourceRoot":"","sources":["../../../../src/document/query/snapshot/snapshot.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAA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,CAAC,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,GAAG;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC,EAAE,CAAA;IACjC,MAAM,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,EAAE,CAAA;IACpC,EAAE,CAAC,EAAE,cAAc,CAAA;IACnB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,aAAa,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,gEAAgE;AAChE,MAAM,MAAM,iBAAiB,GAAG;IAC/B,+EAA+E;IAC/E,WAAW,EAAE,gBAAgB,EAAE,CAAA;IAC/B,wEAAwE;IACxE,cAAc,EAAE,gBAAgB,EAAE,CAAA;IAClC,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAA;CACd,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/document/transaction/create/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/document/transaction/create/create.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,gBAAgB,CAAA;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,KAAK,EACX,iBAAiB,EAGjB,UAAU,EACV,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,MAAM,SAAS,CAAA;AAEhB;;;GAGG;AACH,wBAAsB,aAAa,CAClC,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAChD,mBAAmB,SAAS,UAAU,CAAC,aAAa,EAAE,cAAc,CAAC,EACpE,MAAM,EAAE;IACT,cAAc,EAAE,aAAa,CAAA;IAC7B,KAAK,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAA;IACvC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAA;IAC3B,SAAS,EAAE,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IAC7C,MAAM,EAAE,cAAc,CAAC,aAAa,EAAE,cAAc,EAAE,mBAAmB,CAAC,CAAA;CAC1E,GAAG,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAoEzD"}
|
|
@@ -1,5 +1,35 @@
|
|
|
1
|
-
import { AnyDialecteConfig, ElementsOf, ChildrenOf, Namespace, AttributesValueObjectOf,
|
|
2
|
-
|
|
1
|
+
import { AnyDialecteConfig, ElementsOf, ChildrenOf, Namespace, AttributesValueObjectOf, DefaultAttributeNamesOf, DefaultAttributesValueObjectOf, LocalAttributeNamesInNamespace, NamespaceKeysUsedByElement } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* A single authored attribute in the full-object form. Namespaced attributes —
|
|
4
|
+
* registered or not — are all authored the same way: a **local** `name` plus a
|
|
5
|
+
* `namespace`, and dialecte derives the stored `prefix:local` key. The `namespace`
|
|
6
|
+
* is either a registered namespace **key** (e.g. `'ext'`, which also scopes `name`
|
|
7
|
+
* IntelliSense to that namespace's local attributes) or a full `{ prefix, uri }`
|
|
8
|
+
* object for custom/foreign namespaces. Omit `namespace` for default-namespace
|
|
9
|
+
* (standard) attributes. A prefixed `name` is rejected at runtime
|
|
10
|
+
* (see `assertAuthoredAttributeNamesAreLocal`).
|
|
11
|
+
*/
|
|
12
|
+
export type AuthoredAttributeObjectOf<GenericConfig extends AnyDialecteConfig, GenericChildElement extends ElementsOf<GenericConfig>> = {
|
|
13
|
+
name: DefaultAttributeNamesOf<GenericConfig, GenericChildElement> | (string & {});
|
|
14
|
+
value: string;
|
|
15
|
+
namespace?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
[GenericNamespaceKey in NamespaceKeysUsedByElement<GenericConfig, GenericChildElement>]: {
|
|
18
|
+
name: LocalAttributeNamesInNamespace<GenericConfig, GenericChildElement, GenericNamespaceKey> | (string & {});
|
|
19
|
+
value: string;
|
|
20
|
+
namespace: GenericNamespaceKey;
|
|
21
|
+
};
|
|
22
|
+
}[NamespaceKeysUsedByElement<GenericConfig, GenericChildElement>] | {
|
|
23
|
+
name: string;
|
|
24
|
+
value: string;
|
|
25
|
+
namespace: Namespace;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Attributes accepted by `addChild`. The less-verbose value-object form is reserved
|
|
29
|
+
* for **default-namespace (standard) attributes**; any namespaced attribute is
|
|
30
|
+
* authored via the full-object array form (see `AuthoredAttributeObjectOf`).
|
|
31
|
+
*/
|
|
32
|
+
export type ChildAttributesOf<GenericConfig extends AnyDialecteConfig, GenericChildElement extends ElementsOf<GenericConfig>> = DefaultAttributesValueObjectOf<GenericConfig, GenericChildElement> | AuthoredAttributeObjectOf<GenericConfig, GenericChildElement>[];
|
|
3
33
|
/**
|
|
4
34
|
* `attributes` is optional when the child element has no required attributes
|
|
5
35
|
* and required as soon as it declares at least one required attribute.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.types.d.ts","sourceRoot":"","sources":["../../../../src/document/transaction/create/create.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"create.types.d.ts","sourceRoot":"","sources":["../../../../src/document/transaction/create/create.types.ts"],"names":[],"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,KAAK,CAAC,aAAa,CAAC,CAAA;IAC3B,GAAG,EAAE,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IACvC,MAAM,EAAE,YAAY,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;CACnD,GAAG,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/document/transaction/update/update.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,KAAK,EACX,iBAAiB,EAGjB,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,MAAM,SAAS,CAAA;AAEhB;;;;GAIG;AACH,wBAAsB,WAAW,CAChC,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAC/C,MAAM,EAAE;IACT,cAAc,EAAE,aAAa,CAAA;IAC7B,KAAK,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAA;IACvC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAA;IAC3B,GAAG,EAAE,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IACvC,MAAM,EAAE,YAAY,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;CACnD,GAAG,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CA6DpD"}
|
|
@@ -16,9 +16,16 @@ export type QueryExtensionFn<GenericQuery = any> = (query: GenericQuery, ...args
|
|
|
16
16
|
* Same variance considerations as `QueryExtensionFn`.
|
|
17
17
|
*/
|
|
18
18
|
export type TransactionExtensionFn<GenericTransaction = any> = (tx: GenericTransaction, ...args: any[]) => any;
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
/**
|
|
20
|
+
* A group of extension methods keyed by name. A value is either an extension
|
|
21
|
+
* function (a leaf) or a **nested group** (arbitrary depth), so an author can
|
|
22
|
+
* structure a module's API however they like, e.g. a module `a` exposing
|
|
23
|
+
* `{ aa: { getItems }, aaa: { getItems } }` -> `query.a.aa.getItems`.
|
|
24
|
+
*/
|
|
25
|
+
export type ExtensionGroup<Fn> = {
|
|
26
|
+
[key: string]: Fn | ExtensionGroup<Fn>;
|
|
27
|
+
};
|
|
28
|
+
/** A map of group names -> extension groups (the per-side registry). */
|
|
22
29
|
export type ExtensionMap<Fn> = Record<string, ExtensionGroup<Fn>>;
|
|
23
30
|
/**
|
|
24
31
|
* A single named extension module, grouping its query and transaction methods.
|
|
@@ -46,14 +53,21 @@ export type AssertNoCollision<Extensions extends Record<string, unknown>, Reserv
|
|
|
46
53
|
};
|
|
47
54
|
/** Strips the first argument from a function signature. */
|
|
48
55
|
export type OmitFirstArg<GenericFn extends (...args: any[]) => any> = GenericFn extends (first: any, ...rest: infer Rest) => infer Return ? (...args: Rest) => Return : never;
|
|
56
|
+
/** Any extension function shape (leaf of an extension group). */
|
|
57
|
+
type AnyExtensionFn = (...args: any[]) => any;
|
|
49
58
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
59
|
+
* Recursively strips the first argument (query/tx) from every function in a
|
|
60
|
+
* (possibly nested) extension group, preserving the nesting shape.
|
|
61
|
+
*/
|
|
62
|
+
export type BoundGroup<GenericGroup> = {
|
|
63
|
+
[Key in keyof GenericGroup]: GenericGroup[Key] extends AnyExtensionFn ? OmitFirstArg<GenericGroup[Key]> : GenericGroup[Key] extends ExtensionGroup<QueryExtensionFn | TransactionExtensionFn> ? BoundGroup<GenericGroup[Key]> : never;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Given a map of extension groups, produces the same structure with the first
|
|
67
|
+
* argument stripped from each (possibly nested) function.
|
|
52
68
|
*/
|
|
53
69
|
export type BoundExtensionMap<GenericExtensionsMap extends ExtensionMap<QueryExtensionFn | TransactionExtensionFn>> = {
|
|
54
|
-
[GroupName in keyof GenericExtensionsMap]:
|
|
55
|
-
[MethodName in keyof GenericExtensionsMap[GroupName]]: OmitFirstArg<GenericExtensionsMap[GroupName][MethodName]>;
|
|
56
|
-
};
|
|
70
|
+
[GroupName in keyof GenericExtensionsMap]: BoundGroup<GenericExtensionsMap[GroupName]>;
|
|
57
71
|
};
|
|
58
72
|
export type QueryExtensions<Ext extends ExtensionsRegistry> = Ext extends {
|
|
59
73
|
query: infer Q extends ExtensionMap<QueryExtensionFn>;
|
|
@@ -78,4 +92,5 @@ export type MergedExtensions<Modules extends ExtensionModules> = {
|
|
|
78
92
|
[K in keyof Modules as Modules[K]['transaction'] extends ExtensionGroup<TransactionExtensionFn> ? K : never]: Modules[K]['transaction'] extends ExtensionGroup<TransactionExtensionFn> ? Modules[K]['transaction'] : never;
|
|
79
93
|
};
|
|
80
94
|
};
|
|
95
|
+
export {};
|
|
81
96
|
//# sourceMappingURL=types.extensions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.extensions.d.ts","sourceRoot":"","sources":["../../src/document/types.extensions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,gBAAgB,CAAC,YAAY,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;AAE/F;;;GAGG;AAEH,MAAM,MAAM,sBAAsB,CAAC,kBAAkB,GAAG,GAAG,IAAI,CAC9D,EAAE,EAAE,kBAAkB,EACtB,GAAG,IAAI,EAAE,GAAG,EAAE,KACV,GAAG,CAAA;AAIR
|
|
1
|
+
{"version":3,"file":"types.extensions.d.ts","sourceRoot":"","sources":["../../src/document/types.extensions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,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S,YAAY,CAAC,sBAAsB,CAAC,CAAA;CAAE,GAC/E,iBAAiB,CAAC,CAAC,CAAC,GACpB,EAAE,CAAC,CAAA;AAEP;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;AAE9D;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,OAAO,SAAS,gBAAgB,IAAI;IAChE,KAAK,EAAE;SACL,CAAC,IAAI,MAAM,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,cAAc,CAAC,gBAAgB,CAAC,GAChF,CAAC,GACD,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,cAAc,CAAC,gBAAgB,CAAC,GACpE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GACnB,KAAK;KACR,CAAA;IACD,WAAW,EAAE;SACX,CAAC,IAAI,MAAM,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,cAAc,CAAC,sBAAsB,CAAC,GAC5F,CAAC,GACD,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,cAAc,CAAC,sBAAsB,CAAC,GAChF,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,GACzB,KAAK;KACR,CAAA;CACD,CAAA"}
|
package/dist/errors/codes.d.ts
CHANGED
|
@@ -79,6 +79,14 @@ export declare const ERROR_CATALOG: {
|
|
|
79
79
|
readonly code: "D3006";
|
|
80
80
|
readonly message: "Unknown namespace prefix on attribute — pass it explicitly as { name, namespace: { prefix, uri } }";
|
|
81
81
|
};
|
|
82
|
+
readonly PREFIXED_ATTRIBUTE_NAME: {
|
|
83
|
+
readonly code: "D3007";
|
|
84
|
+
readonly message: "Authored attribute name must be a local name — pass the namespace separately as { name, namespace }, not a prefixed name";
|
|
85
|
+
};
|
|
86
|
+
readonly FIXED_VALUE_VIOLATION: {
|
|
87
|
+
readonly code: "D3008";
|
|
88
|
+
readonly message: "Attribute value differs from the schema-fixed value";
|
|
89
|
+
};
|
|
82
90
|
readonly ALREADY_COMMITTED: {
|
|
83
91
|
readonly code: "D4001";
|
|
84
92
|
readonly message: "Transaction already committed";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/errors/codes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/errors/codes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2JhB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AnyAttribute, AnyDialecteConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Reject a write whose authored value differs from an attribute's schema `fixed`
|
|
4
|
+
* value (XSD `fixed`). Runs on the WRITE path only (`addChild`/`ensureChild`/
|
|
5
|
+
* `update`) — never on import, so an existing document that already violates a
|
|
6
|
+
* fixed value can still be loaded. Attributes are matched by their canonical stored
|
|
7
|
+
* name (`prefix:local`), so pass the array produced by `toFullAttributeArray`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function assertNoFixedViolation(params: {
|
|
10
|
+
dialecteConfig: AnyDialecteConfig;
|
|
11
|
+
tagName: string;
|
|
12
|
+
attributes: readonly AnyAttribute[];
|
|
13
|
+
}): void;
|
|
14
|
+
//# sourceMappingURL=assert-fixed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert-fixed.d.ts","sourceRoot":"","sources":["../../src/helpers/assert-fixed.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE9D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC9C,cAAc,EAAE,iBAAiB,CAAA;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,SAAS,YAAY,EAAE,CAAA;CACnC,GAAG,IAAI,CAaP"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ref, RefOrRecord } from '../document';
|
|
2
|
-
import { RawRecord, TrackedRecord, TreeRecord, AnyDialecteConfig, ElementsOf, FullAttributeObjectOf, AttributesValueObjectOf, OperationStatus, ParentRelationship, ChildRelationship } from '../types';
|
|
2
|
+
import { RawRecord, TrackedRecord, TreeRecord, AnyDialecteConfig, AttributeInputOf, ElementsOf, FullAttributeObjectOf, AttributesValueObjectOf, OperationStatus, ParentRelationship, ChildRelationship } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Converts a TrackedRecord | TreeRecord to RawRecord
|
|
5
5
|
* If already a RawRecord, returns as-is.
|
|
@@ -30,7 +30,7 @@ export declare function toTreeRecord<GenericConfig extends AnyDialecteConfig, Ge
|
|
|
30
30
|
export declare function toFullAttributeArray<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>>(params: {
|
|
31
31
|
dialecteConfig: GenericConfig;
|
|
32
32
|
tagName: GenericElement;
|
|
33
|
-
attributes: Partial<AttributesValueObjectOf<GenericConfig, GenericElement>> |
|
|
33
|
+
attributes: Partial<AttributesValueObjectOf<GenericConfig, GenericElement>> | AttributeInputOf<GenericConfig, GenericElement>[];
|
|
34
34
|
}): FullAttributeObjectOf<GenericConfig, GenericElement>[];
|
|
35
35
|
/**
|
|
36
36
|
* Convert a Ref, ParentRelationship, ChildRelationship, or Record to a Ref.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../src/helpers/converter.ts"],"names":[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U,CAAC,aAAa,EAAE,cAAc,CAAC,GACzC,SAAS,GACV,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;AACrC,wBAAgB,KAAK,CACpB,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAC/C,KAAK,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,GAAG,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA"}
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AnyDialecteConfig,
|
|
1
|
+
import { AnyDialecteConfig, AttributeInputOf, ElementsOf, RawRecord, AttributesValueObjectOf, TransactionHooks } from '../types';
|
|
2
2
|
export declare function standardizeRecord<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>>(params: {
|
|
3
3
|
dialecteConfig: GenericConfig;
|
|
4
4
|
hooks?: TransactionHooks<GenericConfig>;
|
|
5
5
|
record: {
|
|
6
6
|
tagName: GenericElement;
|
|
7
|
-
attributes?: AttributesValueObjectOf<GenericConfig, GenericElement
|
|
7
|
+
attributes?: Partial<AttributesValueObjectOf<GenericConfig, GenericElement>> | AttributeInputOf<GenericConfig, GenericElement>[];
|
|
8
8
|
} & Omit<Partial<RawRecord<GenericConfig, GenericElement>>, 'attributes'>;
|
|
9
9
|
}): RawRecord<GenericConfig, GenericElement>;
|
|
10
10
|
//# sourceMappingURL=standardizing.d.ts.map
|