@spooky-sync/client-solid2 0.0.1-alpha.1
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/AGENTS.md +81 -0
- package/QUICK_START.md +129 -0
- package/README.md +19 -0
- package/dist/index.cjs +1290 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +670 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +670 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1266 -0
- package/dist/index.js.map +1 -0
- package/package.json +63 -0
- package/skills/sp00ky-solid2/SKILL.md +71 -0
- package/src/index.ts +410 -0
- package/src/lib/Blurhash.ts +64 -0
- package/src/lib/BucketImage.ts +170 -0
- package/src/lib/Sp00kyProvider.ts +104 -0
- package/src/lib/__tests__/conflate.test.ts +120 -0
- package/src/lib/__tests__/create-query.test.ts +397 -0
- package/src/lib/__tests__/rc-semantics.test.ts +393 -0
- package/src/lib/__tests__/use-sync-activity.test.ts +104 -0
- package/src/lib/conflate.ts +74 -0
- package/src/lib/context.ts +28 -0
- package/src/lib/create-preload.ts +116 -0
- package/src/lib/create-query.ts +388 -0
- package/src/lib/create-submission.ts +57 -0
- package/src/lib/from-subscription.ts +32 -0
- package/src/lib/merge-rows.test.ts +92 -0
- package/src/lib/merge-rows.ts +72 -0
- package/src/lib/models.ts +8 -0
- package/src/lib/use-app-release.ts +89 -0
- package/src/lib/use-blurhash.ts +82 -0
- package/src/lib/use-bucket-image.ts +108 -0
- package/src/lib/use-crdt-field.ts +57 -0
- package/src/lib/use-download-file.ts +181 -0
- package/src/lib/use-feature-flag.ts +43 -0
- package/src/lib/use-file-upload.ts +146 -0
- package/src/lib/use-storage-status.ts +44 -0
- package/src/lib/use-sync-activity.ts +99 -0
- package/src/lib/use-sync-status.ts +63 -0
- package/src/types/index.ts +83 -0
- package/tsconfig.json +27 -0
- package/tsdown.config.ts +20 -0
- package/vitest.config.ts +14 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import { AppReleaseOptions, AuthService, BucketHandle, BucketPutOptions, BucketPutResult, ConnectionState, ConnectionState as ConnectionState$1, CrdtField, FeatureFlagOptions, PreloadOptions, PreloadOptions as PreloadOptions$1, PreloadRefresh, ReconnectConfig, RunOptions, Sp00kyClient, Sp00kyConfig, Sp00kyQueryResultPromise, StorageHealth, StorageHealth as StorageHealth$1, StorageHealthStatus, StorageHealthStatus as StorageHealthStatus$1, SyncHealth, SyncHealth as SyncHealth$1, SyncHealthConfig, SyncHealthStatus, SyncHealthStatus as SyncHealthStatus$1, UpdateOptions } from "@spooky-sync/core";
|
|
2
|
+
import { RecordId, RecordId as RecordId$1, Surreal, Uuid } from "surrealdb";
|
|
3
|
+
import { Accessor, Element } from "solid-js";
|
|
4
|
+
import { BackendNames, BackendRoutes, BucketDefinitionSchema, BucketNames, ColumnSchema, FinalQuery, GenericModel, GenericSchema, GetCardinality, GetRelationship, GetTable, GetTable as GetTable$1, InferRelatedModelFromMetadata, InnerQuery, QueryBuilder, QueryInfo, QueryModifier, QueryModifierBuilder, QueryResult, QueryResult as QueryResult$1, RelatedFieldMapEntry, RelatedFieldsMap, RelationshipDefinition, RelationshipFieldsFromSchema, RelationshipsMetadata, RoutePayload, SchemaStructure, TableModel, TableModel as TableModel$1, TableNames, TableNames as TableNames$1 } from "@spooky-sync/query-builder";
|
|
5
|
+
|
|
6
|
+
//#region src/lib/models.d.ts
|
|
7
|
+
type Model<T> = T;
|
|
8
|
+
type ModelPayload<T> = T & {
|
|
9
|
+
id: RecordId$1;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=models.d.ts.map
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/types/index.d.ts
|
|
14
|
+
/**
|
|
15
|
+
* Options for database provisioning
|
|
16
|
+
*/
|
|
17
|
+
interface ProvisionOptions {
|
|
18
|
+
/** Force re-provision even if schema already exists */
|
|
19
|
+
force?: boolean;
|
|
20
|
+
}
|
|
21
|
+
sideEffect();
|
|
22
|
+
type CacheStrategy = 'memory' | 'indexeddb';
|
|
23
|
+
/**
|
|
24
|
+
* Infer Schema type (Record<TableName, Model>) from schema const
|
|
25
|
+
*/
|
|
26
|
+
type InferSchemaFromConst<S extends SchemaStructure> = { [K in TableNames$1<S>]: TableModel$1<GetTable$1<S, K>> };
|
|
27
|
+
/**
|
|
28
|
+
* Infer Relationships type from schema const's relationships array
|
|
29
|
+
* Converts from array format to nested object format
|
|
30
|
+
*/
|
|
31
|
+
type InferRelationshipsFromConst<S extends SchemaStructure, Schema extends GenericSchema> = { [TableName in TableNames$1<S>]: { [Rel in Extract<S['relationships'][number], {
|
|
32
|
+
from: TableName;
|
|
33
|
+
}> as Rel['field']]: {
|
|
34
|
+
model: Rel['to'] extends keyof Schema ? Schema[Rel['to']] : any;
|
|
35
|
+
table: Rel['to'];
|
|
36
|
+
cardinality: Rel['cardinality'];
|
|
37
|
+
} } };
|
|
38
|
+
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
39
|
+
type SyncedDbConfig<S extends SchemaStructure> = Prettify<Sp00kyConfig<S>>;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/lib/create-query.d.ts
|
|
42
|
+
type QueryArg<S extends SchemaStructure, TableName extends TableNames$1<S>, T extends {
|
|
43
|
+
columns: Record<string, ColumnSchema>;
|
|
44
|
+
}, RelatedFields extends Record<string, any>, IsOne extends boolean> = FinalQuery<S, TableName, T, RelatedFields, IsOne, Sp00kyQueryResultPromise> | (() => FinalQuery<S, TableName, T, RelatedFields, IsOne, Sp00kyQueryResultPromise> | null | undefined);
|
|
45
|
+
type QueryOptions = {
|
|
46
|
+
enabled?: () => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Tear down the query (remote `_00_query` view + local WASM view) when this
|
|
49
|
+
* hook is disposed and no other subscriber remains, instead of keeping it
|
|
50
|
+
* resident for cheap re-subscription. Use for viewport-windowed lists that
|
|
51
|
+
* mount/unmount a query per scroll window and want off-screen windows
|
|
52
|
+
* cancelled. Trade-off: scrolling back to a torn-down window re-registers it.
|
|
53
|
+
*/
|
|
54
|
+
deregisterOnCleanup?: boolean;
|
|
55
|
+
};
|
|
56
|
+
type CreateQueryResult<TData> = {
|
|
57
|
+
/**
|
|
58
|
+
* Reactive result. Never suspends and never throws: born as an empty
|
|
59
|
+
* committed value (`[]` / `null`) and reconciled in place (keyed by `id`) on
|
|
60
|
+
* every live emission — unchanged rows keep identity, and coarse readers
|
|
61
|
+
* (`<For>`) are notified on add/remove/reorder.
|
|
62
|
+
*/
|
|
63
|
+
data: Accessor<TData>;
|
|
64
|
+
/**
|
|
65
|
+
* Suspending read of the same result for `<Loading>` users: throws Solid's
|
|
66
|
+
* not-ready protocol until the query has delivered its first real result
|
|
67
|
+
* (or errored, in which case it returns the empty value and `error()` is
|
|
68
|
+
* set). Read this inside a `<Loading>` boundary.
|
|
69
|
+
*/
|
|
70
|
+
ready: Accessor<TData>;
|
|
71
|
+
error: Accessor<Error | undefined>;
|
|
72
|
+
/**
|
|
73
|
+
* True only on a COLD first load: nothing has painted for this identity,
|
|
74
|
+
* the server has not answered yet, and registration has not failed. A query
|
|
75
|
+
* that painted from the local cache is not loading, however long the server
|
|
76
|
+
* takes; a query the server answered with zero rows is not loading either
|
|
77
|
+
* (see `isEmpty`). Resets when the query identity changes.
|
|
78
|
+
*/
|
|
79
|
+
isLoading: Accessor<boolean>;
|
|
80
|
+
/** True while a fetch cycle is in flight (registration, a sync round). */
|
|
81
|
+
isFetching: Accessor<boolean>;
|
|
82
|
+
/**
|
|
83
|
+
* True once server membership is known for this identity: a registration or
|
|
84
|
+
* poll landed, or the durable membership of a previous session was read on
|
|
85
|
+
* boot. From then on `data()` is the server's answer, not a cache guess.
|
|
86
|
+
* Latched until the identity changes (or a bucket switch resets it).
|
|
87
|
+
*/
|
|
88
|
+
isAuthoritative: Accessor<boolean>;
|
|
89
|
+
/** Whether `data()` currently holds anything: rows for a list, a row for `one()`. */
|
|
90
|
+
hasData: Accessor<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* The server answered and the answer is "no rows". The signal to render an
|
|
93
|
+
* empty state on; a bare `!hasData()` cannot tell empty from not-yet-loaded.
|
|
94
|
+
*/
|
|
95
|
+
isEmpty: Accessor<boolean>;
|
|
96
|
+
/**
|
|
97
|
+
* True once server membership is known AND no fetch cycle is in flight.
|
|
98
|
+
* While settled, results are authoritative: a windowed query returning fewer
|
|
99
|
+
* rows than its LIMIT really is the end of the list. Not monotonic: a later
|
|
100
|
+
* sync round re-enters `isFetching`; latch it if a verdict must stick.
|
|
101
|
+
*/
|
|
102
|
+
isSettled: Accessor<boolean>;
|
|
103
|
+
};
|
|
104
|
+
declare function createQuery<S extends SchemaStructure, TableName extends TableNames$1<S>, T extends {
|
|
105
|
+
columns: Record<string, ColumnSchema>;
|
|
106
|
+
}, RelatedFields extends Record<string, any>, IsOne extends boolean, TData = QueryResult$1<S, TableName, RelatedFields, IsOne> | null>(finalQuery: QueryArg<S, TableName, T, RelatedFields, IsOne>, options?: QueryOptions): CreateQueryResult<TData>;
|
|
107
|
+
declare function createQuery<S extends SchemaStructure, TableName extends TableNames$1<S>, T extends {
|
|
108
|
+
columns: Record<string, ColumnSchema>;
|
|
109
|
+
}, RelatedFields extends Record<string, any>, IsOne extends boolean, TData = QueryResult$1<S, TableName, RelatedFields, IsOne> | null>(db: SyncedDb<S>, finalQuery: QueryArg<S, TableName, T, RelatedFields, IsOne>, options?: QueryOptions): CreateQueryResult<TData>;
|
|
110
|
+
/** @deprecated Renamed `createQuery` in the Solid 2 binding. */
|
|
111
|
+
declare const useQuery: typeof createQuery;
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/lib/create-preload.d.ts
|
|
114
|
+
type PreloadArg<S extends SchemaStructure, TableName extends TableNames$1<S>, T extends {
|
|
115
|
+
columns: Record<string, ColumnSchema>;
|
|
116
|
+
}, RelatedFields extends Record<string, any>, IsOne extends boolean> = FinalQuery<S, TableName, T, RelatedFields, IsOne, Sp00kyQueryResultPromise> | (() => FinalQuery<S, TableName, T, RelatedFields, IsOne, Sp00kyQueryResultPromise> | null | undefined);
|
|
117
|
+
type PreloadOptions$2 = PreloadOptions$1 & {
|
|
118
|
+
/** Only preload while this returns true (defaults to always). */
|
|
119
|
+
enabled?: () => boolean;
|
|
120
|
+
};
|
|
121
|
+
declare function createPreload<S extends SchemaStructure, TableName extends TableNames$1<S>, T extends {
|
|
122
|
+
columns: Record<string, ColumnSchema>;
|
|
123
|
+
}, RelatedFields extends Record<string, any>, IsOne extends boolean>(finalQuery: PreloadArg<S, TableName, T, RelatedFields, IsOne>, options?: PreloadOptions$2): void;
|
|
124
|
+
declare function createPreload<S extends SchemaStructure, TableName extends TableNames$1<S>, T extends {
|
|
125
|
+
columns: Record<string, ColumnSchema>;
|
|
126
|
+
}, RelatedFields extends Record<string, any>, IsOne extends boolean>(db: SyncedDb<S>, finalQuery: PreloadArg<S, TableName, T, RelatedFields, IsOne>, options?: PreloadOptions$2): void;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/lib/use-sync-status.d.ts
|
|
129
|
+
interface UseSyncStatus {
|
|
130
|
+
/** Full health snapshot; updates reactively on every transition. */
|
|
131
|
+
health: Accessor<SyncHealth$1>;
|
|
132
|
+
/** `'healthy'` | `'degraded'`. */
|
|
133
|
+
status: Accessor<SyncHealthStatus$1>;
|
|
134
|
+
isHealthy: Accessor<boolean>;
|
|
135
|
+
/** `true` once sync has failed for a sustained run — drive a banner off this. */
|
|
136
|
+
isDegraded: Accessor<boolean>;
|
|
137
|
+
/** `true` once at least one sync round has succeeded this session. */
|
|
138
|
+
everConnected: Accessor<boolean>;
|
|
139
|
+
/**
|
|
140
|
+
* `true` only for a real lost connection: degraded AFTER a first successful
|
|
141
|
+
* sync. Stays `false` during the initial "connecting" phase (degraded but
|
|
142
|
+
* never reached the server yet), so an indicator can show nothing until the
|
|
143
|
+
* app has actually connected once.
|
|
144
|
+
*/
|
|
145
|
+
isOffline: Accessor<boolean>;
|
|
146
|
+
/**
|
|
147
|
+
* Transport state of the remote WebSocket. Flips the instant the socket
|
|
148
|
+
* drops, unlike `status`, which only degrades after a sustained run of failed
|
|
149
|
+
* sync rounds — so this is what to drive a "reconnecting…" affordance off.
|
|
150
|
+
*/
|
|
151
|
+
connection: Accessor<ConnectionState$1>;
|
|
152
|
+
/**
|
|
153
|
+
* `true` while the connection is being re-established. Usually still
|
|
154
|
+
* `isHealthy()`: a short reconnect is invisible to sync, and writes made
|
|
155
|
+
* during it are queued locally and pushed once the socket is back.
|
|
156
|
+
*/
|
|
157
|
+
isReconnecting: Accessor<boolean>;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Observe sync health for a "can't reach the server" banner / indicator.
|
|
161
|
+
*
|
|
162
|
+
* Backed by `db.subscribeToSyncHealth`. Individual sync failures (a transient
|
|
163
|
+
* remote 500 on query registration, a dropped socket) are absorbed by the
|
|
164
|
+
* retry and never flip this; `isDegraded()` only goes true once failures
|
|
165
|
+
* persist for the configured number of consecutive rounds (sp00ky core config
|
|
166
|
+
* `syncHealth.degradeAfterConsecutiveFailures`, default 3), and flips back on
|
|
167
|
+
* the next successful round. Must be used within a `<Sp00kyProvider>`.
|
|
168
|
+
*/
|
|
169
|
+
declare function useSyncStatus(): UseSyncStatus;
|
|
170
|
+
//# sourceMappingURL=use-sync-status.d.ts.map
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/lib/use-sync-activity.d.ts
|
|
173
|
+
interface UseSyncActivityOptions {
|
|
174
|
+
/**
|
|
175
|
+
* How long queries must be fetching before `isDownloading()` turns on.
|
|
176
|
+
* Filters the sub-frame fetches a warm cache produces, so the indicator only
|
|
177
|
+
* shows work the user could notice. Default 200 ms.
|
|
178
|
+
*/
|
|
179
|
+
downloadDelayMs?: number;
|
|
180
|
+
/**
|
|
181
|
+
* `isUploading()` turns on once MORE than this many mutations are waiting in
|
|
182
|
+
* the outbox. Default 1: a single write acknowledged within a round trip is
|
|
183
|
+
* not worth an animation; a backlog is.
|
|
184
|
+
*/
|
|
185
|
+
uploadThreshold?: number;
|
|
186
|
+
}
|
|
187
|
+
interface UseSyncActivity {
|
|
188
|
+
/** Queries inside a fetch cycle right now (core `fetchingQueryCount`). */
|
|
189
|
+
fetchingQueries: Accessor<number>;
|
|
190
|
+
/** Locally committed writes the server has not acknowledged yet. */
|
|
191
|
+
pendingMutations: Accessor<number>;
|
|
192
|
+
/** Fetching for longer than `downloadDelayMs`. Drives a "downloading" mark. */
|
|
193
|
+
isDownloading: Accessor<boolean>;
|
|
194
|
+
/** More than `uploadThreshold` writes queued. Drives an "uploading" mark. */
|
|
195
|
+
isUploading: Accessor<boolean>;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The two directions of sync traffic, for an indicator in the app chrome.
|
|
199
|
+
*
|
|
200
|
+
* `fetchingQueries` is one subscription on the engine's aggregate fetch count,
|
|
201
|
+
* not one per query; `pendingMutations` is the outbox depth. `isDownloading`
|
|
202
|
+
* is the fetch count debounced ON by `downloadDelayMs` (and off at once), so a
|
|
203
|
+
* local-first page that answers from cache and confirms with the server in a
|
|
204
|
+
* few milliseconds never flickers. Must be used within a `<Sp00kyProvider>`, or
|
|
205
|
+
* pass the `SyncedDb` explicitly.
|
|
206
|
+
*/
|
|
207
|
+
declare function useSyncActivity<S extends SchemaStructure = any>(dbOrOptions?: SyncedDb<S> | UseSyncActivityOptions, maybeOptions?: UseSyncActivityOptions): UseSyncActivity;
|
|
208
|
+
//# sourceMappingURL=use-sync-activity.d.ts.map
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/lib/use-storage-status.d.ts
|
|
211
|
+
interface UseStorageStatus {
|
|
212
|
+
/** Full durability snapshot; updates reactively. */
|
|
213
|
+
health: Accessor<StorageHealth$1>;
|
|
214
|
+
/** `'unknown'` | `'persistent'` | `'memory'`. */
|
|
215
|
+
status: Accessor<StorageHealthStatus$1>;
|
|
216
|
+
/** `true` when the local store survives a reload. */
|
|
217
|
+
isPersistent: Accessor<boolean>;
|
|
218
|
+
/**
|
|
219
|
+
* `true` only when durable storage was requested and could NOT be opened, so
|
|
220
|
+
* the dataset is sitting in RAM and local writes die on reload. Drive a
|
|
221
|
+
* warning off this, not off `status`: a store configured as in-memory reports
|
|
222
|
+
* `'memory'` too, and that is a choice rather than a problem.
|
|
223
|
+
*/
|
|
224
|
+
isMemoryFallback: Accessor<boolean>;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Observe how durable the LOCAL cache is, for a "no local storage" warning.
|
|
228
|
+
*
|
|
229
|
+
* Under `localEngine: 'sqlite'` with `store: 'indexeddb'` the durable store is
|
|
230
|
+
* the OPFS SAHPool VFS, and only ONE client per bucket can hold it open: a
|
|
231
|
+
* second tab of the same app cannot get it and runs in memory instead (the
|
|
232
|
+
* engine retries first, so a closing tab's lock is usually waited out). Must be
|
|
233
|
+
* used within a `<Sp00kyProvider>`.
|
|
234
|
+
*/
|
|
235
|
+
declare function useStorageStatus(): UseStorageStatus;
|
|
236
|
+
//# sourceMappingURL=use-storage-status.d.ts.map
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/lib/use-crdt-field.d.ts
|
|
239
|
+
declare function useCrdtField(table: string, recordId: () => string | undefined, field: string, fallbackText?: () => string | undefined): Accessor<CrdtField | null>;
|
|
240
|
+
//# sourceMappingURL=use-crdt-field.d.ts.map
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/lib/use-feature-flag.d.ts
|
|
243
|
+
interface UseFeatureFlag {
|
|
244
|
+
variant: Accessor<string | undefined>;
|
|
245
|
+
payload: Accessor<unknown | undefined>;
|
|
246
|
+
enabled: Accessor<boolean>;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Subscribe to a feature flag for the currently authenticated user.
|
|
250
|
+
*
|
|
251
|
+
* Returns three Solid accessors that update reactively whenever the
|
|
252
|
+
* server-materialized assignment in `_00_user_feature` changes. Backed by
|
|
253
|
+
* the same SSP + sync pipeline that powers `createQuery`, so toggling a flag
|
|
254
|
+
* via `spky flag enable <key>` propagates to the UI without a refresh.
|
|
255
|
+
*
|
|
256
|
+
* `enabled()` is `true` when the resolved variant exists and is not 'off'.
|
|
257
|
+
* For multi-variant flags, prefer `variant()` directly.
|
|
258
|
+
*/
|
|
259
|
+
declare function useFeatureFlag(key: string, options?: FeatureFlagOptions): UseFeatureFlag;
|
|
260
|
+
//# sourceMappingURL=use-feature-flag.d.ts.map
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/lib/use-app-release.d.ts
|
|
263
|
+
interface UseAppReleaseOptions extends AppReleaseOptions {
|
|
264
|
+
/** App name from sp00ky.yml, e.g. `web`. */
|
|
265
|
+
app: string;
|
|
266
|
+
/**
|
|
267
|
+
* The running build's version (X.Y.Z), typically baked in at build time
|
|
268
|
+
* (e.g. a vite `define` from package.json). `updateAvailable()` is true when
|
|
269
|
+
* the announced release is semver-newer than this.
|
|
270
|
+
*/
|
|
271
|
+
currentVersion: string;
|
|
272
|
+
}
|
|
273
|
+
interface UseAppRelease {
|
|
274
|
+
/** Latest announced version for the app, or undefined when no row exists. */
|
|
275
|
+
latestVersion: Accessor<string | undefined>;
|
|
276
|
+
/** Announced version is semver-newer than the running build. */
|
|
277
|
+
updateAvailable: Accessor<boolean>;
|
|
278
|
+
/** The newer release asks clients to update/reload without prompting. */
|
|
279
|
+
mandatory: Accessor<boolean>;
|
|
280
|
+
/** The newer release asks reloads to clear service-worker caches first. */
|
|
281
|
+
cacheBust: Accessor<boolean>;
|
|
282
|
+
/**
|
|
283
|
+
* Reload onto the announced release. Plain `location.reload()` normally;
|
|
284
|
+
* when the release is flagged cache-bust, CacheStorage is cleared, the
|
|
285
|
+
* service-worker registration is nudged to update, and navigation carries a
|
|
286
|
+
* `?cb=` token to punch through intermediary caches. The service worker is
|
|
287
|
+
* deliberately NOT unregistered: navigating while still controlled by a
|
|
288
|
+
* just-unregistered worker strands subresource fetches on the dead worker
|
|
289
|
+
* and the page hangs until a manual reload.
|
|
290
|
+
*/
|
|
291
|
+
reload: () => Promise<void>;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Observe the app's announced release (`_00_app_release:<app>`, written by
|
|
295
|
+
* `spky deploy` / `spky release`) and compare it against the running build.
|
|
296
|
+
*
|
|
297
|
+
* Typical use: mount a small "new version available — Reload" notification
|
|
298
|
+
* gated on `updateAvailable()`, auto-invoking `reload()` when `mandatory()`
|
|
299
|
+
* (guard the auto path against reload loops with a per-version marker, since
|
|
300
|
+
* a client can reload while the deploy is still rolling out and land on the
|
|
301
|
+
* old bundle again).
|
|
302
|
+
*/
|
|
303
|
+
declare function useAppRelease(options: UseAppReleaseOptions): UseAppRelease;
|
|
304
|
+
//# sourceMappingURL=use-app-release.d.ts.map
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/lib/use-file-upload.d.ts
|
|
307
|
+
interface FileUploadResult {
|
|
308
|
+
isUploading: () => boolean;
|
|
309
|
+
error: () => Error | null;
|
|
310
|
+
clearError: () => void;
|
|
311
|
+
upload: (path: string, file: File | Blob, options?: BucketPutOptions) => Promise<BucketPutResult | void>;
|
|
312
|
+
download: (path: string) => Promise<string | null>;
|
|
313
|
+
remove: (path: string) => Promise<void>;
|
|
314
|
+
exists: (path: string) => Promise<boolean>;
|
|
315
|
+
}
|
|
316
|
+
declare function useFileUpload<S extends SchemaStructure>(bucketName: BucketNames<S>): FileUploadResult;
|
|
317
|
+
declare function useFileUpload<S extends SchemaStructure>(db: SyncedDb<S>, bucketName: BucketNames<S>): FileUploadResult;
|
|
318
|
+
//# sourceMappingURL=use-file-upload.d.ts.map
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/lib/use-download-file.d.ts
|
|
321
|
+
interface UseDownloadFileOptions {
|
|
322
|
+
/**
|
|
323
|
+
* Master switch, default `true`. `false` gives every hook instance its own
|
|
324
|
+
* private object URL fetched fresh from the bucket and revoked on unmount —
|
|
325
|
+
* no sharing, no persistence, no reuse.
|
|
326
|
+
*/
|
|
327
|
+
cache?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Keep the bytes in OPFS so they survive a reload and are available offline.
|
|
330
|
+
* Default `true`. Turn off for one-shot or sensitive files; the in-tab object
|
|
331
|
+
* URL is still shared between components rendering the same path.
|
|
332
|
+
*/
|
|
333
|
+
persist?: boolean;
|
|
334
|
+
/** Exempt this file from pressure eviction. Pinned bytes never expire. */
|
|
335
|
+
pin?: boolean;
|
|
336
|
+
/**
|
|
337
|
+
* `'never'` (default) treats a bucket path as immutable, which is how paths
|
|
338
|
+
* are written (`crypto.randomUUID() + ext`). `'head'` spends a remote `head()`
|
|
339
|
+
* to compare sizes before trusting the cached copy — for paths the app
|
|
340
|
+
* overwrites in place.
|
|
341
|
+
*/
|
|
342
|
+
revalidate?: 'never' | 'head';
|
|
343
|
+
}
|
|
344
|
+
interface UseDownloadFileResult {
|
|
345
|
+
url: Accessor<string | null>;
|
|
346
|
+
isLoading: Accessor<boolean>;
|
|
347
|
+
error: Accessor<Error | null>;
|
|
348
|
+
refetch: () => void;
|
|
349
|
+
}
|
|
350
|
+
declare function useDownloadFile<S extends SchemaStructure>(bucketName: BucketNames<S>, path: Accessor<string | null | undefined>, options?: UseDownloadFileOptions): UseDownloadFileResult;
|
|
351
|
+
declare function useDownloadFile<S extends SchemaStructure>(db: SyncedDb<S>, bucketName: BucketNames<S>, path: Accessor<string | null | undefined>, options?: UseDownloadFileOptions): UseDownloadFileResult;
|
|
352
|
+
//# sourceMappingURL=use-download-file.d.ts.map
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region src/lib/use-blurhash.d.ts
|
|
355
|
+
interface UseBlurhashResult {
|
|
356
|
+
/** The stored blurhash for the path, or null while loading / when none exists. */
|
|
357
|
+
hash: Accessor<string | null>;
|
|
358
|
+
isLoading: Accessor<boolean>;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* The blurhash sidecar for a bucket image (written automatically by
|
|
362
|
+
* `bucket.put`, see `Sp00kyConfig.blurhash`). Resolves from OPFS instantly on
|
|
363
|
+
* warm clients; a miss is remembered per tab. Use this directly when the hash
|
|
364
|
+
* belongs to a different rendition than the displayed image; otherwise
|
|
365
|
+
* `useBucketImage` / `BucketImage` bundle it with the download.
|
|
366
|
+
*/
|
|
367
|
+
declare function useBlurhash<S extends SchemaStructure>(bucketName: BucketNames<S>, path: Accessor<string | null | undefined>): UseBlurhashResult;
|
|
368
|
+
declare function useBlurhash<S extends SchemaStructure>(db: SyncedDb<S>, bucketName: BucketNames<S>, path: Accessor<string | null | undefined>): UseBlurhashResult;
|
|
369
|
+
//# sourceMappingURL=use-blurhash.d.ts.map
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region src/lib/use-bucket-image.d.ts
|
|
372
|
+
interface UseBucketImageOptions extends UseDownloadFileOptions {
|
|
373
|
+
/**
|
|
374
|
+
* Also resolve the image's blurhash sidecar (see `Sp00kyConfig.blurhash`).
|
|
375
|
+
* Default `true`; the read is registered before the image bytes so the tiny
|
|
376
|
+
* sidecar tends to land first on the serialized remote chain.
|
|
377
|
+
*/
|
|
378
|
+
blurhash?: boolean;
|
|
379
|
+
}
|
|
380
|
+
interface UseBucketImageResult extends UseDownloadFileResult {
|
|
381
|
+
/** Blurhash for the same path, or null (off, missing, still loading). */
|
|
382
|
+
blurhash: Accessor<string | null>;
|
|
383
|
+
/** True once the current `url()` has been decoded and is safe to paint. */
|
|
384
|
+
ready: Accessor<boolean>;
|
|
385
|
+
/**
|
|
386
|
+
* Ref callback for the `<img>` rendering `url()`: flips `ready` when the
|
|
387
|
+
* bitmap is decoded (resolves on failure too, so a broken blob degrades to
|
|
388
|
+
* paint-on-load instead of hiding the image forever). Re-arms itself when
|
|
389
|
+
* the url changes.
|
|
390
|
+
*/
|
|
391
|
+
gate: (img: HTMLImageElement) => void;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Everything needed to render a bucket image without a pop-in: the refcounted
|
|
395
|
+
* object URL, the blurhash placeholder, and a decode gate so the real bitmap
|
|
396
|
+
* is only revealed once it can paint in full. `BucketImage` wraps this into a
|
|
397
|
+
* drop-in component; use the hook for custom markup.
|
|
398
|
+
*/
|
|
399
|
+
declare function useBucketImage<S extends SchemaStructure>(bucketName: BucketNames<S>, path: Accessor<string | null | undefined>, options?: UseBucketImageOptions): UseBucketImageResult;
|
|
400
|
+
declare function useBucketImage<S extends SchemaStructure>(db: SyncedDb<S>, bucketName: BucketNames<S>, path: Accessor<string | null | undefined>, options?: UseBucketImageOptions): UseBucketImageResult;
|
|
401
|
+
//# sourceMappingURL=use-bucket-image.d.ts.map
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/lib/Blurhash.d.ts
|
|
404
|
+
interface BlurhashProps {
|
|
405
|
+
/** The blurhash string. Nullish paints nothing (transparent canvas). */
|
|
406
|
+
hash: string | null | undefined;
|
|
407
|
+
/** Decode resolution. 32x32 is plenty: blurhash carries at most 9x9 DCT
|
|
408
|
+
* components, the canvas is meant to be CSS-scaled to fill. */
|
|
409
|
+
width?: number;
|
|
410
|
+
height?: number;
|
|
411
|
+
/** Contrast punch, see the blurhash reference decoder. Defaults to 1. */
|
|
412
|
+
punch?: number;
|
|
413
|
+
class?: string;
|
|
414
|
+
style?: string;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* A blurhash painted onto a canvas, once per hash change. Size the canvas via
|
|
418
|
+
* `class`/`style` (e.g. `absolute inset-0 w-full h-full`); the internal decode
|
|
419
|
+
* resolution stays tiny regardless of the displayed size.
|
|
420
|
+
*/
|
|
421
|
+
declare function Blurhash(props: BlurhashProps): Element;
|
|
422
|
+
//# sourceMappingURL=Blurhash.d.ts.map
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/lib/BucketImage.d.ts
|
|
425
|
+
interface BucketImageProps {
|
|
426
|
+
/** Bucket name from the schema. */
|
|
427
|
+
bucket: string;
|
|
428
|
+
/** Path within the bucket. Nullish renders only the fallback layers. */
|
|
429
|
+
path: string | null | undefined;
|
|
430
|
+
alt?: string;
|
|
431
|
+
/** Classes for the container element (sizing/positioning). */
|
|
432
|
+
class?: string;
|
|
433
|
+
/** Classes for the inner `<img>` (the layout styles are inline). */
|
|
434
|
+
imgClass?: string;
|
|
435
|
+
/** `object-fit` for the image. Defaults to `cover`. */
|
|
436
|
+
fit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
437
|
+
/**
|
|
438
|
+
* Bottom placeholder layer (your own plate/skeleton), shown until the image
|
|
439
|
+
* settles. The blurhash layer paints on top of it once the sidecar resolves.
|
|
440
|
+
*/
|
|
441
|
+
fallback?: Element;
|
|
442
|
+
/** Crossfade duration in ms. Defaults to 300. */
|
|
443
|
+
transition?: number;
|
|
444
|
+
/** Crossfade easing. Defaults to an ease-out-expo curve. */
|
|
445
|
+
easing?: string;
|
|
446
|
+
/** Resolve the blurhash sidecar. Defaults to true. */
|
|
447
|
+
blurhash?: boolean;
|
|
448
|
+
/** Download tuning, forwarded to the underlying `useDownloadFile`. */
|
|
449
|
+
options?: UseBucketImageOptions;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* A bucket image that never pops in: it layers (bottom to top) your `fallback`
|
|
453
|
+
* plate, the automatically stored blurhash, and the real image, which stays
|
|
454
|
+
* transparent until the bitmap is DECODED and then crossfades over the
|
|
455
|
+
* placeholders. Placeholder layers unmount once the fade settles. Respects
|
|
456
|
+
* prefers-reduced-motion (instant swap). The container is made
|
|
457
|
+
* `position: relative` unless your `class` positions it already.
|
|
458
|
+
*
|
|
459
|
+
* ```tsx
|
|
460
|
+
* <BucketImage bucket="covers" path={row.cover_key} class="absolute inset-0"
|
|
461
|
+
* fallback={<MyPlate />} alt="" />
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
declare function BucketImage(props: BucketImageProps): Element;
|
|
465
|
+
//# sourceMappingURL=BucketImage.d.ts.map
|
|
466
|
+
//#endregion
|
|
467
|
+
//#region src/lib/Sp00kyProvider.d.ts
|
|
468
|
+
interface Sp00kyProviderProps<S extends SchemaStructure> {
|
|
469
|
+
config: SyncedDbConfig<S>;
|
|
470
|
+
fallback?: Element;
|
|
471
|
+
onError?: (error: Error) => void;
|
|
472
|
+
onReady?: (db: SyncedDb<S>) => void;
|
|
473
|
+
/**
|
|
474
|
+
* Prewarm data into the local cache before revealing the UI. Runs after
|
|
475
|
+
* `init()`; the `fallback` stays visible until it resolves. Use awaitable
|
|
476
|
+
* `db.preload(...)` calls here to gate first-load on essential data (e.g.
|
|
477
|
+
* config). On warm loads preload returns instantly, so there's no perceptible
|
|
478
|
+
* gate after the first run. Best-effort: a rejection is caught and the UI is
|
|
479
|
+
* revealed anyway.
|
|
480
|
+
*/
|
|
481
|
+
preload?: (db: SyncedDb<S>) => Promise<void>;
|
|
482
|
+
children: Element;
|
|
483
|
+
}
|
|
484
|
+
declare function Sp00kyProvider<S extends SchemaStructure>(props: Sp00kyProviderProps<S>): Element;
|
|
485
|
+
//# sourceMappingURL=Sp00kyProvider.d.ts.map
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region src/lib/context.d.ts
|
|
488
|
+
declare function useDb<S extends SchemaStructure>(): SyncedDb<S>;
|
|
489
|
+
/**
|
|
490
|
+
* Count of locally-committed mutations not yet acknowledged by the server.
|
|
491
|
+
* Drive an "unsaved changes" indicator off this.
|
|
492
|
+
*/
|
|
493
|
+
declare function usePendingMutations(): Accessor<number>;
|
|
494
|
+
//# sourceMappingURL=context.d.ts.map
|
|
495
|
+
//#endregion
|
|
496
|
+
//#region src/lib/create-submission.d.ts
|
|
497
|
+
interface Submission<Args extends unknown[], R> {
|
|
498
|
+
/** Run the wrapped async fn. Concurrent submits share the pending flag. */
|
|
499
|
+
submit: (...args: Args) => Promise<R | undefined>;
|
|
500
|
+
/** True while at least one submit is in flight. */
|
|
501
|
+
pending: Accessor<boolean>;
|
|
502
|
+
/** Error from the most recent settled submit, cleared on the next submit. */
|
|
503
|
+
error: Accessor<Error | undefined>;
|
|
504
|
+
/** Result of the most recent successful submit. */
|
|
505
|
+
result: Accessor<R | undefined>;
|
|
506
|
+
clearError: () => void;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Thin submission-state wrapper for mutations — button spinner/disable state
|
|
510
|
+
* around `db.create/update/delete/run` calls.
|
|
511
|
+
*
|
|
512
|
+
* Deliberately NOT built on Solid 2's `action()`/`createOptimisticStore`: the
|
|
513
|
+
* spooky engine is already optimistic local-first (writes commit to the local
|
|
514
|
+
* DB and re-render through live queries before sync; `run()` is an outbox
|
|
515
|
+
* CREATE), so a transaction/revert layer on top buys nothing and `action()`'s
|
|
516
|
+
* await-vs-yield transaction escape is a real footgun. Errors here mean the
|
|
517
|
+
* LOCAL commit failed — sync/push failures surface through `useSyncStatus`
|
|
518
|
+
* and `usePendingMutations` instead.
|
|
519
|
+
*/
|
|
520
|
+
declare function createSubmission<Args extends unknown[], R>(fn: (...args: Args) => Promise<R>): Submission<Args, R>;
|
|
521
|
+
//# sourceMappingURL=create-submission.d.ts.map
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region src/lib/conflate.d.ts
|
|
524
|
+
/**
|
|
525
|
+
* Latest-wins async iterable over a subscribe-callback source.
|
|
526
|
+
*
|
|
527
|
+
* Bridges spooky's push-callback subscriptions into the AsyncIterable shape
|
|
528
|
+
* Solid 2 computations consume natively. Each spooky emission is a full result
|
|
529
|
+
* set, so intermediate values are droppable: only the newest unconsumed value
|
|
530
|
+
* is buffered, and a pending pull resolves with it immediately.
|
|
531
|
+
*
|
|
532
|
+
* Teardown contract (probed in rc-semantics.test.ts): Solid 2 does NOT
|
|
533
|
+
* terminate a superseded/disposed computation's async generator — no
|
|
534
|
+
* `return()`, no `finally`. Consumers MUST call `it.return()` themselves from
|
|
535
|
+
* an `onCleanup` registered synchronously in the compute scope. `return()`
|
|
536
|
+
* unsubscribes (awaiting the unsubscribe if the subscribe returned a promise,
|
|
537
|
+
* as `sp00ky.subscribe` does) and resolves any parked pull as done.
|
|
538
|
+
*/
|
|
539
|
+
declare function conflate<T>(subscribe: (cb: (v: T) => void) => (() => void) | Promise<() => void>): AsyncIterable<T>;
|
|
540
|
+
//# sourceMappingURL=conflate.d.ts.map
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region src/lib/from-subscription.d.ts
|
|
543
|
+
/**
|
|
544
|
+
* Reactive view over a spooky subscribe-callback API.
|
|
545
|
+
*
|
|
546
|
+
* The memo's async generator pulls from a conflated (latest-wins) iterator;
|
|
547
|
+
* `initial` is committed as the memo's `loadingValue`, so the accessor is
|
|
548
|
+
* readable synchronously from birth and never suspends. Spooky's subscribe
|
|
549
|
+
* APIs fire immediately with the current value, so the real value lands within
|
|
550
|
+
* a tick of the first read.
|
|
551
|
+
*
|
|
552
|
+
* Teardown is manual by contract (see conflate.ts): onCleanup terminates the
|
|
553
|
+
* iterator, which unsubscribes.
|
|
554
|
+
*/
|
|
555
|
+
declare function fromSubscription<T>(subscribe: (cb: (v: T) => void) => (() => void) | Promise<() => void>, initial: T): Accessor<T>;
|
|
556
|
+
//# sourceMappingURL=from-subscription.d.ts.map
|
|
557
|
+
|
|
558
|
+
//#endregion
|
|
559
|
+
//#region src/index.d.ts
|
|
560
|
+
type RelationshipField<Schema extends SchemaStructure, TableName extends TableNames<Schema>, Field extends RelationshipFieldsFromSchema<Schema, TableName>> = GetRelationship<Schema, TableName, Field>;
|
|
561
|
+
type RelatedFieldsTableScoped<Schema extends SchemaStructure, TableName extends TableNames<Schema>, RelatedFields extends RelationshipFieldsFromSchema<Schema, TableName> = RelationshipFieldsFromSchema<Schema, TableName>> = { [K in RelatedFields]: {
|
|
562
|
+
to: RelationshipField<Schema, TableName, K>['to'];
|
|
563
|
+
relatedFields: RelatedFieldsMap;
|
|
564
|
+
cardinality: RelationshipField<Schema, TableName, K>['cardinality'];
|
|
565
|
+
} };
|
|
566
|
+
type InferModel<Schema extends SchemaStructure, TableName extends TableNames<Schema>, RelatedFields extends RelatedFieldsTableScoped<Schema, TableName>> = QueryResult<Schema, TableName, RelatedFields, true>;
|
|
567
|
+
type WithRelated<Field extends string, RelatedFields extends RelatedFieldsMap = {}> = { [K in Field]: Omit<RelatedFieldMapEntry, 'relatedFields'> & {
|
|
568
|
+
relatedFields: RelatedFields;
|
|
569
|
+
} };
|
|
570
|
+
type WithRelatedMany<Field extends string, RelatedFields extends RelatedFieldsMap = {}> = { [K in Field]: {
|
|
571
|
+
to: Field;
|
|
572
|
+
relatedFields: RelatedFields;
|
|
573
|
+
cardinality: 'many';
|
|
574
|
+
} };
|
|
575
|
+
declare class SyncedDb<S extends SchemaStructure> {
|
|
576
|
+
private config;
|
|
577
|
+
private sp00ky;
|
|
578
|
+
private _initialized;
|
|
579
|
+
constructor(config: SyncedDbConfig<S>);
|
|
580
|
+
getSp00ky(): Sp00kyClient<S>;
|
|
581
|
+
/**
|
|
582
|
+
* Initialize the sp00ky-ts instance
|
|
583
|
+
*/
|
|
584
|
+
init(): Promise<void>;
|
|
585
|
+
/**
|
|
586
|
+
* Tear down the client: leaves the tabs broker, closes the local store and
|
|
587
|
+
* remote socket, and frees the wasm circuit. Without this a remounted provider
|
|
588
|
+
* (or an HMR reload) strands a whole client, and the abandoned wasm heaps stay
|
|
589
|
+
* resident because V8 cannot see how much wasm memory a dropped wrapper holds.
|
|
590
|
+
*/
|
|
591
|
+
close(): Promise<void>;
|
|
592
|
+
/**
|
|
593
|
+
* Create a new record in the database
|
|
594
|
+
*/
|
|
595
|
+
create(id: string, payload: Record<string, unknown>): Promise<void>;
|
|
596
|
+
/**
|
|
597
|
+
* Update an existing record in the database
|
|
598
|
+
*/
|
|
599
|
+
update<TName extends TableNames<S>>(tableName: TName, recordId: string, payload: Partial<TableModel<GetTable<S, TName>>>, options?: UpdateOptions): Promise<void>;
|
|
600
|
+
/**
|
|
601
|
+
* Delete an existing record in the database
|
|
602
|
+
*/
|
|
603
|
+
delete<TName extends TableNames<S>>(tableName: TName, selector: string | RecordId | InnerQuery<GetTable<S, TName>, boolean>): Promise<void>;
|
|
604
|
+
/**
|
|
605
|
+
* Preload/prewarm a built query into the local cache without registering a
|
|
606
|
+
* live view. Fetches once and stores the rows (+ embedded related children)
|
|
607
|
+
* locally so a later `createQuery` for the same data paints instantly. Best-effort.
|
|
608
|
+
*/
|
|
609
|
+
preload(finalQuery: FinalQuery<S, any, any, any, any, Sp00kyQueryResultPromise>, options?: PreloadOptions$1): Promise<void>;
|
|
610
|
+
/**
|
|
611
|
+
* Query data from the database
|
|
612
|
+
*/
|
|
613
|
+
query<TName extends TableNames<S>>(table: TName): QueryBuilder<S, TName, Sp00kyQueryResultPromise, {}, false>;
|
|
614
|
+
/**
|
|
615
|
+
* Run a backend operation
|
|
616
|
+
*/
|
|
617
|
+
run<B extends BackendNames<S>, R extends BackendRoutes<S, B>>(backend: B, path: R, payload: RoutePayload<S, B, R>, options?: RunOptions): Promise<void>;
|
|
618
|
+
/**
|
|
619
|
+
* Sign out, clear session and local storage
|
|
620
|
+
*/
|
|
621
|
+
signOut(): Promise<void>;
|
|
622
|
+
/**
|
|
623
|
+
* Execute a function with direct access to the remote database connection
|
|
624
|
+
*/
|
|
625
|
+
useRemote<T>(fn: (db: Surreal) => T | Promise<T>): Promise<T>;
|
|
626
|
+
/**
|
|
627
|
+
* Access the remote database service directly
|
|
628
|
+
*/
|
|
629
|
+
get remote(): Sp00kyClient<S>['remoteClient'];
|
|
630
|
+
/**
|
|
631
|
+
* Access the local database service directly
|
|
632
|
+
*/
|
|
633
|
+
get local(): Sp00kyClient<S>['localClient'];
|
|
634
|
+
/**
|
|
635
|
+
* Access the auth service
|
|
636
|
+
*/
|
|
637
|
+
get auth(): AuthService<S>;
|
|
638
|
+
get pendingMutationCount(): number;
|
|
639
|
+
/** Diagnostic — see `Sp00kyClient.liveRetryCount`. */
|
|
640
|
+
get liveRetryCount(): number;
|
|
641
|
+
subscribeToPendingMutations(cb: (count: number) => void): () => void;
|
|
642
|
+
/** Queries mid-fetch right now. See {@link useSyncActivity}. */
|
|
643
|
+
get fetchingQueryCount(): number;
|
|
644
|
+
/**
|
|
645
|
+
* Observe how many queries are fetching from the server. Fires immediately
|
|
646
|
+
* and on every change. Prefer the `useSyncActivity` hook in components.
|
|
647
|
+
*/
|
|
648
|
+
subscribeToFetchActivity(cb: (fetching: number) => void): () => void;
|
|
649
|
+
/** Current sync-health snapshot. See {@link useSyncStatus}. */
|
|
650
|
+
get syncHealth(): SyncHealth$1;
|
|
651
|
+
/**
|
|
652
|
+
* Observe sync health. Fires immediately with the current status and again
|
|
653
|
+
* on every healthy↔degraded transition. Prefer the `useSyncStatus` hook in
|
|
654
|
+
* components; this is the imperative escape hatch.
|
|
655
|
+
*/
|
|
656
|
+
subscribeToSyncHealth(cb: (health: SyncHealth$1) => void): () => void;
|
|
657
|
+
/** Current local-store durability snapshot. See {@link useStorageStatus}. */
|
|
658
|
+
get storageHealth(): StorageHealth$1;
|
|
659
|
+
/**
|
|
660
|
+
* Observe local-store durability. Fires immediately with the current snapshot
|
|
661
|
+
* and again on change. Prefer the `useStorageStatus` hook in components; this
|
|
662
|
+
* is the imperative escape hatch.
|
|
663
|
+
*/
|
|
664
|
+
subscribeToStorageHealth(cb: (health: StorageHealth$1) => void): () => void;
|
|
665
|
+
bucket<B extends BucketNames<S>>(name: B): BucketHandle;
|
|
666
|
+
getBucketConfig(name: string): BucketDefinitionSchema | undefined;
|
|
667
|
+
}
|
|
668
|
+
//#endregion
|
|
669
|
+
export { Blurhash, type BlurhashProps, BucketImage, type BucketImageProps, CacheStrategy, type ConnectionState, type CreateQueryResult, type FileUploadResult, type GenericModel, type GenericSchema, type GetCardinality, type GetTable, InferModel, type InferRelatedModelFromMetadata, InferRelationshipsFromConst, InferSchemaFromConst, type Model, type ModelPayload, type PreloadOptions, type PreloadRefresh, ProvisionOptions, type QueryInfo, type QueryModifier, type QueryModifierBuilder, type QueryOptions, type QueryResult, type ReconnectConfig, RecordId, RelatedFieldsTableScoped, type RelationshipDefinition, RelationshipField, type RelationshipsMetadata, Sp00kyProvider, type Sp00kyProviderProps, type StorageHealth, type StorageHealthStatus, type Submission, type SyncHealth, type SyncHealthConfig, type SyncHealthStatus, SyncedDb, SyncedDbConfig, type TableModel, type TableNames, type UseAppRelease, type UseAppReleaseOptions, type UseBlurhashResult, type UseBucketImageOptions, type UseBucketImageResult, type UseDownloadFileOptions, type UseDownloadFileResult, type UseFeatureFlag, type UseStorageStatus, type UseSyncActivity, type UseSyncActivityOptions, type UseSyncStatus, Uuid, WithRelated, WithRelatedMany, conflate, createPreload, createQuery, createSubmission, fromSubscription, useAppRelease, useBlurhash, useBucketImage, useCrdtField, useDb, useDownloadFile, useFeatureFlag, useFileUpload, usePendingMutations, useQuery, useStorageStatus, useSyncActivity, useSyncStatus };
|
|
670
|
+
//# sourceMappingURL=index.d.ts.map
|