@marktiderman/genesis-native 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -14
- package/dist/{block-q6_CV0WK.d.ts → block-CQz1pOnm.d.ts} +4 -4
- package/dist/{blocks-ByVBKaQW.d.ts → blocks-dppiMmy-.d.ts} +7 -4
- package/dist/{chunk-6L36FQBX.js → chunk-EWHO5WQU.js} +3 -3
- package/dist/{chunk-6L36FQBX.js.map → chunk-EWHO5WQU.js.map} +1 -1
- package/dist/{chunk-C54LIT4N.js → chunk-FKDZP3RJ.js} +2 -2
- package/dist/chunk-FKDZP3RJ.js.map +1 -0
- package/dist/{chunk-MFHOHSEQ.js → chunk-YIF4BFQH.js} +33 -28
- package/dist/chunk-YIF4BFQH.js.map +1 -0
- package/dist/devtools.d.ts +5 -5
- package/dist/devtools.js +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/observability.d.ts +5 -5
- package/dist/observability.js +3 -3
- package/dist/offline.d.ts +40 -0
- package/dist/offline.js +118 -0
- package/dist/offline.js.map +1 -0
- package/dist/persist.d.ts +11 -3
- package/dist/persist.js +6 -3
- package/dist/persist.js.map +1 -1
- package/dist/push.d.ts +3 -3
- package/dist/{query-DobJyRvs.d.ts → query--ihYsJWC.d.ts} +31 -9
- package/dist/{screen-boundary-BlT6KBpa.d.ts → screen-boundary-B8DlsLwb.d.ts} +8 -4
- package/dist/updates.d.ts +2 -2
- package/dist/updates.js +10 -10
- package/dist/updates.js.map +1 -1
- package/package.json +15 -10
- package/src/app.tsx +9 -6
- package/src/errors.tsx +56 -22
- package/src/index.ts +2 -0
- package/src/observability/block.tsx +1 -1
- package/src/offline/sqlite-local-cache.ts +161 -0
- package/src/persist.ts +16 -4
- package/src/query.ts +5 -2
- package/src/screen-boundary.tsx +13 -21
- package/src/updates/screens.tsx +10 -22
- package/dist/chunk-C54LIT4N.js.map +0 -1
- package/dist/chunk-MFHOHSEQ.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/boot.tsx","../src/errors.tsx","../src/screen-boundary.tsx"],"names":["jsx","reportError","ScreenFallback"],"mappings":";;;;;;;AA6DO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EACjC,IAAA;AAAA,EACT,WAAA,CAAY,IAAA,EAAc,EAAA,EAAY,MAAA,GAAS,gBAAA,EAAkB;AAC/D,IAAA,KAAA,CAAM,cAAc,IAAI,CAAA,EAAA,EAAK,MAAM,CAAA,QAAA,EAAW,EAAE,CAAA,IAAA,CAAM,CAAA;AACtD,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AACF;AAEA,IAAM,kBAAA,GAAqB,GAAA;AAEpB,SAAS,QAAQ,KAAA,EAAuB;AAC7C,EAAA,IAAI,KAAA,YAAiB,OAAO,OAAO,KAAA;AACnC,EAAA,OAAO,IAAI,KAAA,CAAM,OAAO,KAAA,KAAU,QAAA,GAAW,QAAQ,eAAA,EAAiB,EAAE,KAAA,EAAO,KAAA,EAAO,CAAA;AACxF;AAGA,SAAS,aAAA,CAAc,SAA2B,EAAA,EAA4C;AAC5F,EAAA,IAAI,KAAA;AACJ,EAAA,OAAO,QAAQ,IAAA,CAAK;AAAA,IAClB,OAAA,CAAQ,IAAA;AAAA,MACN,MAAM,SAAA;AAAA,MACN,MAAM;AAAA,KACR;AAAA,IACA,IAAI,OAAA,CAAmB,CAAC,OAAA,KAAY;AAClC,MAAA,KAAA,GAAQ,UAAA,CAAW,MAAM,OAAA,CAAQ,SAAS,GAAG,EAAE,CAAA;AAAA,IACjD,CAAC;AAAA,GACF,CAAA,CAAE,OAAA,CAAQ,MAAM,YAAA,CAAa,KAAK,CAAC,CAAA;AACtC;AAGO,SAAS,UAAA,CAAW,KAAA,EAA4B,OAAA,GAAuB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AAA;AAEJ","file":"chunk-YIF4BFQH.js","sourcesContent":["/**\n * Boot: the async work an app must finish before its first screen (wipe a\n * session left by a reinstall, hydrate stores, load fonts, restore the query\n * cache, read the session).\n *\n * Steps run once each, in order. A step that finished is never run again, so\n * \"try again\" after a failure resumes at the step that failed. Each step has a\n * timeout (10 seconds by default), so a hung step ends in the fatal screen with\n * retry instead of trapping the splash. A minimum keeps a fast boot from\n * flashing the splash.\n *\n * `createBoot` is the controller (no React); `BootProvider` + `useBoot()` read\n * it from components.\n */\nimport { createContext, useContext, useSyncExternalStore, type ReactNode } from \"react\";\n\nexport interface BootStepContext {\n /**\n * Aborted when the step times out. Stop work when it fires: a retry waits\n * for a timed-out run to settle before running the step again.\n */\n signal: AbortSignal;\n}\n\nexport interface BootStep {\n /** Unique within the list; names the step in errors. */\n id: string;\n run: (context: BootStepContext) => Promise<unknown> | unknown;\n /** Overrides the boot's `timeoutMs` for this step. */\n timeoutMs?: number;\n}\n\nexport type BootStatus = \"idle\" | \"booting\" | \"ready\" | \"failed\";\n\nexport interface BootState {\n status: BootStatus;\n /** Set when `status` is `\"failed\"`. */\n error: Error | null;\n /** The id of the step that failed. */\n failedStep: string | null;\n /** Ids of the steps that have finished, in order. */\n completed: readonly string[];\n}\n\nexport interface BootOptions {\n /** Shortest time the boot takes, so the splash doesn't flash. Default 0. */\n minimumMs?: number;\n /** Longest time one step may take. Default 10 000. */\n timeoutMs?: number;\n}\n\nexport interface BootController {\n getState(): BootState;\n subscribe(listener: () => void): () => void;\n /** Run the steps not yet finished. Calling it while a run is in flight returns that run. */\n start(): Promise<void>;\n /** After a failure: run again from the step that failed. */\n retry(): Promise<void>;\n}\n\n/** Thrown when a step takes longer than its timeout. */\nexport class BootTimeoutError extends Error {\n readonly step: string;\n constructor(step: string, ms: number, reason = \"did not finish\") {\n super(`Boot step \"${step}\" ${reason} within ${ms} ms.`);\n this.name = \"BootTimeoutError\";\n this.step = step;\n }\n}\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\n\nexport function toError(value: unknown): Error {\n if (value instanceof Error) return value;\n return new Error(typeof value === \"string\" ? value : \"Unknown error\", { cause: value });\n}\n\n/** Resolves \"settled\" when `promise` settles, \"pending\" after `ms`. */\nfunction settledWithin(promise: Promise<unknown>, ms: number): Promise<\"settled\" | \"pending\"> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n return Promise.race([\n promise.then(\n () => \"settled\" as const,\n () => \"settled\" as const,\n ),\n new Promise<\"pending\">((resolve) => {\n timer = setTimeout(() => resolve(\"pending\"), ms);\n }),\n ]).finally(() => clearTimeout(timer));\n}\n\n/** The boot controller: runs `steps` once each, in order, with a timeout per step. */\nexport function createBoot(steps: readonly BootStep[], options: BootOptions = {}): BootController {\n const seen = new Set<string>();\n for (const step of steps) {\n if (seen.has(step.id)) throw new Error(`Boot step \"${step.id}\" is listed twice.`);\n seen.add(step.id);\n }\n const { minimumMs = 0, timeoutMs = DEFAULT_TIMEOUT_MS } = options;\n const listeners = new Set<() => void>();\n let state: BootState = { status: \"idle\", error: null, failedStep: null, completed: [] };\n let inFlight: Promise<void> | null = null;\n // A step that timed out keeps running (JavaScript can't stop it; `signal`\n // asks it to). A retry waits for it rather than running it twice at once.\n const abandoned = new Map<string, Promise<\"ok\" | \"failed\">>();\n\n const runStep = async (step: BootStep, ms: number): Promise<void> => {\n const previous = abandoned.get(step.id);\n if (previous) {\n if ((await settledWithin(previous, ms)) === \"pending\") {\n throw new BootTimeoutError(step.id, ms, \"is still running from the last attempt\");\n }\n abandoned.delete(step.id);\n // The abandoned run finished after all: it counts.\n if ((await previous) === \"ok\") return;\n }\n const controller = new AbortController();\n const running = Promise.resolve().then(() => step.run({ signal: controller.signal }));\n if ((await settledWithin(running, ms)) === \"pending\") {\n controller.abort();\n abandoned.set(step.id, running.then(() => \"ok\" as const, () => \"failed\" as const));\n throw new BootTimeoutError(step.id, ms);\n }\n await running;\n };\n\n const set = (next: Partial<BootState>) => {\n state = { ...state, ...next };\n for (const listener of listeners) listener();\n };\n\n const run = async () => {\n const started = Date.now();\n set({ status: \"booting\", error: null, failedStep: null });\n for (const step of steps) {\n if (state.completed.includes(step.id)) continue;\n try {\n await runStep(step, step.timeoutMs ?? timeoutMs);\n } catch (error) {\n set({ status: \"failed\", error: toError(error), failedStep: step.id });\n return;\n }\n set({ completed: [...state.completed, step.id] });\n }\n const wait = minimumMs - (Date.now() - started);\n if (wait > 0) await new Promise((resolve) => setTimeout(resolve, wait));\n set({ status: \"ready\" });\n };\n\n const start = () => {\n if (state.status === \"ready\") return Promise.resolve();\n if (!inFlight) {\n inFlight = run().finally(() => {\n inFlight = null;\n });\n }\n return inFlight;\n };\n\n return {\n getState: () => state,\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n start,\n retry: start,\n };\n}\n\nconst BootContext = createContext<BootController | null>(null);\n\n/** Makes a boot readable with `useBoot()`. */\nexport function BootProvider({ boot, children }: { boot: BootController; children: ReactNode }) {\n return <BootContext.Provider value={boot}>{children}</BootContext.Provider>;\n}\n\nexport interface UseBootReturn extends BootState {\n retry: () => void;\n}\n\n/** The boot's status, and `retry` after a failure. Inside `GenesisNativeApp` or a `BootProvider`. */\nexport function useBoot(): UseBootReturn {\n const boot = useContext(BootContext);\n if (!boot) throw new Error(\"useBoot must be used inside <GenesisNativeApp> or <BootProvider>.\");\n const state = useSyncExternalStore(boot.subscribe, boot.getState, boot.getState);\n return { ...state, retry: () => void boot.retry() };\n}\n","/**\n * Errors: a boundary per screen tree, and handlers for errors React never sees\n * (a fatal global error from `ErrorUtils`, an unhandled promise rejection).\n * All of them report through one `onError` (wire Sentry there) and show the\n * fatal screen instead of letting the app die; its \"Try again\" remounts the\n * tree with fresh state.\n */\nimport { Component, type ComponentType, type ErrorInfo, type ReactNode } from \"react\";\nimport { Pressable, Text, View } from \"react-native\";\nimport { NativeButton, NativeEmptyState } from \"@marktiderman/genesis-ui-native/components\";\nimport { classifyError, reportError } from \"@marktiderman/genesis-core/errors\";\nimport { toError } from \"./boot\";\n\ndeclare const __DEV__: boolean | undefined;\n\n/**\n * What a fatal or screen error says under its title: the safe sentence for\n * its kind (offline, signed out…), or nothing for a plain bug. The error's\n * own text can hold an email, an id or a store's internals, so it is shown\n * only in development builds.\n */\nexport function errorDetails(error: Error): string | undefined {\n if (typeof __DEV__ !== \"undefined\" && __DEV__) return error.message;\n const classified = classifyError(error);\n return classified.kind === \"unexpected\" ? undefined : classified.message;\n}\n\nexport interface FatalScreenProps {\n error: Error;\n /** Clears the error and remounts the app below the shell (and re-runs a failed boot). */\n retry: () => void;\n}\n\n/** Which fatal screen: the app's, one screen's, or the last-resort plain one. */\nexport type FatalScreenKind = \"app\" | \"screen\" | \"plain\";\n\nexport interface FatalScreenViewProps {\n error: Error;\n /** Clears the error and renders again (a screen's retry may be async, as Expo Router's is). */\n retry: () => void | Promise<void>;\n /**\n * `app` (default): the app hit a problem, \"Try again\" remounts it. `screen`: one screen failed\n * and the rest of the app still works (the screen boundary's default). `plain`: React Native\n * primitives only, no theme, no context, nothing that can itself fail; shown when the providers\n * could not start, or when the `fatal` slot threw.\n */\n kind?: FatalScreenKind;\n}\n\nconst runRetry = (retry: FatalScreenViewProps[\"retry\"], source: string) => () => {\n void Promise.resolve(retry()).catch((e: unknown) => reportError(e, source));\n};\n\n/**\n * The fatal screen: what went wrong and \"Try again\", for the whole app, one screen, or (with\n * `kind=\"plain\"`) the last resort that needs nothing above it.\n */\nexport function FatalScreen({ error, retry, kind = \"app\" }: FatalScreenViewProps) {\n if (kind === \"plain\") {\n return (\n <View testID=\"genesis-fatal-plain\" style={{ flex: 1, justifyContent: \"center\", alignItems: \"center\", padding: 24, gap: 12 }}>\n <Text accessibilityRole=\"header\" style={{ fontSize: 17, fontWeight: \"600\" }}>\n Something went wrong\n </Text>\n <Text style={{ textAlign: \"center\" }}>{errorDetails(error) ?? \"Try again, and if it keeps happening, close and reopen the app.\"}</Text>\n <Pressable accessibilityRole=\"button\" onPress={() => void retry()} testID=\"genesis-fatal-plain-retry\" style={{ padding: 12 }}>\n <Text style={{ fontSize: 17 }}>Try again</Text>\n </Pressable>\n </View>\n );\n }\n const screen = kind === \"screen\";\n return (\n <NativeEmptyState\n variant=\"error\"\n title={screen ? \"This screen hit a problem\" : \"Something went wrong\"}\n body={\n screen\n ? \"The rest of the app still works. Try again, or go back.\"\n : \"The app hit a problem. Try again, and if it keeps happening, close and reopen the app.\"\n }\n details={errorDetails(error)}\n primaryAction={\n <NativeButton\n onPress={screen ? runRetry(retry, \"native:screen-retry\") : () => void retry()}\n testID={screen ? \"genesis-screen-error-retry\" : \"genesis-fatal-retry\"}\n >\n Try again\n </NativeButton>\n }\n testID={screen ? \"genesis-screen-error\" : \"genesis-fatal\"}\n />\n );\n}\n\n/**\n * The last-resort fatal screen.\n *\n * @deprecated Use `<FatalScreen kind=\"plain\" />`; this name goes at the next major.\n */\nexport function PlainFatalScreen(props: FatalScreenProps) {\n return <FatalScreen {...props} kind=\"plain\" />;\n}\n\nexport interface ErrorReport {\n /** True when the app could not go on (a render error, a failed boot, a fatal global error). */\n fatal: boolean;\n /**\n * `boundary` (the shell's), `screen` (a screen boundary), `global`, `boot`,\n * `rejection`, `query` and `mutation` (a failed query or mutation the\n * shell's query client saw).\n */\n source: \"boundary\" | \"screen\" | \"global\" | \"boot\" | \"rejection\" | \"query\" | \"mutation\";\n componentStack?: string;\n /** False when nothing caught it (an unhandled promise rejection). Default: handled unless fatal. */\n handled?: boolean;\n /** Low-cardinality labels (`query.key`), never ids. */\n tags?: Readonly<Record<string, string>>;\n}\n\nexport type OnError = (error: Error, report: ErrorReport) => void;\n\nexport interface GenesisErrorBoundaryProps {\n children?: ReactNode;\n /** What to render instead of the tree that threw. */\n fallback: ComponentType<FatalScreenProps>;\n onError?: OnError;\n /** Change it to clear a caught error (the tree remounts). */\n resetKey?: unknown;\n /** Called by the fallback's retry, after the error is cleared. */\n onRetry?: () => void;\n /** Reported as fatal (the app could not go on). Default true; a screen boundary reports false. */\n fatal?: boolean;\n /** The report's source. Default `boundary`. */\n source?: ErrorReport[\"source\"];\n}\n\ninterface BoundaryState {\n error: Error | null;\n}\n\n/** An error boundary whose fallback gets `{ error, retry }`. */\nexport class GenesisErrorBoundary extends Component<GenesisErrorBoundaryProps, BoundaryState> {\n override state: BoundaryState = { error: null };\n\n static getDerivedStateFromError(error: unknown): BoundaryState {\n return { error: toError(error) };\n }\n\n override componentDidCatch(error: unknown, info: ErrorInfo) {\n try {\n this.props.onError?.(toError(error), {\n fatal: this.props.fatal ?? true,\n source: this.props.source ?? \"boundary\",\n componentStack: info.componentStack ?? undefined,\n });\n } catch {\n // A failing reporter must not stop the fallback.\n }\n }\n\n override componentDidUpdate(previous: GenesisErrorBoundaryProps) {\n if (this.state.error && previous.resetKey !== this.props.resetKey) this.setState({ error: null });\n }\n\n retry = () => {\n this.setState({ error: null });\n this.props.onRetry?.();\n };\n\n override render() {\n const { error } = this.state;\n if (!error) return this.props.children ?? null;\n const Fallback = this.props.fallback;\n return <Fallback error={error} retry={this.retry} />;\n }\n}\n\n/** React Native's `ErrorUtils` (a global in every RN app), or a stand-in. */\nexport interface ErrorUtilsLike {\n getGlobalHandler(): ((error: unknown, isFatal?: boolean) => void) | undefined;\n setGlobalHandler(handler: (error: unknown, isFatal?: boolean) => void): void;\n}\n\nexport interface GlobalErrorHandlerOptions {\n errorUtils: ErrorUtilsLike;\n onError?: OnError;\n /** A fatal error: show the fatal screen. The previous handler (which would end the app) is not called. */\n onFatal: (error: Error) => void;\n /**\n * True while a fatal screen is already up. Another fatal error then goes to\n * the previous handler, which ends the app (it restarts clean) rather than\n * leaving it stuck behind a screen that may itself be broken.\n */\n alreadyFatal?: () => boolean;\n}\n\n/**\n * Route global errors to `onError`. A fatal one goes to `onFatal` instead of\n * React Native's default handler, which would close the app; a non-fatal one\n * still reaches the previous handler (LogBox in development). Returns a\n * function that puts the previous handler back.\n */\nexport function installGlobalErrorHandler({ errorUtils, onError, onFatal, alreadyFatal }: GlobalErrorHandlerOptions): () => void {\n const previous = errorUtils.getGlobalHandler();\n errorUtils.setGlobalHandler((raw, isFatal) => {\n const error = toError(raw);\n try {\n onError?.(error, { fatal: Boolean(isFatal), source: \"global\" });\n } catch {\n // A failing reporter must not take the handler down with it.\n }\n if (isFatal && !alreadyFatal?.()) onFatal(error);\n else previous?.(raw, isFatal);\n });\n return () => {\n // With no previous handler, leave one that only logs, never ours (it would call an unmounted app).\n // genesis-allow-console: the last handler left once the shell is gone; nothing else is listening.\n errorUtils.setGlobalHandler(previous ?? ((error) => console.error(error)));\n };\n}\n\n/** `globalThis.ErrorUtils` in a React Native runtime, undefined elsewhere. */\nexport function defaultErrorUtils(): ErrorUtilsLike | undefined {\n const candidate = (globalThis as { ErrorUtils?: ErrorUtilsLike }).ErrorUtils;\n return candidate && typeof candidate.setGlobalHandler === \"function\" ? candidate : undefined;\n}\n\n/** Hermes's `HermesInternal.enablePromiseRejectionTracker`, or a stand-in. */\nexport type EnableRejectionTracker = (options: {\n allRejections: boolean;\n onUnhandled: (id: number, rejection: unknown) => void;\n onHandled: (id: number) => void;\n}) => void;\n\n/**\n * Hermes's rejection tracker, when the app runs on Hermes. React Native sends\n * unhandled rejections to `ExceptionsManager` (LogBox in development), never\n * to `ErrorUtils`' global handler, so without this they never reach `onError`.\n */\nexport function defaultRejectionTracker(): EnableRejectionTracker | undefined {\n const hermes = (globalThis as { HermesInternal?: { enablePromiseRejectionTracker?: EnableRejectionTracker } }).HermesInternal;\n const enable = hermes?.enablePromiseRejectionTracker;\n return typeof enable === \"function\" ? enable.bind(hermes) : undefined;\n}\n\n/**\n * Report unhandled promise rejections to `onError`: non-fatal, and unhandled\n * (`handled: false`), so release health counts them. This replaces React\n * Native's own tracker, so each rejection is also written with\n * `console.warn`, which LogBox shows in development as before.\n */\nexport function installRejectionTracker({ enable, onError }: { enable: EnableRejectionTracker; onError: OnError }): void {\n enable({\n allRejections: true,\n onUnhandled: (id, rejection) => {\n const error = toError(rejection);\n // genesis-allow-console: React Native's own tracker writes this warning; replacing it must too (LogBox).\n console.warn(`Uncaught (in promise, id: ${id}): ${error.message}`);\n try {\n onError(error, { fatal: false, handled: false, source: \"rejection\" });\n } catch {\n // A failing reporter must not throw inside the promise machinery.\n }\n },\n onHandled: () => {},\n });\n}\n","/**\n * Screen errors: one screen fails, the rest of the app (the tab bar, the\n * other tabs) keeps working. The error is reported non-fatal, and \"Try\n * again\" renders the screen again.\n *\n * With Expo Router, export the boundary from a route or layout file; it\n * catches errors in that route and the routes below it:\n *\n * // src/lib/observability.ts\n * export const ScreenErrorBoundary = observability.screenBoundary();\n * // src/app/(app)/messages/_layout.tsx\n * export { ScreenErrorBoundary as ErrorBoundary } from \"@/lib/observability\";\n *\n * `observability.screenBoundary()` reports through the block and wraps the\n * boundary with each sink's route wrapper (Sentry's\n * `wrapExpoRouterErrorBoundary`). Without the block,\n * `createScreenErrorBoundary()` reports through `reportError` from\n * genesis-core. Outside Expo Router, wrap a subtree in `<ScreenErrorBoundary>`.\n */\nimport { useEffect, useMemo, useRef, type ComponentType, type ReactNode } from \"react\";\nimport { reportError } from \"@marktiderman/genesis-core/errors\";\nimport { FatalScreen, GenesisErrorBoundary, type ErrorReport, type FatalScreenProps, type OnError } from \"./errors\";\n\n/** What Expo Router gives a route's `ErrorBoundary`: the error, and `retry` to render the route again. */\nexport interface ScreenErrorProps {\n error: Error;\n retry: () => Promise<void>;\n}\n\n/**\n * The default screen fallback: the screen hit a problem, and \"Try again\".\n *\n * @deprecated Use `<FatalScreen kind=\"screen\" />`; this name goes at the next major.\n */\nexport function ScreenErrorScreen(props: ScreenErrorProps) {\n return <FatalScreen {...props} kind=\"screen\" />;\n}\n\nconst ScreenFallback = (props: ScreenErrorProps) => <FatalScreen {...props} kind=\"screen\" />;\n\nconst reportThroughCore = (error: Error, report: ErrorReport) =>\n reportError(error, { source: report.source, fatal: report.fatal, ...(report.tags ? { tags: report.tags } : {}) });\n\nexport interface ScreenErrorBoundaryOptions {\n /** What to show. Default `<FatalScreen kind=\"screen\" />`. */\n fallback?: ComponentType<ScreenErrorProps>;\n /** Where the error goes. Default `reportError` from genesis-core (the observability block, when it is on). */\n onError?: OnError;\n /** Wrappers around the route boundary, innermost first (Sentry's `wrapExpoRouterErrorBoundary`). */\n wrap?: readonly ((boundary: ComponentType<ScreenErrorProps>) => ComponentType<ScreenErrorProps>)[];\n}\n\n/**\n * An Expo Router `ErrorBoundary`: reports each error once (non-fatal, source\n * `screen`) and shows `fallback`. Build it once, at module scope.\n *\n * @stability Beta\n */\nexport function createScreenErrorBoundary(options: ScreenErrorBoundaryOptions = {}): ComponentType<ScreenErrorProps> {\n const Fallback = options.fallback ?? ScreenFallback;\n const onError = options.onError ?? reportThroughCore;\n function GenesisScreenErrorBoundary(props: ScreenErrorProps) {\n const reported = useRef<Error | null>(null);\n useEffect(() => {\n if (reported.current === props.error) return;\n reported.current = props.error;\n try {\n onError(props.error, { fatal: false, source: \"screen\" });\n } catch {\n // A failing reporter must not take the fallback down with it.\n }\n }, [props.error]);\n return <Fallback {...props} />;\n }\n return (options.wrap ?? []).reduce<ComponentType<ScreenErrorProps>>((inner, wrap) => wrap(inner), GenesisScreenErrorBoundary);\n}\n\nexport interface ScreenErrorBoundaryProps {\n children?: ReactNode;\n fallback?: ComponentType<ScreenErrorProps>;\n /** Default `reportError` from genesis-core. */\n onError?: OnError;\n /** Change it to clear a caught error. */\n resetKey?: unknown;\n}\n\n/**\n * A boundary around part of a screen tree, for apps without Expo Router's\n * per-route boundaries: non-fatal, reported, with \"Try again\".\n *\n * @stability Beta\n */\nexport function ScreenErrorBoundary({ children, fallback, onError, resetKey }: ScreenErrorBoundaryProps) {\n const Screen = fallback ?? ScreenFallback;\n // The boundary's retry is synchronous; the screen's (Expo Router's shape) returns a promise.\n const Fallback = useMemo(\n () =>\n function ScreenFallback({ error, retry }: FatalScreenProps) {\n return <Screen error={error} retry={async () => retry()} />;\n },\n [Screen],\n );\n return (\n <GenesisErrorBoundary fallback={Fallback} onError={onError ?? reportThroughCore} resetKey={resetKey} fatal={false} source=\"screen\">\n {children}\n </GenesisErrorBoundary>\n );\n}\n"]}
|
package/dist/devtools.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { N as NativeBlock, U as UpdatesBlock, V as VersionSignature } from './blocks-
|
|
2
|
-
export { D as DevtoolsFeedbackProps, a as DevtoolsSlots } from './blocks-
|
|
3
|
-
import { O as ObservabilityBlock, R as RecentActivity } from './block-
|
|
1
|
+
import { N as NativeBlock, U as UpdatesBlock, V as VersionSignature } from './blocks-dppiMmy-.js';
|
|
2
|
+
export { D as DevtoolsFeedbackProps, a as DevtoolsSlots } from './blocks-dppiMmy-.js';
|
|
3
|
+
import { O as ObservabilityBlock, R as RecentActivity } from './block-CQz1pOnm.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '@marktiderman/genesis-core/slots';
|
|
6
6
|
import '@marktiderman/genesis-features/blocks';
|
|
7
|
-
import './query
|
|
7
|
+
import './query--ihYsJWC.js';
|
|
8
8
|
import '@tanstack/react-query';
|
|
9
9
|
import '@marktiderman/genesis-design-system';
|
|
10
10
|
import '@marktiderman/genesis-core/provider';
|
|
11
11
|
import '@marktiderman/genesis-ui-native/layouts';
|
|
12
12
|
import '@marktiderman/genesis-ui-native/components';
|
|
13
|
-
import './screen-boundary-
|
|
13
|
+
import './screen-boundary-B8DlsLwb.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* The overlay's two ways in, as plain state machines (the root feeds them
|
package/dist/devtools.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useBlocks } from './chunk-65P7RU4V.js';
|
|
2
2
|
import { versionSignature } from './chunk-6BT4PTGH.js';
|
|
3
|
-
import { scrubString, useRecentActivity, scrubUrl } from './chunk-
|
|
4
|
-
import './chunk-
|
|
3
|
+
import { scrubString, useRecentActivity, scrubUrl } from './chunk-EWHO5WQU.js';
|
|
4
|
+
import './chunk-YIF4BFQH.js';
|
|
5
5
|
import './chunk-VIC2KXMA.js';
|
|
6
6
|
import { useSession } from './chunk-NGYNYJPL.js';
|
|
7
7
|
import { useSyncExternalStore, useState, useEffect, useRef, useMemo } from 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { A as AuthClientLike, b as AuthGate, c as AuthGateProps, B as BlockSettingsSection, d as BootController, e as BootOptions, f as BootProvider, g as BootScreen, h as BootScreenProps, i as BootState, j as BootStatus, k as BootStep, l as BootStepContext, m as BootTimeoutError, G as GenesisNativeApp, n as GenesisNativeAppProps, H as HeldLinkAuth, L as LinkHold, o as LinkOptions, p as LinkTarget, q as NativeAppSlots, N as NativeBlock, r as NativeBlockRootProps, s as NativeQueryClientOptions, S as SessionProvider, t as SessionState, u as SessionStatus, v as SessionStore, w as SessionStoreOptions, x as SettingsRowLike, y as SignedOutProps, z as SplashModule, C as UseBlockSettingsOptions, E as UseBootReturn, F as UseHeldLinkOptions, I as createBoot, J as createLinkHold, K as createSessionStore, M as mergeBlockSettings, O as normalizeLink, P as useBlockSettings, Q as useBlocks, R as useBoot, T as useHeldLink, W as useSession } from './blocks-
|
|
2
|
-
import { A as AsyncStorageLike } from './query
|
|
3
|
-
export { a as AppStateLike, D as DAY_MS, E as EnableRejectionTracker, b as ErrorReport, c as ErrorUtilsLike, F as FatalScreen, d as FatalScreenProps, G as GenesisErrorBoundary,
|
|
4
|
-
export { S as ScreenErrorBoundary, a as ScreenErrorBoundaryOptions, b as ScreenErrorBoundaryProps, c as ScreenErrorProps, d as ScreenErrorScreen, e as createScreenErrorBoundary } from './screen-boundary-
|
|
1
|
+
export { A as AuthClientLike, b as AuthGate, c as AuthGateProps, B as BlockSettingsSection, d as BootController, e as BootOptions, f as BootProvider, g as BootScreen, h as BootScreenProps, i as BootState, j as BootStatus, k as BootStep, l as BootStepContext, m as BootTimeoutError, G as GenesisNativeApp, n as GenesisNativeAppProps, H as HeldLinkAuth, L as LinkHold, o as LinkOptions, p as LinkTarget, q as NativeAppSlots, N as NativeBlock, r as NativeBlockRootProps, s as NativeQueryClientOptions, S as SessionProvider, t as SessionState, u as SessionStatus, v as SessionStore, w as SessionStoreOptions, x as SettingsRowLike, y as SignedOutProps, z as SplashModule, C as UseBlockSettingsOptions, E as UseBootReturn, F as UseHeldLinkOptions, I as createBoot, J as createLinkHold, K as createSessionStore, M as mergeBlockSettings, O as normalizeLink, P as useBlockSettings, Q as useBlocks, R as useBoot, T as useHeldLink, W as useSession } from './blocks-dppiMmy-.js';
|
|
2
|
+
import { A as AsyncStorageLike } from './query--ihYsJWC.js';
|
|
3
|
+
export { a as AppStateLike, D as DAY_MS, E as EnableRejectionTracker, b as ErrorReport, c as ErrorUtilsLike, F as FatalScreen, d as FatalScreenKind, e as FatalScreenProps, f as FatalScreenViewProps, G as GenesisErrorBoundary, g as GenesisErrorBoundaryProps, h as GlobalErrorHandlerOptions, N as NetInfoLike, O as OnError, P as PlainFatalScreen, Q as QueryErrorReporter, i as QueryLifecycleOptions, j as QueryPersistence, R as ReportQueryErrorsOptions, k as connectQueryLifecycle, l as createNativeQueryClient, m as defaultErrorUtils, n as defaultRejectionTracker, o as errorDetails, p as installGlobalErrorHandler, q as installRejectionTracker, r as queryKeyName, s as reportQueryErrors } from './query--ihYsJWC.js';
|
|
4
|
+
export { S as ScreenErrorBoundary, a as ScreenErrorBoundaryOptions, b as ScreenErrorBoundaryProps, c as ScreenErrorProps, d as ScreenErrorScreen, e as createScreenErrorBoundary } from './screen-boundary-B8DlsLwb.js';
|
|
5
5
|
export { ClassifiedError, ClassifyErrorOptions, ErrorKind, ErrorMessages, classifyError, errorMessages, reportError } from '@marktiderman/genesis-core/errors';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '@marktiderman/genesis-core/slots';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createNativeQueryClient, connectQueryLifecycle, reportQueryErrors } from './chunk-C54LIT4N.js';
|
|
2
|
-
export { DAY_MS, connectQueryLifecycle, createNativeQueryClient, queryKeyName, reportQueryErrors } from './chunk-C54LIT4N.js';
|
|
3
|
-
export { normalizeLink } from './chunk-VKTIHNAV.js';
|
|
4
1
|
import { reportToBlocks, BlocksProvider } from './chunk-65P7RU4V.js';
|
|
5
2
|
export { mergeBlockSettings, useBlockSettings, useBlocks } from './chunk-65P7RU4V.js';
|
|
6
|
-
import {
|
|
7
|
-
export {
|
|
3
|
+
import { createNativeQueryClient, connectQueryLifecycle, reportQueryErrors } from './chunk-FKDZP3RJ.js';
|
|
4
|
+
export { DAY_MS, connectQueryLifecycle, createNativeQueryClient, queryKeyName, reportQueryErrors } from './chunk-FKDZP3RJ.js';
|
|
5
|
+
export { normalizeLink } from './chunk-VKTIHNAV.js';
|
|
6
|
+
import { GenesisErrorBoundary, createBoot, defaultErrorUtils, installGlobalErrorHandler, defaultRejectionTracker, installRejectionTracker, BootProvider, FatalScreen } from './chunk-YIF4BFQH.js';
|
|
7
|
+
export { BootProvider, BootTimeoutError, FatalScreen, GenesisErrorBoundary, PlainFatalScreen, ScreenErrorBoundary, ScreenErrorScreen, createBoot, createScreenErrorBoundary, defaultErrorUtils, defaultRejectionTracker, errorDetails, installGlobalErrorHandler, installRejectionTracker, useBoot } from './chunk-YIF4BFQH.js';
|
|
8
8
|
export { BEFORE_RELOAD_TIMEOUT_MS, onBeforeReload, runBeforeReload } from './chunk-VIC2KXMA.js';
|
|
9
9
|
import { createSessionStore, SessionProvider } from './chunk-NGYNYJPL.js';
|
|
10
10
|
export { AuthGate, SessionProvider, createSessionStore, useSession } from './chunk-NGYNYJPL.js';
|
|
@@ -67,6 +67,7 @@ function BootScreen(_props) {
|
|
|
67
67
|
return /* @__PURE__ */ jsx(View, { testID: "genesis-boot", accessibilityRole: "progressbar", style: { flex: 1, justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ jsx(Text, { children: "Loading\u2026" }) });
|
|
68
68
|
}
|
|
69
69
|
var PassThrough = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children });
|
|
70
|
+
var PlainFallback = (props) => /* @__PURE__ */ jsx(FatalScreen, { ...props, kind: "plain" });
|
|
70
71
|
var ThemeProvider = GenesisThemeProvider;
|
|
71
72
|
function GenesisNativeApp(props) {
|
|
72
73
|
const [rootKey, setRootKey] = useState(0);
|
|
@@ -78,7 +79,7 @@ function GenesisNativeApp(props) {
|
|
|
78
79
|
return /* @__PURE__ */ jsx(
|
|
79
80
|
GenesisErrorBoundary,
|
|
80
81
|
{
|
|
81
|
-
fallback:
|
|
82
|
+
fallback: PlainFallback,
|
|
82
83
|
onError: (e, r) => {
|
|
83
84
|
reportToBlocks(blocksRef.current, e, r);
|
|
84
85
|
try {
|
|
@@ -234,7 +235,7 @@ function Shell(props) {
|
|
|
234
235
|
const s = withBlockSlots(blocks.slots, latest.current.slots);
|
|
235
236
|
return (
|
|
236
237
|
// A `fatal` slot that throws falls back to the plain screen.
|
|
237
|
-
/* @__PURE__ */ jsx(GenesisErrorBoundary, { fallback:
|
|
238
|
+
/* @__PURE__ */ jsx(GenesisErrorBoundary, { fallback: PlainFallback, onError, onRetry: fallbackProps.retry, children: renderSlot(FatalScreen, s?.fatal, fallbackProps, sp?.fatal) })
|
|
238
239
|
);
|
|
239
240
|
}
|
|
240
241
|
return { client: client2, persistence: persistence2, session: session2, boot: boot2, FatalFallback: FatalFallback2, blocks, provider: provider ?? createSupabaseProvider(supabase) };
|
|
@@ -253,7 +254,7 @@ function Shell(props) {
|
|
|
253
254
|
if (bootState.status === "failed" && bootState.error) onError(bootState.error, { fatal: true, source: "boot" });
|
|
254
255
|
}, [bootState.status, bootState.error]);
|
|
255
256
|
useEffect(() => {
|
|
256
|
-
if (bootState.status === "ready" && persistence) return persistence.subscribe(sessionState.userId ?? "");
|
|
257
|
+
if (bootState.status === "ready" && persistence) return persistence.subscribe(sessionState.userId ?? "", { adopt: Boolean(sessionState.userId) });
|
|
257
258
|
}, [bootState.status, persistence, sessionState.userId]);
|
|
258
259
|
useEffect(() => {
|
|
259
260
|
const utils = errorUtils ?? defaultErrorUtils();
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/held-link.ts","../src/app.tsx","../src/hydration-gate.ts"],"names":["useRef","useEffect","client","persistence","session","boot","FatalFallback","useSyncExternalStore"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoCO,SAAS,cAAA,GAA2B;AACzC,EAAA,IAAI,IAAA,GAAsB,IAAA;AAC1B,EAAA,MAAM,SAAA,uBAAgB,GAAA,EAAgB;AACtC,EAAA,MAAM,GAAA,GAAM,CAAC,IAAA,KAAwB;AACnC,IAAA,IAAI,SAAS,IAAA,EAAM;AACnB,IAAA,IAAA,GAAO,IAAA;AACP,IAAA,KAAA,MAAW,QAAA,IAAY,WAAW,QAAA,EAAS;AAAA,EAC7C,CAAA;AACA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,CAAC,IAAA,KAAS,GAAA,CAAI,IAAI,CAAA;AAAA,IACxB,MAAM,MAAM,IAAA;AAAA,IACZ,IAAA,GAAO;AACL,MAAA,MAAM,IAAA,GAAO,IAAA;AACb,MAAA,GAAA,CAAI,IAAI,CAAA;AACR,MAAA,OAAO,IAAA;AAAA,IACT,CAAA;AAAA,IACA,KAAA,EAAO,MAAM,GAAA,CAAI,IAAI,CAAA;AAAA,IACrB,UAAU,QAAA,EAAU;AAClB,MAAA,SAAA,CAAU,IAAI,QAAQ,CAAA;AACtB,MAAA,OAAO,MAAM,SAAA,CAAU,MAAA,CAAO,QAAQ,CAAA;AAAA,IACxC;AAAA,GACF;AACF;AAYO,SAAS,WAAA,CAAY,IAAA,EAAgB,EAAE,IAAA,EAAM,WAAU,EAAsC;AAClG,EAAA,MAAM,OAAO,oBAAA,CAAqB,IAAA,CAAK,WAAW,IAAA,CAAK,IAAA,EAAM,KAAK,IAAI,CAAA;AACtE,EAAA,MAAM,OAAA,GAAU,OAAO,SAAS,CAAA;AAChC,EAAA,OAAA,CAAQ,OAAA,GAAU,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AAS;AACf,MAAA,MAAM,OAAA,GAAU,OAAO,GAAA,EAAa,KAAA,KAAkB;AACpD,QAAA,IAAI,CAAC,QAAA,EAAU,OAAO,cAAA,GAAiB,GAAG,CAAA;AAC1C,QAAA,OAAO,OAAA,CAAQ,OAAA,CAAQ,GAAA,EAAK,KAAK,CAAA;AAAA,MACnC,CAAA;AACA,MAAA,MAAM,UAAA,GAAa,OAAO,GAAA,KAAgB;AACxC,QAAA,IAAI,CAAC,QAAA,EAAU,OAAO,cAAA,GAAiB,GAAG,CAAA;AAC1C,QAAA,OAAO,OAAA,CAAQ,WAAW,GAAG,CAAA;AAAA,MAC/B,CAAA;AAGA,MAAA,OAAO,IAAI,MAAM,OAAA,EAAS;AAAA,QACxB,GAAA,CAAI,QAAQ,QAAA,EAAU;AACpB,UAAA,IAAI,QAAA,KAAa,WAAW,OAAO,OAAA;AACnC,UAAA,IAAI,QAAA,KAAa,cAAc,OAAO,UAAA;AACtC,UAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,GAAA,CAAI,MAAA,EAAQ,UAAU,MAAM,CAAA;AAClD,UAAA,OAAO,OAAO,KAAA,KAAU,UAAA,GAAa,KAAA,CAAM,IAAA,CAAK,MAAM,CAAA,GAAI,KAAA;AAAA,QAC5D;AAAA,OACD,CAAA;AAAA,IACH;AAAA,GACF;AACA,EAAA,OAAO,IAAA;AACT","file":"index.js","sourcesContent":["/**\n * Hold a deep link until sign-in completes.\n *\n * expo-router opens every incoming link itself. For a signed-in user that is\n * all that should happen. For a signed-out user, the auth layout redirects to\n * sign-in and the link is lost; holding it lets the app go there once the user\n * has signed in. The hold lives outside React, because expo-router's\n * `+native-intent` runs before any component:\n *\n * // lib/links.ts\n * export const linkHold = createLinkHold();\n * // app/+native-intent.ts\n * export function redirectSystemPath({ path }) {\n * const to = normalizeLink(path, links);\n * if (to && to !== \"/\") linkHold.hold(to);\n * return to;\n * }\n *\n * `useHeldLink` follows a held link only if the user was seen signed out\n * while it was held. A link that arrives while signed in, or at a cold start\n * that turns out signed in, is dropped, since the router already opened it.\n * `GenesisNativeApp` runs it for you (`links.onRelease`).\n */\nimport { useEffect, useRef, useSyncExternalStore } from \"react\";\n\nexport interface LinkHold {\n /** Hold `path`, replacing any held one. */\n hold(path: string): void;\n peek(): string | null;\n /** Return the held path and forget it. */\n take(): string | null;\n clear(): void;\n subscribe(listener: () => void): () => void;\n}\n\n/** A place to hold one deep link until sign-in completes; lives outside React. */\nexport function createLinkHold(): LinkHold {\n let held: string | null = null;\n const listeners = new Set<() => void>();\n const set = (next: string | null) => {\n if (held === next) return;\n held = next;\n for (const listener of listeners) listener();\n };\n return {\n hold: (path) => set(path),\n peek: () => held,\n take() {\n const path = held;\n set(null);\n return path;\n },\n clear: () => set(null),\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n };\n}\n\n/** `\"pending\"` while booting or reading the session. */\nexport type HeldLinkAuth = \"pending\" | \"signedOut\" | \"signedIn\";\n\nexport interface UseHeldLinkOptions {\n auth: HeldLinkAuth;\n /** Go there, e.g. `(path) => router.replace(path)`. Called once per link held across a sign-in. */\n onRelease: (path: string) => void;\n}\n\n/** Follow the held link after a sign-in, drop it otherwise; returns the link still held. */\nexport function useHeldLink(hold: LinkHold, { auth, onRelease }: UseHeldLinkOptions): string | null {\n const held = useSyncExternalStore(hold.subscribe, hold.peek, hold.peek);\n const release = useRef(onRelease);\n release.current = onRelease;\n // Was the user signed out while this link was held?\n const waitedForSignIn = useRef(false);\n useEffect(() => {\n if (held === null) {\n waitedForSignIn.current = false;\n return;\n }\n if (auth === \"signedOut\") waitedForSignIn.current = true;\n if (auth !== \"signedIn\") return;\n const path = hold.take();\n const follow = waitedForSignIn.current;\n waitedForSignIn.current = false;\n if (path !== null && follow) release.current(path);\n }, [auth, held, hold]);\n return held;\n}\n","/**\n * `<GenesisNativeApp>`: everything above an Expo app's screens, so the root\n * `_layout.tsx` is a few lines.\n *\n * last-resort boundary (React Native primitives only)\n * └ theme (GenesisThemeProvider, owning the platform color scheme; with `brandVariables`,\n * role variables on a view around the app for NativeWind's role classes; with\n * `modules.navigation`, React Navigation's theme in the same colors and mode)\n * └ keyboard (`keyboardProvider`, once, then `keyboardScroll` for form screens)\n * └ toasts (`NativeToastProvider`, so `useToast()` works on every screen; `toast={null}` drops it)\n * └ data (GenesisProvider over the Supabase client, the QueryClient)\n * └ session + boot (splash held until both are known)\n * └ blocks' roots (with `blocks`, e.g. updates: force upgrade, maintenance, banner, what's new)\n * └ errorBoundary → `bottomSheet`'s provider, if given → your screens (or `signedOut`)\n *\n * Every error the shell catches goes to each block's `onError` (the\n * observability block reports it) and then to the app's own `onError`:\n * render, global, boot and unhandled-rejection errors, and queries and\n * mutations that failed unexpectedly (`reportQueryErrors`).\n *\n * `blocks` (`defineBlock` declarations a native shell can run) are resolved\n * once: requirements checked, boot steps run behind the splash, roots\n * mounted, slot fills put under your `slots`, Settings rows handed to\n * `useBlockSettings`.\n * Global errors, render errors and a failed boot show the `fatal` slot with\n * \"Try again\". Every part is a slot (`slots` / `slotProps`, `null` drops it)\n * and is also exported on its own.\n */\nimport { useEffect, useMemo, useRef, useState, useSyncExternalStore, type ComponentType, type ReactNode } from \"react\";\nimport { Text, View } from \"react-native\";\nimport type { QueryClient, QueryClientConfig } from \"@tanstack/react-query\";\nimport { vars } from \"nativewind\";\nimport { GenesisThemeProvider, useTheme } from \"@marktiderman/genesis-design-system/theme\";\nimport { brandRoleVariables, type CanonicalBrand } from \"@marktiderman/genesis-design-system\";\nimport { GenesisProvider, createSupabaseProvider, type DataProvider, type SupabaseClientInput } from \"@marktiderman/genesis-core/provider\";\nimport { renderSlot, type SlotPropsFor, type Slots } from \"@marktiderman/genesis-core/slots\";\nimport { KeyboardScrollProvider, type KeyboardScrollProps, type KeyboardToolbarProps } from \"@marktiderman/genesis-ui-native/layouts\";\nimport {\n GenesisModulesProvider,\n NativeSheetProvider,\n NativeToastProvider,\n type GenesisModules,\n type GenesisNavigationModule,\n type GenesisNavigationTheme,\n type NativeSheetLibrary,\n type NativeToastProviderProps,\n} from \"@marktiderman/genesis-ui-native/components\";\nimport { BootProvider, createBoot, type BootOptions, type BootStatus, type BootStep } from \"./boot\";\nimport {\n FatalScreen,\n GenesisErrorBoundary,\n PlainFatalScreen,\n defaultErrorUtils,\n defaultRejectionTracker,\n installGlobalErrorHandler,\n installRejectionTracker,\n type EnableRejectionTracker,\n type ErrorUtilsLike,\n type FatalScreenProps,\n type GenesisErrorBoundaryProps,\n type OnError,\n} from \"./errors\";\nimport { SessionProvider, createSessionStore, type AuthClientLike } from \"./auth\";\nimport { useHeldLink, type HeldLinkAuth, type LinkHold } from \"./held-link\";\nimport { connectQueryLifecycle, createNativeQueryClient, reportQueryErrors, type QueryLifecycleOptions, type QueryPersistence } from \"./query\";\nimport { resolveBlocks } from \"@marktiderman/genesis-features/blocks\";\nimport { BlocksProvider, reportToBlocks, type NativeBlock } from \"./blocks\";\nimport type { DevtoolsSlots } from \"./devtools/slots\";\n// Types only: the block's code is in the `/updates` entry and arrives with the `updates` prop.\nimport type { UpdatesBlock, UpdatesSlots } from \"./updates/block\";\n// Types only, likewise: the push block (`/push`) arrives in `blocks`.\nimport type { PushSlots } from \"./push/block\";\n\n/** `expo-splash-screen`, or a stand-in. Call `preventAutoHideAsync()` at module scope yourself too. */\nexport interface SplashModule {\n preventAutoHideAsync?: () => Promise<unknown>;\n hideAsync: () => Promise<unknown>;\n}\n\nexport interface BootScreenProps {\n status: BootStatus;\n}\n\nexport interface SignedOutProps {\n /** Your screens. The default renders them, for an expo-router layout that redirects. */\n children: ReactNode;\n}\n\n// A type, not an interface, so it fits the slots contract's Record constraint.\n// The updates block's slots (`forceUpgrade`, `maintenance`, `updateBanner`,\n// `whatsNew`) render only when the `updates` prop is given.\nexport type NativeAppSlots = UpdatesSlots &\n PushSlots &\n DevtoolsSlots & {\n /** Shown while booting: under the splash at launch, on its own after \"Try again\". Default `BootScreen`. */\n boot: BootScreenProps;\n /** A failed boot, a fatal global error or a render error. Default `FatalScreen`. */\n fatal: FatalScreenProps;\n /** The boundary around your screens. Default `GenesisErrorBoundary`. */\n errorBoundary: GenesisErrorBoundaryProps;\n /** What a signed-out user sees. Default your screens (gate them with `useSession`). */\n signedOut: SignedOutProps;\n};\n\nexport interface NativeQueryClientOptions {\n /** Your own client. Default `createNativeQueryClient(config)`. */\n client?: QueryClient;\n config?: QueryClientConfig;\n}\n\nexport interface GenesisNativeAppProps {\n brand: CanonicalBrand;\n /** A Supabase client (from `createGenesisSupabase` in `@marktiderman/genesis-supabase`). */\n supabase: AuthClientLike & SupabaseClientInput;\n /** The data provider. Default `createSupabaseProvider(supabase)`. */\n provider?: DataProvider;\n queryClient?: NativeQueryClientOptions;\n /**\n * Save queries to the phone: `persistQueries({ storage, keys, buster })`\n * from `@marktiderman/genesis-native/persist`. The saved cache belongs to\n * one user: it is restored only for that user and cleared when the user\n * changes (sign-out, a session that ended while the app was closed, an\n * account switch).\n */\n persist?: (client: QueryClient) => QueryPersistence;\n /** `expo-splash-screen`: hidden once boot has finished and the session is known. */\n splash?: SplashModule;\n /**\n * `KeyboardProvider` from react-native-keyboard-controller, mounted once\n * around the app. Its keyboard views (`keyboardScroll` included) do nothing\n * without it: give both or neither. Read once: it wraps the whole app, so\n * a different component later would remount everything below it. To pass\n * it props, define the wrapper at module scope, not inline.\n */\n keyboardProvider?: ComponentType<{ children: ReactNode }>;\n /**\n * Theme role variables (`--primary`, `--background`, …) to set on a view\n * around the app, over what the app's stylesheet declares on `:root`.\n * Default `false`: none are set, so the app's own variables (from\n * `createGenesisNativewindPreset({ brand })` or its brand package) stand.\n * `true` sets `brandRoleVariables(brand)` for the current mode; an object\n * sets the app's own, one map for both modes or `{ light, dark }`.\n */\n brandVariables?: boolean | Record<string, string> | { light: Record<string, string>; dark: Record<string, string> };\n /**\n * React Navigation's theme (headers, tab bars, the screen background), when\n * `modules.navigation` is given. Default: worked out from the same role\n * variables as `brandVariables` (the app's own when it passes them,\n * `brandRoleVariables(brand)` otherwise), for the current mode, so a header\n * is never light in dark mode. Pass a theme (or `{ light, dark }`) to use\n * your own, or `false` to set none.\n */\n navigationTheme?: false | GenesisNavigationTheme | { light: GenesisNavigationTheme; dark: GenesisNavigationTheme };\n /** `KeyboardAwareScrollView` from react-native-keyboard-controller, for form screens. Needs `keyboardProvider`. */\n keyboardScroll?: ComponentType<KeyboardScrollProps>;\n /**\n * `KeyboardToolbar` from react-native-keyboard-controller: previous / next /\n * done above the keyboard on Genesis's form layouts. Needs `keyboardScroll`\n * (and so `keyboardProvider`); without them it is ignored.\n */\n keyboardToolbar?: ComponentType<KeyboardToolbarProps>;\n /**\n * The optional native modules the app installed, for Genesis components to\n * use (`GenesisModulesProvider` from `@marktiderman/genesis-ui-native`):\n * FlashList, expo-image, Reanimated, expo-glass-effect, expo-symbols, a\n * lucide icon set, the @expo/ui date picker. Each one left out falls back\n * to plain React Native. Read once.\n */\n modules?: GenesisModules;\n /**\n * `@gorhom/bottom-sheet` v5, to opt every `NativeSheet` into it (snap\n * points, drag between heights): `import * as BottomSheet from \"@gorhom/bottom-sheet\"`,\n * then `bottomSheet={BottomSheet}`. The app mounts `NativeSheetProvider`\n * (and so the library's `BottomSheetModalProvider`) for you; the app's root\n * must still be inside gesture-handler's `GestureHandlerRootView`, with\n * Reanimated set up. Leave it out and sheets are React Native's own modal\n * (an iOS page sheet), which needs neither. Read once.\n */\n bottomSheet?: NativeSheetLibrary;\n /**\n * Toasts (`useToast()` from `@marktiderman/genesis-ui-native`): `NativeToastProvider` is\n * mounted around the screens, at the top of the screen by default (a bottom toast would sit on\n * a tab bar). Pass its options to place it, or `null` to mount your own. Read once.\n */\n toast?: Pick<NativeToastProviderProps, \"position\" | \"disableAnimation\"> | null;\n /** Follow a link held while signed out, once the user signs in. */\n links?: { hold: LinkHold; onRelease: (path: string) => void };\n /** Run before first render, in order (wipe-on-reinstall, hydrate stores, fonts). Read once. */\n steps?: readonly BootStep[];\n bootOptions?: BootOptions;\n /** Longest wait for Supabase's `getSession()` before using the stored session (offline). Default 5000 ms. */\n sessionWaitMs?: number;\n /** Default `globalThis.ErrorUtils`. */\n errorUtils?: ErrorUtilsLike;\n /** Report unhandled promise rejections to `onError`. Default Hermes's tracker; `null` turns it off. */\n rejectionTracker?: EnableRejectionTracker | null;\n /** `AppState` and NetInfo, so queries refetch on focus and know the network. */\n lifecycle?: QueryLifecycleOptions;\n /**\n * Report queries and mutations that failed for good to `onError` (and so\n * to the observability block), non-fatal, as `query` / `mutation` with the\n * key's first segment as a tag. Only unexpected errors: offline, signed\n * out, not found and the server's expected refusals are left to the\n * screen. One query opts out with `meta: { reportErrors: false }`.\n * Default true. Read once.\n */\n reportQueryErrors?: boolean;\n /**\n * Every caught error, after the blocks' own `onError` (the observability\n * block, `createObservability` from `/observability`, reports to Sentry\n * there). A throwing reporter is ignored.\n */\n onError?: OnError;\n /** After a signed-in user signs out, once the query cache is cleared. */\n onSignedOut?: () => void;\n /**\n * The updates block: `createUpdates(…)` from `@marktiderman/genesis-native/updates`\n * (force upgrade, maintenance, the update banner, what's new). Its policy\n * loads behind the splash for at most `policyTimeoutMs` and never fails the\n * boot. Read once; leave it out to turn the block off.\n */\n updates?: UpdatesBlock;\n /**\n * Blocks to run (`createUpdates(…)` is one). Resolved once at start: a\n * block whose requirement is missing, or two blocks contributing the same\n * slot, nav entry or Settings row, shows the fatal screen and reports a\n * `BlockError` to `onError`. Read once.\n */\n blocks?: readonly NativeBlock[];\n /**\n * Your features (FeatureIds) that blocks may require but that aren't\n * blocks. A block requiring anything that is neither one of `blocks` nor\n * listed here is a `BlockError`. Read once.\n */\n appFeatures?: readonly string[];\n slots?: Slots<NativeAppSlots>;\n slotProps?: SlotPropsFor<NativeAppSlots>;\n children?: ReactNode;\n}\n\n/** The default boot slot: a plain loading view (the splash covers it at launch). */\nexport function BootScreen(_props: BootScreenProps) {\n return (\n <View testID=\"genesis-boot\" accessibilityRole=\"progressbar\" style={{ flex: 1, justifyContent: \"center\", alignItems: \"center\" }}>\n <Text>Loading…</Text>\n </View>\n );\n}\n\nconst PassThrough: ComponentType<SignedOutProps> = ({ children }) => <>{children}</>;\n\n// The web provider's types don't list the native-only prop; Metro resolves the native provider.\nconst ThemeProvider = GenesisThemeProvider as ComponentType<{\n brand: CanonicalBrand;\n syncNativeAppearance?: boolean;\n children: ReactNode;\n}>;\n\n/**\n * The root of an Expo app: theme, keyboard, data, boot behind the splash, errors, session and held links.\n *\n * @stability Beta\n */\nexport function GenesisNativeApp(props: GenesisNativeAppProps) {\n // Above every provider: if one of them (or the shell's own set-up) throws,\n // this shows a screen made of nothing that can fail, and retry starts over.\n const [rootKey, setRootKey] = useState(0);\n const onErrorRef = useRef(props.onError);\n onErrorRef.current = props.onError;\n // The blocks as given, before they are resolved: an error here may come from resolving them.\n const blocksRef = useRef(givenBlocks(props));\n const splashRef = useRef(props.splash);\n splashRef.current = props.splash;\n return (\n <GenesisErrorBoundary\n key={rootKey}\n fallback={PlainFatalScreen}\n onError={(e, r) => {\n reportToBlocks(blocksRef.current, e, r);\n try {\n onErrorRef.current?.(e, r);\n } catch {\n // A failing reporter must not stop the fatal screen.\n }\n // The shell (which hides the splash) never mounted: hide it here, or the screen stays behind it.\n splashRef.current?.hideAsync().catch(() => {});\n }}\n onRetry={() => setRootKey((key) => key + 1)}\n >\n <ThemedShell {...props} />\n </GenesisErrorBoundary>\n );\n}\n\ndeclare const __DEV__: boolean | undefined;\n\nconst MISSING_KEYBOARD_PROVIDER =\n \"GenesisNativeApp: `keyboardScroll` was given without `keyboardProvider`, so form screens won't move above the keyboard. \" +\n 'Pass `keyboardProvider={KeyboardProvider}` from \"react-native-keyboard-controller\" too.';\n\nconst TOOLBAR_WITHOUT_SCROLL =\n \"GenesisNativeApp: `keyboardToolbar` was given without `keyboardScroll`, so it is ignored. \" +\n 'Pass `keyboardScroll={KeyboardAwareScrollView}` and `keyboardProvider={KeyboardProvider}` from \"react-native-keyboard-controller\" too.';\n\nfunction ThemedShell(props: GenesisNativeAppProps) {\n const { brand, keyboardScroll, keyboardToolbar } = props;\n // Frozen: a new component type here (an inline wrapper) would remount the shell and reset the app.\n const [Keyboard] = useState(() => props.keyboardProvider);\n // Frozen too: an inline object would hand every component a new module set each render.\n const [modules] = useState(() => props.modules);\n const [toast] = useState(() => (props.toast === null ? null : { position: \"top\" as const, ...props.toast }));\n const missingProvider = Boolean(keyboardScroll) && !Keyboard;\n const toolbarWithoutScroll = Boolean(keyboardToolbar) && !keyboardScroll;\n useEffect(() => {\n if (typeof __DEV__ === \"undefined\" || !__DEV__) return;\n // genesis-allow-console: development-only set-up mistakes, shown as LogBox errors on purpose.\n if (missingProvider) console.error(MISSING_KEYBOARD_PROVIDER);\n if (toolbarWithoutScroll) console.error(TOOLBAR_WITHOUT_SCROLL);\n }, [missingProvider, toolbarWithoutScroll]);\n let body = <Shell {...props} />;\n // Inside the modules: a toast animates with Reanimated and draws Liquid Glass when the app gave them.\n if (toast) body = <NativeToastProvider {...toast}>{body}</NativeToastProvider>;\n if (modules) body = <GenesisModulesProvider modules={modules}>{body}</GenesisModulesProvider>;\n if (keyboardScroll) body = <KeyboardScrollProvider component={keyboardScroll} toolbar={keyboardToolbar}>{body}</KeyboardScrollProvider>;\n if (Keyboard) body = <Keyboard>{body}</Keyboard>;\n if (modules?.navigation && props.navigationTheme !== false) {\n body = (\n <NavigationTheme module={modules.navigation} brand={brand} brandVariables={props.brandVariables} given={props.navigationTheme}>\n {body}\n </NavigationTheme>\n );\n }\n return (\n <ThemeProvider brand={brand} syncNativeAppearance>\n {props.brandVariables ? (\n <BrandVariables brand={brand} given={props.brandVariables}>\n {body}\n </BrandVariables>\n ) : (\n body\n )}\n </ThemeProvider>\n );\n}\n\n/**\n * Theme role variables (`--primary`, `--background`, …) for the current mode,\n * set on a view around the app, so NativeWind's role classes (`bg-primary` is\n * `hsl(var(--primary))`) read them instead of what `:root` declares. Only with\n * `brandVariables`: NativeWind can't tell which `:root` variables are the\n * app's own, so setting them is the app's choice.\n */\nfunction BrandVariables({\n brand,\n given,\n children,\n}: {\n brand: CanonicalBrand;\n given: NonNullable<GenesisNativeAppProps[\"brandVariables\"]>;\n children: ReactNode;\n}) {\n const { resolvedMode } = useTheme();\n const variables = useMemo(() => {\n if (given === true) return brandRoleVariables(brand);\n const perMode = given as { light?: unknown; dark?: unknown };\n if (typeof perMode.light === \"object\" && typeof perMode.dark === \"object\") return given as { light: Record<string, string>; dark: Record<string, string> };\n return { light: given as Record<string, string>, dark: given as Record<string, string> };\n }, [brand, given]);\n const style = useMemo(() => [{ flex: 1 }, vars(variables[resolvedMode])], [variables, resolvedMode]);\n return (\n <View testID=\"genesis-brand-variables\" style={style}>\n {children}\n </View>\n );\n}\n\n/**\n * `\"240 10% 3.9%\"` (a role variable's value) → `\"hsl(240, 10%, 3.9%)\"`, and `\"240 10% 3.9% / 0.5\"`\n * → `\"hsla(240, 10%, 3.9%, 0.5)\"`; anything else as it is.\n */\nfunction roleColor(value: string | undefined): string | undefined {\n if (!value) return undefined;\n const [color = \"\", alpha] = value.split(\"/\").map((p) => p.trim());\n const parts = color.split(/\\s+/);\n if (parts.length !== 3) return value;\n return alpha ? `hsla(${parts.join(\", \")}, ${alpha})` : `hsl(${parts.join(\", \")})`;\n}\n\n/**\n * React Navigation's theme for the current mode, in the app's role colors: the\n * variables `brandVariables` sets (or `brandRoleVariables(brand)`) over React\n * Navigation's own light or dark theme, which keeps its fonts.\n */\nfunction NavigationTheme({\n module,\n brand,\n brandVariables,\n given,\n children,\n}: {\n module: GenesisNavigationModule;\n brand: CanonicalBrand;\n brandVariables: GenesisNativeAppProps[\"brandVariables\"];\n given: GenesisNativeAppProps[\"navigationTheme\"];\n children: ReactNode;\n}) {\n const { resolvedMode } = useTheme();\n const theme = useMemo((): GenesisNavigationTheme => {\n const base = resolvedMode === \"dark\" ? module.DarkTheme : module.DefaultTheme;\n if (given) {\n const perMode = given as { light?: GenesisNavigationTheme; dark?: GenesisNavigationTheme };\n const own = perMode.light && perMode.dark ? perMode[resolvedMode]! : (given as GenesisNavigationTheme);\n // React Navigation's headers read every font variant: a theme without fonts keeps the base's.\n return own.fonts ? own : { ...own, fonts: base.fonts };\n }\n // The app's own map over the brand's role colors, so a partial map never falls back to React Navigation's.\n let variables = brandRoleVariables(brand)[resolvedMode];\n if (brandVariables && brandVariables !== true) {\n const perMode = brandVariables as { light?: unknown; dark?: unknown };\n const own = typeof perMode.light === \"object\" && typeof perMode.dark === \"object\" ? (brandVariables as Record<\"light\" | \"dark\", Record<string, string>>)[resolvedMode] : (brandVariables as Record<string, string>);\n variables = { ...variables, ...own };\n }\n const pick = (name: string, fallback: GenesisNavigationTheme[\"colors\"][\"text\"]) => roleColor(variables[`--${name}`]) ?? fallback;\n return {\n ...base,\n dark: resolvedMode === \"dark\",\n colors: {\n ...base.colors,\n primary: pick(\"primary\", base.colors.primary),\n background: pick(\"background\", base.colors.background),\n card: pick(\"card\", base.colors.card),\n text: pick(\"foreground\", base.colors.text),\n border: pick(\"border\", base.colors.border),\n notification: pick(\"destructive\", base.colors.notification),\n },\n };\n }, [module, brand, brandVariables, given, resolvedMode]);\n const Provider = module.ThemeProvider;\n return <Provider value={theme}>{children}</Provider>;\n}\n\nconst SESSION_STEP_MARGIN_MS = 15_000;\n\nfunction Shell(props: GenesisNativeAppProps) {\n const { supabase, provider, queryClient: queryOptions, persist, splash, links, steps = [], bootOptions, sessionWaitMs = 5000 } = props;\n const { errorUtils, rejectionTracker, lifecycle, slotProps, children } = props;\n const latest = useRef(props);\n latest.current = props;\n const [blockList] = useState(() => givenBlocks(props));\n // Read once, like the keyboard provider: a different module later would remount the screens.\n const [bottomSheet] = useState(() => props.bottomSheet);\n const onError: OnError = (error, report) => {\n reportToBlocks(blockList, error, report);\n try {\n latest.current.onError?.(error, report);\n } catch {\n // A failing reporter must not take the shell down with it.\n }\n };\n // How many fatal screens are up (the global handler lets a second fatal error end the app).\n const fatalShown = useRef(0);\n\n // Created once: the shell's parts live as long as the app.\n const [parts] = useState(() => {\n const list = blockList;\n const blocks = resolveBlocks(list, props.appFeatures ? [...list.map((b) => b.id), ...props.appFeatures] : undefined, {\n platform: \"native\",\n slots: NATIVE_APP_SLOT_NAMES,\n });\n const client = queryOptions?.client ?? createNativeQueryClient(queryOptions?.config);\n const persistence = persist ? persist(client) : null;\n const session = createSessionStore(supabase, {\n waitMs: sessionWaitMs,\n // Another user (or nobody) now: nothing of the last user's may show or stay on disk.\n onUserChange: (previous, next) => {\n client.clear();\n void persistence?.clear();\n if (previous !== null && next === null) latest.current.onSignedOut?.();\n },\n });\n const boot = createBoot(\n [\n ...steps,\n // Blocks' steps, in dependency order (the updates block's settles within its own timeout and never throws).\n ...blocks.blocks.flatMap((block) => block.bootSteps ?? []),\n { id: \"genesis:session\", run: () => session.load(), timeoutMs: sessionWaitMs + SESSION_STEP_MARGIN_MS },\n // After the session, so only the cache saved for this user is restored.\n ...(persistence ? [{ id: \"genesis:query-cache\", run: () => persistence.restore(session.getState().userId ?? \"\") }] : []),\n ],\n bootOptions,\n );\n // One component type for the life of the app, so a re-render never remounts a visible fatal screen.\n function FatalFallback(fallbackProps: FatalScreenProps) {\n useEffect(() => {\n fatalShown.current++;\n return () => {\n fatalShown.current--;\n };\n }, []);\n const { slotProps: sp } = latest.current;\n const s = withBlockSlots(blocks.slots, latest.current.slots);\n return (\n // A `fatal` slot that throws falls back to the plain screen.\n <GenesisErrorBoundary fallback={PlainFatalScreen} onError={onError} onRetry={fallbackProps.retry}>\n {renderSlot(FatalScreen, s?.fatal, fallbackProps, sp?.fatal)}\n </GenesisErrorBoundary>\n );\n }\n return { client, persistence, session, boot, FatalFallback, blocks, provider: provider ?? createSupabaseProvider(supabase) };\n });\n const { boot, session, persistence, client, FatalFallback } = parts;\n const slots = withBlockSlots(parts.blocks.slots, props.slots);\n const bootState = useSyncExternalStore(boot.subscribe, boot.getState, boot.getState);\n const sessionState = useSyncExternalStore(session.subscribe, session.getState, session.getState);\n const [fatal, setFatal] = useState<Error | null>(null);\n const [resetKey, setResetKey] = useState(0);\n\n useEffect(() => session.start(), [session]);\n useEffect(() => {\n void boot.start();\n }, [boot]);\n useEffect(() => {\n if (bootState.status === \"failed\" && bootState.error) onError(bootState.error, { fatal: true, source: \"boot\" });\n }, [bootState.status, bootState.error]);\n useEffect(() => {\n if (bootState.status === \"ready\" && persistence) return persistence.subscribe(sessionState.userId ?? \"\");\n }, [bootState.status, persistence, sessionState.userId]);\n useEffect(() => {\n const utils = errorUtils ?? defaultErrorUtils();\n if (!utils) return;\n return installGlobalErrorHandler({ errorUtils: utils, onError, onFatal: setFatal, alreadyFatal: () => fatalShown.current > 0 });\n }, [errorUtils]);\n useEffect(() => {\n const enable = rejectionTracker === null ? undefined : (rejectionTracker ?? defaultRejectionTracker());\n if (enable) installRejectionTracker({ enable, onError });\n }, [rejectionTracker]);\n useEffect(() => (lifecycle ? connectQueryLifecycle(lifecycle) : undefined), [lifecycle]);\n const [queryReports] = useState(() => props.reportQueryErrors !== false);\n useEffect(() => (queryReports ? reportQueryErrors(client, onError) : undefined), [client, queryReports]);\n\n // Splash: up until boot has finished (the session step included), or failed.\n const settled = bootState.status === \"ready\" || bootState.status === \"failed\" || fatal !== null;\n const splashHidden = useRef(false);\n useEffect(() => {\n if (!settled || !splash || splashHidden.current) return;\n splashHidden.current = true;\n splash.hideAsync().catch(() => {});\n }, [settled, splash]);\n\n const auth: HeldLinkAuth = bootState.status !== \"ready\" || sessionState.status === \"loading\" ? \"pending\" : sessionState.status;\n useHeldLink(links?.hold ?? NO_HOLD, { auth: links ? auth : \"pending\", onRelease: (path) => links?.onRelease(path) });\n\n const retry = () => {\n setFatal(null);\n setResetKey((key) => key + 1);\n if (boot.getState().status === \"failed\") void boot.retry();\n };\n\n let content: ReactNode;\n if (fatal) {\n content = <FatalFallback error={fatal} retry={retry} />;\n } else if (bootState.status === \"failed\" && bootState.error) {\n content = <FatalFallback error={bootState.error} retry={retry} />;\n } else if (bootState.status !== \"ready\") {\n content = renderSlot(BootScreen, slots?.boot, { status: bootState.status }, slotProps?.boot);\n } else {\n const screens =\n sessionState.status === \"signedOut\" ? renderSlot(PassThrough, slots?.signedOut, { children }, slotProps?.signedOut) : children;\n const guarded = renderSlot(\n GenesisErrorBoundary,\n slots?.errorBoundary,\n { fallback: FatalFallback, onError, resetKey, onRetry: retry, children: screens },\n slotProps?.errorBoundary,\n );\n // The first block's root is the outermost.\n content = parts.blocks.blocks.reduceRight<ReactNode>((inner, block) => {\n const Root = block.Root;\n return Root ? (\n <Root key={block.id} slots={slots} slotProps={slotProps}>\n {inner}\n </Root>\n ) : (\n inner\n );\n }, guarded);\n }\n\n return (\n <GenesisProvider provider={parts.provider} queryClient={client}>\n <SessionProvider store={session}>\n <BootProvider boot={boot}>\n <BlocksProvider value={parts.blocks}>\n <GenesisErrorBoundary key={resetKey} fallback={FatalFallback} onError={onError} onRetry={retry}>\n {/* Sheet content renders in the library's portal, here: below data, session, boot and blocks. */}\n {bottomSheet ? <NativeSheetProvider bottomSheet={bottomSheet}>{content}</NativeSheetProvider> : content}\n </GenesisErrorBoundary>\n </BlocksProvider>\n </BootProvider>\n </SessionProvider>\n </GenesisProvider>\n );\n}\n\n// Every slot name, checked against NativeAppSlots by the compiler: a block filling any other is a BlockError.\nconst SLOT_NAMES: Record<keyof NativeAppSlots, true> = {\n boot: true,\n fatal: true,\n errorBoundary: true,\n signedOut: true,\n forceUpgrade: true,\n maintenance: true,\n updateBanner: true,\n whatsNew: true,\n devtoolsFeedback: true,\n pushPrompt: true,\n};\nconst NATIVE_APP_SLOT_NAMES: readonly string[] = Object.keys(SLOT_NAMES);\n\n/** Blocks' slot fills under the app's own slots: the app's (a component or `null`) always win. */\nfunction withBlockSlots(fills: Readonly<Record<string, unknown>>, own: Slots<NativeAppSlots> | undefined): Slots<NativeAppSlots> | undefined {\n if (Object.keys(fills).length === 0) return own;\n return { ...(fills as Slots<NativeAppSlots>), ...own };\n}\n\n/** `blocks`, with `updates` added when it was given on its own (given both ways, it runs once). */\nfunction givenBlocks(props: Pick<GenesisNativeAppProps, \"blocks\" | \"updates\">): readonly NativeBlock[] {\n const given = props.blocks ?? [];\n return props.updates && !given.includes(props.updates) ? [...given, props.updates] : given;\n}\n\nconst NO_HOLD: LinkHold = {\n hold: () => {},\n peek: () => null,\n take: () => null,\n clear: () => {},\n subscribe: () => () => {},\n};\n","/**\n * A hydration gate holds writes until a persisted store has loaded from disk.\n *\n * The bug it prevents: a persisted store (zustand `persist`, say) is created\n * with defaults, something sets a value before the saved state has been read,\n * and that write lands on disk first, replacing what the user had. With the\n * gate, a write made before hydration never reaches disk (`storage()`), or\n * waits for it (`run()`).\n *\n * const gate = createHydrationGate();\n * persist(store, {\n * storage: createJSONStorage(() => gate.storage(AsyncStorage)),\n * // Open only after a good read: after a failed one, writes would replace what's on disk.\n * onRehydrateStorage: () => (_state, error) => {\n * if (!error) gate.markHydrated();\n * },\n * });\n */\nimport type { AsyncStorageLike } from \"./query\";\n\nexport interface HydrationGate {\n readonly hydrated: boolean;\n /** Call once the store has read its saved state. Idempotent. */\n markHydrated(): void;\n /** Resolves once hydrated. */\n whenHydrated(): Promise<void>;\n /** Run a write now if hydrated, otherwise once hydrated. */\n run<T>(write: () => T | Promise<T>): Promise<T>;\n /**\n * The storage, with writes made before hydration dropped (reads pass\n * through, since hydration is a read). After hydration the store writes\n * its merged state on its next change, so nothing is lost but the stale\n * write. (A zustand migration's own write during hydration is dropped too;\n * the old version stays on disk and is migrated again until then.)\n */\n storage<S extends AsyncStorageLike>(storage: S): S;\n}\n\nexport interface HydrationGateOptions {\n /** Told about each write `storage()` dropped (to log it in development). */\n onDroppedWrite?: (key: string) => void;\n}\n\n/** A gate that holds writes until a persisted store has hydrated. */\nexport function createHydrationGate({ onDroppedWrite }: HydrationGateOptions = {}): HydrationGate {\n let hydrated = false;\n let open!: () => void;\n const opened = new Promise<void>((resolve) => {\n open = resolve;\n });\n\n const gate: HydrationGate = {\n get hydrated() {\n return hydrated;\n },\n markHydrated() {\n if (hydrated) return;\n hydrated = true;\n open();\n },\n whenHydrated: () => opened,\n async run(write) {\n if (!hydrated) await opened;\n return write();\n },\n storage(storage) {\n const setItem = async (key: string, value: string) => {\n if (!hydrated) return onDroppedWrite?.(key);\n return storage.setItem(key, value);\n };\n const removeItem = async (key: string) => {\n if (!hydrated) return onDroppedWrite?.(key);\n return storage.removeItem(key);\n };\n // A proxy, not a spread: a storage class's prototype methods (and its\n // private fields, through `this`) keep working.\n return new Proxy(storage, {\n get(target, property) {\n if (property === \"setItem\") return setItem;\n if (property === \"removeItem\") return removeItem;\n const value = Reflect.get(target, property, target) as unknown;\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n },\n };\n return gate;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/held-link.ts","../src/app.tsx","../src/hydration-gate.ts"],"names":["useRef","useEffect","client","persistence","session","boot","FatalFallback","useSyncExternalStore"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoCO,SAAS,cAAA,GAA2B;AACzC,EAAA,IAAI,IAAA,GAAsB,IAAA;AAC1B,EAAA,MAAM,SAAA,uBAAgB,GAAA,EAAgB;AACtC,EAAA,MAAM,GAAA,GAAM,CAAC,IAAA,KAAwB;AACnC,IAAA,IAAI,SAAS,IAAA,EAAM;AACnB,IAAA,IAAA,GAAO,IAAA;AACP,IAAA,KAAA,MAAW,QAAA,IAAY,WAAW,QAAA,EAAS;AAAA,EAC7C,CAAA;AACA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,CAAC,IAAA,KAAS,GAAA,CAAI,IAAI,CAAA;AAAA,IACxB,MAAM,MAAM,IAAA;AAAA,IACZ,IAAA,GAAO;AACL,MAAA,MAAM,IAAA,GAAO,IAAA;AACb,MAAA,GAAA,CAAI,IAAI,CAAA;AACR,MAAA,OAAO,IAAA;AAAA,IACT,CAAA;AAAA,IACA,KAAA,EAAO,MAAM,GAAA,CAAI,IAAI,CAAA;AAAA,IACrB,UAAU,QAAA,EAAU;AAClB,MAAA,SAAA,CAAU,IAAI,QAAQ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AA,GAAa,KAAA,CAAM,IAAA,CAAK,MAAM,CAAA,GAAI,KAAA;AAAA,QAC5D;AAAA,OACD,CAAA;AAAA,IACH;AAAA,GACF;AACA,EAAA,OAAO,IAAA;AACT","file":"index.js","sourcesContent":["/**\n * Hold a deep link until sign-in completes.\n *\n * expo-router opens every incoming link itself. For a signed-in user that is\n * all that should happen. For a signed-out user, the auth layout redirects to\n * sign-in and the link is lost; holding it lets the app go there once the user\n * has signed in. The hold lives outside React, because expo-router's\n * `+native-intent` runs before any component:\n *\n * // lib/links.ts\n * export const linkHold = createLinkHold();\n * // app/+native-intent.ts\n * export function redirectSystemPath({ path }) {\n * const to = normalizeLink(path, links);\n * if (to && to !== \"/\") linkHold.hold(to);\n * return to;\n * }\n *\n * `useHeldLink` follows a held link only if the user was seen signed out\n * while it was held. A link that arrives while signed in, or at a cold start\n * that turns out signed in, is dropped, since the router already opened it.\n * `GenesisNativeApp` runs it for you (`links.onRelease`).\n */\nimport { useEffect, useRef, useSyncExternalStore } from \"react\";\n\nexport interface LinkHold {\n /** Hold `path`, replacing any held one. */\n hold(path: string): void;\n peek(): string | null;\n /** Return the held path and forget it. */\n take(): string | null;\n clear(): void;\n subscribe(listener: () => void): () => void;\n}\n\n/** A place to hold one deep link until sign-in completes; lives outside React. */\nexport function createLinkHold(): LinkHold {\n let held: string | null = null;\n const listeners = new Set<() => void>();\n const set = (next: string | null) => {\n if (held === next) return;\n held = next;\n for (const listener of listeners) listener();\n };\n return {\n hold: (path) => set(path),\n peek: () => held,\n take() {\n const path = held;\n set(null);\n return path;\n },\n clear: () => set(null),\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n };\n}\n\n/** `\"pending\"` while booting or reading the session. */\nexport type HeldLinkAuth = \"pending\" | \"signedOut\" | \"signedIn\";\n\nexport interface UseHeldLinkOptions {\n auth: HeldLinkAuth;\n /** Go there, e.g. `(path) => router.replace(path)`. Called once per link held across a sign-in. */\n onRelease: (path: string) => void;\n}\n\n/** Follow the held link after a sign-in, drop it otherwise; returns the link still held. */\nexport function useHeldLink(hold: LinkHold, { auth, onRelease }: UseHeldLinkOptions): string | null {\n const held = useSyncExternalStore(hold.subscribe, hold.peek, hold.peek);\n const release = useRef(onRelease);\n release.current = onRelease;\n // Was the user signed out while this link was held?\n const waitedForSignIn = useRef(false);\n useEffect(() => {\n if (held === null) {\n waitedForSignIn.current = false;\n return;\n }\n if (auth === \"signedOut\") waitedForSignIn.current = true;\n if (auth !== \"signedIn\") return;\n const path = hold.take();\n const follow = waitedForSignIn.current;\n waitedForSignIn.current = false;\n if (path !== null && follow) release.current(path);\n }, [auth, held, hold]);\n return held;\n}\n","/**\n * `<GenesisNativeApp>`: everything above an Expo app's screens, so the root\n * `_layout.tsx` is a few lines.\n *\n * last-resort boundary (React Native primitives only)\n * └ theme (GenesisThemeProvider, owning the platform color scheme; with `brandVariables`,\n * role variables on a view around the app for NativeWind's role classes; with\n * `modules.navigation`, React Navigation's theme in the same colors and mode)\n * └ keyboard (`keyboardProvider`, once, then `keyboardScroll` for form screens)\n * └ toasts (`NativeToastProvider`, so `useToast()` works on every screen; `toast={null}` drops it)\n * └ data (GenesisProvider over the Supabase client, the QueryClient)\n * └ session + boot (splash held until both are known)\n * └ blocks' roots (with `blocks`, e.g. updates: force upgrade, maintenance, banner, what's new)\n * └ errorBoundary → `bottomSheet`'s provider, if given → your screens (or `signedOut`)\n *\n * Every error the shell catches goes to each block's `onError` (the\n * observability block reports it) and then to the app's own `onError`:\n * render, global, boot and unhandled-rejection errors, and queries and\n * mutations that failed unexpectedly (`reportQueryErrors`).\n *\n * `blocks` (`defineBlock` declarations a native shell can run) are resolved\n * once: requirements checked, boot steps run behind the splash, roots\n * mounted, slot fills put under your `slots`, Settings rows handed to\n * `useBlockSettings`.\n * Global errors, render errors and a failed boot show the `fatal` slot with\n * \"Try again\". Every part is a slot (`slots` / `slotProps`, `null` drops it)\n * and is also exported on its own.\n */\nimport { useEffect, useMemo, useRef, useState, useSyncExternalStore, type ComponentType, type ReactNode } from \"react\";\nimport { Text, View } from \"react-native\";\nimport type { QueryClient, QueryClientConfig } from \"@tanstack/react-query\";\nimport { vars } from \"nativewind\";\nimport { GenesisThemeProvider, useTheme } from \"@marktiderman/genesis-design-system/theme\";\nimport { brandRoleVariables, type CanonicalBrand } from \"@marktiderman/genesis-design-system\";\nimport { GenesisProvider, createSupabaseProvider, type DataProvider, type SupabaseClientInput } from \"@marktiderman/genesis-core/provider\";\nimport { renderSlot, type SlotPropsFor, type Slots } from \"@marktiderman/genesis-core/slots\";\nimport { KeyboardScrollProvider, type KeyboardScrollProps, type KeyboardToolbarProps } from \"@marktiderman/genesis-ui-native/layouts\";\nimport {\n GenesisModulesProvider,\n NativeSheetProvider,\n NativeToastProvider,\n type GenesisModules,\n type GenesisNavigationModule,\n type GenesisNavigationTheme,\n type NativeSheetLibrary,\n type NativeToastProviderProps,\n} from \"@marktiderman/genesis-ui-native/components\";\nimport { BootProvider, createBoot, type BootOptions, type BootStatus, type BootStep } from \"./boot\";\nimport {\n FatalScreen,\n GenesisErrorBoundary,\n defaultErrorUtils,\n defaultRejectionTracker,\n installGlobalErrorHandler,\n installRejectionTracker,\n type EnableRejectionTracker,\n type ErrorUtilsLike,\n type FatalScreenProps,\n type GenesisErrorBoundaryProps,\n type OnError,\n} from \"./errors\";\nimport { SessionProvider, createSessionStore, type AuthClientLike } from \"./auth\";\nimport { useHeldLink, type HeldLinkAuth, type LinkHold } from \"./held-link\";\nimport { connectQueryLifecycle, createNativeQueryClient, reportQueryErrors, type QueryLifecycleOptions, type QueryPersistence } from \"./query\";\nimport { resolveBlocks } from \"@marktiderman/genesis-features/blocks\";\nimport { BlocksProvider, reportToBlocks, type NativeBlock } from \"./blocks\";\nimport type { DevtoolsSlots } from \"./devtools/slots\";\n// Types only: the block's code is in the `/updates` entry and arrives with the `updates` prop.\nimport type { UpdatesBlock, UpdatesSlots } from \"./updates/block\";\n// Types only, likewise: the push block (`/push`) arrives in `blocks`.\nimport type { PushSlots } from \"./push/block\";\n\n/** `expo-splash-screen`, or a stand-in. Call `preventAutoHideAsync()` at module scope yourself too. */\nexport interface SplashModule {\n preventAutoHideAsync?: () => Promise<unknown>;\n hideAsync: () => Promise<unknown>;\n}\n\nexport interface BootScreenProps {\n status: BootStatus;\n}\n\nexport interface SignedOutProps {\n /** Your screens. The default renders them, for an expo-router layout that redirects. */\n children: ReactNode;\n}\n\n// A type, not an interface, so it fits the slots contract's Record constraint.\n// The updates block's slots (`forceUpgrade`, `maintenance`, `updateBanner`,\n// `whatsNew`) render only when the `updates` prop is given.\nexport type NativeAppSlots = UpdatesSlots &\n PushSlots &\n DevtoolsSlots & {\n /** Shown while booting: under the splash at launch, on its own after \"Try again\". Default `BootScreen`. */\n boot: BootScreenProps;\n /** A failed boot, a fatal global error or a render error. Default `FatalScreen`. */\n fatal: FatalScreenProps;\n /** The boundary around your screens. Default `GenesisErrorBoundary`. */\n errorBoundary: GenesisErrorBoundaryProps;\n /** What a signed-out user sees. Default your screens (gate them with `useSession`). */\n signedOut: SignedOutProps;\n};\n\nexport interface NativeQueryClientOptions {\n /** Your own client. Default `createNativeQueryClient(config)`. */\n client?: QueryClient;\n config?: QueryClientConfig;\n}\n\nexport interface GenesisNativeAppProps {\n brand: CanonicalBrand;\n /** A Supabase client (from `createGenesisSupabase` in `@marktiderman/genesis-supabase`). */\n supabase: AuthClientLike & SupabaseClientInput;\n /** The data provider. Default `createSupabaseProvider(supabase)`. */\n provider?: DataProvider;\n queryClient?: NativeQueryClientOptions;\n /**\n * Keep reads on the phone: `persistOffline({ cache: sqliteLocalCache({ db }), resources, buster })`\n * from `@marktiderman/genesis-native/offline`. The saved cache belongs to\n * one user: it is restored only for that user and cleared when the user\n * changes (sign-out, a session that ended while the app was closed, an\n * account switch).\n */\n persist?: (client: QueryClient) => QueryPersistence;\n /** `expo-splash-screen`: hidden once boot has finished and the session is known. */\n splash?: SplashModule;\n /**\n * `KeyboardProvider` from react-native-keyboard-controller, mounted once\n * around the app. Its keyboard views (`keyboardScroll` included) do nothing\n * without it: give both or neither. Read once: it wraps the whole app, so\n * a different component later would remount everything below it. To pass\n * it props, define the wrapper at module scope, not inline.\n */\n keyboardProvider?: ComponentType<{ children: ReactNode }>;\n /**\n * Theme role variables (`--primary`, `--background`, …) to set on a view\n * around the app, over what the app's stylesheet declares on `:root`.\n * Default `false`: none are set, so the app's own variables (from\n * `createGenesisNativewindPreset({ brand })` or its brand package) stand.\n * `true` sets `brandRoleVariables(brand)` for the current mode; an object\n * sets the app's own, one map for both modes or `{ light, dark }`.\n */\n brandVariables?: boolean | Record<string, string> | { light: Record<string, string>; dark: Record<string, string> };\n /**\n * React Navigation's theme (headers, tab bars, the screen background), when\n * `modules.navigation` is given. Default: worked out from the same role\n * variables as `brandVariables` (the app's own when it passes them,\n * `brandRoleVariables(brand)` otherwise), for the current mode, so a header\n * is never light in dark mode. Pass a theme (or `{ light, dark }`) to use\n * your own, or `false` to set none.\n */\n navigationTheme?: false | GenesisNavigationTheme | { light: GenesisNavigationTheme; dark: GenesisNavigationTheme };\n /** `KeyboardAwareScrollView` from react-native-keyboard-controller, for form screens. Needs `keyboardProvider`. */\n keyboardScroll?: ComponentType<KeyboardScrollProps>;\n /**\n * `KeyboardToolbar` from react-native-keyboard-controller: previous / next /\n * done above the keyboard on Genesis's form layouts. Needs `keyboardScroll`\n * (and so `keyboardProvider`); without them it is ignored.\n */\n keyboardToolbar?: ComponentType<KeyboardToolbarProps>;\n /**\n * The optional native modules the app installed, for Genesis components to\n * use (`GenesisModulesProvider` from `@marktiderman/genesis-ui-native`):\n * FlashList, expo-image, Reanimated, expo-glass-effect, expo-symbols, a\n * lucide icon set, the @expo/ui date picker. Each one left out falls back\n * to plain React Native. Read once.\n */\n modules?: GenesisModules;\n /**\n * `@gorhom/bottom-sheet` v5, to opt every `NativeSheet` into it (snap\n * points, drag between heights): `import * as BottomSheet from \"@gorhom/bottom-sheet\"`,\n * then `bottomSheet={BottomSheet}`. The app mounts `NativeSheetProvider`\n * (and so the library's `BottomSheetModalProvider`) for you; the app's root\n * must still be inside gesture-handler's `GestureHandlerRootView`, with\n * Reanimated set up. Leave it out and sheets are React Native's own modal\n * (an iOS page sheet), which needs neither. Read once.\n */\n bottomSheet?: NativeSheetLibrary;\n /**\n * Toasts (`useToast()` from `@marktiderman/genesis-ui-native`): `NativeToastProvider` is\n * mounted around the screens, at the top of the screen by default (a bottom toast would sit on\n * a tab bar). Pass its options to place it, or `null` to mount your own. Read once.\n */\n toast?: Pick<NativeToastProviderProps, \"position\" | \"disableAnimation\"> | null;\n /** Follow a link held while signed out, once the user signs in. */\n links?: { hold: LinkHold; onRelease: (path: string) => void };\n /** Run before first render, in order (wipe-on-reinstall, hydrate stores, fonts). Read once. */\n steps?: readonly BootStep[];\n bootOptions?: BootOptions;\n /** Longest wait for Supabase's `getSession()` before using the stored session (offline). Default 5000 ms. */\n sessionWaitMs?: number;\n /** Default `globalThis.ErrorUtils`. */\n errorUtils?: ErrorUtilsLike;\n /** Report unhandled promise rejections to `onError`. Default Hermes's tracker; `null` turns it off. */\n rejectionTracker?: EnableRejectionTracker | null;\n /** `AppState` and NetInfo, so queries refetch on focus and know the network. */\n lifecycle?: QueryLifecycleOptions;\n /**\n * Report queries and mutations that failed for good to `onError` (and so\n * to the observability block), non-fatal, as `query` / `mutation` with the\n * key's first segment as a tag. Only unexpected errors: offline, signed\n * out, not found and the server's expected refusals are left to the\n * screen. One query opts out with `meta: { reportErrors: false }`.\n * Default true. Read once.\n */\n reportQueryErrors?: boolean;\n /**\n * Every caught error, after the blocks' own `onError` (the observability\n * block, `createObservability` from `/observability`, reports to Sentry\n * there). A throwing reporter is ignored.\n */\n onError?: OnError;\n /** After a signed-in user signs out, once the query cache is cleared. */\n onSignedOut?: () => void;\n /**\n * The updates block: `createUpdates(…)` from `@marktiderman/genesis-native/updates`\n * (force upgrade, maintenance, the update banner, what's new). Its policy\n * loads behind the splash for at most `policyTimeoutMs` and never fails the\n * boot. Read once; leave it out to turn the block off.\n */\n updates?: UpdatesBlock;\n /**\n * Blocks to run (`createUpdates(…)` is one). Resolved once at start: a\n * block whose requirement is missing, or two blocks contributing the same\n * slot, nav entry or Settings row, shows the fatal screen and reports a\n * `BlockError` to `onError`. Read once.\n */\n blocks?: readonly NativeBlock[];\n /**\n * Your features (FeatureIds) that blocks may require but that aren't\n * blocks. A block requiring anything that is neither one of `blocks` nor\n * listed here is a `BlockError`. Read once.\n */\n appFeatures?: readonly string[];\n slots?: Slots<NativeAppSlots>;\n slotProps?: SlotPropsFor<NativeAppSlots>;\n children?: ReactNode;\n}\n\n/** The default boot slot: a plain loading view (the splash covers it at launch). */\nexport function BootScreen(_props: BootScreenProps) {\n return (\n <View testID=\"genesis-boot\" accessibilityRole=\"progressbar\" style={{ flex: 1, justifyContent: \"center\", alignItems: \"center\" }}>\n <Text>Loading…</Text>\n </View>\n );\n}\n\nconst PassThrough: ComponentType<SignedOutProps> = ({ children }) => <>{children}</>;\n/** The last-resort fallback: nothing above it has to work. */\nconst PlainFallback = (props: FatalScreenProps) => <FatalScreen {...props} kind=\"plain\" />;\n\n// The web provider's types don't list the native-only prop; Metro resolves the native provider.\nconst ThemeProvider = GenesisThemeProvider as ComponentType<{\n brand: CanonicalBrand;\n syncNativeAppearance?: boolean;\n children: ReactNode;\n}>;\n\n/**\n * The root of an Expo app: theme, keyboard, data, boot behind the splash, errors, session and held links.\n *\n * @stability Beta\n */\nexport function GenesisNativeApp(props: GenesisNativeAppProps) {\n // Above every provider: if one of them (or the shell's own set-up) throws,\n // this shows a screen made of nothing that can fail, and retry starts over.\n const [rootKey, setRootKey] = useState(0);\n const onErrorRef = useRef(props.onError);\n onErrorRef.current = props.onError;\n // The blocks as given, before they are resolved: an error here may come from resolving them.\n const blocksRef = useRef(givenBlocks(props));\n const splashRef = useRef(props.splash);\n splashRef.current = props.splash;\n return (\n <GenesisErrorBoundary\n key={rootKey}\n fallback={PlainFallback}\n onError={(e, r) => {\n reportToBlocks(blocksRef.current, e, r);\n try {\n onErrorRef.current?.(e, r);\n } catch {\n // A failing reporter must not stop the fatal screen.\n }\n // The shell (which hides the splash) never mounted: hide it here, or the screen stays behind it.\n splashRef.current?.hideAsync().catch(() => {});\n }}\n onRetry={() => setRootKey((key) => key + 1)}\n >\n <ThemedShell {...props} />\n </GenesisErrorBoundary>\n );\n}\n\ndeclare const __DEV__: boolean | undefined;\n\nconst MISSING_KEYBOARD_PROVIDER =\n \"GenesisNativeApp: `keyboardScroll` was given without `keyboardProvider`, so form screens won't move above the keyboard. \" +\n 'Pass `keyboardProvider={KeyboardProvider}` from \"react-native-keyboard-controller\" too.';\n\nconst TOOLBAR_WITHOUT_SCROLL =\n \"GenesisNativeApp: `keyboardToolbar` was given without `keyboardScroll`, so it is ignored. \" +\n 'Pass `keyboardScroll={KeyboardAwareScrollView}` and `keyboardProvider={KeyboardProvider}` from \"react-native-keyboard-controller\" too.';\n\nfunction ThemedShell(props: GenesisNativeAppProps) {\n const { brand, keyboardScroll, keyboardToolbar } = props;\n // Frozen: a new component type here (an inline wrapper) would remount the shell and reset the app.\n const [Keyboard] = useState(() => props.keyboardProvider);\n // Frozen too: an inline object would hand every component a new module set each render.\n const [modules] = useState(() => props.modules);\n const [toast] = useState(() => (props.toast === null ? null : { position: \"top\" as const, ...props.toast }));\n const missingProvider = Boolean(keyboardScroll) && !Keyboard;\n const toolbarWithoutScroll = Boolean(keyboardToolbar) && !keyboardScroll;\n useEffect(() => {\n if (typeof __DEV__ === \"undefined\" || !__DEV__) return;\n // genesis-allow-console: development-only set-up mistakes, shown as LogBox errors on purpose.\n if (missingProvider) console.error(MISSING_KEYBOARD_PROVIDER);\n if (toolbarWithoutScroll) console.error(TOOLBAR_WITHOUT_SCROLL);\n }, [missingProvider, toolbarWithoutScroll]);\n let body = <Shell {...props} />;\n // Inside the modules: a toast animates with Reanimated and draws Liquid Glass when the app gave them.\n if (toast) body = <NativeToastProvider {...toast}>{body}</NativeToastProvider>;\n if (modules) body = <GenesisModulesProvider modules={modules}>{body}</GenesisModulesProvider>;\n if (keyboardScroll) body = <KeyboardScrollProvider component={keyboardScroll} toolbar={keyboardToolbar}>{body}</KeyboardScrollProvider>;\n if (Keyboard) body = <Keyboard>{body}</Keyboard>;\n if (modules?.navigation && props.navigationTheme !== false) {\n body = (\n <NavigationTheme module={modules.navigation} brand={brand} brandVariables={props.brandVariables} given={props.navigationTheme}>\n {body}\n </NavigationTheme>\n );\n }\n return (\n <ThemeProvider brand={brand} syncNativeAppearance>\n {props.brandVariables ? (\n <BrandVariables brand={brand} given={props.brandVariables}>\n {body}\n </BrandVariables>\n ) : (\n body\n )}\n </ThemeProvider>\n );\n}\n\n/**\n * Theme role variables (`--primary`, `--background`, …) for the current mode,\n * set on a view around the app, so NativeWind's role classes (`bg-primary` is\n * `hsl(var(--primary))`) read them instead of what `:root` declares. Only with\n * `brandVariables`: NativeWind can't tell which `:root` variables are the\n * app's own, so setting them is the app's choice.\n */\nfunction BrandVariables({\n brand,\n given,\n children,\n}: {\n brand: CanonicalBrand;\n given: NonNullable<GenesisNativeAppProps[\"brandVariables\"]>;\n children: ReactNode;\n}) {\n const { resolvedMode } = useTheme();\n const variables = useMemo(() => {\n if (given === true) return brandRoleVariables(brand);\n const perMode = given as { light?: unknown; dark?: unknown };\n if (typeof perMode.light === \"object\" && typeof perMode.dark === \"object\") return given as { light: Record<string, string>; dark: Record<string, string> };\n return { light: given as Record<string, string>, dark: given as Record<string, string> };\n }, [brand, given]);\n const style = useMemo(() => [{ flex: 1 }, vars(variables[resolvedMode])], [variables, resolvedMode]);\n return (\n <View testID=\"genesis-brand-variables\" style={style}>\n {children}\n </View>\n );\n}\n\n/**\n * `\"240 10% 3.9%\"` (a role variable's value) → `\"hsl(240, 10%, 3.9%)\"`, and `\"240 10% 3.9% / 0.5\"`\n * → `\"hsla(240, 10%, 3.9%, 0.5)\"`; anything else as it is.\n */\nfunction roleColor(value: string | undefined): string | undefined {\n if (!value) return undefined;\n const [color = \"\", alpha] = value.split(\"/\").map((p) => p.trim());\n const parts = color.split(/\\s+/);\n if (parts.length !== 3) return value;\n return alpha ? `hsla(${parts.join(\", \")}, ${alpha})` : `hsl(${parts.join(\", \")})`;\n}\n\n/**\n * React Navigation's theme for the current mode, in the app's role colors: the\n * variables `brandVariables` sets (or `brandRoleVariables(brand)`) over React\n * Navigation's own light or dark theme, which keeps its fonts.\n */\nfunction NavigationTheme({\n module,\n brand,\n brandVariables,\n given,\n children,\n}: {\n module: GenesisNavigationModule;\n brand: CanonicalBrand;\n brandVariables: GenesisNativeAppProps[\"brandVariables\"];\n given: GenesisNativeAppProps[\"navigationTheme\"];\n children: ReactNode;\n}) {\n const { resolvedMode } = useTheme();\n const theme = useMemo((): GenesisNavigationTheme => {\n const base = resolvedMode === \"dark\" ? module.DarkTheme : module.DefaultTheme;\n if (given) {\n const perMode = given as { light?: GenesisNavigationTheme; dark?: GenesisNavigationTheme };\n const own = perMode.light && perMode.dark ? perMode[resolvedMode]! : (given as GenesisNavigationTheme);\n // React Navigation's headers read every font variant: a theme without fonts keeps the base's.\n return own.fonts ? own : { ...own, fonts: base.fonts };\n }\n // The app's own map over the brand's role colors, so a partial map never falls back to React Navigation's.\n let variables = brandRoleVariables(brand)[resolvedMode];\n if (brandVariables && brandVariables !== true) {\n const perMode = brandVariables as { light?: unknown; dark?: unknown };\n const own = typeof perMode.light === \"object\" && typeof perMode.dark === \"object\" ? (brandVariables as Record<\"light\" | \"dark\", Record<string, string>>)[resolvedMode] : (brandVariables as Record<string, string>);\n variables = { ...variables, ...own };\n }\n const pick = (name: string, fallback: GenesisNavigationTheme[\"colors\"][\"text\"]) => roleColor(variables[`--${name}`]) ?? fallback;\n return {\n ...base,\n dark: resolvedMode === \"dark\",\n colors: {\n ...base.colors,\n primary: pick(\"primary\", base.colors.primary),\n background: pick(\"background\", base.colors.background),\n card: pick(\"card\", base.colors.card),\n text: pick(\"foreground\", base.colors.text),\n border: pick(\"border\", base.colors.border),\n notification: pick(\"destructive\", base.colors.notification),\n },\n };\n }, [module, brand, brandVariables, given, resolvedMode]);\n const Provider = module.ThemeProvider;\n return <Provider value={theme}>{children}</Provider>;\n}\n\nconst SESSION_STEP_MARGIN_MS = 15_000;\n\nfunction Shell(props: GenesisNativeAppProps) {\n const { supabase, provider, queryClient: queryOptions, persist, splash, links, steps = [], bootOptions, sessionWaitMs = 5000 } = props;\n const { errorUtils, rejectionTracker, lifecycle, slotProps, children } = props;\n const latest = useRef(props);\n latest.current = props;\n const [blockList] = useState(() => givenBlocks(props));\n // Read once, like the keyboard provider: a different module later would remount the screens.\n const [bottomSheet] = useState(() => props.bottomSheet);\n const onError: OnError = (error, report) => {\n reportToBlocks(blockList, error, report);\n try {\n latest.current.onError?.(error, report);\n } catch {\n // A failing reporter must not take the shell down with it.\n }\n };\n // How many fatal screens are up (the global handler lets a second fatal error end the app).\n const fatalShown = useRef(0);\n\n // Created once: the shell's parts live as long as the app.\n const [parts] = useState(() => {\n const list = blockList;\n const blocks = resolveBlocks(list, props.appFeatures ? [...list.map((b) => b.id), ...props.appFeatures] : undefined, {\n platform: \"native\",\n slots: NATIVE_APP_SLOT_NAMES,\n });\n const client = queryOptions?.client ?? createNativeQueryClient(queryOptions?.config);\n const persistence = persist ? persist(client) : null;\n const session = createSessionStore(supabase, {\n waitMs: sessionWaitMs,\n // Another user (or nobody) now: nothing of the last user's may show or stay on disk.\n onUserChange: (previous, next) => {\n client.clear();\n void persistence?.clear();\n if (previous !== null && next === null) latest.current.onSignedOut?.();\n },\n });\n const boot = createBoot(\n [\n ...steps,\n // Blocks' steps, in dependency order (the updates block's settles within its own timeout and never throws).\n ...blocks.blocks.flatMap((block) => block.bootSteps ?? []),\n { id: \"genesis:session\", run: () => session.load(), timeoutMs: sessionWaitMs + SESSION_STEP_MARGIN_MS },\n // After the session, so only the cache saved for this user is restored.\n ...(persistence ? [{ id: \"genesis:query-cache\", run: () => persistence.restore(session.getState().userId ?? \"\") }] : []),\n ],\n bootOptions,\n );\n // One component type for the life of the app, so a re-render never remounts a visible fatal screen.\n function FatalFallback(fallbackProps: FatalScreenProps) {\n useEffect(() => {\n fatalShown.current++;\n return () => {\n fatalShown.current--;\n };\n }, []);\n const { slotProps: sp } = latest.current;\n const s = withBlockSlots(blocks.slots, latest.current.slots);\n return (\n // A `fatal` slot that throws falls back to the plain screen.\n <GenesisErrorBoundary fallback={PlainFallback} onError={onError} onRetry={fallbackProps.retry}>\n {renderSlot(FatalScreen, s?.fatal, fallbackProps, sp?.fatal)}\n </GenesisErrorBoundary>\n );\n }\n return { client, persistence, session, boot, FatalFallback, blocks, provider: provider ?? createSupabaseProvider(supabase) };\n });\n const { boot, session, persistence, client, FatalFallback } = parts;\n const slots = withBlockSlots(parts.blocks.slots, props.slots);\n const bootState = useSyncExternalStore(boot.subscribe, boot.getState, boot.getState);\n const sessionState = useSyncExternalStore(session.subscribe, session.getState, session.getState);\n const [fatal, setFatal] = useState<Error | null>(null);\n const [resetKey, setResetKey] = useState(0);\n\n useEffect(() => session.start(), [session]);\n useEffect(() => {\n void boot.start();\n }, [boot]);\n useEffect(() => {\n if (bootState.status === \"failed\" && bootState.error) onError(bootState.error, { fatal: true, source: \"boot\" });\n }, [bootState.status, bootState.error]);\n useEffect(() => {\n // The screens mount, and start reading, before this effect runs: their reads are this person's\n // (the client is emptied whenever the person changes), so they're saved too.\n if (bootState.status === \"ready\" && persistence) return persistence.subscribe(sessionState.userId ?? \"\", { adopt: Boolean(sessionState.userId) });\n }, [bootState.status, persistence, sessionState.userId]);\n useEffect(() => {\n const utils = errorUtils ?? defaultErrorUtils();\n if (!utils) return;\n return installGlobalErrorHandler({ errorUtils: utils, onError, onFatal: setFatal, alreadyFatal: () => fatalShown.current > 0 });\n }, [errorUtils]);\n useEffect(() => {\n const enable = rejectionTracker === null ? undefined : (rejectionTracker ?? defaultRejectionTracker());\n if (enable) installRejectionTracker({ enable, onError });\n }, [rejectionTracker]);\n useEffect(() => (lifecycle ? connectQueryLifecycle(lifecycle) : undefined), [lifecycle]);\n const [queryReports] = useState(() => props.reportQueryErrors !== false);\n useEffect(() => (queryReports ? reportQueryErrors(client, onError) : undefined), [client, queryReports]);\n\n // Splash: up until boot has finished (the session step included), or failed.\n const settled = bootState.status === \"ready\" || bootState.status === \"failed\" || fatal !== null;\n const splashHidden = useRef(false);\n useEffect(() => {\n if (!settled || !splash || splashHidden.current) return;\n splashHidden.current = true;\n splash.hideAsync().catch(() => {});\n }, [settled, splash]);\n\n const auth: HeldLinkAuth = bootState.status !== \"ready\" || sessionState.status === \"loading\" ? \"pending\" : sessionState.status;\n useHeldLink(links?.hold ?? NO_HOLD, { auth: links ? auth : \"pending\", onRelease: (path) => links?.onRelease(path) });\n\n const retry = () => {\n setFatal(null);\n setResetKey((key) => key + 1);\n if (boot.getState().status === \"failed\") void boot.retry();\n };\n\n let content: ReactNode;\n if (fatal) {\n content = <FatalFallback error={fatal} retry={retry} />;\n } else if (bootState.status === \"failed\" && bootState.error) {\n content = <FatalFallback error={bootState.error} retry={retry} />;\n } else if (bootState.status !== \"ready\") {\n content = renderSlot(BootScreen, slots?.boot, { status: bootState.status }, slotProps?.boot);\n } else {\n const screens =\n sessionState.status === \"signedOut\" ? renderSlot(PassThrough, slots?.signedOut, { children }, slotProps?.signedOut) : children;\n const guarded = renderSlot(\n GenesisErrorBoundary,\n slots?.errorBoundary,\n { fallback: FatalFallback, onError, resetKey, onRetry: retry, children: screens },\n slotProps?.errorBoundary,\n );\n // The first block's root is the outermost.\n content = parts.blocks.blocks.reduceRight<ReactNode>((inner, block) => {\n const Root = block.Root;\n return Root ? (\n <Root key={block.id} slots={slots} slotProps={slotProps}>\n {inner}\n </Root>\n ) : (\n inner\n );\n }, guarded);\n }\n\n return (\n <GenesisProvider provider={parts.provider} queryClient={client}>\n <SessionProvider store={session}>\n <BootProvider boot={boot}>\n <BlocksProvider value={parts.blocks}>\n <GenesisErrorBoundary key={resetKey} fallback={FatalFallback} onError={onError} onRetry={retry}>\n {/* Sheet content renders in the library's portal, here: below data, session, boot and blocks. */}\n {bottomSheet ? <NativeSheetProvider bottomSheet={bottomSheet}>{content}</NativeSheetProvider> : content}\n </GenesisErrorBoundary>\n </BlocksProvider>\n </BootProvider>\n </SessionProvider>\n </GenesisProvider>\n );\n}\n\n// Every slot name, checked against NativeAppSlots by the compiler: a block filling any other is a BlockError.\nconst SLOT_NAMES: Record<keyof NativeAppSlots, true> = {\n boot: true,\n fatal: true,\n errorBoundary: true,\n signedOut: true,\n forceUpgrade: true,\n maintenance: true,\n updateBanner: true,\n whatsNew: true,\n devtoolsFeedback: true,\n pushPrompt: true,\n};\nconst NATIVE_APP_SLOT_NAMES: readonly string[] = Object.keys(SLOT_NAMES);\n\n/** Blocks' slot fills under the app's own slots: the app's (a component or `null`) always win. */\nfunction withBlockSlots(fills: Readonly<Record<string, unknown>>, own: Slots<NativeAppSlots> | undefined): Slots<NativeAppSlots> | undefined {\n if (Object.keys(fills).length === 0) return own;\n return { ...(fills as Slots<NativeAppSlots>), ...own };\n}\n\n/** `blocks`, with `updates` added when it was given on its own (given both ways, it runs once). */\nfunction givenBlocks(props: Pick<GenesisNativeAppProps, \"blocks\" | \"updates\">): readonly NativeBlock[] {\n const given = props.blocks ?? [];\n return props.updates && !given.includes(props.updates) ? [...given, props.updates] : given;\n}\n\nconst NO_HOLD: LinkHold = {\n hold: () => {},\n peek: () => null,\n take: () => null,\n clear: () => {},\n subscribe: () => () => {},\n};\n","/**\n * A hydration gate holds writes until a persisted store has loaded from disk.\n *\n * The bug it prevents: a persisted store (zustand `persist`, say) is created\n * with defaults, something sets a value before the saved state has been read,\n * and that write lands on disk first, replacing what the user had. With the\n * gate, a write made before hydration never reaches disk (`storage()`), or\n * waits for it (`run()`).\n *\n * const gate = createHydrationGate();\n * persist(store, {\n * storage: createJSONStorage(() => gate.storage(AsyncStorage)),\n * // Open only after a good read: after a failed one, writes would replace what's on disk.\n * onRehydrateStorage: () => (_state, error) => {\n * if (!error) gate.markHydrated();\n * },\n * });\n */\nimport type { AsyncStorageLike } from \"./query\";\n\nexport interface HydrationGate {\n readonly hydrated: boolean;\n /** Call once the store has read its saved state. Idempotent. */\n markHydrated(): void;\n /** Resolves once hydrated. */\n whenHydrated(): Promise<void>;\n /** Run a write now if hydrated, otherwise once hydrated. */\n run<T>(write: () => T | Promise<T>): Promise<T>;\n /**\n * The storage, with writes made before hydration dropped (reads pass\n * through, since hydration is a read). After hydration the store writes\n * its merged state on its next change, so nothing is lost but the stale\n * write. (A zustand migration's own write during hydration is dropped too;\n * the old version stays on disk and is migrated again until then.)\n */\n storage<S extends AsyncStorageLike>(storage: S): S;\n}\n\nexport interface HydrationGateOptions {\n /** Told about each write `storage()` dropped (to log it in development). */\n onDroppedWrite?: (key: string) => void;\n}\n\n/** A gate that holds writes until a persisted store has hydrated. */\nexport function createHydrationGate({ onDroppedWrite }: HydrationGateOptions = {}): HydrationGate {\n let hydrated = false;\n let open!: () => void;\n const opened = new Promise<void>((resolve) => {\n open = resolve;\n });\n\n const gate: HydrationGate = {\n get hydrated() {\n return hydrated;\n },\n markHydrated() {\n if (hydrated) return;\n hydrated = true;\n open();\n },\n whenHydrated: () => opened,\n async run(write) {\n if (!hydrated) await opened;\n return write();\n },\n storage(storage) {\n const setItem = async (key: string, value: string) => {\n if (!hydrated) return onDroppedWrite?.(key);\n return storage.setItem(key, value);\n };\n const removeItem = async (key: string) => {\n if (!hydrated) return onDroppedWrite?.(key);\n return storage.removeItem(key);\n };\n // A proxy, not a spread: a storage class's prototype methods (and its\n // private fields, through `this`) keep working.\n return new Proxy(storage, {\n get(target, property) {\n if (property === \"setItem\") return setItem;\n if (property === \"removeItem\") return removeItem;\n const value = Reflect.get(target, property, target) as unknown;\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n },\n };\n return gate;\n}\n"]}
|
package/dist/observability.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as RouteErrorBoundaryProps, b as ObservabilitySink } from './block-
|
|
2
|
-
export { B as Breadcrumb, c as BreadcrumbLevel, C as ConsoleSinkOptions, E as ErrorContext, d as EventCheck, e as EventPropSpec, f as EventProps, g as EventSchema, h as EventValues, i as OBSERVABILITY_BLOCK_ID, O as ObservabilityBlock, j as ObservabilityOptions, k as ObservabilityProvider, l as ObserveLike, m as ObserveSinkOptions, R as RecentActivity, n as RecentError, o as RecentStore, T as TimingTags, p as checkEvent, q as consoleSink, r as createObservability, s as defineEvents, t as observeSink, u as scrubBreadcrumb, v as scrubbedError, w as useObservability, x as useRecentActivity } from './block-
|
|
1
|
+
import { a as RouteErrorBoundaryProps, b as ObservabilitySink } from './block-CQz1pOnm.js';
|
|
2
|
+
export { B as Breadcrumb, c as BreadcrumbLevel, C as ConsoleSinkOptions, E as ErrorContext, d as EventCheck, e as EventPropSpec, f as EventProps, g as EventSchema, h as EventValues, i as OBSERVABILITY_BLOCK_ID, O as ObservabilityBlock, j as ObservabilityOptions, k as ObservabilityProvider, l as ObserveLike, m as ObserveSinkOptions, R as RecentActivity, n as RecentError, o as RecentStore, T as TimingTags, p as checkEvent, q as consoleSink, r as createObservability, s as defineEvents, t as observeSink, u as scrubBreadcrumb, v as scrubbedError, w as useObservability, x as useRecentActivity } from './block-CQz1pOnm.js';
|
|
3
3
|
import { ComponentType } from 'react';
|
|
4
|
-
import { V as VersionSignature } from './blocks-
|
|
5
|
-
export { c as ScreenErrorProps, d as ScreenErrorScreen, e as createScreenErrorBoundary } from './screen-boundary-
|
|
6
|
-
import './query
|
|
4
|
+
import { V as VersionSignature } from './blocks-dppiMmy-.js';
|
|
5
|
+
export { c as ScreenErrorProps, d as ScreenErrorScreen, e as createScreenErrorBoundary } from './screen-boundary-B8DlsLwb.js';
|
|
6
|
+
import './query--ihYsJWC.js';
|
|
7
7
|
import '@tanstack/react-query';
|
|
8
8
|
import '@marktiderman/genesis-core/slots';
|
|
9
9
|
import '@marktiderman/genesis-features/blocks';
|
package/dist/observability.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { scrubRecord, scrubEvent, scrubString } from './chunk-
|
|
2
|
-
export { FILTERED, OBSERVABILITY_BLOCK_ID, ObservabilityProvider, checkEvent, consoleSink, createObservability, defineEvents, isSecretKey, observeSink, scrubBreadcrumb, scrubEvent, scrubRecord, scrubString, scrubUrl, scrubValue, scrubbedError, useObservability, useRecentActivity } from './chunk-
|
|
3
|
-
export { ScreenErrorScreen, createScreenErrorBoundary } from './chunk-
|
|
1
|
+
import { scrubRecord, scrubEvent, scrubString } from './chunk-EWHO5WQU.js';
|
|
2
|
+
export { FILTERED, OBSERVABILITY_BLOCK_ID, ObservabilityProvider, checkEvent, consoleSink, createObservability, defineEvents, isSecretKey, observeSink, scrubBreadcrumb, scrubEvent, scrubRecord, scrubString, scrubUrl, scrubValue, scrubbedError, useObservability, useRecentActivity } from './chunk-EWHO5WQU.js';
|
|
3
|
+
export { ScreenErrorScreen, createScreenErrorBoundary } from './chunk-YIF4BFQH.js';
|
|
4
4
|
import './chunk-VIC2KXMA.js';
|
|
5
5
|
import './chunk-NGYNYJPL.js';
|
|
6
6
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LocalCache } from '@marktiderman/genesis-core/offline';
|
|
2
|
+
export { LocalCache, PersistOfflineOptions, QueryPersistence, cacheScope, persistOffline } from '@marktiderman/genesis-core/offline';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `@marktiderman/genesis-native/offline`: the phone's device cache, in SQLite
|
|
6
|
+
* (expo-sqlite), so lists and records open at once (ADR 0010, slice 1).
|
|
7
|
+
*
|
|
8
|
+
* import * as SQLite from "expo-sqlite";
|
|
9
|
+
* import { persistOffline, sqliteLocalCache } from "@marktiderman/genesis-native/offline";
|
|
10
|
+
*
|
|
11
|
+
* const db = SQLite.openDatabaseSync("genesis-offline.db");
|
|
12
|
+
* <GenesisNativeApp persist={persistOffline({ cache: sqliteLocalCache({ db }), resources: ["tasks"], buster: version })} … />
|
|
13
|
+
*
|
|
14
|
+
* @stability Beta
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** The part of expo-sqlite's `SQLiteDatabase` this uses (op-sqlite fits behind a small wrapper). */
|
|
18
|
+
interface SQLiteDatabaseLike {
|
|
19
|
+
execAsync(source: string): Promise<void>;
|
|
20
|
+
runAsync(source: string, params: (string | number | null)[]): Promise<unknown>;
|
|
21
|
+
getAllAsync<T>(source: string, params: (string | number | null)[]): Promise<T[]>;
|
|
22
|
+
/** Runs `task` in one exclusive transaction, so a write lands whole or not at all. */
|
|
23
|
+
withExclusiveTransactionAsync(task: (txn: SQLiteDatabaseLike) => Promise<void>): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
/** Options for {@link sqliteLocalCache}. */
|
|
26
|
+
interface SqliteLocalCacheOptions {
|
|
27
|
+
db: SQLiteDatabaseLike;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A `LocalCache` in SQLite, for the phone. Rows and queries are separate
|
|
31
|
+
* tables keyed by scope, so one row is stored once whatever lists hold it,
|
|
32
|
+
* and every write runs in one exclusive transaction. Values are stored as
|
|
33
|
+
* JSON, so a `Date` in a read comes back as its ISO text (rows from Supabase
|
|
34
|
+
* are text already).
|
|
35
|
+
*
|
|
36
|
+
* @stability Beta
|
|
37
|
+
*/
|
|
38
|
+
declare function sqliteLocalCache({ db }: SqliteLocalCacheOptions): LocalCache;
|
|
39
|
+
|
|
40
|
+
export { type SQLiteDatabaseLike, type SqliteLocalCacheOptions, sqliteLocalCache };
|