@dialecte/core 0.2.16 → 0.2.18

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.
@@ -99,6 +99,10 @@ export declare const ERROR_CATALOG: {
99
99
  readonly code: "D5002";
100
100
  readonly message: "Parent references non-existent child record";
101
101
  };
102
+ readonly PARSE_ERROR: {
103
+ readonly code: "D5003";
104
+ readonly message: "Failed to parse XML";
105
+ };
102
106
  readonly EXTENSION_METHOD_COLLISION: {
103
107
  readonly code: "D6001";
104
108
  readonly message: "Extension method name collision detected";
@@ -1 +1 @@
1
- {"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/errors/codes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyIhB,CAAA"}
1
+ {"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/errors/codes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6IhB,CAAA"}
@@ -4,4 +4,19 @@ export declare const DIALECTE_DEV_NAMESPACE: {
4
4
  prefix: string;
5
5
  };
6
6
  export declare const CUSTOM_RECORD_ID_ATTRIBUTE: string;
7
+ export declare const XSI_NAMESPACE: {
8
+ uri: string;
9
+ prefix: string;
10
+ };
11
+ export declare const XMLNS_XSI_NAMESPACE: string;
12
+ export declare const DIALECTE_NAMESPACES: {
13
+ dev: {
14
+ uri: string;
15
+ prefix: string;
16
+ };
17
+ xsi: {
18
+ uri: string;
19
+ prefix: string;
20
+ };
21
+ };
7
22
  //# sourceMappingURL=constant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/helpers/constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,+BAA+B,UAAU,CAAA;AAEtD,eAAO,MAAM,sBAAsB;;;CAGlC,CAAA;AAED,eAAO,MAAM,0BAA0B,QAAwE,CAAA"}
1
+ {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/helpers/constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,+BAA+B,UAAU,CAAA;AAEtD,eAAO,MAAM,sBAAsB;;;CAGlC,CAAA;AAED,eAAO,MAAM,0BAA0B,QAAwE,CAAA;AAE/G,eAAO,MAAM,aAAa;;;CAGzB,CAAA;AAED,eAAO,MAAM,mBAAmB,QAAyD,CAAA;AAEzF,eAAO,MAAM,mBAAmB;;;;;;;;;CAG/B,CAAA"}
package/dist/helpers.js CHANGED
@@ -1,9 +1,15 @@
1
- import { n as e } from "./utils-B_-lXlpE.js";
1
+ import { n as e } from "./utils-CmyVTqDb.js";
2
2
  //#region src/helpers/constant.ts
3
3
  var t = "db-id", n = {
4
4
  uri: "http://dialecte.dev/XML/DEV",
5
5
  prefix: "dev"
6
- }, r = `${n.prefix}:${t}`, i = [
6
+ }, r = `${n.prefix}:${t}`, i = {
7
+ uri: "http://www.w3.org/2001/XMLSchema-instance",
8
+ prefix: "xsi"
9
+ }, a = `xmlns:${i.prefix}="${i.uri}"`, o = {
10
+ dev: n,
11
+ xsi: i
12
+ }, s = [
7
13
  "id",
8
14
  "tagName",
9
15
  "namespace",
@@ -11,42 +17,42 @@ var t = "db-id", n = {
11
17
  "children",
12
18
  "parent",
13
19
  "value"
14
- ], a = [...i, "status"], o = [...a, "tree"];
15
- function s(e, t) {
20
+ ], c = [...s, "status"], l = [...c, "tree"];
21
+ function u(e, t) {
16
22
  if (typeof e != "object" || !e) return !1;
17
23
  let n = Object.keys(e);
18
24
  return t.every((t) => t in e) && n.every((e) => t.includes(e)) && n.length === t.length;
19
25
  }
20
- function c(e) {
26
+ function d(e) {
21
27
  return Array.isArray(e);
22
28
  }
23
- function l(e) {
24
- return s(e, i);
29
+ function f(e) {
30
+ return u(e, s);
25
31
  }
26
- function u(e) {
27
- return s(e, a);
32
+ function p(e) {
33
+ return u(e, c);
28
34
  }
29
- function d(e) {
30
- return s(e, o);
35
+ function m(e) {
36
+ return u(e, l);
31
37
  }
32
- function f(e, t) {
38
+ function h(e, t) {
33
39
  return e.tagName === t;
34
40
  }
35
- function p(e, t) {
41
+ function g(e, t) {
36
42
  return e.tagName === t;
37
43
  }
38
- function m(e, t) {
44
+ function _(e, t) {
39
45
  return e.tagName === t;
40
46
  }
41
- function h(e, t) {
47
+ function v(e, t) {
42
48
  return t.elements.includes(e);
43
49
  }
44
- function g(e, t) {
50
+ function y(e, t) {
45
51
  return e.attributes.some((e) => e.name === t);
46
52
  }
47
53
  //#endregion
48
54
  //#region src/helpers/converter.ts
49
- function _(e) {
55
+ function b(e) {
50
56
  return {
51
57
  id: e.id,
52
58
  tagName: e.tagName,
@@ -57,32 +63,32 @@ function _(e) {
57
63
  children: e.children
58
64
  };
59
65
  }
60
- function v(e) {
66
+ function x(e) {
61
67
  let { record: t, status: n } = e, r = n ?? ("status" in t ? t.status : "unchanged");
62
68
  return {
63
- ..._(t),
69
+ ...b(t),
64
70
  status: r
65
71
  };
66
72
  }
67
- function y(e) {
73
+ function S(e) {
68
74
  let { record: t, status: n, tree: r } = e, i = r ?? ("tree" in t ? t.tree : []);
69
75
  return {
70
- ...v({
76
+ ...x({
71
77
  record: t,
72
78
  status: n
73
79
  }),
74
80
  tree: i
75
81
  };
76
82
  }
77
- function b(e) {
83
+ function C(e) {
78
84
  let { dialecteConfig: t, tagName: n, attributes: r } = e;
79
- return c(r) ? r : Object.entries(r).map(([e, r]) => ({
85
+ return d(r) ? r : Object.entries(r).map(([e, r]) => ({
80
86
  name: e,
81
87
  value: r,
82
88
  namespace: t.definition[n]?.attributes.details[e]?.namespace || void 0
83
89
  }));
84
90
  }
85
- function x(t) {
91
+ function w(t) {
86
92
  return e(t, { detail: "The record or ref is undefined" }), {
87
93
  id: t.id,
88
94
  tagName: t.tagName
@@ -90,8 +96,8 @@ function x(t) {
90
96
  }
91
97
  //#endregion
92
98
  //#region src/helpers/standardizing.ts
93
- function S(e) {
94
- let { dialecteConfig: t, hooks: n, record: r } = e, { id: i, tagName: a, attributes: o, namespace: s, value: c } = r, l = i ?? crypto.randomUUID(), u = o ? b({
99
+ function T(e) {
100
+ let { dialecteConfig: t, hooks: n, record: r } = e, { id: i, tagName: a, attributes: o, namespace: s, value: c } = r, l = i ?? crypto.randomUUID(), u = o ? C({
95
101
  tagName: a,
96
102
  attributes: o,
97
103
  dialecteConfig: t
@@ -124,7 +130,7 @@ function S(e) {
124
130
  }
125
131
  //#endregion
126
132
  //#region src/helpers/merge-extensions.ts
127
- function C(t, n, r, i) {
133
+ function E(t, n, r, i) {
128
134
  if (!t || !n) return;
129
135
  let a = Object.keys(n).filter((e) => e in t);
130
136
  e(a.length === 0, {
@@ -132,12 +138,12 @@ function C(t, n, r, i) {
132
138
  detail: `Module "${r}" has conflicting ${i} method(s): ${a.map((e) => `"${e}"`).join(", ")}`
133
139
  });
134
140
  }
135
- function w(e) {
141
+ function D(e) {
136
142
  let t = {}, n = {}, r = [...Object.entries(e.base ?? {}), ...Object.entries(e.custom ?? {})];
137
- for (let [e, i] of r) i.query && (C(t[e], i.query, e, "query"), t[e] = {
143
+ for (let [e, i] of r) i.query && (E(t[e], i.query, e, "query"), t[e] = {
138
144
  ...t[e],
139
145
  ...i.query
140
- }), i.transaction && (C(n[e], i.transaction, e, "transaction"), n[e] = {
146
+ }), i.transaction && (E(n[e], i.transaction, e, "transaction"), n[e] = {
141
147
  ...n[e],
142
148
  ...i.transaction
143
149
  });
@@ -148,15 +154,15 @@ function w(e) {
148
154
  }
149
155
  //#endregion
150
156
  //#region src/helpers/strip-attributes.ts
151
- function T(e, t) {
157
+ function O(e, t) {
152
158
  let n = new Set(t), r = {
153
159
  ...e,
154
160
  attributes: e.attributes.filter((e) => !n.has(e.name))
155
161
  };
156
162
  return "tree" in e ? {
157
163
  ...r,
158
- tree: e.tree.map((e) => T(e, t))
164
+ tree: e.tree.map((e) => O(e, t))
159
165
  } : r;
160
166
  }
161
167
  //#endregion
162
- export { r as CUSTOM_RECORD_ID_ATTRIBUTE, t as CUSTOM_RECORD_ID_ATTRIBUTE_NAME, n as DIALECTE_DEV_NAMESPACE, g as isAttributeOf, p as isChildOf, h as isElementOf, c as isFullAttributeArray, m as isParentOf, l as isRawRecord, f as isRecordOf, u as isTrackedRecord, d as isTreeRecord, w as mergeExtensions, S as standardizeRecord, T as stripAttributes, b as toFullAttributeArray, _ as toRawRecord, x as toRef, v as toTrackedRecord, y as toTreeRecord };
168
+ export { r as CUSTOM_RECORD_ID_ATTRIBUTE, t as CUSTOM_RECORD_ID_ATTRIBUTE_NAME, n as DIALECTE_DEV_NAMESPACE, o as DIALECTE_NAMESPACES, a as XMLNS_XSI_NAMESPACE, i as XSI_NAMESPACE, y as isAttributeOf, g as isChildOf, v as isElementOf, d as isFullAttributeArray, _ as isParentOf, f as isRawRecord, h as isRecordOf, p as isTrackedRecord, m as isTreeRecord, D as mergeExtensions, T as standardizeRecord, O as stripAttributes, C as toFullAttributeArray, b as toRawRecord, w as toRef, x as toTrackedRecord, S as toTreeRecord };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, O as m, P as h, R as g, S as _, T as v, U as y, V as b, W as x, X as S, Y as C, Z as w, _ as T, a as E, b as D, c as O, d as k, f as A, g as j, h as M, i as N, j as P, k as F, l as I, n as L, o as R, p as z, q as B, r as V, s as H, t as U, u as W, v as G, w as K, x as q, y as J, z as Y } from "./project-BOM3Ipbu.js";
2
- import { i as X, r as Z } from "./utils-B_-lXlpE.js";
3
- export { c as AnyQuery, h as AnyTransaction, G as BLOBS_SCHEMA, J as BLOB_DATA_SCHEMA, D as CHANGELOG_SCHEMA, q as DOCUMENTS_SCHEMA, T as DexieStore, P as Document, X as ERROR_CATALOG, j as InMemoryStore, _ as META_SCHEMA, I as ParseSession, U as Project, a as Query, n as TABLE_BLOBS, K as TABLE_BLOB_PREFIX, v as TABLE_CHANGELOG, i as TABLE_DOCUMENTS, r as TABLE_META, m as TABLE_RECORD_PREFIX, A as TEMP_IDB_ID_ATTRIBUTE_NAME, p as Transaction, w as bindExtensions, F as blobTableName, N as buildDocumentState, W as buildXmlDocument, k as downloadFile, R as exportBlob, H as exportDocument, o as findAncestors, y as findByAttributes, s as findDescendants, z as formatXml, t as getAttribute, b as getAttributeFullObject, g as getAttributes, Y as getAttributesFullObject, B as getChild, u as getChildren, S as getRecord, C as getRecords, l as getRecordsByTagName, d as getTree, V as importDocument, L as initEmptyDocument, f as isTransactionContext, x as matchesAttributeFilter, O as parseXmlFile, E as reconcileDocumentState, e as recordTableName, M as resolveStore, Z as throwDialecteError };
1
+ import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, O as m, P as h, Q as g, R as _, S as v, T as y, U as b, V as x, W as S, X as C, Y as w, Z as T, _ as E, a as D, b as O, c as k, d as A, f as j, g as M, i as N, j as P, k as F, l as I, m as L, n as R, o as z, p as B, q as V, r as H, s as U, t as W, u as G, v as K, w as q, x as J, y as Y, z as X } from "./project-BLDf8nj6.js";
2
+ import { i as Z, r as Q } from "./utils-CmyVTqDb.js";
3
+ export { d as AnyQuery, a as AnyTransaction, Y as BLOBS_SCHEMA, O as BLOB_DATA_SCHEMA, J as CHANGELOG_SCHEMA, v as DOCUMENTS_SCHEMA, K as DexieStore, f as Document, Z as ERROR_CATALOG, E as InMemoryStore, n as META_SCHEMA, I as ParseSession, W as Project, c as Query, q as TABLE_BLOBS, y as TABLE_BLOB_PREFIX, i as TABLE_CHANGELOG, r as TABLE_DOCUMENTS, m as TABLE_META, F as TABLE_RECORD_PREFIX, B as TEMP_IDB_ID_ATTRIBUTE_NAME, h as Transaction, g as bindExtensions, e as blobTableName, N as buildDocumentState, A as buildXmlDocument, j as downloadFile, z as exportBlob, U as exportDocument, u as findAncestors, S as findByAttributes, b as findDescendants, L as formatXml, x as getAttribute, s as getAttributeFullObject, X as getAttributes, t as getAttributesFullObject, l as getChild, V as getChildren, T as getRecord, C as getRecords, w as getRecordsByTagName, _ as getTree, H as importDocument, R as initEmptyDocument, G as inspectXml, p as isTransactionContext, o as matchesAttributeFilter, k as parseXmlFile, D as reconcileDocumentState, P as recordTableName, M as resolveStore, Q as throwDialecteError };