@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.
Files changed (231) hide show
  1. package/dist/apollo/ApolloClientFactoryContext.d.ts +26 -0
  2. package/dist/apollo/ApolloClientFactoryContext.d.ts.map +1 -0
  3. package/dist/apollo/ApolloClientFactoryContext.js +5 -0
  4. package/dist/apollo/ApolloProviderWithFetchConfig.d.ts +21 -0
  5. package/dist/apollo/ApolloProviderWithFetchConfig.d.ts.map +1 -0
  6. package/dist/apollo/ApolloProviderWithFetchConfig.js +153 -0
  7. package/dist/apollo/CedarApolloProvider.d.ts +14 -0
  8. package/dist/apollo/CedarApolloProvider.d.ts.map +1 -0
  9. package/dist/apollo/CedarApolloProvider.js +39 -0
  10. package/dist/apollo/ErrorBoundary.d.ts +13 -0
  11. package/dist/apollo/ErrorBoundary.d.ts.map +1 -0
  12. package/dist/apollo/ErrorBoundary.js +13 -0
  13. package/dist/apollo/apolloLinkTypes.d.ts +60 -0
  14. package/dist/apollo/apolloLinkTypes.d.ts.map +1 -0
  15. package/dist/apollo/fragmentRegistry.d.ts +28 -3
  16. package/dist/apollo/fragmentRegistry.d.ts.map +1 -1
  17. package/dist/apollo/fragmentRegistry.js +52 -7
  18. package/dist/apollo/index.d.ts +54 -70
  19. package/dist/apollo/index.d.ts.map +1 -1
  20. package/dist/apollo/index.js +5 -185
  21. package/dist/apollo/links.d.ts +4 -5
  22. package/dist/apollo/links.d.ts.map +1 -1
  23. package/dist/apollo/links.js +7 -7
  24. package/dist/apollo/sseLink.d.ts +5 -8
  25. package/dist/apollo/sseLink.d.ts.map +1 -1
  26. package/dist/apollo/sseLink.js +9 -12
  27. package/dist/apollo/suspense.d.ts +20 -10
  28. package/dist/apollo/suspense.d.ts.map +1 -1
  29. package/dist/apollo/suspense.js +37 -28
  30. package/dist/apollo/useCache.d.ts +4 -6
  31. package/dist/apollo/useCache.d.ts.map +1 -1
  32. package/dist/apollo/useCache.js +1 -1
  33. package/dist/apollo/useCreateApolloClient.d.ts +11 -0
  34. package/dist/apollo/useCreateApolloClient.d.ts.map +1 -0
  35. package/dist/apollo/useCreateApolloClient.js +14 -0
  36. package/dist/bins/cedar.js +14 -0
  37. package/dist/bins/cfw.js +14 -0
  38. package/dist/bins/cross-env.js +8 -0
  39. package/dist/bins/msw.js +6 -0
  40. package/dist/bins/redwood.js +14 -0
  41. package/dist/bins/storybook.js +27 -0
  42. package/dist/bins/tsc.js +8 -0
  43. package/dist/bundled/apollo-upload-client.d.ts +2 -2
  44. package/dist/bundled/apollo-upload-client.d.ts.map +1 -1
  45. package/dist/bundled/apollo-upload-client.js +2728 -2
  46. package/dist/components/{RedwoodProvider.d.ts → CedarProvider.d.ts} +3 -1
  47. package/dist/components/CedarProvider.d.ts.map +1 -0
  48. package/dist/components/{RedwoodProvider.js → CedarProvider.js} +4 -3
  49. package/dist/components/DevFatalErrorPage.d.ts +3 -3
  50. package/dist/components/DevFatalErrorPage.d.ts.map +1 -1
  51. package/dist/components/DevFatalErrorPage.js +3 -3
  52. package/dist/components/FatalErrorBoundary.d.ts +1 -1
  53. package/dist/components/FetchConfigProvider.d.ts +3 -2
  54. package/dist/components/FetchConfigProvider.d.ts.map +1 -1
  55. package/dist/components/MetaTags.d.ts.map +1 -1
  56. package/dist/components/MetaTags.js +1 -2
  57. package/dist/components/Metadata.d.ts.map +1 -1
  58. package/dist/components/Metadata.js +1 -2
  59. package/dist/components/cell/CellErrorBoundary.d.ts +3 -2
  60. package/dist/components/cell/CellErrorBoundary.d.ts.map +1 -1
  61. package/dist/components/cell/cellTypes.d.ts +69 -21
  62. package/dist/components/cell/cellTypes.d.ts.map +1 -1
  63. package/dist/components/cell/createCell.d.ts +2 -7
  64. package/dist/components/cell/createCell.d.ts.map +1 -1
  65. package/dist/components/cell/createCell.js +84 -60
  66. package/dist/components/cell/createFragmentCell.d.ts +20 -0
  67. package/dist/components/cell/createFragmentCell.d.ts.map +1 -0
  68. package/dist/components/cell/createFragmentCell.js +75 -0
  69. package/dist/components/cell/createServerCell.d.ts +3 -2
  70. package/dist/components/cell/createServerCell.d.ts.map +1 -1
  71. package/dist/components/cell/createServerCell.js +4 -2
  72. package/dist/components/cell/createSuspendingCell.d.ts +2 -1
  73. package/dist/components/cell/createSuspendingCell.d.ts.map +1 -1
  74. package/dist/components/cell/createSuspendingCell.js +47 -35
  75. package/dist/global.web-auto-imports.d.ts +0 -16
  76. package/dist/global.web-auto-imports.d.ts.map +1 -1
  77. package/dist/index.d.ts +8 -6
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +7 -10
  80. package/package.json +70 -137
  81. package/LICENSE +0 -21
  82. package/apollo/index.js +0 -1
  83. package/apollo/package.json +0 -4
  84. package/dist/apollo/typeOverride.d.ts +0 -21
  85. package/dist/apollo/typeOverride.d.ts.map +0 -1
  86. package/dist/cjs/apollo/fragmentRegistry.d.ts +0 -43
  87. package/dist/cjs/apollo/fragmentRegistry.d.ts.map +0 -1
  88. package/dist/cjs/apollo/fragmentRegistry.js +0 -75
  89. package/dist/cjs/apollo/index.d.ts +0 -76
  90. package/dist/cjs/apollo/index.d.ts.map +0 -1
  91. package/dist/cjs/apollo/index.js +0 -218
  92. package/dist/cjs/apollo/links.d.ts +0 -27
  93. package/dist/cjs/apollo/links.d.ts.map +0 -1
  94. package/dist/cjs/apollo/links.js +0 -122
  95. package/dist/cjs/apollo/sseLink.d.ts +0 -29
  96. package/dist/cjs/apollo/sseLink.d.ts.map +0 -1
  97. package/dist/cjs/apollo/sseLink.js +0 -120
  98. package/dist/cjs/apollo/suspense.d.ts +0 -60
  99. package/dist/cjs/apollo/suspense.d.ts.map +0 -1
  100. package/dist/cjs/apollo/suspense.js +0 -127
  101. package/dist/cjs/apollo/typeOverride.d.ts +0 -21
  102. package/dist/cjs/apollo/typeOverride.d.ts.map +0 -1
  103. package/dist/cjs/apollo/typeOverride.js +0 -16
  104. package/dist/cjs/apollo/useCache.d.ts +0 -22
  105. package/dist/cjs/apollo/useCache.d.ts.map +0 -1
  106. package/dist/cjs/apollo/useCache.js +0 -49
  107. package/dist/cjs/bins/cedar.d.ts +0 -9
  108. package/dist/cjs/bins/cedar.d.ts.map +0 -1
  109. package/dist/cjs/bins/cedar.js +0 -36
  110. package/dist/cjs/bins/cfw.d.ts +0 -3
  111. package/dist/cjs/bins/cfw.d.ts.map +0 -1
  112. package/dist/cjs/bins/cfw.js +0 -36
  113. package/dist/cjs/bins/cross-env.d.ts +0 -3
  114. package/dist/cjs/bins/cross-env.d.ts.map +0 -1
  115. package/dist/cjs/bins/cross-env.js +0 -30
  116. package/dist/cjs/bins/msw.d.ts +0 -3
  117. package/dist/cjs/bins/msw.d.ts.map +0 -1
  118. package/dist/cjs/bins/msw.js +0 -28
  119. package/dist/cjs/bins/redwood.d.ts +0 -9
  120. package/dist/cjs/bins/redwood.d.ts.map +0 -1
  121. package/dist/cjs/bins/redwood.js +0 -36
  122. package/dist/cjs/bins/storybook.d.ts +0 -3
  123. package/dist/cjs/bins/storybook.d.ts.map +0 -1
  124. package/dist/cjs/bins/storybook.js +0 -49
  125. package/dist/cjs/bins/tsc.d.ts +0 -3
  126. package/dist/cjs/bins/tsc.d.ts.map +0 -1
  127. package/dist/cjs/bins/tsc.js +0 -30
  128. package/dist/cjs/bundled/apollo-upload-client.d.ts +0 -3
  129. package/dist/cjs/bundled/apollo-upload-client.d.ts.map +0 -1
  130. package/dist/cjs/bundled/apollo-upload-client.js +0 -2511
  131. package/dist/cjs/components/DevFatalErrorPage.d.ts +0 -21
  132. package/dist/cjs/components/DevFatalErrorPage.d.ts.map +0 -1
  133. package/dist/cjs/components/DevFatalErrorPage.js +0 -552
  134. package/dist/cjs/components/FatalErrorBoundary.d.ts +0 -24
  135. package/dist/cjs/components/FatalErrorBoundary.d.ts.map +0 -1
  136. package/dist/cjs/components/FatalErrorBoundary.js +0 -63
  137. package/dist/cjs/components/FetchConfigProvider.d.ts +0 -25
  138. package/dist/cjs/components/FetchConfigProvider.d.ts.map +0 -1
  139. package/dist/cjs/components/FetchConfigProvider.js +0 -80
  140. package/dist/cjs/components/GraphQLHooksProvider.d.ts +0 -45
  141. package/dist/cjs/components/GraphQLHooksProvider.d.ts.map +0 -1
  142. package/dist/cjs/components/GraphQLHooksProvider.js +0 -135
  143. package/dist/cjs/components/MetaTags.d.ts +0 -52
  144. package/dist/cjs/components/MetaTags.d.ts.map +0 -1
  145. package/dist/cjs/components/MetaTags.js +0 -69
  146. package/dist/cjs/components/Metadata.d.ts +0 -9
  147. package/dist/cjs/components/Metadata.d.ts.map +0 -1
  148. package/dist/cjs/components/Metadata.js +0 -95
  149. package/dist/cjs/components/PortalHead.d.ts +0 -4
  150. package/dist/cjs/components/PortalHead.d.ts.map +0 -1
  151. package/dist/cjs/components/PortalHead.js +0 -59
  152. package/dist/cjs/components/RedwoodProvider.d.ts +0 -9
  153. package/dist/cjs/components/RedwoodProvider.d.ts.map +0 -1
  154. package/dist/cjs/components/RedwoodProvider.js +0 -58
  155. package/dist/cjs/components/ServerInject.d.ts +0 -26
  156. package/dist/cjs/components/ServerInject.d.ts.map +0 -1
  157. package/dist/cjs/components/ServerInject.js +0 -75
  158. package/dist/cjs/components/cell/CellCacheContext.d.ts +0 -20
  159. package/dist/cjs/components/cell/CellCacheContext.d.ts.map +0 -1
  160. package/dist/cjs/components/cell/CellCacheContext.js +0 -53
  161. package/dist/cjs/components/cell/CellErrorBoundary.d.ts +0 -25
  162. package/dist/cjs/components/cell/CellErrorBoundary.d.ts.map +0 -1
  163. package/dist/cjs/components/cell/CellErrorBoundary.js +0 -66
  164. package/dist/cjs/components/cell/cellTypes.d.ts +0 -152
  165. package/dist/cjs/components/cell/cellTypes.d.ts.map +0 -1
  166. package/dist/cjs/components/cell/cellTypes.js +0 -16
  167. package/dist/cjs/components/cell/createCell.d.ts +0 -10
  168. package/dist/cjs/components/cell/createCell.d.ts.map +0 -1
  169. package/dist/cjs/components/cell/createCell.js +0 -165
  170. package/dist/cjs/components/cell/createCell.test.js +0 -351
  171. package/dist/cjs/components/cell/createServerCell.d.ts +0 -15
  172. package/dist/cjs/components/cell/createServerCell.d.ts.map +0 -1
  173. package/dist/cjs/components/cell/createServerCell.js +0 -91
  174. package/dist/cjs/components/cell/createSuspendingCell.d.ts +0 -11
  175. package/dist/cjs/components/cell/createSuspendingCell.d.ts.map +0 -1
  176. package/dist/cjs/components/cell/createSuspendingCell.js +0 -152
  177. package/dist/cjs/components/cell/createSuspendingCell.test.js +0 -115
  178. package/dist/cjs/components/cell/isCellEmpty.d.ts +0 -41
  179. package/dist/cjs/components/cell/isCellEmpty.d.ts.map +0 -1
  180. package/dist/cjs/components/cell/isCellEmpty.js +0 -35
  181. package/dist/cjs/components/htmlTags.d.ts +0 -52
  182. package/dist/cjs/components/htmlTags.d.ts.map +0 -1
  183. package/dist/cjs/components/htmlTags.js +0 -88
  184. package/dist/cjs/config.d.ts +0 -2
  185. package/dist/cjs/config.d.ts.map +0 -1
  186. package/dist/cjs/config.js +0 -6
  187. package/dist/cjs/entry/index.js +0 -38
  188. package/dist/cjs/global.web-auto-imports.d.ts +0 -30
  189. package/dist/cjs/global.web-auto-imports.d.ts.map +0 -1
  190. package/dist/cjs/global.web-auto-imports.js +0 -16
  191. package/dist/cjs/graphql.d.ts +0 -23
  192. package/dist/cjs/graphql.d.ts.map +0 -1
  193. package/dist/cjs/graphql.js +0 -36
  194. package/dist/cjs/index.d.ts +0 -20
  195. package/dist/cjs/index.d.ts.map +0 -1
  196. package/dist/cjs/index.js +0 -80
  197. package/dist/cjs/package.json +0 -1
  198. package/dist/cjs/routeHooks.types.d.ts +0 -12
  199. package/dist/cjs/routeHooks.types.d.ts.map +0 -1
  200. package/dist/cjs/routeHooks.types.js +0 -16
  201. package/dist/cjs/server/MiddlewareRequest.d.ts +0 -28
  202. package/dist/cjs/server/MiddlewareRequest.d.ts.map +0 -1
  203. package/dist/cjs/server/MiddlewareRequest.js +0 -71
  204. package/dist/cjs/server/MiddlewareResponse.d.ts +0 -44
  205. package/dist/cjs/server/MiddlewareResponse.d.ts.map +0 -1
  206. package/dist/cjs/server/MiddlewareResponse.js +0 -130
  207. package/dist/cjs/server/middleware.d.ts +0 -17
  208. package/dist/cjs/server/middleware.d.ts.map +0 -1
  209. package/dist/cjs/server/middleware.js +0 -24
  210. package/dist/cjs/server/request.d.ts +0 -2
  211. package/dist/cjs/server/request.d.ts.map +0 -1
  212. package/dist/cjs/server/request.js +0 -34
  213. package/dist/cjs/streamUtils/useDocumentReady.d.ts +0 -11
  214. package/dist/cjs/streamUtils/useDocumentReady.d.ts.map +0 -1
  215. package/dist/cjs/streamUtils/useDocumentReady.js +0 -41
  216. package/dist/cjs/toast/index.d.ts +0 -3
  217. package/dist/cjs/toast/index.d.ts.map +0 -1
  218. package/dist/cjs/toast/index.js +0 -41
  219. package/dist/components/GraphQLHooksProvider.d.ts +0 -45
  220. package/dist/components/GraphQLHooksProvider.d.ts.map +0 -1
  221. package/dist/components/GraphQLHooksProvider.js +0 -94
  222. package/dist/components/RedwoodProvider.d.ts.map +0 -1
  223. package/dist/components/cell/createCell.test.js +0 -328
  224. package/dist/components/cell/createSuspendingCell.test.js +0 -92
  225. package/dist/entry/index.d.ts +0 -1
  226. package/dist/entry/index.js +0 -15
  227. package/dist/package.json +0 -1
  228. package/src/entry/index.jsx +0 -27
  229. package/toast/index.js +0 -1
  230. package/toast/package.json +0 -4
  231. /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=RedwoodProvider.d.ts.map
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 * as helmetPkg from "@dr.pogodin/react-helmet";
3
- const { Helmet, HelmetProvider } = helmetPkg;
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 { GraphQLError } from 'graphql';
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 GraphQLError {
9
+ interface EnhancedGqlError extends GraphQLFormattedError {
10
10
  __RedwoodEnhancedError: RequestDetails;
11
11
  }
12
12
  type ErrorWithRequestMeta = Error & {
13
13
  mostRecentRequest?: RequestDetails;
14
- graphQLErrors?: EnhancedGqlError[];
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,YAAY,EAAE,MAAM,SAAS,CAAA;AAmB3C,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,YAAY;IAC7C,sBAAsB,EAAE,cAAc,CAAA;CACvC;AAGD,KAAK,oBAAoB,GAAG,KAAK,GAAG;IAClC,iBAAiB,CAAC,EAAE,cAAc,CAAA;IAClC,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAClC,kBAAkB,CAAC,EAAE,GAAG,CAAA;CACzB,CAAA;AAiGD,eAAO,MAAM,iBAAiB,GAAI,OAAO;IAAE,KAAK,CAAC,EAAE,oBAAoB,CAAA;CAAE,sBA4FxE,CAAA"}
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.graphQLErrors?.find((gqlErr) => gqlErr.__RedwoodEnhancedError)?.__RedwoodEnhancedError;
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 && err.message);
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.graphQLErrors?.find((gqlErr) => gqlErr.__RedwoodEnhancedError)?.__RedwoodEnhancedError;
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.PromiseLikeOfReactNode | React.JSX.Element | null | undefined;
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 packages/web/src/apollo/index.tsx
20
- * as the token is retrieved async
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;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA+B/C,CAAA;AAED,eAAO,MAAM,cAAc,mBAA6C,CAAA"}
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;AASzB,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
+ {"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 * as helmetPkg from "@dr.pogodin/react-helmet";
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;AA0CzB;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,sBAgElD,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 * as helmetPkg from "@dr.pogodin/react-helmet";
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: QueryOperationResult['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?: QueryOperationResult['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,oBAAoB,CAAC,OAAO,CAAC,CAAA;I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B,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, QueryRef, UseBackgroundQueryResult } from '@apollo/client';
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']>[0] extends unknown ? Record<string, unknown> : Parameters<Cell['beforeQuery']>[0] : GQLVariables extends Record<string, never> ? unknown : GQLVariables;
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?: QueryOperationResult['error'] | 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: DocumentNode | ((variables: Record<string, unknown>) => DocumentNode);
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<QueryOperationResult<TData, TVariables>, 'loading' | 'error' | 'data'>>;
146
- export interface SuspenseCellQueryResult<_TData = any, _TVariables extends OperationVariables = any> extends UseBackgroundQueryResult {
147
- client: ApolloClient<any>;
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;AAElE,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,wBAAwB,EACzB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;;;;;GASG;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,CAAC,CAAC,CAAC,SAAS,OAAO,GAChD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GACpC,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACxC,OAAO,GAC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,CAChE,CAAA;IACD;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,EAAE,CACf,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAChE,CAAA;IACD;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,iBAAiB,CAC1D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CACxB,GAAG;IACF,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAA;IAC9B,mBAAmB,EAAE,uBAAuB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;IAC7D,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,0BAA0B,CACpC,UAAU,SAAS,kBAAkB,GAAG,GAAG,EAC3C,KAAK,GAAG,GAAG,IACT,OAAO,CACT,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC,CACvE,CAAA;AAID,MAAM,WAAW,uBAAuB,CACtC,MAAM,GAAG,GAAG,EACZ,WAAW,SAAS,kBAAkB,GAAG,GAAG,CAC5C,SAAQ,kBAAkB,CAAC,MAAM,CAAC,UAAU,CAAC;IAC7C,MAAM,EAAE,YAAY,CAAA;IAEpB,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,MAAM,EAAE,OAAO,CAAA;CAChB"}
@@ -1,10 +1,5 @@
1
1
  import React from 'react';
2
+ import type { OperationVariables } from '@apollo/client';
2
3
  import type { CreateCellProps } from './cellTypes.js';
3
- import { createSuspendingCell } from './createSuspendingCell.js';
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;AAUzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAIhE,eAAO,MAAM,UAAU,8DAEI,CAAA;AAE3B;;GAEG;AACH,iBAAS,uBAAuB,CAC9B,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7C,EACA,KAAK,EACL,WAWE,EACF,UAA2B,EAC3B,OAAqB,EACrB,OAA+B,EAC/B,OAAO,EACP,KAAK,EACL,OAAO,EACP,WAAoB,GACrB,EAAE,eAAe,CAAC,SAAS,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAuIjE"}
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
- const createCell = RWJS_ENV.RWJS_EXP_STREAMING_SSR ? createSuspendingCell : createNonSuspendingCell;
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 query = typeof QUERY === "function" ? QUERY(options) : QUERY;
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
- const operationName = getOperationName(query);
45
- const transformedQuery = fragmentRegistry.transform(query);
46
- let cacheKey;
47
- if (operationName) {
48
- cacheKey = operationName + "_" + JSON.stringify(variables);
49
- } else {
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
- queryCache[cacheKey] ||= {
65
- query: transformedQuery,
66
- variables: options.variables,
67
- hasProcessed: false
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
- return /* @__PURE__ */ React.createElement(
75
- Failure,
76
- {
77
- error,
78
- errorCode: (
79
- // Use the ad-hoc QueryResultWithErrorCode type to access the errorCode
80
- queryResult.errorCode ?? error.graphQLErrors?.[0]?.extensions?.["code"]
81
- ),
82
- ...props,
83
- updating: loading,
84
- queryResult
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
- return /* @__PURE__ */ React.createElement(
94
- Empty,
95
- {
96
- ...props,
97
- ...afterQueryData,
98
- updating: loading,
99
- queryResult
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
- return /* @__PURE__ */ React.createElement(
104
- Success,
105
- {
106
- ...props,
107
- ...afterQueryData,
108
- updating: loading,
109
- queryResult
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
- return /* @__PURE__ */ React.createElement(Loading, { ...props, queryResult });
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"}