@marktiderman/genesis-core 2.9.0 → 2.11.0
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 +164 -1
- package/dist/{chunk-LGTXQTHA.js → chunk-2VJQVAJD.js} +3 -3
- package/dist/{chunk-LGTXQTHA.js.map → chunk-2VJQVAJD.js.map} +1 -1
- package/dist/chunk-2WS4LGYU.js +47 -0
- package/dist/chunk-2WS4LGYU.js.map +1 -0
- package/dist/{chunk-X6EVE7W4.js → chunk-3B5O36DU.js} +112 -19
- package/dist/chunk-3B5O36DU.js.map +1 -0
- package/dist/{chunk-EHFYSJJA.js → chunk-42QPCDQF.js} +3 -3
- package/dist/{chunk-EHFYSJJA.js.map → chunk-42QPCDQF.js.map} +1 -1
- package/dist/{chunk-RK365SO2.js → chunk-AKF2RAGX.js} +8 -5
- package/dist/chunk-AKF2RAGX.js.map +1 -0
- package/dist/{chunk-4ZR7472O.js → chunk-LOJGHR5O.js} +4 -4
- package/dist/{chunk-4ZR7472O.js.map → chunk-LOJGHR5O.js.map} +1 -1
- package/dist/{chunk-ON2V4RXX.js → chunk-OC4OGB2K.js} +19 -11
- package/dist/chunk-OC4OGB2K.js.map +1 -0
- package/dist/{chunk-HQAVDVIH.js → chunk-POMTRNAL.js} +4 -4
- package/dist/{chunk-HQAVDVIH.js.map → chunk-POMTRNAL.js.map} +1 -1
- package/dist/{chunk-VDEW4AOS.js → chunk-PSFKIG27.js} +55 -6
- package/dist/chunk-PSFKIG27.js.map +1 -0
- package/dist/{chunk-37RWGNIO.js → chunk-VFT6QKZW.js} +114 -5
- package/dist/chunk-VFT6QKZW.js.map +1 -0
- package/dist/{chunk-IQVIHN7C.js → chunk-VJGU6E4U.js} +19 -13
- package/dist/chunk-VJGU6E4U.js.map +1 -0
- package/dist/{chunk-ZCE3CHPX.js → chunk-XVRIWP7B.js} +3 -3
- package/dist/{chunk-ZCE3CHPX.js.map → chunk-XVRIWP7B.js.map} +1 -1
- package/dist/{chunk-7FVTGKTX.js → chunk-YDMKMNDS.js} +2 -2
- package/dist/{chunk-7FVTGKTX.js.map → chunk-YDMKMNDS.js.map} +1 -1
- package/dist/{chunk-6WV6ST67.js → chunk-YNXLPOAB.js} +97 -10
- package/dist/chunk-YNXLPOAB.js.map +1 -0
- package/dist/{chunk-7GW3QR63.js → chunk-ZHC3MDCS.js} +101 -18
- package/dist/chunk-ZHC3MDCS.js.map +1 -0
- package/dist/conversation/index.d.ts +195 -0
- package/dist/conversation/index.js +110 -0
- package/dist/conversation/index.js.map +1 -0
- package/dist/csv.d.ts +1 -1
- package/dist/errors.js +1 -2
- package/dist/form-types.d.ts +1 -1
- package/dist/gallery/index.d.ts +79 -0
- package/dist/gallery/index.js +64 -0
- package/dist/gallery/index.js.map +1 -0
- package/dist/hooks/index.d.ts +5 -4
- package/dist/hooks/index.js +18 -18
- package/dist/hooks/mutation-mode.d.ts +29 -2
- package/dist/hooks/mutation-mode.js +9 -4
- package/dist/hooks/related-keys.d.ts +1 -1
- package/dist/hooks/use-capabilities.d.ts +1 -1
- package/dist/hooks/use-capabilities.js +2 -2
- package/dist/hooks/use-infinite-resource.d.ts +1 -1
- package/dist/hooks/use-infinite-resource.js +4 -4
- package/dist/hooks/use-link-options.d.ts +10 -2
- package/dist/hooks/use-link-options.js +6 -6
- package/dist/hooks/use-live.d.ts +1 -1
- package/dist/hooks/use-live.js +3 -3
- package/dist/hooks/use-one.d.ts +1 -1
- package/dist/hooks/use-one.js +4 -4
- package/dist/hooks/use-relation-label.d.ts +1 -1
- package/dist/hooks/use-relation-label.js +2 -2
- package/dist/hooks/use-resource-form.d.ts +20 -1
- package/dist/hooks/use-resource-form.js +12 -9
- package/dist/hooks/use-resource.d.ts +17 -3
- package/dist/hooks/use-resource.js +12 -8
- package/dist/hooks/use-write.d.ts +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.js +21 -21
- package/dist/offline/index.d.ts +84 -0
- package/dist/offline/index.js +413 -0
- package/dist/offline/index.js.map +1 -0
- package/dist/provider/index.d.ts +60 -7
- package/dist/provider/index.js +3 -3
- package/dist/resource-view/index.d.ts +113 -4
- package/dist/resource-view/index.js +183 -25
- package/dist/resource-view/index.js.map +1 -1
- package/dist/schema/index.d.ts +4 -3
- package/dist/schema/index.js +2 -1
- package/dist/testing/index.d.ts +2 -2
- package/dist/{types-r_Rlw7BB.d.ts → types-BzLv8yOm.d.ts} +22 -0
- package/dist/types-CsKSAKqs.d.ts +143 -0
- package/dist/{viewer-scope-bthEYSOB.d.ts → viewer-scope-Dx0N9AYk.d.ts} +3 -2
- package/dist/workspaces.d.ts +1 -1
- package/dist/{write-outcome-BWV34wh5.d.ts → write-outcome-DC5hORz-.d.ts} +1 -1
- package/dist/write-state-DVC4Yq9T.d.ts +58 -0
- package/package.json +15 -2
- package/dist/chunk-37RWGNIO.js.map +0 -1
- package/dist/chunk-6WV6ST67.js.map +0 -1
- package/dist/chunk-7GW3QR63.js.map +0 -1
- package/dist/chunk-IQVIHN7C.js.map +0 -1
- package/dist/chunk-ON2V4RXX.js.map +0 -1
- package/dist/chunk-PA6WJE5E.js +0 -115
- package/dist/chunk-PA6WJE5E.js.map +0 -1
- package/dist/chunk-RK365SO2.js.map +0 -1
- package/dist/chunk-VDEW4AOS.js.map +0 -1
- package/dist/chunk-X6EVE7W4.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseQueryResult, UseMutationResult } from '@tanstack/react-query';
|
|
2
|
-
import { S as SortParam, a as FilterParam, I as InvalidationKey, s as ListResult, L as ListParams, b as Identifier, B as BaseRecord } from '../types-
|
|
2
|
+
import { S as SortParam, a as FilterParam, I as InvalidationKey, s as ListResult, L as ListParams, b as Identifier, B as BaseRecord } from '../types-BzLv8yOm.js';
|
|
3
3
|
import { MutationModeOptions } from './mutation-mode.js';
|
|
4
4
|
import { LiveOptions } from './use-live.js';
|
|
5
5
|
|
|
@@ -65,6 +65,19 @@ interface UseResourceOptions<T> extends MutationModeOptions {
|
|
|
65
65
|
*/
|
|
66
66
|
onError?: (error: Error) => void;
|
|
67
67
|
}
|
|
68
|
+
/** What `update` can take beside the change. */
|
|
69
|
+
interface UpdateOptions {
|
|
70
|
+
/**
|
|
71
|
+
* Check the write against this version instead of the cached row's: "keep mine" after a
|
|
72
|
+
* conflict, at the version the conflict reported (`WriteConflict.currentVersion`). A version
|
|
73
|
+
* already chained for the row wins over it: a write sent while an earlier write of the same row
|
|
74
|
+
* is still in flight is checked against the version that one commits (as
|
|
75
|
+
* `ExecuteWriteArgs.expectedVersion`). The write
|
|
76
|
+
* still goes through the resource's write path (queued behind any other write of the row, its
|
|
77
|
+
* committed version recorded), so a move made right after it is checked against it.
|
|
78
|
+
*/
|
|
79
|
+
expectedVersion?: string;
|
|
80
|
+
}
|
|
68
81
|
interface UseResourceReturn<T> {
|
|
69
82
|
/** TanStack Query result for the list query. */
|
|
70
83
|
list: UseQueryResult<ListResult<T>>;
|
|
@@ -86,7 +99,7 @@ interface UseResourceReturn<T> {
|
|
|
86
99
|
* `optimistic` and `undoable` modes it resolves at once with the cached
|
|
87
100
|
* row merged with `data`.
|
|
88
101
|
*/
|
|
89
|
-
update: (id: Identifier, data: Partial<T
|
|
102
|
+
update: (id: Identifier, data: Partial<T>, options?: UpdateOptions) => Promise<T>;
|
|
90
103
|
/** Delete a record by id. Resolves at once in `optimistic` / `undoable` modes. */
|
|
91
104
|
remove: (id: Identifier) => Promise<void>;
|
|
92
105
|
/** True when any mutation is in-flight. */
|
|
@@ -95,9 +108,10 @@ interface UseResourceReturn<T> {
|
|
|
95
108
|
updateMutation: UseMutationResult<T, Error, {
|
|
96
109
|
id: Identifier;
|
|
97
110
|
data: Partial<T>;
|
|
111
|
+
options?: UpdateOptions;
|
|
98
112
|
}>;
|
|
99
113
|
deleteMutation: UseMutationResult<void, Error, Identifier>;
|
|
100
114
|
}
|
|
101
115
|
declare function useResource<T extends BaseRecord = BaseRecord>(resource: string, options?: UseResourceOptions<T>): UseResourceReturn<T>;
|
|
102
116
|
|
|
103
|
-
export { type UseResourceOptions, type UseResourceReturn, useResource };
|
|
117
|
+
export { type UpdateOptions, type UseResourceOptions, type UseResourceReturn, useResource };
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
export { useResource } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
1
|
+
export { useResource } from '../chunk-OC4OGB2K.js';
|
|
2
|
+
import '../chunk-7NUL32W7.js';
|
|
3
|
+
import '../chunk-XVRIWP7B.js';
|
|
4
|
+
import '../chunk-YNXLPOAB.js';
|
|
5
|
+
import '../chunk-2VJQVAJD.js';
|
|
6
|
+
import '../chunk-AJGVLF37.js';
|
|
6
7
|
import '../chunk-7PUFVNPB.js';
|
|
7
|
-
import '../chunk-
|
|
8
|
+
import '../chunk-PSFKIG27.js';
|
|
8
9
|
import '../chunk-ZYJUEJ4Z.js';
|
|
9
|
-
import '../chunk-
|
|
10
|
-
import '../chunk-
|
|
10
|
+
import '../chunk-AUVKRXRC.js';
|
|
11
|
+
import '../chunk-VFT6QKZW.js';
|
|
12
|
+
import '../chunk-HUNGCTRA.js';
|
|
13
|
+
import '../chunk-RYEXWQFD.js';
|
|
14
|
+
import '../chunk-LG6TUBVM.js';
|
|
11
15
|
//# sourceMappingURL=use-resource.js.map
|
|
12
16
|
//# sourceMappingURL=use-resource.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QueryClient, MutationOptions } from '@tanstack/react-query';
|
|
2
|
-
import { I as InvalidationKey } from '../types-
|
|
2
|
+
import { I as InvalidationKey } from '../types-BzLv8yOm.js';
|
|
3
3
|
|
|
4
4
|
declare const WRITE_FAILED = "That didn't work. Try again.";
|
|
5
5
|
interface UseWriteOptions<A, R> {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { L as ListParams, b as Identifier } from './types-
|
|
2
|
-
export { A as ArrayFilter, c as AuditEntry, B as BaseRecord, d as BulkChange, e as BulkResult, C as CountMode, f as CreateParams, g as CreateResult, D as DataProvider, h as DataRow, i as DeleteParams, j as DeleteResult, k as FieldPermissions, l as FieldReference, F as FieldSchema, m as FieldType, n as FilterOperator, a as FilterParam, G as GetManyParams, o as GetManyResult, p as GetOneParams, q as GetOneResult, H as HistoryParams, r as ImportParams, I as InvalidationKey, s as ListResult, N as NullFilter, P as PaginationParam, t as ProviderCapabilities, R as RangeFilter, u as RecordComment, v as ResourceAccess, w as ResourceChangeEvent, x as ResourceContract, y as ResourceFormFieldDef, z as ResourceRelation, E as ResourceSchema, J as ResourceSummary, K as RowAction, M as RowFailure, O as RowOf, Q as ScalarFilter, T as SelectOption, S as SortParam, U as StorageType, V as SubscribeParams, X as UpdateParams, Y as UpdateResult, Z as VersionField, m as WidgetHint, W as WriteEvent, _ as defineResource } from './types-
|
|
3
|
-
export { D as DataWriteError, a as DataWriteErrorOptions, W as WriteOutcome, i as isDataWriteError } from './write-outcome-
|
|
4
|
-
export { CallRpcOptions, CreateOrAdoptOptions, CreateOrAdoptResult, DEFAULT_RPC_MESSAGES, DataProviderRoot, DataProviderRootProps, GenesisProvider, GenesisProviderProps, MockProviderOptions, PostgrestFieldErrors, RPC_FAILED, RpcClient, SupabaseClient, SupabaseClientInput, SupabaseProviderOptions, SupabaseRealtimeChannel, SupabaseRealtimePayload, SupabaseResourceConfig, SupabaseWriteContext, callRpc, createMockProvider, createOrAdopt, createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, useDataProvider, useStorage, writeOutcomeFromCode } from './provider/index.js';
|
|
1
|
+
import { L as ListParams, b as Identifier } from './types-BzLv8yOm.js';
|
|
2
|
+
export { A as ArrayFilter, c as AuditEntry, B as BaseRecord, d as BulkChange, e as BulkResult, C as CountMode, f as CreateParams, g as CreateResult, D as DataProvider, h as DataRow, i as DeleteParams, j as DeleteResult, k as FieldPermissions, l as FieldReference, F as FieldSchema, m as FieldType, n as FilterOperator, a as FilterParam, G as GetManyParams, o as GetManyResult, p as GetOneParams, q as GetOneResult, H as HistoryParams, r as ImportParams, I as InvalidationKey, s as ListResult, N as NullFilter, P as PaginationParam, t as ProviderCapabilities, R as RangeFilter, u as RecordComment, v as ResourceAccess, w as ResourceChangeEvent, x as ResourceContract, y as ResourceFormFieldDef, z as ResourceRelation, E as ResourceSchema, J as ResourceSummary, K as RowAction, M as RowFailure, O as RowOf, Q as ScalarFilter, T as SelectOption, S as SortParam, U as StorageType, V as SubscribeParams, X as UpdateParams, Y as UpdateResult, Z as VersionField, m as WidgetHint, W as WriteEvent, _ as defineResource } from './types-BzLv8yOm.js';
|
|
3
|
+
export { D as DataWriteError, a as DataWriteErrorOptions, W as WriteOutcome, i as isDataWriteError } from './write-outcome-DC5hORz-.js';
|
|
4
|
+
export { CallRpcOptions, CreateOrAdoptOptions, CreateOrAdoptResult, DEFAULT_RPC_MESSAGES, DataProviderRoot, DataProviderRootProps, GenesisProvider, GenesisProviderProps, MockProviderOptions, PostgrestFieldErrors, RPC_FAILED, RpcClient, SupabaseClient, SupabaseClientInput, SupabaseProviderOptions, SupabaseRealtimeChannel, SupabaseRealtimePayload, SupabaseResourceConfig, SupabaseUpdateContext, SupabaseWriteContext, callRpc, createMockProvider, createOrAdopt, createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, useDataProvider, useStorage, writeOutcomeFromCode } from './provider/index.js';
|
|
5
5
|
export { D as DataReadError, a as DataReadErrorOptions, R as ReadOutcome, i as isDataReadError, r as readFailureMessage } from './read-outcome-BnboMYOV.js';
|
|
6
6
|
export { S as StorageAdapter } from './types-DKcxHXxq.js';
|
|
7
7
|
export { createLocalStorageAdapter, createMemoryStorageAdapter, createNoopStorageAdapter } from './storage/index.js';
|
|
8
|
-
export { UseResourceOptions, UseResourceReturn, useResource } from './hooks/use-resource.js';
|
|
8
|
+
export { UpdateOptions, UseResourceOptions, UseResourceReturn, useResource } from './hooks/use-resource.js';
|
|
9
9
|
export { UseOneOptions, useOne } from './hooks/use-one.js';
|
|
10
10
|
export { UseRelationLabelOptions, loadRelationLabel, relationNamingField, useRelationLabel } from './hooks/use-relation-label.js';
|
|
11
11
|
export { LinkOption, LinkTarget, UseLinkOptionsOptions, UseLinkOptionsReturn, useLinkOptions } from './hooks/use-link-options.js';
|
|
@@ -14,7 +14,7 @@ export { useCapabilities } from './hooks/use-capabilities.js';
|
|
|
14
14
|
export { UseWriteOptions, UseWriteReturn, WRITE_FAILED, useWrite } from './hooks/use-write.js';
|
|
15
15
|
export { UseDraftReturn, useDraft } from './hooks/use-draft.js';
|
|
16
16
|
export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftAdoption, DraftController, DraftOptions, DraftSeed, DraftState, DraftStatus, DraftValue, isNetworkFailure, stableJson } from './hooks/draft-controller.js';
|
|
17
|
-
export { G as GenesisViewerRoles, N as NO_VIEWER, R as ResourceScope, V as Viewer, a as ViewerContext, b as ViewerScope, c as ViewerScopeProps, d as clearViewerCache, s as scopeClock, u as useOptionalViewerScope, e as useViewer, f as useViewerScope } from './viewer-scope-
|
|
17
|
+
export { G as GenesisViewerRoles, N as NO_VIEWER, R as ResourceScope, V as Viewer, a as ViewerContext, b as ViewerScope, c as ViewerScopeProps, d as clearViewerCache, s as scopeClock, u as useOptionalViewerScope, e as useViewer, f as useViewerScope } from './viewer-scope-Dx0N9AYk.js';
|
|
18
18
|
export { WorkspaceContext, WorkspaceScope, WorkspaceScopeProps, rememberedWorkspaceId, useWorkspace } from './hooks/index.js';
|
|
19
19
|
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, LiveOptions, useLiveInvalidation } from './hooks/use-live.js';
|
|
20
20
|
export { UseResourceFormOptions, UseResourceFormReturn, blankValues, buildArrayItemDefaults, useResourceForm } from './hooks/use-resource-form.js';
|
|
@@ -22,11 +22,13 @@ export { UseWizardReturn, WizardStep, useWizard } from './hooks/use-wizard.js';
|
|
|
22
22
|
export { DEFAULT_UNDO_DELAY_MS, MutationMode, MutationModeOptions, UndoableWrite, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './hooks/mutation-mode.js';
|
|
23
23
|
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, UseUnsavedChangesGuardOptions, UseUnsavedChangesGuardReturn, useUnsavedChangesGuard } from './hooks/use-unsaved-changes-guard.js';
|
|
24
24
|
export { decodeRecordKey, encodeRecordKey, keyFields } from './schema/index.js';
|
|
25
|
+
export { W as WriteConflict, a as WriteConflictOptions, b as WriteState, w as writeConflict } from './write-state-DVC4Yq9T.js';
|
|
25
26
|
import { Query } from '@tanstack/react-query';
|
|
26
27
|
export { isSafeUrl, normalizeLinkUrl } from './urls.js';
|
|
27
28
|
export { ClassifiedError, ClassifyErrorOptions, ErrorKind, ErrorMessages, ErrorReportContext, ErrorReporter, classifyError, defaultErrorReporter, errorMessages, getErrorReporter, reportError, setErrorReporter } from './errors.js';
|
|
28
29
|
export { titleCase } from './utils.js';
|
|
29
30
|
import 'react';
|
|
31
|
+
import './types-CsKSAKqs.js';
|
|
30
32
|
import './dates.js';
|
|
31
33
|
import './workspaces.js';
|
|
32
34
|
import 'react-hook-form';
|
package/dist/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabaseProvider } from './chunk-7GW3QR63.js';
|
|
3
|
-
export { defineResource } from './chunk-7FVTGKTX.js';
|
|
1
|
+
export { defineResource } from './chunk-YDMKMNDS.js';
|
|
4
2
|
export { decodeRecordKey, encodeRecordKey, keyFields } from './chunk-KV2HW4G4.js';
|
|
5
|
-
|
|
6
|
-
export {
|
|
3
|
+
import './chunk-XCX2TRBL.js';
|
|
4
|
+
export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabaseProvider } from './chunk-ZHC3MDCS.js';
|
|
5
|
+
export { ViewerScope, WorkspaceScope, clearViewerCache, rememberedWorkspaceId, scopeClock, useOptionalViewerScope, useViewer, useViewerScope, useWorkspace } from './chunk-AKF2RAGX.js';
|
|
6
|
+
export { NO_VIEWER } from './chunk-OZYF55E3.js';
|
|
7
|
+
export { blankValues, buildArrayItemDefaults, useResourceForm } from './chunk-3B5O36DU.js';
|
|
8
|
+
export { writeConflict } from './chunk-2WS4LGYU.js';
|
|
9
|
+
export { useResource } from './chunk-OC4OGB2K.js';
|
|
10
|
+
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from './chunk-RVWKVD5Q.js';
|
|
7
11
|
export { useWizard } from './chunk-7KOLYF27.js';
|
|
8
12
|
export { WRITE_FAILED, useWrite } from './chunk-52T2EYXH.js';
|
|
9
|
-
|
|
13
|
+
import './chunk-7NUL32W7.js';
|
|
10
14
|
export { useDraft } from './chunk-YQBWXG2G.js';
|
|
11
|
-
export { useLinkOptions } from './chunk-
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export { useOne } from './chunk-4ZR7472O.js';
|
|
17
|
-
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, useLiveInvalidation } from './chunk-ZCE3CHPX.js';
|
|
15
|
+
export { useLinkOptions } from './chunk-VJGU6E4U.js';
|
|
16
|
+
export { loadRelationLabel, relationNamingField, useRelationLabel } from './chunk-42QPCDQF.js';
|
|
17
|
+
export { useInfiniteResource } from './chunk-POMTRNAL.js';
|
|
18
|
+
export { useOne } from './chunk-LOJGHR5O.js';
|
|
19
|
+
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, useLiveInvalidation } from './chunk-XVRIWP7B.js';
|
|
18
20
|
import './chunk-UHOMTFBD.js';
|
|
19
21
|
export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftController, isNetworkFailure, stableJson } from './chunk-HBAPYA5K.js';
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
|
|
22
|
+
export { DEFAULT_UNDO_DELAY_MS, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './chunk-YNXLPOAB.js';
|
|
23
|
+
export { useCapabilities } from './chunk-2VJQVAJD.js';
|
|
24
|
+
import './chunk-AJGVLF37.js';
|
|
23
25
|
export { defineQueryKeys, resourceKeys } from './chunk-7PUFVNPB.js';
|
|
24
|
-
export { DataProviderRoot, GenesisProvider, createMockProvider, useDataProvider, useStorage } from './chunk-
|
|
26
|
+
export { DataProviderRoot, GenesisProvider, createMockProvider, useDataProvider, useStorage } from './chunk-PSFKIG27.js';
|
|
25
27
|
export { createLocalStorageAdapter, createMemoryStorageAdapter, createNoopStorageAdapter } from './chunk-ZYJUEJ4Z.js';
|
|
26
|
-
import './chunk-
|
|
27
|
-
import './chunk-7NUL32W7.js';
|
|
28
|
+
import './chunk-AUVKRXRC.js';
|
|
28
29
|
import './chunk-WXENWPWP.js';
|
|
29
|
-
export { classifyError, defaultErrorReporter, errorMessages, getErrorReporter, reportError, setErrorReporter } from './chunk-
|
|
30
|
-
export { fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, writeOutcomeFromCode } from './chunk-PA6WJE5E.js';
|
|
30
|
+
export { classifyError, defaultErrorReporter, errorMessages, fieldErrorsFromPostgrest, getErrorReporter, readOutcomeFromCode, reportError, setErrorReporter, toDataWriteError, writeOutcomeFromCode } from './chunk-VFT6QKZW.js';
|
|
31
31
|
export { DataReadError, isDataReadError, readFailureMessage } from './chunk-HUNGCTRA.js';
|
|
32
32
|
export { titleCase } from './chunk-RYEXWQFD.js';
|
|
33
33
|
export { DataWriteError, isDataWriteError } from './chunk-LG6TUBVM.js';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { L as LocalCache, Q as QueryPersistence } from '../types-CsKSAKqs.js';
|
|
2
|
+
export { C as CacheOp, a as CacheScope, S as StoredQuery, b as StoredRow, c as SubscribeOptions, d as cacheScope } from '../types-CsKSAKqs.js';
|
|
3
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A `LocalCache` in memory: for tests, and for a screen that wants the
|
|
7
|
+
* contract without a device store. Nothing survives a reload.
|
|
8
|
+
*
|
|
9
|
+
* @stability Beta
|
|
10
|
+
*/
|
|
11
|
+
declare function memoryLocalCache(): LocalCache;
|
|
12
|
+
|
|
13
|
+
/** Options for {@link indexedDbLocalCache}. */
|
|
14
|
+
interface IndexedDbLocalCacheOptions {
|
|
15
|
+
/** The database name. Default `"genesis-offline"`. */
|
|
16
|
+
name?: string;
|
|
17
|
+
/** The IndexedDB factory. Default `globalThis.indexedDB`. */
|
|
18
|
+
indexedDB?: IDBFactory;
|
|
19
|
+
/**
|
|
20
|
+
* Ask the browser to keep this origin's storage (`navigator.storage.persist()`).
|
|
21
|
+
* Default false: some browsers ask the person, and kept storage outlives a
|
|
22
|
+
* shared machine's session longer. Without it the browser may evict the
|
|
23
|
+
* cache under pressure; it's rebuilt from the server.
|
|
24
|
+
*/
|
|
25
|
+
persist?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A `LocalCache` in IndexedDB, for the web: plain IndexedDB, no dependency.
|
|
29
|
+
* Rows and queries are separate object stores keyed by scope, so one row is
|
|
30
|
+
* stored once whatever lists hold it, and a write is one transaction. A newer
|
|
31
|
+
* version of the database opened in another tab closes this one, which then
|
|
32
|
+
* reopens on its next use, instead of blocking the upgrade.
|
|
33
|
+
*
|
|
34
|
+
* @stability Beta
|
|
35
|
+
*/
|
|
36
|
+
declare function indexedDbLocalCache(options?: IndexedDbLocalCacheOptions): LocalCache;
|
|
37
|
+
|
|
38
|
+
/** Options for {@link persistOffline}. */
|
|
39
|
+
interface PersistOfflineOptions {
|
|
40
|
+
/** Where reads are kept: `indexedDbLocalCache()` on the web, `sqliteLocalCache({ db })` on the phone. */
|
|
41
|
+
cache: LocalCache;
|
|
42
|
+
/**
|
|
43
|
+
* The resources whose reads are kept on the device: the one opt-in switch.
|
|
44
|
+
* Keeping data on a device is a decision, so nothing else is written. Leave
|
|
45
|
+
* out a resource whose rows shouldn't sit on a phone unencrypted.
|
|
46
|
+
*/
|
|
47
|
+
resources: readonly string[];
|
|
48
|
+
/** Your app's version: a different value discards what was kept. */
|
|
49
|
+
buster: string;
|
|
50
|
+
/** How old a kept read may be when restored. Default 7 days. */
|
|
51
|
+
maxAge?: number;
|
|
52
|
+
/** Save at most this often. Default 500 ms. */
|
|
53
|
+
throttleMs?: number;
|
|
54
|
+
/** The most reads kept per person and workspace; the least recently fetched go first. Default 200. */
|
|
55
|
+
maxReads?: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Keeps the reads of the listed resources on the device, per record, and
|
|
59
|
+
* puts them back into the QueryClient on the next start, so lists and records
|
|
60
|
+
* open at once and then refresh as usual. What `GenesisNativeApp`'s and
|
|
61
|
+
* `GenesisProvider`'s `persist` take.
|
|
62
|
+
*
|
|
63
|
+
* persist={persistOffline({ cache: indexedDbLocalCache(), resources: ["tasks", "people"], buster: version })}
|
|
64
|
+
*
|
|
65
|
+
* - Only reads that came back from the provider are kept (never an optimistic
|
|
66
|
+
* change that hasn't been saved), in the bucket of the person and workspace
|
|
67
|
+
* they were read in.
|
|
68
|
+
* - A restored read is marked as fetched when it was, so a screen refetches it
|
|
69
|
+
* once it's stale (the client's `staleTime`), as with any cached read. It
|
|
70
|
+
* never replaces a newer read already in the client.
|
|
71
|
+
* - A newer read replaces a stored row, so a field the server stops returning
|
|
72
|
+
* goes; a record that comes back empty is deleted from the device. Each start
|
|
73
|
+
* deletes reads older than `maxAge` and the rows no kept read refers to.
|
|
74
|
+
* - A device is one person's: restoring someone deletes every other person's
|
|
75
|
+
* reads first, and `restore("")` (nobody signed in) deletes them all, so a
|
|
76
|
+
* session that ended outside the app leaves nothing behind.
|
|
77
|
+
* - A sign-out, a change of person or workspace, or `clear()` stops every save
|
|
78
|
+
* and restore still in flight from landing in the new bucket.
|
|
79
|
+
*
|
|
80
|
+
* @stability Beta
|
|
81
|
+
*/
|
|
82
|
+
declare function persistOffline(options: PersistOfflineOptions): (queryClient: QueryClient) => QueryPersistence;
|
|
83
|
+
|
|
84
|
+
export { type IndexedDbLocalCacheOptions, LocalCache, type PersistOfflineOptions, QueryPersistence, indexedDbLocalCache, memoryLocalCache, persistOffline };
|