@aiao/rxdb-adapter-sqliteai 0.0.24 → 0.0.26
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 +2 -2
- package/dist/RxDBAdapterSqliteai-Bebaerj4.js +63 -0
- package/dist/assets/sqlite3-opfs-async-proxy-CPArLPLU.js +1 -0
- package/dist/assets/sqlite3-worker1-bundler-friendly-C9ENWE60.js +3 -0
- package/dist/assets/sqliteai-test.worker-CTOPs2O0.js +23 -0
- package/dist/create_sqlite_client.d.ts.map +1 -1
- package/dist/index.js +3 -59
- package/dist/testing.d.ts +3 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +1537 -0
- package/package.json +31 -5
- package/src/create_sqlite_client.ts +15 -3
- package/src/testing.ts +21 -0
package/package.json
CHANGED
|
@@ -1,13 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiao/rxdb-adapter-sqliteai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
|
+
"description": "SQLiteAI adapter with vector and AI functions for Aiao RxDB.",
|
|
5
|
+
"homepage": "https://rxdb.netlify.app/docs/adapters/sqliteai",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/aiao-io/rxdb/issues"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"aiao",
|
|
11
|
+
"rxdb",
|
|
12
|
+
"sqliteai",
|
|
13
|
+
"sqlite",
|
|
14
|
+
"vector-search",
|
|
15
|
+
"ai"
|
|
16
|
+
],
|
|
4
17
|
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/aiao-io/rxdb.git",
|
|
21
|
+
"directory": "packages/rxdb-adapter-sqliteai"
|
|
22
|
+
},
|
|
5
23
|
"type": "module",
|
|
24
|
+
"sideEffects": false,
|
|
6
25
|
"main": "./dist/index.js",
|
|
7
26
|
"module": "./dist/index.js",
|
|
8
27
|
"types": "./dist/index.d.ts",
|
|
9
28
|
"exports": {
|
|
10
29
|
"./package.json": "./package.json",
|
|
30
|
+
"./testing": {
|
|
31
|
+
"@aiao/source": "./src/testing.ts",
|
|
32
|
+
"types": "./dist/testing.d.ts",
|
|
33
|
+
"import": "./dist/testing.js",
|
|
34
|
+
"default": "./dist/testing.js"
|
|
35
|
+
},
|
|
11
36
|
".": {
|
|
12
37
|
"types": "./dist/index.d.ts",
|
|
13
38
|
"import": "./dist/index.js",
|
|
@@ -32,13 +57,14 @@
|
|
|
32
57
|
]
|
|
33
58
|
},
|
|
34
59
|
"dependencies": {
|
|
35
|
-
"@sqliteai/sqlite-wasm": "3.50.4-wasm.1.0.0-sync.1.1.
|
|
36
|
-
"@aiao/rxdb": "0.0.
|
|
37
|
-
"@aiao/rxdb-adapter-sqlite-core": "0.0.
|
|
60
|
+
"@sqliteai/sqlite-wasm": "3.50.4-wasm.1.0.0-sync.1.1.3-vector.1.1.2-memory.1.3.5",
|
|
61
|
+
"@aiao/rxdb": "0.0.26",
|
|
62
|
+
"@aiao/rxdb-adapter-sqlite-core": "0.0.26"
|
|
38
63
|
},
|
|
39
64
|
"devDependencies": {
|
|
40
65
|
"comlink": "^4.4.2",
|
|
41
66
|
"ms": "^2.1.3",
|
|
42
|
-
"@aiao/rxdb-
|
|
67
|
+
"@aiao/rxdb-plugin-history": "0.0.26",
|
|
68
|
+
"@aiao/rxdb-test": "0.0.26"
|
|
43
69
|
}
|
|
44
70
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
assertLoadOptionsTransferable,
|
|
3
|
+
releaseComlinkProxy,
|
|
4
|
+
wrapWithComlink,
|
|
5
|
+
type SqliteClientLike
|
|
6
|
+
} from '@aiao/rxdb-adapter-sqlite-core';
|
|
2
7
|
import { SqliteaiOptions, type SqliteaiLoadOptions } from './sqliteai.interface.js';
|
|
3
8
|
import { SqliteaiClient } from './SqliteaiClient.js';
|
|
4
9
|
|
|
@@ -33,6 +38,13 @@ export async function createSqliteClient(dbName: string, options: SqliteaiOption
|
|
|
33
38
|
assertLoadOptionsTransferable(loadOptions, options);
|
|
34
39
|
|
|
35
40
|
const client = wrapWithComlink(new SqliteaiClient(), options);
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
try {
|
|
42
|
+
await client.init(dbName, loadOptions);
|
|
43
|
+
return client;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
// 同 rxdb-adapter-sqlite / rxdb-adapter-sqlite-wasm:init 失败要释放 Comlink 代理,
|
|
46
|
+
// 否则 worker 模式下每次失败的重连都会多留一个 MessagePort 和一个 worker 侧客户端。
|
|
47
|
+
releaseComlinkProxy(client);
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
38
50
|
}
|
package/src/testing.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sqliteai 适配器测试工具入口(test-only)。
|
|
3
|
+
*
|
|
4
|
+
* 通过 `@aiao/rxdb-adapter-sqliteai/testing` 子路径导出,供跨包测试复用
|
|
5
|
+
* `sqliteaiFactory`(US-703 AC#8 的搜索套件入口依赖它)。
|
|
6
|
+
*
|
|
7
|
+
* 刻意用 `import.meta.glob` 而不是直接 `export ... from './__tests__/...'`:
|
|
8
|
+
* 后者会在 lib 类型检查里把测试工厂(及其 `@aiao/rxdb-test/encrypted` 依赖链)
|
|
9
|
+
* 拖进 `rootDir`,违反 `src/__tests__/` 的 lib 排除约定。glob 不产生直接 TS
|
|
10
|
+
* import 边,测试工厂只在 vite 打包/运行期被解析,类型由泛型声明。
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { AdapterFactory } from '@aiao/rxdb-adapter-sqlite-core/testing';
|
|
16
|
+
|
|
17
|
+
const factoryModules = import.meta.glob<{ sqliteaiFactory: AdapterFactory }>('./__tests__/sqliteai-factory.ts', {
|
|
18
|
+
eager: true
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const sqliteaiFactory: AdapterFactory = factoryModules['./__tests__/sqliteai-factory.ts'].sqliteaiFactory;
|