@instantdb/solidjs 1.0.40 → 1.0.41-branch-python-sdk-v1.26586025551.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.
@@ -902,7 +902,7 @@ const os = (t) => function e(n, r, s) {
902
902
  var i, o, a;
903
903
  if (typeof n == "function" && typeof r != "function")
904
904
  return function(S, ...M) {
905
- return e(S, (k) => n.call(this, k, ...M), r);
905
+ return e(S, (O) => n.call(this, O, ...M), r);
906
906
  };
907
907
  const c = n, u = r;
908
908
  let l = s;
@@ -910,12 +910,12 @@ const os = (t) => function e(n, r, s) {
910
910
  throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
911
911
  l = Object.assign(Object.assign({}, t), l);
912
912
  const f = Te(c) ? yn(c) : c, d = Array.isArray(l.mark) ? (S, M) => {
913
- for (const k of l.mark) {
914
- if (typeof k != "function")
915
- throw new Error(`Invalid mark: ${k}, 'mark' should be a function.`);
916
- const O = k(S, M);
917
- if (O)
918
- return O;
913
+ for (const O of l.mark) {
914
+ if (typeof O != "function")
915
+ throw new Error(`Invalid mark: ${O}, 'mark' should be a function.`);
916
+ const k = O(S, M);
917
+ if (k)
918
+ return k;
919
919
  }
920
920
  } : l.mark, p = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, y = (o = l.strict) !== null && o !== void 0 ? o : !1, g = {
921
921
  enableAutoFreeze: (a = l.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
@@ -942,9 +942,9 @@ const os = (t) => function e(n, r, s) {
942
942
  if (!Te(S)) {
943
943
  if (S !== void 0 && !ye(S, _) && (M != null && M.operated))
944
944
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
945
- const O = S == null ? void 0 : S[Gr];
946
- if (O) {
947
- const N = O[0];
945
+ const k = S == null ? void 0 : S[Gr];
946
+ if (k) {
947
+ const N = k[0];
948
948
  return g.strict && typeof S == "object" && S !== null && Ut({
949
949
  rootDraft: M,
950
950
  value: S,
@@ -956,9 +956,9 @@ const os = (t) => function e(n, r, s) {
956
956
  }
957
957
  if (S === _ || S === void 0)
958
958
  return w([]);
959
- const k = E(S);
960
- if (g === k.options) {
961
- if (k.operated)
959
+ const O = E(S);
960
+ if (g === O.options) {
961
+ if (O.operated)
962
962
  throw new Error("Cannot return a modified child draft.");
963
963
  return w([yn(S)]);
964
964
  }
@@ -1345,7 +1345,7 @@ function Lt(t) {
1345
1345
  }
1346
1346
  return null;
1347
1347
  }
1348
- function Os(t) {
1348
+ function ks(t) {
1349
1349
  try {
1350
1350
  const e = JSON.parse(t);
1351
1351
  return typeof e == "string" ? Lt(e) : null;
@@ -1360,7 +1360,7 @@ function pt(t) {
1360
1360
  if (t instanceof Date)
1361
1361
  return t;
1362
1362
  if (typeof t == "string") {
1363
- const e = Lt(t) || Os(t) || Lt(t.trim());
1363
+ const e = Lt(t) || ks(t) || Lt(t.trim());
1364
1364
  if (!e)
1365
1365
  throw new Error(`Unable to parse \`${t}\` as a date.`);
1366
1366
  return e;
@@ -1444,7 +1444,7 @@ class Se {
1444
1444
  return { attrs: this.attrs, linkIndex: this.linkIndex };
1445
1445
  }
1446
1446
  }
1447
- function ks(t) {
1447
+ function Os(t) {
1448
1448
  return t.cardinality === "one";
1449
1449
  }
1450
1450
  function sn(t) {
@@ -1564,7 +1564,7 @@ function lr(t, e, n) {
1564
1564
  return;
1565
1565
  a["checked-data-type"] === "date" && t.useDateObjects && (o = pt(o));
1566
1566
  const c = Re(t.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? ur(t, a, r), l = [s, i, o, u];
1567
- ks(a) ? (ee(t.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), ee(t.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (ee(t.eav, [s, i, o], l), ee(t.aev, [i, s, o], l)), sn(a) && ee(t.vae, [o, i, s], l);
1567
+ Os(a) ? (ee(t.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), ee(t.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (ee(t.eav, [s, i, o], l), ee(t.aev, [i, s, o], l)), sn(a) && ee(t.vae, [o, i, s], l);
1568
1568
  }
1569
1569
  function Es(t, e, n) {
1570
1570
  var p;
@@ -2142,7 +2142,7 @@ function _i(t) {
2142
2142
  e.push(t.slice(0, n));
2143
2143
  return e;
2144
2144
  }
2145
- function On(t, e, n, r, s) {
2145
+ function kn(t, e, n, r, s) {
2146
2146
  return _i(s).map((i) => Kt(t, e, n, r, i, {
2147
2147
  $isNull: !0
2148
2148
  }));
@@ -2157,7 +2157,7 @@ function br(t, e, n, r, s) {
2157
2157
  return [];
2158
2158
  const a = i.split(".");
2159
2159
  if (o != null && o.hasOwnProperty("$ne") && (o = { ...o, $not: o.$ne }, delete o.$ne), o != null && o.hasOwnProperty("$not")) {
2160
- const c = Kt(t, e, n, r, a, o), u = On(t, e, n, r, a);
2160
+ const c = Kt(t, e, n, r, a, o), u = kn(t, e, n, r, a);
2161
2161
  return [
2162
2162
  {
2163
2163
  or: {
@@ -2170,7 +2170,7 @@ function br(t, e, n, r, s) {
2170
2170
  return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && a.length > 1 ? [
2171
2171
  {
2172
2172
  or: {
2173
- patterns: On(t, e, n, r, a),
2173
+ patterns: kn(t, e, n, r, a),
2174
2174
  joinSym: t(n, r)
2175
2175
  }
2176
2176
  }
@@ -2232,11 +2232,11 @@ function gr(t, e, n) {
2232
2232
  const [a, c] = n, u = e["checked-data-type"], l = u === "date" ? qt(c) : c, f = u === "date" ? qt(i) : i;
2233
2233
  return at([a, l], [r, f], u);
2234
2234
  }
2235
- function Oi(t, e, n, r) {
2235
+ function ki(t, e, n, r) {
2236
2236
  const s = gr(t, e, r);
2237
2237
  return n === "desc" ? s > 0 : s < 0;
2238
2238
  }
2239
- function ki(t, e, n, r) {
2239
+ function Oi(t, e, n, r) {
2240
2240
  const s = gr(t, e, r);
2241
2241
  return n === "desc" ? s < 0 : s > 0;
2242
2242
  }
@@ -2277,8 +2277,8 @@ function Mi(t, e, { etype: n, pageInfo: r, dq: s, form: i }) {
2277
2277
  if (d && ((g = d == null ? void 0 : d["forward-identity"]) == null ? void 0 : g[2]) !== "id") {
2278
2278
  const _ = d["checked-data-type"] === "date", w = d.id;
2279
2279
  u = u.map(([m]) => {
2280
- var S, M, k, O, N;
2281
- let I = (N = (O = (k = (M = (S = t.eav.get(m)) == null ? void 0 : S.get(w)) == null ? void 0 : M.values()) == null ? void 0 : k.next()) == null ? void 0 : O.value) == null ? void 0 : N[2];
2280
+ var S, M, O, k, N;
2281
+ let I = (N = (k = (O = (M = (S = t.eav.get(m)) == null ? void 0 : S.get(w)) == null ? void 0 : M.values()) == null ? void 0 : O.next()) == null ? void 0 : k.value) == null ? void 0 : N[2];
2282
2282
  return _ && (I = qt(I)), [m, I];
2283
2283
  });
2284
2284
  }
@@ -2291,7 +2291,7 @@ function Mi(t, e, { etype: n, pageInfo: r, dq: s, form: i }) {
2291
2291
  const y = Pi(e, n, s);
2292
2292
  for (const _ of u) {
2293
2293
  const [w] = _;
2294
- if (p[w] || !a && l && d && Oi(l, d, c, _) || !a && f && d && ki(f, d, c, _))
2294
+ if (p[w] || !a && l && d && ki(l, d, c, _) || !a && f && d && Oi(f, d, c, _))
2295
2295
  continue;
2296
2296
  const m = Ds(t, y, w);
2297
2297
  m && (p[w] = m);
@@ -2694,7 +2694,7 @@ function so(t, e, n) {
2694
2694
  "on-delete-reverse": i.onDelete
2695
2695
  };
2696
2696
  }
2697
- function kn(t, e, n, r) {
2697
+ function On(t, e, n, r) {
2698
2698
  const s = t ? so(t, e, n) : null, i = F(), o = [F(), e, n], a = [F(), n, e];
2699
2699
  return {
2700
2700
  id: i,
@@ -2768,7 +2768,7 @@ function fo({ attrsStore: t, schema: e }, n) {
2768
2768
  }
2769
2769
  function f(y, b) {
2770
2770
  const g = o(y, b), _ = a(y, b);
2771
- u(g), u(_), !g && !_ && c(kn(e, y, b, uo));
2771
+ u(g), u(_), !g && !_ && c(On(e, y, b, uo));
2772
2772
  }
2773
2773
  for (const y of n)
2774
2774
  for (const { etype: b, lookupPair: g, linkLabel: _ } of lo(y)) {
@@ -2800,7 +2800,7 @@ function fo({ attrsStore: t, schema: e }, n) {
2800
2800
  const S = o(g, I);
2801
2801
  if (u(S), ao.has(b) && (S || c(Ge(e, g, I, I === "id" ? { "unique?": !0 } : null))), oo.has(b)) {
2802
2802
  const M = a(g, I);
2803
- !S && !M && c(kn(e, g, I)), u(M);
2803
+ !S && !M && c(On(e, g, I)), u(M);
2804
2804
  }
2805
2805
  }
2806
2806
  }
@@ -3376,7 +3376,7 @@ async function Pn({ apiURI: t, appId: e, code: n, codeVerifier: r, refreshToken:
3376
3376
  })
3377
3377
  });
3378
3378
  }
3379
- async function Oo({ apiURI: t, appId: e, nonce: n, idToken: r, clientName: s, refreshToken: i, extraFields: o }) {
3379
+ async function ko({ apiURI: t, appId: e, nonce: n, idToken: r, clientName: s, refreshToken: i, extraFields: o }) {
3380
3380
  return await le(`${t}/runtime/oauth/id_token`, {
3381
3381
  method: "POST",
3382
3382
  headers: { "content-type": "application/json" },
@@ -3390,7 +3390,7 @@ async function Oo({ apiURI: t, appId: e, nonce: n, idToken: r, clientName: s, re
3390
3390
  })
3391
3391
  });
3392
3392
  }
3393
- async function ko({ apiURI: t, appId: e, refreshToken: n }) {
3393
+ async function Oo({ apiURI: t, appId: e, refreshToken: n }) {
3394
3394
  return await le(`${t}/runtime/signout`, {
3395
3395
  method: "POST",
3396
3396
  headers: {
@@ -3458,8 +3458,8 @@ async function Mo({ apiURI: t, appId: e, path: n, refreshToken: r }) {
3458
3458
  });
3459
3459
  return s;
3460
3460
  }
3461
- let un = !1, Or = !1, kr = !1;
3462
- typeof window < "u" && typeof window.localStorage < "u" && (un = !!window.localStorage.getItem("devBackend"), Or = !!window.localStorage.getItem("__instantLogging"), kr = !!window.localStorage.getItem("__devtoolLocalDash"));
3461
+ let un = !1, kr = !1, Or = !1;
3462
+ typeof window < "u" && typeof window.localStorage < "u" && (un = !!window.localStorage.getItem("devBackend"), kr = !!window.localStorage.getItem("__instantLogging"), Or = !!window.localStorage.getItem("__devtoolLocalDash"));
3463
3463
  function Mn(t, e) {
3464
3464
  if (!e)
3465
3465
  return t;
@@ -3536,7 +3536,7 @@ function xn(t) {
3536
3536
  }, e;
3537
3537
  }, {});
3538
3538
  }
3539
- const ln = "v1.0.40";
3539
+ const ln = "v1.0.41-branch-python-sdk-v1.26586025551.1";
3540
3540
  function xo(t, e) {
3541
3541
  return {
3542
3542
  info: t ? (...n) => console.info(...n, e()) : () => {
@@ -3834,7 +3834,7 @@ class ae extends Error {
3834
3834
  super(e), this.name = "TransactionValidationError";
3835
3835
  }
3836
3836
  }
3837
- const Mr = (t) => t.length > 0 ? t.join(", ") : "none", No = (t, e) => new ae(`Entity '${t}' does not exist in schema. Available entities: ${Mr(e)}`), Ot = {
3837
+ const Mr = (t) => t.length > 0 ? t.join(", ") : "none", No = (t, e) => new ae(`Entity '${t}' does not exist in schema. Available entities: ${Mr(e)}`), kt = {
3838
3838
  string: (t) => typeof t == "string",
3839
3839
  number: (t) => typeof t == "number" && !isNaN(t),
3840
3840
  boolean: (t) => typeof t == "boolean",
@@ -3842,13 +3842,13 @@ const Mr = (t) => t.length > 0 ? t.join(", ") : "none", No = (t, e) => new ae(`E
3842
3842
  json: () => !0
3843
3843
  }, Fo = (t, e) => {
3844
3844
  var n;
3845
- return t == null ? !0 : ((n = Ot[e.valueType]) == null ? void 0 : n.call(Ot, t)) ?? !1;
3845
+ return t == null ? !0 : ((n = kt[e.valueType]) == null ? void 0 : n.call(kt, t)) ?? !1;
3846
3846
  }, $r = (t, e) => {
3847
3847
  const n = e.entities[t];
3848
3848
  if (!n)
3849
3849
  throw No(t, Object.keys(e.entities));
3850
3850
  return n;
3851
- }, kt = (t, e, n) => {
3851
+ }, Ot = (t, e, n) => {
3852
3852
  const r = $r(t, n);
3853
3853
  if (typeof e != "object" || e === null)
3854
3854
  throw new ae(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
@@ -3878,9 +3878,9 @@ const Mr = (t) => t.length > 0 ? t.join(", ") : "none", No = (t, e) => new ae(`E
3878
3878
  }
3879
3879
  }
3880
3880
  }, Ko = {
3881
- create: kt,
3882
- update: kt,
3883
- merge: kt,
3881
+ create: Ot,
3882
+ update: Ot,
3883
+ merge: Ot,
3884
3884
  link: Ln,
3885
3885
  unlink: Ln,
3886
3886
  delete: () => {
@@ -4465,14 +4465,14 @@ function Zo({ WStream: t, opts: e, startStream: n, appendStream: r, registerStre
4465
4465
  e.waitUntil && e.waitUntil(new Promise((T) => {
4466
4466
  y.push(T);
4467
4467
  }));
4468
- function k() {
4468
+ function O() {
4469
4469
  for (const T of y)
4470
4470
  try {
4471
4471
  T();
4472
4472
  } catch {
4473
4473
  }
4474
4474
  }
4475
- function O(T) {
4475
+ function k(T) {
4476
4476
  return p.push(T), o && T(o), () => {
4477
4477
  const v = p.indexOf(T);
4478
4478
  v !== -1 && p.splice(v, 1);
@@ -4497,7 +4497,7 @@ function Zo({ WStream: t, opts: e, startStream: n, appendStream: r, registerStre
4497
4497
  R > 0 && (g += q, _ -= q, w.splice(0, R));
4498
4498
  }
4499
4499
  function U(T, v) {
4500
- a = v, I(), T.error(v), k();
4500
+ a = v, I(), T.error(v), O();
4501
4501
  }
4502
4502
  async function V() {
4503
4503
  const T = await n({
@@ -4529,7 +4529,7 @@ function Zo({ WStream: t, opts: e, startStream: n, appendStream: r, registerStre
4529
4529
  x(), V();
4530
4530
  }
4531
4531
  function A({ offset: T, done: v }) {
4532
- L(T), v && (l = !0, k());
4532
+ L(T), v && (l = !0, O());
4533
4533
  }
4534
4534
  function P(T) {
4535
4535
  return l ? (U(T, new J("Stream has been closed.")), null) : o || (U(T, new J("Stream has not been initialized.")), null);
@@ -4588,7 +4588,7 @@ function Zo({ WStream: t, opts: e, startStream: n, appendStream: r, registerStre
4588
4588
  }, Tt = (we) => {
4589
4589
  R(we || new J("Stream is closed.")), Q();
4590
4590
  };
4591
- q.push(O(re)), q.push(S(Tt));
4591
+ q.push(k(re)), q.push(S(Tt));
4592
4592
  });
4593
4593
  }
4594
4594
  }
@@ -4618,7 +4618,7 @@ function Zo({ WStream: t, opts: e, startStream: n, appendStream: r, registerStre
4618
4618
  chunks: [],
4619
4619
  offset: g + _,
4620
4620
  isDone: !0
4621
- }) : k(), I();
4621
+ }) : O(), I();
4622
4622
  },
4623
4623
  abort(T) {
4624
4624
  o ? r({
@@ -4627,7 +4627,7 @@ function Zo({ WStream: t, opts: e, startStream: n, appendStream: r, registerStre
4627
4627
  offset: g + _,
4628
4628
  isDone: !0,
4629
4629
  abortReason: T
4630
- }) : k(), I();
4630
+ }) : O(), I();
4631
4631
  }
4632
4632
  }),
4633
4633
  addCompleteCb: M,
@@ -4676,41 +4676,41 @@ function ea({ RStream: t, opts: e, startStream: n, cancelStream: r }) {
4676
4676
  let c, u = !1;
4677
4677
  const l = [], f = [];
4678
4678
  let d = null, p = null;
4679
- function y(k) {
4679
+ function y(O) {
4680
4680
  u = !0;
4681
- for (const O of l)
4682
- O(k);
4681
+ for (const k of l)
4682
+ k(O);
4683
4683
  }
4684
- function b(k) {
4685
- return l.push(k), () => {
4686
- const O = l.indexOf(k);
4687
- O !== -1 && l.splice(O, 1);
4684
+ function b(O) {
4685
+ return l.push(O), () => {
4686
+ const k = l.indexOf(O);
4687
+ k !== -1 && l.splice(k, 1);
4688
4688
  };
4689
4689
  }
4690
- function g(k) {
4691
- return f.push(k), d && k(d), () => {
4692
- const O = f.indexOf(k);
4693
- O !== -1 && f.splice(O, 1);
4690
+ function g(O) {
4691
+ return f.push(O), d && O(d), () => {
4692
+ const k = f.indexOf(O);
4693
+ k !== -1 && f.splice(k, 1);
4694
4694
  };
4695
4695
  }
4696
- function _(k, O) {
4697
- p = O, k.error(O), y(O);
4696
+ function _(O, k) {
4697
+ p = k, O.error(k), y(k);
4698
4698
  }
4699
4699
  let w = 0;
4700
- async function m(k, O) {
4700
+ async function m(O, k) {
4701
4701
  c = F();
4702
- const N = { ...k || {}, eventId: c };
4702
+ const N = { ...O || {}, eventId: c };
4703
4703
  for await (const x of n(N)) {
4704
4704
  if (i)
4705
4705
  return;
4706
4706
  if (x.type === "reconnect")
4707
4707
  return { retry: !0 };
4708
4708
  if (x.type === "error") {
4709
- _(O, x.error);
4709
+ _(k, x.error);
4710
4710
  return;
4711
4711
  }
4712
4712
  if (x.offset > s) {
4713
- _(O, new J("Stream is corrupted.")), i = !0;
4713
+ _(k, new J("Stream is corrupted.")), i = !0;
4714
4714
  return;
4715
4715
  }
4716
4716
  d = x.streamId;
@@ -4726,7 +4726,7 @@ function ea({ RStream: t, opts: e, startStream: n, cancelStream: r }) {
4726
4726
  const A = x.files[K + 1], C = await V;
4727
4727
  if (A && (V = fetch(A.url, { signal: U.signal })), !C.ok) {
4728
4728
  if (w++, w > 10) {
4729
- _(O, new J("Unable to process stream."));
4729
+ _(k, new J("Unable to process stream."));
4730
4730
  return;
4731
4731
  }
4732
4732
  return { retry: !0 };
@@ -4747,7 +4747,7 @@ function ea({ RStream: t, opts: e, startStream: n, cancelStream: r }) {
4747
4747
  continue;
4748
4748
  s += v.length;
4749
4749
  const R = o.decode(v);
4750
- O.enqueue(R);
4750
+ k.enqueue(R);
4751
4751
  }
4752
4752
  } finally {
4753
4753
  $.releaseLock();
@@ -4763,7 +4763,7 @@ function ea({ RStream: t, opts: e, startStream: n, cancelStream: r }) {
4763
4763
  continue;
4764
4764
  s += j.byteLength;
4765
4765
  const T = o.decode(j);
4766
- O.enqueue(T);
4766
+ k.enqueue(T);
4767
4767
  }
4768
4768
  }
4769
4769
  }
@@ -4775,37 +4775,37 @@ function ea({ RStream: t, opts: e, startStream: n, cancelStream: r }) {
4775
4775
  continue;
4776
4776
  V = K, U = o.decode(K);
4777
4777
  }
4778
- s += V.length, O.enqueue(U);
4778
+ s += V.length, k.enqueue(U);
4779
4779
  }
4780
4780
  }
4781
4781
  }
4782
- async function I(k) {
4783
- let O = !0, N = 0;
4784
- for (; O; ) {
4785
- O = !1;
4782
+ async function I(O) {
4783
+ let k = !0, N = 0;
4784
+ for (; k; ) {
4785
+ k = !1;
4786
4786
  let x = Date.now() + Math.min(15e3, 500 * (N - 1));
4787
- const L = await m({ ...e, offset: s }, k);
4788
- L != null && L.retry && (O = !0, N++, x < Date.now() - 3e5 && (N = 0), await new Promise((U) => {
4787
+ const L = await m({ ...e, offset: s }, O);
4788
+ L != null && L.retry && (k = !0, N++, x < Date.now() - 3e5 && (N = 0), await new Promise((U) => {
4789
4789
  setTimeout(U, Math.max(0, x - Date.now()));
4790
4790
  }));
4791
4791
  }
4792
- !i && !u && (k.close(), y());
4792
+ !i && !u && (O.close(), y());
4793
4793
  }
4794
4794
  class S extends t {
4795
- constructor(O, N) {
4796
- super(O, N);
4795
+ constructor(k, N) {
4796
+ super(k, N);
4797
4797
  }
4798
4798
  async streamId() {
4799
4799
  if (d)
4800
4800
  return d;
4801
4801
  if (p)
4802
4802
  throw p;
4803
- return new Promise((O, N) => {
4803
+ return new Promise((k, N) => {
4804
4804
  const x = [], L = () => {
4805
4805
  for (const K of x)
4806
4806
  K();
4807
4807
  }, U = (K) => {
4808
- O(K), L();
4808
+ k(K), L();
4809
4809
  }, V = (K) => {
4810
4810
  N(K || new J("Stream is closed.")), L();
4811
4811
  };
@@ -4815,10 +4815,10 @@ function ea({ RStream: t, opts: e, startStream: n, cancelStream: r }) {
4815
4815
  }
4816
4816
  return {
4817
4817
  stream: new S({
4818
- start(k) {
4819
- I(k);
4818
+ start(O) {
4819
+ I(O);
4820
4820
  },
4821
- cancel(k) {
4821
+ cancel(O) {
4822
4822
  i = !0, c && r({ eventId: c }), y();
4823
4823
  }
4824
4824
  }),
@@ -4999,7 +4999,7 @@ const fe = {
4999
4999
  }, na = 3e4, ra = 3e4, sa = 200, ia = 1e3 * 60, oa = {
5000
5000
  apiURI: "https://api.instantdb.com",
5001
5001
  websocketURI: "wss://api.instantdb.com/runtime/session"
5002
- }, Ct = "_instant_oauth_redirect", Et = "_instant_extra_fields_id", Je = "oauthExtraFields", ke = "currentUser";
5002
+ }, Ct = "_instant_oauth_redirect", Et = "_instant_extra_fields_id", Je = "oauthExtraFields", Oe = "currentUser";
5003
5003
  function aa({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: s }) {
5004
5004
  if (!s)
5005
5005
  return new Nn(`${r}?app_id=${e}`);
@@ -5279,7 +5279,7 @@ class pa {
5279
5279
  }
5280
5280
  this._log.info("[socket][close]", n.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
5281
5281
  });
5282
- if (this._EventSource = i, this.config = { ...oa, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? ra, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? sa, this._log = xo(e.verbose || un || Or, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": ln }, this.config.schema && (this._linkIndex = xn(this.config.schema)), !!ca()) {
5282
+ if (this._EventSource = i, this.config = { ...oa, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? ra, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? sa, this._log = xo(e.verbose || un || kr, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": ln }, this.config.schema && (this._linkIndex = xn(this.config.schema)), !!ca()) {
5283
5283
  if (!e.appId)
5284
5284
  throw new Error("Instant must be initialized with an appId.");
5285
5285
  if (!je(e.appId))
@@ -5380,7 +5380,7 @@ class pa {
5380
5380
  gc: null
5381
5381
  }), this.kv.onKeyLoaded = (n) => {
5382
5382
  n === "pendingMutations" && this.notifyAll();
5383
- }, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(ke), this._beforeUnloadCbs.push(() => {
5383
+ }, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(Oe), this._beforeUnloadCbs.push(() => {
5384
5384
  this.kv.flush(), this.querySubs.flush();
5385
5385
  });
5386
5386
  }
@@ -5524,7 +5524,7 @@ class pa {
5524
5524
  });
5525
5525
  const _ = Pt(g.entries()), w = p.map((m) => {
5526
5526
  var K, A, P, C;
5527
- const I = m["instaql-query"], S = m["instaql-result"], M = se(I), k = jn(S), O = this.ensureAttrs(), N = Ne(O, k, r, this.config.useDateObjects), { store: x, attrsStore: L } = this._applyOptimisticUpdates(N, O, _, b), U = (A = (K = S == null ? void 0 : S[0]) == null ? void 0 : K.data) == null ? void 0 : A["page-info"], V = (C = (P = S == null ? void 0 : S[0]) == null ? void 0 : P.data) == null ? void 0 : C.aggregate;
5527
+ const I = m["instaql-query"], S = m["instaql-result"], M = se(I), O = jn(S), k = this.ensureAttrs(), N = Ne(k, O, r, this.config.useDateObjects), { store: x, attrsStore: L } = this._applyOptimisticUpdates(N, k, _, b), U = (A = (K = S == null ? void 0 : S[0]) == null ? void 0 : K.data) == null ? void 0 : A["page-info"], V = (C = (P = S == null ? void 0 : S[0]) == null ? void 0 : P.data) == null ? void 0 : C.aggregate;
5528
5528
  return {
5529
5529
  q: I,
5530
5530
  hash: M,
@@ -5534,7 +5534,7 @@ class pa {
5534
5534
  aggregate: V
5535
5535
  };
5536
5536
  });
5537
- w.forEach(({ hash: m, q: I, store: S, attrsStore: M, pageInfo: k, aggregate: O }) => {
5537
+ w.forEach(({ hash: m, q: I, store: S, attrsStore: M, pageInfo: O, aggregate: k }) => {
5538
5538
  this.querySubs.updateInPlace((N) => {
5539
5539
  if (!N[m]) {
5540
5540
  this._log.error("Missing value in querySubs", { hash: m, q: I });
@@ -5543,8 +5543,8 @@ class pa {
5543
5543
  N[m].result = {
5544
5544
  store: S,
5545
5545
  attrsStore: M,
5546
- pageInfo: k,
5547
- aggregate: O,
5546
+ pageInfo: O,
5547
+ aggregate: k,
5548
5548
  processedTxId: b
5549
5549
  };
5550
5550
  });
@@ -6154,8 +6154,8 @@ class pa {
6154
6154
  }
6155
6155
  async setCurrentUser(e) {
6156
6156
  this.kv.updateInPlace((n) => {
6157
- n[ke] = e;
6158
- }), await this.kv.waitForKeyToLoad(ke);
6157
+ n[Oe] = e;
6158
+ }), await this.kv.waitForKeyToLoad(Oe);
6159
6159
  }
6160
6160
  getCurrentUserCached() {
6161
6161
  return this._currentUserCached;
@@ -6165,8 +6165,8 @@ class pa {
6165
6165
  * @returns {Promise<User | undefined>}
6166
6166
  */
6167
6167
  async _getCurrentUser(e) {
6168
- e != null && e.forceReadFromStorage && await this.kv.unloadKey(ke);
6169
- const n = await this.kv.waitForKeyToLoad(ke);
6168
+ e != null && e.forceReadFromStorage && await this.kv.unloadKey(Oe);
6169
+ const n = await this.kv.waitForKeyToLoad(Oe);
6170
6170
  return typeof n == "string" ? JSON.parse(n) : n;
6171
6171
  }
6172
6172
  /**
@@ -6194,7 +6194,7 @@ class pa {
6194
6194
  }
6195
6195
  }
6196
6196
  async _hasCurrentUser() {
6197
- const e = await this.kv.waitForKeyToLoad(ke);
6197
+ const e = await this.kv.waitForKeyToLoad(Oe);
6198
6198
  return typeof e == "string" ? JSON.parse(e) != null : e != null;
6199
6199
  }
6200
6200
  async changeCurrentUser(e) {
@@ -6290,7 +6290,7 @@ class pa {
6290
6290
  this._log.info("[auth-invalidate] skipped invalidateToken");
6291
6291
  return;
6292
6292
  }
6293
- ko({
6293
+ Oo({
6294
6294
  apiURI: this.config.apiURI,
6295
6295
  appId: this.config.appId,
6296
6296
  refreshToken: r
@@ -6355,7 +6355,7 @@ class pa {
6355
6355
  */
6356
6356
  async signInWithIdToken(e) {
6357
6357
  var i;
6358
- const n = await this.getCurrentUser(), r = (i = n == null ? void 0 : n.user) == null ? void 0 : i.refresh_token, s = await Oo({
6358
+ const n = await this.getCurrentUser(), r = (i = n == null ? void 0 : n.user) == null ? void 0 : i.refresh_token, s = await ko({
6359
6359
  apiURI: this.config.apiURI,
6360
6360
  appId: this.config.appId,
6361
6361
  idToken: e.idToken,
@@ -6656,7 +6656,7 @@ const yc = {
6656
6656
  let Ye;
6657
6657
  function Aa(t, e) {
6658
6658
  Ye == null || Ye.dispose();
6659
- const n = Pa(e), r = Ia(e, a), s = ka(Oa(t));
6659
+ const n = Pa(e), r = Ia(e, a), s = Oa(ka(t));
6660
6660
  function i(l) {
6661
6661
  var f;
6662
6662
  l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && n.isVisible() && a();
@@ -6678,10 +6678,10 @@ function Aa(t, e) {
6678
6678
  }
6679
6679
  return u();
6680
6680
  }
6681
- function Oa(t) {
6682
- return `${un || kr ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
6683
- }
6684
6681
  function ka(t) {
6682
+ return `${un || Or ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
6683
+ }
6684
+ function Oa(t) {
6685
6685
  const e = document.createElement("iframe");
6686
6686
  return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
6687
6687
  width: "100%",
@@ -6849,7 +6849,7 @@ const $a = (t) => JSON.stringify(t), Ke = (t, e = !1) => JSON.stringify([t, e]),
6849
6849
  }, w = (A, P) => {
6850
6850
  u.set(Ke(A, P.afterInclusive), P), _();
6851
6851
  }, m = (A, P) => {
6852
- l.set(Ke(A), P), O(), _();
6852
+ l.set(Ke(A), P), k(), _();
6853
6853
  }, I = (A, P) => {
6854
6854
  var T, v;
6855
6855
  const { cursor: C } = zn(A), $ = f.get(Ie("reverse", C));
@@ -6930,7 +6930,7 @@ const $a = (t) => JSON.stringify(t), Ke = (t, e = !1) => JSON.stringify([t, e]),
6930
6930
  });
6931
6931
  }, r);
6932
6932
  f.set(Ie("forward", A, P), C);
6933
- }, k = (A, P = !1) => {
6933
+ }, O = (A, P = !1) => {
6934
6934
  var v, R;
6935
6935
  const C = Ke(A, P), $ = f.get(Ie("forward", A, P));
6936
6936
  $ == null || $();
@@ -6963,7 +6963,7 @@ const $a = (t) => JSON.stringify(t), Ke = (t, e = !1) => JSON.stringify([t, e]),
6963
6963
  });
6964
6964
  }, r);
6965
6965
  f.set(Ie("forward", A, P), T);
6966
- }, O = () => {
6966
+ }, k = () => {
6967
6967
  const A = Array.from(l.entries()).at(-1);
6968
6968
  if (!A)
6969
6969
  return;
@@ -6980,7 +6980,7 @@ const $a = (t) => JSON.stringify(t), Ke = (t, e = !1) => JSON.stringify([t, e]),
6980
6980
  if (!C.endCursor)
6981
6981
  return;
6982
6982
  const { cursor: $, afterInclusive: j } = zn(P);
6983
- k($, j), M(C.endCursor);
6983
+ O($, j), M(C.endCursor);
6984
6984
  };
6985
6985
  return b = t.subscribeQuery({
6986
6986
  [a]: {
@@ -7527,7 +7527,7 @@ const Ga = !1, Ha = (t, e) => t === e, ut = {
7527
7527
  equals: Ha
7528
7528
  };
7529
7529
  let Lr = qr;
7530
- const Oe = 1, lt = 2, Ja = {};
7530
+ const ke = 1, lt = 2, Ja = {};
7531
7531
  var H = null;
7532
7532
  let $t = null, Ya = null, G = null, Y = null, be = null, _t = 0;
7533
7533
  function Ee(t, e) {
@@ -7542,7 +7542,7 @@ function Ee(t, e) {
7542
7542
  }
7543
7543
  function de(t, e, n) {
7544
7544
  Lr = tc;
7545
- const r = Kr(t, e, !1, Oe);
7545
+ const r = Kr(t, e, !1, ke);
7546
7546
  r.user = !0, be ? be.push(r) : mt(r);
7547
7547
  }
7548
7548
  function fn(t, e, n) {
@@ -7565,7 +7565,7 @@ function he(t) {
7565
7565
  }
7566
7566
  function Nr() {
7567
7567
  if (this.sources && this.state)
7568
- if (this.state === Oe) mt(this);
7568
+ if (this.state === ke) mt(this);
7569
7569
  else {
7570
7570
  const t = Y;
7571
7571
  Y = null, St(() => dt(this)), Y = t;
@@ -7581,7 +7581,7 @@ function Fr(t, e, n) {
7581
7581
  return (!t.comparator || !t.comparator(r, e)) && (t.value = e, t.observers && t.observers.length && St(() => {
7582
7582
  for (let s = 0; s < t.observers.length; s += 1) {
7583
7583
  const i = t.observers[s], o = $t && $t.running;
7584
- o && $t.disposed.has(i), (o ? !i.tState : !i.state) && (i.pure ? Y.push(i) : be.push(i), i.observers && zr(i)), o || (i.state = Oe);
7584
+ o && $t.disposed.has(i), (o ? !i.tState : !i.state) && (i.pure ? Y.push(i) : be.push(i), i.observers && zr(i)), o || (i.state = ke);
7585
7585
  }
7586
7586
  if (Y.length > 1e6)
7587
7587
  throw Y = [], new Error();
@@ -7600,13 +7600,13 @@ function Xa(t, e, n) {
7600
7600
  try {
7601
7601
  r = t.fn(e);
7602
7602
  } catch (o) {
7603
- return t.pure && (t.state = Oe, t.owned && t.owned.forEach(ht), t.owned = null), t.updatedAt = n + 1, Wr(o);
7603
+ return t.pure && (t.state = ke, t.owned && t.owned.forEach(ht), t.owned = null), t.updatedAt = n + 1, Wr(o);
7604
7604
  } finally {
7605
7605
  G = i, H = s;
7606
7606
  }
7607
7607
  (!t.updatedAt || t.updatedAt <= n) && (t.updatedAt != null && "observers" in t ? Fr(t, r) : t.value = r, t.updatedAt = n);
7608
7608
  }
7609
- function Kr(t, e, n, r = Oe, s) {
7609
+ function Kr(t, e, n, r = ke, s) {
7610
7610
  const i = {
7611
7611
  fn: t,
7612
7612
  state: r,
@@ -7630,7 +7630,7 @@ function ft(t) {
7630
7630
  for (; (t = t.owner) && (!t.updatedAt || t.updatedAt < _t); )
7631
7631
  t.state && e.push(t);
7632
7632
  for (let n = e.length - 1; n >= 0; n--)
7633
- if (t = e[n], t.state === Oe)
7633
+ if (t = e[n], t.state === ke)
7634
7634
  mt(t);
7635
7635
  else if (t.state === lt) {
7636
7636
  const r = Y;
@@ -7670,7 +7670,7 @@ function dt(t, e) {
7670
7670
  const r = t.sources[n];
7671
7671
  if (r.sources) {
7672
7672
  const s = r.state;
7673
- s === Oe ? r !== e && (!r.updatedAt || r.updatedAt < _t) && ft(r) : s === lt && dt(r, e);
7673
+ s === ke ? r !== e && (!r.updatedAt || r.updatedAt < _t) && ft(r) : s === lt && dt(r, e);
7674
7674
  }
7675
7675
  }
7676
7676
  }