@aiao/rxdb-adapter-sqliteai 0.0.20 → 0.0.21
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/RxDBAdapterSqliteai.d.ts +3 -3
- package/dist/SqliteaiClient.d.ts +1 -1
- package/dist/create_sqlite_client.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -17
- package/dist/sqliteai-load.utils.d.ts +1 -1
- package/dist/sqliteai-load.utils.d.ts.map +1 -1
- package/dist/sqliteai.interface.d.ts +6 -4
- package/dist/sqliteai.interface.d.ts.map +1 -1
- package/package.json +5 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RxDB } from '
|
|
2
|
-
import { RxDBAdapterSqliteBase, SqliteClientLike } from '
|
|
1
|
+
import { RxDB } from '@aiao/rxdb';
|
|
2
|
+
import { RxDBAdapterSqliteBase, SqliteClientLike } from '@aiao/rxdb-adapter-sqlite-core';
|
|
3
3
|
import { ADAPTER_NAME, SqliteaiOptions } from './sqliteai.interface.js';
|
|
4
4
|
/**
|
|
5
5
|
* 基于 `@sqliteai/sqlite-wasm` 的 RxDB 本地存储适配器。
|
|
@@ -15,7 +15,7 @@ export declare class RxDBAdapterSqliteai extends RxDBAdapterSqliteBase {
|
|
|
15
15
|
constructor(rxdb: RxDB, options: SqliteaiOptions);
|
|
16
16
|
protected createClient(): Promise<SqliteClientLike>;
|
|
17
17
|
}
|
|
18
|
-
declare module '
|
|
18
|
+
declare module '@aiao/rxdb' {
|
|
19
19
|
interface RxDBAdapters {
|
|
20
20
|
[ADAPTER_NAME]: RxDBAdapterSqliteai;
|
|
21
21
|
}
|
package/dist/SqliteaiClient.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BATCH_TIMEOUT, Oo1ClientBase, Oo1Static } from '
|
|
1
|
+
import { BATCH_TIMEOUT, Oo1ClientBase, Oo1Static } from '@aiao/rxdb-adapter-sqlite-core';
|
|
2
2
|
import { SqliteaiLoadOptions } from './sqliteai.interface.js';
|
|
3
3
|
export { BATCH_TIMEOUT };
|
|
4
4
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_sqlite_client.d.ts","sourceRoot":"","sources":["../src/create_sqlite_client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAA4B,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"create_sqlite_client.d.ts","sourceRoot":"","sources":["../src/create_sqlite_client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAA4B,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAgB1G"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ROWID, RxDBAdapterSqliteError, SqliteRepository, buildRuleGroup, get_table_name as sqliteGetTableName, get_table_name_by_metadata as sqliteGetTableNameByMetadata } from '
|
|
2
|
-
export type { GenerateSqlResult } from '
|
|
1
|
+
export { ROWID, RxDBAdapterSqliteError, SqliteRepository, buildRuleGroup, get_table_name as sqliteGetTableName, get_table_name_by_metadata as sqliteGetTableNameByMetadata } from '@aiao/rxdb-adapter-sqlite-core';
|
|
2
|
+
export type { GenerateSqlResult } from '@aiao/rxdb-adapter-sqlite-core';
|
|
3
3
|
export { createSqliteClient } from './create_sqlite_client.js';
|
|
4
4
|
export { RxDBAdapterSqliteai } from './RxDBAdapterSqliteai.js';
|
|
5
5
|
export { sqliteaiLoad } from './sqliteai-load.utils.js';
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { Oo1ClientBase as e, ROWID as t, RxDBAdapterSqliteBase as n, RxDBAdapterSqliteError as r, SqliteRepository as i, buildOo1InitOptions as a, buildRuleGroup as o, defaultWarn as s, get_table_name as c, get_table_name_by_metadata as l,
|
|
2
|
-
import
|
|
1
|
+
import { Oo1ClientBase as e, ROWID as t, RxDBAdapterSqliteBase as n, RxDBAdapterSqliteError as r, SqliteRepository as i, buildOo1InitOptions as a, buildRuleGroup as o, defaultWarn as s, get_table_name as c, get_table_name_by_metadata as l, withGlobalOo1LoadLock as u, withPatchedOpfsProxyWorker as d, withSqliteApiConfig as f, wrapWithComlink as p } from "@aiao/rxdb-adapter-sqlite-core";
|
|
2
|
+
import m from "@sqliteai/sqlite-wasm";
|
|
3
3
|
//#region src/sqliteai-load.utils.ts
|
|
4
|
-
var
|
|
5
|
-
async function
|
|
6
|
-
let t = !!e?.opfs && !!e.opfsProxyPath;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
var h, g = !1;
|
|
5
|
+
async function _(e) {
|
|
6
|
+
let t = !!e?.opfs && !!e.opfsProxyPath, n = () => h && (!t || g) ? h : void 0;
|
|
7
|
+
return n() || u(async () => {
|
|
8
|
+
let r = n();
|
|
9
|
+
if (r) return r;
|
|
10
|
+
let i = a(e), o = await d(e, async () => await f({ warn: s }, async () => await m(i)));
|
|
11
|
+
return o.config && (o.config.warn = s), h = o, g = t, o;
|
|
12
|
+
});
|
|
10
13
|
}
|
|
11
14
|
//#endregion
|
|
12
15
|
//#region src/SqliteaiClient.ts
|
|
13
|
-
var
|
|
16
|
+
var v = class extends e {
|
|
14
17
|
get clientName() {
|
|
15
18
|
return "sqliteai";
|
|
16
19
|
}
|
|
17
20
|
loadModule(e) {
|
|
18
|
-
return
|
|
21
|
+
return _(e);
|
|
19
22
|
}
|
|
20
23
|
};
|
|
21
24
|
//#endregion
|
|
22
25
|
//#region src/create_sqlite_client.ts
|
|
23
|
-
async function
|
|
26
|
+
async function y(e, t) {
|
|
24
27
|
let n = {
|
|
25
28
|
opfs: t.opfs,
|
|
26
29
|
wasmPath: t.wasmPath,
|
|
@@ -29,22 +32,23 @@ async function v(e, t) {
|
|
|
29
32
|
print: t.print,
|
|
30
33
|
printErr: t.printErr,
|
|
31
34
|
cacheSizeKb: t.cacheSizeKb,
|
|
32
|
-
batchTimeout: t.batchTimeout
|
|
33
|
-
|
|
35
|
+
batchTimeout: t.batchTimeout,
|
|
36
|
+
opfsFallback: t.opfsFallback
|
|
37
|
+
}, r = p(new v(), t);
|
|
34
38
|
return await r.init(e, n), r;
|
|
35
39
|
}
|
|
36
40
|
//#endregion
|
|
37
41
|
//#region src/sqliteai.interface.ts
|
|
38
|
-
var
|
|
42
|
+
var b = "sqliteai", x = class extends n {
|
|
39
43
|
options;
|
|
40
44
|
#e;
|
|
41
|
-
name =
|
|
45
|
+
name = b;
|
|
42
46
|
constructor(e, t) {
|
|
43
47
|
super(e, t), this.options = t, this.#e = e.config.dbName;
|
|
44
48
|
}
|
|
45
49
|
async createClient() {
|
|
46
|
-
return
|
|
50
|
+
return y(this.#e, this.options);
|
|
47
51
|
}
|
|
48
52
|
};
|
|
49
53
|
//#endregion
|
|
50
|
-
export { t as ROWID, r as RxDBAdapterSqliteError,
|
|
54
|
+
export { t as ROWID, r as RxDBAdapterSqliteError, x as RxDBAdapterSqliteai, i as SqliteRepository, v as SqliteaiClient, o as buildRuleGroup, y as createSqliteClient, c as sqliteGetTableName, l as sqliteGetTableNameByMetadata, _ as sqliteaiLoad };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqliteai-load.utils.d.ts","sourceRoot":"","sources":["../src/sqliteai-load.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"sqliteai-load.utils.d.ts","sourceRoot":"","sources":["../src/sqliteai-load.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAIf,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAKnE;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAG7C;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,CA6BpF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EntityType, IRxDBAdapterOptions, RepositoryBase } from '
|
|
2
|
-
import { OpfsFallback, RxDBAdapterSqliteBase } from '
|
|
1
|
+
import { EntityType, IEntity, IRxDBAdapterOptions, RepositoryBase } from '@aiao/rxdb';
|
|
2
|
+
import { OpfsFallback, RxDBAdapterSqliteBase } from '@aiao/rxdb-adapter-sqlite-core';
|
|
3
3
|
/**
|
|
4
4
|
* SqliteAI 适配器的可配置项(不含自定义 repository 注册)。
|
|
5
5
|
*
|
|
@@ -26,11 +26,13 @@ interface SqliteaiOptionsBase extends IRxDBAdapterOptions {
|
|
|
26
26
|
sharedWorker?: boolean;
|
|
27
27
|
sharedWorkerInstance?: SharedWorker;
|
|
28
28
|
}
|
|
29
|
+
/** 任意实体构造器。 */
|
|
30
|
+
type AnyEntityType = EntityType & (new (...args: never[]) => IEntity);
|
|
29
31
|
/** 自定义 Repository 类的构造器签名(用户可覆盖默认 Repository / TreeRepository)。 */
|
|
30
|
-
export type SqliteaiRepositoryConstructor<T extends RepositoryBase<
|
|
32
|
+
export type SqliteaiRepositoryConstructor<T extends RepositoryBase<AnyEntityType>> = new (adapter: RxDBAdapterSqliteBase, EntityType: EntityType) => T;
|
|
31
33
|
/** SqliteAI 适配器完整选项(含可选的自定义 Repository 注册表)。 */
|
|
32
34
|
export interface SqliteaiOptions extends SqliteaiOptionsBase {
|
|
33
|
-
repositories?: Record<string, SqliteaiRepositoryConstructor<
|
|
35
|
+
repositories?: Record<string, SqliteaiRepositoryConstructor<RepositoryBase<AnyEntityType>>>;
|
|
34
36
|
}
|
|
35
37
|
/** `sqliteaiLoad` 接受的运行期选项子集(剥离 worker / repository 配置)。 */
|
|
36
38
|
export type SqliteaiLoadOptions = Pick<SqliteaiOptionsBase, 'opfs' | 'wasmPath' | 'opfsProxyPath' | 'locateFile' | 'print' | 'printErr' | 'cacheSizeKb' | 'batchTimeout' | 'opfsFallback'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqliteai.interface.d.ts","sourceRoot":"","sources":["../src/sqliteai.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"sqliteai.interface.d.ts","sourceRoot":"","sources":["../src/sqliteai.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE1F;;;;;;;GAOG;AACH,UAAU,mBAAoB,SAAQ,mBAAmB;IACvD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,YAAY,CAAC;CACrC;AAED,eAAe;AACf,KAAK,aAAa,GAAG,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC,CAAC;AAEtE,mEAAmE;AACnE,MAAM,MAAM,6BAA6B,CAAC,CAAC,SAAS,cAAc,CAAC,aAAa,CAAC,IAAI,KACnF,OAAO,EAAE,qBAAqB,EAC9B,UAAU,EAAE,UAAU,KACnB,CAAC,CAAC;AAEP,gDAAgD;AAChD,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CAC7F;AAED,4DAA4D;AAC5D,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,mBAAmB,EACjB,MAAM,GACN,UAAU,GACV,eAAe,GACf,YAAY,GACZ,OAAO,GACP,UAAU,GACV,aAAa,GACb,cAAc,GACd,cAAc,CACjB,CAAC;AAEF,2BAA2B;AAC3B,eAAO,MAAM,YAAY,EAAG,UAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiao/rxdb-adapter-sqliteai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -28,14 +28,12 @@
|
|
|
28
28
|
]
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@sqliteai/sqlite-wasm": "3.50.4-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"@aiao/rxdb": "0.0.20",
|
|
35
|
-
"@aiao/rxdb-adapter-sqlite-core": "0.0.20"
|
|
31
|
+
"@sqliteai/sqlite-wasm": "3.50.4-wasm.1.0.0-sync.1.1.2-vector.1.0.0-memory.1.3.5",
|
|
32
|
+
"@aiao/rxdb": "0.0.21",
|
|
33
|
+
"@aiao/rxdb-adapter-sqlite-core": "0.0.21"
|
|
36
34
|
},
|
|
37
35
|
"devDependencies": {
|
|
38
36
|
"ms": "^2.1.3",
|
|
39
|
-
"@aiao/rxdb-test": "0.0.
|
|
37
|
+
"@aiao/rxdb-test": "0.0.21"
|
|
40
38
|
}
|
|
41
39
|
}
|