@prabhask5/stellar-engine 1.1.7 → 1.1.8
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 +4 -1
- package/dist/actions/remoteChange.d.ts +143 -18
- package/dist/actions/remoteChange.d.ts.map +1 -1
- package/dist/actions/remoteChange.js +182 -58
- package/dist/actions/remoteChange.js.map +1 -1
- package/dist/actions/truncateTooltip.d.ts +26 -12
- package/dist/actions/truncateTooltip.d.ts.map +1 -1
- package/dist/actions/truncateTooltip.js +89 -34
- package/dist/actions/truncateTooltip.js.map +1 -1
- package/dist/auth/admin.d.ts +40 -3
- package/dist/auth/admin.d.ts.map +1 -1
- package/dist/auth/admin.js +45 -5
- package/dist/auth/admin.js.map +1 -1
- package/dist/auth/crypto.d.ts +55 -5
- package/dist/auth/crypto.d.ts.map +1 -1
- package/dist/auth/crypto.js +58 -5
- package/dist/auth/crypto.js.map +1 -1
- package/dist/auth/deviceVerification.d.ts +236 -20
- package/dist/auth/deviceVerification.d.ts.map +1 -1
- package/dist/auth/deviceVerification.js +293 -40
- package/dist/auth/deviceVerification.js.map +1 -1
- package/dist/auth/displayUtils.d.ts +98 -0
- package/dist/auth/displayUtils.d.ts.map +1 -0
- package/dist/auth/displayUtils.js +133 -0
- package/dist/auth/displayUtils.js.map +1 -0
- package/dist/auth/loginGuard.d.ts +108 -14
- package/dist/auth/loginGuard.d.ts.map +1 -1
- package/dist/auth/loginGuard.js +153 -31
- package/dist/auth/loginGuard.js.map +1 -1
- package/dist/auth/offlineCredentials.d.ts +132 -15
- package/dist/auth/offlineCredentials.d.ts.map +1 -1
- package/dist/auth/offlineCredentials.js +167 -23
- package/dist/auth/offlineCredentials.js.map +1 -1
- package/dist/auth/offlineLogin.d.ts +96 -10
- package/dist/auth/offlineLogin.d.ts.map +1 -1
- package/dist/auth/offlineLogin.js +82 -15
- package/dist/auth/offlineLogin.js.map +1 -1
- package/dist/auth/offlineSession.d.ts +83 -9
- package/dist/auth/offlineSession.d.ts.map +1 -1
- package/dist/auth/offlineSession.js +104 -13
- package/dist/auth/offlineSession.js.map +1 -1
- package/dist/auth/resolveAuthState.d.ts +70 -8
- package/dist/auth/resolveAuthState.d.ts.map +1 -1
- package/dist/auth/resolveAuthState.js +142 -46
- package/dist/auth/resolveAuthState.js.map +1 -1
- package/dist/auth/singleUser.d.ts +390 -37
- package/dist/auth/singleUser.d.ts.map +1 -1
- package/dist/auth/singleUser.js +500 -99
- package/dist/auth/singleUser.js.map +1 -1
- package/dist/bin/install-pwa.d.ts +18 -2
- package/dist/bin/install-pwa.d.ts.map +1 -1
- package/dist/bin/install-pwa.js +801 -25
- package/dist/bin/install-pwa.js.map +1 -1
- package/dist/config.d.ts +132 -12
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +87 -9
- package/dist/config.js.map +1 -1
- package/dist/conflicts.d.ts +246 -23
- package/dist/conflicts.d.ts.map +1 -1
- package/dist/conflicts.js +495 -46
- package/dist/conflicts.js.map +1 -1
- package/dist/data.d.ts +338 -18
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +385 -34
- package/dist/data.js.map +1 -1
- package/dist/database.d.ts +72 -14
- package/dist/database.d.ts.map +1 -1
- package/dist/database.js +120 -29
- package/dist/database.js.map +1 -1
- package/dist/debug.d.ts +77 -1
- package/dist/debug.d.ts.map +1 -1
- package/dist/debug.js +88 -1
- package/dist/debug.js.map +1 -1
- package/dist/deviceId.d.ts +38 -7
- package/dist/deviceId.d.ts.map +1 -1
- package/dist/deviceId.js +68 -10
- package/dist/deviceId.js.map +1 -1
- package/dist/engine.d.ts +175 -3
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +756 -109
- package/dist/engine.js.map +1 -1
- package/dist/entries/actions.d.ts +13 -0
- package/dist/entries/actions.d.ts.map +1 -1
- package/dist/entries/actions.js +26 -1
- package/dist/entries/actions.js.map +1 -1
- package/dist/entries/auth.d.ts +16 -0
- package/dist/entries/auth.d.ts.map +1 -1
- package/dist/entries/auth.js +73 -1
- package/dist/entries/auth.js.map +1 -1
- package/dist/entries/config.d.ts +12 -0
- package/dist/entries/config.d.ts.map +1 -1
- package/dist/entries/config.js +18 -1
- package/dist/entries/config.js.map +1 -1
- package/dist/entries/kit.d.ts +11 -0
- package/dist/entries/kit.d.ts.map +1 -1
- package/dist/entries/kit.js +52 -2
- package/dist/entries/kit.js.map +1 -1
- package/dist/entries/stores.d.ts +11 -0
- package/dist/entries/stores.d.ts.map +1 -1
- package/dist/entries/stores.js +43 -2
- package/dist/entries/stores.js.map +1 -1
- package/dist/entries/types.d.ts +10 -0
- package/dist/entries/types.d.ts.map +1 -1
- package/dist/entries/types.js +10 -0
- package/dist/entries/types.js.map +1 -1
- package/dist/entries/utils.d.ts +6 -0
- package/dist/entries/utils.d.ts.map +1 -1
- package/dist/entries/utils.js +22 -1
- package/dist/entries/utils.js.map +1 -1
- package/dist/entries/vite.d.ts +17 -0
- package/dist/entries/vite.d.ts.map +1 -1
- package/dist/entries/vite.js +24 -1
- package/dist/entries/vite.js.map +1 -1
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +175 -20
- package/dist/index.js.map +1 -1
- package/dist/kit/auth.d.ts +60 -5
- package/dist/kit/auth.d.ts.map +1 -1
- package/dist/kit/auth.js +45 -4
- package/dist/kit/auth.js.map +1 -1
- package/dist/kit/confirm.d.ts +93 -12
- package/dist/kit/confirm.d.ts.map +1 -1
- package/dist/kit/confirm.js +103 -16
- package/dist/kit/confirm.js.map +1 -1
- package/dist/kit/loads.d.ts +150 -23
- package/dist/kit/loads.d.ts.map +1 -1
- package/dist/kit/loads.js +140 -24
- package/dist/kit/loads.js.map +1 -1
- package/dist/kit/server.d.ts +142 -10
- package/dist/kit/server.d.ts.map +1 -1
- package/dist/kit/server.js +158 -15
- package/dist/kit/server.js.map +1 -1
- package/dist/kit/sw.d.ts +152 -23
- package/dist/kit/sw.d.ts.map +1 -1
- package/dist/kit/sw.js +182 -26
- package/dist/kit/sw.js.map +1 -1
- package/dist/queue.d.ts +274 -0
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +556 -38
- package/dist/queue.js.map +1 -1
- package/dist/realtime.d.ts +241 -27
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +633 -109
- package/dist/realtime.js.map +1 -1
- package/dist/runtime/runtimeConfig.d.ts +91 -8
- package/dist/runtime/runtimeConfig.d.ts.map +1 -1
- package/dist/runtime/runtimeConfig.js +146 -19
- package/dist/runtime/runtimeConfig.js.map +1 -1
- package/dist/stores/authState.d.ts +150 -11
- package/dist/stores/authState.d.ts.map +1 -1
- package/dist/stores/authState.js +169 -17
- package/dist/stores/authState.js.map +1 -1
- package/dist/stores/network.d.ts +39 -0
- package/dist/stores/network.d.ts.map +1 -1
- package/dist/stores/network.js +169 -16
- package/dist/stores/network.js.map +1 -1
- package/dist/stores/remoteChanges.d.ts +327 -52
- package/dist/stores/remoteChanges.d.ts.map +1 -1
- package/dist/stores/remoteChanges.js +337 -75
- package/dist/stores/remoteChanges.js.map +1 -1
- package/dist/stores/sync.d.ts +130 -0
- package/dist/stores/sync.d.ts.map +1 -1
- package/dist/stores/sync.js +167 -7
- package/dist/stores/sync.js.map +1 -1
- package/dist/supabase/auth.d.ts +325 -18
- package/dist/supabase/auth.d.ts.map +1 -1
- package/dist/supabase/auth.js +374 -26
- package/dist/supabase/auth.js.map +1 -1
- package/dist/supabase/client.d.ts +79 -6
- package/dist/supabase/client.d.ts.map +1 -1
- package/dist/supabase/client.js +158 -15
- package/dist/supabase/client.js.map +1 -1
- package/dist/supabase/validate.d.ts +101 -7
- package/dist/supabase/validate.d.ts.map +1 -1
- package/dist/supabase/validate.js +117 -8
- package/dist/supabase/validate.js.map +1 -1
- package/dist/sw/build/vite-plugin.d.ts +55 -10
- package/dist/sw/build/vite-plugin.d.ts.map +1 -1
- package/dist/sw/build/vite-plugin.js +77 -18
- package/dist/sw/build/vite-plugin.js.map +1 -1
- package/dist/sw/sw.js +99 -44
- package/dist/types.d.ts +150 -26
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +12 -10
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +55 -13
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +83 -22
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/conflicts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conflicts.js","sourceRoot":"","sources":["../src/conflicts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"conflicts.js","sourceRoot":"","sources":["../src/conflicts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA+FzC,gFAAgF;AAChF,wBAAwB;AACxB,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAS,iBAAiB,CAAC,UAAkB;IAC3C,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;IAC7E,MAAM,WAAW,GAAG,eAAe,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,UAAU,CAAC,CAAC;IACxF,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,eAAe,EAAE,GAAG,CAAC,WAAW,EAAE,mBAAmB,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACpF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAS,qBAAqB,CAAC,UAA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BAAkB;AAClB,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;IAC9B,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;IAE3C,IAAI,CAAC;QACH;0EACkE;QAClE,MAAM,KAAK,GAAG,MAAM,eAAe,EAAE;aAClC,EAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC;aAC5B,MAAM,CAAC,CAAC,KAA2B,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;aACpE,MAAM,EAAE,CAAC;QAEZ,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACd,QAAQ,CAAC,yBAAyB,KAAK,+BAA+B,CAAC,CAAC;QAC1E,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,UAAU,CAAC,gDAAgD,EAAE,KAAK,CAAC,CAAC;QACpE,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
|
package/dist/data.d.ts
CHANGED
|
@@ -1,75 +1,395 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generic CRUD and Query Operations
|
|
2
|
+
* @fileoverview Generic CRUD and Query Operations for the Stellar Sync Engine
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* This module serves as the primary data access layer for the sync engine,
|
|
5
|
+
* replacing per-entity repository boilerplate with a unified, table-driven API.
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - Callers reference tables by their **Supabase** name (the remote/canonical name).
|
|
9
|
+
* - Internally, every operation resolves that name to the corresponding **Dexie**
|
|
10
|
+
* (IndexedDB) table name via the configured table map.
|
|
11
|
+
* - All write operations (create, update, delete, increment, batch) follow the
|
|
12
|
+
* same transactional pattern:
|
|
13
|
+
* 1. Open a Dexie read-write transaction spanning the target table + syncQueue.
|
|
14
|
+
* 2. Apply the mutation locally.
|
|
15
|
+
* 3. Enqueue the corresponding sync operation for eventual push to Supabase.
|
|
16
|
+
* 4. After commit, mark the entity as modified and schedule a sync push.
|
|
17
|
+
* - All read operations query Dexie first, with an optional remote fallback that
|
|
18
|
+
* fetches from Supabase when the local store is empty and the device is online.
|
|
19
|
+
*
|
|
20
|
+
* This dual-layer design enables full offline-first functionality: the app works
|
|
21
|
+
* against the local Dexie store, and the sync queue ensures changes propagate to
|
|
22
|
+
* the server when connectivity is available.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link ./config} for table map and column configuration
|
|
25
|
+
* @see {@link ./database} for Dexie database instance management
|
|
26
|
+
* @see {@link ./queue} for sync queue enqueueing operations
|
|
27
|
+
* @see {@link ./engine} for sync push scheduling and entity modification tracking
|
|
28
|
+
* @see {@link ./conflicts} for conflict resolution during sync pull
|
|
6
29
|
*/
|
|
7
30
|
/**
|
|
8
|
-
* Create a new entity
|
|
9
|
-
*
|
|
31
|
+
* Create a new entity in the local store and enqueue it for remote sync.
|
|
32
|
+
*
|
|
33
|
+
* This is the primary entry point for all entity creation. It performs the
|
|
34
|
+
* following steps atomically within a single Dexie transaction:
|
|
35
|
+
* 1. Inserts the entity into the local Dexie table.
|
|
36
|
+
* 2. Enqueues a `create` operation in the sync queue.
|
|
37
|
+
*
|
|
38
|
+
* After the transaction commits, it marks the entity as modified (for reactive
|
|
39
|
+
* UI updates) and schedules a sync push to propagate the change to Supabase.
|
|
40
|
+
*
|
|
41
|
+
* The caller is responsible for providing all required fields (including
|
|
42
|
+
* timestamps like `created_at` and `updated_at`). If `data.id` is omitted,
|
|
43
|
+
* a new UUID is generated automatically.
|
|
44
|
+
*
|
|
45
|
+
* @param table - The Supabase table name (resolved internally to a Dexie table).
|
|
46
|
+
* @param data - The full entity payload. May include `id`; if absent, one is generated.
|
|
47
|
+
* @returns The created entity payload (with `id` guaranteed to be present).
|
|
48
|
+
*
|
|
49
|
+
* @throws {Dexie.ConstraintError} If an entity with the same `id` already exists.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const task = await engineCreate('tasks', {
|
|
54
|
+
* title: 'Write docs',
|
|
55
|
+
* user_id: currentUserId,
|
|
56
|
+
* created_at: now(),
|
|
57
|
+
* updated_at: now(),
|
|
58
|
+
* });
|
|
59
|
+
* console.log(task.id); // auto-generated UUID
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @see {@link engineBatchWrite} for creating multiple entities atomically
|
|
63
|
+
* @see {@link queueCreateOperation} for the sync queue entry format
|
|
10
64
|
*/
|
|
11
65
|
export declare function engineCreate(table: string, data: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
12
66
|
/**
|
|
13
|
-
* Update
|
|
67
|
+
* Update specific fields on an existing entity.
|
|
68
|
+
*
|
|
69
|
+
* Automatically sets `updated_at` to the current timestamp, enqueues a `set`
|
|
70
|
+
* sync operation, and notifies the engine of the modification. The update and
|
|
71
|
+
* queue entry are wrapped in a single transaction for atomicity.
|
|
72
|
+
*
|
|
73
|
+
* If the entity does not exist (e.g., it was deleted between the caller's
|
|
74
|
+
* check and this call), the sync operation is skipped and `undefined` is
|
|
75
|
+
* returned -- no orphan queue entries are created.
|
|
76
|
+
*
|
|
77
|
+
* @param table - The Supabase table name.
|
|
78
|
+
* @param id - The primary key of the entity to update.
|
|
79
|
+
* @param fields - A partial record of fields to merge into the entity.
|
|
80
|
+
* @returns The fully updated entity record, or `undefined` if the entity was not found.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const updated = await engineUpdate('tasks', taskId, { title: 'New title' });
|
|
85
|
+
* // updated.updated_at is automatically set
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @see {@link engineIncrement} for numeric field increments with conflict-safe semantics
|
|
89
|
+
* @see {@link queueSyncOperation} for the `set` operation queue format
|
|
14
90
|
*/
|
|
15
91
|
export declare function engineUpdate(table: string, id: string, fields: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
|
|
16
92
|
/**
|
|
17
|
-
* Soft-delete an entity
|
|
93
|
+
* Soft-delete an entity by setting `deleted: true`.
|
|
94
|
+
*
|
|
95
|
+
* The engine uses soft deletes rather than hard deletes so that the deletion
|
|
96
|
+
* can be synced to other devices and to the server. The sync queue receives a
|
|
97
|
+
* `delete` operation, which the push logic translates into a Supabase update
|
|
98
|
+
* that sets `deleted = true` on the remote row.
|
|
99
|
+
*
|
|
100
|
+
* The entity remains in the local Dexie store (with `deleted: true`) until a
|
|
101
|
+
* future compaction or full re-sync removes it.
|
|
102
|
+
*
|
|
103
|
+
* @param table - The Supabase table name.
|
|
104
|
+
* @param id - The primary key of the entity to soft-delete.
|
|
105
|
+
* @returns Resolves when the local update and queue entry are committed.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* await engineDelete('tasks', taskId);
|
|
110
|
+
* // The task still exists locally with deleted: true
|
|
111
|
+
* // It will be synced as a deletion on the next push
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @see {@link queueDeleteOperation} for the delete queue entry format
|
|
18
115
|
*/
|
|
19
116
|
export declare function engineDelete(table: string, id: string): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Discriminated union representing a single operation within a batch write.
|
|
119
|
+
*
|
|
120
|
+
* Each variant mirrors the corresponding single-entity function but is designed
|
|
121
|
+
* to be executed as part of an atomic multi-operation transaction.
|
|
122
|
+
*
|
|
123
|
+
* @see {@link engineBatchWrite} for execution semantics
|
|
124
|
+
*/
|
|
20
125
|
export type BatchOperation = {
|
|
126
|
+
/** Create a new entity in the specified table. */
|
|
21
127
|
type: 'create';
|
|
128
|
+
/** The Supabase table name. */
|
|
22
129
|
table: string;
|
|
130
|
+
/** The full entity payload (id is auto-generated if absent). */
|
|
23
131
|
data: Record<string, unknown>;
|
|
24
132
|
} | {
|
|
133
|
+
/** Update fields on an existing entity. */
|
|
25
134
|
type: 'update';
|
|
135
|
+
/** The Supabase table name. */
|
|
26
136
|
table: string;
|
|
137
|
+
/** The primary key of the entity to update. */
|
|
27
138
|
id: string;
|
|
139
|
+
/** Partial record of fields to merge. */
|
|
28
140
|
fields: Record<string, unknown>;
|
|
29
141
|
} | {
|
|
142
|
+
/** Soft-delete an existing entity. */
|
|
30
143
|
type: 'delete';
|
|
144
|
+
/** The Supabase table name. */
|
|
31
145
|
table: string;
|
|
146
|
+
/** The primary key of the entity to delete. */
|
|
32
147
|
id: string;
|
|
33
148
|
};
|
|
34
149
|
/**
|
|
35
|
-
* Execute multiple write operations in a single atomic transaction.
|
|
36
|
-
*
|
|
150
|
+
* Execute multiple write operations in a single atomic Dexie transaction.
|
|
151
|
+
*
|
|
152
|
+
* This is the preferred way to perform related mutations that must succeed or
|
|
153
|
+
* fail together (e.g., creating a parent entity and its children, or moving an
|
|
154
|
+
* item from one list to another). All operations share a single `updated_at`
|
|
155
|
+
* timestamp for consistency.
|
|
156
|
+
*
|
|
157
|
+
* Transaction scope is dynamically computed: only the Dexie tables referenced
|
|
158
|
+
* by the operations (plus `syncQueue`) are locked, minimizing contention.
|
|
159
|
+
*
|
|
160
|
+
* After the transaction commits, all modified entity IDs are marked as modified
|
|
161
|
+
* in a single pass, and a single sync push is scheduled (not one per operation).
|
|
162
|
+
*
|
|
163
|
+
* @param operations - An ordered array of create/update/delete operations.
|
|
164
|
+
* @returns Resolves when all operations have been committed.
|
|
165
|
+
*
|
|
166
|
+
* @throws {Dexie.AbortError} If any operation fails, the entire batch is rolled back.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* await engineBatchWrite([
|
|
171
|
+
* { type: 'create', table: 'tasks', data: { title: 'Subtask 1', parent_id: parentId } },
|
|
172
|
+
* { type: 'create', table: 'tasks', data: { title: 'Subtask 2', parent_id: parentId } },
|
|
173
|
+
* { type: 'update', table: 'projects', id: projectId, fields: { task_count: newCount } },
|
|
174
|
+
* ]);
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* @see {@link engineCreate} for single-entity create semantics
|
|
178
|
+
* @see {@link engineUpdate} for single-entity update semantics
|
|
179
|
+
* @see {@link engineDelete} for single-entity delete semantics
|
|
37
180
|
*/
|
|
38
181
|
export declare function engineBatchWrite(operations: BatchOperation[]): Promise<void>;
|
|
39
182
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
183
|
+
* Atomically increment a numeric field on an entity.
|
|
184
|
+
*
|
|
185
|
+
* Unlike a plain `engineUpdate` with a computed value, this function preserves
|
|
186
|
+
* the **increment intent** in the sync queue (operationType: 'increment').
|
|
187
|
+
* This is critical for correct multi-device conflict resolution: when two
|
|
188
|
+
* devices each increment a counter by 1, the server can apply both increments
|
|
189
|
+
* additively (+2) rather than last-write-wins (which would yield +1).
|
|
190
|
+
*
|
|
191
|
+
* The local Dexie value is updated immediately (read-modify-write inside a
|
|
192
|
+
* transaction to prevent TOCTOU races). If additional fields need to be set
|
|
193
|
+
* alongside the increment (e.g., a `completed` flag), they are queued as a
|
|
194
|
+
* separate `set` operation so the increment and set semantics remain distinct.
|
|
195
|
+
*
|
|
196
|
+
* @param table - The Supabase table name.
|
|
197
|
+
* @param id - The primary key of the entity to increment.
|
|
198
|
+
* @param field - The name of the numeric field to increment.
|
|
199
|
+
* @param amount - The increment delta (can be negative for decrements).
|
|
200
|
+
* @param additionalFields - Optional extra fields to set alongside the increment
|
|
201
|
+
* (e.g., `{ completed: true }`). These are queued as a
|
|
202
|
+
* separate `set` operation.
|
|
203
|
+
* @returns The fully updated entity record, or `undefined` if the entity was not found.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```ts
|
|
207
|
+
* // Increment a task's focus_count by 1 and mark it as touched
|
|
208
|
+
* const updated = await engineIncrement('tasks', taskId, 'focus_count', 1, {
|
|
209
|
+
* last_focused_at: now(),
|
|
210
|
+
* });
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* @see {@link engineUpdate} for non-increment field updates
|
|
214
|
+
* @see {@link ./conflicts} for how increment operations are resolved during sync
|
|
43
215
|
*/
|
|
44
216
|
export declare function engineIncrement(table: string, id: string, field: string, amount: number, additionalFields?: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
|
|
45
217
|
/**
|
|
46
|
-
*
|
|
218
|
+
* Retrieve a single entity by its primary key.
|
|
219
|
+
*
|
|
220
|
+
* Queries the local Dexie store first. If the entity is not found locally and
|
|
221
|
+
* `remoteFallback` is enabled (and the device is online), a single-row fetch
|
|
222
|
+
* is made from Supabase. The remote result is cached locally in Dexie for
|
|
223
|
+
* subsequent offline access.
|
|
224
|
+
*
|
|
225
|
+
* The remote fallback filters out soft-deleted rows (`deleted IS NULL OR deleted = false`)
|
|
226
|
+
* to avoid resurrecting deleted entities.
|
|
227
|
+
*
|
|
228
|
+
* @param table - The Supabase table name.
|
|
229
|
+
* @param id - The primary key of the entity to retrieve.
|
|
230
|
+
* @param opts - Optional configuration.
|
|
231
|
+
* @param opts.remoteFallback - If `true`, fall back to a Supabase query when
|
|
232
|
+
* the entity is not found locally. Defaults to `false`.
|
|
233
|
+
* @returns The entity record, or `null` if not found (locally or remotely).
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* // Local-only lookup (fast, offline-safe)
|
|
238
|
+
* const task = await engineGet('tasks', taskId);
|
|
239
|
+
*
|
|
240
|
+
* // With remote fallback for cache misses
|
|
241
|
+
* const task = await engineGet('tasks', taskId, { remoteFallback: true });
|
|
242
|
+
* ```
|
|
243
|
+
*
|
|
244
|
+
* @see {@link engineGetAll} for retrieving all entities from a table
|
|
245
|
+
* @see {@link engineQuery} for index-based filtered queries
|
|
246
|
+
* @see {@link getTableColumns} for column projection on remote queries
|
|
47
247
|
*/
|
|
48
248
|
export declare function engineGet(table: string, id: string, opts?: {
|
|
49
249
|
remoteFallback?: boolean;
|
|
50
250
|
}): Promise<Record<string, unknown> | null>;
|
|
51
251
|
/**
|
|
52
|
-
*
|
|
252
|
+
* Retrieve all entities from a table, with optional ordering and remote fallback.
|
|
253
|
+
*
|
|
254
|
+
* Returns the full (non-filtered) contents of the local Dexie table. If the
|
|
255
|
+
* local table is empty and `remoteFallback` is enabled, a bulk fetch from
|
|
256
|
+
* Supabase is performed and results are cached locally via `bulkPut`.
|
|
257
|
+
*
|
|
258
|
+
* Note: This does NOT filter out soft-deleted entities locally. Callers that
|
|
259
|
+
* need to exclude deleted records should filter the results themselves. The
|
|
260
|
+
* remote fallback, however, does exclude deleted rows to avoid pulling down
|
|
261
|
+
* tombstones.
|
|
262
|
+
*
|
|
263
|
+
* @param table - The Supabase table name.
|
|
264
|
+
* @param opts - Optional configuration.
|
|
265
|
+
* @param opts.orderBy - A Dexie-indexed field name to sort results by.
|
|
266
|
+
* @param opts.remoteFallback - If `true`, fall back to Supabase when the local
|
|
267
|
+
* table is empty. Defaults to `false`.
|
|
268
|
+
* @returns An array of entity records (may be empty).
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* // Get all tasks ordered by creation date
|
|
273
|
+
* const tasks = await engineGetAll('tasks', { orderBy: 'created_at' });
|
|
274
|
+
*
|
|
275
|
+
* // Bootstrap from remote on first load
|
|
276
|
+
* const tasks = await engineGetAll('tasks', { remoteFallback: true });
|
|
277
|
+
* ```
|
|
278
|
+
*
|
|
279
|
+
* @see {@link engineGet} for single-entity retrieval
|
|
280
|
+
* @see {@link engineQuery} for filtered queries by index
|
|
53
281
|
*/
|
|
54
282
|
export declare function engineGetAll(table: string, opts?: {
|
|
55
283
|
orderBy?: string;
|
|
56
284
|
remoteFallback?: boolean;
|
|
57
285
|
}): Promise<Record<string, unknown>[]>;
|
|
58
286
|
/**
|
|
59
|
-
* Query entities by
|
|
287
|
+
* Query entities by a single indexed field value (equivalent to `WHERE index = value`).
|
|
288
|
+
*
|
|
289
|
+
* Uses Dexie's indexed `where().equals()` for efficient local lookups. If no
|
|
290
|
+
* results are found locally and `remoteFallback` is enabled, a filtered query
|
|
291
|
+
* is made against Supabase and results are cached locally.
|
|
292
|
+
*
|
|
293
|
+
* @param table - The Supabase table name.
|
|
294
|
+
* @param index - The name of the indexed field to filter on.
|
|
295
|
+
* @param value - The value to match against the indexed field.
|
|
296
|
+
* @param opts - Optional configuration.
|
|
297
|
+
* @param opts.remoteFallback - If `true`, fall back to Supabase when no local
|
|
298
|
+
* results are found. Defaults to `false`.
|
|
299
|
+
* @returns An array of matching entity records.
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```ts
|
|
303
|
+
* // Get all tasks belonging to a specific project
|
|
304
|
+
* const tasks = await engineQuery('tasks', 'project_id', projectId);
|
|
305
|
+
*
|
|
306
|
+
* // With remote fallback for initial sync scenarios
|
|
307
|
+
* const tasks = await engineQuery('tasks', 'user_id', userId, { remoteFallback: true });
|
|
308
|
+
* ```
|
|
309
|
+
*
|
|
310
|
+
* @see {@link engineQueryRange} for range-based queries (BETWEEN)
|
|
311
|
+
* @see {@link engineGetAll} for unfiltered table scans
|
|
60
312
|
*/
|
|
61
313
|
export declare function engineQuery(table: string, index: string, value: unknown, opts?: {
|
|
62
314
|
remoteFallback?: boolean;
|
|
63
315
|
}): Promise<Record<string, unknown>[]>;
|
|
64
316
|
/**
|
|
65
|
-
*
|
|
317
|
+
* Query entities where an indexed field falls within an inclusive range.
|
|
318
|
+
*
|
|
319
|
+
* Equivalent to `WHERE index BETWEEN lower AND upper` (inclusive on both ends).
|
|
320
|
+
* Useful for date-range queries (e.g., "all tasks due this week") or numeric
|
|
321
|
+
* range filters.
|
|
322
|
+
*
|
|
323
|
+
* Like other query functions, supports an optional remote fallback for when the
|
|
324
|
+
* local store has no matching results.
|
|
325
|
+
*
|
|
326
|
+
* @param table - The Supabase table name.
|
|
327
|
+
* @param index - The name of the indexed field to filter on.
|
|
328
|
+
* @param lower - The inclusive lower bound of the range.
|
|
329
|
+
* @param upper - The inclusive upper bound of the range.
|
|
330
|
+
* @param opts - Optional configuration.
|
|
331
|
+
* @param opts.remoteFallback - If `true`, fall back to Supabase when no local
|
|
332
|
+
* results are found. Defaults to `false`.
|
|
333
|
+
* @returns An array of matching entity records within the range.
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* ```ts
|
|
337
|
+
* // Get all tasks due between Monday and Friday
|
|
338
|
+
* const tasks = await engineQueryRange('tasks', 'due_date', mondayISO, fridayISO);
|
|
339
|
+
*
|
|
340
|
+
* // Get focus sessions within a score range
|
|
341
|
+
* const sessions = await engineQueryRange('focus_sessions', 'score', 80, 100);
|
|
342
|
+
* ```
|
|
343
|
+
*
|
|
344
|
+
* @see {@link engineQuery} for exact-match queries
|
|
66
345
|
*/
|
|
67
346
|
export declare function engineQueryRange(table: string, index: string, lower: unknown, upper: unknown, opts?: {
|
|
68
347
|
remoteFallback?: boolean;
|
|
69
348
|
}): Promise<Record<string, unknown>[]>;
|
|
70
349
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
350
|
+
* Retrieve an existing entity by index, or create one with defaults if none exists.
|
|
351
|
+
*
|
|
352
|
+
* Implements the singleton/get-or-create pattern commonly used for per-user
|
|
353
|
+
* settings records (e.g., `focus_settings`) where exactly one row per user
|
|
354
|
+
* should exist. The lookup uses an indexed field (typically `user_id`) rather
|
|
355
|
+
* than the primary key.
|
|
356
|
+
*
|
|
357
|
+
* Resolution order:
|
|
358
|
+
* 1. **Local lookup** -- query Dexie by the given index. If a non-deleted
|
|
359
|
+
* match is found, return it immediately.
|
|
360
|
+
* 2. **Remote check** (optional) -- if `checkRemote` is true and online,
|
|
361
|
+
* query Supabase for an existing record. If found, cache it locally and
|
|
362
|
+
* return it. This handles the case where the record exists on the server
|
|
363
|
+
* but hasn't been synced down to this device yet.
|
|
364
|
+
* 3. **Local create** -- if neither local nor remote has a match, create a
|
|
365
|
+
* new entity with the provided defaults, queue it for sync, and return it.
|
|
366
|
+
*
|
|
367
|
+
* @param table - The Supabase table name.
|
|
368
|
+
* @param index - The indexed field to search on (e.g., `'user_id'`).
|
|
369
|
+
* @param value - The value to match against the index (e.g., the current user's ID).
|
|
370
|
+
* @param defaults - Default field values for the newly created entity (excluding
|
|
371
|
+
* `id`, `created_at`, and `updated_at`, which are auto-generated).
|
|
372
|
+
* @param opts - Optional configuration.
|
|
373
|
+
* @param opts.checkRemote - If `true`, check Supabase before creating locally.
|
|
374
|
+
* Prevents duplicate creation when the record exists
|
|
375
|
+
* on another device but hasn't synced down yet.
|
|
376
|
+
* Defaults to `false`.
|
|
377
|
+
* @returns The existing or newly created entity record.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```ts
|
|
381
|
+
* // Get or create user-specific focus settings
|
|
382
|
+
* const settings = await engineGetOrCreate(
|
|
383
|
+
* 'focus_settings',
|
|
384
|
+
* 'user_id',
|
|
385
|
+
* currentUserId,
|
|
386
|
+
* { user_id: currentUserId, pomodoro_minutes: 25, break_minutes: 5 },
|
|
387
|
+
* { checkRemote: true }
|
|
388
|
+
* );
|
|
389
|
+
* ```
|
|
390
|
+
*
|
|
391
|
+
* @see {@link engineCreate} for the underlying create logic
|
|
392
|
+
* @see {@link engineQuery} for index-based queries without auto-creation
|
|
73
393
|
*/
|
|
74
394
|
export declare function engineGetOrCreate(table: string, index: string, value: unknown, defaults: Record<string, unknown>, opts?: {
|
|
75
395
|
checkRemote?: boolean;
|
package/dist/data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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