@marktiderman/genesis-core 2.4.1 → 2.6.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 (54) hide show
  1. package/README.md +42 -0
  2. package/dist/{chunk-ZIMQUFXD.js → chunk-37RWGNIO.js} +9 -4
  3. package/dist/chunk-37RWGNIO.js.map +1 -0
  4. package/dist/chunk-BIIENNTW.js +497 -0
  5. package/dist/chunk-BIIENNTW.js.map +1 -0
  6. package/dist/{chunk-XMC4EJUE.js → chunk-EHFYSJJA.js} +6 -3
  7. package/dist/chunk-EHFYSJJA.js.map +1 -0
  8. package/dist/chunk-LZVU5NGV.js +82 -0
  9. package/dist/chunk-LZVU5NGV.js.map +1 -0
  10. package/dist/{chunk-X6EO3XBB.js → chunk-OKCSGNCU.js} +9 -4
  11. package/dist/chunk-OKCSGNCU.js.map +1 -0
  12. package/dist/{chunk-5NEOX2N7.js → chunk-OWYX4BEI.js} +4 -4
  13. package/dist/{chunk-5NEOX2N7.js.map → chunk-OWYX4BEI.js.map} +1 -1
  14. package/dist/csv.d.ts +1 -3
  15. package/dist/dates.d.ts +199 -1
  16. package/dist/dates.js +1 -1
  17. package/dist/errors.d.ts +8 -1
  18. package/dist/errors.js +1 -1
  19. package/dist/form-types.d.ts +1 -70
  20. package/dist/hooks/index.d.ts +3 -4
  21. package/dist/hooks/index.js +7 -6
  22. package/dist/hooks/mutation-mode.d.ts +1 -3
  23. package/dist/hooks/related-keys.d.ts +1 -3
  24. package/dist/hooks/use-capabilities.d.ts +1 -2
  25. package/dist/hooks/use-infinite-resource.d.ts +1 -3
  26. package/dist/hooks/use-link-options.d.ts +58 -0
  27. package/dist/hooks/use-link-options.js +10 -0
  28. package/dist/hooks/use-link-options.js.map +1 -0
  29. package/dist/hooks/use-live.d.ts +1 -3
  30. package/dist/hooks/use-one.d.ts +1 -3
  31. package/dist/hooks/use-relation-label.d.ts +8 -4
  32. package/dist/hooks/use-relation-label.js +1 -1
  33. package/dist/hooks/use-resource-form.d.ts +1 -3
  34. package/dist/hooks/use-resource-form.js +2 -2
  35. package/dist/hooks/use-resource.d.ts +1 -3
  36. package/dist/hooks/use-write.d.ts +1 -3
  37. package/dist/index.d.ts +5 -6
  38. package/dist/index.js +7 -6
  39. package/dist/provider/index.d.ts +4 -6
  40. package/dist/resource-view/index.d.ts +118 -4
  41. package/dist/resource-view/index.js +148 -35
  42. package/dist/resource-view/index.js.map +1 -1
  43. package/dist/schema/index.d.ts +3 -5
  44. package/dist/testing/index.d.ts +2 -4
  45. package/dist/types-r_Rlw7BB.d.ts +800 -0
  46. package/dist/{write-outcome-CFnpciUI.d.ts → write-outcome-BWV34wh5.d.ts} +1 -1
  47. package/package.json +1 -1
  48. package/dist/chunk-3B4IFDMK.js +0 -117
  49. package/dist/chunk-3B4IFDMK.js.map +0 -1
  50. package/dist/chunk-X6EO3XBB.js.map +0 -1
  51. package/dist/chunk-XMC4EJUE.js.map +0 -1
  52. package/dist/chunk-ZIMQUFXD.js.map +0 -1
  53. package/dist/types-CXhqXPN1.d.ts +0 -367
  54. package/dist/types-o8j7g6O6.d.ts +0 -331
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/viewer-scope.tsx","../src/hooks/workspace-scope.tsx"],"names":["Fragment","createContext","useContext","useMemo","useEffect","jsx"],"mappings":";;;;;;;;;;AAUA,IAAI,cAAA,GAAiB,KAAA;AAOrB,SAAS,WAAW,KAAA,EAA+C;AACjE,EAAA,IAAI,QAAA,GAAW,KAAA;AACf,EAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAwB;AACrC,IAAA,IAAI,MAAM,OAAA,CAAQ,CAAC,GAAG,OAAO,CAAA,CAAE,IAAI,KAAK,CAAA,CAAE,GAAA,CAAI,CAAC,MAAM,CAAC,UAAA,CAAW,CAAC,CAAA,EAAG,CAAC,CAAU,CAAA,CAAE,IAAA,CAAK,CAAC,CAAC,CAAC,CAAA,EAAG,CAAC,CAAC,CAAA,KAAO,CA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AAI,SAAS,QAAA,KAAa,MAAA,GAAY,EAAE,aAAA,EAAe,OAAA,CAAQ,QAAA,EAAS,GAAI,EAAC;AAAA,MAE7E;AAAA;AAAA,GACH,EACF,CAAA;AAEJ","file":"chunk-5NEOX2N7.js","sourcesContent":["import { useQueryClient, type QueryClient } from \"@tanstack/react-query\";\nimport { createContext, Fragment, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\nimport { dayIn, isTimeZone, personTimeZone, type Day } from \"../dates\";\nimport { reportError } from \"../errors\";\nimport { stableJson } from \"./draft-controller\";\nimport { NO_VIEWER, type GenesisViewerRoles, type Viewer } from \"../viewer\";\nimport { dropPendingWrites, flushPendingWrites } from \"./mutation-mode\";\n\nexport { NO_VIEWER, type GenesisViewerRoles, type Viewer };\n\nlet warnedNotPlain = false;\n\n/**\n * Roles as a value: object keys and lists sorted, so `[\"editor\", \"owner\"]` equals\n * `[\"owner\", \"editor\"]`. A Set, Map or class would stringify as `{}` and hide a change: in\n * development that throws; in production it warns once and the roles count as unknown (undefined).\n */\nfunction rolesKeyOf(roles: GenesisViewerRoles): string | undefined {\n let notPlain = false;\n const plain = (v: unknown): unknown => {\n if (Array.isArray(v)) return v.map(plain).map((x) => [stableJson(x), x] as const).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)).map(([, x]) => x);\n if (v && typeof v === \"object\") {\n const proto = Object.getPrototypeOf(v);\n if (proto !== Object.prototype && proto !== null) {\n if (process.env.NODE_ENV !== \"production\") throw new TypeError(\"[genesis-core] ViewerScope roles must be plain JSON (no Set, Map or class)\");\n notPlain = true;\n return null;\n }\n return Object.fromEntries(Object.entries(v as Record<string, unknown>).map(([k, x]) => [k, plain(x)]));\n }\n return v;\n };\n const key = stableJson(plain(roles));\n if (!notPlain) return key;\n if (!warnedNotPlain) {\n warnedNotPlain = true;\n reportError(new TypeError(\"ViewerScope roles must be plain JSON (no Set, Map or class); treating them as unknown, so guards that need them refuse\"), \"core:viewer-scope\");\n }\n return undefined;\n}\n\n/** Today in `zone`, rechecked when the page comes back into view and at the next minute boundary while it's open. */\nfunction useToday(zone: string): Day {\n const [day, setDay] = useState(() => dayIn(zone));\n useEffect(() => {\n const check = () => setDay(dayIn(zone));\n check();\n const onVisible = () => {\n if (typeof document === \"undefined\" || document.visibilityState === \"visible\") check();\n };\n if (typeof document !== \"undefined\") document.addEventListener(\"visibilitychange\", onVisible);\n // A page left open over midnight rolls over within a minute.\n const timer = setInterval(check, 60_000);\n return () => {\n if (typeof document !== \"undefined\") document.removeEventListener(\"visibilitychange\", onVisible);\n clearInterval(timer);\n };\n }, [zone]);\n return day;\n}\n\n/**\n * Empties the query cache for a new viewer: sends the old viewer's waiting\n * undoable writes (the session is still theirs), cancels reads in flight,\n * then removes every query. Call it in the sign-in and sign-out actions,\n * before the session changes.\n */\nexport async function clearViewerCache(queryClient: QueryClient): Promise<void> {\n await flushPendingWrites(queryClient);\n await queryClient.cancelQueries();\n queryClient.clear();\n}\n\n/**\n * Where the viewer is working: the person, space or set of people Genesis knows by name, plus\n * whatever the app scopes to under its own key (`{ orgId }`, `{ leagueId }`, `{ locationId }`).\n * Screens turn it into server filters and create defaults (a view's `scope: [\"league_id\"]` reads\n * `league_id`, then `leagueId`); it never decides access (row-level security does).\n */\nexport interface ResourceScope {\n personId?: string;\n spaceId?: string;\n /** Several people at once (a coach's client list, a group). */\n personIds?: readonly string[];\n /** The app's own scope keys: `orgId`, `leagueId`, `locationId`, … */\n [key: string]: unknown;\n}\n\nexport interface ViewerContext {\n viewer: string | null;\n scope: ResourceScope;\n /** The viewer's roles (see `GenesisViewerRoles`), when ViewerScope was given them. */\n roles?: GenesisViewerRoles;\n /** The zone the viewer's days are counted in: theirs if known, else the device's. */\n timeZone: string;\n /**\n * The zone of whatever the viewer is scoped to (a location, a league), for columns with\n * `timeZone: \"scope\"`: ViewerScope's `scopeTimeZone` when valid, else {@link timeZone}.\n */\n scopeTimeZone?: string;\n /**\n * Today on the viewer's clock (YYYY-MM-DD), kept current when the page comes back into view.\n * Use it for every \"today\" read and as query keys' `day`: `keys.for(useViewerScope())`.\n */\n day: Day;\n}\n\nconst ViewerContextValue = createContext<ViewerContext | null>(null);\n\n/** The viewer and scope from the nearest `ViewerScope`. Throws without one: screens that cache per viewer need it. */\nexport function useViewerScope(): ViewerContext {\n const value = useContext(ViewerContextValue);\n if (!value) throw new Error(\"[genesis-core] useViewerScope needs a <ViewerScope> above it\");\n return value;\n}\n\n/** Like useViewerScope, or null outside a ViewerScope. */\nexport function useOptionalViewerScope(): ViewerContext | null {\n return useContext(ViewerContextValue);\n}\n\n/**\n * The viewer for guards: `{ id, scope, roles }` from the nearest ViewerScope, or\n * {@link NO_VIEWER} without one. The object is stable while those are equal by value, so it can\n * sit in a memo's dependencies.\n */\nexport function useViewer(): Viewer {\n const context = useContext(ViewerContextValue);\n return useMemo<Viewer>(\n () =>\n context\n ? Object.freeze({ id: context.viewer, scope: context.scope, ...(context.roles !== undefined ? { roles: context.roles } : {}) })\n : NO_VIEWER,\n [context],\n );\n}\n\nexport interface ViewerScopeProps {\n /** The signed-in viewer's id, null when signed out, undefined while the session loads. */\n viewer: string | null | undefined;\n /**\n * The viewer a persisted cache was saved for. When the first known viewer\n * is this one, the restored cache is kept; otherwise it's emptied.\n */\n persistedViewer?: string | null;\n /** Where the viewer is working (see `ResourceScope`). Changing it doesn't remount or clear anything. */\n scope?: ResourceScope;\n /**\n * What the viewer may do there (see `GenesisViewerRoles`), for view guards. Compared by value,\n * so a new object with the same roles changes nothing. Undefined while they load: guards that\n * need them refuse. Arriving (undefined → roles) or going back to undefined changes nothing;\n * different roles send the person's waiting writes, then reread every query, with nothing\n * remounted. Plain JSON values only (lists are compared as sets, in any order): a Set, Map or\n * class instance throws in development; in production it warns once and the roles count as\n * unknown (as if undefined), so guards that need them refuse.\n */\n roles?: GenesisViewerRoles;\n /**\n * The viewer's saved time zone (IANA), when known; else the device's is used. Pass it when\n * rendering on a server, whose own zone is rarely the viewer's.\n */\n timeZone?: string | null;\n /**\n * The IANA zone of whatever the viewer is scoped to (a location, a league), when it has one.\n * Columns with `timeZone: \"scope\"` read on it; without it they read on the viewer's clock.\n */\n scopeTimeZone?: string | null;\n /** Shown while the session loads (and for the one render a change takes). */\n fallback?: ReactNode;\n children: ReactNode;\n}\n\n/**\n * The scope's clock: `scopeTimeZone` when the runtime knows it, else the viewer's. A zone it\n * doesn't know is never a quiet fallback: it throws in development, and in production it is\n * reported (`reportError`, once per zone) before the viewer's clock is used, so a misspelt zone can't show\n * times on the wrong clock unnoticed.\n */\nexport function scopeClock(scopeTimeZone: string | null | undefined, viewerZone: string): string {\n if (scopeTimeZone === undefined || scopeTimeZone === null || scopeTimeZone === \"\") return viewerZone;\n if (isTimeZone(scopeTimeZone)) return scopeTimeZone;\n const error = new RangeError(`[genesis-core] scopeTimeZone \"${scopeTimeZone}\" isn't a time zone this runtime knows (an IANA name such as \"Europe/Berlin\")`);\n if (process.env.NODE_ENV !== \"production\") throw error;\n // Once per zone: a bad zone in a long-lived screen must not flood the error reporter.\n if (!reportedScopeZones.has(scopeTimeZone)) {\n reportedScopeZones.add(scopeTimeZone);\n reportError(error, \"core:viewer-scope\");\n }\n return viewerZone;\n}\n\n/** The unknown scope zones already reported, so each is reported once per page load. */\nconst reportedScopeZones = new Set<string>();\n\n/**\n * Keeps one viewer's cached data from ever showing to the next. Children\n * render only once the viewer is known, under a key of that viewer, so a\n * sign-out or a new person signing in unmounts every screen and its queries\n * before the cache is emptied and the new viewer's screens mount fresh. The\n * first known viewer empties a restored cache too, unless it's the\n * `persistedViewer` it was saved for.\n *\n * ```tsx\n * <ViewerScope viewer={session === undefined ? undefined : (session?.user.id ?? null)}>\n * <App />\n * </ViewerScope>\n * ```\n */\nexport function ViewerScope({ viewer, persistedViewer, scope, roles, timeZone, scopeTimeZone, fallback = null, children }: ViewerScopeProps) {\n const queryClient = useQueryClient();\n const zone = personTimeZone({ timeZone });\n // Memoised, and scopeClock reports a zone once, so a bad zone isn't reported on every render.\n const scopeZone = useMemo(() => scopeClock(scopeTimeZone, zone), [scopeTimeZone, zone]);\n const day = useToday(zone);\n // A new scope object each render shouldn't re-render every reader: compare by value.\n const scopeKey = stableJson(scope ?? {});\n // Roles by value too: undefined stays undefined, so \"not known yet\" never equals \"none\".\n // Roles that aren't plain JSON count as unknown in production (rolesKeyOf warns; development throws).\n const rolesKey = roles === undefined ? undefined : rolesKeyOf(roles);\n const value = useMemo<ViewerContext>(\n () => ({ viewer: viewer ?? null, scope: scope ?? {}, ...(rolesKey !== undefined ? { roles } : {}), timeZone: zone, scopeTimeZone: scopeZone, day }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [viewer, scopeKey, rolesKey, zone, scopeZone, day],\n );\n // The last roles known for this viewer. Arriving (undefined → roles) or going back to undefined\n // changes nothing; different roles for the same person send their waiting writes, then reread\n // everything under the new roles. Nothing remounts: the person, their drafts and their\n // navigation are the same.\n const known = useRef<{ viewer: string | null | undefined; roles: string | undefined }>({ viewer, roles: undefined });\n useEffect(() => {\n if (known.current.viewer !== viewer) known.current = { viewer, roles: undefined };\n if (rolesKey === undefined) return;\n const previous = known.current.roles;\n known.current.roles = rolesKey;\n if (previous === undefined || previous === rolesKey) return;\n // The session is still theirs: their writes go out, and the database decides each one with the\n // roles as they are when it arrives (a refused one fails as any refused write does).\n void flushPendingWrites(queryClient).then(() => queryClient.invalidateQueries());\n }, [viewer, rolesKey, queryClient]);\n // Who the children were last mounted for, and how many times they were reset. Undefined before\n // the first mount.\n const [mounted, setMounted] = useState<{ viewer: string | null; epoch: number } | undefined>(undefined);\n if (viewer === undefined) return <>{fallback}</>;\n if (mounted === undefined || mounted.viewer !== viewer) {\n const keep = mounted === undefined && persistedViewer !== undefined && persistedViewer === viewer;\n // Nothing for the new viewer is mounted yet, so emptying now can't strand\n // a fetch; the old viewer's screens unmount with this render.\n if (!keep) {\n // The session already belongs to the new viewer: the old one's unsent\n // writes must never go out under it. (clearViewerCache, run before the\n // session changes, sends them instead.)\n dropPendingWrites(queryClient);\n void queryClient.cancelQueries();\n queryClient.clear();\n }\n setMounted({ viewer, epoch: (mounted?.epoch ?? 0) + 1 });\n return <>{fallback}</>;\n }\n return (\n <ViewerContextValue.Provider value={value}>\n <Fragment key={`${viewer ?? \"signed-out\"}#${mounted.epoch}`}>{children}</Fragment>\n </ViewerContextValue.Provider>\n );\n}\n","import { createContext, useContext, useEffect, useMemo } from \"react\";\nimport { ViewerScope, type ViewerScopeProps } from \"./viewer-scope\";\nimport { workspaceAt, workspaceHref, type Workspace, type WorkspaceHrefOptions } from \"../workspaces\";\n\n/**\n * The workspace the viewer is in, and where each of their others is from here.\n *\n * @stability Beta\n */\nexport interface WorkspaceContext<W extends Workspace = Workspace> {\n /** Undefined when the URL is in no workspace (the app's front door, a sign-in page). */\n current: W | undefined;\n workspaces: readonly W[];\n /** Where switching to `to` goes from the current URL, keeping the viewer's place when it can. */\n hrefFor: (to: W) => string;\n}\n\nconst WorkspaceContextValue = createContext<WorkspaceContext | null>(null);\n\n/**\n * The nearest `WorkspaceScope`'s workspaces, or null outside one.\n *\n * @stability Beta\n */\nexport function useWorkspace<W extends Workspace = Workspace>(): WorkspaceContext<W> | null {\n return useContext(WorkspaceContextValue) as WorkspaceContext<W> | null;\n}\n\nconst STORAGE_PREFIX = \"genesis:workspace:\";\n\n/**\n * The workspace this viewer was last in on this device, for the app's front door\n * (`defaultWorkspace(workspaces, rememberedWorkspaceId(viewer))`). Null when unknown.\n *\n * @stability Beta\n */\nexport function rememberedWorkspaceId(viewer: string | null | undefined): string | null {\n if (!viewer || typeof window === \"undefined\") return null;\n try {\n return window.localStorage.getItem(STORAGE_PREFIX + viewer);\n } catch {\n return null;\n }\n}\n\nfunction remember(viewer: string, id: string) {\n try {\n window.localStorage.setItem(STORAGE_PREFIX + viewer, id);\n } catch {\n // private mode or full: the front door falls back to the first tenant.\n }\n}\n\n/** @stability Beta */\nexport interface WorkspaceScopeProps<W extends Workspace = Workspace> extends Omit<ViewerScopeProps, \"scope\" | \"roles\" | \"scopeTimeZone\"> {\n /** Every workspace this viewer has. */\n workspaces: readonly W[];\n /** The current URL's path (`useLocation().pathname`): the workspace is read from it. */\n pathname: string;\n /** Scope keys every workspace adds to its own (rarely needed). */\n scope?: ViewerScopeProps[\"scope\"];\n /** How switching keeps the viewer's place (see `workspaceHref`). */\n keep?: WorkspaceHrefOptions[\"keep\"];\n}\n\n/**\n * `ViewerScope` for an app with workspaces: use it in place of `ViewerScope`. It reads the current\n * workspace from the URL and scopes everything under it to that workspace (its `scope`, `roles` and\n * `timeZone`), so every view with `scope: [\"org_id\"]` follows the switcher with no screen code. It\n * remembers the workspace per viewer on this device, and gives `WorkspaceSwitcher` its list.\n *\n * ```tsx\n * <WorkspaceScope viewer={userId} workspaces={workspaces} pathname={location.pathname}>\n * <AppShell headerSlot={<WorkspaceSwitcher linkComponent={Link} />} …>\n * </WorkspaceScope>\n * ```\n *\n * @stability Beta\n */\nexport function WorkspaceScope<W extends Workspace>({ workspaces, pathname, scope, keep, children, ...viewerProps }: WorkspaceScopeProps<W>) {\n const current = workspaceAt(workspaces, pathname);\n const value = useMemo<WorkspaceContext<W>>(\n () => ({\n current,\n workspaces,\n hrefFor: (to) => workspaceHref(workspaces, to, pathname, keep ? { keep } : {}),\n }),\n [current, workspaces, pathname, keep],\n );\n const viewer = viewerProps.viewer;\n useEffect(() => {\n if (viewer && current) remember(viewer, current.id);\n }, [viewer, current]);\n return (\n <WorkspaceContextValue.Provider value={value as unknown as WorkspaceContext}>\n <ViewerScope\n {...viewerProps}\n scope={{ ...scope, ...current?.scope }}\n {...(current?.roles !== undefined ? { roles: current.roles } : {})}\n {...(current?.timeZone !== undefined ? { scopeTimeZone: current.timeZone } : {})}\n >\n {children}\n </ViewerScope>\n </WorkspaceContextValue.Provider>\n );\n}\n\n"]}
1
+ {"version":3,"sources":["../src/hooks/viewer-scope.tsx","../src/hooks/workspace-scope.tsx"],"names":["Fragment","createContext","useContext","useMemo","useEffect","jsx"],"mappings":";;;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,CAAA;AAAA,EACpD,CAAA,EAAG,CAAC,MAAA,EAAQ,OAAO,CAAC,CAAA;AACpB,EAAA,uBACEC,GAAAA,CAAC,qBAAA,CAAsB,QAAA,EAAtB,EAA+B,OAC9B,QAAA,kBAAAA,GAAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACE,GAAG,WAAA;AAAA,MACJ,OAAO,EAAE,GAAG,KAAA,EAAO,GAAG,SAAS,KAAA,EAAM;AAAA,MACpC,GAAI,SAAS,KAAA,KAAU,MAAA,GAAY,EAAE,KAAA,EAAO,OAAA,CAAQ,KAAA,EAAM,GAAI,EAAC;AAAA,MAC/D,GAAI,SAAS,QAAA,KAAa,MAAA,GAAY,EAAE,aAAA,EAAe,OAAA,CAAQ,QAAA,EAAS,GAAI,EAAC;AAAA,MAE7E;AAAA;AAAA,GACH,EACF,CAAA;AAEJ","file":"chunk-OWYX4BEI.js","sourcesContent":["import { useQueryClient, type QueryClient } from \"@tanstack/react-query\";\nimport { createContext, Fragment, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\nimport { dayIn, isTimeZone, personTimeZone, type Day } from \"../dates\";\nimport { reportError } from \"../errors\";\nimport { stableJson } from \"./draft-controller\";\nimport { NO_VIEWER, type GenesisViewerRoles, type Viewer } from \"../viewer\";\nimport { dropPendingWrites, flushPendingWrites } from \"./mutation-mode\";\n\nexport { NO_VIEWER, type GenesisViewerRoles, type Viewer };\n\nlet warnedNotPlain = false;\n\n/**\n * Roles as a value: object keys and lists sorted, so `[\"editor\", \"owner\"]` equals\n * `[\"owner\", \"editor\"]`. A Set, Map or class would stringify as `{}` and hide a change: in\n * development that throws; in production it warns once and the roles count as unknown (undefined).\n */\nfunction rolesKeyOf(roles: GenesisViewerRoles): string | undefined {\n let notPlain = false;\n const plain = (v: unknown): unknown => {\n if (Array.isArray(v)) return v.map(plain).map((x) => [stableJson(x), x] as const).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)).map(([, x]) => x);\n if (v && typeof v === \"object\") {\n const proto = Object.getPrototypeOf(v);\n if (proto !== Object.prototype && proto !== null) {\n if (process.env.NODE_ENV !== \"production\") throw new TypeError(\"[genesis-core] ViewerScope roles must be plain JSON (no Set, Map or class)\");\n notPlain = true;\n return null;\n }\n return Object.fromEntries(Object.entries(v as Record<string, unknown>).map(([k, x]) => [k, plain(x)]));\n }\n return v;\n };\n const key = stableJson(plain(roles));\n if (!notPlain) return key;\n if (!warnedNotPlain) {\n warnedNotPlain = true;\n reportError(new TypeError(\"ViewerScope roles must be plain JSON (no Set, Map or class); treating them as unknown, so guards that need them refuse\"), \"core:viewer-scope\");\n }\n return undefined;\n}\n\n/** Today in `zone`, rechecked when the page comes back into view and at the next minute boundary while it's open. */\nfunction useToday(zone: string): Day {\n const [day, setDay] = useState(() => dayIn(zone));\n useEffect(() => {\n const check = () => setDay(dayIn(zone));\n check();\n const onVisible = () => {\n if (typeof document === \"undefined\" || document.visibilityState === \"visible\") check();\n };\n if (typeof document !== \"undefined\") document.addEventListener(\"visibilitychange\", onVisible);\n // A page left open over midnight rolls over within a minute.\n const timer = setInterval(check, 60_000);\n return () => {\n if (typeof document !== \"undefined\") document.removeEventListener(\"visibilitychange\", onVisible);\n clearInterval(timer);\n };\n }, [zone]);\n return day;\n}\n\n/**\n * Empties the query cache for a new viewer: sends the old viewer's waiting\n * undoable writes (the session is still theirs), cancels reads in flight,\n * then removes every query. Call it in the sign-in and sign-out actions,\n * before the session changes.\n */\nexport async function clearViewerCache(queryClient: QueryClient): Promise<void> {\n await flushPendingWrites(queryClient);\n await queryClient.cancelQueries();\n queryClient.clear();\n}\n\n/**\n * Where the viewer is working: the person, space or set of people Genesis knows by name, plus\n * whatever the app scopes to under its own key (`{ orgId }`, `{ leagueId }`, `{ locationId }`).\n * Screens turn it into server filters and create defaults (a view's `scope: [\"league_id\"]` reads\n * `league_id`, then `leagueId`); it never decides access (row-level security does).\n */\nexport interface ResourceScope {\n personId?: string;\n spaceId?: string;\n /** Several people at once (a coach's client list, a group). */\n personIds?: readonly string[];\n /** The app's own scope keys: `orgId`, `leagueId`, `locationId`, … */\n [key: string]: unknown;\n}\n\nexport interface ViewerContext {\n viewer: string | null;\n scope: ResourceScope;\n /** The viewer's roles (see `GenesisViewerRoles`), when ViewerScope was given them. */\n roles?: GenesisViewerRoles;\n /** The zone the viewer's days are counted in: theirs if known, else the device's. */\n timeZone: string;\n /**\n * The zone of whatever the viewer is scoped to (a location, a league), for columns with\n * `timeZone: \"scope\"`: ViewerScope's `scopeTimeZone` when valid, else {@link timeZone}.\n */\n scopeTimeZone?: string;\n /**\n * Today on the viewer's clock (YYYY-MM-DD), kept current when the page comes back into view.\n * Use it for every \"today\" read and as query keys' `day`: `keys.for(useViewerScope())`.\n */\n day: Day;\n}\n\nconst ViewerContextValue = createContext<ViewerContext | null>(null);\n\n/** The viewer and scope from the nearest `ViewerScope`. Throws without one: screens that cache per viewer need it. */\nexport function useViewerScope(): ViewerContext {\n const value = useContext(ViewerContextValue);\n if (!value) throw new Error(\"[genesis-core] useViewerScope needs a <ViewerScope> above it\");\n return value;\n}\n\n/** Like useViewerScope, or null outside a ViewerScope. */\nexport function useOptionalViewerScope(): ViewerContext | null {\n return useContext(ViewerContextValue);\n}\n\n/**\n * The viewer for guards: `{ id, scope, roles }` from the nearest ViewerScope, or\n * {@link NO_VIEWER} without one. The object is stable while those are equal by value, so it can\n * sit in a memo's dependencies.\n */\nexport function useViewer(): Viewer {\n const context = useContext(ViewerContextValue);\n return useMemo<Viewer>(\n () =>\n context\n ? Object.freeze({ id: context.viewer, scope: context.scope, ...(context.roles !== undefined ? { roles: context.roles } : {}) })\n : NO_VIEWER,\n [context],\n );\n}\n\nexport interface ViewerScopeProps {\n /** The signed-in viewer's id, null when signed out, undefined while the session loads. */\n viewer: string | null | undefined;\n /**\n * The viewer a persisted cache was saved for. When the first known viewer\n * is this one, the restored cache is kept; otherwise it's emptied.\n */\n persistedViewer?: string | null;\n /** Where the viewer is working (see `ResourceScope`). Changing it doesn't remount or clear anything. */\n scope?: ResourceScope;\n /**\n * What the viewer may do there (see `GenesisViewerRoles`), for view guards. Compared by value,\n * so a new object with the same roles changes nothing. Undefined while they load: guards that\n * need them refuse. Arriving (undefined → roles) or going back to undefined changes nothing;\n * different roles send the person's waiting writes, then reread every query, with nothing\n * remounted. Plain JSON values only (lists are compared as sets, in any order): a Set, Map or\n * class instance throws in development; in production it warns once and the roles count as\n * unknown (as if undefined), so guards that need them refuse.\n */\n roles?: GenesisViewerRoles;\n /**\n * The viewer's saved time zone (IANA), when known; else the device's is used. Pass it when\n * rendering on a server, whose own zone is rarely the viewer's.\n */\n timeZone?: string | null;\n /**\n * The IANA zone of whatever the viewer is scoped to (a location, a league), when it has one.\n * Columns with `timeZone: \"scope\"` read on it; without it they read on the viewer's clock.\n */\n scopeTimeZone?: string | null;\n /** Shown while the session loads (and for the one render a change takes). */\n fallback?: ReactNode;\n children: ReactNode;\n}\n\n/**\n * The scope's clock: `scopeTimeZone` when the runtime knows it, else the viewer's. A zone it\n * doesn't know is never a quiet fallback: it throws in development, and in production it is\n * reported (`reportError`, once per zone) before the viewer's clock is used, so a misspelt zone can't show\n * times on the wrong clock unnoticed.\n */\nexport function scopeClock(scopeTimeZone: string | null | undefined, viewerZone: string): string {\n if (scopeTimeZone === undefined || scopeTimeZone === null || scopeTimeZone === \"\") return viewerZone;\n if (isTimeZone(scopeTimeZone)) return scopeTimeZone;\n const error = new RangeError(`[genesis-core] scopeTimeZone \"${scopeTimeZone}\" isn't a time zone this runtime knows (an IANA name such as \"Europe/Berlin\")`);\n if (process.env.NODE_ENV !== \"production\") throw error;\n // Once per zone: a bad zone in a long-lived screen must not flood the error reporter.\n if (!reportedScopeZones.has(scopeTimeZone)) {\n reportedScopeZones.add(scopeTimeZone);\n reportError(error, \"core:viewer-scope\");\n }\n return viewerZone;\n}\n\n/** The unknown scope zones already reported, so each is reported once per page load. */\nconst reportedScopeZones = new Set<string>();\n\n/**\n * Keeps one viewer's cached data from ever showing to the next. Children\n * render only once the viewer is known, under a key of that viewer, so a\n * sign-out or a new person signing in unmounts every screen and its queries\n * before the cache is emptied and the new viewer's screens mount fresh. The\n * first known viewer empties a restored cache too, unless it's the\n * `persistedViewer` it was saved for.\n *\n * ```tsx\n * <ViewerScope viewer={session === undefined ? undefined : (session?.user.id ?? null)}>\n * <App />\n * </ViewerScope>\n * ```\n */\nexport function ViewerScope({ viewer, persistedViewer, scope, roles, timeZone, scopeTimeZone, fallback = null, children }: ViewerScopeProps) {\n const queryClient = useQueryClient();\n const zone = personTimeZone({ timeZone });\n // Memoised, and scopeClock reports a zone once, so a bad zone isn't reported on every render.\n const scopeZone = useMemo(() => scopeClock(scopeTimeZone, zone), [scopeTimeZone, zone]);\n const day = useToday(zone);\n // A new scope object each render shouldn't re-render every reader: compare by value.\n const scopeKey = stableJson(scope ?? {});\n // Roles by value too: undefined stays undefined, so \"not known yet\" never equals \"none\".\n // Roles that aren't plain JSON count as unknown in production (rolesKeyOf warns; development throws).\n const rolesKey = roles === undefined ? undefined : rolesKeyOf(roles);\n const value = useMemo<ViewerContext>(\n () => ({ viewer: viewer ?? null, scope: scope ?? {}, ...(rolesKey !== undefined ? { roles } : {}), timeZone: zone, scopeTimeZone: scopeZone, day }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [viewer, scopeKey, rolesKey, zone, scopeZone, day],\n );\n // The last roles known for this viewer. Arriving (undefined → roles) or going back to undefined\n // changes nothing; different roles for the same person send their waiting writes, then reread\n // everything under the new roles. Nothing remounts: the person, their drafts and their\n // navigation are the same.\n const known = useRef<{ viewer: string | null | undefined; roles: string | undefined }>({ viewer, roles: undefined });\n useEffect(() => {\n if (known.current.viewer !== viewer) known.current = { viewer, roles: undefined };\n if (rolesKey === undefined) return;\n const previous = known.current.roles;\n known.current.roles = rolesKey;\n if (previous === undefined || previous === rolesKey) return;\n // The session is still theirs: their writes go out, and the database decides each one with the\n // roles as they are when it arrives (a refused one fails as any refused write does).\n void flushPendingWrites(queryClient).then(() => queryClient.invalidateQueries());\n }, [viewer, rolesKey, queryClient]);\n // Who the children were last mounted for, and how many times they were reset. Undefined before\n // the first mount.\n const [mounted, setMounted] = useState<{ viewer: string | null; epoch: number } | undefined>(undefined);\n if (viewer === undefined) return <>{fallback}</>;\n if (mounted === undefined || mounted.viewer !== viewer) {\n const keep = mounted === undefined && persistedViewer !== undefined && persistedViewer === viewer;\n // Nothing for the new viewer is mounted yet, so emptying now can't strand\n // a fetch; the old viewer's screens unmount with this render.\n if (!keep) {\n // The session already belongs to the new viewer: the old one's unsent\n // writes must never go out under it. (clearViewerCache, run before the\n // session changes, sends them instead.)\n dropPendingWrites(queryClient);\n void queryClient.cancelQueries();\n queryClient.clear();\n }\n setMounted({ viewer, epoch: (mounted?.epoch ?? 0) + 1 });\n return <>{fallback}</>;\n }\n return (\n <ViewerContextValue.Provider value={value}>\n <Fragment key={`${viewer ?? \"signed-out\"}#${mounted.epoch}`}>{children}</Fragment>\n </ViewerContextValue.Provider>\n );\n}\n","import { createContext, useContext, useEffect, useMemo } from \"react\";\nimport { ViewerScope, type ViewerScopeProps } from \"./viewer-scope\";\nimport { workspaceAt, workspaceHref, type Workspace, type WorkspaceHrefOptions } from \"../workspaces\";\n\n/**\n * The workspace the viewer is in, and where each of their others is from here.\n *\n * @stability Beta\n */\nexport interface WorkspaceContext<W extends Workspace = Workspace> {\n /** Undefined when the URL is in no workspace (the app's front door, a sign-in page). */\n current: W | undefined;\n workspaces: readonly W[];\n /** Where switching to `to` goes from the current URL, keeping the viewer's place when it can. */\n hrefFor: (to: W) => string;\n}\n\nconst WorkspaceContextValue = createContext<WorkspaceContext | null>(null);\n\n/**\n * The nearest `WorkspaceScope`'s workspaces, or null outside one.\n *\n * @stability Beta\n */\nexport function useWorkspace<W extends Workspace = Workspace>(): WorkspaceContext<W> | null {\n return useContext(WorkspaceContextValue) as WorkspaceContext<W> | null;\n}\n\nconst STORAGE_PREFIX = \"genesis:workspace:\";\n\n/**\n * The workspace this viewer was last in on this device, for the app's front door\n * (`defaultWorkspace(workspaces, rememberedWorkspaceId(viewer))`). Null when unknown.\n *\n * @stability Beta\n */\nexport function rememberedWorkspaceId(viewer: string | null | undefined): string | null {\n if (!viewer || typeof window === \"undefined\") return null;\n try {\n return window.localStorage.getItem(STORAGE_PREFIX + viewer);\n } catch {\n return null;\n }\n}\n\nfunction remember(viewer: string, id: string) {\n try {\n window.localStorage.setItem(STORAGE_PREFIX + viewer, id);\n } catch {\n // private mode or full: the front door falls back to the first tenant.\n }\n}\n\n/** @stability Beta */\nexport interface WorkspaceScopeProps<W extends Workspace = Workspace> extends Omit<ViewerScopeProps, \"scope\" | \"roles\" | \"scopeTimeZone\"> {\n /** Every workspace this viewer has. */\n workspaces: readonly W[];\n /** The current URL's path (`useLocation().pathname`): the workspace is read from it. */\n pathname: string;\n /** Scope keys every workspace adds to its own (rarely needed). */\n scope?: ViewerScopeProps[\"scope\"];\n /** How switching keeps the viewer's place (see `workspaceHref`). */\n keep?: WorkspaceHrefOptions[\"keep\"];\n}\n\n/**\n * `ViewerScope` for an app with workspaces: use it in place of `ViewerScope`. It reads the current\n * workspace from the URL and scopes everything under it to that workspace (its `scope`, `roles` and\n * `timeZone`), so every view with `scope: [\"org_id\"]` follows the switcher with no screen code. It\n * remembers the workspace per viewer on this device, and gives `WorkspaceSwitcher` its list.\n *\n * ```tsx\n * <WorkspaceScope viewer={userId} workspaces={workspaces} pathname={location.pathname}>\n * <AppShell headerSlot={<WorkspaceSwitcher linkComponent={Link} />} …>\n * </WorkspaceScope>\n * ```\n *\n * @stability Beta\n */\nexport function WorkspaceScope<W extends Workspace>({ workspaces, pathname, scope, keep, children, ...viewerProps }: WorkspaceScopeProps<W>) {\n const current = workspaceAt(workspaces, pathname);\n const value = useMemo<WorkspaceContext<W>>(\n () => ({\n current,\n workspaces,\n hrefFor: (to) => workspaceHref(workspaces, to, pathname, keep ? { keep } : {}),\n }),\n [current, workspaces, pathname, keep],\n );\n const viewer = viewerProps.viewer;\n useEffect(() => {\n if (viewer && current) remember(viewer, current.id);\n }, [viewer, current]);\n return (\n <WorkspaceContextValue.Provider value={value as unknown as WorkspaceContext}>\n <ViewerScope\n {...viewerProps}\n scope={{ ...scope, ...current?.scope }}\n {...(current?.roles !== undefined ? { roles: current.roles } : {})}\n {...(current?.timeZone !== undefined ? { scopeTimeZone: current.timeZone } : {})}\n >\n {children}\n </ViewerScope>\n </WorkspaceContextValue.Provider>\n );\n}\n\n"]}
package/dist/csv.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- import { D as DataProvider, S as SortParam, F as FilterParam } from './types-CXhqXPN1.js';
2
- import { F as FieldSchema } from './types-o8j7g6O6.js';
3
- import './form-types.js';
1
+ import { D as DataProvider, F as FieldSchema, S as SortParam, a as FilterParam } from './types-r_Rlw7BB.js';
4
2
 
5
3
  /** RFC 4180 field: quoted when it holds a comma, quote or line break. */
6
4
  declare function csvField(value: unknown): string;
package/dist/dates.d.ts CHANGED
@@ -80,5 +80,203 @@ declare function dayRangeIn(day: Day, zone: string): {
80
80
  start: Date;
81
81
  end: Date;
82
82
  };
83
+ /** A `[start, end)` run of days: `end` is the first day after it. @stability Beta */
84
+ interface DayRange {
85
+ start: Day;
86
+ end: Day;
87
+ }
88
+ /** Days in `day`'s month (28 to 31). @stability Beta */
89
+ declare function daysInMonth(day: Day): number;
90
+ /** The first day of `day`'s month. @stability Beta */
91
+ declare function startOfMonth(day: Day): Day;
92
+ /**
93
+ * `day` moved by `months`, keeping its day of the month where the month has it and taking the
94
+ * month's last day where it doesn't (31 January + 1 is 28 or 29 February). @stability Beta
95
+ */
96
+ declare function addMonths(day: Day, months: number): Day;
97
+ /** The first day of `day`'s quarter (1 January, 1 April, 1 July or 1 October). @stability Beta */
98
+ declare function startOfQuarter(day: Day): Day;
99
+ /** `day` moved by whole weeks. @stability Beta */
100
+ declare function addWeeks(day: Day, weeks: number): Day;
101
+ /** `day`'s month as a range: its first day to the next month's first. @stability Beta */
102
+ declare function monthRange(day: Day): DayRange;
103
+ /** `day`'s quarter as a range. @stability Beta */
104
+ declare function quarterRange(day: Day): DayRange;
105
+ /**
106
+ * `weeks` whole weeks (1 or more) from the week `day` is in: what a 1-to-4-week calendar shows.
107
+ *
108
+ * ```ts
109
+ * weeksRange("2026-11-04", 2, 0); // { start: "2026-11-01", end: "2026-11-15" } (weeks from Sunday)
110
+ * ```
111
+ *
112
+ * @stability Beta
113
+ */
114
+ declare function weeksRange(day: Day, weeks: number, weekStartsOn?: number): DayRange;
115
+ /** The whole weeks that cover `day`'s month: what a month grid shows, leading and trailing days included. @stability Beta */
116
+ declare function monthGridRange(day: Day, weekStartsOn?: number): DayRange;
117
+ /** Every day of a range, in order. @stability Beta */
118
+ declare function eachDay(range: DayRange): Day[];
119
+ /**
120
+ * The `[start, end)` instants of a range of days on `zone`'s clock: what to filter a timestamp
121
+ * column by for a calendar's visible window. @stability Beta
122
+ */
123
+ declare function rangeIn(range: DayRange, zone: string): {
124
+ start: Date;
125
+ end: Date;
126
+ };
127
+ /** A time on the wall clock, `HH:MM` or `HH:MM:SS`. @stability Beta */
128
+ type WallTime = string;
129
+ /**
130
+ * The instant `zone`'s clock shows `time` on `day`. A time the clock skips (the hour lost when
131
+ * daylight saving starts) is read with the offset before the jump, so 02:30 becomes 03:30; a time
132
+ * it shows twice (the hour repeated when it ends) is the first of the two. Both as RFC 5545 says.
133
+ *
134
+ * @stability Beta
135
+ */
136
+ declare function instantIn(day: Day, time: WallTime, zone: string): Date;
137
+ /** The day and wall time `zone`'s clock shows at `at`. @stability Beta */
138
+ declare function wallTimeIn(zone: string, at: Date): {
139
+ day: Day;
140
+ time: WallTime;
141
+ };
142
+ /** A weekday in a rule: 0 Sunday … 6 Saturday, with an optional position (`2MO` is 2, `-1FR` is −1). @stability Beta */
143
+ interface RuleWeekday {
144
+ weekday: number;
145
+ nth?: number;
146
+ }
147
+ /** A parsed RRULE. @stability Beta */
148
+ interface RRule {
149
+ freq: "DAILY" | "WEEKLY" | "MONTHLY" | "YEARLY";
150
+ interval: number;
151
+ count?: number;
152
+ /**
153
+ * A last day (`UNTIL=20261231`), a last instant (`UNTIL=20261231T235959Z`), or a last wall time
154
+ * with no zone (`UNTIL=20261231T235959`), read on the series' own clock.
155
+ */
156
+ until?: Day | Date | {
157
+ day: Day;
158
+ time: WallTime;
159
+ };
160
+ byDay?: RuleWeekday[];
161
+ /** 1 to 31, or −1 (last) to −31. */
162
+ byMonthDay?: number[];
163
+ /** 1 to 12. */
164
+ byMonth?: number[];
165
+ /** The week's first day, 0 Sunday … 6 Saturday. Default 1 (Monday), as RFC 5545 says. */
166
+ weekStart: number;
167
+ }
168
+ /**
169
+ * Read an RRULE (`"FREQ=WEEKLY;BYDAY=MO,WE"`, with or without the `RRULE:` prefix). Supports
170
+ * FREQ (DAILY, WEEKLY, MONTHLY, YEARLY), INTERVAL, COUNT, UNTIL, BYDAY, BYMONTHDAY, BYMONTH and
171
+ * WKST. Any other part (BYSETPOS, BYWEEKNO, BYYEARDAY, BYHOUR, BYMINUTE, BYSECOND, sub-daily
172
+ * frequencies…) throws a `RangeError` naming it, so a caller can show the series' first instance
173
+ * rather than a wrong pattern.
174
+ *
175
+ * @stability Beta
176
+ */
177
+ declare function parseRRule(text: string): RRule;
178
+ /**
179
+ * Where a series starts: a day (an all-day series), or a wall time on a zone's clock. Give the
180
+ * zone the series was written in (the calendar's), so 09:00 stays 09:00 there across daylight
181
+ * saving; an instant (`at`) is read on that zone's clock.
182
+ */
183
+ /** @stability Beta */
184
+ type RecurrenceStart = Day | {
185
+ day: Day;
186
+ time: WallTime;
187
+ timeZone: string;
188
+ } | {
189
+ at: Date;
190
+ timeZone: string;
191
+ };
192
+ /** One occurrence: its day on the series' clock, and for a timed series its instant. @stability Beta */
193
+ interface Occurrence {
194
+ day: Day;
195
+ start?: Date;
196
+ }
197
+ /** What `expandRecurrence` returns: the occurrences in order, and whether `limit` cut them short. @stability Beta */
198
+ interface RecurrenceResult {
199
+ occurrences: Occurrence[];
200
+ /** True when there were more than `limit` in the window. */
201
+ truncated: boolean;
202
+ }
203
+ /** What `expandRecurrence` takes. @stability Beta */
204
+ interface RecurrenceOptions {
205
+ /** The rule: RRULE text or `parseRRule`'s result. */
206
+ rule: string | RRule;
207
+ start: RecurrenceStart;
208
+ /**
209
+ * Occurrences removed (EXDATE): days for an all-day series (an instant throws: it has no day
210
+ * without a zone); instants or days for a timed one (a day removes that day's occurrence).
211
+ */
212
+ exdates?: readonly (Day | Date)[];
213
+ /**
214
+ * Which occurrences to return, by their day on the series' clock: `[start, end)`. Widen the start
215
+ * by an event's length to catch ones that began earlier and still run into it. Required: a rule
216
+ * without COUNT or UNTIL never ends.
217
+ */
218
+ window: DayRange;
219
+ /** Most occurrences returned. Default 1,000; the result's `truncated` says when it cut. */
220
+ limit?: number;
221
+ }
222
+ /**
223
+ * The occurrences of a repeating series inside a window, in order. No dependencies; daylight
224
+ * saving is right because each occurrence keeps the series' wall time on its own zone's clock
225
+ * (a 09:00 meeting is 09:00 in Denver in both January and July).
226
+ *
227
+ * Follows RFC 5545: the start is the first occurrence; COUNT counts from it, whatever the window;
228
+ * EXDATE removes occurrences after counting, so it never adds one at the end; days a rule names
229
+ * that a month lacks (the 31st in April) are skipped, not moved.
230
+ *
231
+ * ```ts
232
+ * expandRecurrence({
233
+ * rule: "FREQ=MONTHLY;BYDAY=2MO;COUNT=10",
234
+ * start: { day: "2026-11-09", time: "18:30", timeZone: "America/Denver" },
235
+ * window: { start: "2026-11-01", end: "2027-02-01" },
236
+ * }); // 9 Nov, 14 Dec, 11 Jan, each 18:30 in Denver
237
+ * ```
238
+ *
239
+ * @stability Beta
240
+ */
241
+ declare function expandRecurrence(options: RecurrenceOptions): RecurrenceResult;
242
+ /**
243
+ * One dated occurrence of an event, the shape every calendar reader and writer shares (a feed's
244
+ * events, a provider's, an app's own sessions). A recurring event is one per occurrence, each
245
+ * expanded with `expandRecurrence`.
246
+ *
247
+ * An all-day occurrence's `start` and `end` are days, `end` the day after its last day
248
+ * (exclusive, as RFC 5545 and calendar providers write it). A timed one's are instants, `end`
249
+ * exclusive. Where it came from (a source, its ids) is the reading package's to add.
250
+ *
251
+ * @stability Beta
252
+ */
253
+ interface EventOccurrence {
254
+ title: string;
255
+ location: string | null;
256
+ allDay: boolean;
257
+ start: Day | Date;
258
+ end: Day | Date;
259
+ /** The zone it was written in, when it names one (IANA). */
260
+ timeZone: string | null;
261
+ /** One occurrence of a repeating series. */
262
+ recurring: boolean;
263
+ /** `private`: others see it only as a busy block, without its title or place. */
264
+ visibility: "public" | "private";
265
+ /** A cancelled occurrence is removed, never kept with a status. */
266
+ status: "confirmed" | "tentative";
267
+ }
268
+ /**
269
+ * A stored date or timestamp as a calendar value: a day for a `date` column (`dateOnly`) or a
270
+ * value with no time; an instant for a timestamp. A timestamp written without a zone (Postgres
271
+ * `timestamp without time zone`, `2026-11-02 09:30:00`) is a wall time, read on `timeZone`'s
272
+ * clock (default the device's). Postgres text (`2026-10-19 09:30:00.123456+00`), ISO strings and
273
+ * `Date`s are all read. Null when it isn't a date.
274
+ *
275
+ * @stability Beta
276
+ */
277
+ declare function readEventTime(value: unknown, options?: {
278
+ dateOnly?: boolean;
279
+ timeZone?: string;
280
+ }): Day | Date | null;
83
281
 
84
- export { type Day, type PersonClock, type WallClock, addDays, dayIn, dayRangeIn, daysBetween, deviceTimeZone, isDay, isTimeZone, personDay, personTimeZone, startOfDayIn, startOfWeek, wallClock, weekdayOf };
282
+ export { type Day, type DayRange, type EventOccurrence, type Occurrence, type PersonClock, type RRule, type RecurrenceOptions, type RecurrenceResult, type RecurrenceStart, type RuleWeekday, type WallClock, type WallTime, addDays, addMonths, addWeeks, dayIn, dayRangeIn, daysBetween, daysInMonth, deviceTimeZone, eachDay, expandRecurrence, instantIn, isDay, isTimeZone, monthGridRange, monthRange, parseRRule, personDay, personTimeZone, quarterRange, rangeIn, readEventTime, startOfDayIn, startOfMonth, startOfQuarter, startOfWeek, wallClock, wallTimeIn, weekdayOf, weeksRange };
package/dist/dates.js CHANGED
@@ -1,3 +1,3 @@
1
- export { addDays, dayIn, dayRangeIn, daysBetween, deviceTimeZone, isDay, isTimeZone, personDay, personTimeZone, startOfDayIn, startOfWeek, wallClock, weekdayOf } from './chunk-3B4IFDMK.js';
1
+ export { addDays, addMonths, addWeeks, dayIn, dayRangeIn, daysBetween, daysInMonth, deviceTimeZone, eachDay, expandRecurrence, instantIn, isDay, isTimeZone, monthGridRange, monthRange, parseRRule, personDay, personTimeZone, quarterRange, rangeIn, readEventTime, startOfDayIn, startOfMonth, startOfQuarter, startOfWeek, wallClock, wallTimeIn, weekdayOf, weeksRange } from './chunk-BIIENNTW.js';
2
2
  //# sourceMappingURL=dates.js.map
3
3
  //# sourceMappingURL=dates.js.map
package/dist/errors.d.ts CHANGED
@@ -12,6 +12,13 @@ interface ErrorReportContext {
12
12
  }
13
13
  /** Where `reportError` sends errors. A throw inside it is ignored. */
14
14
  type ErrorReporter = (error: unknown, context: ErrorReportContext) => void;
15
+ /**
16
+ * True in a development build: `__DEV__` on React Native, else `NODE_ENV`, else true (no bundler
17
+ * and no `process`). For development-only hints.
18
+ *
19
+ * @stability Beta
20
+ */
21
+ declare function isDevelopment(): boolean;
15
22
  /** The reporter used when the app registered none: `console.warn` in development, nothing in production. */
16
23
  declare const defaultErrorReporter: ErrorReporter;
17
24
  /** The reporter `reportError` uses now. */
@@ -66,4 +73,4 @@ interface ClassifyErrorOptions {
66
73
  */
67
74
  declare function classifyError(error: unknown, options?: ClassifyErrorOptions): ClassifiedError;
68
75
 
69
- export { type ClassifiedError, type ClassifyErrorOptions, type ErrorKind, type ErrorMessages, type ErrorReportContext, type ErrorReporter, classifyError, defaultErrorReporter, errorMessages, getErrorReporter, reportError, setErrorReporter };
76
+ export { type ClassifiedError, type ClassifyErrorOptions, type ErrorKind, type ErrorMessages, type ErrorReportContext, type ErrorReporter, classifyError, defaultErrorReporter, errorMessages, getErrorReporter, isDevelopment, reportError, setErrorReporter };
package/dist/errors.js CHANGED
@@ -1,4 +1,4 @@
1
- export { classifyError, defaultErrorReporter, errorMessages, getErrorReporter, reportError, setErrorReporter } from './chunk-ZIMQUFXD.js';
1
+ export { classifyError, defaultErrorReporter, errorMessages, getErrorReporter, isDevelopment, reportError, setErrorReporter } from './chunk-37RWGNIO.js';
2
2
  import './chunk-PA6WJE5E.js';
3
3
  import './chunk-HUNGCTRA.js';
4
4
  import './chunk-RYEXWQFD.js';
@@ -1,70 +1 @@
1
- type FieldType = "text" | "number" | "email" | "url" | "textarea" | "select" | "checkbox" | "switch" | "date" | "hidden" | "relation" | "file" | "image" | "array";
2
- interface SelectOption {
3
- value: string;
4
- label: string;
5
- }
6
- interface ResourceFormFieldDef {
7
- key: string;
8
- label?: string;
9
- type?: FieldType;
10
- placeholder?: string;
11
- required?: boolean;
12
- defaultValue?: unknown;
13
- options?: SelectOption[];
14
- hidden?: boolean;
15
- /** Shown read-only when editing, and never sent by an edit (a create still sends it). */
16
- readOnlyOnEdit?: boolean;
17
- /**
18
- * The column takes null. A left-empty input is then sent as null on an edit and left out of
19
- * a create (so the column's default applies), text included. `false`: an empty text input keeps
20
- * sending "" (left out of a create when `hasDefault`), while an empty input of another type is
21
- * handled as for `true`, since "" is never a valid value for those. Unset, the form doesn't know
22
- * the column: every empty input is sent as it is ("" or undefined), on a create and an edit.
23
- */
24
- nullable?: boolean;
25
- /**
26
- * The column has a default: a create leaves an empty input out, text included, so the default
27
- * applies. Acts only when `nullable` is set.
28
- */
29
- hasDefault?: boolean;
30
- description?: string;
31
- min?: number;
32
- max?: number;
33
- rows?: number;
34
- /**
35
- * Longest value accepted by a text-like field (text, email, url, textarea).
36
- * Validated on save, and the web renderer also sets the input's
37
- * `maxLength` so the user cannot type past it.
38
- */
39
- maxLength?: number;
40
- /** Relation field configuration. */
41
- relation?: {
42
- resource: string;
43
- labelField: string;
44
- valueField?: string;
45
- searchable?: boolean;
46
- allowCreate?: boolean;
47
- };
48
- /** Accepted file types, e.g. "image/*", ".pdf,.doc". */
49
- accept?: string;
50
- /** Max file size in bytes. Default 10MB. */
51
- maxSize?: number;
52
- /** Allow multiple files. */
53
- multiple?: boolean;
54
- /** Sub-field definitions for array (child records) fields. */
55
- arrayFields?: ResourceFormFieldDef[];
56
- /** Minimum number of array items. */
57
- arrayMin?: number;
58
- /** Maximum number of array items. */
59
- arrayMax?: number;
60
- /** Group heading for field grouping in the form. */
61
- group?: string;
62
- /** Column span in 2-column layout. Default 1. */
63
- colSpan?: 1 | 2;
64
- /** Return false to hide this field based on current form values. */
65
- visible?: (values: Record<string, unknown>) => boolean;
66
- /** Return true to disable this field based on current form values. */
67
- disabled?: (values: Record<string, unknown>) => boolean;
68
- }
69
-
70
- export type { FieldType, ResourceFormFieldDef, SelectOption };
1
+ export { m as FieldType, y as ResourceFormFieldDef, T as SelectOption } from './types-r_Rlw7BB.js';
@@ -1,6 +1,7 @@
1
1
  export { UseResourceOptions, UseResourceReturn, useResource } from './use-resource.js';
2
2
  export { UseOneOptions, useOne } from './use-one.js';
3
- export { UseRelationLabelOptions, loadRelationLabel, useRelationLabel } from './use-relation-label.js';
3
+ export { UseRelationLabelOptions, loadRelationLabel, relationNamingField, useRelationLabel } from './use-relation-label.js';
4
+ export { LinkOption, LinkTarget, UseLinkOptionsOptions, UseLinkOptionsReturn, useLinkOptions } from './use-link-options.js';
4
5
  export { InfinitePageParam, UseInfiniteResourceOptions, UseInfiniteResourceReturn, useInfiniteResource } from './use-infinite-resource.js';
5
6
  export { useCapabilities } from './use-capabilities.js';
6
7
  export { UseWriteOptions, UseWriteReturn, WRITE_FAILED, useWrite } from './use-write.js';
@@ -16,9 +17,7 @@ export { UseWizardReturn, WizardStep, useWizard } from './use-wizard.js';
16
17
  export { DEFAULT_UNDO_DELAY_MS, MutationMode, MutationModeOptions, UndoableWrite, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './mutation-mode.js';
17
18
  export { DEFAULT_UNSAVED_CHANGES_MESSAGE, UseUnsavedChangesGuardOptions, UseUnsavedChangesGuardReturn, useUnsavedChangesGuard } from './use-unsaved-changes-guard.js';
18
19
  import '@tanstack/react-query';
19
- import '../types-CXhqXPN1.js';
20
- import '../types-o8j7g6O6.js';
21
- import '../form-types.js';
20
+ import '../types-r_Rlw7BB.js';
22
21
  import '../dates.js';
23
22
  import 'react-hook-form';
24
23
 
@@ -1,15 +1,16 @@
1
- export { ViewerScope, WorkspaceScope, clearViewerCache, rememberedWorkspaceId, scopeClock, useOptionalViewerScope, useViewer, useViewerScope, useWorkspace } from '../chunk-5NEOX2N7.js';
1
+ export { ViewerScope, WorkspaceScope, clearViewerCache, rememberedWorkspaceId, scopeClock, useOptionalViewerScope, useViewer, useViewerScope, useWorkspace } from '../chunk-OWYX4BEI.js';
2
2
  export { useWizard } from '../chunk-7KOLYF27.js';
3
3
  export { WRITE_FAILED, useWrite } from '../chunk-52T2EYXH.js';
4
4
  export { NO_VIEWER } from '../chunk-OZYF55E3.js';
5
5
  export { useDraft } from '../chunk-DF2UWEEB.js';
6
+ export { useLinkOptions } from '../chunk-LZVU5NGV.js';
6
7
  export { useInfiniteResource } from '../chunk-2VVZ2KX3.js';
7
- export { loadRelationLabel, useRelationLabel } from '../chunk-XMC4EJUE.js';
8
- export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-X6EO3XBB.js';
8
+ export { loadRelationLabel, relationNamingField, useRelationLabel } from '../chunk-EHFYSJJA.js';
9
+ export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-OKCSGNCU.js';
10
+ export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from '../chunk-XQO4OH2N.js';
9
11
  export { useOne } from '../chunk-GWQHP3RC.js';
10
12
  export { useResource } from '../chunk-CC37H7O2.js';
11
13
  export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS } from '../chunk-K4ZNAF3G.js';
12
- export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from '../chunk-XQO4OH2N.js';
13
14
  import '../chunk-UHOMTFBD.js';
14
15
  export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftController, isNetworkFailure, stableJson } from '../chunk-HBAPYA5K.js';
15
16
  import '../chunk-AUVKRXRC.js';
@@ -19,8 +20,8 @@ import '../chunk-7NUL32W7.js';
19
20
  export { useCapabilities } from '../chunk-LGTXQTHA.js';
20
21
  import '../chunk-VDEW4AOS.js';
21
22
  import '../chunk-ZYJUEJ4Z.js';
22
- import '../chunk-3B4IFDMK.js';
23
- import '../chunk-ZIMQUFXD.js';
23
+ import '../chunk-BIIENNTW.js';
24
+ import '../chunk-37RWGNIO.js';
24
25
  import '../chunk-PA6WJE5E.js';
25
26
  import '../chunk-HUNGCTRA.js';
26
27
  import '../chunk-RYEXWQFD.js';
@@ -1,7 +1,5 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
- import { a as Identifier, B as BaseRecord, D as DataProvider } from '../types-CXhqXPN1.js';
3
- import { A as AuditEntry } from '../types-o8j7g6O6.js';
4
- import '../form-types.js';
2
+ import { b as Identifier, B as BaseRecord, D as DataProvider, c as AuditEntry } from '../types-r_Rlw7BB.js';
5
3
 
6
4
  type MutationMode = "pessimistic" | "optimistic" | "undoable";
7
5
  /** How long an `undoable` write waits for an undo before it is sent. */
@@ -1,6 +1,4 @@
1
- import { D as DataProvider, W as WriteEvent, I as InvalidationKey } from '../types-CXhqXPN1.js';
2
- import '../types-o8j7g6O6.js';
3
- import '../form-types.js';
1
+ import { D as DataProvider, W as WriteEvent, I as InvalidationKey } from '../types-r_Rlw7BB.js';
4
2
 
5
3
  /**
6
4
  * The cache keys a committed write makes stale beyond `[resource]`: the
@@ -1,6 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import { P as ProviderCapabilities } from '../types-o8j7g6O6.js';
3
- import '../form-types.js';
2
+ import { t as ProviderCapabilities } from '../types-r_Rlw7BB.js';
4
3
 
5
4
  /**
6
5
  * The query key for `provider`'s capabilities for `resource`. It includes
@@ -1,8 +1,6 @@
1
1
  import { UseInfiniteQueryResult, InfiniteData } from '@tanstack/react-query';
2
- import { S as SortParam, F as FilterParam, l as ListResult, L as ListParams, B as BaseRecord } from '../types-CXhqXPN1.js';
2
+ import { S as SortParam, a as FilterParam, s as ListResult, L as ListParams, B as BaseRecord } from '../types-r_Rlw7BB.js';
3
3
  import { LiveOptions } from './use-live.js';
4
- import '../types-o8j7g6O6.js';
5
- import '../form-types.js';
6
4
 
7
5
  interface UseInfiniteResourceOptions {
8
6
  defaultSort?: SortParam;
@@ -0,0 +1,58 @@
1
+ import { a as FilterParam } from '../types-r_Rlw7BB.js';
2
+
3
+ interface LinkTarget {
4
+ /** The linked resource. */
5
+ resource: string;
6
+ /** The linked field the link stores. Default `id`. */
7
+ field?: string | undefined;
8
+ /** The linked field that names a row. Default: the provider's `describe`, else a name-like field. */
9
+ labelField?: string | undefined;
10
+ /** The linked fields a search matches. Default: the naming field. */
11
+ searchFields?: readonly string[] | undefined;
12
+ }
13
+ interface UseLinkOptionsOptions {
14
+ /** Filters every request carries: the linked view's scope and default filter, the link's own. */
15
+ filters?: FilterParam[] | undefined;
16
+ /** What the person typed. Sent to the server (`search`), never matched against loaded rows. */
17
+ search?: string | undefined;
18
+ /** Rows per page. Default 25. */
19
+ perPage?: number | undefined;
20
+ /** Default true. A picker passes false until it opens, so a closed form asks for nothing. */
21
+ enabled?: boolean | undefined;
22
+ /**
23
+ * The words for a row whose naming field is empty: a picker passes its catalogue's
24
+ * (`common.untitled`). Default "Untitled". Never the row's raw key.
25
+ */
26
+ untitled?: string | undefined;
27
+ }
28
+ /** One row a picker offers: the key it stores and the words it shows. */
29
+ interface LinkOption {
30
+ /** The linked row's key, as the row holds it (text or a number). */
31
+ value: string | number;
32
+ label: string;
33
+ }
34
+ interface UseLinkOptionsReturn {
35
+ options: LinkOption[];
36
+ /** The naming field used, once known. */
37
+ labelField: string | undefined;
38
+ /** Whether a search can be sent: false when nothing names the rows. */
39
+ searchable: boolean;
40
+ /** The first page is loading. */
41
+ isLoading: boolean;
42
+ isError: boolean;
43
+ /** More rows than are loaded match. */
44
+ hasMore: boolean;
45
+ /** Loads the next page. Does nothing while one loads or none is left. */
46
+ loadMore: () => void;
47
+ isLoadingMore: boolean;
48
+ }
49
+ /**
50
+ * The rows a link can point at, for a picker: listed through the data provider with `filters`,
51
+ * searched on the server with `search` across `searchFields` (else the naming field), sorted by
52
+ * the naming field then the key, `perPage` at a time (`loadMore` for the next). A large table is
53
+ * never loaded whole. Each option is the row's key and its words; a row with no words shows
54
+ * `untitled`, never its key.
55
+ */
56
+ declare function useLinkOptions(target: LinkTarget, options?: UseLinkOptionsOptions): UseLinkOptionsReturn;
57
+
58
+ export { type LinkOption, type LinkTarget, type UseLinkOptionsOptions, type UseLinkOptionsReturn, useLinkOptions };
@@ -0,0 +1,10 @@
1
+ export { useLinkOptions } from '../chunk-LZVU5NGV.js';
2
+ import '../chunk-2VVZ2KX3.js';
3
+ import '../chunk-EHFYSJJA.js';
4
+ import '../chunk-K4ZNAF3G.js';
5
+ import '../chunk-AUVKRXRC.js';
6
+ import '../chunk-7PUFVNPB.js';
7
+ import '../chunk-VDEW4AOS.js';
8
+ import '../chunk-ZYJUEJ4Z.js';
9
+ //# sourceMappingURL=use-link-options.js.map
10
+ //# sourceMappingURL=use-link-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"use-link-options.js"}
@@ -1,7 +1,5 @@
1
1
  import { QueryKey } from '@tanstack/react-query';
2
- import { p as SubscribeParams, m as ResourceChangeEvent } from '../types-CXhqXPN1.js';
3
- import '../types-o8j7g6O6.js';
4
- import '../form-types.js';
2
+ import { V as SubscribeParams, w as ResourceChangeEvent } from '../types-r_Rlw7BB.js';
5
3
 
6
4
  /** How long a burst of change events is gathered into one refetch. */
7
5
  declare const DEFAULT_LIVE_DEBOUNCE_MS = 250;
@@ -1,8 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import { B as BaseRecord, a as Identifier } from '../types-CXhqXPN1.js';
2
+ import { B as BaseRecord, b as Identifier } from '../types-r_Rlw7BB.js';
3
3
  import { LiveOptions } from './use-live.js';
4
- import '../types-o8j7g6O6.js';
5
- import '../form-types.js';
6
4
 
7
5
  interface UseOneOptions {
8
6
  /** Supabase select/join syntax, e.g. "*, author:profiles(name)". */