@workglow/storage 0.2.27 → 0.2.29
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/dist/browser.d.ts +0 -10
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +406 -4207
- package/dist/browser.js.map +8 -24
- package/dist/bun.js +341 -7235
- package/dist/bun.js.map +8 -35
- package/dist/common-server.d.ts +0 -21
- package/dist/common-server.d.ts.map +1 -1
- package/dist/common.d.ts +1 -6
- package/dist/common.d.ts.map +1 -1
- package/dist/node.js +341 -7236
- package/dist/node.js.map +8 -35
- package/package.json +5 -71
- package/dist/kv/IndexedDbKvStorage.d.ts +0 -27
- package/dist/kv/IndexedDbKvStorage.d.ts.map +0 -1
- package/dist/kv/PostgresKvStorage.d.ts +0 -28
- package/dist/kv/PostgresKvStorage.d.ts.map +0 -1
- package/dist/kv/SqliteKvStorage.d.ts +0 -28
- package/dist/kv/SqliteKvStorage.d.ts.map +0 -1
- package/dist/kv/SupabaseKvStorage.d.ts +0 -33
- package/dist/kv/SupabaseKvStorage.d.ts.map +0 -1
- package/dist/postgres/browser.d.ts +0 -32
- package/dist/postgres/browser.d.ts.map +0 -1
- package/dist/postgres/browser.js +0 -150
- package/dist/postgres/browser.js.map +0 -11
- package/dist/postgres/node-bun.d.ts +0 -26
- package/dist/postgres/node-bun.d.ts.map +0 -1
- package/dist/postgres/node-bun.js +0 -41
- package/dist/postgres/node-bun.js.map +0 -10
- package/dist/postgres/pglite-pool.d.ts +0 -21
- package/dist/postgres/pglite-pool.d.ts.map +0 -1
- package/dist/queue/IQueueStorage.d.ts +0 -229
- package/dist/queue/IQueueStorage.d.ts.map +0 -1
- package/dist/queue/InMemoryQueueStorage.d.ts +0 -149
- package/dist/queue/InMemoryQueueStorage.d.ts.map +0 -1
- package/dist/queue/IndexedDbQueueStorage.d.ts +0 -166
- package/dist/queue/IndexedDbQueueStorage.d.ts.map +0 -1
- package/dist/queue/PostgresQueueStorage.d.ts +0 -154
- package/dist/queue/PostgresQueueStorage.d.ts.map +0 -1
- package/dist/queue/SqliteQueueStorage.d.ts +0 -149
- package/dist/queue/SqliteQueueStorage.d.ts.map +0 -1
- package/dist/queue/SupabaseQueueStorage.d.ts +0 -195
- package/dist/queue/SupabaseQueueStorage.d.ts.map +0 -1
- package/dist/queue/TelemetryQueueStorage.d.ts +0 -33
- package/dist/queue/TelemetryQueueStorage.d.ts.map +0 -1
- package/dist/queue-limiter/IRateLimiterStorage.d.ts +0 -127
- package/dist/queue-limiter/IRateLimiterStorage.d.ts.map +0 -1
- package/dist/queue-limiter/InMemoryRateLimiterStorage.d.ts +0 -43
- package/dist/queue-limiter/InMemoryRateLimiterStorage.d.ts.map +0 -1
- package/dist/queue-limiter/IndexedDbRateLimiterStorage.d.ts +0 -79
- package/dist/queue-limiter/IndexedDbRateLimiterStorage.d.ts.map +0 -1
- package/dist/queue-limiter/PostgresRateLimiterStorage.d.ts +0 -57
- package/dist/queue-limiter/PostgresRateLimiterStorage.d.ts.map +0 -1
- package/dist/queue-limiter/SqliteRateLimiterStorage.d.ts +0 -62
- package/dist/queue-limiter/SqliteRateLimiterStorage.d.ts.map +0 -1
- package/dist/queue-limiter/SupabaseRateLimiterStorage.d.ts +0 -54
- package/dist/queue-limiter/SupabaseRateLimiterStorage.d.ts.map +0 -1
- package/dist/sqlite/browser.d.ts +0 -37
- package/dist/sqlite/browser.d.ts.map +0 -1
- package/dist/sqlite/browser.js +0 -125
- package/dist/sqlite/browser.js.map +0 -10
- package/dist/sqlite/bun.d.ts +0 -32
- package/dist/sqlite/bun.d.ts.map +0 -1
- package/dist/sqlite/bun.js +0 -84
- package/dist/sqlite/bun.js.map +0 -10
- package/dist/sqlite/canonical-api.d.ts +0 -34
- package/dist/sqlite/canonical-api.d.ts.map +0 -1
- package/dist/sqlite/node.d.ts +0 -34
- package/dist/sqlite/node.d.ts.map +0 -1
- package/dist/sqlite/node.js +0 -65
- package/dist/sqlite/node.js.map +0 -10
- package/dist/tabular/IndexedDbTabularStorage.d.ts +0 -199
- package/dist/tabular/IndexedDbTabularStorage.d.ts.map +0 -1
- package/dist/tabular/PostgresTabularStorage.d.ts +0 -196
- package/dist/tabular/PostgresTabularStorage.d.ts.map +0 -1
- package/dist/tabular/SqliteTabularStorage.d.ts +0 -167
- package/dist/tabular/SqliteTabularStorage.d.ts.map +0 -1
- package/dist/tabular/SupabaseTabularStorage.d.ts +0 -174
- package/dist/tabular/SupabaseTabularStorage.d.ts.map +0 -1
- package/dist/util/IndexedDbTable.d.ts +0 -40
- package/dist/util/IndexedDbTable.d.ts.map +0 -1
- package/dist/util/traced.d.ts +0 -10
- package/dist/util/traced.d.ts.map +0 -1
- package/dist/vector/IndexedDbVectorStorage.d.ts +0 -53
- package/dist/vector/IndexedDbVectorStorage.d.ts.map +0 -1
- package/dist/vector/PostgresVectorStorage.d.ts +0 -39
- package/dist/vector/PostgresVectorStorage.d.ts.map +0 -1
- package/dist/vector/SqliteAiVectorStorage.d.ts +0 -100
- package/dist/vector/SqliteAiVectorStorage.d.ts.map +0 -1
- package/dist/vector/SqliteVectorStorage.d.ts +0 -49
- package/dist/vector/SqliteVectorStorage.d.ts.map +0 -1
- package/src/queue/README.md +0 -41
package/dist/sqlite/bun.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import type { SqliteApi } from "./canonical-api";
|
|
7
|
-
export type { SqliteApi };
|
|
8
|
-
/**
|
|
9
|
-
* Resolves `bun:sqlite` via dynamic import. Idempotent; concurrent callers share one load.
|
|
10
|
-
*/
|
|
11
|
-
declare function initSqlite(): Promise<void>;
|
|
12
|
-
/**
|
|
13
|
-
* Bun `bun:sqlite` database wrapped to match {@link SqliteApi.Database}:
|
|
14
|
-
* `prepare<Bind, Result>` uses bindings-first generics; `get()` maps `null` → `undefined`.
|
|
15
|
-
*/
|
|
16
|
-
export declare class BunSqliteDatabase implements SqliteApi.Database {
|
|
17
|
-
#private;
|
|
18
|
-
constructor(filename?: string, options?: number | import("bun:sqlite").DatabaseOptions);
|
|
19
|
-
exec(sql: string): void;
|
|
20
|
-
prepare<BindParameters extends unknown[] | Record<string, unknown> = unknown[], Result = unknown>(sql: string): SqliteApi.Statement<BindParameters, Result>;
|
|
21
|
-
transaction<T extends unknown[]>(fn: (...args: T) => void): (...args: T) => void;
|
|
22
|
-
close(): void;
|
|
23
|
-
loadExtension(path: string, entryPoint?: string): void;
|
|
24
|
-
}
|
|
25
|
-
export declare const Sqlite: {
|
|
26
|
-
readonly init: typeof initSqlite;
|
|
27
|
-
readonly Database: typeof BunSqliteDatabase;
|
|
28
|
-
};
|
|
29
|
-
export declare namespace Sqlite {
|
|
30
|
-
type Database = BunSqliteDatabase;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=bun.d.ts.map
|
package/dist/sqlite/bun.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/sqlite/bun.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,YAAY,EAAE,SAAS,EAAE,CAAC;AAc1B;;GAEG;AACH,iBAAS,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAOnC;AAuCD;;;GAGG;AACH,qBAAa,iBAAkB,YAAW,SAAS,CAAC,QAAQ;;IAG1D,YAAY,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,YAAY,EAAE,eAAe,EAGrF;IAED,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtB;IAED,OAAO,CAAC,cAAc,SAAS,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAAE,EAAE,MAAM,GAAG,OAAO,EAC9F,GAAG,EAAE,MAAM,GACV,SAAS,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC,CAG7C;IAED,WAAW,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAK/E;IAED,KAAK,IAAI,IAAI,CAEZ;IAED,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAErD;CACF;AAED,eAAO,MAAM,MAAM;aACjB,IAAI;aACJ,QAAQ;CACA,CAAC;AAEX,yBAAiB,MAAM,CAAC,CAAC;IACvB,KAAY,QAAQ,GAAG,iBAAiB,CAAC;CAC1C"}
|
package/dist/sqlite/bun.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var __require = import.meta.require;
|
|
3
|
-
|
|
4
|
-
// src/sqlite/bun.ts
|
|
5
|
-
var _bunSqlite;
|
|
6
|
-
var initPromise;
|
|
7
|
-
function assertBunLoaded() {
|
|
8
|
-
if (!_bunSqlite) {
|
|
9
|
-
throw new Error("SQLite is not ready. Await Sqlite.init() before using new Sqlite.Database().");
|
|
10
|
-
}
|
|
11
|
-
return _bunSqlite;
|
|
12
|
-
}
|
|
13
|
-
function initSqlite() {
|
|
14
|
-
return initPromise ??= (async () => {
|
|
15
|
-
if (_bunSqlite) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
_bunSqlite = await import("bun:sqlite");
|
|
19
|
-
})();
|
|
20
|
-
}
|
|
21
|
-
function getBunSqlite() {
|
|
22
|
-
return assertBunLoaded();
|
|
23
|
-
}
|
|
24
|
-
function toRunResult(changes, lastInsertRowid) {
|
|
25
|
-
return { changes, lastInsertRowid };
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
class BunStatementAdapter {
|
|
29
|
-
#stmt;
|
|
30
|
-
constructor(stmt) {
|
|
31
|
-
this.#stmt = stmt;
|
|
32
|
-
}
|
|
33
|
-
run(...params) {
|
|
34
|
-
const meta = this.#stmt.run(...params);
|
|
35
|
-
return toRunResult(meta.changes, meta.lastInsertRowid);
|
|
36
|
-
}
|
|
37
|
-
get(...params) {
|
|
38
|
-
const row = this.#stmt.get(...params);
|
|
39
|
-
return row === null ? undefined : row;
|
|
40
|
-
}
|
|
41
|
-
all(...params) {
|
|
42
|
-
return this.#stmt.all(...params);
|
|
43
|
-
}
|
|
44
|
-
finalize() {
|
|
45
|
-
this.#stmt.finalize();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
class BunSqliteDatabase {
|
|
50
|
-
#db;
|
|
51
|
-
constructor(filename, options) {
|
|
52
|
-
const { Database } = getBunSqlite();
|
|
53
|
-
this.#db = new Database(filename, options);
|
|
54
|
-
}
|
|
55
|
-
exec(sql) {
|
|
56
|
-
this.#db.run(sql);
|
|
57
|
-
}
|
|
58
|
-
prepare(sql) {
|
|
59
|
-
const stmt = this.#db.prepare(sql);
|
|
60
|
-
return new BunStatementAdapter(stmt);
|
|
61
|
-
}
|
|
62
|
-
transaction(fn) {
|
|
63
|
-
const tx = this.#db.transaction(fn);
|
|
64
|
-
return (...args) => {
|
|
65
|
-
tx(...args);
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
close() {
|
|
69
|
-
this.#db.close();
|
|
70
|
-
}
|
|
71
|
-
loadExtension(path, entryPoint) {
|
|
72
|
-
this.#db.loadExtension(path, entryPoint);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
var Sqlite = {
|
|
76
|
-
init: initSqlite,
|
|
77
|
-
Database: BunSqliteDatabase
|
|
78
|
-
};
|
|
79
|
-
export {
|
|
80
|
-
Sqlite,
|
|
81
|
-
BunSqliteDatabase
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
//# debugId=A1427F3CD043959764756E2164756E21
|
package/dist/sqlite/bun.js.map
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/sqlite/bun.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Database as BunDatabaseCtor, Statement as BunStatementType } from \"bun:sqlite\";\n\nimport type { SqliteApi } from \"./canonical-api\";\n\nexport type { SqliteApi };\n\ntype BunSqliteModule = typeof import(\"bun:sqlite\");\n\nlet _bunSqlite: BunSqliteModule | undefined;\nlet initPromise: Promise<void> | undefined;\n\nfunction assertBunLoaded(): BunSqliteModule {\n if (!_bunSqlite) {\n throw new Error(\"SQLite is not ready. Await Sqlite.init() before using new Sqlite.Database().\");\n }\n return _bunSqlite;\n}\n\n/**\n * Resolves `bun:sqlite` via dynamic import. Idempotent; concurrent callers share one load.\n */\nfunction initSqlite(): Promise<void> {\n return (initPromise ??= (async () => {\n if (_bunSqlite) {\n return;\n }\n _bunSqlite = await import(\"bun:sqlite\");\n })());\n}\n\nfunction getBunSqlite(): BunSqliteModule {\n return assertBunLoaded();\n}\n\nfunction toRunResult(changes: number, lastInsertRowid: number | bigint): SqliteApi.RunResult {\n return { changes, lastInsertRowid };\n}\n\nclass BunStatementAdapter<\n BindParameters extends unknown[] | Record<string, unknown> = unknown[],\n Result = unknown,\n> implements SqliteApi.Statement<BindParameters, Result> {\n readonly #stmt: BunStatementType<Result, any>;\n\n constructor(stmt: BunStatementType<Result, any>) {\n this.#stmt = stmt;\n }\n\n run(...params: unknown[]): SqliteApi.RunResult {\n const meta = this.#stmt.run(...(params as never[]));\n return toRunResult(meta.changes, meta.lastInsertRowid);\n }\n\n get(...params: unknown[]): Result | undefined {\n const row = this.#stmt.get(...(params as never[]));\n return row === null ? undefined : row;\n }\n\n all(...params: unknown[]): Result[] {\n return this.#stmt.all(...(params as never[]));\n }\n\n finalize(): void {\n this.#stmt.finalize();\n }\n}\n\n/**\n * Bun `bun:sqlite` database wrapped to match {@link SqliteApi.Database}:\n * `prepare<Bind, Result>` uses bindings-first generics; `get()` maps `null` → `undefined`.\n */\nexport class BunSqliteDatabase implements SqliteApi.Database {\n readonly #db: InstanceType<typeof BunDatabaseCtor>;\n\n constructor(filename?: string, options?: number | import(\"bun:sqlite\").DatabaseOptions) {\n const { Database } = getBunSqlite();\n this.#db = new Database(filename, options);\n }\n\n exec(sql: string): void {\n this.#db.run(sql);\n }\n\n prepare<BindParameters extends unknown[] | Record<string, unknown> = unknown[], Result = unknown>(\n sql: string\n ): SqliteApi.Statement<BindParameters, Result> {\n const stmt = this.#db.prepare<Result, any>(sql);\n return new BunStatementAdapter<BindParameters, Result>(stmt);\n }\n\n transaction<T extends unknown[]>(fn: (...args: T) => void): (...args: T) => void {\n const tx = this.#db.transaction(fn);\n return (...args: T) => {\n tx(...args);\n };\n }\n\n close(): void {\n this.#db.close();\n }\n\n loadExtension(path: string, entryPoint?: string): void {\n this.#db.loadExtension(path, entryPoint);\n }\n}\n\nexport const Sqlite = {\n init: initSqlite,\n Database: BunSqliteDatabase,\n} as const;\n\nexport namespace Sqlite {\n export type Database = BunSqliteDatabase;\n}\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;;;AAcA,IAAI;AACJ,IAAI;AAEJ,SAAS,eAAe,GAAoB;AAAA,EAC1C,IAAI,CAAC,YAAY;AAAA,IACf,MAAM,IAAI,MAAM,8EAA8E;AAAA,EAChG;AAAA,EACA,OAAO;AAAA;AAMT,SAAS,UAAU,GAAkB;AAAA,EACnC,OAAQ,iBAAiB,YAAY;AAAA,IACnC,IAAI,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IACA,aAAa,MAAa;AAAA,KACzB;AAAA;AAGL,SAAS,YAAY,GAAoB;AAAA,EACvC,OAAO,gBAAgB;AAAA;AAGz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B;AAAA,IACrD,KAAK,IAAI,cAAc,MAAM,UAAU;AAAA;AAE3C;AAEO,IAAM,SAAS;AAAA,EACpB,MAAM;AAAA,EACN,UAAU;AACZ;",
|
|
8
|
-
"debugId": "A1427F3CD043959764756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Canonical SQLite surface for `@workglow/storage/sqlite` across Node (better-sqlite3),
|
|
8
|
-
* Bun (native, via adapter), and browser (WASM).
|
|
9
|
-
*
|
|
10
|
-
* On every platform, call `await Sqlite.init()` once before `new Sqlite.Database(...)`.
|
|
11
|
-
*
|
|
12
|
-
* **Generic order:** `prepare<BindParameters, Result>(sql)` — bindings first,
|
|
13
|
-
* row/result second (better-sqlite3 order), not `bun:sqlite`’s reversed order.
|
|
14
|
-
*/
|
|
15
|
-
export declare namespace SqliteApi {
|
|
16
|
-
interface RunResult {
|
|
17
|
-
readonly changes: number;
|
|
18
|
-
readonly lastInsertRowid: number | bigint;
|
|
19
|
-
}
|
|
20
|
-
interface Statement<BindParameters extends unknown[] | Record<string, unknown> = unknown[], Result = unknown> {
|
|
21
|
-
run(...params: unknown[]): RunResult;
|
|
22
|
-
get(...params: unknown[]): Result | undefined;
|
|
23
|
-
all(...params: unknown[]): Result[];
|
|
24
|
-
finalize(): void;
|
|
25
|
-
}
|
|
26
|
-
interface Database {
|
|
27
|
-
exec(sql: string): void;
|
|
28
|
-
prepare<BindParameters extends unknown[] | Record<string, unknown> = unknown[], Result = unknown>(sql: string): Statement<BindParameters, Result>;
|
|
29
|
-
transaction<T extends unknown[]>(fn: (...args: T) => void): (...args: T) => void;
|
|
30
|
-
close(): void;
|
|
31
|
-
loadExtension(path: string, entryPoint?: string): void;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a,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxD;CACF"}
|
package/dist/sqlite/node.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import type BetterSqlite3 from "better-sqlite3";
|
|
7
|
-
import type { SqliteApi } from "./canonical-api";
|
|
8
|
-
export type { SqliteApi };
|
|
9
|
-
/**
|
|
10
|
-
* Loads better-sqlite3 via dynamic import. Idempotent; concurrent callers share one load.
|
|
11
|
-
*/
|
|
12
|
-
declare function initSqlite(): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* better-sqlite3 database wrapped as {@link SqliteApi.Database} (bindings-first `prepare`
|
|
15
|
-
* generics). Construct only after {@link Sqlite.init}.
|
|
16
|
-
*/
|
|
17
|
-
export declare class NodeSqliteDatabase implements SqliteApi.Database {
|
|
18
|
-
#private;
|
|
19
|
-
constructor(filename?: string, options?: BetterSqlite3.Options);
|
|
20
|
-
exec(sql: string): void;
|
|
21
|
-
prepare<BindParameters extends unknown[] | Record<string, unknown> = unknown[], Result = unknown>(sql: string): SqliteApi.Statement<BindParameters, Result>;
|
|
22
|
-
transaction<T extends unknown[]>(fn: (...args: T) => void): (...args: T) => void;
|
|
23
|
-
close(): void;
|
|
24
|
-
loadExtension(path: string, entryPoint?: string): void;
|
|
25
|
-
}
|
|
26
|
-
export declare const Sqlite: {
|
|
27
|
-
readonly init: typeof initSqlite;
|
|
28
|
-
readonly Database: typeof NodeSqliteDatabase;
|
|
29
|
-
};
|
|
30
|
-
/** Merged with {@link Sqlite} so `Sqlite.Database` works in type positions (not only as a value). */
|
|
31
|
-
export declare namespace Sqlite {
|
|
32
|
-
type Database = NodeSqliteDatabase;
|
|
33
|
-
}
|
|
34
|
-
//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+0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
3
|
-
|
|
4
|
-
// src/sqlite/node.ts
|
|
5
|
-
var BetterCtor;
|
|
6
|
-
var initPromise;
|
|
7
|
-
function assertLoaded() {
|
|
8
|
-
if (!BetterCtor) {
|
|
9
|
-
throw new Error("SQLite is not ready. Await Sqlite.init() before using new Sqlite.Database().");
|
|
10
|
-
}
|
|
11
|
-
return BetterCtor;
|
|
12
|
-
}
|
|
13
|
-
function initSqlite() {
|
|
14
|
-
return initPromise ??= (async () => {
|
|
15
|
-
if (BetterCtor) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
const mod = await import("better-sqlite3");
|
|
20
|
-
BetterCtor = mod.default ?? mod;
|
|
21
|
-
} catch {
|
|
22
|
-
throw new Error("better-sqlite3 is required for @workglow/storage/sqlite on Node.js. Install it with: bun add better-sqlite3");
|
|
23
|
-
}
|
|
24
|
-
})();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
class NodeSqliteDatabase {
|
|
28
|
-
#inner;
|
|
29
|
-
constructor(filename, options) {
|
|
30
|
-
const Ctor = assertLoaded();
|
|
31
|
-
this.#inner = new Ctor(filename ?? ":memory:", options);
|
|
32
|
-
}
|
|
33
|
-
exec(sql) {
|
|
34
|
-
this.#inner.exec(sql);
|
|
35
|
-
}
|
|
36
|
-
prepare(sql) {
|
|
37
|
-
return this.#inner.prepare(sql);
|
|
38
|
-
}
|
|
39
|
-
transaction(fn) {
|
|
40
|
-
const tx = this.#inner.transaction(fn);
|
|
41
|
-
return (...args) => {
|
|
42
|
-
tx(...args);
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
close() {
|
|
46
|
-
this.#inner.close();
|
|
47
|
-
}
|
|
48
|
-
loadExtension(path, entryPoint) {
|
|
49
|
-
if (entryPoint === undefined) {
|
|
50
|
-
this.#inner.loadExtension(path);
|
|
51
|
-
} else {
|
|
52
|
-
this.#inner.loadExtension(path, entryPoint);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
var Sqlite = {
|
|
57
|
-
init: initSqlite,
|
|
58
|
-
Database: NodeSqliteDatabase
|
|
59
|
-
};
|
|
60
|
-
export {
|
|
61
|
-
Sqlite,
|
|
62
|
-
NodeSqliteDatabase
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
//# debugId=0C6C96D699E34FE664756E2164756E21
|
package/dist/sqlite/node.js.map
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/sqlite/node.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type BetterSqlite3 from \"better-sqlite3\";\n\nimport type { SqliteApi } from \"./canonical-api\";\n\nexport type { SqliteApi };\n\ntype BetterDatabase = InstanceType<typeof BetterSqlite3>;\n\nlet BetterCtor: typeof BetterSqlite3 | undefined;\nlet initPromise: Promise<void> | undefined;\n\nfunction assertLoaded(): typeof BetterSqlite3 {\n if (!BetterCtor) {\n throw new Error(\"SQLite is not ready. Await Sqlite.init() before using new Sqlite.Database().\");\n }\n return BetterCtor;\n}\n\n/**\n * Loads better-sqlite3 via dynamic import. Idempotent; concurrent callers share one load.\n */\nfunction initSqlite(): Promise<void> {\n return (initPromise ??= (async () => {\n if (BetterCtor) {\n return;\n }\n try {\n const mod = await import(\"better-sqlite3\");\n BetterCtor =\n (mod as { default?: typeof BetterSqlite3 }).default ??\n (mod as unknown as typeof BetterSqlite3);\n } catch {\n throw new Error(\n \"better-sqlite3 is required for @workglow/storage/sqlite on Node.js. Install it with: bun add better-sqlite3\"\n );\n }\n })());\n}\n\n/**\n * better-sqlite3 database wrapped as {@link SqliteApi.Database} (bindings-first `prepare`\n * generics). Construct only after {@link Sqlite.init}.\n */\nexport class NodeSqliteDatabase implements SqliteApi.Database {\n readonly #inner: BetterDatabase;\n\n constructor(filename?: string, options?: BetterSqlite3.Options) {\n const Ctor = assertLoaded();\n this.#inner = new Ctor(filename ?? \":memory:\", options);\n }\n\n exec(sql: string): void {\n this.#inner.exec(sql);\n }\n\n prepare<BindParameters extends unknown[] | Record<string, unknown> = unknown[], Result = unknown>(\n sql: string\n ): SqliteApi.Statement<BindParameters, Result> {\n return this.#inner.prepare(sql) as unknown as SqliteApi.Statement<BindParameters, Result>;\n }\n\n transaction<T extends unknown[]>(fn: (...args: T) => void): (...args: T) => void {\n const tx = this.#inner.transaction(fn);\n return (...args: T) => {\n tx(...args);\n };\n }\n\n close(): void {\n this.#inner.close();\n }\n\n loadExtension(path: string, entryPoint?: string): void {\n if (entryPoint === undefined) {\n this.#inner.loadExtension(path);\n } else {\n (this.#inner as unknown as { loadExtension(p: string, e?: string): void }).loadExtension(\n path,\n entryPoint\n );\n }\n }\n}\n\nexport const Sqlite = {\n init: initSqlite,\n Database: NodeSqliteDatabase,\n} as const;\n\n/** Merged with {@link Sqlite} so `Sqlite.Database` works in type positions (not only as a value). */\nexport namespace Sqlite {\n export type Database = NodeSqliteDatabase;\n}\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;;;AAcA,IAAI;AACJ,IAAI;AAEJ,SAAS,YAAY,GAAyB;AAAA,EAC5C,IAAI,CAAC,YAAY;AAAA,IACf,MAAM,IAAI,MAAM,8EAA8E;AAAA,EAChG;AAAA,EACA,OAAO;AAAA;AAMT,SAAS,UAAU,GAAkB;AAAA,EACnC,OAAQ,iBAAiB,YAAY;AAAA,IACnC,IAAI,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IACA,IAAI;AAAA,MACF,MAAM,MAAM,MAAa;AAAA,MACzB,aACG,IAA2C,WAC3C;AAAA,MACH,MAAM;AAAA,MACN,MAAM,IAAI,MACR,6GACF;AAAA;AAAA,KAED;AAAA;AAAA;AAOE,MAAM,mBAAiD;AAAA,EACnD;AAAA,EAET,WAAW,CAAC,UAAmB,SAAiC;AAAA,IAC9D,MAAM,OAAO,aAAa;AAAA,IAC1B,KAAK,SAAS,IAAI,KAAK,YAAY,YAAY,OAAO;AAAA;AAAA,EAGxD,IAAI,CAAC,KAAmB;AAAA,IACtB,KAAK,OAAO,KAAK,GAAG;AAAA;AAAA,EAGtB,OAAiG,CAC/F,KAC6C;AAAA,IAC7C,OAAO,KAAK,OAAO,QAAQ,GAAG;AAAA;AAAA,EAGhC,WAAgC,CAAC,IAAgD;AAAA,IAC/E,MAAM,KAAK,KAAK,OAAO,YAAY,EAAE;AAAA,IACrC,OAAO,IAAI,SAAY;AAAA,MACrB,GAAG,GAAG,IAAI;AAAA;AAAA;AAAA,EAId,KAAK,GAAS;AAAA,IACZ,KAAK,OAAO,MAAM;AAAA;AAAA,EAGpB,aAAa,CAAC,MAAc,YAA2B;AAAA,IACrD,IAAI,eAAe,WAAW;AAAA,MAC5B,KAAK,OAAO,cAAc,IAAI;AAAA,IAChC,EAAO;AAAA,MACJ,KAAK,OAAqE,cACzE,MACA,UACF;AAAA;AAAA;AAGN;AAEO,IAAM,SAAS;AAAA,EACpB,MAAM;AAAA,EACN,UAAU;AACZ;",
|
|
8
|
-
"debugId": "0C6C96D699E34FE664756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { DataPortSchemaObject, FromSchema, TypedArraySchemaOptions } from "@workglow/util/schema";
|
|
7
|
-
import { MigrationOptions } from "../util/IndexedDbTable";
|
|
8
|
-
import { BaseTabularStorage, ClientProvidedKeysOption, KeyGenerationStrategy } from "./BaseTabularStorage";
|
|
9
|
-
import { AnyTabularStorage, AutoGeneratedKeys, CoveringIndexQueryOptions, DeleteSearchCriteria, InsertEntity, QueryOptions, SearchCriteria, SimplifyPrimaryKey, TabularChangePayload, TabularSubscribeOptions } from "./ITabularStorage";
|
|
10
|
-
export declare const IDB_TABULAR_REPOSITORY: import("@workglow/util").ServiceToken<AnyTabularStorage>;
|
|
11
|
-
/**
|
|
12
|
-
* A tabular repository implementation using IndexedDB for browser-based storage.
|
|
13
|
-
*
|
|
14
|
-
* @template Schema - The schema definition for the entity
|
|
15
|
-
* @template PrimaryKeyNames - Array of property names that form the primary key
|
|
16
|
-
*/
|
|
17
|
-
export declare class IndexedDbTabularStorage<Schema extends DataPortSchemaObject, PrimaryKeyNames extends ReadonlyArray<keyof Schema["properties"]>, Entity = FromSchema<Schema, TypedArraySchemaOptions>, PrimaryKey = SimplifyPrimaryKey<Entity, PrimaryKeyNames>, Value = Omit<Entity, PrimaryKeyNames[number] & keyof Entity>, InsertType extends InsertEntity<Entity, AutoGeneratedKeys<Schema>> = InsertEntity<Entity, AutoGeneratedKeys<Schema>>> extends BaseTabularStorage<Schema, PrimaryKeyNames, Entity, PrimaryKey, Value, InsertType> {
|
|
18
|
-
table: string;
|
|
19
|
-
/** Promise that resolves to the IndexedDB database instance */
|
|
20
|
-
private db;
|
|
21
|
-
/** Promise to track ongoing database setup to prevent concurrent setup calls */
|
|
22
|
-
private setupPromise;
|
|
23
|
-
/** Migration options for database schema changes */
|
|
24
|
-
private migrationOptions;
|
|
25
|
-
/** Shared hybrid subscription manager */
|
|
26
|
-
private hybridManager;
|
|
27
|
-
/** Hybrid subscription options */
|
|
28
|
-
private readonly hybridOptions;
|
|
29
|
-
/**
|
|
30
|
-
* Indexes safe for cursor-based narrowing. An IDB index excludes records
|
|
31
|
-
* whose keyPath has any undefined component, so iterating an index can miss
|
|
32
|
-
* records when an indexed column is optional in the schema. Native
|
|
33
|
-
* `count(range)` and cursor scans are only correct over indexes whose every
|
|
34
|
-
* column is required. Computed lazily on first use.
|
|
35
|
-
*/
|
|
36
|
-
private cursorSafeIndexes;
|
|
37
|
-
/**
|
|
38
|
-
* Creates a new IndexedDB-based tabular repository.
|
|
39
|
-
* @param table - Name of the IndexedDB store to use.
|
|
40
|
-
* @param schema - Schema defining the structure of the entity
|
|
41
|
-
* @param primaryKeyNames - Array of property names that form the primary key
|
|
42
|
-
* @param indexes - Array of columns or column arrays to make searchable. Each string or single column creates a single-column index,
|
|
43
|
-
* while each array creates a compound index with columns in the specified order.
|
|
44
|
-
* @param migrationOptions - Options for handling database schema migrations
|
|
45
|
-
* @param clientProvidedKeys - How to handle client-provided values for auto-generated keys
|
|
46
|
-
*/
|
|
47
|
-
constructor(table: string | undefined, schema: Schema, primaryKeyNames: PrimaryKeyNames, indexes?: readonly (keyof NoInfer<Entity> | readonly (keyof NoInfer<Entity>)[])[], migrationOptions?: MigrationOptions & {
|
|
48
|
-
readonly useBroadcastChannel?: boolean;
|
|
49
|
-
readonly backupPollingIntervalMs?: number;
|
|
50
|
-
}, clientProvidedKeys?: ClientProvidedKeysOption);
|
|
51
|
-
private getDb;
|
|
52
|
-
/**
|
|
53
|
-
* Sets up the IndexedDB database table with the required schema and indexes.
|
|
54
|
-
* Must be called before using any other methods.
|
|
55
|
-
*/
|
|
56
|
-
setupDatabase(): Promise<void>;
|
|
57
|
-
private performSetup;
|
|
58
|
-
/**
|
|
59
|
-
* Generates a key value for UUID keys
|
|
60
|
-
* Integer autoincrement keys are handled by IndexedDB's autoIncrement
|
|
61
|
-
* @param columnName - Name of the column to generate a key for
|
|
62
|
-
* @param strategy - The generation strategy to use
|
|
63
|
-
* @returns The generated key value
|
|
64
|
-
*/
|
|
65
|
-
protected generateKeyValue(columnName: string, strategy: KeyGenerationStrategy): string | number;
|
|
66
|
-
/**
|
|
67
|
-
* Stores a row in the repository.
|
|
68
|
-
* @param record - The entity to store (may be missing auto-generated keys).
|
|
69
|
-
* @returns The stored entity
|
|
70
|
-
* @emits put - Emitted when the value is successfully stored
|
|
71
|
-
*/
|
|
72
|
-
put(record: InsertType): Promise<Entity>;
|
|
73
|
-
/**
|
|
74
|
-
* Stores multiple rows in the repository in a bulk operation.
|
|
75
|
-
* @param records - Array of entities to store (may be missing auto-generated keys).
|
|
76
|
-
* @returns Array of stored entities
|
|
77
|
-
* @emits put - Emitted for each record successfully stored
|
|
78
|
-
*/
|
|
79
|
-
putBulk(records: InsertType[]): Promise<Entity[]>;
|
|
80
|
-
protected getPrimaryKeyAsOrderedArray(key: PrimaryKey): (string | number | boolean | Uint8Array<ArrayBufferLike> | null)[];
|
|
81
|
-
private getIndexedKey;
|
|
82
|
-
/**
|
|
83
|
-
* Retrieves a value from the repository by its key.
|
|
84
|
-
* @param key - The key object.
|
|
85
|
-
* @returns The value object or undefined if not found.
|
|
86
|
-
* @emits get - Emitted when the value is successfully retrieved
|
|
87
|
-
*/
|
|
88
|
-
get(key: PrimaryKey): Promise<Entity | undefined>;
|
|
89
|
-
/**
|
|
90
|
-
* Returns an array of all entries in the repository, with optional ordering, offset, and limit.
|
|
91
|
-
* @param options - Optional ordering, limit, and offset options
|
|
92
|
-
* @returns Array of all entries in the repository.
|
|
93
|
-
*/
|
|
94
|
-
getAll(options?: QueryOptions<Entity>): Promise<Entity[] | undefined>;
|
|
95
|
-
/**
|
|
96
|
-
* Deletes a row from the repository.
|
|
97
|
-
* @param key - The key object to delete.
|
|
98
|
-
*/
|
|
99
|
-
delete(key: PrimaryKey): Promise<void>;
|
|
100
|
-
/**
|
|
101
|
-
* Deletes all records from the repository.
|
|
102
|
-
* @emits clearall - Emitted when all values are deleted
|
|
103
|
-
*/
|
|
104
|
-
deleteAll(): Promise<void>;
|
|
105
|
-
/**
|
|
106
|
-
* Returns the total number of rows in the repository.
|
|
107
|
-
* @returns Count of stored items.
|
|
108
|
-
*/
|
|
109
|
-
size(): Promise<number>;
|
|
110
|
-
/**
|
|
111
|
-
* Returns the subset of configured indexes safe to use for cursor-based
|
|
112
|
-
* narrowing — those whose every column is required by the schema. IDB
|
|
113
|
-
* excludes records with undefined keyPath components from indexes, so
|
|
114
|
-
* iterating an index would silently miss records when any indexed column
|
|
115
|
-
* is optional.
|
|
116
|
-
*/
|
|
117
|
-
private getCursorSafeIndexes;
|
|
118
|
-
/**
|
|
119
|
-
* Picks the best index to narrow a criteria-based scan, preferring indexes
|
|
120
|
-
* whose prefix covers every criteria column (so callers can use the native
|
|
121
|
-
* `count()` API) and falling back to the longest equality-prefix match.
|
|
122
|
-
*
|
|
123
|
-
* Upper bound uses `[]` as a sentinel that compares greater than any
|
|
124
|
-
* primitive value at the next index position (per IndexedDB key ordering:
|
|
125
|
-
* array > binary > string > date > number). Assumes subsequent indexed
|
|
126
|
-
* columns hold primitive values — array-valued columns would compare
|
|
127
|
-
* greater than `[]` and slip outside the range.
|
|
128
|
-
*/
|
|
129
|
-
private createIndexedRange;
|
|
130
|
-
/**
|
|
131
|
-
* Counts rows matching the specified search criteria.
|
|
132
|
-
*
|
|
133
|
-
* Uses the native `count()` API when an index prefix covers every criteria
|
|
134
|
-
* column. Otherwise narrows via the longest matching index prefix and
|
|
135
|
-
* filters the remaining columns during cursor iteration. Falls back to a
|
|
136
|
-
* full store scan only when no index applies.
|
|
137
|
-
*/
|
|
138
|
-
count(criteria?: SearchCriteria<Entity>): Promise<number>;
|
|
139
|
-
/**
|
|
140
|
-
* Fetches a page of records from the repository.
|
|
141
|
-
* @param offset - Number of records to skip
|
|
142
|
-
* @param limit - Maximum number of records to return
|
|
143
|
-
* @returns Array of entities or undefined if no records found
|
|
144
|
-
*/
|
|
145
|
-
getBulk(offset: number, limit: number): Promise<Entity[] | undefined>;
|
|
146
|
-
/**
|
|
147
|
-
* Checks if a record matches all criteria conditions.
|
|
148
|
-
* @param record - The record to check
|
|
149
|
-
* @param criteria - The search criteria
|
|
150
|
-
* @returns true if all conditions match
|
|
151
|
-
*/
|
|
152
|
-
private matchesCriteria;
|
|
153
|
-
/**
|
|
154
|
-
* Deletes all entries matching the specified search criteria.
|
|
155
|
-
* Supports multiple columns with optional comparison operators.
|
|
156
|
-
*
|
|
157
|
-
* @param criteria - Object with column names as keys and values or SearchConditions
|
|
158
|
-
*/
|
|
159
|
-
deleteSearch(criteria: DeleteSearchCriteria<Entity>): Promise<void>;
|
|
160
|
-
private getEqualityCriterionValue;
|
|
161
|
-
private compareByOrder;
|
|
162
|
-
private createIndexedQuery;
|
|
163
|
-
/**
|
|
164
|
-
* Queries entries matching the specified search criteria with optional ordering, limit, and offset.
|
|
165
|
-
*
|
|
166
|
-
* @param criteria - Object with column names as keys and values or SearchConditions
|
|
167
|
-
* @param options - Optional ordering, limit, and offset options
|
|
168
|
-
* @returns Array of matching entities or undefined if no matches found
|
|
169
|
-
*/
|
|
170
|
-
query(criteria: SearchCriteria<Entity>, options?: QueryOptions<Entity>): Promise<Entity[] | undefined>;
|
|
171
|
-
/**
|
|
172
|
-
* Strict, projected query served entirely by a covering compound index.
|
|
173
|
-
* Uses `openKeyCursor` — never reads `cursor.value` — so only the index key
|
|
174
|
-
* bytes are loaded into memory. Ideal for tables with large value blobs.
|
|
175
|
-
*
|
|
176
|
-
* Throws {@link CoveringIndexMissingError} when no registered index can serve
|
|
177
|
-
* the request (i.e. the index does not cover all select + orderBy columns).
|
|
178
|
-
*/
|
|
179
|
-
queryIndex<K extends keyof Entity & string>(criteria: SearchCriteria<Entity>, options: CoveringIndexQueryOptions<Entity, K>): Promise<Pick<Entity, K>[]>;
|
|
180
|
-
/**
|
|
181
|
-
* Gets or creates the shared hybrid subscription manager.
|
|
182
|
-
* This ensures all subscriptions share a single manager.
|
|
183
|
-
*/
|
|
184
|
-
private getHybridManager;
|
|
185
|
-
/**
|
|
186
|
-
* Subscribes to changes in the repository.
|
|
187
|
-
* Uses polling since IndexedDB has no native cross-tab change notifications.
|
|
188
|
-
*
|
|
189
|
-
* @param callback - Function called when a change occurs
|
|
190
|
-
* @param options - Optional subscription options including polling interval
|
|
191
|
-
* @returns Unsubscribe function
|
|
192
|
-
*/
|
|
193
|
-
subscribeToChanges(callback: (change: TabularChangePayload<Entity>) => void, options?: TabularSubscribeOptions): () => void;
|
|
194
|
-
/**
|
|
195
|
-
* Destroys this repository and frees up resources.
|
|
196
|
-
*/
|
|
197
|
-
destroy(): void;
|
|
198
|
-
}
|
|
199
|
-
//# sourceMappingURL=IndexedDbTabularStorage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedDbTabularStorage.d.ts","sourceRoot":"","sources":["../../src/tabular/IndexedDbTabularStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAGL,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,YAAY,EAEZ,YAAY,EACZ,cAAc,EAEd,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,mBAAmB,CAAC;AAG3B,eAAO,MAAM,sBAAsB,0DAElC,CAAC;AA0BF;;;;;GAKG;AACH,qBAAa,uBAAuB,CAClC,MAAM,SAAS,oBAAoB,EACnC,eAAe,SAAS,aAAa,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,EAEjE,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,uBAAuB,CAAC,EACpD,UAAU,GAAG,kBAAkB,CAAC,MAAM,EAAE,eAAe,CAAC,EACxD,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM,MAAM,CAAC,EAC5D,UAAU,SAAS,YAAY,CAAC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAC/E,MAAM,EACN,iBAAiB,CAAC,MAAM,CAAC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