@marktiderman/genesis-core 1.4.0 → 1.5.1
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 +102 -0
- package/dist/{chunk-IHWWJUEN.js → chunk-3JSFTLDV.js} +147 -39
- package/dist/chunk-3JSFTLDV.js.map +1 -0
- package/dist/{chunk-6MBACQYA.js → chunk-5NHR6ZXS.js} +10 -2
- package/dist/chunk-5NHR6ZXS.js.map +1 -0
- package/dist/{chunk-P4OIIRQS.js → chunk-6Q477CHB.js} +72 -26
- package/dist/chunk-6Q477CHB.js.map +1 -0
- package/dist/chunk-BQOJX67X.js +31 -0
- package/dist/chunk-BQOJX67X.js.map +1 -0
- package/dist/{chunk-NW26Z3LZ.js → chunk-E5VYFAQO.js} +212 -37
- package/dist/chunk-E5VYFAQO.js.map +1 -0
- package/dist/chunk-F3BE7NGM.js +520 -0
- package/dist/chunk-F3BE7NGM.js.map +1 -0
- package/dist/chunk-HT43MPKW.js +3 -0
- package/dist/{chunk-EL7YGOTY.js.map → chunk-HT43MPKW.js.map} +1 -1
- package/dist/chunk-HUNGCTRA.js +33 -0
- package/dist/chunk-HUNGCTRA.js.map +1 -0
- package/dist/chunk-XQO4OH2N.js +32 -0
- package/dist/chunk-XQO4OH2N.js.map +1 -0
- package/dist/hooks/index.d.ts +5 -1
- package/dist/hooks/index.js +8 -4
- package/dist/hooks/mutation-mode.d.ts +119 -0
- package/dist/hooks/mutation-mode.js +6 -0
- package/dist/hooks/mutation-mode.js.map +1 -0
- package/dist/hooks/related-keys.d.ts +2 -1
- package/dist/hooks/use-capabilities.d.ts +21 -0
- package/dist/hooks/use-capabilities.js +5 -0
- package/dist/hooks/use-capabilities.js.map +1 -0
- package/dist/hooks/use-one.d.ts +2 -1
- package/dist/hooks/use-resource-form.d.ts +43 -2
- package/dist/hooks/use-resource-form.js +6 -2
- package/dist/hooks/use-resource.d.ts +29 -5
- package/dist/hooks/use-resource.js +3 -1
- package/dist/hooks/use-unsaved-changes-guard.d.ts +33 -0
- package/dist/hooks/use-unsaved-changes-guard.js +3 -0
- package/dist/hooks/use-unsaved-changes-guard.js.map +1 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +10 -6
- package/dist/provider/index.d.ts +81 -5
- package/dist/provider/index.js +4 -2
- package/dist/read-outcome-kgNhfuST.d.ts +88 -0
- package/dist/schema/index.d.ts +4 -3
- package/dist/schema/index.js +2 -1
- package/dist/{types-zILrlHuV.d.ts → types-5cuflvha.d.ts} +20 -279
- package/dist/types-DDOmG9hj.d.ts +292 -0
- package/package.json +1 -1
- package/dist/chunk-6MBACQYA.js.map +0 -1
- package/dist/chunk-EL7YGOTY.js +0 -3
- package/dist/chunk-IHWWJUEN.js.map +0 -1
- package/dist/chunk-NW26Z3LZ.js.map +0 -1
- package/dist/chunk-P4OIIRQS.js.map +0 -1
- package/dist/write-outcome-BE3Tk6bA.d.ts +0 -47
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/schema/read-outcome.ts
|
|
2
|
+
var DataReadError = class extends Error {
|
|
3
|
+
outcome;
|
|
4
|
+
/** The store's own error code, when it gave one. */
|
|
5
|
+
code;
|
|
6
|
+
constructor(outcome, message, options = {}) {
|
|
7
|
+
super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
8
|
+
this.name = "DataReadError";
|
|
9
|
+
this.outcome = outcome;
|
|
10
|
+
if (options.code !== void 0) this.code = options.code;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
function isDataReadError(error) {
|
|
14
|
+
return error instanceof Error && error.name === "DataReadError" && typeof error.outcome === "string";
|
|
15
|
+
}
|
|
16
|
+
function readFailureMessage(outcome, noun, one, plural = `${noun}s`) {
|
|
17
|
+
switch (outcome) {
|
|
18
|
+
case "unauthenticated":
|
|
19
|
+
return "Your session has ended. Sign in again to continue.";
|
|
20
|
+
case "forbidden":
|
|
21
|
+
return one ? `You don't have access to this ${noun}.` : `You don't have access to these ${plural}.`;
|
|
22
|
+
case "gone":
|
|
23
|
+
return `This ${noun} doesn't exist, or you can't see it.`;
|
|
24
|
+
case "invalid":
|
|
25
|
+
return one ? `This ${noun} couldn't be loaded.` : `These ${plural} couldn't be loaded.`;
|
|
26
|
+
default:
|
|
27
|
+
return one ? `This ${noun} couldn't be loaded. Try again.` : `These ${plural} couldn't be loaded. Try again.`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { DataReadError, isDataReadError, readFailureMessage };
|
|
32
|
+
//# sourceMappingURL=chunk-HUNGCTRA.js.map
|
|
33
|
+
//# sourceMappingURL=chunk-HUNGCTRA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schema/read-outcome.ts"],"names":[],"mappings":";AAyBO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EAC9B,OAAA;AAAA;AAAA,EAEA,IAAA;AAAA,EAET,WAAA,CAAY,OAAA,EAAsB,OAAA,EAAiB,OAAA,GAAgC,EAAC,EAAG;AACrF,IAAA,KAAA,CAAM,OAAA,EAAS,QAAQ,KAAA,KAAU,MAAA,GAAY,SAAY,EAAE,KAAA,EAAO,OAAA,CAAQ,KAAA,EAAO,CAAA;AACjF,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AACZ,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAI,OAAA,CAAQ,IAAA,KAAS,MAAA,EAAW,IAAA,CAAK,OAAO,OAAA,CAAQ,IAAA;AAAA,EACtD;AACF;AAMO,SAAS,gBAAgB,KAAA,EAAwC;AACtE,EAAA,OACE,iBAAiB,KAAA,IACjB,KAAA,CAAM,SAAS,eAAA,IACf,OAAQ,MAAgC,OAAA,KAAY,QAAA;AAExD;AAGO,SAAS,mBAAmB,OAAA,EAAsB,IAAA,EAAc,KAAc,MAAA,GAAS,CAAA,EAAG,IAAI,CAAA,CAAA,CAAA,EAAa;AAChH,EAAA,QAAQ,OAAA;AAAS,IACf,KAAK,iBAAA;AACH,MAAA,OAAO,oDAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAA,OAAO,GAAA,GAAM,CAAA,8BAAA,EAAiC,IAAI,CAAA,CAAA,CAAA,GAAM,kCAAkC,MAAM,CAAA,CAAA,CAAA;AAAA,IAClG,KAAK,MAAA;AACH,MAAA,OAAO,QAAQ,IAAI,CAAA,oCAAA,CAAA;AAAA,IACrB,KAAK,SAAA;AACH,MAAA,OAAO,GAAA,GAAM,CAAA,KAAA,EAAQ,IAAI,CAAA,oBAAA,CAAA,GAAyB,SAAS,MAAM,CAAA,oBAAA,CAAA;AAAA,IACnE;AACE,MAAA,OAAO,GAAA,GAAM,CAAA,KAAA,EAAQ,IAAI,CAAA,+BAAA,CAAA,GAAoC,SAAS,MAAM,CAAA,+BAAA,CAAA;AAAA;AAElF","file":"chunk-HUNGCTRA.js","sourcesContent":["// ---------------------------------------------------------------------------\n// Why a read failed, in words a user can be shown\n//\n// A store's own error text (\"relation \\\"tasks\\\" does not exist\", \"JWT\n// expired\", a constraint name) is for developers. A read error carries a\n// plain message for the screen and keeps the store's error as its `cause`.\n// ---------------------------------------------------------------------------\n\n/**\n * - `unauthenticated`: no signed-in user, or the session expired.\n * - `forbidden`: this user may not read these records.\n * - `gone`: the one record asked for doesn't exist, or isn't visible.\n * - `invalid`: the request itself was wrong (an unknown column, a bad value).\n * - `error`: anything else.\n */\nexport type ReadOutcome = \"unauthenticated\" | \"forbidden\" | \"gone\" | \"invalid\" | \"error\";\n\nexport interface DataReadErrorOptions {\n /** The store's own error code (a Postgres SQLSTATE or PostgREST code). */\n code?: string;\n /** The underlying error, with its raw text, kept for logging. */\n cause?: unknown;\n}\n\n/** Thrown by a provider when a read failed. Its `message` is safe to show. */\nexport class DataReadError extends Error {\n readonly outcome: ReadOutcome;\n /** The store's own error code, when it gave one. */\n readonly code?: string;\n\n constructor(outcome: ReadOutcome, message: string, options: DataReadErrorOptions = {}) {\n super(message, options.cause === undefined ? undefined : { cause: options.cause });\n this.name = \"DataReadError\";\n this.outcome = outcome;\n if (options.code !== undefined) this.code = options.code;\n }\n}\n\n/**\n * `instanceof` fails when two copies of this package are installed, so check\n * the shape instead.\n */\nexport function isDataReadError(error: unknown): error is DataReadError {\n return (\n error instanceof Error &&\n error.name === \"DataReadError\" &&\n typeof (error as { outcome?: unknown }).outcome === \"string\"\n );\n}\n\n/** The plain sentence for a failed read of `noun` records (one, or a list). */\nexport function readFailureMessage(outcome: ReadOutcome, noun: string, one: boolean, plural = `${noun}s`): string {\n switch (outcome) {\n case \"unauthenticated\":\n return \"Your session has ended. Sign in again to continue.\";\n case \"forbidden\":\n return one ? `You don't have access to this ${noun}.` : `You don't have access to these ${plural}.`;\n case \"gone\":\n return `This ${noun} doesn't exist, or you can't see it.`;\n case \"invalid\":\n return one ? `This ${noun} couldn't be loaded.` : `These ${plural} couldn't be loaded.`;\n default:\n return one ? `This ${noun} couldn't be loaded. Try again.` : `These ${plural} couldn't be loaded. Try again.`;\n }\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useRef, useEffect, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
// src/hooks/use-unsaved-changes-guard.ts
|
|
4
|
+
var DEFAULT_UNSAVED_CHANGES_MESSAGE = "You have unsaved changes. Leave without saving?";
|
|
5
|
+
function useUnsavedChangesGuard(options) {
|
|
6
|
+
const { when, message = DEFAULT_UNSAVED_CHANGES_MESSAGE, confirm } = options;
|
|
7
|
+
const whenRef = useRef(when);
|
|
8
|
+
whenRef.current = when;
|
|
9
|
+
const messageRef = useRef(message);
|
|
10
|
+
messageRef.current = message;
|
|
11
|
+
const confirmRef = useRef(confirm);
|
|
12
|
+
confirmRef.current = confirm;
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!when || typeof window === "undefined") return;
|
|
15
|
+
const onBeforeUnload = (event) => {
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
event.returnValue = "";
|
|
18
|
+
};
|
|
19
|
+
window.addEventListener("beforeunload", onBeforeUnload);
|
|
20
|
+
return () => window.removeEventListener("beforeunload", onBeforeUnload);
|
|
21
|
+
}, [when]);
|
|
22
|
+
const confirmLeave = useCallback(() => {
|
|
23
|
+
if (!whenRef.current) return true;
|
|
24
|
+
const ask = confirmRef.current ?? (typeof window !== "undefined" && typeof window.confirm === "function" ? (text) => window.confirm(text) : () => true);
|
|
25
|
+
return ask(messageRef.current);
|
|
26
|
+
}, []);
|
|
27
|
+
return { isBlocking: when, confirmLeave };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard };
|
|
31
|
+
//# sourceMappingURL=chunk-XQO4OH2N.js.map
|
|
32
|
+
//# sourceMappingURL=chunk-XQO4OH2N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-unsaved-changes-guard.ts"],"names":[],"mappings":";;;AAEO,IAAM,+BAAA,GACX;AAiCK,SAAS,uBACd,OAAA,EAC8B;AAC9B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,GAAU,+BAAA,EAAiC,SAAQ,GAAI,OAAA;AACrE,EAAA,MAAM,OAAA,GAAU,OAAO,IAAI,CAAA;AAC3B,EAAA,OAAA,CAAQ,OAAA,GAAU,IAAA;AAClB,EAAA,MAAM,UAAA,GAAa,OAAO,OAAO,CAAA;AACjC,EAAA,UAAA,CAAW,OAAA,GAAU,OAAA;AACrB,EAAA,MAAM,UAAA,GAAa,OAAO,OAAO,CAAA;AACjC,EAAA,UAAA,CAAW,OAAA,GAAU,OAAA;AAErB,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,IAAA,IAAQ,OAAO,MAAA,KAAW,WAAA,EAAa;AAC5C,IAAA,MAAM,cAAA,GAAiB,CAAC,KAAA,KAA6B;AACnD,MAAA,KAAA,CAAM,cAAA,EAAe;AAErB,MAAA,KAAA,CAAM,WAAA,GAAc,EAAA;AAAA,IACtB,CAAA;AACA,IAAA,MAAA,CAAO,gBAAA,CAAiB,gBAAgB,cAAc,CAAA;AACtD,IAAA,OAAO,MAAM,MAAA,CAAO,mBAAA,CAAoB,cAAA,EAAgB,cAAc,CAAA;AAAA,EACxE,CAAA,EAAG,CAAC,IAAI,CAAC,CAAA;AAET,EAAA,MAAM,YAAA,GAAe,YAAY,MAAe;AAC9C,IAAA,IAAI,CAAC,OAAA,CAAQ,OAAA,EAAS,OAAO,IAAA;AAC7B,IAAA,MAAM,MACJ,UAAA,CAAW,OAAA,KACV,OAAO,MAAA,KAAW,eAAe,OAAO,MAAA,CAAO,OAAA,KAAY,UAAA,GACxD,CAAC,IAAA,KAAiB,MAAA,CAAO,OAAA,CAAQ,IAAI,IACrC,MAAM,IAAA,CAAA;AACZ,IAAA,OAAO,GAAA,CAAI,WAAW,OAAO,CAAA;AAAA,EAC/B,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,EAAE,UAAA,EAAY,IAAA,EAAM,YAAA,EAAa;AAC1C","file":"chunk-XQO4OH2N.js","sourcesContent":["import { useCallback, useEffect, useRef } from \"react\";\n\nexport const DEFAULT_UNSAVED_CHANGES_MESSAGE =\n \"You have unsaved changes. Leave without saving?\";\n\nexport interface UseUnsavedChangesGuardOptions {\n /** Guard while this is true (e.g. a form is dirty). */\n when: boolean;\n /** The question `confirmLeave` asks. */\n message?: string;\n /**\n * How to ask. Default `window.confirm`. Must answer synchronously, since\n * router blockers and `beforeunload` cannot wait.\n */\n confirm?: (message: string) => boolean;\n}\n\nexport interface UseUnsavedChangesGuardReturn {\n /** True while leaving would lose changes. */\n isBlocking: boolean;\n /**\n * Call before leaving in-app (closing a dialog, a router blocker). Returns\n * true when it is fine to leave: nothing to lose, or the user said so.\n */\n confirmLeave: () => boolean;\n}\n\n/**\n * Warns before unsaved changes are lost, without depending on a router.\n *\n * - While `when` is true, closing or reloading the tab shows the browser's\n * own \"Leave site?\" prompt (`beforeunload`).\n * - `confirmLeave()` is for in-app navigation: wire it to your router's\n * blocker (React Router `useBlocker`, TanStack Router `useBlocker`), or call\n * it before closing a dialog. See SKILL.md \"Unsaved changes\".\n */\nexport function useUnsavedChangesGuard(\n options: UseUnsavedChangesGuardOptions,\n): UseUnsavedChangesGuardReturn {\n const { when, message = DEFAULT_UNSAVED_CHANGES_MESSAGE, confirm } = options;\n const whenRef = useRef(when);\n whenRef.current = when;\n const messageRef = useRef(message);\n messageRef.current = message;\n const confirmRef = useRef(confirm);\n confirmRef.current = confirm;\n\n useEffect(() => {\n if (!when || typeof window === \"undefined\") return;\n const onBeforeUnload = (event: BeforeUnloadEvent) => {\n event.preventDefault();\n // Older browsers need returnValue set to show the prompt.\n event.returnValue = \"\";\n };\n window.addEventListener(\"beforeunload\", onBeforeUnload);\n return () => window.removeEventListener(\"beforeunload\", onBeforeUnload);\n }, [when]);\n\n const confirmLeave = useCallback((): boolean => {\n if (!whenRef.current) return true;\n const ask =\n confirmRef.current ??\n (typeof window !== \"undefined\" && typeof window.confirm === \"function\"\n ? (text: string) => window.confirm(text)\n : () => true);\n return ask(messageRef.current);\n }, []);\n\n return { isBlocking: when, confirmLeave };\n}\n"]}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export { UseResourceOptions, UseResourceReturn, useResource } from './use-resource.js';
|
|
2
2
|
export { UseOneOptions, useOne } from './use-one.js';
|
|
3
|
+
export { useCapabilities } from './use-capabilities.js';
|
|
3
4
|
export { UseResourceFormOptions, UseResourceFormReturn, buildArrayItemDefaults, useResourceForm } from './use-resource-form.js';
|
|
4
5
|
export { UseWizardReturn, WizardStep, useWizard } from './use-wizard.js';
|
|
6
|
+
export { DEFAULT_UNDO_DELAY_MS, MutationMode, MutationModeOptions, UndoableWrite, pendingWriteCount } from './mutation-mode.js';
|
|
7
|
+
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, UseUnsavedChangesGuardOptions, UseUnsavedChangesGuardReturn, useUnsavedChangesGuard } from './use-unsaved-changes-guard.js';
|
|
5
8
|
import '@tanstack/react-query';
|
|
6
|
-
import '../types-
|
|
9
|
+
import '../types-DDOmG9hj.js';
|
|
10
|
+
import '../types-5cuflvha.js';
|
|
7
11
|
import '../form-types.js';
|
|
8
12
|
import 'react-hook-form';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import '../chunk-
|
|
1
|
+
import '../chunk-HT43MPKW.js';
|
|
2
|
+
export { buildArrayItemDefaults, useResourceForm } from '../chunk-3JSFTLDV.js';
|
|
3
|
+
export { useResource } from '../chunk-6Q477CHB.js';
|
|
4
|
+
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from '../chunk-XQO4OH2N.js';
|
|
2
5
|
export { useWizard } from '../chunk-7KOLYF27.js';
|
|
3
|
-
|
|
6
|
+
import '../chunk-5NHR6ZXS.js';
|
|
4
7
|
import '../chunk-RYEXWQFD.js';
|
|
5
|
-
export {
|
|
6
|
-
export { useResource } from '../chunk-P4OIIRQS.js';
|
|
8
|
+
export { DEFAULT_UNDO_DELAY_MS, pendingWriteCount } from '../chunk-F3BE7NGM.js';
|
|
7
9
|
import '../chunk-7NUL32W7.js';
|
|
10
|
+
export { useCapabilities } from '../chunk-BQOJX67X.js';
|
|
11
|
+
export { useOne } from '../chunk-ZK5C3OOT.js';
|
|
8
12
|
import '../chunk-GGSXSI6Z.js';
|
|
9
13
|
import '../chunk-ZYJUEJ4Z.js';
|
|
10
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { I as Identifier, B as BaseRecord, D as DataProvider } from '../types-DDOmG9hj.js';
|
|
3
|
+
import { A as AuditEntry } from '../types-5cuflvha.js';
|
|
4
|
+
import '../form-types.js';
|
|
5
|
+
|
|
6
|
+
type MutationMode = "pessimistic" | "optimistic" | "undoable";
|
|
7
|
+
/** How long an `undoable` write waits for an undo before it is sent. */
|
|
8
|
+
declare const DEFAULT_UNDO_DELAY_MS = 5000;
|
|
9
|
+
/** An undoable write, as handed to `onUndoable` so a UI can offer the undo. */
|
|
10
|
+
interface UndoableWrite {
|
|
11
|
+
resource: string;
|
|
12
|
+
kind: "create" | "update" | "delete";
|
|
13
|
+
/** The record's id; absent for a create (it has none until it is sent). */
|
|
14
|
+
id?: Identifier;
|
|
15
|
+
/**
|
|
16
|
+
* - `delay`: the write has not been sent. `undo()` discards it; `commit()`
|
|
17
|
+
* sends it now instead of waiting.
|
|
18
|
+
* - `provider`: the write was sent at once, because the provider serves
|
|
19
|
+
* `undo`. `undo()` asks the provider to reverse it; `commit()` does
|
|
20
|
+
* nothing.
|
|
21
|
+
*/
|
|
22
|
+
strategy: "delay" | "provider";
|
|
23
|
+
/** How long the undo is offered, in ms (the toast's duration). */
|
|
24
|
+
delayMs: number;
|
|
25
|
+
/**
|
|
26
|
+
* Take the write back. Resolves true when it was undone (or will never be
|
|
27
|
+
* sent), false when it could not be: already sent under `delay` (the
|
|
28
|
+
* window closed, it was committed, a later write on the same record sent
|
|
29
|
+
* it first, or the page unloaded), already undone, or the provider's undo
|
|
30
|
+
* failed (reported through `onError`). Works after the hook that made the
|
|
31
|
+
* write has unmounted. Safe to call more than once.
|
|
32
|
+
*/
|
|
33
|
+
undo: () => Promise<boolean>;
|
|
34
|
+
/** Send a `delay` write now. */
|
|
35
|
+
commit: () => void;
|
|
36
|
+
}
|
|
37
|
+
interface MutationModeOptions {
|
|
38
|
+
/** Default `"pessimistic"`. */
|
|
39
|
+
mutationMode?: MutationMode;
|
|
40
|
+
/** How long an `undoable` write waits, in ms. Default 5000. */
|
|
41
|
+
undoDelayMs?: number;
|
|
42
|
+
/** Called with every `undoable` write, to show an undo control. */
|
|
43
|
+
onUndoable?: (write: UndoableWrite) => void;
|
|
44
|
+
}
|
|
45
|
+
/** Structural equality for row values (JSON-like data, Dates). */
|
|
46
|
+
declare function sameValue(a: unknown, b: unknown): boolean;
|
|
47
|
+
/** The record as the cache has it now, from a detail entry or any list. */
|
|
48
|
+
declare function cachedRecord(queryClient: QueryClient, resource: string, id: Identifier): BaseRecord | undefined;
|
|
49
|
+
/** Optimistic or undoable writes on `resource` not yet settled. */
|
|
50
|
+
declare function pendingWriteCount(queryClient: QueryClient, resource: string): number;
|
|
51
|
+
/**
|
|
52
|
+
* Invalidate `[resource]`. Safe while optimistic/undoable writes on it are
|
|
53
|
+
* pending: their patches are re-applied to whatever the refetch brings.
|
|
54
|
+
*/
|
|
55
|
+
declare function invalidateResource(queryClient: QueryClient, resource: string): Promise<void>;
|
|
56
|
+
/** What `send` is given when the write goes out. */
|
|
57
|
+
interface SendContext {
|
|
58
|
+
/**
|
|
59
|
+
* The row-shaped values to send, when `data` was given. They can differ
|
|
60
|
+
* from `data`: an earlier write on the record that this one built on was
|
|
61
|
+
* taken back, and its values were put back. Send these.
|
|
62
|
+
*/
|
|
63
|
+
data?: Record<string, unknown>;
|
|
64
|
+
/** The page is unloading: pass `keepalive: true` to the provider. */
|
|
65
|
+
keepalive: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface ExecuteWriteArgs<R extends BaseRecord | void> {
|
|
68
|
+
queryClient: QueryClient;
|
|
69
|
+
provider: DataProvider;
|
|
70
|
+
resource: string;
|
|
71
|
+
kind: "create" | "update" | "delete";
|
|
72
|
+
id?: Identifier;
|
|
73
|
+
/**
|
|
74
|
+
* The values to merge into the cached row (update). Leave out to patch
|
|
75
|
+
* nothing, e.g. when the values are form-shaped and the row is not.
|
|
76
|
+
*/
|
|
77
|
+
data?: Record<string, unknown>;
|
|
78
|
+
mode: MutationMode;
|
|
79
|
+
undoDelayMs?: number;
|
|
80
|
+
onUndoable?: (write: UndoableWrite) => void;
|
|
81
|
+
/** Sends the write. */
|
|
82
|
+
send: (context: SendContext) => Promise<{
|
|
83
|
+
record: R;
|
|
84
|
+
audit?: AuditEntry;
|
|
85
|
+
}>;
|
|
86
|
+
/** After the write committed. Invalidates and calls success callbacks. */
|
|
87
|
+
committed: (record: R) => Promise<void> | void;
|
|
88
|
+
/** A write that failed (or was dropped) after the caller was told it went through. */
|
|
89
|
+
failedLater: (error: Error) => void;
|
|
90
|
+
}
|
|
91
|
+
type ExecuteWriteResult<R> = {
|
|
92
|
+
status: "committed";
|
|
93
|
+
record: R;
|
|
94
|
+
} | {
|
|
95
|
+
status: "applied";
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Whether `provider` serves `undo` for `resource`, from its capabilities
|
|
99
|
+
* (useCapabilities' key, so the answer is shared, and scoped to this
|
|
100
|
+
* provider: a swapped-out provider's capabilities never offer undo).
|
|
101
|
+
* @internal Exported for tests.
|
|
102
|
+
*/
|
|
103
|
+
declare function providerServesUndo(queryClient: QueryClient, provider: DataProvider, resource: string): Promise<boolean>;
|
|
104
|
+
/** A later write that built on one that was taken back. */
|
|
105
|
+
declare const DROPPED_WRITE_MESSAGE = "This change was not saved: it was made on top of an earlier change that was undone or failed. Please make it again.";
|
|
106
|
+
/**
|
|
107
|
+
* Runs one write in the given mode.
|
|
108
|
+
*
|
|
109
|
+
* - `pessimistic`: sends it and waits; a failure rejects.
|
|
110
|
+
* - `optimistic` / `undoable`: resolves `{ status: "applied" }` as soon as
|
|
111
|
+
* the cache is patched. A later failure rolls the patch back and goes to
|
|
112
|
+
* `failedLater`, never to the returned promise.
|
|
113
|
+
*
|
|
114
|
+
* Writes on the same record are sent one after another, in the order they
|
|
115
|
+
* were made; sending one first sends the earlier ones still waiting.
|
|
116
|
+
*/
|
|
117
|
+
declare function executeWrite<R extends BaseRecord | void>(args: ExecuteWriteArgs<R>): Promise<ExecuteWriteResult<R>>;
|
|
118
|
+
|
|
119
|
+
export { DEFAULT_UNDO_DELAY_MS, DROPPED_WRITE_MESSAGE, type ExecuteWriteArgs, type ExecuteWriteResult, type MutationMode, type MutationModeOptions, type SendContext, type UndoableWrite, cachedRecord, executeWrite, invalidateResource, pendingWriteCount, providerServesUndo, sameValue };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DEFAULT_UNDO_DELAY_MS, DROPPED_WRITE_MESSAGE, cachedRecord, executeWrite, invalidateResource, pendingWriteCount, providerServesUndo, sameValue } from '../chunk-F3BE7NGM.js';
|
|
2
|
+
import '../chunk-BQOJX67X.js';
|
|
3
|
+
import '../chunk-GGSXSI6Z.js';
|
|
4
|
+
import '../chunk-ZYJUEJ4Z.js';
|
|
5
|
+
//# sourceMappingURL=mutation-mode.js.map
|
|
6
|
+
//# sourceMappingURL=mutation-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"mutation-mode.js"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import { P as ProviderCapabilities } from '../types-5cuflvha.js';
|
|
3
|
+
import '../form-types.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The query key for `provider`'s capabilities for `resource`. It includes
|
|
7
|
+
* the provider's identity: swapping the provider (another tenant, a
|
|
8
|
+
* different store) asks the new one instead of reusing the old answer.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
declare function capabilitiesQueryKey(provider: object, resource: string | undefined): readonly unknown[];
|
|
12
|
+
/**
|
|
13
|
+
* What the data provider can do for `resource` (`provider.capabilities`),
|
|
14
|
+
* cached per provider and resource. `data` stays undefined for a provider
|
|
15
|
+
* that doesn't report capabilities, so a UI keeps its defaults.
|
|
16
|
+
*/
|
|
17
|
+
declare function useCapabilities(resource: string | undefined, options?: {
|
|
18
|
+
enabled?: boolean;
|
|
19
|
+
}): UseQueryResult<ProviderCapabilities>;
|
|
20
|
+
|
|
21
|
+
export { capabilitiesQueryKey, useCapabilities };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"use-capabilities.js"}
|
package/dist/hooks/use-one.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import { B as BaseRecord, I as Identifier } from '../types-
|
|
2
|
+
import { B as BaseRecord, I as Identifier } from '../types-DDOmG9hj.js';
|
|
3
|
+
import '../types-5cuflvha.js';
|
|
3
4
|
import '../form-types.js';
|
|
4
5
|
|
|
5
6
|
interface UseOneOptions {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { UseFormReturn } from 'react-hook-form';
|
|
2
2
|
import { ResourceFormFieldDef } from '../form-types.js';
|
|
3
|
-
import {
|
|
3
|
+
import { j as InvalidationKey } from '../types-DDOmG9hj.js';
|
|
4
|
+
import { MutationModeOptions } from './mutation-mode.js';
|
|
5
|
+
import '../types-5cuflvha.js';
|
|
6
|
+
import '@tanstack/react-query';
|
|
4
7
|
|
|
5
|
-
interface UseResourceFormOptions {
|
|
8
|
+
interface UseResourceFormOptions extends MutationModeOptions {
|
|
6
9
|
resource: string;
|
|
7
10
|
action: "create" | "edit";
|
|
8
11
|
id?: string;
|
|
@@ -10,8 +13,35 @@ interface UseResourceFormOptions {
|
|
|
10
13
|
fields?: ResourceFormFieldDef[];
|
|
11
14
|
/** Full dataset used to auto-detect select fields from unique values. */
|
|
12
15
|
listData?: Record<string, unknown>[];
|
|
16
|
+
/**
|
|
17
|
+
* The form is done. After the save in `pessimistic` mode (with the stored
|
|
18
|
+
* row); at once in `optimistic` and `undoable` modes (with the submitted
|
|
19
|
+
* values over the record, and no `id` for a create).
|
|
20
|
+
*/
|
|
13
21
|
onSuccess?: (data: Record<string, unknown>) => void;
|
|
22
|
+
/**
|
|
23
|
+
* The save failed. In `optimistic` and `undoable` modes the form may be
|
|
24
|
+
* gone by then, so show the error from here (genesis-ui's ResourceForm
|
|
25
|
+
* toasts it when no `onError` is given).
|
|
26
|
+
*/
|
|
14
27
|
onError?: (error: Error) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Warn before unsaved changes are lost. Default false. While the form is
|
|
30
|
+
* dirty, closing or reloading the tab shows the browser's prompt, and
|
|
31
|
+
* `confirmLeave()` asks before in-app navigation (wire it to a router
|
|
32
|
+
* blocker; see SKILL.md "Unsaved changes").
|
|
33
|
+
*/
|
|
34
|
+
warnWhenUnsaved?: boolean | {
|
|
35
|
+
message?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Whether the form is on screen. Default true. Pass false while it is
|
|
39
|
+
* hidden but still mounted (a closed dialog). An optimistic or undoable
|
|
40
|
+
* save that fails later is put back on the form (field errors, unsaved
|
|
41
|
+
* again) only while the form is mounted, visible and still holds the
|
|
42
|
+
* values it saved; otherwise the failure only reaches `onError`.
|
|
43
|
+
*/
|
|
44
|
+
visible?: boolean;
|
|
15
45
|
/**
|
|
16
46
|
* Pre-fill create form defaults from URL query params: a param named like a
|
|
17
47
|
* field (`?status=draft`) becomes that field's starting value. Default true.
|
|
@@ -48,6 +78,17 @@ interface UseResourceFormReturn {
|
|
|
48
78
|
handleSave: (data: Record<string, unknown>) => Promise<void>;
|
|
49
79
|
isSaving: boolean;
|
|
50
80
|
isLoading: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The form has changes that have not been saved. False again once a save
|
|
83
|
+
* succeeds (or, in optimistic / undoable modes, is handed off).
|
|
84
|
+
*/
|
|
85
|
+
isDirty: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* For in-app navigation: true when it is fine to leave (nothing unsaved,
|
|
88
|
+
* `warnWhenUnsaved` off, or the user confirmed). Asks with
|
|
89
|
+
* `window.confirm` otherwise.
|
|
90
|
+
*/
|
|
91
|
+
confirmLeave: () => boolean;
|
|
51
92
|
}
|
|
52
93
|
/** Build default values for a single array item from its sub-field definitions */
|
|
53
94
|
declare function buildArrayItemDefaults(arrayFields: ResourceFormFieldDef[]): Record<string, unknown>;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export { buildArrayItemDefaults, useResourceForm } from '../chunk-
|
|
1
|
+
export { buildArrayItemDefaults, useResourceForm } from '../chunk-3JSFTLDV.js';
|
|
2
|
+
import '../chunk-XQO4OH2N.js';
|
|
3
|
+
import '../chunk-5NHR6ZXS.js';
|
|
2
4
|
import '../chunk-RYEXWQFD.js';
|
|
3
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-F3BE7NGM.js';
|
|
4
6
|
import '../chunk-7NUL32W7.js';
|
|
7
|
+
import '../chunk-BQOJX67X.js';
|
|
8
|
+
import '../chunk-ZK5C3OOT.js';
|
|
5
9
|
import '../chunk-GGSXSI6Z.js';
|
|
6
10
|
import '../chunk-ZYJUEJ4Z.js';
|
|
7
11
|
//# sourceMappingURL=use-resource-form.js.map
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { UseQueryResult, UseMutationResult } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { m as SortParam, F as FilterParam, j as InvalidationKey, k as ListResult, L as ListParams, I as Identifier, B as BaseRecord } from '../types-DDOmG9hj.js';
|
|
3
|
+
import { MutationModeOptions } from './mutation-mode.js';
|
|
4
|
+
import '../types-5cuflvha.js';
|
|
3
5
|
import '../form-types.js';
|
|
4
6
|
|
|
5
|
-
interface UseResourceOptions<T> {
|
|
7
|
+
interface UseResourceOptions<T> extends MutationModeOptions {
|
|
6
8
|
defaultSort?: SortParam;
|
|
7
9
|
/**
|
|
8
10
|
* Re-synced whenever its value changes (deep-equal, order-independent),
|
|
@@ -15,6 +17,10 @@ interface UseResourceOptions<T> {
|
|
|
15
17
|
*/
|
|
16
18
|
defaultFilters?: FilterParam[];
|
|
17
19
|
defaultPerPage?: number;
|
|
20
|
+
/** The page to start on (from 1), e.g. restored from the URL. Default 1. */
|
|
21
|
+
defaultPage?: number;
|
|
22
|
+
/** The search to start with, e.g. restored from the URL. Default "". */
|
|
23
|
+
defaultSearch?: string;
|
|
18
24
|
/** Supabase select/join syntax, e.g. "*, author:profiles(name)". */
|
|
19
25
|
select?: string;
|
|
20
26
|
/** Fields to search across when setSearch is called. Required for server-side search. */
|
|
@@ -34,9 +40,19 @@ interface UseResourceOptions<T> {
|
|
|
34
40
|
* rather than flashing a skeleton. Default false.
|
|
35
41
|
*/
|
|
36
42
|
keepPreviousData?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* After the write commits, with the provider's row. In `optimistic` and
|
|
45
|
+
* `undoable` modes that is after `create` / `update` / `remove` have
|
|
46
|
+
* already resolved.
|
|
47
|
+
*/
|
|
37
48
|
onCreateSuccess?: (data: T) => void;
|
|
38
49
|
onUpdateSuccess?: (data: T) => void;
|
|
39
50
|
onDeleteSuccess?: () => void;
|
|
51
|
+
/**
|
|
52
|
+
* A write failed. In `optimistic` and `undoable` modes this is the only
|
|
53
|
+
* place a failure is reported (the cache has already been put back), so
|
|
54
|
+
* show it to the user here.
|
|
55
|
+
*/
|
|
40
56
|
onError?: (error: Error) => void;
|
|
41
57
|
}
|
|
42
58
|
interface UseResourceReturn<T> {
|
|
@@ -49,11 +65,19 @@ interface UseResourceReturn<T> {
|
|
|
49
65
|
setPage: (page: number) => void;
|
|
50
66
|
setPerPage: (perPage: number) => void;
|
|
51
67
|
setSearch: (query: string) => void;
|
|
52
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Create a new record. Returns the created item. In `optimistic` and
|
|
70
|
+
* `undoable` modes it resolves at once with the values given (no `id` yet;
|
|
71
|
+
* `onCreateSuccess` gets the stored row).
|
|
72
|
+
*/
|
|
53
73
|
create: (data: Partial<T>) => Promise<T>;
|
|
54
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Update an existing record by id. Returns the updated item. In
|
|
76
|
+
* `optimistic` and `undoable` modes it resolves at once with the cached
|
|
77
|
+
* row merged with `data`.
|
|
78
|
+
*/
|
|
55
79
|
update: (id: Identifier, data: Partial<T>) => Promise<T>;
|
|
56
|
-
/** Delete a record by id. */
|
|
80
|
+
/** Delete a record by id. Resolves at once in `optimistic` / `undoable` modes. */
|
|
57
81
|
remove: (id: Identifier) => Promise<void>;
|
|
58
82
|
/** True when any mutation is in-flight. */
|
|
59
83
|
isMutating: boolean;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export { useResource } from '../chunk-
|
|
1
|
+
export { useResource } from '../chunk-6Q477CHB.js';
|
|
2
|
+
import '../chunk-F3BE7NGM.js';
|
|
2
3
|
import '../chunk-7NUL32W7.js';
|
|
4
|
+
import '../chunk-BQOJX67X.js';
|
|
3
5
|
import '../chunk-GGSXSI6Z.js';
|
|
4
6
|
import '../chunk-ZYJUEJ4Z.js';
|
|
5
7
|
//# sourceMappingURL=use-resource.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare const DEFAULT_UNSAVED_CHANGES_MESSAGE = "You have unsaved changes. Leave without saving?";
|
|
2
|
+
interface UseUnsavedChangesGuardOptions {
|
|
3
|
+
/** Guard while this is true (e.g. a form is dirty). */
|
|
4
|
+
when: boolean;
|
|
5
|
+
/** The question `confirmLeave` asks. */
|
|
6
|
+
message?: string;
|
|
7
|
+
/**
|
|
8
|
+
* How to ask. Default `window.confirm`. Must answer synchronously, since
|
|
9
|
+
* router blockers and `beforeunload` cannot wait.
|
|
10
|
+
*/
|
|
11
|
+
confirm?: (message: string) => boolean;
|
|
12
|
+
}
|
|
13
|
+
interface UseUnsavedChangesGuardReturn {
|
|
14
|
+
/** True while leaving would lose changes. */
|
|
15
|
+
isBlocking: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Call before leaving in-app (closing a dialog, a router blocker). Returns
|
|
18
|
+
* true when it is fine to leave: nothing to lose, or the user said so.
|
|
19
|
+
*/
|
|
20
|
+
confirmLeave: () => boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Warns before unsaved changes are lost, without depending on a router.
|
|
24
|
+
*
|
|
25
|
+
* - While `when` is true, closing or reloading the tab shows the browser's
|
|
26
|
+
* own "Leave site?" prompt (`beforeunload`).
|
|
27
|
+
* - `confirmLeave()` is for in-app navigation: wire it to your router's
|
|
28
|
+
* blocker (React Router `useBlocker`, TanStack Router `useBlocker`), or call
|
|
29
|
+
* it before closing a dialog. See SKILL.md "Unsaved changes".
|
|
30
|
+
*/
|
|
31
|
+
declare function useUnsavedChangesGuard(options: UseUnsavedChangesGuardOptions): UseUnsavedChangesGuardReturn;
|
|
32
|
+
|
|
33
|
+
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, type UseUnsavedChangesGuardOptions, type UseUnsavedChangesGuardReturn, useUnsavedChangesGuard };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"use-unsaved-changes-guard.js"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
export { A as ArrayFilter,
|
|
2
|
-
export { D as
|
|
3
|
-
export { DataProviderRoot, DataProviderRootProps, GenesisProvider, GenesisProviderProps, MockProviderOptions, SupabaseClient, SupabaseClientInput, SupabaseProviderOptions, SupabaseResourceConfig, SupabaseWriteContext, createMockProvider, createSupabaseProvider, toDataWriteError, useDataProvider, useStorage, writeOutcomeFromCode } from './provider/index.js';
|
|
1
|
+
export { A as ArrayFilter, B as BaseRecord, a as BulkChange, b as BulkResult, C as CreateParams, c as CreateResult, D as DataProvider, d as DeleteParams, e as DeleteResult, F as FilterParam, G as GetManyParams, f as GetManyResult, g as GetOneParams, h as GetOneResult, H as HistoryParams, I as Identifier, i as ImportParams, j as InvalidationKey, L as ListParams, k as ListResult, N as NullFilter, P as PaginationParam, R as RangeFilter, l as RowFailure, S as ScalarFilter, m as SortParam, U as UpdateParams, n as UpdateResult, W as WriteEvent } from './types-DDOmG9hj.js';
|
|
2
|
+
export { D as DataReadError, a as DataReadErrorOptions, b as DataWriteError, c as DataWriteErrorOptions, R as ReadOutcome, W as WriteOutcome, i as isDataReadError, d as isDataWriteError, r as readFailureMessage } from './read-outcome-kgNhfuST.js';
|
|
3
|
+
export { DataProviderRoot, DataProviderRootProps, GenesisProvider, GenesisProviderProps, MockProviderOptions, PostgrestFieldErrors, SupabaseClient, SupabaseClientInput, SupabaseProviderOptions, SupabaseResourceConfig, SupabaseWriteContext, createMockProvider, createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, useDataProvider, useStorage, writeOutcomeFromCode } from './provider/index.js';
|
|
4
4
|
export { S as StorageAdapter } from './types-DKcxHXxq.js';
|
|
5
5
|
export { createLocalStorageAdapter, createMemoryStorageAdapter, createNoopStorageAdapter } from './storage/index.js';
|
|
6
6
|
export { UseResourceOptions, UseResourceReturn, useResource } from './hooks/use-resource.js';
|
|
7
7
|
export { UseOneOptions, useOne } from './hooks/use-one.js';
|
|
8
|
+
export { useCapabilities } from './hooks/use-capabilities.js';
|
|
8
9
|
export { UseResourceFormOptions, UseResourceFormReturn, buildArrayItemDefaults, useResourceForm } from './hooks/use-resource-form.js';
|
|
9
10
|
export { UseWizardReturn, WizardStep, useWizard } from './hooks/use-wizard.js';
|
|
11
|
+
export { DEFAULT_UNDO_DELAY_MS, MutationMode, MutationModeOptions, UndoableWrite, pendingWriteCount } from './hooks/mutation-mode.js';
|
|
12
|
+
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, UseUnsavedChangesGuardOptions, UseUnsavedChangesGuardReturn, useUnsavedChangesGuard } from './hooks/use-unsaved-changes-guard.js';
|
|
10
13
|
export { FieldType, ResourceFormFieldDef, SelectOption, FieldType as WidgetHint } from './form-types.js';
|
|
14
|
+
export { A as AuditEntry, D as DataRow, F as FieldPermissions, a as FieldReference, b as FieldSchema, c as FilterOperator, P as ProviderCapabilities, R as RecordComment, d as ResourceAccess, e as ResourceContract, f as ResourceRelation, g as ResourceSchema, h as ResourceSummary, i as RowAction, S as StorageType, V as VersionField } from './types-5cuflvha.js';
|
|
11
15
|
export { decodeRecordKey, encodeRecordKey, keyFields } from './schema/index.js';
|
|
12
16
|
export { titleCase } from './utils.js';
|
|
13
17
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
export { createSupabaseProvider, toDataWriteError, writeOutcomeFromCode } from './chunk-
|
|
1
|
+
export { createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, writeOutcomeFromCode } from './chunk-E5VYFAQO.js';
|
|
2
2
|
export { decodeRecordKey, encodeRecordKey, keyFields } from './chunk-KV2HW4G4.js';
|
|
3
|
-
export {
|
|
3
|
+
export { DataReadError, isDataReadError, readFailureMessage } from './chunk-HUNGCTRA.js';
|
|
4
4
|
import './chunk-XCX2TRBL.js';
|
|
5
5
|
import './chunk-65SXNHWE.js';
|
|
6
|
-
import './chunk-
|
|
6
|
+
import './chunk-HT43MPKW.js';
|
|
7
|
+
export { buildArrayItemDefaults, useResourceForm } from './chunk-3JSFTLDV.js';
|
|
8
|
+
export { useResource } from './chunk-6Q477CHB.js';
|
|
9
|
+
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from './chunk-XQO4OH2N.js';
|
|
7
10
|
export { useWizard } from './chunk-7KOLYF27.js';
|
|
8
|
-
export {
|
|
11
|
+
export { DataWriteError, isDataWriteError } from './chunk-5NHR6ZXS.js';
|
|
9
12
|
export { titleCase } from './chunk-RYEXWQFD.js';
|
|
10
|
-
export {
|
|
11
|
-
export { useResource } from './chunk-P4OIIRQS.js';
|
|
13
|
+
export { DEFAULT_UNDO_DELAY_MS, pendingWriteCount } from './chunk-F3BE7NGM.js';
|
|
12
14
|
import './chunk-7NUL32W7.js';
|
|
15
|
+
export { useCapabilities } from './chunk-BQOJX67X.js';
|
|
16
|
+
export { useOne } from './chunk-ZK5C3OOT.js';
|
|
13
17
|
export { DataProviderRoot, GenesisProvider, createMockProvider, useDataProvider, useStorage } from './chunk-GGSXSI6Z.js';
|
|
14
18
|
export { createLocalStorageAdapter, createMemoryStorageAdapter, createNoopStorageAdapter } from './chunk-ZYJUEJ4Z.js';
|
|
15
19
|
//# sourceMappingURL=index.js.map
|