@instantdb/core 0.22.90-experimental.drewh-ssr.20286580593.1 → 0.22.90-experimental.drewh-ssr.20320632959.1

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.
@@ -1,7 +1,7 @@
1
1
  var Gn = Object.defineProperty;
2
2
  var Bn = (n, e, t) => e in n ? Gn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
3
  var T = (n, e, t) => Bn(n, typeof e != "symbol" ? e + "" : e, t);
4
- function M(n) {
4
+ function C(n) {
5
5
  if (typeof n == "number")
6
6
  return (Math.abs(n * 2654435761) >>> 0).toString(16);
7
7
  if (typeof n == "boolean") return n ? "1" : "0";
@@ -17,7 +17,7 @@ function M(n) {
17
17
  let e = 2166136261;
18
18
  for (let t = 0; t < n.length; t++) {
19
19
  e ^= (t + 1) * 2654435761;
20
- const r = M(n[t]);
20
+ const r = C(n[t]);
21
21
  for (let s = 0; s < r.length; s++)
22
22
  e ^= r.charCodeAt(s), e *= 16777619, e = e >>> 0;
23
23
  }
@@ -27,14 +27,14 @@ function M(n) {
27
27
  let e = 2166136261;
28
28
  const t = Object.keys(n).sort();
29
29
  for (let r = 0; r < t.length; r++) {
30
- const s = t[r], i = M(s);
30
+ const s = t[r], i = C(s);
31
31
  e ^= parseInt(i, 16), e *= 16777619, e = e >>> 0;
32
- const o = M(n[s]);
32
+ const o = C(n[s]);
33
33
  e ^= parseInt(o, 16), e *= 16777619, e = e >>> 0;
34
34
  }
35
35
  return e.toString(16);
36
36
  }
37
- return M(String(n));
37
+ return C(String(n));
38
38
  }
39
39
  const I = {
40
40
  Remove: "remove",
@@ -1327,7 +1327,7 @@ function kr(n) {
1327
1327
  return null;
1328
1328
  }
1329
1329
  }
1330
- function Ce(n) {
1330
+ function Me(n) {
1331
1331
  if (n !== void 0) {
1332
1332
  if (n === null)
1333
1333
  return null;
@@ -1454,7 +1454,7 @@ function dn(n, e, t) {
1454
1454
  console.warn("no such attr", c, a);
1455
1455
  continue;
1456
1456
  }
1457
- l["checked-data-type"] === "date" && t && (u = Ce(u), o[2] = u), ht(l) && R(i, [u, c, a], o), R(r, [a, c, u], o), R(s, [c, a, u], o);
1457
+ l["checked-data-type"] === "date" && t && (u = Me(u), o[2] = u), ht(l) && R(i, [u, c, a], o), R(r, [a, c, u], o), R(s, [c, a, u], o);
1458
1458
  }
1459
1459
  return { eav: r, aev: s, vae: i };
1460
1460
  }
@@ -1525,12 +1525,12 @@ function bn(n, e, t) {
1525
1525
  const [s, i, o] = r, a = e.getAttr(i);
1526
1526
  a && (K(n.eav, [s, i, o]), K(n.aev, [i, s, o]), ht(a) && K(n.vae, [o, i, s]));
1527
1527
  }
1528
- let Cr = 0;
1528
+ let Mr = 0;
1529
1529
  function gn(n, e, t) {
1530
1530
  const [r, s, i] = t;
1531
1531
  let o;
1532
1532
  const a = ie(n.eav, [r, s, i]);
1533
- return a && (o = a[3]), o || Date.now() * 10 + Cr++;
1533
+ return a && (o = a[3]), o || Date.now() * 10 + Mr++;
1534
1534
  }
1535
1535
  function _n(n, e, t) {
1536
1536
  const r = be(n, t);
@@ -1540,11 +1540,11 @@ function _n(n, e, t) {
1540
1540
  const a = e.getAttr(i);
1541
1541
  if (!a)
1542
1542
  return;
1543
- a["checked-data-type"] === "date" && n.useDateObjects && (o = Ce(o));
1543
+ a["checked-data-type"] === "date" && n.useDateObjects && (o = Me(o));
1544
1544
  const c = ie(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? gn(n, a, r), l = [s, i, o, u];
1545
1545
  Er(a) ? (R(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), R(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (R(n.eav, [s, i, o], l), R(n.aev, [i, s, o], l)), ht(a) && R(n.vae, [o, i, s], l);
1546
1546
  }
1547
- function Mr(n, e, t) {
1547
+ function Cr(n, e, t) {
1548
1548
  var h;
1549
1549
  const r = be(n, t);
1550
1550
  if (!r)
@@ -1625,7 +1625,7 @@ function Dr(n, e, t) {
1625
1625
  _n(n, e, s);
1626
1626
  break;
1627
1627
  case "deep-merge-triple":
1628
- Mr(n, e, s);
1628
+ Cr(n, e, s);
1629
1629
  break;
1630
1630
  case "retract-triple":
1631
1631
  bn(n, e, s);
@@ -1759,7 +1759,7 @@ function Ur(n, e, t) {
1759
1759
  }
1760
1760
  return r;
1761
1761
  }
1762
- function C(n, e, t) {
1762
+ function M(n, e, t) {
1763
1763
  var r;
1764
1764
  return (r = n.forwardIdents.get(e)) == null ? void 0 : r.get(t);
1765
1765
  }
@@ -1832,15 +1832,15 @@ function Kr(n, e, t) {
1832
1832
  }
1833
1833
  return { ...t, [n]: e };
1834
1834
  }
1835
- function Ct(n, e, t) {
1835
+ function Mt(n, e, t) {
1836
1836
  return n === e ? t : null;
1837
1837
  }
1838
1838
  function zr(n) {
1839
1839
  switch (typeof n) {
1840
1840
  case "string":
1841
- return n.startsWith("?") ? Kr : Ct;
1841
+ return n.startsWith("?") ? Kr : Mt;
1842
1842
  default:
1843
- return Ct;
1843
+ return Mt;
1844
1844
  }
1845
1845
  }
1846
1846
  const Vr = [
@@ -1904,11 +1904,11 @@ function es() {
1904
1904
  }
1905
1905
  return xe(Xr);
1906
1906
  }
1907
- const ts = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Mt = { randomUUID: ts };
1907
+ const ts = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ct = { randomUUID: ts };
1908
1908
  function ns(n, e, t) {
1909
1909
  var s;
1910
- if (Mt.randomUUID && !n)
1911
- return Mt.randomUUID();
1910
+ if (Ct.randomUUID && !n)
1911
+ return Ct.randomUUID();
1912
1912
  n = n || {};
1913
1913
  const r = n.random ?? ((s = n.rng) == null ? void 0 : s.call(n)) ?? es();
1914
1914
  if (r.length < 16)
@@ -1949,9 +1949,9 @@ function os() {
1949
1949
  const as = os();
1950
1950
  let cs = 0;
1951
1951
  function fe(n) {
1952
- return Me(`_${n}`, cs++);
1952
+ return Ce(`_${n}`, cs++);
1953
1953
  }
1954
- function Me(n, e) {
1954
+ function Ce(n, e) {
1955
1955
  return `?${n}-${e}`;
1956
1956
  }
1957
1957
  class se extends Error {
@@ -1980,7 +1980,7 @@ function fs(n, e, t) {
1980
1980
  return n.map((r) => r === e ? t : r);
1981
1981
  }
1982
1982
  function An(n, e, t, r, s) {
1983
- const i = C(e, t, s), o = X(e, t, s), a = i || o;
1983
+ const i = M(e, t, s), o = X(e, t, s), a = i || o;
1984
1984
  if (!a)
1985
1985
  throw new se(`Could not find attr for ${[t, s]}`);
1986
1986
  if (a["value-type"] !== "ref")
@@ -2072,7 +2072,7 @@ function ds(n, e) {
2072
2072
  return e;
2073
2073
  }
2074
2074
  function hs(n, e, t, r, s, i) {
2075
- const o = C(e, t, s), a = X(
2075
+ const o = M(e, t, s), a = X(
2076
2076
  e,
2077
2077
  t,
2078
2078
  s
@@ -2082,7 +2082,7 @@ function hs(n, e, t, r, s, i) {
2082
2082
  `No attr for etype = ${t} label = ${s}`
2083
2083
  );
2084
2084
  if (i != null && i.hasOwnProperty("$isNull")) {
2085
- const u = C(e, t, "id");
2085
+ const u = M(e, t, "id");
2086
2086
  if (!u)
2087
2087
  throw new se(
2088
2088
  `No attr for etype = ${t} label = id`
@@ -2219,7 +2219,7 @@ function On(n, e, t, r, s) {
2219
2219
  });
2220
2220
  }
2221
2221
  function Ts(n, e, t, r) {
2222
- const s = Me;
2222
+ const s = Ce;
2223
2223
  return r ? On(s, n, e, t, r).concat(jt(s, n, e, t)) : jt(s, n, e, t);
2224
2224
  }
2225
2225
  function ms(n, e, t) {
@@ -2292,7 +2292,7 @@ function ks(n, e) {
2292
2292
  }
2293
2293
  function Es(n, e, t) {
2294
2294
  const r = Object.keys(t)[0];
2295
- return C(n, e, r);
2295
+ return M(n, e, r);
2296
2296
  }
2297
2297
  function Is(n, e, t, r) {
2298
2298
  if (t)
@@ -2300,22 +2300,22 @@ function Is(n, e, t, r) {
2300
2300
  if (r)
2301
2301
  return Es(n, e, r);
2302
2302
  }
2303
- function Cs(n, e, t) {
2303
+ function Ms(n, e, t) {
2304
2304
  var s, i;
2305
2305
  if (!Array.isArray(t.fields))
2306
2306
  return Lr(n, e);
2307
2307
  const r = /* @__PURE__ */ new Map();
2308
2308
  for (const o of t.fields) {
2309
- const a = C(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
2309
+ const a = M(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
2310
2310
  c && pt(a) && r.set(c, a);
2311
2311
  }
2312
2312
  if (!r.has("id")) {
2313
- const o = C(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
2313
+ const o = M(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
2314
2314
  a && r.set(a, o);
2315
2315
  }
2316
2316
  return r;
2317
2317
  }
2318
- function Ms(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
2318
+ function Cs(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
2319
2319
  var p, b;
2320
2320
  const o = (p = i == null ? void 0 : i.$) == null ? void 0 : p.order, a = vn(i), c = Ps(i);
2321
2321
  let u = Hr(n, s);
@@ -2336,7 +2336,7 @@ function Ms(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
2336
2336
  }
2337
2337
  );
2338
2338
  let d = {};
2339
- const h = Cs(e, t, s);
2339
+ const h = Ms(e, t, s);
2340
2340
  for (const _ of u) {
2341
2341
  const [g] = _;
2342
2342
  if (d[g] || !a && l && f && vs(l, f, c, _))
@@ -2363,7 +2363,7 @@ function js(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
2363
2363
  const a = ys(
2364
2364
  Ts(e, t, r, (d = s.$) == null ? void 0 : d.where),
2365
2365
  i
2366
- ), c = ms(Me, t, r), u = (h = s.$) == null ? void 0 : h.fields, l = Ms(n, e, {
2366
+ ), c = ms(Ce, t, r), u = (h = s.$) == null ? void 0 : h.fields, l = Cs(n, e, {
2367
2367
  etype: t,
2368
2368
  pageInfo: o,
2369
2369
  form: s,
@@ -2389,7 +2389,7 @@ function $s(n, e, t) {
2389
2389
  }
2390
2390
  function kn(n, e, t) {
2391
2391
  const r = $s(n, e, t);
2392
- return As(Me, n, e, t, r);
2392
+ return As(Ce, n, e, t, r);
2393
2393
  }
2394
2394
  function Ds(n) {
2395
2395
  const e = {};
@@ -2520,7 +2520,7 @@ function Ns(n) {
2520
2520
  function qs(n, e, t) {
2521
2521
  return t.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
2522
2522
  // before assuming it's a ref lookup.
2523
- !C(n, e, t);
2523
+ !M(n, e, t);
2524
2524
  }
2525
2525
  function Ze(n) {
2526
2526
  const [e, t, ...r] = n.split(".");
@@ -2530,8 +2530,8 @@ function Ze(n) {
2530
2530
  }
2531
2531
  function Ks(n, e, t) {
2532
2532
  if (!qs(n, e, t))
2533
- return C(n, e, t);
2534
- const r = Ze(t), s = C(n, e, r) || X(n, e, r);
2533
+ return M(n, e, t);
2534
+ const r = Ze(t), s = M(n, e, r) || X(n, e, r);
2535
2535
  if (s && s["value-type"] !== "ref")
2536
2536
  throw new Error(`${t} does not reference a valid link attribute.`);
2537
2537
  return s;
@@ -2548,19 +2548,19 @@ function U(n, e, t) {
2548
2548
  throw new Error(`${s} is not a unique attribute.`);
2549
2549
  return [o.id, i];
2550
2550
  }
2551
- function Cn(n, e, t, r) {
2551
+ function Mn(n, e, t, r) {
2552
2552
  var o;
2553
2553
  const s = U(n, e, t);
2554
2554
  return Array.isArray(s) ? [[
2555
2555
  "add-triple",
2556
2556
  s,
2557
- (o = C(n, e, "id")) == null ? void 0 : o.id,
2557
+ (o = M(n, e, "id")) == null ? void 0 : o.id,
2558
2558
  s
2559
2559
  ]].concat(r) : r;
2560
2560
  }
2561
2561
  function zs({ attrsStore: n }, [e, t, r]) {
2562
2562
  const s = Object.entries(r).flatMap(([i, o]) => {
2563
- const a = Array.isArray(o) ? o : [o], c = C(n, e, i), u = X(n, e, i);
2563
+ const a = Array.isArray(o) ? o : [o], c = M(n, e, i), u = X(n, e, i);
2564
2564
  return a.map((l) => c ? [
2565
2565
  "add-triple",
2566
2566
  U(n, e, t),
@@ -2577,11 +2577,11 @@ function zs({ attrsStore: n }, [e, t, r]) {
2577
2577
  U(n, e, t)
2578
2578
  ]);
2579
2579
  });
2580
- return Cn(n, e, t, s);
2580
+ return Mn(n, e, t, s);
2581
2581
  }
2582
2582
  function Vs({ attrsStore: n }, [e, t, r]) {
2583
2583
  const s = Object.entries(r).flatMap(([i, o]) => {
2584
- const a = Array.isArray(o) ? o : [o], c = C(n, e, i), u = X(n, e, i);
2584
+ const a = Array.isArray(o) ? o : [o], c = M(n, e, i), u = X(n, e, i);
2585
2585
  return a.map((l) => c ? [
2586
2586
  "retract-triple",
2587
2587
  U(n, e, t),
@@ -2598,7 +2598,7 @@ function Vs({ attrsStore: n }, [e, t, r]) {
2598
2598
  U(n, e, t)
2599
2599
  ]);
2600
2600
  });
2601
- return Cn(n, e, t, s);
2601
+ return Mn(n, e, t, s);
2602
2602
  }
2603
2603
  function Qs(n, e, t, r) {
2604
2604
  var s;
@@ -2623,21 +2623,21 @@ function Qs(n, e, t, r) {
2623
2623
  }
2624
2624
  return !1;
2625
2625
  }
2626
- function Mn({ stores: n, attrsStore: e }, [t, r, s, i]) {
2626
+ function Cn({ stores: n, attrsStore: e }, [t, r, s, i]) {
2627
2627
  return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : Qs(n, e, t, r) ? { mode: "update" } : null;
2628
2628
  }
2629
2629
  function Ws(n, e) {
2630
2630
  const { attrsStore: t } = n, [r, s, i, o] = e, a = dt(i), c = U(t, r, s);
2631
2631
  return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
2632
- const d = C(t, r, l);
2633
- return d["checked-data-type"] === "date" && n.useDateObjects && (f = Ce(f)), ["add-triple", c, d.id, f, { mode: "create" }];
2632
+ const d = M(t, r, l);
2633
+ return d["checked-data-type"] === "date" && n.useDateObjects && (f = Me(f)), ["add-triple", c, d.id, f, { mode: "create" }];
2634
2634
  });
2635
2635
  }
2636
2636
  function Gs(n, e) {
2637
- const { attrsStore: t } = n, [r, s, i, o] = e, a = dt(i), c = U(t, r, s), u = Mn(n, [r, c, i, o]);
2637
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = dt(i), c = U(t, r, s), u = Cn(n, [r, c, i, o]);
2638
2638
  return [["id", c]].concat(Object.entries(a)).map(([f, d]) => {
2639
- const h = C(t, r, f);
2640
- return h["checked-data-type"] === "date" && n.useDateObjects && (d = Ce(d)), [
2639
+ const h = M(t, r, f);
2640
+ return h["checked-data-type"] === "date" && n.useDateObjects && (d = Me(d)), [
2641
2641
  "add-triple",
2642
2642
  c,
2643
2643
  h.id,
@@ -2650,8 +2650,8 @@ function Bs({ attrsStore: n }, [e, t]) {
2650
2650
  return [["delete-entity", U(n, e, t), e]];
2651
2651
  }
2652
2652
  function Hs(n, e) {
2653
- const { attrsStore: t } = n, [r, s, i, o] = e, a = dt(i), c = U(t, r, s), u = Mn(n, [r, c, i, o]), l = Object.entries(a).map(([d, h]) => {
2654
- const p = C(t, r, d);
2653
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = dt(i), c = U(t, r, s), u = Cn(n, [r, c, i, o]), l = Object.entries(a).map(([d, h]) => {
2654
+ const p = M(t, r, d);
2655
2655
  return [
2656
2656
  "deep-merge-triple",
2657
2657
  c,
@@ -2663,7 +2663,7 @@ function Hs(n, e) {
2663
2663
  return [[
2664
2664
  "add-triple",
2665
2665
  c,
2666
- C(t, r, "id").id,
2666
+ M(t, r, "id").id,
2667
2667
  c,
2668
2668
  ...u ? [u] : []
2669
2669
  ]].concat(l);
@@ -2807,7 +2807,7 @@ function ui({ attrsStore: n, schema: e }, t) {
2807
2807
  var d, h;
2808
2808
  const r = /* @__PURE__ */ new Set(), s = [], i = [];
2809
2809
  function o(p, b) {
2810
- return C(n, p, b) || s.find(
2810
+ return M(n, p, b) || s.find(
2811
2811
  (_) => _["forward-identity"][1] === p && _["forward-identity"][2] === b
2812
2812
  );
2813
2813
  }
@@ -3573,7 +3573,7 @@ function qt(n, e) {
3573
3573
  t[r] = n[r];
3574
3574
  }), t;
3575
3575
  }
3576
- function Ci(n, e, t) {
3576
+ function Mi(n, e, t) {
3577
3577
  const r = {
3578
3578
  peers: {}
3579
3579
  };
@@ -3590,7 +3590,7 @@ function Ci(n, e, t) {
3590
3590
  }
3591
3591
  return r;
3592
3592
  }
3593
- function Mi(n, e) {
3593
+ function Ci(n, e) {
3594
3594
  if (n.isLoading !== e.isLoading || n.error !== e.error || (n.user || e.user) && (!n.user || !e.user || !kt(n.user, e.user)) || !un(n.peers, e.peers)) return !0;
3595
3595
  for (const r of Object.keys(n.peers))
3596
3596
  if (!kt(n.peers[r], e.peers[r])) return !0;
@@ -3639,7 +3639,7 @@ function nt(n) {
3639
3639
  }, e;
3640
3640
  }, {});
3641
3641
  }
3642
- const xn = "v0.22.90-experimental.drewh-ssr.20286580593.1";
3642
+ const xn = "v0.22.90-experimental.drewh-ssr.20320632959.1";
3643
3643
  function Pi(n, e) {
3644
3644
  return {
3645
3645
  info: n ? (...t) => console.info(...t, e()) : () => {
@@ -4346,7 +4346,7 @@ function Fe(n, e, t) {
4346
4346
  }
4347
4347
  function Ht(n, e, t, r) {
4348
4348
  var o;
4349
- const s = (o = C(t, n.table, "id")) == null ? void 0 : o.id;
4349
+ const s = (o = M(t, n.table, "id")) == null ? void 0 : o.id;
4350
4350
  if (!s)
4351
4351
  return -1;
4352
4352
  const i = ie(e.eav, [r, s, r]);
@@ -4394,7 +4394,7 @@ function Wi(n, e) {
4394
4394
  var r;
4395
4395
  if (n.orderFieldType)
4396
4396
  return n.orderFieldType;
4397
- const t = n.orderField === "serverCreatedAt" ? "number" : (r = C(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
4397
+ const t = n.orderField === "serverCreatedAt" ? "number" : (r = M(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
4398
4398
  return n.orderFieldType = t, t;
4399
4399
  }
4400
4400
  function Gi(n, e, t) {
@@ -4469,7 +4469,7 @@ class Hi {
4469
4469
  this.subs.flush();
4470
4470
  }
4471
4471
  subscribe(e, t) {
4472
- const r = M(e);
4472
+ const r = C(e);
4473
4473
  return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(t), this.initSubscription(e, r, t), (s) => {
4474
4474
  this.unsubscribe(r, t, s == null ? void 0 : s.keepSubscription);
4475
4475
  };
@@ -4540,7 +4540,7 @@ class Hi {
4540
4540
  }
4541
4541
  }
4542
4542
  onStartSyncOk(e) {
4543
- const t = e["subscription-id"], r = e.q, s = M(r);
4543
+ const t = e["subscription-id"], r = e.q, s = C(r);
4544
4544
  this.idToHash[t] = s, this.subs.updateInPlace((i) => {
4545
4545
  const o = i[s];
4546
4546
  if (!o)
@@ -4726,7 +4726,7 @@ class Hi {
4726
4726
  }
4727
4727
  }
4728
4728
  onStartSyncError(e) {
4729
- const t = M(e["original-event"].q), r = {
4729
+ const t = C(e["original-event"].q), r = {
4730
4730
  message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
4731
4731
  status: e.status,
4732
4732
  type: e.type,
@@ -4916,7 +4916,7 @@ class ao {
4916
4916
  // Queries
4917
4917
  T(this, "getPreviousResult", (e) => {
4918
4918
  var r;
4919
- const t = M(e);
4919
+ const t = C(e);
4920
4920
  return (r = this.dataForQuery(t)) == null ? void 0 : r.data;
4921
4921
  });
4922
4922
  /** Re-run instaql and call all callbacks with new data */
@@ -5248,7 +5248,7 @@ class ao {
5248
5248
  _addQueryData(e, t, r) {
5249
5249
  if (!this.attrs)
5250
5250
  throw new Error("Attrs in reactor have not been set");
5251
- const s = M(e), i = this.ensureAttrs(), o = te(
5251
+ const s = C(e), i = this.ensureAttrs(), o = te(
5252
5252
  this.attrs,
5253
5253
  t.triples,
5254
5254
  r,
@@ -5280,11 +5280,11 @@ class ao {
5280
5280
  break;
5281
5281
  }
5282
5282
  case "add-query-exists": {
5283
- this.notifyOneQueryOnce(M(t.q));
5283
+ this.notifyOneQueryOnce(C(t.q));
5284
5284
  break;
5285
5285
  }
5286
5286
  case "add-query-ok": {
5287
- const { q: d, result: h } = t, p = M(d);
5287
+ const { q: d, result: h } = t, p = C(d);
5288
5288
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[p])
5289
5289
  break;
5290
5290
  const b = (a = (o = h == null ? void 0 : h[0]) == null ? void 0 : o.data) == null ? void 0 : a["page-info"], _ = (u = (c = h == null ? void 0 : h[0]) == null ? void 0 : c.data) == null ? void 0 : u.aggregate, g = zt(h), y = this.ensureAttrs(), w = te(
@@ -5337,7 +5337,7 @@ class ao {
5337
5337
  });
5338
5338
  const _ = Zt(b.entries()), g = d.map((y) => {
5339
5339
  var _t, wt, Tt, mt;
5340
- const w = y["instaql-query"], S = y["instaql-result"], m = M(w), v = zt(S), O = this.ensureAttrs(), L = te(
5340
+ const w = y["instaql-query"], S = y["instaql-result"], m = C(w), v = zt(S), O = this.ensureAttrs(), L = te(
5341
5341
  O,
5342
5342
  v,
5343
5343
  r,
@@ -5486,8 +5486,8 @@ class ao {
5486
5486
  return;
5487
5487
  }
5488
5488
  if ((a = e["original-event"]) != null && a.hasOwnProperty("q") && ((c = e["original-event"]) == null ? void 0 : c.op) === "add-query") {
5489
- const p = (u = e["original-event"]) == null ? void 0 : u.q, b = M(p);
5490
- this.notifyQueryError(M(p), s), this.notifyQueryOnceError(p, b, t, s);
5489
+ const p = (u = e["original-event"]) == null ? void 0 : u.q, b = C(p);
5490
+ this.notifyQueryError(C(p), s), this.notifyQueryOnceError(p, b, t, s);
5491
5491
  return;
5492
5492
  }
5493
5493
  if (((l = e["original-event"]) == null ? void 0 : l.op) === "init") {
@@ -5545,7 +5545,7 @@ class ao {
5545
5545
  */
5546
5546
  subscribeQuery(e, t, r) {
5547
5547
  this.config.disableValidation || Qt(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
5548
- const s = M(e), i = this.getPreviousResult(e);
5548
+ const s = C(e), i = this.getPreviousResult(e);
5549
5549
  return i && t(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: t }), this._startQuerySub(e, s), () => {
5550
5550
  this._unsubQuery(e, s, t);
5551
5551
  };
@@ -5563,7 +5563,7 @@ class ao {
5563
5563
  "We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query"
5564
5564
  )
5565
5565
  ), r.promise;
5566
- const s = M(e), i = this._startQuerySub(e, s);
5566
+ const s = C(e), i = this._startQuerySub(e, s);
5567
5567
  return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(
5568
5568
  () => r.reject(new Error("Query timed out")),
5569
5569
  Ji
@@ -5606,7 +5606,7 @@ class ao {
5606
5606
  if (!t) return /* @__PURE__ */ new Map();
5607
5607
  const s = (l) => {
5608
5608
  const [f, d, h] = l["forward-identity"];
5609
- return C(e, d, h);
5609
+ return M(e, d, h);
5610
5610
  }, i = (l) => {
5611
5611
  const [f, d, h] = l["forward-identity"];
5612
5612
  return X(e, d, h);
@@ -6179,7 +6179,7 @@ class ao {
6179
6179
  getPresence(e, t, r = {}) {
6180
6180
  const s = this._rooms[t], i = this._presence[t];
6181
6181
  return !s || !i || !i.result ? null : {
6182
- ...Ci(i.result, r, this._sessionId),
6182
+ ...Mi(i.result, r, this._sessionId),
6183
6183
  isLoading: !s.isConnected,
6184
6184
  error: s.error
6185
6185
  };
@@ -6235,7 +6235,7 @@ class ao {
6235
6235
  }
6236
6236
  _notifyPresenceSub(e, t) {
6237
6237
  const r = this.getPresence("", e, t);
6238
- r && (t.prev && !Mi(r, t.prev) || (t.prev = r, t.cb(r)));
6238
+ r && (t.prev && !Ci(r, t.prev) || (t.prev = r, t.cb(r)));
6239
6239
  }
6240
6240
  _patchPresencePeers(e, t) {
6241
6241
  var o, a, c;
@@ -6704,7 +6704,7 @@ class qo {
6704
6704
  u.status = "success", u.data = l, u.promise = null;
6705
6705
  }), c.catch((l) => {
6706
6706
  u.status = "error", u.error = l, u.promise = null;
6707
- }), u;
6707
+ }), this.resultMap.set(s, u), u;
6708
6708
  }
6709
6709
  const o = this.getTriplesAndAttrsForQuery(i);
6710
6710
  let a = {
@@ -6759,7 +6759,7 @@ class qo {
6759
6759
  }, this.hashQuery = (t, r) => {
6760
6760
  t && r && "ruleParams" in r && (t = { $$ruleParams: r.ruleParams, ...t });
6761
6761
  const s = t ? Po(t) : null;
6762
- return { hash: M(s), query: s };
6762
+ return { hash: C(s), query: s };
6763
6763
  }, this.getTriplesAndAttrsForQuery = async (t) => {
6764
6764
  var c, u, l, f, d, h;
6765
6765
  const r = await fetch(
@@ -6808,12 +6808,12 @@ function rt(n) {
6808
6808
  return n.appId + "_" + (n.websocketURI || "default_ws_uri") + "_" + (n.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + n.useDateObjects;
6809
6809
  }
6810
6810
  const st = Io(), Xt = Eo();
6811
- class Co {
6811
+ class Mo {
6812
6812
  constructor(e) {
6813
6813
  this.db = e, this.sendMagicCode = (t) => this.db.sendMagicCode(t), this.signInWithMagicCode = (t) => this.db.signInWithMagicCode(t), this.signInWithToken = (t) => this.db.signInWithCustomToken(t), this.signInAsGuest = () => this.db.signInAsGuest(), this.createAuthorizationURL = (t) => this.db.createAuthorizationURL(t), this.signInWithIdToken = (t) => this.db.signInWithIdToken(t), this.exchangeOAuthCode = (t) => this.db.exchangeCodeForToken(t), this.issuerURI = () => this.db.issuerURI(), this.signOut = (t = { invalidateToken: !0 }) => this.db.signOut(t);
6814
6814
  }
6815
6815
  }
6816
- class Mo {
6816
+ class Co {
6817
6817
  constructor(e) {
6818
6818
  this.db = e, this.uploadFile = (t, r, s = {}) => this.db.uploadFile(t, r, s), this.delete = (t) => this.db.deleteFile(t), this.upload = (t, r) => this.db.upload(t, r), this.put = this.upload, this.getDownloadUrl = (t) => this.db.getDownloadUrl(t);
6819
6819
  }
@@ -6823,7 +6823,7 @@ function Po(n) {
6823
6823
  }
6824
6824
  class jo {
6825
6825
  constructor(e) {
6826
- this.tx = In(), this._reactor = e, this.auth = new Co(this._reactor), this.storage = new Mo(this._reactor);
6826
+ this.tx = In(), this._reactor = e, this.auth = new Mo(this._reactor), this.storage = new Co(this._reactor);
6827
6827
  }
6828
6828
  /**
6829
6829
  * Use this to write data! You can create, update, delete, and link objects
@@ -7003,7 +7003,7 @@ function en(n) {
7003
7003
  const e = Xt.get(n);
7004
7004
  if (e)
7005
7005
  return e;
7006
- const t = M(n);
7006
+ const t = C(n);
7007
7007
  return Xt.set(n, t), t;
7008
7008
  }
7009
7009
  function $o(n, e) {
@@ -7041,20 +7041,20 @@ function Ro(n, e) {
7041
7041
  }
7042
7042
  const Ko = Do;
7043
7043
  export {
7044
- Co as Auth,
7044
+ Mo as Auth,
7045
7045
  qo as FrameworkClient,
7046
7046
  Pn as IndexedDBStorage,
7047
7047
  Pe as InstantAPIError,
7048
7048
  jo as InstantCoreDatabase,
7049
7049
  pe as InstantError,
7050
7050
  k as QueryValidationError,
7051
- Mo as Storage,
7051
+ Co as Storage,
7052
7052
  fi as StorageInterface,
7053
7053
  Bi as SyncTableCallbackEventType,
7054
7054
  q as TransactionValidationError,
7055
7055
  jn as WindowNetworkListener,
7056
7056
  Po as coerceQuery,
7057
- Ce as coerceToDate,
7057
+ Me as coerceToDate,
7058
7058
  Fo as createInstantRouteHandler,
7059
7059
  Ls as getOps,
7060
7060
  E as i,
@@ -7068,5 +7068,5 @@ export {
7068
7068
  Qt as validateQuery,
7069
7069
  Ni as validateTransactions,
7070
7070
  xn as version,
7071
- M as weakHash
7071
+ C as weakHash
7072
7072
  };