@cedarjs/web 5.0.7-next.338 → 5.0.7

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 (192) hide show
  1. package/dist/apollo/fragmentRegistry.d.ts +0 -25
  2. package/dist/apollo/fragmentRegistry.d.ts.map +1 -1
  3. package/dist/apollo/fragmentRegistry.js +1 -19
  4. package/dist/apollo/index.d.ts +70 -50
  5. package/dist/apollo/index.d.ts.map +1 -1
  6. package/dist/apollo/index.js +184 -2
  7. package/dist/apollo/suspense.d.ts +7 -16
  8. package/dist/apollo/suspense.d.ts.map +1 -1
  9. package/dist/apollo/suspense.js +26 -9
  10. package/dist/apollo/typeOverride.d.ts +21 -0
  11. package/dist/apollo/typeOverride.d.ts.map +1 -0
  12. package/dist/bundled/apollo-upload-client.js +1 -2899
  13. package/dist/cjs/apollo/fragmentRegistry.d.ts +43 -0
  14. package/dist/cjs/apollo/fragmentRegistry.d.ts.map +1 -0
  15. package/dist/cjs/apollo/fragmentRegistry.js +75 -0
  16. package/dist/cjs/apollo/index.d.ts +76 -0
  17. package/dist/cjs/apollo/index.d.ts.map +1 -0
  18. package/dist/cjs/apollo/index.js +218 -0
  19. package/dist/cjs/apollo/links.d.ts +27 -0
  20. package/dist/cjs/apollo/links.d.ts.map +1 -0
  21. package/dist/cjs/apollo/links.js +122 -0
  22. package/dist/cjs/apollo/sseLink.d.ts +29 -0
  23. package/dist/cjs/apollo/sseLink.d.ts.map +1 -0
  24. package/dist/cjs/apollo/sseLink.js +120 -0
  25. package/dist/{apollo/apolloLinkTypes.d.ts → cjs/apollo/suspense.d.ts} +22 -22
  26. package/dist/cjs/apollo/suspense.d.ts.map +1 -0
  27. package/dist/cjs/apollo/suspense.js +127 -0
  28. package/dist/cjs/apollo/typeOverride.d.ts +21 -0
  29. package/dist/cjs/apollo/typeOverride.d.ts.map +1 -0
  30. package/dist/cjs/apollo/typeOverride.js +16 -0
  31. package/dist/cjs/apollo/useCache.d.ts +22 -0
  32. package/dist/cjs/apollo/useCache.d.ts.map +1 -0
  33. package/dist/cjs/apollo/useCache.js +49 -0
  34. package/dist/cjs/bins/cedar.d.ts +9 -0
  35. package/dist/cjs/bins/cedar.d.ts.map +1 -0
  36. package/dist/cjs/bins/cedar.js +36 -0
  37. package/dist/cjs/bins/cfw.d.ts +3 -0
  38. package/dist/cjs/bins/cfw.d.ts.map +1 -0
  39. package/dist/cjs/bins/cfw.js +36 -0
  40. package/dist/cjs/bins/cross-env.d.ts +3 -0
  41. package/dist/cjs/bins/cross-env.d.ts.map +1 -0
  42. package/dist/cjs/bins/cross-env.js +30 -0
  43. package/dist/cjs/bins/msw.d.ts +3 -0
  44. package/dist/cjs/bins/msw.d.ts.map +1 -0
  45. package/dist/cjs/bins/msw.js +28 -0
  46. package/dist/cjs/bins/redwood.d.ts +9 -0
  47. package/dist/cjs/bins/redwood.d.ts.map +1 -0
  48. package/dist/cjs/bins/redwood.js +36 -0
  49. package/dist/cjs/bins/storybook.d.ts +3 -0
  50. package/dist/cjs/bins/storybook.d.ts.map +1 -0
  51. package/dist/cjs/bins/storybook.js +49 -0
  52. package/dist/cjs/bins/tsc.d.ts +3 -0
  53. package/dist/cjs/bins/tsc.d.ts.map +1 -0
  54. package/dist/cjs/bins/tsc.js +30 -0
  55. package/dist/cjs/bundled/apollo-upload-client.d.ts +3 -0
  56. package/dist/cjs/bundled/apollo-upload-client.d.ts.map +1 -0
  57. package/dist/cjs/bundled/apollo-upload-client.js +2925 -0
  58. package/dist/cjs/components/DevFatalErrorPage.d.ts +21 -0
  59. package/dist/cjs/components/DevFatalErrorPage.d.ts.map +1 -0
  60. package/dist/cjs/components/DevFatalErrorPage.js +552 -0
  61. package/dist/cjs/components/FatalErrorBoundary.d.ts +24 -0
  62. package/dist/cjs/components/FatalErrorBoundary.d.ts.map +1 -0
  63. package/dist/cjs/components/FatalErrorBoundary.js +63 -0
  64. package/dist/cjs/components/FetchConfigProvider.d.ts +25 -0
  65. package/dist/cjs/components/FetchConfigProvider.d.ts.map +1 -0
  66. package/dist/cjs/components/FetchConfigProvider.js +80 -0
  67. package/dist/cjs/components/GraphQLHooksProvider.d.ts +45 -0
  68. package/dist/cjs/components/GraphQLHooksProvider.d.ts.map +1 -0
  69. package/dist/cjs/components/GraphQLHooksProvider.js +135 -0
  70. package/dist/cjs/components/MetaTags.d.ts +52 -0
  71. package/dist/cjs/components/MetaTags.d.ts.map +1 -0
  72. package/dist/cjs/components/MetaTags.js +68 -0
  73. package/dist/cjs/components/Metadata.d.ts +9 -0
  74. package/dist/cjs/components/Metadata.d.ts.map +1 -0
  75. package/dist/cjs/components/Metadata.js +94 -0
  76. package/dist/cjs/components/PortalHead.d.ts +4 -0
  77. package/dist/cjs/components/PortalHead.d.ts.map +1 -0
  78. package/dist/cjs/components/PortalHead.js +59 -0
  79. package/dist/{components/CedarProvider.d.ts → cjs/components/RedwoodProvider.d.ts} +1 -3
  80. package/dist/cjs/components/RedwoodProvider.d.ts.map +1 -0
  81. package/dist/cjs/components/RedwoodProvider.js +57 -0
  82. package/dist/cjs/components/ServerInject.d.ts +26 -0
  83. package/dist/cjs/components/ServerInject.d.ts.map +1 -0
  84. package/dist/cjs/components/ServerInject.js +75 -0
  85. package/dist/cjs/components/cell/CellCacheContext.d.ts +20 -0
  86. package/dist/cjs/components/cell/CellCacheContext.d.ts.map +1 -0
  87. package/dist/cjs/components/cell/CellCacheContext.js +53 -0
  88. package/dist/cjs/components/cell/CellErrorBoundary.d.ts +25 -0
  89. package/dist/cjs/components/cell/CellErrorBoundary.d.ts.map +1 -0
  90. package/dist/cjs/components/cell/CellErrorBoundary.js +66 -0
  91. package/dist/cjs/components/cell/cellTypes.d.ts +152 -0
  92. package/dist/cjs/components/cell/cellTypes.d.ts.map +1 -0
  93. package/dist/cjs/components/cell/cellTypes.js +16 -0
  94. package/dist/cjs/components/cell/createCell.d.ts +10 -0
  95. package/dist/cjs/components/cell/createCell.d.ts.map +1 -0
  96. package/dist/cjs/components/cell/createCell.js +165 -0
  97. package/dist/cjs/components/cell/createCell.test.js +351 -0
  98. package/dist/cjs/components/cell/createServerCell.d.ts +15 -0
  99. package/dist/cjs/components/cell/createServerCell.d.ts.map +1 -0
  100. package/dist/cjs/components/cell/createServerCell.js +91 -0
  101. package/dist/cjs/components/cell/createSuspendingCell.d.ts +11 -0
  102. package/dist/cjs/components/cell/createSuspendingCell.d.ts.map +1 -0
  103. package/dist/cjs/components/cell/createSuspendingCell.js +152 -0
  104. package/dist/cjs/components/cell/createSuspendingCell.test.js +115 -0
  105. package/dist/cjs/components/cell/isCellEmpty.d.ts +41 -0
  106. package/dist/cjs/components/cell/isCellEmpty.d.ts.map +1 -0
  107. package/dist/cjs/components/cell/isCellEmpty.js +35 -0
  108. package/dist/cjs/components/htmlTags.d.ts +52 -0
  109. package/dist/cjs/components/htmlTags.d.ts.map +1 -0
  110. package/dist/cjs/components/htmlTags.js +88 -0
  111. package/dist/cjs/config.d.ts +2 -0
  112. package/dist/cjs/config.d.ts.map +1 -0
  113. package/dist/cjs/config.js +6 -0
  114. package/dist/cjs/global.web-auto-imports.d.ts +30 -0
  115. package/dist/cjs/global.web-auto-imports.d.ts.map +1 -0
  116. package/dist/cjs/global.web-auto-imports.js +16 -0
  117. package/dist/cjs/graphql.d.ts +23 -0
  118. package/dist/cjs/graphql.d.ts.map +1 -0
  119. package/dist/cjs/graphql.js +36 -0
  120. package/dist/cjs/index.d.ts +19 -0
  121. package/dist/cjs/index.d.ts.map +1 -0
  122. package/dist/cjs/index.js +69 -0
  123. package/dist/cjs/package.json +1 -0
  124. package/dist/cjs/routeHooks.types.d.ts +12 -0
  125. package/dist/cjs/routeHooks.types.d.ts.map +1 -0
  126. package/dist/cjs/routeHooks.types.js +16 -0
  127. package/dist/cjs/server/MiddlewareRequest.d.ts +28 -0
  128. package/dist/cjs/server/MiddlewareRequest.d.ts.map +1 -0
  129. package/dist/cjs/server/MiddlewareRequest.js +71 -0
  130. package/dist/cjs/server/MiddlewareResponse.d.ts +44 -0
  131. package/dist/cjs/server/MiddlewareResponse.d.ts.map +1 -0
  132. package/dist/cjs/server/MiddlewareResponse.js +130 -0
  133. package/dist/cjs/server/middleware.d.ts +17 -0
  134. package/dist/cjs/server/middleware.d.ts.map +1 -0
  135. package/dist/cjs/server/middleware.js +24 -0
  136. package/dist/cjs/server/request.d.ts +2 -0
  137. package/dist/cjs/server/request.d.ts.map +1 -0
  138. package/dist/cjs/server/request.js +34 -0
  139. package/dist/cjs/streamUtils/useDocumentReady.d.ts +11 -0
  140. package/dist/cjs/streamUtils/useDocumentReady.d.ts.map +1 -0
  141. package/dist/cjs/streamUtils/useDocumentReady.js +41 -0
  142. package/dist/cjs/toast/index.d.ts +3 -0
  143. package/dist/cjs/toast/index.d.ts.map +1 -0
  144. package/dist/cjs/toast/index.js +41 -0
  145. package/dist/components/FetchConfigProvider.d.ts +2 -3
  146. package/dist/components/FetchConfigProvider.d.ts.map +1 -1
  147. package/dist/components/GraphQLHooksProvider.d.ts +45 -0
  148. package/dist/components/GraphQLHooksProvider.d.ts.map +1 -0
  149. package/dist/components/GraphQLHooksProvider.js +94 -0
  150. package/dist/components/RedwoodProvider.d.ts +9 -0
  151. package/dist/components/RedwoodProvider.d.ts.map +1 -0
  152. package/dist/components/{CedarProvider.js → RedwoodProvider.js} +1 -3
  153. package/dist/components/cell/CellErrorBoundary.d.ts +2 -3
  154. package/dist/components/cell/CellErrorBoundary.d.ts.map +1 -1
  155. package/dist/components/cell/cellTypes.d.ts +7 -22
  156. package/dist/components/cell/cellTypes.d.ts.map +1 -1
  157. package/dist/components/cell/createCell.d.ts +7 -1
  158. package/dist/components/cell/createCell.d.ts.map +1 -1
  159. package/dist/components/cell/createCell.js +3 -22
  160. package/dist/components/cell/createCell.test.js +328 -0
  161. package/dist/components/cell/createSuspendingCell.d.ts.map +1 -1
  162. package/dist/components/cell/createSuspendingCell.js +3 -12
  163. package/dist/components/cell/createSuspendingCell.test.js +92 -0
  164. package/dist/global.web-auto-imports.d.ts +16 -0
  165. package/dist/global.web-auto-imports.d.ts.map +1 -1
  166. package/dist/index.d.ts +3 -6
  167. package/dist/index.d.ts.map +1 -1
  168. package/dist/index.js +4 -6
  169. package/dist/package.json +1 -0
  170. package/package.json +106 -48
  171. package/dist/apollo/ApolloProviderWithFetchConfig.d.ts +0 -15
  172. package/dist/apollo/ApolloProviderWithFetchConfig.d.ts.map +0 -1
  173. package/dist/apollo/ApolloProviderWithFetchConfig.js +0 -134
  174. package/dist/apollo/CedarApolloProvider.d.ts +0 -14
  175. package/dist/apollo/CedarApolloProvider.d.ts.map +0 -1
  176. package/dist/apollo/CedarApolloProvider.js +0 -35
  177. package/dist/apollo/ErrorBoundary.d.ts +0 -13
  178. package/dist/apollo/ErrorBoundary.d.ts.map +0 -1
  179. package/dist/apollo/ErrorBoundary.js +0 -13
  180. package/dist/apollo/apolloLinkTypes.d.ts.map +0 -1
  181. package/dist/bins/cedar.js +0 -14
  182. package/dist/bins/cfw.js +0 -14
  183. package/dist/bins/cross-env.js +0 -8
  184. package/dist/bins/msw.js +0 -6
  185. package/dist/bins/redwood.js +0 -14
  186. package/dist/bins/storybook.js +0 -27
  187. package/dist/bins/tsc.js +0 -8
  188. package/dist/components/CedarProvider.d.ts.map +0 -1
  189. package/dist/components/cell/createFragmentCell.d.ts +0 -19
  190. package/dist/components/cell/createFragmentCell.d.ts.map +0 -1
  191. package/dist/components/cell/createFragmentCell.js +0 -73
  192. /package/dist/apollo/{apolloLinkTypes.js → typeOverride.js} +0 -0
@@ -0,0 +1,328 @@
1
+ import React from "react";
2
+ import { render, screen } from "@testing-library/react";
3
+ import { vi, describe, beforeAll, test, expect } from "vitest";
4
+ import { GraphQLHooksProvider } from "../GraphQLHooksProvider.js";
5
+ import { createCell } from "./createCell.js";
6
+ describe("createCell", () => {
7
+ beforeAll(() => {
8
+ globalThis.RWJS_ENV = {
9
+ RWJS_EXP_STREAMING_SSR: false
10
+ };
11
+ });
12
+ test("Renders a static Success component", () => {
13
+ const TestCell = createCell({
14
+ // @ts-expect-error - Purposefully using a plain string here.
15
+ QUERY: "query TestQuery { answer }",
16
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!")
17
+ });
18
+ const myUseQueryHook = () => ({ data: {} });
19
+ render(
20
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
21
+ );
22
+ screen.getByText(/^Great success!$/);
23
+ });
24
+ test("Renders Success with data", () => {
25
+ const TestCell = createCell({
26
+ // @ts-expect-error - Purposefully using a plain string here.
27
+ QUERY: "query TestQuery { answer }",
28
+ Success: ({ answer }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("dl", null, /* @__PURE__ */ React.createElement("dt", null, "What's the meaning of life?"), /* @__PURE__ */ React.createElement("dd", null, answer)))
29
+ });
30
+ const myUseQueryHook = () => {
31
+ return { data: { answer: 42 } };
32
+ };
33
+ render(
34
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
35
+ );
36
+ screen.getByText(/^What's the meaning of life\?$/);
37
+ screen.getByText(/^42$/);
38
+ });
39
+ test("Renders Success if any of the fields have data (i.e. not just the first)", () => {
40
+ const TestCell = createCell({
41
+ // @ts-expect-error - Purposefully using a plain string here.
42
+ QUERY: "query TestQuery { users { name } posts { title } }",
43
+ Empty: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "No users or posts"),
44
+ Success: ({ users, posts }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", null, users.length > 0 ? /* @__PURE__ */ React.createElement("ul", null, users.map(({ name }) => /* @__PURE__ */ React.createElement("li", { key: name }, name))) : "no users"), /* @__PURE__ */ React.createElement("div", null, posts.length > 0 ? /* @__PURE__ */ React.createElement("ul", null, posts.map(({ title }) => /* @__PURE__ */ React.createElement("li", { key: title }, title))) : "no posts"))
45
+ });
46
+ const myUseQueryHook = () => {
47
+ return {
48
+ data: {
49
+ users: [],
50
+ posts: [{ title: "bazinga" }, { title: "kittens" }]
51
+ }
52
+ };
53
+ };
54
+ render(
55
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
56
+ );
57
+ screen.getByText(/bazinga/);
58
+ screen.getByText(/kittens/);
59
+ });
60
+ test("Renders default Loading when there is no data", () => {
61
+ const TestCell = createCell({
62
+ // @ts-expect-error - Purposefully using a plain string here.
63
+ QUERY: "query TestQuery { answer }",
64
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!")
65
+ });
66
+ const myUseQueryHook = () => ({ loading: true });
67
+ render(
68
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
69
+ );
70
+ screen.getByText(/^Loading...$/);
71
+ });
72
+ test("Renders custom Loading when there is no data", () => {
73
+ const TestCell = createCell({
74
+ // @ts-expect-error - Purposefully using a plain string here.
75
+ QUERY: "query TestQuery { answer }",
76
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!"),
77
+ Loading: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Fetching answer...")
78
+ });
79
+ const myUseQueryHook = () => ({ loading: true });
80
+ render(
81
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
82
+ );
83
+ screen.getByText(/^Fetching answer...$/);
84
+ });
85
+ test("Renders Success even when `loading` is true if there is data", () => {
86
+ const TestCell = createCell({
87
+ // @ts-expect-error - Purposefully using a plain string here.
88
+ QUERY: "query TestQuery { answer }",
89
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!"),
90
+ Loading: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Fetching answer...")
91
+ });
92
+ const myUseQueryHook = () => ({ loading: true, data: {} });
93
+ render(
94
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
95
+ );
96
+ screen.getByText(/^Great success!$/);
97
+ });
98
+ test("Renders Empty if available, and data field is null", () => {
99
+ const TestCell = createCell({
100
+ // @ts-expect-error - Purposefully using a plain string here.
101
+ QUERY: "query TestQuery { answer }",
102
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!"),
103
+ Empty: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "No one knows")
104
+ });
105
+ const myUseQueryHook = () => ({ loading: true, data: { answer: null } });
106
+ render(
107
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
108
+ );
109
+ screen.getByText(/^No one knows$/);
110
+ });
111
+ test("Renders Empty if available, and data field is an empty array", () => {
112
+ const TestCell = createCell({
113
+ // @ts-expect-error - Purposefully using a plain string here.
114
+ QUERY: "query TestQuery { answers }",
115
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!"),
116
+ Empty: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "No one knows")
117
+ });
118
+ const myUseQueryHook = () => ({ loading: true, data: { answers: [] } });
119
+ render(
120
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
121
+ );
122
+ screen.getByText(/^No one knows$/);
123
+ });
124
+ test("Renders Success even if data is empty when no Empty is available", () => {
125
+ const TestCell = createCell({
126
+ // @ts-expect-error - Purposefully using a plain string here.
127
+ QUERY: "query TestQuery { answer }",
128
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Empty success")
129
+ });
130
+ const myUseQueryHook = () => ({ loading: true, data: { answer: null } });
131
+ render(
132
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
133
+ );
134
+ screen.getByText(/^Empty success$/);
135
+ });
136
+ test("Allows passing children to Success", () => {
137
+ const TestCell = createCell({
138
+ // @ts-expect-error - Purposefully using a plain string here.
139
+ QUERY: "query TestQuery { answer }",
140
+ Success: ({ children }) => /* @__PURE__ */ React.createElement(React.Fragment, null, "Look at my beautiful ", children)
141
+ });
142
+ const myUseQueryHook = () => ({ data: {} });
143
+ render(
144
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null, /* @__PURE__ */ React.createElement("div", null, "\u{1F986}")))
145
+ );
146
+ screen.getByText(/^Look at my beautiful$/);
147
+ screen.getByText(/^🦆$/);
148
+ });
149
+ test("Cell props are passed to the query as variables", () => {
150
+ const TestCell = createCell({
151
+ // @ts-expect-error - Purposefully using a plain string here.
152
+ QUERY: `query Greet($name: String!) {
153
+ greet(name: $name) {
154
+ greeting
155
+ }
156
+ }`,
157
+ Success: ({ greeting }) => /* @__PURE__ */ React.createElement("p", null, greeting)
158
+ });
159
+ const myUseQueryHook = (_query, options) => {
160
+ return { data: { greeting: `Hello ${options.variables.name}!` } };
161
+ };
162
+ render(
163
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, { name: "Bob" }))
164
+ );
165
+ screen.getByText(/^Hello Bob!$/);
166
+ });
167
+ test("Allows QUERY to be a function", () => {
168
+ const TestCell = createCell({
169
+ // @ts-expect-error - Purposefully using a plain string here.
170
+ QUERY: ({ variables }) => {
171
+ if (variables.character === "BEAST") {
172
+ return "query BeastQuery { name }";
173
+ }
174
+ return "query HeroQuery { name }";
175
+ },
176
+ Success: ({ name }) => /* @__PURE__ */ React.createElement("p", null, "Call me ", name)
177
+ });
178
+ const myUseQueryHook = (query) => {
179
+ if (query.includes("BeastQuery")) {
180
+ return { data: { name: "Boogeyman" } };
181
+ } else if (query.includes("HeroQuery")) {
182
+ return { data: { name: "Lara Croft" } };
183
+ }
184
+ return { data: { name: "John Doe" } };
185
+ };
186
+ render(
187
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, { character: "BEAST" }), /* @__PURE__ */ React.createElement(TestCell, { character: "HERO" }))
188
+ );
189
+ screen.getByText(/^Call me Boogeyman$/);
190
+ screen.getByText(/^Call me Lara Croft$/);
191
+ });
192
+ test("Renders Failure when there is an error", () => {
193
+ const TestCell = createCell({
194
+ // @ts-expect-error - Purposefully using a plain string here.
195
+ QUERY: "query TestQuery { answer }",
196
+ Failure: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Sad face :("),
197
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!"),
198
+ Loading: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Fetching answer...")
199
+ });
200
+ const myUseQueryHook = () => ({ error: true });
201
+ render(
202
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
203
+ );
204
+ screen.getByText(/^Sad face :\($/);
205
+ });
206
+ test("Passes error to Failure component", () => {
207
+ const TestCell = createCell({
208
+ // @ts-expect-error - Purposefully using a plain string here.
209
+ QUERY: "query TestQuery { answer }",
210
+ Failure: ({ error }) => /* @__PURE__ */ React.createElement(React.Fragment, null, JSON.stringify(error)),
211
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!"),
212
+ Loading: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Fetching answer...")
213
+ });
214
+ const myUseQueryHook = () => ({ error: { msg: "System malfunction" } });
215
+ render(
216
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
217
+ );
218
+ screen.getByText(/^{"msg":"System malfunction"}$/);
219
+ });
220
+ test("Passes error and errorCode to Failure component", () => {
221
+ const TestCell = createCell({
222
+ // @ts-expect-error - Purposefully using a plain string here.
223
+ QUERY: "query TestQuery { answer }",
224
+ Failure: ({ error, errorCode }) => /* @__PURE__ */ React.createElement(React.Fragment, null, JSON.stringify(error), ",code:", errorCode),
225
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!"),
226
+ Loading: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Fetching answer...")
227
+ });
228
+ const myUseQueryHook = () => ({
229
+ error: { msg: "System malfunction" },
230
+ errorCode: "SIMON_SAYS_NO"
231
+ });
232
+ render(
233
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
234
+ );
235
+ screen.getByText(/^{"msg":"System malfunction"},code:SIMON_SAYS_NO$/);
236
+ });
237
+ test("Passes children to Failure", () => {
238
+ const TestCell = createCell({
239
+ // @ts-expect-error - Purposefully using a plain string here.
240
+ QUERY: "query TestQuery { answer }",
241
+ Failure: ({ children }) => /* @__PURE__ */ React.createElement(React.Fragment, null, "I'm a failure ", children)
242
+ });
243
+ const myUseQueryHook = () => ({ error: {} });
244
+ render(
245
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null, /* @__PURE__ */ React.createElement("div", null, "Child")))
246
+ );
247
+ screen.getByText(/^I'm a failure$/);
248
+ screen.getByText(/^Child$/);
249
+ });
250
+ test("Throws an error when there is an error if no Failure component exists", () => {
251
+ const TestCell = createCell({
252
+ // @ts-expect-error - Purposefully using a plain string here.
253
+ QUERY: "query TestQuery { answer }",
254
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!"),
255
+ Loading: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Fetching answer...")
256
+ });
257
+ const myUseQueryHook = () => ({ error: { message: "200 GraphQL" } });
258
+ const err = console.error;
259
+ console.error = vi.fn();
260
+ let error;
261
+ try {
262
+ render(
263
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
264
+ );
265
+ } catch (e) {
266
+ error = e;
267
+ }
268
+ expect(error.message).toEqual("200 GraphQL");
269
+ console.error = err;
270
+ });
271
+ test("Allows overriding of default isDataEmpty", () => {
272
+ const TestCell = createCell({
273
+ // @ts-expect-error - Purposefully using a plain string here.
274
+ QUERY: "query TestQuery { answer }",
275
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!"),
276
+ Empty: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Got nothing"),
277
+ isEmpty: () => true
278
+ });
279
+ const myUseQueryHook = () => ({
280
+ data: {},
281
+ loading: false
282
+ });
283
+ render(
284
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
285
+ );
286
+ screen.getByText(/^Got nothing$/);
287
+ });
288
+ test("Allows mixing isDataEmpty with custom logic", () => {
289
+ const TestCell = createCell({
290
+ // @ts-expect-error - Purposefully using a plain string here.
291
+ QUERY: "query TestQuery { answer }",
292
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!"),
293
+ Empty: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Got nothing"),
294
+ isEmpty: (data, { isDataEmpty }) => isDataEmpty(data) || data.answer === "0"
295
+ });
296
+ const myUseQueryHook = () => ({
297
+ data: { answer: "0" },
298
+ loading: false
299
+ });
300
+ render(
301
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
302
+ );
303
+ screen.getByText(/^Got nothing$/);
304
+ });
305
+ test("Allows overriding variables in beforeQuery", () => {
306
+ const TestCell = createCell({
307
+ // @ts-expect-error - Purposefully using a plain string here.
308
+ QUERY: `query Greet($name: String!) {
309
+ greet(name: $name) {
310
+ greeting
311
+ }
312
+ }`,
313
+ Success: ({ greeting }) => /* @__PURE__ */ React.createElement("p", null, greeting),
314
+ beforeQuery: () => ({
315
+ variables: {
316
+ name: "Bob"
317
+ }
318
+ })
319
+ });
320
+ const myUseQueryHook = (_query, options) => {
321
+ return { data: { greeting: `Hello ${options.variables.name}!` } };
322
+ };
323
+ render(
324
+ /* @__PURE__ */ React.createElement(GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ React.createElement(TestCell, null))
325
+ );
326
+ screen.getByText(/^Hello Bob!$/);
327
+ });
328
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"createSuspendingCell.d.ts","sourceRoot":"","sources":["../../../src/components/cell/createSuspendingCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAWvC,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,gBAAgB,CAAA;AAGvB,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACrC;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,SAAS,MAAM,EACxB,aAAa,SAAS,MAAM,EAE5B,eAAe,EAAE,eAAe,CAAC,MAAM,EAAE,aAAa,CAAC,GACtD,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAiJrB"}
1
+ {"version":3,"file":"createSuspendingCell.d.ts","sourceRoot":"","sources":["../../../src/components/cell/createSuspendingCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAYvC,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,gBAAgB,CAAA;AAGvB,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACrC;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,SAAS,MAAM,EACxB,aAAa,SAAS,MAAM,EAE5B,eAAe,EAAE,eAAe,CAAC,MAAM,EAAE,aAAa,CAAC,GACtD,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAqIrB"}
@@ -1,9 +1,6 @@
1
1
  import React, { Suspense } from "react";
2
- import {
3
- useApolloClient,
4
- useBackgroundQuery,
5
- useReadQuery
6
- } from "@apollo/client/react/hooks/hooks.cjs";
2
+ import { useApolloClient } from "@apollo/client/react/hooks/hooks.cjs";
3
+ import { useBackgroundQuery, useReadQuery } from "../GraphQLHooksProvider.js";
7
4
  import { CellErrorBoundary } from "./CellErrorBoundary.js";
8
5
  import { isDataEmpty } from "./isCellEmpty.js";
9
6
  function createSuspendingCell(createCellProps) {
@@ -29,12 +26,6 @@ function createSuspendingCell(createCellProps) {
29
26
  Success,
30
27
  displayName = "Cell"
31
28
  } = createCellProps;
32
- if (!QUERY) {
33
- throw new Error(
34
- `Can't create a Cell (${displayName}) without a QUERY or FRAGMENT export`
35
- );
36
- }
37
- const cellQuery = QUERY;
38
29
  function SuspendingSuccess(props) {
39
30
  const { queryRef, suspenseQueryResult, userProps } = props;
40
31
  const { data, networkStatus } = useReadQuery(queryRef);
@@ -66,7 +57,7 @@ function createSuspendingCell(createCellProps) {
66
57
  return (props) => {
67
58
  const { children: _, ...variables } = props;
68
59
  const options = beforeQuery(variables);
69
- const query = typeof cellQuery === "function" ? cellQuery(options) : cellQuery;
60
+ const query = typeof QUERY === "function" ? QUERY(options) : QUERY;
70
61
  const [queryRef, other] = useBackgroundQuery(query, options);
71
62
  const client = useApolloClient();
72
63
  const suspenseQueryResult = {
@@ -0,0 +1,92 @@
1
+ import React from "react";
2
+ import { loadErrorMessages, loadDevMessages } from "@apollo/client/dev";
3
+ import { render, screen } from "@testing-library/react";
4
+ import { vi, describe, beforeAll, test } from "vitest";
5
+ import { GraphQLHooksProvider } from "../GraphQLHooksProvider.js";
6
+ import { createSuspendingCell } from "./createSuspendingCell.js";
7
+ vi.mock("@apollo/client/react/hooks/hooks.cjs", () => {
8
+ return {
9
+ useApolloClient: vi.fn()
10
+ };
11
+ });
12
+ describe("createSuspendingCell", () => {
13
+ beforeAll(() => {
14
+ globalThis.RWJS_ENV = {
15
+ RWJS_EXP_STREAMING_SSR: true
16
+ };
17
+ loadDevMessages();
18
+ loadErrorMessages();
19
+ });
20
+ const mockedUseBgQuery = (() => {
21
+ return ["mocked-query-ref", { refetch: vi.fn(), fetchMore: vi.fn() }];
22
+ });
23
+ const mockedQueryHook = () => ({ data: {} });
24
+ test("Renders a static Success component", () => {
25
+ const TestCell = createSuspendingCell({
26
+ // @ts-expect-error - Purposefully using a plain string here.
27
+ QUERY: "query TestQuery { answer }",
28
+ Success: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "Great success!")
29
+ });
30
+ render(
31
+ /* @__PURE__ */ React.createElement(
32
+ GraphQLHooksProvider,
33
+ {
34
+ useBackgroundQuery: mockedUseBgQuery,
35
+ useReadQuery: mockedQueryHook
36
+ },
37
+ /* @__PURE__ */ React.createElement(TestCell, null)
38
+ )
39
+ );
40
+ screen.getByText(/^Great success!$/);
41
+ });
42
+ test("Renders Success with data", () => {
43
+ const TestCell = createSuspendingCell({
44
+ // @ts-expect-error - Purposefully using a plain string here.
45
+ QUERY: "query TestQuery { answer }",
46
+ Success: ({ answer }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("dl", null, /* @__PURE__ */ React.createElement("dt", null, "What's the meaning of life?"), /* @__PURE__ */ React.createElement("dd", null, answer)))
47
+ });
48
+ const myUseQueryHook = (() => {
49
+ return { data: { answer: 42 } };
50
+ });
51
+ render(
52
+ /* @__PURE__ */ React.createElement(
53
+ GraphQLHooksProvider,
54
+ {
55
+ useReadQuery: myUseQueryHook,
56
+ useBackgroundQuery: mockedUseBgQuery
57
+ },
58
+ /* @__PURE__ */ React.createElement(TestCell, null)
59
+ )
60
+ );
61
+ screen.getByText(/^What's the meaning of life\?$/);
62
+ screen.getByText(/^42$/);
63
+ });
64
+ test("Renders Success if any of the fields have data (i.e. not just the first)", () => {
65
+ const TestCell = createSuspendingCell({
66
+ // @ts-expect-error - Purposefully using a plain string here.
67
+ QUERY: "query TestQuery { users { name } posts { title } }",
68
+ Empty: () => /* @__PURE__ */ React.createElement(React.Fragment, null, "No users or posts"),
69
+ Success: ({ users, posts }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", null, users.length > 0 ? /* @__PURE__ */ React.createElement("ul", null, users.map(({ name }) => /* @__PURE__ */ React.createElement("li", { key: name }, name))) : "no users"), /* @__PURE__ */ React.createElement("div", null, posts.length > 0 ? /* @__PURE__ */ React.createElement("ul", null, posts.map(({ title }) => /* @__PURE__ */ React.createElement("li", { key: title }, title))) : "no posts"))
70
+ });
71
+ const myReadQueryHook = (() => {
72
+ return {
73
+ data: {
74
+ users: [],
75
+ posts: [{ title: "bazinga" }, { title: "kittens" }]
76
+ }
77
+ };
78
+ });
79
+ render(
80
+ /* @__PURE__ */ React.createElement(
81
+ GraphQLHooksProvider,
82
+ {
83
+ useReadQuery: myReadQueryHook,
84
+ useBackgroundQuery: mockedUseBgQuery
85
+ },
86
+ /* @__PURE__ */ React.createElement(TestCell, null)
87
+ )
88
+ );
89
+ screen.getByText(/bazinga/);
90
+ screen.getByText(/kittens/);
91
+ });
92
+ });
@@ -10,5 +10,21 @@ declare global {
10
10
  RWJS_API_URL: string;
11
11
  __REDWOOD__APP_TITLE: string;
12
12
  }
13
+ type GraphQLOperationVariables = Record<string, any>;
14
+ interface QueryOperationResult<TData = any, TVariables = GraphQLOperationVariables> {
15
+ data: TData | undefined;
16
+ loading: boolean;
17
+ }
18
+ interface MutationOperationResult<TData, TVariables> {
19
+ }
20
+ interface GraphQLQueryHookOptions<TData, TVariables> {
21
+ variables?: TVariables;
22
+ [key: string]: any;
23
+ }
24
+ export interface GraphQLMutationHookOptions<TData, TVariables> {
25
+ variables?: TVariables;
26
+ onCompleted?: (data: TData) => void;
27
+ [key: string]: any;
28
+ }
13
29
  }
14
30
  //# sourceMappingURL=global.web-auto-imports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"global.web-auto-imports.d.ts","sourceRoot":"","sources":["../src/global.web-auto-imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,OAAO,CAAA;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAK3C,OAAO,CAAC,MAAM,CAAC;IAMb,MAAM,GAAG,EAAE,CACT,MAAM,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,MAAM,EAAE,EACzD,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,YAAY,CAAA;IAIjB,KAAK,KAAK,GAAG,OAAO,MAAM,CAAA;IAE1B,UAAU,MAAM;QACd,8DAA8D;QAC9D,oBAAoB,EAAE,MAAM,CAAA;QAC5B,mDAAmD;QACnD,YAAY,EAAE,MAAM,CAAA;QACpB,oBAAoB,EAAE,MAAM,CAAA;KAC7B;CACF"}
1
+ {"version":3,"file":"global.web-auto-imports.d.ts","sourceRoot":"","sources":["../src/global.web-auto-imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,OAAO,CAAA;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAK3C,OAAO,CAAC,MAAM,CAAC;IAMb,MAAM,GAAG,EAAE,CACT,MAAM,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,MAAM,EAAE,EACzD,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,YAAY,CAAA;IAIjB,KAAK,KAAK,GAAG,OAAO,MAAM,CAAA;IAE1B,UAAU,MAAM;QACd,8DAA8D;QAC9D,oBAAoB,EAAE,MAAM,CAAA;QAC5B,mDAAmD;QACnD,YAAY,EAAE,MAAM,CAAA;QACpB,oBAAoB,EAAE,MAAM,CAAA;KAC7B;IAED,KAAK,yBAAyB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAIpD,UAAU,oBAAoB,CAC5B,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,yBAAyB;QAEtC,IAAI,EAAE,KAAK,GAAG,SAAS,CAAA;QACvB,OAAO,EAAE,OAAO,CAAA;KAGjB;IAID,UAAU,uBAAuB,CAAC,KAAK,EAAE,UAAU;KAAI;IAGvD,UAAU,uBAAuB,CAAC,KAAK,EAAE,UAAU;QACjD,SAAS,CAAC,EAAE,UAAU,CAAA;QACtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB;IAED,MAAM,WAAW,0BAA0B,CAAC,KAAK,EAAE,UAAU;QAC3D,SAAS,CAAC,EAAE,UAAU,CAAA;QACtB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAA;QACnC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB;CACF"}
package/dist/index.d.ts CHANGED
@@ -2,15 +2,12 @@ import './global.web-auto-imports.js';
2
2
  import './config.js';
3
3
  export { FatalErrorBoundary } from './components/FatalErrorBoundary.js';
4
4
  export { FetchConfigProvider, useFetchConfig, } from './components/FetchConfigProvider.js';
5
- export { useQuery, useMutation, useSubscription, } from '@apollo/client/react/hooks/hooks.cjs';
6
- export { useFragment } from './apollo/fragmentRegistry.js';
7
- export type { FragmentHookOptions, FragmentHookResult, } from './apollo/fragmentRegistry.js';
5
+ export { GraphQLHooksProvider, useQuery, useMutation, useSubscription, } from './components/GraphQLHooksProvider.js';
8
6
  export * from './components/cell/CellCacheContext.js';
9
7
  export { createCell } from './components/cell/createCell.js';
10
- export { createFragmentCell } from './components/cell/createFragmentCell.js';
11
8
  export type { CellProps, CellFailureProps, CellLoadingProps, CellSuccessProps, CellSuccessData, } from './components/cell/cellTypes.js';
12
9
  export * from './graphql.js';
13
- export * from './components/CedarProvider.js';
10
+ export * from './components/RedwoodProvider.js';
14
11
  export * from './components/MetaTags.js';
15
12
  export * from './components/Metadata.js';
16
13
  import { Helmet } from '@dr.pogodin/react-helmet';
@@ -18,5 +15,5 @@ export { Helmet as Head, Helmet };
18
15
  export * from './components/htmlTags.js';
19
16
  export * from './routeHooks.types.js';
20
17
  export * from './components/ServerInject.js';
21
- export type { TypedDocumentNode } from '@apollo/client';
18
+ export type { TypedDocumentNode } from './components/GraphQLHooksProvider.js';
22
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,8BAA8B,CAAA;AACrC,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAEvE,OAAO,EACL,mBAAmB,EACnB,cAAc,GACf,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,QAAQ,EACR,WAAW,EACX,eAAe,GAChB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,YAAY,EACV,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,8BAA8B,CAAA;AAErC,cAAc,uCAAuC,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAE5E,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,gCAAgC,CAAA;AAEvC,cAAc,cAAc,CAAA;AAE5B,cAAc,+BAA+B,CAAA;AAE7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,MAAM,IAAI,IAAI,EAAE,MAAM,EAAE,CAAA;AAEjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AAErC,cAAc,8BAA8B,CAAA;AAE5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,8BAA8B,CAAA;AACrC,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAEvE,OAAO,EACL,mBAAmB,EACnB,cAAc,GACf,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,eAAe,GAChB,MAAM,sCAAsC,CAAA;AAE7C,cAAc,uCAAuC,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAE5D,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,gCAAgC,CAAA;AAEvC,cAAc,cAAc,CAAA;AAE5B,cAAc,iCAAiC,CAAA;AAE/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,MAAM,IAAI,IAAI,EAAE,MAAM,EAAE,CAAA;AAEjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AAErC,cAAc,8BAA8B,CAAA;AAE5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA"}
package/dist/index.js CHANGED
@@ -6,16 +6,15 @@ import {
6
6
  useFetchConfig
7
7
  } from "./components/FetchConfigProvider.js";
8
8
  import {
9
+ GraphQLHooksProvider,
9
10
  useQuery,
10
11
  useMutation,
11
12
  useSubscription
12
- } from "@apollo/client/react/hooks/hooks.cjs";
13
- import { useFragment } from "./apollo/fragmentRegistry.js";
13
+ } from "./components/GraphQLHooksProvider.js";
14
14
  export * from "./components/cell/CellCacheContext.js";
15
15
  import { createCell } from "./components/cell/createCell.js";
16
- import { createFragmentCell } from "./components/cell/createFragmentCell.js";
17
16
  export * from "./graphql.js";
18
- export * from "./components/CedarProvider.js";
17
+ export * from "./components/RedwoodProvider.js";
19
18
  export * from "./components/MetaTags.js";
20
19
  export * from "./components/Metadata.js";
21
20
  import { Helmet } from "@dr.pogodin/react-helmet";
@@ -25,12 +24,11 @@ export * from "./components/ServerInject.js";
25
24
  export {
26
25
  FatalErrorBoundary,
27
26
  FetchConfigProvider,
27
+ GraphQLHooksProvider,
28
28
  Helmet as Head,
29
29
  Helmet,
30
30
  createCell,
31
- createFragmentCell,
32
31
  useFetchConfig,
33
- useFragment,
34
32
  useMutation,
35
33
  useQuery,
36
34
  useSubscription
@@ -0,0 +1 @@
1
+ {"type":"module"}