@dialecte/core 0.2.12 → 0.2.15
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 +2 -2
- package/dist/document/bind-extensions.d.ts.map +1 -1
- package/dist/document/index.d.ts +1 -0
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/query/get/tree/get-tree.d.ts.map +1 -1
- package/dist/document/types.extensions.d.ts +16 -8
- package/dist/document/types.extensions.d.ts.map +1 -1
- package/dist/errors/codes.d.ts +12 -0
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/helpers.d.ts +1 -1
- package/dist/helpers.js +162 -30
- package/dist/index.js +3 -49
- package/dist/project/index.d.ts +3 -2
- package/dist/project/index.d.ts.map +1 -1
- package/dist/project/io/export-blob.d.ts +7 -0
- package/dist/project/io/export-blob.d.ts.map +1 -0
- package/dist/project/io/index.d.ts +1 -0
- package/dist/project/io/index.d.ts.map +1 -1
- package/dist/project/project.d.ts +26 -2
- package/dist/project/project.d.ts.map +1 -1
- package/dist/project/types.d.ts +15 -1
- package/dist/project/types.d.ts.map +1 -1
- package/dist/project-BOM3Ipbu.js +7744 -0
- package/dist/store/in-memory/in-memory-store.d.ts +18 -1
- package/dist/store/in-memory/in-memory-store.d.ts.map +1 -1
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/local/dexie-store.d.ts +15 -1
- package/dist/store/local/dexie-store.d.ts.map +1 -1
- package/dist/store/store.constants.d.ts +10 -0
- package/dist/store/store.constants.d.ts.map +1 -1
- package/dist/store/store.types.d.ts +26 -1
- package/dist/store/store.types.d.ts.map +1 -1
- package/dist/test.d.ts +1 -1
- package/dist/test.js +2849 -1705
- package/dist/types/blob.d.ts +35 -0
- package/dist/types/blob.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/save-to-disk.d.ts +17 -0
- package/dist/utils/save-to-disk.d.ts.map +1 -0
- package/dist/utils-B_-lXlpE.js +177 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +2 -4
- package/dist/xml/build/download-file.d.ts.map +1 -1
- package/package.json +15 -16
- package/dist/index-BgyMtFE-.js +0 -150
- package/dist/index-Bvh3Qxyf.js +0 -7015
- package/dist/merge-extensions-CU05iRtz.js +0 -172
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BlobRecord — registry entry for a binary attachment stored alongside XML documents.
|
|
3
|
+
*
|
|
4
|
+
* The binary data lives in a partitioned table `blob_{documentId}` (storage owner).
|
|
5
|
+
* `attachedTo` describes logical references from XML records; the array is independent
|
|
6
|
+
* of the storage owner and may include zero (standalone), one, or many references.
|
|
7
|
+
*/
|
|
8
|
+
export type BlobAttachment = {
|
|
9
|
+
/** The XML document this blob is referenced from */
|
|
10
|
+
documentId: string;
|
|
11
|
+
/** Record id (e.g. element uuid) inside that document */
|
|
12
|
+
recordRef: string;
|
|
13
|
+
/** Optional attribute name on the record where the filename is referenced */
|
|
14
|
+
attribute?: string;
|
|
15
|
+
};
|
|
16
|
+
export type BlobRecord = {
|
|
17
|
+
/** Blob identifier (crypto.randomUUID()) */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Storage owner: binary data lives in `blob_{documentId}` */
|
|
20
|
+
documentId: string;
|
|
21
|
+
/** Original filename (e.g. "diagram.pdf") */
|
|
22
|
+
name: string;
|
|
23
|
+
/** MIME type (e.g. "application/pdf") */
|
|
24
|
+
mimeType?: string;
|
|
25
|
+
/** Size in bytes, for UI display without loading data */
|
|
26
|
+
size?: number;
|
|
27
|
+
/** Creation timestamp (ms since epoch) */
|
|
28
|
+
createdAt: number;
|
|
29
|
+
/**
|
|
30
|
+
* Logical references from XML records.
|
|
31
|
+
* Empty array = standalone project blob (not linked to any XML record).
|
|
32
|
+
*/
|
|
33
|
+
attachedTo: BlobAttachment[];
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=blob.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blob.d.ts","sourceRoot":"","sources":["../../src/types/blob.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAA;IAClB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAA;IACjB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACxB,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAA;IACV,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAA;IACZ,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,UAAU,EAAE,cAAc,EAAE,CAAA;CAC5B,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,mBAAmB,CAAA;AACtC,mBAAmB,WAAW,CAAA;AAC9B,mBAAmB,cAAc,CAAA;AACjC,mBAAmB,MAAM,CAAA;AACzB,mBAAmB,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,mBAAmB,CAAA;AACtC,mBAAmB,WAAW,CAAA;AAC9B,mBAAmB,cAAc,CAAA;AACjC,mBAAmB,MAAM,CAAA;AACzB,mBAAmB,cAAc,CAAA;AACjC,mBAAmB,QAAQ,CAAA"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Save a Blob to disk using the native File System Access API when available
|
|
3
|
+
* (Chrome / Edge) and falling back to a hidden anchor download (Safari /
|
|
4
|
+
* Firefox).
|
|
5
|
+
*
|
|
6
|
+
* Browser-only: relies on `window`, `document`, and `URL`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function saveToDisk(params: {
|
|
9
|
+
data: Blob;
|
|
10
|
+
filename: string;
|
|
11
|
+
/** Optional picker type descriptor for `showSaveFilePicker`. */
|
|
12
|
+
pickerType?: {
|
|
13
|
+
description: string;
|
|
14
|
+
accept: Record<string, string[]>;
|
|
15
|
+
};
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=save-to-disk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-to-disk.d.ts","sourceRoot":"","sources":["../../src/utils/save-to-disk.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE;IACxC,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,gEAAgE;IAChE,UAAU,CAAC,EAAE;QACZ,WAAW,EAAE,MAAM,CAAA;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;KAChC,CAAA;CACD,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BhB"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
//#region src/errors/codes.ts
|
|
2
|
+
var e = {
|
|
3
|
+
UNKNOWN: {
|
|
4
|
+
code: "D0001",
|
|
5
|
+
message: "An unknown error occurred"
|
|
6
|
+
},
|
|
7
|
+
ASSERTION_FAILED: {
|
|
8
|
+
code: "D0002",
|
|
9
|
+
message: "Assertion failed"
|
|
10
|
+
},
|
|
11
|
+
STORE_CONNECTION_FAILED: {
|
|
12
|
+
code: "D1001",
|
|
13
|
+
message: "Failed to open database"
|
|
14
|
+
},
|
|
15
|
+
STORE_COMMIT_FAILED: {
|
|
16
|
+
code: "D1002",
|
|
17
|
+
message: "Failed to commit changes"
|
|
18
|
+
},
|
|
19
|
+
STORE_RECORD_NOT_FOUND: {
|
|
20
|
+
code: "D1003",
|
|
21
|
+
message: "Record not found in database"
|
|
22
|
+
},
|
|
23
|
+
STORE_BULK_ADD_FAILED: {
|
|
24
|
+
code: "D1004",
|
|
25
|
+
message: "Failed to add records to database"
|
|
26
|
+
},
|
|
27
|
+
STORE_BULK_UPDATE_FAILED: {
|
|
28
|
+
code: "D1005",
|
|
29
|
+
message: "Failed to update records in database"
|
|
30
|
+
},
|
|
31
|
+
STORE_DELETE_FAILED: {
|
|
32
|
+
code: "D1006",
|
|
33
|
+
message: "Failed to delete records from database"
|
|
34
|
+
},
|
|
35
|
+
STORE_NOT_WRITABLE: {
|
|
36
|
+
code: "D1007",
|
|
37
|
+
message: "Store is not writable"
|
|
38
|
+
},
|
|
39
|
+
STORE_BLOB_NOT_FOUND: {
|
|
40
|
+
code: "D1008",
|
|
41
|
+
message: "Blob not found"
|
|
42
|
+
},
|
|
43
|
+
ELEMENT_NOT_FOUND: {
|
|
44
|
+
code: "D2001",
|
|
45
|
+
message: "Element not found"
|
|
46
|
+
},
|
|
47
|
+
ROOT_NOT_FOUND: {
|
|
48
|
+
code: "D2002",
|
|
49
|
+
message: "Root element not found"
|
|
50
|
+
},
|
|
51
|
+
DUPLICATE_ID: {
|
|
52
|
+
code: "D2003",
|
|
53
|
+
message: "Duplicate element ID"
|
|
54
|
+
},
|
|
55
|
+
ELEMENT_TAGNAME_MISMATCH: {
|
|
56
|
+
code: "D2004",
|
|
57
|
+
message: "Element tagName does not match the expected type"
|
|
58
|
+
},
|
|
59
|
+
INVALID_PARENT_CHILD: {
|
|
60
|
+
code: "D3001",
|
|
61
|
+
message: "Invalid parent-child relationship"
|
|
62
|
+
},
|
|
63
|
+
INVALID_ATTRIBUTE: {
|
|
64
|
+
code: "D3002",
|
|
65
|
+
message: "Invalid attribute for element"
|
|
66
|
+
},
|
|
67
|
+
PROTECTED_ROOT: {
|
|
68
|
+
code: "D3003",
|
|
69
|
+
message: "Root element cannot be deleted"
|
|
70
|
+
},
|
|
71
|
+
REQUIRED_ATTRIBUTE_MISSING: {
|
|
72
|
+
code: "D3004",
|
|
73
|
+
message: "Required attribute is missing"
|
|
74
|
+
},
|
|
75
|
+
UNIQUE_CONSTRAINT_VIOLATION: {
|
|
76
|
+
code: "D3005",
|
|
77
|
+
message: "Value is already used within its scope"
|
|
78
|
+
},
|
|
79
|
+
ALREADY_COMMITTED: {
|
|
80
|
+
code: "D4001",
|
|
81
|
+
message: "Transaction already committed"
|
|
82
|
+
},
|
|
83
|
+
ALREADY_FAILED: {
|
|
84
|
+
code: "D4002",
|
|
85
|
+
message: "Transaction already failed"
|
|
86
|
+
},
|
|
87
|
+
DATABASE_COMMIT_ERROR: {
|
|
88
|
+
code: "D4003",
|
|
89
|
+
message: "An error occurred while committing changes to the database"
|
|
90
|
+
},
|
|
91
|
+
CONCURRENT_TRANSACTION: {
|
|
92
|
+
code: "D4004",
|
|
93
|
+
message: "A transaction is already in progress. Concurrent transactions are not supported yet — serialize them or implement a transaction queue."
|
|
94
|
+
},
|
|
95
|
+
EXPORT_ROOT_NOT_FOUND: {
|
|
96
|
+
code: "D5001",
|
|
97
|
+
message: "Root element not found in records during export"
|
|
98
|
+
},
|
|
99
|
+
EXPORT_ORPHAN_CHILD_REF: {
|
|
100
|
+
code: "D5002",
|
|
101
|
+
message: "Parent references non-existent child record"
|
|
102
|
+
},
|
|
103
|
+
EXTENSION_METHOD_COLLISION: {
|
|
104
|
+
code: "D6001",
|
|
105
|
+
message: "Extension method name collision detected"
|
|
106
|
+
},
|
|
107
|
+
UNKNOWN_CONFIG_KEY: {
|
|
108
|
+
code: "D7001",
|
|
109
|
+
message: "Unknown config key"
|
|
110
|
+
},
|
|
111
|
+
DOCUMENT_NOT_REGISTERED: {
|
|
112
|
+
code: "D7002",
|
|
113
|
+
message: "Document not registered in project"
|
|
114
|
+
},
|
|
115
|
+
PROJECT_NOT_OPENED: {
|
|
116
|
+
code: "D7003",
|
|
117
|
+
message: "Project not opened"
|
|
118
|
+
},
|
|
119
|
+
BLOB_NOT_FOUND: {
|
|
120
|
+
code: "D7004",
|
|
121
|
+
message: "Blob not found in store"
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/errors/errors.ts
|
|
126
|
+
function t(t, r) {
|
|
127
|
+
let i = e[t], a = {
|
|
128
|
+
code: i.code,
|
|
129
|
+
key: t,
|
|
130
|
+
message: r.message ?? i.message,
|
|
131
|
+
detail: r.detail,
|
|
132
|
+
method: n((/* @__PURE__ */ Error()).stack),
|
|
133
|
+
ref: r.ref,
|
|
134
|
+
cause: r.cause
|
|
135
|
+
}, o = Error(r.detail);
|
|
136
|
+
throw o.cause = a, o;
|
|
137
|
+
}
|
|
138
|
+
function n(e) {
|
|
139
|
+
if (!e) return "unknown";
|
|
140
|
+
let t = e.split("\n").slice(1).find((e) => !/\b(throwDialecteError|assert)\b/.test(e));
|
|
141
|
+
if (!t) return "unknown";
|
|
142
|
+
let n = t.match(/\bat\s+(\S+)\s+\(([^)]+)\)/), r = n?.[1], i = n?.[2];
|
|
143
|
+
if (!i || !r) return r ?? "unknown";
|
|
144
|
+
let a = i.match(/(\w[\w-]*\/src\/[^?:]+)/);
|
|
145
|
+
return a ? `${a[1].replace(/\.[^/.]+$/, "")}::${r}` : r;
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/utils/invariant.ts
|
|
149
|
+
function r(e, n) {
|
|
150
|
+
if (e) return;
|
|
151
|
+
let { detail: r, key: i = "ASSERTION_FAILED", ref: a } = n;
|
|
152
|
+
t(i, {
|
|
153
|
+
detail: r,
|
|
154
|
+
ref: a
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/utils/save-to-disk.ts
|
|
159
|
+
async function i(e) {
|
|
160
|
+
let { data: t, filename: n, pickerType: r } = e;
|
|
161
|
+
if ("showSaveFilePicker" in window) try {
|
|
162
|
+
let e = await (await window.showSaveFilePicker({
|
|
163
|
+
suggestedName: n,
|
|
164
|
+
...r ? { types: [r] } : {}
|
|
165
|
+
})).createWritable();
|
|
166
|
+
await e.write(t), await e.close();
|
|
167
|
+
return;
|
|
168
|
+
} catch (e) {
|
|
169
|
+
if (e.name === "AbortError") return;
|
|
170
|
+
console.error("Save failed:", e);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
let i = URL.createObjectURL(t), a = document.createElement("a");
|
|
174
|
+
a.href = i, a.download = n, document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(i);
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
export { e as i, r as n, t as r, i as t };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './utils/index'
|
|
1
|
+
export * from './utils/index.js'
|
|
2
2
|
export {}
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-file.d.ts","sourceRoot":"","sources":["../../../src/xml/build/download-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"download-file.d.ts","sourceRoot":"","sources":["../../../src/xml/build/download-file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD,wBAAsB,YAAY,CAAC,aAAa,SAAS,iBAAiB,EAAE,MAAM,EAAE;IACnF,SAAS,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAA;IACjE,WAAW,EAAE,WAAW,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;CAChB,iBAoBA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dialecte/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
4
4
|
"description": "Dialecte - Core functionality for Dialecte SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -56,25 +56,24 @@
|
|
|
56
56
|
"xml-formatter": "^3.6.7"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@tsconfig/
|
|
60
|
-
"@types/node": "^
|
|
59
|
+
"@tsconfig/node24": "^24.0.4",
|
|
60
|
+
"@types/node": "^24.12.4",
|
|
61
61
|
"@types/sax": "^1.2.7",
|
|
62
|
-
"@vitest/browser": "^
|
|
62
|
+
"@vitest/browser-playwright": "^4.1.8",
|
|
63
63
|
"@xmldom/xmldom": "^0.8.11",
|
|
64
64
|
"husky": "^9.1.7",
|
|
65
65
|
"jiti": "^2.4.2",
|
|
66
66
|
"npm-run-all2": "^8.0.4",
|
|
67
|
-
"oxfmt": "^0.
|
|
68
|
-
"oxlint": "^1.
|
|
69
|
-
"oxlint-tsgolint": "^0.
|
|
70
|
-
"playwright": "^1.
|
|
71
|
-
"tsx": "^4.
|
|
72
|
-
"typescript": "^
|
|
73
|
-
"vite": "^
|
|
74
|
-
"vite-plugin-dts": "^
|
|
75
|
-
"vitepress": "^2.0.0-alpha.
|
|
76
|
-
"vitepress-plugin-llms": "^1.
|
|
77
|
-
"vitest": "^
|
|
78
|
-
"vitest-browser-vue": "^1.0.0"
|
|
67
|
+
"oxfmt": "^0.53.0",
|
|
68
|
+
"oxlint": "^1.68.0",
|
|
69
|
+
"oxlint-tsgolint": "^0.23.0",
|
|
70
|
+
"playwright": "^1.60.0",
|
|
71
|
+
"tsx": "^4.22.4",
|
|
72
|
+
"typescript": "^6.0.3",
|
|
73
|
+
"vite": "^8.0.16",
|
|
74
|
+
"vite-plugin-dts": "^5.0.2",
|
|
75
|
+
"vitepress": "^2.0.0-alpha.17",
|
|
76
|
+
"vitepress-plugin-llms": "^1.13.1",
|
|
77
|
+
"vitest": "^4.1.8"
|
|
79
78
|
}
|
|
80
79
|
}
|
package/dist/index-BgyMtFE-.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
const c = {
|
|
2
|
-
// D0xxx — Generic
|
|
3
|
-
UNKNOWN: {
|
|
4
|
-
code: "D0001",
|
|
5
|
-
message: "An unknown error occurred"
|
|
6
|
-
},
|
|
7
|
-
ASSERTION_FAILED: {
|
|
8
|
-
code: "D0002",
|
|
9
|
-
message: "Assertion failed"
|
|
10
|
-
},
|
|
11
|
-
// D1xxx — Store/persistence
|
|
12
|
-
STORE_CONNECTION_FAILED: {
|
|
13
|
-
code: "D1001",
|
|
14
|
-
message: "Failed to open database"
|
|
15
|
-
},
|
|
16
|
-
STORE_COMMIT_FAILED: {
|
|
17
|
-
code: "D1002",
|
|
18
|
-
message: "Failed to commit changes"
|
|
19
|
-
},
|
|
20
|
-
STORE_RECORD_NOT_FOUND: {
|
|
21
|
-
code: "D1003",
|
|
22
|
-
message: "Record not found in database"
|
|
23
|
-
},
|
|
24
|
-
STORE_BULK_ADD_FAILED: {
|
|
25
|
-
code: "D1004",
|
|
26
|
-
message: "Failed to add records to database"
|
|
27
|
-
},
|
|
28
|
-
STORE_BULK_UPDATE_FAILED: {
|
|
29
|
-
code: "D1005",
|
|
30
|
-
message: "Failed to update records in database"
|
|
31
|
-
},
|
|
32
|
-
STORE_DELETE_FAILED: {
|
|
33
|
-
code: "D1006",
|
|
34
|
-
message: "Failed to delete records from database"
|
|
35
|
-
},
|
|
36
|
-
STORE_NOT_WRITABLE: {
|
|
37
|
-
code: "D1007",
|
|
38
|
-
message: "Store is not writable"
|
|
39
|
-
},
|
|
40
|
-
// D2xxx — Element lookup
|
|
41
|
-
ELEMENT_NOT_FOUND: {
|
|
42
|
-
code: "D2001",
|
|
43
|
-
message: "Element not found"
|
|
44
|
-
},
|
|
45
|
-
ROOT_NOT_FOUND: {
|
|
46
|
-
code: "D2002",
|
|
47
|
-
message: "Root element not found"
|
|
48
|
-
},
|
|
49
|
-
DUPLICATE_ID: {
|
|
50
|
-
code: "D2003",
|
|
51
|
-
message: "Duplicate element ID"
|
|
52
|
-
},
|
|
53
|
-
ELEMENT_TAGNAME_MISMATCH: {
|
|
54
|
-
code: "D2004",
|
|
55
|
-
message: "Element tagName does not match the expected type"
|
|
56
|
-
},
|
|
57
|
-
// D3xxx — Constraint violations
|
|
58
|
-
INVALID_PARENT_CHILD: {
|
|
59
|
-
code: "D3001",
|
|
60
|
-
message: "Invalid parent-child relationship"
|
|
61
|
-
},
|
|
62
|
-
INVALID_ATTRIBUTE: {
|
|
63
|
-
code: "D3002",
|
|
64
|
-
message: "Invalid attribute for element"
|
|
65
|
-
},
|
|
66
|
-
PROTECTED_ROOT: {
|
|
67
|
-
code: "D3003",
|
|
68
|
-
message: "Root element cannot be deleted"
|
|
69
|
-
},
|
|
70
|
-
REQUIRED_ATTRIBUTE_MISSING: {
|
|
71
|
-
code: "D3004",
|
|
72
|
-
message: "Required attribute is missing"
|
|
73
|
-
},
|
|
74
|
-
// D4xxx — Transaction lifecycle
|
|
75
|
-
ALREADY_COMMITTED: {
|
|
76
|
-
code: "D4001",
|
|
77
|
-
message: "Transaction already committed"
|
|
78
|
-
},
|
|
79
|
-
ALREADY_FAILED: {
|
|
80
|
-
code: "D4002",
|
|
81
|
-
message: "Transaction already failed"
|
|
82
|
-
},
|
|
83
|
-
DATABASE_COMMIT_ERROR: {
|
|
84
|
-
code: "D4003",
|
|
85
|
-
message: "An error occurred while committing changes to the database"
|
|
86
|
-
},
|
|
87
|
-
CONCURRENT_TRANSACTION: {
|
|
88
|
-
code: "D4004",
|
|
89
|
-
message: "A transaction is already in progress. Concurrent transactions are not supported yet — serialize them or implement a transaction queue."
|
|
90
|
-
},
|
|
91
|
-
// D5xxx — Import/Export
|
|
92
|
-
EXPORT_ROOT_NOT_FOUND: {
|
|
93
|
-
code: "D5001",
|
|
94
|
-
message: "Root element not found in records during export"
|
|
95
|
-
},
|
|
96
|
-
EXPORT_ORPHAN_CHILD_REF: {
|
|
97
|
-
code: "D5002",
|
|
98
|
-
message: "Parent references non-existent child record"
|
|
99
|
-
},
|
|
100
|
-
// D6xxx — Config
|
|
101
|
-
EXTENSION_METHOD_COLLISION: {
|
|
102
|
-
code: "D6001",
|
|
103
|
-
message: "Extension method name collision detected"
|
|
104
|
-
},
|
|
105
|
-
// D7xxx — Project
|
|
106
|
-
UNKNOWN_CONFIG_KEY: {
|
|
107
|
-
code: "D7001",
|
|
108
|
-
message: "Unknown config key"
|
|
109
|
-
},
|
|
110
|
-
DOCUMENT_NOT_REGISTERED: {
|
|
111
|
-
code: "D7002",
|
|
112
|
-
message: "Document not registered in project"
|
|
113
|
-
},
|
|
114
|
-
PROJECT_NOT_OPENED: {
|
|
115
|
-
code: "D7003",
|
|
116
|
-
message: "Project not opened"
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
function d(o, e) {
|
|
120
|
-
const s = c[o], t = {
|
|
121
|
-
code: s.code,
|
|
122
|
-
key: o,
|
|
123
|
-
message: e.message ?? s.message,
|
|
124
|
-
detail: e.detail,
|
|
125
|
-
method: i(new Error().stack),
|
|
126
|
-
ref: e.ref,
|
|
127
|
-
cause: e.cause
|
|
128
|
-
}, a = new Error(e.detail);
|
|
129
|
-
throw a.cause = t, a;
|
|
130
|
-
}
|
|
131
|
-
function i(o) {
|
|
132
|
-
if (!o) return "unknown";
|
|
133
|
-
const e = o.split(`
|
|
134
|
-
`).slice(1).find((r) => !/\b(throwDialecteError|assert)\b/.test(r));
|
|
135
|
-
if (!e) return "unknown";
|
|
136
|
-
const s = e.match(/\bat\s+(\S+)\s+\(([^)]+)\)/), t = s?.[1], a = s?.[2];
|
|
137
|
-
if (!a || !t) return t ?? "unknown";
|
|
138
|
-
const n = a.match(/(\w[\w-]*\/src\/[^?:]+)/);
|
|
139
|
-
return n ? `${n[1].replace(/\.[^/.]+$/, "")}::${t}` : t;
|
|
140
|
-
}
|
|
141
|
-
function D(o, e) {
|
|
142
|
-
if (o) return;
|
|
143
|
-
const { detail: s, key: t = "ASSERTION_FAILED", ref: a } = e;
|
|
144
|
-
d(t, { detail: s, ref: a });
|
|
145
|
-
}
|
|
146
|
-
export {
|
|
147
|
-
c as E,
|
|
148
|
-
D as i,
|
|
149
|
-
d as t
|
|
150
|
-
};
|