@dialecte/core 0.4.3 → 0.4.6
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/index.d.ts +1 -1
- package/dist/document/index.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/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.d.ts +13 -1
- package/dist/document/types.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-D0KkiT1t.js → project-wohrish5.js} +1624 -1440
- 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/package.json +1 -1
package/dist/document/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { Document } from './document';
|
|
|
2
2
|
export { bindExtensions } from './bind-extensions';
|
|
3
3
|
export * from './query';
|
|
4
4
|
export * from './transaction';
|
|
5
|
-
export type { Context, CachedContext, PreparedTransaction, DocumentState, TransactionEntry, } from './types';
|
|
5
|
+
export type { ExtendedDocument, Context, CachedContext, PreparedTransaction, DocumentState, TransactionEntry, } from './types';
|
|
6
6
|
export type * from './types.extensions';
|
|
7
7
|
export type * from './types.ref';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAE7B,YAAY,EACX,OAAO,EACP,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GAChB,MAAM,SAAS,CAAA;AAEhB,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAE7B,YAAY,EACX,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GAChB,MAAM,SAAS,CAAA;AAEhB,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,aAAa,CAAA"}
|
|
@@ -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,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,aA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AC,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","sourceRoot":"","sources":["../../../../../src/document/query/get/attribute/get-attribute.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CACjC,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,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC5B,GAAG,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAmB1C;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC3C,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,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC5B,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAyBxC"}
|
|
@@ -1,23 +1,36 @@
|
|
|
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,oBAAo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gB,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"}
|
|
@@ -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":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,uBAAuB,EACvB,8BAA8B,EAC9B,8BAA8B,EAC9B,0BAA0B,EAC1B,MAAM,SAAS,CAAA;AAEhB;;;;;;;;;GASG;AACH,MAAM,MAAM,yBAAyB,CACpC,aAAa,SAAS,iBAAiB,EACvC,mBAAmB,SAAS,UAAU,CAAC,aAAa,CAAC,IAEnD;IACA,IAAI,EAAE,uBAAuB,CAAC,aAAa,EAAE,mBAAmB,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACjF,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,SAAS,CAAA;CACpB,GACD;KACC,mBAAmB,IAAI,0BAA0B,CAAC,aAAa,EAAE,mBAAmB,CAAC,GAAG;QACxF,IAAI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,MAAM,CAAA;CACd,GAAG,wBAAwB,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
package/dist/document/types.d.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
import { Document } from './document';
|
|
1
2
|
import { Query } from './query';
|
|
2
|
-
import { ExtensionsRegistry, QueryExtensions } from './types.extensions';
|
|
3
|
+
import { ExtensionsRegistry, QueryExtensions, ExtensionModules, MergedExtensions } from './types.extensions';
|
|
3
4
|
import { DialecteError } from '../errors';
|
|
4
5
|
import { Store } from '../store';
|
|
5
6
|
import { AnyDialecteConfig, Operation, AnyRawRecord } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* The document a project configured with `GenericModules` yields — i.e. the
|
|
9
|
+
* return type of `Project<Config, Modules>['openDocument']`. Both the query
|
|
10
|
+
* surface and the transaction callback are typed through the extension system.
|
|
11
|
+
*
|
|
12
|
+
* This is the single source of truth for "a `Document` augmented with modules".
|
|
13
|
+
* Config packages hydrate it into a one-parameter helper by fixing the config
|
|
14
|
+
* and pre-merging their base modules, e.g.
|
|
15
|
+
* `type ExtendedDocument<Custom> = Core.ExtendedDocument<Config, BaseModules & Custom>`.
|
|
16
|
+
*/
|
|
17
|
+
export type ExtendedDocument<GenericConfig extends AnyDialecteConfig, GenericModules extends ExtensionModules> = Document<GenericConfig, MergedExtensions<GenericModules>>;
|
|
6
18
|
/**
|
|
7
19
|
* Context passed to methods.
|
|
8
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/document/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEzE;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,CAAC,aAAa,SAAS,iBAAiB,IAAI;IAC9D,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAA;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,SAAS,CAAA;IAC3D,gBAAgB,EAAE,SAAS,CAAC,aAAa,CAAC,EAAE,CAAA;CAC5C,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,CAAC,aAAa,SAAS,iBAAiB,IAAI,OAAO,CAAC,aAAa,CAAC,GAAG;IAC7F,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;CAC/C,CAAA;AAID,MAAM,MAAM,mBAAmB,CAC9B,aAAa,SAAS,iBAAiB,EACvC,gBAAgB,SAAS,kBAAkB,GAAG,EAAE,IAC7C;IACH,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;IAC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CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IACvE;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAA;IACxE,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACvB,OAAO,IAAI,IAAI,CAAA;CACf,CAAA;AAID,MAAM,MAAM,gBAAgB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;CACrC,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;IAE3B,6EAA6E;IAC7E,QAAQ,EAAE;QACT,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,KAAK,EAAE,MAAM,CAAA;KACb,GAAG,IAAI,CAAA;IAER,4DAA4D;IAC5D,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAE3B;;;;OAIG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,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":[],"mappings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C,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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standardizing.d.ts","sourceRoot":"","sources":["../../src/helpers/standardizing.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,iBAAiB,EACjB,UAAU,EACV,
|
|
1
|
+
{"version":3,"file":"standardizing.d.ts","sourceRoot":"","sources":["../../src/helpers/standardizing.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,gBAAgB,EAChB,MAAM,SAAS,CAAA;AAEhB,wBAAgB,iBAAiB,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,MAAM,EAAE;QACP,OAAO,EAAE,cAAc,CAAA;QACvB,UAAU,CAAC,EACR,OAAO,CAAC,uBAAuB,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,GAC/D,gBAAgB,CAAC,aAAa,EAAE,cAAc,CAAC,EAAE,CAAA;KACpD,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,EAAE,YAAY,CAAC,CAAA;CACzE,GAAG,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,CAsG3C"}
|