@redocly/replay 0.28.0-next.8 → 0.28.0

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.
Files changed (72) hide show
  1. package/dist/{replay-AiChatProvider--1WugvKf.js → replay-AiChatProvider-BRqjyy2W.js} +2 -2
  2. package/dist/{replay-AiChatProvider-BJdxRVOc.js → replay-AiChatProvider-DUVoLgY2.js} +128 -130
  3. package/dist/{replay-AiChatSqliteDBStorage-D9fgt_9s.js → replay-AiChatSqliteDBStorage-0evx56pl.js} +6 -6
  4. package/dist/{replay-AiChatSqliteDBStorage-DbGtw6xx.js → replay-AiChatSqliteDBStorage-C5AnRloD.js} +1 -1
  5. package/dist/{replay-AiPanel-BU8oG0pD.js → replay-AiPanel-CMjVD12K.js} +77 -77
  6. package/dist/{replay-AiPanel-BYOLZjQX.js → replay-AiPanel-PVgJioX3.js} +2 -2
  7. package/dist/replay-FileWatcher-CFYprlWN.js +364 -0
  8. package/dist/replay-FileWatcher-DGLwO5Kd.js +1 -0
  9. package/dist/{replay-HistorySqliteDBStorage-CtF6-vY8.js → replay-HistorySqliteDBStorage-Bi5vBQ2T.js} +2 -2
  10. package/dist/{replay-SemanticSearchService-DRDdGJkI.js → replay-SemanticSearchService-Bh5xYa91.js} +22 -26
  11. package/dist/replay-SemanticSearchService-CulKCCNl.js +1 -0
  12. package/dist/{replay-SqliteDBStorage-D9Oeu_XC.js → replay-SqliteDBStorage-Bz0muHEk.js} +49 -49
  13. package/dist/{replay-SqliteDBStorage-B3zO7RGD.js → replay-SqliteDBStorage-CVHRAsPD.js} +1 -1
  14. package/dist/{replay-StepContextSqliteDBStorage-BfAAKDwA.js → replay-StepContextSqliteDBStorage-BkB2NM27.js} +2 -2
  15. package/dist/replay-TauriFileSystemAdapter-B163-f2D.js +108 -0
  16. package/dist/replay-TauriFileSystemAdapter-D4bOmvzP.js +1 -0
  17. package/dist/{replay-TauriRootStorage-XIJpsp6_.js → replay-TauriRootStorage-2MPQE-3f.js} +159 -155
  18. package/dist/replay-TauriRootStorage-CjWUrnWz.js +1 -0
  19. package/dist/{replay-agent-loop-DxK1tiVw.js → replay-agent-loop-BgYyBo9e.js} +9 -9
  20. package/dist/{replay-agent-loop-IDavXm8f.js → replay-agent-loop-DYDFXAZj.js} +1 -1
  21. package/dist/{replay-ai-chat-mappers-B-_eSMi4.js → replay-ai-chat-mappers-BEwNRQPV.js} +3 -3
  22. package/dist/{replay-ai-chat-mappers-BmvAc4xt.js → replay-ai-chat-mappers-CMtNqQHX.js} +1 -1
  23. package/dist/{replay-ai-message-parts.schema-E9u9-nqr.js → replay-ai-message-parts.schema-DKLf0SiG.js} +1 -1
  24. package/dist/{replay-create-model-CscK0cT1.js → replay-create-model-B2ZsGTjs.js} +3 -3
  25. package/dist/{replay-create-model-CIY7WZ1P.js → replay-create-model-DPxfOEfv.js} +4 -4
  26. package/dist/{replay-db-e_3o5e3f.js → replay-db-C9iqyMet.js} +1 -1
  27. package/dist/{replay-db-C_cdHXEt.js → replay-db-D4-LmLRk.js} +5 -5
  28. package/dist/{replay-external-resolver-nuL3ajF5.js → replay-external-resolver-BXgVrfzk.js} +7 -7
  29. package/dist/{replay-external-resolver-BmOmF-DG.js → replay-external-resolver-CTUbNZGW.js} +1 -1
  30. package/dist/{replay-history.schema-5ce6X0R1.js → replay-history.schema-B0lLwmdG.js} +3 -3
  31. package/dist/{replay-index-DDt4LOBo.js → replay-index-4TEahAPK.js} +21968 -21367
  32. package/dist/{replay-index-DjdDUkfV.js → replay-index-B4U7iZuq.js} +46 -46
  33. package/dist/replay-index-B8O3wYqo.js +1 -0
  34. package/dist/{replay-index-etIeWhnn.js → replay-index-Bdg7noSD.js} +1 -1
  35. package/dist/replay-index-CG9VN2JQ.js +4 -0
  36. package/dist/{replay-index-E3Eu6_jY.js → replay-index-DcC173cC.js} +1 -1
  37. package/dist/{replay-index-B8Zfn7JD.js → replay-index-Nz5obVS5.js} +1139 -1141
  38. package/dist/{replay-index-DcbwI4wD.js → replay-index-q63USe25.js} +1 -1
  39. package/dist/{replay-indexes-CfsvVMi_.js → replay-indexes-B3PJtgeh.js} +43 -43
  40. package/dist/{replay-lint-DVAifLdU.js → replay-lint-4XFKTmSY.js} +97 -97
  41. package/dist/{replay-lint-graphql-U_VxwRr1.js → replay-lint-graphql-BsBWkZ6L.js} +1 -1
  42. package/dist/{replay-lint-graphql-D1qaeEmu.js → replay-lint-graphql-De2eDZnT.js} +1 -1
  43. package/dist/{replay-lint-BjrmIhuZ.js → replay-lint-s7ylMBWz.js} +6111 -6074
  44. package/dist/replay-periodic-revalidation-BMFP7f-u.js +1 -0
  45. package/dist/{replay-periodic-revalidation-BtEKdEKa.js → replay-periodic-revalidation-DJbblUef.js} +4 -5
  46. package/dist/{replay-resolve-C97SfUAB.js → replay-resolve-BtNxNrKo.js} +123 -123
  47. package/dist/{replay-resolve-BYJosLqD.js → replay-resolve-BueEsOnR.js} +1 -1
  48. package/dist/{replay-respect-run-CW5xFLKz.js → replay-respect-run-B_dJjlti.js} +1 -1
  49. package/dist/{replay-respect-run-3FHTVHvs.js → replay-respect-run-Dfpbcsns.js} +3 -3
  50. package/dist/replay-step-context.schema-BOprzd6Z.js +21 -0
  51. package/dist/{replay-tauri-path-CMpWmGvW.js → replay-tauri-path-Bht3XIt7.js} +1 -1
  52. package/dist/replay-tauri-path-CiuYXh_j.js +22 -0
  53. package/dist/replay-useAiChatQueries-02CRdEPJ.js +215 -0
  54. package/dist/{replay-useAiChatQueries-DhTcllVx.js → replay-useAiChatQueries-D2hh5omV.js} +1039 -996
  55. package/dist/{replay-validate-key-Dj_UT2WG.js → replay-validate-key-ALwOF1Ux.js} +1 -1
  56. package/dist/{replay-validate-key-DJ_1khxq.js → replay-validate-key-B7fbWbfv.js} +2 -2
  57. package/dist/replay.cjs +1 -1
  58. package/dist/replay.d.ts +5 -0
  59. package/dist/replay.js +15 -15
  60. package/package.json +6 -6
  61. package/dist/replay-FileWatcher-BrhE0AP6.js +0 -1
  62. package/dist/replay-FileWatcher-JoqPJECh.js +0 -360
  63. package/dist/replay-SemanticSearchService-BgQ1HMcT.js +0 -1
  64. package/dist/replay-TauriFileSystemAdapter-CxHFFCmk.js +0 -1
  65. package/dist/replay-TauriFileSystemAdapter-DJETGEY7.js +0 -99
  66. package/dist/replay-TauriRootStorage-BSQQcFgG.js +0 -1
  67. package/dist/replay-index-C_DfEx-H.js +0 -1
  68. package/dist/replay-index-Da2H-hpA.js +0 -25
  69. package/dist/replay-periodic-revalidation-C3eLm7Mw.js +0 -1
  70. package/dist/replay-step-context.schema-DBk4jufr.js +0 -21
  71. package/dist/replay-tauri-path-C-vLbl1V.js +0 -22
  72. package/dist/replay-useAiChatQueries-CEYDGx9f.js +0 -215
@@ -1,8 +1,8 @@
1
- import { i as Qe } from "./replay-index-DDt4LOBo.js";
2
- import { h as Ve } from "./replay-history.schema-5ce6X0R1.js";
3
- import { s as We } from "./replay-step-context.schema-DBk4jufr.js";
4
- import { b as J, c as X, a as ee } from "./replay-ai-message-parts.schema-E9u9-nqr.js";
5
- import { c as f, T as m, i as h, g as V, s as n, o as Ue, n as He, f as Ye, h as Ge, j as Ze, k as Xe, l as et, m as tt, p as st, q as it, r as rt, t as nt, u as at, v as ot, w as lt, x as ct, y as ht, z as ut, e as _e, A as dt, b as he, d as ft, a as mt, C as R, S as b, V as A, B as P, D as ye, E as O, F as W, G as Y, H as le, P as Oe, I as yt, J as ue, K as pe, L as pt, W as Ae, M as gt, N as Me, O as G, Q as $e } from "./replay-indexes-CfsvVMi_.js";
1
+ import { i as Qe } from "./replay-index-4TEahAPK.js";
2
+ import { h as Ve } from "./replay-history.schema-B0lLwmdG.js";
3
+ import { s as Ue } from "./replay-step-context.schema-BOprzd6Z.js";
4
+ import { b as J, c as X, a as ee } from "./replay-ai-message-parts.schema-DKLf0SiG.js";
5
+ import { g as f, T as m, h, j as V, f as n, o as We, n as He, k as Ye, m as Ge, p as Ze, q as Xe, r as et, v as tt, w as st, l as it, x as rt, y as nt, z as at, A as ot, B as lt, C as ct, D as ht, E as ut, e as _e, F as dt, c as he, d as ft, b as mt, G as x, S as b, V as A, H as P, I as ye, J as O, K as U, L as Y, M as le, P as Oe, N as yt, O as ue, Q as pe, R as pt, W as Ae, U as gt, X as Me, Y as G, Z as $e } from "./replay-indexes-B3PJtgeh.js";
6
6
  class bt {
7
7
  static [f] = "ConsoleLogWriter";
8
8
  write(e) {
@@ -138,7 +138,7 @@ function Ct() {
138
138
  notLike: Ge,
139
139
  notIlike: Ye,
140
140
  notInArray: He,
141
- or: Ue,
141
+ or: We,
142
142
  sql: n
143
143
  };
144
144
  }
@@ -214,7 +214,7 @@ function Lt(l) {
214
214
  return new ne(l, t, s);
215
215
  };
216
216
  }
217
- function xt(l, e, t) {
217
+ function Rt(l, e, t) {
218
218
  if (h(t, k) && t.config)
219
219
  return {
220
220
  fields: t.config.fields,
@@ -253,7 +253,7 @@ function xt(l, e, t) {
253
253
  `There is not enough information to infer relation "${a}.${t.fieldName}"`
254
254
  );
255
255
  }
256
- function Rt(l) {
256
+ function xt(l) {
257
257
  return {
258
258
  one: Tt(l),
259
259
  many: Lt(l)
@@ -285,7 +285,7 @@ function de(l, e, t, s, i = (r) => r) {
285
285
  } else {
286
286
  const c = i(t[a]), u = o.field;
287
287
  let d;
288
- h(u, R) ? d = u : h(u, b) ? d = u.decoder : d = u.sql.decoder, r[o.tsKey] = c === null ? null : d.mapFromDriverValue(c);
288
+ h(u, x) ? d = u : h(u, b) ? d = u.decoder : d = u.sql.decoder, r[o.tsKey] = c === null ? null : d.mapFromDriverValue(c);
289
289
  }
290
290
  return r;
291
291
  }
@@ -329,7 +329,7 @@ class be {
329
329
  }), r;
330
330
  }
331
331
  const s = e[t];
332
- return h(s, R) ? new Proxy(s, new te(new Proxy(e, this))) : s;
332
+ return h(s, x) ? new Proxy(s, new te(new Proxy(e, this))) : s;
333
333
  }
334
334
  }
335
335
  function ce(l, e) {
@@ -345,7 +345,7 @@ function Pe(l, e) {
345
345
  return new b.Aliased(se(l.sql, e), l.fieldAlias);
346
346
  }
347
347
  function se(l, e) {
348
- return n.join(l.queryChunks.map((t) => h(t, R) ? E(t, e) : h(t, b) ? se(t, e) : h(t, b.Aliased) ? Pe(t, e) : t));
348
+ return n.join(l.queryChunks.map((t) => h(t, x) ? E(t, e) : h(t, b) ? se(t, e) : h(t, b.Aliased) ? Pe(t, e) : t));
349
349
  }
350
350
  class T {
351
351
  static [f] = "SelectionProxyHandler";
@@ -386,7 +386,7 @@ class T {
386
386
  `You tried to reference "${t}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`
387
387
  );
388
388
  }
389
- return h(i, R) ? this.config.alias ? new Proxy(
389
+ return h(i, x) ? this.config.alias ? new Proxy(
390
390
  i,
391
391
  new te(
392
392
  new Proxy(
@@ -476,7 +476,7 @@ class qe extends D {
476
476
  return this.config.limit = e, this;
477
477
  }
478
478
  returning(e = this.table[O.Symbol.Columns]) {
479
- return this.config.returning = W(e), this;
479
+ return this.config.returning = U(e), this;
480
480
  }
481
481
  /** @internal */
482
482
  getSQL() {
@@ -654,10 +654,10 @@ class ie {
654
654
  const c = h(r, b.Aliased) ? r.sql : r;
655
655
  t ? o.push(
656
656
  new b(
657
- c.queryChunks.map((u) => h(u, R) ? n.identifier(this.casing.getColumnCasing(u)) : u)
657
+ c.queryChunks.map((u) => h(u, x) ? n.identifier(this.casing.getColumnCasing(u)) : u)
658
658
  )
659
659
  ) : o.push(c), h(r, b.Aliased) && o.push(n` as ${n.identifier(r.fieldAlias)}`);
660
- } else if (h(r, R)) {
660
+ } else if (h(r, x)) {
661
661
  const c = r.table[m.Symbol.Name];
662
662
  r.columnType === "SQLiteNumericBigInt" ? t ? o.push(
663
663
  n`cast(${n.identifier(this.casing.getColumnCasing(r))} as text)`
@@ -669,7 +669,7 @@ class ie {
669
669
  } else if (h(r, P)) {
670
670
  const c = Object.entries(r._.selectedFields);
671
671
  if (c.length === 1) {
672
- const u = c[0][1], d = h(u, b) ? u.decoder : h(u, R) ? { mapFromDriverValue: (p) => u.mapFromDriverValue(p) } : u.sql.decoder;
672
+ const u = c[0][1], d = h(u, b) ? u.decoder : h(u, x) ? { mapFromDriverValue: (p) => u.mapFromDriverValue(p) } : u.sql.decoder;
673
673
  d && (r._.sql.decoder = d);
674
674
  }
675
675
  o.push(r);
@@ -731,9 +731,9 @@ class ie {
731
731
  distinct: C,
732
732
  setOperators: N
733
733
  }) {
734
- const $ = s ?? W(t);
734
+ const $ = s ?? U(t);
735
735
  for (const B of $)
736
- if (h(B.field, R) && Y(B.field.table) !== (h(a, P) ? a._.alias : h(a, Se) ? a[A].name : h(a, b) ? void 0 : Y(a)) && !((_) => o?.some(
736
+ if (h(B.field, x) && Y(B.field.table) !== (h(a, P) ? a._.alias : h(a, Se) ? a[A].name : h(a, b) ? void 0 : Y(a)) && !((_) => o?.some(
737
737
  ({ alias: H }) => H === (_[m.Symbol.IsAlias] ? Y(_) : _[m.Symbol.BaseName])
738
738
  ))(B.field.table)) {
739
739
  const _ = Y(B.field.table);
@@ -743,11 +743,11 @@ class ie {
743
743
  )}" field references a column "${_}"."${B.field.name}", but the table "${_}" is not part of the query! Did you forget to join it?`
744
744
  );
745
745
  }
746
- const S = !o || o.length === 0, v = this.buildWithCTE(e), Q = C ? n` distinct` : void 0, L = this.buildSelection($, { isSingleTable: S }), q = this.buildFromTable(a), g = this.buildJoins(o), M = i ? n` where ${i}` : void 0, x = r ? n` having ${r}` : void 0, y = [];
746
+ const S = !o || o.length === 0, v = this.buildWithCTE(e), Q = C ? n` distinct` : void 0, L = this.buildSelection($, { isSingleTable: S }), q = this.buildFromTable(a), g = this.buildJoins(o), M = i ? n` where ${i}` : void 0, R = r ? n` having ${r}` : void 0, y = [];
747
747
  if (u)
748
748
  for (const [B, _] of u.entries())
749
749
  y.push(_), B < u.length - 1 && y.push(n`, `);
750
- const w = y.length > 0 ? n` group by ${n.join(y)}` : void 0, j = this.buildOrderBy(c), U = this.buildLimit(d), oe = p ? n` offset ${p}` : void 0, z = n`${v}select${Q} ${L} from ${q}${g}${M}${w}${x}${j}${U}${oe}`;
750
+ const w = y.length > 0 ? n` group by ${n.join(y)}` : void 0, j = this.buildOrderBy(c), W = this.buildLimit(d), oe = p ? n` offset ${p}` : void 0, z = n`${v}select${Q} ${L} from ${q}${g}${M}${w}${R}${j}${W}${oe}`;
751
751
  return N.length > 0 ? this.buildSetOperations(z, N) : z;
752
752
  }
753
753
  buildSetOperations(e, t) {
@@ -807,18 +807,18 @@ class ie {
807
807
  for (const [q, g] of u) {
808
808
  const M = Q[q];
809
809
  if (M === void 0 || h(M, Oe) && M.value === void 0) {
810
- let x;
810
+ let R;
811
811
  if (g.default !== null && g.default !== void 0)
812
- x = h(g.default, b) ? g.default : n.param(g.default, g);
812
+ R = h(g.default, b) ? g.default : n.param(g.default, g);
813
813
  else if (g.defaultFn !== void 0) {
814
814
  const y = g.defaultFn();
815
- x = h(y, b) ? y : n.param(y, g);
815
+ R = h(y, b) ? y : n.param(y, g);
816
816
  } else if (!g.default && g.onUpdateFn !== void 0) {
817
817
  const y = g.onUpdateFn();
818
- x = h(y, b) ? y : n.param(y, g);
818
+ R = h(y, b) ? y : n.param(y, g);
819
819
  } else
820
- x = n`null`;
821
- L.push(x);
820
+ R = n`null`;
821
+ L.push(R);
822
822
  } else
823
823
  L.push(M);
824
824
  }
@@ -906,27 +906,27 @@ class ie {
906
906
  d.push({
907
907
  dbKey: h(w, b.Aliased) ? w.fieldAlias : r.columns[y].name,
908
908
  tsKey: y,
909
- field: h(w, R) ? E(w, o) : w,
909
+ field: h(w, x) ? E(w, o) : w,
910
910
  relationTableTsKey: void 0,
911
911
  isJson: !1,
912
912
  selection: []
913
913
  });
914
- let x = typeof a.orderBy == "function" ? a.orderBy(Q, Nt()) : a.orderBy ?? [];
915
- Array.isArray(x) || (x = [x]), N = x.map((y) => h(y, R) ? E(y, o) : se(y, o)), p = a.limit, C = a.offset;
914
+ let R = typeof a.orderBy == "function" ? a.orderBy(Q, Nt()) : a.orderBy ?? [];
915
+ Array.isArray(R) || (R = [R]), N = R.map((y) => h(y, x) ? E(y, o) : se(y, o)), p = a.limit, C = a.offset;
916
916
  for (const {
917
917
  tsKey: y,
918
918
  queryConfig: w,
919
919
  relation: j
920
920
  } of g) {
921
- const U = xt(
921
+ const W = Rt(
922
922
  t,
923
923
  s,
924
924
  j
925
925
  ), oe = V(j.referencedTable), z = s[oe], B = `${o}_${y}`, _ = he(
926
- ...U.fields.map(
926
+ ...W.fields.map(
927
927
  (ze, Je) => _e(
928
928
  E(
929
- U.references[Je],
929
+ W.references[Je],
930
930
  B
931
931
  ),
932
932
  E(ze, o)
@@ -995,7 +995,7 @@ class ie {
995
995
  fields: {},
996
996
  fieldsFlat: L.map(({ field: g }) => ({
997
997
  path: [],
998
- field: h(g, R) ? E(g, o) : g
998
+ field: h(g, x) ? E(g, o) : g
999
999
  })),
1000
1000
  joins: S,
1001
1001
  where: $,
@@ -1010,7 +1010,7 @@ class ie {
1010
1010
  fields: {},
1011
1011
  fieldsFlat: d.map(({ field: Q }) => ({
1012
1012
  path: [],
1013
- field: h(Q, R) ? E(Q, o) : Q
1013
+ field: h(Q, x) ? E(Q, o) : Q
1014
1014
  })),
1015
1015
  joins: S,
1016
1016
  where: $,
@@ -1616,7 +1616,7 @@ class Fe extends Ft {
1616
1616
  _prepare(e = !0) {
1617
1617
  if (!this.session)
1618
1618
  throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");
1619
- const t = W(this.config.fields), s = this.session[e ? "prepareOneTimeQuery" : "prepareQuery"](
1619
+ const t = U(this.config.fields), s = this.session[e ? "prepareOneTimeQuery" : "prepareQuery"](
1620
1620
  this.dialect.sqlToQuery(this.getSQL()),
1621
1621
  t,
1622
1622
  "all",
@@ -1757,7 +1757,7 @@ class Le extends D {
1757
1757
  /** @internal */
1758
1758
  config;
1759
1759
  returning(e = this.config.table[O.Symbol.Columns]) {
1760
- return this.config.returning = W(e), this;
1760
+ return this.config.returning = U(e), this;
1761
1761
  }
1762
1762
  /**
1763
1763
  * Adds an `on conflict do nothing` clause to the query.
@@ -1866,7 +1866,7 @@ class Le extends D {
1866
1866
  return this;
1867
1867
  }
1868
1868
  }
1869
- class xe {
1869
+ class Re {
1870
1870
  constructor(e, t, s, i) {
1871
1871
  this.table = e, this.session = t, this.dialect = s, this.withList = i;
1872
1872
  }
@@ -1971,7 +1971,7 @@ class Jt extends D {
1971
1971
  return this.config.limit = e, this;
1972
1972
  }
1973
1973
  returning(e = this.config.table[O.Symbol.Columns]) {
1974
- return this.config.returning = W(e), this;
1974
+ return this.config.returning = U(e), this;
1975
1975
  }
1976
1976
  /** @internal */
1977
1977
  getSQL() {
@@ -2050,7 +2050,7 @@ class Vt {
2050
2050
  }
2051
2051
  static [f] = "SQLiteAsyncRelationalQueryBuilder";
2052
2052
  findMany(e) {
2053
- return this.mode === "sync" ? new Re(
2053
+ return this.mode === "sync" ? new xe(
2054
2054
  this.fullSchema,
2055
2055
  this.schema,
2056
2056
  this.tableNamesMap,
@@ -2073,7 +2073,7 @@ class Vt {
2073
2073
  );
2074
2074
  }
2075
2075
  findFirst(e) {
2076
- return this.mode === "sync" ? new Re(
2076
+ return this.mode === "sync" ? new xe(
2077
2077
  this.fullSchema,
2078
2078
  this.schema,
2079
2079
  this.tableNamesMap,
@@ -2157,7 +2157,7 @@ class fe extends D {
2157
2157
  return this.executeRaw();
2158
2158
  }
2159
2159
  }
2160
- class Re extends fe {
2160
+ class xe extends fe {
2161
2161
  static [f] = "SQLiteSyncRelationalQuery";
2162
2162
  sync() {
2163
2163
  return this.executeRaw();
@@ -2299,7 +2299,7 @@ class Ke {
2299
2299
  });
2300
2300
  }
2301
2301
  function r(c) {
2302
- return new xe(c, t.session, t.dialect, e);
2302
+ return new Re(c, t.session, t.dialect, e);
2303
2303
  }
2304
2304
  function a(c) {
2305
2305
  return new Te(c, t.session, t.dialect, e);
@@ -2348,7 +2348,7 @@ class Ke {
2348
2348
  * ```
2349
2349
  */
2350
2350
  update(e) {
2351
- return new xe(e, this.session, this.dialect);
2351
+ return new Re(e, this.session, this.dialect);
2352
2352
  }
2353
2353
  $cache;
2354
2354
  /**
@@ -2449,10 +2449,10 @@ class Ke {
2449
2449
  return this.session.transaction(e, t);
2450
2450
  }
2451
2451
  }
2452
- class Wt {
2452
+ class Ut {
2453
2453
  static [f] = "Cache";
2454
2454
  }
2455
- class ke extends Wt {
2455
+ class ke extends Ut {
2456
2456
  strategy() {
2457
2457
  return "all";
2458
2458
  }
@@ -2468,7 +2468,7 @@ async function Be(l, e) {
2468
2468
  const t = `${l}-${JSON.stringify(e)}`, i = new TextEncoder().encode(t), r = await crypto.subtle.digest("SHA-256", i);
2469
2469
  return [...new Uint8Array(r)].map((c) => c.toString(16).padStart(2, "0")).join("");
2470
2470
  }
2471
- class Ut extends D {
2471
+ class Wt extends D {
2472
2472
  constructor(e) {
2473
2473
  super(), this.resultCb = e;
2474
2474
  }
@@ -2561,7 +2561,7 @@ class Ht {
2561
2561
  throw new Error("Not implemented");
2562
2562
  }
2563
2563
  execute(e) {
2564
- return this.mode === "async" ? this[this.executeMethod](e) : new Ut(() => this[this.executeMethod](e));
2564
+ return this.mode === "async" ? this[this.executeMethod](e) : new Wt(() => this[this.executeMethod](e));
2565
2565
  }
2566
2566
  mapResult(e, t) {
2567
2567
  switch (this.executeMethod) {
@@ -2765,7 +2765,7 @@ function ts(l, e, t) {
2765
2765
  if (o.schema) {
2766
2766
  const p = qt(
2767
2767
  o.schema,
2768
- Rt
2768
+ xt
2769
2769
  );
2770
2770
  c = {
2771
2771
  fullSchema: o.schema,
@@ -2798,7 +2798,7 @@ const ss = ge(X, ({ many: l }) => ({
2798
2798
  aiMessages: J,
2799
2799
  aiMessagesRelations: is,
2800
2800
  history: Ve,
2801
- stepContext: We
2801
+ stepContext: Ue
2802
2802
  }, Symbol.toStringTag, { value: "Module" }));
2803
2803
  function as(l) {
2804
2804
  return l.map((e) => e === "" ? null : e);
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie=require("./replay-index-B8Zfn7JD.js"),Te=require("./replay-history.schema-miM3Etuf.js"),Qe=require("./replay-step-context.schema-BuuXkAck.js"),C=require("./replay-ai-message-parts.schema-BBdjwldJ.js"),t=require("./replay-indexes-Dqjl8m6C.js");class Ce{static[t.entityKind]="ConsoleLogWriter";write(e){console.log(e)}}class ve{static[t.entityKind]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new Ce}logQuery(e,s){const i=s.map(n=>{try{return JSON.stringify(n)}catch{return String(n)}}),r=i.length?` -- params: [${i.join(", ")}]`:"";this.writer.write(`Query: ${e}${r}`)}}class Le{static[t.entityKind]="NoopLogger";logQuery(){}}const re=Symbol.for("drizzle:PgInlineForeignKeys"),ne=Symbol.for("drizzle:EnableRLS");class $e extends t.Table{static[t.entityKind]="PgTable";static Symbol=Object.assign({},t.Table.Symbol,{InlineForeignKeys:re,EnableRLS:ne});[re]=[];[ne]=!1;[t.Table.Symbol.ExtraConfigBuilder]=void 0;[t.Table.Symbol.ExtraConfigColumns]={}}class Ne{static[t.entityKind]="PgPrimaryKeyBuilder";columns;name;constructor(e,s){this.columns=e,this.name=s}build(e){return new xe(e,this.columns,this.name)}}class xe{constructor(e,s,i){this.table=e,this.columns=s,this.name=i}static[t.entityKind]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[$e.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}class de{constructor(e,s,i){this.sourceTable=e,this.referencedTable=s,this.relationName=i,this.referencedTableName=s[t.Table.Symbol.Name]}static[t.entityKind]="Relation";referencedTableName;fieldName}class fe{constructor(e,s){this.table=e,this.config=s}static[t.entityKind]="Relations"}class A extends de{constructor(e,s,i,r){super(e,s,i?.relationName),this.config=i,this.isNullable=r}static[t.entityKind]="One";withFieldName(e){const s=new A(this.sourceTable,this.referencedTable,this.config,this.isNullable);return s.fieldName=e,s}}class J extends de{constructor(e,s,i){super(e,s,i?.relationName),this.config=i}static[t.entityKind]="Many";withFieldName(e){const s=new J(this.sourceTable,this.referencedTable,this.config);return s.fieldName=e,s}}function Re(){return{and:t.and,between:t.between,eq:t.eq,exists:t.exists,gt:t.gt,gte:t.gte,ilike:t.ilike,inArray:t.inArray,isNull:t.isNull,isNotNull:t.isNotNull,like:t.like,lt:t.lt,lte:t.lte,ne:t.ne,not:t.not,notBetween:t.notBetween,notExists:t.notExists,notLike:t.notLike,notIlike:t.notIlike,notInArray:t.notInArray,or:t.or,sql:t.sql}}function Be(){return{sql:t.sql,asc:t.asc,desc:t.desc}}function _e(o,e){Object.keys(o).length===1&&"default"in o&&!t.is(o.default,t.Table)&&(o=o.default);const s={},i={},r={};for(const[n,a]of Object.entries(o))if(t.is(a,t.Table)){const l=t.getTableUniqueName(a),c=i[l];s[l]=n,r[n]={tsName:n,dbName:a[t.Table.Symbol.Name],schema:a[t.Table.Symbol.Schema],columns:a[t.Table.Symbol.Columns],relations:c?.relations??{},primaryKey:c?.primaryKey??[]};for(const h of Object.values(a[t.Table.Symbol.Columns]))h.primary&&r[n].primaryKey.push(h);const u=a[t.Table.Symbol.ExtraConfigBuilder]?.(a[t.Table.Symbol.ExtraConfigColumns]);if(u)for(const h of Object.values(u))t.is(h,Ne)&&r[n].primaryKey.push(...h.columns)}else if(t.is(a,fe)){const l=t.getTableUniqueName(a.table),c=s[l],u=a.config(e(a.table));let h;for(const[f,w]of Object.entries(u))if(c){const q=r[c];q.relations[f]=w}else l in i||(i[l]={relations:{},primaryKey:h}),i[l].relations[f]=w}return{tables:r,tableNamesMap:s}}function Z(o,e){return new fe(o,s=>Object.fromEntries(Object.entries(e(s)).map(([i,r])=>[i,r.withFieldName(i)])))}function Oe(o){return function(s,i){return new A(o,s,i,i?.fields.reduce((r,n)=>r&&n.notNull,!0)??!1)}}function Me(o){return function(s,i){return new J(o,s,i)}}function Ae(o,e,s){if(t.is(s,A)&&s.config)return{fields:s.config.fields,references:s.config.references};const i=e[t.getTableUniqueName(s.referencedTable)];if(!i)throw new Error(`Table "${s.referencedTable[t.Table.Symbol.Name]}" not found in schema`);const r=o[i];if(!r)throw new Error(`Table "${i}" not found in schema`);const n=s.sourceTable,a=e[t.getTableUniqueName(n)];if(!a)throw new Error(`Table "${n[t.Table.Symbol.Name]}" not found in schema`);const l=[];for(const c of Object.values(r.relations))(s.relationName&&s!==c&&c.relationName===s.relationName||!s.relationName&&c.referencedTable===s.sourceTable)&&l.push(c);if(l.length>1)throw s.relationName?new Error(`There are multiple relations with name "${s.relationName}" in table "${i}"`):new Error(`There are multiple relations between "${i}" and "${s.sourceTable[t.Table.Symbol.Name]}". Please specify relation name`);if(l[0]&&t.is(l[0],A)&&l[0].config)return{fields:l[0].config.references,references:l[0].config.fields};throw new Error(`There is not enough information to infer relation "${a}.${s.fieldName}"`)}function Ke(o){return{one:Oe(o),many:Me(o)}}function Y(o,e,s,i,r=n=>n){const n={};for(const[a,l]of i.entries())if(l.isJson){const c=e.relations[l.tsKey],u=s[a],h=typeof u=="string"?JSON.parse(u):u;n[l.tsKey]=t.is(c,A)?h&&Y(o,o[l.relationTableTsKey],h,l.selection,r):h.map(f=>Y(o,o[l.relationTableTsKey],f,l.selection,r))}else{const c=r(s[a]),u=l.field;let h;t.is(u,t.Column)?h=u:t.is(u,t.SQL)?h=u.decoder:h=u.sql.decoder,n[l.tsKey]=c===null?null:h.mapFromDriverValue(c)}return n}class I{constructor(e){this.table=e}static[t.entityKind]="ColumnAliasProxyHandler";get(e,s){return s==="table"?this.table:e[s]}}class X{constructor(e,s){this.alias=e,this.replaceOriginalName=s}static[t.entityKind]="TableAliasProxyHandler";get(e,s){if(s===t.Table.Symbol.IsAlias)return!0;if(s===t.Table.Symbol.Name)return this.alias;if(this.replaceOriginalName&&s===t.Table.Symbol.OriginalName)return this.alias;if(s===t.ViewBaseConfig)return{...e[t.ViewBaseConfig],name:this.alias,isAlias:!0};if(s===t.Table.Symbol.Columns){const r=e[t.Table.Symbol.Columns];if(!r)return r;const n={};return Object.keys(r).map(a=>{n[a]=new Proxy(r[a],new I(new Proxy(e,this)))}),n}const i=e[s];return t.is(i,t.Column)?new Proxy(i,new I(new Proxy(e,this))):i}}function H(o,e){return new Proxy(o,new X(e,!1))}function B(o,e){return new Proxy(o,new I(new Proxy(o.table,new X(e,!1))))}function me(o,e){return new t.SQL.Aliased(k(o.sql,e),o.fieldAlias)}function k(o,e){return t.sql.join(o.queryChunks.map(s=>t.is(s,t.Column)?B(s,e):t.is(s,t.SQL)?k(s,e):t.is(s,t.SQL.Aliased)?me(s,e):s))}class Q{static[t.entityKind]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,s){if(s==="_")return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(s===t.ViewBaseConfig)return{...e[t.ViewBaseConfig],selectedFields:new Proxy(e[t.ViewBaseConfig].selectedFields,this)};if(typeof s=="symbol")return e[s];const r=(t.is(e,t.Subquery)?e._.selectedFields:t.is(e,t.View)?e[t.ViewBaseConfig].selectedFields:e)[s];if(t.is(r,t.SQL.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!r.isSelectionField)return r.sql;const n=r.clone();return n.isSelectionField=!0,n}if(t.is(r,t.SQL)){if(this.config.sqlBehavior==="sql")return r;throw new Error(`You tried to reference "${s}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return t.is(r,t.Column)?this.config.alias?new Proxy(r,new I(new Proxy(r.table,new X(this.config.alias,this.config.replaceOriginalName??!1)))):r:typeof r!="object"||r===null?r:new Proxy(r,new Q(this.config))}}class K{static[t.entityKind]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(s=>(e?.(),s),s=>{throw e?.(),s})}then(e,s){return this.execute().then(e,s)}}function M(o){return t.is(o,t.SQLiteTable)?[`${o[t.Table.Symbol.BaseName]}`]:t.is(o,t.Subquery)?o._.usedTables??[]:t.is(o,t.SQL)?o.usedTables??[]:[]}class ae extends K{constructor(e,s,i,r){super(),this.table=e,this.session=s,this.dialect=i,this.config={table:e,withList:r}}static[t.entityKind]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]=="function"){const s=e[0](new Proxy(this.config.table[t.Table.Symbol.Columns],new Q({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(s)?s:[s];this.config.orderBy=i}else{const s=e;this.config.orderBy=s}return this}limit(e){return this.config.limit=e,this}returning(e=this.table[t.SQLiteTable.Symbol.Columns]){return this.config.returning=t.orderSelectedFields(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){const{typings:e,...s}=this.dialect.sqlToQuery(this.getSQL());return s}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:M(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}}function Pe(o){return(o.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(s=>s.toLowerCase()).join("_")}function je(o){return(o.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((s,i,r)=>{const n=r===0?i.toLowerCase():`${i[0].toUpperCase()}${i.slice(1)}`;return s+n},"")}function Ee(o){return o}class Fe{static[t.entityKind]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert=e==="snake_case"?Pe:e==="camelCase"?je:Ee}getColumnCasing(e){if(!e.keyAsName)return e.name;const s=e.table[t.Table.Symbol.Schema]??"public",i=e.table[t.Table.Symbol.OriginalName],r=`${s}.${i}.${e.name}`;return this.cache[r]||this.cacheTable(e.table),this.cache[r]}cacheTable(e){const s=e[t.Table.Symbol.Schema]??"public",i=e[t.Table.Symbol.OriginalName],r=`${s}.${i}`;if(!this.cachedTables[r]){for(const n of Object.values(e[t.Table.Symbol.Columns])){const a=`${r}.${n.name}`;this.cache[a]=this.convert(n.name)}this.cachedTables[r]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class ee extends Error{static[t.entityKind]="DrizzleError";constructor({message:e,cause:s}){super(e),this.name="DrizzleError",this.cause=s}}class _ extends Error{constructor(e,s,i){super(`Failed query: ${e}
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie=require("./replay-index-Nz5obVS5.js"),Te=require("./replay-history.schema-miM3Etuf.js"),Qe=require("./replay-step-context.schema-BuuXkAck.js"),C=require("./replay-ai-message-parts.schema-BBdjwldJ.js"),t=require("./replay-indexes-Dqjl8m6C.js");class Ce{static[t.entityKind]="ConsoleLogWriter";write(e){console.log(e)}}class ve{static[t.entityKind]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new Ce}logQuery(e,s){const i=s.map(n=>{try{return JSON.stringify(n)}catch{return String(n)}}),r=i.length?` -- params: [${i.join(", ")}]`:"";this.writer.write(`Query: ${e}${r}`)}}class Le{static[t.entityKind]="NoopLogger";logQuery(){}}const re=Symbol.for("drizzle:PgInlineForeignKeys"),ne=Symbol.for("drizzle:EnableRLS");class $e extends t.Table{static[t.entityKind]="PgTable";static Symbol=Object.assign({},t.Table.Symbol,{InlineForeignKeys:re,EnableRLS:ne});[re]=[];[ne]=!1;[t.Table.Symbol.ExtraConfigBuilder]=void 0;[t.Table.Symbol.ExtraConfigColumns]={}}class Ne{static[t.entityKind]="PgPrimaryKeyBuilder";columns;name;constructor(e,s){this.columns=e,this.name=s}build(e){return new xe(e,this.columns,this.name)}}class xe{constructor(e,s,i){this.table=e,this.columns=s,this.name=i}static[t.entityKind]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[$e.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}class de{constructor(e,s,i){this.sourceTable=e,this.referencedTable=s,this.relationName=i,this.referencedTableName=s[t.Table.Symbol.Name]}static[t.entityKind]="Relation";referencedTableName;fieldName}class fe{constructor(e,s){this.table=e,this.config=s}static[t.entityKind]="Relations"}class A extends de{constructor(e,s,i,r){super(e,s,i?.relationName),this.config=i,this.isNullable=r}static[t.entityKind]="One";withFieldName(e){const s=new A(this.sourceTable,this.referencedTable,this.config,this.isNullable);return s.fieldName=e,s}}class J extends de{constructor(e,s,i){super(e,s,i?.relationName),this.config=i}static[t.entityKind]="Many";withFieldName(e){const s=new J(this.sourceTable,this.referencedTable,this.config);return s.fieldName=e,s}}function Re(){return{and:t.and,between:t.between,eq:t.eq,exists:t.exists,gt:t.gt,gte:t.gte,ilike:t.ilike,inArray:t.inArray,isNull:t.isNull,isNotNull:t.isNotNull,like:t.like,lt:t.lt,lte:t.lte,ne:t.ne,not:t.not,notBetween:t.notBetween,notExists:t.notExists,notLike:t.notLike,notIlike:t.notIlike,notInArray:t.notInArray,or:t.or,sql:t.sql}}function Be(){return{sql:t.sql,asc:t.asc,desc:t.desc}}function _e(o,e){Object.keys(o).length===1&&"default"in o&&!t.is(o.default,t.Table)&&(o=o.default);const s={},i={},r={};for(const[n,a]of Object.entries(o))if(t.is(a,t.Table)){const l=t.getTableUniqueName(a),c=i[l];s[l]=n,r[n]={tsName:n,dbName:a[t.Table.Symbol.Name],schema:a[t.Table.Symbol.Schema],columns:a[t.Table.Symbol.Columns],relations:c?.relations??{},primaryKey:c?.primaryKey??[]};for(const h of Object.values(a[t.Table.Symbol.Columns]))h.primary&&r[n].primaryKey.push(h);const u=a[t.Table.Symbol.ExtraConfigBuilder]?.(a[t.Table.Symbol.ExtraConfigColumns]);if(u)for(const h of Object.values(u))t.is(h,Ne)&&r[n].primaryKey.push(...h.columns)}else if(t.is(a,fe)){const l=t.getTableUniqueName(a.table),c=s[l],u=a.config(e(a.table));let h;for(const[f,w]of Object.entries(u))if(c){const q=r[c];q.relations[f]=w}else l in i||(i[l]={relations:{},primaryKey:h}),i[l].relations[f]=w}return{tables:r,tableNamesMap:s}}function Z(o,e){return new fe(o,s=>Object.fromEntries(Object.entries(e(s)).map(([i,r])=>[i,r.withFieldName(i)])))}function Oe(o){return function(s,i){return new A(o,s,i,i?.fields.reduce((r,n)=>r&&n.notNull,!0)??!1)}}function Me(o){return function(s,i){return new J(o,s,i)}}function Ae(o,e,s){if(t.is(s,A)&&s.config)return{fields:s.config.fields,references:s.config.references};const i=e[t.getTableUniqueName(s.referencedTable)];if(!i)throw new Error(`Table "${s.referencedTable[t.Table.Symbol.Name]}" not found in schema`);const r=o[i];if(!r)throw new Error(`Table "${i}" not found in schema`);const n=s.sourceTable,a=e[t.getTableUniqueName(n)];if(!a)throw new Error(`Table "${n[t.Table.Symbol.Name]}" not found in schema`);const l=[];for(const c of Object.values(r.relations))(s.relationName&&s!==c&&c.relationName===s.relationName||!s.relationName&&c.referencedTable===s.sourceTable)&&l.push(c);if(l.length>1)throw s.relationName?new Error(`There are multiple relations with name "${s.relationName}" in table "${i}"`):new Error(`There are multiple relations between "${i}" and "${s.sourceTable[t.Table.Symbol.Name]}". Please specify relation name`);if(l[0]&&t.is(l[0],A)&&l[0].config)return{fields:l[0].config.references,references:l[0].config.fields};throw new Error(`There is not enough information to infer relation "${a}.${s.fieldName}"`)}function Ke(o){return{one:Oe(o),many:Me(o)}}function Y(o,e,s,i,r=n=>n){const n={};for(const[a,l]of i.entries())if(l.isJson){const c=e.relations[l.tsKey],u=s[a],h=typeof u=="string"?JSON.parse(u):u;n[l.tsKey]=t.is(c,A)?h&&Y(o,o[l.relationTableTsKey],h,l.selection,r):h.map(f=>Y(o,o[l.relationTableTsKey],f,l.selection,r))}else{const c=r(s[a]),u=l.field;let h;t.is(u,t.Column)?h=u:t.is(u,t.SQL)?h=u.decoder:h=u.sql.decoder,n[l.tsKey]=c===null?null:h.mapFromDriverValue(c)}return n}class I{constructor(e){this.table=e}static[t.entityKind]="ColumnAliasProxyHandler";get(e,s){return s==="table"?this.table:e[s]}}class X{constructor(e,s){this.alias=e,this.replaceOriginalName=s}static[t.entityKind]="TableAliasProxyHandler";get(e,s){if(s===t.Table.Symbol.IsAlias)return!0;if(s===t.Table.Symbol.Name)return this.alias;if(this.replaceOriginalName&&s===t.Table.Symbol.OriginalName)return this.alias;if(s===t.ViewBaseConfig)return{...e[t.ViewBaseConfig],name:this.alias,isAlias:!0};if(s===t.Table.Symbol.Columns){const r=e[t.Table.Symbol.Columns];if(!r)return r;const n={};return Object.keys(r).map(a=>{n[a]=new Proxy(r[a],new I(new Proxy(e,this)))}),n}const i=e[s];return t.is(i,t.Column)?new Proxy(i,new I(new Proxy(e,this))):i}}function H(o,e){return new Proxy(o,new X(e,!1))}function B(o,e){return new Proxy(o,new I(new Proxy(o.table,new X(e,!1))))}function me(o,e){return new t.SQL.Aliased(k(o.sql,e),o.fieldAlias)}function k(o,e){return t.sql.join(o.queryChunks.map(s=>t.is(s,t.Column)?B(s,e):t.is(s,t.SQL)?k(s,e):t.is(s,t.SQL.Aliased)?me(s,e):s))}class Q{static[t.entityKind]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,s){if(s==="_")return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(s===t.ViewBaseConfig)return{...e[t.ViewBaseConfig],selectedFields:new Proxy(e[t.ViewBaseConfig].selectedFields,this)};if(typeof s=="symbol")return e[s];const r=(t.is(e,t.Subquery)?e._.selectedFields:t.is(e,t.View)?e[t.ViewBaseConfig].selectedFields:e)[s];if(t.is(r,t.SQL.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!r.isSelectionField)return r.sql;const n=r.clone();return n.isSelectionField=!0,n}if(t.is(r,t.SQL)){if(this.config.sqlBehavior==="sql")return r;throw new Error(`You tried to reference "${s}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return t.is(r,t.Column)?this.config.alias?new Proxy(r,new I(new Proxy(r.table,new X(this.config.alias,this.config.replaceOriginalName??!1)))):r:typeof r!="object"||r===null?r:new Proxy(r,new Q(this.config))}}class K{static[t.entityKind]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(s=>(e?.(),s),s=>{throw e?.(),s})}then(e,s){return this.execute().then(e,s)}}function M(o){return t.is(o,t.SQLiteTable)?[`${o[t.Table.Symbol.BaseName]}`]:t.is(o,t.Subquery)?o._.usedTables??[]:t.is(o,t.SQL)?o.usedTables??[]:[]}class ae extends K{constructor(e,s,i,r){super(),this.table=e,this.session=s,this.dialect=i,this.config={table:e,withList:r}}static[t.entityKind]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]=="function"){const s=e[0](new Proxy(this.config.table[t.Table.Symbol.Columns],new Q({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(s)?s:[s];this.config.orderBy=i}else{const s=e;this.config.orderBy=s}return this}limit(e){return this.config.limit=e,this}returning(e=this.table[t.SQLiteTable.Symbol.Columns]){return this.config.returning=t.orderSelectedFields(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){const{typings:e,...s}=this.dialect.sqlToQuery(this.getSQL());return s}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:M(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}}function Pe(o){return(o.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(s=>s.toLowerCase()).join("_")}function je(o){return(o.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((s,i,r)=>{const n=r===0?i.toLowerCase():`${i[0].toUpperCase()}${i.slice(1)}`;return s+n},"")}function Ee(o){return o}class Fe{static[t.entityKind]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert=e==="snake_case"?Pe:e==="camelCase"?je:Ee}getColumnCasing(e){if(!e.keyAsName)return e.name;const s=e.table[t.Table.Symbol.Schema]??"public",i=e.table[t.Table.Symbol.OriginalName],r=`${s}.${i}.${e.name}`;return this.cache[r]||this.cacheTable(e.table),this.cache[r]}cacheTable(e){const s=e[t.Table.Symbol.Schema]??"public",i=e[t.Table.Symbol.OriginalName],r=`${s}.${i}`;if(!this.cachedTables[r]){for(const n of Object.values(e[t.Table.Symbol.Columns])){const a=`${r}.${n.name}`;this.cache[a]=this.convert(n.name)}this.cachedTables[r]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class ee extends Error{static[t.entityKind]="DrizzleError";constructor({message:e,cause:s}){super(e),this.name="DrizzleError",this.cause=s}}class _ extends Error{constructor(e,s,i){super(`Failed query: ${e}
2
2
  params: ${s}`),this.query=e,this.params=s,this.cause=i,Error.captureStackTrace(this,_),i&&(this.cause=i)}}class Ie extends ee{static[t.entityKind]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class te extends t.View{static[t.entityKind]="SQLiteViewBase"}class D{static[t.entityKind]="SQLiteDialect";casing;constructor(e){this.casing=new Fe(e?.casing)}escapeName(e){return`"${e.replace(/"/g,'""')}"`}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;const s=[t.sql`with `];for(const[i,r]of e.entries())s.push(t.sql`${t.sql.identifier(r._.alias)} as (${r._.sql})`),i<e.length-1&&s.push(t.sql`, `);return s.push(t.sql` `),t.sql.join(s)}buildDeleteQuery({table:e,where:s,returning:i,withList:r,limit:n,orderBy:a}){const l=this.buildWithCTE(r),c=i?t.sql` returning ${this.buildSelection(i,{isSingleTable:!0})}`:void 0,u=s?t.sql` where ${s}`:void 0,h=this.buildOrderBy(a),f=this.buildLimit(n);return t.sql`${l}delete from ${e}${u}${c}${h}${f}`}buildUpdateSet(e,s){const i=e[t.Table.Symbol.Columns],r=Object.keys(i).filter(a=>s[a]!==void 0||i[a]?.onUpdateFn!==void 0),n=r.length;return t.sql.join(r.flatMap((a,l)=>{const c=i[a],u=c.onUpdateFn?.(),h=s[a]??(t.is(u,t.SQL)?u:t.sql.param(u,c)),f=t.sql`${t.sql.identifier(this.casing.getColumnCasing(c))} = ${h}`;return l<n-1?[f,t.sql.raw(", ")]:[f]}))}buildUpdateQuery({table:e,set:s,where:i,returning:r,withList:n,joins:a,from:l,limit:c,orderBy:u}){const h=this.buildWithCTE(n),f=this.buildUpdateSet(e,s),w=l&&t.sql.join([t.sql.raw(" from "),this.buildFromTable(l)]),q=this.buildJoins(a),S=r?t.sql` returning ${this.buildSelection(r,{isSingleTable:!0})}`:void 0,g=i?t.sql` where ${i}`:void 0,p=this.buildOrderBy(u),b=this.buildLimit(c);return t.sql`${h}update ${e} set ${f}${w}${q}${g}${S}${p}${b}`}buildSelection(e,{isSingleTable:s=!1}={}){const i=e.length,r=e.flatMap(({field:n},a)=>{const l=[];if(t.is(n,t.SQL.Aliased)&&n.isSelectionField)l.push(t.sql.identifier(n.fieldAlias));else if(t.is(n,t.SQL.Aliased)||t.is(n,t.SQL)){const c=t.is(n,t.SQL.Aliased)?n.sql:n;s?l.push(new t.SQL(c.queryChunks.map(u=>t.is(u,t.Column)?t.sql.identifier(this.casing.getColumnCasing(u)):u))):l.push(c),t.is(n,t.SQL.Aliased)&&l.push(t.sql` as ${t.sql.identifier(n.fieldAlias)}`)}else if(t.is(n,t.Column)){const c=n.table[t.Table.Symbol.Name];n.columnType==="SQLiteNumericBigInt"?s?l.push(t.sql`cast(${t.sql.identifier(this.casing.getColumnCasing(n))} as text)`):l.push(t.sql`cast(${t.sql.identifier(c)}.${t.sql.identifier(this.casing.getColumnCasing(n))} as text)`):s?l.push(t.sql.identifier(this.casing.getColumnCasing(n))):l.push(t.sql`${t.sql.identifier(c)}.${t.sql.identifier(this.casing.getColumnCasing(n))}`)}else if(t.is(n,t.Subquery)){const c=Object.entries(n._.selectedFields);if(c.length===1){const u=c[0][1],h=t.is(u,t.SQL)?u.decoder:t.is(u,t.Column)?{mapFromDriverValue:f=>u.mapFromDriverValue(f)}:u.sql.decoder;h&&(n._.sql.decoder=h)}l.push(n)}return a<i-1&&l.push(t.sql`, `),l});return t.sql.join(r)}buildJoins(e){if(!e||e.length===0)return;const s=[];if(e)for(const[i,r]of e.entries()){i===0&&s.push(t.sql` `);const n=r.table,a=r.on?t.sql` on ${r.on}`:void 0;if(t.is(n,t.SQLiteTable)){const l=n[t.SQLiteTable.Symbol.Name],c=n[t.SQLiteTable.Symbol.Schema],u=n[t.SQLiteTable.Symbol.OriginalName],h=l===u?void 0:r.alias;s.push(t.sql`${t.sql.raw(r.joinType)} join ${c?t.sql`${t.sql.identifier(c)}.`:void 0}${t.sql.identifier(u)}${h&&t.sql` ${t.sql.identifier(h)}`}${a}`)}else s.push(t.sql`${t.sql.raw(r.joinType)} join ${n}${a}`);i<e.length-1&&s.push(t.sql` `)}return t.sql.join(s)}buildLimit(e){return typeof e=="object"||typeof e=="number"&&e>=0?t.sql` limit ${e}`:void 0}buildOrderBy(e){const s=[];if(e)for(const[i,r]of e.entries())s.push(r),i<e.length-1&&s.push(t.sql`, `);return s.length>0?t.sql` order by ${t.sql.join(s)}`:void 0}buildFromTable(e){return t.is(e,t.Table)&&e[t.Table.Symbol.IsAlias]?t.sql`${t.sql`${t.sql.identifier(e[t.Table.Symbol.Schema]??"")}.`.if(e[t.Table.Symbol.Schema])}${t.sql.identifier(e[t.Table.Symbol.OriginalName])} ${t.sql.identifier(e[t.Table.Symbol.Name])}`:e}buildSelectQuery({withList:e,fields:s,fieldsFlat:i,where:r,having:n,table:a,joins:l,orderBy:c,groupBy:u,limit:h,offset:f,distinct:w,setOperators:q}){const S=i??t.orderSelectedFields(s);for(const $ of S)if(t.is($.field,t.Column)&&t.getTableName($.field.table)!==(t.is(a,t.Subquery)?a._.alias:t.is(a,te)?a[t.ViewBaseConfig].name:t.is(a,t.SQL)?void 0:t.getTableName(a))&&!(N=>l?.some(({alias:E})=>E===(N[t.Table.Symbol.IsAlias]?t.getTableName(N):N[t.Table.Symbol.BaseName])))($.field.table)){const N=t.getTableName($.field.table);throw new Error(`Your "${$.path.join("->")}" field references a column "${N}"."${$.field.name}", but the table "${N}" is not part of the query! Did you forget to join it?`)}const g=!l||l.length===0,p=this.buildWithCTE(e),b=w?t.sql` distinct`:void 0,v=this.buildSelection(S,{isSingleTable:g}),T=this.buildFromTable(a),m=this.buildJoins(l),x=r?t.sql` where ${r}`:void 0,L=n?t.sql` having ${n}`:void 0,d=[];if(u)for(const[$,N]of u.entries())d.push(N),$<u.length-1&&d.push(t.sql`, `);const y=d.length>0?t.sql` group by ${t.sql.join(d)}`:void 0,R=this.buildOrderBy(c),j=this.buildLimit(h),W=f?t.sql` offset ${f}`:void 0,P=t.sql`${p}select${b} ${v} from ${T}${m}${x}${y}${L}${R}${j}${W}`;return q.length>0?this.buildSetOperations(P,q):P}buildSetOperations(e,s){const[i,...r]=s;if(!i)throw new Error("Cannot pass undefined values to any set operator");return r.length===0?this.buildSetOperationQuery({leftSelect:e,setOperator:i}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:i}),r)}buildSetOperationQuery({leftSelect:e,setOperator:{type:s,isAll:i,rightSelect:r,limit:n,orderBy:a,offset:l}}){const c=t.sql`${e.getSQL()} `,u=t.sql`${r.getSQL()}`;let h;if(a&&a.length>0){const S=[];for(const g of a)if(t.is(g,t.SQLiteColumn))S.push(t.sql.identifier(g.name));else if(t.is(g,t.SQL)){for(let p=0;p<g.queryChunks.length;p++){const b=g.queryChunks[p];t.is(b,t.SQLiteColumn)&&(g.queryChunks[p]=t.sql.identifier(this.casing.getColumnCasing(b)))}S.push(t.sql`${g}`)}else S.push(t.sql`${g}`);h=t.sql` order by ${t.sql.join(S,t.sql`, `)}`}const f=typeof n=="object"||typeof n=="number"&&n>=0?t.sql` limit ${n}`:void 0,w=t.sql.raw(`${s} ${i?"all ":""}`),q=l?t.sql` offset ${l}`:void 0;return t.sql`${c}${w}${u}${h}${f}${q}`}buildInsertQuery({table:e,values:s,onConflict:i,returning:r,withList:n,select:a}){const l=[],c=e[t.Table.Symbol.Columns],u=Object.entries(c).filter(([g,p])=>!p.shouldDisableInsert()),h=u.map(([,g])=>t.sql.identifier(this.casing.getColumnCasing(g)));if(a){const g=s;t.is(g,t.SQL)?l.push(g):l.push(g.getSQL())}else{const g=s;l.push(t.sql.raw("values "));for(const[p,b]of g.entries()){const v=[];for(const[T,m]of u){const x=b[T];if(x===void 0||t.is(x,t.Param)&&x.value===void 0){let L;if(m.default!==null&&m.default!==void 0)L=t.is(m.default,t.SQL)?m.default:t.sql.param(m.default,m);else if(m.defaultFn!==void 0){const d=m.defaultFn();L=t.is(d,t.SQL)?d:t.sql.param(d,m)}else if(!m.default&&m.onUpdateFn!==void 0){const d=m.onUpdateFn();L=t.is(d,t.SQL)?d:t.sql.param(d,m)}else L=t.sql`null`;v.push(L)}else v.push(x)}l.push(v),p<g.length-1&&l.push(t.sql`, `)}}const f=this.buildWithCTE(n),w=t.sql.join(l),q=r?t.sql` returning ${this.buildSelection(r,{isSingleTable:!0})}`:void 0,S=i?.length?t.sql.join(i):void 0;return t.sql`${f}insert into ${e} ${h} ${w}${S}${q}`}sqlToQuery(e,s){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:s})}buildRelationalQuery({fullSchema:e,schema:s,tableNamesMap:i,table:r,tableConfig:n,queryConfig:a,tableAlias:l,nestedQueryRelation:c,joinOn:u}){let h=[],f,w,q=[],S;const g=[];if(a===!0)h=Object.entries(n.columns).map(([v,T])=>({dbKey:T.name,tsKey:v,field:B(T,l),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{const b=Object.fromEntries(Object.entries(n.columns).map(([d,y])=>[d,B(y,l)]));if(a.where){const d=typeof a.where=="function"?a.where(b,Re()):a.where;S=d&&k(d,l)}const v=[];let T=[];if(a.columns){let d=!1;for(const[y,R]of Object.entries(a.columns))R!==void 0&&y in n.columns&&(!d&&R===!0&&(d=!0),T.push(y));T.length>0&&(T=d?T.filter(y=>a.columns?.[y]===!0):Object.keys(n.columns).filter(y=>!T.includes(y)))}else T=Object.keys(n.columns);for(const d of T){const y=n.columns[d];v.push({tsKey:d,value:y})}let m=[];a.with&&(m=Object.entries(a.with).filter(d=>!!d[1]).map(([d,y])=>({tsKey:d,queryConfig:y,relation:n.relations[d]})));let x;if(a.extras){x=typeof a.extras=="function"?a.extras(b,{sql:t.sql}):a.extras;for(const[d,y]of Object.entries(x))v.push({tsKey:d,value:me(y,l)})}for(const{tsKey:d,value:y}of v)h.push({dbKey:t.is(y,t.SQL.Aliased)?y.fieldAlias:n.columns[d].name,tsKey:d,field:t.is(y,t.Column)?B(y,l):y,relationTableTsKey:void 0,isJson:!1,selection:[]});let L=typeof a.orderBy=="function"?a.orderBy(b,Be()):a.orderBy??[];Array.isArray(L)||(L=[L]),q=L.map(d=>t.is(d,t.Column)?B(d,l):k(d,l)),f=a.limit,w=a.offset;for(const{tsKey:d,queryConfig:y,relation:R}of m){const j=Ae(s,i,R),W=t.getTableUniqueName(R.referencedTable),P=i[W],$=`${l}_${d}`,N=t.and(...j.fields.map((we,qe)=>t.eq(B(j.references[qe],$),B(we,l)))),E=this.buildRelationalQuery({fullSchema:e,schema:s,tableNamesMap:i,table:e[P],tableConfig:s[P],queryConfig:t.is(R,A)?y===!0?{limit:1}:{...y,limit:1}:y,tableAlias:$,joinOn:N,nestedQueryRelation:R}),Se=t.sql`(${E.sql})`.as(d);h.push({dbKey:d,tsKey:d,field:Se,relationTableTsKey:P,isJson:!0,selection:E.selection})}}if(h.length===0)throw new ee({message:`No fields selected for table "${n.tsName}" ("${l}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});let p;if(S=t.and(u,S),c){let b=t.sql`json_array(${t.sql.join(h.map(({field:m})=>t.is(m,t.SQLiteColumn)?t.sql.identifier(this.casing.getColumnCasing(m)):t.is(m,t.SQL.Aliased)?m.sql:m),t.sql`, `)})`;t.is(c,J)&&(b=t.sql`coalesce(json_group_array(${b}), json_array())`);const v=[{dbKey:"data",tsKey:"data",field:b.as("data"),isJson:!0,relationTableTsKey:n.tsName,selection:h}];f!==void 0||w!==void 0||q.length>0?(p=this.buildSelectQuery({table:H(r,l),fields:{},fieldsFlat:[{path:[],field:t.sql.raw("*")}],where:S,limit:f,offset:w,orderBy:q,setOperators:[]}),S=void 0,f=void 0,w=void 0,q=void 0):p=H(r,l),p=this.buildSelectQuery({table:t.is(p,t.SQLiteTable)?p:new t.Subquery(p,{},l),fields:{},fieldsFlat:v.map(({field:m})=>({path:[],field:t.is(m,t.Column)?B(m,l):m})),joins:g,where:S,limit:f,offset:w,orderBy:q,setOperators:[]})}else p=this.buildSelectQuery({table:H(r,l),fields:{},fieldsFlat:h.map(({field:b})=>({path:[],field:t.is(b,t.Column)?B(b,l):b})),joins:g,where:S,limit:f,offset:w,orderBy:q,setOperators:[]});return{tableTsKey:n.tsName,sql:p,selection:h}}}class ke extends D{static[t.entityKind]="SQLiteSyncDialect";migrate(e,s,i){const r=i===void 0||typeof i=="string"?"__drizzle_migrations":i.migrationsTable??"__drizzle_migrations",n=t.sql`
3
3
  CREATE TABLE IF NOT EXISTS ${t.sql.identifier(r)} (
4
4
  id SERIAL PRIMARY KEY,
@@ -1,5 +1,5 @@
1
- import { s as e } from "./replay-step-context.schema-DBk4jufr.js";
2
- import { b as l, e as o, d, q as c } from "./replay-indexes-CfsvVMi_.js";
1
+ import { s as e } from "./replay-step-context.schema-BOprzd6Z.js";
2
+ import { c as l, e as o, d, l as c } from "./replay-indexes-B3PJtgeh.js";
3
3
  function r(t) {
4
4
  return {
5
5
  id: t.id,
@@ -0,0 +1,108 @@
1
+ import { m as o, r as u, j as c, P as d, b as h, e as l, s as w, w as y, d as m, f } from "./replay-index-4TEahAPK.js";
2
+ import { O as E } from "./replay-Observable-D6wKbFwB.js";
3
+ const F = /* @__PURE__ */ new Set(["node_modules"]), T = /\(os error [23]\)/;
4
+ function g(r) {
5
+ return typeof r != "string" ? !1 : r.includes("No such file or directory") || r.includes("forbidden path") || T.test(r);
6
+ }
7
+ class b extends E {
8
+ constructor(t) {
9
+ super(), this.baseDir = t, this.initializeDirectory(t);
10
+ }
11
+ baseDir;
12
+ writeExcludedKeys = /* @__PURE__ */ new Set();
13
+ writeEndTimers = /* @__PURE__ */ new Map();
14
+ async initializeDirectory(t) {
15
+ await o(t, {
16
+ recursive: !0
17
+ });
18
+ }
19
+ setWriteExcludedKeys(t) {
20
+ this.writeExcludedKeys = t;
21
+ }
22
+ async ls(t) {
23
+ const e = await this.getFullPath(t);
24
+ return this.getDirEntryFilesRecursively(e);
25
+ }
26
+ async getDirEntryFilesRecursively(t) {
27
+ try {
28
+ const e = [], i = await u(t);
29
+ for (const s of i)
30
+ if (s.isDirectory) {
31
+ if (F.has(s.name))
32
+ continue;
33
+ const n = await c(t, s.name), a = await this.getDirEntryFilesRecursively(n);
34
+ e.push(...a);
35
+ } else {
36
+ const n = await c(t, s.name), a = await d.relative(this.baseDir, n);
37
+ e.push(a);
38
+ }
39
+ return e;
40
+ } catch (e) {
41
+ return e.includes("forbidden path") || console.error(e), [];
42
+ }
43
+ }
44
+ async get(t) {
45
+ const e = await this.getFullPath(t);
46
+ try {
47
+ return await h(e);
48
+ } catch (i) {
49
+ if (g(i)) return null;
50
+ try {
51
+ if (!await l(e)) return null;
52
+ } catch {
53
+ }
54
+ throw console.error(i), i;
55
+ }
56
+ }
57
+ async has(t) {
58
+ const e = await this.getFullPath(t);
59
+ return await l(e);
60
+ }
61
+ async set(t, e) {
62
+ if (!this.writeExcludedKeys.has(t)) {
63
+ this.cancelWriteEndTimer(t), this.emit("write-start", t);
64
+ try {
65
+ const i = await this.getFullPath(t), s = w(), n = i.split(s).slice(0, -1).join(s);
66
+ await o(n, {
67
+ recursive: !0
68
+ }), await y(i, e);
69
+ } finally {
70
+ this.scheduleWriteEnd(t);
71
+ }
72
+ }
73
+ }
74
+ async remove(t) {
75
+ if (!this.writeExcludedKeys.has(t)) {
76
+ this.cancelWriteEndTimer(t), this.emit("write-start", t);
77
+ try {
78
+ const e = await this.getFullPath(t);
79
+ await m(e);
80
+ } catch (e) {
81
+ !e.includes("No such file or directory") && !e.includes("forbidden path") && console.error(e);
82
+ } finally {
83
+ this.scheduleWriteEnd(t);
84
+ }
85
+ }
86
+ }
87
+ cancelWriteEndTimer(t) {
88
+ const e = this.writeEndTimers.get(t);
89
+ e && (clearTimeout(e), this.writeEndTimers.delete(t));
90
+ }
91
+ scheduleWriteEnd(t) {
92
+ this.cancelWriteEndTimer(t);
93
+ const e = setTimeout(() => {
94
+ this.emit("write-end", t), this.writeEndTimers.delete(t);
95
+ }, 1e3);
96
+ this.writeEndTimers.set(t, e);
97
+ }
98
+ async rename(t, e) {
99
+ const i = await this.getFullPath(t), s = await this.getFullPath(e);
100
+ await f(i, s);
101
+ }
102
+ async getFullPath(t) {
103
+ return await c(this.baseDir, t ?? "");
104
+ }
105
+ }
106
+ export {
107
+ b as TauriFileSystemAdapter
108
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./replay-index-Nz5obVS5.js"),o=require("./replay-Observable-bjJ6wkRB.js"),l=new Set(["node_modules"]),u=/\(os error [23]\)/;function d(n){return typeof n!="string"?!1:n.includes("No such file or directory")||n.includes("forbidden path")||u.test(n)}class h extends o.Observable{constructor(e){super(),this.baseDir=e,this.initializeDirectory(e)}baseDir;writeExcludedKeys=new Set;writeEndTimers=new Map;async initializeDirectory(e){await i.mkdir(e,{recursive:!0})}setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e){const t=await this.getFullPath(e);return this.getDirEntryFilesRecursively(t)}async getDirEntryFilesRecursively(e){try{const t=[],s=await i.readDir(e);for(const r of s)if(r.isDirectory){if(l.has(r.name))continue;const a=await i.join(e,r.name),c=await this.getDirEntryFilesRecursively(a);t.push(...c)}else{const a=await i.join(e,r.name),c=await i.PathUtils.relative(this.baseDir,a);t.push(c)}return t}catch(t){return t.includes("forbidden path")||console.error(t),[]}}async get(e){const t=await this.getFullPath(e);try{return await i.readTextFile(t)}catch(s){if(d(s))return null;try{if(!await i.exists(t))return null}catch{}throw console.error(s),s}}async has(e){const t=await this.getFullPath(e);return await i.exists(t)}async set(e,t){if(!this.writeExcludedKeys.has(e)){this.cancelWriteEndTimer(e),this.emit("write-start",e);try{const s=await this.getFullPath(e),r=i.sep(),a=s.split(r).slice(0,-1).join(r);await i.mkdir(a,{recursive:!0}),await i.writeTextFile(s,t)}finally{this.scheduleWriteEnd(e)}}}async remove(e){if(!this.writeExcludedKeys.has(e)){this.cancelWriteEndTimer(e),this.emit("write-start",e);try{const t=await this.getFullPath(e);await i.remove(t)}catch(t){!t.includes("No such file or directory")&&!t.includes("forbidden path")&&console.error(t)}finally{this.scheduleWriteEnd(e)}}}cancelWriteEndTimer(e){const t=this.writeEndTimers.get(e);t&&(clearTimeout(t),this.writeEndTimers.delete(e))}scheduleWriteEnd(e){this.cancelWriteEndTimer(e);const t=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,t)}async rename(e,t){const s=await this.getFullPath(e),r=await this.getFullPath(t);await i.rename(s,r)}async getFullPath(e){return await i.join(this.baseDir,e??"")}}exports.TauriFileSystemAdapter=h;