@anfenn/dync 1.0.31 → 1.0.32

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/node.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as better_sqlite3 from 'better-sqlite3';
2
- import { S as SQLiteDatabaseDriver, a as SQLiteRunResult, b as SQLiteQueryResult } from './types-DeiRXWKl.cjs';
2
+ import { S as SQLiteDatabaseDriver, a as SQLiteRunResult, b as SQLiteQueryResult } from './types-6-NyRQ0D.cjs';
3
3
 
4
4
  /**
5
5
  * Options for configuring the BetterSQLite3Driver.
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as better_sqlite3 from 'better-sqlite3';
2
- import { S as SQLiteDatabaseDriver, a as SQLiteRunResult, b as SQLiteQueryResult } from './types-DeiRXWKl.js';
2
+ import { S as SQLiteDatabaseDriver, a as SQLiteRunResult, b as SQLiteQueryResult } from './types-6-NyRQ0D.js';
3
3
 
4
4
  /**
5
5
  * Options for configuring the BetterSQLite3Driver.
@@ -1,7 +1,7 @@
1
- import { a as SyncApi, k as SyncState } from '../types-B7xq90Kc.cjs';
2
- import '../dexie-q17SmbBw.cjs';
1
+ import { a as SyncApi, k as SyncState } from '../types-BszcepJK.cjs';
2
+ import '../dexie-3VOQSn1s.cjs';
3
3
  import 'dexie';
4
- import '../types-DeiRXWKl.cjs';
4
+ import '../types-6-NyRQ0D.cjs';
5
5
 
6
6
  /** Minimal database interface for React hooks */
7
7
  interface DyncLike {
@@ -1,7 +1,7 @@
1
- import { a as SyncApi, k as SyncState } from '../types-CfvYBKI_.js';
2
- import '../dexie-ImxmapkS.js';
1
+ import { a as SyncApi, k as SyncState } from '../types-Dhx9MuUp.js';
2
+ import '../dexie-D85rTx4g.js';
3
3
  import 'dexie';
4
- import '../types-DeiRXWKl.js';
4
+ import '../types-6-NyRQ0D.js';
5
5
 
6
6
  /** Minimal database interface for React hooks */
7
7
  interface DyncLike {
@@ -28,10 +28,6 @@ interface SQLiteVersionMigration {
28
28
  up?: SQLiteMigrationHandler;
29
29
  down?: SQLiteMigrationHandler;
30
30
  }
31
- interface SQLiteVersionConfigurator {
32
- up(handler: SQLiteMigrationHandler): void;
33
- down(handler: SQLiteMigrationHandler): void;
34
- }
35
31
  interface SQLiteSchemaDefinitionOptions {
36
32
  migrations?: SQLiteVersionMigration;
37
33
  }
@@ -39,4 +35,4 @@ interface StorageSchemaDefinitionOptions {
39
35
  sqlite?: SQLiteSchemaDefinitionOptions;
40
36
  }
41
37
 
42
- export type { SQLiteDatabaseDriver as S, SQLiteRunResult as a, SQLiteQueryResult as b, SQLiteVersionConfigurator as c, StorageSchemaDefinitionOptions as d, SQLiteAdapterOptions as e };
38
+ export type { SQLiteDatabaseDriver as S, SQLiteRunResult as a, SQLiteQueryResult as b, SQLiteVersionMigration as c, StorageSchemaDefinitionOptions as d, SQLiteAdapterOptions as e };
@@ -28,10 +28,6 @@ interface SQLiteVersionMigration {
28
28
  up?: SQLiteMigrationHandler;
29
29
  down?: SQLiteMigrationHandler;
30
30
  }
31
- interface SQLiteVersionConfigurator {
32
- up(handler: SQLiteMigrationHandler): void;
33
- down(handler: SQLiteMigrationHandler): void;
34
- }
35
31
  interface SQLiteSchemaDefinitionOptions {
36
32
  migrations?: SQLiteVersionMigration;
37
33
  }
@@ -39,4 +35,4 @@ interface StorageSchemaDefinitionOptions {
39
35
  sqlite?: SQLiteSchemaDefinitionOptions;
40
36
  }
41
37
 
42
- export type { SQLiteDatabaseDriver as S, SQLiteRunResult as a, SQLiteQueryResult as b, SQLiteVersionConfigurator as c, StorageSchemaDefinitionOptions as d, SQLiteAdapterOptions as e };
38
+ export type { SQLiteDatabaseDriver as S, SQLiteRunResult as a, SQLiteQueryResult as b, SQLiteVersionMigration as c, StorageSchemaDefinitionOptions as d, SQLiteAdapterOptions as e };
@@ -1,4 +1,4 @@
1
- import { d as StorageAdapter, a as StorageTable } from './dexie-q17SmbBw.cjs';
1
+ import { d as StorageAdapter, a as StorageTable } from './dexie-3VOQSn1s.cjs';
2
2
 
3
3
  type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'none';
4
4
  interface Logger {
@@ -1,4 +1,4 @@
1
- import { d as StorageAdapter, a as StorageTable } from './dexie-ImxmapkS.js';
1
+ import { d as StorageAdapter, a as StorageTable } from './dexie-D85rTx4g.js';
2
2
 
3
3
  type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'none';
4
4
  interface Logger {
@@ -1,4 +1,4 @@
1
- import { S as SQLiteDatabaseDriver, a as SQLiteRunResult, b as SQLiteQueryResult } from './types-DeiRXWKl.cjs';
1
+ import { S as SQLiteDatabaseDriver, a as SQLiteRunResult, b as SQLiteQueryResult } from './types-6-NyRQ0D.cjs';
2
2
 
3
3
  /**
4
4
  * Virtual File System (VFS) options for wa-sqlite.
@@ -1,4 +1,4 @@
1
- import { S as SQLiteDatabaseDriver, a as SQLiteRunResult, b as SQLiteQueryResult } from './types-DeiRXWKl.js';
1
+ import { S as SQLiteDatabaseDriver, a as SQLiteRunResult, b as SQLiteQueryResult } from './types-6-NyRQ0D.js';
2
2
 
3
3
  /**
4
4
  * Virtual File System (VFS) options for wa-sqlite.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anfenn/dync",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "private": false,
5
5
  "description": "Write once, run IndexedDB & SQLite with sync anywhere - React, React Native, Expo, Capacitor, Electron & Node.js",
6
6
  "keywords": [
@@ -19,7 +19,7 @@ import {
19
19
  } from './types';
20
20
  import { addVisibilityChangeListener } from './addVisibilityChangeListener';
21
21
  import { type StorageAdapter, type StorageTable, type TransactionMode } from './storage/types';
22
- import type { StorageSchemaDefinitionOptions, SQLiteVersionConfigurator } from './storage/sqlite/types';
22
+ import type { StorageSchemaDefinitionOptions, SQLiteVersionMigration } from './storage/sqlite/types';
23
23
  import type { TableSchemaDefinition, SQLiteTableDefinition } from './storage/sqlite/schema';
24
24
  import { enhanceSyncTable, setupEnhancedTables as setupEnhancedTablesHelper, wrapWithMutationEmitter } from './core/tableEnhancers';
25
25
  import { pullAll as runPullAll, pullAllBatch as runPullAllBatch } from './core/pullOperations';
@@ -205,21 +205,12 @@ class DyncBase<_TStoreMap extends Record<string, any> = Record<string, any>> {
205
205
 
206
206
  return builder;
207
207
  },
208
- sqlite(configure: (builder: SQLiteVersionConfigurator) => void) {
208
+ sqlite(migrations: SQLiteVersionMigration) {
209
209
  if (!storesDefined) {
210
210
  throw new Error('Call stores() before registering sqlite migrations');
211
211
  }
212
212
  const sqliteOptions = (schemaOptions.sqlite ??= {});
213
- const migrations = (sqliteOptions.migrations ??= {});
214
- const configurator: SQLiteVersionConfigurator = {
215
- up(handler) {
216
- migrations.up = handler;
217
- },
218
- down(handler) {
219
- migrations.down = handler;
220
- },
221
- };
222
- configure(configurator);
213
+ sqliteOptions.migrations = migrations;
223
214
  return builder;
224
215
  },
225
216
  };
@@ -141,11 +141,6 @@ export interface SQLiteVersionMigration {
141
141
  down?: SQLiteMigrationHandler;
142
142
  }
143
143
 
144
- export interface SQLiteVersionConfigurator {
145
- up(handler: SQLiteMigrationHandler): void;
146
- down(handler: SQLiteMigrationHandler): void;
147
- }
148
-
149
144
  export interface SQLiteSchemaDefinitionOptions {
150
145
  migrations?: SQLiteVersionMigration;
151
146
  }