@framers/sql-storage-adapter 0.3.3 → 0.3.4
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/LICENSE +3 -1
- package/README.md +14 -2
- package/dist/adapters/__tests__/indexedDbAdapter.spec.js +1 -1
- package/dist/adapters/betterSqliteAdapter.js +1 -1
- package/dist/adapters/capacitorSqliteAdapter.js +1 -1
- package/dist/adapters/indexedDbAdapter.d.ts +1 -1
- package/dist/adapters/indexedDbAdapter.js +2 -2
- package/dist/adapters/postgresAdapter.js +1 -1
- package/dist/adapters/sqlJsAdapter.js +1 -1
- package/dist/core/database.js +2 -2
- package/dist/core/resolver.js +6 -6
- package/dist/features/backup/cloudBackup.js +2 -2
- package/dist/features/migrations/migration.js +2 -2
- package/dist/features/sync/syncManager.js +3 -3
- package/dist/index.js +16 -16
- package/dist/types/index.js +5 -5
- package/package.json +11 -4
package/LICENSE
CHANGED
|
@@ -18,4 +18,6 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
|
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
<!-- BRANDING-LOGOS -->
|
|
2
|
+
|
|
1
3
|
# SQL Storage Adapter
|
|
2
4
|
|
|
3
5
|
<p align="center">
|
|
4
6
|
<a href="https://frame.dev" target="_blank" rel="noopener">
|
|
5
|
-
<img src="https://
|
|
7
|
+
<img src="https://raw.githubusercontent.com/framersai/frame.dev/refs/heads/master/public/frame-logo-transparent.png" alt="Frame.dev" width="160" style="border-radius: 12px;">
|
|
6
8
|
</a>
|
|
7
9
|
<br>
|
|
8
|
-
<small>by <a href="https://frame.dev" target="_blank" rel="noopener">Frame.dev</a></small>
|
|
9
10
|
</p>
|
|
10
11
|
|
|
11
12
|
[](https://www.npmjs.com/package/@framers/sql-storage-adapter)
|
|
@@ -245,3 +246,14 @@ See [**PLATFORM_STRATEGY.md**](./PLATFORM_STRATEGY.md) for a comprehensive guide
|
|
|
245
246
|
<p align="center">
|
|
246
247
|
Built and maintained by <a href="https://frame.dev" target="_blank" rel="noopener"><strong>Frame.dev</strong></a>
|
|
247
248
|
</p>
|
|
249
|
+
|
|
250
|
+
## Links
|
|
251
|
+
- Website: https://frame.dev
|
|
252
|
+
- AgentOS: https://agentos.sh
|
|
253
|
+
- Marketplace: https://vca.chat
|
|
254
|
+
- GitHub: https://github.com/framersai/sql-storage-adapter
|
|
255
|
+
- npm: https://www.npmjs.com/package/@framers/sql-storage-adapter
|
|
256
|
+
## Contributing & Security
|
|
257
|
+
- Contributing: ./\.github/CONTRIBUTING.md
|
|
258
|
+
- Code of Conduct: ./\.github/CODE_OF_CONDUCT.md
|
|
259
|
+
- Security Policy: ./\.github/SECURITY.md
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
-
import { IndexedDbAdapter } from '../indexedDbAdapter';
|
|
2
|
+
import { IndexedDbAdapter } from '../indexedDbAdapter.js';
|
|
3
3
|
// Mock IndexedDB for Node.js tests
|
|
4
4
|
const setupIndexedDbMock = () => {
|
|
5
5
|
const stores = new Map();
|
|
@@ -7,7 +7,7 @@ import path from 'path';
|
|
|
7
7
|
* OPEN the adapter in a browser will produce a clear runtime error.
|
|
8
8
|
*/
|
|
9
9
|
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
10
|
-
import { normaliseParameters } from '../shared/parameterUtils';
|
|
10
|
+
import { normaliseParameters } from '../shared/parameterUtils.js';
|
|
11
11
|
/**
|
|
12
12
|
* Lazy loader for better-sqlite3 to keep the dependency optional.
|
|
13
13
|
*
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* ```typescript
|
|
29
|
-
* import { IndexedDbAdapter } from '
|
|
29
|
+
* import { IndexedDbAdapter } from '@framers/sql-storage-adapter/adapters/indexedDbAdapter';
|
|
30
30
|
*
|
|
31
31
|
* const adapter = new IndexedDbAdapter({
|
|
32
32
|
* dbName: 'my-app-db',
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* ```typescript
|
|
29
|
-
* import { IndexedDbAdapter } from '
|
|
29
|
+
* import { IndexedDbAdapter } from '@framers/sql-storage-adapter/adapters/indexedDbAdapter';
|
|
30
30
|
*
|
|
31
31
|
* const adapter = new IndexedDbAdapter({
|
|
32
32
|
* dbName: 'my-app-db',
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
import initSqlJs from 'sql.js';
|
|
46
|
-
import { normaliseParameters } from '../shared/parameterUtils';
|
|
46
|
+
import { normaliseParameters } from '../shared/parameterUtils.js';
|
|
47
47
|
const DB_VERSION = 1;
|
|
48
48
|
/**
|
|
49
49
|
* Storage adapter using IndexedDB + sql.js for client-side SQL persistence.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// this file without crashing. A runtime error will be thrown inside `open()` if
|
|
3
3
|
// execution actually occurs in a browser.
|
|
4
4
|
const __isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
5
|
-
import { normaliseParameters } from '../shared/parameterUtils';
|
|
5
|
+
import { normaliseParameters } from '../shared/parameterUtils.js';
|
|
6
6
|
const isPositional = (statement) => statement.includes('?');
|
|
7
7
|
const buildNamedStatement = (statement, named) => {
|
|
8
8
|
const order = [];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import initSqlJs from 'sql.js';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import { normaliseParameters } from '../shared/parameterUtils';
|
|
4
|
+
import { normaliseParameters } from '../shared/parameterUtils.js';
|
|
5
5
|
const normaliseRowId = (value) => {
|
|
6
6
|
if (typeof value === 'number' || typeof value === 'string') {
|
|
7
7
|
return value;
|
package/dist/core/database.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - connectDatabase() - Explicit connection with clear options
|
|
7
7
|
* - openDatabase() - Simple file-based database
|
|
8
8
|
*/
|
|
9
|
-
import { resolveStorageAdapter } from './resolver';
|
|
9
|
+
import { resolveStorageAdapter } from './resolver.js';
|
|
10
10
|
/**
|
|
11
11
|
* Create a database connection.
|
|
12
12
|
* Automatically picks the best database for your environment.
|
|
@@ -163,5 +163,5 @@ export async function createMemoryDatabase() {
|
|
|
163
163
|
return openDatabase(':memory:');
|
|
164
164
|
}
|
|
165
165
|
// Re-export for backwards compatibility
|
|
166
|
-
export { resolveStorageAdapter } from './resolver';
|
|
166
|
+
export { resolveStorageAdapter } from './resolver.js';
|
|
167
167
|
//# sourceMappingURL=database.js.map
|
package/dist/core/resolver.js
CHANGED
|
@@ -36,12 +36,12 @@ const getCwd = () => {
|
|
|
36
36
|
// Browser fallback (not used in browser anyway)
|
|
37
37
|
return '/';
|
|
38
38
|
};
|
|
39
|
-
import { StorageResolutionError } from './contracts';
|
|
40
|
-
import { createBetterSqliteAdapter } from '../adapters/betterSqliteAdapter';
|
|
41
|
-
import { createSqlJsAdapter } from '../adapters/sqlJsAdapter';
|
|
42
|
-
import { createCapacitorSqliteAdapter } from '../adapters/capacitorSqliteAdapter';
|
|
43
|
-
import { createPostgresAdapter } from '../adapters/postgresAdapter';
|
|
44
|
-
import { IndexedDbAdapter } from '../adapters/indexedDbAdapter';
|
|
39
|
+
import { StorageResolutionError } from './contracts/index.js';
|
|
40
|
+
import { createBetterSqliteAdapter } from '../adapters/betterSqliteAdapter.js';
|
|
41
|
+
import { createSqlJsAdapter } from '../adapters/sqlJsAdapter.js';
|
|
42
|
+
import { createCapacitorSqliteAdapter } from '../adapters/capacitorSqliteAdapter.js';
|
|
43
|
+
import { createPostgresAdapter } from '../adapters/postgresAdapter.js';
|
|
44
|
+
import { IndexedDbAdapter } from '../adapters/indexedDbAdapter.js';
|
|
45
45
|
const isCapacitorRuntime = () => {
|
|
46
46
|
if (typeof window === 'undefined') {
|
|
47
47
|
return false;
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
*
|
|
31
31
|
* @module cloudBackup
|
|
32
32
|
*/
|
|
33
|
-
import { exportAsJSON, exportAsSQL } from '../migrations/dataExport';
|
|
34
|
-
import { importFromJSON, importFromSQL } from '../migrations/dataImport';
|
|
33
|
+
import { exportAsJSON, exportAsSQL } from '../migrations/dataExport.js';
|
|
34
|
+
import { importFromJSON, importFromSQL } from '../migrations/dataImport.js';
|
|
35
35
|
/**
|
|
36
36
|
* S3-compatible cloud storage provider.
|
|
37
37
|
*
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* High-level migration utilities for moving data between adapters.
|
|
3
3
|
* Simplifies common migration scenarios like local -> Supabase, Supabase -> local, etc.
|
|
4
4
|
*/
|
|
5
|
-
import { exportData, exportAsJSON } from './dataExport';
|
|
6
|
-
import { migrateAdapter } from './dataImport';
|
|
5
|
+
import { exportData, exportAsJSON } from './dataExport.js';
|
|
6
|
+
import { migrateAdapter } from './dataImport.js';
|
|
7
7
|
/**
|
|
8
8
|
* Migrate from Better-SQLite3 (local) to Supabase.
|
|
9
9
|
*/
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
* await manager.sync();
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
import { createDatabase, openDatabase, connectDatabase } from '../../core/database';
|
|
37
|
-
import { exportData } from '../migrations/dataExport';
|
|
38
|
-
import { importData } from '../migrations/dataImport';
|
|
36
|
+
import { createDatabase, openDatabase, connectDatabase } from '../../core/database.js';
|
|
37
|
+
import { exportData } from '../migrations/dataExport.js';
|
|
38
|
+
import { importData } from '../migrations/dataImport.js';
|
|
39
39
|
/**
|
|
40
40
|
* Sync manager for hybrid local/cloud databases.
|
|
41
41
|
* Handles automatic synchronization, conflict resolution, and offline support.
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
// Public type surface -------------------------------------------------------
|
|
2
|
-
export * from './types';
|
|
2
|
+
export * from './types/index.js';
|
|
3
3
|
// Core runtime APIs ---------------------------------------------------------
|
|
4
|
-
export * from './core/database';
|
|
5
|
-
export * from './core/resolver';
|
|
4
|
+
export * from './core/database.js';
|
|
5
|
+
export * from './core/resolver.js';
|
|
6
6
|
// Adapter implementations ----------------------------------------------------
|
|
7
|
-
export * from './adapters/betterSqliteAdapter';
|
|
8
|
-
export * from './adapters/sqlJsAdapter';
|
|
9
|
-
export * from './adapters/indexedDbAdapter';
|
|
10
|
-
export * from './adapters/capacitorSqliteAdapter';
|
|
11
|
-
export * from './adapters/postgresAdapter';
|
|
12
|
-
export * from './adapters/supabase';
|
|
13
|
-
export * from './adapters/baseStorageAdapter';
|
|
7
|
+
export * from './adapters/betterSqliteAdapter.js';
|
|
8
|
+
export * from './adapters/sqlJsAdapter.js';
|
|
9
|
+
export * from './adapters/indexedDbAdapter.js';
|
|
10
|
+
export * from './adapters/capacitorSqliteAdapter.js';
|
|
11
|
+
export * from './adapters/postgresAdapter.js';
|
|
12
|
+
export * from './adapters/supabase.js';
|
|
13
|
+
export * from './adapters/baseStorageAdapter.js';
|
|
14
14
|
// Feature modules ------------------------------------------------------------
|
|
15
|
-
export * from './features/backup/cloudBackup';
|
|
16
|
-
export * from './features/migrations/dataExport';
|
|
17
|
-
export * from './features/migrations/dataImport';
|
|
18
|
-
export * from './features/migrations/migration';
|
|
19
|
-
export * from './features/sync/syncManager';
|
|
15
|
+
export * from './features/backup/cloudBackup.js';
|
|
16
|
+
export * from './features/migrations/dataExport.js';
|
|
17
|
+
export * from './features/migrations/dataImport.js';
|
|
18
|
+
export * from './features/migrations/migration.js';
|
|
19
|
+
export * from './features/sync/syncManager.js';
|
|
20
20
|
// Shared utilities -----------------------------------------------------------
|
|
21
|
-
export * from './shared/parameterUtils';
|
|
21
|
+
export * from './shared/parameterUtils.js';
|
|
22
22
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* "@framers/sql-storage-adapter/types". Ensures Node's specifier
|
|
4
4
|
* resolution finds an index module alongside the compiled artifacts.
|
|
5
5
|
*/
|
|
6
|
-
export * from '../core/contracts';
|
|
7
|
-
export * from '../core/contracts/context';
|
|
8
|
-
export * from '../core/contracts/events';
|
|
9
|
-
export * from '../core/contracts/extensions';
|
|
10
|
-
export * from '../core/contracts/limitations';
|
|
6
|
+
export * from '../core/contracts/index.js';
|
|
7
|
+
export * from '../core/contracts/context.js';
|
|
8
|
+
export * from '../core/contracts/events.js';
|
|
9
|
+
export * from '../core/contracts/extensions.js';
|
|
10
|
+
export * from '../core/contracts/limitations.js';
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@framers/sql-storage-adapter",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Robust cross-platform SQL storage abstraction with automatic fallbacks and runtime detection",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
26
|
"clean": "rimraf dist tsconfig.build.tsbuildinfo",
|
|
27
|
-
"build": "
|
|
28
|
-
"prepublishOnly": "
|
|
27
|
+
"build": "pnpm run clean && pnpm exec tsc -p tsconfig.build.json && node scripts/fix-esm-imports.mjs",
|
|
28
|
+
"prepublishOnly": "pnpm run build && pnpm run test",
|
|
29
29
|
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
30
30
|
"lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix",
|
|
31
31
|
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|
|
@@ -70,10 +70,16 @@
|
|
|
70
70
|
"url": "https://github.com/framersai/sql-storage-adapter/issues",
|
|
71
71
|
"email": "team@frame.dev"
|
|
72
72
|
},
|
|
73
|
-
"homepage": "https://github.
|
|
73
|
+
"homepage": "https://framersai.github.io/sql-storage-adapter",
|
|
74
74
|
"sideEffects": false,
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@aws-sdk/client-s3": "^3.709.0",
|
|
77
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
78
|
+
"@semantic-release/commit-analyzer": "^13.0.0",
|
|
79
|
+
"@semantic-release/git": "^10.0.1",
|
|
80
|
+
"@semantic-release/github": "^9.2.4",
|
|
81
|
+
"@semantic-release/npm": "^12.0.1",
|
|
82
|
+
"@semantic-release/release-notes-generator": "^14.0.1",
|
|
77
83
|
"@eslint/js": "^9.39.0",
|
|
78
84
|
"@types/better-sqlite3": "^7.6.13",
|
|
79
85
|
"@types/node": "^20.17.6",
|
|
@@ -83,6 +89,7 @@
|
|
|
83
89
|
"eslint-config-prettier": "^9.1.0",
|
|
84
90
|
"patch-package": "^8.0.0",
|
|
85
91
|
"rimraf": "^5.0.7",
|
|
92
|
+
"semantic-release": "^24.1.0",
|
|
86
93
|
"ts-node": "^10.9.2",
|
|
87
94
|
"tsc-alias": "^1.8.10",
|
|
88
95
|
"tsconfig-paths": "^4.2.0",
|