interaqt 0.4.13 → 0.4.14
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/index.js +702 -703
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { uuidv7 as Pe } from "uuidv7";
|
|
2
1
|
import { parse as De } from "acorn";
|
|
3
2
|
import { AsyncLocalStorage as ye } from "async_hooks";
|
|
4
3
|
import Oe from "better-sqlite3";
|
|
@@ -34,23 +33,23 @@ function wt(u, t) {
|
|
|
34
33
|
const e = u;
|
|
35
34
|
return t && e._type && e.constructor?.clone ? e.constructor.clone(u, t) : u;
|
|
36
35
|
}
|
|
37
|
-
function
|
|
36
|
+
function Ei(...u) {
|
|
38
37
|
for (const t of u)
|
|
39
38
|
t.instances.length = 0;
|
|
40
39
|
}
|
|
41
|
-
function
|
|
40
|
+
function Ii() {
|
|
42
41
|
}
|
|
43
42
|
const Bt = /* @__PURE__ */ new Map();
|
|
44
43
|
function Le(u, t) {
|
|
45
44
|
t && t.isKlass && t.displayName && Bt.set(u, t);
|
|
46
45
|
}
|
|
47
|
-
function
|
|
46
|
+
function Ci() {
|
|
48
47
|
const u = [];
|
|
49
48
|
return Array.from(Bt.entries()).forEach(([, t]) => {
|
|
50
49
|
t.instances && Array.isArray(t.instances) && t.stringify && u.push(...t.instances.map((e) => t.stringify(e)));
|
|
51
50
|
}), `[${u.join(",")}]`;
|
|
52
51
|
}
|
|
53
|
-
function
|
|
52
|
+
function xi(u) {
|
|
54
53
|
const t = JSON.parse(u);
|
|
55
54
|
return _e(t);
|
|
56
55
|
}
|
|
@@ -66,10 +65,282 @@ function _e(u) {
|
|
|
66
65
|
t.set(i, o);
|
|
67
66
|
}), t;
|
|
68
67
|
}
|
|
69
|
-
function
|
|
68
|
+
function Mi(u) {
|
|
70
69
|
return console.warn("createClass is deprecated in refactored code"), null;
|
|
71
70
|
}
|
|
72
|
-
|
|
71
|
+
/**
|
|
72
|
+
* uuidv7: A JavaScript implementation of UUID version 7
|
|
73
|
+
*
|
|
74
|
+
* Copyright 2021-2024 LiosK
|
|
75
|
+
*
|
|
76
|
+
* @license Apache-2.0
|
|
77
|
+
* @packageDocumentation
|
|
78
|
+
*/
|
|
79
|
+
const Nt = "0123456789abcdef";
|
|
80
|
+
class U {
|
|
81
|
+
/** @param bytes - The 16-byte byte array representation. */
|
|
82
|
+
constructor(t) {
|
|
83
|
+
this.bytes = t;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Creates an object from the internal representation, a 16-byte byte array
|
|
87
|
+
* containing the binary UUID representation in the big-endian byte order.
|
|
88
|
+
*
|
|
89
|
+
* This method does NOT shallow-copy the argument, and thus the created object
|
|
90
|
+
* holds the reference to the underlying buffer.
|
|
91
|
+
*
|
|
92
|
+
* @throws TypeError if the length of the argument is not 16.
|
|
93
|
+
*/
|
|
94
|
+
static ofInner(t) {
|
|
95
|
+
if (t.length !== 16)
|
|
96
|
+
throw new TypeError("not 128-bit length");
|
|
97
|
+
return new U(t);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Builds a byte array from UUIDv7 field values.
|
|
101
|
+
*
|
|
102
|
+
* @param unixTsMs - A 48-bit `unix_ts_ms` field value.
|
|
103
|
+
* @param randA - A 12-bit `rand_a` field value.
|
|
104
|
+
* @param randBHi - The higher 30 bits of 62-bit `rand_b` field value.
|
|
105
|
+
* @param randBLo - The lower 32 bits of 62-bit `rand_b` field value.
|
|
106
|
+
* @throws RangeError if any field value is out of the specified range.
|
|
107
|
+
*/
|
|
108
|
+
static fromFieldsV7(t, e, r, i) {
|
|
109
|
+
if (!Number.isInteger(t) || !Number.isInteger(e) || !Number.isInteger(r) || !Number.isInteger(i) || t < 0 || e < 0 || r < 0 || i < 0 || t > 281474976710655 || e > 4095 || r > 1073741823 || i > 4294967295)
|
|
110
|
+
throw new RangeError("invalid field value");
|
|
111
|
+
const s = new Uint8Array(16);
|
|
112
|
+
return s[0] = t / 2 ** 40, s[1] = t / 2 ** 32, s[2] = t / 2 ** 24, s[3] = t / 2 ** 16, s[4] = t / 2 ** 8, s[5] = t, s[6] = 112 | e >>> 8, s[7] = e, s[8] = 128 | r >>> 24, s[9] = r >>> 16, s[10] = r >>> 8, s[11] = r, s[12] = i >>> 24, s[13] = i >>> 16, s[14] = i >>> 8, s[15] = i, new U(s);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Builds a byte array from a string representation.
|
|
116
|
+
*
|
|
117
|
+
* This method accepts the following formats:
|
|
118
|
+
*
|
|
119
|
+
* - 32-digit hexadecimal format without hyphens: `0189dcd553117d408db09496a2eef37b`
|
|
120
|
+
* - 8-4-4-4-12 hyphenated format: `0189dcd5-5311-7d40-8db0-9496a2eef37b`
|
|
121
|
+
* - Hyphenated format with surrounding braces: `{0189dcd5-5311-7d40-8db0-9496a2eef37b}`
|
|
122
|
+
* - RFC 9562 URN format: `urn:uuid:0189dcd5-5311-7d40-8db0-9496a2eef37b`
|
|
123
|
+
*
|
|
124
|
+
* Leading and trailing whitespaces represents an error.
|
|
125
|
+
*
|
|
126
|
+
* @throws SyntaxError if the argument could not parse as a valid UUID string.
|
|
127
|
+
*/
|
|
128
|
+
static parse(t) {
|
|
129
|
+
var e, r, i, s;
|
|
130
|
+
let a;
|
|
131
|
+
switch (t.length) {
|
|
132
|
+
case 32:
|
|
133
|
+
a = (e = /^[0-9a-f]{32}$/i.exec(t)) === null || e === void 0 ? void 0 : e[0];
|
|
134
|
+
break;
|
|
135
|
+
case 36:
|
|
136
|
+
a = (r = /^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)) === null || r === void 0 ? void 0 : r.slice(1, 6).join("");
|
|
137
|
+
break;
|
|
138
|
+
case 38:
|
|
139
|
+
a = (i = /^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)) === null || i === void 0 ? void 0 : i.slice(1, 6).join("");
|
|
140
|
+
break;
|
|
141
|
+
case 45:
|
|
142
|
+
a = (s = /^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)) === null || s === void 0 ? void 0 : s.slice(1, 6).join("");
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
if (a) {
|
|
146
|
+
const o = new Uint8Array(16);
|
|
147
|
+
for (let n = 0; n < 16; n += 4) {
|
|
148
|
+
const c = parseInt(a.substring(2 * n, 2 * n + 8), 16);
|
|
149
|
+
o[n + 0] = c >>> 24, o[n + 1] = c >>> 16, o[n + 2] = c >>> 8, o[n + 3] = c;
|
|
150
|
+
}
|
|
151
|
+
return new U(o);
|
|
152
|
+
} else
|
|
153
|
+
throw new SyntaxError("could not parse UUID string");
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* @returns The 8-4-4-4-12 canonical hexadecimal string representation
|
|
157
|
+
* (`0189dcd5-5311-7d40-8db0-9496a2eef37b`).
|
|
158
|
+
*/
|
|
159
|
+
toString() {
|
|
160
|
+
let t = "";
|
|
161
|
+
for (let e = 0; e < this.bytes.length; e++)
|
|
162
|
+
t += Nt.charAt(this.bytes[e] >>> 4), t += Nt.charAt(this.bytes[e] & 15), (e === 3 || e === 5 || e === 7 || e === 9) && (t += "-");
|
|
163
|
+
return t;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* @returns The 32-digit hexadecimal representation without hyphens
|
|
167
|
+
* (`0189dcd553117d408db09496a2eef37b`).
|
|
168
|
+
*/
|
|
169
|
+
toHex() {
|
|
170
|
+
let t = "";
|
|
171
|
+
for (let e = 0; e < this.bytes.length; e++)
|
|
172
|
+
t += Nt.charAt(this.bytes[e] >>> 4), t += Nt.charAt(this.bytes[e] & 15);
|
|
173
|
+
return t;
|
|
174
|
+
}
|
|
175
|
+
/** @returns The 8-4-4-4-12 canonical hexadecimal string representation. */
|
|
176
|
+
toJSON() {
|
|
177
|
+
return this.toString();
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Reports the variant field value of the UUID or, if appropriate, "NIL" or
|
|
181
|
+
* "MAX".
|
|
182
|
+
*
|
|
183
|
+
* For convenience, this method reports "NIL" or "MAX" if `this` represents
|
|
184
|
+
* the Nil or Max UUID, although the Nil and Max UUIDs are technically
|
|
185
|
+
* subsumed under the variants `0b0` and `0b111`, respectively.
|
|
186
|
+
*/
|
|
187
|
+
getVariant() {
|
|
188
|
+
const t = this.bytes[8] >>> 4;
|
|
189
|
+
if (t < 0)
|
|
190
|
+
throw new Error("unreachable");
|
|
191
|
+
if (t <= 7)
|
|
192
|
+
return this.bytes.every((e) => e === 0) ? "NIL" : "VAR_0";
|
|
193
|
+
if (t <= 11)
|
|
194
|
+
return "VAR_10";
|
|
195
|
+
if (t <= 13)
|
|
196
|
+
return "VAR_110";
|
|
197
|
+
if (t <= 15)
|
|
198
|
+
return this.bytes.every((e) => e === 255) ? "MAX" : "VAR_RESERVED";
|
|
199
|
+
throw new Error("unreachable");
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Returns the version field value of the UUID or `undefined` if the UUID does
|
|
203
|
+
* not have the variant field value of `0b10`.
|
|
204
|
+
*/
|
|
205
|
+
getVersion() {
|
|
206
|
+
return this.getVariant() === "VAR_10" ? this.bytes[6] >>> 4 : void 0;
|
|
207
|
+
}
|
|
208
|
+
/** Creates an object from `this`. */
|
|
209
|
+
clone() {
|
|
210
|
+
return new U(this.bytes.slice(0));
|
|
211
|
+
}
|
|
212
|
+
/** Returns true if `this` is equivalent to `other`. */
|
|
213
|
+
equals(t) {
|
|
214
|
+
return this.compareTo(t) === 0;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Returns a negative integer, zero, or positive integer if `this` is less
|
|
218
|
+
* than, equal to, or greater than `other`, respectively.
|
|
219
|
+
*/
|
|
220
|
+
compareTo(t) {
|
|
221
|
+
for (let e = 0; e < 16; e++) {
|
|
222
|
+
const r = this.bytes[e] - t.bytes[e];
|
|
223
|
+
if (r !== 0)
|
|
224
|
+
return Math.sign(r);
|
|
225
|
+
}
|
|
226
|
+
return 0;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
class qe {
|
|
230
|
+
/**
|
|
231
|
+
* Creates a generator object with the default random number generator, or
|
|
232
|
+
* with the specified one if passed as an argument. The specified random
|
|
233
|
+
* number generator should be cryptographically strong and securely seeded.
|
|
234
|
+
*/
|
|
235
|
+
constructor(t) {
|
|
236
|
+
this.timestamp = 0, this.counter = 0, this.random = t ?? Be();
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Generates a new UUIDv7 object from the current timestamp, or resets the
|
|
240
|
+
* generator upon significant timestamp rollback.
|
|
241
|
+
*
|
|
242
|
+
* This method returns a monotonically increasing UUID by reusing the previous
|
|
243
|
+
* timestamp even if the up-to-date timestamp is smaller than the immediately
|
|
244
|
+
* preceding UUID's. However, when such a clock rollback is considered
|
|
245
|
+
* significant (i.e., by more than ten seconds), this method resets the
|
|
246
|
+
* generator and returns a new UUID based on the given timestamp, breaking the
|
|
247
|
+
* increasing order of UUIDs.
|
|
248
|
+
*
|
|
249
|
+
* See {@link generateOrAbort} for the other mode of generation and
|
|
250
|
+
* {@link generateOrResetCore} for the low-level primitive.
|
|
251
|
+
*/
|
|
252
|
+
generate() {
|
|
253
|
+
return this.generateOrResetCore(Date.now(), 1e4);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Generates a new UUIDv7 object from the current timestamp, or returns
|
|
257
|
+
* `undefined` upon significant timestamp rollback.
|
|
258
|
+
*
|
|
259
|
+
* This method returns a monotonically increasing UUID by reusing the previous
|
|
260
|
+
* timestamp even if the up-to-date timestamp is smaller than the immediately
|
|
261
|
+
* preceding UUID's. However, when such a clock rollback is considered
|
|
262
|
+
* significant (i.e., by more than ten seconds), this method aborts and
|
|
263
|
+
* returns `undefined` immediately.
|
|
264
|
+
*
|
|
265
|
+
* See {@link generate} for the other mode of generation and
|
|
266
|
+
* {@link generateOrAbortCore} for the low-level primitive.
|
|
267
|
+
*/
|
|
268
|
+
generateOrAbort() {
|
|
269
|
+
return this.generateOrAbortCore(Date.now(), 1e4);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Generates a new UUIDv7 object from the `unixTsMs` passed, or resets the
|
|
273
|
+
* generator upon significant timestamp rollback.
|
|
274
|
+
*
|
|
275
|
+
* This method is equivalent to {@link generate} except that it takes a custom
|
|
276
|
+
* timestamp and clock rollback allowance.
|
|
277
|
+
*
|
|
278
|
+
* @param rollbackAllowance - The amount of `unixTsMs` rollback that is
|
|
279
|
+
* considered significant. A suggested value is `10_000` (milliseconds).
|
|
280
|
+
* @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
|
|
281
|
+
*/
|
|
282
|
+
generateOrResetCore(t, e) {
|
|
283
|
+
let r = this.generateOrAbortCore(t, e);
|
|
284
|
+
return r === void 0 && (this.timestamp = 0, r = this.generateOrAbortCore(t, e)), r;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Generates a new UUIDv7 object from the `unixTsMs` passed, or returns
|
|
288
|
+
* `undefined` upon significant timestamp rollback.
|
|
289
|
+
*
|
|
290
|
+
* This method is equivalent to {@link generateOrAbort} except that it takes a
|
|
291
|
+
* custom timestamp and clock rollback allowance.
|
|
292
|
+
*
|
|
293
|
+
* @param rollbackAllowance - The amount of `unixTsMs` rollback that is
|
|
294
|
+
* considered significant. A suggested value is `10_000` (milliseconds).
|
|
295
|
+
* @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
|
|
296
|
+
*/
|
|
297
|
+
generateOrAbortCore(t, e) {
|
|
298
|
+
if (!Number.isInteger(t) || t < 0 || t > 281474976710655)
|
|
299
|
+
throw new RangeError(`\`unixTsMs\` must be a 48-bit positive integer, got ${t}`);
|
|
300
|
+
if (e < 0 || e > 281474976710655)
|
|
301
|
+
throw new RangeError(`\`rollbackAllowance\` out of reasonable range, got ${e}`);
|
|
302
|
+
if (t > this.timestamp)
|
|
303
|
+
this.timestamp = t, this.resetCounter();
|
|
304
|
+
else if (t + e >= this.timestamp)
|
|
305
|
+
this.counter++, this.counter > 4398046511103 && (this.timestamp++, this.resetCounter());
|
|
306
|
+
else
|
|
307
|
+
return;
|
|
308
|
+
return U.fromFieldsV7(this.timestamp, Math.trunc(this.counter / 2 ** 30), this.counter & 2 ** 30 - 1, this.random.nextUint32());
|
|
309
|
+
}
|
|
310
|
+
/** Initializes the counter at a 42-bit random integer. */
|
|
311
|
+
resetCounter() {
|
|
312
|
+
this.counter = this.random.nextUint32() * 1024 + (this.random.nextUint32() & 1023);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Generates a new UUIDv4 object utilizing the random number generator inside.
|
|
316
|
+
*
|
|
317
|
+
* @internal
|
|
318
|
+
*/
|
|
319
|
+
generateV4() {
|
|
320
|
+
const t = new Uint8Array(Uint32Array.of(this.random.nextUint32(), this.random.nextUint32(), this.random.nextUint32(), this.random.nextUint32()).buffer);
|
|
321
|
+
return t[6] = 64 | t[6] >>> 4, t[8] = 128 | t[8] >>> 2, U.ofInner(t);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const Be = () => {
|
|
325
|
+
if (typeof crypto < "u" && typeof crypto.getRandomValues < "u")
|
|
326
|
+
return new We();
|
|
327
|
+
if (typeof UUIDV7_DENY_WEAK_RNG < "u" && UUIDV7_DENY_WEAK_RNG)
|
|
328
|
+
throw new Error("no cryptographically strong RNG available");
|
|
329
|
+
return {
|
|
330
|
+
nextUint32: () => Math.trunc(Math.random() * 65536) * 65536 + Math.trunc(Math.random() * 65536)
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
class We {
|
|
334
|
+
constructor() {
|
|
335
|
+
this.buffer = new Uint32Array(8), this.cursor = 65535;
|
|
336
|
+
}
|
|
337
|
+
nextUint32() {
|
|
338
|
+
return this.cursor >= this.buffer.length && (crypto.getRandomValues(this.buffer), this.cursor = 0), this.buffer[this.cursor++];
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
let ce;
|
|
342
|
+
const Re = () => Je().toString(), Je = () => (ce || (ce = new qe())).generate();
|
|
343
|
+
class $i {
|
|
73
344
|
static {
|
|
74
345
|
this.isKlass = !0;
|
|
75
346
|
}
|
|
@@ -92,9 +363,9 @@ class Di {
|
|
|
92
363
|
}
|
|
93
364
|
}
|
|
94
365
|
function S(u) {
|
|
95
|
-
return u?.uuid ||
|
|
366
|
+
return u?.uuid || Re();
|
|
96
367
|
}
|
|
97
|
-
const
|
|
368
|
+
const je = /^[a-zA-Z0-9_]+$/;
|
|
98
369
|
class C {
|
|
99
370
|
// for Merged Entity
|
|
100
371
|
constructor(t, e) {
|
|
@@ -115,7 +386,7 @@ class C {
|
|
|
115
386
|
type: "string",
|
|
116
387
|
required: !0,
|
|
117
388
|
constraints: {
|
|
118
|
-
nameFormat: ({ name: t }) =>
|
|
389
|
+
nameFormat: ({ name: t }) => je.test(t)
|
|
119
390
|
}
|
|
120
391
|
},
|
|
121
392
|
properties: {
|
|
@@ -197,7 +468,7 @@ class C {
|
|
|
197
468
|
}
|
|
198
469
|
}
|
|
199
470
|
var Wt = /* @__PURE__ */ ((u) => (u.String = "string", u.Number = "number", u.Boolean = "boolean", u.Timestamp = "timestamp", u))(Wt || {});
|
|
200
|
-
const
|
|
471
|
+
const Ue = /^[a-zA-Z0-9_]+$/;
|
|
201
472
|
class Jt {
|
|
202
473
|
constructor(t, e) {
|
|
203
474
|
this._type = "Dictionary", this._options = e, this.uuid = S(e), this.name = t.name, this.type = t.type, this.collection = t.collection ?? !1, this.args = t.args, this.defaultValue = t.defaultValue, this.computation = t.computation;
|
|
@@ -218,7 +489,7 @@ class Jt {
|
|
|
218
489
|
required: !0,
|
|
219
490
|
collection: !1,
|
|
220
491
|
constraints: {
|
|
221
|
-
format: ({ name: t }) =>
|
|
492
|
+
format: ({ name: t }) => Ue.test(t),
|
|
222
493
|
length: ({ name: t }) => t.length > 1 && t.length < 5
|
|
223
494
|
}
|
|
224
495
|
},
|
|
@@ -291,7 +562,7 @@ class Jt {
|
|
|
291
562
|
return this.create(e.public, e.options);
|
|
292
563
|
}
|
|
293
564
|
}
|
|
294
|
-
const
|
|
565
|
+
const He = /^[a-zA-Z0-9_]+$/;
|
|
295
566
|
class T {
|
|
296
567
|
constructor(t, e) {
|
|
297
568
|
this._type = "Property", this._options = e, this.uuid = S(e), this.name = t.name, this.type = t.type, this.collection = t.collection, this.defaultValue = t.defaultValue, this.computed = t.computed, this.computation = t.computation;
|
|
@@ -311,7 +582,7 @@ class T {
|
|
|
311
582
|
type: "string",
|
|
312
583
|
required: !0,
|
|
313
584
|
constraints: {
|
|
314
|
-
format: ({ name: t }) =>
|
|
585
|
+
format: ({ name: t }) => He.test(t),
|
|
315
586
|
length: ({ name: t }) => t.length > 1 && t.length < 5
|
|
316
587
|
}
|
|
317
588
|
},
|
|
@@ -804,7 +1075,7 @@ class it {
|
|
|
804
1075
|
return this.create(e.public, e.options);
|
|
805
1076
|
}
|
|
806
1077
|
}
|
|
807
|
-
class
|
|
1078
|
+
class we {
|
|
808
1079
|
constructor(t, e) {
|
|
809
1080
|
this._type = "Transfer", this._options = e, this.uuid = S(e), this.name = t.name, this.source = t.source, this.target = t.target;
|
|
810
1081
|
}
|
|
@@ -837,7 +1108,7 @@ class Re {
|
|
|
837
1108
|
};
|
|
838
1109
|
}
|
|
839
1110
|
static create(t, e) {
|
|
840
|
-
const r = new
|
|
1111
|
+
const r = new we(t, e);
|
|
841
1112
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
842
1113
|
throw new Error(`duplicate uuid in options ${r.uuid}, Transfer`);
|
|
843
1114
|
return this.instances.push(r), r;
|
|
@@ -873,16 +1144,16 @@ class Re {
|
|
|
873
1144
|
return this.create(e.public, e.options);
|
|
874
1145
|
}
|
|
875
1146
|
}
|
|
876
|
-
function
|
|
1147
|
+
function Ne(u, t, e) {
|
|
877
1148
|
u.interactions.forEach((r) => t(r, e)), u.groups.forEach((r) => {
|
|
878
|
-
r.activities?.forEach((i) =>
|
|
1149
|
+
r.activities?.forEach((i) => Ne(i, t, r));
|
|
879
1150
|
});
|
|
880
1151
|
}
|
|
881
|
-
function
|
|
1152
|
+
function Pi(u) {
|
|
882
1153
|
const t = [];
|
|
883
|
-
return
|
|
1154
|
+
return Ne(u, (e) => t.push(e)), t;
|
|
884
1155
|
}
|
|
885
|
-
function
|
|
1156
|
+
function Di(u) {
|
|
886
1157
|
return null;
|
|
887
1158
|
}
|
|
888
1159
|
class nt {
|
|
@@ -1175,19 +1446,19 @@ class R {
|
|
|
1175
1446
|
throw new Error(`invalid bool expression type: ${JSON.stringify(this.raw)}`);
|
|
1176
1447
|
}
|
|
1177
1448
|
}
|
|
1178
|
-
const
|
|
1449
|
+
const Ge = {
|
|
1179
1450
|
"&&": "and",
|
|
1180
1451
|
"||": "or",
|
|
1181
1452
|
"!": "not"
|
|
1182
1453
|
};
|
|
1183
|
-
function
|
|
1454
|
+
function Ke(u) {
|
|
1184
1455
|
return { key: u };
|
|
1185
1456
|
}
|
|
1186
1457
|
function Tt(u, t, e) {
|
|
1187
1458
|
if (u.type === "LogicalExpression")
|
|
1188
1459
|
return {
|
|
1189
1460
|
type: "expression",
|
|
1190
|
-
operator:
|
|
1461
|
+
operator: Ge[u.operator],
|
|
1191
1462
|
left: Tt(u.left, t, e),
|
|
1192
1463
|
right: Tt(u.right, t, e)
|
|
1193
1464
|
};
|
|
@@ -1204,7 +1475,7 @@ function Tt(u, t, e) {
|
|
|
1204
1475
|
};
|
|
1205
1476
|
throw new Error("unknown ast node type");
|
|
1206
1477
|
}
|
|
1207
|
-
function
|
|
1478
|
+
function Oi(u, t = [], e = Ke) {
|
|
1208
1479
|
const r = Qe(t, "name"), i = De(u, { ecmaVersion: 2020 });
|
|
1209
1480
|
return new R(
|
|
1210
1481
|
Tt(i.body[0].expression, r, e)
|
|
@@ -1347,7 +1618,7 @@ function Vt(u) {
|
|
|
1347
1618
|
right: Vt(u.right)
|
|
1348
1619
|
});
|
|
1349
1620
|
}
|
|
1350
|
-
function
|
|
1621
|
+
function Fi(u) {
|
|
1351
1622
|
return Ct.create({
|
|
1352
1623
|
content: Vt(u)
|
|
1353
1624
|
});
|
|
@@ -1472,7 +1743,7 @@ class Gt {
|
|
|
1472
1743
|
return r.content && typeof r.content == "string" && r.content.startsWith("func::") && (r.content = new Function("return " + r.content.substring(6))()), this.create(r, e.options);
|
|
1473
1744
|
}
|
|
1474
1745
|
}
|
|
1475
|
-
class
|
|
1746
|
+
class Te {
|
|
1476
1747
|
constructor(t, e) {
|
|
1477
1748
|
this._type = "QueryItem", this._options = e, this.uuid = S(e), this.name = t.name, this.value = t.value;
|
|
1478
1749
|
}
|
|
@@ -1500,7 +1771,7 @@ class Ne {
|
|
|
1500
1771
|
};
|
|
1501
1772
|
}
|
|
1502
1773
|
static create(t, e) {
|
|
1503
|
-
const r = new
|
|
1774
|
+
const r = new Te(t, e);
|
|
1504
1775
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
1505
1776
|
throw new Error(`duplicate uuid in options ${r.uuid}, QueryItem`);
|
|
1506
1777
|
return this.instances.push(r), r;
|
|
@@ -1534,7 +1805,7 @@ class Ne {
|
|
|
1534
1805
|
return this.create(e.public, e.options);
|
|
1535
1806
|
}
|
|
1536
1807
|
}
|
|
1537
|
-
class
|
|
1808
|
+
class Se {
|
|
1538
1809
|
constructor(t, e) {
|
|
1539
1810
|
this._type = "Query", this._options = e, this.uuid = S(e), this.items = t.items;
|
|
1540
1811
|
}
|
|
@@ -1557,7 +1828,7 @@ class Te {
|
|
|
1557
1828
|
};
|
|
1558
1829
|
}
|
|
1559
1830
|
static create(t, e) {
|
|
1560
|
-
const r = new
|
|
1831
|
+
const r = new Se(t, e);
|
|
1561
1832
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
1562
1833
|
throw new Error(`duplicate uuid in options ${r.uuid}, Query`);
|
|
1563
1834
|
return this.instances.push(r), r;
|
|
@@ -1643,7 +1914,7 @@ class xt {
|
|
|
1643
1914
|
return this.create(e.public, e.options);
|
|
1644
1915
|
}
|
|
1645
1916
|
}
|
|
1646
|
-
const
|
|
1917
|
+
const Xe = xt.create({ name: "get" });
|
|
1647
1918
|
class st {
|
|
1648
1919
|
constructor(t, e) {
|
|
1649
1920
|
this._type = "Gateway", this._options = e, this.uuid = S(e), this.name = t.name;
|
|
@@ -2920,7 +3191,7 @@ class te {
|
|
|
2920
3191
|
return this.create(e.public, e.options);
|
|
2921
3192
|
}
|
|
2922
3193
|
}
|
|
2923
|
-
const
|
|
3194
|
+
const Ye = [
|
|
2924
3195
|
C,
|
|
2925
3196
|
P,
|
|
2926
3197
|
T,
|
|
@@ -2952,7 +3223,7 @@ const He = [
|
|
|
2952
3223
|
$t,
|
|
2953
3224
|
te
|
|
2954
3225
|
];
|
|
2955
|
-
|
|
3226
|
+
Ye.forEach((u) => {
|
|
2956
3227
|
u && u.displayName && Le(u.displayName, u);
|
|
2957
3228
|
});
|
|
2958
3229
|
class ee {
|
|
@@ -3062,7 +3333,7 @@ class ee {
|
|
|
3062
3333
|
}), this.create(r, e.options);
|
|
3063
3334
|
}
|
|
3064
3335
|
}
|
|
3065
|
-
class
|
|
3336
|
+
class ve {
|
|
3066
3337
|
constructor(t = [], e = []) {
|
|
3067
3338
|
this.clonedEntities = /* @__PURE__ */ new Map(), this.clonedRelations = /* @__PURE__ */ new Map(), this.reverseEntityMap = /* @__PURE__ */ new Map(), this.reverseRelationMap = /* @__PURE__ */ new Map(), this.originalEntities = [...t], this.originalRelations = [...e], (t.length > 0 || e.length > 0) && this.initializeClones();
|
|
3068
3339
|
}
|
|
@@ -3273,7 +3544,7 @@ class Se {
|
|
|
3273
3544
|
return null;
|
|
3274
3545
|
}
|
|
3275
3546
|
}
|
|
3276
|
-
function
|
|
3547
|
+
function Vi({ name: u, isRef: t = !1 }, e) {
|
|
3277
3548
|
return Y.create({
|
|
3278
3549
|
name: u,
|
|
3279
3550
|
content: u ? new Function("user", `return user.roles.includes('${u}')`) : function() {
|
|
@@ -3646,7 +3917,7 @@ class m {
|
|
|
3646
3917
|
);
|
|
3647
3918
|
}
|
|
3648
3919
|
}
|
|
3649
|
-
class
|
|
3920
|
+
class ze {
|
|
3650
3921
|
constructor(t, e, r, i) {
|
|
3651
3922
|
this.recordName = t, this.map = e, this.data = r, this.fromRelation = i;
|
|
3652
3923
|
}
|
|
@@ -3682,7 +3953,7 @@ class M {
|
|
|
3682
3953
|
e,
|
|
3683
3954
|
N,
|
|
3684
3955
|
new x(h, e, r.attributeQuery || [], s, a),
|
|
3685
|
-
new
|
|
3956
|
+
new ze(h, e, r.modifier),
|
|
3686
3957
|
i,
|
|
3687
3958
|
s,
|
|
3688
3959
|
a,
|
|
@@ -3776,7 +4047,7 @@ class _ {
|
|
|
3776
4047
|
}), this.parentLinkQueryTree && (t[f] = this.parentLinkQueryTree.getData()), t;
|
|
3777
4048
|
}
|
|
3778
4049
|
}
|
|
3779
|
-
const f = "&",
|
|
4050
|
+
const f = "&", Ze = "*";
|
|
3780
4051
|
class x {
|
|
3781
4052
|
constructor(t, e, r = [], i, s, a) {
|
|
3782
4053
|
this.recordName = t, this.map = e, this.data = r, this.parentRecord = i, this.attributeName = s, this.shouldQueryParentLinkData = a, this.relatedRecords = [], this.xToManyRecords = [], this.xToOneRecords = [], this.valueAttributes = [], this.id = Math.random();
|
|
@@ -3789,7 +4060,7 @@ class x {
|
|
|
3789
4060
|
this.parentLinkRecordQuery = M.create(y.linkName, this.map, d, void 0);
|
|
3790
4061
|
return;
|
|
3791
4062
|
}
|
|
3792
|
-
if (l ===
|
|
4063
|
+
if (l === Ze) {
|
|
3793
4064
|
o = new Set(this.map.getRecordInfo(this.recordName).valueAttributes.map((y) => y.attributeName));
|
|
3794
4065
|
return;
|
|
3795
4066
|
}
|
|
@@ -3798,10 +4069,10 @@ class x {
|
|
|
3798
4069
|
let y = l, N = d;
|
|
3799
4070
|
if (p.isLinkFiltered()) {
|
|
3800
4071
|
y = p.getBaseAttributeInfo().attributeName;
|
|
3801
|
-
const k = d.matchExpression, F = p.getLinkInfo().getBaseLinkInfo(), oe = new m(F.name, this.map, p.getMatchExpression()).rebase(p.isRecordSource() ? "target" : "source"),
|
|
4072
|
+
const k = d.matchExpression, F = p.getLinkInfo().getBaseLinkInfo(), oe = new m(F.name, this.map, p.getMatchExpression()).rebase(p.isRecordSource() ? "target" : "source"), Pe = k ? oe.and(k.data) : oe;
|
|
3802
4073
|
N = {
|
|
3803
4074
|
...d,
|
|
3804
|
-
matchExpression:
|
|
4075
|
+
matchExpression: Pe.data
|
|
3805
4076
|
};
|
|
3806
4077
|
}
|
|
3807
4078
|
const b = M.create(p.recordName, this.map, N, void 0, this.recordName, y, h, !1, l);
|
|
@@ -3919,7 +4190,7 @@ class x {
|
|
|
3919
4190
|
return this.parentLinkRecordQuery ? new x(this.recordName, this.map, this.data, this.parentRecord, this.attributeName, !0) : this;
|
|
3920
4191
|
}
|
|
3921
4192
|
}
|
|
3922
|
-
function
|
|
4193
|
+
function tr(u) {
|
|
3923
4194
|
const t = [];
|
|
3924
4195
|
return u.forEach((e) => t.push(...Array.isArray(e) ? e : [e])), t;
|
|
3925
4196
|
}
|
|
@@ -3929,7 +4200,7 @@ class L {
|
|
|
3929
4200
|
const s = this.map.getRecordInfo(e);
|
|
3930
4201
|
this.recordName = s.isFilteredEntity || s.isFilteredRelation ? s.resolvedBaseRecordName : e;
|
|
3931
4202
|
const [a, o, n] = this.map.groupAttributes(this.recordName, r ? Object.keys(r) : []);
|
|
3932
|
-
this.relatedEntitiesData =
|
|
4203
|
+
this.relatedEntitiesData = tr(o.map(
|
|
3933
4204
|
(l) => Array.isArray(r[l.attributeName]) ? r[l.attributeName].map((d) => new L(this.map, l.recordName, d, l)) : new L(this.map, l.recordName, r[l.attributeName], l)
|
|
3934
4205
|
)), this.valueAttributes = a, this.entityIdAttributes = n;
|
|
3935
4206
|
const c = this.map.getRecordInfo(this.recordName);
|
|
@@ -4006,7 +4277,7 @@ class L {
|
|
|
4006
4277
|
}), r;
|
|
4007
4278
|
}
|
|
4008
4279
|
}
|
|
4009
|
-
class
|
|
4280
|
+
class er {
|
|
4010
4281
|
constructor(t, e) {
|
|
4011
4282
|
this.map = t, this.queryAgent = e, this.dependencies = /* @__PURE__ */ new Map();
|
|
4012
4283
|
}
|
|
@@ -4232,7 +4503,7 @@ class Ye {
|
|
|
4232
4503
|
}
|
|
4233
4504
|
}
|
|
4234
4505
|
}
|
|
4235
|
-
class
|
|
4506
|
+
class rr {
|
|
4236
4507
|
constructor() {
|
|
4237
4508
|
this.aliasToPath = /* @__PURE__ */ new Map(), this.pathStrToAlias = /* @__PURE__ */ new Map(), this.aliasPlaceholder = 0;
|
|
4238
4509
|
}
|
|
@@ -4246,7 +4517,7 @@ class ze {
|
|
|
4246
4517
|
return this.aliasToPath.get(t);
|
|
4247
4518
|
}
|
|
4248
4519
|
}
|
|
4249
|
-
const
|
|
4520
|
+
const ke = ":root";
|
|
4250
4521
|
class vt {
|
|
4251
4522
|
constructor(t, e, r = []) {
|
|
4252
4523
|
this.label = t, this.parent = e, this.stack = r;
|
|
@@ -4261,9 +4532,9 @@ class vt {
|
|
|
4261
4532
|
return new vt(t, this);
|
|
4262
4533
|
}
|
|
4263
4534
|
}
|
|
4264
|
-
class
|
|
4535
|
+
class ir {
|
|
4265
4536
|
constructor(t) {
|
|
4266
|
-
this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(
|
|
4537
|
+
this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(ke, t), this.recursiveSaveLabelledRecordQuery(t);
|
|
4267
4538
|
}
|
|
4268
4539
|
recursiveSaveLabelledRecordQuery(t) {
|
|
4269
4540
|
t.attributeQuery?.relatedRecords.forEach((e) => {
|
|
@@ -4277,9 +4548,9 @@ class Ze {
|
|
|
4277
4548
|
return this.recordQueryByName.get(t);
|
|
4278
4549
|
}
|
|
4279
4550
|
}
|
|
4280
|
-
class
|
|
4551
|
+
class sr {
|
|
4281
4552
|
constructor(t, e) {
|
|
4282
|
-
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (r) => "?"), this.filteredEntityManager = new
|
|
4553
|
+
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (r) => "?"), this.filteredEntityManager = new er(t, this), this.initializeFilteredEntityDependencies();
|
|
4283
4554
|
}
|
|
4284
4555
|
/**
|
|
4285
4556
|
* 初始化所有 filtered entity 的依赖关系
|
|
@@ -4338,8 +4609,8 @@ ${b}
|
|
|
4338
4609
|
// 查 entity 和 查 relation 都是一样的。具体在 entityQuery 里面区别。
|
|
4339
4610
|
// TODO 为了性能,也可以把信息丢到客户端,然客户端去结构化???
|
|
4340
4611
|
// CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
|
|
4341
|
-
async findRecords(t, e = "", r, i = new vt(
|
|
4342
|
-
if (r || (r = new
|
|
4612
|
+
async findRecords(t, e = "", r, i = new vt(ke)) {
|
|
4613
|
+
if (r || (r = new ir(t)), t.goto) {
|
|
4343
4614
|
if (t.exit && await t.exit(i))
|
|
4344
4615
|
return [];
|
|
4345
4616
|
const l = r.get(t.goto);
|
|
@@ -4548,7 +4819,7 @@ ${b}
|
|
|
4548
4819
|
return t ? `${t}___` : "";
|
|
4549
4820
|
}
|
|
4550
4821
|
buildSelectClause(t, e = "") {
|
|
4551
|
-
const r = new
|
|
4822
|
+
const r = new rr();
|
|
4552
4823
|
return t.length ? [t.map(({ tableAliasAndField: s, attribute: a, nameContext: o }) => {
|
|
4553
4824
|
const n = [
|
|
4554
4825
|
`${this.withPrefix(e)}${o[0]}`,
|
|
@@ -5120,9 +5391,9 @@ WHERE "${s.idField}" = ${l()}
|
|
|
5120
5391
|
return p ? [N, ...p] : void 0;
|
|
5121
5392
|
}
|
|
5122
5393
|
}
|
|
5123
|
-
class
|
|
5394
|
+
class ar {
|
|
5124
5395
|
constructor(t, e) {
|
|
5125
|
-
this.map = t, this.database = e, this.agent = new
|
|
5396
|
+
this.map = t, this.database = e, this.agent = new sr(t, e);
|
|
5126
5397
|
}
|
|
5127
5398
|
async findOne(t, e, r = {}, i) {
|
|
5128
5399
|
const s = {
|
|
@@ -5382,7 +5653,7 @@ class kt {
|
|
|
5382
5653
|
return g(this.isFilteredRelation(), "only filtered relation can get resolved record name"), this.data.resolvedBaseRecordName;
|
|
5383
5654
|
}
|
|
5384
5655
|
}
|
|
5385
|
-
class
|
|
5656
|
+
class or {
|
|
5386
5657
|
constructor(t) {
|
|
5387
5658
|
this.data = t;
|
|
5388
5659
|
}
|
|
@@ -5578,7 +5849,7 @@ class rr {
|
|
|
5578
5849
|
return i.join(".");
|
|
5579
5850
|
}
|
|
5580
5851
|
}
|
|
5581
|
-
function
|
|
5852
|
+
function nr(u) {
|
|
5582
5853
|
const t = /* @__PURE__ */ new Map();
|
|
5583
5854
|
for (const e of u)
|
|
5584
5855
|
if (e.inputEntities)
|
|
@@ -5589,7 +5860,7 @@ function ir(u) {
|
|
|
5589
5860
|
}
|
|
5590
5861
|
return t;
|
|
5591
5862
|
}
|
|
5592
|
-
function
|
|
5863
|
+
function cr(u) {
|
|
5593
5864
|
const t = /* @__PURE__ */ new Map();
|
|
5594
5865
|
for (const e of u) {
|
|
5595
5866
|
const r = e.name || `${e.source.name}_${e.sourceProperty}_${e.targetProperty}_${e.target.name}`;
|
|
@@ -5603,36 +5874,36 @@ function sr(u) {
|
|
|
5603
5874
|
}
|
|
5604
5875
|
return t;
|
|
5605
5876
|
}
|
|
5606
|
-
function
|
|
5607
|
-
const e = new
|
|
5608
|
-
return
|
|
5877
|
+
function lr(u, t) {
|
|
5878
|
+
const e = new ve(u, t), r = nr(u), i = cr(t);
|
|
5879
|
+
return le(
|
|
5609
5880
|
u,
|
|
5610
5881
|
e,
|
|
5611
5882
|
r,
|
|
5612
5883
|
"entity"
|
|
5613
|
-
),
|
|
5884
|
+
), le(
|
|
5614
5885
|
t,
|
|
5615
5886
|
e,
|
|
5616
5887
|
i,
|
|
5617
5888
|
"relation"
|
|
5618
5889
|
), e.getAll();
|
|
5619
5890
|
}
|
|
5620
|
-
function
|
|
5891
|
+
function le(u, t, e, r) {
|
|
5621
5892
|
const i = u.filter((s) => {
|
|
5622
5893
|
const a = bt(s);
|
|
5623
5894
|
return a && a.length > 0;
|
|
5624
5895
|
});
|
|
5625
5896
|
if (i.length !== 0)
|
|
5626
5897
|
for (const s of i)
|
|
5627
|
-
|
|
5898
|
+
ur(
|
|
5628
5899
|
s,
|
|
5629
5900
|
t,
|
|
5630
5901
|
r,
|
|
5631
5902
|
e
|
|
5632
5903
|
);
|
|
5633
5904
|
}
|
|
5634
|
-
function
|
|
5635
|
-
const i = e === "entity", a = `__${Z(u)}_input_${e}`, o = i ? t.getEntityByName(u.name) : t.getRelationByName(u.name), [n, c] =
|
|
5905
|
+
function ur(u, t, e, r) {
|
|
5906
|
+
const i = e === "entity", a = `__${Z(u)}_input_${e}`, o = i ? t.getEntityByName(u.name) : t.getRelationByName(u.name), [n, c] = mr(
|
|
5636
5907
|
o,
|
|
5637
5908
|
a,
|
|
5638
5909
|
r,
|
|
@@ -5642,7 +5913,7 @@ function or(u, t, e, r) {
|
|
|
5642
5913
|
const l = bt(u);
|
|
5643
5914
|
if (l)
|
|
5644
5915
|
for (const d of l)
|
|
5645
|
-
|
|
5916
|
+
dr(
|
|
5646
5917
|
d,
|
|
5647
5918
|
c,
|
|
5648
5919
|
a,
|
|
@@ -5650,8 +5921,8 @@ function or(u, t, e, r) {
|
|
|
5650
5921
|
i
|
|
5651
5922
|
);
|
|
5652
5923
|
}
|
|
5653
|
-
function
|
|
5654
|
-
const [s, a] =
|
|
5924
|
+
function dr(u, t, e, r, i) {
|
|
5925
|
+
const [s, a] = yr(
|
|
5655
5926
|
u,
|
|
5656
5927
|
t,
|
|
5657
5928
|
e
|
|
@@ -5661,7 +5932,7 @@ function nr(u, t, e, r, i) {
|
|
|
5661
5932
|
const o = Z(a), n = i ? r.getEntityByName(o) : r.getRelationByName(o);
|
|
5662
5933
|
n && r.replace(s, n);
|
|
5663
5934
|
}
|
|
5664
|
-
function
|
|
5935
|
+
function hr(u, t) {
|
|
5665
5936
|
const e = /* @__PURE__ */ new Map(), r = bt(u);
|
|
5666
5937
|
if (r && r.length > 0)
|
|
5667
5938
|
for (const i of r) {
|
|
@@ -5675,8 +5946,8 @@ function cr(u, t) {
|
|
|
5675
5946
|
}
|
|
5676
5947
|
return e;
|
|
5677
5948
|
}
|
|
5678
|
-
function
|
|
5679
|
-
const r =
|
|
5949
|
+
function pr(u, t, e) {
|
|
5950
|
+
const r = hr(t, e);
|
|
5680
5951
|
return T.create({
|
|
5681
5952
|
name: u,
|
|
5682
5953
|
type: "json",
|
|
@@ -5688,14 +5959,14 @@ function lr(u, t, e) {
|
|
|
5688
5959
|
}
|
|
5689
5960
|
});
|
|
5690
5961
|
}
|
|
5691
|
-
function
|
|
5962
|
+
function fr(u, t, e) {
|
|
5692
5963
|
const r = bt(u), i = [], s = /* @__PURE__ */ new Map(), a = {};
|
|
5693
5964
|
for (const o of r) {
|
|
5694
5965
|
let n = o;
|
|
5695
5966
|
if (gt(n))
|
|
5696
5967
|
for (; n.baseEntity && n.properties.length === 0; )
|
|
5697
5968
|
n = n.baseEntity;
|
|
5698
|
-
else if (
|
|
5969
|
+
else if (br(n))
|
|
5699
5970
|
for (; n.baseRelation && n.properties.length === 0; )
|
|
5700
5971
|
n = n.baseRelation;
|
|
5701
5972
|
const c = Object.fromEntries(n.properties.map((h) => [h.name, h]));
|
|
@@ -5725,13 +5996,13 @@ function ur(u, t, e) {
|
|
|
5725
5996
|
}
|
|
5726
5997
|
return i;
|
|
5727
5998
|
}
|
|
5728
|
-
function
|
|
5729
|
-
const i =
|
|
5999
|
+
function mr(u, t, e, r) {
|
|
6000
|
+
const i = pr(
|
|
5730
6001
|
t,
|
|
5731
6002
|
u,
|
|
5732
6003
|
e
|
|
5733
6004
|
), s = [
|
|
5734
|
-
...
|
|
6005
|
+
...fr(
|
|
5735
6006
|
u,
|
|
5736
6007
|
e,
|
|
5737
6008
|
r
|
|
@@ -5789,7 +6060,7 @@ function dr(u, t, e, r) {
|
|
|
5789
6060
|
return [o, n || o];
|
|
5790
6061
|
}
|
|
5791
6062
|
}
|
|
5792
|
-
function
|
|
6063
|
+
function yr(u, t, e) {
|
|
5793
6064
|
if (gt(u)) {
|
|
5794
6065
|
const r = u, i = t;
|
|
5795
6066
|
let s = r;
|
|
@@ -5803,7 +6074,7 @@ function hr(u, t, e) {
|
|
|
5803
6074
|
}), [a, s];
|
|
5804
6075
|
} else {
|
|
5805
6076
|
const r = u, i = t, s = Z(r);
|
|
5806
|
-
return r.baseRelation ? [r,
|
|
6077
|
+
return r.baseRelation ? [r, gr(r)] : [P.create({
|
|
5807
6078
|
name: s,
|
|
5808
6079
|
baseRelation: i,
|
|
5809
6080
|
sourceProperty: r.sourceProperty,
|
|
@@ -5815,7 +6086,7 @@ function hr(u, t, e) {
|
|
|
5815
6086
|
}), r];
|
|
5816
6087
|
}
|
|
5817
6088
|
}
|
|
5818
|
-
function
|
|
6089
|
+
function gr(u) {
|
|
5819
6090
|
let t = u;
|
|
5820
6091
|
for (; t.baseRelation; )
|
|
5821
6092
|
t = t.baseRelation;
|
|
@@ -5824,7 +6095,7 @@ function pr(u) {
|
|
|
5824
6095
|
function gt(u) {
|
|
5825
6096
|
return "inputEntities" in u || !("sourceProperty" in u);
|
|
5826
6097
|
}
|
|
5827
|
-
function
|
|
6098
|
+
function br(u) {
|
|
5828
6099
|
return "sourceProperty" in u;
|
|
5829
6100
|
}
|
|
5830
6101
|
function bt(u) {
|
|
@@ -5833,7 +6104,7 @@ function bt(u) {
|
|
|
5833
6104
|
function Z(u) {
|
|
5834
6105
|
return gt(u), u.name;
|
|
5835
6106
|
}
|
|
5836
|
-
class
|
|
6107
|
+
class Rr {
|
|
5837
6108
|
constructor(t, e, r, i = []) {
|
|
5838
6109
|
this.entities = t, this.relations = e, this.database = r, this.mergeLinks = i, this.fieldNameMap = /* @__PURE__ */ new Map(), this.usedFieldNames = /* @__PURE__ */ new Set(), this.fieldCounter = 1, this.recordToTableMap = /* @__PURE__ */ new Map(), this.tableToRecordsMap = /* @__PURE__ */ new Map(), this.mergeLog = [], this.tables = {}, this.map = { links: {}, records: {} }, this.buildMap(), this.buildTables();
|
|
5839
6110
|
}
|
|
@@ -5928,8 +6199,8 @@ class mr {
|
|
|
5928
6199
|
}
|
|
5929
6200
|
];
|
|
5930
6201
|
}));
|
|
5931
|
-
e && g(!r.source && !r.target, "source and target is reserved name for relation attributes"), r[
|
|
5932
|
-
name:
|
|
6202
|
+
e && g(!r.source && !r.target, "source and target is reserved name for relation attributes"), r[ue] = {
|
|
6203
|
+
name: ue,
|
|
5933
6204
|
type: "id",
|
|
5934
6205
|
fieldType: this.database.mapToDBFieldType("pk")
|
|
5935
6206
|
};
|
|
@@ -6112,7 +6383,7 @@ class mr {
|
|
|
6112
6383
|
* 统一处理 merged entities 和 merged relations
|
|
6113
6384
|
*/
|
|
6114
6385
|
processMergedItems() {
|
|
6115
|
-
const t =
|
|
6386
|
+
const t = lr(
|
|
6116
6387
|
this.entities,
|
|
6117
6388
|
this.relations
|
|
6118
6389
|
);
|
|
@@ -6226,7 +6497,7 @@ ${Object.values(this.tables[t].columns).map((r) => ` "${r.name}" ${r.fieldTyp
|
|
|
6226
6497
|
return this.fieldCounter++, this.fieldNameMap.set(t, i), this.usedFieldNames.add(i), i;
|
|
6227
6498
|
}
|
|
6228
6499
|
}
|
|
6229
|
-
const et = "_System_", q = "_Dictionary_",
|
|
6500
|
+
const et = "_System_", q = "_Dictionary_", ue = "id", ot = "_rowId", wr = C.create({
|
|
6230
6501
|
name: et,
|
|
6231
6502
|
properties: [
|
|
6232
6503
|
T.create({
|
|
@@ -6245,7 +6516,7 @@ const et = "_System_", q = "_Dictionary_", le = "id", ot = "_rowId", yr = C.crea
|
|
|
6245
6516
|
collection: !1
|
|
6246
6517
|
})
|
|
6247
6518
|
]
|
|
6248
|
-
}),
|
|
6519
|
+
}), Nr = C.create({
|
|
6249
6520
|
name: q,
|
|
6250
6521
|
properties: [
|
|
6251
6522
|
T.create({
|
|
@@ -6259,8 +6530,8 @@ const et = "_System_", q = "_Dictionary_", le = "id", ot = "_rowId", yr = C.crea
|
|
|
6259
6530
|
collection: !1
|
|
6260
6531
|
})
|
|
6261
6532
|
]
|
|
6262
|
-
}),
|
|
6263
|
-
class
|
|
6533
|
+
}), Qi = 0, Ot = 1, Li = 2;
|
|
6534
|
+
class Tr {
|
|
6264
6535
|
constructor(t, e) {
|
|
6265
6536
|
this.controller = t, this.scheduler = e, this.sourceMaps = [], this.sourceMapTree = {};
|
|
6266
6537
|
}
|
|
@@ -6490,28 +6761,28 @@ class A {
|
|
|
6490
6761
|
this.skip = () => new At();
|
|
6491
6762
|
}
|
|
6492
6763
|
static {
|
|
6493
|
-
this.resolved = (t, e) => new
|
|
6764
|
+
this.resolved = (t, e) => new Ie(t, e);
|
|
6494
6765
|
}
|
|
6495
6766
|
static {
|
|
6496
|
-
this.async = (t) => new
|
|
6767
|
+
this.async = (t) => new Ee(t);
|
|
6497
6768
|
}
|
|
6498
6769
|
static {
|
|
6499
|
-
this.fullRecompute = (t) => new
|
|
6770
|
+
this.fullRecompute = (t) => new Ae(t);
|
|
6500
6771
|
}
|
|
6501
6772
|
}
|
|
6502
6773
|
class At extends A {
|
|
6503
6774
|
}
|
|
6504
|
-
class
|
|
6775
|
+
class Ae extends A {
|
|
6505
6776
|
constructor(t) {
|
|
6506
6777
|
super(), this.reason = t;
|
|
6507
6778
|
}
|
|
6508
6779
|
}
|
|
6509
|
-
class
|
|
6780
|
+
class Ee extends A {
|
|
6510
6781
|
constructor(t) {
|
|
6511
6782
|
super(), this.args = t;
|
|
6512
6783
|
}
|
|
6513
6784
|
}
|
|
6514
|
-
class
|
|
6785
|
+
class Ie extends A {
|
|
6515
6786
|
constructor(t, e) {
|
|
6516
6787
|
super(), this.result = t, this.args = e;
|
|
6517
6788
|
}
|
|
@@ -6553,7 +6824,7 @@ function Lt(u, t) {
|
|
|
6553
6824
|
return !1;
|
|
6554
6825
|
return !0;
|
|
6555
6826
|
}
|
|
6556
|
-
class
|
|
6827
|
+
class Ce {
|
|
6557
6828
|
constructor(t) {
|
|
6558
6829
|
this.data = t, this.map = {};
|
|
6559
6830
|
for (const e of t.transfers)
|
|
@@ -6579,32 +6850,32 @@ function v(u, t) {
|
|
|
6579
6850
|
if (!u)
|
|
6580
6851
|
throw new Error(t);
|
|
6581
6852
|
}
|
|
6582
|
-
function
|
|
6853
|
+
function _i(u, t) {
|
|
6583
6854
|
return new Map(Array.from(u.entries()).map(([e, r]) => [e, t(e, r)]));
|
|
6584
6855
|
}
|
|
6585
|
-
function
|
|
6856
|
+
function qi(u, t) {
|
|
6586
6857
|
return Object.fromEntries(Object.entries(u).map(([e, r]) => [e, t(e, r)]));
|
|
6587
6858
|
}
|
|
6588
|
-
async function
|
|
6859
|
+
async function Bi(u, t) {
|
|
6589
6860
|
for (let e of u)
|
|
6590
6861
|
if (!await t(e)) return !1;
|
|
6591
6862
|
return !0;
|
|
6592
6863
|
}
|
|
6593
|
-
async function
|
|
6864
|
+
async function Sr(u, t) {
|
|
6594
6865
|
for (let e of u)
|
|
6595
6866
|
if (await t(e)) return !0;
|
|
6596
6867
|
return !1;
|
|
6597
6868
|
}
|
|
6598
|
-
async function
|
|
6869
|
+
async function vr(u, t) {
|
|
6599
6870
|
for (let e of u) {
|
|
6600
6871
|
const r = await t(e);
|
|
6601
6872
|
if (r !== !0) return r;
|
|
6602
6873
|
}
|
|
6603
6874
|
return !0;
|
|
6604
6875
|
}
|
|
6605
|
-
class
|
|
6876
|
+
class kr {
|
|
6606
6877
|
constructor(t, e, r) {
|
|
6607
|
-
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6878
|
+
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new Ce(this.args), this.defaultState = this.args.defaultState;
|
|
6608
6879
|
for (const i of this.args.transfers) {
|
|
6609
6880
|
const s = `${i.trigger.recordName}_${i.trigger.type}`;
|
|
6610
6881
|
this.eventDeps[s] = {
|
|
@@ -6633,9 +6904,9 @@ class Nr {
|
|
|
6633
6904
|
return s ? (await this.state.currentState.set(s.name), s.computeValue ? await s.computeValue.call(this.controller, t, e) : s.name) : A.skip();
|
|
6634
6905
|
}
|
|
6635
6906
|
}
|
|
6636
|
-
class
|
|
6907
|
+
class Ar {
|
|
6637
6908
|
constructor(t, e, r) {
|
|
6638
|
-
this.controller = t, this.args = e, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6909
|
+
this.controller = t, this.args = e, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new Ce(this.args), this.defaultState = this.args.defaultState, this.dataContext = r;
|
|
6639
6910
|
for (const i of this.args.transfers) {
|
|
6640
6911
|
const s = `${i.trigger.recordName}_${i.trigger.type}`;
|
|
6641
6912
|
this.eventDeps[s] = {
|
|
@@ -6681,17 +6952,17 @@ Or if you want to use state name as value, you should not set ${this.dataContext
|
|
|
6681
6952
|
};
|
|
6682
6953
|
}
|
|
6683
6954
|
}
|
|
6684
|
-
const
|
|
6955
|
+
const Wi = z.create({
|
|
6685
6956
|
name: "nonExistent",
|
|
6686
6957
|
computeValue: () => null
|
|
6687
|
-
}),
|
|
6958
|
+
}), Ji = z.create({
|
|
6688
6959
|
name: "nonDeleted",
|
|
6689
6960
|
computeValue: () => !1
|
|
6690
|
-
}),
|
|
6961
|
+
}), ji = z.create({
|
|
6691
6962
|
name: "deleted",
|
|
6692
6963
|
computeValue: () => !0
|
|
6693
|
-
}),
|
|
6694
|
-
class
|
|
6964
|
+
}), Er = [kr, Ar];
|
|
6965
|
+
class Ir {
|
|
6695
6966
|
constructor(t, e, r) {
|
|
6696
6967
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, this.matchRecordToWeight = this.args.callback.bind(this.controller), this.record = this.args.record, this.dataDeps = {
|
|
6697
6968
|
main: {
|
|
@@ -6744,7 +7015,7 @@ class vr {
|
|
|
6744
7015
|
return r;
|
|
6745
7016
|
}
|
|
6746
7017
|
}
|
|
6747
|
-
class
|
|
7018
|
+
class Cr {
|
|
6748
7019
|
constructor(t, e, r) {
|
|
6749
7020
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, this.matchRecordToWeight = this.args.callback.bind(this.controller), this.relation = this.controller.relations.find((a) => a.source === r.host && a.sourceProperty === this.args.property || a.target === r.host && a.targetProperty === this.args.property), v(this.relation, "weighted summation computation must specify property"), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === r.host.name, v(this.isSource ? this.relation.source === r.host : this.relation.target === r.host, "weighted summation computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property || this.relationAttr, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
6750
7021
|
const i = this.args.attributeQuery || [];
|
|
@@ -6820,8 +7091,8 @@ class kr {
|
|
|
6820
7091
|
return s;
|
|
6821
7092
|
}
|
|
6822
7093
|
}
|
|
6823
|
-
const
|
|
6824
|
-
class
|
|
7094
|
+
const xr = [Ir, Cr];
|
|
7095
|
+
class Mr {
|
|
6825
7096
|
constructor(t, e, r) {
|
|
6826
7097
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.dataDeps = {
|
|
6827
7098
|
main: {
|
|
@@ -6874,7 +7145,7 @@ class Er {
|
|
|
6874
7145
|
return a === s;
|
|
6875
7146
|
}
|
|
6876
7147
|
}
|
|
6877
|
-
class
|
|
7148
|
+
class $r {
|
|
6878
7149
|
constructor(t, e, r) {
|
|
6879
7150
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.relation = this.controller.relations.find((a) => a.source === r.host && a.sourceProperty === this.args.property || a.target === r.host && a.targetProperty === this.args.property), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === r.host.name, v(this.isSource ? this.relation.source === r.host : this.relation.target === r.host, "every computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
6880
7151
|
const i = this.args.attributeQuery || [];
|
|
@@ -6948,8 +7219,8 @@ class Ir {
|
|
|
6948
7219
|
return a === o;
|
|
6949
7220
|
}
|
|
6950
7221
|
}
|
|
6951
|
-
const
|
|
6952
|
-
class
|
|
7222
|
+
const Pr = [Mr, $r];
|
|
7223
|
+
class Dr {
|
|
6953
7224
|
constructor(t, e, r) {
|
|
6954
7225
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.dataDeps = {
|
|
6955
7226
|
main: {
|
|
@@ -7002,7 +7273,7 @@ class xr {
|
|
|
7002
7273
|
return s > 0;
|
|
7003
7274
|
}
|
|
7004
7275
|
}
|
|
7005
|
-
class
|
|
7276
|
+
class Or {
|
|
7006
7277
|
constructor(t, e, r) {
|
|
7007
7278
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.relation = this.controller.relations.find((n) => n.source === r.host && n.sourceProperty === this.args.property || n.target === r.host && n.targetProperty === this.args.property), v(this.relation, `cannot find relation for property ${this.args.property} in "Any" computation`), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === r.host.name, v(this.isSource ? this.relation.source === r.host : this.relation.target === r.host, "any computation relation direction error");
|
|
7008
7279
|
let i = this.relation.baseRelation || this.relation;
|
|
@@ -7078,8 +7349,8 @@ class Mr {
|
|
|
7078
7349
|
return s > 0;
|
|
7079
7350
|
}
|
|
7080
7351
|
}
|
|
7081
|
-
const
|
|
7082
|
-
class
|
|
7352
|
+
const Fr = [Dr, Or];
|
|
7353
|
+
class Vr {
|
|
7083
7354
|
constructor(t, e, r) {
|
|
7084
7355
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, this.record = this.args.record, this.callback = this.args.callback?.bind(this) || (() => !0), this.dataDeps = {
|
|
7085
7356
|
main: {
|
|
@@ -7129,7 +7400,7 @@ class Pr {
|
|
|
7129
7400
|
return s = Math.max(0, s), await this.state.count.set(s), s;
|
|
7130
7401
|
}
|
|
7131
7402
|
}
|
|
7132
|
-
class
|
|
7403
|
+
class Qr {
|
|
7133
7404
|
constructor(t, e, r) {
|
|
7134
7405
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, this.callback = this.args.callback?.bind(this.controller), this.args.property ? this.relation = this.controller.relations.find((a) => a.source === r.host && a.sourceProperty === this.args.property || a.target === r.host && a.targetProperty === this.args.property) : this.relation = this.args.record, this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === r.host.name, v(this.isSource ? this.relation.source === r.host : this.relation.target === r.host, "count computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property || this.relationAttr, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
7135
7406
|
const i = this.args.attributeQuery || [];
|
|
@@ -7211,8 +7482,8 @@ class Dr {
|
|
|
7211
7482
|
return a;
|
|
7212
7483
|
}
|
|
7213
7484
|
}
|
|
7214
|
-
const
|
|
7215
|
-
class
|
|
7485
|
+
const Lr = [Vr, Qr];
|
|
7486
|
+
class _r {
|
|
7216
7487
|
constructor(t, e, r) {
|
|
7217
7488
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, v(!(this.args.record && this.args.eventDeps), "Transform must have either record or eventDep"), v(!(this.args.dataDeps && this.args.eventDeps), "Transform must have either dataDeps or eventDeps"), this.transformCallback = this.args.callback.bind(this.controller), this.args.eventDeps ? this.eventDeps = this.args.eventDeps : (v(this.args.dataDeps?._source === void 0, "dataDep name `_source` is reserved for Transform"), this.dataDeps = {
|
|
7218
7489
|
...this.args.dataDeps || {},
|
|
@@ -7320,7 +7591,7 @@ class Fr {
|
|
|
7320
7591
|
return i;
|
|
7321
7592
|
}
|
|
7322
7593
|
}
|
|
7323
|
-
const
|
|
7594
|
+
const qr = [_r];
|
|
7324
7595
|
class $ {
|
|
7325
7596
|
constructor(t) {
|
|
7326
7597
|
this.node = t;
|
|
@@ -7592,7 +7863,7 @@ class re {
|
|
|
7592
7863
|
}
|
|
7593
7864
|
}
|
|
7594
7865
|
}
|
|
7595
|
-
class
|
|
7866
|
+
class Br {
|
|
7596
7867
|
constructor(t, e, r) {
|
|
7597
7868
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = this.args.dataDeps ?? {}, this.callback = (i, s) => this.args.callback.call(this.controller, i, s), this.nextRecomputeTime = this.args.nextRecomputeTime ? (i, s) => this.args.nextRecomputeTime.call(this.controller, i, s) : void 0;
|
|
7598
7869
|
}
|
|
@@ -7624,7 +7895,7 @@ class Qr {
|
|
|
7624
7895
|
return await this.state.lastRecomputeTime.set(r), await this.state.nextRecomputeTime.set(s), i;
|
|
7625
7896
|
}
|
|
7626
7897
|
}
|
|
7627
|
-
class
|
|
7898
|
+
class Wr {
|
|
7628
7899
|
constructor(t, e, r) {
|
|
7629
7900
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {
|
|
7630
7901
|
_current: {
|
|
@@ -7662,8 +7933,8 @@ class Lr {
|
|
|
7662
7933
|
return await this.state.lastRecomputeTime.set(e, i), await this.state.nextRecomputeTime.set(e, a), s;
|
|
7663
7934
|
}
|
|
7664
7935
|
}
|
|
7665
|
-
const
|
|
7666
|
-
class
|
|
7936
|
+
const Jr = [Br, Wr];
|
|
7937
|
+
class jr {
|
|
7667
7938
|
constructor(t, e, r) {
|
|
7668
7939
|
if (this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, this.record = this.args.record, !this.args.attributeQuery || this.args.attributeQuery.length === 0)
|
|
7669
7940
|
throw new Error("Sum computation requires attributeQuery with at least one field");
|
|
@@ -7724,7 +7995,7 @@ class qr {
|
|
|
7724
7995
|
return s;
|
|
7725
7996
|
}
|
|
7726
7997
|
}
|
|
7727
|
-
class
|
|
7998
|
+
class Ur {
|
|
7728
7999
|
constructor(t, e, r) {
|
|
7729
8000
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, this.relation = this.controller.relations.find((o) => o.source === r.host && o.sourceProperty === this.args.property || o.target === r.host && o.targetProperty === this.args.property), v(this.relation, "summation computation must specify either property or record"), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === r.host.name, v(this.isSource ? this.relation.source === r.host : this.relation.target === r.host, "summation computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
7730
8001
|
const i = this.args.attributeQuery || [];
|
|
@@ -7813,8 +8084,8 @@ class Br {
|
|
|
7813
8084
|
return a;
|
|
7814
8085
|
}
|
|
7815
8086
|
}
|
|
7816
|
-
const
|
|
7817
|
-
class
|
|
8087
|
+
const Hr = [jr, Ur];
|
|
8088
|
+
class Gr {
|
|
7818
8089
|
constructor(t, e, r) {
|
|
7819
8090
|
if (this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, this.record = this.args.record, !this.args.attributeQuery || this.args.attributeQuery.length === 0)
|
|
7820
8091
|
throw new Error("Average computation requires attributeQuery with at least one field");
|
|
@@ -7887,7 +8158,7 @@ class Jr {
|
|
|
7887
8158
|
return await this.state.sum.set(a), await this.state.count.set(s), s > 0 ? a / s : 0;
|
|
7888
8159
|
}
|
|
7889
8160
|
}
|
|
7890
|
-
class
|
|
8161
|
+
class Kr {
|
|
7891
8162
|
constructor(t, e, r) {
|
|
7892
8163
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !0, this.dataDeps = {}, this.relation = this.controller.relations.find((o) => o.source === r.host && o.sourceProperty === this.args.property || o.target === r.host && o.targetProperty === this.args.property), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === r.host.name, v(this.isSource ? this.relation.source === r.host : this.relation.target === r.host, "average computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property || this.relationAttr, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
7893
8164
|
const i = this.args.attributeQuery || [];
|
|
@@ -7971,7 +8242,7 @@ class jr {
|
|
|
7971
8242
|
return await this.state.count.set(e.record, a), a > 0 ? o / a : 0;
|
|
7972
8243
|
}
|
|
7973
8244
|
}
|
|
7974
|
-
const
|
|
8245
|
+
const Xr = [Gr, Kr];
|
|
7975
8246
|
class Pt {
|
|
7976
8247
|
constructor(t, e, r) {
|
|
7977
8248
|
this.controller = t, this.args = e, this.dataContext = r, this.state = {}, this.dataDeps = {}, this.useLastValue = e.useLastValue !== void 0 ? e.useLastValue : !0, e.dataDeps && (this.dataDeps = e.dataDeps), e.compute && (this.computeCallback = e.compute, this.compute = async (...i) => {
|
|
@@ -8043,22 +8314,22 @@ class Pt {
|
|
|
8043
8314
|
return A.skip();
|
|
8044
8315
|
}
|
|
8045
8316
|
}
|
|
8046
|
-
class
|
|
8317
|
+
class Yr extends Pt {
|
|
8047
8318
|
static {
|
|
8048
8319
|
this.contextType = "global";
|
|
8049
8320
|
}
|
|
8050
8321
|
}
|
|
8051
|
-
class
|
|
8322
|
+
class zr extends Pt {
|
|
8052
8323
|
static {
|
|
8053
8324
|
this.contextType = "entity";
|
|
8054
8325
|
}
|
|
8055
8326
|
}
|
|
8056
|
-
class
|
|
8327
|
+
class Zr extends Pt {
|
|
8057
8328
|
static {
|
|
8058
8329
|
this.contextType = "relation";
|
|
8059
8330
|
}
|
|
8060
8331
|
}
|
|
8061
|
-
class
|
|
8332
|
+
class ti extends Pt {
|
|
8062
8333
|
static {
|
|
8063
8334
|
this.contextType = "property";
|
|
8064
8335
|
}
|
|
@@ -8073,11 +8344,11 @@ If you want to use aggregated data from all records in the entity/relation, you
|
|
|
8073
8344
|
super(t, e, r);
|
|
8074
8345
|
}
|
|
8075
8346
|
}
|
|
8076
|
-
const
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8347
|
+
const ei = [
|
|
8348
|
+
Yr,
|
|
8349
|
+
zr,
|
|
8350
|
+
Zr,
|
|
8351
|
+
ti
|
|
8081
8352
|
];
|
|
8082
8353
|
class H extends Error {
|
|
8083
8354
|
constructor(t, e = {}) {
|
|
@@ -8213,7 +8484,7 @@ class G extends H {
|
|
|
8213
8484
|
}), this.interactionName = e.interactionName, this.userId = e.userId, this.payload = e.payload, this.executionPhase = e.executionPhase, this.severity = e.severity || Q.HIGH;
|
|
8214
8485
|
}
|
|
8215
8486
|
}
|
|
8216
|
-
class
|
|
8487
|
+
class de extends H {
|
|
8217
8488
|
constructor(t, e = {}) {
|
|
8218
8489
|
super(t, {
|
|
8219
8490
|
errorType: e.context?.errorType || "ActivityError",
|
|
@@ -8245,7 +8516,7 @@ class V extends H {
|
|
|
8245
8516
|
}), this.handleName = e.handleName, this.computationName = e.computationName, this.dataContext = e.dataContext, this.computationPhase = e.computationPhase, this.severity = e.severity || Q.MEDIUM;
|
|
8246
8517
|
}
|
|
8247
8518
|
}
|
|
8248
|
-
class
|
|
8519
|
+
class he extends V {
|
|
8249
8520
|
constructor(t, e = {}) {
|
|
8250
8521
|
super(t, {
|
|
8251
8522
|
...e,
|
|
@@ -8363,9 +8634,9 @@ class O extends H {
|
|
|
8363
8634
|
}
|
|
8364
8635
|
}
|
|
8365
8636
|
const Ft = "_ASYNC_TASK_";
|
|
8366
|
-
class
|
|
8637
|
+
class ri {
|
|
8367
8638
|
constructor(t, e, r, i, s) {
|
|
8368
|
-
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new
|
|
8639
|
+
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new Tr(this.controller, this), this.buildComputationHandleMap(s);
|
|
8369
8640
|
const a = [];
|
|
8370
8641
|
i.forEach((o) => {
|
|
8371
8642
|
o.computation && a.push({ dataContext: { type: "global", id: o }, args: o.computation });
|
|
@@ -8756,7 +9027,7 @@ class zr {
|
|
|
8756
9027
|
try {
|
|
8757
9028
|
o = await this.controller.retrieveLastValue(t.dataContext, r);
|
|
8758
9029
|
} catch (n) {
|
|
8759
|
-
throw new
|
|
9030
|
+
throw new he("Failed to retrieve last value for incremental computation", {
|
|
8760
9031
|
handleName: t.constructor.name,
|
|
8761
9032
|
computationName: t.args.constructor.displayName,
|
|
8762
9033
|
dataContext: t.dataContext,
|
|
@@ -8770,7 +9041,7 @@ class zr {
|
|
|
8770
9041
|
try {
|
|
8771
9042
|
o = await this.controller.retrieveLastValue(t.dataContext, r);
|
|
8772
9043
|
} catch (n) {
|
|
8773
|
-
throw new
|
|
9044
|
+
throw new he("Failed to retrieve last value for incremental patch computation", {
|
|
8774
9045
|
handleName: t.constructor.name,
|
|
8775
9046
|
computationName: t.args.constructor.displayName,
|
|
8776
9047
|
dataContext: t.dataContext,
|
|
@@ -8785,7 +9056,7 @@ class zr {
|
|
|
8785
9056
|
dataContext: t.dataContext,
|
|
8786
9057
|
computationPhase: "type-validation"
|
|
8787
9058
|
});
|
|
8788
|
-
if (s instanceof
|
|
9059
|
+
if (s instanceof Ae) {
|
|
8789
9060
|
const o = t;
|
|
8790
9061
|
if (!o.compute)
|
|
8791
9062
|
throw new V("compute must be defined for computation when incrementalCompute returns ComputationResultFullRecompute", {
|
|
@@ -8808,7 +9079,7 @@ class zr {
|
|
|
8808
9079
|
}
|
|
8809
9080
|
if (s instanceof At)
|
|
8810
9081
|
return;
|
|
8811
|
-
if (s instanceof
|
|
9082
|
+
if (s instanceof Ee)
|
|
8812
9083
|
try {
|
|
8813
9084
|
return await this.createAsyncTask(t, s.args, r);
|
|
8814
9085
|
} catch (o) {
|
|
@@ -8821,7 +9092,7 @@ class zr {
|
|
|
8821
9092
|
});
|
|
8822
9093
|
}
|
|
8823
9094
|
try {
|
|
8824
|
-
const o = s instanceof
|
|
9095
|
+
const o = s instanceof Ie ? await t.asyncReturn(s.result, s.args) : s;
|
|
8825
9096
|
t.incrementalPatchCompute ? await this.controller.applyResultPatch(t.dataContext, o, r) : await this.controller.applyResult(t.dataContext, o, r);
|
|
8826
9097
|
} catch (o) {
|
|
8827
9098
|
throw new V("Failed to apply computation result", {
|
|
@@ -8942,7 +9213,7 @@ class zr {
|
|
|
8942
9213
|
}
|
|
8943
9214
|
}
|
|
8944
9215
|
}
|
|
8945
|
-
class
|
|
9216
|
+
class xe {
|
|
8946
9217
|
constructor(t, e, r) {
|
|
8947
9218
|
this.interaction = t, this.controller = e, this.activitySeqCall = r, this.system = e.system;
|
|
8948
9219
|
}
|
|
@@ -8996,7 +9267,7 @@ class Ce {
|
|
|
8996
9267
|
}
|
|
8997
9268
|
if (this.isConceptAlias(e)) {
|
|
8998
9269
|
const s = [];
|
|
8999
|
-
return await
|
|
9270
|
+
return await Sr(e.for, async (o) => {
|
|
9000
9271
|
const n = await this.isConcept(t, o);
|
|
9001
9272
|
return n === !0 ? !0 : (s.push(n), !1);
|
|
9002
9273
|
}) ? !0 : { name: e.name, type: "conceptAlias", stack: i, error: s };
|
|
@@ -9036,7 +9307,7 @@ class Ce {
|
|
|
9036
9307
|
throw O.payloadValidationFailed(i.name, "data is not a ref", s);
|
|
9037
9308
|
if (i.base)
|
|
9038
9309
|
if (i.isCollection) {
|
|
9039
|
-
const a = await
|
|
9310
|
+
const a = await vr(s, (o) => this.checkConcept(o, i.base));
|
|
9040
9311
|
if (a !== !0)
|
|
9041
9312
|
throw O.conceptCheckFailed(i.name, a);
|
|
9042
9313
|
} else {
|
|
@@ -9092,7 +9363,7 @@ class Ce {
|
|
|
9092
9363
|
v(!r.sideEffects[o], `sideEffect ${o} already exists`), r.sideEffects[o] = { result: n, error: c };
|
|
9093
9364
|
}
|
|
9094
9365
|
isGetInteraction() {
|
|
9095
|
-
return this.interaction.action ===
|
|
9366
|
+
return this.interaction.action === Xe;
|
|
9096
9367
|
}
|
|
9097
9368
|
async saveEvent(t) {
|
|
9098
9369
|
return await this.controller.activityManager.saveEvent(t);
|
|
@@ -9208,7 +9479,7 @@ class D {
|
|
|
9208
9479
|
this.parent.transferToNext(this.node.uuid);
|
|
9209
9480
|
}
|
|
9210
9481
|
}
|
|
9211
|
-
class
|
|
9482
|
+
class pe {
|
|
9212
9483
|
constructor(t, e) {
|
|
9213
9484
|
this.graph = e, this.root = K.create(t, this.graph);
|
|
9214
9485
|
}
|
|
@@ -9243,7 +9514,7 @@ class rt {
|
|
|
9243
9514
|
for (let o of t.interactions) {
|
|
9244
9515
|
const n = { content: o, next: null, uuid: o.uuid, parentGroup: e, parentSeq: i };
|
|
9245
9516
|
this.uuidToNode.set(o.uuid, n), this.rawToNode.set(o, n);
|
|
9246
|
-
const c = new
|
|
9517
|
+
const c = new xe(o, this.controller, this);
|
|
9247
9518
|
this.uuidToInteractionCall.set(o.uuid, c), o.name && this.interactionCallByName.set(o.name, c);
|
|
9248
9519
|
}
|
|
9249
9520
|
for (let o of t.gateways) {
|
|
@@ -9272,7 +9543,7 @@ class rt {
|
|
|
9272
9543
|
}), i;
|
|
9273
9544
|
}
|
|
9274
9545
|
async create() {
|
|
9275
|
-
const t =
|
|
9546
|
+
const t = pe.createInitialState(this.graph.head);
|
|
9276
9547
|
return {
|
|
9277
9548
|
activityId: (await this.controller.activityManager.createActivity({
|
|
9278
9549
|
name: this.activity.name,
|
|
@@ -9331,7 +9602,7 @@ class rt {
|
|
|
9331
9602
|
s = (await this.create()).activityId;
|
|
9332
9603
|
}
|
|
9333
9604
|
} else if (!t) return { error: "activityId must be provided for non-head interaction of an activity" };
|
|
9334
|
-
const a = new
|
|
9605
|
+
const a = new pe(await this.getState(s), this);
|
|
9335
9606
|
if (!a.isInteractionAvailable(e)) return { error: `interaction ${e} not available` };
|
|
9336
9607
|
const o = await i.call(r, s, this.checkUserRef);
|
|
9337
9608
|
if (o.error)
|
|
@@ -9359,7 +9630,7 @@ class rt {
|
|
|
9359
9630
|
}), await this.setActivity(t, { refs: i });
|
|
9360
9631
|
}
|
|
9361
9632
|
}
|
|
9362
|
-
class
|
|
9633
|
+
class ii extends D {
|
|
9363
9634
|
onChange(t, e) {
|
|
9364
9635
|
if (this.graph.isStartNode(t)) {
|
|
9365
9636
|
if (e)
|
|
@@ -9370,24 +9641,24 @@ class Zr extends D {
|
|
|
9370
9641
|
}
|
|
9371
9642
|
}
|
|
9372
9643
|
}
|
|
9373
|
-
D.GroupStateNodeType.set("any",
|
|
9374
|
-
class
|
|
9644
|
+
D.GroupStateNodeType.set("any", ii);
|
|
9645
|
+
class si extends D {
|
|
9375
9646
|
onChange(t, e) {
|
|
9376
9647
|
this.isGroupCompleted() && this.complete();
|
|
9377
9648
|
}
|
|
9378
9649
|
}
|
|
9379
|
-
D.GroupStateNodeType.set("every",
|
|
9380
|
-
class
|
|
9650
|
+
D.GroupStateNodeType.set("every", si);
|
|
9651
|
+
class ai extends D {
|
|
9381
9652
|
onChange(t, e) {
|
|
9382
9653
|
this.graph.isEndNode(t) && this.complete();
|
|
9383
9654
|
}
|
|
9384
9655
|
}
|
|
9385
|
-
D.GroupStateNodeType.set("race",
|
|
9386
|
-
class
|
|
9656
|
+
D.GroupStateNodeType.set("race", ai);
|
|
9657
|
+
class oi extends D {
|
|
9387
9658
|
// 可以根据 group 上的具体配置逻辑,来动态决定。
|
|
9388
9659
|
}
|
|
9389
|
-
D.GroupStateNodeType.set("program",
|
|
9390
|
-
const I = new ye(), _t = "_Interaction_", St = "_Activity_",
|
|
9660
|
+
D.GroupStateNodeType.set("program", oi);
|
|
9661
|
+
const I = new ye(), _t = "_Interaction_", St = "_Activity_", Me = C.create({
|
|
9391
9662
|
name: _t,
|
|
9392
9663
|
properties: [
|
|
9393
9664
|
T.create({
|
|
@@ -9416,7 +9687,7 @@ const I = new ye(), _t = "_Interaction_", St = "_Activity_", xe = C.create({
|
|
|
9416
9687
|
collection: !1
|
|
9417
9688
|
})
|
|
9418
9689
|
]
|
|
9419
|
-
}),
|
|
9690
|
+
}), $e = C.create({
|
|
9420
9691
|
name: St,
|
|
9421
9692
|
properties: [
|
|
9422
9693
|
T.create({
|
|
@@ -9440,21 +9711,21 @@ const I = new ye(), _t = "_Interaction_", St = "_Activity_", xe = C.create({
|
|
|
9440
9711
|
collection: !1
|
|
9441
9712
|
})
|
|
9442
9713
|
]
|
|
9443
|
-
}),
|
|
9714
|
+
}), ni = P.create({
|
|
9444
9715
|
name: "activityInteraction",
|
|
9445
|
-
source:
|
|
9716
|
+
source: $e,
|
|
9446
9717
|
sourceProperty: "interaction",
|
|
9447
|
-
target:
|
|
9718
|
+
target: Me,
|
|
9448
9719
|
targetProperty: "activity",
|
|
9449
9720
|
type: "1:n"
|
|
9450
9721
|
});
|
|
9451
|
-
class
|
|
9722
|
+
class ci {
|
|
9452
9723
|
constructor(t, e, r) {
|
|
9453
|
-
this.controller = t, this.activityCalls = /* @__PURE__ */ new Map(), this.activityCallsByName = /* @__PURE__ */ new Map(), this.interactionCallsByName = /* @__PURE__ */ new Map(), this.interactionCalls = /* @__PURE__ */ new Map(), this.controller.entities.push(
|
|
9724
|
+
this.controller = t, this.activityCalls = /* @__PURE__ */ new Map(), this.activityCallsByName = /* @__PURE__ */ new Map(), this.interactionCallsByName = /* @__PURE__ */ new Map(), this.interactionCalls = /* @__PURE__ */ new Map(), this.controller.entities.push($e, Me), this.controller.relations.push(ni), e.forEach((i) => {
|
|
9454
9725
|
const s = new rt(i, t);
|
|
9455
9726
|
this.activityCalls.set(i.uuid, s), i.name && (v(!this.activityCallsByName.has(i.name), `activity name ${i.name} is duplicated`), this.activityCallsByName.set(i.name, s));
|
|
9456
9727
|
}), r.forEach((i) => {
|
|
9457
|
-
const s = new
|
|
9728
|
+
const s = new xe(i, t);
|
|
9458
9729
|
this.interactionCalls.set(i.uuid, s), i.name && (v(!this.interactionCallsByName.has(i.name), `interaction name ${i.name} is duplicated`), this.interactionCallsByName.set(i.name, s));
|
|
9459
9730
|
});
|
|
9460
9731
|
}
|
|
@@ -9506,7 +9777,7 @@ class si {
|
|
|
9506
9777
|
try {
|
|
9507
9778
|
const o = this.activityCallsByName.get(t);
|
|
9508
9779
|
if (!o)
|
|
9509
|
-
throw new
|
|
9780
|
+
throw new de(`Cannot find activity for ${t}`, {
|
|
9510
9781
|
activityName: t,
|
|
9511
9782
|
context: {
|
|
9512
9783
|
interactionName: e,
|
|
@@ -9529,7 +9800,7 @@ class si {
|
|
|
9529
9800
|
const c = await o.callInteraction(r, n.interaction.uuid, i);
|
|
9530
9801
|
return c.error ? (a.error({ label: "activity", message: o.activity.name }), await this.controller.system.storage.rollbackTransaction(o.activity.name)) : (await this.controller.system.storage.commitTransaction(o.activity.name), await this.runRecordChangeSideEffects(c, a)), c;
|
|
9531
9802
|
} catch (o) {
|
|
9532
|
-
throw new
|
|
9803
|
+
throw new de("Unexpected error during activity interaction call", {
|
|
9533
9804
|
activityName: t,
|
|
9534
9805
|
context: {
|
|
9535
9806
|
interactionName: e,
|
|
@@ -9609,14 +9880,14 @@ class si {
|
|
|
9609
9880
|
}
|
|
9610
9881
|
}
|
|
9611
9882
|
const It = new ye();
|
|
9612
|
-
function
|
|
9883
|
+
function li() {
|
|
9613
9884
|
return It.getStore()?.effects;
|
|
9614
9885
|
}
|
|
9615
|
-
function
|
|
9886
|
+
function fe(u) {
|
|
9616
9887
|
const t = It.getStore();
|
|
9617
9888
|
t?.effects && t.effects.push(...u);
|
|
9618
9889
|
}
|
|
9619
|
-
const
|
|
9890
|
+
const Ui = "User";
|
|
9620
9891
|
class X {
|
|
9621
9892
|
constructor(t) {
|
|
9622
9893
|
this.name = t.name, this.record = t.record, this.content = t.content;
|
|
@@ -9625,7 +9896,7 @@ class X {
|
|
|
9625
9896
|
return new X(t);
|
|
9626
9897
|
}
|
|
9627
9898
|
}
|
|
9628
|
-
const qt = "_isDeleted_",
|
|
9899
|
+
const qt = "_isDeleted_", Hi = {
|
|
9629
9900
|
create() {
|
|
9630
9901
|
return T.create({
|
|
9631
9902
|
name: qt,
|
|
@@ -9633,7 +9904,7 @@ const qt = "_isDeleted_", Ki = {
|
|
|
9633
9904
|
});
|
|
9634
9905
|
}
|
|
9635
9906
|
};
|
|
9636
|
-
class
|
|
9907
|
+
class Gi {
|
|
9637
9908
|
constructor(t) {
|
|
9638
9909
|
this.recordNameToSideEffects = /* @__PURE__ */ new Map(), this.globals = {
|
|
9639
9910
|
BoolExp: R,
|
|
@@ -9652,21 +9923,21 @@ class Xi {
|
|
|
9652
9923
|
forceThtrowInteractionError: d = !1
|
|
9653
9924
|
// 会 catch 住 error,并在 result 中返回。
|
|
9654
9925
|
} = t;
|
|
9655
|
-
this.system = e, this.ignorePermission = l, this.forceThtrowInteractionError = d, this.entities = [...r], this.relations = [...i], this.activities = [...s], this.interactions = [...a], this.dict = [...o], this.recordMutationSideEffects = [...n], this.activityManager = new
|
|
9926
|
+
this.system = e, this.ignorePermission = l, this.forceThtrowInteractionError = d, this.entities = [...r], this.relations = [...i], this.activities = [...s], this.interactions = [...a], this.dict = [...o], this.recordMutationSideEffects = [...n], this.activityManager = new ci(this, s, a);
|
|
9656
9927
|
const h = [
|
|
9657
|
-
...
|
|
9658
|
-
...
|
|
9659
|
-
|
|
9660
|
-
...
|
|
9661
|
-
...
|
|
9662
|
-
...
|
|
9663
|
-
...
|
|
9664
|
-
...
|
|
9665
|
-
...
|
|
9666
|
-
...
|
|
9928
|
+
...Lr,
|
|
9929
|
+
...qr,
|
|
9930
|
+
...Fr,
|
|
9931
|
+
...Pr,
|
|
9932
|
+
...xr,
|
|
9933
|
+
...Hr,
|
|
9934
|
+
...Xr,
|
|
9935
|
+
...Jr,
|
|
9936
|
+
...Er,
|
|
9937
|
+
...ei,
|
|
9667
9938
|
...c
|
|
9668
9939
|
];
|
|
9669
|
-
this.scheduler = new
|
|
9940
|
+
this.scheduler = new ri(this, this.entities, this.relations, this.dict, h), n.forEach((p) => {
|
|
9670
9941
|
let y = this.recordNameToSideEffects.get(p.record.name);
|
|
9671
9942
|
y || this.recordNameToSideEffects.set(p.record.name, y = /* @__PURE__ */ new Set()), y.add(p);
|
|
9672
9943
|
});
|
|
@@ -9803,7 +10074,7 @@ class Xi {
|
|
|
9803
10074
|
this.callbacks.has(t) || this.callbacks.set(t, /* @__PURE__ */ new Set()), this.callbacks.get(t).add(e);
|
|
9804
10075
|
}
|
|
9805
10076
|
}
|
|
9806
|
-
let
|
|
10077
|
+
let ui = class {
|
|
9807
10078
|
constructor(t) {
|
|
9808
10079
|
this.db = t;
|
|
9809
10080
|
}
|
|
@@ -9815,9 +10086,9 @@ let oi = class {
|
|
|
9815
10086
|
return e === void 0 ? await this.db.scheme(`INSERT INTO _IDS_ (name, last) VALUES ('${t}', ${r})`, i) : await this.db.update("UPDATE _IDS_ SET last = ? WHERE name = ?", [r, t], void 0, i), r;
|
|
9816
10087
|
}
|
|
9817
10088
|
};
|
|
9818
|
-
class
|
|
10089
|
+
class di {
|
|
9819
10090
|
constructor(t = ":memory:", e) {
|
|
9820
|
-
this.file = t, this.options = e, this.idSystem = new
|
|
10091
|
+
this.file = t, this.options = e, this.idSystem = new ui(this), this.logger = this.options?.logger || Rt;
|
|
9821
10092
|
}
|
|
9822
10093
|
async open() {
|
|
9823
10094
|
this.db = new Oe(this.file, this.options), await this.idSystem.setup();
|
|
@@ -9887,13 +10158,13 @@ class ni {
|
|
|
9887
10158
|
return t === "pk" ? "INTEGER PRIMARY KEY" : t === "id" ? "INT" : e || t === "object" || t === "json" ? "JSON" : t === "string" ? "TEXT" : t === "boolean" ? "INT(2)" : t === "number" || t === "timestamp" ? "INT" : t;
|
|
9888
10159
|
}
|
|
9889
10160
|
}
|
|
9890
|
-
function
|
|
10161
|
+
function hi(u) {
|
|
9891
10162
|
return encodeURI(JSON.stringify(u));
|
|
9892
10163
|
}
|
|
9893
|
-
function
|
|
10164
|
+
function pi(u) {
|
|
9894
10165
|
return u === void 0 ? void 0 : JSON.parse(decodeURI(u));
|
|
9895
10166
|
}
|
|
9896
|
-
class
|
|
10167
|
+
class fi {
|
|
9897
10168
|
constructor(t) {
|
|
9898
10169
|
this.db = t, this.callbacks = /* @__PURE__ */ new Set(), this.dict = {
|
|
9899
10170
|
get: async (e) => {
|
|
@@ -9918,20 +10189,20 @@ class ui {
|
|
|
9918
10189
|
// CAUTION kv 结构数据的实现也用 er。这是系统约定,因为也需要 Record 事件!
|
|
9919
10190
|
async get(t, e, r) {
|
|
9920
10191
|
const i = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), s = (await this.queryHandle.findOne(et, i, void 0, ["value"]))?.value;
|
|
9921
|
-
return s === void 0 ? r :
|
|
10192
|
+
return s === void 0 ? r : pi(s);
|
|
9922
10193
|
}
|
|
9923
10194
|
async set(t, e, r, i) {
|
|
9924
10195
|
const s = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] });
|
|
9925
|
-
return await this.queryHandle.findOne(et, s, void 0, ["value"]) ? this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), [et, s, { concept: t, key: e.toString(), value:
|
|
10196
|
+
return await this.queryHandle.findOne(et, s, void 0, ["value"]) ? this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), [et, s, { concept: t, key: e.toString(), value: hi(r) }], i) : this.callWithEvents(this.queryHandle.create.bind(this.queryHandle), [et, { concept: t, key: e.toString(), value: encodeURI(JSON.stringify(r)) }], i);
|
|
9926
10197
|
}
|
|
9927
10198
|
async setup(t, e, r = !1) {
|
|
9928
10199
|
await this.db.open(r);
|
|
9929
|
-
const i = new
|
|
10200
|
+
const i = new Rr(
|
|
9930
10201
|
t,
|
|
9931
10202
|
e,
|
|
9932
10203
|
this.db
|
|
9933
10204
|
);
|
|
9934
|
-
r && await i.createTables(), this.queryHandle = new
|
|
10205
|
+
r && await i.createTables(), this.queryHandle = new ar(new or(i.map), this.db), this.map = i.map;
|
|
9935
10206
|
}
|
|
9936
10207
|
findOne(...t) {
|
|
9937
10208
|
return this.queryHandle.findOne(...t);
|
|
@@ -9951,8 +10222,8 @@ class ui {
|
|
|
9951
10222
|
async callWithEvents(t, e, r = []) {
|
|
9952
10223
|
const i = [], s = await t(...e, i), a = await this.dispatch(i);
|
|
9953
10224
|
r.push(...i, ...a);
|
|
9954
|
-
const o =
|
|
9955
|
-
return o && i.length > 0 &&
|
|
10225
|
+
const o = li();
|
|
10226
|
+
return o && i.length > 0 && fe(i), o && a.length > 0 && fe(a), s;
|
|
9956
10227
|
}
|
|
9957
10228
|
findRelationByName(...t) {
|
|
9958
10229
|
return this.queryHandle.findRelationByName(...t);
|
|
@@ -9990,7 +10261,7 @@ class ui {
|
|
|
9990
10261
|
return this.db.close();
|
|
9991
10262
|
}
|
|
9992
10263
|
}
|
|
9993
|
-
var
|
|
10264
|
+
var mi = /* @__PURE__ */ ((u) => (u[u.ERROR = 0] = "ERROR", u[u.INFO = 1] = "INFO", u))(mi || {});
|
|
9994
10265
|
class ie {
|
|
9995
10266
|
constructor(t = 0) {
|
|
9996
10267
|
this.level = t;
|
|
@@ -10005,7 +10276,7 @@ class ie {
|
|
|
10005
10276
|
return new ie(this.level);
|
|
10006
10277
|
}
|
|
10007
10278
|
}
|
|
10008
|
-
var
|
|
10279
|
+
var yi = /* @__PURE__ */ ((u) => (u[u.MUTE = -1] = "MUTE", u[u.ERROR = 0] = "ERROR", u[u.INFO = 1] = "INFO", u[u.DEBUG = 2] = "DEBUG", u))(yi || {});
|
|
10009
10280
|
class se {
|
|
10010
10281
|
constructor(t = 0) {
|
|
10011
10282
|
this.level = t;
|
|
@@ -10014,423 +10285,151 @@ class se {
|
|
|
10014
10285
|
this.level >= 0 && console.error(`[ERROR] ${t}: ${e}`, r);
|
|
10015
10286
|
}
|
|
10016
10287
|
info({ label: t, message: e, ...r }) {
|
|
10017
|
-
this.level >= 1 && console.info(`[INFO] ${t}: ${e}`, r);
|
|
10018
|
-
}
|
|
10019
|
-
debug({ label: t, message: e, ...r }) {
|
|
10020
|
-
this.level >= 2 && console.debug(`[DEBUG] ${t}: ${e}`, r);
|
|
10021
|
-
}
|
|
10022
|
-
child(t) {
|
|
10023
|
-
return new se(this.level);
|
|
10024
|
-
}
|
|
10025
|
-
}
|
|
10026
|
-
const Rt = new ie(), pi = new se();
|
|
10027
|
-
class zi {
|
|
10028
|
-
constructor(t = new ni(void 0, { logger: Rt }), e = pi) {
|
|
10029
|
-
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new ui(t);
|
|
10030
|
-
}
|
|
10031
|
-
setup(t, e, r, i = !1) {
|
|
10032
|
-
const s = new Se(t, e), { entities: a, relations: o } = s.getAll();
|
|
10033
|
-
return r.forEach(({ dataContext: n, state: c }) => {
|
|
10034
|
-
Object.entries(c).forEach(([l, d]) => {
|
|
10035
|
-
if (d instanceof E) {
|
|
10036
|
-
if (!d.record)
|
|
10037
|
-
return;
|
|
10038
|
-
let h = s.getEntityByName(d.record);
|
|
10039
|
-
if (h || (h = s.getRelationByName(d.record)), !h)
|
|
10040
|
-
throw new Error(`Entity or Relation not found: ${d.record}`);
|
|
10041
|
-
for (; h.baseEntity || h.baseRelation; )
|
|
10042
|
-
h = h.baseEntity || h.baseRelation;
|
|
10043
|
-
if (d.defaultValue instanceof T)
|
|
10044
|
-
d.defaultValue.name = d.key, h.properties.push(d.defaultValue);
|
|
10045
|
-
else {
|
|
10046
|
-
const p = typeof d.defaultValue;
|
|
10047
|
-
h.properties.push(T.create({
|
|
10048
|
-
name: d.key,
|
|
10049
|
-
type: p,
|
|
10050
|
-
// 应该系统定义
|
|
10051
|
-
collection: Array.isArray(d.defaultValue),
|
|
10052
|
-
defaultValue: () => d.defaultValue
|
|
10053
|
-
}));
|
|
10054
|
-
}
|
|
10055
|
-
}
|
|
10056
|
-
});
|
|
10057
|
-
}), this.storage.setup(
|
|
10058
|
-
[...a, gr, yr],
|
|
10059
|
-
o,
|
|
10060
|
-
i
|
|
10061
|
-
);
|
|
10062
|
-
}
|
|
10063
|
-
destroy() {
|
|
10064
|
-
this.storage.destroy();
|
|
10065
|
-
}
|
|
10066
|
-
}
|
|
10067
|
-
const { Client: fe } = Fe;
|
|
10068
|
-
let fi = class {
|
|
10069
|
-
constructor(t) {
|
|
10070
|
-
this.db = t;
|
|
10071
|
-
}
|
|
10072
|
-
setup() {
|
|
10073
|
-
return this.db.scheme('CREATE Table IF NOT EXISTS "_IDS_" (last INTEGER, name TEXT)');
|
|
10074
|
-
}
|
|
10075
|
-
async getAutoId(t) {
|
|
10076
|
-
const e = (await this.db.query(`SELECT last FROM "_IDS_" WHERE name = '${t}'`, [], `finding last id of ${t}`))[0]?.last, r = (e || 0) + 1, i = `set last id for ${t}: ${r}`;
|
|
10077
|
-
return e === void 0 ? await this.db.scheme(`INSERT INTO "_IDS_" (name, last) VALUES ('${t}', ${r})`, i) : await this.db.update('UPDATE "_IDS_" SET last = $1 WHERE name = $2', [r, t], void 0, i), r;
|
|
10078
|
-
}
|
|
10079
|
-
};
|
|
10080
|
-
class ts {
|
|
10081
|
-
constructor(t, e = {}) {
|
|
10082
|
-
this.database = t, this.options = e, this.idSystem = new fi(this), this.logger = this.options?.logger || Rt, this.db = new fe({
|
|
10083
|
-
...e
|
|
10084
|
-
});
|
|
10085
|
-
}
|
|
10086
|
-
async open(t = !1) {
|
|
10087
|
-
await this.db.connect(), (await this.db.query(`SELECT FROM pg_database WHERE datname = '${this.database}'`)).rows.length === 0 ? await this.db.query(`CREATE DATABASE ${this.database}`) : (t && (await this.db.query(`DROP DATABASE ${this.database}`), await this.db.query(`CREATE DATABASE ${this.database}`)), this.db = new fe({
|
|
10088
|
-
...this.options,
|
|
10089
|
-
database: this.database
|
|
10090
|
-
}), await this.db.connect()), await this.idSystem.setup();
|
|
10091
|
-
}
|
|
10092
|
-
async query(t, e = [], r = "") {
|
|
10093
|
-
const i = I.getStore(), s = this.logger.child(i?.logContext || {}), a = e.map((o) => o === !1 ? 0 : o === !0 ? 1 : o);
|
|
10094
|
-
return s.info({
|
|
10095
|
-
type: "query",
|
|
10096
|
-
name: r,
|
|
10097
|
-
sql: t,
|
|
10098
|
-
params: a
|
|
10099
|
-
}), (await this.db.query(t, a)).rows;
|
|
10100
|
-
}
|
|
10101
|
-
async update(t, e, r, i = "") {
|
|
10102
|
-
const s = I.getStore(), a = this.logger.child(s?.logContext || {}), o = `${t} ${r ? `RETURNING "${r}" AS id` : ""}`, n = e.map((c) => typeof c == "object" && c !== null ? JSON.stringify(c) : c === !1 ? 0 : c === !0 ? 1 : c);
|
|
10103
|
-
return a.info({
|
|
10104
|
-
type: "update",
|
|
10105
|
-
name: i,
|
|
10106
|
-
sql: o,
|
|
10107
|
-
params: n
|
|
10108
|
-
}), (await this.db.query(t, n)).rows;
|
|
10109
|
-
}
|
|
10110
|
-
async insert(t, e, r = "") {
|
|
10111
|
-
const i = I.getStore(), s = this.logger.child(i?.logContext || {}), a = e.map((n) => typeof n == "object" && n !== null ? JSON.stringify(n) : n === !1 ? 0 : n === !0 ? 1 : n);
|
|
10112
|
-
s.info({
|
|
10113
|
-
type: "insert",
|
|
10114
|
-
name: r,
|
|
10115
|
-
sql: t,
|
|
10116
|
-
params: a
|
|
10117
|
-
});
|
|
10118
|
-
const o = `${t} RETURNING "${ot}"`;
|
|
10119
|
-
return (await this.db.query(o, a)).rows[0];
|
|
10120
|
-
}
|
|
10121
|
-
async delete(t, e, r = "") {
|
|
10122
|
-
const i = I.getStore(), s = this.logger.child(i?.logContext || {}), a = e.map((o) => o === !1 ? 0 : o === !0 ? 1 : o);
|
|
10123
|
-
return s.info({
|
|
10124
|
-
type: "delete",
|
|
10125
|
-
name: r,
|
|
10126
|
-
sql: t,
|
|
10127
|
-
params: a
|
|
10128
|
-
}), (await this.db.query(t, a)).rows;
|
|
10129
|
-
}
|
|
10130
|
-
async scheme(t, e = "") {
|
|
10131
|
-
const r = I.getStore();
|
|
10132
|
-
return this.logger.child(r?.logContext || {}).info({
|
|
10133
|
-
type: "scheme",
|
|
10134
|
-
name: e,
|
|
10135
|
-
sql: t
|
|
10136
|
-
}), await this.db.query(t);
|
|
10137
|
-
}
|
|
10138
|
-
close() {
|
|
10139
|
-
return this.db.end();
|
|
10140
|
-
}
|
|
10141
|
-
async getAutoId(t) {
|
|
10142
|
-
return this.idSystem.getAutoId(t);
|
|
10143
|
-
}
|
|
10144
|
-
parseMatchExpression(t, e, r, i, s, a, o) {
|
|
10145
|
-
if (i === "JSON" && e[0].toLowerCase() === "contains") {
|
|
10146
|
-
const n = r.split(".").map((c) => `"${c}"`).join(".");
|
|
10147
|
-
return {
|
|
10148
|
-
fieldValue: `IS NOT NULL AND ${o()} = ANY (SELECT json_array_elements_text(${n}))`,
|
|
10149
|
-
fieldParams: [e[1]]
|
|
10150
|
-
};
|
|
10151
|
-
}
|
|
10152
|
-
}
|
|
10153
|
-
getPlaceholder() {
|
|
10154
|
-
let t = 0;
|
|
10155
|
-
return () => (t++, `$${t}`);
|
|
10156
|
-
}
|
|
10157
|
-
mapToDBFieldType(t, e) {
|
|
10158
|
-
return t === "pk" ? "INT GENERATED ALWAYS AS IDENTITY" : t === "id" ? "INT" : e || t === "object" ? "JSON" : t === "string" ? "TEXT" : t === "boolean" ? "BOOLEAN" : t === "number" ? "INT" : t === "timestamp" ? "TIMESTAMP" : t;
|
|
10159
|
-
}
|
|
10160
|
-
}
|
|
10161
|
-
/**
|
|
10162
|
-
* uuidv7: A JavaScript implementation of UUID version 7
|
|
10163
|
-
*
|
|
10164
|
-
* Copyright 2021-2024 LiosK
|
|
10165
|
-
*
|
|
10166
|
-
* @license Apache-2.0
|
|
10167
|
-
* @packageDocumentation
|
|
10168
|
-
*/
|
|
10169
|
-
const Nt = "0123456789abcdef";
|
|
10170
|
-
class U {
|
|
10171
|
-
/** @param bytes - The 16-byte byte array representation. */
|
|
10172
|
-
constructor(t) {
|
|
10173
|
-
this.bytes = t;
|
|
10174
|
-
}
|
|
10175
|
-
/**
|
|
10176
|
-
* Creates an object from the internal representation, a 16-byte byte array
|
|
10177
|
-
* containing the binary UUID representation in the big-endian byte order.
|
|
10178
|
-
*
|
|
10179
|
-
* This method does NOT shallow-copy the argument, and thus the created object
|
|
10180
|
-
* holds the reference to the underlying buffer.
|
|
10181
|
-
*
|
|
10182
|
-
* @throws TypeError if the length of the argument is not 16.
|
|
10183
|
-
*/
|
|
10184
|
-
static ofInner(t) {
|
|
10185
|
-
if (t.length !== 16)
|
|
10186
|
-
throw new TypeError("not 128-bit length");
|
|
10187
|
-
return new U(t);
|
|
10188
|
-
}
|
|
10189
|
-
/**
|
|
10190
|
-
* Builds a byte array from UUIDv7 field values.
|
|
10191
|
-
*
|
|
10192
|
-
* @param unixTsMs - A 48-bit `unix_ts_ms` field value.
|
|
10193
|
-
* @param randA - A 12-bit `rand_a` field value.
|
|
10194
|
-
* @param randBHi - The higher 30 bits of 62-bit `rand_b` field value.
|
|
10195
|
-
* @param randBLo - The lower 32 bits of 62-bit `rand_b` field value.
|
|
10196
|
-
* @throws RangeError if any field value is out of the specified range.
|
|
10197
|
-
*/
|
|
10198
|
-
static fromFieldsV7(t, e, r, i) {
|
|
10199
|
-
if (!Number.isInteger(t) || !Number.isInteger(e) || !Number.isInteger(r) || !Number.isInteger(i) || t < 0 || e < 0 || r < 0 || i < 0 || t > 281474976710655 || e > 4095 || r > 1073741823 || i > 4294967295)
|
|
10200
|
-
throw new RangeError("invalid field value");
|
|
10201
|
-
const s = new Uint8Array(16);
|
|
10202
|
-
return s[0] = t / 2 ** 40, s[1] = t / 2 ** 32, s[2] = t / 2 ** 24, s[3] = t / 2 ** 16, s[4] = t / 2 ** 8, s[5] = t, s[6] = 112 | e >>> 8, s[7] = e, s[8] = 128 | r >>> 24, s[9] = r >>> 16, s[10] = r >>> 8, s[11] = r, s[12] = i >>> 24, s[13] = i >>> 16, s[14] = i >>> 8, s[15] = i, new U(s);
|
|
10203
|
-
}
|
|
10204
|
-
/**
|
|
10205
|
-
* Builds a byte array from a string representation.
|
|
10206
|
-
*
|
|
10207
|
-
* This method accepts the following formats:
|
|
10208
|
-
*
|
|
10209
|
-
* - 32-digit hexadecimal format without hyphens: `0189dcd553117d408db09496a2eef37b`
|
|
10210
|
-
* - 8-4-4-4-12 hyphenated format: `0189dcd5-5311-7d40-8db0-9496a2eef37b`
|
|
10211
|
-
* - Hyphenated format with surrounding braces: `{0189dcd5-5311-7d40-8db0-9496a2eef37b}`
|
|
10212
|
-
* - RFC 9562 URN format: `urn:uuid:0189dcd5-5311-7d40-8db0-9496a2eef37b`
|
|
10213
|
-
*
|
|
10214
|
-
* Leading and trailing whitespaces represents an error.
|
|
10215
|
-
*
|
|
10216
|
-
* @throws SyntaxError if the argument could not parse as a valid UUID string.
|
|
10217
|
-
*/
|
|
10218
|
-
static parse(t) {
|
|
10219
|
-
var e, r, i, s;
|
|
10220
|
-
let a;
|
|
10221
|
-
switch (t.length) {
|
|
10222
|
-
case 32:
|
|
10223
|
-
a = (e = /^[0-9a-f]{32}$/i.exec(t)) === null || e === void 0 ? void 0 : e[0];
|
|
10224
|
-
break;
|
|
10225
|
-
case 36:
|
|
10226
|
-
a = (r = /^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)) === null || r === void 0 ? void 0 : r.slice(1, 6).join("");
|
|
10227
|
-
break;
|
|
10228
|
-
case 38:
|
|
10229
|
-
a = (i = /^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)) === null || i === void 0 ? void 0 : i.slice(1, 6).join("");
|
|
10230
|
-
break;
|
|
10231
|
-
case 45:
|
|
10232
|
-
a = (s = /^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)) === null || s === void 0 ? void 0 : s.slice(1, 6).join("");
|
|
10233
|
-
break;
|
|
10234
|
-
}
|
|
10235
|
-
if (a) {
|
|
10236
|
-
const o = new Uint8Array(16);
|
|
10237
|
-
for (let n = 0; n < 16; n += 4) {
|
|
10238
|
-
const c = parseInt(a.substring(2 * n, 2 * n + 8), 16);
|
|
10239
|
-
o[n + 0] = c >>> 24, o[n + 1] = c >>> 16, o[n + 2] = c >>> 8, o[n + 3] = c;
|
|
10240
|
-
}
|
|
10241
|
-
return new U(o);
|
|
10242
|
-
} else
|
|
10243
|
-
throw new SyntaxError("could not parse UUID string");
|
|
10244
|
-
}
|
|
10245
|
-
/**
|
|
10246
|
-
* @returns The 8-4-4-4-12 canonical hexadecimal string representation
|
|
10247
|
-
* (`0189dcd5-5311-7d40-8db0-9496a2eef37b`).
|
|
10248
|
-
*/
|
|
10249
|
-
toString() {
|
|
10250
|
-
let t = "";
|
|
10251
|
-
for (let e = 0; e < this.bytes.length; e++)
|
|
10252
|
-
t += Nt.charAt(this.bytes[e] >>> 4), t += Nt.charAt(this.bytes[e] & 15), (e === 3 || e === 5 || e === 7 || e === 9) && (t += "-");
|
|
10253
|
-
return t;
|
|
10254
|
-
}
|
|
10255
|
-
/**
|
|
10256
|
-
* @returns The 32-digit hexadecimal representation without hyphens
|
|
10257
|
-
* (`0189dcd553117d408db09496a2eef37b`).
|
|
10258
|
-
*/
|
|
10259
|
-
toHex() {
|
|
10260
|
-
let t = "";
|
|
10261
|
-
for (let e = 0; e < this.bytes.length; e++)
|
|
10262
|
-
t += Nt.charAt(this.bytes[e] >>> 4), t += Nt.charAt(this.bytes[e] & 15);
|
|
10263
|
-
return t;
|
|
10264
|
-
}
|
|
10265
|
-
/** @returns The 8-4-4-4-12 canonical hexadecimal string representation. */
|
|
10266
|
-
toJSON() {
|
|
10267
|
-
return this.toString();
|
|
10288
|
+
this.level >= 1 && console.info(`[INFO] ${t}: ${e}`, r);
|
|
10268
10289
|
}
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
* "MAX".
|
|
10272
|
-
*
|
|
10273
|
-
* For convenience, this method reports "NIL" or "MAX" if `this` represents
|
|
10274
|
-
* the Nil or Max UUID, although the Nil and Max UUIDs are technically
|
|
10275
|
-
* subsumed under the variants `0b0` and `0b111`, respectively.
|
|
10276
|
-
*/
|
|
10277
|
-
getVariant() {
|
|
10278
|
-
const t = this.bytes[8] >>> 4;
|
|
10279
|
-
if (t < 0)
|
|
10280
|
-
throw new Error("unreachable");
|
|
10281
|
-
if (t <= 7)
|
|
10282
|
-
return this.bytes.every((e) => e === 0) ? "NIL" : "VAR_0";
|
|
10283
|
-
if (t <= 11)
|
|
10284
|
-
return "VAR_10";
|
|
10285
|
-
if (t <= 13)
|
|
10286
|
-
return "VAR_110";
|
|
10287
|
-
if (t <= 15)
|
|
10288
|
-
return this.bytes.every((e) => e === 255) ? "MAX" : "VAR_RESERVED";
|
|
10289
|
-
throw new Error("unreachable");
|
|
10290
|
+
debug({ label: t, message: e, ...r }) {
|
|
10291
|
+
this.level >= 2 && console.debug(`[DEBUG] ${t}: ${e}`, r);
|
|
10290
10292
|
}
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
* not have the variant field value of `0b10`.
|
|
10294
|
-
*/
|
|
10295
|
-
getVersion() {
|
|
10296
|
-
return this.getVariant() === "VAR_10" ? this.bytes[6] >>> 4 : void 0;
|
|
10293
|
+
child(t) {
|
|
10294
|
+
return new se(this.level);
|
|
10297
10295
|
}
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10296
|
+
}
|
|
10297
|
+
const Rt = new ie(), gi = new se();
|
|
10298
|
+
class Xi {
|
|
10299
|
+
constructor(t = new di(void 0, { logger: Rt }), e = gi) {
|
|
10300
|
+
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new fi(t);
|
|
10301
10301
|
}
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
return
|
|
10302
|
+
setup(t, e, r, i = !1) {
|
|
10303
|
+
const s = new ve(t, e), { entities: a, relations: o } = s.getAll();
|
|
10304
|
+
return r.forEach(({ dataContext: n, state: c }) => {
|
|
10305
|
+
Object.entries(c).forEach(([l, d]) => {
|
|
10306
|
+
if (d instanceof E) {
|
|
10307
|
+
if (!d.record)
|
|
10308
|
+
return;
|
|
10309
|
+
let h = s.getEntityByName(d.record);
|
|
10310
|
+
if (h || (h = s.getRelationByName(d.record)), !h)
|
|
10311
|
+
throw new Error(`Entity or Relation not found: ${d.record}`);
|
|
10312
|
+
for (; h.baseEntity || h.baseRelation; )
|
|
10313
|
+
h = h.baseEntity || h.baseRelation;
|
|
10314
|
+
if (d.defaultValue instanceof T)
|
|
10315
|
+
d.defaultValue.name = d.key, h.properties.push(d.defaultValue);
|
|
10316
|
+
else {
|
|
10317
|
+
const p = typeof d.defaultValue;
|
|
10318
|
+
h.properties.push(T.create({
|
|
10319
|
+
name: d.key,
|
|
10320
|
+
type: p,
|
|
10321
|
+
// 应该系统定义
|
|
10322
|
+
collection: Array.isArray(d.defaultValue),
|
|
10323
|
+
defaultValue: () => d.defaultValue
|
|
10324
|
+
}));
|
|
10325
|
+
}
|
|
10326
|
+
}
|
|
10327
|
+
});
|
|
10328
|
+
}), this.storage.setup(
|
|
10329
|
+
[...a, Nr, wr],
|
|
10330
|
+
o,
|
|
10331
|
+
i
|
|
10332
|
+
);
|
|
10305
10333
|
}
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
* than, equal to, or greater than `other`, respectively.
|
|
10309
|
-
*/
|
|
10310
|
-
compareTo(t) {
|
|
10311
|
-
for (let e = 0; e < 16; e++) {
|
|
10312
|
-
const r = this.bytes[e] - t.bytes[e];
|
|
10313
|
-
if (r !== 0)
|
|
10314
|
-
return Math.sign(r);
|
|
10315
|
-
}
|
|
10316
|
-
return 0;
|
|
10334
|
+
destroy() {
|
|
10335
|
+
this.storage.destroy();
|
|
10317
10336
|
}
|
|
10318
10337
|
}
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
* Creates a generator object with the default random number generator, or
|
|
10322
|
-
* with the specified one if passed as an argument. The specified random
|
|
10323
|
-
* number generator should be cryptographically strong and securely seeded.
|
|
10324
|
-
*/
|
|
10338
|
+
const { Client: me } = Fe;
|
|
10339
|
+
let bi = class {
|
|
10325
10340
|
constructor(t) {
|
|
10326
|
-
this.
|
|
10341
|
+
this.db = t;
|
|
10327
10342
|
}
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
* generator upon significant timestamp rollback.
|
|
10331
|
-
*
|
|
10332
|
-
* This method returns a monotonically increasing UUID by reusing the previous
|
|
10333
|
-
* timestamp even if the up-to-date timestamp is smaller than the immediately
|
|
10334
|
-
* preceding UUID's. However, when such a clock rollback is considered
|
|
10335
|
-
* significant (i.e., by more than ten seconds), this method resets the
|
|
10336
|
-
* generator and returns a new UUID based on the given timestamp, breaking the
|
|
10337
|
-
* increasing order of UUIDs.
|
|
10338
|
-
*
|
|
10339
|
-
* See {@link generateOrAbort} for the other mode of generation and
|
|
10340
|
-
* {@link generateOrResetCore} for the low-level primitive.
|
|
10341
|
-
*/
|
|
10342
|
-
generate() {
|
|
10343
|
-
return this.generateOrResetCore(Date.now(), 1e4);
|
|
10343
|
+
setup() {
|
|
10344
|
+
return this.db.scheme('CREATE Table IF NOT EXISTS "_IDS_" (last INTEGER, name TEXT)');
|
|
10344
10345
|
}
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
*
|
|
10349
|
-
* This method returns a monotonically increasing UUID by reusing the previous
|
|
10350
|
-
* timestamp even if the up-to-date timestamp is smaller than the immediately
|
|
10351
|
-
* preceding UUID's. However, when such a clock rollback is considered
|
|
10352
|
-
* significant (i.e., by more than ten seconds), this method aborts and
|
|
10353
|
-
* returns `undefined` immediately.
|
|
10354
|
-
*
|
|
10355
|
-
* See {@link generate} for the other mode of generation and
|
|
10356
|
-
* {@link generateOrAbortCore} for the low-level primitive.
|
|
10357
|
-
*/
|
|
10358
|
-
generateOrAbort() {
|
|
10359
|
-
return this.generateOrAbortCore(Date.now(), 1e4);
|
|
10346
|
+
async getAutoId(t) {
|
|
10347
|
+
const e = (await this.db.query(`SELECT last FROM "_IDS_" WHERE name = '${t}'`, [], `finding last id of ${t}`))[0]?.last, r = (e || 0) + 1, i = `set last id for ${t}: ${r}`;
|
|
10348
|
+
return e === void 0 ? await this.db.scheme(`INSERT INTO "_IDS_" (name, last) VALUES ('${t}', ${r})`, i) : await this.db.update('UPDATE "_IDS_" SET last = $1 WHERE name = $2', [r, t], void 0, i), r;
|
|
10360
10349
|
}
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
*
|
|
10368
|
-
* @param rollbackAllowance - The amount of `unixTsMs` rollback that is
|
|
10369
|
-
* considered significant. A suggested value is `10_000` (milliseconds).
|
|
10370
|
-
* @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
|
|
10371
|
-
*/
|
|
10372
|
-
generateOrResetCore(t, e) {
|
|
10373
|
-
let r = this.generateOrAbortCore(t, e);
|
|
10374
|
-
return r === void 0 && (this.timestamp = 0, r = this.generateOrAbortCore(t, e)), r;
|
|
10350
|
+
};
|
|
10351
|
+
class zi {
|
|
10352
|
+
constructor(t, e = {}) {
|
|
10353
|
+
this.database = t, this.options = e, this.idSystem = new bi(this), this.logger = this.options?.logger || Rt, this.db = new me({
|
|
10354
|
+
...e
|
|
10355
|
+
});
|
|
10375
10356
|
}
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
* custom timestamp and clock rollback allowance.
|
|
10382
|
-
*
|
|
10383
|
-
* @param rollbackAllowance - The amount of `unixTsMs` rollback that is
|
|
10384
|
-
* considered significant. A suggested value is `10_000` (milliseconds).
|
|
10385
|
-
* @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
|
|
10386
|
-
*/
|
|
10387
|
-
generateOrAbortCore(t, e) {
|
|
10388
|
-
if (!Number.isInteger(t) || t < 0 || t > 281474976710655)
|
|
10389
|
-
throw new RangeError("`unixTsMs` must be a 48-bit positive integer");
|
|
10390
|
-
if (e < 0 || e > 281474976710655)
|
|
10391
|
-
throw new RangeError("`rollbackAllowance` out of reasonable range");
|
|
10392
|
-
if (t > this.timestamp)
|
|
10393
|
-
this.timestamp = t, this.resetCounter();
|
|
10394
|
-
else if (t + e >= this.timestamp)
|
|
10395
|
-
this.counter++, this.counter > 4398046511103 && (this.timestamp++, this.resetCounter());
|
|
10396
|
-
else
|
|
10397
|
-
return;
|
|
10398
|
-
return U.fromFieldsV7(this.timestamp, Math.trunc(this.counter / 2 ** 30), this.counter & 2 ** 30 - 1, this.random.nextUint32());
|
|
10357
|
+
async open(t = !1) {
|
|
10358
|
+
await this.db.connect(), (await this.db.query(`SELECT FROM pg_database WHERE datname = '${this.database}'`)).rows.length === 0 ? await this.db.query(`CREATE DATABASE ${this.database}`) : (t && (await this.db.query(`DROP DATABASE ${this.database}`), await this.db.query(`CREATE DATABASE ${this.database}`)), this.db = new me({
|
|
10359
|
+
...this.options,
|
|
10360
|
+
database: this.database
|
|
10361
|
+
}), await this.db.connect()), await this.idSystem.setup();
|
|
10399
10362
|
}
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10363
|
+
async query(t, e = [], r = "") {
|
|
10364
|
+
const i = I.getStore(), s = this.logger.child(i?.logContext || {}), a = e.map((o) => o === !1 ? 0 : o === !0 ? 1 : o);
|
|
10365
|
+
return s.info({
|
|
10366
|
+
type: "query",
|
|
10367
|
+
name: r,
|
|
10368
|
+
sql: t,
|
|
10369
|
+
params: a
|
|
10370
|
+
}), (await this.db.query(t, a)).rows;
|
|
10403
10371
|
}
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10372
|
+
async update(t, e, r, i = "") {
|
|
10373
|
+
const s = I.getStore(), a = this.logger.child(s?.logContext || {}), o = `${t} ${r ? `RETURNING "${r}" AS id` : ""}`, n = e.map((c) => typeof c == "object" && c !== null ? JSON.stringify(c) : c === !1 ? 0 : c === !0 ? 1 : c);
|
|
10374
|
+
return a.info({
|
|
10375
|
+
type: "update",
|
|
10376
|
+
name: i,
|
|
10377
|
+
sql: o,
|
|
10378
|
+
params: n
|
|
10379
|
+
}), (await this.db.query(t, n)).rows;
|
|
10412
10380
|
}
|
|
10413
|
-
|
|
10414
|
-
const
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
class gi {
|
|
10424
|
-
constructor() {
|
|
10425
|
-
this.buffer = new Uint32Array(8), this.cursor = 65535;
|
|
10381
|
+
async insert(t, e, r = "") {
|
|
10382
|
+
const i = I.getStore(), s = this.logger.child(i?.logContext || {}), a = e.map((n) => typeof n == "object" && n !== null ? JSON.stringify(n) : n === !1 ? 0 : n === !0 ? 1 : n);
|
|
10383
|
+
s.info({
|
|
10384
|
+
type: "insert",
|
|
10385
|
+
name: r,
|
|
10386
|
+
sql: t,
|
|
10387
|
+
params: a
|
|
10388
|
+
});
|
|
10389
|
+
const o = `${t} RETURNING "${ot}"`;
|
|
10390
|
+
return (await this.db.query(o, a)).rows[0];
|
|
10426
10391
|
}
|
|
10427
|
-
|
|
10428
|
-
|
|
10392
|
+
async delete(t, e, r = "") {
|
|
10393
|
+
const i = I.getStore(), s = this.logger.child(i?.logContext || {}), a = e.map((o) => o === !1 ? 0 : o === !0 ? 1 : o);
|
|
10394
|
+
return s.info({
|
|
10395
|
+
type: "delete",
|
|
10396
|
+
name: r,
|
|
10397
|
+
sql: t,
|
|
10398
|
+
params: a
|
|
10399
|
+
}), (await this.db.query(t, a)).rows;
|
|
10400
|
+
}
|
|
10401
|
+
async scheme(t, e = "") {
|
|
10402
|
+
const r = I.getStore();
|
|
10403
|
+
return this.logger.child(r?.logContext || {}).info({
|
|
10404
|
+
type: "scheme",
|
|
10405
|
+
name: e,
|
|
10406
|
+
sql: t
|
|
10407
|
+
}), await this.db.query(t);
|
|
10408
|
+
}
|
|
10409
|
+
close() {
|
|
10410
|
+
return this.db.end();
|
|
10411
|
+
}
|
|
10412
|
+
async getAutoId(t) {
|
|
10413
|
+
return this.idSystem.getAutoId(t);
|
|
10414
|
+
}
|
|
10415
|
+
parseMatchExpression(t, e, r, i, s, a, o) {
|
|
10416
|
+
if (i === "JSON" && e[0].toLowerCase() === "contains") {
|
|
10417
|
+
const n = r.split(".").map((c) => `"${c}"`).join(".");
|
|
10418
|
+
return {
|
|
10419
|
+
fieldValue: `IS NOT NULL AND ${o()} = ANY (SELECT json_array_elements_text(${n}))`,
|
|
10420
|
+
fieldParams: [e[1]]
|
|
10421
|
+
};
|
|
10422
|
+
}
|
|
10423
|
+
}
|
|
10424
|
+
getPlaceholder() {
|
|
10425
|
+
let t = 0;
|
|
10426
|
+
return () => (t++, `$${t}`);
|
|
10427
|
+
}
|
|
10428
|
+
mapToDBFieldType(t, e) {
|
|
10429
|
+
return t === "pk" ? "INT GENERATED ALWAYS AS IDENTITY" : t === "id" ? "INT" : e || t === "object" ? "JSON" : t === "string" ? "TEXT" : t === "boolean" ? "BOOLEAN" : t === "number" ? "INT" : t === "timestamp" ? "TIMESTAMP" : t;
|
|
10429
10430
|
}
|
|
10430
10431
|
}
|
|
10431
|
-
let
|
|
10432
|
-
const bi = () => Ri().toString(), Ri = () => (me || (me = new mi())).generate();
|
|
10433
|
-
let wi = class {
|
|
10432
|
+
let Ri = class {
|
|
10434
10433
|
constructor(t) {
|
|
10435
10434
|
this.db = t;
|
|
10436
10435
|
}
|
|
@@ -10438,12 +10437,12 @@ let wi = class {
|
|
|
10438
10437
|
return this.db.scheme('CREATE Table IF NOT EXISTS "_IDS_" (last INTEGER, name TEXT)');
|
|
10439
10438
|
}
|
|
10440
10439
|
async getAutoId(t) {
|
|
10441
|
-
return
|
|
10440
|
+
return Re();
|
|
10442
10441
|
}
|
|
10443
10442
|
};
|
|
10444
|
-
class
|
|
10443
|
+
class ts {
|
|
10445
10444
|
constructor(t, e = {}) {
|
|
10446
|
-
this.database = t, this.options = e, this.idSystem = new
|
|
10445
|
+
this.database = t, this.options = e, this.idSystem = new Ri(this), this.logger = this.options?.logger || Rt, this.db = new Ve(this.database);
|
|
10447
10446
|
}
|
|
10448
10447
|
async open(t = !1) {
|
|
10449
10448
|
if (t) {
|
|
@@ -10558,7 +10557,7 @@ class rs {
|
|
|
10558
10557
|
return t === "pk" ? "SERIAL PRIMARY KEY" : t === "id" ? "UUID" : e || t === "object" ? "JSON" : t === "string" ? "TEXT" : t === "boolean" ? "BOOL" : t === "number" ? "INT" : t === "timestamp" ? "TIMESTAMP" : t;
|
|
10559
10558
|
}
|
|
10560
10559
|
}
|
|
10561
|
-
class
|
|
10560
|
+
class wi {
|
|
10562
10561
|
constructor(t) {
|
|
10563
10562
|
this.db = t;
|
|
10564
10563
|
}
|
|
@@ -10570,9 +10569,9 @@ class Ni {
|
|
|
10570
10569
|
return e === void 0 ? await this.db.scheme(`INSERT INTO "_IDS_" (name, last) VALUES ('${t}', ${r})`, i) : await this.db.update('UPDATE "_IDS_" SET last = ? WHERE name = ?', [r, t], void 0, i), r;
|
|
10571
10570
|
}
|
|
10572
10571
|
}
|
|
10573
|
-
class
|
|
10572
|
+
class es {
|
|
10574
10573
|
constructor(t, e = {}) {
|
|
10575
|
-
this.database = t, this.options = e, this.idSystem = new
|
|
10574
|
+
this.database = t, this.options = e, this.idSystem = new wi(this), this.logger = this.options?.logger || Rt;
|
|
10576
10575
|
}
|
|
10577
10576
|
async open(t = !1) {
|
|
10578
10577
|
({ ...this.options }, this.db = await ne.createConnection({
|
|
@@ -10652,175 +10651,175 @@ class is {
|
|
|
10652
10651
|
}
|
|
10653
10652
|
export {
|
|
10654
10653
|
St as ACTIVITY_RECORD,
|
|
10655
|
-
|
|
10654
|
+
Ze as ALL_ATTR_SYMBOL,
|
|
10656
10655
|
Ft as ASYNC_TASK_RECORD,
|
|
10657
10656
|
xt as Action,
|
|
10658
10657
|
Ut as Activity,
|
|
10659
10658
|
rt as ActivityCall,
|
|
10660
10659
|
it as ActivityGroup,
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10660
|
+
ni as ActivityInteractionRelation,
|
|
10661
|
+
ci as ActivityManager,
|
|
10662
|
+
$e as ActivityStateEntity,
|
|
10664
10663
|
mt as Any,
|
|
10665
|
-
|
|
10664
|
+
Fr as AnyHandles,
|
|
10666
10665
|
W as AttributeInfo,
|
|
10667
10666
|
x as AttributeQuery,
|
|
10668
10667
|
Y as Attributive,
|
|
10669
10668
|
Ct as Attributives,
|
|
10670
10669
|
pt as Average,
|
|
10671
|
-
|
|
10672
|
-
|
|
10670
|
+
Xr as AverageHandles,
|
|
10671
|
+
$i as BaseKlass,
|
|
10673
10672
|
nt as BoolAtomData,
|
|
10674
10673
|
R as BoolExp,
|
|
10675
10674
|
ct as BoolExpressionData,
|
|
10676
10675
|
J as ComputationDataDepError,
|
|
10677
10676
|
V as ComputationError,
|
|
10678
10677
|
A as ComputationResult,
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
10678
|
+
Ee as ComputationResultAsync,
|
|
10679
|
+
Ae as ComputationResultFullRecompute,
|
|
10680
|
+
Ie as ComputationResultResolved,
|
|
10682
10681
|
At as ComputationResultSkip,
|
|
10683
|
-
|
|
10682
|
+
he as ComputationStateError,
|
|
10684
10683
|
Ht as Condition,
|
|
10685
10684
|
O as ConditionError,
|
|
10686
10685
|
$t as Conditions,
|
|
10687
|
-
|
|
10686
|
+
Gi as Controller,
|
|
10688
10687
|
dt as Count,
|
|
10689
|
-
|
|
10688
|
+
Lr as CountHandles,
|
|
10690
10689
|
ee as Custom,
|
|
10691
|
-
|
|
10690
|
+
ei as CustomHandles,
|
|
10692
10691
|
ie as DBConsoleLogger,
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10692
|
+
mi as DBLogLevel,
|
|
10693
|
+
Rr as DBSetup,
|
|
10694
|
+
ji as DELETED_STATE,
|
|
10696
10695
|
q as DICTIONARY_RECORD,
|
|
10697
10696
|
Gt as DataAttributive,
|
|
10698
10697
|
te as DataAttributives,
|
|
10699
10698
|
Jt as Dictionary,
|
|
10700
|
-
|
|
10699
|
+
Nr as DictionaryEntity,
|
|
10701
10700
|
C as Entity,
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
|
|
10701
|
+
zr as EntityCustomHandle,
|
|
10702
|
+
ar as EntityQueryHandle,
|
|
10703
|
+
or as EntityToTableMap,
|
|
10705
10704
|
re as Equation,
|
|
10706
10705
|
Kt as Event,
|
|
10707
10706
|
ft as Every,
|
|
10708
|
-
|
|
10707
|
+
Pr as EveryHandles,
|
|
10709
10708
|
$ as Expression,
|
|
10710
10709
|
st as Gateway,
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10710
|
+
Xe as GetAction,
|
|
10711
|
+
Dr as GlobalAnyHandle,
|
|
10712
|
+
Gr as GlobalAverageHandle,
|
|
10714
10713
|
B as GlobalBoundState,
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10714
|
+
Vr as GlobalCountHandle,
|
|
10715
|
+
Yr as GlobalCustomHandle,
|
|
10716
|
+
Mr as GlobalEveryHandle,
|
|
10717
|
+
Br as GlobalRealTimeComputation,
|
|
10718
|
+
kr as GlobalStateMachineHandle,
|
|
10719
|
+
jr as GlobalSumHandle,
|
|
10720
|
+
Ir as GlobalWeightedSummationHandle,
|
|
10722
10721
|
qt as HARD_DELETION_PROPERTY_NAME,
|
|
10723
|
-
|
|
10724
|
-
|
|
10722
|
+
Hi as HardDeletionProperty,
|
|
10723
|
+
ue as ID_ATTR,
|
|
10725
10724
|
_t as INTERACTION_RECORD,
|
|
10726
10725
|
Et as Inequality,
|
|
10727
10726
|
jt as Interaction,
|
|
10728
|
-
|
|
10729
|
-
|
|
10727
|
+
xe as InteractionCall,
|
|
10728
|
+
Me as InteractionEventEntity,
|
|
10730
10729
|
Bt as KlassByName,
|
|
10731
10730
|
f as LINK_SYMBOL,
|
|
10732
10731
|
kt as LinkInfo,
|
|
10733
10732
|
m as MatchExp,
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10733
|
+
ze as Modifier,
|
|
10734
|
+
Xi as MonoSystem,
|
|
10735
|
+
es as MysqlDB,
|
|
10736
|
+
Ji as NON_DELETED_STATE,
|
|
10737
|
+
Wi as NON_EXIST_STATE,
|
|
10739
10738
|
L as NewRecordData,
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10739
|
+
ts as PGLiteDB,
|
|
10740
|
+
Li as PHASE_AFTER_ALL,
|
|
10741
|
+
Qi as PHASE_BEFORE_ALL,
|
|
10743
10742
|
Ot as PHASE_NORMAL,
|
|
10744
10743
|
zt as Payload,
|
|
10745
10744
|
Yt as PayloadItem,
|
|
10746
|
-
|
|
10745
|
+
zi as PostgreSQLDB,
|
|
10747
10746
|
T as Property,
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10747
|
+
Or as PropertyAnyHandle,
|
|
10748
|
+
Kr as PropertyAverageHandle,
|
|
10749
|
+
Qr as PropertyCountHandle,
|
|
10750
|
+
ti as PropertyCustomHandle,
|
|
10751
|
+
$r as PropertyEveryHandle,
|
|
10752
|
+
Wr as PropertyRealTimeComputation,
|
|
10753
|
+
Ar as PropertyStateMachineHandle,
|
|
10754
|
+
Ur as PropertySumHandle,
|
|
10756
10755
|
Wt as PropertyTypes,
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10756
|
+
Cr as PropertyWeightedSummationHandle,
|
|
10757
|
+
Se as Query,
|
|
10758
|
+
Te as QueryItem,
|
|
10759
|
+
ke as ROOT_LABEL,
|
|
10761
10760
|
ot as ROW_ID_ATTR,
|
|
10762
10761
|
yt as RealTime,
|
|
10763
|
-
|
|
10762
|
+
Jr as RealTimeHandles,
|
|
10764
10763
|
E as RecordBoundState,
|
|
10765
10764
|
at as RecordInfo,
|
|
10766
10765
|
X as RecordMutationSideEffect,
|
|
10767
10766
|
M as RecordQuery,
|
|
10768
|
-
|
|
10767
|
+
sr as RecordQueryAgent,
|
|
10769
10768
|
_ as RecordQueryTree,
|
|
10770
|
-
|
|
10769
|
+
_r as RecordsTransformHandle,
|
|
10771
10770
|
vt as RecursiveContext,
|
|
10772
|
-
|
|
10771
|
+
ve as RefContainer,
|
|
10773
10772
|
P as Relation,
|
|
10774
|
-
|
|
10775
|
-
|
|
10773
|
+
Zr as RelationCustomHandle,
|
|
10774
|
+
di as SQLiteDB,
|
|
10776
10775
|
et as SYSTEM_RECORD,
|
|
10777
|
-
|
|
10776
|
+
ri as Scheduler,
|
|
10778
10777
|
Zt as SideEffect,
|
|
10779
10778
|
lt as StateMachine,
|
|
10780
|
-
|
|
10779
|
+
Er as StateMachineHandles,
|
|
10781
10780
|
z as StateNode,
|
|
10782
10781
|
Xt as StateTransfer,
|
|
10783
10782
|
ht as Summation,
|
|
10784
|
-
|
|
10783
|
+
Hr as SummationHandles,
|
|
10785
10784
|
se as SystemConsoleLogger,
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10785
|
+
wr as SystemEntity,
|
|
10786
|
+
yi as SystemLogLevel,
|
|
10787
|
+
we as Transfer,
|
|
10789
10788
|
Mt as Transform,
|
|
10790
|
-
|
|
10791
|
-
|
|
10789
|
+
qr as TransformHandles,
|
|
10790
|
+
Ui as USER_ENTITY,
|
|
10792
10791
|
ut as WeightedSummation,
|
|
10793
|
-
|
|
10794
|
-
|
|
10792
|
+
xr as WeightedSummationHandles,
|
|
10793
|
+
fe as addToCurrentEffects,
|
|
10795
10794
|
v as assert,
|
|
10796
10795
|
It as asyncEffectsContext,
|
|
10797
10796
|
I as asyncInteractionContext,
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10797
|
+
Fi as boolExpToAttributives,
|
|
10798
|
+
Ei as clearAllInstances,
|
|
10799
|
+
Mi as createClass,
|
|
10801
10800
|
_e as createInstances,
|
|
10802
|
-
|
|
10803
|
-
|
|
10801
|
+
xi as createInstancesFromString,
|
|
10802
|
+
Vi as createUserRoleAttributive,
|
|
10804
10803
|
Rt as dbConsoleLogger,
|
|
10805
10804
|
wt as deepClone,
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10805
|
+
Bi as everyAsync,
|
|
10806
|
+
vr as everyWithErrorAsync,
|
|
10807
|
+
_i as filterMap,
|
|
10808
|
+
Di as findRootActivity,
|
|
10809
|
+
Ne as forEachInteraction,
|
|
10811
10810
|
S as generateUUID,
|
|
10812
|
-
|
|
10813
|
-
|
|
10811
|
+
li as getCurrentEffects,
|
|
10812
|
+
Pi as getInteractions,
|
|
10814
10813
|
Qe as indexBy,
|
|
10815
10814
|
ge as isObject,
|
|
10816
10815
|
be as isPlainObject,
|
|
10817
|
-
|
|
10818
|
-
|
|
10816
|
+
qi as mapObject,
|
|
10817
|
+
Oi as parse,
|
|
10819
10818
|
Le as registerKlass,
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10819
|
+
Ii as removeAllInstance,
|
|
10820
|
+
Sr as someAsync,
|
|
10821
|
+
Ci as stringifyAllInstances,
|
|
10823
10822
|
w as stringifyAttribute,
|
|
10824
|
-
|
|
10823
|
+
gi as systemConsoleLogger
|
|
10825
10824
|
};
|
|
10826
10825
|
//# sourceMappingURL=index.js.map
|