@cedarjs/web 9.0.0-canary.1784 → 9.0.0-canary.3124
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/dist/apollo/ApolloClientFactoryContext.d.ts +26 -0
- package/dist/apollo/ApolloClientFactoryContext.d.ts.map +1 -0
- package/dist/apollo/ApolloClientFactoryContext.js +5 -0
- package/dist/apollo/ApolloProviderWithFetchConfig.d.ts +21 -0
- package/dist/apollo/ApolloProviderWithFetchConfig.d.ts.map +1 -0
- package/dist/apollo/ApolloProviderWithFetchConfig.js +153 -0
- package/dist/apollo/CedarApolloProvider.d.ts +14 -0
- package/dist/apollo/CedarApolloProvider.d.ts.map +1 -0
- package/dist/apollo/CedarApolloProvider.js +39 -0
- package/dist/apollo/ErrorBoundary.d.ts +13 -0
- package/dist/apollo/ErrorBoundary.d.ts.map +1 -0
- package/dist/apollo/ErrorBoundary.js +13 -0
- package/dist/apollo/apolloLinkTypes.d.ts +60 -0
- package/dist/apollo/apolloLinkTypes.d.ts.map +1 -0
- package/dist/apollo/fragmentRegistry.d.ts +28 -3
- package/dist/apollo/fragmentRegistry.d.ts.map +1 -1
- package/dist/apollo/fragmentRegistry.js +52 -7
- package/dist/apollo/index.d.ts +54 -70
- package/dist/apollo/index.d.ts.map +1 -1
- package/dist/apollo/index.js +5 -185
- package/dist/apollo/links.d.ts +4 -5
- package/dist/apollo/links.d.ts.map +1 -1
- package/dist/apollo/links.js +7 -7
- package/dist/apollo/sseLink.d.ts +5 -8
- package/dist/apollo/sseLink.d.ts.map +1 -1
- package/dist/apollo/sseLink.js +9 -12
- package/dist/apollo/suspense.d.ts +20 -10
- package/dist/apollo/suspense.d.ts.map +1 -1
- package/dist/apollo/suspense.js +37 -28
- package/dist/apollo/useCache.d.ts +4 -6
- package/dist/apollo/useCache.d.ts.map +1 -1
- package/dist/apollo/useCache.js +1 -1
- package/dist/apollo/useCreateApolloClient.d.ts +11 -0
- package/dist/apollo/useCreateApolloClient.d.ts.map +1 -0
- package/dist/apollo/useCreateApolloClient.js +14 -0
- package/dist/bins/cedar.js +14 -0
- package/dist/bins/cfw.js +14 -0
- package/dist/bins/cross-env.js +8 -0
- package/dist/bins/msw.js +6 -0
- package/dist/bins/redwood.js +14 -0
- package/dist/bins/storybook.js +27 -0
- package/dist/bins/tsc.js +8 -0
- package/dist/bundled/apollo-upload-client.d.ts +2 -2
- package/dist/bundled/apollo-upload-client.d.ts.map +1 -1
- package/dist/bundled/apollo-upload-client.js +2728 -2
- package/dist/components/{RedwoodProvider.d.ts → CedarProvider.d.ts} +3 -1
- package/dist/components/CedarProvider.d.ts.map +1 -0
- package/dist/components/{RedwoodProvider.js → CedarProvider.js} +4 -3
- package/dist/components/DevFatalErrorPage.d.ts +3 -3
- package/dist/components/DevFatalErrorPage.d.ts.map +1 -1
- package/dist/components/DevFatalErrorPage.js +3 -3
- package/dist/components/FatalErrorBoundary.d.ts +1 -1
- package/dist/components/FetchConfigProvider.d.ts +3 -2
- package/dist/components/FetchConfigProvider.d.ts.map +1 -1
- package/dist/components/MetaTags.d.ts.map +1 -1
- package/dist/components/MetaTags.js +1 -2
- package/dist/components/Metadata.d.ts.map +1 -1
- package/dist/components/Metadata.js +1 -2
- package/dist/components/cell/CellErrorBoundary.d.ts +3 -2
- package/dist/components/cell/CellErrorBoundary.d.ts.map +1 -1
- package/dist/components/cell/cellTypes.d.ts +69 -21
- package/dist/components/cell/cellTypes.d.ts.map +1 -1
- package/dist/components/cell/createCell.d.ts +2 -7
- package/dist/components/cell/createCell.d.ts.map +1 -1
- package/dist/components/cell/createCell.js +84 -60
- package/dist/components/cell/createFragmentCell.d.ts +20 -0
- package/dist/components/cell/createFragmentCell.d.ts.map +1 -0
- package/dist/components/cell/createFragmentCell.js +75 -0
- package/dist/components/cell/createServerCell.d.ts +3 -2
- package/dist/components/cell/createServerCell.d.ts.map +1 -1
- package/dist/components/cell/createServerCell.js +4 -2
- package/dist/components/cell/createSuspendingCell.d.ts +2 -1
- package/dist/components/cell/createSuspendingCell.d.ts.map +1 -1
- package/dist/components/cell/createSuspendingCell.js +47 -35
- package/dist/global.web-auto-imports.d.ts +0 -16
- package/dist/global.web-auto-imports.d.ts.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -10
- package/package.json +70 -137
- package/LICENSE +0 -21
- package/apollo/index.js +0 -1
- package/apollo/package.json +0 -4
- package/dist/apollo/typeOverride.d.ts +0 -21
- package/dist/apollo/typeOverride.d.ts.map +0 -1
- package/dist/cjs/apollo/fragmentRegistry.d.ts +0 -43
- package/dist/cjs/apollo/fragmentRegistry.d.ts.map +0 -1
- package/dist/cjs/apollo/fragmentRegistry.js +0 -75
- package/dist/cjs/apollo/index.d.ts +0 -76
- package/dist/cjs/apollo/index.d.ts.map +0 -1
- package/dist/cjs/apollo/index.js +0 -218
- package/dist/cjs/apollo/links.d.ts +0 -27
- package/dist/cjs/apollo/links.d.ts.map +0 -1
- package/dist/cjs/apollo/links.js +0 -122
- package/dist/cjs/apollo/sseLink.d.ts +0 -29
- package/dist/cjs/apollo/sseLink.d.ts.map +0 -1
- package/dist/cjs/apollo/sseLink.js +0 -120
- package/dist/cjs/apollo/suspense.d.ts +0 -60
- package/dist/cjs/apollo/suspense.d.ts.map +0 -1
- package/dist/cjs/apollo/suspense.js +0 -127
- package/dist/cjs/apollo/typeOverride.d.ts +0 -21
- package/dist/cjs/apollo/typeOverride.d.ts.map +0 -1
- package/dist/cjs/apollo/typeOverride.js +0 -16
- package/dist/cjs/apollo/useCache.d.ts +0 -22
- package/dist/cjs/apollo/useCache.d.ts.map +0 -1
- package/dist/cjs/apollo/useCache.js +0 -49
- package/dist/cjs/bins/cedar.d.ts +0 -9
- package/dist/cjs/bins/cedar.d.ts.map +0 -1
- package/dist/cjs/bins/cedar.js +0 -36
- package/dist/cjs/bins/cfw.d.ts +0 -3
- package/dist/cjs/bins/cfw.d.ts.map +0 -1
- package/dist/cjs/bins/cfw.js +0 -36
- package/dist/cjs/bins/cross-env.d.ts +0 -3
- package/dist/cjs/bins/cross-env.d.ts.map +0 -1
- package/dist/cjs/bins/cross-env.js +0 -30
- package/dist/cjs/bins/msw.d.ts +0 -3
- package/dist/cjs/bins/msw.d.ts.map +0 -1
- package/dist/cjs/bins/msw.js +0 -28
- package/dist/cjs/bins/redwood.d.ts +0 -9
- package/dist/cjs/bins/redwood.d.ts.map +0 -1
- package/dist/cjs/bins/redwood.js +0 -36
- package/dist/cjs/bins/storybook.d.ts +0 -3
- package/dist/cjs/bins/storybook.d.ts.map +0 -1
- package/dist/cjs/bins/storybook.js +0 -49
- package/dist/cjs/bins/tsc.d.ts +0 -3
- package/dist/cjs/bins/tsc.d.ts.map +0 -1
- package/dist/cjs/bins/tsc.js +0 -30
- package/dist/cjs/bundled/apollo-upload-client.d.ts +0 -3
- package/dist/cjs/bundled/apollo-upload-client.d.ts.map +0 -1
- package/dist/cjs/bundled/apollo-upload-client.js +0 -2511
- package/dist/cjs/components/DevFatalErrorPage.d.ts +0 -21
- package/dist/cjs/components/DevFatalErrorPage.d.ts.map +0 -1
- package/dist/cjs/components/DevFatalErrorPage.js +0 -552
- package/dist/cjs/components/FatalErrorBoundary.d.ts +0 -24
- package/dist/cjs/components/FatalErrorBoundary.d.ts.map +0 -1
- package/dist/cjs/components/FatalErrorBoundary.js +0 -63
- package/dist/cjs/components/FetchConfigProvider.d.ts +0 -25
- package/dist/cjs/components/FetchConfigProvider.d.ts.map +0 -1
- package/dist/cjs/components/FetchConfigProvider.js +0 -80
- package/dist/cjs/components/GraphQLHooksProvider.d.ts +0 -45
- package/dist/cjs/components/GraphQLHooksProvider.d.ts.map +0 -1
- package/dist/cjs/components/GraphQLHooksProvider.js +0 -135
- package/dist/cjs/components/MetaTags.d.ts +0 -52
- package/dist/cjs/components/MetaTags.d.ts.map +0 -1
- package/dist/cjs/components/MetaTags.js +0 -69
- package/dist/cjs/components/Metadata.d.ts +0 -9
- package/dist/cjs/components/Metadata.d.ts.map +0 -1
- package/dist/cjs/components/Metadata.js +0 -95
- package/dist/cjs/components/PortalHead.d.ts +0 -4
- package/dist/cjs/components/PortalHead.d.ts.map +0 -1
- package/dist/cjs/components/PortalHead.js +0 -59
- package/dist/cjs/components/RedwoodProvider.d.ts +0 -9
- package/dist/cjs/components/RedwoodProvider.d.ts.map +0 -1
- package/dist/cjs/components/RedwoodProvider.js +0 -58
- package/dist/cjs/components/ServerInject.d.ts +0 -26
- package/dist/cjs/components/ServerInject.d.ts.map +0 -1
- package/dist/cjs/components/ServerInject.js +0 -75
- package/dist/cjs/components/cell/CellCacheContext.d.ts +0 -20
- package/dist/cjs/components/cell/CellCacheContext.d.ts.map +0 -1
- package/dist/cjs/components/cell/CellCacheContext.js +0 -53
- package/dist/cjs/components/cell/CellErrorBoundary.d.ts +0 -25
- package/dist/cjs/components/cell/CellErrorBoundary.d.ts.map +0 -1
- package/dist/cjs/components/cell/CellErrorBoundary.js +0 -66
- package/dist/cjs/components/cell/cellTypes.d.ts +0 -152
- package/dist/cjs/components/cell/cellTypes.d.ts.map +0 -1
- package/dist/cjs/components/cell/cellTypes.js +0 -16
- package/dist/cjs/components/cell/createCell.d.ts +0 -10
- package/dist/cjs/components/cell/createCell.d.ts.map +0 -1
- package/dist/cjs/components/cell/createCell.js +0 -165
- package/dist/cjs/components/cell/createCell.test.js +0 -351
- package/dist/cjs/components/cell/createServerCell.d.ts +0 -15
- package/dist/cjs/components/cell/createServerCell.d.ts.map +0 -1
- package/dist/cjs/components/cell/createServerCell.js +0 -91
- package/dist/cjs/components/cell/createSuspendingCell.d.ts +0 -11
- package/dist/cjs/components/cell/createSuspendingCell.d.ts.map +0 -1
- package/dist/cjs/components/cell/createSuspendingCell.js +0 -152
- package/dist/cjs/components/cell/createSuspendingCell.test.js +0 -115
- package/dist/cjs/components/cell/isCellEmpty.d.ts +0 -41
- package/dist/cjs/components/cell/isCellEmpty.d.ts.map +0 -1
- package/dist/cjs/components/cell/isCellEmpty.js +0 -35
- package/dist/cjs/components/htmlTags.d.ts +0 -52
- package/dist/cjs/components/htmlTags.d.ts.map +0 -1
- package/dist/cjs/components/htmlTags.js +0 -88
- package/dist/cjs/config.d.ts +0 -2
- package/dist/cjs/config.d.ts.map +0 -1
- package/dist/cjs/config.js +0 -6
- package/dist/cjs/entry/index.js +0 -38
- package/dist/cjs/global.web-auto-imports.d.ts +0 -30
- package/dist/cjs/global.web-auto-imports.d.ts.map +0 -1
- package/dist/cjs/global.web-auto-imports.js +0 -16
- package/dist/cjs/graphql.d.ts +0 -23
- package/dist/cjs/graphql.d.ts.map +0 -1
- package/dist/cjs/graphql.js +0 -36
- package/dist/cjs/index.d.ts +0 -20
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js +0 -80
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/routeHooks.types.d.ts +0 -12
- package/dist/cjs/routeHooks.types.d.ts.map +0 -1
- package/dist/cjs/routeHooks.types.js +0 -16
- package/dist/cjs/server/MiddlewareRequest.d.ts +0 -28
- package/dist/cjs/server/MiddlewareRequest.d.ts.map +0 -1
- package/dist/cjs/server/MiddlewareRequest.js +0 -71
- package/dist/cjs/server/MiddlewareResponse.d.ts +0 -44
- package/dist/cjs/server/MiddlewareResponse.d.ts.map +0 -1
- package/dist/cjs/server/MiddlewareResponse.js +0 -130
- package/dist/cjs/server/middleware.d.ts +0 -17
- package/dist/cjs/server/middleware.d.ts.map +0 -1
- package/dist/cjs/server/middleware.js +0 -24
- package/dist/cjs/server/request.d.ts +0 -2
- package/dist/cjs/server/request.d.ts.map +0 -1
- package/dist/cjs/server/request.js +0 -34
- package/dist/cjs/streamUtils/useDocumentReady.d.ts +0 -11
- package/dist/cjs/streamUtils/useDocumentReady.d.ts.map +0 -1
- package/dist/cjs/streamUtils/useDocumentReady.js +0 -41
- package/dist/cjs/toast/index.d.ts +0 -3
- package/dist/cjs/toast/index.d.ts.map +0 -1
- package/dist/cjs/toast/index.js +0 -41
- package/dist/components/GraphQLHooksProvider.d.ts +0 -45
- package/dist/components/GraphQLHooksProvider.d.ts.map +0 -1
- package/dist/components/GraphQLHooksProvider.js +0 -94
- package/dist/components/RedwoodProvider.d.ts.map +0 -1
- package/dist/components/cell/createCell.test.js +0 -328
- package/dist/components/cell/createSuspendingCell.test.js +0 -92
- package/dist/entry/index.d.ts +0 -1
- package/dist/entry/index.js +0 -15
- package/dist/package.json +0 -1
- package/src/entry/index.jsx +0 -27
- package/toast/index.js +0 -1
- package/toast/package.json +0 -4
- /package/dist/apollo/{typeOverride.js → apolloLinkTypes.js} +0 -0
|
@@ -3,7 +3,9 @@ interface RedwoodProviderProps {
|
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
titleTemplate?: string;
|
|
5
5
|
}
|
|
6
|
+
export declare const CedarProvider: ({ children, titleTemplate, }: RedwoodProviderProps) => React.JSX.Element;
|
|
7
|
+
/** @deprecated Please use CedarProvider instead */
|
|
6
8
|
export declare const RedwoodProvider: ({ children, titleTemplate, }: RedwoodProviderProps) => React.JSX.Element;
|
|
7
9
|
declare global { }
|
|
8
10
|
export {};
|
|
9
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=CedarProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CedarProvider.d.ts","sourceRoot":"","sources":["../../src/components/CedarProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,eAAO,MAAM,aAAa,GAAI,8BAG3B,oBAAoB,sBAuBtB,CAAA;AAED,mDAAmD;AACnD,eAAO,MAAM,eAAe,iCA1BzB,oBAAoB,sBA0BqB,CAAA;AAE5C,OAAO,CAAC,MAAM,CAAC,GAAE"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
const RedwoodProvider = ({
|
|
2
|
+
import { Helmet, HelmetProvider } from "@dr.pogodin/react-helmet";
|
|
3
|
+
const CedarProvider = ({
|
|
5
4
|
children,
|
|
6
5
|
titleTemplate
|
|
7
6
|
}) => {
|
|
@@ -19,6 +18,8 @@ const RedwoodProvider = ({
|
|
|
19
18
|
}
|
|
20
19
|
return /* @__PURE__ */ React.createElement(HelmetProvider, { context: globalThis.__REDWOOD__HELMET_CONTEXT }, /* @__PURE__ */ React.createElement(Helmet, { titleTemplate: template(), defaultTitle: appTitle }, /* @__PURE__ */ React.createElement("title", null, appTitle)), children);
|
|
21
20
|
};
|
|
21
|
+
const RedwoodProvider = CedarProvider;
|
|
22
22
|
export {
|
|
23
|
+
CedarProvider,
|
|
23
24
|
RedwoodProvider
|
|
24
25
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { GraphQLFormattedError } from 'graphql';
|
|
3
3
|
type RequestDetails = {
|
|
4
4
|
query: string;
|
|
5
5
|
operationName: string;
|
|
6
6
|
operationKind: string;
|
|
7
7
|
variables: any;
|
|
8
8
|
};
|
|
9
|
-
interface EnhancedGqlError extends
|
|
9
|
+
interface EnhancedGqlError extends GraphQLFormattedError {
|
|
10
10
|
__RedwoodEnhancedError: RequestDetails;
|
|
11
11
|
}
|
|
12
12
|
type ErrorWithRequestMeta = Error & {
|
|
13
13
|
mostRecentRequest?: RequestDetails;
|
|
14
|
-
|
|
14
|
+
errors?: EnhancedGqlError[];
|
|
15
15
|
mostRecentResponse?: any;
|
|
16
16
|
};
|
|
17
17
|
export declare const DevFatalErrorPage: (props: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevFatalErrorPage.d.ts","sourceRoot":"","sources":["../../src/components/DevFatalErrorPage.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAE1D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"DevFatalErrorPage.d.ts","sourceRoot":"","sources":["../../src/components/DevFatalErrorPage.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAE1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAmBpD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,GAAG,CAAA;CACf,CAAA;AAED,UAAU,gBAAiB,SAAQ,qBAAqB;IACtD,sBAAsB,EAAE,cAAc,CAAA;CACvC;AAID,KAAK,oBAAoB,GAAG,KAAK,GAAG;IAClC,iBAAiB,CAAC,EAAE,cAAc,CAAA;IAClC,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC3B,kBAAkB,CAAC,EAAE,GAAG,CAAA;CACzB,CAAA;AAiGD,eAAO,MAAM,iBAAiB,GAAI,OAAO;IAAE,KAAK,CAAC,EAAE,oBAAoB,CAAA;CAAE,sBA4FxE,CAAA"}
|
|
@@ -19,7 +19,7 @@ function formatErrorForClipboard(err, stack, typeName, msg, errorWithMeta) {
|
|
|
19
19
|
lines.push(`ERROR TYPE: ${typeName}`);
|
|
20
20
|
lines.push(`ERROR MESSAGE: ${msg}`);
|
|
21
21
|
lines.push("");
|
|
22
|
-
const mostRecentRequest = errorWithMeta.mostRecentRequest || errorWithMeta.
|
|
22
|
+
const mostRecentRequest = errorWithMeta.mostRecentRequest || errorWithMeta.errors?.find((gqlErr) => gqlErr.__RedwoodEnhancedError)?.__RedwoodEnhancedError;
|
|
23
23
|
if (mostRecentRequest) {
|
|
24
24
|
lines.push("-".repeat(80));
|
|
25
25
|
lines.push("REQUEST CONTEXT");
|
|
@@ -96,7 +96,7 @@ const DevFatalErrorPage = (props) => {
|
|
|
96
96
|
const typeName = String(
|
|
97
97
|
err["type"] || err.constructor?.name || typeof err
|
|
98
98
|
);
|
|
99
|
-
const msg = String(err
|
|
99
|
+
const msg = String(err?.message);
|
|
100
100
|
const FileRef = stack.items[0] ? /* @__PURE__ */ React.createElement("a", { href: toVSCodeURL(stack.items[0]) }, stack.items[0].fileName) : null;
|
|
101
101
|
const handleCopyAll = async () => {
|
|
102
102
|
const errorText = formatErrorForClipboard(err, stack, typeName, msg, err);
|
|
@@ -194,7 +194,7 @@ function ResponseRequest(props) {
|
|
|
194
194
|
if (!props.error) {
|
|
195
195
|
return null;
|
|
196
196
|
}
|
|
197
|
-
const mostRecentRequest = props.error.mostRecentRequest || props.error.
|
|
197
|
+
const mostRecentRequest = props.error.mostRecentRequest || props.error.errors?.find((gqlErr) => gqlErr.__RedwoodEnhancedError)?.__RedwoodEnhancedError;
|
|
198
198
|
const mostRecentResponse = props.error.mostRecentResponse;
|
|
199
199
|
return /* @__PURE__ */ React.createElement("div", { className: "request-response" }, mostRecentRequest ? /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h4", null, "Request: ", mostRecentRequest.operationName), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h5", null, "Variables:"), /* @__PURE__ */ React.createElement("code", null, /* @__PURE__ */ React.createElement("pre", null, JSON.stringify(mostRecentRequest.variables, null, " ")))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h5", null, "Query:"), /* @__PURE__ */ React.createElement("code", null, /* @__PURE__ */ React.createElement(
|
|
200
200
|
"pre",
|
|
@@ -18,7 +18,7 @@ declare class FatalErrorBoundary extends React.Component<PropsFatalErrorBoundary
|
|
|
18
18
|
hasError: boolean;
|
|
19
19
|
error: Error;
|
|
20
20
|
};
|
|
21
|
-
render(): string | number | boolean | Iterable<React.ReactNode> | React.
|
|
21
|
+
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
22
22
|
}
|
|
23
23
|
export { FatalErrorBoundary };
|
|
24
24
|
//# sourceMappingURL=FatalErrorBoundary.d.ts.map
|
|
@@ -16,8 +16,9 @@ interface Props {
|
|
|
16
16
|
/**
|
|
17
17
|
* The `FetchConfigProvider` understands Redwood's Auth and determines the
|
|
18
18
|
* correct request-headers based on a user's authentication state.
|
|
19
|
-
* Note that the auth bearer token is now passed in
|
|
20
|
-
* as the token is
|
|
19
|
+
* Note that the auth bearer token is now passed in
|
|
20
|
+
* packages/web/src/apollo/ApolloProviderWithFetchConfig.tsx as the token is
|
|
21
|
+
* retrieved async
|
|
21
22
|
*/
|
|
22
23
|
export declare const FetchConfigProvider: React.FC<Props>;
|
|
23
24
|
export declare const useFetchConfig: () => FetchConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchConfigProvider.d.ts","sourceRoot":"","sources":["../../src/components/FetchConfigProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAG5C,eAAO,MAAM,gBAAgB,cAE5B,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC/D;AAED,eAAO,MAAM,kBAAkB,4BAE7B,CAAA;AAEF,UAAU,KAAK;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED
|
|
1
|
+
{"version":3,"file":"FetchConfigProvider.d.ts","sourceRoot":"","sources":["../../src/components/FetchConfigProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAG5C,eAAO,MAAM,gBAAgB,cAE5B,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC/D;AAED,eAAO,MAAM,kBAAkB,4BAE7B,CAAA;AAEF,UAAU,KAAK;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA+B/C,CAAA;AAED,eAAO,MAAM,cAAc,mBAA6C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaTags.d.ts","sourceRoot":"","sources":["../../src/components/MetaTags.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"MetaTags.d.ts","sourceRoot":"","sources":["../../src/components/MetaTags.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,KAAK,YAAY,GACb,SAAS,GACT,OAAO,GACP,QAAQ,GACR,UAAU,GACV,MAAM,GACN,WAAW,GACX,SAAS,GACT,WAAW,CAAA;AACf,UAAU,aAAa;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,MAAM,EAAE,CAAA;IAEpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;QAGI;IACJ,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;QAII;IACJ,KAAK,CAAC,EAAE,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,EAAE,CAAA;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;QAGI;IACJ,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,sBAoG5C,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
const { Helmet: HelmetHead } = helmetPkg;
|
|
2
|
+
import { Helmet as HelmetHead } from "@dr.pogodin/react-helmet";
|
|
4
3
|
import PortalHead from "./PortalHead.js";
|
|
5
4
|
const MetaTags = (props) => {
|
|
6
5
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Metadata.d.ts","sourceRoot":"","sources":["../../src/components/Metadata.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Metadata.d.ts","sourceRoot":"","sources":["../../src/components/Metadata.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAwCzB;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,sBAgElD,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import
|
|
4
|
-
const { Helmet: HelmetHead } = helmetPkg;
|
|
3
|
+
import { Helmet as HelmetHead } from "@dr.pogodin/react-helmet";
|
|
5
4
|
import PortalHead from "./PortalHead.js";
|
|
6
5
|
const EXCLUDE_PROPS = ["charSet"];
|
|
7
6
|
const propToMetaTag = (parentKey, parentValue, options) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { useQuery } from '@apollo/client/react';
|
|
2
3
|
import type { CellFailureProps } from './cellTypes.js';
|
|
3
4
|
export type FallbackProps = {
|
|
4
|
-
error:
|
|
5
|
+
error: useQuery.Result['error'];
|
|
5
6
|
resetErrorBoundary: () => void;
|
|
6
7
|
};
|
|
7
8
|
export type CellErrorBoundaryProps = {
|
|
@@ -10,7 +11,7 @@ export type CellErrorBoundaryProps = {
|
|
|
10
11
|
};
|
|
11
12
|
interface ErrState {
|
|
12
13
|
hasError: boolean;
|
|
13
|
-
error?:
|
|
14
|
+
error?: useQuery.Result['error'];
|
|
14
15
|
}
|
|
15
16
|
export declare class CellErrorBoundary extends React.Component<CellErrorBoundaryProps, ErrState> {
|
|
16
17
|
constructor(props: CellErrorBoundaryProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CellErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/cell/CellErrorBoundary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CellErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/cell/CellErrorBoundary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC/B,kBAAkB,EAAE,MAAM,IAAI,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IAGnC,cAAc,EAAE,CACd,OAAO,EAAE,aAAa,KACnB,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAA;IACzC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,UAAU,QAAQ;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;CACjC;AAED,qBAAa,iBAAkB,SAAQ,KAAK,CAAC,SAAS,CACpD,sBAAsB,EACtB,QAAQ,CACT;gBACa,KAAK,EAAE,sBAAsB;IAKzC,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK;;;;IAI5C,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS;IAQ1D,MAAM;CAgBP"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type { ComponentProps, JSXElementConstructor } from 'react';
|
|
2
|
-
import type { ApolloClient, NetworkStatus, OperationVariables,
|
|
1
|
+
import type { ComponentProps, JSX, JSXElementConstructor } from 'react';
|
|
2
|
+
import type { ApolloClient, NetworkStatus, OperationVariables, TypedDocumentNode } from '@apollo/client';
|
|
3
|
+
import type { QueryRef, SkipToken, useBackgroundQuery, useQuery } from '@apollo/client/react';
|
|
3
4
|
import type { DocumentNode } from 'graphql';
|
|
4
5
|
import type { A, L, O, U } from 'ts-toolbelt';
|
|
5
6
|
/**
|
|
6
7
|
* If the Cell has a `beforeQuery` function, then the variables are not required,
|
|
7
|
-
* but instead the arguments of the `beforeQuery` function are required.
|
|
8
|
+
* but instead the arguments of the `beforeQuery` function are required. If
|
|
9
|
+
* `beforeQuery` takes no arguments, or its first argument is untyped, any
|
|
10
|
+
* props are accepted.
|
|
8
11
|
*
|
|
9
12
|
* If the Cell does not have a `beforeQuery` function, then the variables are required.
|
|
10
13
|
*
|
|
@@ -14,12 +17,12 @@ import type { A, L, O, U } from 'ts-toolbelt';
|
|
|
14
17
|
*/
|
|
15
18
|
type CellPropsVariables<Cell, GQLVariables> = Cell extends {
|
|
16
19
|
beforeQuery: (...args: any[]) => any;
|
|
17
|
-
} ? Parameters<Cell['beforeQuery']>[
|
|
20
|
+
} ? Parameters<Cell['beforeQuery']> extends [infer FirstArg, ...any[]] ? unknown extends FirstArg ? Record<string, unknown> : FirstArg : Record<string, unknown> : GQLVariables extends Record<string, never> ? unknown : GQLVariables;
|
|
18
21
|
/**
|
|
19
22
|
* Cell component props which is the combination of query variables and Success props.
|
|
20
23
|
*/
|
|
21
|
-
export type CellProps<CellSuccess extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>, GQLResult, CellType, GQLVariables> = A.Compute<Omit<ComponentProps<CellSuccess>, keyof CellPropsVariables<CellType, GQLVariables> | keyof GQLResult | 'updating' | 'queryResult'> & CellPropsVariables<CellType, GQLVariables>>;
|
|
22
|
-
type InputVarProps<T> = T extends {
|
|
24
|
+
export type CellProps<CellSuccess extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>, GQLResult, CellType, GQLVariables> = A.Compute<Omit<ComponentProps<CellSuccess>, keyof CellPropsVariables<CellType, GQLVariables> | keyof (GQLVariables extends Record<string, never> ? unknown : GQLVariables) | keyof GQLResult | 'updating' | 'queryResult'> & CellPropsVariables<CellType, GQLVariables>>;
|
|
25
|
+
type InputVarProps<T> = unknown extends T ? unknown : T extends {
|
|
23
26
|
[key: string]: never;
|
|
24
27
|
} ? unknown : T;
|
|
25
28
|
export type CellLoadingProps<TVariables extends OperationVariables = any> = {
|
|
@@ -27,7 +30,7 @@ export type CellLoadingProps<TVariables extends OperationVariables = any> = {
|
|
|
27
30
|
} & InputVarProps<TVariables>;
|
|
28
31
|
export type CellFailureProps<TVariables extends OperationVariables = any> = {
|
|
29
32
|
queryResult?: NonSuspenseCellQueryResult<TVariables, any> | SuspenseCellQueryResult;
|
|
30
|
-
error?:
|
|
33
|
+
error?: useQuery.Result['error'] | Error;
|
|
31
34
|
/**
|
|
32
35
|
* @see {@link https://www.apollographql.com/docs/apollo-server/data/errors/#error-codes}
|
|
33
36
|
*/
|
|
@@ -73,23 +76,68 @@ export type CellSuccessProps<TData = any, TVariables extends OperationVariables
|
|
|
73
76
|
export type DataObject = {
|
|
74
77
|
[key: string]: unknown;
|
|
75
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* What `beforeQuery` returns is handed straight to the GraphQL client's query
|
|
81
|
+
* hook, so any of that hook's options can be set here.
|
|
82
|
+
*/
|
|
83
|
+
export type CellBeforeQueryOptions<CellVariables> = {
|
|
84
|
+
variables: CellVariables;
|
|
85
|
+
} & Omit<useQuery.Options<DataObject, OperationVariables>, 'variables'>;
|
|
86
|
+
/**
|
|
87
|
+
* `beforeQuery` can return `skipToken` instead of an options object to keep the
|
|
88
|
+
* query from being executed at all. A skipped Cell renders nothing -- none of
|
|
89
|
+
* `Loading`, `Empty`, `Failure` or `Success` are rendered.
|
|
90
|
+
*
|
|
91
|
+
* @see {@link https://www.apollographql.com/docs/react/api/react/hooks#skiptoken}
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* import { skipToken } from '@apollo/client/react'
|
|
96
|
+
*
|
|
97
|
+
* export const beforeQuery = ({ id }) => {
|
|
98
|
+
* const otherId = useStore((state) => state.getOther(id))
|
|
99
|
+
*
|
|
100
|
+
* return otherId ? { variables: { id, otherId } } : skipToken
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export type CellBeforeQueryResult<CellVariables> = CellBeforeQueryOptions<CellVariables> | SkipToken;
|
|
76
105
|
/**
|
|
77
106
|
* The main interface.
|
|
107
|
+
*
|
|
108
|
+
* @param GQLResult - The shape of the data returned by `QUERY` (or, for
|
|
109
|
+
* fragment Cells, the shape of the fragment's data). This is what
|
|
110
|
+
* `Success`/`Empty` receive their data as. Defaults to `any` so Cells that
|
|
111
|
+
* don't -- or can't -- type their `QUERY` with `TypedDocumentNode` (e.g. in
|
|
112
|
+
* tests, or Cells built from a plain string) keep the pre-existing loose
|
|
113
|
+
* behavior instead of erroring.
|
|
78
114
|
*/
|
|
79
|
-
export interface CreateCellProps<CellProps, CellVariables> {
|
|
115
|
+
export interface CreateCellProps<CellProps, CellVariables extends OperationVariables = OperationVariables, GQLResult = any> {
|
|
80
116
|
/**
|
|
81
117
|
* The GraphQL syntax tree to execute or function to call that returns it.
|
|
82
118
|
* If `QUERY` is a function, it's called with the result of `beforeQuery`.
|
|
119
|
+
*
|
|
120
|
+
* Either `QUERY` or `FRAGMENT` must be provided.
|
|
83
121
|
*/
|
|
84
|
-
QUERY
|
|
122
|
+
QUERY?: TypedDocumentNode<GQLResult, CellVariables> | DocumentNode | ((variables: Record<string, unknown>) => DocumentNode);
|
|
123
|
+
/**
|
|
124
|
+
* A GraphQL fragment that declares this Cell's data requirements. Fragment
|
|
125
|
+
* Cells don't fire their own query. Instead a parent Cell spreads the
|
|
126
|
+
* fragment in its `QUERY` and passes the fetched data object down via a
|
|
127
|
+
* prop named after the fragment (`AuthorCell_author` -> `author`). The
|
|
128
|
+
* fragment is automatically registered with the GraphQL client's fragment
|
|
129
|
+
* registry, so parent queries can spread it by name.
|
|
130
|
+
*
|
|
131
|
+
* Either `QUERY` or `FRAGMENT` must be provided.
|
|
132
|
+
*/
|
|
133
|
+
FRAGMENT?: DocumentNode;
|
|
85
134
|
/**
|
|
86
135
|
* Parse `props` into query variables. Most of the time `props` are appropriate variables as is.
|
|
136
|
+
*
|
|
137
|
+
* Any other option the GraphQL client's query hook accepts can be returned
|
|
138
|
+
* here as well. Return `skipToken` to not execute the query at all.
|
|
87
139
|
*/
|
|
88
|
-
beforeQuery?: ((props: CellProps) =>
|
|
89
|
-
variables: CellVariables;
|
|
90
|
-
}) | (() => {
|
|
91
|
-
variables: CellVariables;
|
|
92
|
-
});
|
|
140
|
+
beforeQuery?: ((props: CellProps) => CellBeforeQueryResult<CellVariables>) | (() => CellBeforeQueryResult<CellVariables>);
|
|
93
141
|
/**
|
|
94
142
|
* Sanitize the data returned from the query.
|
|
95
143
|
*/
|
|
@@ -119,19 +167,19 @@ export interface CreateCellProps<CellProps, CellVariables> {
|
|
|
119
167
|
/**
|
|
120
168
|
* If the query's in flight and there's no stale data, render this.
|
|
121
169
|
*/
|
|
122
|
-
Loading?: React.FC<CellLoadingProps & Partial<CellProps>>;
|
|
170
|
+
Loading?: React.FC<CellLoadingProps<CellVariables> & Partial<CellProps>>;
|
|
123
171
|
/**
|
|
124
172
|
* If something went wrong, render this.
|
|
125
173
|
*/
|
|
126
|
-
Failure?: React.FC<CellFailureProps & Partial<CellProps>>;
|
|
174
|
+
Failure?: React.FC<CellFailureProps<CellVariables> & Partial<CellProps>>;
|
|
127
175
|
/**
|
|
128
176
|
* If no data was returned, render this.
|
|
129
177
|
*/
|
|
130
|
-
Empty?: React.FC<CellSuccessProps & Partial<CellProps>>;
|
|
178
|
+
Empty?: React.FC<CellSuccessProps<GQLResult, CellVariables> & Partial<CellProps>>;
|
|
131
179
|
/**
|
|
132
180
|
* If data was returned, render this.
|
|
133
181
|
*/
|
|
134
|
-
Success: React.FC<CellSuccessProps & Partial<CellProps>>;
|
|
182
|
+
Success: React.FC<CellSuccessProps<GQLResult, CellVariables> & Partial<CellProps>>;
|
|
135
183
|
/**
|
|
136
184
|
* What to call the Cell. Defaults to the filename.
|
|
137
185
|
*/
|
|
@@ -142,9 +190,9 @@ export type SuspendingSuccessProps = React.PropsWithChildren<Record<string, unkn
|
|
|
142
190
|
suspenseQueryResult: SuspenseCellQueryResult<DataObject, any>;
|
|
143
191
|
userProps: Record<string, any>;
|
|
144
192
|
};
|
|
145
|
-
export type NonSuspenseCellQueryResult<TVariables extends OperationVariables = any, TData = any> = Partial<Omit<
|
|
146
|
-
export interface SuspenseCellQueryResult<_TData = any, _TVariables extends OperationVariables = any> extends
|
|
147
|
-
client: ApolloClient
|
|
193
|
+
export type NonSuspenseCellQueryResult<TVariables extends OperationVariables = any, TData = any> = Partial<Omit<useQuery.Result<TData, TVariables>, 'loading' | 'error' | 'data'>>;
|
|
194
|
+
export interface SuspenseCellQueryResult<_TData = any, _TVariables extends OperationVariables = any> extends useBackgroundQuery.Result<DataObject> {
|
|
195
|
+
client: ApolloClient;
|
|
148
196
|
networkStatus?: NetworkStatus;
|
|
149
197
|
called: boolean;
|
|
150
198
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cellTypes.d.ts","sourceRoot":"","sources":["../../../src/components/cell/cellTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"cellTypes.d.ts","sourceRoot":"","sources":["../../../src/components/cell/cellTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAA;AAEvE,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,QAAQ,EACT,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;;;;;;;GAWG;AACH,KAAK,kBAAkB,CAAC,IAAI,EAAE,YAAY,IAAI,IAAI,SAAS;IACzD,WAAW,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;CACrC,GACG,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,MAAM,QAAQ,EAAE,GAAG,GA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
|
|
2
|
+
import type { OperationVariables } from '@apollo/client';
|
|
2
3
|
import type { CreateCellProps } from './cellTypes.js';
|
|
3
|
-
|
|
4
|
-
export declare const createCell: typeof createSuspendingCell | typeof createNonSuspendingCell;
|
|
5
|
-
/**
|
|
6
|
-
* Creates a Cell out of a GraphQL query and components that track to its lifecycle.
|
|
7
|
-
*/
|
|
8
|
-
declare function createNonSuspendingCell<CellProps extends Record<string, unknown>, CellVariables extends Record<string, unknown>>({ QUERY, beforeQuery, afterQuery, isEmpty, Loading, Failure, Empty, Success, displayName, }: CreateCellProps<CellProps, CellVariables>): React.FC<CellProps>;
|
|
9
|
-
export {};
|
|
4
|
+
export declare function createCell<CellProps extends Record<string, unknown>, CellVariables extends OperationVariables = OperationVariables, GQLResult = any>(createCellProps: CreateCellProps<CellProps, CellVariables, GQLResult>): React.FC<CellProps>;
|
|
10
5
|
//# sourceMappingURL=createCell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCell.d.ts","sourceRoot":"","sources":["../../../src/components/cell/createCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"createCell.d.ts","sourceRoot":"","sources":["../../../src/components/cell/createCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAQxD,OAAO,KAAK,EAAE,eAAe,EAAc,MAAM,gBAAgB,CAAA;AAKjE,wBAAgB,UAAU,CACxB,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,aAAa,SAAS,kBAAkB,GAAG,kBAAkB,EAC7D,SAAS,GAAG,GAAG,EAEf,eAAe,EAAE,eAAe,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,CAAC,GACpE,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAoCrB"}
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { CombinedGraphQLErrors } from "@apollo/client";
|
|
3
|
+
import { useQuery } from "@apollo/client/react";
|
|
2
4
|
import { fragmentRegistry } from "../../apollo/fragmentRegistry.js";
|
|
3
5
|
import { getOperationName } from "../../graphql.js";
|
|
4
|
-
import { useQuery } from "../GraphQLHooksProvider.js";
|
|
5
6
|
import { useCellCacheContext } from "./CellCacheContext.js";
|
|
7
|
+
import { createFragmentCell } from "./createFragmentCell.js";
|
|
6
8
|
import { createSuspendingCell } from "./createSuspendingCell.js";
|
|
7
9
|
import { isDataEmpty } from "./isCellEmpty.js";
|
|
8
|
-
|
|
10
|
+
function createCell(createCellProps) {
|
|
11
|
+
if (createCellProps.FRAGMENT) {
|
|
12
|
+
if (!createCellProps.QUERY) {
|
|
13
|
+
return createFragmentCell(createCellProps);
|
|
14
|
+
}
|
|
15
|
+
fragmentRegistry.register(createCellProps.FRAGMENT);
|
|
16
|
+
}
|
|
17
|
+
if (RWJS_ENV.RWJS_EXP_STREAMING_SSR) {
|
|
18
|
+
const suspendingCellProps = createCellProps;
|
|
19
|
+
return createSuspendingCell(
|
|
20
|
+
suspendingCellProps
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return createNonSuspendingCell(createCellProps);
|
|
24
|
+
}
|
|
9
25
|
function createNonSuspendingCell({
|
|
10
26
|
QUERY,
|
|
11
27
|
beforeQuery = (props) => ({
|
|
@@ -28,10 +44,18 @@ function createNonSuspendingCell({
|
|
|
28
44
|
Success,
|
|
29
45
|
displayName = "Cell"
|
|
30
46
|
}) {
|
|
47
|
+
if (!QUERY) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
`Can't create a Cell (${displayName}) without a QUERY or FRAGMENT export`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
const cellQuery = QUERY;
|
|
31
53
|
function NamedCell(props) {
|
|
32
54
|
const { children: _, ...variables } = props;
|
|
33
55
|
const options = beforeQuery(variables);
|
|
34
|
-
const
|
|
56
|
+
const queryOptions = typeof options === "symbol" ? void 0 : options;
|
|
57
|
+
const skipped = !queryOptions || queryOptions.skip === true;
|
|
58
|
+
const query = typeof cellQuery === "function" ? cellQuery(queryOptions ?? {}) : cellQuery;
|
|
35
59
|
let {
|
|
36
60
|
// eslint-disable-next-line prefer-const
|
|
37
61
|
error,
|
|
@@ -41,77 +65,77 @@ function createNonSuspendingCell({
|
|
|
41
65
|
} = useQuery(query, options);
|
|
42
66
|
if (globalThis.__REDWOOD__PRERENDERING) {
|
|
43
67
|
const { queryCache } = useCellCacheContext();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const cellName = displayName === "Cell" ? "the cell" : displayName;
|
|
51
|
-
throw new Error(
|
|
52
|
-
`The gql query in ${cellName} is missing an operation name. Something like FindBlogPostQuery in \`query FindBlogPostQuery($id: Int!)\``
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
const queryInfo = queryCache[cacheKey];
|
|
56
|
-
if (queryInfo?.renderLoading) {
|
|
57
|
-
loading = true;
|
|
58
|
-
} else {
|
|
59
|
-
if (queryInfo?.hasProcessed) {
|
|
60
|
-
loading = false;
|
|
61
|
-
data = queryInfo.data;
|
|
62
|
-
queryResult = { variables };
|
|
68
|
+
if (!skipped) {
|
|
69
|
+
const operationName = getOperationName(query);
|
|
70
|
+
const transformedQuery = fragmentRegistry.transform(query);
|
|
71
|
+
let cacheKey;
|
|
72
|
+
if (operationName) {
|
|
73
|
+
cacheKey = operationName + "_" + JSON.stringify(variables);
|
|
63
74
|
} else {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
const cellName = displayName === "Cell" ? "the cell" : displayName;
|
|
76
|
+
throw new Error(
|
|
77
|
+
`The gql query in ${cellName} is missing an operation name. Something like FindBlogPostQuery in \`query FindBlogPostQuery($id: Int!)\``
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
const queryInfo = queryCache[cacheKey];
|
|
81
|
+
if (queryInfo?.renderLoading) {
|
|
82
|
+
loading = true;
|
|
83
|
+
} else {
|
|
84
|
+
if (queryInfo?.hasProcessed) {
|
|
85
|
+
loading = false;
|
|
86
|
+
data = queryInfo.data;
|
|
87
|
+
queryResult = { variables };
|
|
88
|
+
} else {
|
|
89
|
+
queryCache[cacheKey] ||= {
|
|
90
|
+
query: transformedQuery,
|
|
91
|
+
variables: queryOptions.variables,
|
|
92
|
+
hasProcessed: false
|
|
93
|
+
};
|
|
94
|
+
}
|
|
69
95
|
}
|
|
70
96
|
}
|
|
71
97
|
}
|
|
98
|
+
if (skipped) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
72
101
|
if (error) {
|
|
73
102
|
if (Failure) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
errorCode:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
);
|
|
103
|
+
const failureProps = {
|
|
104
|
+
error,
|
|
105
|
+
errorCode: (
|
|
106
|
+
// Use the ad-hoc QueryResultWithErrorCode type to access the errorCode
|
|
107
|
+
queryResult.errorCode ?? (CombinedGraphQLErrors.is(error) ? error.errors[0]?.extensions?.["code"] : void 0)
|
|
108
|
+
),
|
|
109
|
+
...props,
|
|
110
|
+
updating: loading,
|
|
111
|
+
queryResult
|
|
112
|
+
};
|
|
113
|
+
return /* @__PURE__ */ React.createElement(Failure, { ...failureProps });
|
|
87
114
|
} else {
|
|
88
|
-
throw error;
|
|
115
|
+
throw error instanceof Error ? error : new Error(error.message);
|
|
89
116
|
}
|
|
90
117
|
} else if (data) {
|
|
91
118
|
const afterQueryData = afterQuery(data);
|
|
92
119
|
if (isEmpty(data, { isDataEmpty }) && Empty) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
);
|
|
120
|
+
const emptyProps = {
|
|
121
|
+
...props,
|
|
122
|
+
...afterQueryData,
|
|
123
|
+
updating: loading,
|
|
124
|
+
queryResult
|
|
125
|
+
};
|
|
126
|
+
return /* @__PURE__ */ React.createElement(Empty, { ...emptyProps });
|
|
102
127
|
} else {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
);
|
|
128
|
+
const successProps = {
|
|
129
|
+
...props,
|
|
130
|
+
...afterQueryData,
|
|
131
|
+
updating: loading,
|
|
132
|
+
queryResult
|
|
133
|
+
};
|
|
134
|
+
return /* @__PURE__ */ React.createElement(Success, { ...successProps });
|
|
112
135
|
}
|
|
113
136
|
} else if (loading) {
|
|
114
|
-
|
|
137
|
+
const loadingProps = { ...props, queryResult };
|
|
138
|
+
return /* @__PURE__ */ React.createElement(Loading, { ...loadingProps });
|
|
115
139
|
} else {
|
|
116
140
|
console.warn(
|
|
117
141
|
`If you're using Apollo Client, check for its debug logs here in the console, which may help explain the error.`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { OperationVariables } from '@apollo/client';
|
|
3
|
+
import type { CreateCellProps } from './cellTypes.js';
|
|
4
|
+
/**
|
|
5
|
+
* Creates a Cell out of a GraphQL fragment and components that render its
|
|
6
|
+
* data.
|
|
7
|
+
*
|
|
8
|
+
* Fragment Cells don't fire queries of their own. A parent Cell spreads the
|
|
9
|
+
* fragment in its QUERY and passes the matching slice of the query result
|
|
10
|
+
* down via a prop named after the fragment (`AuthorCell_author` -> `author`).
|
|
11
|
+
* `Success` receives the data as that same prop. The data is read
|
|
12
|
+
* synchronously, so fragment Cells never render `Loading`.
|
|
13
|
+
*
|
|
14
|
+
* When the GraphQL client supports it (Apollo does), the fragment data is
|
|
15
|
+
* read from the client's cache, so the Cell re-renders when other queries or
|
|
16
|
+
* mutations update the underlying entity. If the cache read is incomplete,
|
|
17
|
+
* the passed-in object itself is used as the data snapshot.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createFragmentCell<CellProps extends Record<string, unknown>, CellVariables extends OperationVariables = OperationVariables, GQLResult = any>({ FRAGMENT, afterQuery, isEmpty, Empty, Success, displayName, }: CreateCellProps<CellProps, CellVariables, GQLResult>): React.FC<CellProps>;
|
|
20
|
+
//# sourceMappingURL=createFragmentCell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createFragmentCell.d.ts","sourceRoot":"","sources":["../../../src/components/cell/createFragmentCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAMxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAqDrD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,aAAa,SAAS,kBAAkB,GAAG,kBAAkB,EAC7D,SAAS,GAAG,GAAG,EACf,EACA,QAAQ,EACR,UAA2B,EAC3B,OAAqB,EACrB,KAAK,EACL,OAAO,EACP,WAAoB,GACrB,EAAE,eAAe,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAiF5E"}
|