@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.
Files changed (51) hide show
  1. package/dist/document/bind-extensions.d.ts +2 -2
  2. package/dist/document/bind-extensions.d.ts.map +1 -1
  3. package/dist/document/index.d.ts +1 -0
  4. package/dist/document/index.d.ts.map +1 -1
  5. package/dist/document/query/get/tree/get-tree.d.ts.map +1 -1
  6. package/dist/document/types.extensions.d.ts +16 -8
  7. package/dist/document/types.extensions.d.ts.map +1 -1
  8. package/dist/errors/codes.d.ts +12 -0
  9. package/dist/errors/codes.d.ts.map +1 -1
  10. package/dist/helpers.d.ts +1 -1
  11. package/dist/helpers.js +162 -30
  12. package/dist/index.js +3 -49
  13. package/dist/project/index.d.ts +3 -2
  14. package/dist/project/index.d.ts.map +1 -1
  15. package/dist/project/io/export-blob.d.ts +7 -0
  16. package/dist/project/io/export-blob.d.ts.map +1 -0
  17. package/dist/project/io/index.d.ts +1 -0
  18. package/dist/project/io/index.d.ts.map +1 -1
  19. package/dist/project/project.d.ts +26 -2
  20. package/dist/project/project.d.ts.map +1 -1
  21. package/dist/project/types.d.ts +15 -1
  22. package/dist/project/types.d.ts.map +1 -1
  23. package/dist/project-BOM3Ipbu.js +7744 -0
  24. package/dist/store/in-memory/in-memory-store.d.ts +18 -1
  25. package/dist/store/in-memory/in-memory-store.d.ts.map +1 -1
  26. package/dist/store/index.d.ts +1 -1
  27. package/dist/store/index.d.ts.map +1 -1
  28. package/dist/store/local/dexie-store.d.ts +15 -1
  29. package/dist/store/local/dexie-store.d.ts.map +1 -1
  30. package/dist/store/store.constants.d.ts +10 -0
  31. package/dist/store/store.constants.d.ts.map +1 -1
  32. package/dist/store/store.types.d.ts +26 -1
  33. package/dist/store/store.types.d.ts.map +1 -1
  34. package/dist/test.d.ts +1 -1
  35. package/dist/test.js +2849 -1705
  36. package/dist/types/blob.d.ts +35 -0
  37. package/dist/types/blob.d.ts.map +1 -0
  38. package/dist/types/index.d.ts +1 -0
  39. package/dist/types/index.d.ts.map +1 -1
  40. package/dist/utils/index.d.ts +1 -0
  41. package/dist/utils/index.d.ts.map +1 -1
  42. package/dist/utils/save-to-disk.d.ts +17 -0
  43. package/dist/utils/save-to-disk.d.ts.map +1 -0
  44. package/dist/utils-B_-lXlpE.js +177 -0
  45. package/dist/utils.d.ts +1 -1
  46. package/dist/utils.js +2 -4
  47. package/dist/xml/build/download-file.d.ts.map +1 -1
  48. package/package.json +15 -16
  49. package/dist/index-BgyMtFE-.js +0 -150
  50. package/dist/index-Bvh3Qxyf.js +0 -7015
  51. package/dist/merge-extensions-CU05iRtz.js +0 -172
@@ -1,172 +0,0 @@
1
- import { i as E } from "./index-BgyMtFE-.js";
2
- const D = "db-id", v = {
3
- uri: "http://dialecte.dev/XML/DEV",
4
- prefix: "dev"
5
- }, $ = `${v.prefix}:${D}`, b = [
6
- "id",
7
- "tagName",
8
- "namespace",
9
- "attributes",
10
- "children",
11
- "parent",
12
- "value"
13
- ], A = [...b, "status"], S = [...A, "tree"];
14
- function d(e, t) {
15
- if (typeof e != "object" || e === null)
16
- return !1;
17
- const n = Object.keys(e);
18
- return t.every((a) => a in e) && n.every((a) => t.includes(a)) && n.length === t.length;
19
- }
20
- function I(e) {
21
- return Array.isArray(e);
22
- }
23
- function z(e) {
24
- return d(e, b);
25
- }
26
- function F(e) {
27
- return d(e, A);
28
- }
29
- function K(e) {
30
- return d(e, S);
31
- }
32
- function L(e, t) {
33
- return e.tagName === t;
34
- }
35
- function V(e, t) {
36
- return e.tagName === t;
37
- }
38
- function Y(e, t) {
39
- return e.tagName === t;
40
- }
41
- function w(e, t) {
42
- return t.elements.includes(e);
43
- }
44
- function B(e, t) {
45
- return e.attributes.some((n) => n.name === t);
46
- }
47
- function M(e) {
48
- return {
49
- id: e.id,
50
- tagName: e.tagName,
51
- namespace: e.namespace,
52
- attributes: e.attributes,
53
- value: e.value,
54
- parent: e.parent,
55
- children: e.children
56
- };
57
- }
58
- function j(e) {
59
- const { record: t, status: n } = e, a = n ?? ("status" in t ? t.status : "unchanged");
60
- return {
61
- ...M(t),
62
- status: a
63
- };
64
- }
65
- function P(e) {
66
- const { record: t, status: n, tree: a } = e, r = a ?? ("tree" in t ? t.tree : []);
67
- return {
68
- ...j({ record: t, status: n }),
69
- tree: r
70
- };
71
- }
72
- function k(e) {
73
- const { dialecteConfig: t, tagName: n, attributes: a } = e;
74
- return I(a) ? a : Object.entries(a).map(
75
- ([r, s]) => ({
76
- name: r,
77
- value: s,
78
- namespace: t.definition[n]?.attributes.details[r]?.namespace || void 0
79
- })
80
- );
81
- }
82
- function X(e) {
83
- return E(e, {
84
- detail: "The record or ref is undefined"
85
- }), {
86
- id: e.id,
87
- tagName: e.tagName
88
- };
89
- }
90
- function G(e) {
91
- const { dialecteConfig: t, hooks: n, record: a } = e, { id: r, tagName: s, attributes: l, namespace: O, value: g } = a, N = r ?? crypto.randomUUID(), c = l ? k({ tagName: s, attributes: l, dialecteConfig: t }) : [], f = {
92
- id: N,
93
- tagName: s,
94
- attributes: c,
95
- namespace: O ?? {
96
- prefix: "prefixNeededForNotSupportedNamespace",
97
- uri: "uriNeededForNotSupportedNamespace"
98
- },
99
- value: g ?? "",
100
- parent: a.parent ?? null,
101
- children: a.children ?? []
102
- };
103
- if (!t.elements.includes(s)) return f;
104
- const m = t.definition[s].attributes.sequence, o = t.definition[s].attributes.details, T = m.flatMap((i) => {
105
- const h = o[i].required, _ = o[i]?.namespace || void 0, p = c.find((C) => C.name === i)?.value ?? (h ? o[i]?.default ?? "" : o[i]?.default);
106
- return p === void 0 ? [] : [
107
- {
108
- name: i,
109
- value: p,
110
- namespace: _
111
- }
112
- ];
113
- }), y = c.filter(
114
- (i) => "namespace" in i && i.namespace != null && !m.includes(i.name)
115
- );
116
- let u = {
117
- ...f,
118
- namespace: t.definition[s].namespace,
119
- attributes: [...T, ...y]
120
- };
121
- return n?.afterStandardizedRecord && (u = n.afterStandardizedRecord({
122
- record: u
123
- })), u;
124
- }
125
- function R(e, t, n, a) {
126
- if (!e || !t) return;
127
- const r = Object.keys(t).filter((s) => s in e);
128
- E(r.length === 0, {
129
- key: "EXTENSION_METHOD_COLLISION",
130
- detail: `Module "${n}" has conflicting ${a} method(s): ${r.map((s) => `"${s}"`).join(", ")}`
131
- });
132
- }
133
- function H(e) {
134
- const t = {}, n = {}, a = [
135
- ...Object.entries(e.base ?? {}),
136
- ...Object.entries(e.custom ?? {})
137
- ];
138
- for (const [r, s] of a)
139
- s.query && (R(
140
- t[r],
141
- s.query,
142
- r,
143
- "query"
144
- ), t[r] = { ...t[r], ...s.query }), s.transaction && (R(
145
- n[r],
146
- s.transaction,
147
- r,
148
- "transaction"
149
- ), n[r] = { ...n[r], ...s.transaction });
150
- return { query: t, transaction: n };
151
- }
152
- export {
153
- $ as C,
154
- v as D,
155
- D as a,
156
- V as b,
157
- w as c,
158
- I as d,
159
- Y as e,
160
- z as f,
161
- L as g,
162
- F as h,
163
- B as i,
164
- K as j,
165
- M as k,
166
- X as l,
167
- H as m,
168
- j as n,
169
- P as o,
170
- G as s,
171
- k as t
172
- };