@matter/nodejs 0.16.6-alpha.0-20260121-06f1d9611 → 0.16.6-alpha.0-20260122-b5154bcb4
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/cjs/config.d.ts +6 -0
- package/dist/cjs/config.d.ts.map +1 -1
- package/dist/cjs/config.js +14 -1
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/environment/NodeJsEnvironment.d.ts +2 -1
- package/dist/cjs/environment/NodeJsEnvironment.d.ts.map +1 -1
- package/dist/cjs/environment/NodeJsEnvironment.js +28 -10
- package/dist/cjs/environment/NodeJsEnvironment.js.map +1 -1
- package/dist/cjs/storage/StorageFactory.d.ts +52 -0
- package/dist/cjs/storage/StorageFactory.d.ts.map +1 -0
- package/dist/cjs/storage/StorageFactory.js +215 -0
- package/dist/cjs/storage/StorageFactory.js.map +6 -0
- package/dist/cjs/storage/fs/StorageBackendDisk.d.ts.map +1 -0
- package/dist/cjs/storage/{StorageBackendDisk.js.map → fs/StorageBackendDisk.js.map} +1 -1
- package/dist/cjs/storage/fs/StorageBackendJsonFile.d.ts.map +1 -0
- package/dist/cjs/storage/{StorageBackendJsonFile.js.map → fs/StorageBackendJsonFile.js.map} +1 -1
- package/dist/cjs/storage/fs/index.d.ts +8 -0
- package/dist/cjs/storage/fs/index.d.ts.map +1 -0
- package/dist/cjs/storage/fs/index.js +25 -0
- package/dist/cjs/storage/fs/index.js.map +6 -0
- package/dist/cjs/storage/index.d.ts +3 -2
- package/dist/cjs/storage/index.d.ts.map +1 -1
- package/dist/cjs/storage/index.js +3 -2
- package/dist/cjs/storage/index.js.map +1 -1
- package/dist/cjs/storage/sqlite/SqliteStorage.d.ts +105 -0
- package/dist/cjs/storage/sqlite/SqliteStorage.d.ts.map +1 -0
- package/dist/cjs/storage/sqlite/SqliteStorage.js +439 -0
- package/dist/cjs/storage/sqlite/SqliteStorage.js.map +6 -0
- package/dist/cjs/storage/sqlite/SqliteStorageError.d.ts +19 -0
- package/dist/cjs/storage/sqlite/SqliteStorageError.d.ts.map +1 -0
- package/dist/cjs/storage/sqlite/SqliteStorageError.js +38 -0
- package/dist/cjs/storage/sqlite/SqliteStorageError.js.map +6 -0
- package/dist/cjs/storage/sqlite/SqliteTypes.d.ts +67 -0
- package/dist/cjs/storage/sqlite/SqliteTypes.d.ts.map +1 -0
- package/dist/cjs/storage/sqlite/SqliteTypes.js +35 -0
- package/dist/cjs/storage/sqlite/SqliteTypes.js.map +6 -0
- package/dist/cjs/storage/sqlite/SqliteUtil.d.ts +33 -0
- package/dist/cjs/storage/sqlite/SqliteUtil.d.ts.map +1 -0
- package/dist/cjs/storage/sqlite/SqliteUtil.js +64 -0
- package/dist/cjs/storage/sqlite/SqliteUtil.js.map +6 -0
- package/dist/cjs/storage/sqlite/index.d.ts +10 -0
- package/dist/cjs/storage/sqlite/index.d.ts.map +1 -0
- package/dist/cjs/storage/sqlite/index.js +34 -0
- package/dist/cjs/storage/sqlite/index.js.map +6 -0
- package/dist/cjs/storage/sqlite/platform/BunSqlite.d.ts +17 -0
- package/dist/cjs/storage/sqlite/platform/BunSqlite.d.ts.map +1 -0
- package/dist/cjs/storage/sqlite/platform/BunSqlite.js +62 -0
- package/dist/cjs/storage/sqlite/platform/BunSqlite.js.map +6 -0
- package/dist/cjs/storage/sqlite/platform/NodeJsSqlite.d.ts +12 -0
- package/dist/cjs/storage/sqlite/platform/NodeJsSqlite.d.ts.map +1 -0
- package/dist/cjs/storage/sqlite/platform/NodeJsSqlite.js +49 -0
- package/dist/cjs/storage/sqlite/platform/NodeJsSqlite.js.map +6 -0
- package/dist/cjs/storage/sqlite/platform/PlatformSqlite.d.ts +8 -0
- package/dist/cjs/storage/sqlite/platform/PlatformSqlite.d.ts.map +1 -0
- package/dist/cjs/storage/sqlite/platform/PlatformSqlite.js +54 -0
- package/dist/cjs/storage/sqlite/platform/PlatformSqlite.js.map +6 -0
- package/dist/cjs/util/runtimeChecks.d.ts +14 -0
- package/dist/cjs/util/runtimeChecks.d.ts.map +1 -0
- package/dist/cjs/util/runtimeChecks.js +45 -0
- package/dist/cjs/util/runtimeChecks.js.map +6 -0
- package/dist/esm/config.d.ts +6 -0
- package/dist/esm/config.d.ts.map +1 -1
- package/dist/esm/config.js +14 -1
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/environment/NodeJsEnvironment.d.ts +2 -1
- package/dist/esm/environment/NodeJsEnvironment.d.ts.map +1 -1
- package/dist/esm/environment/NodeJsEnvironment.js +29 -10
- package/dist/esm/environment/NodeJsEnvironment.js.map +1 -1
- package/dist/esm/storage/StorageFactory.d.ts +52 -0
- package/dist/esm/storage/StorageFactory.d.ts.map +1 -0
- package/dist/esm/storage/StorageFactory.js +195 -0
- package/dist/esm/storage/StorageFactory.js.map +6 -0
- package/dist/esm/storage/fs/StorageBackendDisk.d.ts.map +1 -0
- package/dist/esm/storage/{StorageBackendDisk.js.map → fs/StorageBackendDisk.js.map} +1 -1
- package/dist/esm/storage/fs/StorageBackendJsonFile.d.ts.map +1 -0
- package/dist/esm/storage/{StorageBackendJsonFile.js.map → fs/StorageBackendJsonFile.js.map} +1 -1
- package/dist/esm/storage/fs/index.d.ts +8 -0
- package/dist/esm/storage/fs/index.d.ts.map +1 -0
- package/dist/esm/storage/fs/index.js +8 -0
- package/dist/esm/storage/fs/index.js.map +6 -0
- package/dist/esm/storage/index.d.ts +3 -2
- package/dist/esm/storage/index.d.ts.map +1 -1
- package/dist/esm/storage/index.js +3 -2
- package/dist/esm/storage/index.js.map +1 -1
- package/dist/esm/storage/sqlite/SqliteStorage.d.ts +105 -0
- package/dist/esm/storage/sqlite/SqliteStorage.d.ts.map +1 -0
- package/dist/esm/storage/sqlite/SqliteStorage.js +423 -0
- package/dist/esm/storage/sqlite/SqliteStorage.js.map +6 -0
- package/dist/esm/storage/sqlite/SqliteStorageError.d.ts +19 -0
- package/dist/esm/storage/sqlite/SqliteStorageError.d.ts.map +1 -0
- package/dist/esm/storage/sqlite/SqliteStorageError.js +18 -0
- package/dist/esm/storage/sqlite/SqliteStorageError.js.map +6 -0
- package/dist/esm/storage/sqlite/SqliteTypes.d.ts +67 -0
- package/dist/esm/storage/sqlite/SqliteTypes.d.ts.map +1 -0
- package/dist/esm/storage/sqlite/SqliteTypes.js +15 -0
- package/dist/esm/storage/sqlite/SqliteTypes.js.map +6 -0
- package/dist/esm/storage/sqlite/SqliteUtil.d.ts +33 -0
- package/dist/esm/storage/sqlite/SqliteUtil.d.ts.map +1 -0
- package/dist/esm/storage/sqlite/SqliteUtil.js +44 -0
- package/dist/esm/storage/sqlite/SqliteUtil.js.map +6 -0
- package/dist/esm/storage/sqlite/index.d.ts +10 -0
- package/dist/esm/storage/sqlite/index.d.ts.map +1 -0
- package/dist/esm/storage/sqlite/index.js +14 -0
- package/dist/esm/storage/sqlite/index.js.map +6 -0
- package/dist/esm/storage/sqlite/platform/BunSqlite.d.ts +17 -0
- package/dist/esm/storage/sqlite/platform/BunSqlite.d.ts.map +1 -0
- package/dist/esm/storage/sqlite/platform/BunSqlite.js +32 -0
- package/dist/esm/storage/sqlite/platform/BunSqlite.js.map +6 -0
- package/dist/esm/storage/sqlite/platform/NodeJsSqlite.d.ts +12 -0
- package/dist/esm/storage/sqlite/platform/NodeJsSqlite.d.ts.map +1 -0
- package/dist/esm/storage/sqlite/platform/NodeJsSqlite.js +29 -0
- package/dist/esm/storage/sqlite/platform/NodeJsSqlite.js.map +6 -0
- package/dist/esm/storage/sqlite/platform/PlatformSqlite.d.ts +8 -0
- package/dist/esm/storage/sqlite/platform/PlatformSqlite.d.ts.map +1 -0
- package/dist/esm/storage/sqlite/platform/PlatformSqlite.js +24 -0
- package/dist/esm/storage/sqlite/platform/PlatformSqlite.js.map +6 -0
- package/dist/esm/util/runtimeChecks.d.ts +14 -0
- package/dist/esm/util/runtimeChecks.d.ts.map +1 -0
- package/dist/esm/util/runtimeChecks.js +25 -0
- package/dist/esm/util/runtimeChecks.js.map +6 -0
- package/package.json +10 -10
- package/src/config.ts +18 -4
- package/src/environment/NodeJsEnvironment.ts +41 -12
- package/src/net/NodeJsHttpEndpoint.ts +1 -1
- package/src/storage/StorageFactory.ts +310 -0
- package/src/storage/fs/index.ts +8 -0
- package/src/storage/index.ts +3 -2
- package/src/storage/sqlite/SqliteStorage.ts +572 -0
- package/src/storage/sqlite/SqliteStorageError.ts +23 -0
- package/src/storage/sqlite/SqliteTypes.ts +75 -0
- package/src/storage/sqlite/SqliteUtil.ts +61 -0
- package/src/storage/sqlite/index.ts +10 -0
- package/src/storage/sqlite/platform/BunSqlite.ts +40 -0
- package/src/storage/sqlite/platform/NodeJsSqlite.ts +35 -0
- package/src/storage/sqlite/platform/PlatformSqlite.ts +52 -0
- package/src/util/runtimeChecks.ts +31 -0
- package/dist/cjs/storage/StorageBackendDisk.d.ts.map +0 -1
- package/dist/cjs/storage/StorageBackendJsonFile.d.ts.map +0 -1
- package/dist/esm/storage/StorageBackendDisk.d.ts.map +0 -1
- package/dist/esm/storage/StorageBackendJsonFile.d.ts.map +0 -1
- /package/dist/cjs/storage/{StorageBackendDisk.d.ts → fs/StorageBackendDisk.d.ts} +0 -0
- /package/dist/cjs/storage/{StorageBackendDisk.js → fs/StorageBackendDisk.js} +0 -0
- /package/dist/cjs/storage/{StorageBackendJsonFile.d.ts → fs/StorageBackendJsonFile.d.ts} +0 -0
- /package/dist/cjs/storage/{StorageBackendJsonFile.js → fs/StorageBackendJsonFile.js} +0 -0
- /package/dist/esm/storage/{StorageBackendDisk.d.ts → fs/StorageBackendDisk.d.ts} +0 -0
- /package/dist/esm/storage/{StorageBackendDisk.js → fs/StorageBackendDisk.js} +0 -0
- /package/dist/esm/storage/{StorageBackendJsonFile.d.ts → fs/StorageBackendJsonFile.d.ts} +0 -0
- /package/dist/esm/storage/{StorageBackendJsonFile.js → fs/StorageBackendJsonFile.js} +0 -0
- /package/src/storage/{StorageBackendDisk.ts → fs/StorageBackendDisk.ts} +0 -0
- /package/src/storage/{StorageBackendJsonFile.ts → fs/StorageBackendJsonFile.ts} +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Stores various utility types used by sqlite disk.
|
|
8
|
+
*/
|
|
9
|
+
export type SafeUint8Array = Uint8Array<ArrayBuffer>;
|
|
10
|
+
export type SqliteDataType = null | number | bigint | string | SafeUint8Array;
|
|
11
|
+
export type SqliteResultType = Record<string, SqliteDataType>;
|
|
12
|
+
/**
|
|
13
|
+
* DatabaseLike
|
|
14
|
+
*
|
|
15
|
+
* compatible with `node:sqlite`(type mismatch), `bun:sqlite`
|
|
16
|
+
*/
|
|
17
|
+
export interface DatabaseLike {
|
|
18
|
+
prepare<O extends SqliteResultType | void>(query: string): SqlRunnableSimple<O> & SqlRunnableParam<any, O>;
|
|
19
|
+
exec(sql: string): void;
|
|
20
|
+
close(): void;
|
|
21
|
+
}
|
|
22
|
+
export type DatabaseCreator = (path: string) => DatabaseLike;
|
|
23
|
+
/**
|
|
24
|
+
* Defines `I` -> `O` Runnable
|
|
25
|
+
*
|
|
26
|
+
* `I` type is treated as Input.
|
|
27
|
+
*
|
|
28
|
+
* `O` type is treated as Output.
|
|
29
|
+
*
|
|
30
|
+
* `void` type is used for no input/output.
|
|
31
|
+
*/
|
|
32
|
+
export type SqlRunnable<I extends SqliteResultType | void, O extends SqliteResultType | void> = I extends SqliteResultType ? SqlRunnableParam<I, O> : SqlRunnableSimple<O>;
|
|
33
|
+
/**
|
|
34
|
+
* Database method with no parameter.
|
|
35
|
+
*
|
|
36
|
+
* (`I` must be void)
|
|
37
|
+
*/
|
|
38
|
+
interface SqlRunnableSimple<O extends SqliteResultType | void> {
|
|
39
|
+
run(): {
|
|
40
|
+
changes: number | bigint;
|
|
41
|
+
};
|
|
42
|
+
get(): O | null | undefined;
|
|
43
|
+
all(): Array<O | undefined>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Database method with parameter.
|
|
47
|
+
*/
|
|
48
|
+
interface SqlRunnableParam<I extends SqliteResultType, O extends SqliteResultType | void> {
|
|
49
|
+
run(arg: I): {
|
|
50
|
+
changes: number | bigint;
|
|
51
|
+
};
|
|
52
|
+
get(arg: I): O | null | undefined;
|
|
53
|
+
all(arg: I): Array<O | undefined>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* SQLite Transaction mode
|
|
57
|
+
*
|
|
58
|
+
* TODO: Move transaction control to higher level (matter.js Transaction API)
|
|
59
|
+
* and remove this
|
|
60
|
+
*/
|
|
61
|
+
export declare enum SqliteTransaction {
|
|
62
|
+
BEGIN = 0,
|
|
63
|
+
COMMIT = 1,
|
|
64
|
+
ROLLBACK = 2
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=SqliteTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqliteTypes.d.ts","sourceRoot":"","sources":["../../../../src/storage/sqlite/SqliteTypes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AAGH,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,cAAc,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,YAAY;IACzB,OAAO,CAAC,CAAC,SAAS,gBAAgB,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC3G,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,CAAC;AAE7D;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CACnB,CAAC,SAAS,gBAAgB,GAAG,IAAI,EACjC,CAAC,SAAS,gBAAgB,GAAG,IAAI,IACjC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;GAIG;AACH,UAAU,iBAAiB,CAAC,CAAC,SAAS,gBAAgB,GAAG,IAAI;IACzD,GAAG,IAAI;QAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACpC,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IAC5B,GAAG,IAAI,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,UAAU,gBAAgB,CAAC,CAAC,SAAS,gBAAgB,EAAE,CAAC,SAAS,gBAAgB,GAAG,IAAI;IACpF,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG;QAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC1C,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;CACrC;AAED;;;;;GAKG;AACH,oBAAY,iBAAiB;IACzB,KAAK,IAAA;IACL,MAAM,IAAA;IACN,QAAQ,IAAA;CACX"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var SqliteTypes_exports = {};
|
|
20
|
+
__export(SqliteTypes_exports, {
|
|
21
|
+
SqliteTransaction: () => SqliteTransaction
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(SqliteTypes_exports);
|
|
24
|
+
/**
|
|
25
|
+
* @license
|
|
26
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
27
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
28
|
+
*/
|
|
29
|
+
var SqliteTransaction = /* @__PURE__ */ ((SqliteTransaction2) => {
|
|
30
|
+
SqliteTransaction2[SqliteTransaction2["BEGIN"] = 0] = "BEGIN";
|
|
31
|
+
SqliteTransaction2[SqliteTransaction2["COMMIT"] = 1] = "COMMIT";
|
|
32
|
+
SqliteTransaction2[SqliteTransaction2["ROLLBACK"] = 2] = "ROLLBACK";
|
|
33
|
+
return SqliteTransaction2;
|
|
34
|
+
})(SqliteTransaction || {});
|
|
35
|
+
//# sourceMappingURL=SqliteTypes.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/storage/sqlite/SqliteTypes.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsEO,IAAK,oBAAL,kBAAKA,uBAAL;AACH,EAAAA,sCAAA;AACA,EAAAA,sCAAA;AACA,EAAAA,sCAAA;AAHQ,SAAAA;AAAA,GAAA;",
|
|
5
|
+
"names": ["SqliteTransaction"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Build string context path from contexts[]
|
|
8
|
+
* @param contexts Contexts
|
|
9
|
+
* @returns `.` joined context path
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildContextPath(contexts: string[]): string;
|
|
12
|
+
/**
|
|
13
|
+
* Build Context & Key pair
|
|
14
|
+
* @param contexts Contexts
|
|
15
|
+
* @param key Key
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildContextKeyPair(contexts: string[], key: string): {
|
|
18
|
+
context: string;
|
|
19
|
+
key: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Build Context & Key *log* path
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildContextKeyLog(contexts: string[], key: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Build key (just verification)
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildKey(key: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Escape string for Glob
|
|
31
|
+
*/
|
|
32
|
+
export declare function escapeGlob(value: string): string;
|
|
33
|
+
//# sourceMappingURL=SqliteUtil.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqliteUtil.d.ts","sourceRoot":"","sources":["../../../../src/storage/sqlite/SqliteUtil.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAWlD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM;;;EAKlE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,UAEjE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,UAKnC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,UAEvC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var SqliteUtil_exports = {};
|
|
20
|
+
__export(SqliteUtil_exports, {
|
|
21
|
+
buildContextKeyLog: () => buildContextKeyLog,
|
|
22
|
+
buildContextKeyPair: () => buildContextKeyPair,
|
|
23
|
+
buildContextPath: () => buildContextPath,
|
|
24
|
+
buildKey: () => buildKey,
|
|
25
|
+
escapeGlob: () => escapeGlob
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(SqliteUtil_exports);
|
|
28
|
+
var import_SqliteStorageError = require("./SqliteStorageError.js");
|
|
29
|
+
/**
|
|
30
|
+
* @license
|
|
31
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
32
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
33
|
+
*/
|
|
34
|
+
function buildContextPath(contexts) {
|
|
35
|
+
for (const ctx of contexts) {
|
|
36
|
+
if (ctx.trim().length <= 0 || ctx.includes(".")) {
|
|
37
|
+
throw new import_SqliteStorageError.SqliteStorageError(
|
|
38
|
+
"build",
|
|
39
|
+
`{${contexts.join(",")}}`,
|
|
40
|
+
"Context must not be an empty and not contain dots."
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return contexts.join(".");
|
|
45
|
+
}
|
|
46
|
+
function buildContextKeyPair(contexts, key) {
|
|
47
|
+
return {
|
|
48
|
+
context: buildContextPath(contexts),
|
|
49
|
+
key: buildKey(key)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function buildContextKeyLog(contexts, key) {
|
|
53
|
+
return `${buildContextPath(contexts)}$${key}`;
|
|
54
|
+
}
|
|
55
|
+
function buildKey(key) {
|
|
56
|
+
if (key.trim().length <= 0) {
|
|
57
|
+
throw new import_SqliteStorageError.SqliteStorageError("build", key, "Key must not be an empty string.");
|
|
58
|
+
}
|
|
59
|
+
return key;
|
|
60
|
+
}
|
|
61
|
+
function escapeGlob(value) {
|
|
62
|
+
return value.replace(/[*[?]/g, "[$&]");
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=SqliteUtil.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/storage/sqlite/SqliteUtil.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,gCAAmC;AANnC;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,iBAAiB,UAAoB;AACjD,aAAW,OAAO,UAAU;AACxB,QAAI,IAAI,KAAK,EAAE,UAAU,KAAK,IAAI,SAAS,GAAG,GAAG;AAC7C,YAAM,IAAI;AAAA,QACN;AAAA,QACA,IAAI,SAAS,KAAK,GAAG,CAAC;AAAA,QACtB;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACA,SAAO,SAAS,KAAK,GAAG;AAC5B;AAOO,SAAS,oBAAoB,UAAoB,KAAa;AACjE,SAAO;AAAA,IACH,SAAS,iBAAiB,QAAQ;AAAA,IAClC,KAAK,SAAS,GAAG;AAAA,EACrB;AACJ;AAKO,SAAS,mBAAmB,UAAoB,KAAa;AAChE,SAAO,GAAG,iBAAiB,QAAQ,CAAC,IAAI,GAAG;AAC/C;AAKO,SAAS,SAAS,KAAa;AAClC,MAAI,IAAI,KAAK,EAAE,UAAU,GAAG;AACxB,UAAM,IAAI,6CAAmB,SAAS,KAAK,kCAAkC;AAAA,EACjF;AACA,SAAO;AACX;AAKO,SAAS,WAAW,OAAe;AACtC,SAAO,MAAM,QAAQ,UAAU,MAAM;AACzC;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export { PlatformSqlite } from "./platform/PlatformSqlite.js";
|
|
7
|
+
export { SqliteStorage } from "./SqliteStorage.js";
|
|
8
|
+
export { SqliteStorageError } from "./SqliteStorageError.js";
|
|
9
|
+
export type { DatabaseCreator, DatabaseLike } from "./SqliteTypes.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/sqlite/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var sqlite_exports = {};
|
|
20
|
+
__export(sqlite_exports, {
|
|
21
|
+
PlatformSqlite: () => import_PlatformSqlite.PlatformSqlite,
|
|
22
|
+
SqliteStorage: () => import_SqliteStorage.SqliteStorage,
|
|
23
|
+
SqliteStorageError: () => import_SqliteStorageError.SqliteStorageError
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(sqlite_exports);
|
|
26
|
+
var import_PlatformSqlite = require("./platform/PlatformSqlite.js");
|
|
27
|
+
var import_SqliteStorage = require("./SqliteStorage.js");
|
|
28
|
+
var import_SqliteStorageError = require("./SqliteStorageError.js");
|
|
29
|
+
/**
|
|
30
|
+
* @license
|
|
31
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
32
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
33
|
+
*/
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { SqliteStorage } from "../SqliteStorage.js";
|
|
7
|
+
/**
|
|
8
|
+
* `StorageSqliteDisk` for Bun
|
|
9
|
+
*
|
|
10
|
+
* DO NOT IMPORT DIRECTLY
|
|
11
|
+
* (should import `PlatformSqlite.js`)
|
|
12
|
+
*/
|
|
13
|
+
export declare class BunSqlite extends SqliteStorage {
|
|
14
|
+
constructor(path: string | null, clear?: boolean);
|
|
15
|
+
clear(completely?: boolean): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=BunSqlite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BunSqlite.d.ts","sourceRoot":"","sources":["../../../../../src/storage/sqlite/platform/BunSqlite.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,aAAa;gBAC5B,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,UAAQ;IAY/B,KAAK,CAAC,UAAU,CAAC,EAAE,OAAO;CAQ5C"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var BunSqlite_exports = {};
|
|
30
|
+
__export(BunSqlite_exports, {
|
|
31
|
+
BunSqlite: () => BunSqlite
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(BunSqlite_exports);
|
|
34
|
+
var import_SqliteStorage = require("../SqliteStorage.js");
|
|
35
|
+
var import_bun_sqlite = require("bun:sqlite");
|
|
36
|
+
var import_bun = __toESM(require("bun"), 1);
|
|
37
|
+
/**
|
|
38
|
+
* @license
|
|
39
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
40
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
41
|
+
*/
|
|
42
|
+
class BunSqlite extends import_SqliteStorage.SqliteStorage {
|
|
43
|
+
constructor(path, clear = false) {
|
|
44
|
+
super({
|
|
45
|
+
databaseCreator: (path2) => new import_bun_sqlite.Database(path2, {
|
|
46
|
+
strict: true,
|
|
47
|
+
create: true
|
|
48
|
+
}),
|
|
49
|
+
path,
|
|
50
|
+
clear
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async clear(completely) {
|
|
54
|
+
await super.clear();
|
|
55
|
+
if (completely ?? false) {
|
|
56
|
+
this.close();
|
|
57
|
+
await import_bun.default.file(this.dbPath).delete();
|
|
58
|
+
this.isInitialized = false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=BunSqlite.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/storage/sqlite/platform/BunSqlite.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,2BAA8B;AAE9B,wBAAyB;AAEzB,iBAAgB;AAVhB;AAAA;AAAA;AAAA;AAAA;AAkBO,MAAM,kBAAkB,mCAAc;AAAA,EACzC,YAAY,MAAqB,QAAQ,OAAO;AAC5C,UAAM;AAAA,MACF,iBAAiB,CAAAA,UACb,IAAI,2BAASA,OAAM;AAAA,QACf,QAAQ;AAAA,QACR,QAAQ;AAAA,MACZ,CAAC;AAAA,MACL;AAAA,MACA;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,MAAe,MAAM,YAAsB;AACvC,UAAM,MAAM,MAAM;AAClB,QAAI,cAAc,OAAO;AACrB,WAAK,MAAM;AACX,YAAM,WAAAC,QAAI,KAAK,KAAK,MAAM,EAAE,OAAO;AACnC,WAAK,gBAAgB;AAAA,IACzB;AAAA,EACJ;AACJ;",
|
|
5
|
+
"names": ["path", "Bun"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SqliteStorage } from "../SqliteStorage.js";
|
|
2
|
+
/**
|
|
3
|
+
* `StorageSqliteDisk` for Node.js
|
|
4
|
+
*
|
|
5
|
+
* DO NOT IMPORT DIRECTLY
|
|
6
|
+
* (should import `PlatformSqlite.js`)
|
|
7
|
+
*/
|
|
8
|
+
export declare class NodeJsSqlite extends SqliteStorage {
|
|
9
|
+
constructor(path: string | null, clear?: boolean);
|
|
10
|
+
clear(completely?: boolean): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=NodeJsSqlite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeJsSqlite.d.ts","sourceRoot":"","sources":["../../../../../src/storage/sqlite/platform/NodeJsSqlite.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,aAAa;gBAC/B,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,UAAQ;IAQ/B,KAAK,CAAC,UAAU,CAAC,EAAE,OAAO;CAQ5C"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var NodeJsSqlite_exports = {};
|
|
20
|
+
__export(NodeJsSqlite_exports, {
|
|
21
|
+
NodeJsSqlite: () => NodeJsSqlite
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(NodeJsSqlite_exports);
|
|
24
|
+
var import_promises = require("node:fs/promises");
|
|
25
|
+
var import_node_sqlite = require("node:sqlite");
|
|
26
|
+
var import_SqliteStorage = require("../SqliteStorage.js");
|
|
27
|
+
/**
|
|
28
|
+
* @license
|
|
29
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
30
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
31
|
+
*/
|
|
32
|
+
class NodeJsSqlite extends import_SqliteStorage.SqliteStorage {
|
|
33
|
+
constructor(path, clear = false) {
|
|
34
|
+
super({
|
|
35
|
+
databaseCreator: (path2) => new import_node_sqlite.DatabaseSync(path2),
|
|
36
|
+
path,
|
|
37
|
+
clear
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async clear(completely) {
|
|
41
|
+
await super.clear();
|
|
42
|
+
if (completely ?? false) {
|
|
43
|
+
this.close();
|
|
44
|
+
await (0, import_promises.rm)(this.dbPath, { force: true });
|
|
45
|
+
this.isInitialized = false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=NodeJsSqlite.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/storage/sqlite/platform/NodeJsSqlite.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,sBAAmB;AACnB,yBAA6B;AAE7B,2BAA8B;AAR9B;AAAA;AAAA;AAAA;AAAA;AAiBO,MAAM,qBAAqB,mCAAc;AAAA,EAC5C,YAAY,MAAqB,QAAQ,OAAO;AAC5C,UAAM;AAAA,MACF,iBAAiB,CAAAA,UAAQ,IAAI,gCAAaA,KAAI;AAAA,MAC9C;AAAA,MACA;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,MAAe,MAAM,YAAsB;AACvC,UAAM,MAAM,MAAM;AAClB,QAAI,cAAc,OAAO;AACrB,WAAK,MAAM;AACX,gBAAM,oBAAG,KAAK,QAAQ,EAAE,OAAO,KAAK,CAAC;AACrC,WAAK,gBAAgB;AAAA,IACzB;AAAA,EACJ;AACJ;",
|
|
5
|
+
"names": ["path"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SqliteStorage } from "../SqliteStorage.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create platform-specific SQLite storage
|
|
4
|
+
*
|
|
5
|
+
* Automatically detects runtime (Bun or Node.js) and returns appropriate implementation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function PlatformSqlite(path: string | null, clear?: boolean): Promise<SqliteStorage>;
|
|
8
|
+
//# sourceMappingURL=PlatformSqlite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformSqlite.d.ts","sourceRoot":"","sources":["../../../../../src/storage/sqlite/platform/PlatformSqlite.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAc/F"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var PlatformSqlite_exports = {};
|
|
30
|
+
__export(PlatformSqlite_exports, {
|
|
31
|
+
PlatformSqlite: () => PlatformSqlite
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(PlatformSqlite_exports);
|
|
34
|
+
var import_runtimeChecks = require("#util/runtimeChecks.js");
|
|
35
|
+
/**
|
|
36
|
+
* @license
|
|
37
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
38
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
39
|
+
*/
|
|
40
|
+
async function PlatformSqlite(path, clear = false) {
|
|
41
|
+
const isBun = (0, import_runtimeChecks.isBunjs)();
|
|
42
|
+
if (!isBun) {
|
|
43
|
+
const module3 = await import("./NodeJsSqlite.js");
|
|
44
|
+
const NodeJsSqlite = findDefaultExport(module3, "NodeJsSqlite");
|
|
45
|
+
return new NodeJsSqlite(path, clear);
|
|
46
|
+
}
|
|
47
|
+
const module2 = await import("./BunSqlite.js");
|
|
48
|
+
const BunSqlite = findDefaultExport(module2, "BunSqlite");
|
|
49
|
+
return new BunSqlite(path, clear);
|
|
50
|
+
}
|
|
51
|
+
function findDefaultExport(moduleLike, name) {
|
|
52
|
+
return moduleLike[name] || moduleLike.default?.[name] || moduleLike.default;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=PlatformSqlite.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/storage/sqlite/platform/PlatformSqlite.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,2BAAwB;AALxB;AAAA;AAAA;AAAA;AAAA;AAaA,eAAsB,eAAe,MAAqB,QAAQ,OAA+B;AAC7F,QAAM,YAAQ,8BAAQ;AAGtB,MAAI,CAAC,OAAO;AACR,UAAMA,UAAS,MAAM,OAAO,mBAAmB;AAC/C,UAAM,eAAe,kBAAkBA,SAAQ,cAAc;AAC7D,WAAO,IAAI,aAAa,MAAM,KAAK;AAAA,EACvC;AAGA,QAAMA,UAAS,MAAM,OAAO,gBAAgB;AAC5C,QAAM,YAAY,kBAAkBA,SAAQ,WAAW;AACvD,SAAO,IAAI,UAAU,MAAM,KAAK;AACpC;AAsBA,SAAS,kBAAwC,YAAe,MAAe;AAC3E,SAAO,WAAW,IAAI,KAAM,WAAmB,UAAU,IAAI,KAAM,WAAmB;AAC1F;",
|
|
5
|
+
"names": ["module"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Check runtime is bun.js
|
|
8
|
+
*/
|
|
9
|
+
export declare function isBunjs(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Check Node.js's runtime supports sqlite.
|
|
12
|
+
*/
|
|
13
|
+
export declare function supportsSqlite(): boolean;
|
|
14
|
+
//# sourceMappingURL=runtimeChecks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeChecks.d.ts","sourceRoot":"","sources":["../../../src/util/runtimeChecks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH;;GAEG;AACH,wBAAgB,OAAO,YAEtB;AAED;;GAEG;AACH,wBAAgB,cAAc,YAa7B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var runtimeChecks_exports = {};
|
|
20
|
+
__export(runtimeChecks_exports, {
|
|
21
|
+
isBunjs: () => isBunjs,
|
|
22
|
+
supportsSqlite: () => supportsSqlite
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(runtimeChecks_exports);
|
|
25
|
+
/**
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
28
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
29
|
+
*/
|
|
30
|
+
function isBunjs() {
|
|
31
|
+
return process.versions.bun != null;
|
|
32
|
+
}
|
|
33
|
+
function supportsSqlite() {
|
|
34
|
+
const nodeVersion = process.versions.node;
|
|
35
|
+
if (!nodeVersion.includes(".")) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
const prefixPart = nodeVersion.substring(0, nodeVersion.indexOf("."));
|
|
39
|
+
const majorNum = Number(prefixPart);
|
|
40
|
+
if (Number.isNaN(majorNum)) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return majorNum >= 22;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=runtimeChecks.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/util/runtimeChecks.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,SAAS,UAAU;AACtB,SAAO,QAAQ,SAAS,OAAO;AACnC;AAKO,SAAS,iBAAiB;AAC7B,QAAM,cAAc,QAAQ,SAAS;AACrC,MAAI,CAAC,YAAY,SAAS,GAAG,GAAG;AAC5B,WAAO;AAAA,EACX;AACA,QAAM,aAAa,YAAY,UAAU,GAAG,YAAY,QAAQ,GAAG,CAAC;AAEpE,QAAM,WAAW,OAAO,UAAU;AAClC,MAAI,OAAO,MAAM,QAAQ,GAAG;AACxB,WAAO;AAAA,EACX;AAEA,SAAO,YAAY;AACvB;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/esm/config.d.ts
CHANGED
|
@@ -68,6 +68,12 @@ export declare const config: {
|
|
|
68
68
|
* If you disable this you must initialize environmental storage manually for components that rely on it.
|
|
69
69
|
*/
|
|
70
70
|
initializeStorage: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Set storage driver to use (default: 'file').
|
|
73
|
+
*
|
|
74
|
+
* Currently, 'file' and 'sqlite' (Node.js v22+) is supported.
|
|
75
|
+
*/
|
|
76
|
+
storageDriver: "file" | "sqlite";
|
|
71
77
|
/**
|
|
72
78
|
* Enables handling of SIGINT, SIGTERM, SIGUSR2 and SIGABRT (depending on platform; default: true).
|
|
73
79
|
*/
|
package/dist/esm/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,qBAAa,6BAA8B,SAAQ,KAAK;CAAG;AAE3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,MAAM;mBACU,OAAO;IAMhC;;OAEG;4BAK+B,MAAM;IAKxC;;OAEG;wBAK2B,MAAM,GAAG,SAAS;IAKhD;;;OAGG;2BAK8B,MAAM;IAKvC;;OAEG;qBAKwB,OAAO;IAKlC;;OAEG;oBAKuB,OAAO;IAKjC;;OAEG;oBAKuB,OAAO;IAKjC;;OAEG;mBAKsB,OAAO;IAKhC;;OAEG;oBAKuB,OAAO;IAKjC;;;;OAIG;uBAK0B,OAAO;IAKpC;;OAEG;wBAK2B,OAAO;IAKrC;;;;;OAKG;yBAK4B,OAAO;IAKtC;;;OAGG;+BAKkC,OAAO;CAI/C,CAAC"}
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,qBAAa,6BAA8B,SAAQ,KAAK;CAAG;AAE3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,MAAM;mBACU,OAAO;IAMhC;;OAEG;4BAK+B,MAAM;IAKxC;;OAEG;wBAK2B,MAAM,GAAG,SAAS;IAKhD;;;OAGG;2BAK8B,MAAM;IAKvC;;OAEG;qBAKwB,OAAO;IAKlC;;OAEG;oBAKuB,OAAO;IAKjC;;OAEG;oBAKuB,OAAO;IAKjC;;OAEG;mBAKsB,OAAO;IAKhC;;OAEG;oBAKuB,OAAO;IAKjC;;;;OAIG;uBAK0B,OAAO;IAKpC;;;;OAIG;mBAKsB,MAAM,GAAG,QAAQ;IAK1C;;OAEG;wBAK2B,OAAO;IAKrC;;;;;OAKG;yBAK4B,OAAO;IAKtC;;;OAGG;+BAKkC,OAAO;CAI/C,CAAC"}
|
package/dist/esm/config.js
CHANGED
|
@@ -15,7 +15,8 @@ let trapProcessSignals = true;
|
|
|
15
15
|
let trapUnhandledErrors = true;
|
|
16
16
|
let setProcessExitCodeOnError = true;
|
|
17
17
|
let installNetwork = true;
|
|
18
|
-
let installCrypto =
|
|
18
|
+
let installCrypto = true;
|
|
19
|
+
let storageDriver = "file";
|
|
19
20
|
class NodeJsAlreadyInitializedError extends Error {
|
|
20
21
|
}
|
|
21
22
|
const config = {
|
|
@@ -117,6 +118,18 @@ const config = {
|
|
|
117
118
|
assertUninitialized("initializeStorage");
|
|
118
119
|
initializeStorage = value;
|
|
119
120
|
},
|
|
121
|
+
/**
|
|
122
|
+
* Set storage driver to use (default: 'file').
|
|
123
|
+
*
|
|
124
|
+
* Currently, 'file' and 'sqlite' (Node.js v22+) is supported.
|
|
125
|
+
*/
|
|
126
|
+
get storageDriver() {
|
|
127
|
+
return storageDriver;
|
|
128
|
+
},
|
|
129
|
+
set storageDriver(value) {
|
|
130
|
+
assertUninitialized("initializeStorage");
|
|
131
|
+
storageDriver = value;
|
|
132
|
+
},
|
|
120
133
|
/**
|
|
121
134
|
* Enables handling of SIGINT, SIGTERM, SIGUSR2 and SIGABRT (depending on platform; default: true).
|
|
122
135
|
*/
|