@instantdb/react 1.0.40-branch-drewh-user-sync-less-often.26546252190.1 → 1.0.40-branch-python-sdk-v1.26548577482.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.
@@ -1962,7 +1962,7 @@ function Go() {
1962
1962
  }
1963
1963
  const Ho = Go();
1964
1964
  let Ds = !0;
1965
- const ol = (n) => {
1965
+ const al = (n) => {
1966
1966
  Ds = n;
1967
1967
  };
1968
1968
  let Jo = 0;
@@ -2430,7 +2430,7 @@ function ir() {
2430
2430
  }
2431
2431
  });
2432
2432
  }
2433
- const al = ir();
2433
+ const cl = ir();
2434
2434
  function Ca(n) {
2435
2435
  return n.__ops;
2436
2436
  }
@@ -3541,7 +3541,7 @@ function Qr(n) {
3541
3541
  }, e;
3542
3542
  }, {});
3543
3543
  }
3544
- const ar = "v1.0.40-branch-drewh-user-sync-less-often.26546252190.1";
3544
+ const ar = "v1.0.40-branch-python-sdk-v1.26548577482.1";
3545
3545
  function Sc(n, e) {
3546
3546
  return {
3547
3547
  info: n ? (...t) => console.info(...t, e()) : () => {
@@ -5001,11 +5001,11 @@ const Ce = {
5001
5001
  AUTHENTICATED: "authenticated",
5002
5002
  CLOSED: "closed",
5003
5003
  ERRORED: "errored"
5004
- }, qc = 3e4, zc = 3e4, Vc = 200, Qc = {
5004
+ }, qc = 3e4, zc = 3e4, Vc = 200, Qc = 1e3 * 60, Bc = {
5005
5005
  apiURI: "https://api.instantdb.com",
5006
5006
  websocketURI: "wss://api.instantdb.com/runtime/session"
5007
5007
  }, bn = "_instant_oauth_redirect", gn = "_instant_extra_fields_id", xt = "oauthExtraFields", Ge = "currentUser";
5008
- function Bc({ transportType: n, appId: e, apiURI: t, wsURI: r, EventSourceImpl: s }) {
5008
+ function Gc({ transportType: n, appId: e, apiURI: t, wsURI: r, EventSourceImpl: s }) {
5009
5009
  if (!s)
5010
5010
  return new Yr(`${r}?app_id=${e}`);
5011
5011
  switch (n) {
@@ -5017,7 +5017,7 @@ function Bc({ transportType: n, appId: e, apiURI: t, wsURI: r, EventSourceImpl:
5017
5017
  throw new Error("Unknown transport type " + n);
5018
5018
  }
5019
5019
  }
5020
- function Gc() {
5020
+ function Hc() {
5021
5021
  return typeof window < "u" || typeof chrome < "u";
5022
5022
  }
5023
5023
  const es = {
@@ -5026,7 +5026,7 @@ const es = {
5026
5026
  "refresh-presence": !0,
5027
5027
  "patch-presence": !0
5028
5028
  };
5029
- function Hc(n, e) {
5029
+ function Jc(n, e) {
5030
5030
  var r;
5031
5031
  const t = typeof n == "string" ? JSON.parse(n) : n;
5032
5032
  if ((r = t == null ? void 0 : t.result) != null && r.store) {
@@ -5041,7 +5041,7 @@ function Hc(n, e) {
5041
5041
  }
5042
5042
  return t;
5043
5043
  }
5044
- function Jc(n, e) {
5044
+ function Yc(n, e) {
5045
5045
  const { result: t, ...r } = e, s = (
5046
5046
  /** @type {import('./reactorTypes.ts').QuerySubInStorage} */
5047
5047
  r
@@ -5056,7 +5056,7 @@ function Jc(n, e) {
5056
5056
  }
5057
5057
  return s;
5058
5058
  }
5059
- function Yc(n, e) {
5059
+ function Zc(n, e) {
5060
5060
  switch (n) {
5061
5061
  case "pendingMutations":
5062
5062
  return new Map(typeof e == "string" ? JSON.parse(e) : e);
@@ -5064,7 +5064,7 @@ function Yc(n, e) {
5064
5064
  return e;
5065
5065
  }
5066
5066
  }
5067
- function Zc(n, e) {
5067
+ function Xc(n, e) {
5068
5068
  switch (n) {
5069
5069
  case "pendingMutations":
5070
5070
  return [...e.entries()];
@@ -5072,7 +5072,7 @@ function Zc(n, e) {
5072
5072
  return e;
5073
5073
  }
5074
5074
  }
5075
- function Xc(n, e, t) {
5075
+ function eu(n, e, t) {
5076
5076
  const r = e == null ? void 0 : e.result, s = t == null ? void 0 : t.result;
5077
5077
  return r && !s && t && (t.result = r), t || e;
5078
5078
  }
@@ -5082,7 +5082,7 @@ function _n(n) {
5082
5082
  return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
5083
5083
  });
5084
5084
  }
5085
- class eu {
5085
+ class tu {
5086
5086
  constructor(e, t = Vs, r = Qs, s, i) {
5087
5087
  /** @type {s.AttrsStore | undefined} */
5088
5088
  p(this, "attrs");
@@ -5284,7 +5284,7 @@ class eu {
5284
5284
  }
5285
5285
  this._log.info("[socket][close]", t.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
5286
5286
  });
5287
- if (this._EventSource = i, this.config = { ...Qc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? zc, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Vc, this._log = Sc(e.verbose || or || Bs, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": ar }, this.config.schema && (this._linkIndex = Qr(this.config.schema)), !!Gc()) {
5287
+ if (this._EventSource = i, this.config = { ...Bc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? zc, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Vc, this._log = Sc(e.verbose || or || Bs, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": ar }, this.config.schema && (this._linkIndex = Qr(this.config.schema)), !!Hc()) {
5288
5288
  if (!e.appId)
5289
5289
  throw new Error("Instant must be initialized with an appId.");
5290
5290
  if (!it(e.appId))
@@ -5310,7 +5310,12 @@ class eu {
5310
5310
  RStream: this.config.ReadableStream || ReadableStream,
5311
5311
  trySend: this._trySendAuthed.bind(this),
5312
5312
  log: this._log
5313
- }), this._oauthCallbackResponse = this._oauthLoginInit(), r.getIsOnline().then((o) => {
5313
+ }), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser().then((o) => {
5314
+ this.syncUserToEndpoint(o.user);
5315
+ }), setInterval(async () => {
5316
+ const o = await this.getCurrentUser();
5317
+ this.syncUserToEndpoint(o.user);
5318
+ }, Qc), r.getIsOnline().then((o) => {
5314
5319
  this._isOnline = o, this._startSocket(), r.listen((a) => {
5315
5320
  a !== this._isOnline && (this._log.info("[network] online =", a), this._isOnline = a, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", Ce.CLOSED), this._setStatus(Ce.CLOSED)));
5316
5321
  });
@@ -5349,9 +5354,9 @@ class eu {
5349
5354
  _initStorage(e) {
5350
5355
  this.querySubs = new Dn({
5351
5356
  persister: new e(this.config.appId, "querySubs"),
5352
- merge: Xc,
5353
- serialize: Jc,
5354
- parse: (t, r) => Hc(r, this.config.useDateObjects),
5357
+ merge: eu,
5358
+ serialize: Yc,
5359
+ parse: (t, r) => Jc(r, this.config.useDateObjects),
5355
5360
  // objectSize
5356
5361
  objectSize: (t) => {
5357
5362
  var r, s, i;
@@ -5370,8 +5375,8 @@ class eu {
5370
5375
  }), this.querySubs.onKeyLoaded = (t) => this._onQuerySubLoaded(t), this.kv = new Dn({
5371
5376
  persister: new e(this.config.appId, "kv"),
5372
5377
  merge: this._onMergeKv,
5373
- serialize: Zc,
5374
- parse: Yc,
5378
+ serialize: Xc,
5379
+ parse: Zc,
5375
5380
  objectSize: () => 0,
5376
5381
  logger: this._log,
5377
5382
  saveThrottleMs: 100,
@@ -6014,7 +6019,7 @@ class eu {
6014
6019
  return;
6015
6020
  }
6016
6021
  const e = this._transport;
6017
- this._transport = Bc({
6022
+ this._transport = Gc({
6018
6023
  transportType: this._transportType,
6019
6024
  appId: this.config.appId,
6020
6025
  apiURI: this.config.apiURI,
@@ -6212,7 +6217,7 @@ class eu {
6212
6217
  async syncUserToEndpoint(e) {
6213
6218
  if (this.config.firstPartyPath)
6214
6219
  try {
6215
- const t = await fetch(this.config.firstPartyPath + "/", {
6220
+ await fetch(this.config.firstPartyPath + "/", {
6216
6221
  method: "POST",
6217
6222
  body: JSON.stringify({
6218
6223
  type: "sync-user",
@@ -6223,8 +6228,6 @@ class eu {
6223
6228
  "Content-Type": "application/json"
6224
6229
  }
6225
6230
  });
6226
- if (!t.ok)
6227
- throw new Error(`HTTP error! status: ${t.status}`);
6228
6231
  } catch (t) {
6229
6232
  this._log.error("Error syncing user with external endpoint", t);
6230
6233
  }
@@ -6577,7 +6580,7 @@ class eu {
6577
6580
  });
6578
6581
  }
6579
6582
  }
6580
- function tu(n, e) {
6583
+ function nu(n, e) {
6581
6584
  return new nn(
6582
6585
  ni(n, e),
6583
6586
  // (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
@@ -6589,25 +6592,25 @@ function tu(n, e) {
6589
6592
  void 0
6590
6593
  );
6591
6594
  }
6592
- function nu(n) {
6595
+ function ru(n) {
6593
6596
  return new tn(n, {});
6594
6597
  }
6595
- function ru() {
6598
+ function su() {
6596
6599
  return new he("string", !0, !1);
6597
6600
  }
6598
- function su() {
6601
+ function iu() {
6599
6602
  return new he("number", !0, !1);
6600
6603
  }
6601
- function iu() {
6604
+ function ou() {
6602
6605
  return new he("boolean", !0, !1);
6603
6606
  }
6604
- function ou() {
6607
+ function au() {
6605
6608
  return new he("date", !0, !1);
6606
6609
  }
6607
- function au() {
6610
+ function cu() {
6608
6611
  return new he("json", !0, !1);
6609
6612
  }
6610
- function cu() {
6613
+ function uu() {
6611
6614
  return new he("json", !0, !1);
6612
6615
  }
6613
6616
  function ni(n, e) {
@@ -6629,7 +6632,7 @@ function ni(n, e) {
6629
6632
  })
6630
6633
  ]));
6631
6634
  }
6632
- function uu({ entities: n, links: e, rooms: t }) {
6635
+ function lu({ entities: n, links: e, rooms: t }) {
6633
6636
  const r = e ?? {}, s = t ?? {};
6634
6637
  return new nn(
6635
6638
  ni(n, r),
@@ -6642,23 +6645,23 @@ function uu({ entities: n, links: e, rooms: t }) {
6642
6645
  s
6643
6646
  );
6644
6647
  }
6645
- const cl = {
6648
+ const ul = {
6646
6649
  // constructs
6647
- graph: tu,
6648
- schema: uu,
6649
- entity: nu,
6650
+ graph: nu,
6651
+ schema: lu,
6652
+ entity: ru,
6650
6653
  // value types
6651
- string: ru,
6652
- number: su,
6653
- boolean: iu,
6654
- date: ou,
6655
- json: au,
6656
- any: cu
6654
+ string: su,
6655
+ number: iu,
6656
+ boolean: ou,
6657
+ date: au,
6658
+ json: cu,
6659
+ any: uu
6657
6660
  };
6658
6661
  let $t;
6659
- function lu(n, e) {
6662
+ function fu(n, e) {
6660
6663
  $t == null || $t.dispose();
6661
- const t = bu(e), r = hu(e, a), s = du(fu(n));
6664
+ const t = gu(e), r = pu(e, a), s = hu(du(n));
6662
6665
  function i(l) {
6663
6666
  var f;
6664
6667
  l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && t.isVisible() && a();
@@ -6680,10 +6683,10 @@ function lu(n, e) {
6680
6683
  }
6681
6684
  return u();
6682
6685
  }
6683
- function fu(n) {
6686
+ function du(n) {
6684
6687
  return `${or || Gs ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${n}`;
6685
6688
  }
6686
- function du(n) {
6689
+ function hu(n) {
6687
6690
  const e = document.createElement("iframe");
6688
6691
  return e.src = n, e.className = "instant-devtool-iframe", Object.assign(e.style, {
6689
6692
  width: "100%",
@@ -6692,7 +6695,7 @@ function du(n) {
6692
6695
  border: "none"
6693
6696
  }), { element: e };
6694
6697
  }
6695
- function hu(n, e) {
6698
+ function pu(n, e) {
6696
6699
  const t = `
6697
6700
  <svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
6698
6701
  <rect width="512" height="512" fill="black"/>
@@ -6702,7 +6705,7 @@ function hu(n, e) {
6702
6705
  return r.innerHTML = t, r.className = "instant-devtool-toggler", Object.assign(r.style, {
6703
6706
  // pos
6704
6707
  position: "fixed",
6705
- ...pu(n.position),
6708
+ ...yu(n.position),
6706
6709
  height: "32px",
6707
6710
  width: "32px",
6708
6711
  // layout
@@ -6717,7 +6720,7 @@ function hu(n, e) {
6717
6720
  cursor: "pointer"
6718
6721
  }), r.addEventListener("click", e), { element: r };
6719
6722
  }
6720
- function pu(n) {
6723
+ function yu(n) {
6721
6724
  switch (n) {
6722
6725
  case "bottom-left":
6723
6726
  return { bottom: "24px", left: "24px" };
@@ -6729,7 +6732,7 @@ function pu(n) {
6729
6732
  return { top: "24px", left: "24px" };
6730
6733
  }
6731
6734
  }
6732
- function yu(n) {
6735
+ function bu(n) {
6733
6736
  switch (n) {
6734
6737
  case "bottom-left":
6735
6738
  return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
@@ -6741,11 +6744,11 @@ function yu(n) {
6741
6744
  return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
6742
6745
  }
6743
6746
  }
6744
- function bu(n) {
6747
+ function gu(n) {
6745
6748
  const e = document.createElement("div");
6746
6749
  Object.assign(e.style, {
6747
6750
  position: "fixed",
6748
- ...yu(n.position),
6751
+ ...bu(n.position),
6749
6752
  display: "block",
6750
6753
  borderRadius: "4px",
6751
6754
  border: "1px #ccc solid",
@@ -6758,7 +6761,7 @@ function bu(n) {
6758
6761
  }
6759
6762
  return { element: e, isVisible: t };
6760
6763
  }
6761
- function gu(n, e) {
6764
+ function _u(n, e) {
6762
6765
  return e && e.refresh_token ? new Response(JSON.stringify({ ok: !0 }), {
6763
6766
  headers: {
6764
6767
  "Content-Type": "application/json",
@@ -6779,7 +6782,7 @@ function Dt(n, e) {
6779
6782
  headers: { "Content-Type": "application/json" }
6780
6783
  });
6781
6784
  }
6782
- const ul = (n) => ({
6785
+ const ll = (n) => ({
6783
6786
  POST: async (e) => {
6784
6787
  let t;
6785
6788
  try {
@@ -6793,7 +6796,7 @@ const ul = (n) => ({
6793
6796
  return Dt(403, "App ID mismatch");
6794
6797
  switch (t.type) {
6795
6798
  case "sync-user":
6796
- return gu(n, t.user ?? null);
6799
+ return _u(n, t.user ?? null);
6797
6800
  default:
6798
6801
  return Dt(400, `Unknown type: ${t.type}`);
6799
6802
  }
@@ -6803,10 +6806,10 @@ function lt(n, e) {
6803
6806
  if (!n)
6804
6807
  throw new Error("[assertion error] " + e);
6805
6808
  }
6806
- const _u = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]), ts = (n) => {
6809
+ const mu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]), ts = (n) => {
6807
6810
  const [e, t] = JSON.parse(n);
6808
6811
  return { cursor: e, afterInclusive: t };
6809
- }, He = (n, e, t = !1) => `${n}:${gt(e, t)}`, mu = (n) => !!n.endCursor, wu = (n) => {
6812
+ }, He = (n, e, t = !1) => `${n}:${gt(e, t)}`, wu = (n) => !!n.endCursor, Su = (n) => {
6810
6813
  var t;
6811
6814
  const e = Array.from(n.values());
6812
6815
  return e.length === 0 ? !1 : ((t = e[e.length - 1]) == null ? void 0 : t.hasMore) || !1;
@@ -6823,7 +6826,7 @@ const _u = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
6823
6826
  };
6824
6827
  }, ri = (n) => n && Object.keys(n).length > 0 ? n : {
6825
6828
  serverCreatedAt: "asc"
6826
- }, Su = (n, e) => {
6829
+ }, Tu = (n, e) => {
6827
6830
  const t = [
6828
6831
  ...Array.from(e.values()).slice().reverse(),
6829
6832
  ...Array.from(n.values())
@@ -6832,7 +6835,7 @@ const _u = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
6832
6835
  ...Array.from(n.values()).flatMap((s) => s.data)
6833
6836
  ];
6834
6837
  return { chunks: t, data: r };
6835
- }, mn = ["bootstrap", "bootstrap", "bootstrap", 1], Tu = (n, e, t, r) => {
6838
+ }, mn = ["bootstrap", "bootstrap", "bootstrap", 1], vu = (n, e, t, r) => {
6836
6839
  var G, V, ne, q;
6837
6840
  const { entityName: s, entityQuery: i } = si(e), o = ((G = i.$) == null ? void 0 : G.limit) || 10, a = s, c = ri((V = i.$) == null ? void 0 : V.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
6838
6841
  let d = !1, y = !0, b = null, g = null;
@@ -6841,12 +6844,12 @@ const _u = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
6841
6844
  }, T = () => {
6842
6845
  if (!y)
6843
6846
  return;
6844
- const { chunks: k, data: j } = Su(u, l);
6847
+ const { chunks: k, data: j } = Tu(u, l);
6845
6848
  t({
6846
6849
  data: { [a]: j },
6847
6850
  // @ts-expect-error hidden debug variable
6848
6851
  chunks: k,
6849
- canLoadNextPage: wu(u)
6852
+ canLoadNextPage: Su(u)
6850
6853
  });
6851
6854
  }, _ = (k, j) => {
6852
6855
  u.set(gt(k, j.afterInclusive), j), T();
@@ -6970,9 +6973,9 @@ const _u = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
6970
6973
  if (!k)
6971
6974
  return;
6972
6975
  const [j, R] = k;
6973
- if (!(R != null && R.hasMore) || !mu(R))
6976
+ if (!(R != null && R.hasMore) || !wu(R))
6974
6977
  return;
6975
- const F = `${j}:${_u(R.endCursor)}`;
6978
+ const F = `${j}:${mu(R.endCursor)}`;
6976
6979
  F != b && (b = F, C(j, R), v(R.endCursor));
6977
6980
  }, H = () => {
6978
6981
  const k = Array.from(u.entries()).at(-1);
@@ -7028,7 +7031,7 @@ const _u = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
7028
7031
  },
7029
7032
  loadNextPage: H
7030
7033
  };
7031
- }, vu = (n, e, t) => {
7034
+ }, Eu = (n, e, t) => {
7032
7035
  var u, l, f, d;
7033
7036
  if (!e)
7034
7037
  return {
@@ -7065,22 +7068,22 @@ const _u = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
7065
7068
  if (!t || !r)
7066
7069
  throw new B("No query provided for infinite query");
7067
7070
  return { entityName: t, entityQuery: r };
7068
- }, Eu = {
7071
+ }, Ou = {
7069
7072
  apiURI: "https://api.instantdb.com",
7070
7073
  websocketURI: "wss://api.instantdb.com/runtime/session"
7071
7074
  };
7072
- function Ou() {
7075
+ function ku() {
7073
7076
  return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
7074
7077
  }
7075
- function ku() {
7078
+ function Au() {
7076
7079
  return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
7077
7080
  }
7078
7081
  function Un(n) {
7079
7082
  const e = n.__adminToken, t = n.__extraDedupeKey;
7080
7083
  return n.appId + "_" + (n.websocketURI || "default_ws_uri") + "_" + (n.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + n.useDateObjects + "_" + (t || "");
7081
7084
  }
7082
- const Ln = ku(), rs = Ou();
7083
- class Au {
7085
+ const Ln = Au(), rs = ku();
7086
+ class Cu {
7084
7087
  constructor(e) {
7085
7088
  p(this, "db");
7086
7089
  /**
@@ -7197,7 +7200,7 @@ class Au {
7197
7200
  this.db = e;
7198
7201
  }
7199
7202
  }
7200
- class Cu {
7203
+ class Iu {
7201
7204
  constructor(e) {
7202
7205
  p(this, "db");
7203
7206
  /**
@@ -7255,7 +7258,7 @@ class Cu {
7255
7258
  this.db = e;
7256
7259
  }
7257
7260
  }
7258
- class Iu {
7261
+ class Pu {
7259
7262
  constructor(e) {
7260
7263
  p(this, "db");
7261
7264
  /**
@@ -7284,14 +7287,14 @@ class Iu {
7284
7287
  function ii(n) {
7285
7288
  return JSON.parse(JSON.stringify(n));
7286
7289
  }
7287
- class Pu {
7290
+ class Mu {
7288
7291
  constructor(e) {
7289
7292
  p(this, "_reactor");
7290
7293
  p(this, "auth");
7291
7294
  p(this, "storage");
7292
7295
  p(this, "streams");
7293
7296
  p(this, "tx", ir());
7294
- this._reactor = e, this.auth = new Au(this._reactor), this.storage = new Cu(this._reactor), this.streams = new Iu(this._reactor);
7297
+ this._reactor = e, this.auth = new Cu(this._reactor), this.storage = new Iu(this._reactor), this.streams = new Pu(this._reactor);
7295
7298
  }
7296
7299
  /**
7297
7300
  * Use this to write data! You can create, update, delete, and link objects
@@ -7369,7 +7372,7 @@ class Pu {
7369
7372
  * });
7370
7373
  */
7371
7374
  subscribeInfiniteQuery(e, t, r) {
7372
- return Tu(this, e, t, r);
7375
+ return vu(this, e, t, r);
7373
7376
  }
7374
7377
  /**
7375
7378
  * Listen for the logged in state. This is useful
@@ -7496,10 +7499,10 @@ function ss(n) {
7496
7499
  const t = ce(n);
7497
7500
  return rs.set(n, t), t;
7498
7501
  }
7499
- function Mu(n, e) {
7502
+ function Ru(n, e) {
7500
7503
  return ss(n._reactor.config.schema) !== ss(e);
7501
7504
  }
7502
- function Ru(n, e, t, r, s) {
7505
+ function ju(n, e, t, r, s) {
7503
7506
  var u;
7504
7507
  const i = {
7505
7508
  ...n,
@@ -7507,15 +7510,15 @@ function Ru(n, e, t, r, s) {
7507
7510
  useDateObjects: n.useDateObjects ?? !1
7508
7511
  }, o = Ln[Un(i)];
7509
7512
  if (o)
7510
- return Mu(o, i.schema) && o._reactor.updateSchema(i.schema), o;
7511
- const a = new eu({
7512
- ...Eu,
7513
+ return Ru(o, i.schema) && o._reactor.updateSchema(i.schema), o;
7514
+ const a = new tu({
7515
+ ...Ou,
7513
7516
  ...i,
7514
7517
  cardinalityInference: !!i.schema
7515
- }, e || Vs, t || Qs, { ...r || {}, "@instantdb/core": ar }, s), c = new Pu(a);
7516
- return Ln[Un(i)] = c, ju(i.appId, i.devtool), c;
7518
+ }, e || Vs, t || Qs, { ...r || {}, "@instantdb/core": ar }, s), c = new Mu(a);
7519
+ return Ln[Un(i)] = c, xu(i.appId, i.devtool), c;
7517
7520
  }
7518
- function ju(n, e) {
7521
+ function xu(n, e) {
7519
7522
  if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
7520
7523
  return;
7521
7524
  const t = {
@@ -7523,7 +7526,7 @@ function ju(n, e) {
7523
7526
  allowedHosts: ["localhost"],
7524
7527
  ...typeof e == "object" ? e : {}
7525
7528
  };
7526
- t.allowedHosts.includes(window.location.hostname) && lu(n, t);
7529
+ t.allowedHosts.includes(window.location.hostname) && fu(n, t);
7527
7530
  }
7528
7531
  var Fn = { exports: {} }, ft = {};
7529
7532
  /**
@@ -7536,7 +7539,7 @@ var Fn = { exports: {} }, ft = {};
7536
7539
  * LICENSE file in the root directory of this source tree.
7537
7540
  */
7538
7541
  var is;
7539
- function xu() {
7542
+ function $u() {
7540
7543
  if (is) return ft;
7541
7544
  is = 1;
7542
7545
  var n = hs, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
@@ -7550,7 +7553,7 @@ function xu() {
7550
7553
  return ft.Fragment = t, ft.jsx = o, ft.jsxs = o, ft;
7551
7554
  }
7552
7555
  var dt = {}, os;
7553
- function $u() {
7556
+ function Du() {
7554
7557
  if (os) return dt;
7555
7558
  os = 1;
7556
7559
  var n = {};
@@ -8151,10 +8154,10 @@ React keys must be passed directly to JSX without using spread:
8151
8154
  dt.Fragment = s, dt.jsx = Ii, dt.jsxs = Pi;
8152
8155
  }(), dt;
8153
8156
  }
8154
- var Du = {};
8155
- Du.NODE_ENV === "production" ? Fn.exports = xu() : Fn.exports = $u();
8157
+ var Uu = {};
8158
+ Uu.NODE_ENV === "production" ? Fn.exports = $u() : Fn.exports = Du();
8156
8159
  var ae = Fn.exports;
8157
- const Uu = {
8160
+ const Lu = {
8158
8161
  isLoading: !0,
8159
8162
  data: void 0,
8160
8163
  pageInfo: void 0,
@@ -8169,9 +8172,9 @@ function as(n) {
8169
8172
  ...n || {}
8170
8173
  };
8171
8174
  }
8172
- function Lu(n, e, t, r) {
8175
+ function Fu(n, e, t, r) {
8173
8176
  e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
8174
- const s = e ? ii(e) : null, i = ce(s), o = $e(as(n._reactor.getPreviousResult(s))), a = $e(Uu), c = Me(
8177
+ const s = e ? ii(e) : null, i = ce(s), o = $e(as(n._reactor.getPreviousResult(s))), a = $e(Lu), c = Me(
8175
8178
  (l) => (o.current = as(n._reactor.getPreviousResult(s)), l(), s ? n.subscribeQuery(s, (d) => {
8176
8179
  o.current = {
8177
8180
  isLoading: !d,
@@ -8190,14 +8193,14 @@ function Lu(n, e, t, r) {
8190
8193
  );
8191
8194
  return { state: Vt(c, () => o.current, () => a.current), query: s, queryHash: i };
8192
8195
  }
8193
- const Fu = {
8196
+ const Nu = {
8194
8197
  error: void 0,
8195
8198
  data: void 0,
8196
8199
  isLoading: !0,
8197
8200
  canLoadNextPage: !1
8198
8201
  };
8199
- function Nu({ core: n, query: e, opts: t }) {
8200
- const r = $e(null), s = ce(e), i = ce(t), o = vu(n, e, t), a = $e({
8202
+ function Ku({ core: n, query: e, opts: t }) {
8203
+ const r = $e(null), s = ce(e), i = ce(t), o = Eu(n, e, t), a = $e({
8201
8204
  ...o,
8202
8205
  isLoading: !o.data && !o.error
8203
8206
  }), c = Me((f) => {
@@ -8220,14 +8223,14 @@ function Nu({ core: n, query: e, opts: t }) {
8220
8223
  };
8221
8224
  }, [s, i]);
8222
8225
  return {
8223
- ...Vt(c, () => a.current, () => Fu),
8226
+ ...Vt(c, () => a.current, () => Nu),
8224
8227
  loadNextPage: () => {
8225
8228
  var f;
8226
8229
  (f = r.current) == null || f.loadNextPage();
8227
8230
  }
8228
8231
  };
8229
8232
  }
8230
- function Ku() {
8233
+ function Wu() {
8231
8234
  const n = $e(null);
8232
8235
  We(() => {
8233
8236
  t();
@@ -8240,14 +8243,14 @@ function Ku() {
8240
8243
  }
8241
8244
  return { set: e, clear: t };
8242
8245
  }
8243
- const Wu = 1e3;
8244
- function qu(n, e, t) {
8246
+ const qu = 1e3;
8247
+ function zu(n, e, t) {
8245
8248
  const r = $e(t);
8246
8249
  r.current = t, We(() => n.core._reactor.subscribeTopic(n.type, n.id, e, (i, o) => {
8247
8250
  r.current(i, o);
8248
8251
  }), [n.id, e]);
8249
8252
  }
8250
- function zu(n, e) {
8253
+ function Vu(n, e) {
8251
8254
  return We(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]), Me((r) => {
8252
8255
  n.core._reactor.publishTopic({
8253
8256
  roomType: n.type,
@@ -8257,7 +8260,7 @@ function zu(n, e) {
8257
8260
  });
8258
8261
  }, [n.id, e]);
8259
8262
  }
8260
- function Vu(n, e = {}) {
8263
+ function Qu(n, e = {}) {
8261
8264
  var o, a;
8262
8265
  const [t, r] = ps(() => n.core._reactor.getPresence(n.type, n.id, e) ?? {
8263
8266
  peers: {},
@@ -8274,11 +8277,11 @@ function Vu(n, e = {}) {
8274
8277
  publishPresence: s
8275
8278
  }), [t, s]);
8276
8279
  }
8277
- function Qu(n, e, t) {
8280
+ function Bu(n, e, t) {
8278
8281
  We(() => n.core._reactor.joinRoom(n.type, n.id, e), [n.id]), We(() => n.core._reactor.publishPresence(n.type, n.id, e), [n.type, n.id, t ?? JSON.stringify(e)]);
8279
8282
  }
8280
- function Bu(n, e, t = {}) {
8281
- const r = Ku(), s = Le.usePresence(n, {
8283
+ function Gu(n, e, t = {}) {
8284
+ const r = Wu(), s = Le.usePresence(n, {
8282
8285
  keys: [e]
8283
8286
  }), i = Sn(() => {
8284
8287
  const l = n._core._reactor.getPresence(n.type, n.id);
@@ -8286,7 +8289,7 @@ function Bu(n, e, t = {}) {
8286
8289
  }, [t == null ? void 0 : t.writeOnly, s]), o = Me((l) => {
8287
8290
  n.core._reactor.publishPresence(n.type, n.id, {
8288
8291
  [e]: l
8289
- }), l && ((t == null ? void 0 : t.timeout) === null || (t == null ? void 0 : t.timeout) === 0 || r.set((t == null ? void 0 : t.timeout) ?? Wu, () => {
8292
+ }), l && ((t == null ? void 0 : t.timeout) === null || (t == null ? void 0 : t.timeout) === 0 || r.set((t == null ? void 0 : t.timeout) ?? qu, () => {
8290
8293
  n.core._reactor.publishPresence(n.type, n.id, {
8291
8294
  [e]: null
8292
8295
  });
@@ -8304,13 +8307,13 @@ function Bu(n, e, t = {}) {
8304
8307
  };
8305
8308
  }
8306
8309
  const Le = {
8307
- useTopicEffect: qu,
8308
- usePublishTopic: zu,
8309
- usePresence: Vu,
8310
- useSyncPresence: Qu,
8311
- useTypingIndicator: Bu
8310
+ useTopicEffect: zu,
8311
+ usePublishTopic: Vu,
8312
+ usePresence: Qu,
8313
+ useSyncPresence: Bu,
8314
+ useTypingIndicator: Gu
8312
8315
  };
8313
- class Gu {
8316
+ class Hu {
8314
8317
  constructor(e, t, r) {
8315
8318
  p(this, "core");
8316
8319
  /** @deprecated use `core` instead */
@@ -8397,7 +8400,7 @@ class Gu {
8397
8400
  this.core = e, this._core = this.core, this.type = t, this.id = r;
8398
8401
  }
8399
8402
  }
8400
- const Hu = {
8403
+ const Ju = {
8401
8404
  isLoading: !0,
8402
8405
  user: void 0,
8403
8406
  error: void 0
@@ -8501,7 +8504,7 @@ class Wt {
8501
8504
  * auth.user ? { goals: {} } : null,
8502
8505
  * );
8503
8506
  */
8504
- p(this, "useQuery", (e, t) => Lu(this.core, e, t).state);
8507
+ p(this, "useQuery", (e, t) => Fu(this.core, e, t).state);
8505
8508
  /**
8506
8509
  * Listen for the logged in state. This is useful
8507
8510
  * for deciding when to show a login screen.
@@ -8621,7 +8624,7 @@ class Wt {
8621
8624
  * },
8622
8625
  * });
8623
8626
  */
8624
- p(this, "useInfiniteQuery", (e, t) => Nu({
8627
+ p(this, "useInfiniteQuery", (e, t) => Ku({
8625
8628
  core: this.core,
8626
8629
  query: e,
8627
8630
  opts: t
@@ -8654,7 +8657,7 @@ class Wt {
8654
8657
  const t = this.useAuth();
8655
8658
  return t.isLoading || t.error || t.user ? null : ae.jsx(ae.Fragment, { children: e });
8656
8659
  });
8657
- this.core = Ru(
8660
+ this.core = ju(
8658
8661
  e,
8659
8662
  // @ts-expect-error because TS can't resolve subclass statics
8660
8663
  e.Store || this.constructor.Store,
@@ -8678,13 +8681,13 @@ class Wt {
8678
8681
  * const { peers } = db.rooms.usePresence(room);
8679
8682
  */
8680
8683
  room(e = "_defaultRoomType", t = "_defaultRoomId") {
8681
- return new Gu(this.core, e, t);
8684
+ return new Hu(this.core, e, t);
8682
8685
  }
8683
8686
  _useAuth() {
8684
8687
  const e = $e(this.core._reactor._currentUserCached), t = Me((s) => this.core.subscribeAuth((o) => {
8685
8688
  e.current = { isLoading: !1, ...o }, s();
8686
8689
  }), []);
8687
- return Vt(t, () => e.current, () => Hu);
8690
+ return Vt(t, () => e.current, () => Ju);
8688
8691
  }
8689
8692
  /**
8690
8693
  * One time query for the logged in state. This is useful
@@ -8708,7 +8711,7 @@ class cs extends Error {
8708
8711
  }
8709
8712
  function wn(n) {
8710
8713
  }
8711
- function Ju(n) {
8714
+ function Yu(n) {
8712
8715
  if (typeof n == "function")
8713
8716
  throw new TypeError(
8714
8717
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
@@ -8716,7 +8719,7 @@ function Ju(n) {
8716
8719
  const { onEvent: e = wn, onError: t = wn, onRetry: r = wn, onComment: s } = n;
8717
8720
  let i = "", o = !0, a, c = "", u = "";
8718
8721
  function l(g) {
8719
- const m = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [T, _] = Yu(`${i}${m}`);
8722
+ const m = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [T, _] = Zu(`${i}${m}`);
8720
8723
  for (const w of T)
8721
8724
  f(w);
8722
8725
  i = _, o = !1;
@@ -8784,7 +8787,7 @@ function Ju(n) {
8784
8787
  }
8785
8788
  return { feed: l, reset: b };
8786
8789
  }
8787
- function Yu(n) {
8790
+ function Zu(n) {
8788
8791
  const e = [];
8789
8792
  let t = "", r = 0;
8790
8793
  for (; r < n.length; ) {
@@ -8844,7 +8847,7 @@ class us extends Event {
8844
8847
  return e(ls(this), t);
8845
8848
  }
8846
8849
  }
8847
- function Zu(n) {
8850
+ function Xu(n) {
8848
8851
  const e = globalThis.DOMException;
8849
8852
  return typeof e == "function" ? new e(n, "SyntaxError") : new SyntaxError(n);
8850
8853
  }
@@ -8916,13 +8919,13 @@ class zt extends EventTarget {
8916
8919
  if (e instanceof URL)
8917
8920
  Y(this, Fe, e);
8918
8921
  else if (typeof e == "string")
8919
- Y(this, Fe, new URL(e, Xu()));
8922
+ Y(this, Fe, new URL(e, el()));
8920
8923
  else
8921
8924
  throw new Error("Invalid URL");
8922
8925
  } catch {
8923
- throw Zu("An invalid or illegal string was specified");
8926
+ throw Xu("An invalid or illegal string was specified");
8924
8927
  }
8925
- Y(this, Ze, Ju({
8928
+ Y(this, Ze, Yu({
8926
8929
  onEvent: x(this, zn),
8927
8930
  onRetry: x(this, Vn)
8928
8931
  })), Y(this, ye, this.CONNECTING), Y(this, Tt, 3e3), Y(this, Yt, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), Y(this, qt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), Pe(this, Ee, Kn).call(this);
@@ -9065,14 +9068,14 @@ zt.OPEN = 1, /**
9065
9068
  * @public
9066
9069
  */
9067
9070
  zt.CLOSED = 2;
9068
- function Xu() {
9071
+ function el() {
9069
9072
  const n = "document" in globalThis ? globalThis.document : void 0;
9070
9073
  return n && typeof n == "object" && "baseURI" in n && typeof n.baseURI == "string" ? n.baseURI : void 0;
9071
9074
  }
9072
9075
  class ai extends Wt {
9073
9076
  }
9074
9077
  p(ai, "EventSourceImpl", zt);
9075
- function el(n) {
9078
+ function tl(n) {
9076
9079
  const e = {
9077
9080
  ...n,
9078
9081
  useDateObjects: n.useDateObjects ?? !1
@@ -9081,8 +9084,8 @@ function el(n) {
9081
9084
  "@instantdb/react": ar
9082
9085
  });
9083
9086
  }
9084
- const ll = el;
9085
- function fl({
9087
+ const fl = tl;
9088
+ function dl({
9086
9089
  as: n = "div",
9087
9090
  spaceId: e,
9088
9091
  room: t,
@@ -9154,8 +9157,8 @@ function fl({
9154
9157
  {
9155
9158
  style: {
9156
9159
  ...ds,
9157
- ...nl,
9158
- zIndex: u !== void 0 ? u : rl
9160
+ ...rl,
9161
+ zIndex: u !== void 0 ? u : sl
9159
9162
  },
9160
9163
  children: Object.entries(f.peers).map(([_, w]) => {
9161
9164
  const C = w[l];
@@ -9171,7 +9174,7 @@ function fl({
9171
9174
  children: a ? a({
9172
9175
  color: C.color,
9173
9176
  presence: d == null ? void 0 : d.peers[_]
9174
- }) : /* @__PURE__ */ ae.jsx(tl, { ...C })
9177
+ }) : /* @__PURE__ */ ae.jsx(nl, { ...C })
9175
9178
  },
9176
9179
  _
9177
9180
  ) : null;
@@ -9182,7 +9185,7 @@ function fl({
9182
9185
  ]
9183
9186
  );
9184
9187
  }
9185
- function tl({ color: n }) {
9188
+ function nl({ color: n }) {
9186
9189
  const t = n || "black";
9187
9190
  return /* @__PURE__ */ ae.jsxs(
9188
9191
  "svg",
@@ -9235,24 +9238,24 @@ const ds = {
9235
9238
  left: 0,
9236
9239
  bottom: 0,
9237
9240
  right: 0
9238
- }, nl = {
9241
+ }, rl = {
9239
9242
  overflow: "hidden",
9240
9243
  pointerEvents: "none",
9241
9244
  userSelect: "none"
9242
- }, rl = 99999;
9245
+ }, sl = 99999;
9243
9246
  export {
9244
- fl as Cursors,
9247
+ dl as Cursors,
9245
9248
  en as InstantAPIError,
9246
9249
  Wt as InstantReactAbstractDatabase,
9247
9250
  ai as InstantReactWebDatabase,
9248
9251
  tc as StoreInterface,
9249
9252
  Ue as SyncTableCallbackEventType,
9250
- ul as createInstantRouteHandler,
9251
- cl as i,
9253
+ ll as createInstantRouteHandler,
9254
+ ul as i,
9252
9255
  Z as id,
9253
- el as init,
9254
- ll as init_experimental,
9256
+ tl as init,
9257
+ fl as init_experimental,
9255
9258
  ka as lookup,
9256
- ol as setInstantWarningsEnabled,
9257
- al as tx
9259
+ al as setInstantWarningsEnabled,
9260
+ cl as tx
9258
9261
  };