@dialecte/core 0.1.3 → 0.1.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/dialecte/main.d.ts +4 -3
- package/dist/dialecte/main.d.ts.map +1 -1
- package/dist/document/bind-extensions.d.ts +10 -0
- package/dist/document/bind-extensions.d.ts.map +1 -0
- package/dist/document/document.d.ts +10 -6
- package/dist/document/document.d.ts.map +1 -1
- package/dist/document/query/index.d.ts +1 -1
- package/dist/document/query/index.d.ts.map +1 -1
- package/dist/document/query/query.d.ts +182 -0
- package/dist/document/query/query.d.ts.map +1 -0
- package/dist/document/transaction/clone/clone.d.ts.map +1 -1
- package/dist/document/transaction/clone/clone.types.d.ts +2 -2
- package/dist/document/transaction/clone/clone.types.d.ts.map +1 -1
- package/dist/document/transaction/create/create.d.ts +2 -2
- package/dist/document/transaction/create/create.d.ts.map +1 -1
- package/dist/document/transaction/delete/delete.d.ts +2 -2
- package/dist/document/transaction/delete/delete.d.ts.map +1 -1
- package/dist/document/transaction/index.d.ts +1 -1
- package/dist/document/transaction/index.d.ts.map +1 -1
- package/dist/document/transaction/main.d.ts +9 -9
- package/dist/document/transaction/main.d.ts.map +1 -1
- package/dist/document/transaction/transaction.d.ts +109 -0
- package/dist/document/transaction/transaction.d.ts.map +1 -0
- package/dist/document/transaction/update/update.d.ts +2 -2
- package/dist/document/transaction/update/update.d.ts.map +1 -1
- package/dist/document/types.d.ts +3 -7
- package/dist/document/types.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/merge-extensions.d.ts +13 -0
- package/dist/helpers/merge-extensions.d.ts.map +1 -0
- package/dist/helpers.js +21 -125
- package/dist/{index-ni-jr0mc.js → index-YegaL-lT.js} +1574 -1551
- package/dist/index.js +3 -3
- package/dist/standardizing-CeZD5ywI.js +128 -0
- package/dist/{test-fixtures → test}/assert-xml/assert-xml.d.ts +1 -1
- package/dist/test/assert-xml/assert-xml.d.ts.map +1 -0
- package/dist/test/assert-xml/index.d.ts.map +1 -0
- package/dist/test/assert-xml/types.d.ts.map +1 -0
- package/dist/test/assert-xml/xpath-parser.d.ts.map +1 -0
- package/dist/test/config.d.ts +2109 -0
- package/dist/{test-fixtures/test-record.d.ts.map → test/config.d.ts.map} +1 -1
- package/dist/test/constant.d.ts.map +1 -0
- package/dist/{test-fixtures → test}/create-test-dialecte.d.ts +0 -3
- package/dist/test/create-test-dialecte.d.ts.map +1 -0
- package/dist/{test-fixtures → test}/generated/constants.generated.d.ts +105 -121
- package/dist/test/generated/constants.generated.d.ts.map +1 -0
- package/dist/test/generated/definition.generated.d.ts +1901 -0
- package/dist/test/generated/definition.generated.d.ts.map +1 -0
- package/dist/test/generated/index.d.ts +4 -0
- package/dist/test/generated/index.d.ts.map +1 -0
- package/dist/{test-fixtures → test}/generated/types.generated.d.ts +52 -53
- package/dist/test/generated/types.generated.d.ts.map +1 -0
- package/dist/{test-fixtures → test}/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/run-test-cases.d.ts +12 -0
- package/dist/test/run-test-cases.d.ts.map +1 -0
- package/dist/test/run-test-cases.type.d.ts +24 -0
- package/dist/test/run-test-cases.type.d.ts.map +1 -0
- package/dist/test/test-record.d.ts +16804 -0
- package/dist/test/test-record.d.ts.map +1 -0
- package/dist/test/test-record.types.d.ts.map +1 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1494 -12226
- package/dist/types/definition.d.ts +67 -50
- package/dist/types/definition.d.ts.map +1 -1
- package/dist/types/extensions.d.ts +73 -0
- package/dist/types/extensions.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/ref.d.ts +0 -1
- package/dist/types/ref.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/document/query/main.types.d.ts +0 -22
- package/dist/document/query/main.types.d.ts.map +0 -1
- package/dist/magic-string.es-uPKorP4O.js +0 -663
- package/dist/test-fixtures/assert-xml/assert-xml.d.ts.map +0 -1
- package/dist/test-fixtures/assert-xml/index.d.ts.map +0 -1
- package/dist/test-fixtures/assert-xml/types.d.ts.map +0 -1
- package/dist/test-fixtures/assert-xml/xpath-parser.d.ts.map +0 -1
- package/dist/test-fixtures/config.d.ts +0 -210
- package/dist/test-fixtures/config.d.ts.map +0 -1
- package/dist/test-fixtures/constant.d.ts.map +0 -1
- package/dist/test-fixtures/create-test-dialecte.d.ts.map +0 -1
- package/dist/test-fixtures/generated/constants.generated.d.ts.map +0 -1
- package/dist/test-fixtures/generated/definition.d.ts +0 -3
- package/dist/test-fixtures/generated/definition.d.ts.map +0 -1
- package/dist/test-fixtures/generated/index.d.ts +0 -4
- package/dist/test-fixtures/generated/index.d.ts.map +0 -1
- package/dist/test-fixtures/generated/types.generated.d.ts.map +0 -1
- package/dist/test-fixtures/index.d.ts.map +0 -1
- package/dist/test-fixtures/test-record.d.ts +0 -1612
- package/dist/test-fixtures/test-record.types.d.ts.map +0 -1
- /package/dist/{test-fixtures → test}/assert-xml/index.d.ts +0 -0
- /package/dist/{test-fixtures → test}/assert-xml/types.d.ts +0 -0
- /package/dist/{test-fixtures → test}/assert-xml/xpath-parser.d.ts +0 -0
- /package/dist/{test-fixtures → test}/constant.d.ts +0 -0
- /package/dist/{test-fixtures → test}/test-record.types.d.ts +0 -0
package/dist/dialecte/main.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Document } from '../document';
|
|
2
2
|
import { StorageOptions } from '../store';
|
|
3
|
-
import { AnyDialecteConfig } from '../types';
|
|
4
|
-
export declare function openDialecteDocument<GenericConfig extends AnyDialecteConfig>(params: {
|
|
3
|
+
import { AnyDialecteConfig, ExtensionsRegistry } from '../types';
|
|
4
|
+
export declare function openDialecteDocument<GenericConfig extends AnyDialecteConfig, GenericExt extends ExtensionsRegistry = {}>(params: {
|
|
5
5
|
config: GenericConfig;
|
|
6
6
|
storage: StorageOptions;
|
|
7
|
-
|
|
7
|
+
extensions?: GenericExt;
|
|
8
|
+
}): Document<GenericConfig, GenericExt>;
|
|
8
9
|
//# sourceMappingURL=main.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/dialecte/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/dialecte/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEpE,wBAAgB,oBAAoB,CACnC,aAAa,SAAS,iBAAiB,EACvC,UAAU,SAAS,kBAAkB,GAAG,EAAE,EACzC,MAAM,EAAE;IACT,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,EAAE,cAAc,CAAA;IACvB,UAAU,CAAC,EAAE,UAAU,CAAA;CACvB,GAAG,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC,CAOtC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ExtensionMap, QueryExtensionFn, TransactionExtensionFn } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Binds an extension map to an instance (Query or Transaction).
|
|
4
|
+
* Each function in the map gets `instance` prepended as its first argument,
|
|
5
|
+
* so the public API signature has that argument stripped.
|
|
6
|
+
*
|
|
7
|
+
* Returns a frozen object of { GroupName: { methodName: boundFn } }.
|
|
8
|
+
*/
|
|
9
|
+
export declare function bindExtensions<GenericExtensionsMap extends ExtensionMap<QueryExtensionFn | TransactionExtensionFn>>(extensionMap: GenericExtensionsMap | undefined, instance: unknown): Record<string, Record<string, (...args: unknown[]) => unknown>>;
|
|
10
|
+
//# sourceMappingURL=bind-extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind-extensions.d.ts","sourceRoot":"","sources":["../../src/document/bind-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAErF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC7B,oBAAoB,SAAS,YAAY,CAAC,gBAAgB,GAAG,sBAAsB,CAAC,EAEpF,YAAY,EAAE,oBAAoB,GAAG,SAAS,EAC9C,QAAQ,EAAE,OAAO,GACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC,CAgBjE"}
|
|
@@ -3,21 +3,23 @@ import { Transaction } from './transaction';
|
|
|
3
3
|
import { PreparedTransaction, DocumentState } from './types';
|
|
4
4
|
import { Store } from '../store';
|
|
5
5
|
import { AnyDialecteConfig } from '../types/dialecte-config';
|
|
6
|
+
import { AllExtensions, ExtensionsRegistry, QueryExtensions } from '../types/extensions';
|
|
6
7
|
/**
|
|
7
8
|
* Document — the public entry point for querying and mutating a dialecte.
|
|
8
9
|
*
|
|
9
10
|
* Queries: doc.query.getRoot(), doc.query.findChildren(...), etc.
|
|
10
11
|
* Mutations: doc.transaction(async (tx) => { tx.addChild(...) })
|
|
11
12
|
*
|
|
12
|
-
* Single observable state: doc.state — loading, error,
|
|
13
|
+
* Single observable state: doc.state — loading, error, progress, history.
|
|
13
14
|
* Transaction mutates this state directly (no separate transaction state).
|
|
14
15
|
*
|
|
15
16
|
* Subclass in a dialecte to override createQuery() / createTransaction()
|
|
16
17
|
* and return domain-specific subclasses (e.g. SclQuery, SclTransaction).
|
|
17
18
|
*/
|
|
18
|
-
export declare class Document<GenericConfig extends AnyDialecteConfig> {
|
|
19
|
+
export declare class Document<GenericConfig extends AnyDialecteConfig, GenericExtension extends ExtensionsRegistry = {}> {
|
|
19
20
|
protected store: Store;
|
|
20
21
|
protected config: GenericConfig;
|
|
22
|
+
private extensionsRegistry?;
|
|
21
23
|
readonly state: DocumentState;
|
|
22
24
|
/** Track concurrent transactions to manage loading flag */
|
|
23
25
|
private activeTransactions;
|
|
@@ -30,18 +32,20 @@ export declare class Document<GenericConfig extends AnyDialecteConfig> {
|
|
|
30
32
|
* so no self-filter is needed.
|
|
31
33
|
*/
|
|
32
34
|
private channel;
|
|
33
|
-
constructor(store: Store, config: GenericConfig);
|
|
35
|
+
constructor(store: Store, config: GenericConfig, extensions?: GenericExtension);
|
|
36
|
+
private withQueryExtensions;
|
|
37
|
+
private withAllExtensions;
|
|
34
38
|
/**
|
|
35
39
|
* Override in dialecte subclass to return a domain-specific Query.
|
|
36
40
|
*/
|
|
37
41
|
protected createQuery(): Query<GenericConfig>;
|
|
38
|
-
get query(): Query<GenericConfig>;
|
|
42
|
+
get query(): Query<GenericConfig> & QueryExtensions<GenericExtension>;
|
|
39
43
|
/**
|
|
40
44
|
* Override in dialecte subclass to return a domain-specific Transaction.
|
|
41
45
|
* e.g. SclDocument overrides this to return new SclTransaction(...)
|
|
42
46
|
*/
|
|
43
47
|
protected createTransaction(): Transaction<GenericConfig>;
|
|
44
|
-
transaction<T>(fn: (tx: Transaction<GenericConfig>) => Promise<T>, options?: {
|
|
48
|
+
transaction<T>(fn: (tx: Transaction<GenericConfig> & AllExtensions<GenericExtension>) => Promise<T>, options?: {
|
|
45
49
|
label?: string;
|
|
46
50
|
}): Promise<T>;
|
|
47
51
|
/**
|
|
@@ -64,7 +68,7 @@ export declare class Document<GenericConfig extends AnyDialecteConfig> {
|
|
|
64
68
|
* // or: prepared.discard()
|
|
65
69
|
* ```
|
|
66
70
|
*/
|
|
67
|
-
prepare(fn: (tx: Transaction<GenericConfig>) => Promise<void>, options?: {
|
|
71
|
+
prepare(fn: (tx: Transaction<GenericConfig> & AllExtensions<GenericExtension>) => Promise<void>, options?: {
|
|
68
72
|
label?: string;
|
|
69
73
|
}): Promise<PreparedTransaction<GenericConfig>>;
|
|
70
74
|
undo(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/document/document.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/document/document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAI3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAE5F;;;;;;;;;;;GAWG;AACH,qBAAa,QAAQ,CACpB,aAAa,SAAS,iBAAiB,EACvC,gBAAgB,SAAS,kBAAkB,GAAG,EAAE;IAEhD,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;IACtB,SAAS,CAAC,MAAM,EAAE,aAAa,CAAA;IAC/B,OAAO,CAAC,kBAAkB,CAAC,CAAkB;IAE7C,QAAQ,CAAC,KAAK,EAAE,aAAa,CAM5B;IAED,2DAA2D;IAC3D,OAAO,CAAC,kBAAkB,CAAI;IAE9B;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,CAAkB;gBAErB,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,gBAAgB;IAY9E,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,iBAAiB;IASzB;;OAEG;IACH,SAAS,CAAC,WAAW,IAAI,KAAK,CAAC,aAAa,CAAC;IAI7C,IAAI,KAAK,IAAI,KAAK,CAAC,aAAa,CAAC,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAEpE;IAID;;;OAGG;IACH,SAAS,CAAC,iBAAiB,IAAI,WAAW,CAAC,aAAa,CAAC;IAInD,WAAW,CAAC,CAAC,EAClB,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC,gBAAgB,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EACpF,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1B,OAAO,CAAC,CAAC,CAAC;IA0Cb;;;;;;;;;;;;;;;;;;;OAmBG;IACG,OAAO,CACZ,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC,gBAAgB,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,EACvF,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1B,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAqFxC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBrB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqB3B,iCAAiC;IACjC,KAAK,IAAI,IAAI;IAIb,wDAAwD;IAClD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAI9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/document/query/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/document/query/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { Context } from '../types';
|
|
2
|
+
import { FilterAttributes, DescendantsFilter, FindDescendantsReturn } from './find';
|
|
3
|
+
import { GetTreeParams } from './get';
|
|
4
|
+
import { Store } from '../../store';
|
|
5
|
+
import { AnyDialecteConfig, AttributesOf, AttributesValueObjectOf, ElementsOf, FullAttributeObjectOf, TrackedRecord, TreeRecord, Operation, RefOrRecord, RootElementOf } from '../../types';
|
|
6
|
+
/**
|
|
7
|
+
* Query — query-only access to a dialecte's store.
|
|
8
|
+
*
|
|
9
|
+
* Single source of truth for all read operations.
|
|
10
|
+
* Transaction extends this to overlay staged ops.
|
|
11
|
+
* Document exposes this via doc.query for direct store reads.
|
|
12
|
+
*
|
|
13
|
+
* Subclass in a dialecte (e.g. SclQuery) to add domain-specific queries.
|
|
14
|
+
*/
|
|
15
|
+
export declare class Query<GenericConfig extends AnyDialecteConfig> {
|
|
16
|
+
protected store: Store;
|
|
17
|
+
protected dialecteConfig: GenericConfig;
|
|
18
|
+
constructor(store: Store, dialecteConfig: GenericConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Override point for Transaction: returns staged operations to overlay.
|
|
21
|
+
* Query returns [] — no staged ops. Transaction returns its stagedOperations.
|
|
22
|
+
*/
|
|
23
|
+
protected getOperations(): Operation<GenericConfig>[];
|
|
24
|
+
/**
|
|
25
|
+
* Read-only context passed to record FP functions.
|
|
26
|
+
* Expose as `protected` so dialecte subclasses (e.g. SclQuery) can call
|
|
27
|
+
* the same FP functions for domain-specific queries.
|
|
28
|
+
*/
|
|
29
|
+
protected get context(): Context<GenericConfig>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the root element of the document.
|
|
32
|
+
*
|
|
33
|
+
* @returns The root record, or `undefined` if the database is empty.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const root = await query.getRoot()
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
getRoot(): Promise<TrackedRecord<GenericConfig, RootElementOf<GenericConfig>>>;
|
|
41
|
+
/**
|
|
42
|
+
* Get a single record by ref, record, or relationship.
|
|
43
|
+
*
|
|
44
|
+
* @param refOrRecord - A ref `{ tagName, id }`, or any record/relationship.
|
|
45
|
+
* @returns The tracked record, or `undefined` if not found.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const ied = await query.getRecord({ tagName: 'IED', id: knownId })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
getRecord<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined): Promise<TrackedRecord<GenericConfig, GenericElement> | undefined>;
|
|
53
|
+
/**
|
|
54
|
+
* Get multiple records in a single call.
|
|
55
|
+
*
|
|
56
|
+
* @param refsOrRecords - Array of refs, records, or relationships.
|
|
57
|
+
* @returns Array of tracked records (same order, `undefined` for missing).
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const [bay1, bay2] = await query.getRecords([ref1, ref2])
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
getRecords<GenericElement extends ElementsOf<GenericConfig>>(refsOrRecords: (RefOrRecord<GenericConfig, GenericElement> | undefined)[]): Promise<(TrackedRecord<GenericConfig, GenericElement> | undefined)[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Get all records of a given tag name.
|
|
67
|
+
*
|
|
68
|
+
* @param tagName - The element type to retrieve.
|
|
69
|
+
* @returns All tracked records matching that tag name.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* const ieds = await query.getRecordsByTagName('IED')
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
getRecordsByTagName<GenericElement extends ElementsOf<GenericConfig>>(tagName: GenericElement): Promise<TrackedRecord<GenericConfig, GenericElement>[]>;
|
|
77
|
+
/**
|
|
78
|
+
* Find all descendants of an element, grouped by tag name.
|
|
79
|
+
*
|
|
80
|
+
* @param refOrRecord - The ancestor element.
|
|
81
|
+
* @param filter - Optional filter to restrict which tag names are returned.
|
|
82
|
+
* @returns Object keyed by tag name, each value an array of tracked records.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* const { Bay, VoltageLevel } = await query.findDescendants(substation)
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
findDescendants<GenericElement extends ElementsOf<GenericConfig>, GenericFilter extends DescendantsFilter<GenericConfig> | undefined = undefined>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, filter?: GenericFilter): Promise<FindDescendantsReturn<GenericConfig, GenericElement, GenericFilter>>;
|
|
90
|
+
/**
|
|
91
|
+
* Build a full tree structure from an element down.
|
|
92
|
+
*
|
|
93
|
+
* @param refOrRecord - The root of the subtree.
|
|
94
|
+
* @param options - Optional depth/filter controls.
|
|
95
|
+
* @returns A tree record with nested children, or `undefined` if not found.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const tree = await query.getTree(bay)
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
getTree<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, options?: GetTreeParams<GenericConfig, GenericElement>): Promise<TreeRecord<GenericConfig, GenericElement> | undefined>;
|
|
103
|
+
/**
|
|
104
|
+
* Get a single attribute value from a record.
|
|
105
|
+
*
|
|
106
|
+
* @param refOrRecord - The element to read from.
|
|
107
|
+
* @param params - Attribute name.
|
|
108
|
+
* @returns The attribute value, or `''` if absent.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* const name = await query.getAttribute(bay, { name: 'name' })
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
getAttribute<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: {
|
|
116
|
+
name: AttributesOf<GenericConfig, GenericElement>;
|
|
117
|
+
fullObject?: false;
|
|
118
|
+
}): Promise<FullAttributeObjectOf<GenericConfig, GenericElement>['value'] | ''>;
|
|
119
|
+
/**
|
|
120
|
+
* Get the full attribute object for a single attribute.
|
|
121
|
+
*
|
|
122
|
+
* @param refOrRecord - The element to read from.
|
|
123
|
+
* @param params - Attribute name and `fullObject: true`.
|
|
124
|
+
* @returns The full attribute object, or `undefined` if absent.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* const fullAttributeObject = await query.getAttribute(bay, { name: 'name', fullObject: true })
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
getAttribute<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: {
|
|
132
|
+
name: AttributesOf<GenericConfig, GenericElement>;
|
|
133
|
+
fullObject: true;
|
|
134
|
+
}): Promise<FullAttributeObjectOf<GenericConfig, GenericElement> | undefined>;
|
|
135
|
+
/**
|
|
136
|
+
* Get all attributes of a record as a destructurable key/value object.
|
|
137
|
+
*
|
|
138
|
+
* @param refOrRecord - The element to read from.
|
|
139
|
+
* @returns A `{ name, desc, ... }` object with attribute names as keys.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* const { name, desc } = await query.getAttributes(bay)
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
getAttributes<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params?: {
|
|
147
|
+
fullObject?: false;
|
|
148
|
+
}): Promise<AttributesValueObjectOf<GenericConfig, GenericElement>>;
|
|
149
|
+
/**
|
|
150
|
+
* Get all attributes of a record as an array of full attribute objects.
|
|
151
|
+
*
|
|
152
|
+
* @param refOrRecord - The element to read from.
|
|
153
|
+
* @returns An array of full attribute objects.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* const fullAttributeObjects = await query.getAttributes(bay, { fullObject: true })
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
getAttributes<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: {
|
|
161
|
+
fullObject: true;
|
|
162
|
+
}): Promise<FullAttributeObjectOf<GenericConfig, GenericElement>[]>;
|
|
163
|
+
/**
|
|
164
|
+
* Find records matching specific attribute values.
|
|
165
|
+
*
|
|
166
|
+
* @param params - Tag name and attribute filter criteria.
|
|
167
|
+
* @returns All matching tracked records.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const bays = await query.findByAttributes({
|
|
172
|
+
* tagName: 'Bay',
|
|
173
|
+
* attributes: { name: 'Q01' },
|
|
174
|
+
* })
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
findByAttributes<GenericElement extends ElementsOf<GenericConfig>>(params: {
|
|
178
|
+
tagName: GenericElement;
|
|
179
|
+
attributes: FilterAttributes<GenericConfig, GenericElement>;
|
|
180
|
+
}): Promise<TrackedRecord<GenericConfig, GenericElement>[]>;
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/document/query/query.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAA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,UAAU,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../../../src/document/transaction/clone/clone.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAa,MAAM,SAAS,CAAA;AAEpG;;;;GAIG;AACH,wBAAsB,cAAc,CACnC,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,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,SAAS,EAAE,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IAC7C,MAAM,EAAE,UAAU,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAA;CACtD,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAiB3D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyDialecteConfig, ElementsOf, Ref } from '../../../types';
|
|
1
|
+
import { AnyDialecteConfig, ElementsOf, RawRecord, Ref } from '../../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Mapping of source to target refs during cloning operations.
|
|
4
4
|
*/
|
|
@@ -10,7 +10,7 @@ export type CloneMapping<GenericConfig extends AnyDialecteConfig> = {
|
|
|
10
10
|
* Result of a deepClone operation.
|
|
11
11
|
*/
|
|
12
12
|
export type CloneResult<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = {
|
|
13
|
-
|
|
13
|
+
record: RawRecord<GenericConfig, GenericElement>;
|
|
14
14
|
mappings: CloneMapping<GenericConfig>[];
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=clone.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clone.types.d.ts","sourceRoot":"","sources":["../../../../src/document/transaction/clone/clone.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"clone.types.d.ts","sourceRoot":"","sources":["../../../../src/document/transaction/clone/clone.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAE5E;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,aAAa,SAAS,iBAAiB,IAAI;IACnE,MAAM,EAAE,GAAG,CAAC,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,CAAA;IACrD,MAAM,EAAE,GAAG,CAAC,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,CAAA;CACrD,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,CACtB,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,IAC7C;IACH,MAAM,EAAE,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IAChD,QAAQ,EAAE,YAAY,CAAC,aAAa,CAAC,EAAE,CAAA;CACvC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AddChildParams } from './create.types';
|
|
2
2
|
import { Context } from '../..';
|
|
3
|
-
import { AnyDialecteConfig, ElementsOf, ChildrenOf, Ref } from '../../../types';
|
|
3
|
+
import { AnyDialecteConfig, ElementsOf, ChildrenOf, RawRecord, Ref } from '../../../types';
|
|
4
4
|
/**
|
|
5
5
|
* Fetches parent, builds and stages operations for adding a child.
|
|
6
6
|
* Pushes operations directly to context.stagedOperations.
|
|
@@ -10,5 +10,5 @@ export declare function stageAddChild<GenericConfig extends AnyDialecteConfig, G
|
|
|
10
10
|
context: Context<GenericConfig>;
|
|
11
11
|
parentRef: Ref<GenericConfig, GenericElement>;
|
|
12
12
|
params: AddChildParams<GenericConfig, GenericElement, GenericChildElement>;
|
|
13
|
-
}): Promise<
|
|
13
|
+
}): Promise<RawRecord<GenericConfig, GenericChildElement>>;
|
|
14
14
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/document/transaction/create/create.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/document/transaction/create/create.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAExF;;;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,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,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,CAoDzD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context } from '../..';
|
|
2
|
-
import { AnyDialecteConfig, ElementsOf, ParentsOf, Ref } from '../../../types';
|
|
2
|
+
import { AnyDialecteConfig, ElementsOf, ParentsOf, Ref, RawRecord } from '../../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Stages deletion of a record and all its descendants.
|
|
5
5
|
* Also removes the deleted record from its parent's children list.
|
|
@@ -8,5 +8,5 @@ import { AnyDialecteConfig, ElementsOf, ParentsOf, Ref } from '../../../types';
|
|
|
8
8
|
export declare function stageDelete<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>>(params: {
|
|
9
9
|
context: Context<GenericConfig>;
|
|
10
10
|
ref: Ref<GenericConfig, GenericElement>;
|
|
11
|
-
}): Promise<
|
|
11
|
+
}): Promise<RawRecord<GenericConfig, ParentsOf<GenericConfig, GenericElement>>>;
|
|
12
12
|
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/document/transaction/delete/delete.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/document/transaction/delete/delete.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EACX,iBAAiB,EACjB,UAAU,EACV,SAAS,EAET,GAAG,EACH,SAAS,EACT,MAAM,SAAS,CAAA;AAEhB;;;;GAIG;AACH,wBAAsB,WAAW,CAChC,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAC/C,MAAM,EAAE;IACT,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,GAAG,EAAE,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;CACvC,GAAG,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC,CAqC9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/document/transaction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/document/transaction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { CloneResult } from './clone';
|
|
|
4
4
|
import { AddChildParams } from './create';
|
|
5
5
|
import { UpdateParams } from './update';
|
|
6
6
|
import { Store } from '../../store';
|
|
7
|
-
import { AnyDialecteConfig, AnyRawRecord, ChildrenOf, ElementsOf, Operation, ParentsOf,
|
|
7
|
+
import { AnyDialecteConfig, AnyRawRecord, ChildrenOf, ElementsOf, Operation, ParentsOf, RawRecord, RefOrRecord, TreeRecord } from '../../types';
|
|
8
8
|
/**
|
|
9
9
|
* Transaction — a scoped unit of work against a document.
|
|
10
10
|
*
|
|
@@ -39,23 +39,23 @@ export declare class Transaction<GenericConfig extends AnyDialecteConfig> extend
|
|
|
39
39
|
*
|
|
40
40
|
* @param parentRefOrRecord - The parent element (ref, record, or relationship). `undefined` for root.
|
|
41
41
|
* @param params - Child tagName, attributes and optional namespace, value, id.
|
|
42
|
-
* @returns
|
|
42
|
+
* @returns RawRecord of the created child.
|
|
43
43
|
*
|
|
44
44
|
* @example
|
|
45
45
|
* ```ts
|
|
46
|
-
* const
|
|
46
|
+
* const bayRecord = await tx.addChild(substation, {
|
|
47
47
|
* tagName: 'VoltageLevel',
|
|
48
48
|
* attributes: { name: 'VL1' },
|
|
49
49
|
* })
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
|
-
addChild<GenericElement extends ElementsOf<GenericConfig>, GenericChildElement extends ChildrenOf<GenericConfig, GenericElement>>(parentRefOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: AddChildParams<GenericConfig, GenericElement, GenericChildElement>): Promise<
|
|
52
|
+
addChild<GenericElement extends ElementsOf<GenericConfig>, GenericChildElement extends ChildrenOf<GenericConfig, GenericElement>>(parentRefOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: AddChildParams<GenericConfig, GenericElement, GenericChildElement>): Promise<RawRecord<GenericConfig, GenericChildElement>>;
|
|
53
53
|
/**
|
|
54
54
|
* Update attributes of an existing element.
|
|
55
55
|
*
|
|
56
56
|
* @param refOrRecord - The element to update (ref, record, or relationship).
|
|
57
57
|
* @param params - New attribute values.
|
|
58
|
-
* @returns
|
|
58
|
+
* @returns RawRecord of the updated element.
|
|
59
59
|
*
|
|
60
60
|
* @example
|
|
61
61
|
* ```ts
|
|
@@ -64,19 +64,19 @@ export declare class Transaction<GenericConfig extends AnyDialecteConfig> extend
|
|
|
64
64
|
* })
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
67
|
-
update<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: UpdateParams<GenericConfig, GenericElement>): Promise<
|
|
67
|
+
update<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: UpdateParams<GenericConfig, GenericElement>): Promise<RawRecord<GenericConfig, GenericElement>>;
|
|
68
68
|
/**
|
|
69
69
|
* Delete an element and its entire subtree.
|
|
70
70
|
*
|
|
71
71
|
* @param refOrRecord - The element to delete (ref, record, or relationship).
|
|
72
|
-
* @returns
|
|
72
|
+
* @returns RawRecord of the deleted element's parent.
|
|
73
73
|
*
|
|
74
74
|
* @example
|
|
75
75
|
* ```ts
|
|
76
|
-
* const
|
|
76
|
+
* const parentRecord = await tx.delete(bay)
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
|
-
delete<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined): Promise<
|
|
79
|
+
delete<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined): Promise<RawRecord<GenericConfig, ParentsOf<GenericConfig, GenericElement>>>;
|
|
80
80
|
/**
|
|
81
81
|
* Deep-clone a subtree under a new parent.
|
|
82
82
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/document/transaction/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAShC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,KAAK,EACX,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/document/transaction/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAShC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,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IACG,MAAM,CAAC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAC5D,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,EACnE,MAAM,EAAE,YAAY,CAAC,aAAa,EAAE,cAAc,CAAC,GACjD,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IASpD;;;;;;;;;;OAUG;IACG,MAAM,CAAC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAC5D,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,GACjE,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;IAI9E;;;;;;;;;;;;OAYG;IACG,SAAS,CACd,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAChD,mBAAmB,SAAS,UAAU,CAAC,aAAa,EAAE,cAAc,CAAC,EAErE,iBAAiB,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,EACzE,MAAM,EAAE,UAAU,CAAC,aAAa,EAAE,mBAAmB,CAAC,GACpD,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;IAW3D,0EAA0E;IAC1E,mBAAmB,IAAI,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAI9D,yCAAyC;IACzC,qBAAqB,IAAI,IAAI;IAI7B,sCAAsC;IACtC,gBAAgB,IAAI,IAAI;IAIxB;;;;;;OAMG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAO7B"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Query } from '../query';
|
|
2
|
+
import { DocumentState, Context } from '../types';
|
|
3
|
+
import { CloneResult } from './clone';
|
|
4
|
+
import { AddChildParams } from './create';
|
|
5
|
+
import { UpdateParams } from './update';
|
|
6
|
+
import { Store } from '../../store';
|
|
7
|
+
import { AnyDialecteConfig, AnyRawRecord, ChildrenOf, ElementsOf, Operation, ParentsOf, RawRecord, RefOrRecord, TreeRecord } from '../../types';
|
|
8
|
+
/**
|
|
9
|
+
* Transaction — a scoped unit of work against a document.
|
|
10
|
+
*
|
|
11
|
+
* Extends Query: queries overlay staged ops on top of store reads
|
|
12
|
+
* via getOperations() override (the single override point).
|
|
13
|
+
* Adds mutation methods (addChild, update, delete, deepClone).
|
|
14
|
+
*
|
|
15
|
+
* Mutates Document's state directly (loading, progress, history).
|
|
16
|
+
* No separate transaction state — the UI sees one unified state.
|
|
17
|
+
*
|
|
18
|
+
* Lifecycle: created by Document → used in callback → committed by Document → discarded.
|
|
19
|
+
*
|
|
20
|
+
* Subclass in a dialecte (e.g. SclTransaction) to add domain-specific mutations.
|
|
21
|
+
*/
|
|
22
|
+
export declare class Transaction<GenericConfig extends AnyDialecteConfig> extends Query<GenericConfig> {
|
|
23
|
+
protected stagedOperations: Operation<GenericConfig>[];
|
|
24
|
+
protected documentState: DocumentState;
|
|
25
|
+
protected recordCache: Map<string, AnyRawRecord>;
|
|
26
|
+
constructor(store: Store, dialecteConfig: GenericConfig, documentState: DocumentState);
|
|
27
|
+
/**
|
|
28
|
+
* Override: returns staged operations so Query's record methods overlay them.
|
|
29
|
+
*/
|
|
30
|
+
protected getOperations(): Operation<GenericConfig>[];
|
|
31
|
+
/**
|
|
32
|
+
* Single context for both reads and writes inside a Transaction.
|
|
33
|
+
* Overrides Query's cacheless context — adds the transaction-scoped cache
|
|
34
|
+
* and a mutable stagedOperations array (mutation FP functions push to it).
|
|
35
|
+
*/
|
|
36
|
+
protected get context(): Context<GenericConfig>;
|
|
37
|
+
/**
|
|
38
|
+
* Add a child element to a parent.
|
|
39
|
+
*
|
|
40
|
+
* @param parentRefOrRecord - The parent element (ref, record, or relationship). `undefined` for root.
|
|
41
|
+
* @param params - Child tagName, attributes and optional namespace, value, id.
|
|
42
|
+
* @returns Ref to the created child.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const bayRef = await tx.addChild(substation, {
|
|
47
|
+
* tagName: 'VoltageLevel',
|
|
48
|
+
* attributes: { name: 'VL1' },
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
addChild<GenericElement extends ElementsOf<GenericConfig>, GenericChildElement extends ChildrenOf<GenericConfig, GenericElement>>(parentRefOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: AddChildParams<GenericConfig, GenericElement, GenericChildElement>): Promise<RawRecord<GenericConfig, GenericChildElement>>;
|
|
53
|
+
/**
|
|
54
|
+
* Update attributes of an existing element.
|
|
55
|
+
*
|
|
56
|
+
* @param refOrRecord - The element to update (ref, record, or relationship).
|
|
57
|
+
* @param params - New attribute values.
|
|
58
|
+
* @returns Ref to the updated element.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* await tx.update(bay, {
|
|
63
|
+
* attributes: { name: 'Q02', desc: 'Feeder bay' },
|
|
64
|
+
* })
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
update<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, params: UpdateParams<GenericConfig, GenericElement>): Promise<RawRecord<GenericConfig, GenericElement>>;
|
|
68
|
+
/**
|
|
69
|
+
* Delete an element and its entire subtree.
|
|
70
|
+
*
|
|
71
|
+
* @param refOrRecord - The element to delete (ref, record, or relationship).
|
|
72
|
+
* @returns Ref to the deleted element's parent.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const parentRef = await tx.delete(bay)
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
delete<GenericElement extends ElementsOf<GenericConfig>>(refOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined): Promise<RawRecord<GenericConfig, ParentsOf<GenericConfig, GenericElement>>>;
|
|
80
|
+
/**
|
|
81
|
+
* Deep-clone a subtree under a new parent.
|
|
82
|
+
*
|
|
83
|
+
* @param parentRefOrRecord - The target parent for the clone.
|
|
84
|
+
* @param record - The tree record to clone (from `getTree`).
|
|
85
|
+
* @returns The cloned root ref and an ID mapping from old to new.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const tree = await tx.getTree(bay)
|
|
90
|
+
* const { ref, idMap } = await tx.deepClone(substation, tree)
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
deepClone<GenericElement extends ElementsOf<GenericConfig>, GenericChildElement extends ChildrenOf<GenericConfig, GenericElement>>(parentRefOrRecord: RefOrRecord<GenericConfig, GenericElement> | undefined, record: TreeRecord<GenericConfig, GenericChildElement>): Promise<CloneResult<GenericConfig, GenericChildElement>>;
|
|
94
|
+
/** Returns a read-only view of staged operations (for prepare/preview) */
|
|
95
|
+
getStagedOperations(): ReadonlyArray<Operation<GenericConfig>>;
|
|
96
|
+
/** Free staged operations from memory */
|
|
97
|
+
clearStagedOperations(): void;
|
|
98
|
+
/** Free cached records from memory */
|
|
99
|
+
clearRecordCache(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Commit all staged operations to the store atomically.
|
|
102
|
+
* Called by Document.transaction() after user callback completes.
|
|
103
|
+
*
|
|
104
|
+
* Updates documentState (loading, progress, lastCommit).
|
|
105
|
+
* Merges operations by ID to optimize database writes.
|
|
106
|
+
*/
|
|
107
|
+
commit(): Promise<void>;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/document/transaction/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAShC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,OA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C,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAC5D,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,EACnE,MAAM,EAAE,YAAY,CAAC,aAAa,EAAE,cAAc,CAAC,GACjD,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IASpD;;;;;;;;;;OAUG;IACG,MAAM,CAAC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAC5D,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,GACjE,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;IAI9E;;;;;;;;;;;;OAYG;IACG,SAAS,CACd,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAChD,mBAAmB,SAAS,UAAU,CAAC,aAAa,EAAE,cAAc,CAAC,EAErE,iBAAiB,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,EACzE,MAAM,EAAE,UAAU,CAAC,aAAa,EAAE,mBAAmB,CAAC,GACpD,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;IAW3D,0EAA0E;IAC1E,mBAAmB,IAAI,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAI9D,yCAAyC;IACzC,qBAAqB,IAAI,IAAI;IAI7B,sCAAsC;IACtC,gBAAgB,IAAI,IAAI;IAIxB;;;;;;OAMG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAO7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UpdateParams } from './update.types';
|
|
2
2
|
import { Context } from '../..';
|
|
3
|
-
import { AnyDialecteConfig, ElementsOf, Ref } from '../../../types';
|
|
3
|
+
import { AnyDialecteConfig, ElementsOf, RawRecord, Ref } from '../../../types';
|
|
4
4
|
/**
|
|
5
5
|
* Merges attribute/value changes onto an existing record.
|
|
6
6
|
* Undefined/null attribute values are stripped (treated as removals).
|
|
@@ -11,5 +11,5 @@ export declare function stageUpdate<GenericConfig extends AnyDialecteConfig, Gen
|
|
|
11
11
|
context: Context<GenericConfig>;
|
|
12
12
|
ref: Ref<GenericConfig, GenericElement>;
|
|
13
13
|
params: UpdateParams<GenericConfig, GenericElement>;
|
|
14
|
-
}): Promise<
|
|
14
|
+
}): Promise<RawRecord<GenericConfig, GenericElement>>;
|
|
15
15
|
//# sourceMappingURL=update.d.ts.map
|
|
@@ -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,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;
|
|
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,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAE5E;;;;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,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,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,CAqCpD"}
|
package/dist/document/types.d.ts
CHANGED
|
@@ -43,18 +43,14 @@ export type TransactionEntry = {
|
|
|
43
43
|
* Single observable state for a Document.
|
|
44
44
|
* In Vue: reactive(doc.state) makes all fields trigger re-renders.
|
|
45
45
|
*
|
|
46
|
-
* Usage: const { loading, error,
|
|
46
|
+
* Usage: const { loading, error, progress } = doc.state
|
|
47
47
|
*/
|
|
48
48
|
export type DocumentState = {
|
|
49
49
|
loading: boolean;
|
|
50
50
|
error: DialecteError | null;
|
|
51
|
-
/**
|
|
52
|
-
activity: {
|
|
53
|
-
method: string;
|
|
54
|
-
message: string;
|
|
55
|
-
} | null;
|
|
56
|
-
/** Measurable progress — drives progress bars (deepClone, commit, bulk ops) */
|
|
51
|
+
/** Drives progress bars and status messages (commit, deepClone, bulk ops) */
|
|
57
52
|
progress: {
|
|
53
|
+
message: string;
|
|
58
54
|
current: number;
|
|
59
55
|
total: number;
|
|
60
56
|
} | null;
|