@dialecte/core 0.1.22 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document/bind-extensions.d.ts +1 -1
- package/dist/document/bind-extensions.d.ts.map +1 -1
- package/dist/document/document.d.ts +6 -7
- package/dist/document/document.d.ts.map +1 -1
- package/dist/document/index.d.ts +3 -1
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/query/any/any-query.d.ts +2 -1
- package/dist/document/query/any/any-query.d.ts.map +1 -1
- package/dist/document/query/find/ancestor/find-ancestor.d.ts +2 -2
- package/dist/document/query/find/ancestor/find-ancestor.d.ts.map +1 -1
- package/dist/document/query/find/descendant/find-descendant.d.ts +2 -2
- package/dist/document/query/find/descendant/find-descendant.d.ts.map +1 -1
- package/dist/document/query/get/attribute/get-attribute.d.ts +2 -2
- package/dist/document/query/get/attribute/get-attribute.d.ts.map +1 -1
- package/dist/document/query/get/attribute/get-attributes.d.ts +2 -2
- package/dist/document/query/get/attribute/get-attributes.d.ts.map +1 -1
- package/dist/document/query/get/record/get-child.d.ts +2 -2
- package/dist/document/query/get/record/get-child.d.ts.map +1 -1
- package/dist/document/query/get/record/get-children.d.ts +2 -2
- package/dist/document/query/get/record/get-children.d.ts.map +1 -1
- 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/tree/get-tree.d.ts +2 -2
- package/dist/document/query/get/tree/get-tree.d.ts.map +1 -1
- package/dist/document/query/main.d.ts +4 -2
- package/dist/document/query/main.d.ts.map +1 -1
- package/dist/document/transaction/any/any-transaction.d.ts +2 -3
- package/dist/document/transaction/any/any-transaction.d.ts.map +1 -1
- package/dist/document/transaction/clone/clone.d.ts +2 -2
- package/dist/document/transaction/clone/clone.d.ts.map +1 -1
- package/dist/document/transaction/clone/clone.types.d.ts +2 -1
- package/dist/document/transaction/clone/clone.types.d.ts.map +1 -1
- package/dist/document/transaction/commit/commit.d.ts +3 -2
- package/dist/document/transaction/commit/commit.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/ensure/ensure.d.ts +2 -2
- package/dist/document/transaction/ensure/ensure.d.ts.map +1 -1
- package/dist/document/transaction/main.d.ts +5 -4
- package/dist/document/transaction/main.d.ts.map +1 -1
- 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 +2 -1
- package/dist/document/types.d.ts.map +1 -1
- package/dist/{types/extensions.d.ts → document/types.extensions.d.ts} +3 -3
- package/dist/document/types.extensions.d.ts.map +1 -0
- package/dist/{types/ref.d.ts → document/types.ref.d.ts} +2 -3
- package/dist/document/types.ref.d.ts.map +1 -0
- package/dist/errors/codes.d.ts +16 -0
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/helpers/converter.d.ts +2 -1
- package/dist/helpers/converter.d.ts.map +1 -1
- package/dist/helpers/merge-extensions.d.ts +1 -2
- package/dist/helpers/merge-extensions.d.ts.map +1 -1
- package/dist/helpers.js +1 -1
- package/dist/{index-B1qiHOqL.js → index-C2WRi-6U.js} +27 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -38
- package/dist/{merge-extensions-D-JNgVJ8.js → merge-extensions-DQKNUthU.js} +1 -1
- package/dist/project/index.d.ts +9 -0
- package/dist/project/index.d.ts.map +1 -0
- package/dist/project/io/export-document.d.ts +7 -0
- package/dist/project/io/export-document.d.ts.map +1 -0
- package/dist/project/io/import-document.d.ts +7 -0
- package/dist/project/io/import-document.d.ts.map +1 -0
- package/dist/project/io/index.d.ts +4 -0
- package/dist/project/io/index.d.ts.map +1 -0
- package/dist/project/io/init-empty-document.d.ts +7 -0
- package/dist/project/io/init-empty-document.d.ts.map +1 -0
- package/dist/project/project.d.ts +80 -0
- package/dist/project/project.d.ts.map +1 -0
- package/dist/project/state/document-state.d.ts +11 -0
- package/dist/project/state/document-state.d.ts.map +1 -0
- package/dist/project/state/index.d.ts +2 -0
- package/dist/project/state/index.d.ts.map +1 -0
- package/dist/project/types.d.ts +128 -0
- package/dist/project/types.d.ts.map +1 -0
- package/dist/project-ChrJXVyu.js +6762 -0
- package/dist/store/index.d.ts +3 -2
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/local/dexie-store.d.ts +74 -0
- package/dist/store/local/dexie-store.d.ts.map +1 -0
- package/dist/store/local/index.d.ts +3 -0
- package/dist/store/local/index.d.ts.map +1 -0
- package/dist/store/local/types.d.ts +6 -0
- package/dist/store/local/types.d.ts.map +1 -0
- package/dist/store/resolve-store.d.ts +9 -0
- package/dist/store/resolve-store.d.ts.map +1 -0
- package/dist/store/store.constants.d.ts +18 -0
- package/dist/store/store.constants.d.ts.map +1 -0
- package/dist/store/store.types.d.ts +70 -32
- package/dist/store/store.types.d.ts.map +1 -1
- package/dist/test/assert-xml/assert-xml.d.ts +1 -1
- package/dist/test/config.d.ts +14 -0
- package/dist/test/config.d.ts.map +1 -1
- package/dist/test/create-test-dialecte.d.ts +20 -20
- package/dist/test/create-test-dialecte.d.ts.map +1 -1
- package/dist/test/run-test-cases.d.ts +6 -0
- package/dist/test/run-test-cases.d.ts.map +1 -1
- package/dist/test/run-test-cases.type.d.ts +4 -8
- package/dist/test/run-test-cases.type.d.ts.map +1 -1
- package/dist/test/test-record.d.ts +48 -0
- package/dist/test/test-record.d.ts.map +1 -1
- package/dist/test.js +227 -227
- package/dist/types/dialecte-config.d.ts +8 -1
- package/dist/types/dialecte-config.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/xml/build/build-xml-document.d.ts +10 -0
- package/dist/xml/build/build-xml-document.d.ts.map +1 -0
- package/dist/xml/build/build-xml-document.types.d.ts +7 -0
- package/dist/xml/build/build-xml-document.types.d.ts.map +1 -0
- package/dist/xml/build/constant.d.ts.map +1 -0
- package/dist/{io/export → xml/build}/download-file.d.ts.map +1 -1
- package/dist/xml/build/formatter.d.ts.map +1 -0
- package/dist/xml/build/index.d.ts +6 -0
- package/dist/xml/build/index.d.ts.map +1 -0
- package/dist/xml/index.d.ts +3 -0
- package/dist/xml/index.d.ts.map +1 -0
- package/dist/{io/import → xml/parse}/guards.d.ts.map +1 -1
- package/dist/xml/parse/index.d.ts +5 -0
- package/dist/xml/parse/index.d.ts.map +1 -0
- package/dist/xml/parse/parse-session.d.ts +22 -0
- package/dist/xml/parse/parse-session.d.ts.map +1 -0
- package/dist/xml/parse/parse-xml-document.d.ts +12 -0
- package/dist/xml/parse/parse-xml-document.d.ts.map +1 -0
- package/dist/xml/parse/parse-xml-document.types.d.ts +17 -0
- package/dist/xml/parse/parse-xml-document.types.d.ts.map +1 -0
- package/dist/{io/import → xml/parse}/parser.d.ts +2 -0
- package/dist/xml/parse/parser.d.ts.map +1 -0
- package/dist/{io/import → xml/parse}/types.d.ts.map +1 -1
- package/package.json +1 -10
- package/dist/dialecte/index.d.ts +0 -2
- package/dist/dialecte/index.d.ts.map +0 -1
- package/dist/dialecte/main.d.ts +0 -6
- package/dist/dialecte/main.d.ts.map +0 -1
- package/dist/dialecte/main.types.d.ts +0 -12
- package/dist/dialecte/main.types.d.ts.map +0 -1
- package/dist/index-BI0vaz_1.js +0 -6662
- package/dist/io/database/index.d.ts +0 -3
- package/dist/io/database/index.d.ts.map +0 -1
- package/dist/io/database/instance.d.ts +0 -7
- package/dist/io/database/instance.d.ts.map +0 -1
- package/dist/io/database/types.d.ts +0 -7
- package/dist/io/database/types.d.ts.map +0 -1
- package/dist/io/export/constant.d.ts.map +0 -1
- package/dist/io/export/formatter.d.ts.map +0 -1
- package/dist/io/export/index.d.ts +0 -4
- package/dist/io/export/index.d.ts.map +0 -1
- package/dist/io/export/main.d.ts +0 -18
- package/dist/io/export/main.d.ts.map +0 -1
- package/dist/io/import/database-helpers.d.ts +0 -53
- package/dist/io/import/database-helpers.d.ts.map +0 -1
- package/dist/io/import/index.d.ts +0 -4
- package/dist/io/import/index.d.ts.map +0 -1
- package/dist/io/import/main.d.ts +0 -15
- package/dist/io/import/main.d.ts.map +0 -1
- package/dist/io/import/parser.d.ts.map +0 -1
- package/dist/io/import/relationships.d.ts +0 -9
- package/dist/io/import/relationships.d.ts.map +0 -1
- package/dist/io/import/test.types.d.ts +0 -4
- package/dist/io/import/test.types.d.ts.map +0 -1
- package/dist/io/index.d.ts +0 -3
- package/dist/io/index.d.ts.map +0 -1
- package/dist/script/element-parent-mapping.d.ts +0 -2
- package/dist/script/element-parent-mapping.d.ts.map +0 -1
- package/dist/script/find-singleton.d.ts +0 -1
- package/dist/script/find-singleton.d.ts.map +0 -1
- package/dist/script/find-unreferenced-elements.d.ts +0 -3
- package/dist/script/find-unreferenced-elements.d.ts.map +0 -1
- package/dist/script/generate-definition.d.ts +0 -3
- package/dist/script/generate-definition.d.ts.map +0 -1
- package/dist/script/generate-definition.types.d.ts +0 -86
- package/dist/script/generate-definition.types.d.ts.map +0 -1
- package/dist/script/pyodide.d.ts +0 -12
- package/dist/script/pyodide.d.ts.map +0 -1
- package/dist/script/sorted-dexie-dump-json.d.ts +0 -2
- package/dist/script/sorted-dexie-dump-json.d.ts.map +0 -1
- package/dist/script/test-pyodide.d.ts +0 -9
- package/dist/script/test-pyodide.d.ts.map +0 -1
- package/dist/store/dexie-store.d.ts +0 -36
- package/dist/store/dexie-store.d.ts.map +0 -1
- package/dist/types/extensions.d.ts.map +0 -1
- package/dist/types/ref.d.ts.map +0 -1
- /package/dist/{io/export → xml/build}/constant.d.ts +0 -0
- /package/dist/{io/export → xml/build}/download-file.d.ts +0 -0
- /package/dist/{io/export → xml/build}/formatter.d.ts +0 -0
- /package/dist/{io/import → xml/parse}/guards.d.ts +0 -0
- /package/dist/{io/import → xml/parse}/types.d.ts +0 -0
package/dist/errors/codes.d.ts
CHANGED
|
@@ -79,9 +79,25 @@ export declare const ERROR_CATALOG: {
|
|
|
79
79
|
readonly code: "D4004";
|
|
80
80
|
readonly message: "A transaction is already in progress. Concurrent transactions are not supported yet — serialize them or implement a transaction queue.";
|
|
81
81
|
};
|
|
82
|
+
readonly EXPORT_ROOT_NOT_FOUND: {
|
|
83
|
+
readonly code: "D5001";
|
|
84
|
+
readonly message: "Root element not found in records during export";
|
|
85
|
+
};
|
|
86
|
+
readonly EXPORT_ORPHAN_CHILD_REF: {
|
|
87
|
+
readonly code: "D5002";
|
|
88
|
+
readonly message: "Parent references non-existent child record";
|
|
89
|
+
};
|
|
82
90
|
readonly EXTENSION_METHOD_COLLISION: {
|
|
83
91
|
readonly code: "D6001";
|
|
84
92
|
readonly message: "Extension method name collision detected";
|
|
85
93
|
};
|
|
94
|
+
readonly UNKNOWN_CONFIG_KEY: {
|
|
95
|
+
readonly code: "D7001";
|
|
96
|
+
readonly message: "Unknown config key";
|
|
97
|
+
};
|
|
98
|
+
readonly DOCUMENT_NOT_REGISTERED: {
|
|
99
|
+
readonly code: "D7002";
|
|
100
|
+
readonly message: "Document not registered in project";
|
|
101
|
+
};
|
|
86
102
|
};
|
|
87
103
|
//# sourceMappingURL=codes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/errors/codes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/errors/codes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqHhB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref, RefOrRecord } from '../document';
|
|
2
|
+
import { RawRecord, TrackedRecord, TreeRecord, AnyDialecteConfig, ElementsOf, FullAttributeObjectOf, AttributesValueObjectOf, OperationStatus, ParentRelationship, ChildRelationship } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Converts a TrackedRecord | TreeRecord to RawRecord
|
|
4
5
|
* If already a RawRecord, returns as-is.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../src/helpers/converter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,SAAS,EACT,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../src/helpers/converter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EACX,SAAS,EACT,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,MAAM,SAAS,CAAA;AAEhB;;;GAGG;AACH,wBAAgB,WAAW,CAC1B,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAEhD,MAAM,EACH,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,GACxC,aAAa,CAAC,aAAa,EAAE,cAAc,CAAC,GAC5C,UAAU,CAAC,aAAa,EAAE,cAAc,CAAC,GAC1C,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,CAU1C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC9B,aAAa,SAAS,iBAAiB,E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AAK,EAAE,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,GAAG,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;AAC5F,wBAAgB,KAAK,CACpB,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAEhD,KAAK,EACF,kBAAkB,CAAC,aAAa,EAAE,cAAc,CAAC,GACjD,iBAAiB,CAAC,aAAa,EAAE,cAAc,CAAC,GAChD,SAAS,GACV,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;AACrC,wBAAgB,KAAK,CACpB,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAEhD,KAAK,EACF,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,GACxC,aAAa,CAAC,aAAa,EAAE,cAAc,CAAC,GAC5C,UAAU,CAAC,aAAa,EAAE,cAAc,CAAC,GACzC,SAAS,GACV,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;AACrC,wBAAgB,KAAK,CACpB,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAC/C,KAAK,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,GAAG,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ExtensionModules, MergedExtensions } from '../
|
|
1
|
+
import { ExtensionModules, MergedExtensions } from '../document';
|
|
2
2
|
/**
|
|
3
3
|
* Merges named extension modules into the flat { query, transaction } registry
|
|
4
|
-
* expected by openDialecteDocument.
|
|
5
4
|
*
|
|
6
5
|
* When two module sets share the same module key (e.g. base and custom both define
|
|
7
6
|
* "history"), their query and transaction groups are merged at the method level.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-extensions.d.ts","sourceRoot":"","sources":["../../src/helpers/merge-extensions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"merge-extensions.d.ts","sourceRoot":"","sources":["../../src/helpers/merge-extensions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAgBpE;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC9B,WAAW,SAAS,gBAAgB,EACpC,aAAa,SAAS,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC5D,OAAO,EAAE;IACV,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,MAAM,CAAC,EAAE,aAAa,CAAA;CACtB,GAAG,gBAAgB,CAAC,WAAW,GAAG,aAAa,CAAC,CA+BhD"}
|
package/dist/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as n, a as T, D as d, i as A, b as E, c, d as f, e as u, f as O, g as _, h as l, j as C, m as b, s as D, t as m, k as p, l as I, n as S, o as M } from "./merge-extensions-
|
|
1
|
+
import { C as n, a as T, D as d, i as A, b as E, c, d as f, e as u, f as O, g as _, h as l, j as C, m as b, s as D, t as m, k as p, l as I, n as S, o as M } from "./merge-extensions-DQKNUthU.js";
|
|
2
2
|
function i(t, s) {
|
|
3
3
|
const r = new Set(s), a = { ...t, attributes: t.attributes.filter((e) => !r.has(e.name)) };
|
|
4
4
|
return "tree" in t ? {
|
|
@@ -85,38 +85,55 @@ const c = {
|
|
|
85
85
|
message: "A transaction is already in progress. Concurrent transactions are not supported yet — serialize them or implement a transaction queue."
|
|
86
86
|
},
|
|
87
87
|
// D5xxx — Import/Export
|
|
88
|
+
EXPORT_ROOT_NOT_FOUND: {
|
|
89
|
+
code: "D5001",
|
|
90
|
+
message: "Root element not found in records during export"
|
|
91
|
+
},
|
|
92
|
+
EXPORT_ORPHAN_CHILD_REF: {
|
|
93
|
+
code: "D5002",
|
|
94
|
+
message: "Parent references non-existent child record"
|
|
95
|
+
},
|
|
88
96
|
// D6xxx — Config
|
|
89
97
|
EXTENSION_METHOD_COLLISION: {
|
|
90
98
|
code: "D6001",
|
|
91
99
|
message: "Extension method name collision detected"
|
|
100
|
+
},
|
|
101
|
+
// D7xxx — Project
|
|
102
|
+
UNKNOWN_CONFIG_KEY: {
|
|
103
|
+
code: "D7001",
|
|
104
|
+
message: "Unknown config key"
|
|
105
|
+
},
|
|
106
|
+
DOCUMENT_NOT_REGISTERED: {
|
|
107
|
+
code: "D7002",
|
|
108
|
+
message: "Document not registered in project"
|
|
92
109
|
}
|
|
93
110
|
};
|
|
94
111
|
function d(o, e) {
|
|
95
|
-
const
|
|
96
|
-
code:
|
|
112
|
+
const s = c[o], t = {
|
|
113
|
+
code: s.code,
|
|
97
114
|
key: o,
|
|
98
|
-
message: e.message ??
|
|
115
|
+
message: e.message ?? s.message,
|
|
99
116
|
detail: e.detail,
|
|
100
117
|
method: i(new Error().stack),
|
|
101
118
|
ref: e.ref,
|
|
102
119
|
cause: e.cause
|
|
103
|
-
},
|
|
104
|
-
throw
|
|
120
|
+
}, a = new Error(e.detail);
|
|
121
|
+
throw a.cause = t, a;
|
|
105
122
|
}
|
|
106
123
|
function i(o) {
|
|
107
124
|
if (!o) return "unknown";
|
|
108
125
|
const e = o.split(`
|
|
109
126
|
`).slice(1).find((r) => !/\b(throwDialecteError|assert)\b/.test(r));
|
|
110
127
|
if (!e) return "unknown";
|
|
111
|
-
const
|
|
112
|
-
if (!
|
|
113
|
-
const n =
|
|
128
|
+
const s = e.match(/\bat\s+(\S+)\s+\(([^)]+)\)/), t = s?.[1], a = s?.[2];
|
|
129
|
+
if (!a || !t) return t ?? "unknown";
|
|
130
|
+
const n = a.match(/(\w[\w-]*\/src\/[^?:]+)/);
|
|
114
131
|
return n ? `${n[1].replace(/\.[^/.]+$/, "")}::${t}` : t;
|
|
115
132
|
}
|
|
116
133
|
function D(o, e) {
|
|
117
134
|
if (o) return;
|
|
118
|
-
const { detail:
|
|
119
|
-
d(t, { detail:
|
|
135
|
+
const { detail: s, key: t = "ASSERTION_FAILED", ref: a } = e;
|
|
136
|
+
d(t, { detail: s, ref: a });
|
|
120
137
|
}
|
|
121
138
|
export {
|
|
122
139
|
c as E,
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AAErB,mBAAmB,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,75 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { x as l } from "./project-ChrJXVyu.js";
|
|
2
|
+
import { A as D, a as g, C as w, D as x, b as S, c as f, M as C, P as R, d as h, Q as y, T as _, e as F, f as L, g as B, h as M, i as O, j as U, k as v, l as N, m as P, n as j, o as G, p as H, q as X, r as k, s as z, t as I, u as Q, v as W, w as q, y as J, z as K, B as $, E as V, F as Y, G as Z, H as ee, I as te, J as ae, K as se } from "./project-ChrJXVyu.js";
|
|
3
|
+
import { E as oe, t as ne } from "./index-C2WRi-6U.js";
|
|
4
|
+
function m(a) {
|
|
5
|
+
return l(a);
|
|
6
|
+
}
|
|
7
|
+
async function p(a) {
|
|
8
|
+
const { extension: s, xmlDocument: n, filename: r } = a, i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
9
|
+
` + new XMLSerializer().serializeToString(n), c = m(i), o = new Blob([c], { type: "application/xml" });
|
|
10
|
+
if ("showSaveFilePicker" in window)
|
|
11
|
+
try {
|
|
12
|
+
const e = await (await window.showSaveFilePicker({
|
|
13
|
+
suggestedName: r,
|
|
14
|
+
types: [
|
|
15
|
+
{
|
|
16
|
+
description: `${s.replace(/^\./, "").toUpperCase()} Files`,
|
|
17
|
+
accept: { "application/xml": [s] }
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
})).createWritable();
|
|
21
|
+
await e.write(o), await e.close();
|
|
22
|
+
} catch (t) {
|
|
23
|
+
t.name !== "AbortError" && console.error("Save failed:", t);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const t = URL.createObjectURL(o), e = document.createElement("a");
|
|
27
|
+
e.href = t, e.download = r, document.body.appendChild(e), e.click(), e.remove(), URL.revokeObjectURL(t);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
3
30
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
I as
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
D as AnyQuery,
|
|
32
|
+
g as AnyTransaction,
|
|
33
|
+
w as CHANGELOG_SCHEMA,
|
|
34
|
+
x as DOCUMENTS_SCHEMA,
|
|
35
|
+
S as DexieStore,
|
|
36
|
+
f as Document,
|
|
37
|
+
oe as ERROR_CATALOG,
|
|
38
|
+
C as META_SCHEMA,
|
|
39
|
+
R as ParseSession,
|
|
40
|
+
h as Project,
|
|
41
|
+
y as Query,
|
|
42
|
+
_ as TABLE_CHANGELOG,
|
|
43
|
+
F as TABLE_DOCUMENTS,
|
|
44
|
+
L as TABLE_META,
|
|
45
|
+
B as TABLE_RECORD_PREFIX,
|
|
46
|
+
M as TEMP_IDB_ID_ATTRIBUTE_NAME,
|
|
47
|
+
O as Transaction,
|
|
48
|
+
U as buildDocumentState,
|
|
49
|
+
v as buildXmlDocument,
|
|
50
|
+
p as downloadFile,
|
|
51
|
+
N as exportDocument,
|
|
52
|
+
P as findAncestors,
|
|
53
|
+
j as findByAttributes,
|
|
54
|
+
G as findDescendants,
|
|
55
|
+
m as formatXml,
|
|
56
|
+
H as getAttribute,
|
|
57
|
+
X as getAttributeFullObject,
|
|
58
|
+
k as getAttributes,
|
|
59
|
+
z as getAttributesFullObject,
|
|
60
|
+
I as getChild,
|
|
61
|
+
Q as getChildren,
|
|
62
|
+
W as getRecord,
|
|
63
|
+
q as getRecords,
|
|
64
|
+
J as getRecordsByTagName,
|
|
65
|
+
K as getTree,
|
|
66
|
+
$ as importDocument,
|
|
67
|
+
V as initEmptyDocument,
|
|
68
|
+
Y as isTransactionContext,
|
|
69
|
+
Z as matchesAttributeFilter,
|
|
70
|
+
ee as parseXmlFile,
|
|
71
|
+
te as reconcileDocumentState,
|
|
72
|
+
ae as recordTableName,
|
|
73
|
+
se as resolveStore,
|
|
74
|
+
ne as throwDialecteError
|
|
40
75
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Project } from './project';
|
|
2
|
+
export { buildDocumentState, reconcileDocumentState } from './state/document-state';
|
|
3
|
+
export { exportDocument } from './io/export-document';
|
|
4
|
+
export { initEmptyDocument } from './io/init-empty-document';
|
|
5
|
+
export { importDocument } from './io/import-document';
|
|
6
|
+
export { resolveStore } from '../store/resolve-store';
|
|
7
|
+
export type { ProjectOpenParams, InitEmptyDocumentOptions, ImportDocumentOptions, ExportDocumentOptions, StorageParam, DocumentRecord, DocumentState, ProjectState, } from './types';
|
|
8
|
+
export type { InitEmptyDocumentParams, InitEmptyDocumentResult, ImportDocumentParams, ImportDocumentResult, ExportDocumentParams, ExportDocumentResult, } from './types';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/project/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,YAAY,EACX,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,YAAY,GACZ,MAAM,SAAS,CAAA;AAChB,YAAY,EACX,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,GACpB,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExportDocumentParams, ExportDocumentResult } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Export a document as an XMLDocument built from stored records.
|
|
4
|
+
* Pure orchestration - no class state mutation.
|
|
5
|
+
*/
|
|
6
|
+
export declare function exportDocument(params: ExportDocumentParams): Promise<ExportDocumentResult>;
|
|
7
|
+
//# sourceMappingURL=export-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-document.d.ts","sourceRoot":"","sources":["../../../src/project/io/export-document.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAE1E;;;GAGG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAqBhG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ImportDocumentParams, ImportDocumentResult } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Import a File into the project: register document, parse XML, persist records, resolve root.
|
|
4
|
+
* Pure orchestration - no class state mutation.
|
|
5
|
+
*/
|
|
6
|
+
export declare function importDocument(params: ImportDocumentParams): Promise<ImportDocumentResult>;
|
|
7
|
+
//# sourceMappingURL=import-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-document.d.ts","sourceRoot":"","sources":["../../../src/project/io/import-document.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAG1E;;;GAGG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA2ChG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/project/io/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InitEmptyDocumentParams, InitEmptyDocumentResult } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Build a DocumentRecord, persist it, and create a root record in the store.
|
|
4
|
+
* Pure orchestration - no class state mutation.
|
|
5
|
+
*/
|
|
6
|
+
export declare function initEmptyDocument(params: InitEmptyDocumentParams): Promise<InitEmptyDocumentResult>;
|
|
7
|
+
//# sourceMappingURL=init-empty-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-empty-document.d.ts","sourceRoot":"","sources":["../../../src/project/io/init-empty-document.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,uBAAuB,EAAkB,MAAM,UAAU,CAAA;AAGhG;;;GAGG;AACH,wBAAsB,iBAAiB,CACtC,MAAM,EAAE,uBAAuB,GAC7B,OAAO,CAAC,uBAAuB,CAAC,CAkDlC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Document, ExtensionModules, ExtensionsRegistry, MergedExtensions } from '../document';
|
|
2
|
+
import { InitEmptyDocumentOptions, ImportDocumentOptions, ExportDocumentOptions, ProjectOpenParams, ProjectState, DocumentRecord } from './types';
|
|
3
|
+
import { Store } from '../store';
|
|
4
|
+
import { DexieStore } from '../store/local';
|
|
5
|
+
import { AnyDialecteConfig } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Project — top-level entry point for multi-file dialecte workspaces.
|
|
8
|
+
*
|
|
9
|
+
* Owns the Store, file registry, and configuration.
|
|
10
|
+
* Documents are file-scoped views opened from a Project.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Project<GenericConfig extends AnyDialecteConfig, GenericExtension extends ExtensionsRegistry = {}, GenericStore extends Store = Store> {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
private store;
|
|
15
|
+
private configs;
|
|
16
|
+
private defaultConfigKey;
|
|
17
|
+
private extensionsRegistry?;
|
|
18
|
+
private hooks?;
|
|
19
|
+
private channel;
|
|
20
|
+
readonly state: ProjectState;
|
|
21
|
+
private constructor();
|
|
22
|
+
static open<GenericConfig extends AnyDialecteConfig, BaseExtensions extends ExtensionModules = Record<never, never>, CustomExtensions extends ExtensionModules = Record<never, never>>(params: ProjectOpenParams<GenericConfig, BaseExtensions, CustomExtensions> & {
|
|
23
|
+
storage: {
|
|
24
|
+
type: 'local';
|
|
25
|
+
};
|
|
26
|
+
}): Promise<Project<GenericConfig, MergedExtensions<BaseExtensions & CustomExtensions>, DexieStore>>;
|
|
27
|
+
static open<GenericConfig extends AnyDialecteConfig, BaseExtensions extends ExtensionModules = Record<never, never>, CustomExtensions extends ExtensionModules = Record<never, never>, GenericStore extends Store = Store>(params: Omit<ProjectOpenParams<GenericConfig, BaseExtensions, CustomExtensions>, 'storage'> & {
|
|
28
|
+
storage: {
|
|
29
|
+
type: 'custom';
|
|
30
|
+
store: GenericStore;
|
|
31
|
+
};
|
|
32
|
+
}): Promise<Project<GenericConfig, MergedExtensions<BaseExtensions & CustomExtensions>, GenericStore>>;
|
|
33
|
+
/**
|
|
34
|
+
* Register a new empty document in the project.
|
|
35
|
+
* Returns the new documentId. Records are added later via import or transactions.
|
|
36
|
+
*/
|
|
37
|
+
initEmptyDocument(options?: InitEmptyDocumentOptions): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Remove a file and all its records.
|
|
40
|
+
*/
|
|
41
|
+
removeDocument(documentId: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Import a File into the project: register, parse XML, persist records.
|
|
44
|
+
*/
|
|
45
|
+
import(file: File, options?: ImportDocumentOptions): Promise<{
|
|
46
|
+
documentId: string;
|
|
47
|
+
recordCount: number;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Export a document as an XMLDocument built from stored records.
|
|
51
|
+
*/
|
|
52
|
+
export(documentId: string, options?: ExportDocumentOptions): Promise<{
|
|
53
|
+
xmlDocument: XMLDocument;
|
|
54
|
+
filename: string;
|
|
55
|
+
}>;
|
|
56
|
+
getDocuments(): Promise<DocumentRecord[]>;
|
|
57
|
+
getDocument(documentId: string): Promise<DocumentRecord | undefined>;
|
|
58
|
+
/**
|
|
59
|
+
* Open a file-scoped Document for querying and mutating a specific file.
|
|
60
|
+
*/
|
|
61
|
+
openDocument(documentId: string): Document<GenericConfig, GenericExtension>;
|
|
62
|
+
/**
|
|
63
|
+
* Get the config for a specific file.
|
|
64
|
+
*/
|
|
65
|
+
getDocumentConfig(documentId: string): GenericConfig | undefined;
|
|
66
|
+
undo(documentId: string): Promise<void>;
|
|
67
|
+
redo(documentId: string): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Close the store and release resources.
|
|
70
|
+
*/
|
|
71
|
+
close(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Destroy the project - deletes the database entirely.
|
|
74
|
+
*/
|
|
75
|
+
destroy(): Promise<void>;
|
|
76
|
+
/** Expose the underlying database instance. Return type is inferred from the store (Dexie for local storage). */
|
|
77
|
+
getDatabaseInstance(): ReturnType<GenericStore['getDatabaseInstance']>;
|
|
78
|
+
private refreshState;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/project/project.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAIrC,OAAO,KAAK,EACX,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACxF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,SAAS,CAAA;AAIlE;;;;;GAKG;AACH,qBAAa,OAAO,CACnB,aAAa,SAAS,iBAAiB,EACvC,gBAAgB,SAAS,kBAAkB,GAAG,EAAE,EAChD,YAAY,SAAS,KAAK,GAAG,KAAK;IAElC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,O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
*/
|
|
5
|
+
export declare function buildDocumentState(document: DocumentRecord): DocumentState;
|
|
6
|
+
/**
|
|
7
|
+
* Reconcile in-memory document state Map with the current store contents.
|
|
8
|
+
* Adds new documents, removes stale ones. Returns the mutated map for convenience.
|
|
9
|
+
*/
|
|
10
|
+
export declare function reconcileDocumentState(state: Map<string, DocumentState>, storeDocuments: DocumentRecord[]): Map<string, DocumentState>;
|
|
11
|
+
//# sourceMappingURL=document-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-state.d.ts","sourceRoot":"","sources":["../../../src/project/state/document-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE9D;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,aAAa,CAW1E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EACjC,cAAc,EAAE,cAAc,EAAE,GAC9B,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAgB5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/project/state/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { DocumentActivity, ExtensionModules } from '../document';
|
|
2
|
+
import { Store } from '../store/store.types';
|
|
3
|
+
import { AnyDialecteConfig, ChunkOptions, TransactionHooks } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* DocumentRecord - metadata entry for a file registered in a Project.
|
|
6
|
+
*
|
|
7
|
+
* Stored in the `_files` table. Each file gets its own `xel_{id}` table
|
|
8
|
+
* for XML records (created/dropped via dynamic Dexie versioning).
|
|
9
|
+
*/
|
|
10
|
+
export type DocumentRecord = {
|
|
11
|
+
/** Primary key - crypto.randomUUID() */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Original filename without extension */
|
|
14
|
+
name: string;
|
|
15
|
+
/** File extension including leading dot (e.g. ".scd", ".icd", ".nsd") */
|
|
16
|
+
extension: string;
|
|
17
|
+
/** Key into Project's config registry - determines which DialecteConfig applies */
|
|
18
|
+
configKey: string;
|
|
19
|
+
/** Timestamp of file registration */
|
|
20
|
+
createdAt: number;
|
|
21
|
+
/** Extensible per-file metadata, populated by config.extractMetadata at import */
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* DocumentState - observable state for a single document within a Project.
|
|
26
|
+
* Extends DocumentActivity with project-level fields.
|
|
27
|
+
*/
|
|
28
|
+
export type DocumentState = DocumentActivity & {
|
|
29
|
+
document: DocumentRecord;
|
|
30
|
+
canUndo: boolean;
|
|
31
|
+
canRedo: boolean;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* ProjectState - top-level observable state for a Project.
|
|
35
|
+
* In Vue: reactive(project.state) makes all fields trigger re-renders.
|
|
36
|
+
*/
|
|
37
|
+
export type ProjectState = {
|
|
38
|
+
documents: Map<string, DocumentState>;
|
|
39
|
+
activeTransactions: number;
|
|
40
|
+
};
|
|
41
|
+
export type StorageParam = {
|
|
42
|
+
type: 'local';
|
|
43
|
+
} | {
|
|
44
|
+
type: 'custom';
|
|
45
|
+
store: Store;
|
|
46
|
+
};
|
|
47
|
+
export type ProjectOpenParams<GenericConfig extends AnyDialecteConfig, BaseExtensions extends ExtensionModules = Record<never, never>, CustomExtensions extends ExtensionModules = Record<never, never>> = {
|
|
48
|
+
/** Project name - used as the database/store name */
|
|
49
|
+
name: string;
|
|
50
|
+
/**
|
|
51
|
+
* Config registry keyed by label.
|
|
52
|
+
* Single-dialect: { scl: sclConfig }
|
|
53
|
+
* Multi-dialect: { nsd: nsdConfig, nsdoc: nsdocConfig }
|
|
54
|
+
*/
|
|
55
|
+
configs: Record<string, GenericConfig>;
|
|
56
|
+
/** Used when configKey is omitted in createDocument. Defaults to first key. */
|
|
57
|
+
defaultConfigKey?: string;
|
|
58
|
+
/** Storage backend. 'local' uses DexieStore; 'custom' brings your own Store. */
|
|
59
|
+
storage: StorageParam;
|
|
60
|
+
/** Extensions applied to all Documents opened from this Project */
|
|
61
|
+
extensions?: {
|
|
62
|
+
base?: BaseExtensions;
|
|
63
|
+
custom?: CustomExtensions;
|
|
64
|
+
};
|
|
65
|
+
/** Transaction hooks applied to all Documents */
|
|
66
|
+
hooks?: TransactionHooks<GenericConfig>;
|
|
67
|
+
};
|
|
68
|
+
export type InitEmptyDocumentOptions = {
|
|
69
|
+
/** Filename without extension. Defaults to 'untitled'. */
|
|
70
|
+
name?: string;
|
|
71
|
+
/** File extension including leading dot. Defaults to config's first supported extension. */
|
|
72
|
+
extension?: string;
|
|
73
|
+
/** Key into configs registry. Defaults to defaultConfigKey or first key. */
|
|
74
|
+
configKey?: string;
|
|
75
|
+
/** Extensible per-file metadata */
|
|
76
|
+
metadata?: Record<string, unknown>;
|
|
77
|
+
};
|
|
78
|
+
export type InitEmptyDocumentParams = {
|
|
79
|
+
store: Store;
|
|
80
|
+
configs: Record<string, AnyDialecteConfig>;
|
|
81
|
+
defaultConfigKey: string;
|
|
82
|
+
options?: InitEmptyDocumentOptions;
|
|
83
|
+
};
|
|
84
|
+
export type InitEmptyDocumentResult = {
|
|
85
|
+
documentId: string;
|
|
86
|
+
document: DocumentRecord;
|
|
87
|
+
documentState: DocumentState;
|
|
88
|
+
};
|
|
89
|
+
export type ImportDocumentOptions = {
|
|
90
|
+
/** Key into configs registry. Defaults to defaultConfigKey. */
|
|
91
|
+
configKey?: string;
|
|
92
|
+
/** Extensible per-file metadata */
|
|
93
|
+
metadata?: Record<string, unknown>;
|
|
94
|
+
/** Override chunking defaults for SAX streaming */
|
|
95
|
+
chunkOptions?: Partial<ChunkOptions>;
|
|
96
|
+
/** Use custom record IDs from XML attributes instead of generating UUIDs */
|
|
97
|
+
useCustomRecordsIds?: boolean;
|
|
98
|
+
};
|
|
99
|
+
export type ImportDocumentParams = {
|
|
100
|
+
file: File;
|
|
101
|
+
store: Store;
|
|
102
|
+
configs: Record<string, AnyDialecteConfig>;
|
|
103
|
+
defaultConfigKey: string;
|
|
104
|
+
options?: ImportDocumentOptions;
|
|
105
|
+
};
|
|
106
|
+
export type ImportDocumentResult = {
|
|
107
|
+
documentId: string;
|
|
108
|
+
document: DocumentRecord;
|
|
109
|
+
documentState: DocumentState;
|
|
110
|
+
recordCount: number;
|
|
111
|
+
};
|
|
112
|
+
export type ExportDocumentParams = {
|
|
113
|
+
documentId: string;
|
|
114
|
+
state: ProjectState;
|
|
115
|
+
configs: Record<string, AnyDialecteConfig>;
|
|
116
|
+
store: Store;
|
|
117
|
+
projectName: string;
|
|
118
|
+
options?: ExportDocumentOptions;
|
|
119
|
+
};
|
|
120
|
+
export type ExportDocumentOptions = {
|
|
121
|
+
/** Include internal database IDs in exported XML */
|
|
122
|
+
withDatabaseIds?: boolean;
|
|
123
|
+
};
|
|
124
|
+
export type ExportDocumentResult = {
|
|
125
|
+
xmlDocument: XMLDocument;
|
|
126
|
+
filename: string;
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/project/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAIhF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAA;IACV,0CAA0C;I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