@lostgradient/weft 0.2.0 → 0.3.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.
- package/README.md +47 -22
- package/dist/cli/generated/operation-client.generated.d.ts +28 -1
- package/dist/cli/generated/operation-client.generated.js +2 -0
- package/dist/cli-main.js +79 -79
- package/dist/client/handle-delegation.d.ts +4 -0
- package/dist/client/handle-delegation.js +6 -0
- package/dist/client/http-client-requests.d.ts +2 -0
- package/dist/client/http-client-requests.js +3 -0
- package/dist/client/http-client.d.ts +4 -1
- package/dist/client/http-client.js +9 -1
- package/dist/client/interface.d.ts +57 -2
- package/dist/client/local.d.ts +4 -1
- package/dist/client/local.js +7 -0
- package/dist/client/start-body.d.ts +7 -1
- package/dist/client/start-body.js +13 -4
- package/dist/core/codec/extension-codec.js +4 -2
- package/dist/core/codec/index.d.ts +1 -0
- package/dist/core/codec/index.js +1 -0
- package/dist/core/codec/serializer-registry.d.ts +122 -0
- package/dist/core/codec/serializer-registry.js +51 -0
- package/dist/core/context/index.d.ts +10 -0
- package/dist/core/context/index.js +3 -0
- package/dist/core/context/internals.d.ts +10 -0
- package/dist/core/context/internals.js +5 -1
- package/dist/core/context/run-operation.d.ts +16 -3
- package/dist/core/context/run-operation.js +16 -7
- package/dist/core/context/speculative-child.js +2 -0
- package/dist/core/context/types.d.ts +6 -0
- package/dist/core/engine/bulk-operations-purge.js +1 -0
- package/dist/core/engine/bulk-operations.js +1 -1
- package/dist/core/engine/callback-creators-bundles.js +2 -1
- package/dist/core/engine/callback-creators-core.js +2 -1
- package/dist/core/engine/construction.d.ts +1 -1
- package/dist/core/engine/construction.js +15 -3
- package/dist/core/engine/disposal.js +12 -0
- package/dist/core/engine/engine-create-types.d.ts +0 -14
- package/dist/core/engine/engine-internal-types.d.ts +17 -0
- package/dist/core/engine/engine-leak-warnings.d.ts +6 -0
- package/dist/core/engine/engine-leak-warnings.js +4 -0
- package/dist/core/engine/engine-runtime-helpers.d.ts +17 -0
- package/dist/core/engine/engine-runtime-helpers.js +26 -5
- package/dist/core/engine/errors.d.ts +74 -0
- package/dist/core/engine/errors.js +25 -1
- package/dist/core/engine/handle-result.js +1 -1
- package/dist/core/engine/handles.d.ts +89 -40
- package/dist/core/engine/handles.js +25 -27
- package/dist/core/engine/index.d.ts +122 -4
- package/dist/core/engine/index.js +82 -5
- package/dist/core/engine/inline-launch-queue.d.ts +14 -0
- package/dist/core/engine/inline-launch-queue.js +32 -7
- package/dist/core/engine/internals.d.ts +26 -10
- package/dist/core/engine/lifecycle/fork-helpers.js +1 -7
- package/dist/core/engine/lifecycle/persist.js +5 -20
- package/dist/core/engine/lifecycle/recovered-services.d.ts +45 -0
- package/dist/core/engine/lifecycle/recovered-services.js +34 -0
- package/dist/core/engine/lifecycle/resume.js +33 -5
- package/dist/core/engine/lifecycle/shared.d.ts +8 -0
- package/dist/core/engine/lifecycle/start-batch.js +23 -12
- package/dist/core/engine/lifecycle/start-commit.d.ts +47 -0
- package/dist/core/engine/lifecycle/start-commit.js +27 -0
- package/dist/core/engine/lifecycle/start-exec.d.ts +30 -2
- package/dist/core/engine/lifecycle/start-exec.js +38 -0
- package/dist/core/engine/lifecycle/start-or-signal-resolution.d.ts +79 -0
- package/dist/core/engine/lifecycle/start-or-signal-resolution.js +60 -0
- package/dist/core/engine/lifecycle/start-or-signal.d.ts +45 -0
- package/dist/core/engine/lifecycle/start-or-signal.js +141 -0
- package/dist/core/engine/lifecycle/start.d.ts +3 -3
- package/dist/core/engine/lifecycle/start.js +42 -37
- package/dist/core/engine/lifecycle.d.ts +3 -2
- package/dist/core/engine/lifecycle.js +9 -2
- package/dist/core/engine/listing.js +1 -1
- package/dist/core/engine/operations-data.d.ts +16 -0
- package/dist/core/engine/operations-data.js +6 -0
- package/dist/core/engine/operations-time.d.ts +3 -2
- package/dist/core/engine/operations-time.js +6 -1
- package/dist/core/engine/persisted-data-version.d.ts +5 -9
- package/dist/core/engine/persisted-data-version.js +4 -5
- package/dist/core/engine/schedule-handle.d.ts +45 -0
- package/dist/core/engine/schedule-handle.js +26 -0
- package/dist/core/engine/schedules.d.ts +1 -1
- package/dist/core/engine/schedules.js +7 -3
- package/dist/core/engine/second-instance-detector.d.ts +96 -0
- package/dist/core/engine/second-instance-detector.js +108 -0
- package/dist/core/engine/signals.d.ts +22 -0
- package/dist/core/engine/signals.js +15 -0
- package/dist/core/engine/termination/cleanup.d.ts +25 -0
- package/dist/core/engine/termination/cleanup.js +21 -1
- package/dist/core/engine/termination/complete.js +4 -3
- package/dist/core/engine/termination/suspend.d.ts +68 -0
- package/dist/core/engine/termination/suspend.js +41 -0
- package/dist/core/engine/termination.d.ts +4 -2
- package/dist/core/engine/termination.js +2 -0
- package/dist/core/engine/validation.js +25 -1
- package/dist/core/engine/workflow-feed.d.ts +5 -3
- package/dist/core/events/event-map.d.ts +2 -1
- package/dist/core/events/workflow-events.d.ts +23 -0
- package/dist/core/events/workflow-events.js +9 -0
- package/dist/core/inline-execution-strategy.d.ts +5 -0
- package/dist/core/inline-execution-strategy.js +2 -1
- package/dist/core/list-filter-validation.js +2 -1
- package/dist/core/start-workflow-validation.d.ts +22 -0
- package/dist/core/start-workflow-validation.js +11 -1
- package/dist/core/step-context.d.ts +10 -6
- package/dist/core/step-context.js +7 -15
- package/dist/core/types/activity.d.ts +6 -3
- package/dist/core/types/identity.d.ts +8 -1
- package/dist/core/types/launch-metadata.d.ts +33 -0
- package/dist/core/types/launch-metadata.js +0 -0
- package/dist/core/types/message-handles.d.ts +25 -0
- package/dist/core/types/options.d.ts +90 -7
- package/dist/core/types/reviews.d.ts +2 -1
- package/dist/core/types/services-resolution.d.ts +47 -0
- package/dist/core/types/services-resolution.js +0 -0
- package/dist/core/types/state.d.ts +11 -11
- package/dist/core/types/workflow-builder.d.ts +5 -4
- package/dist/core/types/workflow-context.d.ts +25 -0
- package/dist/core/types/workflow-function.d.ts +17 -0
- package/dist/core/types/workflow-snapshot.d.ts +29 -0
- package/dist/core/types/workflow-snapshot.js +0 -0
- package/dist/core/types.d.ts +3 -0
- package/dist/core/types.js +3 -0
- package/dist/core/weft-error.d.ts +46 -14
- package/dist/core/weft-error.js +12 -1
- package/dist/diagnostics/doctor.js +6 -3
- package/dist/diagnostics/format.js +2 -2
- package/dist/diagnostics/types.d.ts +1 -0
- package/dist/diagnostics/version-check.js +6 -4
- package/dist/index.d.ts +10 -5
- package/dist/index.js +11 -2
- package/dist/json-schema.js +3 -3
- package/dist/mcp/cli.js +35 -35
- package/dist/mcp/list-filter.js +2 -1
- package/dist/mcp/session.js +1 -0
- package/dist/observability/index.js +2 -2
- package/dist/server/handler.js +30 -30
- package/dist/server/index.js +33 -33
- package/dist/server/interactive-operations.js +1 -0
- package/dist/server/operations/resume-workflow.js +2 -2
- package/dist/server/operations/start-or-signal-workflow.d.ts +39 -0
- package/dist/server/operations/start-or-signal-workflow.js +140 -0
- package/dist/server/operations/start-workflow-options.d.ts +32 -0
- package/dist/server/operations/start-workflow-options.js +63 -0
- package/dist/server/operations/start-workflow.js +7 -69
- package/dist/server/operations/suspend-workflow.d.ts +13 -0
- package/dist/server/operations/suspend-workflow.js +36 -0
- package/dist/server/rest-binding.d.ts +18 -7
- package/dist/server/rest-bindings.js +12 -0
- package/dist/server/runtime/task-dispatch.js +5 -3
- package/dist/server/runtime/task-polling.d.ts +16 -2
- package/dist/server/runtime/task-polling.js +20 -5
- package/dist/server/runtime/websocket-worker.js +8 -0
- package/dist/server/serve-internals.d.ts +8 -0
- package/dist/server/serve-internals.js +4 -2
- package/dist/server/task-state.d.ts +8 -0
- package/dist/service-worker/index.js +28 -28
- package/dist/storage/capabilities.d.ts +10 -2
- package/dist/storage/capabilities.js +2 -2
- package/dist/storage/http.js +2 -2
- package/dist/storage/index.d.ts +7 -1
- package/dist/storage/indexeddb.js +1 -1
- package/dist/storage/interface.d.ts +40 -0
- package/dist/storage/interface.js +1 -1
- package/dist/storage/key-prefixes.d.ts +1 -1
- package/dist/storage/key-prefixes.js +3 -0
- package/dist/storage/lmdb.js +1 -1
- package/dist/storage/memory.js +1 -1
- package/dist/storage/neon-value-mapping.d.ts +47 -0
- package/dist/storage/neon-value-mapping.js +11 -0
- package/dist/storage/neon.d.ts +108 -0
- package/dist/storage/neon.js +10 -0
- package/dist/storage/node-sqlite-loader.d.ts +71 -0
- package/dist/storage/node-sqlite-loader.js +41 -0
- package/dist/storage/node-sqlite.d.ts +1 -19
- package/dist/storage/node-sqlite.js +38 -32
- package/dist/storage/postgres-key-value-queries.d.ts +79 -0
- package/dist/storage/postgres-key-value-queries.js +63 -0
- package/dist/storage/resolve.d.ts +2 -165
- package/dist/storage/resolve.js +1 -1
- package/dist/storage/scoped-storage.js +1 -1
- package/dist/storage/storage-configuration.d.ts +209 -0
- package/dist/storage/storage-configuration.js +0 -0
- package/dist/storage/text-value-store.d.ts +13 -10
- package/dist/storage/turso.js +2 -2
- package/dist/storage/typed-storage.js +1 -1
- package/dist/storage/web-extension.js +1 -1
- package/dist/testing/event-loop.d.ts +36 -2
- package/dist/testing/index.d.ts +31 -1
- package/dist/testing/index.js +33 -33
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/index.js +9 -5
- package/dist/worker/long-poll.js +4 -0
- package/dist/worker/protocol-messages.d.ts +20 -0
- package/dist/worker/protocol-schemas.d.ts +32 -0
- package/dist/worker/protocol-schemas.js +8 -4
- package/dist/worker/protocol-task-result.d.ts +28 -0
- package/dist/worker/protocol-task-result.js +76 -0
- package/dist/worker/protocol.d.ts +4 -15
- package/dist/worker/protocol.js +1 -1
- package/dist/worker/registry/fair-share.d.ts +29 -0
- package/dist/worker/registry/fair-share.js +30 -0
- package/dist/worker/registry/routing.d.ts +18 -0
- package/dist/worker/registry/routing.js +14 -0
- package/dist/worker/registry/types.d.ts +7 -0
- package/dist/worker/registry.d.ts +16 -1
- package/dist/worker/registry.js +24 -36
- package/package.json +17 -4
|
@@ -1,168 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import type { Storage } from './interface.ts';
|
|
4
|
-
import type { LMDBStorage } from './lmdb.ts';
|
|
5
|
-
import { MemoryStorage } from './memory.ts';
|
|
6
|
-
import type { SQLiteStorageInstance } from './sqlite.ts';
|
|
7
|
-
import type { TursoStorage } from './turso.ts';
|
|
8
|
-
import type { WebExtensionStorage } from './web-extension.ts';
|
|
9
|
-
/**
|
|
10
|
-
* Runtime configuration for in-memory storage.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* import { resolveStorage, type MemoryStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
15
|
-
*
|
|
16
|
-
* const configuration: MemoryStorageConfiguration = { type: 'memory' };
|
|
17
|
-
* const storage = await resolveStorage(configuration);
|
|
18
|
-
* void storage;
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export type MemoryStorageConfiguration = {
|
|
22
|
-
type: 'memory';
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Runtime configuration for SQLite storage.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* import { resolveStorage, type SQLiteStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
30
|
-
*
|
|
31
|
-
* const configuration: SQLiteStorageConfiguration = { type: 'sqlite', path: './weft.db' };
|
|
32
|
-
* const storage = await resolveStorage(configuration);
|
|
33
|
-
* void storage;
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export type SQLiteStorageConfiguration = {
|
|
37
|
-
type: 'sqlite';
|
|
38
|
-
path?: string;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Runtime configuration for LMDB storage.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```ts
|
|
45
|
-
* import { resolveStorage, type LMDBStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
46
|
-
*
|
|
47
|
-
* const configuration: LMDBStorageConfiguration = { type: 'lmdb', path: './weft-data' };
|
|
48
|
-
* const storage = await resolveStorage(configuration);
|
|
49
|
-
* void storage;
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export type LMDBStorageConfiguration = {
|
|
53
|
-
type: 'lmdb';
|
|
54
|
-
path: string;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Runtime configuration for Turso/libSQL storage.
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```ts
|
|
61
|
-
* import { resolveStorage, type TursoStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
62
|
-
*
|
|
63
|
-
* const configuration: TursoStorageConfiguration = { type: 'turso', url: 'file:weft.db' };
|
|
64
|
-
* const storage = await resolveStorage(configuration);
|
|
65
|
-
* void storage;
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
export type TursoStorageConfiguration = {
|
|
69
|
-
type: 'turso';
|
|
70
|
-
url: string;
|
|
71
|
-
authToken?: string;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Runtime configuration for browser IndexedDB storage.
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```ts
|
|
78
|
-
* import { resolveStorage, type IndexedDBStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
79
|
-
*
|
|
80
|
-
* const configuration: IndexedDBStorageConfiguration = { type: 'indexeddb', databaseName: 'weft' };
|
|
81
|
-
* const storage = await resolveStorage(configuration);
|
|
82
|
-
* void storage;
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
export type IndexedDBStorageConfiguration = {
|
|
86
|
-
type: 'indexeddb';
|
|
87
|
-
databaseName?: string;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Runtime configuration for WebExtension storage.
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```ts
|
|
94
|
-
* import { resolveStorage, type WebExtensionStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
95
|
-
*
|
|
96
|
-
* const configuration: WebExtensionStorageConfiguration = { type: 'web-extension', area: 'local' };
|
|
97
|
-
* const storage = await resolveStorage(configuration);
|
|
98
|
-
* void storage;
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
export type WebExtensionStorageConfiguration = {
|
|
102
|
-
type: 'web-extension';
|
|
103
|
-
area?: 'local' | 'sync' | 'session' | 'managed';
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Runtime configuration for remote HTTP storage.
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```ts
|
|
110
|
-
* import { resolveStorage, type HTTPStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
111
|
-
*
|
|
112
|
-
* const configuration: HTTPStorageConfiguration = { type: 'http', baseUrl: 'https://weft.example.com' };
|
|
113
|
-
* const storage = await resolveStorage(configuration);
|
|
114
|
-
* void storage;
|
|
115
|
-
* ```
|
|
116
|
-
*/
|
|
117
|
-
export type HTTPStorageConfiguration = {
|
|
118
|
-
type: 'http';
|
|
119
|
-
baseUrl: string | URL;
|
|
120
|
-
headers?: Record<string, string>;
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Runtime configuration for automatic storage selection.
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```ts
|
|
127
|
-
* import { resolveStorage, type AutoStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
128
|
-
*
|
|
129
|
-
* const configuration: AutoStorageConfiguration = { type: 'auto' };
|
|
130
|
-
* const storage = await resolveStorage(configuration);
|
|
131
|
-
* void storage;
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
export type AutoStorageConfiguration = {
|
|
135
|
-
type: 'auto';
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* Union of supported runtime-driven storage configurations.
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```ts
|
|
142
|
-
* import { resolveStorage, type StorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
143
|
-
*
|
|
144
|
-
* const configuration: StorageConfiguration = { type: 'memory' };
|
|
145
|
-
* const storage = await resolveStorage(configuration);
|
|
146
|
-
* void storage;
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
export type StorageConfiguration = MemoryStorageConfiguration | SQLiteStorageConfiguration | LMDBStorageConfiguration | TursoStorageConfiguration | IndexedDBStorageConfiguration | WebExtensionStorageConfiguration | HTTPStorageConfiguration | AutoStorageConfiguration;
|
|
150
|
-
/**
|
|
151
|
-
* Storage adapter type resolved for a concrete {@link StorageConfiguration}.
|
|
152
|
-
*
|
|
153
|
-
* Use this when a configuration value is already narrowed and downstream code
|
|
154
|
-
* needs the adapter-specific instance type that {@link resolveStorage} returns.
|
|
155
|
-
*
|
|
156
|
-
* @example
|
|
157
|
-
* ```ts
|
|
158
|
-
* import type { HTTPStorageConfiguration, ResolvedStorage } from '@lostgradient/weft/storage/resolve';
|
|
159
|
-
*
|
|
160
|
-
* type RemoteStorage = ResolvedStorage<HTTPStorageConfiguration>;
|
|
161
|
-
* declare const storage: RemoteStorage;
|
|
162
|
-
* void storage;
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
export type ResolvedStorage<Configuration extends StorageConfiguration> = Configuration extends MemoryStorageConfiguration ? MemoryStorage : Configuration extends SQLiteStorageConfiguration ? SQLiteStorageInstance : Configuration extends LMDBStorageConfiguration ? LMDBStorage : Configuration extends TursoStorageConfiguration ? TursoStorage : Configuration extends IndexedDBStorageConfiguration ? IndexedDBStorage : Configuration extends WebExtensionStorageConfiguration ? WebExtensionStorage : Configuration extends HTTPStorageConfiguration ? HTTPStorage : Storage;
|
|
1
|
+
import type { ResolvedStorage, StorageConfiguration } from './storage-configuration.ts';
|
|
2
|
+
export type { AutoStorageConfiguration, HTTPStorageConfiguration, IndexedDBStorageConfiguration, LMDBStorageConfiguration, MemoryStorageConfiguration, NeonStorageConfiguration, ResolvedStorage, SQLiteStorageConfiguration, StorageConfiguration, StorageConfigurationType, TursoStorageConfiguration, WebExtensionStorageConfiguration, } from './storage-configuration.ts';
|
|
166
3
|
/**
|
|
167
4
|
* Resolve a storage backend from runtime configuration.
|
|
168
5
|
*
|
package/dist/storage/resolve.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var r=Object.defineProperty;var i=(F)=>F;function n(F,Y){this[F]=i.bind(null,Y)}var t=(F,Y)=>{for(var J in Y)r(F,J,{get:Y[J],enumerable:!0,configurable:!0,set:n.bind(Y,J)})};var _=(F,Y)=>()=>(F&&(Y=F(F=0)),Y);function A(F,Y,J){if(!F.capabilities()[Y])throw Error(`Feature "${J}" requires storage capability "${Y}", but this storage backend does not provide it.`)}function o(F){let Y=F.capabilities(),J=[];if(Y.persistence!=="local")J.push(`persistence must be "local" (got "${Y.persistence}")`);if(Y.readAfterWrite!=="linearizable")J.push(`readAfterWrite must be "linearizable" (got "${Y.readAfterWrite}")`);if(Y.scanConsistency!=="snapshot")J.push(`scanConsistency must be "snapshot" (got "${Y.scanConsistency}")`);if(!Y.atomicBatch)J.push("atomicBatch must be true");if(!Y.conditionalBatch)J.push("conditionalBatch must be true");if(J.length>0)throw Error(`Storage is not durable enough for recovery: ${J.join("; ")}.`)}var P="default";async function h(F,Y){return await F.get(Y)!==null}async function*B(F,Y,J){for await(let[Z]of F.scan(Y,J))yield Z}async function C(F,Y){let J=0;for await(let Z of B(F,Y))J++;return J}async function b(F,Y){let J=[];for await(let Z of B(F,Y))J.push({type:"delete",key:Z});if(J.length===0)return 0;return await F.batch(J),J.length}async function v(F,Y,J){let Z=[];for await(let X of B(F,Y,J))Z.push({type:"delete",key:X});if(Z.length===0)return 0;return await F.batch(Z),Z.length}var e;var K=_(()=>{e=["actrec:","archive:","async-act:","attr:","audit:bulk:","blob:","budget:","budget-charged:","ev:","idx:","offload:","op:","review:","schedule:","schedule-due:","schedule-run:","sig:","sigres:","sigseq:","state:","tag:","tool-effect:","upd:","upk:","upr:","wf:","wf-cleanup:","wf-cleanup-needed:","wf-deadline:","wf-delayed:","wf-headers:","wf-idx-","wf-terminal:"]});function q(F){return F.length>0?F.slice(0,-1)+String.fromCharCode(F.charCodeAt(F.length-1)+1):"\xFF"}function N(F,Y={}){if(Y.gt!==void 0&&F<=Y.gt)return!1;if(Y.gte!==void 0&&F<Y.gte)return!1;if(Y.lt!==void 0&&F>=Y.lt)return!1;if(Y.lte!==void 0&&F>Y.lte)return!1;return!0}function I(F,Y){if(F===null||Y===null)return F===Y;if(F.byteLength!==Y.byteLength)return!1;for(let J=0;J<F.byteLength;J++)if(F[J]!==Y[J])return!1;return!0}async function x(F,Y){if(F.has)return F.has(Y);return h(F,Y)}function S(F,Y,J){if(F.keys)return F.keys(Y,J);return B(F,Y,J)}async function w(F,Y){if(F.count)return F.count(Y);return C(F,Y)}async function k(F,Y){if(F.deletePrefix)return F.deletePrefix(Y);return b(F,Y)}async function m(F,Y,J){if(A(F,"conditionalBatch","storageConditionalBatch"),!F.conditionalBatch)throw Error("This storage backend reports conditionalBatch capability but does not implement the conditionalBatch() method.");return F.conditionalBatch(Y,J)}function W(F){return encodeURIComponent(F)}function bF(F){return decodeURIComponent(F)}function vF(F){try{return decodeURIComponent(F)}catch{return null}}var j=(F)=>String(F).padStart(16,"0"),KF;var E=_(()=>{K();KF={workflow:(F)=>`wf:${W(F)}`,checkpoint:(F)=>`wf:${W(F)}:ckpt`,checkpointHistory:(F,Y)=>`wf:${W(F)}:ckpt:${String(Y).padStart(10,"0")}`,timelinePrefix:(F)=>`wf:${W(F)}:timeline:`,timeline:(F,Y)=>`wf:${W(F)}:timeline:${String(Y).padStart(10,"0")}`,schedule:(F)=>`schedule:${W(F)}`,scheduleTick:(F,Y)=>`schedule-due:${String(F).padStart(16,"0")}:${W(Y)}`,scheduleRun:(F)=>`schedule-run:${W(F)}`,operation:(F,Y,J)=>`op:${F}:${j(Y)}:${J}`,operationInflight:(F)=>`op:inflight:${F}`,operationQueued:(F)=>`op:queued:${F}`,operationResolved:(F)=>`op:resolved:${F}`,bulkOperationAuditPrefix:()=>"audit:bulk:",bulkOperationAudit:(F,Y,J)=>`audit:bulk:${j(F)}:${W(Y)}:${W(J)}`,operationResolvedByTimePrefix:()=>"op:resolved-by-time:",operationResolvedByTime:(F,Y)=>`op:resolved-by-time:${j(F)}:${W(Y)}`,asyncActivity:(F,Y)=>`async-act:v1:${W(F)}:${W(Y)}`,activityReconciliationPrefix:(F)=>`actrec:v1:${W(F)}:`,activityReconciliation:(F,Y,J)=>`actrec:v1:${W(F)}:${W(Y)}:${J}`,eventPrefix:(F)=>`ev:${W(F)}:`,event:(F,Y)=>`ev:${W(F)}:${String(Y).padStart(10,"0")}`,eventHead:(F)=>`ev:${W(F)}:head`,eventWatermark:(F)=>`ev:${W(F)}:watermark`,signal:(F,Y,J)=>`sig:${W(F)}:${Y}:${W(J)}`,signalSequence:(F)=>`sigseq:v1:${W(F)}`,signalAcceptedResponsePrefix:(F)=>`sigres:v1:${W(F)}:`,signalAcceptedResponse:(F,Y,J)=>`sigres:v1:${W(F)}:${W(Y)}:${W(J)}`,deadline:(F,Y)=>`wf-deadline:${j(F)}:${W(Y)}`,terminalCleanup:(F,Y)=>`wf-cleanup:${j(F)}:${W(Y)}`,delayedStart:(F,Y)=>`wf-delayed:${j(F)}:${W(Y)}`,terminalWorkflowPrefix:()=>"wf-terminal:",terminalWorkflow:(F,Y)=>`wf-terminal:${j(F)}:${W(Y)}`,attribute:(F)=>`attr:${W(F)}`,attributeIndex:(F,Y,J)=>`idx:${F}:${Y}:${W(J)}`,tagIndex:(F,Y)=>`tag:${W(F)}:${W(Y)}`,updatePrefix:(F)=>`upd:${W(F)}:`,update:(F,Y)=>`upd:${W(F)}:${Y}`,updateResponse:(F)=>`upr:${F}`,updateIdempotency:(F,Y)=>`upk:${W(F)}:${Y}`,budget:(F,Y,J)=>`budget:${F}:${Y}:${J}`,review:(F,Y)=>`review:${W(F)}:${Y}`,workflowHeaders:(F)=>`wf-headers:${W(F)}`,terminalCleanupNeeded:(F)=>`wf-cleanup-needed:${W(F)}`,offload:(F,Y)=>`offload:${W(F)}:${Y}`,archive:(F,Y)=>`archive:${W(F)}:${Y}`,stateExecution:(F,Y)=>`state:execution:${W(F)}:${W(Y)}`,stateWorkflow:(F,Y)=>`state:workflow-scope:${P}:${W(F)}:${W(Y)}`,streamChunkPrefix:(F,Y)=>`blob:${W(F)}:${Y}:chunk:`,streamChunk:(F,Y,J)=>`blob:${W(F)}:${Y}:chunk:${String(J).padStart(10,"0")}`,streamMetadata:(F,Y)=>`blob:${W(F)}:${Y}:meta`,budgetCharged:(F)=>`budget-charged:${F}`,toolEffect:(F,Y,J)=>`tool-effect:${W(F)}:${Y}:${J}`,workflowVisibilityStatus:(F,Y)=>`wf-idx-status:${W(F)}:${W(Y)}`,workflowVisibilityType:(F,Y)=>`wf-idx-type:${W(F)}:${W(Y)}`,workflowVisibilityCreated:(F,Y)=>`wf-idx-created:${j(F)}:${W(Y)}`,workflowVisibilityUpdated:(F,Y)=>`wf-idx-updated:${j(F)}:${W(Y)}`,workflowVisibilityDeadline:(F,Y)=>`wf-idx-deadline:${j(F)}:${W(Y)}`,workflowVisibilityManifest:(F)=>`wf-idx-manifest:${W(F)}`,workflowVisibilityMetaVersion:()=>"wf-idx-meta:version",workflowVisibilityMetaBuiltAt:()=>"wf-idx-meta:built-at",workflowVisibilityMetaCursor:()=>"wf-idx-meta:cursor"}});function FF(F){if(F===void 0)return;if(typeof F!=="number"||!Number.isInteger(F)||F<0)throw Error("deleteRange limit must be a finite non-negative integer");return F===0?0:F}function L(F){let Y={},J=!1;for(let X of["gt","gte","lt","lte"]){let $=F[X];if($===void 0)continue;if(typeof $!=="string")throw Error("deleteRange bounds must be strings");Y[X]=$,J=!0}if(!J)throw Error("deleteRange requires at least one of gt/gte/lt/lte; use deletePrefix to delete a whole prefix");let Z=FF(F.limit);if(Z!==void 0)Y.limit=Z;return Y}async function y(F,Y,J){let Z=L(J);if(F.deleteRange)return F.deleteRange(Y,Z);return v(F,Y,Z)}var D=()=>{};function M(F){return F.replaceAll(/:+$/g,"")}function YF(F,Y){let J=M(F),Z=M(Y);if(J.length===0)return Z;if(Z.length===0)return J;return`${J}:${Z}`}function u(F,Y){return new R(F,Y)}var R;var c=_(()=>{D();E();R=class R{#F;#J;constructor(F,Y){this.#F=F,this.#J=M(Y)}#Y(F){if(this.#J.length===0)return F;return F.length===0?`${this.#J}:`:`${this.#J}:${F}`}#W(F){if(this.#J.length===0)return F;return F.slice(this.#J.length+1)}#Z(F={}){let Y={};if(F.limit!==void 0)Y.limit=F.limit;if(F.reverse!==void 0)Y.reverse=F.reverse;if(F.gt!==void 0)Y.gt=this.#Y(F.gt);if(F.gte!==void 0)Y.gte=this.#Y(F.gte);if(F.lt!==void 0)Y.lt=this.#Y(F.lt);if(F.lte!==void 0)Y.lte=this.#Y(F.lte);return Y}#$(F){let Y={};if(F.limit!==void 0)Y.limit=F.limit;if(F.gt!==void 0)Y.gt=this.#Y(F.gt);if(F.gte!==void 0)Y.gte=this.#Y(F.gte);if(F.lt!==void 0)Y.lt=this.#Y(F.lt);if(F.lte!==void 0)Y.lte=this.#Y(F.lte);return Y}capabilities(){return this.#F.capabilities()}scoped(F){return new R(this.#F,YF(this.#J,F))}async get(F){return this.#F.get(this.#Y(F))}async put(F,Y){await this.#F.put(this.#Y(F),Y)}async delete(F){await this.#F.delete(this.#Y(F))}async*scan(F,Y){for await(let[J,Z]of this.#F.scan(this.#Y(F),this.#Z(Y)))yield[this.#W(J),Z]}async batch(F){await this.#F.batch(F.map((Y)=>{if(Y.type==="put")return{type:"put",key:this.#Y(Y.key),value:Y.value};return{type:"delete",key:this.#Y(Y.key)}}))}async conditionalBatch(F,Y){return m(this.#F,F.map((J)=>({key:this.#Y(J.key),expectedValue:J.expectedValue})),Y.map((J)=>{if(J.type==="put")return{type:"put",key:this.#Y(J.key),value:J.value};return{type:"delete",key:this.#Y(J.key)}}))}async has(F){return x(this.#F,this.#Y(F))}async deletePrefix(F){return k(this.#F,this.#Y(F))}async deleteRange(F,Y){let J=this.#$(L(Y));return y(this.#F,this.#Y(F),J)}async*keys(F,Y){for await(let J of S(this.#F,this.#Y(F),this.#Z(Y)))yield this.#W(J)}async count(F){return w(this.#F,this.#Y(F))}[Symbol.dispose](){this.#F[Symbol.dispose]()}}});var JF={};t(JF,{MemoryStorage:()=>z});var z;var l=_(()=>{D();E();c();z=class z{#F;constructor(){this.#F=new Map}capabilities(){return{persistence:"ephemeral",readAfterWrite:"linearizable",scanConsistency:"snapshot",atomicBatch:!0,conditionalBatch:!0,boundedRangeDelete:!0}}#J(F,Y,J){return F>=Y&&F<J}#Y(F,Y){let J=[];for(let Z of this.#F.keys())if(this.#J(Z,F,Y))J.push(Z);return J.toSorted()}async get(F){return this.#F.get(F)??null}async put(F,Y){this.#F.set(F,Y)}async delete(F){this.#F.delete(F)}async*scan(F,Y={}){let{limit:J,reverse:Z}=Y,X=q(F),$=this.#Y(F,X);if($=$.filter((Q)=>N(Q,Y)),Z)$.reverse();let H=0;for(let Q of $){if(J!==void 0&&H>=J)break;let O=this.#F.get(Q);if(O!==void 0)yield[Q,O],H++}}async batch(F){this.#W(F)}#W(F){for(let Y of F)if(Y.type==="put")this.#F.set(Y.key,Y.value);else this.#F.delete(Y.key)}async conditionalBatch(F,Y){for(let J of F){let Z=this.#F.get(J.key)??null;if(!I(Z,J.expectedValue))return!1}return this.#W(Y),!0}async has(F){return this.#F.has(F)}async deletePrefix(F){let Y=q(F),J=this.#Y(F,Y);for(let Z of J)this.#F.delete(Z);return J.length}async deleteRange(F,Y){let J=L(Y),Z=q(F),X=this.#Y(F,Z).filter((H)=>N(H,J)),$=J.limit===void 0?X:X.slice(0,J.limit);for(let H of $)this.#F.delete(H);return $.length}async*keys(F,Y={}){let{limit:J,reverse:Z}=Y,X=q(F),$=this.#Y(F,X);if($=$.filter((Q)=>N(Q,Y)),Z)$.reverse();let H=0;for(let Q of $){if(J!==void 0&&H>=J)break;yield Q,H++}}async count(F){let Y=q(F);return this.#Y(F,Y).length}scoped(F){return u(this,F)}get size(){return this.#F.size}clear(){this.#F.clear()}snapshot(){let F=new Map;for(let[Y,J]of this.#F)F.set(Y,new Uint8Array(J));return F}[Symbol.dispose](){this.#F.clear()}}});l();function G(F,Y){return import.meta.url.endsWith(".ts")?F:Y}async function V(F){return await import(F)}var WF=G("./bun-sql.ts","./bun-sql.js"),ZF=G("./node-sqlite.ts","./node-sqlite.js"),$F=G("./lmdb.ts","./lmdb.js"),XF=G("./turso.ts","./turso.js"),g=G("./indexeddb.ts","./indexeddb.js"),d=G("./web-extension.ts","./web-extension.js"),jF=G("./http.ts","./http.js"),VF=G("./auto.ts","./auto.js");function p(){return typeof Bun<"u"}function s(){return typeof globalThis.process==="object"&&globalThis.process!==null&&typeof globalThis.process.versions==="object"&&typeof globalThis.process.versions.node==="string"}function HF(){let F=globalThis;return F.browser?.storage!==void 0||F.chrome?.storage!==void 0}function QF(){return typeof globalThis.indexedDB<"u"}async function GF(F){if(p()){let{BunSQLiteStorage:Y}=await V(WF);return new Y(F)}if(s()){let{NodeSQLiteStorage:Y}=await V(ZF);return new Y(F)}throw Error("SQLite storage is only available in Bun or Node runtimes.")}async function qF(){if(p()||s()){let{resolveDefaultStorage:F}=await V(VF);return F()}if(HF()){let{WebExtensionStorage:F}=await V(d);return new F}if(QF()){let{IndexedDBStorage:F}=await V(g);return new F}return new z}var a={memory:async(F)=>new z,sqlite:async(F)=>GF(F.path),lmdb:async(F)=>{let{LMDBStorage:Y}=await V($F);return new Y(F.path)},turso:async(F)=>{let{TursoStorage:Y}=await V(XF);return new Y({url:F.url,...F.authToken===void 0?{}:{authToken:F.authToken}})},indexeddb:async(F)=>{let{IndexedDBStorage:Y}=await V(g);return new Y(F.databaseName)},"web-extension":async(F)=>{let{WebExtensionStorage:Y}=await V(d);return new Y(F.area===void 0?{}:{area:F.area})},http:async(F)=>{let{HTTPStorage:Y}=await V(jF);return new Y({baseUrl:F.baseUrl,...F.headers===void 0?{}:{headers:F.headers}})},auto:async(F)=>qF()};function _F(F){if(typeof F!=="object"||F===null)return"unknown";if(!("type"in F))return"unknown";return typeof F.type==="string"?F.type:"unknown"}function UF(F){if(typeof F!=="object"||F===null||Array.isArray(F))throw Error("Storage configuration must be an object.");return F}function f(F,Y,J){let Z=F[Y];if(typeof Z!=="string"||Z.length===0)throw Error(`${J} storage configuration requires "${Y}" as a string.`);return Z}function T(F,Y,J){let Z=F[Y];if(Z===void 0)return;if(typeof Z!=="string")throw Error(`${J} storage configuration field "${Y}" must be a string.`);return Z}function BF(F,Y,J){let Z=F[Y];if(typeof Z==="string"||Z instanceof URL)return Z;throw Error(`${J} storage configuration requires "${Y}" as a string or URL.`)}function LF(F){let Y=F.headers;if(Y===void 0)return;if(typeof Y!=="object"||Y===null||Array.isArray(Y))throw Error('HTTP storage configuration field "headers" must be a string record.');let J={};for(let[Z,X]of Object.entries(Y)){if(typeof X!=="string")throw Error('HTTP storage configuration field "headers" must be a string record.');J[Z]=X}return J}function zF(F){let Y=F.area;if(Y===void 0)return;if(Y==="local"||Y==="sync"||Y==="session"||Y==="managed")return Y;throw Error('WebExtension storage configuration field "area" must be one of local, sync, session, or managed.')}var NF={memory:(F)=>({type:"memory"}),sqlite:(F)=>{let Y=T(F,"path","SQLite");return Y===void 0?{type:"sqlite"}:{type:"sqlite",path:Y}},lmdb:(F)=>({type:"lmdb",path:f(F,"path","LMDB")}),turso:(F)=>{let Y=T(F,"authToken","Turso");return{type:"turso",url:f(F,"url","Turso"),...Y===void 0?{}:{authToken:Y}}},indexeddb:(F)=>{let Y=T(F,"databaseName","IndexedDB");return Y===void 0?{type:"indexeddb"}:{type:"indexeddb",databaseName:Y}},"web-extension":(F)=>{let Y=zF(F);return Y===void 0?{type:"web-extension"}:{type:"web-extension",area:Y}},http:(F)=>{let Y=LF(F);return{type:"http",baseUrl:BF(F,"baseUrl","HTTP"),...Y===void 0?{}:{headers:Y}}},auto:(F)=>({type:"auto"})};function AF(F,Y){return NF[Y](UF(F))}function PF(F){return Object.hasOwn(a,F)}async function pF(F){let Y=_F(F);if(!PF(Y))throw Error(`Unsupported storage configuration type: ${Y}`);let J=AF(F,Y),Z=a[Y];return Z(J)}export{pF as resolveStorage};
|
|
2
|
+
var r=Object.defineProperty;var i=(F)=>F;function n(F,Y){this[F]=i.bind(null,Y)}var t=(F,Y)=>{for(var W in Y)r(F,W,{get:Y[W],enumerable:!0,configurable:!0,set:n.bind(Y,W)})};var U=(F,Y)=>()=>(F&&(Y=F(F=0)),Y);function N(F,Y,W){if(!F.capabilities()[Y])throw Error(`Feature "${W}" requires storage capability "${Y}", but this storage backend does not provide it.`)}function o(F){let Y=F.capabilities(),W=[];if(Y.persistence!=="local"&&Y.persistence!=="remote")W.push(`persistence must be "local" or "remote" (got "${Y.persistence}")`);if(Y.readAfterWrite!=="linearizable")W.push(`readAfterWrite must be "linearizable" (got "${Y.readAfterWrite}")`);if(Y.scanConsistency!=="snapshot")W.push(`scanConsistency must be "snapshot" (got "${Y.scanConsistency}")`);if(!Y.atomicBatch)W.push("atomicBatch must be true");if(!Y.conditionalBatch)W.push("conditionalBatch must be true");if(W.length>0)throw Error(`Storage is not durable enough for recovery: ${W.join("; ")}.`)}var P="default";async function b(F,Y){return await F.get(Y)!==null}async function*B(F,Y,W){for await(let[Z]of F.scan(Y,W))yield Z}async function v(F,Y){let W=0;for await(let Z of B(F,Y))W++;return W}async function C(F,Y){let W=[];for await(let Z of B(F,Y))W.push({type:"delete",key:Z});if(W.length===0)return 0;return await F.batch(W),W.length}async function K(F,Y,W){let Z=[];for await(let X of B(F,Y,W))Z.push({type:"delete",key:X});if(Z.length===0)return 0;return await F.batch(Z),Z.length}var e;var I=U(()=>{e=["actrec:","archive:","async-act:","attr:","audit:bulk:","blob:","budget:","budget-charged:","ev:","idx:","liveness:","offload:","op:","review:","schedule:","schedule-due:","schedule-run:","sig:","sigres:","sigseq:","start-idem:","state:","tag:","tool-effect:","upd:","upk:","upr:","wf:","wf-cleanup:","wf-cleanup-needed:","wf-deadline:","wf-delayed:","wf-has-services:","wf-headers:","wf-idx-","wf-terminal:"]});function q(F){return F.length>0?F.slice(0,-1)+String.fromCharCode(F.charCodeAt(F.length-1)+1):"\xFF"}function A(F,Y={}){if(Y.gt!==void 0&&F<=Y.gt)return!1;if(Y.gte!==void 0&&F<Y.gte)return!1;if(Y.lt!==void 0&&F>=Y.lt)return!1;if(Y.lte!==void 0&&F>Y.lte)return!1;return!0}function x(F,Y){if(F===null||Y===null)return F===Y;if(F.byteLength!==Y.byteLength)return!1;for(let W=0;W<F.byteLength;W++)if(F[W]!==Y[W])return!1;return!0}async function w(F,Y){if(F.has)return F.has(Y);return b(F,Y)}function S(F,Y,W){if(F.keys)return F.keys(Y,W);return B(F,Y,W)}async function k(F,Y){if(F.count)return F.count(Y);return v(F,Y)}async function m(F,Y){if(F.deletePrefix)return F.deletePrefix(Y);return C(F,Y)}async function u(F,Y,W){if(N(F,"conditionalBatch","storageConditionalBatch"),!F.conditionalBatch)throw Error("This storage backend reports conditionalBatch capability but does not implement the conditionalBatch() method.");return F.conditionalBatch(Y,W)}function J(F){return encodeURIComponent(F)}function CF(F){return decodeURIComponent(F)}function KF(F){try{return decodeURIComponent(F)}catch{return null}}var Q=(F)=>String(F).padStart(16,"0"),IF;var E=U(()=>{I();IF={workflow:(F)=>`wf:${J(F)}`,checkpoint:(F)=>`wf:${J(F)}:ckpt`,checkpointHistory:(F,Y)=>`wf:${J(F)}:ckpt:${String(Y).padStart(10,"0")}`,timelinePrefix:(F)=>`wf:${J(F)}:timeline:`,timeline:(F,Y)=>`wf:${J(F)}:timeline:${String(Y).padStart(10,"0")}`,schedule:(F)=>`schedule:${J(F)}`,scheduleTick:(F,Y)=>`schedule-due:${String(F).padStart(16,"0")}:${J(Y)}`,scheduleRun:(F)=>`schedule-run:${J(F)}`,operation:(F,Y,W)=>`op:${F}:${Q(Y)}:${W}`,operationInflight:(F)=>`op:inflight:${F}`,operationQueued:(F)=>`op:queued:${F}`,operationResolved:(F)=>`op:resolved:${F}`,bulkOperationAuditPrefix:()=>"audit:bulk:",bulkOperationAudit:(F,Y,W)=>`audit:bulk:${Q(F)}:${J(Y)}:${J(W)}`,operationResolvedByTimePrefix:()=>"op:resolved-by-time:",operationResolvedByTime:(F,Y)=>`op:resolved-by-time:${Q(F)}:${J(Y)}`,asyncActivity:(F,Y)=>`async-act:v1:${J(F)}:${J(Y)}`,activityReconciliationPrefix:(F)=>`actrec:v1:${J(F)}:`,activityReconciliation:(F,Y,W)=>`actrec:v1:${J(F)}:${J(Y)}:${W}`,eventPrefix:(F)=>`ev:${J(F)}:`,event:(F,Y)=>`ev:${J(F)}:${String(Y).padStart(10,"0")}`,eventHead:(F)=>`ev:${J(F)}:head`,eventWatermark:(F)=>`ev:${J(F)}:watermark`,signal:(F,Y,W)=>`sig:${J(F)}:${Y}:${J(W)}`,signalSequence:(F)=>`sigseq:v1:${J(F)}`,signalAcceptedResponsePrefix:(F)=>`sigres:v1:${J(F)}:`,signalAcceptedResponse:(F,Y,W)=>`sigres:v1:${J(F)}:${J(Y)}:${J(W)}`,deadline:(F,Y)=>`wf-deadline:${Q(F)}:${J(Y)}`,terminalCleanup:(F,Y)=>`wf-cleanup:${Q(F)}:${J(Y)}`,delayedStart:(F,Y)=>`wf-delayed:${Q(F)}:${J(Y)}`,terminalWorkflowPrefix:()=>"wf-terminal:",terminalWorkflow:(F,Y)=>`wf-terminal:${Q(F)}:${J(Y)}`,attribute:(F)=>`attr:${J(F)}`,attributeIndex:(F,Y,W)=>`idx:${F}:${Y}:${J(W)}`,tagIndex:(F,Y)=>`tag:${J(F)}:${J(Y)}`,updatePrefix:(F)=>`upd:${J(F)}:`,update:(F,Y)=>`upd:${J(F)}:${Y}`,updateResponse:(F)=>`upr:${F}`,updateIdempotency:(F,Y)=>`upk:${J(F)}:${Y}`,startIdempotency:(F)=>`start-idem:${J(F)}`,startIdempotencySignalId:(F)=>`start-idem:${F}`,livenessPrefix:()=>"liveness:",liveness:(F)=>`liveness:${J(F)}`,budget:(F,Y,W)=>`budget:${F}:${Y}:${W}`,review:(F,Y)=>`review:${J(F)}:${Y}`,workflowHeaders:(F)=>`wf-headers:${J(F)}`,terminalCleanupNeeded:(F)=>`wf-cleanup-needed:${J(F)}`,workflowHasServices:(F)=>`wf-has-services:${J(F)}`,offload:(F,Y)=>`offload:${J(F)}:${Y}`,archive:(F,Y)=>`archive:${J(F)}:${Y}`,stateExecution:(F,Y)=>`state:execution:${J(F)}:${J(Y)}`,stateWorkflow:(F,Y)=>`state:workflow-scope:${P}:${J(F)}:${J(Y)}`,streamChunkPrefix:(F,Y)=>`blob:${J(F)}:${Y}:chunk:`,streamChunk:(F,Y,W)=>`blob:${J(F)}:${Y}:chunk:${String(W).padStart(10,"0")}`,streamMetadata:(F,Y)=>`blob:${J(F)}:${Y}:meta`,budgetCharged:(F)=>`budget-charged:${F}`,toolEffect:(F,Y,W)=>`tool-effect:${J(F)}:${Y}:${W}`,workflowVisibilityStatus:(F,Y)=>`wf-idx-status:${J(F)}:${J(Y)}`,workflowVisibilityType:(F,Y)=>`wf-idx-type:${J(F)}:${J(Y)}`,workflowVisibilityCreated:(F,Y)=>`wf-idx-created:${Q(F)}:${J(Y)}`,workflowVisibilityUpdated:(F,Y)=>`wf-idx-updated:${Q(F)}:${J(Y)}`,workflowVisibilityDeadline:(F,Y)=>`wf-idx-deadline:${Q(F)}:${J(Y)}`,workflowVisibilityManifest:(F)=>`wf-idx-manifest:${J(F)}`,workflowVisibilityMetaVersion:()=>"wf-idx-meta:version",workflowVisibilityMetaBuiltAt:()=>"wf-idx-meta:built-at",workflowVisibilityMetaCursor:()=>"wf-idx-meta:cursor"}});function FF(F){if(F===void 0)return;if(typeof F!=="number"||!Number.isInteger(F)||F<0)throw Error("deleteRange limit must be a finite non-negative integer");return F===0?0:F}function L(F){let Y={},W=!1;for(let X of["gt","gte","lt","lte"]){let $=F[X];if($===void 0)continue;if(typeof $!=="string")throw Error("deleteRange bounds must be strings");Y[X]=$,W=!0}if(!W)throw Error("deleteRange requires at least one of gt/gte/lt/lte; use deletePrefix to delete a whole prefix");let Z=FF(F.limit);if(Z!==void 0)Y.limit=Z;return Y}async function y(F,Y,W){let Z=L(W);if(F.deleteRange)return F.deleteRange(Y,Z);return K(F,Y,Z)}var D=()=>{};function R(F){return F.replaceAll(/:+$/g,"")}function YF(F,Y){let W=R(F),Z=R(Y);if(W.length===0)return Z;if(Z.length===0)return W;return`${W}:${Z}`}function c(F,Y){return new M(F,Y)}var M;var l=U(()=>{D();E();M=class M{#F;#W;constructor(F,Y){this.#F=F,this.#W=R(Y)}#Y(F){if(this.#W.length===0)return F;return F.length===0?`${this.#W}:`:`${this.#W}:${F}`}#J(F){if(this.#W.length===0)return F;return F.slice(this.#W.length+1)}#Z(F={}){let Y={};if(F.limit!==void 0)Y.limit=F.limit;if(F.reverse!==void 0)Y.reverse=F.reverse;if(F.gt!==void 0)Y.gt=this.#Y(F.gt);if(F.gte!==void 0)Y.gte=this.#Y(F.gte);if(F.lt!==void 0)Y.lt=this.#Y(F.lt);if(F.lte!==void 0)Y.lte=this.#Y(F.lte);return Y}#$(F){let Y={};if(F.limit!==void 0)Y.limit=F.limit;if(F.gt!==void 0)Y.gt=this.#Y(F.gt);if(F.gte!==void 0)Y.gte=this.#Y(F.gte);if(F.lt!==void 0)Y.lt=this.#Y(F.lt);if(F.lte!==void 0)Y.lte=this.#Y(F.lte);return Y}capabilities(){return this.#F.capabilities()}scoped(F){return new M(this.#F,YF(this.#W,F))}async get(F){return this.#F.get(this.#Y(F))}async put(F,Y){await this.#F.put(this.#Y(F),Y)}async delete(F){await this.#F.delete(this.#Y(F))}async*scan(F,Y){for await(let[W,Z]of this.#F.scan(this.#Y(F),this.#Z(Y)))yield[this.#J(W),Z]}async batch(F){await this.#F.batch(F.map((Y)=>{if(Y.type==="put")return{type:"put",key:this.#Y(Y.key),value:Y.value};return{type:"delete",key:this.#Y(Y.key)}}))}async conditionalBatch(F,Y){return u(this.#F,F.map((W)=>({key:this.#Y(W.key),expectedValue:W.expectedValue})),Y.map((W)=>{if(W.type==="put")return{type:"put",key:this.#Y(W.key),value:W.value};return{type:"delete",key:this.#Y(W.key)}}))}async has(F){return w(this.#F,this.#Y(F))}async deletePrefix(F){return m(this.#F,this.#Y(F))}async deleteRange(F,Y){let W=this.#$(L(Y));return y(this.#F,this.#Y(F),W)}async*keys(F,Y){for await(let W of S(this.#F,this.#Y(F),this.#Z(Y)))yield this.#J(W)}async count(F){return k(this.#F,this.#Y(F))}[Symbol.dispose](){this.#F[Symbol.dispose]()}}});var WF={};t(WF,{MemoryStorage:()=>z});var z;var f=U(()=>{D();E();l();z=class z{#F;constructor(){this.#F=new Map}capabilities(){return{persistence:"ephemeral",readAfterWrite:"linearizable",scanConsistency:"snapshot",atomicBatch:!0,conditionalBatch:!0,boundedRangeDelete:!0}}#W(F,Y,W){return F>=Y&&F<W}#Y(F,Y){let W=[];for(let Z of this.#F.keys())if(this.#W(Z,F,Y))W.push(Z);return W.toSorted()}async get(F){return this.#F.get(F)??null}async put(F,Y){this.#F.set(F,Y)}async delete(F){this.#F.delete(F)}async*scan(F,Y={}){let{limit:W,reverse:Z}=Y,X=q(F),$=this.#Y(F,X);if($=$.filter((G)=>A(G,Y)),Z)$.reverse();let V=0;for(let G of $){if(W!==void 0&&V>=W)break;let h=this.#F.get(G);if(h!==void 0)yield[G,h],V++}}async batch(F){this.#J(F)}#J(F){for(let Y of F)if(Y.type==="put")this.#F.set(Y.key,Y.value);else this.#F.delete(Y.key)}async conditionalBatch(F,Y){for(let W of F){let Z=this.#F.get(W.key)??null;if(!x(Z,W.expectedValue))return!1}return this.#J(Y),!0}async has(F){return this.#F.has(F)}async deletePrefix(F){let Y=q(F),W=this.#Y(F,Y);for(let Z of W)this.#F.delete(Z);return W.length}async deleteRange(F,Y){let W=L(Y),Z=q(F),X=this.#Y(F,Z).filter((V)=>A(V,W)),$=W.limit===void 0?X:X.slice(0,W.limit);for(let V of $)this.#F.delete(V);return $.length}async*keys(F,Y={}){let{limit:W,reverse:Z}=Y,X=q(F),$=this.#Y(F,X);if($=$.filter((G)=>A(G,Y)),Z)$.reverse();let V=0;for(let G of $){if(W!==void 0&&V>=W)break;yield G,V++}}async count(F){let Y=q(F);return this.#Y(F,Y).length}scoped(F){return c(this,F)}get size(){return this.#F.size}clear(){this.#F.clear()}snapshot(){let F=new Map;for(let[Y,W]of this.#F)F.set(Y,new Uint8Array(W));return F}[Symbol.dispose](){this.#F.clear()}}});f();function H(F,Y){return import.meta.url.endsWith(".ts")?F:Y}async function j(F){return await import(F)}var JF=H("./bun-sql.ts","./bun-sql.js"),ZF=H("./node-sqlite.ts","./node-sqlite.js"),$F=H("./lmdb.ts","./lmdb.js"),XF=H("./turso.ts","./turso.js"),jF=H("./neon.ts","./neon.js"),g=H("./indexeddb.ts","./indexeddb.js"),d=H("./web-extension.ts","./web-extension.js"),QF=H("./http.ts","./http.js"),VF=H("./auto.ts","./auto.js");function s(){return typeof Bun<"u"}function p(){return typeof globalThis.process==="object"&&globalThis.process!==null&&typeof globalThis.process.versions==="object"&&typeof globalThis.process.versions.node==="string"}function HF(){let F=globalThis;return F.browser?.storage!==void 0||F.chrome?.storage!==void 0}function GF(){return typeof globalThis.indexedDB<"u"}async function qF(F){if(s()){let{BunSQLiteStorage:Y}=await j(JF);return new Y(F)}if(p()){let{NodeSQLiteStorage:Y}=await j(ZF);return new Y(F)}throw Error("SQLite storage is only available in Bun or Node runtimes.")}async function UF(){if(s()||p()){let{resolveDefaultStorage:F}=await j(VF);return F()}if(HF()){let{WebExtensionStorage:F}=await j(d);return new F}if(GF()){let{IndexedDBStorage:F}=await j(g);return new F}return new z}var a={memory:async(F)=>new z,sqlite:async(F)=>qF(F.path),lmdb:async(F)=>{let{LMDBStorage:Y}=await j($F);return new Y(F.path)},turso:async(F)=>{let{TursoStorage:Y}=await j(XF);return new Y({url:F.url,...F.authToken===void 0?{}:{authToken:F.authToken}})},neon:async(F)=>{let{NeonStorage:Y}=await j(jF);return new Y({url:F.url})},indexeddb:async(F)=>{let{IndexedDBStorage:Y}=await j(g);return new Y(F.databaseName)},"web-extension":async(F)=>{let{WebExtensionStorage:Y}=await j(d);return new Y(F.area===void 0?{}:{area:F.area})},http:async(F)=>{let{HTTPStorage:Y}=await j(QF);return new Y({baseUrl:F.baseUrl,...F.headers===void 0?{}:{headers:F.headers}})},auto:async(F)=>UF()};function _F(F){if(typeof F!=="object"||F===null)return"unknown";if(!("type"in F))return"unknown";return typeof F.type==="string"?F.type:"unknown"}function BF(F){if(typeof F!=="object"||F===null||Array.isArray(F))throw Error("Storage configuration must be an object.");return F}function T(F,Y,W){let Z=F[Y];if(typeof Z!=="string"||Z.length===0)throw Error(`${W} storage configuration requires "${Y}" as a string.`);return Z}function O(F,Y,W){let Z=F[Y];if(Z===void 0)return;if(typeof Z!=="string")throw Error(`${W} storage configuration field "${Y}" must be a string.`);return Z}function LF(F,Y,W){let Z=F[Y];if(typeof Z==="string"||Z instanceof URL)return Z;throw Error(`${W} storage configuration requires "${Y}" as a string or URL.`)}function zF(F){let Y=F.headers;if(Y===void 0)return;if(typeof Y!=="object"||Y===null||Array.isArray(Y))throw Error('HTTP storage configuration field "headers" must be a string record.');let W={};for(let[Z,X]of Object.entries(Y)){if(typeof X!=="string")throw Error('HTTP storage configuration field "headers" must be a string record.');W[Z]=X}return W}function AF(F){let Y=F.area;if(Y===void 0)return;if(Y==="local"||Y==="sync"||Y==="session"||Y==="managed")return Y;throw Error('WebExtension storage configuration field "area" must be one of local, sync, session, or managed.')}var NF={memory:(F)=>({type:"memory"}),sqlite:(F)=>{let Y=O(F,"path","SQLite");return Y===void 0?{type:"sqlite"}:{type:"sqlite",path:Y}},lmdb:(F)=>({type:"lmdb",path:T(F,"path","LMDB")}),turso:(F)=>{let Y=O(F,"authToken","Turso");return{type:"turso",url:T(F,"url","Turso"),...Y===void 0?{}:{authToken:Y}}},neon:(F)=>({type:"neon",url:T(F,"url","Neon")}),indexeddb:(F)=>{let Y=O(F,"databaseName","IndexedDB");return Y===void 0?{type:"indexeddb"}:{type:"indexeddb",databaseName:Y}},"web-extension":(F)=>{let Y=AF(F);return Y===void 0?{type:"web-extension"}:{type:"web-extension",area:Y}},http:(F)=>{let Y=zF(F);return{type:"http",baseUrl:LF(F,"baseUrl","HTTP"),...Y===void 0?{}:{headers:Y}}},auto:(F)=>({type:"auto"})};function PF(F,Y){return NF[Y](BF(F))}function EF(F){return Object.hasOwn(a,F)}async function pF(F){let Y=_F(F);if(!EF(Y))throw Error(`Unsupported storage configuration type: ${Y}`);let W=PF(F,Y),Z=a[Y];return Z(W)}export{pF as resolveStorage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var b=Object.defineProperty;var
|
|
2
|
+
var b=Object.defineProperty;var u=(E)=>E;function C(E,_){this[E]=u.bind(null,_)}var k=(E,_)=>{for(var F in _)b(E,F,{get:_[F],enumerable:!0,configurable:!0,set:C.bind(_,F)})};var V=(E,_)=>()=>(E&&(_=E(E=0)),_);function $(E,_,F){if(!E.capabilities()[_])throw Error(`Feature "${F}" requires storage capability "${_}", but this storage backend does not provide it.`)}function S(E){let _=E.capabilities(),F=[];if(_.persistence!=="local"&&_.persistence!=="remote")F.push(`persistence must be "local" or "remote" (got "${_.persistence}")`);if(_.readAfterWrite!=="linearizable")F.push(`readAfterWrite must be "linearizable" (got "${_.readAfterWrite}")`);if(_.scanConsistency!=="snapshot")F.push(`scanConsistency must be "snapshot" (got "${_.scanConsistency}")`);if(!_.atomicBatch)F.push("atomicBatch must be true");if(!_.conditionalBatch)F.push("conditionalBatch must be true");if(F.length>0)throw Error(`Storage is not durable enough for recovery: ${F.join("; ")}.`)}var G="default";async function L(E,_){return await E.get(_)!==null}async function*Q(E,_,F){for await(let[Y]of E.scan(_,F))yield Y}async function B(E,_){let F=0;for await(let Y of Q(E,_))F++;return F}async function R(E,_){let F=[];for await(let Y of Q(E,_))F.push({type:"delete",key:Y});if(F.length===0)return 0;return await E.batch(F),F.length}async function q(E,_,F){let Y=[];for await(let U of Q(E,_,F))Y.push({type:"delete",key:U});if(Y.length===0)return 0;return await E.batch(Y),Y.length}var K;var N=V(()=>{K=["actrec:","archive:","async-act:","attr:","audit:bulk:","blob:","budget:","budget-charged:","ev:","idx:","liveness:","offload:","op:","review:","schedule:","schedule-due:","schedule-run:","sig:","sigres:","sigseq:","start-idem:","state:","tag:","tool-effect:","upd:","upk:","upr:","wf:","wf-cleanup:","wf-cleanup-needed:","wf-deadline:","wf-delayed:","wf-has-services:","wf-headers:","wf-idx-","wf-terminal:"]});function p(E){return E.length>0?E.slice(0,-1)+String.fromCharCode(E.charCodeAt(E.length-1)+1):"\xFF"}function a(E,_={}){if(_.gt!==void 0&&E<=_.gt)return!1;if(_.gte!==void 0&&E<_.gte)return!1;if(_.lt!==void 0&&E>=_.lt)return!1;if(_.lte!==void 0&&E>_.lte)return!1;return!0}function i(E,_){if(E===null||_===null)return E===_;if(E.byteLength!==_.byteLength)return!1;for(let F=0;F<E.byteLength;F++)if(E[F]!==_[F])return!1;return!0}async function D(E,_){if(E.has)return E.has(_);return L(E,_)}function T(E,_,F){if(E.keys)return E.keys(_,F);return Q(E,_,F)}async function A(E,_){if(E.count)return E.count(_);return B(E,_)}async function O(E,_){if(E.deletePrefix)return E.deletePrefix(_);return R(E,_)}async function z(E,_,F){if($(E,"conditionalBatch","storageConditionalBatch"),!E.conditionalBatch)throw Error("This storage backend reports conditionalBatch capability but does not implement the conditionalBatch() method.");return E.conditionalBatch(_,F)}function W(E){return encodeURIComponent(E)}function r(E){return decodeURIComponent(E)}function n(E){try{return decodeURIComponent(E)}catch{return null}}var X=(E)=>String(E).padStart(16,"0"),t;var P=V(()=>{N();t={workflow:(E)=>`wf:${W(E)}`,checkpoint:(E)=>`wf:${W(E)}:ckpt`,checkpointHistory:(E,_)=>`wf:${W(E)}:ckpt:${String(_).padStart(10,"0")}`,timelinePrefix:(E)=>`wf:${W(E)}:timeline:`,timeline:(E,_)=>`wf:${W(E)}:timeline:${String(_).padStart(10,"0")}`,schedule:(E)=>`schedule:${W(E)}`,scheduleTick:(E,_)=>`schedule-due:${String(E).padStart(16,"0")}:${W(_)}`,scheduleRun:(E)=>`schedule-run:${W(E)}`,operation:(E,_,F)=>`op:${E}:${X(_)}:${F}`,operationInflight:(E)=>`op:inflight:${E}`,operationQueued:(E)=>`op:queued:${E}`,operationResolved:(E)=>`op:resolved:${E}`,bulkOperationAuditPrefix:()=>"audit:bulk:",bulkOperationAudit:(E,_,F)=>`audit:bulk:${X(E)}:${W(_)}:${W(F)}`,operationResolvedByTimePrefix:()=>"op:resolved-by-time:",operationResolvedByTime:(E,_)=>`op:resolved-by-time:${X(E)}:${W(_)}`,asyncActivity:(E,_)=>`async-act:v1:${W(E)}:${W(_)}`,activityReconciliationPrefix:(E)=>`actrec:v1:${W(E)}:`,activityReconciliation:(E,_,F)=>`actrec:v1:${W(E)}:${W(_)}:${F}`,eventPrefix:(E)=>`ev:${W(E)}:`,event:(E,_)=>`ev:${W(E)}:${String(_).padStart(10,"0")}`,eventHead:(E)=>`ev:${W(E)}:head`,eventWatermark:(E)=>`ev:${W(E)}:watermark`,signal:(E,_,F)=>`sig:${W(E)}:${_}:${W(F)}`,signalSequence:(E)=>`sigseq:v1:${W(E)}`,signalAcceptedResponsePrefix:(E)=>`sigres:v1:${W(E)}:`,signalAcceptedResponse:(E,_,F)=>`sigres:v1:${W(E)}:${W(_)}:${W(F)}`,deadline:(E,_)=>`wf-deadline:${X(E)}:${W(_)}`,terminalCleanup:(E,_)=>`wf-cleanup:${X(E)}:${W(_)}`,delayedStart:(E,_)=>`wf-delayed:${X(E)}:${W(_)}`,terminalWorkflowPrefix:()=>"wf-terminal:",terminalWorkflow:(E,_)=>`wf-terminal:${X(E)}:${W(_)}`,attribute:(E)=>`attr:${W(E)}`,attributeIndex:(E,_,F)=>`idx:${E}:${_}:${W(F)}`,tagIndex:(E,_)=>`tag:${W(E)}:${W(_)}`,updatePrefix:(E)=>`upd:${W(E)}:`,update:(E,_)=>`upd:${W(E)}:${_}`,updateResponse:(E)=>`upr:${E}`,updateIdempotency:(E,_)=>`upk:${W(E)}:${_}`,startIdempotency:(E)=>`start-idem:${W(E)}`,startIdempotencySignalId:(E)=>`start-idem:${E}`,livenessPrefix:()=>"liveness:",liveness:(E)=>`liveness:${W(E)}`,budget:(E,_,F)=>`budget:${E}:${_}:${F}`,review:(E,_)=>`review:${W(E)}:${_}`,workflowHeaders:(E)=>`wf-headers:${W(E)}`,terminalCleanupNeeded:(E)=>`wf-cleanup-needed:${W(E)}`,workflowHasServices:(E)=>`wf-has-services:${W(E)}`,offload:(E,_)=>`offload:${W(E)}:${_}`,archive:(E,_)=>`archive:${W(E)}:${_}`,stateExecution:(E,_)=>`state:execution:${W(E)}:${W(_)}`,stateWorkflow:(E,_)=>`state:workflow-scope:${G}:${W(E)}:${W(_)}`,streamChunkPrefix:(E,_)=>`blob:${W(E)}:${_}:chunk:`,streamChunk:(E,_,F)=>`blob:${W(E)}:${_}:chunk:${String(F).padStart(10,"0")}`,streamMetadata:(E,_)=>`blob:${W(E)}:${_}:meta`,budgetCharged:(E)=>`budget-charged:${E}`,toolEffect:(E,_,F)=>`tool-effect:${W(E)}:${_}:${F}`,workflowVisibilityStatus:(E,_)=>`wf-idx-status:${W(E)}:${W(_)}`,workflowVisibilityType:(E,_)=>`wf-idx-type:${W(E)}:${W(_)}`,workflowVisibilityCreated:(E,_)=>`wf-idx-created:${X(E)}:${W(_)}`,workflowVisibilityUpdated:(E,_)=>`wf-idx-updated:${X(E)}:${W(_)}`,workflowVisibilityDeadline:(E,_)=>`wf-idx-deadline:${X(E)}:${W(_)}`,workflowVisibilityManifest:(E)=>`wf-idx-manifest:${W(E)}`,workflowVisibilityMetaVersion:()=>"wf-idx-meta:version",workflowVisibilityMetaBuiltAt:()=>"wf-idx-meta:built-at",workflowVisibilityMetaCursor:()=>"wf-idx-meta:cursor"}});function x(E){if(E===void 0)return;if(typeof E!=="number"||!Number.isInteger(E)||E<0)throw Error("deleteRange limit must be a finite non-negative integer");return E===0?0:E}function j(E){let _={},F=!1;for(let U of["gt","gte","lt","lte"]){let Z=E[U];if(Z===void 0)continue;if(typeof Z!=="string")throw Error("deleteRange bounds must be strings");_[U]=Z,F=!0}if(!F)throw Error("deleteRange requires at least one of gt/gte/lt/lte; use deletePrefix to delete a whole prefix");let Y=x(E.limit);if(Y!==void 0)_.limit=Y;return _}async function v(E,_,F){let Y=j(F);if(E.deleteRange)return E.deleteRange(_,Y);return q(E,_,Y)}var h=()=>{};function M(E){return E.replaceAll(/:+$/g,"")}function I(E,_){let F=M(E),Y=M(_);if(F.length===0)return Y;if(Y.length===0)return F;return`${F}:${Y}`}function JE(E,_){return new H(E,_)}var H;var c=V(()=>{h();P();H=class H{#_;#F;constructor(E,_){this.#_=E,this.#F=M(_)}#E(E){if(this.#F.length===0)return E;return E.length===0?`${this.#F}:`:`${this.#F}:${E}`}#W(E){if(this.#F.length===0)return E;return E.slice(this.#F.length+1)}#Y(E={}){let _={};if(E.limit!==void 0)_.limit=E.limit;if(E.reverse!==void 0)_.reverse=E.reverse;if(E.gt!==void 0)_.gt=this.#E(E.gt);if(E.gte!==void 0)_.gte=this.#E(E.gte);if(E.lt!==void 0)_.lt=this.#E(E.lt);if(E.lte!==void 0)_.lte=this.#E(E.lte);return _}#X(E){let _={};if(E.limit!==void 0)_.limit=E.limit;if(E.gt!==void 0)_.gt=this.#E(E.gt);if(E.gte!==void 0)_.gte=this.#E(E.gte);if(E.lt!==void 0)_.lt=this.#E(E.lt);if(E.lte!==void 0)_.lte=this.#E(E.lte);return _}capabilities(){return this.#_.capabilities()}scoped(E){return new H(this.#_,I(this.#F,E))}async get(E){return this.#_.get(this.#E(E))}async put(E,_){await this.#_.put(this.#E(E),_)}async delete(E){await this.#_.delete(this.#E(E))}async*scan(E,_){for await(let[F,Y]of this.#_.scan(this.#E(E),this.#Y(_)))yield[this.#W(F),Y]}async batch(E){await this.#_.batch(E.map((_)=>{if(_.type==="put")return{type:"put",key:this.#E(_.key),value:_.value};return{type:"delete",key:this.#E(_.key)}}))}async conditionalBatch(E,_){return z(this.#_,E.map((F)=>({key:this.#E(F.key),expectedValue:F.expectedValue})),_.map((F)=>{if(F.type==="put")return{type:"put",key:this.#E(F.key),value:F.value};return{type:"delete",key:this.#E(F.key)}}))}async has(E){return D(this.#_,this.#E(E))}async deletePrefix(E){return O(this.#_,this.#E(E))}async deleteRange(E,_){let F=this.#X(j(_));return v(this.#_,this.#E(E),F)}async*keys(E,_){for await(let F of T(this.#_,this.#E(E),this.#Y(_)))yield this.#W(F)}async count(E){return A(this.#_,this.#E(E))}[Symbol.dispose](){this.#_[Symbol.dispose]()}}});c();export{JE as scopedStorage,H as ScopedStorage};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declarative storage configuration types and the `ResolvedStorage` mapping.
|
|
3
|
+
* Split out from `resolve.ts` so that module stays focused on the runtime
|
|
4
|
+
* resolver/validator logic; the public `@lostgradient/weft/storage/resolve`
|
|
5
|
+
* subpath re-exports everything here, so these types keep their documented
|
|
6
|
+
* import path.
|
|
7
|
+
*
|
|
8
|
+
* @module storage/storage-configuration
|
|
9
|
+
*/
|
|
10
|
+
import type { HTTPStorage } from './http.ts';
|
|
11
|
+
import type { IndexedDBStorage } from './indexeddb.ts';
|
|
12
|
+
import type { Storage } from './interface.ts';
|
|
13
|
+
import type { LMDBStorage } from './lmdb.ts';
|
|
14
|
+
import type { MemoryStorage } from './memory.ts';
|
|
15
|
+
import type { NeonStorage } from './neon.ts';
|
|
16
|
+
import type { SQLiteStorageInstance } from './sqlite.ts';
|
|
17
|
+
import type { TursoStorage } from './turso.ts';
|
|
18
|
+
import type { WebExtensionStorage } from './web-extension.ts';
|
|
19
|
+
/**
|
|
20
|
+
* Runtime configuration for in-memory storage.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { resolveStorage, type MemoryStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
25
|
+
*
|
|
26
|
+
* const configuration: MemoryStorageConfiguration = { type: 'memory' };
|
|
27
|
+
* const storage = await resolveStorage(configuration);
|
|
28
|
+
* void storage;
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export type MemoryStorageConfiguration = {
|
|
32
|
+
type: 'memory';
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Runtime configuration for SQLite storage.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { resolveStorage, type SQLiteStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
40
|
+
*
|
|
41
|
+
* const configuration: SQLiteStorageConfiguration = { type: 'sqlite', path: './weft.db' };
|
|
42
|
+
* const storage = await resolveStorage(configuration);
|
|
43
|
+
* void storage;
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export type SQLiteStorageConfiguration = {
|
|
47
|
+
type: 'sqlite';
|
|
48
|
+
path?: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Runtime configuration for LMDB storage.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { resolveStorage, type LMDBStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
56
|
+
*
|
|
57
|
+
* const configuration: LMDBStorageConfiguration = { type: 'lmdb', path: './weft-data' };
|
|
58
|
+
* const storage = await resolveStorage(configuration);
|
|
59
|
+
* void storage;
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export type LMDBStorageConfiguration = {
|
|
63
|
+
type: 'lmdb';
|
|
64
|
+
path: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Runtime configuration for Turso/libSQL storage.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* import { resolveStorage, type TursoStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
72
|
+
*
|
|
73
|
+
* const configuration: TursoStorageConfiguration = { type: 'turso', url: 'file:weft.db' };
|
|
74
|
+
* const storage = await resolveStorage(configuration);
|
|
75
|
+
* void storage;
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export type TursoStorageConfiguration = {
|
|
79
|
+
type: 'turso';
|
|
80
|
+
url: string;
|
|
81
|
+
authToken?: string;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Runtime configuration for Neon (or any Postgres) storage.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* import { resolveStorage, type NeonStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
89
|
+
*
|
|
90
|
+
* const configuration: NeonStorageConfiguration = {
|
|
91
|
+
* type: 'neon',
|
|
92
|
+
* url: 'postgresql://user:password@host.neon.tech/weft?sslmode=require',
|
|
93
|
+
* };
|
|
94
|
+
* const storage = await resolveStorage(configuration);
|
|
95
|
+
* void storage;
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export type NeonStorageConfiguration = {
|
|
99
|
+
type: 'neon';
|
|
100
|
+
url: string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Runtime configuration for browser IndexedDB storage.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* import { resolveStorage, type IndexedDBStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
108
|
+
*
|
|
109
|
+
* const configuration: IndexedDBStorageConfiguration = { type: 'indexeddb', databaseName: 'weft' };
|
|
110
|
+
* const storage = await resolveStorage(configuration);
|
|
111
|
+
* void storage;
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export type IndexedDBStorageConfiguration = {
|
|
115
|
+
type: 'indexeddb';
|
|
116
|
+
databaseName?: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Runtime configuration for WebExtension storage.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* import { resolveStorage, type WebExtensionStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
124
|
+
*
|
|
125
|
+
* const configuration: WebExtensionStorageConfiguration = { type: 'web-extension', area: 'local' };
|
|
126
|
+
* const storage = await resolveStorage(configuration);
|
|
127
|
+
* void storage;
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export type WebExtensionStorageConfiguration = {
|
|
131
|
+
type: 'web-extension';
|
|
132
|
+
area?: 'local' | 'sync' | 'session' | 'managed';
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Runtime configuration for remote HTTP storage.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* import { resolveStorage, type HTTPStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
140
|
+
*
|
|
141
|
+
* const configuration: HTTPStorageConfiguration = { type: 'http', baseUrl: 'https://weft.example.com' };
|
|
142
|
+
* const storage = await resolveStorage(configuration);
|
|
143
|
+
* void storage;
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export type HTTPStorageConfiguration = {
|
|
147
|
+
type: 'http';
|
|
148
|
+
baseUrl: string | URL;
|
|
149
|
+
headers?: Record<string, string>;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Runtime configuration for automatic storage selection.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* import { resolveStorage, type AutoStorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
157
|
+
*
|
|
158
|
+
* const configuration: AutoStorageConfiguration = { type: 'auto' };
|
|
159
|
+
* const storage = await resolveStorage(configuration);
|
|
160
|
+
* void storage;
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
export type AutoStorageConfiguration = {
|
|
164
|
+
type: 'auto';
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Union of supported runtime-driven storage configurations.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* import { resolveStorage, type StorageConfiguration } from '@lostgradient/weft/storage/resolve';
|
|
172
|
+
*
|
|
173
|
+
* const configuration: StorageConfiguration = { type: 'memory' };
|
|
174
|
+
* const storage = await resolveStorage(configuration);
|
|
175
|
+
* void storage;
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
export type StorageConfiguration = MemoryStorageConfiguration | SQLiteStorageConfiguration | LMDBStorageConfiguration | TursoStorageConfiguration | NeonStorageConfiguration | IndexedDBStorageConfiguration | WebExtensionStorageConfiguration | HTTPStorageConfiguration | AutoStorageConfiguration;
|
|
179
|
+
/**
|
|
180
|
+
* Discriminant union of every supported `StorageConfiguration` `type` — the
|
|
181
|
+
* string literals (`'memory'`, `'sqlite'`, `'neon'`, …) that select a backend.
|
|
182
|
+
* Useful for typing a storage-kind value before building the full configuration.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* import { resolveStorage, type StorageConfigurationType } from '@lostgradient/weft/storage/resolve';
|
|
187
|
+
*
|
|
188
|
+
* const kind: StorageConfigurationType = 'memory';
|
|
189
|
+
* const storage = await resolveStorage({ type: kind });
|
|
190
|
+
* void storage;
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
export type StorageConfigurationType = StorageConfiguration['type'];
|
|
194
|
+
/**
|
|
195
|
+
* Storage adapter type resolved for a concrete {@link StorageConfiguration}.
|
|
196
|
+
*
|
|
197
|
+
* Use this when a configuration value is already narrowed and downstream code
|
|
198
|
+
* needs the adapter-specific instance type that {@link resolveStorage} returns.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```ts
|
|
202
|
+
* import type { HTTPStorageConfiguration, ResolvedStorage } from '@lostgradient/weft/storage/resolve';
|
|
203
|
+
*
|
|
204
|
+
* type RemoteStorage = ResolvedStorage<HTTPStorageConfiguration>;
|
|
205
|
+
* declare const storage: RemoteStorage;
|
|
206
|
+
* void storage;
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export type ResolvedStorage<Configuration extends StorageConfiguration> = Configuration extends MemoryStorageConfiguration ? MemoryStorage : Configuration extends SQLiteStorageConfiguration ? SQLiteStorageInstance : Configuration extends LMDBStorageConfiguration ? LMDBStorage : Configuration extends TursoStorageConfiguration ? TursoStorage : Configuration extends NeonStorageConfiguration ? NeonStorage : Configuration extends IndexedDBStorageConfiguration ? IndexedDBStorage : Configuration extends WebExtensionStorageConfiguration ? WebExtensionStorage : Configuration extends HTTPStorageConfiguration ? HTTPStorage : Storage;
|
|
File without changes
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Text-value
|
|
2
|
+
* Text-value storage facade.
|
|
3
3
|
*
|
|
4
|
-
* Adapts Weft's `Uint8Array`-
|
|
4
|
+
* Adapts Weft's `Uint8Array`-valued {@link Storage} to a generic
|
|
5
5
|
* string-valued key/value interface with an array-returning prefix
|
|
6
|
-
* list
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* on those consumers.
|
|
6
|
+
* list — the shape a string `KeyValueStore` consumer expects. It ships
|
|
7
|
+
* in Weft as a first-class integration surface, so adopting Weft
|
|
8
|
+
* storage behind a string KV interface needs no extra dependency.
|
|
10
9
|
*
|
|
11
10
|
* Encoding is UTF-8 with fatal decoding: invalid byte sequences raise
|
|
12
11
|
* `TypeError` rather than silently producing replacement characters,
|
|
@@ -31,9 +30,10 @@ import { type Storage } from './interface';
|
|
|
31
30
|
*/
|
|
32
31
|
export type TextValueStoreOptions = {
|
|
33
32
|
/**
|
|
34
|
-
* Whether `close()` disposes the wrapped storage. Defaults to `true`
|
|
35
|
-
*
|
|
36
|
-
* storage instance is shared by the Weft engine and application
|
|
33
|
+
* Whether `close()` disposes the wrapped storage. Defaults to `true` — the
|
|
34
|
+
* facade owns the storage it wraps and tears it down on close. Set `false`
|
|
35
|
+
* when the same storage instance is shared by the Weft engine and application
|
|
36
|
+
* state, so closing the facade must not dispose storage the engine still uses.
|
|
37
37
|
*/
|
|
38
38
|
disposeUnderlyingStorage?: boolean;
|
|
39
39
|
};
|
|
@@ -94,7 +94,10 @@ export type TextValueStoreBatchOperation = {
|
|
|
94
94
|
* Matches the structural shape downstream consumers commonly require
|
|
95
95
|
* from a string `KeyValueStore` backend: `get`/`set`/`delete` over
|
|
96
96
|
* UTF-8 text, a `list(prefix)` that materializes keys into an array,
|
|
97
|
-
* and
|
|
97
|
+
* and `has`, `deletePrefix`, and `close` helpers. All members are
|
|
98
|
+
* required — a conforming `TextValueStore` always provides them, so
|
|
99
|
+
* consumers can call `has`/`deletePrefix` without an optional-chaining
|
|
100
|
+
* fallback.
|
|
98
101
|
*
|
|
99
102
|
* @example
|
|
100
103
|
* ```ts
|
package/dist/storage/turso.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var WW=Object.defineProperty;var FW=(W)=>W;function XW(W,F){this[W]=FW.bind(null,F)}var AW=(W,F)=>{for(var X in F)WW(W,X,{get:F[X],enumerable:!0,configurable:!0,set:XW.bind(F,X)})};var U=(W,F)=>()=>(W&&(F=W(W=0)),F);function O(W,F,X){if(!W.capabilities()[F])throw Error(`Feature "${X}" requires storage capability "${F}", but this storage backend does not provide it.`)}function JW(W){let F=W.capabilities(),X=[];if(F.persistence!=="local")X.push(`persistence must be "local" (got "${F.persistence}")`);if(F.readAfterWrite!=="linearizable")X.push(`readAfterWrite must be "linearizable" (got "${F.readAfterWrite}")`);if(F.scanConsistency!=="snapshot")X.push(`scanConsistency must be "snapshot" (got "${F.scanConsistency}")`);if(!F.atomicBatch)X.push("atomicBatch must be true");if(!F.conditionalBatch)X.push("conditionalBatch must be true");if(X.length>0)throw Error(`Storage is not durable enough for recovery: ${X.join("; ")}.`)}var _="default";async function E(W,F){return await W.get(F)!==null}async function*Y(W,F,X){for await(let[Z]of W.scan(F,X))yield Z}async function v(W,F){let X=0;for await(let Z of Y(W,F))X++;return X}async function h(W,F){let X=[];for await(let Z of Y(W,F))X.push({type:"delete",key:Z});if(X.length===0)return 0;return await W.batch(X),X.length}async function T(W,F,X){let Z=[];for await(let $ of Y(W,F,X))Z.push({type:"delete",key:$});if(Z.length===0)return 0;return await W.batch(Z),Z.length}var ZW;var b=U(()=>{ZW=["actrec:","archive:","async-act:","attr:","audit:bulk:","blob:","budget:","budget-charged:","ev:","idx:","offload:","op:","review:","schedule:","schedule-due:","schedule-run:","sig:","sigres:","sigseq:","state:","tag:","tool-effect:","upd:","upk:","upr:","wf:","wf-cleanup:","wf-cleanup-needed:","wf-deadline:","wf-delayed:","wf-headers:","wf-idx-","wf-terminal:"]});function C(W){return W.length>0?W.slice(0,-1)+String.fromCharCode(W.charCodeAt(W.length-1)+1):"\xFF"}function CW(W,F={}){if(F.gt!==void 0&&W<=F.gt)return!1;if(F.gte!==void 0&&W<F.gte)return!1;if(F.lt!==void 0&&W>=F.lt)return!1;if(F.lte!==void 0&&W>F.lte)return!1;return!0}function K(W,F){if(W===null||F===null)return W===F;if(W.byteLength!==F.byteLength)return!1;for(let X=0;X<W.byteLength;X++)if(W[X]!==F[X])return!1;return!0}async function x(W,F){if(W.has)return W.has(F);return E(W,F)}function I(W,F,X){if(W.keys)return W.keys(F,X);return Y(W,F,X)}async function u(W,F){if(W.count)return W.count(F);return v(W,F)}async function S(W,F){if(W.deletePrefix)return W.deletePrefix(F);return h(W,F)}async function k(W,F,X){if(O(W,"conditionalBatch","storageConditionalBatch"),!W.conditionalBatch)throw Error("This storage backend reports conditionalBatch capability but does not implement the conditionalBatch() method.");return W.conditionalBatch(F,X)}function J(W){return encodeURIComponent(W)}function KW(W){return decodeURIComponent(W)}function xW(W){try{return decodeURIComponent(W)}catch{return null}}var G=(W)=>String(W).padStart(16,"0"),IW;var V=U(()=>{b();IW={workflow:(W)=>`wf:${J(W)}`,checkpoint:(W)=>`wf:${J(W)}:ckpt`,checkpointHistory:(W,F)=>`wf:${J(W)}:ckpt:${String(F).padStart(10,"0")}`,timelinePrefix:(W)=>`wf:${J(W)}:timeline:`,timeline:(W,F)=>`wf:${J(W)}:timeline:${String(F).padStart(10,"0")}`,schedule:(W)=>`schedule:${J(W)}`,scheduleTick:(W,F)=>`schedule-due:${String(W).padStart(16,"0")}:${J(F)}`,scheduleRun:(W)=>`schedule-run:${J(W)}`,operation:(W,F,X)=>`op:${W}:${G(F)}:${X}`,operationInflight:(W)=>`op:inflight:${W}`,operationQueued:(W)=>`op:queued:${W}`,operationResolved:(W)=>`op:resolved:${W}`,bulkOperationAuditPrefix:()=>"audit:bulk:",bulkOperationAudit:(W,F,X)=>`audit:bulk:${G(W)}:${J(F)}:${J(X)}`,operationResolvedByTimePrefix:()=>"op:resolved-by-time:",operationResolvedByTime:(W,F)=>`op:resolved-by-time:${G(W)}:${J(F)}`,asyncActivity:(W,F)=>`async-act:v1:${J(W)}:${J(F)}`,activityReconciliationPrefix:(W)=>`actrec:v1:${J(W)}:`,activityReconciliation:(W,F,X)=>`actrec:v1:${J(W)}:${J(F)}:${X}`,eventPrefix:(W)=>`ev:${J(W)}:`,event:(W,F)=>`ev:${J(W)}:${String(F).padStart(10,"0")}`,eventHead:(W)=>`ev:${J(W)}:head`,eventWatermark:(W)=>`ev:${J(W)}:watermark`,signal:(W,F,X)=>`sig:${J(W)}:${F}:${J(X)}`,signalSequence:(W)=>`sigseq:v1:${J(W)}`,signalAcceptedResponsePrefix:(W)=>`sigres:v1:${J(W)}:`,signalAcceptedResponse:(W,F,X)=>`sigres:v1:${J(W)}:${J(F)}:${J(X)}`,deadline:(W,F)=>`wf-deadline:${G(W)}:${J(F)}`,terminalCleanup:(W,F)=>`wf-cleanup:${G(W)}:${J(F)}`,delayedStart:(W,F)=>`wf-delayed:${G(W)}:${J(F)}`,terminalWorkflowPrefix:()=>"wf-terminal:",terminalWorkflow:(W,F)=>`wf-terminal:${G(W)}:${J(F)}`,attribute:(W)=>`attr:${J(W)}`,attributeIndex:(W,F,X)=>`idx:${W}:${F}:${J(X)}`,tagIndex:(W,F)=>`tag:${J(W)}:${J(F)}`,updatePrefix:(W)=>`upd:${J(W)}:`,update:(W,F)=>`upd:${J(W)}:${F}`,updateResponse:(W)=>`upr:${W}`,updateIdempotency:(W,F)=>`upk:${J(W)}:${F}`,budget:(W,F,X)=>`budget:${W}:${F}:${X}`,review:(W,F)=>`review:${J(W)}:${F}`,workflowHeaders:(W)=>`wf-headers:${J(W)}`,terminalCleanupNeeded:(W)=>`wf-cleanup-needed:${J(W)}`,offload:(W,F)=>`offload:${J(W)}:${F}`,archive:(W,F)=>`archive:${J(W)}:${F}`,stateExecution:(W,F)=>`state:execution:${J(W)}:${J(F)}`,stateWorkflow:(W,F)=>`state:workflow-scope:${_}:${J(W)}:${J(F)}`,streamChunkPrefix:(W,F)=>`blob:${J(W)}:${F}:chunk:`,streamChunk:(W,F,X)=>`blob:${J(W)}:${F}:chunk:${String(X).padStart(10,"0")}`,streamMetadata:(W,F)=>`blob:${J(W)}:${F}:meta`,budgetCharged:(W)=>`budget-charged:${W}`,toolEffect:(W,F,X)=>`tool-effect:${J(W)}:${F}:${X}`,workflowVisibilityStatus:(W,F)=>`wf-idx-status:${J(W)}:${J(F)}`,workflowVisibilityType:(W,F)=>`wf-idx-type:${J(W)}:${J(F)}`,workflowVisibilityCreated:(W,F)=>`wf-idx-created:${G(W)}:${J(F)}`,workflowVisibilityUpdated:(W,F)=>`wf-idx-updated:${G(W)}:${J(F)}`,workflowVisibilityDeadline:(W,F)=>`wf-idx-deadline:${G(W)}:${J(F)}`,workflowVisibilityManifest:(W)=>`wf-idx-manifest:${J(W)}`,workflowVisibilityMetaVersion:()=>"wf-idx-meta:version",workflowVisibilityMetaBuiltAt:()=>"wf-idx-meta:built-at",workflowVisibilityMetaCursor:()=>"wf-idx-meta:cursor"}});function $W(W){if(W===void 0)return;if(typeof W!=="number"||!Number.isInteger(W)||W<0)throw Error("deleteRange limit must be a finite non-negative integer");return W===0?0:W}function Q(W){let F={},X=!1;for(let $ of["gt","gte","lt","lte"]){let j=W[$];if(j===void 0)continue;if(typeof j!=="string")throw Error("deleteRange bounds must be strings");F[$]=j,X=!0}if(!X)throw Error("deleteRange requires at least one of gt/gte/lt/lte; use deletePrefix to delete a whole prefix");let Z=$W(W.limit);if(Z!==void 0)F.limit=Z;return F}async function w(W,F,X){let Z=Q(X);if(W.deleteRange)return W.deleteRange(F,Z);return T(W,F,Z)}var z=()=>{};function A(W){return W.replaceAll(/:+$/g,"")}function jW(W,F){let X=A(W),Z=A(F);if(X.length===0)return Z;if(Z.length===0)return X;return`${X}:${Z}`}function y(W,F){return new P(W,F)}var P;var c=U(()=>{z();V();P=class P{#W;#J;constructor(W,F){this.#W=W,this.#J=A(F)}#F(W){if(this.#J.length===0)return W;return W.length===0?`${this.#J}:`:`${this.#J}:${W}`}#X(W){if(this.#J.length===0)return W;return W.slice(this.#J.length+1)}#Z(W={}){let F={};if(W.limit!==void 0)F.limit=W.limit;if(W.reverse!==void 0)F.reverse=W.reverse;if(W.gt!==void 0)F.gt=this.#F(W.gt);if(W.gte!==void 0)F.gte=this.#F(W.gte);if(W.lt!==void 0)F.lt=this.#F(W.lt);if(W.lte!==void 0)F.lte=this.#F(W.lte);return F}#$(W){let F={};if(W.limit!==void 0)F.limit=W.limit;if(W.gt!==void 0)F.gt=this.#F(W.gt);if(W.gte!==void 0)F.gte=this.#F(W.gte);if(W.lt!==void 0)F.lt=this.#F(W.lt);if(W.lte!==void 0)F.lte=this.#F(W.lte);return F}capabilities(){return this.#W.capabilities()}scoped(W){return new P(this.#W,jW(this.#J,W))}async get(W){return this.#W.get(this.#F(W))}async put(W,F){await this.#W.put(this.#F(W),F)}async delete(W){await this.#W.delete(this.#F(W))}async*scan(W,F){for await(let[X,Z]of this.#W.scan(this.#F(W),this.#Z(F)))yield[this.#X(X),Z]}async batch(W){await this.#W.batch(W.map((F)=>{if(F.type==="put")return{type:"put",key:this.#F(F.key),value:F.value};return{type:"delete",key:this.#F(F.key)}}))}async conditionalBatch(W,F){return k(this.#W,W.map((X)=>({key:this.#F(X.key),expectedValue:X.expectedValue})),F.map((X)=>{if(X.type==="put")return{type:"put",key:this.#F(X.key),value:X.value};return{type:"delete",key:this.#F(X.key)}}))}async has(W){return x(this.#W,this.#F(W))}async deletePrefix(W){return S(this.#W,this.#F(W))}async deleteRange(W,F){let X=this.#$(Q(F));return w(this.#W,this.#F(W),X)}async*keys(W,F){for await(let X of I(this.#W,this.#F(W),this.#Z(F)))yield this.#X(X)}async count(W){return u(this.#W,this.#F(W))}[Symbol.dispose](){this.#W[Symbol.dispose]()}}});function UW(W){return W.trim().replace(/;+\s*$/u,"").trim()}function NW(W){return HW.test(W)}function m(W){let F=UW(W);if(F.length===0)throw Error("Storage query must not be empty.");if(F.includes(";"))throw Error("Storage query must contain exactly one read-only statement.");if(MW.test(F))return;if(GW.test(F)&&NW(F))return;throw Error("Storage query only supports read-only SELECT and PRAGMA statements.")}var GW,HW,MW;var f=U(()=>{GW=/^PRAGMA\b/iu,HW=/^PRAGMA\s+(?:[A-Z_][A-Z0-9_]*\.)?[A-Z_][A-Z0-9_]*\s*$/iu,MW=/^SELECT\b/iu});function R(W){return[W,C(W)]}function s(W,F){let{gt:X,gte:Z,lt:$,lte:j}=F,H=["key >= ? AND key < ?"],M=R(W);if(X!==void 0)H.push("key > ?"),M.push(X);if(Z!==void 0)H.push("key >= ?"),M.push(Z);if($!==void 0)H.push("key < ?"),M.push($);if(j!==void 0)H.push("key <= ?"),M.push(j);return{conditions:H,parameters:M}}function a(W,F={}){let{limit:X,reverse:Z}=F,{conditions:$,parameters:j}=s(W,F),H=Z?"DESC":"ASC",M=X!==void 0?" LIMIT ?":"";if(X!==void 0)j.push(X);return{parameters:j,sqlSuffix:`WHERE ${$.join(" AND ")} ORDER BY key ${H}${M}`}}function i(W,F){let{conditions:X,parameters:Z}=s(W,F),$=X.join(" AND ");if(F.limit===void 0)return{parameters:Z,sql:`DELETE FROM kv WHERE ${$}`};return Z.push(F.limit),{parameters:Z,sql:`DELETE FROM kv WHERE key IN (SELECT key FROM kv WHERE ${$} ORDER BY key ASC LIMIT ?)`}}function r(W,F={}){let{parameters:X,sqlSuffix:Z}=a(W,F);return{parameters:X,sql:`SELECT key, value FROM kv ${Z}`}}function n(W,F={}){let{parameters:X,sqlSuffix:Z}=a(W,F);return{parameters:X,sql:`SELECT key FROM kv ${Z}`}}var g=`CREATE TABLE IF NOT EXISTS kv (
|
|
2
|
+
var FF=Object.defineProperty;var WF=(F)=>F;function XF(F,W){this[F]=WF.bind(null,W)}var AF=(F,W)=>{for(var X in W)FF(F,X,{get:W[X],enumerable:!0,configurable:!0,set:XF.bind(W,X)})};var U=(F,W)=>()=>(F&&(W=F(F=0)),W);function O(F,W,X){if(!F.capabilities()[W])throw Error(`Feature "${X}" requires storage capability "${W}", but this storage backend does not provide it.`)}function JF(F){let W=F.capabilities(),X=[];if(W.persistence!=="local"&&W.persistence!=="remote")X.push(`persistence must be "local" or "remote" (got "${W.persistence}")`);if(W.readAfterWrite!=="linearizable")X.push(`readAfterWrite must be "linearizable" (got "${W.readAfterWrite}")`);if(W.scanConsistency!=="snapshot")X.push(`scanConsistency must be "snapshot" (got "${W.scanConsistency}")`);if(!W.atomicBatch)X.push("atomicBatch must be true");if(!W.conditionalBatch)X.push("conditionalBatch must be true");if(X.length>0)throw Error(`Storage is not durable enough for recovery: ${X.join("; ")}.`)}var _="default";async function v(F,W){return await F.get(W)!==null}async function*N(F,W,X){for await(let[Z]of F.scan(W,X))yield Z}async function h(F,W){let X=0;for await(let Z of N(F,W))X++;return X}async function E(F,W){let X=[];for await(let Z of N(F,W))X.push({type:"delete",key:Z});if(X.length===0)return 0;return await F.batch(X),X.length}async function T(F,W,X){let Z=[];for await(let $ of N(F,W,X))Z.push({type:"delete",key:$});if(Z.length===0)return 0;return await F.batch(Z),Z.length}var ZF;var b=U(()=>{ZF=["actrec:","archive:","async-act:","attr:","audit:bulk:","blob:","budget:","budget-charged:","ev:","idx:","liveness:","offload:","op:","review:","schedule:","schedule-due:","schedule-run:","sig:","sigres:","sigseq:","start-idem:","state:","tag:","tool-effect:","upd:","upk:","upr:","wf:","wf-cleanup:","wf-cleanup-needed:","wf-deadline:","wf-delayed:","wf-has-services:","wf-headers:","wf-idx-","wf-terminal:"]});function C(F){return F.length>0?F.slice(0,-1)+String.fromCharCode(F.charCodeAt(F.length-1)+1):"\xFF"}function CF(F,W={}){if(W.gt!==void 0&&F<=W.gt)return!1;if(W.gte!==void 0&&F<W.gte)return!1;if(W.lt!==void 0&&F>=W.lt)return!1;if(W.lte!==void 0&&F>W.lte)return!1;return!0}function K(F,W){if(F===null||W===null)return F===W;if(F.byteLength!==W.byteLength)return!1;for(let X=0;X<F.byteLength;X++)if(F[X]!==W[X])return!1;return!0}async function u(F,W){if(F.has)return F.has(W);return v(F,W)}function x(F,W,X){if(F.keys)return F.keys(W,X);return N(F,W,X)}async function S(F,W){if(F.count)return F.count(W);return h(F,W)}async function I(F,W){if(F.deletePrefix)return F.deletePrefix(W);return E(F,W)}async function k(F,W,X){if(O(F,"conditionalBatch","storageConditionalBatch"),!F.conditionalBatch)throw Error("This storage backend reports conditionalBatch capability but does not implement the conditionalBatch() method.");return F.conditionalBatch(W,X)}function J(F){return encodeURIComponent(F)}function KF(F){return decodeURIComponent(F)}function uF(F){try{return decodeURIComponent(F)}catch{return null}}var G=(F)=>String(F).padStart(16,"0"),xF;var D=U(()=>{b();xF={workflow:(F)=>`wf:${J(F)}`,checkpoint:(F)=>`wf:${J(F)}:ckpt`,checkpointHistory:(F,W)=>`wf:${J(F)}:ckpt:${String(W).padStart(10,"0")}`,timelinePrefix:(F)=>`wf:${J(F)}:timeline:`,timeline:(F,W)=>`wf:${J(F)}:timeline:${String(W).padStart(10,"0")}`,schedule:(F)=>`schedule:${J(F)}`,scheduleTick:(F,W)=>`schedule-due:${String(F).padStart(16,"0")}:${J(W)}`,scheduleRun:(F)=>`schedule-run:${J(F)}`,operation:(F,W,X)=>`op:${F}:${G(W)}:${X}`,operationInflight:(F)=>`op:inflight:${F}`,operationQueued:(F)=>`op:queued:${F}`,operationResolved:(F)=>`op:resolved:${F}`,bulkOperationAuditPrefix:()=>"audit:bulk:",bulkOperationAudit:(F,W,X)=>`audit:bulk:${G(F)}:${J(W)}:${J(X)}`,operationResolvedByTimePrefix:()=>"op:resolved-by-time:",operationResolvedByTime:(F,W)=>`op:resolved-by-time:${G(F)}:${J(W)}`,asyncActivity:(F,W)=>`async-act:v1:${J(F)}:${J(W)}`,activityReconciliationPrefix:(F)=>`actrec:v1:${J(F)}:`,activityReconciliation:(F,W,X)=>`actrec:v1:${J(F)}:${J(W)}:${X}`,eventPrefix:(F)=>`ev:${J(F)}:`,event:(F,W)=>`ev:${J(F)}:${String(W).padStart(10,"0")}`,eventHead:(F)=>`ev:${J(F)}:head`,eventWatermark:(F)=>`ev:${J(F)}:watermark`,signal:(F,W,X)=>`sig:${J(F)}:${W}:${J(X)}`,signalSequence:(F)=>`sigseq:v1:${J(F)}`,signalAcceptedResponsePrefix:(F)=>`sigres:v1:${J(F)}:`,signalAcceptedResponse:(F,W,X)=>`sigres:v1:${J(F)}:${J(W)}:${J(X)}`,deadline:(F,W)=>`wf-deadline:${G(F)}:${J(W)}`,terminalCleanup:(F,W)=>`wf-cleanup:${G(F)}:${J(W)}`,delayedStart:(F,W)=>`wf-delayed:${G(F)}:${J(W)}`,terminalWorkflowPrefix:()=>"wf-terminal:",terminalWorkflow:(F,W)=>`wf-terminal:${G(F)}:${J(W)}`,attribute:(F)=>`attr:${J(F)}`,attributeIndex:(F,W,X)=>`idx:${F}:${W}:${J(X)}`,tagIndex:(F,W)=>`tag:${J(F)}:${J(W)}`,updatePrefix:(F)=>`upd:${J(F)}:`,update:(F,W)=>`upd:${J(F)}:${W}`,updateResponse:(F)=>`upr:${F}`,updateIdempotency:(F,W)=>`upk:${J(F)}:${W}`,startIdempotency:(F)=>`start-idem:${J(F)}`,startIdempotencySignalId:(F)=>`start-idem:${F}`,livenessPrefix:()=>"liveness:",liveness:(F)=>`liveness:${J(F)}`,budget:(F,W,X)=>`budget:${F}:${W}:${X}`,review:(F,W)=>`review:${J(F)}:${W}`,workflowHeaders:(F)=>`wf-headers:${J(F)}`,terminalCleanupNeeded:(F)=>`wf-cleanup-needed:${J(F)}`,workflowHasServices:(F)=>`wf-has-services:${J(F)}`,offload:(F,W)=>`offload:${J(F)}:${W}`,archive:(F,W)=>`archive:${J(F)}:${W}`,stateExecution:(F,W)=>`state:execution:${J(F)}:${J(W)}`,stateWorkflow:(F,W)=>`state:workflow-scope:${_}:${J(F)}:${J(W)}`,streamChunkPrefix:(F,W)=>`blob:${J(F)}:${W}:chunk:`,streamChunk:(F,W,X)=>`blob:${J(F)}:${W}:chunk:${String(X).padStart(10,"0")}`,streamMetadata:(F,W)=>`blob:${J(F)}:${W}:meta`,budgetCharged:(F)=>`budget-charged:${F}`,toolEffect:(F,W,X)=>`tool-effect:${J(F)}:${W}:${X}`,workflowVisibilityStatus:(F,W)=>`wf-idx-status:${J(F)}:${J(W)}`,workflowVisibilityType:(F,W)=>`wf-idx-type:${J(F)}:${J(W)}`,workflowVisibilityCreated:(F,W)=>`wf-idx-created:${G(F)}:${J(W)}`,workflowVisibilityUpdated:(F,W)=>`wf-idx-updated:${G(F)}:${J(W)}`,workflowVisibilityDeadline:(F,W)=>`wf-idx-deadline:${G(F)}:${J(W)}`,workflowVisibilityManifest:(F)=>`wf-idx-manifest:${J(F)}`,workflowVisibilityMetaVersion:()=>"wf-idx-meta:version",workflowVisibilityMetaBuiltAt:()=>"wf-idx-meta:built-at",workflowVisibilityMetaCursor:()=>"wf-idx-meta:cursor"}});function $F(F){if(F===void 0)return;if(typeof F!=="number"||!Number.isInteger(F)||F<0)throw Error("deleteRange limit must be a finite non-negative integer");return F===0?0:F}function Y(F){let W={},X=!1;for(let $ of["gt","gte","lt","lte"]){let j=F[$];if(j===void 0)continue;if(typeof j!=="string")throw Error("deleteRange bounds must be strings");W[$]=j,X=!0}if(!X)throw Error("deleteRange requires at least one of gt/gte/lt/lte; use deletePrefix to delete a whole prefix");let Z=$F(F.limit);if(Z!==void 0)W.limit=Z;return W}async function w(F,W,X){let Z=Y(X);if(F.deleteRange)return F.deleteRange(W,Z);return T(F,W,Z)}var z=()=>{};function A(F){return F.replaceAll(/:+$/g,"")}function jF(F,W){let X=A(F),Z=A(W);if(X.length===0)return Z;if(Z.length===0)return X;return`${X}:${Z}`}function c(F,W){return new P(F,W)}var P;var y=U(()=>{z();D();P=class P{#F;#J;constructor(F,W){this.#F=F,this.#J=A(W)}#W(F){if(this.#J.length===0)return F;return F.length===0?`${this.#J}:`:`${this.#J}:${F}`}#X(F){if(this.#J.length===0)return F;return F.slice(this.#J.length+1)}#Z(F={}){let W={};if(F.limit!==void 0)W.limit=F.limit;if(F.reverse!==void 0)W.reverse=F.reverse;if(F.gt!==void 0)W.gt=this.#W(F.gt);if(F.gte!==void 0)W.gte=this.#W(F.gte);if(F.lt!==void 0)W.lt=this.#W(F.lt);if(F.lte!==void 0)W.lte=this.#W(F.lte);return W}#$(F){let W={};if(F.limit!==void 0)W.limit=F.limit;if(F.gt!==void 0)W.gt=this.#W(F.gt);if(F.gte!==void 0)W.gte=this.#W(F.gte);if(F.lt!==void 0)W.lt=this.#W(F.lt);if(F.lte!==void 0)W.lte=this.#W(F.lte);return W}capabilities(){return this.#F.capabilities()}scoped(F){return new P(this.#F,jF(this.#J,F))}async get(F){return this.#F.get(this.#W(F))}async put(F,W){await this.#F.put(this.#W(F),W)}async delete(F){await this.#F.delete(this.#W(F))}async*scan(F,W){for await(let[X,Z]of this.#F.scan(this.#W(F),this.#Z(W)))yield[this.#X(X),Z]}async batch(F){await this.#F.batch(F.map((W)=>{if(W.type==="put")return{type:"put",key:this.#W(W.key),value:W.value};return{type:"delete",key:this.#W(W.key)}}))}async conditionalBatch(F,W){return k(this.#F,F.map((X)=>({key:this.#W(X.key),expectedValue:X.expectedValue})),W.map((X)=>{if(X.type==="put")return{type:"put",key:this.#W(X.key),value:X.value};return{type:"delete",key:this.#W(X.key)}}))}async has(F){return u(this.#F,this.#W(F))}async deletePrefix(F){return I(this.#F,this.#W(F))}async deleteRange(F,W){let X=this.#$(Y(W));return w(this.#F,this.#W(F),X)}async*keys(F,W){for await(let X of x(this.#F,this.#W(F),this.#Z(W)))yield this.#X(X)}async count(F){return S(this.#F,this.#W(F))}[Symbol.dispose](){this.#F[Symbol.dispose]()}}});function UF(F){return F.trim().replace(/;+\s*$/u,"").trim()}function QF(F){return HF.test(F)}function m(F){let W=UF(F);if(W.length===0)throw Error("Storage query must not be empty.");if(W.includes(";"))throw Error("Storage query must contain exactly one read-only statement.");if(MF.test(W))return;if(GF.test(W)&&QF(W))return;throw Error("Storage query only supports read-only SELECT and PRAGMA statements.")}var GF,HF,MF;var f=U(()=>{GF=/^PRAGMA\b/iu,HF=/^PRAGMA\s+(?:[A-Z_][A-Z0-9_]*\.)?[A-Z_][A-Z0-9_]*\s*$/iu,MF=/^SELECT\b/iu});function B(F){return[F,C(F)]}function s(F,W){let{gt:X,gte:Z,lt:$,lte:j}=W,H=["key >= ? AND key < ?"],M=B(F);if(X!==void 0)H.push("key > ?"),M.push(X);if(Z!==void 0)H.push("key >= ?"),M.push(Z);if($!==void 0)H.push("key < ?"),M.push($);if(j!==void 0)H.push("key <= ?"),M.push(j);return{conditions:H,parameters:M}}function a(F,W={}){let{limit:X,reverse:Z}=W,{conditions:$,parameters:j}=s(F,W),H=Z?"DESC":"ASC",M=X!==void 0?" LIMIT ?":"";if(X!==void 0)j.push(X);return{parameters:j,sqlSuffix:`WHERE ${$.join(" AND ")} ORDER BY key ${H}${M}`}}function i(F,W){let{conditions:X,parameters:Z}=s(F,W),$=X.join(" AND ");if(W.limit===void 0)return{parameters:Z,sql:`DELETE FROM kv WHERE ${$}`};return Z.push(W.limit),{parameters:Z,sql:`DELETE FROM kv WHERE key IN (SELECT key FROM kv WHERE ${$} ORDER BY key ASC LIMIT ?)`}}function r(F,W={}){let{parameters:X,sqlSuffix:Z}=a(F,W);return{parameters:X,sql:`SELECT key, value FROM kv ${Z}`}}function n(F,W={}){let{parameters:X,sqlSuffix:Z}=a(F,W);return{parameters:X,sql:`SELECT key FROM kv ${Z}`}}var g=`CREATE TABLE IF NOT EXISTS kv (
|
|
3
3
|
key TEXT PRIMARY KEY,
|
|
4
4
|
value BLOB NOT NULL
|
|
5
|
-
) WITHOUT ROWID`,L="SELECT value FROM kv WHERE key = ?",
|
|
5
|
+
) WITHOUT ROWID`,L="SELECT value FROM kv WHERE key = ?",V="INSERT INTO kv (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value",R="DELETE FROM kv WHERE key = ?",d="SELECT 1 AS present FROM kv WHERE key = ? LIMIT 1",l="SELECT COUNT(*) AS count FROM kv WHERE key >= ? AND key < ?",p="DELETE FROM kv WHERE key >= ? AND key < ?";var t=U(()=>{D()});z();D();f();y();t();import{createClient as NF}from"@libsql/client";var o=`${g};`;function q(F){return typeof F==="object"&&F!==null&&"code"in F&&F.code==="SQLITE_BUSY"}async function YF(F){return F.transaction("write").catch((W)=>{if(q(W))return null;throw W})}async function DF(F){try{await F.rollback()}catch{}}async function VF(F){await new Promise((W)=>{setTimeout(W,Math.min(F*5,50))})}async function RF(F,W){for(let Z=1;Z<=10;Z++)try{await F.batch(W,"write");return}catch($){if(!q($)||Z===10)throw $;await VF(Z)}}async function BF(F,W){for(let X of W){let $=(await F.execute({sql:L,args:[X.key]})).rows[0]?.value,j=$===null||$===void 0?null:new Uint8Array($);if(!K(j,X.expectedValue))return!1}return!0}async function OF(F,W){for(let X of W)if(X.type==="put")await F.execute({sql:V,args:[X.key,X.value]});else await F.execute({sql:R,args:[X.key]})}function _F(F){if(F==="file::memory:"||F===":memory:")return"ephemeral";if(F.startsWith("file:"))return"local";return"remote"}class zF{#F;#J;#W=!1;constructor(F){this.#J=_F(F.url),this.#F=NF(F.authToken?{url:F.url,authToken:F.authToken}:{url:F.url})}capabilities(){return{persistence:this.#J,readAfterWrite:"session",scanConsistency:"snapshot",atomicBatch:!0,conditionalBatch:!0,boundedRangeDelete:!0}}async#X(){if(this.#W)return;await this.#F.executeMultiple(o),this.#W=!0}async get(F){await this.#X();let W=await this.#F.execute({sql:L,args:[F]});if(W.rows.length===0)return null;let X=W.rows[0].value;if(X===null||X===void 0)return null;return new Uint8Array(X)}async put(F,W){await this.#X(),await this.#F.execute({sql:V,args:[F,W]})}async delete(F){await this.#X(),await this.#F.execute({sql:R,args:[F]})}async has(F){return await this.#X(),(await this.#F.execute({sql:d,args:[F]})).rows.length>0}async deletePrefix(F){await this.#X();let[W,X]=B(F);return(await this.#F.execute({sql:p,args:[W,X]})).rowsAffected}async deleteRange(F,W){await this.#X();let X=Y(W),{parameters:Z,sql:$}=i(F,X);return(await this.#F.execute({sql:$,args:Z})).rowsAffected}async*scan(F,W={}){await this.#X();let{parameters:X,sql:Z}=r(F,W),$=await this.#F.execute({sql:Z,args:X});for(let j of $.rows){let{key:H,value:M}=j,e=new Uint8Array(M);yield[H,e]}}async*keys(F,W={}){await this.#X();let{parameters:X,sql:Z}=n(F,W),$=await this.#F.execute({sql:Z,args:X});for(let j of $.rows)yield j.key}async count(F){await this.#X();let[W,X]=B(F),Z=await this.#F.execute({sql:l,args:[W,X]});return Number(Z.rows[0]?.count??0)}scoped(F){return c(this,F)}async batch(F){if(F.length===0)return;await this.#X();let W=F.map((X)=>{if(X.type==="put")return{sql:V,args:[X.key,X.value]};return{sql:R,args:[X.key]}});await RF(this.#F,W)}async conditionalBatch(F,W){await this.#X();let X=await YF(this.#F);if(X===null)return!1;try{if(await X.executeMultiple(o),!await BF(X,F))return await X.rollback(),!1;return await OF(X,W),await X.commit(),!0}catch(Z){if(await DF(X),q(Z))return!1;throw Z}}async query(F,W){return await this.#X(),m(F),(await this.#F.execute({sql:F,args:W??[]})).rows}[Symbol.dispose](){this.#F.close()}}export{zF as TursoStorage};
|