@lix-js/sdk 0.1.0 → 0.2.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/dist/account/database-schema.d.ts.map +1 -1
- package/dist/account/database-schema.js +2 -6
- package/dist/account/database-schema.js.map +1 -1
- package/dist/account/database-schema.test.js +4 -8
- package/dist/account/database-schema.test.js.map +1 -1
- package/dist/file-queue/file-queue-process.d.ts.map +1 -1
- package/dist/file-queue/file-queue-process.js +4 -1
- package/dist/file-queue/file-queue-process.js.map +1 -1
- package/dist/file-queue/file-queue-process.test.js +4 -5
- package/dist/file-queue/file-queue-process.test.js.map +1 -1
- package/dist/lix/open-lix.d.ts +16 -1
- package/dist/lix/open-lix.d.ts.map +1 -1
- package/dist/lix/open-lix.js +76 -0
- package/dist/lix/open-lix.js.map +1 -1
- package/dist/lix/open-lix.test.js +54 -0
- package/dist/lix/open-lix.test.js.map +1 -1
- package/dist/services/env-variables/index.d.ts +5 -0
- package/dist/services/env-variables/index.d.ts.map +1 -0
- package/dist/services/env-variables/index.js +5 -0
- package/dist/services/env-variables/index.js.map +1 -0
- package/dist/services/telemetry/capture.d.ts +30 -0
- package/dist/services/telemetry/capture.d.ts.map +1 -0
- package/dist/services/telemetry/capture.js +71 -0
- package/dist/services/telemetry/capture.js.map +1 -0
- package/dist/services/telemetry/capture.test.d.ts +2 -0
- package/dist/services/telemetry/capture.test.d.ts.map +1 -0
- package/dist/services/telemetry/capture.test.js +37 -0
- package/dist/services/telemetry/capture.test.js.map +1 -0
- package/dist/sync/sync-process.d.ts.map +1 -1
- package/dist/sync/sync-process.js +11 -5
- package/dist/sync/sync-process.js.map +1 -1
- package/package.json +4 -6
- package/src/account/database-schema.test.ts +6 -9
- package/src/account/database-schema.ts +2 -6
- package/src/file-queue/file-queue-process.test.ts +4 -5
- package/src/file-queue/file-queue-process.ts +4 -1
- package/src/lix/open-lix.test.ts +63 -0
- package/src/lix/open-lix.ts +98 -1
- package/src/services/env-variables/create-index-file.js +35 -0
- package/src/services/env-variables/index.d.ts +15 -0
- package/src/services/telemetry/capture.test.ts +44 -0
- package/src/services/telemetry/capture.ts +99 -0
- package/src/sync/sync-process.ts +11 -6
- package/node_modules/@lix-js/server-api-schema/.prettierrc.json +0 -3
- package/node_modules/@lix-js/server-api-schema/.vscode/extensions.json +0 -3
- package/node_modules/@lix-js/server-api-schema/CHANGELOG.md +0 -9
- package/node_modules/@lix-js/server-api-schema/LICENSE +0 -21
- package/node_modules/@lix-js/server-api-schema/dist/schema.js +0 -0
- package/node_modules/@lix-js/server-api-schema/package.json +0 -21
- package/node_modules/@lix-js/server-api-schema/src/schema.yaml +0 -290
- package/node_modules/@lix-js/server-api-schema/tsconfig.json +0 -20
- package/node_modules/sqlite-wasm-kysely/LICENSE +0 -21
- package/node_modules/sqlite-wasm-kysely/README.md +0 -11
- package/node_modules/sqlite-wasm-kysely/dist/dialect.d.ts +0 -11
- package/node_modules/sqlite-wasm-kysely/dist/dialect.js +0 -13
- package/node_modules/sqlite-wasm-kysely/dist/dialect.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/index.d.ts +0 -2
- package/node_modules/sqlite-wasm-kysely/dist/index.js +0 -3
- package/node_modules/sqlite-wasm-kysely/dist/index.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/kysely/ConnectionMutex.d.ts +0 -5
- package/node_modules/sqlite-wasm-kysely/dist/kysely/ConnectionMutex.js +0 -34
- package/node_modules/sqlite-wasm-kysely/dist/kysely/ConnectionMutex.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/kysely/SqliteWasmConnection.d.ts +0 -8
- package/node_modules/sqlite-wasm-kysely/dist/kysely/SqliteWasmConnection.js +0 -57
- package/node_modules/sqlite-wasm-kysely/dist/kysely/SqliteWasmConnection.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/kysely/SqliteWasmDialectConfig.d.ts +0 -18
- package/node_modules/sqlite-wasm-kysely/dist/kysely/SqliteWasmDialectConfig.js +0 -2
- package/node_modules/sqlite-wasm-kysely/dist/kysely/SqliteWasmDialectConfig.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/kysely/SqliteWasmDriver.d.ts +0 -13
- package/node_modules/sqlite-wasm-kysely/dist/kysely/SqliteWasmDriver.js +0 -57
- package/node_modules/sqlite-wasm-kysely/dist/kysely/SqliteWasmDriver.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/kysely/index.d.ts +0 -4
- package/node_modules/sqlite-wasm-kysely/dist/kysely/index.js +0 -4
- package/node_modules/sqlite-wasm-kysely/dist/kysely/index.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/kysely/sqliteModule.d.ts +0 -3
- package/node_modules/sqlite-wasm-kysely/dist/kysely/sqliteModule.js +0 -5
- package/node_modules/sqlite-wasm-kysely/dist/kysely/sqliteModule.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/util/contentFromDatabase.d.ts +0 -9
- package/node_modules/sqlite-wasm-kysely/dist/util/contentFromDatabase.js +0 -12
- package/node_modules/sqlite-wasm-kysely/dist/util/contentFromDatabase.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/util/createInMemoryDatabase.d.ts +0 -3
- package/node_modules/sqlite-wasm-kysely/dist/util/createInMemoryDatabase.js +0 -22
- package/node_modules/sqlite-wasm-kysely/dist/util/createInMemoryDatabase.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/util/importDatabase.d.ts +0 -7
- package/node_modules/sqlite-wasm-kysely/dist/util/importDatabase.js +0 -15
- package/node_modules/sqlite-wasm-kysely/dist/util/importDatabase.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/util/index.d.ts +0 -5
- package/node_modules/sqlite-wasm-kysely/dist/util/index.js +0 -5
- package/node_modules/sqlite-wasm-kysely/dist/util/index.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/util/loadDatabaseInMemory.d.ts +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/util/loadDatabaseInMemory.js +0 -13
- package/node_modules/sqlite-wasm-kysely/dist/util/loadDatabaseInMemory.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/dist/util/sqliteWasmBinary.d.ts +0 -7
- package/node_modules/sqlite-wasm-kysely/dist/util/sqliteWasmBinary.js +0 -17
- package/node_modules/sqlite-wasm-kysely/dist/util/sqliteWasmBinary.js.map +0 -1
- package/node_modules/sqlite-wasm-kysely/package.json +0 -34
- package/node_modules/sqlite-wasm-kysely/src/dialect.ts +0 -15
- package/node_modules/sqlite-wasm-kysely/src/index.ts +0 -2
- package/node_modules/sqlite-wasm-kysely/src/kysely/ConnectionMutex.ts +0 -23
- package/node_modules/sqlite-wasm-kysely/src/kysely/SqliteWasmConnection.ts +0 -57
- package/node_modules/sqlite-wasm-kysely/src/kysely/SqliteWasmDialectConfig.ts +0 -19
- package/node_modules/sqlite-wasm-kysely/src/kysely/SqliteWasmDriver.ts +0 -58
- package/node_modules/sqlite-wasm-kysely/src/kysely/index.ts +0 -4
- package/node_modules/sqlite-wasm-kysely/src/kysely/sqliteModule.ts +0 -7
- package/node_modules/sqlite-wasm-kysely/src/util/contentFromDatabase.ts +0 -13
- package/node_modules/sqlite-wasm-kysely/src/util/createInMemoryDatabase.ts +0 -30
- package/node_modules/sqlite-wasm-kysely/src/util/importDatabase.ts +0 -34
- package/node_modules/sqlite-wasm-kysely/src/util/index.ts +0 -5
- package/node_modules/sqlite-wasm-kysely/src/util/loadDatabaseInMemory.ts +0 -13
- package/node_modules/sqlite-wasm-kysely/src/util/sqliteWasmBinary.ts +0 -20
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _SqliteWasmDriver_config, _SqliteWasmDriver_connectionMutex, _SqliteWasmDriver_db, _SqliteWasmDriver_connection;
|
|
13
|
-
import { CompiledQuery } from "kysely";
|
|
14
|
-
import { ConnectionMutex } from "./ConnectionMutex.js";
|
|
15
|
-
import { SqliteWasmConnection } from "./SqliteWasmConnection.js";
|
|
16
|
-
export class SqliteWasmDriver {
|
|
17
|
-
constructor(config) {
|
|
18
|
-
_SqliteWasmDriver_config.set(this, void 0);
|
|
19
|
-
_SqliteWasmDriver_connectionMutex.set(this, new ConnectionMutex());
|
|
20
|
-
_SqliteWasmDriver_db.set(this, void 0);
|
|
21
|
-
_SqliteWasmDriver_connection.set(this, void 0);
|
|
22
|
-
// this.#config = freeze({ ...config })
|
|
23
|
-
__classPrivateFieldSet(this, _SqliteWasmDriver_config, { ...config }, "f");
|
|
24
|
-
}
|
|
25
|
-
async init() {
|
|
26
|
-
__classPrivateFieldSet(this, _SqliteWasmDriver_db, typeof __classPrivateFieldGet(this, _SqliteWasmDriver_config, "f").database === "function"
|
|
27
|
-
? await __classPrivateFieldGet(this, _SqliteWasmDriver_config, "f").database()
|
|
28
|
-
: __classPrivateFieldGet(this, _SqliteWasmDriver_config, "f").database, "f");
|
|
29
|
-
__classPrivateFieldSet(this, _SqliteWasmDriver_connection, new SqliteWasmConnection(__classPrivateFieldGet(this, _SqliteWasmDriver_db, "f")), "f");
|
|
30
|
-
if (__classPrivateFieldGet(this, _SqliteWasmDriver_config, "f").onCreateConnection) {
|
|
31
|
-
await __classPrivateFieldGet(this, _SqliteWasmDriver_config, "f").onCreateConnection(__classPrivateFieldGet(this, _SqliteWasmDriver_connection, "f"));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
async acquireConnection() {
|
|
35
|
-
// SQLite only has one single connection. We use a mutex here to wait
|
|
36
|
-
// until the single connection has been released.
|
|
37
|
-
await __classPrivateFieldGet(this, _SqliteWasmDriver_connectionMutex, "f").lock();
|
|
38
|
-
return __classPrivateFieldGet(this, _SqliteWasmDriver_connection, "f");
|
|
39
|
-
}
|
|
40
|
-
async beginTransaction(connection) {
|
|
41
|
-
await connection.executeQuery(CompiledQuery.raw("begin"));
|
|
42
|
-
}
|
|
43
|
-
async commitTransaction(connection) {
|
|
44
|
-
await connection.executeQuery(CompiledQuery.raw("commit"));
|
|
45
|
-
}
|
|
46
|
-
async rollbackTransaction(connection) {
|
|
47
|
-
await connection.executeQuery(CompiledQuery.raw("rollback"));
|
|
48
|
-
}
|
|
49
|
-
async releaseConnection() {
|
|
50
|
-
__classPrivateFieldGet(this, _SqliteWasmDriver_connectionMutex, "f").unlock();
|
|
51
|
-
}
|
|
52
|
-
async destroy() {
|
|
53
|
-
__classPrivateFieldGet(this, _SqliteWasmDriver_db, "f")?.close();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
_SqliteWasmDriver_config = new WeakMap(), _SqliteWasmDriver_connectionMutex = new WeakMap(), _SqliteWasmDriver_db = new WeakMap(), _SqliteWasmDriver_connection = new WeakMap();
|
|
57
|
-
//# sourceMappingURL=SqliteWasmDriver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteWasmDriver.js","sourceRoot":"","sources":["../../src/kysely/SqliteWasmDriver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAA8B,MAAM,QAAQ,CAAC;AAGnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,OAAO,gBAAgB;IAO3B,YAAY,MAA+B;QANlC,2CAAiC;QACjC,4CAAmB,IAAI,eAAe,EAAE,EAAC;QAElD,uCAAe;QACf,+CAAiC;QAG/B,uCAAuC;QACvC,uBAAA,IAAI,4BAAW,EAAE,GAAG,MAAM,EAAE,MAAA,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,IAAI;QACR,uBAAA,IAAI,wBACF,OAAO,uBAAA,IAAI,gCAAQ,CAAC,QAAQ,KAAK,UAAU;YACzC,CAAC,CAAC,MAAM,uBAAA,IAAI,gCAAQ,CAAC,QAAQ,EAAE;YAC/B,CAAC,CAAC,uBAAA,IAAI,gCAAQ,CAAC,QAAQ,MAAA,CAAC;QAE5B,uBAAA,IAAI,gCAAe,IAAI,oBAAoB,CAAC,uBAAA,IAAI,4BAAI,CAAC,MAAA,CAAC;QAEtD,IAAI,uBAAA,IAAI,gCAAQ,CAAC,kBAAkB,EAAE,CAAC;YACpC,MAAM,uBAAA,IAAI,gCAAQ,CAAC,kBAAkB,CAAC,uBAAA,IAAI,oCAAY,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,qEAAqE;QACrE,iDAAiD;QACjD,MAAM,uBAAA,IAAI,yCAAiB,CAAC,IAAI,EAAE,CAAC;QACnC,OAAO,uBAAA,IAAI,oCAAa,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,UAA8B;QACnD,MAAM,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,UAA8B;QACpD,MAAM,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,UAA8B;QACtD,MAAM,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,uBAAA,IAAI,yCAAiB,CAAC,MAAM,EAAE,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,OAAO;QACX,uBAAA,IAAI,4BAAI,EAAE,KAAK,EAAE,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/kysely/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sqliteModule.js","sourceRoot":"","sources":["../../src/kysely/sqliteModule.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,IAAI,YAA2B,CAAC;AAEvC,MAAM,UAAU,eAAe,CAAC,MAAqB;IACnD,YAAY,GAAG,MAAM,CAAC;AACxB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Database } from "@eliaspourquoi/sqlite-node-wasm";
|
|
2
|
-
/**
|
|
3
|
-
* Exports the content of a database as a Uint8Array.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* const db = createInMemoryDatabase({ readOnly: false });
|
|
7
|
-
* const content = contentFromDatabase(db);
|
|
8
|
-
*/
|
|
9
|
-
export declare const contentFromDatabase: (db: Database) => Uint8Array;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { sqliteModule } from "../kysely/sqliteModule.js";
|
|
2
|
-
/**
|
|
3
|
-
* Exports the content of a database as a Uint8Array.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* const db = createInMemoryDatabase({ readOnly: false });
|
|
7
|
-
* const content = contentFromDatabase(db);
|
|
8
|
-
*/
|
|
9
|
-
export const contentFromDatabase = (db) => {
|
|
10
|
-
return sqliteModule.capi.sqlite3_js_db_export(db);
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=contentFromDatabase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contentFromDatabase.js","sourceRoot":"","sources":["../../src/util/contentFromDatabase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAY,EAAc,EAAE;IAC9D,OAAO,YAAY,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import sqlite3InitModule from "@eliaspourquoi/sqlite-node-wasm";
|
|
2
|
-
import { setSqliteModule, sqliteModule } from "../kysely/sqliteModule.js";
|
|
3
|
-
import { wasmBinary } from "./sqliteWasmBinary.js";
|
|
4
|
-
export const createInMemoryDatabase = async ({ readOnly = false, }) => {
|
|
5
|
-
if (!sqliteModule) {
|
|
6
|
-
await initSqlite();
|
|
7
|
-
}
|
|
8
|
-
const flags = [
|
|
9
|
-
readOnly ? "r" : "cw", // read and write
|
|
10
|
-
"", // non verbose
|
|
11
|
-
].join("");
|
|
12
|
-
return new sqliteModule.oo1.DB(":memory:", flags);
|
|
13
|
-
};
|
|
14
|
-
async function initSqlite() {
|
|
15
|
-
setSqliteModule(await sqlite3InitModule({
|
|
16
|
-
// @ts-expect-error
|
|
17
|
-
wasmBinary: wasmBinary,
|
|
18
|
-
// https://github.com/opral/inlang-sdk/issues/170#issuecomment-2334768193
|
|
19
|
-
locateFile: () => "sqlite3.wasm",
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=createInMemoryDatabase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createInMemoryDatabase.js","sourceRoot":"","sources":["../../src/util/createInMemoryDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EAAE,EAC3C,QAAQ,GAAG,KAAK,GAGjB,EAAE,EAAE;IACH,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,UAAU,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,KAAK,GAAG;QACZ,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,iBAAiB;QACxC,EAAE,EAAE,cAAc;KACnB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEX,OAAO,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,KAAK,UAAU,UAAU;IACvB,eAAe,CACb,MAAM,iBAAiB,CAAC;QACtB,mBAAmB;QACnB,UAAU,EAAE,UAAU;QACtB,yEAAyE;QACzE,UAAU,EAAE,GAAG,EAAE,CAAC,cAAc;KACjC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { sqliteModule } from "../kysely/sqliteModule.js";
|
|
2
|
-
export const importDatabase = ({ db, content, schema = "main", readOnly = false, }) => {
|
|
3
|
-
const deserializeFlag = readOnly
|
|
4
|
-
? sqliteModule.capi.SQLITE_DESERIALIZE_READONLY
|
|
5
|
-
: sqliteModule.capi.SQLITE_DESERIALIZE_FREEONCLOSE |
|
|
6
|
-
sqliteModule.capi.SQLITE_DESERIALIZE_RESIZEABLE;
|
|
7
|
-
const contentPointer = sqliteModule.wasm.allocFromTypedArray(content);
|
|
8
|
-
const deserializeReturnCode = sqliteModule.capi.sqlite3_deserialize(db.pointer, schema, contentPointer, content.byteLength, // db size
|
|
9
|
-
content.byteLength, // content size
|
|
10
|
-
deserializeFlag);
|
|
11
|
-
// check if the deserialization was successfull
|
|
12
|
-
db.checkRc(deserializeReturnCode);
|
|
13
|
-
return db;
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=importDatabase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"importDatabase.js","sourceRoot":"","sources":["../../src/util/importDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,EAAE,EACF,OAAO,EACP,MAAM,GAAG,MAAM,EACf,QAAQ,GAAG,KAAK,GAMjB,EAAE,EAAE;IACH,MAAM,eAAe,GAAG,QAAQ;QAC9B,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,2BAA2B;QAC/C,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,8BAA8B;YAChD,YAAY,CAAC,IAAI,CAAC,6BAA6B,CAAC;IAEpD,MAAM,cAAc,GAAG,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACtE,MAAM,qBAAqB,GAAG,YAAY,CAAC,IAAI,CAAC,mBAAmB,CACjE,EAAE,CAAC,OAAQ,EACX,MAAM,EACN,cAAc,EACd,OAAO,CAAC,UAAU,EAAE,UAAU;IAC9B,OAAO,CAAC,UAAU,EAAE,eAAe;IACnC,eAAe,CAChB,CAAC;IAEF,+CAA+C;IAC/C,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAElC,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { contentFromDatabase } from "./contentFromDatabase.js";
|
|
2
|
-
export { createInMemoryDatabase } from "./createInMemoryDatabase.js";
|
|
3
|
-
export { importDatabase } from "./importDatabase.js";
|
|
4
|
-
export type { Database as SqliteDatabase } from "@eliaspourquoi/sqlite-node-wasm";
|
|
5
|
-
export { loadDatabaseInMemory } from "./loadDatabaseInMemory.js";
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { contentFromDatabase } from "./contentFromDatabase.js";
|
|
2
|
-
export { createInMemoryDatabase } from "./createInMemoryDatabase.js";
|
|
3
|
-
export { importDatabase } from "./importDatabase.js";
|
|
4
|
-
export { loadDatabaseInMemory } from "./loadDatabaseInMemory.js";
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function loadDatabaseInMemory(data: ArrayBuffer): Promise<import("@eliaspourquoi/sqlite-node-wasm").Database>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createInMemoryDatabase } from "./createInMemoryDatabase.js";
|
|
2
|
-
import { importDatabase } from "./importDatabase.js";
|
|
3
|
-
export async function loadDatabaseInMemory(data) {
|
|
4
|
-
const database = await createInMemoryDatabase({
|
|
5
|
-
readOnly: false,
|
|
6
|
-
});
|
|
7
|
-
importDatabase({
|
|
8
|
-
db: database,
|
|
9
|
-
content: new Uint8Array(data),
|
|
10
|
-
});
|
|
11
|
-
return database;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=loadDatabaseInMemory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadDatabaseInMemory.js","sourceRoot":"","sources":["../../src/util/loadDatabaseInMemory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAiB;IAC1D,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC;QAC5C,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IACH,cAAc,CAAC;QACb,EAAE,EAAE,QAAQ;QACZ,OAAO,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC;KAC9B,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|