@rawdash/adapter-sqlite 0.28.2 → 0.29.1
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/index.d.ts +3 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServerStorage, GetStorageHandleOptions, StorageHandle, ConnectorHealth, SyncState } from '@rawdash/core';
|
|
1
|
+
import { ServerStorage, GetStorageHandleOptions, StorageHandle, ConnectorHealth, SyncState, SyncSchedulingState, MarkConnectorSyncSucceededOptions } from '@rawdash/core';
|
|
2
2
|
|
|
3
3
|
interface SqliteStorageOptions {
|
|
4
4
|
ensureDir?: boolean;
|
|
@@ -14,6 +14,8 @@ declare class SqliteStorage implements ServerStorage {
|
|
|
14
14
|
markSyncRunning(): Promise<boolean>;
|
|
15
15
|
markSyncSucceeded(): Promise<void>;
|
|
16
16
|
markSyncFailed(error: string): Promise<void>;
|
|
17
|
+
getConnectorSyncState(connectorId: string): Promise<SyncSchedulingState>;
|
|
18
|
+
markConnectorSyncSucceeded(connectorId: string, options?: MarkConnectorSyncSucceededOptions): Promise<void>;
|
|
17
19
|
close(): Promise<void>;
|
|
18
20
|
}
|
|
19
21
|
|
package/dist/index.js
CHANGED
|
@@ -49,6 +49,12 @@ var SqliteStorage = class {
|
|
|
49
49
|
markSyncFailed(error) {
|
|
50
50
|
return this.inner.markSyncFailed(error);
|
|
51
51
|
}
|
|
52
|
+
getConnectorSyncState(connectorId) {
|
|
53
|
+
return this.inner.getConnectorSyncState(connectorId);
|
|
54
|
+
}
|
|
55
|
+
markConnectorSyncSucceeded(connectorId, options) {
|
|
56
|
+
return this.inner.markConnectorSyncSucceeded(connectorId, options);
|
|
57
|
+
}
|
|
52
58
|
close() {
|
|
53
59
|
return this.inner.close();
|
|
54
60
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sqlite-storage.ts"],"sourcesContent":["import { type Client, createClient } from '@libsql/client';\nimport { LibsqlStorage } from '@rawdash/adapter-libsql';\nimport type {\n ConnectorHealth,\n GetStorageHandleOptions,\n ServerStorage,\n StorageHandle,\n SyncState,\n} from '@rawdash/core';\nimport { mkdirSync } from 'node:fs';\nimport { dirname, isAbsolute, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nexport interface SqliteStorageOptions {\n ensureDir?: boolean;\n}\n\nfunction toFileUrl(path: string): string {\n if (path === ':memory:') {\n return ':memory:';\n }\n const absolute = isAbsolute(path) ? path : resolve(process.cwd(), path);\n return pathToFileURL(absolute).toString();\n}\n\nfunction makeClient(path: string, ensureDir: boolean): Client {\n if (ensureDir && path !== ':memory:') {\n const absolute = isAbsolute(path) ? path : resolve(process.cwd(), path);\n mkdirSync(dirname(absolute), { recursive: true });\n }\n return createClient({ url: toFileUrl(path) });\n}\n\nexport class SqliteStorage implements ServerStorage {\n private inner: LibsqlStorage;\n\n constructor(path: string, options: SqliteStorageOptions = {}) {\n const ensureDir = options.ensureDir ?? true;\n const client = makeClient(path, ensureDir);\n this.inner = new LibsqlStorage({ client });\n }\n\n waitUntilReady(): Promise<void> {\n return this.inner.waitUntilReady();\n }\n\n getStorageHandle(\n connectorId: string,\n options?: GetStorageHandleOptions,\n ): StorageHandle {\n return this.inner.getStorageHandle(connectorId, options);\n }\n\n getHealth(connectorId: string): Promise<ConnectorHealth | null> {\n return this.inner.getHealth(connectorId);\n }\n\n getSyncState(): Promise<SyncState> {\n return this.inner.getSyncState();\n }\n\n markSyncQueued(): Promise<boolean> {\n return this.inner.markSyncQueued();\n }\n\n markSyncRunning(): Promise<boolean> {\n return this.inner.markSyncRunning();\n }\n\n markSyncSucceeded(): Promise<void> {\n return this.inner.markSyncSucceeded();\n }\n\n markSyncFailed(error: string): Promise<void> {\n return this.inner.markSyncFailed(error);\n }\n\n close(): Promise<void> {\n return this.inner.close();\n }\n}\n"],"mappings":";AAAA,SAAsB,oBAAoB;AAC1C,SAAS,qBAAqB;
|
|
1
|
+
{"version":3,"sources":["../src/sqlite-storage.ts"],"sourcesContent":["import { type Client, createClient } from '@libsql/client';\nimport { LibsqlStorage } from '@rawdash/adapter-libsql';\nimport type {\n ConnectorHealth,\n GetStorageHandleOptions,\n MarkConnectorSyncSucceededOptions,\n ServerStorage,\n StorageHandle,\n SyncSchedulingState,\n SyncState,\n} from '@rawdash/core';\nimport { mkdirSync } from 'node:fs';\nimport { dirname, isAbsolute, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nexport interface SqliteStorageOptions {\n ensureDir?: boolean;\n}\n\nfunction toFileUrl(path: string): string {\n if (path === ':memory:') {\n return ':memory:';\n }\n const absolute = isAbsolute(path) ? path : resolve(process.cwd(), path);\n return pathToFileURL(absolute).toString();\n}\n\nfunction makeClient(path: string, ensureDir: boolean): Client {\n if (ensureDir && path !== ':memory:') {\n const absolute = isAbsolute(path) ? path : resolve(process.cwd(), path);\n mkdirSync(dirname(absolute), { recursive: true });\n }\n return createClient({ url: toFileUrl(path) });\n}\n\nexport class SqliteStorage implements ServerStorage {\n private inner: LibsqlStorage;\n\n constructor(path: string, options: SqliteStorageOptions = {}) {\n const ensureDir = options.ensureDir ?? true;\n const client = makeClient(path, ensureDir);\n this.inner = new LibsqlStorage({ client });\n }\n\n waitUntilReady(): Promise<void> {\n return this.inner.waitUntilReady();\n }\n\n getStorageHandle(\n connectorId: string,\n options?: GetStorageHandleOptions,\n ): StorageHandle {\n return this.inner.getStorageHandle(connectorId, options);\n }\n\n getHealth(connectorId: string): Promise<ConnectorHealth | null> {\n return this.inner.getHealth(connectorId);\n }\n\n getSyncState(): Promise<SyncState> {\n return this.inner.getSyncState();\n }\n\n markSyncQueued(): Promise<boolean> {\n return this.inner.markSyncQueued();\n }\n\n markSyncRunning(): Promise<boolean> {\n return this.inner.markSyncRunning();\n }\n\n markSyncSucceeded(): Promise<void> {\n return this.inner.markSyncSucceeded();\n }\n\n markSyncFailed(error: string): Promise<void> {\n return this.inner.markSyncFailed(error);\n }\n\n getConnectorSyncState(connectorId: string): Promise<SyncSchedulingState> {\n return this.inner.getConnectorSyncState(connectorId);\n }\n\n markConnectorSyncSucceeded(\n connectorId: string,\n options?: MarkConnectorSyncSucceededOptions,\n ): Promise<void> {\n return this.inner.markConnectorSyncSucceeded(connectorId, options);\n }\n\n close(): Promise<void> {\n return this.inner.close();\n }\n}\n"],"mappings":";AAAA,SAAsB,oBAAoB;AAC1C,SAAS,qBAAqB;AAU9B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,YAAY,eAAe;AAC7C,SAAS,qBAAqB;AAM9B,SAAS,UAAU,MAAsB;AACvC,MAAI,SAAS,YAAY;AACvB,WAAO;AAAA,EACT;AACA,QAAM,WAAW,WAAW,IAAI,IAAI,OAAO,QAAQ,QAAQ,IAAI,GAAG,IAAI;AACtE,SAAO,cAAc,QAAQ,EAAE,SAAS;AAC1C;AAEA,SAAS,WAAW,MAAc,WAA4B;AAC5D,MAAI,aAAa,SAAS,YAAY;AACpC,UAAM,WAAW,WAAW,IAAI,IAAI,OAAO,QAAQ,QAAQ,IAAI,GAAG,IAAI;AACtE,cAAU,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;AAAA,EAClD;AACA,SAAO,aAAa,EAAE,KAAK,UAAU,IAAI,EAAE,CAAC;AAC9C;AAEO,IAAM,gBAAN,MAA6C;AAAA,EAC1C;AAAA,EAER,YAAY,MAAc,UAAgC,CAAC,GAAG;AAC5D,UAAM,YAAY,QAAQ,aAAa;AACvC,UAAM,SAAS,WAAW,MAAM,SAAS;AACzC,SAAK,QAAQ,IAAI,cAAc,EAAE,OAAO,CAAC;AAAA,EAC3C;AAAA,EAEA,iBAAgC;AAC9B,WAAO,KAAK,MAAM,eAAe;AAAA,EACnC;AAAA,EAEA,iBACE,aACA,SACe;AACf,WAAO,KAAK,MAAM,iBAAiB,aAAa,OAAO;AAAA,EACzD;AAAA,EAEA,UAAU,aAAsD;AAC9D,WAAO,KAAK,MAAM,UAAU,WAAW;AAAA,EACzC;AAAA,EAEA,eAAmC;AACjC,WAAO,KAAK,MAAM,aAAa;AAAA,EACjC;AAAA,EAEA,iBAAmC;AACjC,WAAO,KAAK,MAAM,eAAe;AAAA,EACnC;AAAA,EAEA,kBAAoC;AAClC,WAAO,KAAK,MAAM,gBAAgB;AAAA,EACpC;AAAA,EAEA,oBAAmC;AACjC,WAAO,KAAK,MAAM,kBAAkB;AAAA,EACtC;AAAA,EAEA,eAAe,OAA8B;AAC3C,WAAO,KAAK,MAAM,eAAe,KAAK;AAAA,EACxC;AAAA,EAEA,sBAAsB,aAAmD;AACvE,WAAO,KAAK,MAAM,sBAAsB,WAAW;AAAA,EACrD;AAAA,EAEA,2BACE,aACA,SACe;AACf,WAAO,KAAK,MAAM,2BAA2B,aAAa,OAAO;AAAA,EACnE;AAAA,EAEA,QAAuB;AACrB,WAAO,KAAK,MAAM,MAAM;AAAA,EAC1B;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rawdash/adapter-sqlite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.1",
|
|
4
4
|
"description": "Rawdash SQLite storage adapter for local development (file-backed, survives restarts)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@libsql/client": "^0.17.0",
|
|
26
|
-
"@rawdash/adapter-libsql": "0.
|
|
27
|
-
"@rawdash/core": "0.
|
|
26
|
+
"@rawdash/adapter-libsql": "0.29.1",
|
|
27
|
+
"@rawdash/core": "0.29.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^22.19.17",
|