@marktiderman/genesis-core 2.14.0 → 2.16.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.
Files changed (101) hide show
  1. package/dist/aggregate-Y5IJ5aPn.d.ts +34 -0
  2. package/dist/{chunk-7PUFVNPB.js → chunk-2IGAUXYH.js} +5 -3
  3. package/dist/chunk-2IGAUXYH.js.map +1 -0
  4. package/dist/{chunk-KA3BUJ4H.js → chunk-42NVJJTT.js} +3 -3
  5. package/dist/{chunk-KA3BUJ4H.js.map → chunk-42NVJJTT.js.map} +1 -1
  6. package/dist/{chunk-JN47G4UE.js → chunk-7EFTWOMA.js} +56 -2
  7. package/dist/chunk-7EFTWOMA.js.map +1 -0
  8. package/dist/{chunk-P3FHXRS2.js → chunk-ALLWIK62.js} +6 -6
  9. package/dist/{chunk-P3FHXRS2.js.map → chunk-ALLWIK62.js.map} +1 -1
  10. package/dist/chunk-APFXV6FZ.js +130 -0
  11. package/dist/chunk-APFXV6FZ.js.map +1 -0
  12. package/dist/chunk-BDPRWVFW.js +17 -0
  13. package/dist/chunk-BDPRWVFW.js.map +1 -0
  14. package/dist/{chunk-S2VYJWB4.js → chunk-E3K2A3PK.js} +3 -3
  15. package/dist/{chunk-S2VYJWB4.js.map → chunk-E3K2A3PK.js.map} +1 -1
  16. package/dist/{chunk-OYDJGPDY.js → chunk-FXPODKCK.js} +5 -5
  17. package/dist/{chunk-OYDJGPDY.js.map → chunk-FXPODKCK.js.map} +1 -1
  18. package/dist/{chunk-SDAJSJNN.js → chunk-IYGVJFCV.js} +3 -3
  19. package/dist/{chunk-SDAJSJNN.js.map → chunk-IYGVJFCV.js.map} +1 -1
  20. package/dist/chunk-J54XXKQD.js +104 -0
  21. package/dist/chunk-J54XXKQD.js.map +1 -0
  22. package/dist/{chunk-KV2HW4G4.js → chunk-LB6FMQQM.js} +11 -3
  23. package/dist/chunk-LB6FMQQM.js.map +1 -0
  24. package/dist/{chunk-G6GQPXQS.js → chunk-M5IX7C6U.js} +5 -5
  25. package/dist/{chunk-G6GQPXQS.js.map → chunk-M5IX7C6U.js.map} +1 -1
  26. package/dist/{chunk-DFABPMEQ.js → chunk-POUI7GAI.js} +5 -5
  27. package/dist/{chunk-DFABPMEQ.js.map → chunk-POUI7GAI.js.map} +1 -1
  28. package/dist/{chunk-NE2D74BP.js → chunk-QGWQ6LK3.js} +5 -5
  29. package/dist/{chunk-NE2D74BP.js.map → chunk-QGWQ6LK3.js.map} +1 -1
  30. package/dist/{chunk-2K4747KX.js → chunk-R3YXYVWF.js} +7 -2
  31. package/dist/chunk-R3YXYVWF.js.map +1 -0
  32. package/dist/{chunk-RFHUOXZC.js → chunk-SOO54YYY.js} +4 -4
  33. package/dist/{chunk-RFHUOXZC.js.map → chunk-SOO54YYY.js.map} +1 -1
  34. package/dist/{chunk-YZV3Z6ZA.js → chunk-SQLM5CIJ.js} +3 -3
  35. package/dist/{chunk-YZV3Z6ZA.js.map → chunk-SQLM5CIJ.js.map} +1 -1
  36. package/dist/{chunk-WDPM5TBO.js → chunk-UDSTWXXZ.js} +3 -3
  37. package/dist/{chunk-WDPM5TBO.js.map → chunk-UDSTWXXZ.js.map} +1 -1
  38. package/dist/chunk-XPBS5YE4.js +24 -0
  39. package/dist/chunk-XPBS5YE4.js.map +1 -0
  40. package/dist/{chunk-AHFIS42U.js → chunk-ZYOJWU62.js} +5 -5
  41. package/dist/{chunk-AHFIS42U.js.map → chunk-ZYOJWU62.js.map} +1 -1
  42. package/dist/csv.d.ts +1 -1
  43. package/dist/form-types.d.ts +1 -1
  44. package/dist/headless/index.d.ts +334 -0
  45. package/dist/headless/index.js +490 -0
  46. package/dist/headless/index.js.map +1 -0
  47. package/dist/hooks/index.d.ts +4 -2
  48. package/dist/hooks/index.js +20 -17
  49. package/dist/hooks/mutation-mode.d.ts +1 -1
  50. package/dist/hooks/mutation-mode.js +5 -4
  51. package/dist/hooks/related-keys.d.ts +1 -1
  52. package/dist/hooks/use-aggregate.d.ts +25 -0
  53. package/dist/hooks/use-aggregate.js +10 -0
  54. package/dist/hooks/use-aggregate.js.map +1 -0
  55. package/dist/hooks/use-capabilities.d.ts +1 -1
  56. package/dist/hooks/use-capabilities.js +4 -2
  57. package/dist/hooks/use-draft.js +2 -2
  58. package/dist/hooks/use-infinite-resource.d.ts +1 -1
  59. package/dist/hooks/use-infinite-resource.js +6 -4
  60. package/dist/hooks/use-link-options.d.ts +1 -1
  61. package/dist/hooks/use-link-options.js +8 -6
  62. package/dist/hooks/use-live.d.ts +1 -1
  63. package/dist/hooks/use-live.js +4 -2
  64. package/dist/hooks/use-one.d.ts +1 -1
  65. package/dist/hooks/use-one.js +6 -4
  66. package/dist/hooks/use-persisted-ui-state.js +4 -2
  67. package/dist/hooks/use-relation-label.d.ts +1 -1
  68. package/dist/hooks/use-relation-label.js +4 -2
  69. package/dist/hooks/use-resource-form.d.ts +1 -1
  70. package/dist/hooks/use-resource-form.js +8 -7
  71. package/dist/hooks/use-resource.d.ts +1 -1
  72. package/dist/hooks/use-resource.js +7 -6
  73. package/dist/hooks/use-write.d.ts +1 -1
  74. package/dist/index.d.ts +110 -6
  75. package/dist/index.js +129 -20
  76. package/dist/index.js.map +1 -1
  77. package/dist/navigation.d.ts +77 -1
  78. package/dist/navigation.js +32 -2
  79. package/dist/navigation.js.map +1 -1
  80. package/dist/provider/index.d.ts +12 -4
  81. package/dist/provider/index.js +3 -2
  82. package/dist/resource-view/index.d.ts +456 -166
  83. package/dist/resource-view/index.js +251 -5
  84. package/dist/resource-view/index.js.map +1 -1
  85. package/dist/schema/index.d.ts +3 -3
  86. package/dist/schema/index.js +1 -2
  87. package/dist/testing/index.d.ts +2 -2
  88. package/dist/{types-CtJxwoyv.d.ts → types-BriIV4e_.d.ts} +78 -3
  89. package/dist/workspaces-CxpiFu2-.d.ts +263 -0
  90. package/dist/workspaces.d.ts +2 -160
  91. package/dist/workspaces.js +2 -1
  92. package/dist/{write-outcome-Goy1v39G.d.ts → write-outcome-CkQXgtJq.d.ts} +1 -1
  93. package/package.json +14 -4
  94. package/dist/chunk-2K4747KX.js.map +0 -1
  95. package/dist/chunk-7PUFVNPB.js.map +0 -1
  96. package/dist/chunk-JN47G4UE.js.map +0 -1
  97. package/dist/chunk-KV2HW4G4.js.map +0 -1
  98. package/dist/chunk-UHOMTFBD.js +0 -72
  99. package/dist/chunk-UHOMTFBD.js.map +0 -1
  100. package/dist/chunk-YDMKMNDS.js +0 -8
  101. package/dist/chunk-YDMKMNDS.js.map +0 -1
@@ -1,5 +1,6 @@
1
1
  export { UpdateOptions, UseResourceOptions, UseResourceReturn, useResource } from './use-resource.js';
2
2
  export { UseOneOptions, useOne } from './use-one.js';
3
+ export { UseAggregateOptions, useAggregate } from './use-aggregate.js';
3
4
  export { UseRelationLabelOptions, loadRelationLabel, relationNamingField, useRelationLabel } from './use-relation-label.js';
4
5
  export { LinkOption, LinkTarget, UseLinkOptionsOptions, UseLinkOptionsReturn, useLinkOptions } from './use-link-options.js';
5
6
  export { InfinitePageParam, UseInfiniteResourceOptions, UseInfiniteResourceReturn, useInfiniteResource } from './use-infinite-resource.js';
@@ -11,14 +12,15 @@ export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftAdoption, DraftController
11
12
  import { c as ViewerScopeProps } from '../viewer-scope-Dx0N9AYk.js';
12
13
  export { G as GenesisViewerRoles, N as NO_VIEWER, R as ResourceScope, V as Viewer, a as ViewerContext, b as ViewerScope, d as clearViewerCache, s as scopeClock, u as useOptionalViewerScope, e as useViewer, f as useViewerScope } from '../viewer-scope-Dx0N9AYk.js';
13
14
  import * as react from 'react';
14
- import { Workspace, WorkspaceHrefOptions } from '../workspaces.js';
15
+ import { W as Workspace, g as WorkspaceHrefOptions } from '../workspaces-CxpiFu2-.js';
15
16
  export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, LiveOptions, useLiveInvalidation } from './use-live.js';
16
17
  export { UseResourceFormOptions, UseResourceFormReturn, blankValues, buildArrayItemDefaults, useResourceForm } from './use-resource-form.js';
17
18
  export { UseWizardReturn, WizardStep, useWizard } from './use-wizard.js';
18
19
  export { DEFAULT_UNDO_DELAY_MS, MutationMode, MutationModeOptions, UndoableWrite, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './mutation-mode.js';
19
20
  export { DEFAULT_UNSAVED_CHANGES_MESSAGE, UseUnsavedChangesGuardOptions, UseUnsavedChangesGuardReturn, useUnsavedChangesGuard } from './use-unsaved-changes-guard.js';
20
21
  import '@tanstack/react-query';
21
- import '../types-CtJxwoyv.js';
22
+ import '../types-BriIV4e_.js';
23
+ import '../aggregate-Y5IJ5aPn.js';
22
24
  import '../dates.js';
23
25
  import 'react-hook-form';
24
26
  import '../write-state-DVC4Yq9T.js';
@@ -1,27 +1,30 @@
1
- export { ViewerScope, WorkspaceScope, clearViewerCache, rememberedWorkspaceId, scopeClock, useOptionalViewerScope, useViewer, useViewerScope, useWorkspace } from '../chunk-AHFIS42U.js';
1
+ export { ViewerScope, WorkspaceScope, clearViewerCache, rememberedWorkspaceId, scopeClock, useOptionalViewerScope, useViewer, useViewerScope, useWorkspace } from '../chunk-ZYOJWU62.js';
2
+ export { WRITE_FAILED, useWrite } from '../chunk-NQFIAULD.js';
2
3
  export { NO_VIEWER } from '../chunk-OZYF55E3.js';
3
- export { usePersistedUiState } from '../chunk-SDAJSJNN.js';
4
- export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-OYDJGPDY.js';
4
+ export { usePersistedUiState } from '../chunk-IYGVJFCV.js';
5
+ export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-FXPODKCK.js';
5
6
  import '../chunk-LKRJB632.js';
6
- export { useResource } from '../chunk-P3FHXRS2.js';
7
+ export { useOne } from '../chunk-QGWQ6LK3.js';
8
+ export { useResource } from '../chunk-ALLWIK62.js';
7
9
  export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from '../chunk-RVWKVD5Q.js';
8
10
  export { useWizard } from '../chunk-7KOLYF27.js';
9
- export { WRITE_FAILED, useWrite } from '../chunk-NQFIAULD.js';
11
+ export { DEFAULT_UNDO_DELAY_MS, dropPendingWrites, flushPendingWrites, pendingWriteCount } from '../chunk-SOO54YYY.js';
10
12
  import '../chunk-7NUL32W7.js';
11
- export { useDraft } from '../chunk-YZV3Z6ZA.js';
12
- export { useLinkOptions } from '../chunk-DFABPMEQ.js';
13
- export { loadRelationLabel, relationNamingField, useRelationLabel } from '../chunk-WDPM5TBO.js';
14
- export { useInfiniteResource } from '../chunk-G6GQPXQS.js';
15
- export { useOne } from '../chunk-NE2D74BP.js';
16
- export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, useLiveInvalidation } from '../chunk-S2VYJWB4.js';
17
- import '../chunk-UHOMTFBD.js';
18
- export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftController, isNetworkFailure, stableJson } from '../chunk-5ASUMG6K.js';
19
- export { DEFAULT_UNDO_DELAY_MS, dropPendingWrites, flushPendingWrites, pendingWriteCount } from '../chunk-RFHUOXZC.js';
20
- export { useCapabilities } from '../chunk-KA3BUJ4H.js';
13
+ export { useAggregate } from '../chunk-XPBS5YE4.js';
14
+ export { useCapabilities } from '../chunk-42NVJJTT.js';
15
+ export { useDraft } from '../chunk-SQLM5CIJ.js';
21
16
  import '../chunk-AJGVLF37.js';
22
- import '../chunk-7PUFVNPB.js';
23
- import '../chunk-2K4747KX.js';
17
+ export { useLinkOptions } from '../chunk-POUI7GAI.js';
18
+ export { loadRelationLabel, relationNamingField, useRelationLabel } from '../chunk-UDSTWXXZ.js';
19
+ export { useInfiniteResource } from '../chunk-M5IX7C6U.js';
20
+ export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, useLiveInvalidation } from '../chunk-E3K2A3PK.js';
21
+ import '../chunk-2IGAUXYH.js';
22
+ import '../chunk-R3YXYVWF.js';
23
+ import '../chunk-J54XXKQD.js';
24
24
  import '../chunk-4PTQYT5J.js';
25
+ import '../chunk-APFXV6FZ.js';
26
+ import '../chunk-BDPRWVFW.js';
27
+ export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftController, isNetworkFailure, stableJson } from '../chunk-5ASUMG6K.js';
25
28
  import '../chunk-AUVKRXRC.js';
26
29
  import '../chunk-WXENWPWP.js';
27
30
  import '../chunk-NOPS5EIH.js';
@@ -1,5 +1,5 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
- import { b as Identifier, B as BaseRecord, D as DataProvider, c as AuditEntry } from '../types-CtJxwoyv.js';
2
+ import { d as Identifier, B as BaseRecord, D as DataProvider, h as AuditEntry } from '../types-BriIV4e_.js';
3
3
 
4
4
  type MutationMode = "pessimistic" | "optimistic" | "undoable";
5
5
  /** How long an `undoable` write waits for an undo before it is sent. */
@@ -1,8 +1,9 @@
1
- export { DEFAULT_UNDO_DELAY_MS, DROPPED_WRITE_MESSAGE, cachedRecord, cachedVersion, dropPendingWrites, executeWrite, flushPendingWrites, invalidateResource, pendingWriteCount, providerServesUndo, sameValue } from '../chunk-RFHUOXZC.js';
2
- import '../chunk-KA3BUJ4H.js';
1
+ export { DEFAULT_UNDO_DELAY_MS, DROPPED_WRITE_MESSAGE, cachedRecord, cachedVersion, dropPendingWrites, executeWrite, flushPendingWrites, invalidateResource, pendingWriteCount, providerServesUndo, sameValue } from '../chunk-SOO54YYY.js';
2
+ import '../chunk-42NVJJTT.js';
3
3
  import '../chunk-AJGVLF37.js';
4
- import '../chunk-7PUFVNPB.js';
5
- import '../chunk-2K4747KX.js';
4
+ import '../chunk-2IGAUXYH.js';
5
+ import '../chunk-R3YXYVWF.js';
6
+ import '../chunk-J54XXKQD.js';
6
7
  import '../chunk-4PTQYT5J.js';
7
8
  import '../chunk-AUVKRXRC.js';
8
9
  import '../chunk-NOPS5EIH.js';
@@ -1,4 +1,4 @@
1
- import { D as DataProvider, W as WriteEvent, I as InvalidationKey } from '../types-CtJxwoyv.js';
1
+ import { D as DataProvider, W as WriteEvent, I as InvalidationKey } from '../types-BriIV4e_.js';
2
2
 
3
3
  /**
4
4
  * The cache keys a committed write makes stale beyond `[resource]`: the
@@ -0,0 +1,25 @@
1
+ import { UseQueryResult } from '@tanstack/react-query';
2
+ import { R as ResolveAggregateOptions } from '../aggregate-Y5IJ5aPn.js';
3
+ import { A as AggregateParams, b as AggregateResult } from '../types-BriIV4e_.js';
4
+ import { LiveOptions } from './use-live.js';
5
+
6
+ interface UseAggregateOptions extends ResolveAggregateOptions {
7
+ /** Default true. False waits (on a scope, say) and fetches nothing. */
8
+ enabled?: boolean;
9
+ /**
10
+ * Keep the totals current while mounted: work them out again when the provider reports a
11
+ * change to the resource (`DataProvider.subscribe`). Off by default.
12
+ */
13
+ live?: boolean | LiveOptions;
14
+ }
15
+ /**
16
+ * Totals over a resource's rows (count, and sum, average, lowest or highest of a field), through
17
+ * the data provider: its `aggregate`, or `resolveAggregate`'s fallback. Cached under the
18
+ * resource's key, so any write to the resource through Genesis makes them stale, and `live`
19
+ * keeps them current with changes made elsewhere. A widget reads a view's totals with it.
20
+ *
21
+ * @stability Beta
22
+ */
23
+ declare function useAggregate(resource: string, params: AggregateParams, options?: UseAggregateOptions): UseQueryResult<AggregateResult>;
24
+
25
+ export { type UseAggregateOptions, useAggregate };
@@ -0,0 +1,10 @@
1
+ export { useAggregate } from '../chunk-XPBS5YE4.js';
2
+ import '../chunk-E3K2A3PK.js';
3
+ import '../chunk-2IGAUXYH.js';
4
+ import '../chunk-R3YXYVWF.js';
5
+ import '../chunk-J54XXKQD.js';
6
+ import '../chunk-4PTQYT5J.js';
7
+ import '../chunk-AUVKRXRC.js';
8
+ import '../chunk-HUNGCTRA.js';
9
+ //# sourceMappingURL=use-aggregate.js.map
10
+ //# sourceMappingURL=use-aggregate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"use-aggregate.js"}
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import { t as ProviderCapabilities } from '../types-CtJxwoyv.js';
2
+ import { P as ProviderCapabilities } from '../types-BriIV4e_.js';
3
3
 
4
4
  /**
5
5
  * The query key for `provider`'s capabilities for `resource`. It includes
@@ -1,5 +1,7 @@
1
- export { capabilitiesQueryKey, useCapabilities } from '../chunk-KA3BUJ4H.js';
2
- import '../chunk-2K4747KX.js';
1
+ export { capabilitiesQueryKey, useCapabilities } from '../chunk-42NVJJTT.js';
2
+ import '../chunk-R3YXYVWF.js';
3
+ import '../chunk-J54XXKQD.js';
3
4
  import '../chunk-4PTQYT5J.js';
5
+ import '../chunk-HUNGCTRA.js';
4
6
  //# sourceMappingURL=use-capabilities.js.map
5
7
  //# sourceMappingURL=use-capabilities.js.map
@@ -1,6 +1,6 @@
1
- export { useDraft } from '../chunk-YZV3Z6ZA.js';
2
- import '../chunk-5ASUMG6K.js';
1
+ export { useDraft } from '../chunk-SQLM5CIJ.js';
3
2
  import '../chunk-AJGVLF37.js';
3
+ import '../chunk-5ASUMG6K.js';
4
4
  import '../chunk-WLDSIQJ2.js';
5
5
  //# sourceMappingURL=use-draft.js.map
6
6
  //# sourceMappingURL=use-draft.js.map
@@ -1,5 +1,5 @@
1
1
  import { UseInfiniteQueryResult, InfiniteData } from '@tanstack/react-query';
2
- import { S as SortParam, a as FilterParam, s as ListResult, L as ListParams, B as BaseRecord } from '../types-CtJxwoyv.js';
2
+ import { S as SortParam, a as FilterParam, L as ListResult, c as ListParams, B as BaseRecord } from '../types-BriIV4e_.js';
3
3
  import { LiveOptions } from './use-live.js';
4
4
 
5
5
  interface UseInfiniteResourceOptions {
@@ -1,8 +1,10 @@
1
- export { useInfiniteResource } from '../chunk-G6GQPXQS.js';
2
- import '../chunk-S2VYJWB4.js';
3
- import '../chunk-7PUFVNPB.js';
4
- import '../chunk-2K4747KX.js';
1
+ export { useInfiniteResource } from '../chunk-M5IX7C6U.js';
2
+ import '../chunk-E3K2A3PK.js';
3
+ import '../chunk-2IGAUXYH.js';
4
+ import '../chunk-R3YXYVWF.js';
5
+ import '../chunk-J54XXKQD.js';
5
6
  import '../chunk-4PTQYT5J.js';
6
7
  import '../chunk-AUVKRXRC.js';
8
+ import '../chunk-HUNGCTRA.js';
7
9
  //# sourceMappingURL=use-infinite-resource.js.map
8
10
  //# sourceMappingURL=use-infinite-resource.js.map
@@ -1,4 +1,4 @@
1
- import { a as FilterParam } from '../types-CtJxwoyv.js';
1
+ import { a as FilterParam } from '../types-BriIV4e_.js';
2
2
 
3
3
  interface LinkTarget {
4
4
  /** The linked resource. */
@@ -1,10 +1,12 @@
1
- export { useLinkOptions } from '../chunk-DFABPMEQ.js';
2
- import '../chunk-WDPM5TBO.js';
3
- import '../chunk-G6GQPXQS.js';
4
- import '../chunk-S2VYJWB4.js';
5
- import '../chunk-7PUFVNPB.js';
6
- import '../chunk-2K4747KX.js';
1
+ export { useLinkOptions } from '../chunk-POUI7GAI.js';
2
+ import '../chunk-UDSTWXXZ.js';
3
+ import '../chunk-M5IX7C6U.js';
4
+ import '../chunk-E3K2A3PK.js';
5
+ import '../chunk-2IGAUXYH.js';
6
+ import '../chunk-R3YXYVWF.js';
7
+ import '../chunk-J54XXKQD.js';
7
8
  import '../chunk-4PTQYT5J.js';
8
9
  import '../chunk-AUVKRXRC.js';
10
+ import '../chunk-HUNGCTRA.js';
9
11
  //# sourceMappingURL=use-link-options.js.map
10
12
  //# sourceMappingURL=use-link-options.js.map
@@ -1,5 +1,5 @@
1
1
  import { QueryKey } from '@tanstack/react-query';
2
- import { V as SubscribeParams, w as ResourceChangeEvent } from '../types-CtJxwoyv.js';
2
+ import { f as SubscribeParams, g as ResourceChangeEvent } from '../types-BriIV4e_.js';
3
3
 
4
4
  /** How long a burst of change events is gathered into one refetch. */
5
5
  declare const DEFAULT_LIVE_DEBOUNCE_MS = 250;
@@ -1,6 +1,8 @@
1
- export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, useLiveInvalidation } from '../chunk-S2VYJWB4.js';
2
- import '../chunk-2K4747KX.js';
1
+ export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, useLiveInvalidation } from '../chunk-E3K2A3PK.js';
2
+ import '../chunk-R3YXYVWF.js';
3
+ import '../chunk-J54XXKQD.js';
3
4
  import '../chunk-4PTQYT5J.js';
4
5
  import '../chunk-AUVKRXRC.js';
6
+ import '../chunk-HUNGCTRA.js';
5
7
  //# sourceMappingURL=use-live.js.map
6
8
  //# sourceMappingURL=use-live.js.map
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import { B as BaseRecord, b as Identifier } from '../types-CtJxwoyv.js';
2
+ import { B as BaseRecord, d as Identifier } from '../types-BriIV4e_.js';
3
3
  import { LiveOptions } from './use-live.js';
4
4
 
5
5
  interface UseOneOptions {
@@ -1,8 +1,10 @@
1
- export { useOne } from '../chunk-NE2D74BP.js';
2
- import '../chunk-S2VYJWB4.js';
3
- import '../chunk-7PUFVNPB.js';
4
- import '../chunk-2K4747KX.js';
1
+ export { useOne } from '../chunk-QGWQ6LK3.js';
2
+ import '../chunk-E3K2A3PK.js';
3
+ import '../chunk-2IGAUXYH.js';
4
+ import '../chunk-R3YXYVWF.js';
5
+ import '../chunk-J54XXKQD.js';
5
6
  import '../chunk-4PTQYT5J.js';
6
7
  import '../chunk-AUVKRXRC.js';
8
+ import '../chunk-HUNGCTRA.js';
7
9
  //# sourceMappingURL=use-one.js.map
8
10
  //# sourceMappingURL=use-one.js.map
@@ -1,5 +1,7 @@
1
- export { usePersistedUiState } from '../chunk-SDAJSJNN.js';
2
- import '../chunk-2K4747KX.js';
1
+ export { usePersistedUiState } from '../chunk-IYGVJFCV.js';
2
+ import '../chunk-R3YXYVWF.js';
3
+ import '../chunk-J54XXKQD.js';
3
4
  import '../chunk-4PTQYT5J.js';
5
+ import '../chunk-HUNGCTRA.js';
4
6
  //# sourceMappingURL=use-persisted-ui-state.js.map
5
7
  //# sourceMappingURL=use-persisted-ui-state.js.map
@@ -1,4 +1,4 @@
1
- import { D as DataProvider, l as FieldReference, b as Identifier } from '../types-CtJxwoyv.js';
1
+ import { D as DataProvider, e as FieldReference, d as Identifier } from '../types-BriIV4e_.js';
2
2
 
3
3
  interface UseRelationLabelOptions {
4
4
  /** The linked row's field that names it. Default: the linked resource's `labelField` (`describe`). */
@@ -1,5 +1,7 @@
1
- export { loadRelationLabel, relationNamingField, useRelationLabel } from '../chunk-WDPM5TBO.js';
2
- import '../chunk-2K4747KX.js';
1
+ export { loadRelationLabel, relationNamingField, useRelationLabel } from '../chunk-UDSTWXXZ.js';
2
+ import '../chunk-R3YXYVWF.js';
3
+ import '../chunk-J54XXKQD.js';
3
4
  import '../chunk-4PTQYT5J.js';
5
+ import '../chunk-HUNGCTRA.js';
4
6
  //# sourceMappingURL=use-relation-label.js.map
5
7
  //# sourceMappingURL=use-relation-label.js.map
@@ -1,5 +1,5 @@
1
1
  import { UseFormReturn } from 'react-hook-form';
2
- import { y as ResourceFormFieldDef, I as InvalidationKey } from '../types-CtJxwoyv.js';
2
+ import { R as ResourceFormFieldDef, I as InvalidationKey } from '../types-BriIV4e_.js';
3
3
  import { W as WriteConflict } from '../write-state-DVC4Yq9T.js';
4
4
  import { MutationModeOptions } from './mutation-mode.js';
5
5
  import '@tanstack/react-query';
@@ -1,14 +1,15 @@
1
- export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-OYDJGPDY.js';
1
+ export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-FXPODKCK.js';
2
2
  import '../chunk-LKRJB632.js';
3
+ import '../chunk-QGWQ6LK3.js';
3
4
  import '../chunk-RVWKVD5Q.js';
5
+ import '../chunk-SOO54YYY.js';
4
6
  import '../chunk-7NUL32W7.js';
5
- import '../chunk-NE2D74BP.js';
6
- import '../chunk-S2VYJWB4.js';
7
- import '../chunk-RFHUOXZC.js';
8
- import '../chunk-KA3BUJ4H.js';
7
+ import '../chunk-42NVJJTT.js';
9
8
  import '../chunk-AJGVLF37.js';
10
- import '../chunk-7PUFVNPB.js';
11
- import '../chunk-2K4747KX.js';
9
+ import '../chunk-E3K2A3PK.js';
10
+ import '../chunk-2IGAUXYH.js';
11
+ import '../chunk-R3YXYVWF.js';
12
+ import '../chunk-J54XXKQD.js';
12
13
  import '../chunk-4PTQYT5J.js';
13
14
  import '../chunk-AUVKRXRC.js';
14
15
  import '../chunk-NOPS5EIH.js';
@@ -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-CtJxwoyv.js';
2
+ import { S as SortParam, a as FilterParam, I as InvalidationKey, L as ListResult, c as ListParams, d as Identifier, B as BaseRecord } from '../types-BriIV4e_.js';
3
3
  import { MutationModeOptions } from './mutation-mode.js';
4
4
  import { LiveOptions } from './use-live.js';
5
5
 
@@ -1,11 +1,12 @@
1
- export { useResource } from '../chunk-P3FHXRS2.js';
1
+ export { useResource } from '../chunk-ALLWIK62.js';
2
+ import '../chunk-SOO54YYY.js';
2
3
  import '../chunk-7NUL32W7.js';
3
- import '../chunk-S2VYJWB4.js';
4
- import '../chunk-RFHUOXZC.js';
5
- import '../chunk-KA3BUJ4H.js';
4
+ import '../chunk-42NVJJTT.js';
6
5
  import '../chunk-AJGVLF37.js';
7
- import '../chunk-7PUFVNPB.js';
8
- import '../chunk-2K4747KX.js';
6
+ import '../chunk-E3K2A3PK.js';
7
+ import '../chunk-2IGAUXYH.js';
8
+ import '../chunk-R3YXYVWF.js';
9
+ import '../chunk-J54XXKQD.js';
9
10
  import '../chunk-4PTQYT5J.js';
10
11
  import '../chunk-AUVKRXRC.js';
11
12
  import '../chunk-NOPS5EIH.js';
@@ -1,5 +1,5 @@
1
1
  import { QueryClient, MutationOptions } from '@tanstack/react-query';
2
- import { I as InvalidationKey } from '../types-CtJxwoyv.js';
2
+ import { I as InvalidationKey } from '../types-BriIV4e_.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,12 +1,14 @@
1
- import { L as ListParams, b as Identifier } from './types-CtJxwoyv.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-CtJxwoyv.js';
3
- export { D as DataWriteError, a as DataWriteErrorOptions, N as NO_ROWS_MATCHED, W as WriteOutcome, i as isDataWriteError } from './write-outcome-Goy1v39G.js';
1
+ import { c as ListParams, d as Identifier } from './types-BriIV4e_.js';
2
+ export { i as AggregateMetric, A as AggregateParams, b as AggregateResult, k as ArrayFilter, h as AuditEntry, B as BaseRecord, l as BulkChange, m as BulkResult, C as ControlHint, n as CountMode, o as CreateParams, p as CreateResult, D as DataProvider, j as DataRow, q as DeleteParams, r as DeleteResult, s as FieldPermissions, e as FieldReference, F as FieldSchema, t as FieldType, u as FilterOperator, a as FilterParam, G as GetManyParams, v as GetManyResult, w as GetOneParams, x as GetOneResult, H as HistoryParams, y as ImportParams, I as InvalidationKey, L as ListResult, N as NullFilter, z as PaginationParam, P as ProviderCapabilities, E as RangeFilter, J as RecordComment, K as ResourceAccess, g as ResourceChangeEvent, M as ResourceContract, R as ResourceFormFieldDef, O as ResourceRelation, Q as ResourceSchema, T as ResourceSummary, U as RowAction, V as RowFailure, X as RowOf, Y as ScalarFilter, Z as SelectOption, S as SortParam, _ as StorageType, f as SubscribeParams, $ as UpdateParams, a0 as UpdateResult, a1 as VersionField, a2 as WidgetHint, W as WriteEvent, a3 as defineResource, a4 as fieldControl } from './types-BriIV4e_.js';
3
+ export { R as ResolveAggregateOptions, a as aggregateProblems, r as resolveAggregate, t as toAggregateValues } from './aggregate-Y5IJ5aPn.js';
4
+ export { D as DataWriteError, a as DataWriteErrorOptions, N as NO_ROWS_MATCHED, W as WriteOutcome, i as isDataWriteError } from './write-outcome-CkQXgtJq.js';
4
5
  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
6
  export { D as DataReadError, a as DataReadErrorOptions, R as ReadOutcome, i as isDataReadError, r as readFailureMessage } from './read-outcome-BnboMYOV.js';
6
7
  export { S as StorageAdapter } from './types-DKcxHXxq.js';
7
8
  export { createLocalStorageAdapter, createMemoryStorageAdapter, createNoopStorageAdapter } from './storage/index.js';
8
9
  export { UpdateOptions, UseResourceOptions, UseResourceReturn, useResource } from './hooks/use-resource.js';
9
10
  export { UseOneOptions, useOne } from './hooks/use-one.js';
11
+ export { UseAggregateOptions, useAggregate } from './hooks/use-aggregate.js';
10
12
  export { UseRelationLabelOptions, loadRelationLabel, relationNamingField, useRelationLabel } from './hooks/use-relation-label.js';
11
13
  export { LinkOption, LinkTarget, UseLinkOptionsOptions, UseLinkOptionsReturn, useLinkOptions } from './hooks/use-link-options.js';
12
14
  export { InfinitePageParam, UseInfiniteResourceOptions, UseInfiniteResourceReturn, useInfiniteResource } from './hooks/use-infinite-resource.js';
@@ -28,10 +30,12 @@ import { Query } from '@tanstack/react-query';
28
30
  export { isSafeUrl, normalizeLinkUrl } from './urls.js';
29
31
  export { ClassifiedError, ClassifyErrorOptions, ErrorKind, ErrorMessages, ErrorReportContext, ErrorReporter, classifyError, defaultErrorReporter, errorMessages, getErrorReporter, reportError, setErrorReporter } from './errors.js';
30
32
  export { titleCase } from './utils.js';
31
- import 'react';
33
+ import { A as AppearancePreferenceValues, R as ResolvedAppearancePreferences, a as AppearancePreferenceLayers, b as Appearance, D as Density } from './workspaces-CxpiFu2-.js';
34
+ export { c as APPEARANCES, d as AppearancePreferenceSource, e as DENSITIES, G as GENESIS_APPEARANCE_DEFAULTS, i as isAppearance, f as isDensity, r as resolveAppearancePreferences, t as toAppearancePreferenceValues } from './workspaces-CxpiFu2-.js';
35
+ import * as react from 'react';
36
+ import { ReactNode } from 'react';
32
37
  import './types-CsKSAKqs.js';
33
38
  import './dates.js';
34
- import './workspaces.js';
35
39
  import 'react-hook-form';
36
40
 
37
41
  /** Who and when a key is for. `viewer` is required; null means signed out. */
@@ -102,6 +106,106 @@ declare function resourceKeys(resource: string): {
102
106
  detailsOf: (id: Identifier | null | undefined) => readonly [string, "detail", Identifier | null | undefined];
103
107
  detail: (id: Identifier | null | undefined, select?: string) => readonly [string, "detail", Identifier | null | undefined, string | undefined];
104
108
  infinite: (params: unknown) => readonly [string, "infinite", unknown];
109
+ /** Totals over a list (`useAggregate`): any write to the resource makes them stale. */
110
+ aggregate: (params: unknown) => readonly [string, "aggregate", unknown];
105
111
  };
106
112
 
107
- export { Identifier, type KeyFilter, type KeyScope, ListParams, type QueryKeys, type ScopedKey, defineQueryKeys, resourceKeys };
113
+ /**
114
+ * Where a person's appearance preferences are kept: an adapter an app backs with its own server
115
+ * table (a `profiles` row, say), so the choice follows the person. `read` may be async; return
116
+ * null when the person has chosen nothing. `subscribe` (optional) reports a change made elsewhere.
117
+ *
118
+ * @stability Beta
119
+ */
120
+ interface AppearancePreferencesStore {
121
+ read(): AppearancePreferenceValues | null | undefined | Promise<AppearancePreferenceValues | null | undefined>;
122
+ write(values: AppearancePreferenceValues): void | Promise<void>;
123
+ subscribe?(onChange: (values: AppearancePreferenceValues | null) => void): () => void;
124
+ }
125
+ /** What `defineAppearancePreferences` accepts. */
126
+ interface AppearancePreferencesDefinition {
127
+ /** Where the person's choice is kept beyond this device. Unset: the device only. */
128
+ store?: AppearancePreferencesStore;
129
+ /** The device copy's storage key (`useStorage()`). Default `genesis-appearance`. */
130
+ storageKey?: string;
131
+ /** Values the app fixes: nobody below can change them. */
132
+ lock?: AppearancePreferenceValues;
133
+ }
134
+ /** A defined appearance-preferences setup. */
135
+ interface AppearancePreferences {
136
+ readonly store?: AppearancePreferencesStore;
137
+ readonly storageKey: string;
138
+ readonly lock: Readonly<AppearancePreferenceValues>;
139
+ }
140
+ /**
141
+ * Declare where a person's appearance and density are kept and what the app locks. Checks the
142
+ * lock and returns it frozen; throws on a value that isn't an appearance or a density.
143
+ *
144
+ * ```ts
145
+ * export const appearance = defineAppearancePreferences({
146
+ * store: {
147
+ * read: () => api.myPreferences(), // { appearance: "dark", density: "compact" }
148
+ * write: (values) => api.saveMyPreferences(values),
149
+ * },
150
+ * lock: { density: "comfortable" },
151
+ * });
152
+ * ```
153
+ *
154
+ * @stability Beta
155
+ */
156
+ declare function defineAppearancePreferences(definition?: AppearancePreferencesDefinition): AppearancePreferences;
157
+ /** What `useAppearancePreferences` returns. */
158
+ interface UseAppearancePreferencesReturn extends ResolvedAppearancePreferences {
159
+ /** The person's own choice (the store's, else this device's), before the order is applied. */
160
+ person: AppearancePreferenceValues;
161
+ /** Which values the app has locked. */
162
+ locked: {
163
+ appearance: boolean;
164
+ density: boolean;
165
+ };
166
+ /**
167
+ * Every layer as given, for a component with a default of its own to put in the order
168
+ * (`AppShell` puts its `options.density` under the theme's).
169
+ */
170
+ layers: AppearancePreferenceLayers;
171
+ /** False until the store's first read has answered. */
172
+ ready: boolean;
173
+ /** Save the person's appearance (`undefined` clears it back to the defaults). Ignored when locked. */
174
+ setAppearance(appearance: Appearance | undefined): void;
175
+ /** Save the person's density (`undefined` clears it). Ignored when locked. */
176
+ setDensity(density: Density | undefined): void;
177
+ }
178
+ interface AppearancePreferencesProviderProps {
179
+ /** From `defineAppearancePreferences`. Default: this device only, nothing locked. */
180
+ preferences?: AppearancePreferences;
181
+ /** The active organization's defaults (`resolveWorkspaceAppearance(workspace)`). */
182
+ organization?: AppearancePreferenceValues | undefined;
183
+ /** The app theme's defaults. */
184
+ theme?: AppearancePreferenceValues | undefined;
185
+ children: ReactNode;
186
+ }
187
+ /**
188
+ * Serves a person's appearance and density to the tree, resolved in the written order. Reads the
189
+ * store once on mount (and on its `subscribe`), keeps a copy on the device, and writes both when
190
+ * the person changes a value.
191
+ *
192
+ * @stability Beta
193
+ */
194
+ declare function AppearancePreferencesProvider({ preferences, organization, theme, children }: AppearancePreferencesProviderProps): react.JSX.Element;
195
+ /**
196
+ * The person's appearance and density, resolved, with setters. Throws outside an
197
+ * `AppearancePreferencesProvider`; a component that works with or without one reads
198
+ * `useOptionalAppearancePreferences`.
199
+ *
200
+ * @stability Beta
201
+ */
202
+ declare function useAppearancePreferences(): UseAppearancePreferencesReturn;
203
+ /**
204
+ * Like `useAppearancePreferences`, but null outside a provider: for a component (a shell, a
205
+ * theme provider) that keeps its own behaviour when an app hasn't set preferences up.
206
+ *
207
+ * @stability Beta
208
+ */
209
+ declare function useOptionalAppearancePreferences(): UseAppearancePreferencesReturn | null;
210
+
211
+ export { Appearance, AppearancePreferenceLayers, AppearancePreferenceValues, type AppearancePreferences, type AppearancePreferencesDefinition, AppearancePreferencesProvider, type AppearancePreferencesProviderProps, type AppearancePreferencesStore, Density, Identifier, type KeyFilter, type KeyScope, ListParams, type QueryKeys, ResolvedAppearancePreferences, type ScopedKey, type UseAppearancePreferencesReturn, defineAppearancePreferences, defineQueryKeys, resourceKeys, useAppearancePreferences, useOptionalAppearancePreferences };