@anfenn/dync 1.1.0 → 1.1.3
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/README.md +9 -4
- package/dist/{dexie-D85rTx4g.d.ts → dexie-B3Ihrrxi.d.ts} +1 -6
- package/dist/{dexie-3VOQSn1s.d.cts → dexie-BRWUYM02.d.cts} +1 -6
- package/dist/dexie.d.cts +1 -1
- package/dist/dexie.d.ts +1 -1
- package/dist/index.cjs +2 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -16
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.cts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/{types-BIJhsSOf.d.ts → types-DhlgTu1o.d.ts} +1 -1
- package/dist/{types-DhCTdAep.d.cts → types-Di82FTAL.d.cts} +1 -1
- package/package.json +5 -3
- package/src/storage/sqlite/SQLiteAdapter.ts +1 -2
- package/src/storage/sqlite/SQLiteQueryContext.ts +1 -22
package/dist/react/index.d.cts
CHANGED
package/dist/react/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anfenn/dync",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
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": [
|
|
@@ -143,8 +143,10 @@
|
|
|
143
143
|
"test:ci": "pnpm --filter tests test:ci",
|
|
144
144
|
"test:browser:full": "pnpm --filter tests test:browser:full",
|
|
145
145
|
"reinstall": "find . -name node_modules -type d -prune -exec rm -rf {} + && pnpm install",
|
|
146
|
-
"
|
|
147
|
-
"
|
|
146
|
+
"smoke": "pnpm build:all && pnpm test",
|
|
147
|
+
"hascommits": "[ -n \"$(git log @{u}.. --oneline)\" ] || { echo \"No unpushed commits, aborting.\"; exit 1; }",
|
|
148
|
+
"prepush": "pnpm hascommits && pnpm build:all && pnpm test:all && pnpm test:browser:full",
|
|
149
|
+
"release": "bash -c 'pnpm prepush && { [ \"$1\" = \"--no-patch\" ] || npm version patch --no-tag --force; } && git push && npm login && npm publish' --"
|
|
148
150
|
},
|
|
149
151
|
"devDependencies": {
|
|
150
152
|
"@capacitor-community/sqlite": "7.0.2",
|
|
@@ -203,8 +203,7 @@ export class SQLiteAdapter implements StorageAdapter {
|
|
|
203
203
|
async query(statement: string, values?: any[]): Promise<SQLiteQueryResult>;
|
|
204
204
|
async query<R>(arg1: string | ((ctx: SQLiteQueryContext) => Promise<R>), arg2?: any[]): Promise<R | SQLiteQueryResult> {
|
|
205
205
|
if (typeof arg1 === 'function') {
|
|
206
|
-
|
|
207
|
-
return arg1(new SQLiteQueryContext(driver, this));
|
|
206
|
+
return arg1(new SQLiteQueryContext(this));
|
|
208
207
|
}
|
|
209
208
|
const statement = arg1;
|
|
210
209
|
const values = arg2;
|
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
import type { StorageTable, StorageTransactionContext, TransactionMode } from '../types';
|
|
2
|
-
import type { SQLiteDatabaseDriver, SQLiteRunResult } from './types';
|
|
3
1
|
import { SQLiteAdapter } from './SQLiteAdapter';
|
|
4
2
|
|
|
5
3
|
export class SQLiteQueryContext {
|
|
6
|
-
constructor(
|
|
7
|
-
private readonly driver: SQLiteDatabaseDriver,
|
|
8
|
-
private readonly adapter: SQLiteAdapter,
|
|
9
|
-
) {}
|
|
10
|
-
|
|
11
|
-
table<T = any>(name: string): StorageTable<T> {
|
|
12
|
-
return this.adapter.table(name);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
transaction<T>(mode: TransactionMode, tableNames: string[], callback: (context: StorageTransactionContext) => Promise<T>): Promise<T> {
|
|
16
|
-
return this.adapter.transaction(mode, tableNames, callback);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async execute(statement: string): Promise<void> {
|
|
20
|
-
return this.driver.execute(statement);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async run(statement: string, values?: any[]): Promise<SQLiteRunResult> {
|
|
24
|
-
return this.driver.run(statement, values);
|
|
25
|
-
}
|
|
4
|
+
constructor(private readonly adapter: SQLiteAdapter) {}
|
|
26
5
|
|
|
27
6
|
async queryRows(statement: string, values?: any[]): Promise<Array<Record<string, any>>> {
|
|
28
7
|
return this.adapter.queryRows(statement, values);
|