apps 0.0.1-beta.37 → 0.0.1-beta.39

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 (81) hide show
  1. package/framework-reference.json +1 -1
  2. package/js/{chunk-GHDZEEPO.js → chunk-27TDXHRX.js} +395 -82
  3. package/js/{chunk-KOOJUMLR.js → chunk-3MMG2H6M.js} +2 -2
  4. package/js/{chunk-LQBR7AI7.js → chunk-3V575NIW.js} +217 -19
  5. package/js/{chunk-U74JVKTQ.js → chunk-5NIEOXRZ.js} +7 -7
  6. package/js/{chunk-BWUHMKHQ.js → chunk-5TJA7364.js} +2 -2
  7. package/js/{chunk-7KEKFBV7.js → chunk-7CSHVXVR.js} +3 -3
  8. package/js/{chunk-3LRFKLUX.js → chunk-BO4US6DZ.js} +9 -49
  9. package/js/{chunk-A4O72Z3A.js → chunk-DKUEYTYD.js} +167 -30
  10. package/js/{chunk-ENJCQWVF.js → chunk-E4BWL7KQ.js} +3 -3
  11. package/js/{chunk-CAOHGMNW.js → chunk-F3TBO2U3.js} +7 -94
  12. package/js/{chunk-POOIHRPF.js → chunk-GHXRRFZA.js} +11 -34
  13. package/js/{chunk-RSNZDT4L.js → chunk-JTMDWPCH.js} +2 -2
  14. package/js/{chunk-YW333DH3.js → chunk-KANDIVIH.js} +4 -4
  15. package/js/{chunk-2FWXCU5I.js → chunk-KAQD3DTI.js} +1 -1
  16. package/js/{chunk-QQKHJ72Y.js → chunk-LVWX4UWK.js} +9 -9
  17. package/js/{chunk-KEZ4YZSP.js → chunk-MLHNVYHT.js} +2 -2
  18. package/js/{chunk-IJQ5LE74.js → chunk-MXDKXAY4.js} +363 -401
  19. package/js/{chunk-BI6R577B.js → chunk-P7MGDPFD.js} +2 -2
  20. package/js/{chunk-24EIFQYZ.js → chunk-PCV73KVK.js} +35 -10
  21. package/js/{chunk-JU7F4PRK.js → chunk-RIXVGVA6.js} +2 -2
  22. package/js/{chunk-D45FU4TZ.js → chunk-SDHD6J37.js} +3 -3
  23. package/js/{chunk-UCOMVHGW.js → chunk-U5PFZDVB.js} +2 -2
  24. package/js/{chunk-PHO7HXTC.js → chunk-VIU2XXA7.js} +294 -47
  25. package/js/{chunk-TADLIUEU.js → chunk-VJQXXOQ3.js} +2 -2
  26. package/js/{chunk-NHCFIWN5.js → chunk-W2NV54JD.js} +1 -1
  27. package/js/{chunk-BI45HZWM.js → chunk-YQ35E7KS.js} +1 -1
  28. package/js/{chunk-WDBUOIWV.js → chunk-ZUKBIHMK.js} +3 -3
  29. package/js/client.js +13 -17
  30. package/js/contracts.js +16 -21
  31. package/js/effect.js +19 -24
  32. package/js/graphql.js +21 -26
  33. package/js/host.js +19 -24
  34. package/js/index.js +13 -26
  35. package/js/mcp/effect.js +21 -26
  36. package/js/mcp/stdio.js +21 -26
  37. package/js/mcp.js +23 -28
  38. package/js/openapi.js +17 -21
  39. package/js/react.js +2 -3
  40. package/js/skills/effect.js +6 -7
  41. package/js/skills.js +15 -17
  42. package/js/storage/facet.js +1 -214
  43. package/js/ui/auth/contracts.js +2 -2
  44. package/js/ui/auth.js +5 -5
  45. package/js/ui/contracts.js +5 -6
  46. package/js/ui/serving.js +10 -11
  47. package/package.json +1 -2
  48. package/runtime.json +1 -1
  49. package/types/apps/src/contracts/app.d.ts +0 -2
  50. package/types/apps/src/contracts/context.d.ts +12 -11
  51. package/types/apps/src/contracts/host.d.ts +10 -8
  52. package/types/apps/src/contracts/live.d.ts +2 -0
  53. package/types/apps/src/contracts/operations.d.ts +3 -3
  54. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  55. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  56. package/types/apps/src/contracts/protocols/4.d.ts +3 -3
  57. package/types/apps/src/contracts/protocols/5.d.ts +1 -1
  58. package/types/apps/src/contracts/protocols/6.d.ts +1 -1
  59. package/types/apps/src/contracts/protocols/7.d.ts +1 -1
  60. package/types/apps/src/contracts/sql.d.ts +58 -0
  61. package/types/apps/src/facet.d.ts +4 -5
  62. package/types/apps/src/implementation/openapi-compile.d.ts +2 -2
  63. package/types/apps/src/implementation/schema.d.ts +1 -10
  64. package/types/apps/src/implementation/sql.d.ts +66 -0
  65. package/types/apps/src/index.d.ts +1 -2
  66. package/types/telemetry/src/transport.d.ts +8 -1
  67. package/js/chunk-73AV3JVU.js +0 -186
  68. package/js/chunk-HDAQBRT5.js +0 -1254
  69. package/js/chunk-IU7CCCUC.js +0 -630
  70. package/js/chunk-NHUHTWAF.js +0 -0
  71. package/js/chunk-V5DWGYRK.js +0 -268
  72. package/js/chunk-Y3XN4X4Q.js +0 -19
  73. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  74. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  75. package/types/app-data/src/implementation/promise.d.ts +0 -68
  76. package/types/app-data/src/implementation/range.d.ts +0 -8
  77. package/types/app-data/src/implementation/schema.d.ts +0 -18
  78. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  79. package/types/app-data/src/index.d.ts +0 -4
  80. package/types/apps/src/contracts/storage.d.ts +0 -68
  81. package/types/apps/src/implementation/storage.d.ts +0 -15
@@ -1,9 +1,3 @@
1
- import {
2
- Reactivity,
3
- invalidate,
4
- layer,
5
- mutation
6
- } from "./chunk-HDAQBRT5.js";
7
1
  import {
8
2
  Boolean,
9
3
  Cause,
@@ -43,6 +37,7 @@ import {
43
37
  constTrue,
44
38
  constVoid,
45
39
  constant,
40
+ context,
46
41
  contextWith,
47
42
  declareConstructor,
48
43
  decodeEffect,
@@ -65,6 +60,7 @@ import {
65
60
  fail4 as fail3,
66
61
  failCause,
67
62
  failCause2,
63
+ failCauseUnsafe,
68
64
  filter,
69
65
  filter2,
70
66
  filterInterruptors,
@@ -75,9 +71,11 @@ import {
75
71
  flatMap2,
76
72
  flatMapEager,
77
73
  flatMapNullishOr,
74
+ flow,
78
75
  forkDetach,
79
76
  fromInputUnsafe,
80
77
  fromJsonString,
78
+ fromQueue,
81
79
  gen,
82
80
  get,
83
81
  get3 as get2,
@@ -87,6 +85,7 @@ import {
87
85
  getOrNull,
88
86
  getOrThrowWith,
89
87
  getOrUndefined,
88
+ getOrUndefined2,
90
89
  getStackTraceLimit,
91
90
  getSuccess,
92
91
  getUnsafe,
@@ -109,6 +108,7 @@ import {
109
108
  joinAll,
110
109
  lastNonEmpty,
111
110
  link,
111
+ make3 as make,
112
112
  makeCompositeAtKey,
113
113
  makeMemoMapUnsafe,
114
114
  makeUnsafe2 as makeUnsafe,
@@ -124,14 +124,17 @@ import {
124
124
  never,
125
125
  none,
126
126
  offerUnsafe,
127
+ onExit,
127
128
  pipe,
128
129
  pipeArguments,
129
130
  provide2 as provide,
130
131
  provideMerge,
132
+ provideService,
131
133
  remove3 as remove,
132
134
  runCallbackWith,
133
135
  runForEachArray,
134
136
  runForkWith,
137
+ runIn,
135
138
  runSync,
136
139
  runSyncWith,
137
140
  scope,
@@ -148,6 +151,7 @@ import {
148
151
  symbol,
149
152
  symbol2,
150
153
  sync2 as sync,
154
+ tap,
151
155
  toCodecJson,
152
156
  toMillis,
153
157
  toPull,
@@ -158,7 +162,7 @@ import {
158
162
  void_2,
159
163
  whileLoop,
160
164
  zipRight
161
- } from "./chunk-IJQ5LE74.js";
165
+ } from "./chunk-MXDKXAY4.js";
162
166
  import {
163
167
  __export
164
168
  } from "./chunk-CZ7CSFO4.js";
@@ -610,27 +614,27 @@ __export(AtomRegistry_exports, {
610
614
  batchState: () => batchState,
611
615
  getResult: () => getResult,
612
616
  isAtomRegistry: () => isAtomRegistry,
613
- layer: () => layer2,
617
+ layer: () => layer,
614
618
  layerOptions: () => layerOptions,
615
- make: () => make,
619
+ make: () => make2,
616
620
  mount: () => mount,
617
621
  toStream: () => toStream,
618
622
  toStreamResult: () => toStreamResult
619
623
  });
620
624
  var TypeId2 = "~effect/reactivity/AtomRegistry";
621
625
  var isAtomRegistry = (u) => hasProperty(u, TypeId2);
622
- var make = (options) => new RegistryImpl(options?.initialValues, options?.scheduleTask, options?.timeoutResolution, options?.defaultIdleTTL);
626
+ var make2 = (options) => new RegistryImpl(options?.initialValues, options?.scheduleTask, options?.timeoutResolution, options?.defaultIdleTTL);
623
627
  var AtomRegistry = /* @__PURE__ */ Service(TypeId2);
624
628
  var layerOptions = (options) => effect(AtomRegistry, gen(function* () {
625
629
  const scope2 = yield* scope;
626
- const registry = make({
630
+ const registry = make2({
627
631
  ...options,
628
632
  scheduleTask: options?.scheduleTask
629
633
  });
630
634
  yield* addFinalizer(scope2, sync(() => registry.dispose()));
631
635
  return registry;
632
636
  }));
633
- var layer2 = /* @__PURE__ */ layerOptions();
637
+ var layer = /* @__PURE__ */ layerOptions();
634
638
  var toStream = /* @__PURE__ */ dual(2, (self, atom) => callback2((queue) => suspend(() => {
635
639
  const fiber = getCurrent();
636
640
  const scope2 = getUnsafe(fiber.context, Scope);
@@ -1442,11 +1446,11 @@ __export(Atom_exports, {
1442
1446
  Reset: () => Reset,
1443
1447
  SerializableTypeId: () => SerializableTypeId2,
1444
1448
  ServerValueTypeId: () => ServerValueTypeId,
1445
- TypeId: () => TypeId3,
1449
+ TypeId: () => TypeId4,
1446
1450
  WritableTypeId: () => WritableTypeId,
1447
1451
  autoDispose: () => autoDispose,
1448
1452
  batch: () => batch2,
1449
- context: () => context,
1453
+ context: () => context2,
1450
1454
  debounce: () => debounce,
1451
1455
  family: () => family,
1452
1456
  fn: () => fn,
@@ -1460,7 +1464,7 @@ __export(Atom_exports, {
1460
1464
  isWritable: () => isWritable,
1461
1465
  keepAlive: () => keepAlive,
1462
1466
  kvs: () => kvs,
1463
- make: () => make2,
1467
+ make: () => make4,
1464
1468
  makeRefreshOnSignal: () => makeRefreshOnSignal,
1465
1469
  map: () => map5,
1466
1470
  mapResult: () => mapResult,
@@ -1495,6 +1499,139 @@ __export(Atom_exports, {
1495
1499
  writable: () => writable
1496
1500
  });
1497
1501
 
1502
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/Reactivity.js
1503
+ var TypeId3 = "~effect/reactivity/Reactivity";
1504
+ var Reactivity = /* @__PURE__ */ Service("effect/reactivity/Reactivity");
1505
+ var make3 = /* @__PURE__ */ sync(() => {
1506
+ const handlers = /* @__PURE__ */ new Map();
1507
+ const invalidateUnsafe = (keys) => {
1508
+ keysToHashes(keys, (hash2) => {
1509
+ const set4 = handlers.get(hash2);
1510
+ if (set4 === void 0) return;
1511
+ set4.forEach((run) => run());
1512
+ });
1513
+ };
1514
+ const invalidate2 = (keys) => contextWith((services) => {
1515
+ const pending = getOrUndefined2(services, PendingInvalidation);
1516
+ if (pending) {
1517
+ keysToHashes(keys, (hash2) => {
1518
+ pending.add(hash2);
1519
+ });
1520
+ } else {
1521
+ invalidateUnsafe(keys);
1522
+ }
1523
+ return void_2;
1524
+ });
1525
+ const mutation2 = (keys, effect3) => tap(effect3, invalidate2(keys));
1526
+ const registerUnsafe = (keys, handler) => {
1527
+ const resolvedKeys = [];
1528
+ keysToHashes(keys, (hash2) => {
1529
+ resolvedKeys.push(hash2);
1530
+ let set4 = handlers.get(hash2);
1531
+ if (set4 === void 0) {
1532
+ set4 = /* @__PURE__ */ new Set();
1533
+ handlers.set(hash2, set4);
1534
+ }
1535
+ set4.add(handler);
1536
+ });
1537
+ return () => {
1538
+ for (let i = 0; i < resolvedKeys.length; i++) {
1539
+ const set4 = handlers.get(resolvedKeys[i]);
1540
+ if (set4 === void 0) continue;
1541
+ set4.delete(handler);
1542
+ if (set4.size === 0) {
1543
+ handlers.delete(resolvedKeys[i]);
1544
+ }
1545
+ }
1546
+ };
1547
+ };
1548
+ const query = (keys, effect3) => gen(function* () {
1549
+ const services = yield* context();
1550
+ const scope2 = get(services, Scope);
1551
+ const results = yield* make();
1552
+ const runFork = flow(runForkWith(services), runIn(scope2));
1553
+ let running = false;
1554
+ let pending = false;
1555
+ const handleExit = (exit) => {
1556
+ if (exit._tag === "Failure") {
1557
+ failCauseUnsafe(results, exit.cause);
1558
+ } else {
1559
+ offerUnsafe(results, exit.value);
1560
+ }
1561
+ if (pending) {
1562
+ pending = false;
1563
+ runFork(effect3).addObserver(handleExit);
1564
+ } else {
1565
+ running = false;
1566
+ }
1567
+ };
1568
+ function run() {
1569
+ if (running) {
1570
+ pending = true;
1571
+ return;
1572
+ }
1573
+ running = true;
1574
+ runFork(effect3).addObserver(handleExit);
1575
+ }
1576
+ const cancel = registerUnsafe(keys, run);
1577
+ yield* addFinalizer(scope2, sync(cancel));
1578
+ run();
1579
+ return results;
1580
+ });
1581
+ const stream2 = (tables, effect3) => query(tables, effect3).pipe(map2(fromQueue), unwrap);
1582
+ const withBatch = (effect3) => suspend(() => {
1583
+ const pending = /* @__PURE__ */ new Set();
1584
+ return effect3.pipe(provideService(PendingInvalidation, pending), onExit((_) => sync(() => {
1585
+ pending.forEach((hash2) => {
1586
+ const set4 = handlers.get(hash2);
1587
+ if (set4 === void 0) return;
1588
+ set4.forEach((run) => run());
1589
+ });
1590
+ })));
1591
+ });
1592
+ return Reactivity.of({
1593
+ [TypeId3]: TypeId3,
1594
+ mutation: mutation2,
1595
+ query,
1596
+ stream: stream2,
1597
+ invalidateUnsafe,
1598
+ invalidate: invalidate2,
1599
+ registerUnsafe,
1600
+ withBatch
1601
+ });
1602
+ });
1603
+ var PendingInvalidation = class extends (/* @__PURE__ */ Service()("effect/reactivity/Reactivity/PendingInvalidation")) {
1604
+ };
1605
+ var mutation = /* @__PURE__ */ dual(2, (effect3, keys) => Reactivity.use((_) => _.mutation(keys, effect3)));
1606
+ var invalidate = (keys) => Reactivity.use((r) => r.invalidate(keys));
1607
+ var layer2 = /* @__PURE__ */ effect(Reactivity)(make3);
1608
+ function stringOrHash(u) {
1609
+ switch (typeof u) {
1610
+ case "string":
1611
+ case "number":
1612
+ case "bigint":
1613
+ case "boolean":
1614
+ return String(u);
1615
+ default:
1616
+ return hash(u);
1617
+ }
1618
+ }
1619
+ var keysToHashes = (keys, f) => {
1620
+ if (Array.isArray(keys)) {
1621
+ for (let i = 0; i < keys.length; i++) {
1622
+ f(stringOrHash(keys[i]));
1623
+ }
1624
+ return;
1625
+ }
1626
+ for (const key in keys) {
1627
+ f(key);
1628
+ const ids = keys[key];
1629
+ for (let i = 0; i < ids.length; i++) {
1630
+ f(`${key}:${stringOrHash(ids[i])}`);
1631
+ }
1632
+ }
1633
+ };
1634
+
1498
1635
  // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/persistence/KeyValueStore.js
1499
1636
  var ErrorTypeId = "~effect/persistence/KeyValueStore/KeyValueStoreError";
1500
1637
  var KeyValueStoreError = class extends (/* @__PURE__ */ TaggedError("KeyValueStoreError")) {
@@ -1539,8 +1676,8 @@ var toSchemaStore = (self, schema) => {
1539
1676
  };
1540
1677
 
1541
1678
  // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/Atom.js
1542
- var TypeId3 = "~effect/reactivity/Atom";
1543
- var isAtom = (u) => hasProperty(u, TypeId3);
1679
+ var TypeId4 = "~effect/reactivity/Atom";
1680
+ var isAtom = (u) => hasProperty(u, TypeId4);
1544
1681
  var WritableTypeId = "~effect/reactivity/Atom/Writable";
1545
1682
  var setIdleTTL = /* @__PURE__ */ dual(2, (self, durationInput) => {
1546
1683
  const duration = fromInputUnsafe(durationInput);
@@ -1553,7 +1690,7 @@ var setIdleTTL = /* @__PURE__ */ dual(2, (self, durationInput) => {
1553
1690
  });
1554
1691
  var removeTtl = /* @__PURE__ */ setIdleTTL(0);
1555
1692
  var AtomProto = {
1556
- [TypeId3]: TypeId3,
1693
+ [TypeId4]: TypeId4,
1557
1694
  equals: Object.is,
1558
1695
  ...PipeInspectableProto,
1559
1696
  toJSON() {
@@ -1651,9 +1788,9 @@ var writable = (read, write, refresh2) => {
1651
1788
  function constSetSelf(ctx, value2) {
1652
1789
  ctx.setSelf(value2);
1653
1790
  }
1654
- var make2 = (arg, options) => {
1791
+ var make4 = (arg, options) => {
1655
1792
  const readOrAtom = makeRead(arg, options);
1656
- if (TypeId3 in readOrAtom) {
1793
+ if (TypeId4 in readOrAtom) {
1657
1794
  return readOrAtom;
1658
1795
  }
1659
1796
  return readable(readOrAtom);
@@ -1723,9 +1860,9 @@ function makeEffect(ctx, effect3, initialValue2, services = empty(), uninterrupt
1723
1860
  }
1724
1861
  return waiting(initialValue2);
1725
1862
  }
1726
- function runCallbackSync(services, effect3, onExit, uninterruptible = false) {
1863
+ function runCallbackSync(services, effect3, onExit2, uninterruptible = false) {
1727
1864
  if (isExit(effect3)) {
1728
- onExit(effect3);
1865
+ onExit2(effect3);
1729
1866
  return void 0;
1730
1867
  }
1731
1868
  const runFork = runForkWith(services);
@@ -1733,10 +1870,10 @@ function runCallbackSync(services, effect3, onExit, uninterruptible = false) {
1733
1870
  fiber.currentDispatcher?.flush();
1734
1871
  const result = fiber.pollUnsafe();
1735
1872
  if (result) {
1736
- onExit(result);
1873
+ onExit2(result);
1737
1874
  return void 0;
1738
1875
  }
1739
- const remove2 = fiber.addObserver(onExit);
1876
+ const remove2 = fiber.addObserver(onExit2);
1740
1877
  function cancel() {
1741
1878
  remove2();
1742
1879
  if (!uninterruptible) {
@@ -1745,10 +1882,10 @@ function runCallbackSync(services, effect3, onExit, uninterruptible = false) {
1745
1882
  }
1746
1883
  return cancel;
1747
1884
  }
1748
- function context(options) {
1749
- const memoMap = options?.memoMap ?? removeTtl(make2(() => makeMemoMapUnsafe()));
1885
+ function context2(options) {
1886
+ const memoMap = options?.memoMap ?? removeTtl(make4(() => makeMemoMapUnsafe()));
1750
1887
  const resolveMemoMap = (get5) => isAtom(memoMap) ? get5(memoMap) : memoMap;
1751
- let globalLayer = layer;
1888
+ let globalLayer = layer2;
1752
1889
  function factory(create) {
1753
1890
  const self = Object.create(RuntimeProto);
1754
1891
  self.keepAlive = false;
@@ -1768,9 +1905,9 @@ function context(options) {
1768
1905
  }
1769
1906
  factory.memoMap = memoMap;
1770
1907
  factory.addGlobalLayer = (layer3) => {
1771
- globalLayer = provideMerge(globalLayer, provide(layer3, layer));
1908
+ globalLayer = provideMerge(globalLayer, provide(layer3, layer2));
1772
1909
  };
1773
- const reactivityAtom = removeTtl(make2((get5) => contextWith((services) => buildWithMemoMap(layer, resolveMemoMap(get5), get(services, Scope))).pipe(map2(get(Reactivity)))));
1910
+ const reactivityAtom = removeTtl(make4((get5) => contextWith((services) => buildWithMemoMap(layer2, resolveMemoMap(get5), get(services, Scope))).pipe(map2(get(Reactivity)))));
1774
1911
  factory.withReactivity = (keys) => (atom) => transform2(atom, (get5) => {
1775
1912
  const reactivity = getOrThrow(get5(reactivityAtom));
1776
1913
  get5.addFinalizer(reactivity.registerUnsafe(keys, () => {
@@ -1783,7 +1920,7 @@ function context(options) {
1783
1920
  });
1784
1921
  return factory;
1785
1922
  }
1786
- var runtime = /* @__PURE__ */ context();
1923
+ var runtime = /* @__PURE__ */ context2();
1787
1924
  var withReactivity = runtime.withReactivity;
1788
1925
  var stream = (get5, stream2, options, services) => {
1789
1926
  const initialValue2 = options?.initialValue !== void 0 ? success(options.initialValue) : initial();
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  ProviderError,
3
3
  maxUpstreamMessageLength
4
- } from "./chunk-BI6R577B.js";
4
+ } from "./chunk-P7MGDPFD.js";
5
5
  import {
6
6
  AccountId
7
- } from "./chunk-BI45HZWM.js";
7
+ } from "./chunk-YQ35E7KS.js";
8
8
  import {
9
9
  Option_exports,
10
10
  Schema_exports
11
- } from "./chunk-IJQ5LE74.js";
11
+ } from "./chunk-MXDKXAY4.js";
12
12
 
13
13
  // src/implementation/upstream-error.ts
14
14
  var ErrorToken = Schema_exports.String.check(Schema_exports.isPattern(/^[A-Za-z0-9._-]{1,128}$/));
@@ -1,34 +1,24 @@
1
- import {
2
- promiseTable
3
- } from "./chunk-IU7CCCUC.js";
4
1
  import {
5
2
  declaredOperations,
6
3
  fromPromise,
7
4
  nativeOperation,
8
5
  nativeRouter
9
- } from "./chunk-7KEKFBV7.js";
6
+ } from "./chunk-7CSHVXVR.js";
10
7
  import {
11
8
  ScheduleTiming
12
- } from "./chunk-LQBR7AI7.js";
13
- import {
14
- DatabaseSchema
15
- } from "./chunk-73AV3JVU.js";
9
+ } from "./chunk-3V575NIW.js";
16
10
  import {
17
11
  decoderOf,
18
12
  isSchema,
19
- schemaArgument,
20
- storageFieldOf
21
- } from "./chunk-POOIHRPF.js";
22
- import {
23
- AppStorageUnavailable
24
- } from "./chunk-Y3XN4X4Q.js";
13
+ schemaArgument
14
+ } from "./chunk-GHXRRFZA.js";
25
15
  import {
26
16
  JsonValue
27
- } from "./chunk-BI45HZWM.js";
17
+ } from "./chunk-YQ35E7KS.js";
28
18
  import {
29
19
  Effect_exports,
30
20
  Schema_exports
31
- } from "./chunk-IJQ5LE74.js";
21
+ } from "./chunk-MXDKXAY4.js";
32
22
 
33
23
  // src/contracts/http.ts
34
24
  var ResponseStatusError = class extends Schema_exports.TaggedError()(
@@ -147,7 +137,6 @@ var defineApp = (requirements, definition) => {
147
137
  const factory = fromPromise(evaluate);
148
138
  const native = {
149
139
  accounts: requirements.accounts,
150
- ...requirements.database === void 0 ? {} : { database: requirements.database },
151
140
  evaluate: (context) => factory(context).pipe(Effect_exports.map((value) => adaptDefinition(value)))
152
141
  };
153
142
  return {
@@ -157,87 +146,11 @@ var defineApp = (requirements, definition) => {
157
146
  };
158
147
  };
159
148
 
160
- // src/implementation/storage.ts
161
- var table = (fields) => tableWithIndexes(fields, []);
162
- var tableWithIndexes = (fields, indexes) => ({
163
- fields,
164
- indexes,
165
- index: (name, fieldsInIndex) => tableWithIndexes(fields, [...indexes, { name, fields: fieldsInIndex }])
166
- });
167
- var serialize = (tables) => {
168
- const definitions = Object.fromEntries(
169
- Object.entries(tables).map(([name, table2]) => [
170
- name,
171
- {
172
- fields: Object.fromEntries(
173
- Object.entries(table2.fields).map(([fieldName, schema]) => {
174
- const field = storageFieldOf(schema);
175
- if (field === void 0) throw new Error("Database columns must use a scalar schema");
176
- return [fieldName, field];
177
- })
178
- ),
179
- indexes: table2.indexes
180
- }
181
- ])
182
- );
183
- return Schema_exports.decodeUnknownSync(DatabaseSchema)(definitions);
184
- };
185
- var authorDatabase = (tables, session, signal, writable) => {
186
- return Object.fromEntries(
187
- Object.entries(tables).map(([name, table2]) => {
188
- const api = promiseTable(session, name, signal);
189
- const parseFields = (input, partial) => {
190
- const values = Schema_exports.decodeUnknownSync(
191
- Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown)
192
- )(input);
193
- const fields = {};
194
- for (const [key, value] of Object.entries(values)) {
195
- if (value === void 0) continue;
196
- const field = Object.hasOwn(table2.fields, key) ? table2.fields[key] : void 0;
197
- if (field === void 0) throw new Error("Unknown database column");
198
- const definition = storageFieldOf(field);
199
- fields[key] = value === null && definition?.optional ? null : field.parse(value);
200
- }
201
- if (!partial) {
202
- for (const [key, field] of Object.entries(table2.fields))
203
- if (!Object.hasOwn(fields, key)) {
204
- const value = field.parse(void 0);
205
- if (value !== void 0) fields[key] = value;
206
- }
207
- }
208
- return fields;
209
- };
210
- const read = { get: api.get, withIndex: api.withIndex };
211
- return [
212
- name,
213
- writable ? {
214
- ...read,
215
- insert: (value) => api.insert(parseFields(value, false)),
216
- update: (id, value) => api.update(id, parseFields(value, true)),
217
- delete: api.delete
218
- } : read
219
- ];
220
- })
221
- );
222
- };
223
- var defineDatabase = (tables) => ({
224
- schema: serialize(tables),
225
- tables
226
- });
227
- var unavailableStorage = {
228
- read: () => Effect_exports.fail(new AppStorageUnavailable()),
229
- mutate: () => Effect_exports.fail(new AppStorageUnavailable())
230
- };
231
-
232
149
  export {
233
150
  ResponseStatusError,
234
151
  ResponseDecodeError,
235
152
  workflow,
236
153
  isApp,
237
154
  toEffectApp,
238
- defineApp,
239
- table,
240
- authorDatabase,
241
- defineDatabase,
242
- unavailableStorage
155
+ defineApp
243
156
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  JsonObject,
3
3
  ValidationError
4
- } from "./chunk-BI45HZWM.js";
4
+ } from "./chunk-YQ35E7KS.js";
5
5
  import {
6
6
  Cause_exports,
7
7
  Effect_exports,
@@ -10,7 +10,7 @@ import {
10
10
  SchemaIssue_exports,
11
11
  SchemaParser_exports,
12
12
  Schema_exports
13
- } from "./chunk-IJQ5LE74.js";
13
+ } from "./chunk-MXDKXAY4.js";
14
14
 
15
15
  // ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
16
16
  function deepCompareStrict(a, b) {
@@ -107,9 +107,9 @@ var ignoredKeyword = {
107
107
  var initialBaseURI = typeof self !== "undefined" && self.location && self.location.origin !== "null" ? new URL(self.location.origin + self.location.pathname + location.search) : new URL("https://github.com/cfworker");
108
108
  function dereference(schema, lookup = /* @__PURE__ */ Object.create(null), baseURI = initialBaseURI, basePointer = "") {
109
109
  if (schema && typeof schema === "object" && !Array.isArray(schema)) {
110
- const id2 = schema.$id || schema.id;
111
- if (id2) {
112
- const url = new URL(id2, baseURI.href);
110
+ const id = schema.$id || schema.id;
111
+ if (id) {
112
+ const url = new URL(id, baseURI.href);
113
113
  if (url.hash.length > 1) {
114
114
  lookup[url.href] = schema;
115
115
  } else {
@@ -1069,7 +1069,6 @@ function schemaPattern(pattern) {
1069
1069
  }
1070
1070
 
1071
1071
  // src/implementation/schema.ts
1072
- var StorageField = /* @__PURE__ */ Symbol("apps.StorageField");
1073
1072
  var Decoder = /* @__PURE__ */ Symbol("apps.Schema");
1074
1073
  var decoderOf = (schema) => schema[Decoder];
1075
1074
  var isSchema = (value) => typeof value === "object" && value !== null && Decoder in value;
@@ -1083,33 +1082,18 @@ var schemaArgument = (value, role) => {
1083
1082
  var parse = (decoder, input) => Effect_exports.suspend(() => Schema_exports.decodeUnknownEffect(decoder)(input)).pipe(
1084
1083
  Effect_exports.mapError(() => new ValidationError())
1085
1084
  );
1086
- function wrap(decoder, optionalValue, field) {
1085
+ function wrap(decoder, optionalValue) {
1087
1086
  return {
1088
1087
  [Decoder]: decoder,
1089
- ...field === void 0 ? {} : { [StorageField]: field },
1090
1088
  optionalValue,
1091
1089
  parse: (input) => Effect_exports.runSync(parse(decoder, input)),
1092
- optional: () => wrap(
1093
- Schema_exports.optional(decoder),
1094
- true,
1095
- field === void 0 ? void 0 : { ...field, optional: true }
1096
- ),
1090
+ optional: () => wrap(Schema_exports.optional(decoder), true),
1097
1091
  default: (value) => {
1098
1092
  const parsed = Effect_exports.runSync(parse(decoder, value));
1099
1093
  return {
1100
1094
  ...wrap(
1101
1095
  decoder.annotate({ default: parsed }).pipe(Schema_exports.withDecodingDefault(Effect_exports.succeed(parsed))),
1102
- false,
1103
- field === void 0 || parsed === void 0 ? void 0 : {
1104
- ...field,
1105
- default: Schema_exports.decodeUnknownSync(
1106
- Schema_exports.Union([
1107
- Schema_exports.String,
1108
- Schema_exports.Finite,
1109
- Schema_exports.Boolean
1110
- ])
1111
- )(parsed)
1112
- }
1096
+ false
1113
1097
  ),
1114
1098
  hasDefault: true,
1115
1099
  inputOptional: optionalValue
@@ -1120,12 +1104,11 @@ function wrap(decoder, optionalValue, field) {
1120
1104
  function string(options = {}) {
1121
1105
  return wrap(
1122
1106
  options.minLength === void 0 ? Schema_exports.String : Schema_exports.String.check(Schema_exports.isMinLength(options.minLength)),
1123
- false,
1124
- { kind: "string" }
1107
+ false
1125
1108
  );
1126
1109
  }
1127
- var number = () => wrap(Schema_exports.Finite, false, { kind: "number" });
1128
- var boolean = () => wrap(Schema_exports.Boolean, false, { kind: "boolean" });
1110
+ var number = () => wrap(Schema_exports.Finite, false);
1111
+ var boolean = () => wrap(Schema_exports.Boolean, false);
1129
1112
  var json = () => wrap(Schema_exports.Json, false);
1130
1113
  var record = (value) => wrap(
1131
1114
  Schema_exports.Record(
@@ -1752,9 +1735,6 @@ var jsonSchema = (input) => {
1752
1735
  false
1753
1736
  );
1754
1737
  };
1755
- var storageFieldOf = (schema) => schema[StorageField];
1756
- var id = (table) => wrap(Schema_exports.NonEmptyString, false, { kind: "id", references: table });
1757
- var userId = () => wrap(Schema_exports.NonEmptyString, false, { kind: "userId" });
1758
1738
  var jsonSchemaDocument = (decoder) => {
1759
1739
  const imported = importedJsonSchema(decoder);
1760
1740
  if (imported !== void 0) return Schema_exports.decodeUnknownEffect(JsonObject)(imported);
@@ -1797,8 +1777,5 @@ export {
1797
1777
  preparedJsonSchemaDecoder,
1798
1778
  jsonSchemaDecoder,
1799
1779
  jsonSchema,
1800
- storageFieldOf,
1801
- id,
1802
- userId,
1803
1780
  jsonSchemaDocument
1804
1781
  };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  appSignInCallbackPath
3
- } from "./chunk-NHCFIWN5.js";
3
+ } from "./chunk-W2NV54JD.js";
4
4
  import {
5
5
  HttpServerResponse_exports
6
- } from "./chunk-KOOJUMLR.js";
6
+ } from "./chunk-3MMG2H6M.js";
7
7
 
8
8
  // src/implementation/ui-auth.ts
9
9
  var appPrivateHeaders = {
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  CacheError
3
- } from "./chunk-BI6R577B.js";
3
+ } from "./chunk-P7MGDPFD.js";
4
4
  import {
5
5
  wrap
6
- } from "./chunk-POOIHRPF.js";
6
+ } from "./chunk-GHXRRFZA.js";
7
7
  import {
8
8
  JsonObject
9
- } from "./chunk-BI45HZWM.js";
9
+ } from "./chunk-YQ35E7KS.js";
10
10
  import {
11
11
  Duration_exports,
12
12
  Effect_exports,
13
13
  Schema_exports
14
- } from "./chunk-IJQ5LE74.js";
14
+ } from "./chunk-MXDKXAY4.js";
15
15
 
16
16
  // src/implementation/catalog-cache.ts
17
17
  var catalogScope = (options, credential, invalid) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Predicate_exports
3
- } from "./chunk-IJQ5LE74.js";
3
+ } from "./chunk-MXDKXAY4.js";
4
4
 
5
5
  // ../utils/src/recorded-message.ts
6
6
  var RecordedMessage = /* @__PURE__ */ Symbol.for("@executor-js/utils/RecordedMessage");