interaqt 0.4.13 → 0.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,8 @@
1
- import { uuidv7 as Pe } from "uuidv7";
2
- import { parse as De } from "acorn";
1
+ import { parse as Pe } from "acorn";
3
2
  import { AsyncLocalStorage as ye } from "async_hooks";
4
- import Oe from "better-sqlite3";
5
- import Fe from "pg";
6
- import { PGlite as Ve } from "@electric-sql/pglite";
3
+ import De from "better-sqlite3";
4
+ import Oe from "pg";
5
+ import { PGlite as Fe } from "@electric-sql/pglite";
7
6
  import ne from "mysql2/promise";
8
7
  function ge(u) {
9
8
  return u !== null && typeof u == "object";
@@ -13,7 +12,7 @@ function be(u) {
13
12
  const t = Object.getPrototypeOf(u);
14
13
  return t === null ? !0 : t === Object.prototype || t === null;
15
14
  }
16
- function Qe(u, t) {
15
+ function Ve(u, t) {
17
16
  const e = {};
18
17
  for (const r of u)
19
18
  r && r[t] !== void 0 && (e[String(r[t])] = r);
@@ -34,27 +33,27 @@ 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 Ci(...u) {
36
+ function Ii(...u) {
38
37
  for (const t of u)
39
38
  t.instances.length = 0;
40
39
  }
41
- function xi() {
40
+ function Ci() {
42
41
  }
43
42
  const Bt = /* @__PURE__ */ new Map();
44
- function Le(u, t) {
43
+ function Qe(u, t) {
45
44
  t && t.isKlass && t.displayName && Bt.set(u, t);
46
45
  }
47
- function Mi() {
46
+ function xi() {
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 $i(u) {
52
+ function Mi(u) {
54
53
  const t = JSON.parse(u);
55
- return _e(t);
54
+ return Le(t);
56
55
  }
57
- function _e(u) {
56
+ function Le(u) {
58
57
  const t = /* @__PURE__ */ new Map();
59
58
  return u.forEach(({ type: e, options: r = {}, uuid: i, public: s }) => {
60
59
  const a = Bt.get(e);
@@ -66,10 +65,10 @@ function _e(u) {
66
65
  t.set(i, o);
67
66
  }), t;
68
67
  }
69
- function Pi(u) {
68
+ function $i(u) {
70
69
  return console.warn("createClass is deprecated in refactored code"), null;
71
70
  }
72
- class Di {
71
+ class Pi {
73
72
  static {
74
73
  this.isKlass = !0;
75
74
  }
@@ -91,8 +90,9 @@ class Di {
91
90
  return t !== null && typeof t == "object" && typeof t.uuid == "string";
92
91
  }
93
92
  }
93
+ let _e = 0;
94
94
  function S(u) {
95
- return u?.uuid || Pe();
95
+ return u?.uuid || `id_${++_e}`;
96
96
  }
97
97
  const qe = /^[a-zA-Z0-9_]+$/;
98
98
  class C {
@@ -878,11 +878,11 @@ function we(u, t, e) {
878
878
  r.activities?.forEach((i) => we(i, t, r));
879
879
  });
880
880
  }
881
- function Oi(u) {
881
+ function Di(u) {
882
882
  const t = [];
883
883
  return we(u, (e) => t.push(e)), t;
884
884
  }
885
- function Fi(u) {
885
+ function Oi(u) {
886
886
  return null;
887
887
  }
888
888
  class nt {
@@ -1204,8 +1204,8 @@ function Tt(u, t, e) {
1204
1204
  };
1205
1205
  throw new Error("unknown ast node type");
1206
1206
  }
1207
- function Vi(u, t = [], e = je) {
1208
- const r = Qe(t, "name"), i = De(u, { ecmaVersion: 2020 });
1207
+ function Fi(u, t = [], e = je) {
1208
+ const r = Ve(t, "name"), i = Pe(u, { ecmaVersion: 2020 });
1209
1209
  return new R(
1210
1210
  Tt(i.body[0].expression, r, e)
1211
1211
  );
@@ -1347,7 +1347,7 @@ function Vt(u) {
1347
1347
  right: Vt(u.right)
1348
1348
  });
1349
1349
  }
1350
- function Qi(u) {
1350
+ function Vi(u) {
1351
1351
  return Ct.create({
1352
1352
  content: Vt(u)
1353
1353
  });
@@ -2953,7 +2953,7 @@ const He = [
2953
2953
  te
2954
2954
  ];
2955
2955
  He.forEach((u) => {
2956
- u && u.displayName && Le(u.displayName, u);
2956
+ u && u.displayName && Qe(u.displayName, u);
2957
2957
  });
2958
2958
  class ee {
2959
2959
  constructor(t, e) {
@@ -3273,7 +3273,7 @@ class Se {
3273
3273
  return null;
3274
3274
  }
3275
3275
  }
3276
- function Li({ name: u, isRef: t = !1 }, e) {
3276
+ function Qi({ name: u, isRef: t = !1 }, e) {
3277
3277
  return Y.create({
3278
3278
  name: u,
3279
3279
  content: u ? new Function("user", `return user.roles.includes('${u}')`) : function() {
@@ -6259,7 +6259,7 @@ const et = "_System_", q = "_Dictionary_", le = "id", ot = "_rowId", yr = C.crea
6259
6259
  collection: !1
6260
6260
  })
6261
6261
  ]
6262
- }), _i = 0, Ot = 1, qi = 2;
6262
+ }), Li = 0, Ot = 1, _i = 2;
6263
6263
  class br {
6264
6264
  constructor(t, e) {
6265
6265
  this.controller = t, this.scheduler = e, this.sourceMaps = [], this.sourceMapTree = {};
@@ -6579,13 +6579,13 @@ function v(u, t) {
6579
6579
  if (!u)
6580
6580
  throw new Error(t);
6581
6581
  }
6582
- function Bi(u, t) {
6582
+ function qi(u, t) {
6583
6583
  return new Map(Array.from(u.entries()).map(([e, r]) => [e, t(e, r)]));
6584
6584
  }
6585
- function Wi(u, t) {
6585
+ function Bi(u, t) {
6586
6586
  return Object.fromEntries(Object.entries(u).map(([e, r]) => [e, t(e, r)]));
6587
6587
  }
6588
- async function Ji(u, t) {
6588
+ async function Wi(u, t) {
6589
6589
  for (let e of u)
6590
6590
  if (!await t(e)) return !1;
6591
6591
  return !0;
@@ -6681,13 +6681,13 @@ Or if you want to use state name as value, you should not set ${this.dataContext
6681
6681
  };
6682
6682
  }
6683
6683
  }
6684
- const ji = z.create({
6684
+ const Ji = z.create({
6685
6685
  name: "nonExistent",
6686
6686
  computeValue: () => null
6687
- }), Ui = z.create({
6687
+ }), ji = z.create({
6688
6688
  name: "nonDeleted",
6689
6689
  computeValue: () => !1
6690
- }), Hi = z.create({
6690
+ }), Ui = z.create({
6691
6691
  name: "deleted",
6692
6692
  computeValue: () => !0
6693
6693
  }), Sr = [Nr, Tr];
@@ -9616,7 +9616,7 @@ function pe(u) {
9616
9616
  const t = It.getStore();
9617
9617
  t?.effects && t.effects.push(...u);
9618
9618
  }
9619
- const Gi = "User";
9619
+ const Hi = "User";
9620
9620
  class X {
9621
9621
  constructor(t) {
9622
9622
  this.name = t.name, this.record = t.record, this.content = t.content;
@@ -9625,7 +9625,7 @@ class X {
9625
9625
  return new X(t);
9626
9626
  }
9627
9627
  }
9628
- const qt = "_isDeleted_", Ki = {
9628
+ const qt = "_isDeleted_", Gi = {
9629
9629
  create() {
9630
9630
  return T.create({
9631
9631
  name: qt,
@@ -9633,7 +9633,7 @@ const qt = "_isDeleted_", Ki = {
9633
9633
  });
9634
9634
  }
9635
9635
  };
9636
- class Xi {
9636
+ class Ki {
9637
9637
  constructor(t) {
9638
9638
  this.recordNameToSideEffects = /* @__PURE__ */ new Map(), this.globals = {
9639
9639
  BoolExp: R,
@@ -9820,7 +9820,7 @@ class ni {
9820
9820
  this.file = t, this.options = e, this.idSystem = new oi(this), this.logger = this.options?.logger || Rt;
9821
9821
  }
9822
9822
  async open() {
9823
- this.db = new Oe(this.file, this.options), await this.idSystem.setup();
9823
+ this.db = new De(this.file, this.options), await this.idSystem.setup();
9824
9824
  }
9825
9825
  async query(t, e = [], r = "") {
9826
9826
  const i = I.getStore(), s = this.logger.child(i?.logContext || {}), a = e.map((o) => o === !1 ? 0 : o === !0 ? 1 : o);
@@ -10024,7 +10024,7 @@ class se {
10024
10024
  }
10025
10025
  }
10026
10026
  const Rt = new ie(), pi = new se();
10027
- class zi {
10027
+ class Yi {
10028
10028
  constructor(t = new ni(void 0, { logger: Rt }), e = pi) {
10029
10029
  this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new ui(t);
10030
10030
  }
@@ -10064,7 +10064,7 @@ class zi {
10064
10064
  this.storage.destroy();
10065
10065
  }
10066
10066
  }
10067
- const { Client: fe } = Fe;
10067
+ const { Client: fe } = Oe;
10068
10068
  let fi = class {
10069
10069
  constructor(t) {
10070
10070
  this.db = t;
@@ -10077,7 +10077,7 @@ let fi = class {
10077
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
10078
  }
10079
10079
  };
10080
- class ts {
10080
+ class Zi {
10081
10081
  constructor(t, e = {}) {
10082
10082
  this.database = t, this.options = e, this.idSystem = new fi(this), this.logger = this.options?.logger || Rt, this.db = new fe({
10083
10083
  ...e
@@ -10386,9 +10386,9 @@ class mi {
10386
10386
  */
10387
10387
  generateOrAbortCore(t, e) {
10388
10388
  if (!Number.isInteger(t) || t < 0 || t > 281474976710655)
10389
- throw new RangeError("`unixTsMs` must be a 48-bit positive integer");
10389
+ throw new RangeError(`\`unixTsMs\` must be a 48-bit positive integer, got ${t}`);
10390
10390
  if (e < 0 || e > 281474976710655)
10391
- throw new RangeError("`rollbackAllowance` out of reasonable range");
10391
+ throw new RangeError(`\`rollbackAllowance\` out of reasonable range, got ${e}`);
10392
10392
  if (t > this.timestamp)
10393
10393
  this.timestamp = t, this.resetCounter();
10394
10394
  else if (t + e >= this.timestamp)
@@ -10441,9 +10441,9 @@ let wi = class {
10441
10441
  return bi();
10442
10442
  }
10443
10443
  };
10444
- class rs {
10444
+ class es {
10445
10445
  constructor(t, e = {}) {
10446
- this.database = t, this.options = e, this.idSystem = new wi(this), this.logger = this.options?.logger || Rt, this.db = new Ve(this.database);
10446
+ this.database = t, this.options = e, this.idSystem = new wi(this), this.logger = this.options?.logger || Rt, this.db = new Fe(this.database);
10447
10447
  }
10448
10448
  async open(t = !1) {
10449
10449
  if (t) {
@@ -10570,7 +10570,7 @@ class Ni {
10570
10570
  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
10571
  }
10572
10572
  }
10573
- class is {
10573
+ class rs {
10574
10574
  constructor(t, e = {}) {
10575
10575
  this.database = t, this.options = e, this.idSystem = new Ni(this), this.logger = this.options?.logger || Rt;
10576
10576
  }
@@ -10669,7 +10669,7 @@ export {
10669
10669
  Ct as Attributives,
10670
10670
  pt as Average,
10671
10671
  Ur as AverageHandles,
10672
- Di as BaseKlass,
10672
+ Pi as BaseKlass,
10673
10673
  nt as BoolAtomData,
10674
10674
  R as BoolExp,
10675
10675
  ct as BoolExpressionData,
@@ -10684,7 +10684,7 @@ export {
10684
10684
  Ht as Condition,
10685
10685
  O as ConditionError,
10686
10686
  $t as Conditions,
10687
- Xi as Controller,
10687
+ Ki as Controller,
10688
10688
  dt as Count,
10689
10689
  Or as CountHandles,
10690
10690
  ee as Custom,
@@ -10692,7 +10692,7 @@ export {
10692
10692
  ie as DBConsoleLogger,
10693
10693
  di as DBLogLevel,
10694
10694
  mr as DBSetup,
10695
- Hi as DELETED_STATE,
10695
+ Ui as DELETED_STATE,
10696
10696
  q as DICTIONARY_RECORD,
10697
10697
  Gt as DataAttributive,
10698
10698
  te as DataAttributives,
@@ -10720,7 +10720,7 @@ export {
10720
10720
  qr as GlobalSumHandle,
10721
10721
  vr as GlobalWeightedSummationHandle,
10722
10722
  qt as HARD_DELETION_PROPERTY_NAME,
10723
- Ki as HardDeletionProperty,
10723
+ Gi as HardDeletionProperty,
10724
10724
  le as ID_ATTR,
10725
10725
  _t as INTERACTION_RECORD,
10726
10726
  Et as Inequality,
@@ -10732,18 +10732,18 @@ export {
10732
10732
  kt as LinkInfo,
10733
10733
  m as MatchExp,
10734
10734
  Ge as Modifier,
10735
- zi as MonoSystem,
10736
- is as MysqlDB,
10737
- Ui as NON_DELETED_STATE,
10738
- ji as NON_EXIST_STATE,
10735
+ Yi as MonoSystem,
10736
+ rs as MysqlDB,
10737
+ ji as NON_DELETED_STATE,
10738
+ Ji as NON_EXIST_STATE,
10739
10739
  L as NewRecordData,
10740
- rs as PGLiteDB,
10741
- qi as PHASE_AFTER_ALL,
10742
- _i as PHASE_BEFORE_ALL,
10740
+ es as PGLiteDB,
10741
+ _i as PHASE_AFTER_ALL,
10742
+ Li as PHASE_BEFORE_ALL,
10743
10743
  Ot as PHASE_NORMAL,
10744
10744
  zt as Payload,
10745
10745
  Yt as PayloadItem,
10746
- ts as PostgreSQLDB,
10746
+ Zi as PostgreSQLDB,
10747
10747
  T as Property,
10748
10748
  Mr as PropertyAnyHandle,
10749
10749
  jr as PropertyAverageHandle,
@@ -10788,38 +10788,38 @@ export {
10788
10788
  Re as Transfer,
10789
10789
  Mt as Transform,
10790
10790
  Vr as TransformHandles,
10791
- Gi as USER_ENTITY,
10791
+ Hi as USER_ENTITY,
10792
10792
  ut as WeightedSummation,
10793
10793
  Ar as WeightedSummationHandles,
10794
10794
  pe as addToCurrentEffects,
10795
10795
  v as assert,
10796
10796
  It as asyncEffectsContext,
10797
10797
  I as asyncInteractionContext,
10798
- Qi as boolExpToAttributives,
10799
- Ci as clearAllInstances,
10800
- Pi as createClass,
10801
- _e as createInstances,
10802
- $i as createInstancesFromString,
10803
- Li as createUserRoleAttributive,
10798
+ Vi as boolExpToAttributives,
10799
+ Ii as clearAllInstances,
10800
+ $i as createClass,
10801
+ Le as createInstances,
10802
+ Mi as createInstancesFromString,
10803
+ Qi as createUserRoleAttributive,
10804
10804
  Rt as dbConsoleLogger,
10805
10805
  wt as deepClone,
10806
- Ji as everyAsync,
10806
+ Wi as everyAsync,
10807
10807
  wr as everyWithErrorAsync,
10808
- Bi as filterMap,
10809
- Fi as findRootActivity,
10808
+ qi as filterMap,
10809
+ Oi as findRootActivity,
10810
10810
  we as forEachInteraction,
10811
10811
  S as generateUUID,
10812
10812
  ai as getCurrentEffects,
10813
- Oi as getInteractions,
10814
- Qe as indexBy,
10813
+ Di as getInteractions,
10814
+ Ve as indexBy,
10815
10815
  ge as isObject,
10816
10816
  be as isPlainObject,
10817
- Wi as mapObject,
10818
- Vi as parse,
10819
- Le as registerKlass,
10820
- xi as removeAllInstance,
10817
+ Bi as mapObject,
10818
+ Fi as parse,
10819
+ Qe as registerKlass,
10820
+ Ci as removeAllInstance,
10821
10821
  Rr as someAsync,
10822
- Mi as stringifyAllInstances,
10822
+ xi as stringifyAllInstances,
10823
10823
  w as stringifyAttribute,
10824
10824
  pi as systemConsoleLogger
10825
10825
  };