@dialecte/core 0.1.4 → 0.1.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/query/find/ancestor/find-ancestor.d.ts +17 -0
- package/dist/document/query/find/ancestor/find-ancestor.d.ts.map +1 -0
- package/dist/document/query/find/ancestor/find-ancestor.types.d.ts +6 -0
- package/dist/document/query/find/ancestor/find-ancestor.types.d.ts.map +1 -0
- package/dist/document/query/find/ancestor/index.d.ts +3 -0
- package/dist/document/query/find/ancestor/index.d.ts.map +1 -0
- package/dist/document/query/find/index.d.ts +1 -0
- package/dist/document/query/find/index.d.ts.map +1 -1
- package/dist/document/query/get/record/get-child.d.ts +13 -0
- package/dist/document/query/get/record/get-child.d.ts.map +1 -0
- package/dist/document/query/get/record/get-children.d.ts +13 -0
- package/dist/document/query/get/record/get-children.d.ts.map +1 -0
- package/dist/document/query/get/record/get-record.d.ts +2 -2
- package/dist/document/query/get/record/get-record.d.ts.map +1 -1
- package/dist/document/query/get/record/get-records.d.ts +2 -2
- package/dist/document/query/get/record/get-records.d.ts.map +1 -1
- package/dist/document/query/get/record/index.d.ts +2 -0
- package/dist/document/query/get/record/index.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/main.d.ts +56 -16
- package/dist/document/query/main.d.ts.map +1 -1
- package/dist/document/transaction/ensure/ensure.d.ts +24 -0
- package/dist/document/transaction/ensure/ensure.d.ts.map +1 -0
- package/dist/document/transaction/ensure/index.d.ts +2 -0
- package/dist/document/transaction/ensure/index.d.ts.map +1 -0
- 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 +32 -10
- package/dist/document/transaction/main.d.ts.map +1 -1
- package/dist/helpers/guard.d.ts +20 -1
- package/dist/helpers/guard.d.ts.map +1 -1
- package/dist/helpers.js +18 -16
- package/dist/{index-YegaL-lT.js → index-Cl4q6wr5.js} +2224 -2096
- package/dist/index.js +27 -24
- package/dist/{standardizing-CeZD5ywI.js → standardizing-27Zk5ECm.js} +38 -30
- package/dist/test.js +2 -2
- package/dist/types/definition.d.ts +2 -1
- package/dist/types/definition.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/document/query/query.d.ts +0 -182
- package/dist/document/query/query.d.ts.map +0 -1
- package/dist/document/transaction/transaction.d.ts +0 -109
- package/dist/document/transaction/transaction.d.ts.map +0 -1
- package/dist/script/generate-test-fixtures.d.ts +0 -16
- package/dist/script/generate-test-fixtures.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,34 +1,37 @@
|
|
|
1
|
-
import { D as s, a, Q as r, T as
|
|
2
|
-
import { E as
|
|
1
|
+
import { D as s, a, Q as r, T as i, b as o, c as l, d, f as c, g as u, h as b, e as n, j as A, k as g, l as m, m as D, n as R, p, q as T, r as f, s as E, t as x, u as F, v as h, w as k, y as B, z as C, i as _, A as y, B as I, C as O, o as j } from "./index-Cl4q6wr5.js";
|
|
2
|
+
import { E as U, t as X } from "./index-CqwLClK7.js";
|
|
3
3
|
export {
|
|
4
4
|
s as DexieStore,
|
|
5
5
|
a as Document,
|
|
6
|
-
|
|
6
|
+
U as ERROR_CATALOG,
|
|
7
7
|
r as Query,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
i as TEMP_IDB_ID_ATTRIBUTE_NAME,
|
|
9
|
+
o as Transaction,
|
|
10
10
|
l as bulkAddRecords,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
d as bulkDeleteRecords,
|
|
12
|
+
c as bulkUpdateRecordAttributes,
|
|
13
|
+
u as bulkUpdateRecords,
|
|
14
14
|
b as deleteDatabaseIfExists,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
n as exportXmlFile,
|
|
16
|
+
A as findAncestors,
|
|
17
|
+
g as findByAttributes,
|
|
18
|
+
m as findDescendants,
|
|
18
19
|
D as formatXml,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
k as
|
|
20
|
+
R as getAttribute,
|
|
21
|
+
p as getAttributeFullObject,
|
|
22
|
+
T as getAttributes,
|
|
23
|
+
f as getAttributesFullObject,
|
|
24
|
+
E as getChild,
|
|
25
|
+
x as getChildren,
|
|
26
|
+
F as getDatabaseName,
|
|
27
|
+
h as getRecord,
|
|
28
|
+
k as getRecords,
|
|
29
|
+
B as getRecordsByTagName,
|
|
30
|
+
C as getTree,
|
|
28
31
|
_ as importXmlFiles,
|
|
29
32
|
y as isFileSupported,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
I as isTransactionContext,
|
|
34
|
+
O as matchesAttributeFilter,
|
|
35
|
+
j as openDialecteDocument,
|
|
36
|
+
X as throwDialecteError
|
|
34
37
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
const
|
|
1
|
+
import { a as D } from "./index-CqwLClK7.js";
|
|
2
|
+
const _ = "db-id", C = {
|
|
3
3
|
uri: "http://dialecte.dev/XML/DEV",
|
|
4
4
|
prefix: "dev"
|
|
5
|
-
}, z = `${C.prefix}:${
|
|
5
|
+
}, z = `${C.prefix}:${_}`, m = [
|
|
6
6
|
"id",
|
|
7
7
|
"tagName",
|
|
8
8
|
"namespace",
|
|
@@ -10,29 +10,35 @@ const N = "db-id", C = {
|
|
|
10
10
|
"children",
|
|
11
11
|
"parent",
|
|
12
12
|
"value"
|
|
13
|
-
],
|
|
13
|
+
], R = [...m, "status"], O = [...R, "tree"];
|
|
14
14
|
function u(e, t) {
|
|
15
15
|
if (typeof e != "object" || e === null)
|
|
16
16
|
return !1;
|
|
17
17
|
const n = Object.keys(e);
|
|
18
18
|
return t.every((a) => a in e) && n.every((a) => t.includes(a)) && n.length === t.length;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function S(e) {
|
|
21
21
|
return Array.isArray(e);
|
|
22
22
|
}
|
|
23
23
|
function j(e) {
|
|
24
|
-
return u(e,
|
|
24
|
+
return u(e, m);
|
|
25
25
|
}
|
|
26
26
|
function F(e) {
|
|
27
|
-
return u(e,
|
|
27
|
+
return u(e, R);
|
|
28
28
|
}
|
|
29
29
|
function K(e) {
|
|
30
|
-
return u(e,
|
|
30
|
+
return u(e, O);
|
|
31
31
|
}
|
|
32
32
|
function V(e, t) {
|
|
33
33
|
return e.tagName === t;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function Y(e, t) {
|
|
36
|
+
return e.tagName === t;
|
|
37
|
+
}
|
|
38
|
+
function w(e, t) {
|
|
39
|
+
return e.tagName === t;
|
|
40
|
+
}
|
|
41
|
+
function y(e) {
|
|
36
42
|
return {
|
|
37
43
|
id: e.id,
|
|
38
44
|
tagName: e.tagName,
|
|
@@ -46,11 +52,11 @@ function O(e) {
|
|
|
46
52
|
function I(e) {
|
|
47
53
|
const { record: t, status: n } = e, a = n ?? ("status" in t ? t.status : "unchanged");
|
|
48
54
|
return {
|
|
49
|
-
...
|
|
55
|
+
...y(t),
|
|
50
56
|
status: a
|
|
51
57
|
};
|
|
52
58
|
}
|
|
53
|
-
function
|
|
59
|
+
function B(e) {
|
|
54
60
|
const { record: t, status: n, tree: a } = e, r = a ?? ("tree" in t ? t.tree : []);
|
|
55
61
|
return {
|
|
56
62
|
...I({ record: t, status: n }),
|
|
@@ -59,7 +65,7 @@ function Y(e) {
|
|
|
59
65
|
}
|
|
60
66
|
function x(e) {
|
|
61
67
|
const { dialecteConfig: t, tagName: n, attributes: a } = e;
|
|
62
|
-
return
|
|
68
|
+
return S(a) ? a : Object.entries(a).map(
|
|
63
69
|
([r, i]) => ({
|
|
64
70
|
name: r,
|
|
65
71
|
value: i,
|
|
@@ -67,15 +73,15 @@ function x(e) {
|
|
|
67
73
|
})
|
|
68
74
|
);
|
|
69
75
|
}
|
|
70
|
-
function
|
|
71
|
-
return
|
|
76
|
+
function L(e) {
|
|
77
|
+
return D(e, {
|
|
72
78
|
detail: "The record or ref is undefined"
|
|
73
79
|
}), {
|
|
74
80
|
id: e.id,
|
|
75
81
|
tagName: e.tagName
|
|
76
82
|
};
|
|
77
83
|
}
|
|
78
|
-
function
|
|
84
|
+
function P(e) {
|
|
79
85
|
const { dialecteConfig: t, record: n } = e, { id: a, tagName: r, attributes: i, namespace: E, value: b } = n, A = a ?? crypto.randomUUID(), c = i ? x({ tagName: r, attributes: i, dialecteConfig: t }) : [], l = {
|
|
80
86
|
id: A,
|
|
81
87
|
tagName: r,
|
|
@@ -90,21 +96,21 @@ function B(e) {
|
|
|
90
96
|
};
|
|
91
97
|
if (!t.elements.includes(r)) return l;
|
|
92
98
|
const f = t.definition[r].attributes.sequence, o = t.definition[r].attributes.details, T = f.flatMap((s) => {
|
|
93
|
-
const
|
|
99
|
+
const N = o[s].required, h = o[s]?.namespace || void 0, p = c.find((v) => v.name === s)?.value || (N ? o[s]?.default || "" : void 0);
|
|
94
100
|
return p === void 0 ? [] : [
|
|
95
101
|
{
|
|
96
102
|
name: s,
|
|
97
103
|
value: p,
|
|
98
|
-
namespace:
|
|
104
|
+
namespace: h
|
|
99
105
|
}
|
|
100
106
|
];
|
|
101
|
-
}),
|
|
107
|
+
}), g = c.filter(
|
|
102
108
|
(s) => "namespace" in s && s.namespace != null && !f.includes(s.name)
|
|
103
109
|
);
|
|
104
110
|
let d = {
|
|
105
111
|
...l,
|
|
106
112
|
namespace: t.definition[r].namespace,
|
|
107
|
-
attributes: [...T, ...
|
|
113
|
+
attributes: [...T, ...g]
|
|
108
114
|
};
|
|
109
115
|
return t.hooks?.afterStandardizedRecord && (d = t.hooks.afterStandardizedRecord({
|
|
110
116
|
record: d
|
|
@@ -113,16 +119,18 @@ function B(e) {
|
|
|
113
119
|
export {
|
|
114
120
|
z as C,
|
|
115
121
|
C as D,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
_ as a,
|
|
123
|
+
S as b,
|
|
124
|
+
w as c,
|
|
125
|
+
j as d,
|
|
126
|
+
V as e,
|
|
127
|
+
F as f,
|
|
128
|
+
K as g,
|
|
129
|
+
y as h,
|
|
130
|
+
Y as i,
|
|
131
|
+
L as j,
|
|
132
|
+
I as k,
|
|
133
|
+
B as l,
|
|
134
|
+
P as s,
|
|
127
135
|
x as t
|
|
128
136
|
};
|
package/dist/test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect as l, it as x } from "vitest";
|
|
2
|
-
import { x as E, D as b, i as X, o as q, e as f } from "./index-
|
|
3
|
-
import { D as S, s as D,
|
|
2
|
+
import { x as E, D as b, i as X, o as q, e as f } from "./index-Cl4q6wr5.js";
|
|
3
|
+
import { D as S, s as D, l as L, k as T } from "./standardizing-27Zk5ECm.js";
|
|
4
4
|
function h(a) {
|
|
5
5
|
const e = w(a);
|
|
6
6
|
if (e.length === 0)
|
|
@@ -56,7 +56,8 @@ export type ChildDefinition = {
|
|
|
56
56
|
};
|
|
57
57
|
export type ChoiceGroup = {
|
|
58
58
|
readonly options: readonly string[];
|
|
59
|
-
readonly
|
|
59
|
+
readonly minOccurs?: number;
|
|
60
|
+
readonly maxOccurs?: number;
|
|
60
61
|
};
|
|
61
62
|
export type TextContent = {
|
|
62
63
|
readonly facets?: Facets;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/types/definition.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAI1C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,aAAa,CAAA;AAExE,MAAM,MAAM,SAAS,GAAG;IACvB,QAAQ,CAAC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AAW,CAAA;CAClC,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,182 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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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,SAAS,EACnE,MAAM,EAAE;QAAE,IAAI,EAAE,YAAY,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;QAAC,UAAU,EAAE,IAAI,CAAA;KAAE,GAC7E,OAAO,CAAC,qBAAqB,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,CAAC;IAkB5E;;;;;;;;;;OAUG;IACG,aAAa,CAAC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EACnE,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,EACnE,MAAM,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,KAAK,CAAA;KAAE,GAC7B,OAAO,CAAC,uBAAuB,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IAClE;;;;;;;;;;OAUG;IACG,aAAa,CAAC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EACnE,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,EACnE,MAAM,EAAE;QAAE,UAAU,EAAE,IAAI,CAAA;KAAE,GAC1B,OAAO,CAAC,qBAAqB,CAAC,aAAa,EAAE,cAAc,CAAC,EAAE,CAAC;IAiBlE;;;;;;;;;;;;;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"}
|
|
@@ -1,109 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,OAAO,EAAE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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,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* generate-test-fixtures.ts
|
|
3
|
-
*
|
|
4
|
-
* Generates TypeScript types and constants from the test DEFINITION constant.
|
|
5
|
-
*
|
|
6
|
-
* Steps:
|
|
7
|
-
* 1. Import DEFINITION from definition.ts
|
|
8
|
-
* 2. Write it to a temporary JSON file
|
|
9
|
-
* 3. Run generate-definition.ts on it (with empty MAPPING for test fixtures)
|
|
10
|
-
* 4. Clean up temp file
|
|
11
|
-
*
|
|
12
|
-
* Usage:
|
|
13
|
-
* node --import=tsx src/script/generate-test-fixtures.ts
|
|
14
|
-
*/
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=generate-test-fixtures.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-test-fixtures.d.ts","sourceRoot":"","sources":["../../src/script/generate-test-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|