@dialecte/core 0.6.2 → 0.6.4
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 +1 -0
- package/dist/document/query/any/any-query.d.ts.map +1 -1
- package/dist/document/query/find/descendant/find-descendant.d.ts +12 -0
- package/dist/document/query/find/descendant/find-descendant.d.ts.map +1 -1
- package/dist/document/query/find/descendant/record-source.d.ts +42 -0
- package/dist/document/query/find/descendant/record-source.d.ts.map +1 -0
- package/dist/document/query/get/attribute/get-attribute.d.ts +7 -7
- package/dist/document/query/get/attribute/get-attribute.d.ts.map +1 -1
- package/dist/document/query/get/attribute/get-attributes.d.ts +5 -3
- package/dist/document/query/get/attribute/get-attributes.d.ts.map +1 -1
- package/dist/document/query/get/record/index.d.ts +1 -0
- package/dist/document/query/get/record/index.d.ts.map +1 -1
- package/dist/document/query/get/record/load-live-records.d.ts +9 -0
- package/dist/document/query/get/record/load-live-records.d.ts.map +1 -0
- package/dist/document/query/main.d.ts +11 -0
- package/dist/document/query/main.d.ts.map +1 -1
- package/dist/helpers/index.d.ts +2 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/read-attributes.d.ts +56 -0
- package/dist/helpers/read-attributes.d.ts.map +1 -0
- package/dist/helpers/read-attributes.types.d.ts +10 -0
- package/dist/helpers/read-attributes.types.d.ts.map +1 -0
- package/dist/helpers.js +167 -43
- package/dist/index.js +3 -3
- package/dist/{project-DQ6Yf6lO.js → project-DGQAe9G9.js} +854 -793
- package/dist/store/in-memory/in-memory-store.d.ts +1 -0
- package/dist/store/in-memory/in-memory-store.d.ts.map +1 -1
- package/dist/store/local/dexie-store.d.ts +6 -0
- package/dist/store/local/dexie-store.d.ts.map +1 -1
- package/dist/store/store.types.d.ts +6 -0
- package/dist/store/store.types.d.ts.map +1 -1
- package/dist/test/run-test-cases.d.ts.map +1 -1
- package/dist/test/run-test-cases.type.d.ts +8 -0
- package/dist/test/run-test-cases.type.d.ts.map +1 -1
- package/dist/test.js +33 -31
- package/package.json +1 -1
|
@@ -53,6 +53,7 @@ export declare class AnyQuery<GenericConfig extends AnyDialecteConfig> {
|
|
|
53
53
|
getSnapshot(options: GetSnapshotOptions<AnyDialecteConfig> & {
|
|
54
54
|
as: 'both';
|
|
55
55
|
}): Promise<SnapshotResult>;
|
|
56
|
+
/** Every descendant of the element, grouped by tag name; a group's records come in no guaranteed order. */
|
|
56
57
|
findDescendants(refOrRecord: AnyRefOrRecord | undefined): Promise<Record<string, AnyTrackedRecord[]>>;
|
|
57
58
|
findAncestors(refOrRecord: AnyRefOrRecord | undefined): Promise<AnyTrackedRecord[]>;
|
|
58
59
|
findByAttributes(params: {
|
|
@@ -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,EAAsC,MAAM,YAAY,CAAA;AAC5F,OAAO,KAAK,EACX,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD;;;;;GAKG;AACH,qBAAa,QAAQ,CAAC,aAAa,SAAS,iBAAiB;IAE3D,SAAS,CAAC,UAAU,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC;IAClD,SAAS,CAAC,cAAc,EAAE,aAAa;gBAD7B,UAAU,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,EACxC,cAAc,EAAE,aAAa;IAGlC,SAAS,CAA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,MAAM,CAAA;KAAE,GAC7D,OAAO,CAAC,cAAc,CAAC;IAU1B,2GAA2G;IACrG,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,6 +1,18 @@
|
|
|
1
1
|
import { Collect, FindDescendantsParams, FindDescendantsReturn } from './find-descendant.types';
|
|
2
2
|
import { Context, Ref } from '../../..';
|
|
3
3
|
import { AnyDialecteConfig, ElementsOf } from '../../../../types';
|
|
4
|
+
/**
|
|
5
|
+
* Collect the descendants of `ref` by tag name.
|
|
6
|
+
*
|
|
7
|
+
* Reads: the records come from one per-call {@link RecordSource} - the store first, each
|
|
8
|
+
* record once, then one whole-document read once the call has issued more store reads (by id
|
|
9
|
+
* or by tag name) than that read is worth for this document. A flat collect under the document
|
|
10
|
+
* root with no `omit` verifies no ancestry at all: it relies on every record of a document
|
|
11
|
+
* lying under its root.
|
|
12
|
+
*
|
|
13
|
+
* Order: the groups are keyed by tag name; the records of a group come in no guaranteed order
|
|
14
|
+
* (the store's own; it is not guaranteed to be document order).
|
|
15
|
+
*/
|
|
4
16
|
export declare function findDescendants<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, GenericCollect extends Collect<GenericConfig, GenericElement>>(params: {
|
|
5
17
|
context: Context<GenericConfig>;
|
|
6
18
|
ref: Ref<GenericConfig, GenericElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-descendant.d.ts","sourceRoot":"","sources":["../../../../../src/document/query/find/descendant/find-descendant.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find-descendant.d.ts","sourceRoot":"","sources":["../../../../../src/document/query/find/descendant/find-descendant.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAEpG,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAa,MAAM,YAAY,CAAA;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAiB,MAAM,SAAS,CAAA;AAM3E;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CACpC,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAChD,cAAc,SAAS,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC,EAC5D,MAAM,EAAE;IACT,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,GAAG,EAAE,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IACvC,OAAO,EAAE,qBAAqB,CAAC,aAAa,EAAE,cAAc,EAAE,cAAc,CAAC,CAAA;CAC7E,GAAG,OAAO,CAAC,qBAAqB,CAAC,aAAa,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC,CA2ChF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Context, Ref } from '../../..';
|
|
2
|
+
import { AnyDialecteConfig, ElementsOf, TrackedRecord } from '../../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Store reads a call may issue before it asks the store how big the document is. Asking costs a
|
|
5
|
+
* count, which IndexedDB answers by iterating (about 50 ms for 90,000 records), so a call this
|
|
6
|
+
* small never asks: on IndexedDB 128 reads cost about 8 ms, the count of a 15,000-record document.
|
|
7
|
+
* It is also the floor of the switch: a document read is never due before this many reads.
|
|
8
|
+
*/
|
|
9
|
+
export declare const READS_BEFORE_SIZING = 128;
|
|
10
|
+
/**
|
|
11
|
+
* What one record of a whole-document read costs, in by-id reads: the switch from climbing to
|
|
12
|
+
* reading the document once is due after `count × this` store reads.
|
|
13
|
+
*
|
|
14
|
+
* Measured on IndexedDB (Dexie, Chromium) on the 5 and 10 MB stress fixtures (92,000 and 184,000
|
|
15
|
+
* records): one `get` 0.065 ms, one `getByDocumentId` 351 and 664 ms, so a record of the whole
|
|
16
|
+
* read costs 1/17.4 and 1/17.7 of a `get`. The in-memory store reads too fast for it to matter.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DOCUMENT_READ_COST_PER_RECORD: number;
|
|
19
|
+
type AnyTracked<GenericConfig extends AnyDialecteConfig> = TrackedRecord<GenericConfig, ElementsOf<GenericConfig>>;
|
|
20
|
+
/**
|
|
21
|
+
* The records of one `findDescendants` call. Reads go to the store, each record once (a
|
|
22
|
+
* per-call memo), until the call has issued more store reads (by id or by tag name) than one
|
|
23
|
+
* whole-document read is worth for this document; from then on every record comes from one
|
|
24
|
+
* in-memory map of the document (staged operations overlaid), and no store read is issued any
|
|
25
|
+
* more. A record served by the staged operations or the transaction cache is not a store read.
|
|
26
|
+
*
|
|
27
|
+
* A ref whose tag name differs from the record stored under its id throws
|
|
28
|
+
* `ELEMENT_TAGNAME_MISMATCH`, as `getRecord` does, whichever way the record is served.
|
|
29
|
+
*/
|
|
30
|
+
export type RecordSource<GenericConfig extends AnyDialecteConfig> = {
|
|
31
|
+
/** One record by ref. Staged operations come first, as with `getRecord`. */
|
|
32
|
+
get(ref: Ref<GenericConfig, ElementsOf<GenericConfig>>): Promise<AnyTracked<GenericConfig> | undefined>;
|
|
33
|
+
/** Several records by ref, in the order given; a missing record yields `undefined`. */
|
|
34
|
+
getMany(refs: Ref<GenericConfig, ElementsOf<GenericConfig>>[]): Promise<(AnyTracked<GenericConfig> | undefined)[]>;
|
|
35
|
+
/** Every live record of a tag name. */
|
|
36
|
+
byTag(tagName: ElementsOf<GenericConfig>): Promise<AnyTracked<GenericConfig>[]>;
|
|
37
|
+
};
|
|
38
|
+
export declare function createRecordSource<GenericConfig extends AnyDialecteConfig>(params: {
|
|
39
|
+
context: Context<GenericConfig>;
|
|
40
|
+
}): RecordSource<GenericConfig>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=record-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-source.d.ts","sourceRoot":"","sources":["../../../../../src/document/query/find/descendant/record-source.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE3E;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,QAAS,CAAA;AAEnD,KAAK,UAAU,CAAC,aAAa,SAAS,iBAAiB,IAAI,aAAa,CACvE,aAAa,EACb,UAAU,CAAC,aAAa,CAAC,CACzB,CAAA;AAOD;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,CAAC,aAAa,SAAS,iBAAiB,IAAI;IACnE,4EAA4E;IAC5E,GAAG,CACF,GAAG,EAAE,GAAG,CAAC,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,GAChD,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,CAAA;IACjD,uFAAuF;IACvF,OAAO,CACN,IAAI,EAAE,GAAG,CAAC,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,EAAE,GACnD,OAAO,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,CAAA;IACrD,uCAAuC;IACvC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;CAC/E,CAAA;AAED,wBAAgB,kBAAkB,CAAC,aAAa,SAAS,iBAAiB,EAAE,MAAM,EAAE;IACnF,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;CAC/B,GAAG,YAAY,CAAC,aAAa,CAAC,CAkH9B"}
|
|
@@ -5,10 +5,10 @@ import { AttributeDefaults } from '../../../../utils';
|
|
|
5
5
|
* Fetch a single attribute for the given ref or record.
|
|
6
6
|
*
|
|
7
7
|
* Resolves the record (a record given in full is read as it is, through the staged
|
|
8
|
-
* operations; a ref via staged → cache → store, see `resolveRecord`), then
|
|
9
|
-
* attribute. Pass `namespace` to scope by a namespace key (a local
|
|
10
|
-
* to the stored `prefix:local` key). `defaults` (default `'optional'`)
|
|
11
|
-
* fallback for an absent attribute: `'none'` → `''`; `'optional'` → `fixed` /
|
|
8
|
+
* operations; a ref via staged → cache → store, see `resolveRecord`), then reads the named
|
|
9
|
+
* attribute with {@link readAttribute}. Pass `namespace` to scope by a namespace key (a local
|
|
10
|
+
* `name` is resolved to the stored `prefix:local` key). `defaults` (default `'optional'`)
|
|
11
|
+
* controls the fallback for an absent attribute: `'none'` → `''`; `'optional'` → `fixed` /
|
|
12
12
|
* non-empty `default` (else `''`); `'required'` → required/fixed materialized value.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
@@ -24,9 +24,9 @@ export declare function getAttribute<GenericConfig extends AnyDialecteConfig, Ge
|
|
|
24
24
|
}): Promise<GenericAttribute['value'] | ''>;
|
|
25
25
|
/**
|
|
26
26
|
* Fetch a single attribute for the given ref or record as a full object (name + value +
|
|
27
|
-
* namespace). `defaults` (default `'optional'`) fills an
|
|
28
|
-
* synthesizing its object; `'none'` returns `undefined` when the
|
|
29
|
-
* stored.
|
|
27
|
+
* namespace), read with {@link readAttribute}. `defaults` (default `'optional'`) fills an
|
|
28
|
+
* absent schema attribute by synthesizing its object; `'none'` returns `undefined` when the
|
|
29
|
+
* attribute is not stored.
|
|
30
30
|
*
|
|
31
31
|
* @example
|
|
32
32
|
* getAttribute({ context, ref, name: 'name', fullObject: true }) // → FullAttributeObject | undefined
|
|
@@ -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":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD;;;;;;;;;;;;;GAaG;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,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,CAAA;IAC3D,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,CAQ1C;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,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,CAAA;IAC3D,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC5B,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAQxC"}
|
|
@@ -3,7 +3,8 @@ import { AnyDialecteConfig, AttributesValueObjectOf, ElementsOf, FullAttributeOb
|
|
|
3
3
|
import { AttributeDefaults } from '../../../../utils';
|
|
4
4
|
/**
|
|
5
5
|
* Fetch attributes for the given ref or record as a destructurable value object. A record given in full is read as it
|
|
6
|
-
* is, through the staged operations, with no store round trip (see `resolveRecord`)
|
|
6
|
+
* is, through the staged operations, with no store round trip (see `resolveRecord`); the reading itself is
|
|
7
|
+
* {@link readAttributes}.
|
|
7
8
|
*
|
|
8
9
|
* Without `namespace`, every attribute under the name it is stored by (`aA`, `xsi:type`, `ext:cA`) - what a write takes
|
|
9
10
|
* back. With a `namespace` key, only that namespace's attributes, with the prefix stripped from the keys
|
|
@@ -17,14 +18,15 @@ import { AttributeDefaults } from '../../../../utils';
|
|
|
17
18
|
* getAttributes({ context, ref }) // → { aA: '', bA: '', ... }
|
|
18
19
|
* getAttributes({ context, ref, namespace: 'ext' }) // → { cA: '...' }
|
|
19
20
|
*/
|
|
20
|
-
export declare function getAttributes<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>,
|
|
21
|
+
export declare function getAttributes<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>, _GenericAttribute extends FullAttributeObjectOf<GenericConfig, GenericElement>>(params: {
|
|
21
22
|
context: Context<GenericConfig>;
|
|
22
23
|
ref: RefOrRecord<GenericConfig, GenericElement> | undefined;
|
|
23
24
|
namespace?: string;
|
|
24
25
|
defaults?: AttributeDefaults;
|
|
25
26
|
}): Promise<AttributesValueObjectOf<GenericConfig, GenericElement>>;
|
|
26
27
|
/**
|
|
27
|
-
* Fetch all attributes of the given ref or record as a full array (name + value + namespace)
|
|
28
|
+
* Fetch all attributes of the given ref or record as a full array (name + value + namespace), read with
|
|
29
|
+
* {@link readAttributes}.
|
|
28
30
|
*
|
|
29
31
|
* `defaults` (default `'optional'`) fills absent schema attributes just like
|
|
30
32
|
* {@link getAttributes}: `'none'` returns the faithful stored-only set;
|
|
@@ -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":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACtD,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,iBAAiB,SAAS,qBAAqB,CAAC,aAAa,EAAE,cAAc,CAAC,EAC7E,MAAM,EAAE;IACT,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,GAAG,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,CAAA;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC5B,GAAG,OAAO,CAAC,uBAAuB,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CASlE;AAED;;;;;;;;;;;GAWG;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,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,CAAA;IAC3D,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC5B,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAW9B"}
|
|
@@ -5,4 +5,5 @@ export { getRecordsByTagName } from './get-records-by-tagname';
|
|
|
5
5
|
export { getChild } from './get-child';
|
|
6
6
|
export { getChildren } from './get-children';
|
|
7
7
|
export { overlayAllStaged, indexStagedDeletesByParent } from './staged-lookup';
|
|
8
|
+
export { loadLiveRecords } from './load-live-records';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/document/query/get/record/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/document/query/get/record/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Context } from '../../..';
|
|
2
|
+
import { AnyDialecteConfig, ElementsOf, TrackedRecord } from '../../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Read every record of the document once and overlay the staged operations: the in-memory
|
|
5
|
+
* data source of a whole-tree read (`getTree`) and of a descendant collect that has outgrown
|
|
6
|
+
* its climb (`findDescendants`). One `getByDocumentId` round trip, whatever the document size.
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadLiveRecords<GenericConfig extends AnyDialecteConfig>(context: Context<GenericConfig>): Promise<Map<string, TrackedRecord<GenericConfig, ElementsOf<GenericConfig>>>>;
|
|
9
|
+
//# sourceMappingURL=load-live-records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-live-records.d.ts","sourceRoot":"","sources":["../../../../../src/document/query/get/record/load-live-records.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE3E;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,aAAa,SAAS,iBAAiB,EAC5E,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAC7B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAQ/E"}
|
|
@@ -141,6 +141,17 @@ export declare class Query<GenericConfig extends AnyDialecteConfig> {
|
|
|
141
141
|
/**
|
|
142
142
|
* Find all descendants of an element, grouped by tag name.
|
|
143
143
|
*
|
|
144
|
+
* The groups are keyed by tag name; the records of a group come in no guaranteed order (the
|
|
145
|
+
* store's own; it is not guaranteed to be document order) - walk a `getTree` result for
|
|
146
|
+
* document order.
|
|
147
|
+
*
|
|
148
|
+
* Reads: a flat collect reads each tag name's candidates from the store's tag index and
|
|
149
|
+
* climbs their parent chains, each ancestor read once per call; the path form reads level
|
|
150
|
+
* by level. Once a call has issued more store reads than one whole-document read is worth for
|
|
151
|
+
* this document (never before 128), it reads the document once and serves the rest from
|
|
152
|
+
* memory - a large collect costs one `getByDocumentId`, never one read per ancestor step. A
|
|
153
|
+
* flat collect under the document root with no `omit` climbs nothing.
|
|
154
|
+
*
|
|
144
155
|
* @param refOrRecord - The ancestor element.
|
|
145
156
|
* @param options - Collect spec and optional omit list. When omitted, collects all descendant tag names.
|
|
146
157
|
* @returns Object keyed by tag name, each value an array of tracked records.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/document/query/main.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAgBhC,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AACzD,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;AA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EAAE,cAAc,CAAC,GAAG,SAAS,EACnE,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;IAalE;;;;;;;;;;;;;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"}
|
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,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,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,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,mBAAmB,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ReadAttributesBaseParams } from './read-attributes.types';
|
|
2
|
+
import { AnyAttribute } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Read one attribute of a record you hold, the way `query.getAttribute` reads it - same `namespace` scope, same
|
|
5
|
+
* `defaults` fill, same `''` for an absent attribute - with no query: synchronous, for an import pass or a pure
|
|
6
|
+
* composer. `query.getAttribute` itself delegates to it once it has the record.
|
|
7
|
+
*
|
|
8
|
+
* `fullObject: true` returns the attribute object, or `undefined` when there is none in that view: with
|
|
9
|
+
* `defaults: 'none'`, how to tell an absent attribute from one written empty.
|
|
10
|
+
*
|
|
11
|
+
* Reads the record as you hold it. Inside a transaction use `tx.getAttribute`, which sees the transaction's staged
|
|
12
|
+
* writes: a record held from before a write still reads its old values here.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* readAttribute({ record, dialecteConfig, name: 'aA' }) // → 'v' | ''
|
|
16
|
+
* readAttribute({ record, dialecteConfig, name: 'aA', defaults: 'none', fullObject: true }) // → undefined when absent
|
|
17
|
+
*
|
|
18
|
+
* @see {@link readAttributes}
|
|
19
|
+
*/
|
|
20
|
+
export declare function readAttribute(params: ReadAttributesBaseParams & {
|
|
21
|
+
name: string;
|
|
22
|
+
namespace?: string;
|
|
23
|
+
fullObject?: false;
|
|
24
|
+
}): string;
|
|
25
|
+
export declare function readAttribute(params: ReadAttributesBaseParams & {
|
|
26
|
+
name: string;
|
|
27
|
+
namespace?: string;
|
|
28
|
+
fullObject: true;
|
|
29
|
+
}): AnyAttribute | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Read the attributes of a record you hold, the way `query.getAttributes` reads them - each under the name it is
|
|
32
|
+
* stored by, or keyed by local name in a `namespace` scope, absent schema attributes filled per `defaults` - with no
|
|
33
|
+
* query: synchronous, for an import pass or a pure composer. `query.getAttributes`
|
|
34
|
+
* itself delegates to it once it has the record. Values are plain strings: for typed reads use the query.
|
|
35
|
+
*
|
|
36
|
+
* Namespace declarations are left out of the value object; `fullObject: true` returns the stored attributes as they
|
|
37
|
+
* are, a declaration a document carries included (stored by its prefix, in the xmlns namespace).
|
|
38
|
+
*
|
|
39
|
+
* Reads the record as you hold it. Inside a transaction use `tx.getAttributes`, which sees the transaction's staged
|
|
40
|
+
* writes: a record held from before a write still reads its old values here.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* readAttributes({ record, dialecteConfig }) // → { aA: 'v', 'ext:cA': 'w' }
|
|
44
|
+
* readAttributes({ record, dialecteConfig, defaults: 'none' }) // → stored only
|
|
45
|
+
* readAttributes({ record, dialecteConfig, fullObject: true }) // → AnyAttribute[]
|
|
46
|
+
*
|
|
47
|
+
* @see {@link readAttribute}
|
|
48
|
+
*/
|
|
49
|
+
export declare function readAttributes(params: ReadAttributesBaseParams & {
|
|
50
|
+
namespace?: string;
|
|
51
|
+
fullObject?: false;
|
|
52
|
+
}): Record<string, string>;
|
|
53
|
+
export declare function readAttributes(params: ReadAttributesBaseParams & {
|
|
54
|
+
fullObject: true;
|
|
55
|
+
}): AnyAttribute[];
|
|
56
|
+
//# sourceMappingURL=read-attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-attributes.d.ts","sourceRoot":"","sources":["../../src/helpers/read-attributes.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAA8C,MAAM,SAAS,CAAA;AAGvF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,wBAAwB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GACzF,MAAM,CAAA;AACT,wBAAgB,aAAa,CAC5B,MAAM,EAAE,wBAAwB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,IAAI,CAAA;CAAE,GACvF,YAAY,GAAG,SAAS,CAAA;AAyC3B;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAC7B,MAAM,EAAE,wBAAwB,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GAC3E,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACzB,wBAAgB,cAAc,CAC7B,MAAM,EAAE,wBAAwB,GAAG;IAAE,UAAU,EAAE,IAAI,CAAA;CAAE,GACrD,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AnyDialecteConfig, AnyRawRecord } from '../types';
|
|
2
|
+
import { AttributeDefaults } from '../utils';
|
|
3
|
+
/** What every attribute read takes: the record as held (raw, tracked or tree), the config its schema values come from. */
|
|
4
|
+
export type ReadAttributesBaseParams = {
|
|
5
|
+
record: AnyRawRecord;
|
|
6
|
+
dialecteConfig: AnyDialecteConfig;
|
|
7
|
+
/** How an absent schema attribute is filled - as in `query.getAttribute(s)`. Default `'optional'`. */
|
|
8
|
+
defaults?: AttributeDefaults;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=read-attributes.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-attributes.types.d.ts","sourceRoot":"","sources":["../../src/helpers/read-attributes.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD,0HAA0H;AAC1H,MAAM,MAAM,wBAAwB,GAAG;IACtC,MAAM,EAAE,YAAY,CAAA;IACpB,cAAc,EAAE,iBAAiB,CAAA;IACjC,sGAAsG;IACtG,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC5B,CAAA"}
|