houdini-react 1.3.14 → 2.0.0-go.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/build/houdini-react/package.json +92 -0
- package/build/houdini-react/postInstall.js +117 -0
- package/build/houdini-react/runtime/client.ts +5 -0
- package/build/houdini-react/runtime/clientPlugin.ts +17 -0
- package/build/houdini-react/runtime/componentFields.ts +79 -0
- package/build/houdini-react/runtime/hooks/index.ts +9 -0
- package/build/houdini-react/runtime/hooks/useDeepCompareEffect.ts +89 -0
- package/build/houdini-react/runtime/hooks/useDocumentHandle.ts +224 -0
- package/build/houdini-react/runtime/hooks/useDocumentStore.ts +76 -0
- package/build/houdini-react/runtime/hooks/useDocumentSubscription.ts +62 -0
- package/build/houdini-react/runtime/hooks/useFragment.ts +102 -0
- package/build/houdini-react/runtime/hooks/useFragmentHandle.ts +47 -0
- package/build/houdini-react/runtime/hooks/useIsMounted.ts +14 -0
- package/build/houdini-react/runtime/hooks/useMutation.ts +54 -0
- package/build/houdini-react/runtime/hooks/useQuery.ts +17 -0
- package/build/houdini-react/runtime/hooks/useQueryHandle.ts +184 -0
- package/build/houdini-react/runtime/hooks/useSubscription.ts +12 -0
- package/build/houdini-react/runtime/hooks/useSubscriptionHandle.ts +33 -0
- package/build/houdini-react/runtime/index.tsx +49 -0
- package/build/houdini-react/runtime/manifest.ts +6 -0
- package/build/houdini-react/runtime/routing/Router.tsx +887 -0
- package/build/houdini-react/runtime/routing/cache.ts +52 -0
- package/build/houdini-react/runtime/routing/index.ts +2 -0
- package/build/houdini-react/shim.cjs +64 -0
- package/build/houdini-react/vite/index.d.ts +3 -0
- package/build/houdini-react/vite/index.js +11 -0
- package/build/houdini-react-darwin-arm64/bin/houdini-react +0 -0
- package/build/houdini-react-darwin-arm64/package.json +11 -0
- package/build/houdini-react-darwin-x64/bin/houdini-react +0 -0
- package/build/houdini-react-darwin-x64/package.json +11 -0
- package/build/houdini-react-linux-arm64/bin/houdini-react +0 -0
- package/build/houdini-react-linux-arm64/package.json +11 -0
- package/build/houdini-react-linux-x64/bin/houdini-react +0 -0
- package/build/houdini-react-linux-x64/package.json +11 -0
- package/build/houdini-react-windows-arm64/bin/houdini-react.exe +0 -0
- package/build/houdini-react-windows-arm64/package.json +11 -0
- package/build/houdini-react-windows-x64/bin/houdini-react.exe +0 -0
- package/build/houdini-react-windows-x64/package.json +11 -0
- package/build/package.json +91 -0
- package/package.json +6 -6
- package/build/plugin/codegen/entries/documentWrappers.d.ts +0 -6
- package/build/plugin/codegen/entries/fallbacks.d.ts +0 -5
- package/build/plugin/codegen/entries/index.d.ts +0 -16
- package/build/plugin/codegen/entries/pages.d.ts +0 -2
- package/build/plugin/codegen/index.d.ts +0 -17
- package/build/plugin/codegen/manifest.d.ts +0 -5
- package/build/plugin/codegen/render.d.ts +0 -7
- package/build/plugin/codegen/router.d.ts +0 -7
- package/build/plugin/codegen/typeRoot.d.ts +0 -5
- package/build/plugin/config.d.ts +0 -4
- package/build/plugin/dedent.d.ts +0 -1
- package/build/plugin/extract.d.ts +0 -6
- package/build/plugin/index.d.ts +0 -5
- package/build/plugin/state.d.ts +0 -3
- package/build/plugin/transform.d.ts +0 -6
- package/build/plugin/vite.d.ts +0 -70
- package/build/plugin-cjs/index.js +0 -84192
- package/build/plugin-cjs/package.json +0 -1
- package/build/plugin-esm/index.js +0 -84184
- package/build/runtime/client.d.ts +0 -3
- package/build/runtime/clientPlugin.d.ts +0 -3
- package/build/runtime/componentFields.d.ts +0 -9
- package/build/runtime/hooks/index.d.ts +0 -8
- package/build/runtime/hooks/useDeepCompareEffect.d.ts +0 -35
- package/build/runtime/hooks/useDocumentHandle.d.ts +0 -36
- package/build/runtime/hooks/useDocumentStore.d.ts +0 -11
- package/build/runtime/hooks/useDocumentSubscription.d.ts +0 -11
- package/build/runtime/hooks/useFragment.d.ts +0 -16
- package/build/runtime/hooks/useFragmentHandle.d.ts +0 -8
- package/build/runtime/hooks/useIsMounted.d.ts +0 -3
- package/build/runtime/hooks/useMutation.d.ts +0 -11
- package/build/runtime/hooks/useQuery.d.ts +0 -5
- package/build/runtime/hooks/useQueryHandle.d.ts +0 -10
- package/build/runtime/hooks/useSubscription.d.ts +0 -4
- package/build/runtime/hooks/useSubscriptionHandle.d.ts +0 -25
- package/build/runtime/index.d.ts +0 -14
- package/build/runtime/manifest.d.ts +0 -3
- package/build/runtime/routing/Router.d.ts +0 -62
- package/build/runtime/routing/cache.d.ts +0 -7
- package/build/runtime/routing/hooks.d.ts +0 -40
- package/build/runtime/routing/index.d.ts +0 -3
- package/build/runtime-cjs/client.d.ts +0 -3
- package/build/runtime-cjs/client.js +0 -27
- package/build/runtime-cjs/clientPlugin.d.ts +0 -3
- package/build/runtime-cjs/clientPlugin.js +0 -39
- package/build/runtime-cjs/componentFields.d.ts +0 -9
- package/build/runtime-cjs/componentFields.js +0 -83
- package/build/runtime-cjs/hooks/index.d.ts +0 -8
- package/build/runtime-cjs/hooks/index.js +0 -45
- package/build/runtime-cjs/hooks/useDeepCompareEffect.d.ts +0 -35
- package/build/runtime-cjs/hooks/useDeepCompareEffect.js +0 -72
- package/build/runtime-cjs/hooks/useDocumentHandle.d.ts +0 -36
- package/build/runtime-cjs/hooks/useDocumentHandle.js +0 -173
- package/build/runtime-cjs/hooks/useDocumentStore.d.ts +0 -11
- package/build/runtime-cjs/hooks/useDocumentStore.js +0 -72
- package/build/runtime-cjs/hooks/useDocumentSubscription.d.ts +0 -11
- package/build/runtime-cjs/hooks/useDocumentSubscription.js +0 -71
- package/build/runtime-cjs/hooks/useFragment.d.ts +0 -16
- package/build/runtime-cjs/hooks/useFragment.js +0 -97
- package/build/runtime-cjs/hooks/useFragmentHandle.d.ts +0 -8
- package/build/runtime-cjs/hooks/useFragmentHandle.js +0 -47
- package/build/runtime-cjs/hooks/useIsMounted.d.ts +0 -3
- package/build/runtime-cjs/hooks/useIsMounted.js +0 -38
- package/build/runtime-cjs/hooks/useMutation.d.ts +0 -11
- package/build/runtime-cjs/hooks/useMutation.js +0 -52
- package/build/runtime-cjs/hooks/useQuery.d.ts +0 -5
- package/build/runtime-cjs/hooks/useQuery.js +0 -32
- package/build/runtime-cjs/hooks/useQueryHandle.d.ts +0 -10
- package/build/runtime-cjs/hooks/useQueryHandle.js +0 -125
- package/build/runtime-cjs/hooks/useSubscription.d.ts +0 -4
- package/build/runtime-cjs/hooks/useSubscription.js +0 -32
- package/build/runtime-cjs/hooks/useSubscriptionHandle.d.ts +0 -25
- package/build/runtime-cjs/hooks/useSubscriptionHandle.js +0 -42
- package/build/runtime-cjs/index.d.ts +0 -14
- package/build/runtime-cjs/index.js +0 -83
- package/build/runtime-cjs/manifest.d.ts +0 -3
- package/build/runtime-cjs/manifest.js +0 -27
- package/build/runtime-cjs/package.json +0 -1
- package/build/runtime-cjs/routing/Router.d.ts +0 -62
- package/build/runtime-cjs/routing/Router.js +0 -532
- package/build/runtime-cjs/routing/cache.d.ts +0 -7
- package/build/runtime-cjs/routing/cache.js +0 -58
- package/build/runtime-cjs/routing/hooks.d.ts +0 -40
- package/build/runtime-cjs/routing/hooks.js +0 -89
- package/build/runtime-cjs/routing/index.d.ts +0 -3
- package/build/runtime-cjs/routing/index.js +0 -31
- package/build/runtime-esm/client.d.ts +0 -3
- package/build/runtime-esm/client.js +0 -5
- package/build/runtime-esm/clientPlugin.d.ts +0 -3
- package/build/runtime-esm/clientPlugin.js +0 -17
- package/build/runtime-esm/componentFields.d.ts +0 -9
- package/build/runtime-esm/componentFields.js +0 -59
- package/build/runtime-esm/hooks/index.d.ts +0 -8
- package/build/runtime-esm/hooks/index.js +0 -16
- package/build/runtime-esm/hooks/useDeepCompareEffect.d.ts +0 -35
- package/build/runtime-esm/hooks/useDeepCompareEffect.js +0 -41
- package/build/runtime-esm/hooks/useDocumentHandle.d.ts +0 -36
- package/build/runtime-esm/hooks/useDocumentHandle.js +0 -143
- package/build/runtime-esm/hooks/useDocumentStore.d.ts +0 -11
- package/build/runtime-esm/hooks/useDocumentStore.js +0 -42
- package/build/runtime-esm/hooks/useDocumentSubscription.d.ts +0 -11
- package/build/runtime-esm/hooks/useDocumentSubscription.js +0 -41
- package/build/runtime-esm/hooks/useFragment.d.ts +0 -16
- package/build/runtime-esm/hooks/useFragment.js +0 -66
- package/build/runtime-esm/hooks/useFragmentHandle.d.ts +0 -8
- package/build/runtime-esm/hooks/useFragmentHandle.js +0 -23
- package/build/runtime-esm/hooks/useIsMounted.d.ts +0 -3
- package/build/runtime-esm/hooks/useIsMounted.js +0 -14
- package/build/runtime-esm/hooks/useMutation.d.ts +0 -11
- package/build/runtime-esm/hooks/useMutation.js +0 -28
- package/build/runtime-esm/hooks/useQuery.d.ts +0 -5
- package/build/runtime-esm/hooks/useQuery.js +0 -8
- package/build/runtime-esm/hooks/useQueryHandle.d.ts +0 -10
- package/build/runtime-esm/hooks/useQueryHandle.js +0 -95
- package/build/runtime-esm/hooks/useSubscription.d.ts +0 -4
- package/build/runtime-esm/hooks/useSubscription.js +0 -8
- package/build/runtime-esm/hooks/useSubscriptionHandle.d.ts +0 -25
- package/build/runtime-esm/hooks/useSubscriptionHandle.js +0 -18
- package/build/runtime-esm/index.d.ts +0 -14
- package/build/runtime-esm/index.js +0 -48
- package/build/runtime-esm/manifest.d.ts +0 -3
- package/build/runtime-esm/manifest.js +0 -5
- package/build/runtime-esm/routing/Router.d.ts +0 -62
- package/build/runtime-esm/routing/Router.js +0 -495
- package/build/runtime-esm/routing/cache.d.ts +0 -7
- package/build/runtime-esm/routing/cache.js +0 -33
- package/build/runtime-esm/routing/hooks.d.ts +0 -40
- package/build/runtime-esm/routing/hooks.js +0 -53
- package/build/runtime-esm/routing/index.d.ts +0 -3
- package/build/runtime-esm/routing/index.js +0 -6
- package/build/server-cjs/index.js +0 -28
- package/build/server-cjs/package.json +0 -1
- /package/build/{plugin-esm → houdini-react/runtime}/package.json +0 -0
- /package/build/{server → houdini-react/server}/index.d.ts +0 -0
- /package/build/{server-esm → houdini-react/server}/index.js +0 -0
- /package/build/{runtime-esm → houdini-react/server}/package.json +0 -0
- /package/build/{server-esm → houdini-react/vite}/package.json +0 -0
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var useDeepCompareEffect_exports = {};
|
|
26
|
-
__export(useDeepCompareEffect_exports, {
|
|
27
|
-
default: () => useDeepCompareEffect_default,
|
|
28
|
-
useDeepCompareEffectNoCheck: () => useDeepCompareEffectNoCheck,
|
|
29
|
-
useDeepCompareMemoize: () => useDeepCompareMemoize
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(useDeepCompareEffect_exports);
|
|
32
|
-
var import_deepEquals = require("$houdini/runtime/lib/deepEquals");
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
function checkDeps(deps) {
|
|
35
|
-
if (!deps || !deps.length) {
|
|
36
|
-
throw new Error(
|
|
37
|
-
"useDeepCompareEffect should not be used with no dependencies. Use React.useEffect instead."
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
if (deps.every(isPrimitive)) {
|
|
41
|
-
throw new Error(
|
|
42
|
-
"useDeepCompareEffect should not be used with dependencies that are all primitive values. Use React.useEffect instead."
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function isPrimitive(val) {
|
|
47
|
-
return val == null || /^[sbn]/.test(typeof val);
|
|
48
|
-
}
|
|
49
|
-
function useDeepCompareMemoize(value) {
|
|
50
|
-
const ref = React.useRef(value);
|
|
51
|
-
const signalRef = React.useRef(0);
|
|
52
|
-
if (!(0, import_deepEquals.deepEquals)(value, ref.current)) {
|
|
53
|
-
ref.current = value;
|
|
54
|
-
signalRef.current += 1;
|
|
55
|
-
}
|
|
56
|
-
return React.useMemo(() => ref.current, [signalRef.current]);
|
|
57
|
-
}
|
|
58
|
-
function useDeepCompareEffect(callback, dependencies) {
|
|
59
|
-
if (process.env.NODE_ENV !== "production") {
|
|
60
|
-
checkDeps(dependencies);
|
|
61
|
-
}
|
|
62
|
-
return React.useEffect(callback, useDeepCompareMemoize(dependencies));
|
|
63
|
-
}
|
|
64
|
-
function useDeepCompareEffectNoCheck(callback, dependencies) {
|
|
65
|
-
return React.useEffect(callback, useDeepCompareMemoize(dependencies));
|
|
66
|
-
}
|
|
67
|
-
var useDeepCompareEffect_default = useDeepCompareEffect;
|
|
68
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
-
0 && (module.exports = {
|
|
70
|
-
useDeepCompareEffectNoCheck,
|
|
71
|
-
useDeepCompareMemoize
|
|
72
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { DocumentStore } from '$houdini/runtime/client';
|
|
2
|
-
import type { GraphQLObject, GraphQLVariables, CursorHandlers, OffsetHandlers, PageInfo, FetchFn, QueryResult, DocumentArtifact, QueryArtifact } from '$houdini/runtime/lib/types';
|
|
3
|
-
export declare function useDocumentHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject, _Input extends GraphQLVariables>({ artifact, observer, storeValue, }: {
|
|
4
|
-
artifact: DocumentArtifact;
|
|
5
|
-
observer: DocumentStore<_Data, _Input>;
|
|
6
|
-
storeValue: QueryResult<_Data, _Input>;
|
|
7
|
-
}): DocumentHandle<_Artifact, _Data, _Input> & {
|
|
8
|
-
fetch: FetchFn<_Data, _Input>;
|
|
9
|
-
};
|
|
10
|
-
export type DocumentHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables> = {
|
|
11
|
-
data: _Data;
|
|
12
|
-
partial: boolean;
|
|
13
|
-
fetch: FetchFn<_Data, Partial<_Input>>;
|
|
14
|
-
variables: _Input;
|
|
15
|
-
} & RefetchHandlers<_Artifact, _Data, _Input>;
|
|
16
|
-
type RefetchHandlers<_Artifact extends QueryArtifact, _Data extends GraphQLObject, _Input> = _Artifact extends {
|
|
17
|
-
refetch: {
|
|
18
|
-
paginated: true;
|
|
19
|
-
method: 'cursor';
|
|
20
|
-
};
|
|
21
|
-
} ? {
|
|
22
|
-
loadNext: CursorHandlers<_Data, _Input>['loadNextPage'];
|
|
23
|
-
loadNextPending: boolean;
|
|
24
|
-
loadPrevious: CursorHandlers<_Data, _Input>['loadPreviousPage'];
|
|
25
|
-
loadPreviousPending: boolean;
|
|
26
|
-
pageInfo: PageInfo;
|
|
27
|
-
} : _Artifact extends {
|
|
28
|
-
refetch: {
|
|
29
|
-
paginated: true;
|
|
30
|
-
method: 'offset';
|
|
31
|
-
};
|
|
32
|
-
} ? {
|
|
33
|
-
loadNext: OffsetHandlers<_Data, _Input>['loadNextPage'];
|
|
34
|
-
loadNextPending: boolean;
|
|
35
|
-
} : {};
|
|
36
|
-
export {};
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var useDocumentHandle_exports = {};
|
|
26
|
-
__export(useDocumentHandle_exports, {
|
|
27
|
-
useDocumentHandle: () => useDocumentHandle
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(useDocumentHandle_exports);
|
|
30
|
-
var import_pageInfo = require("$houdini/runtime/lib/pageInfo");
|
|
31
|
-
var import_pagination = require("$houdini/runtime/lib/pagination");
|
|
32
|
-
var import_types = require("$houdini/runtime/lib/types");
|
|
33
|
-
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_hooks = require("../routing/hooks");
|
|
35
|
-
function useDocumentHandle({
|
|
36
|
-
artifact,
|
|
37
|
-
observer,
|
|
38
|
-
storeValue
|
|
39
|
-
}) {
|
|
40
|
-
const [forwardPending, setForwardPending] = import_react.default.useState(false);
|
|
41
|
-
const [backwardPending, setBackwardPending] = import_react.default.useState(false);
|
|
42
|
-
const location = (0, import_hooks.useLocation)();
|
|
43
|
-
const [session] = (0, import_hooks.useSession)();
|
|
44
|
-
const client = (0, import_hooks.useClient)();
|
|
45
|
-
const paginationObserver = import_react.default.useMemo(() => {
|
|
46
|
-
if (!artifact.refetch?.paginated) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
return client.observe({ artifact });
|
|
50
|
-
}, [artifact.name]);
|
|
51
|
-
return import_react.default.useMemo(() => {
|
|
52
|
-
const wrapLoad = (setLoading, fn) => {
|
|
53
|
-
return async (value) => {
|
|
54
|
-
setLoading(true);
|
|
55
|
-
let result = null;
|
|
56
|
-
let err = null;
|
|
57
|
-
try {
|
|
58
|
-
result = await fn(value);
|
|
59
|
-
} catch (e) {
|
|
60
|
-
err = e;
|
|
61
|
-
}
|
|
62
|
-
setLoading(false);
|
|
63
|
-
if (err && err.name !== "AbortError") {
|
|
64
|
-
throw err;
|
|
65
|
-
}
|
|
66
|
-
return result || observer.state;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
const fetchQuery = (args) => {
|
|
70
|
-
const usedVariables = Object.fromEntries(
|
|
71
|
-
Object.keys(observer.artifact.input?.fields ?? {}).reduce(
|
|
72
|
-
(entries, fieldName) => {
|
|
73
|
-
if (!(fieldName in location.params)) {
|
|
74
|
-
return entries;
|
|
75
|
-
}
|
|
76
|
-
return [...entries, [fieldName, location.params[fieldName]]];
|
|
77
|
-
},
|
|
78
|
-
[]
|
|
79
|
-
)
|
|
80
|
-
);
|
|
81
|
-
return observer.send({
|
|
82
|
-
...args,
|
|
83
|
-
variables: {
|
|
84
|
-
...usedVariables,
|
|
85
|
-
...args?.variables
|
|
86
|
-
},
|
|
87
|
-
session
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
if (artifact.kind !== import_types.ArtifactKind.Query || !artifact.refetch?.paginated) {
|
|
91
|
-
return {
|
|
92
|
-
artifact,
|
|
93
|
-
data: storeValue.data,
|
|
94
|
-
variables: storeValue.variables,
|
|
95
|
-
fetch: fetchQuery,
|
|
96
|
-
partial: storeValue.partial
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
if (artifact.refetch.method === "cursor") {
|
|
100
|
-
const handlers = (0, import_pagination.cursorHandlers)({
|
|
101
|
-
artifact,
|
|
102
|
-
getState: () => storeValue.data,
|
|
103
|
-
getVariables: () => storeValue.variables,
|
|
104
|
-
fetch: fetchQuery,
|
|
105
|
-
fetchUpdate: (args, updates) => {
|
|
106
|
-
return paginationObserver.send({
|
|
107
|
-
...args,
|
|
108
|
-
cacheParams: {
|
|
109
|
-
...args?.cacheParams,
|
|
110
|
-
disableSubscriptions: true,
|
|
111
|
-
applyUpdates: updates
|
|
112
|
-
},
|
|
113
|
-
session
|
|
114
|
-
});
|
|
115
|
-
},
|
|
116
|
-
getSession: async () => session
|
|
117
|
-
});
|
|
118
|
-
return {
|
|
119
|
-
artifact,
|
|
120
|
-
data: storeValue.data,
|
|
121
|
-
variables: storeValue.variables,
|
|
122
|
-
fetch: handlers.fetch,
|
|
123
|
-
partial: storeValue.partial,
|
|
124
|
-
loadNext: wrapLoad(setForwardPending, handlers.loadNextPage),
|
|
125
|
-
loadNextPending: forwardPending,
|
|
126
|
-
loadPrevious: wrapLoad(setBackwardPending, handlers.loadPreviousPage),
|
|
127
|
-
loadPreviousPending: backwardPending,
|
|
128
|
-
pageInfo: (0, import_pageInfo.extractPageInfo)(storeValue.data, artifact.refetch.path)
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
if (artifact.refetch.method === "offset") {
|
|
132
|
-
const handlers = (0, import_pagination.offsetHandlers)({
|
|
133
|
-
artifact,
|
|
134
|
-
getState: () => storeValue.data,
|
|
135
|
-
getVariables: () => storeValue.variables,
|
|
136
|
-
storeName: artifact.name,
|
|
137
|
-
fetch: fetchQuery,
|
|
138
|
-
fetchUpdate: async (args, updates = ["append"]) => {
|
|
139
|
-
return paginationObserver.send({
|
|
140
|
-
...args,
|
|
141
|
-
cacheParams: {
|
|
142
|
-
disableSubscriptions: true,
|
|
143
|
-
applyUpdates: updates,
|
|
144
|
-
...args?.cacheParams
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
},
|
|
148
|
-
getSession: async () => session
|
|
149
|
-
});
|
|
150
|
-
return {
|
|
151
|
-
artifact,
|
|
152
|
-
data: storeValue.data,
|
|
153
|
-
variables: storeValue.variables,
|
|
154
|
-
fetch: handlers.fetch,
|
|
155
|
-
partial: storeValue.partial,
|
|
156
|
-
loadNext: wrapLoad(setForwardPending, handlers.loadNextPage),
|
|
157
|
-
loadNextPending: forwardPending
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
return {
|
|
161
|
-
artifact,
|
|
162
|
-
data: storeValue.data,
|
|
163
|
-
variables: storeValue.variables,
|
|
164
|
-
fetch: fetchQuery,
|
|
165
|
-
refetch: fetchQuery,
|
|
166
|
-
partial: storeValue.partial
|
|
167
|
-
};
|
|
168
|
-
}, [artifact, observer, session, storeValue]);
|
|
169
|
-
}
|
|
170
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
171
|
-
0 && (module.exports = {
|
|
172
|
-
useDocumentHandle
|
|
173
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DocumentArtifact, GraphQLVariables, QueryResult } from '$houdini/lib/types';
|
|
2
|
-
import type { DocumentStore, ObserveParams } from '$houdini/runtime/client';
|
|
3
|
-
import type { GraphQLObject } from 'houdini';
|
|
4
|
-
export type UseDocumentStoreParams<_Artifact extends DocumentArtifact, _Data extends GraphQLObject, _Input extends GraphQLVariables> = {
|
|
5
|
-
artifact: _Artifact;
|
|
6
|
-
observer?: DocumentStore<_Data, _Input>;
|
|
7
|
-
} & Partial<ObserveParams<_Data, DocumentArtifact, _Input>>;
|
|
8
|
-
export declare function useDocumentStore<_Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables, _Artifact extends DocumentArtifact = DocumentArtifact>({ artifact, observer: obs, ...observeParams }: UseDocumentStoreParams<_Artifact, _Data, _Input>): [
|
|
9
|
-
QueryResult<_Data, _Input>,
|
|
10
|
-
DocumentStore<_Data, _Input>
|
|
11
|
-
];
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var useDocumentStore_exports = {};
|
|
26
|
-
__export(useDocumentStore_exports, {
|
|
27
|
-
useDocumentStore: () => useDocumentStore
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(useDocumentStore_exports);
|
|
30
|
-
var React = __toESM(require("react"));
|
|
31
|
-
var import_hooks = require("../routing/hooks");
|
|
32
|
-
var import_useIsMounted = require("./useIsMounted");
|
|
33
|
-
function useDocumentStore({
|
|
34
|
-
artifact,
|
|
35
|
-
observer: obs,
|
|
36
|
-
...observeParams
|
|
37
|
-
}) {
|
|
38
|
-
const client = (0, import_hooks.useClient)();
|
|
39
|
-
const isMountedRef = (0, import_useIsMounted.useIsMountedRef)();
|
|
40
|
-
let [observer, setObserver] = React.useState(
|
|
41
|
-
() => obs ?? client.observe({
|
|
42
|
-
artifact,
|
|
43
|
-
...observeParams
|
|
44
|
-
})
|
|
45
|
-
);
|
|
46
|
-
const box = React.useRef(observer.state);
|
|
47
|
-
if (obs && obs !== observer) {
|
|
48
|
-
box.current = obs.state;
|
|
49
|
-
setObserver(obs);
|
|
50
|
-
}
|
|
51
|
-
const subscribe = React.useCallback(
|
|
52
|
-
(fn) => {
|
|
53
|
-
return observer.subscribe((val) => {
|
|
54
|
-
box.current = val;
|
|
55
|
-
if (isMountedRef.current) {
|
|
56
|
-
fn();
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
},
|
|
60
|
-
[observer]
|
|
61
|
-
);
|
|
62
|
-
const storeValue = React.useSyncExternalStore(
|
|
63
|
-
subscribe,
|
|
64
|
-
() => box.current,
|
|
65
|
-
() => box.current
|
|
66
|
-
);
|
|
67
|
-
return [storeValue, observer];
|
|
68
|
-
}
|
|
69
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
-
0 && (module.exports = {
|
|
71
|
-
useDocumentStore
|
|
72
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DocumentArtifact, GraphQLVariables, QueryResult } from '$houdini/lib/types';
|
|
2
|
-
import type { DocumentStore, SendParams } from '$houdini/runtime/client';
|
|
3
|
-
import type { GraphQLObject } from 'houdini';
|
|
4
|
-
import { type UseDocumentStoreParams } from './useDocumentStore';
|
|
5
|
-
export declare function useDocumentSubscription<_Artifact extends DocumentArtifact = DocumentArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables>({ artifact, variables, send, disabled, ...observeParams }: UseDocumentStoreParams<_Artifact, _Data, _Input> & {
|
|
6
|
-
variables: _Input;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
send?: Partial<SendParams>;
|
|
9
|
-
}): [QueryResult<_Data, _Input> & {
|
|
10
|
-
parent?: string | null;
|
|
11
|
-
}, DocumentStore<_Data, _Input>];
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var useDocumentSubscription_exports = {};
|
|
26
|
-
__export(useDocumentSubscription_exports, {
|
|
27
|
-
useDocumentSubscription: () => useDocumentSubscription
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(useDocumentSubscription_exports);
|
|
30
|
-
var import_hooks = require("../routing/hooks");
|
|
31
|
-
var import_useDeepCompareEffect = __toESM(require("./useDeepCompareEffect"));
|
|
32
|
-
var import_useDocumentStore = require("./useDocumentStore");
|
|
33
|
-
function useDocumentSubscription({
|
|
34
|
-
artifact,
|
|
35
|
-
variables,
|
|
36
|
-
send,
|
|
37
|
-
disabled,
|
|
38
|
-
...observeParams
|
|
39
|
-
}) {
|
|
40
|
-
const [storeValue, observer] = (0, import_useDocumentStore.useDocumentStore)({
|
|
41
|
-
artifact,
|
|
42
|
-
...observeParams
|
|
43
|
-
});
|
|
44
|
-
const [session] = (0, import_hooks.useSession)();
|
|
45
|
-
(0, import_useDeepCompareEffect.default)(() => {
|
|
46
|
-
if (!disabled) {
|
|
47
|
-
observer.send({
|
|
48
|
-
variables,
|
|
49
|
-
session,
|
|
50
|
-
metadata: {},
|
|
51
|
-
...send
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
return () => {
|
|
55
|
-
if (!disabled) {
|
|
56
|
-
observer.cleanup();
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}, [disabled, session, observer, variables ?? {}, send ?? {}]);
|
|
60
|
-
return [
|
|
61
|
-
{
|
|
62
|
-
parent: send?.stuff?.parentID,
|
|
63
|
-
...storeValue
|
|
64
|
-
},
|
|
65
|
-
observer
|
|
66
|
-
];
|
|
67
|
-
}
|
|
68
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
-
0 && (module.exports = {
|
|
70
|
-
useDocumentSubscription
|
|
71
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { fragmentKey } from '$houdini/runtime/lib/types';
|
|
2
|
-
import type { GraphQLObject, GraphQLVariables, FragmentArtifact } from '$houdini/runtime/lib/types';
|
|
3
|
-
export declare function useFragment<_Data extends GraphQLObject, _ReferenceType extends {}, _Input extends GraphQLVariables = GraphQLVariables>(reference: _Data | {
|
|
4
|
-
[fragmentKey]: _ReferenceType;
|
|
5
|
-
} | null, document: {
|
|
6
|
-
artifact: FragmentArtifact;
|
|
7
|
-
}): _Data | null;
|
|
8
|
-
export declare function fragmentReference<_Data extends GraphQLObject, _Input, _ReferenceType extends {}>(reference: _Data | {
|
|
9
|
-
[fragmentKey]: _ReferenceType;
|
|
10
|
-
} | null, document: {
|
|
11
|
-
artifact: FragmentArtifact;
|
|
12
|
-
}): {
|
|
13
|
-
variables: _Input;
|
|
14
|
-
parent: string;
|
|
15
|
-
loading: boolean;
|
|
16
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var useFragment_exports = {};
|
|
26
|
-
__export(useFragment_exports, {
|
|
27
|
-
fragmentReference: () => fragmentReference,
|
|
28
|
-
useFragment: () => useFragment
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(useFragment_exports);
|
|
31
|
-
var import_deepEquals = require("$houdini/runtime/lib/deepEquals");
|
|
32
|
-
var import_types = require("$houdini/runtime/lib/types");
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_routing = require("../routing");
|
|
35
|
-
var import_useDeepCompareEffect = require("./useDeepCompareEffect");
|
|
36
|
-
var import_useDocumentSubscription = require("./useDocumentSubscription");
|
|
37
|
-
function useFragment(reference, document) {
|
|
38
|
-
const { cache } = (0, import_routing.useRouterContext)();
|
|
39
|
-
const { parent, variables, loading } = fragmentReference(
|
|
40
|
-
reference,
|
|
41
|
-
document
|
|
42
|
-
);
|
|
43
|
-
let cachedValue = reference;
|
|
44
|
-
if (reference && parent) {
|
|
45
|
-
cachedValue = cache.read({
|
|
46
|
-
selection: document.artifact.selection,
|
|
47
|
-
parent,
|
|
48
|
-
variables,
|
|
49
|
-
loading
|
|
50
|
-
}).data;
|
|
51
|
-
}
|
|
52
|
-
const [storeValue] = (0, import_useDocumentSubscription.useDocumentSubscription)({
|
|
53
|
-
artifact: document.artifact,
|
|
54
|
-
variables,
|
|
55
|
-
initialValue: cachedValue,
|
|
56
|
-
disabled: loading,
|
|
57
|
-
send: {
|
|
58
|
-
stuff: {
|
|
59
|
-
parentID: parent
|
|
60
|
-
},
|
|
61
|
-
setup: true
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
const lastReference = React.useRef(null);
|
|
65
|
-
return React.useMemo(() => {
|
|
66
|
-
const parentChange = storeValue.parent !== parent || !(0, import_deepEquals.deepEquals)({ parent, variables }, lastReference.current);
|
|
67
|
-
if (parentChange) {
|
|
68
|
-
lastReference.current = { parent, variables: { ...variables } };
|
|
69
|
-
return cachedValue;
|
|
70
|
-
}
|
|
71
|
-
return storeValue.data;
|
|
72
|
-
}, [
|
|
73
|
-
(0, import_useDeepCompareEffect.useDeepCompareMemoize)({
|
|
74
|
-
parent,
|
|
75
|
-
variables,
|
|
76
|
-
cachedValue,
|
|
77
|
-
storeValue: storeValue.data,
|
|
78
|
-
storeParent: storeValue.parent
|
|
79
|
-
})
|
|
80
|
-
]);
|
|
81
|
-
}
|
|
82
|
-
function fragmentReference(reference, document) {
|
|
83
|
-
const { variables, parent } = reference?.[import_types.fragmentKey]?.values?.[document.artifact.name] ?? {};
|
|
84
|
-
if (reference && import_types.fragmentKey in reference && (!variables || !parent)) {
|
|
85
|
-
console.warn(
|
|
86
|
-
`\u26A0\uFE0F Parent does not contain the information for this fragment. Something is wrong.
|
|
87
|
-
Please ensure that you have passed a record that has ${document.artifact.name} mixed into it.`
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
const loading = Boolean(reference?.[import_types.fragmentKey]?.loading);
|
|
91
|
-
return { variables, parent, loading };
|
|
92
|
-
}
|
|
93
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
-
0 && (module.exports = {
|
|
95
|
-
fragmentReference,
|
|
96
|
-
useFragment
|
|
97
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { GraphQLObject, FragmentArtifact, QueryArtifact, fragmentKey, GraphQLVariables } from '$houdini/runtime/lib/types';
|
|
2
|
-
import { type DocumentHandle } from './useDocumentHandle';
|
|
3
|
-
export declare function useFragmentHandle<_Artifact extends FragmentArtifact, _Data extends GraphQLObject, _ReferenceType extends {}, _PaginationArtifact extends QueryArtifact, _Input extends GraphQLVariables = GraphQLVariables>(reference: _Data | {
|
|
4
|
-
[fragmentKey]: _ReferenceType;
|
|
5
|
-
} | null, document: {
|
|
6
|
-
artifact: FragmentArtifact;
|
|
7
|
-
refetchArtifact?: QueryArtifact;
|
|
8
|
-
}): DocumentHandle<_PaginationArtifact, _Data, _Input>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var useFragmentHandle_exports = {};
|
|
20
|
-
__export(useFragmentHandle_exports, {
|
|
21
|
-
useFragmentHandle: () => useFragmentHandle
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useFragmentHandle_exports);
|
|
24
|
-
var import_useDocumentHandle = require("./useDocumentHandle");
|
|
25
|
-
var import_useDocumentStore = require("./useDocumentStore");
|
|
26
|
-
var import_useFragment = require("./useFragment");
|
|
27
|
-
function useFragmentHandle(reference, document) {
|
|
28
|
-
const data = (0, import_useFragment.useFragment)(reference, document);
|
|
29
|
-
const { variables } = (0, import_useFragment.fragmentReference)(reference, document);
|
|
30
|
-
const [handleValue, handleObserver] = (0, import_useDocumentStore.useDocumentStore)({
|
|
31
|
-
artifact: document.refetchArtifact ?? document.artifact
|
|
32
|
-
});
|
|
33
|
-
const handle = (0, import_useDocumentHandle.useDocumentHandle)({
|
|
34
|
-
observer: handleObserver,
|
|
35
|
-
storeValue: handleValue,
|
|
36
|
-
artifact: document.refetchArtifact ?? document.artifact
|
|
37
|
-
});
|
|
38
|
-
return {
|
|
39
|
-
...handle,
|
|
40
|
-
variables,
|
|
41
|
-
data
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
useFragmentHandle
|
|
47
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var useIsMounted_exports = {};
|
|
20
|
-
__export(useIsMounted_exports, {
|
|
21
|
-
useIsMountedRef: () => useIsMountedRef
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useIsMounted_exports);
|
|
24
|
-
var import_react = require("react");
|
|
25
|
-
function useIsMountedRef() {
|
|
26
|
-
const isMountedRef = (0, import_react.useRef)(true);
|
|
27
|
-
(0, import_react.useEffect)(() => {
|
|
28
|
-
isMountedRef.current = true;
|
|
29
|
-
return () => {
|
|
30
|
-
isMountedRef.current = false;
|
|
31
|
-
};
|
|
32
|
-
}, []);
|
|
33
|
-
return isMountedRef;
|
|
34
|
-
}
|
|
35
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
-
0 && (module.exports = {
|
|
37
|
-
useIsMountedRef
|
|
38
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { MutationArtifact, GraphQLObject, QueryResult, GraphQLVariables } from '$houdini/runtime/lib/types';
|
|
2
|
-
export type MutationHandler<_Result, _Input, _Optimistic extends GraphQLObject> = (args: {
|
|
3
|
-
variables: _Input;
|
|
4
|
-
metadata?: App.Metadata;
|
|
5
|
-
fetch?: typeof globalThis.fetch;
|
|
6
|
-
optimisticResponse?: _Optimistic;
|
|
7
|
-
abortController?: AbortController;
|
|
8
|
-
}) => Promise<QueryResult<_Result, _Input>>;
|
|
9
|
-
export declare function useMutation<_Result extends GraphQLObject, _Input extends GraphQLVariables, _Optimistic extends GraphQLObject>({ artifact, }: {
|
|
10
|
-
artifact: MutationArtifact;
|
|
11
|
-
}): [boolean, MutationHandler<_Result, _Input, _Optimistic>];
|