@overmap-ai/common 0.0.1-more-code-dump.0
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/classes/DeferredPromise.d.ts +35 -0
- package/dist/classes/UUIDPromise.d.ts +10 -0
- package/dist/classes/index.d.ts +2 -0
- package/dist/constants/assets.d.ts +3 -0
- package/dist/constants/base.d.ts +3 -0
- package/dist/constants/documents.d.ts +1 -0
- package/dist/constants/empty.d.ts +4 -0
- package/dist/constants/errors.d.ts +1 -0
- package/dist/constants/index.d.ts +7 -0
- package/dist/constants/issues.d.ts +4 -0
- package/dist/constants/organizations.d.ts +2 -0
- package/dist/constants/users.d.ts +1 -0
- package/dist/enums/asset.d.ts +8 -0
- package/dist/enums/index.d.ts +5 -0
- package/dist/enums/issue.d.ts +22 -0
- package/dist/enums/organizations.d.ts +5 -0
- package/dist/enums/procedures.d.ts +11 -0
- package/dist/enums/verification.d.ts +8 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +478 -0
- package/dist/typings/index.d.ts +2 -0
- package/dist/typings/models/agents.d.ts +17 -0
- package/dist/typings/models/assets.d.ts +55 -0
- package/dist/typings/models/base.d.ts +81 -0
- package/dist/typings/models/documents.d.ts +14 -0
- package/dist/typings/models/emailDomain.d.ts +6 -0
- package/dist/typings/models/emailVerification.d.ts +12 -0
- package/dist/typings/models/forms.d.ts +42 -0
- package/dist/typings/models/geoImages.d.ts +9 -0
- package/dist/typings/models/index.d.ts +15 -0
- package/dist/typings/models/issues.d.ts +98 -0
- package/dist/typings/models/organizations.d.ts +11 -0
- package/dist/typings/models/procedures.d.ts +104 -0
- package/dist/typings/models/projects.d.ts +24 -0
- package/dist/typings/models/teams.d.ts +12 -0
- package/dist/typings/models/users.d.ts +8 -0
- package/dist/typings/models/utils.d.ts +36 -0
- package/dist/typings/uuid.d.ts +3 -0
- package/dist/utils/array.d.ts +1 -0
- package/dist/utils/empty.d.ts +4 -0
- package/dist/utils/errors.d.ts +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/models/assets.d.ts +3 -0
- package/dist/utils/models/base.d.ts +9 -0
- package/dist/utils/models/documents.d.ts +4 -0
- package/dist/utils/models/index.d.ts +4 -0
- package/dist/utils/models/issues.d.ts +4 -0
- package/dist/utils/string.d.ts +10 -0
- package/dist/utils/uuid.d.ts +5 -0
- package/package.json +53 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), t = /* @__PURE__ */ function(e) {
|
|
3
|
+
return e[e.GUEST = 0] = "GUEST", e[e.BASIC = 2] = "BASIC", e[e.ADMIN = 4] = "ADMIN", e;
|
|
4
|
+
}({}), n = /* @__PURE__ */ function(e) {
|
|
5
|
+
return e[e.PLANNED = 0] = "PLANNED", e[e.ACTIVE = 1] = "ACTIVE", e[e.MAINTENANCE = 2] = "MAINTENANCE", e[e.INACTIVE = 3] = "INACTIVE", e[e.RETIRED = 4] = "RETIRED", e[e.DISPOSED = 5] = "DISPOSED", e;
|
|
6
|
+
}({}), r = /* @__PURE__ */ function(e) {
|
|
7
|
+
return e.STATUS = "status", e.PRIORITY = "priority", e.DESCRIPTION = "description", e.TITLE = "title", e.ASSIGNED_TO = "assigned_to", e.DUE_DATE = "due_date", e;
|
|
8
|
+
}({}), i = /* @__PURE__ */ function(e) {
|
|
9
|
+
return e[e.BACKLOG = 0] = "BACKLOG", e[e.PLANNED = 1] = "PLANNED", e[e.IN_PROGRESS = 2] = "IN_PROGRESS", e[e.COMPLETED = 3] = "COMPLETED", e[e.CANCELLED = 4] = "CANCELLED", e;
|
|
10
|
+
}({}), a = /* @__PURE__ */ function(e) {
|
|
11
|
+
return e[e.LOWEST = 0] = "LOWEST", e[e.LOW = 2] = "LOW", e[e.MEDIUM = 4] = "MEDIUM", e[e.HIGH = 6] = "HIGH", e[e.HIGHEST = 8] = "HIGHEST", e;
|
|
12
|
+
}({}), o = /* @__PURE__ */ function(e) {
|
|
13
|
+
return e[e.ADD_ASSIGNEE = 0] = "ADD_ASSIGNEE", e[e.REMOVE_ASSIGNEE = 2] = "REMOVE_ASSIGNEE", e[e.ADD_REVIEWER = 4] = "ADD_REVIEWER", e[e.REMOVE_REVIEWER = 6] = "REMOVE_REVIEWER", e;
|
|
14
|
+
}({}), s = /* @__PURE__ */ function(e) {
|
|
15
|
+
return e[e.APPROVED = 0] = "APPROVED", e[e.REJECTED = 2] = "REJECTED", e[e.CHANGES_REQUESTED = 4] = "CHANGES_REQUESTED", e;
|
|
16
|
+
}({}), c = /* @__PURE__ */ function(e) {
|
|
17
|
+
return e[e.USER_REGISTRATION = 0] = "USER_REGISTRATION", e[e.APPLICATION_INVITE = 2] = "APPLICATION_INVITE", e[e.PROJECT_INVITE = 4] = "PROJECT_INVITE", e[e.ORGANIZATION_INVITE = 6] = "ORGANIZATION_INVITE", e[e.ADD_EMAIL_DOMAIN = 8] = "ADD_EMAIL_DOMAIN", e[e.RESET_PASSWORD = 10] = "RESET_PASSWORD", e;
|
|
18
|
+
}({}), l = [];
|
|
19
|
+
for (let e = 0; e < 256; ++e) l.push((e + 256).toString(16).slice(1));
|
|
20
|
+
function u(e, t = 0) {
|
|
21
|
+
return (l[e[t + 0]] + l[e[t + 1]] + l[e[t + 2]] + l[e[t + 3]] + "-" + l[e[t + 4]] + l[e[t + 5]] + "-" + l[e[t + 6]] + l[e[t + 7]] + "-" + l[e[t + 8]] + l[e[t + 9]] + "-" + l[e[t + 10]] + l[e[t + 11]] + l[e[t + 12]] + l[e[t + 13]] + l[e[t + 14]] + l[e[t + 15]]).toLowerCase();
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region node_modules/uuid/dist/esm-browser/rng.js
|
|
25
|
+
var d, f = /* @__PURE__ */ new Uint8Array(16);
|
|
26
|
+
function p() {
|
|
27
|
+
if (!d) {
|
|
28
|
+
if (typeof crypto > "u" || !crypto.getRandomValues) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
29
|
+
d = crypto.getRandomValues.bind(crypto);
|
|
30
|
+
}
|
|
31
|
+
return d(f);
|
|
32
|
+
}
|
|
33
|
+
var m = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region node_modules/uuid/dist/esm-browser/v4.js
|
|
36
|
+
function h(e, t, n) {
|
|
37
|
+
if (m.randomUUID && !t && !e) return m.randomUUID();
|
|
38
|
+
e ||= {};
|
|
39
|
+
let r = e.random ?? e.rng?.() ?? p();
|
|
40
|
+
if (r.length < 16) throw Error("Random bytes length must be >= 16");
|
|
41
|
+
if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
|
|
42
|
+
if (n ||= 0, n < 0 || n + 16 > t.length) throw RangeError(`UUID byte range ${n}:${n + 15} is out of buffer bounds`);
|
|
43
|
+
for (let e = 0; e < 16; ++e) t[n + e] = r[e];
|
|
44
|
+
return t;
|
|
45
|
+
}
|
|
46
|
+
return u(r);
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/utils/uuid.ts
|
|
50
|
+
function g(e) {
|
|
51
|
+
return {
|
|
52
|
+
...e,
|
|
53
|
+
uuid: h()
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function _(e) {
|
|
57
|
+
let t = {};
|
|
58
|
+
for (let n of e) t[n.uuid] = n;
|
|
59
|
+
return t;
|
|
60
|
+
}
|
|
61
|
+
function v(e) {
|
|
62
|
+
return e.map(({ uuid: e }) => e);
|
|
63
|
+
}
|
|
64
|
+
function y(e, t) {
|
|
65
|
+
return e.localeCompare(t);
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/utils/string.ts
|
|
69
|
+
function b(e, t) {
|
|
70
|
+
if (e.length <= t) return e;
|
|
71
|
+
let n = e.slice(0, t - 1);
|
|
72
|
+
return n.slice(0, n.lastIndexOf(" ")) + "…";
|
|
73
|
+
}
|
|
74
|
+
function x(e, t) {
|
|
75
|
+
return t === 1 ? e : e + "s";
|
|
76
|
+
}
|
|
77
|
+
function S(e) {
|
|
78
|
+
let t = e.trim().split(/[\s-_]+/).filter((e) => e.length > 0);
|
|
79
|
+
if (t.length === 0) return "";
|
|
80
|
+
if (t.length === 1) {
|
|
81
|
+
let e = t[0];
|
|
82
|
+
if (e.length <= 3) return e.toUpperCase();
|
|
83
|
+
let n = e.replace(/[aeiouAEIOU]/g, "");
|
|
84
|
+
return n.length >= 2 ? n.slice(0, 3).toUpperCase() : e.slice(0, 3).toUpperCase();
|
|
85
|
+
}
|
|
86
|
+
return t.length === 2 ? (t[0][0] + t[1].slice(0, 2)).toUpperCase() : t.slice(0, 3).map((e) => e[0]).join("").toUpperCase();
|
|
87
|
+
}
|
|
88
|
+
function C(e, t) {
|
|
89
|
+
return e.toLowerCase().includes(t.toLowerCase());
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/utils/array.ts
|
|
93
|
+
function w(e, t) {
|
|
94
|
+
let n = [], r = 0, i = e.length;
|
|
95
|
+
for (; r < i;) n.push(e.slice(r, r += t));
|
|
96
|
+
return n;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/constants/empty.ts
|
|
100
|
+
var T = Object.freeze([]), E = Object.freeze({}), D = Object.freeze(/* @__PURE__ */ new Set()), O = Object.freeze(/* @__PURE__ */ new Map()), k = "Unlabelled asset", A = [
|
|
101
|
+
n.PLANNED,
|
|
102
|
+
n.ACTIVE,
|
|
103
|
+
n.MAINTENANCE,
|
|
104
|
+
n.INACTIVE,
|
|
105
|
+
n.RETIRED,
|
|
106
|
+
n.DISPOSED
|
|
107
|
+
], j = "Untitled issue", M = [
|
|
108
|
+
a.LOWEST,
|
|
109
|
+
a.LOW,
|
|
110
|
+
a.MEDIUM,
|
|
111
|
+
a.HIGH,
|
|
112
|
+
a.HIGHEST
|
|
113
|
+
], N = [
|
|
114
|
+
i.BACKLOG,
|
|
115
|
+
i.PLANNED,
|
|
116
|
+
i.IN_PROGRESS,
|
|
117
|
+
i.COMPLETED,
|
|
118
|
+
i.CANCELLED
|
|
119
|
+
], P = [
|
|
120
|
+
t.GUEST,
|
|
121
|
+
t.BASIC,
|
|
122
|
+
t.ADMIN
|
|
123
|
+
], F = "Untitled document", I = "Unknown user", L = "An unexpected error occurred. Please try again later.", R = (e, t) => e.type === t.type ? e.order - t.order : e.type - t.type, z = (e, t) => C(e.label || "Unlabelled asset", t) || C(e.index?.toString() ?? "(Pending)", t), B = (e, t) => e.type === t.type ? e.order - t.order : e.type - t.type, ee = (e, t) => e.type === t.type ? e.order - t.order : e.type - t.type, V = (e, t) => C(e.title || "Untitled issue", t) || C(e.index?.toString() ?? "(Pending)", t);
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/utils/models/base.ts
|
|
126
|
+
function H(e, t) {
|
|
127
|
+
return y(e.uuid, t.uuid);
|
|
128
|
+
}
|
|
129
|
+
var U = (e, t) => e.submitted_at === t.submitted_at ? 0 : e.submitted_at < t.submitted_at ? -1 : 1, W = (e, t) => e.name.localeCompare(t.name), G = (e, t) => C(e.name, t);
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region node_modules/fast-tree-builder/index.mjs
|
|
132
|
+
function K(e, t) {
|
|
133
|
+
if (!t) throw Error("Missing required 'options' parameter.");
|
|
134
|
+
let { id: n, parentId: r, childIds: i, valueResolver: a, valueKey: o = "value", parentKey: s = "parent", childrenKey: c = "children", depthKey: l = !1, validateTree: u = !1, validateReferences: d = !1, includeEmptyChildrenArray: f = !1 } = t;
|
|
135
|
+
if (!n) throw Error("Option 'id' is required.");
|
|
136
|
+
if (!r && !i) throw Error("Either 'parentId' or 'childIds' must be provided.");
|
|
137
|
+
if (r && i) throw Error("'parentId' and 'childIds' cannot be used together.");
|
|
138
|
+
let p = [], m = /* @__PURE__ */ new Map();
|
|
139
|
+
if (r) {
|
|
140
|
+
let t = /* @__PURE__ */ new Map();
|
|
141
|
+
for (let i of e) {
|
|
142
|
+
let e = typeof n == "function" ? n(i) : i[n];
|
|
143
|
+
if (m.has(e)) throw Error(`Duplicate identifier '${e}'.`);
|
|
144
|
+
let l = o === !1 ? { ...a ? a(i) : i } : { [o]: a ? a(i) : i };
|
|
145
|
+
o === !1 && (s !== !1 && delete l[s], delete l[c]), f && (l[c] = []), m.set(e, l);
|
|
146
|
+
let u = typeof r == "function" ? r(i) : i[r], d = m.get(u);
|
|
147
|
+
if (d) d[c] ||= [], d[c].push(l), s !== !1 && (l[s] = d);
|
|
148
|
+
else {
|
|
149
|
+
let e = t.get(u);
|
|
150
|
+
e ? e.push(l) : t.set(u, [l]);
|
|
151
|
+
}
|
|
152
|
+
let p = t.get(e);
|
|
153
|
+
if (p) {
|
|
154
|
+
if (l[c] = p, s !== !1) for (let e of p) e[s] = l;
|
|
155
|
+
t.delete(e);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
for (let [e, n] of t.entries()) {
|
|
159
|
+
if (d && e != null) throw Error(`Referential integrity violation: parentId '${e}' does not match any item in the input.`);
|
|
160
|
+
for (let e of n) p.push(e);
|
|
161
|
+
}
|
|
162
|
+
} else if (i) {
|
|
163
|
+
let t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
164
|
+
for (let l of e) {
|
|
165
|
+
let e = typeof n == "function" ? n(l) : l[n];
|
|
166
|
+
if (m.has(e)) throw Error(`Duplicate identifier '${e}'.`);
|
|
167
|
+
let u = o === !1 ? { ...a ? a(l) : l } : { [o]: a ? a(l) : l };
|
|
168
|
+
o === !1 && (s !== !1 && delete u[s], delete u[c]), f && (u[c] = []), m.set(e, u);
|
|
169
|
+
let d = typeof i == "function" ? i(l) : l[i];
|
|
170
|
+
if (d != null) {
|
|
171
|
+
if (typeof d[Symbol.iterator] != "function") throw Error(`Item '${e}' has invalid children: expected an iterable value.`);
|
|
172
|
+
u[c] = [];
|
|
173
|
+
for (let e of d) {
|
|
174
|
+
let n = m.get(e);
|
|
175
|
+
if (n) {
|
|
176
|
+
if (u[c].push(n), s !== !1) {
|
|
177
|
+
if (n[s] && n[s] !== u) throw Error(`Node '${e}' already has a different parent, refusing to overwrite.`);
|
|
178
|
+
n[s] = u;
|
|
179
|
+
}
|
|
180
|
+
r.delete(e);
|
|
181
|
+
} else {
|
|
182
|
+
if (t.has(e)) throw Error(`Multiple parents reference the same unresolved child '${e}'.`);
|
|
183
|
+
t.set(e, {
|
|
184
|
+
parentNode: u,
|
|
185
|
+
childIndex: u[c].length
|
|
186
|
+
}), u[c].push(null);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
u[c].length === 0 && delete u[c];
|
|
190
|
+
}
|
|
191
|
+
let p = t.get(e);
|
|
192
|
+
if (p) {
|
|
193
|
+
let { parentNode: n, childIndex: r } = p;
|
|
194
|
+
if (n[c][r] = u, s !== !1) {
|
|
195
|
+
if (u[s] && u[s] !== n) throw Error(`Node '${e}' already has a different parent, refusing to overwrite.`);
|
|
196
|
+
u[s] = n;
|
|
197
|
+
}
|
|
198
|
+
t.delete(e);
|
|
199
|
+
} else r.set(e, u);
|
|
200
|
+
}
|
|
201
|
+
if (t.size > 0) {
|
|
202
|
+
if (d) {
|
|
203
|
+
let e = t.keys().next().value;
|
|
204
|
+
throw Error(`Referential integrity violation: child reference '${e}' does not match any item in the input.`);
|
|
205
|
+
}
|
|
206
|
+
let e = Array.from(t.values());
|
|
207
|
+
for (let t = e.length - 1; t >= 0; t--) {
|
|
208
|
+
let { parentNode: n, childIndex: r } = e[t];
|
|
209
|
+
n[c].splice(r, 1), n[c].length === 0 && delete n[c];
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
for (let e of r.values()) p.push(e);
|
|
213
|
+
}
|
|
214
|
+
let h = typeof l == "string" || typeof l == "symbol" || typeof l == "number";
|
|
215
|
+
if (u || h) {
|
|
216
|
+
if (p.length === 0 && m.size > 0) throw Error("Tree validation failed: detected a cycle.");
|
|
217
|
+
let e = [...p].map((e) => ({
|
|
218
|
+
node: e,
|
|
219
|
+
depth: 0
|
|
220
|
+
})), t = /* @__PURE__ */ new Set(), n = 0, r = m.size;
|
|
221
|
+
for (; e.length > 0 && n++ <= r;) {
|
|
222
|
+
let { node: n, depth: r } = e.pop();
|
|
223
|
+
if (t.has(n)) throw Error("Tree validation failed: a node reachable via multiple paths.");
|
|
224
|
+
if (t.add(n), h && (n[l] = r), n[c]) for (let t of n[c]) e.push({
|
|
225
|
+
node: t,
|
|
226
|
+
depth: r + 1
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
if (m.size !== t.size) throw Error("Tree validation failed: detected a cycle.");
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
roots: p,
|
|
233
|
+
nodes: m
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region node_modules/ts-tree-lib/dist/src/TreeNode.js
|
|
238
|
+
var q = /* @__PURE__ */ e(((e) => {
|
|
239
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.defaultTraversalStrategy = e.TreeNode = void 0, e.TreeNode = class {
|
|
240
|
+
constructor(e, t, n) {
|
|
241
|
+
this.children = [], this.strategy = this.depthFirstSearch, this.model = e, this.index = t, n && (this.strategy = n);
|
|
242
|
+
}
|
|
243
|
+
addChild(e) {
|
|
244
|
+
e && this.children.push(e);
|
|
245
|
+
}
|
|
246
|
+
removeChild(e) {
|
|
247
|
+
e && (this.children = this.children.filter((t) => t !== e));
|
|
248
|
+
}
|
|
249
|
+
moveChild(e, t) {
|
|
250
|
+
e && t && (this.removeChild(e), t.addChild(e));
|
|
251
|
+
}
|
|
252
|
+
findChild(e, t) {
|
|
253
|
+
let n;
|
|
254
|
+
n = typeof e == "function" ? e : (n) => n.model[e] === t;
|
|
255
|
+
for (let e of this.children) {
|
|
256
|
+
if (n(e)) return e;
|
|
257
|
+
if (e.children) {
|
|
258
|
+
let t = e.findChild(n);
|
|
259
|
+
if (t) return t;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
getPath(e) {
|
|
265
|
+
let t = [], n = (r) => {
|
|
266
|
+
if (!r) return !1;
|
|
267
|
+
if (t.push(r), r === e) return !0;
|
|
268
|
+
for (let e of r.children) if (n(e)) return !0;
|
|
269
|
+
return t.pop(), !1;
|
|
270
|
+
};
|
|
271
|
+
return n(this), t.length > 0 ? t : null;
|
|
272
|
+
}
|
|
273
|
+
getReversePath(e) {
|
|
274
|
+
let t = this.getPath(e);
|
|
275
|
+
return t ? t.reverse() : null;
|
|
276
|
+
}
|
|
277
|
+
getParent(e) {
|
|
278
|
+
if (!e) return null;
|
|
279
|
+
for (let t of this.children) {
|
|
280
|
+
if (t.children.includes(e)) return t;
|
|
281
|
+
let n = t.getParent(e);
|
|
282
|
+
if (n) return n;
|
|
283
|
+
}
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
findChildren(e, t) {
|
|
287
|
+
let n;
|
|
288
|
+
return n = typeof e == "function" ? e : (n) => n.model[e] === t, this.children.filter(n);
|
|
289
|
+
}
|
|
290
|
+
deleteChildren(e, t) {
|
|
291
|
+
let n;
|
|
292
|
+
n = typeof e == "function" ? e : (n) => n.model[e] === t, this.children = this.children.filter((e) => !n(e));
|
|
293
|
+
}
|
|
294
|
+
insertChild(e, t, n) {
|
|
295
|
+
if (!e || !this.children) return;
|
|
296
|
+
let r = typeof t == "function" ? this.children.findIndex(t) : this.children.findIndex((e) => e.model[t] === n);
|
|
297
|
+
r === -1 ? this.children.push(e) : this.children.splice(r, 0, e);
|
|
298
|
+
}
|
|
299
|
+
depthFirstSearch(e, t = "in-order") {
|
|
300
|
+
let n = [], r = (e) => {
|
|
301
|
+
t.includes("pre-order") && n.push(e);
|
|
302
|
+
for (let t of e.children) r(t);
|
|
303
|
+
(t.includes("in-order") || t.includes("post-order")) && n.push(e);
|
|
304
|
+
};
|
|
305
|
+
return r(e), t === "reverse-pre-order" || t === "reverse-post-order" || t === "reverse-in-order" ? n.reverse() : n;
|
|
306
|
+
}
|
|
307
|
+
breadthFirstOrder(e) {
|
|
308
|
+
let t = [], n = [e];
|
|
309
|
+
for (; n.length > 0;) {
|
|
310
|
+
let e = n.shift();
|
|
311
|
+
t.push(e), n.push(...e.children);
|
|
312
|
+
}
|
|
313
|
+
return t;
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
function t(e) {
|
|
317
|
+
return e.depthFirstSearch(e);
|
|
318
|
+
}
|
|
319
|
+
e.defaultTraversalStrategy = t;
|
|
320
|
+
})), J = /* @__PURE__ */ e(((e) => {
|
|
321
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.Tree = void 0;
|
|
322
|
+
var t = q();
|
|
323
|
+
e.Tree = class {
|
|
324
|
+
constructor(e, n) {
|
|
325
|
+
this.strategy = t.defaultTraversalStrategy, this.root = e ? this.parse(e) : null, n && (this.strategy = n);
|
|
326
|
+
}
|
|
327
|
+
parse(e) {
|
|
328
|
+
if (!e) return null;
|
|
329
|
+
let n = new t.TreeNode(e, 0);
|
|
330
|
+
return e.children && this.parseChildren(n, e.children), n;
|
|
331
|
+
}
|
|
332
|
+
parseChildren(e, n) {
|
|
333
|
+
n && n.forEach((n, r) => {
|
|
334
|
+
let i = new t.TreeNode(n, r + 1);
|
|
335
|
+
e.addChild(i), n.children && this.parseChildren(i, n.children);
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
all() {
|
|
339
|
+
return this.root ? this.strategy(this.root) : null;
|
|
340
|
+
}
|
|
341
|
+
remove(e) {
|
|
342
|
+
let t = (e, t) => {
|
|
343
|
+
let n = e.indexOf(t);
|
|
344
|
+
n !== -1 && e.splice(n, 1);
|
|
345
|
+
}, n = (e, r) => {
|
|
346
|
+
t(e.children, r), e.children.forEach((e) => n(e, r));
|
|
347
|
+
};
|
|
348
|
+
this.root && (this.root === e ? this.root = null : n(this.root, e));
|
|
349
|
+
}
|
|
350
|
+
find(e, t) {
|
|
351
|
+
return this.root ? this.root.findChild(e, t) : null;
|
|
352
|
+
}
|
|
353
|
+
move(e, t) {
|
|
354
|
+
e.getParent(this.root)?.removeChild(e), t.addChild(e);
|
|
355
|
+
}
|
|
356
|
+
getPath(e) {
|
|
357
|
+
return this.root ? this.root.getPath(e) : null;
|
|
358
|
+
}
|
|
359
|
+
getReversePath(e) {
|
|
360
|
+
return this.root ? this.root.getReversePath(e) : null;
|
|
361
|
+
}
|
|
362
|
+
walk(e) {
|
|
363
|
+
var t;
|
|
364
|
+
(t = this.root) == null || t.depthFirstSearch(this.root).forEach(e);
|
|
365
|
+
}
|
|
366
|
+
insertChild(e, t, n) {
|
|
367
|
+
let r;
|
|
368
|
+
r = typeof t == "function" ? t : (e) => e.model[t] === n;
|
|
369
|
+
let i = this.root ? this.strategy(this.root) : [];
|
|
370
|
+
for (let t of i) if (r(t)) {
|
|
371
|
+
t.addChild(e);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
})), Y = (/* @__PURE__ */ e(((e) => {
|
|
377
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.defaultTraversalStrategy = e.TreeNode = e.Tree = void 0;
|
|
378
|
+
var t = J();
|
|
379
|
+
Object.defineProperty(e, "Tree", {
|
|
380
|
+
enumerable: !0,
|
|
381
|
+
get: function() {
|
|
382
|
+
return t.Tree;
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
var n = q();
|
|
386
|
+
Object.defineProperty(e, "TreeNode", {
|
|
387
|
+
enumerable: !0,
|
|
388
|
+
get: function() {
|
|
389
|
+
return n.TreeNode;
|
|
390
|
+
}
|
|
391
|
+
}), Object.defineProperty(e, "defaultTraversalStrategy", {
|
|
392
|
+
enumerable: !0,
|
|
393
|
+
get: function() {
|
|
394
|
+
return n.defaultTraversalStrategy;
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
})))(), X = (e) => K(e, {
|
|
398
|
+
id: (e) => e.uuid,
|
|
399
|
+
parentId: (e) => e.parent_document,
|
|
400
|
+
includeEmptyChildrenArray: !0,
|
|
401
|
+
valueKey: !1
|
|
402
|
+
}), Z = (e) => {
|
|
403
|
+
let { roots: t } = X(e);
|
|
404
|
+
return t.map((e) => new Y.Tree(e));
|
|
405
|
+
}, Q = (e, t) => {
|
|
406
|
+
let { nodes: n } = X(t), r = n.get(e);
|
|
407
|
+
if (!r) throw Error(`Node with uuid ${e} does not exist in document tree.`);
|
|
408
|
+
return new Y.Tree(r);
|
|
409
|
+
}, $ = (e) => e.length === 0 ? T : e, te = (e) => Object.keys(e).length === 0 ? E : e, ne = (e) => e.size === 0 ? D : e, re = (e) => e.size === 0 ? E : e;
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region src/utils/errors.ts
|
|
412
|
+
function ie(e) {
|
|
413
|
+
return e instanceof Error && e.name === "AbortError";
|
|
414
|
+
}
|
|
415
|
+
//#endregion
|
|
416
|
+
//#region src/classes/DeferredPromise.ts
|
|
417
|
+
var ae = class {
|
|
418
|
+
[Symbol.toStringTag] = "Promise";
|
|
419
|
+
_promise;
|
|
420
|
+
_resolve;
|
|
421
|
+
_reject;
|
|
422
|
+
_state = "pending";
|
|
423
|
+
get state() {
|
|
424
|
+
return this._state;
|
|
425
|
+
}
|
|
426
|
+
constructor() {
|
|
427
|
+
this._resolve = null, this._reject = null, this._promise = new Promise((e, t) => {
|
|
428
|
+
this._resolve = e, this._reject = t;
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
then(e, t) {
|
|
432
|
+
return this._promise.then(e, t);
|
|
433
|
+
}
|
|
434
|
+
catch(e) {
|
|
435
|
+
return this._promise.catch(e);
|
|
436
|
+
}
|
|
437
|
+
resolve(e) {
|
|
438
|
+
if (!this._resolve) throw Error("No resolve callback");
|
|
439
|
+
this._resolve(e), this._state = "fulfilled";
|
|
440
|
+
}
|
|
441
|
+
reject(e) {
|
|
442
|
+
if (!this._reject) throw e;
|
|
443
|
+
this._reject(e), this._state = "rejected";
|
|
444
|
+
}
|
|
445
|
+
finally(e) {
|
|
446
|
+
throw Error("`finally` not implemented");
|
|
447
|
+
}
|
|
448
|
+
}, oe = class e extends Promise {
|
|
449
|
+
_uuid;
|
|
450
|
+
constructor(e, t) {
|
|
451
|
+
super(e), this._uuid = t;
|
|
452
|
+
}
|
|
453
|
+
get uuid() {
|
|
454
|
+
return this._uuid;
|
|
455
|
+
}
|
|
456
|
+
set uuid(e) {
|
|
457
|
+
this._uuid = e;
|
|
458
|
+
}
|
|
459
|
+
static from(t, n) {
|
|
460
|
+
return new e((e, n) => {
|
|
461
|
+
Promise.resolve(t).then(e).catch(n);
|
|
462
|
+
}, n);
|
|
463
|
+
}
|
|
464
|
+
then(e, t) {
|
|
465
|
+
let n = super.then(e, t);
|
|
466
|
+
return n.uuid = this.uuid, n;
|
|
467
|
+
}
|
|
468
|
+
catch(e) {
|
|
469
|
+
let t = super.catch(e);
|
|
470
|
+
return t.uuid = this.uuid, t;
|
|
471
|
+
}
|
|
472
|
+
finally(e) {
|
|
473
|
+
let t = super.finally(e);
|
|
474
|
+
return t.uuid = this.uuid, t;
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
//#endregion
|
|
478
|
+
export { A as ASSET_STATUS_TYPES, n as AssetStatusType, ae as DeferredPromise, T as EMPTY_ARRAY, O as EMPTY_MAP, E as EMPTY_OBJECT, D as EMPTY_SET, L as ERROR_MSG_UNEXPECTED, M as ISSUE_PRIORITY_TYPES, N as ISSUE_STATUS_TYPES, a as IssuePriorityType, i as IssueStatusType, r as IssueUpdateChange, I as NON_EXISTING_USER_NAME, P as ORGANIZATION_ACCESS_LEVELS, t as OrganizationAccessLevel, o as ProcedureStepEventType, s as ProcedureStepFieldValuesReviewType, k as UNLABELLED_ASSET_LABEL, F as UNTITLED_DOCUMENT_TITLE, j as UNTITLED_ISSUE_TITLE, oe as UUIDPromise, c as VerificationCodeType, z as assetFilterCallback, R as assetTypeStatusSortFn, w as chunkArray, $ as fallbackToEmptyArray, re as fallbackToEmptyMap, te as fallbackToEmptyObject, ne as fallbackToEmptySet, S as generateAbbreviation, Q as getDocumentSubTree, Z as getDocumentTrees, C as includesLowercase, ie as isAbortError, V as issueFilterCallback, ee as issueTypePrioritySortFn, B as issueTypeStatusSortFn, G as nameModelFilterFn, W as nameModelSortFn, x as pluralize, U as submittedAtModelSortFn, v as toUuidArray, _ as toUuidIdRecord, b as truncate, H as uuidModelSortFn, g as uuidObj, y as uuidSortFn };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { UUID } from '../uuid';
|
|
3
|
+
import { OptionalFileModel, TimestampedModel } from './base';
|
|
4
|
+
export interface AgentProfile extends OptionalFileModel {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the agent.
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The description of the agent.
|
|
11
|
+
*/
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AgentUserConversation extends UUID<TimestampedModel> {
|
|
15
|
+
profile?: AgentProfile | null;
|
|
16
|
+
tiptap_content?: JSONContent[];
|
|
17
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AssetStatusType } from '../../enums';
|
|
2
|
+
import { AbbreviationModel, ColorModel, CreatedByModel, FieldsAttachmentModel, FieldsModel, FieldValuesModel, GeometryModel, IconModel, IdentifierModel, IdentifierValueModel, IndexedModel, RequiredFileModel, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
3
|
+
import { Organization } from './organizations';
|
|
4
|
+
import { Project } from './projects';
|
|
5
|
+
export interface Asset extends UUIDModel, TimestampedModel, SubmittedAtModel, CreatedByModel, GeometryModel, IndexedModel {
|
|
6
|
+
asset_type: AssetType["uuid"];
|
|
7
|
+
label: string | null;
|
|
8
|
+
description: string | null;
|
|
9
|
+
project: Project["uuid"];
|
|
10
|
+
status: AssetTypeStatus["uuid"];
|
|
11
|
+
}
|
|
12
|
+
export interface AssetType extends UUIDModel, TimestampedModel, SubmittedAtModel, CreatedByModel, IconModel, ColorModel, AbbreviationModel {
|
|
13
|
+
organization: Organization["uuid"];
|
|
14
|
+
name: string;
|
|
15
|
+
description: string | null;
|
|
16
|
+
order: number;
|
|
17
|
+
default_status: AssetTypeStatus["uuid"] | null;
|
|
18
|
+
}
|
|
19
|
+
export interface AssetTypeFields extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel, FieldsModel {
|
|
20
|
+
asset_type: AssetType["uuid"];
|
|
21
|
+
}
|
|
22
|
+
export interface AssetTypeFieldsAttachment extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel, FieldsAttachmentModel {
|
|
23
|
+
fields_revision: AssetTypeFields["uuid"];
|
|
24
|
+
}
|
|
25
|
+
export interface AssetTypeFieldValues extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel, FieldValuesModel {
|
|
26
|
+
fields_revision: AssetTypeFields["uuid"];
|
|
27
|
+
asset: Asset["uuid"];
|
|
28
|
+
}
|
|
29
|
+
export interface AssetTypeFieldValuesAttachment extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel, FieldsAttachmentModel {
|
|
30
|
+
field_values: AssetTypeFieldValues["uuid"];
|
|
31
|
+
}
|
|
32
|
+
export interface AssetTypeIdentifier extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel, IdentifierModel {
|
|
33
|
+
asset_type: AssetType["uuid"];
|
|
34
|
+
}
|
|
35
|
+
export interface AssetTypeIdentifierValue extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel, IdentifierValueModel {
|
|
36
|
+
asset: Asset["uuid"];
|
|
37
|
+
asset_type_identifier: AssetTypeIdentifier["uuid"];
|
|
38
|
+
}
|
|
39
|
+
export interface AssetAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel, RequiredFileModel, CreatedByModel {
|
|
40
|
+
asset: Asset["uuid"];
|
|
41
|
+
}
|
|
42
|
+
export interface AssetTypeAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel, RequiredFileModel, CreatedByModel {
|
|
43
|
+
asset_type: AssetType["uuid"];
|
|
44
|
+
}
|
|
45
|
+
export interface AssetTypeStatus extends UUIDModel, SubmittedAtModel, TimestampedModel, ColorModel, CreatedByModel {
|
|
46
|
+
asset_type: AssetType["uuid"];
|
|
47
|
+
name: string;
|
|
48
|
+
type: AssetStatusType;
|
|
49
|
+
order: number;
|
|
50
|
+
}
|
|
51
|
+
export interface AssetComment extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel {
|
|
52
|
+
asset: Asset["uuid"];
|
|
53
|
+
content: string;
|
|
54
|
+
resolved: boolean;
|
|
55
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { JSONField, JSONFieldSection, JSONFieldValues } from '@adrekic/fieldsjson';
|
|
2
|
+
import { Geometry, MultiPoint, Point, Polygon } from 'geojson';
|
|
3
|
+
import { User } from './users';
|
|
4
|
+
export interface Model {
|
|
5
|
+
}
|
|
6
|
+
export interface IdModel extends Model {
|
|
7
|
+
id: number;
|
|
8
|
+
}
|
|
9
|
+
export interface UUIDModel extends Model {
|
|
10
|
+
uuid: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SubmittedAtModel extends Model {
|
|
13
|
+
submitted_at: string;
|
|
14
|
+
}
|
|
15
|
+
export interface TimestampedModel extends Model {
|
|
16
|
+
created_at: string;
|
|
17
|
+
updated_at: string;
|
|
18
|
+
}
|
|
19
|
+
export interface IconModel {
|
|
20
|
+
icon: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ColorModel {
|
|
23
|
+
color: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CreatedByModel {
|
|
26
|
+
created_by: User["id"] | null;
|
|
27
|
+
}
|
|
28
|
+
export interface IndexedModel {
|
|
29
|
+
index: number;
|
|
30
|
+
}
|
|
31
|
+
export interface BoundableModel {
|
|
32
|
+
bounds?: MultiPoint;
|
|
33
|
+
}
|
|
34
|
+
export interface PolygonBoundedModel {
|
|
35
|
+
bounds: Polygon;
|
|
36
|
+
}
|
|
37
|
+
export interface MarkableModel {
|
|
38
|
+
geo_marker?: Point;
|
|
39
|
+
}
|
|
40
|
+
export interface IdentifierModel {
|
|
41
|
+
name: string;
|
|
42
|
+
}
|
|
43
|
+
export interface IdentifierValueModel {
|
|
44
|
+
value: string;
|
|
45
|
+
}
|
|
46
|
+
export interface GeometryModel {
|
|
47
|
+
geometry: Geometry;
|
|
48
|
+
}
|
|
49
|
+
export interface AbbreviationModel {
|
|
50
|
+
abbr: string;
|
|
51
|
+
}
|
|
52
|
+
export interface TreeModel<TId extends string | number | symbol> {
|
|
53
|
+
parent: TId | null;
|
|
54
|
+
}
|
|
55
|
+
export interface OptionalFileModel extends Model {
|
|
56
|
+
object_url?: string;
|
|
57
|
+
file_sha1: string | null;
|
|
58
|
+
file_extension: string | null;
|
|
59
|
+
file_name: string | null;
|
|
60
|
+
}
|
|
61
|
+
export interface RequiredFileModel extends Model {
|
|
62
|
+
object_url?: string;
|
|
63
|
+
file_sha1: NonNullable<OptionalFileModel["file_sha1"]>;
|
|
64
|
+
file_extension: NonNullable<OptionalFileModel["file_extension"]>;
|
|
65
|
+
file_name: NonNullable<OptionalFileModel["file_name"]>;
|
|
66
|
+
file_type: string | null;
|
|
67
|
+
}
|
|
68
|
+
export interface FieldsModel {
|
|
69
|
+
fields: JSONFieldSection[];
|
|
70
|
+
revision: number;
|
|
71
|
+
}
|
|
72
|
+
export interface FieldValuesModel {
|
|
73
|
+
published_at: string | null;
|
|
74
|
+
values: JSONFieldValues;
|
|
75
|
+
}
|
|
76
|
+
export interface FieldsAttachmentModel extends RequiredFileModel {
|
|
77
|
+
field_identifier: JSONField["identifier"];
|
|
78
|
+
}
|
|
79
|
+
export interface FieldValuesAttachmentModel extends RequiredFileModel {
|
|
80
|
+
field_identifier: JSONField["identifier"];
|
|
81
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ColorModel, CreatedByModel, IconModel, RequiredFileModel, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
2
|
+
import { Organization } from './organizations';
|
|
3
|
+
import { Project } from './projects';
|
|
4
|
+
export interface Document extends UUIDModel, SubmittedAtModel, CreatedByModel, TimestampedModel, IconModel, ColorModel {
|
|
5
|
+
title: string | null;
|
|
6
|
+
description: string | null;
|
|
7
|
+
content: string | null;
|
|
8
|
+
parent_document: Document["uuid"] | null;
|
|
9
|
+
project: Project["uuid"] | null;
|
|
10
|
+
organization: Organization["uuid"] | null;
|
|
11
|
+
}
|
|
12
|
+
export interface DocumentAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel, RequiredFileModel, CreatedByModel {
|
|
13
|
+
document: Document["uuid"];
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VerificationCodeType } from '../../enums';
|
|
2
|
+
import { UUIDModel } from './base';
|
|
3
|
+
import { Organization } from './organizations';
|
|
4
|
+
import { Project } from './projects';
|
|
5
|
+
import { User } from './users';
|
|
6
|
+
export interface VerificationCode extends UUIDModel {
|
|
7
|
+
verification_code: string;
|
|
8
|
+
verification_type: VerificationCodeType;
|
|
9
|
+
organization?: Organization["uuid"];
|
|
10
|
+
project?: Project["uuid"];
|
|
11
|
+
user?: User["id"];
|
|
12
|
+
}
|