cry-synced-db-client 0.1.74 → 0.1.76

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.
@@ -115,4 +115,13 @@ export declare class SyncedDb implements I_SyncedDb {
115
115
  */
116
116
  private resolveOpts;
117
117
  private assertCollection;
118
+ /**
119
+ * Asserts write-only collection has online connectivity for reads.
120
+ * @throws Error if offline
121
+ */
122
+ private assertWriteOnlyOnline;
123
+ private writeOnlyFindById;
124
+ private writeOnlyFindByIds;
125
+ private writeOnlyFindOne;
126
+ private writeOnlyFind;
118
127
  }
@@ -20,4 +20,10 @@ export interface CollectionConfig<T = any> {
20
20
  */
21
21
  syncConfig?: CollectionSyncConfig<T>;
22
22
  resolveSyncConflict?(local: T, external: T): T;
23
+ /**
24
+ * Write-only mode: writes are persisted locally (Dexie) and uploaded
25
+ * to the server, but no data is downloaded or kept in the in-memory cache.
26
+ * Read operations throw. Server sync and WS notifications are skipped.
27
+ */
28
+ writeOnly?: boolean;
23
29
  }
@@ -254,6 +254,12 @@ export interface CollectionConfig<T extends DbEntity = any, M = any> {
254
254
  syncConfig?: CollectionSyncConfig;
255
255
  /** Opcijska funkcija za razreševanje konfliktov */
256
256
  resolveSyncConflict?(local: T, external: T): T;
257
+ /**
258
+ * Write-only mode: writes are persisted locally (Dexie) and uploaded
259
+ * to the server, but no data is downloaded or kept in the in-memory cache.
260
+ * Read operations throw. Server sync and WS notifications are skipped.
261
+ */
262
+ writeOnly?: boolean;
257
263
  /** Whether this collection uses in-memory metadata */
258
264
  hasMetadata?: boolean;
259
265
  /** Callback called when a single object is written to in-mem. Returns metadata to store. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cry-synced-db-client",
3
- "version": "0.1.74",
3
+ "version": "0.1.76",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "scripts": {
18
18
  "clean": "rm -rf dist",
19
19
  "build": "bun run clean && bun run build:js && bun run build:types",
20
- "build:js": "bun build ./src/index.ts --outdir ./dist --target browser --format esm --external dexie --external bson --external cry-helpers --external notepack.io",
20
+ "build:js": "esbuild ./src/index.ts --bundle --outdir=./dist --target=es2017 --format=esm --platform=browser --external:dexie --external:bson --external:cry-helpers --external:notepack.io",
21
21
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
22
22
  "test": "bun test test/*.test.ts test/restProxy/*.test.ts && vitest run",
23
23
  "test:bun": "bun test test/*.test.ts test/restProxy/*.test.ts",
@@ -26,21 +26,22 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/bun": "latest",
29
- "bson": "^7.0.0",
29
+ "bson": "^7.2.0",
30
30
  "cry-ebus-proxy": "^1.0.3",
31
- "dexie": "^4.2.1",
31
+ "dexie": "^4.4.1",
32
+ "esbuild": "^0.27.4",
32
33
  "fake-indexeddb": "^6.2.5",
33
- "typescript": "^5",
34
- "vitest": "^4.0.17"
34
+ "typescript": "^6",
35
+ "vitest": "^4.1.2"
35
36
  },
36
37
  "dependencies": {
37
- "cry-db": "^2.4.18",
38
- "cry-helpers": "^2.1.187",
39
- "msgpackr": "^1.11.8",
38
+ "cry-db": "^2.4.23",
39
+ "cry-helpers": "^2.1.193",
40
+ "msgpackr": "^1.11.9",
40
41
  "notepack": "^0.0.2",
41
42
  "notepack.io": "^3.0.1",
42
43
  "superjson": "^2.2.6",
43
- "undici": "^7.18.2"
44
+ "undici": "^7.24.6"
44
45
  },
45
46
  "peerDependencies": {
46
47
  "bson": "^6.0.0 || ^7.0.0",