bleam 0.0.10 → 0.0.12

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 (90) hide show
  1. package/dist/ai.cjs +1872 -1182
  2. package/dist/ai.d.cts +267 -234
  3. package/dist/ai.d.ts +267 -234
  4. package/dist/ai.js +1859 -1167
  5. package/dist/cli.cjs +3 -183
  6. package/dist/cli.d.cts +3 -47
  7. package/dist/cli.d.ts +3 -47
  8. package/dist/cli.js +3 -183
  9. package/dist/config.d.cts +1 -1
  10. package/dist/config.d.ts +1 -1
  11. package/dist/{files-Ds1wT8C2.js → files-BXVkPrPN.js} +6 -1
  12. package/dist/{files-Bo7h9fik.cjs → files-DxaQ-Nv0.cjs} +11 -0
  13. package/dist/files.cjs +1 -1
  14. package/dist/files.js +1 -1
  15. package/dist/index.d.cts +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/platform.cjs +1 -13
  18. package/dist/platform.d.cts +1 -28
  19. package/dist/platform.d.ts +1 -28
  20. package/dist/platform.js +1 -10
  21. package/dist/schema-B5BfdswF.js +226 -0
  22. package/dist/schema-BnVZOXfu.cjs +286 -0
  23. package/dist/schema-D5eImHxu.d.cts +125 -0
  24. package/dist/schema-SSjokbtw.d.ts +125 -0
  25. package/dist/schema.cjs +10 -2
  26. package/dist/schema.d.cts +2 -2
  27. package/dist/schema.d.ts +2 -2
  28. package/dist/schema.js +2 -2
  29. package/dist/state-Dh3HLixb.js +874 -0
  30. package/dist/state-LssDgpff.cjs +973 -0
  31. package/dist/state.cjs +16 -12
  32. package/dist/state.d.cts +144 -140
  33. package/dist/state.d.ts +145 -140
  34. package/dist/state.js +3 -3
  35. package/dist/{ui-Bg11tvlc.d.ts → ui-1WepaMS4.d.cts} +1 -1
  36. package/dist/{ui-Dd7SXdbg.d.cts → ui-D7bRLYee.d.ts} +7 -7
  37. package/dist/ui.d.cts +1 -1
  38. package/dist/ui.d.ts +1 -1
  39. package/dist/window.d.cts +1 -1
  40. package/dist/window.d.ts +1 -1
  41. package/package.json +3 -1
  42. package/templates/foundation-models/app/index.tsx +77 -15
  43. package/templates/image-generation/app/index.tsx +4 -2
  44. package/templates/native/ios/Bleam/AI/Flux2/Configuration/ModelRegistry.swift +1 -1
  45. package/templates/native/ios/Bleam/AI/Flux2/Pipeline/FluxImageRunner.swift +7 -2
  46. package/templates/native/ios/Bleam/AI/TextGeneration/Bonsai/BonsaiTextGenerator.swift +46 -0
  47. package/templates/native/ios/Bleam/AI/TextGeneration/Bonsai/BonsaiTextModel.swift +107 -0
  48. package/templates/native/ios/Bleam/AI/TextGeneration/Bonsai/BonsaiTextSnapshotValidator.swift +201 -0
  49. package/templates/native/ios/Bleam/AI/TextGeneration/Core/GenerationTypes.swift +85 -0
  50. package/templates/native/ios/Bleam/AI/TextGeneration/Core/ModelCapabilities.swift +21 -0
  51. package/templates/native/ios/Bleam/AI/TextGeneration/Core/TextKVCache.swift +23 -0
  52. package/templates/native/ios/Bleam/AI/TextGeneration/Core/TokenSampler.swift +79 -0
  53. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3CheckpointLoader.swift +161 -0
  54. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3Configuration.swift +119 -0
  55. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3InferenceSession.swift +84 -0
  56. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3Layers.swift +197 -0
  57. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3Model.swift +130 -0
  58. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen35/Qwen35Checkpoint.swift +102 -0
  59. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen35/Qwen35Configuration.swift +140 -0
  60. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen35/Qwen35Model.swift +112 -0
  61. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen35/Qwen35Session.swift +121 -0
  62. package/templates/native/ios/Bleam/AI/TextGeneration/QwenHybrid/QwenHybridCache.swift +42 -0
  63. package/templates/native/ios/Bleam/AI/TextGeneration/QwenHybrid/QwenHybridFullAttention.swift +57 -0
  64. package/templates/native/ios/Bleam/AI/TextGeneration/QwenHybrid/QwenHybridLayers.swift +58 -0
  65. package/templates/native/ios/Bleam/AI/TextGeneration/QwenHybrid/QwenHybridLinearAttention.swift +111 -0
  66. package/templates/native/ios/Bleam/AppDelegate.swift +0 -206
  67. package/templates/native/ios/Bleam.xcodeproj/project.pbxproj +135 -129
  68. package/templates/native/ios/GenerationService/BonsaiTextGenerationRunner.swift +103 -0
  69. package/templates/native/ios/GenerationService/ImageGenerationRunner.swift +19 -7
  70. package/templates/native/ios/GenerationService/main.swift +174 -48
  71. package/templates/native/ios/Podfile.lock +173 -173
  72. package/templates/native/ios/Shared/Generation/GenerationServiceProtocol.swift +3 -0
  73. package/templates/native/ios/Shared/Generation/GenerationWorkerProtocol.swift +44 -0
  74. package/templates/native/modules/bleam-runtime/ios/AIModule.swift +239 -341
  75. package/templates/native/modules/bleam-runtime/ios/GenerationContracts.swift +47 -0
  76. package/templates/native/modules/bleam-runtime/ios/PlatformModule.swift +0 -191
  77. package/templates/text-generation/app/index.tsx +124 -0
  78. package/templates/text-generation/app.config.ts +5 -0
  79. package/templates/updates/README.md +43 -199
  80. package/templates/updates/src/index.ts +5 -98
  81. package/templates/updates/src/schema.ts +18 -173
  82. package/dist/schema-Bo5Jvqus.js +0 -90
  83. package/dist/schema-DOOjfXvs.d.ts +0 -58
  84. package/dist/schema-ENSMX_1t.d.cts +0 -58
  85. package/dist/schema-rQ13mrpD.cjs +0 -102
  86. package/dist/state-Bx0VlTlO.cjs +0 -852
  87. package/dist/state-CAwe-Vw1.js +0 -767
  88. package/templates/native/ios/PlatformHelper/main.swift +0 -726
  89. /package/dist/{config-Cms0rvqg.d.ts → config-COcRnn5a.d.cts} +0 -0
  90. /package/dist/{config-CufOVJV3.d.cts → config-Chi-flpJ.d.ts} +0 -0
@@ -0,0 +1,973 @@
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
+ const require_native_runtime = require('./native-runtime-CsXnXkQn.cjs');
3
+ const require_crypto = require('./crypto-CT3VZ7lF.cjs');
4
+ const require_schema = require('./schema-BnVZOXfu.cjs');
5
+ let jotai_react = require("jotai/react");
6
+ jotai_react = require_chunk.__toESM(jotai_react);
7
+ let jotai_vanilla = require("jotai/vanilla");
8
+ jotai_vanilla = require_chunk.__toESM(jotai_vanilla);
9
+ let jotai_family = require("jotai-family");
10
+ jotai_family = require_chunk.__toESM(jotai_family);
11
+
12
+ //#region src/app-storage.ts
13
+ let cachedStorageKey;
14
+ function launchArgument(name) {
15
+ const argumentsList = NSProcessInfo.processInfo.arguments();
16
+ const count = Number(argumentsList.count ?? 0);
17
+ for (let index = 0; index < count - 1; index += 1) if (String(argumentsList.objectAtIndex(index)) === name) return String(argumentsList.objectAtIndex(index + 1));
18
+ }
19
+ function storageKey$1(name) {
20
+ return name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "app";
21
+ }
22
+ function currentAppStorageKey() {
23
+ if (cachedStorageKey) return cachedStorageKey;
24
+ require_native_runtime.ensureNativeScript();
25
+ const configPath = launchArgument("--bleam-project-config");
26
+ if (configPath) try {
27
+ const text = String(NSString.stringWithContentsOfFileEncodingError(configPath, NSUTF8StringEncoding, null));
28
+ const config = JSON.parse(text);
29
+ if (typeof config.id === "string" && config.id) {
30
+ cachedStorageKey = config.id;
31
+ return cachedStorageKey;
32
+ }
33
+ if (typeof config.name === "string" && config.name) {
34
+ cachedStorageKey = storageKey$1(config.name);
35
+ return cachedStorageKey;
36
+ }
37
+ } catch {}
38
+ cachedStorageKey = "app";
39
+ return cachedStorageKey;
40
+ }
41
+
42
+ //#endregion
43
+ //#region src/state/atom.ts
44
+ const storedAtomsKey = Symbol.for("bleam.state.storedAtoms.v1");
45
+ function storedAtoms() {
46
+ const scope = globalThis;
47
+ scope[storedAtomsKey] ??= /* @__PURE__ */ new Map();
48
+ return scope[storedAtomsKey];
49
+ }
50
+ function asJotaiAtom(value) {
51
+ return value;
52
+ }
53
+ function asJotaiWritableAtom(value) {
54
+ return value;
55
+ }
56
+ function asAtom(value) {
57
+ return value;
58
+ }
59
+ function asWritableAtom(value) {
60
+ return value;
61
+ }
62
+ function storageKey(key) {
63
+ const trimmed = key.trim();
64
+ if (!trimmed) throw new Error("Atom storage key must not be empty");
65
+ return `bleam.apps.${currentAppStorageKey()}.atoms.${trimmed}`;
66
+ }
67
+ function assertStoredValue(value, seen = /* @__PURE__ */ new Set()) {
68
+ if (value === null) return;
69
+ if (value === void 0) throw new Error("Persisted atom objects cannot contain undefined");
70
+ if (typeof value === "string" || typeof value === "boolean") return;
71
+ if (typeof value === "number") {
72
+ if (!Number.isFinite(value)) throw new Error("Persisted atom numbers must be finite");
73
+ return;
74
+ }
75
+ if (typeof value !== "object") throw new Error("Persisted atom values must be JSON-safe");
76
+ if (seen.has(value)) throw new Error("Persisted atom values cannot be cyclic");
77
+ seen.add(value);
78
+ if (Array.isArray(value)) for (const item of value) {
79
+ if (item === void 0) throw new Error("Persisted atom arrays cannot contain undefined");
80
+ assertStoredValue(item, seen);
81
+ }
82
+ else {
83
+ const prototype = Object.getPrototypeOf(value);
84
+ if (prototype !== Object.prototype && prototype !== null) throw new Error("Persisted atom objects must be plain objects");
85
+ for (const item of Object.values(value)) assertStoredValue(item, seen);
86
+ }
87
+ seen.delete(value);
88
+ }
89
+ function encoded(value) {
90
+ if (value === void 0) return void 0;
91
+ assertStoredValue(value);
92
+ return JSON.stringify(value);
93
+ }
94
+ function persistedAtom(initialValue, key) {
95
+ const resolvedKey = storageKey(key);
96
+ const initial = encoded(initialValue);
97
+ const existing = storedAtoms().get(resolvedKey);
98
+ if (existing) {
99
+ if (process.env.NODE_ENV !== "production" && existing.initial !== initial) console.warn(`Atom storage key "${key}" was declared with different initial values`);
100
+ return existing.atom;
101
+ }
102
+ const defaults = NSUserDefaults.standardUserDefaults;
103
+ const stored = defaults.objectForKey(resolvedKey);
104
+ let value = initialValue;
105
+ if (typeof stored === "string") try {
106
+ value = JSON.parse(stored);
107
+ assertStoredValue(value);
108
+ } catch {
109
+ defaults.removeObjectForKey(resolvedKey);
110
+ value = initialValue;
111
+ }
112
+ const base = (0, jotai_vanilla.atom)(value);
113
+ const result = asWritableAtom((0, jotai_vanilla.atom)((get) => get(base), (get, set, update) => {
114
+ const next = typeof update === "function" ? update(get(base)) : update;
115
+ const nextEncoded = encoded(next);
116
+ if (nextEncoded === void 0) defaults.removeObjectForKey(resolvedKey);
117
+ else defaults.setObjectForKey(nextEncoded, resolvedKey);
118
+ set(base, next);
119
+ }));
120
+ storedAtoms().set(resolvedKey, {
121
+ atom: result,
122
+ initial
123
+ });
124
+ return result;
125
+ }
126
+ function atom(initialOrRead, optionsOrWrite) {
127
+ if (typeof initialOrRead === "function") {
128
+ const read = initialOrRead;
129
+ const wrappedRead = (get) => read((value) => get(asJotaiAtom(value)));
130
+ if (typeof optionsOrWrite === "function") {
131
+ const write = optionsOrWrite;
132
+ return asWritableAtom((0, jotai_vanilla.atom)(wrappedRead, (get, set, ...args) => write((value) => get(asJotaiAtom(value)), (value, ...nextArgs) => set(asJotaiWritableAtom(value), ...nextArgs), ...args)));
133
+ }
134
+ return asAtom((0, jotai_vanilla.atom)(wrappedRead));
135
+ }
136
+ const options = optionsOrWrite;
137
+ return options?.storage ? persistedAtom(initialOrRead, options.storage) : asWritableAtom((0, jotai_vanilla.atom)(initialOrRead));
138
+ }
139
+ function useAtomValue(value) {
140
+ return (0, jotai_react.useAtomValue)(asJotaiAtom(value));
141
+ }
142
+ function useSetAtom(value) {
143
+ return (0, jotai_react.useSetAtom)(asJotaiWritableAtom(value));
144
+ }
145
+ function useAtom(value) {
146
+ return (0, jotai_react.useAtom)(asJotaiWritableAtom(value));
147
+ }
148
+ function internalAtom(value) {
149
+ return asAtom(value);
150
+ }
151
+ function internalWritableAtom(value) {
152
+ return asWritableAtom(value);
153
+ }
154
+ function internalJotaiAtom(value) {
155
+ return asJotaiAtom(value);
156
+ }
157
+ function internalJotaiWritableAtom(value) {
158
+ return asJotaiWritableAtom(value);
159
+ }
160
+ const internalStore = (0, jotai_vanilla.getDefaultStore)();
161
+
162
+ //#endregion
163
+ //#region src/state/collection.ts
164
+ var CollectionVersionConflictError = class extends Error {
165
+ name = "CollectionVersionConflictError";
166
+ constructor(collection, id, expectedVersion, actualVersion) {
167
+ super(`Version conflict for "${collection}:${id}": expected ${expectedVersion}, received ${actualVersion}`);
168
+ this.collection = collection;
169
+ this.id = id;
170
+ this.expectedVersion = expectedVersion;
171
+ this.actualVersion = actualVersion;
172
+ }
173
+ };
174
+ const schemaVersion = 2;
175
+ const registryKey = Symbol.for("bleam.state.collections.v3");
176
+ function registry() {
177
+ const scope = globalThis;
178
+ scope[registryKey] ??= /* @__PURE__ */ new Map();
179
+ return scope[registryKey];
180
+ }
181
+ const queryPlans = /* @__PURE__ */ new Map();
182
+ const mutationTerminals = /* @__PURE__ */ new Map();
183
+ let databasePromise;
184
+ let initializedPromise;
185
+ let jsonSqlSupportPromise;
186
+ let mutationPipeline = Promise.resolve();
187
+ let transactionCallbackStarting = false;
188
+ function getDatabase() {
189
+ databasePromise ??= Promise.resolve().then(() => require("./native-sqlite-yQLD5s9i.cjs")).then((module$1) => module$1.openNativeSQLiteDatabase(`${currentAppStorageKey()}.sqlite3`));
190
+ return databasePromise;
191
+ }
192
+ async function initializedDatabase() {
193
+ initializedPromise ??= (async () => {
194
+ const database = await getDatabase();
195
+ await database.execute("PRAGMA journal_mode = WAL");
196
+ if (numberValue(await database.get("PRAGMA user_version"), "user_version", 0) !== schemaVersion) await database.transaction(async () => {
197
+ await database.execute("DROP TABLE IF EXISTS links");
198
+ await database.execute("DROP TABLE IF EXISTS collections");
199
+ await createTables(database);
200
+ await database.execute(`PRAGMA user_version = ${schemaVersion}`);
201
+ });
202
+ else await createTables(database);
203
+ return database;
204
+ })();
205
+ return initializedPromise;
206
+ }
207
+ async function createTables(database) {
208
+ await database.execute(`CREATE TABLE IF NOT EXISTS collections (
209
+ collection TEXT NOT NULL,
210
+ id TEXT NOT NULL,
211
+ version INTEGER NOT NULL,
212
+ createdAt TEXT NOT NULL,
213
+ updatedAt TEXT NOT NULL,
214
+ data TEXT NOT NULL,
215
+ PRIMARY KEY (collection, id)
216
+ )`);
217
+ await database.execute(`CREATE TABLE IF NOT EXISTS links (
218
+ leftCollection TEXT NOT NULL,
219
+ leftId TEXT NOT NULL,
220
+ rightCollection TEXT NOT NULL,
221
+ rightId TEXT NOT NULL,
222
+ createdAt TEXT NOT NULL,
223
+ PRIMARY KEY (leftCollection, leftId, rightCollection, rightId)
224
+ )`);
225
+ await database.execute("CREATE INDEX IF NOT EXISTS collections_created_idx ON collections(collection, createdAt, id)");
226
+ await database.execute("CREATE INDEX IF NOT EXISTS links_left_idx ON links(leftCollection, leftId, rightCollection)");
227
+ await database.execute("CREATE INDEX IF NOT EXISTS links_right_idx ON links(rightCollection, rightId, leftCollection)");
228
+ }
229
+ function stableStringify(value) {
230
+ if (value === void 0) return "undefined";
231
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
232
+ if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
233
+ return `{${Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, item]) => `${JSON.stringify(key)}:${stableStringify(item)}`).join(",")}}`;
234
+ }
235
+ function collectionDefinition(collection) {
236
+ const definition = registry().get(collectionName(collection));
237
+ if (!definition || definition.atom !== collection) throw new Error("Invalid collection atom");
238
+ return definition;
239
+ }
240
+ function collectionName(collection) {
241
+ for (const definition of registry().values()) if (definition.atom === collection) return definition.name;
242
+ throw new Error("Invalid collection atom");
243
+ }
244
+ function stringValue(row, key) {
245
+ const value = row?.[key];
246
+ if (typeof value !== "string") throw new Error(`Expected SQLite ${key} string`);
247
+ return value;
248
+ }
249
+ function numberValue(row, key, fallback) {
250
+ const value = row?.[key];
251
+ if (typeof value === "number" && Number.isFinite(value)) return value;
252
+ if (fallback !== void 0 && value === void 0) return fallback;
253
+ throw new Error(`Expected SQLite ${key} number`);
254
+ }
255
+ function parseRow(definition, row) {
256
+ const parsed = JSON.parse(stringValue(row, "data"));
257
+ return {
258
+ id: stringValue(row, "id"),
259
+ collection: definition.name,
260
+ version: numberValue(row, "version"),
261
+ createdAt: stringValue(row, "createdAt"),
262
+ updatedAt: stringValue(row, "updatedAt"),
263
+ data: definition.validator.parse(parsed)
264
+ };
265
+ }
266
+ function assertId(id) {
267
+ if (!id.trim()) throw new TypeError("Record ID must not be empty");
268
+ }
269
+ function assertCollectionName(name) {
270
+ if (!name.trim()) throw new TypeError("Collection name must not be empty");
271
+ }
272
+ function assertFieldPaths(shape, prefix = "") {
273
+ for (const [key, field] of Object.entries(shape)) {
274
+ if (!key || key.includes(".")) throw new TypeError(`Collection field name "${prefix}${key}" must not be empty or contain a dot`);
275
+ if (field.kind === "object") assertFieldPaths(field.shape, `${prefix}${key}.`);
276
+ }
277
+ }
278
+ function endpointOrder(first, second) {
279
+ if (first.collection === second.collection && first.id === second.id) throw new Error(`Cannot link record "${first.collection}:${first.id}" to itself`);
280
+ return first.collection < second.collection || first.collection === second.collection && first.id < second.id ? [first, second] : [second, first];
281
+ }
282
+ async function linkedIds(database, collection, id, target) {
283
+ return (await database.select(`SELECT leftCollection, leftId, rightCollection, rightId FROM links
284
+ WHERE (leftCollection = ? AND leftId = ? AND rightCollection = ?)
285
+ OR (rightCollection = ? AND rightId = ? AND leftCollection = ?)`, [
286
+ collection,
287
+ id,
288
+ target,
289
+ collection,
290
+ id,
291
+ target
292
+ ])).map((row) => stringValue(row, "leftCollection") === collection && stringValue(row, "leftId") === id ? stringValue(row, "rightId") : stringValue(row, "leftId")).sort((left, right) => left.localeCompare(right));
293
+ }
294
+ async function incidentLinks(database, collection, id) {
295
+ return database.select(`SELECT leftCollection, leftId, rightCollection, rightId FROM links
296
+ WHERE (leftCollection = ? AND leftId = ?)
297
+ OR (rightCollection = ? AND rightId = ?)`, [
298
+ collection,
299
+ id,
300
+ collection,
301
+ id
302
+ ]);
303
+ }
304
+ async function fullRow(database, definition, persisted, linkNames = []) {
305
+ const links = {};
306
+ for (const target of [...new Set(linkNames)].sort()) links[target] = await linkedIds(database, definition.name, persisted.id, target);
307
+ return {
308
+ ...persisted,
309
+ data: persisted.data,
310
+ links
311
+ };
312
+ }
313
+ async function getPersisted(database, definition, id) {
314
+ const row = await database.get(`SELECT id, version, createdAt, updatedAt, data FROM collections
315
+ WHERE collection = ? AND id = ?`, [definition.name, id]);
316
+ return row ? parseRow(definition, row) : null;
317
+ }
318
+ function dataValueAt(data, path) {
319
+ let current = data;
320
+ for (const segment of path.split(".")) {
321
+ if (!current || typeof current !== "object" || Array.isArray(current)) return;
322
+ current = current[segment];
323
+ }
324
+ return current;
325
+ }
326
+ function valueAt(row, path) {
327
+ if (path === "createdAt" || path === "updatedAt") return row[path];
328
+ return dataValueAt(row.data, path);
329
+ }
330
+ function sqliteOperand(value) {
331
+ return typeof value === "boolean" ? value ? 1 : 0 : value;
332
+ }
333
+ function topLevelClauseSql(clause, parameters) {
334
+ if (clause.path.includes(".")) return void 0;
335
+ parameters.push(`$.${clause.path}`, sqliteOperand(clause.operand));
336
+ switch (clause.comparison) {
337
+ case "equals": return "json_extract(data, ?) = ?";
338
+ case "greater-than": return "json_extract(data, ?) > ?";
339
+ case "less-than": return "json_extract(data, ?) < ?";
340
+ case "contains": return "instr(json_extract(data, ?), ?) > 0";
341
+ }
342
+ }
343
+ function supportsJsonSql(database) {
344
+ jsonSqlSupportPromise ??= database.get(`SELECT json_extract('{"value":1}', '$.value') AS value`).then((row) => row?.value === 1).catch(() => false);
345
+ return jsonSqlSupportPromise;
346
+ }
347
+ function matches(value, clause) {
348
+ const operand = clause.operand;
349
+ switch (clause.comparison) {
350
+ case "equals": return typeof value === typeof operand && Object.is(value, operand);
351
+ case "greater-than": return typeof value === "number" && typeof operand === "number" && value > operand;
352
+ case "less-than": return typeof value === "number" && typeof operand === "number" && value < operand;
353
+ case "contains": return typeof value === "string" && typeof operand === "string" && value.includes(operand);
354
+ }
355
+ }
356
+ function relatedPath(left, right) {
357
+ return left === right || left.startsWith(`${right}.`) || right.startsWith(`${left}.`);
358
+ }
359
+ function sameIds(left, right) {
360
+ return Array.isArray(left) && left.length === right.length && left.every((id, index) => id === right[index]);
361
+ }
362
+ function compareValues(left, right, order) {
363
+ const leftMissing = left === void 0;
364
+ const rightMissing = right === void 0;
365
+ if (leftMissing || rightMissing) {
366
+ if (leftMissing && rightMissing) return 0;
367
+ return leftMissing ? 1 : -1;
368
+ }
369
+ if (Object.is(left, right)) return 0;
370
+ if (typeof left !== "string" && typeof left !== "number" && typeof left !== "boolean" || typeof left !== typeof right) return 0;
371
+ const comparison = left < right ? -1 : 1;
372
+ return order === "desc" ? -comparison : comparison;
373
+ }
374
+ async function selectRows(database, definition, plan) {
375
+ const parameters = [definition.name];
376
+ const predicates = [];
377
+ if (await supportsJsonSql(database)) for (const clause of plan.where) {
378
+ const predicate = topLevelClauseSql(clause, parameters);
379
+ if (predicate) predicates.push(predicate);
380
+ }
381
+ let rows = (await database.select(`SELECT id, version, createdAt, updatedAt, data FROM collections
382
+ WHERE collection = ?${predicates.length > 0 ? ` AND ${predicates.join(" AND ")}` : ""}`, parameters)).map((row) => parseRow(definition, row));
383
+ if (plan.from) {
384
+ const ids = new Set(await linkedIds(database, plan.from.collection, plan.from.id, definition.name));
385
+ rows = rows.filter((row) => ids.has(row.id));
386
+ }
387
+ rows = rows.filter((row) => plan.where.every((clause) => matches(valueAt(row, clause.path), clause)));
388
+ rows.sort((left, right) => {
389
+ return (plan.sort ? compareValues(valueAt(left, plan.sort.path), valueAt(right, plan.sort.path), plan.sort.order) : left.createdAt.localeCompare(right.createdAt)) || left.id.localeCompare(right.id);
390
+ });
391
+ return plan.take === void 0 ? rows : rows.slice(0, plan.take);
392
+ }
393
+ async function executeQuery(database, definition, terminal) {
394
+ const plan = terminal.plan;
395
+ if (plan.terminal === "ids") return (await selectRows(database, definition, plan)).map((row) => row.id);
396
+ const persisted = await getPersisted(database, definition, plan.id);
397
+ if (plan.terminal === "row") return persisted ? await fullRow(database, definition, persisted, plan.links) : null;
398
+ return persisted ? dataValueAt(persisted.data, plan.path) : void 0;
399
+ }
400
+ function fieldAtPath(shape, path) {
401
+ const segments = path.split(".");
402
+ let currentShape = shape;
403
+ let field = currentShape[segments[0]];
404
+ for (let index = 1; index < segments.length; index += 1) {
405
+ if (field?.kind !== "object") throw new Error(`Unknown schema field path "${path}"`);
406
+ currentShape = field.shape;
407
+ field = currentShape[segments[index]];
408
+ }
409
+ if (!field) throw new Error(`Unknown schema field path "${path}"`);
410
+ return field;
411
+ }
412
+ function validateScalarPath(definition, path) {
413
+ const field = fieldAtPath(definition.shape, path);
414
+ if (field.kind === "object" || field.kind === "array") throw new TypeError(`Collection query path "${path}" must be scalar`);
415
+ return field;
416
+ }
417
+ function queryBuilder(definition) {
418
+ const plan = {
419
+ terminal: "ids",
420
+ where: []
421
+ };
422
+ const builder = {
423
+ where(filters) {
424
+ for (const [path, value] of Object.entries(filters)) {
425
+ const field = validateScalarPath(definition, path);
426
+ const clauses = Array.isArray(value) ? typeof value[0] === "string" ? [value] : value : [["equals", value]];
427
+ for (const [comparison, operand] of clauses) {
428
+ if (typeof operand === "number" && !Number.isFinite(operand)) throw new TypeError("Collection query numbers must be finite");
429
+ const fieldType = field.kind === "literal" ? typeof field.value : field.kind;
430
+ if (typeof operand !== fieldType) throw new TypeError(`Invalid comparison value for "${path}"`);
431
+ if (comparison !== "equals" && comparison !== "greater-than" && comparison !== "less-than" && comparison !== "contains") throw new TypeError(`Invalid comparison operator "${comparison}"`);
432
+ if (comparison === "contains" && fieldType !== "string" || (comparison === "greater-than" || comparison === "less-than") && fieldType !== "number") throw new TypeError(`Invalid ${comparison} comparison for "${path}"`);
433
+ plan.where.push({
434
+ path,
435
+ comparison,
436
+ operand
437
+ });
438
+ }
439
+ }
440
+ return builder;
441
+ },
442
+ from(other, id) {
443
+ assertId(id);
444
+ plan.from = {
445
+ collection: collectionName(other),
446
+ id
447
+ };
448
+ return builder;
449
+ },
450
+ sortBy(path, order = "asc") {
451
+ if (path !== "createdAt" && path !== "updatedAt") validateScalarPath(definition, path);
452
+ if (order !== "asc" && order !== "desc") throw new TypeError("Invalid sort order");
453
+ plan.sort = {
454
+ path,
455
+ order
456
+ };
457
+ return builder;
458
+ },
459
+ take(count) {
460
+ if (!Number.isInteger(count) || count <= 0) throw new TypeError("Collection query take must be a positive integer");
461
+ plan.take = count;
462
+ return builder;
463
+ },
464
+ ids() {
465
+ return { plan: {
466
+ ...plan,
467
+ terminal: "ids"
468
+ } };
469
+ },
470
+ row(id, options) {
471
+ assertId(id);
472
+ return { plan: {
473
+ ...plan,
474
+ terminal: "row",
475
+ id,
476
+ links: options?.links?.map(collectionName).sort()
477
+ } };
478
+ },
479
+ field(id, path) {
480
+ assertId(id);
481
+ fieldAtPath(definition.shape, path);
482
+ return { plan: {
483
+ ...plan,
484
+ terminal: "field",
485
+ id,
486
+ path
487
+ } };
488
+ }
489
+ };
490
+ return builder;
491
+ }
492
+ function canonicalPlan(plan) {
493
+ return {
494
+ ...plan,
495
+ where: [...plan.where].sort((left, right) => stableStringify(left).localeCompare(stableStringify(right))),
496
+ links: plan.links ? [...new Set(plan.links)].sort() : void 0
497
+ };
498
+ }
499
+ const queryFamily = (0, jotai_family.atomFamily)((key) => {
500
+ const registration = queryPlans.get(key);
501
+ if (!registration) throw new Error(`Missing collection query plan "${key}"`);
502
+ return (0, jotai_vanilla.atom)(async (get) => {
503
+ get(internalJotaiAtom(registration.revision));
504
+ const result = await executeQuery(await initializedDatabase(), registration.definition, { plan: registration.plan });
505
+ if (registration.hasCache && registration.plan.terminal === "ids" && sameIds(registration.cache, result)) return registration.cache;
506
+ if (registration.hasCache && Object.is(registration.cache, result)) return registration.cache;
507
+ registration.cache = result;
508
+ registration.hasCache = true;
509
+ return result;
510
+ });
511
+ });
512
+ const mutationFamily = (0, jotai_family.atomFamily)((key) => {
513
+ const registration = mutationTerminals.get(key);
514
+ if (!registration) throw new Error(`Missing collection mutation terminal "${key}"`);
515
+ return (0, jotai_vanilla.atom)(() => null, (_get, _set, ...args) => enqueueMutation((database, changes) => executeMutation(database, changes, registration.collection, registration.terminal, args)));
516
+ });
517
+ function atomCollection(name, shape) {
518
+ assertCollectionName(name);
519
+ assertFieldPaths(shape);
520
+ const validator = require_schema.schema(shape);
521
+ const signature = stableStringify(validator.toJSONSchema());
522
+ const existing = registry().get(name);
523
+ if (existing) {
524
+ if (existing.signature !== signature) throw new Error(`Collection "${name}" was registered with a different schema`);
525
+ return existing.atom;
526
+ }
527
+ const definition = {
528
+ name,
529
+ shape,
530
+ signature,
531
+ validator,
532
+ revision: atom(0)
533
+ };
534
+ const value = atom(async (get) => {
535
+ get(definition.revision);
536
+ const ids = (await selectRows(await initializedDatabase(), definition, {
537
+ terminal: "ids",
538
+ where: []
539
+ })).map((row) => row.id);
540
+ if (sameIds(definition.idsCache, ids)) return definition.idsCache;
541
+ definition.idsCache = ids;
542
+ return ids;
543
+ });
544
+ definition.atom = value;
545
+ registry().set(name, definition);
546
+ return value;
547
+ }
548
+ function queryAtom(collection, build) {
549
+ const definition = collectionDefinition(collection);
550
+ const plan = canonicalPlan(build(queryBuilder(definition)).plan);
551
+ const key = stableStringify({
552
+ collection: definition.name,
553
+ plan
554
+ });
555
+ if (!queryPlans.has(key)) queryPlans.set(key, {
556
+ definition,
557
+ plan,
558
+ revision: atom(0),
559
+ hasCache: false
560
+ });
561
+ return internalAtom(queryFamily(key));
562
+ }
563
+ function mutationBuilder() {
564
+ return {
565
+ insert: () => ({ kind: "insert" }),
566
+ update: (id) => ({
567
+ kind: "update",
568
+ id,
569
+ args: [],
570
+ result: void 0
571
+ }),
572
+ remove: (id) => ({
573
+ kind: "remove",
574
+ id
575
+ }),
576
+ link: (id, other) => ({
577
+ kind: "link",
578
+ id,
579
+ other
580
+ }),
581
+ unlink: (id, other) => ({
582
+ kind: "unlink",
583
+ id,
584
+ other
585
+ })
586
+ };
587
+ }
588
+ function terminalKey(terminal) {
589
+ return stableStringify({
590
+ kind: terminal.kind,
591
+ id: "id" in terminal ? terminal.id : void 0,
592
+ other: "other" in terminal ? collectionName(terminal.other) : void 0
593
+ });
594
+ }
595
+ function collectionChange(changes, name) {
596
+ let change = changes.get(name);
597
+ if (!change) {
598
+ change = {
599
+ structural: false,
600
+ links: false,
601
+ records: /* @__PURE__ */ new Map()
602
+ };
603
+ changes.set(name, change);
604
+ }
605
+ return change;
606
+ }
607
+ function markRecord(changes, collection, id, kind, paths = []) {
608
+ const change = collectionChange(changes, collection);
609
+ if (kind === "insert" || kind === "remove") change.structural = true;
610
+ const record = change.records.get(id) ?? {
611
+ kind,
612
+ paths: /* @__PURE__ */ new Set(),
613
+ data: true,
614
+ links: false
615
+ };
616
+ record.kind = kind;
617
+ record.data = true;
618
+ for (const path of paths) record.paths.add(path);
619
+ change.records.set(id, record);
620
+ }
621
+ function markLink(changes, collection, id) {
622
+ const change = collectionChange(changes, collection);
623
+ change.links = true;
624
+ const record = change.records.get(id) ?? {
625
+ kind: "update",
626
+ paths: /* @__PURE__ */ new Set(),
627
+ data: false,
628
+ links: false
629
+ };
630
+ record.links = true;
631
+ change.records.set(id, record);
632
+ }
633
+ function changedDataPaths(previous, next, prefix = "", output = /* @__PURE__ */ new Set()) {
634
+ if (stableStringify(previous) === stableStringify(next)) return output;
635
+ if (previous && next && typeof previous === "object" && typeof next === "object" && !Array.isArray(previous) && !Array.isArray(next)) {
636
+ const keys = new Set([...Object.keys(previous), ...Object.keys(next)]);
637
+ for (const key of keys) changedDataPaths(previous[key], next[key], prefix ? `${prefix}.${key}` : key, output);
638
+ } else if (prefix) output.add(prefix);
639
+ return output;
640
+ }
641
+ function queryAffected(registration, changes) {
642
+ const { definition, plan } = registration;
643
+ const change = changes.get(definition.name);
644
+ if (plan.terminal === "row") {
645
+ const record = change?.records.get(plan.id);
646
+ return Boolean(record && (record.data || record.links && (plan.links?.length ?? 0) > 0));
647
+ }
648
+ if (plan.terminal === "field") {
649
+ const record = change?.records.get(plan.id);
650
+ if (!record?.data) return false;
651
+ if (record.kind !== "update") return true;
652
+ return [...record.paths].some((path) => relatedPath(path, plan.path));
653
+ }
654
+ if (change?.structural) return true;
655
+ if (plan.from && (change?.links || changes.get(plan.from.collection)?.links)) return true;
656
+ const dependencies = [...plan.where.map((clause) => clause.path), ...plan.sort ? [plan.sort.path] : []];
657
+ if (!change || dependencies.length === 0) return false;
658
+ return [...change.records.values()].some((record) => [...record.paths].some((path) => dependencies.some((dependency) => relatedPath(path, dependency))));
659
+ }
660
+ function publishChanges(changes) {
661
+ for (const [name, change] of changes) {
662
+ if (!change.structural) continue;
663
+ const definition = registry().get(name);
664
+ if (definition) internalStore.set(internalJotaiWritableAtom(definition.revision), (value) => value + 1);
665
+ }
666
+ for (const registration of queryPlans.values()) {
667
+ if (!queryAffected(registration, changes)) continue;
668
+ internalStore.set(internalJotaiWritableAtom(registration.revision), (value) => value + 1);
669
+ }
670
+ }
671
+ function enqueueMutation(action) {
672
+ let resolve;
673
+ let reject;
674
+ const result = new Promise((onResolve, onReject) => {
675
+ resolve = onResolve;
676
+ reject = onReject;
677
+ });
678
+ mutationPipeline = mutationPipeline.then(async () => {
679
+ const database = await initializedDatabase();
680
+ const changes = /* @__PURE__ */ new Map();
681
+ try {
682
+ const value = await database.transaction(() => action(database, changes));
683
+ publishChanges(changes);
684
+ resolve(value);
685
+ } catch (error) {
686
+ reject(error);
687
+ }
688
+ }).catch(() => void 0);
689
+ return result;
690
+ }
691
+ async function insertRecord(database, changes, definition, input) {
692
+ const data = definition.validator.parse(input);
693
+ const id = require_crypto.crypto.randomUUID();
694
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
695
+ await database.execute(`INSERT INTO collections (collection, id, version, createdAt, updatedAt, data)
696
+ VALUES (?, ?, 1, ?, ?, ?)`, [
697
+ definition.name,
698
+ id,
699
+ timestamp,
700
+ timestamp,
701
+ JSON.stringify(data)
702
+ ]);
703
+ markRecord(changes, definition.name, id, "insert");
704
+ return id;
705
+ }
706
+ function validatePatch(shape, patch, path = "patch") {
707
+ if (!patch || typeof patch !== "object" || Array.isArray(patch)) throw new TypeError(`${path} must be an object`);
708
+ for (const [key, value] of Object.entries(patch)) {
709
+ const field = shape[key];
710
+ if (!field) throw new TypeError(`Unknown field ${path}.${key}`);
711
+ if (value !== void 0 && field.kind === "object") validatePatch(field.shape, value, `${path}.${key}`);
712
+ }
713
+ }
714
+ function applyPatch(current, patch) {
715
+ const next = { ...current };
716
+ for (const [key, value] of Object.entries(patch)) if (value === void 0) delete next[key];
717
+ else if (value && typeof value === "object" && !Array.isArray(value) && current[key] && typeof current[key] === "object" && !Array.isArray(current[key])) next[key] = applyPatch(current[key], value);
718
+ else next[key] = value;
719
+ return next;
720
+ }
721
+ async function updateRecord(database, changes, definition, id, patch, options) {
722
+ assertId(id);
723
+ validatePatch(definition.shape, patch);
724
+ const previous = await getPersisted(database, definition, id);
725
+ if (!previous) throw new Error(`Cannot update missing record "${definition.name}:${id}"`);
726
+ if (options?.ifVersion !== void 0 && options.ifVersion !== previous.version) throw new CollectionVersionConflictError(definition.name, id, options.ifVersion, previous.version);
727
+ const data = definition.validator.parse(applyPatch(previous.data, patch));
728
+ const now = (/* @__PURE__ */ new Date()).toISOString();
729
+ const timestamp = now > previous.updatedAt ? now : new Date(Date.parse(previous.updatedAt) + 1).toISOString();
730
+ await database.execute(`UPDATE collections SET data = ?, updatedAt = ?, version = ?
731
+ WHERE collection = ? AND id = ? AND version = ?`, [
732
+ JSON.stringify(data),
733
+ timestamp,
734
+ previous.version + 1,
735
+ definition.name,
736
+ id,
737
+ previous.version
738
+ ]);
739
+ const persisted = await getPersisted(database, definition, id);
740
+ if (!persisted) throw new Error(`Cannot update missing record "${definition.name}:${id}"`);
741
+ if (persisted.version !== previous.version + 1 || stableStringify(persisted.data) !== stableStringify(data)) throw new CollectionVersionConflictError(definition.name, id, options?.ifVersion ?? previous.version, persisted.version);
742
+ const paths = changedDataPaths(previous.data, data);
743
+ paths.add("updatedAt");
744
+ markRecord(changes, definition.name, id, "update", paths);
745
+ return fullRow(database, definition, persisted);
746
+ }
747
+ async function removeRecord(database, changes, definition, id) {
748
+ assertId(id);
749
+ if (!await getPersisted(database, definition, id)) return false;
750
+ const links = await incidentLinks(database, definition.name, id);
751
+ for (const link of links) {
752
+ markLink(changes, stringValue(link, "leftCollection"), stringValue(link, "leftId"));
753
+ markLink(changes, stringValue(link, "rightCollection"), stringValue(link, "rightId"));
754
+ }
755
+ await database.execute("DELETE FROM links WHERE (leftCollection = ? AND leftId = ?) OR (rightCollection = ? AND rightId = ?)", [
756
+ definition.name,
757
+ id,
758
+ definition.name,
759
+ id
760
+ ]);
761
+ await database.execute("DELETE FROM collections WHERE collection = ? AND id = ?", [definition.name, id]);
762
+ markRecord(changes, definition.name, id, "remove");
763
+ return true;
764
+ }
765
+ async function mutateLink(database, changes, kind, leftCollection, leftId, rightCollection, rightId) {
766
+ assertId(leftId);
767
+ assertId(rightId);
768
+ const leftDefinition = collectionDefinition(leftCollection);
769
+ const rightDefinition = collectionDefinition(rightCollection);
770
+ const [left, right] = endpointOrder({
771
+ collection: leftDefinition.name,
772
+ id: leftId
773
+ }, {
774
+ collection: rightDefinition.name,
775
+ id: rightId
776
+ });
777
+ if (!await getPersisted(database, leftDefinition, leftId)) throw new Error(`Cannot link missing record "${leftDefinition.name}:${leftId}"`);
778
+ if (!await getPersisted(database, rightDefinition, rightId)) throw new Error(`Cannot link missing record "${rightDefinition.name}:${rightId}"`);
779
+ const parameters = [
780
+ left.collection,
781
+ left.id,
782
+ right.collection,
783
+ right.id
784
+ ];
785
+ const existing = await database.get(`SELECT createdAt FROM links WHERE leftCollection = ? AND leftId = ?
786
+ AND rightCollection = ? AND rightId = ?`, parameters);
787
+ if (kind === "unlink") {
788
+ if (!existing) return false;
789
+ await database.execute(`DELETE FROM links WHERE leftCollection = ? AND leftId = ?
790
+ AND rightCollection = ? AND rightId = ?`, parameters);
791
+ markLink(changes, left.collection, left.id);
792
+ markLink(changes, right.collection, right.id);
793
+ return true;
794
+ }
795
+ if (existing) return false;
796
+ await database.execute(`INSERT INTO links (leftCollection, leftId, rightCollection, rightId, createdAt)
797
+ VALUES (?, ?, ?, ?, ?)`, [...parameters, (/* @__PURE__ */ new Date()).toISOString()]);
798
+ markLink(changes, left.collection, left.id);
799
+ markLink(changes, right.collection, right.id);
800
+ return true;
801
+ }
802
+ async function executeMutation(database, changes, collection, terminal, args) {
803
+ const definition = collectionDefinition(collection);
804
+ switch (terminal.kind) {
805
+ case "insert": return insertRecord(database, changes, definition, args[0]);
806
+ case "update": return updateRecord(database, changes, definition, terminal.id, args[0], args[1]);
807
+ case "remove": return removeRecord(database, changes, definition, terminal.id);
808
+ case "link":
809
+ case "unlink": return mutateLink(database, changes, terminal.kind, collection, terminal.id, terminal.other, args[0]);
810
+ }
811
+ }
812
+ function mutateAtom(collection, build) {
813
+ const definition = collectionDefinition(collection);
814
+ const terminal = build(mutationBuilder());
815
+ if ("id" in terminal) assertId(terminal.id);
816
+ const key = stableStringify({
817
+ collection: definition.name,
818
+ terminal: terminalKey(terminal)
819
+ });
820
+ if (!mutationTerminals.has(key)) mutationTerminals.set(key, {
821
+ collection,
822
+ terminal
823
+ });
824
+ return internalWritableAtom(mutationFamily(key));
825
+ }
826
+ function transactionContext(database, changes) {
827
+ return {
828
+ async get(collection, id, options) {
829
+ const definition = collectionDefinition(collection);
830
+ const persisted = await getPersisted(database, definition, id);
831
+ return persisted ? fullRow(database, definition, persisted, options?.links?.map(collectionName)) : null;
832
+ },
833
+ query(collection, build) {
834
+ const definition = collectionDefinition(collection);
835
+ return executeQuery(database, definition, { plan: canonicalPlan(build(queryBuilder(definition)).plan) });
836
+ },
837
+ insert(collection, value) {
838
+ return insertRecord(database, changes, collectionDefinition(collection), value);
839
+ },
840
+ update(collection, id, patch, options) {
841
+ return updateRecord(database, changes, collectionDefinition(collection), id, patch, options);
842
+ },
843
+ remove(collection, id) {
844
+ return removeRecord(database, changes, collectionDefinition(collection), id);
845
+ },
846
+ link(collection, id, other, otherId) {
847
+ return mutateLink(database, changes, "link", collection, id, other, otherId);
848
+ },
849
+ unlink(collection, id, other, otherId) {
850
+ return mutateLink(database, changes, "unlink", collection, id, other, otherId);
851
+ }
852
+ };
853
+ }
854
+ function transactionAtom(action) {
855
+ return atom(() => null, (_get, _set, ...args) => {
856
+ if (transactionCallbackStarting) return Promise.reject(/* @__PURE__ */ new Error("Nested collection transactions are not supported"));
857
+ return enqueueMutation((database, changes) => {
858
+ transactionCallbackStarting = true;
859
+ try {
860
+ return Promise.resolve(action(transactionContext(database, changes), ...args));
861
+ } finally {
862
+ transactionCallbackStarting = false;
863
+ }
864
+ });
865
+ });
866
+ }
867
+ function useList(collection, build = (builder) => builder.ids()) {
868
+ return useAtomValue(queryAtom(collection, build));
869
+ }
870
+ function useRow(collection, id, options) {
871
+ return useAtomValue(queryAtom(collection, (builder) => builder.row(id, options)));
872
+ }
873
+ function useField(collection, id, path) {
874
+ return useAtomValue(queryAtom(collection, (builder) => builder.field(id, path)));
875
+ }
876
+
877
+ //#endregion
878
+ Object.defineProperty(exports, 'CollectionVersionConflictError', {
879
+ enumerable: true,
880
+ get: function () {
881
+ return CollectionVersionConflictError;
882
+ }
883
+ });
884
+ Object.defineProperty(exports, 'atom', {
885
+ enumerable: true,
886
+ get: function () {
887
+ return atom;
888
+ }
889
+ });
890
+ Object.defineProperty(exports, 'atomCollection', {
891
+ enumerable: true,
892
+ get: function () {
893
+ return atomCollection;
894
+ }
895
+ });
896
+ Object.defineProperty(exports, 'currentAppStorageKey', {
897
+ enumerable: true,
898
+ get: function () {
899
+ return currentAppStorageKey;
900
+ }
901
+ });
902
+ Object.defineProperty(exports, 'internalJotaiAtom', {
903
+ enumerable: true,
904
+ get: function () {
905
+ return internalJotaiAtom;
906
+ }
907
+ });
908
+ Object.defineProperty(exports, 'internalJotaiWritableAtom', {
909
+ enumerable: true,
910
+ get: function () {
911
+ return internalJotaiWritableAtom;
912
+ }
913
+ });
914
+ Object.defineProperty(exports, 'internalStore', {
915
+ enumerable: true,
916
+ get: function () {
917
+ return internalStore;
918
+ }
919
+ });
920
+ Object.defineProperty(exports, 'mutateAtom', {
921
+ enumerable: true,
922
+ get: function () {
923
+ return mutateAtom;
924
+ }
925
+ });
926
+ Object.defineProperty(exports, 'queryAtom', {
927
+ enumerable: true,
928
+ get: function () {
929
+ return queryAtom;
930
+ }
931
+ });
932
+ Object.defineProperty(exports, 'transactionAtom', {
933
+ enumerable: true,
934
+ get: function () {
935
+ return transactionAtom;
936
+ }
937
+ });
938
+ Object.defineProperty(exports, 'useAtom', {
939
+ enumerable: true,
940
+ get: function () {
941
+ return useAtom;
942
+ }
943
+ });
944
+ Object.defineProperty(exports, 'useAtomValue', {
945
+ enumerable: true,
946
+ get: function () {
947
+ return useAtomValue;
948
+ }
949
+ });
950
+ Object.defineProperty(exports, 'useField', {
951
+ enumerable: true,
952
+ get: function () {
953
+ return useField;
954
+ }
955
+ });
956
+ Object.defineProperty(exports, 'useList', {
957
+ enumerable: true,
958
+ get: function () {
959
+ return useList;
960
+ }
961
+ });
962
+ Object.defineProperty(exports, 'useRow', {
963
+ enumerable: true,
964
+ get: function () {
965
+ return useRow;
966
+ }
967
+ });
968
+ Object.defineProperty(exports, 'useSetAtom', {
969
+ enumerable: true,
970
+ get: function () {
971
+ return useSetAtom;
972
+ }
973
+ });