@spooky-sync/client-solid2 0.0.1-canary.259 → 0.0.1-canary.261
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 +1 -1
- package/dist/index.cjs +19 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +19 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/skills/sp00ky-solid2/SKILL.md +1 -1
- package/src/index.ts +1 -0
- package/src/lib/use-impersonation.ts +31 -0
package/AGENTS.md
CHANGED
|
@@ -46,7 +46,7 @@ Provider props are identical to client-solid: `config`, `fallback`, `preload` (a
|
|
|
46
46
|
- Options: `enabled?: () => boolean`, `deregisterOnCleanup?: boolean`.
|
|
47
47
|
- **`createSubmission(fn)`** — button pending/error state around a mutation: `submit()`, `pending()`, `error()`, `result()`, `clearError()`. There is deliberately no `action()` / `createOptimisticStore` layer (see `src/lib/create-submission.ts`).
|
|
48
48
|
- **`useSyncActivity(options?)`** — `{ fetchingQueries, pendingMutations, isDownloading, isUploading }`. One subscription on the engine's aggregate fetch count plus the outbox depth; both are debounced ON by their delay (`downloadDelayMs` 200, `uploadDelayMs` 150) and off at once, and `isUploading()` additionally needs `pendingMutations() > uploadThreshold` (0, so any unacknowledged write counts). Drive a logo/traffic indicator off it; pair with `useSyncStatus().connection()` / `.isOffline()` to switch the same mark to a reconnecting or offline state and show the unsaved count.
|
|
49
|
-
- **`createPreload`**, **`usePendingMutations`**, **`useSyncStatus`**, **`useStorageStatus`**, **`useFeatureFlag`**, **`useAppRelease`**, **`useCrdtField`**, **`useFileUpload`**, **`useDownloadFile`** — same shapes as client-solid.
|
|
49
|
+
- **`createPreload`**, **`usePendingMutations`**, **`useSyncStatus`**, **`useImpersonation`**, **`useStorageStatus`**, **`useFeatureFlag`**, **`useAppRelease`**, **`useCrdtField`**, **`useFileUpload`**, **`useDownloadFile`** — same shapes as client-solid.
|
|
50
50
|
- **`conflate`**, **`fromSubscription`** — the async-iterable helpers the hooks are built on; useful for wrapping other engine subscriptions.
|
|
51
51
|
|
|
52
52
|
## Mutations
|
package/dist/index.cjs
CHANGED
|
@@ -385,6 +385,24 @@ function useSyncStatus() {
|
|
|
385
385
|
};
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/lib/use-impersonation.ts
|
|
390
|
+
/**
|
|
391
|
+
* Observe admin impersonation (started from the DevTools). The client already
|
|
392
|
+
* shows its own warning bar with a Stop button; use this for anything extra,
|
|
393
|
+
* such as hiding actions an admin should not take on someone's behalf.
|
|
394
|
+
* Must be used within a `<Sp00kyProvider>`.
|
|
395
|
+
*/
|
|
396
|
+
function useImpersonation() {
|
|
397
|
+
const db = useDb();
|
|
398
|
+
const impersonation = fromSubscription((cb) => db.auth.subscribeImpersonation(cb), db.auth.impersonation);
|
|
399
|
+
return {
|
|
400
|
+
impersonation,
|
|
401
|
+
isImpersonating: () => impersonation() !== null,
|
|
402
|
+
stop: () => db.auth.stopImpersonating()
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
|
|
388
406
|
//#endregion
|
|
389
407
|
//#region src/lib/use-sync-activity.ts
|
|
390
408
|
/**
|
|
@@ -1310,6 +1328,7 @@ exports.useDb = useDb;
|
|
|
1310
1328
|
exports.useDownloadFile = useDownloadFile;
|
|
1311
1329
|
exports.useFeatureFlag = useFeatureFlag;
|
|
1312
1330
|
exports.useFileUpload = useFileUpload;
|
|
1331
|
+
exports.useImpersonation = useImpersonation;
|
|
1313
1332
|
exports.usePendingMutations = usePendingMutations;
|
|
1314
1333
|
exports.useQuery = useQuery;
|
|
1315
1334
|
exports.useStorageStatus = useStorageStatus;
|