@cedarjs/web 6.0.0-canary.2646 → 6.0.0-canary.2647

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 (49) hide show
  1. package/dist/apollo/fragmentRegistry.d.ts +8 -0
  2. package/dist/apollo/fragmentRegistry.d.ts.map +1 -1
  3. package/dist/apollo/fragmentRegistry.js +19 -1
  4. package/dist/apollo/index.d.ts.map +1 -1
  5. package/dist/apollo/index.js +4 -2
  6. package/dist/apollo/suspense.d.ts.map +1 -1
  7. package/dist/apollo/suspense.js +7 -4
  8. package/dist/cjs/apollo/fragmentRegistry.d.ts +8 -0
  9. package/dist/cjs/apollo/fragmentRegistry.d.ts.map +1 -1
  10. package/dist/cjs/apollo/fragmentRegistry.js +21 -2
  11. package/dist/cjs/apollo/index.d.ts.map +1 -1
  12. package/dist/cjs/apollo/index.js +2 -1
  13. package/dist/cjs/apollo/suspense.d.ts.map +1 -1
  14. package/dist/cjs/apollo/suspense.js +7 -4
  15. package/dist/cjs/components/GraphQLHooksProvider.d.ts +33 -1
  16. package/dist/cjs/components/GraphQLHooksProvider.d.ts.map +1 -1
  17. package/dist/cjs/components/GraphQLHooksProvider.js +14 -2
  18. package/dist/cjs/components/cell/cellTypes.d.ts +14 -1
  19. package/dist/cjs/components/cell/cellTypes.d.ts.map +1 -1
  20. package/dist/cjs/components/cell/createCell.d.ts +1 -7
  21. package/dist/cjs/components/cell/createCell.d.ts.map +1 -1
  22. package/dist/cjs/components/cell/createCell.js +21 -2
  23. package/dist/cjs/components/cell/createFragmentCell.d.ts +19 -0
  24. package/dist/cjs/components/cell/createFragmentCell.d.ts.map +1 -0
  25. package/dist/cjs/components/cell/createFragmentCell.js +108 -0
  26. package/dist/cjs/components/cell/createFragmentCell.test.js +235 -0
  27. package/dist/cjs/components/cell/createSuspendingCell.d.ts.map +1 -1
  28. package/dist/cjs/components/cell/createSuspendingCell.js +7 -1
  29. package/dist/cjs/index.d.ts +3 -1
  30. package/dist/cjs/index.d.ts.map +1 -1
  31. package/dist/cjs/index.js +5 -0
  32. package/dist/components/GraphQLHooksProvider.d.ts +33 -1
  33. package/dist/components/GraphQLHooksProvider.d.ts.map +1 -1
  34. package/dist/components/GraphQLHooksProvider.js +13 -2
  35. package/dist/components/cell/cellTypes.d.ts +14 -1
  36. package/dist/components/cell/cellTypes.d.ts.map +1 -1
  37. package/dist/components/cell/createCell.d.ts +1 -7
  38. package/dist/components/cell/createCell.d.ts.map +1 -1
  39. package/dist/components/cell/createCell.js +21 -2
  40. package/dist/components/cell/createFragmentCell.d.ts +19 -0
  41. package/dist/components/cell/createFragmentCell.d.ts.map +1 -0
  42. package/dist/components/cell/createFragmentCell.js +74 -0
  43. package/dist/components/cell/createFragmentCell.test.js +212 -0
  44. package/dist/components/cell/createSuspendingCell.d.ts.map +1 -1
  45. package/dist/components/cell/createSuspendingCell.js +7 -1
  46. package/dist/index.d.ts +3 -1
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +5 -1
  49. package/package.json +5 -5
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var createFragmentCell_exports = {};
30
+ __export(createFragmentCell_exports, {
31
+ createFragmentCell: () => createFragmentCell
32
+ });
33
+ module.exports = __toCommonJS(createFragmentCell_exports);
34
+ var import_react = __toESM(require("react"), 1);
35
+ var import_graphql = require("graphql");
36
+ var import_fragmentRegistry = require("../../apollo/fragmentRegistry.js");
37
+ var import_GraphQLHooksProvider = require("../GraphQLHooksProvider.js");
38
+ var import_isCellEmpty = require("./isCellEmpty.js");
39
+ function getFragmentDefinition(fragment, displayName) {
40
+ const fragmentDefinition = fragment.definitions.find(
41
+ (definition) => definition.kind === import_graphql.Kind.FRAGMENT_DEFINITION
42
+ );
43
+ if (!fragmentDefinition) {
44
+ throw new Error(
45
+ `The FRAGMENT export in ${displayName} must contain a GraphQL fragment definition, like \`fragment AuthorCell_author on User { fullName }\``
46
+ );
47
+ }
48
+ return fragmentDefinition;
49
+ }
50
+ function getFragmentPropName(fragmentDefinition) {
51
+ const fragmentName = fragmentDefinition.name.value;
52
+ const underscoreIndex = fragmentName.lastIndexOf("_");
53
+ if (underscoreIndex > 0 && underscoreIndex < fragmentName.length - 1) {
54
+ return fragmentName.slice(underscoreIndex + 1);
55
+ }
56
+ const typename = fragmentDefinition.typeCondition.name.value;
57
+ return typename.charAt(0).toLowerCase() + typename.slice(1);
58
+ }
59
+ function isDataRef(value) {
60
+ return typeof value === "object" && value !== null;
61
+ }
62
+ function createFragmentCell({
63
+ FRAGMENT,
64
+ afterQuery = (data) => data,
65
+ isEmpty = import_isCellEmpty.isDataEmpty,
66
+ Empty,
67
+ Success,
68
+ displayName = "Cell"
69
+ }) {
70
+ if (!FRAGMENT) {
71
+ throw new Error(
72
+ `createFragmentCell() for ${displayName} requires a FRAGMENT`
73
+ );
74
+ }
75
+ const fragment = FRAGMENT;
76
+ const fragmentDefinition = getFragmentDefinition(fragment, displayName);
77
+ const fragmentName = fragmentDefinition.name.value;
78
+ const propName = getFragmentPropName(fragmentDefinition);
79
+ import_fragmentRegistry.fragmentRegistry.register(fragment);
80
+ function NamedCell(props) {
81
+ const { children: _, [propName]: rawSlice, ...rest } = props;
82
+ const dataRef = isDataRef(rawSlice) ? rawSlice : void 0;
83
+ const fragmentResult = (0, import_GraphQLHooksProvider.useFragment)({
84
+ fragment,
85
+ fragmentName,
86
+ from: dataRef ?? {}
87
+ });
88
+ if (!(propName in props)) {
89
+ throw new Error(
90
+ `${displayName} must be passed a \`${propName}\` prop. Render it from a parent Cell that spreads \`...${fragmentName}\` in its QUERY, and pass the matching data object: \`<${displayName} ${propName}={data.someField} />\``
91
+ );
92
+ }
93
+ const data = fragmentResult.complete ? fragmentResult.data : dataRef ?? null;
94
+ const afterQueryData = afterQuery({ [propName]: data });
95
+ if (isEmpty({ [propName]: data }, { isDataEmpty: import_isCellEmpty.isDataEmpty }) && Empty) {
96
+ return /* @__PURE__ */ import_react.default.createElement(Empty, { ...rest, ...afterQueryData });
97
+ }
98
+ return /* @__PURE__ */ import_react.default.createElement(Success, { ...rest, ...afterQueryData });
99
+ }
100
+ NamedCell.displayName = displayName;
101
+ return (props) => {
102
+ return /* @__PURE__ */ import_react.default.createElement(NamedCell, { ...props });
103
+ };
104
+ }
105
+ // Annotate the CommonJS export names for ESM import in node:
106
+ 0 && (module.exports = {
107
+ createFragmentCell
108
+ });
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var import_react = __toESM(require("react"), 1);
25
+ var import_react2 = require("@testing-library/react");
26
+ var import_graphql = require("graphql");
27
+ var import_vitest = require("vitest");
28
+ var import_fragmentRegistry = require("../../apollo/fragmentRegistry.js");
29
+ var import_GraphQLHooksProvider = require("../GraphQLHooksProvider.js");
30
+ var import_createCell = require("./createCell.js");
31
+ const AUTHOR_FRAGMENT = (0, import_graphql.parse)(`
32
+ fragment AuthorCell_author on User {
33
+ email
34
+ fullName
35
+ }
36
+ `);
37
+ (0, import_vitest.describe)("createFragmentCell", () => {
38
+ (0, import_vitest.beforeAll)(() => {
39
+ globalThis.RWJS_ENV = {
40
+ RWJS_EXP_STREAMING_SSR: false
41
+ };
42
+ });
43
+ (0, import_vitest.test)("renders Success with data from its data prop", () => {
44
+ const TestCell = (0, import_createCell.createCell)({
45
+ FRAGMENT: AUTHOR_FRAGMENT,
46
+ Success: ({ author }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "By ", author.fullName)
47
+ });
48
+ (0, import_react2.render)(
49
+ // No useFragment hook registered, so the Cell falls back to reading
50
+ // data straight off the `author` prop
51
+ /* @__PURE__ */ import_react.default.createElement(import_GraphQLHooksProvider.GraphQLHooksProvider, { useQuery: null, useMutation: null }, /* @__PURE__ */ import_react.default.createElement(
52
+ TestCell,
53
+ {
54
+ author: { __typename: "User", id: 1, fullName: "Story Teller" }
55
+ }
56
+ ))
57
+ );
58
+ import_react2.screen.getByText(/^By Story Teller$/);
59
+ });
60
+ (0, import_vitest.test)("prefers complete data from the useFragment hook", () => {
61
+ const TestCell = (0, import_createCell.createCell)({
62
+ FRAGMENT: AUTHOR_FRAGMENT,
63
+ Success: ({ author }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "By ", author.fullName)
64
+ });
65
+ const myUseFragmentHook = (options) => {
66
+ (0, import_vitest.expect)(options.fragmentName).toEqual("AuthorCell_author");
67
+ (0, import_vitest.expect)(options.from).toEqual({ __typename: "User", id: 1 });
68
+ return {
69
+ data: { fullName: "Cache Dweller" },
70
+ complete: true
71
+ };
72
+ };
73
+ (0, import_react2.render)(
74
+ /* @__PURE__ */ import_react.default.createElement(
75
+ import_GraphQLHooksProvider.GraphQLHooksProvider,
76
+ {
77
+ useQuery: null,
78
+ useMutation: null,
79
+ useFragment: myUseFragmentHook
80
+ },
81
+ /* @__PURE__ */ import_react.default.createElement(TestCell, { author: { __typename: "User", id: 1 } })
82
+ )
83
+ );
84
+ import_react2.screen.getByText(/^By Cache Dweller$/);
85
+ });
86
+ (0, import_vitest.test)("falls back to the data prop for incomplete useFragment reads", () => {
87
+ const TestCell = (0, import_createCell.createCell)({
88
+ FRAGMENT: AUTHOR_FRAGMENT,
89
+ Success: ({ author }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "By ", author.fullName)
90
+ });
91
+ const myUseFragmentHook = () => {
92
+ return { data: void 0, complete: false };
93
+ };
94
+ (0, import_react2.render)(
95
+ /* @__PURE__ */ import_react.default.createElement(
96
+ import_GraphQLHooksProvider.GraphQLHooksProvider,
97
+ {
98
+ useQuery: null,
99
+ useMutation: null,
100
+ useFragment: myUseFragmentHook
101
+ },
102
+ /* @__PURE__ */ import_react.default.createElement(
103
+ TestCell,
104
+ {
105
+ author: { __typename: "User", id: 1, fullName: "Ref Reader" }
106
+ }
107
+ )
108
+ )
109
+ );
110
+ import_react2.screen.getByText(/^By Ref Reader$/);
111
+ });
112
+ (0, import_vitest.test)("derives the prop name from the fragment type when there is no underscore", () => {
113
+ const TestCell = (0, import_createCell.createCell)({
114
+ FRAGMENT: (0, import_graphql.parse)(`
115
+ fragment AuthorBio on User {
116
+ bio
117
+ }
118
+ `),
119
+ Success: ({ user }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, user.bio)
120
+ });
121
+ (0, import_react2.render)(
122
+ /* @__PURE__ */ import_react.default.createElement(import_GraphQLHooksProvider.GraphQLHooksProvider, { useQuery: null, useMutation: null }, /* @__PURE__ */ import_react.default.createElement(TestCell, { user: { __typename: "User", id: 1, bio: "Writes things" } }))
123
+ );
124
+ import_react2.screen.getByText(/^Writes things$/);
125
+ });
126
+ (0, import_vitest.test)("renders Empty when isEmpty says so", () => {
127
+ const TestCell = (0, import_createCell.createCell)({
128
+ FRAGMENT: AUTHOR_FRAGMENT,
129
+ isEmpty: () => true,
130
+ Empty: () => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "Nothing to see"),
131
+ Success: ({ author }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "By ", author.fullName)
132
+ });
133
+ (0, import_react2.render)(
134
+ /* @__PURE__ */ import_react.default.createElement(import_GraphQLHooksProvider.GraphQLHooksProvider, { useQuery: null, useMutation: null }, /* @__PURE__ */ import_react.default.createElement(TestCell, { author: { __typename: "User", id: 1, fullName: "Nobody" } }))
135
+ );
136
+ import_react2.screen.getByText(/^Nothing to see$/);
137
+ });
138
+ (0, import_vitest.test)("applies afterQuery to the fragment data", () => {
139
+ const TestCell = (0, import_createCell.createCell)({
140
+ FRAGMENT: AUTHOR_FRAGMENT,
141
+ afterQuery: (data) => ({
142
+ author: { ...data.author, fullName: "Changed Name" }
143
+ }),
144
+ Success: ({ author }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "By ", author.fullName)
145
+ });
146
+ (0, import_react2.render)(
147
+ /* @__PURE__ */ import_react.default.createElement(import_GraphQLHooksProvider.GraphQLHooksProvider, { useQuery: null, useMutation: null }, /* @__PURE__ */ import_react.default.createElement(
148
+ TestCell,
149
+ {
150
+ author: { __typename: "User", id: 1, fullName: "Original Name" }
151
+ }
152
+ ))
153
+ );
154
+ import_react2.screen.getByText(/^By Changed Name$/);
155
+ });
156
+ (0, import_vitest.test)("renders Empty when the data prop is null", () => {
157
+ const TestCell = (0, import_createCell.createCell)({
158
+ FRAGMENT: AUTHOR_FRAGMENT,
159
+ Empty: () => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "No author"),
160
+ Success: ({ author }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "By ", author.fullName)
161
+ });
162
+ (0, import_react2.render)(
163
+ // A nullable field, or a partial error with `errorPolicy: 'all'`, can
164
+ // make the parent pass null here
165
+ /* @__PURE__ */ import_react.default.createElement(import_GraphQLHooksProvider.GraphQLHooksProvider, { useQuery: null, useMutation: null }, /* @__PURE__ */ import_react.default.createElement(TestCell, { author: null }))
166
+ );
167
+ import_react2.screen.getByText(/^No author$/);
168
+ });
169
+ (0, import_vitest.test)("renders Success with null data when the data prop is null and there is no Empty", () => {
170
+ const TestCell = (0, import_createCell.createCell)({
171
+ FRAGMENT: AUTHOR_FRAGMENT,
172
+ Success: ({ author }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "By ", author?.fullName ?? "unknown")
173
+ });
174
+ (0, import_react2.render)(
175
+ /* @__PURE__ */ import_react.default.createElement(import_GraphQLHooksProvider.GraphQLHooksProvider, { useQuery: null, useMutation: null }, /* @__PURE__ */ import_react.default.createElement(TestCell, { author: null }))
176
+ );
177
+ import_react2.screen.getByText(/^By unknown$/);
178
+ });
179
+ (0, import_vitest.test)("throws a helpful error naming the prop when it is not passed", () => {
180
+ const TestCell = (0, import_createCell.createCell)({
181
+ FRAGMENT: AUTHOR_FRAGMENT,
182
+ Success: ({ author }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "By ", author.fullName),
183
+ displayName: "AuthorCell"
184
+ });
185
+ const consoleErrorSpy = import_vitest.vi.spyOn(console, "error").mockImplementation(() => {
186
+ });
187
+ try {
188
+ (0, import_vitest.expect)(() => {
189
+ (0, import_react2.render)(
190
+ /* @__PURE__ */ import_react.default.createElement(import_GraphQLHooksProvider.GraphQLHooksProvider, { useQuery: null, useMutation: null }, /* @__PURE__ */ import_react.default.createElement(TestCell, null))
191
+ );
192
+ }).toThrow(/`author` prop/);
193
+ } finally {
194
+ consoleErrorSpy.mockRestore();
195
+ }
196
+ });
197
+ (0, import_vitest.test)("stays a query Cell when both QUERY and FRAGMENT are exported", () => {
198
+ const TestCell = (0, import_createCell.createCell)({
199
+ // @ts-expect-error - Purposefully using a plain string here.
200
+ QUERY: "query AuthorQuery { author { fullName } }",
201
+ FRAGMENT: AUTHOR_FRAGMENT,
202
+ Success: ({ author }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "By ", author.fullName)
203
+ });
204
+ const myUseQueryHook = () => {
205
+ return { data: { author: { fullName: "Query Result" } } };
206
+ };
207
+ (0, import_react2.render)(
208
+ /* @__PURE__ */ import_react.default.createElement(import_GraphQLHooksProvider.GraphQLHooksProvider, { useQuery: myUseQueryHook, useMutation: null }, /* @__PURE__ */ import_react.default.createElement(TestCell, null))
209
+ );
210
+ import_react2.screen.getByText(/^By Query Result$/);
211
+ });
212
+ (0, import_vitest.test)("registers the FRAGMENT even when the Cell stays a query Cell", () => {
213
+ (0, import_createCell.createCell)({
214
+ // @ts-expect-error - Purposefully using a plain string here.
215
+ QUERY: "query MixedExportQuery { author { fullName } }",
216
+ // Using a unique fragment name since the registry is shared between
217
+ // tests
218
+ FRAGMENT: (0, import_graphql.parse)(`
219
+ fragment MixedExportCell_author on User {
220
+ fullName
221
+ }
222
+ `),
223
+ Success: ({ author }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "By ", author.fullName)
224
+ });
225
+ (0, import_vitest.expect)(import_fragmentRegistry.fragmentRegistry.lookup("MixedExportCell_author")).toBeTruthy();
226
+ });
227
+ (0, import_vitest.test)("throws when the FRAGMENT export is not a fragment", () => {
228
+ (0, import_vitest.expect)(
229
+ () => (0, import_createCell.createCell)({
230
+ FRAGMENT: (0, import_graphql.parse)("query FindAuthor { author { id } }"),
231
+ Success: () => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "hello")
232
+ })
233
+ ).toThrow(/fragment definition/);
234
+ });
235
+ });
@@ -1 +1 @@
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
+ {"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,CAiJrB"}
@@ -59,6 +59,12 @@ function createSuspendingCell(createCellProps) {
59
59
  Success,
60
60
  displayName = "Cell"
61
61
  } = createCellProps;
62
+ if (!QUERY) {
63
+ throw new Error(
64
+ `Can't create a Cell (${displayName}) without a QUERY or FRAGMENT export`
65
+ );
66
+ }
67
+ const cellQuery = QUERY;
62
68
  function SuspendingSuccess(props) {
63
69
  const { queryRef, suspenseQueryResult, userProps } = props;
64
70
  const { data, networkStatus } = (0, import_GraphQLHooksProvider.useReadQuery)(queryRef);
@@ -90,7 +96,7 @@ function createSuspendingCell(createCellProps) {
90
96
  return (props) => {
91
97
  const { children: _, ...variables } = props;
92
98
  const options = beforeQuery(variables);
93
- const query = typeof QUERY === "function" ? QUERY(options) : QUERY;
99
+ const query = typeof cellQuery === "function" ? cellQuery(options) : cellQuery;
94
100
  const [queryRef, other] = (0, import_GraphQLHooksProvider.useBackgroundQuery)(query, options);
95
101
  const client = (0, import_hooks.useApolloClient)();
96
102
  const suspenseQueryResult = {
@@ -2,9 +2,11 @@ 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 { GraphQLHooksProvider, useQuery, useMutation, useSubscription, } from './components/GraphQLHooksProvider.js';
5
+ export { GraphQLHooksProvider, useQuery, useMutation, useSubscription, useFragment, } from './components/GraphQLHooksProvider.js';
6
+ export type { FragmentHookOptions, FragmentHookResult, } from './components/GraphQLHooksProvider.js';
6
7
  export * from './components/cell/CellCacheContext.js';
7
8
  export { createCell } from './components/cell/createCell.js';
9
+ export { createFragmentCell } from './components/cell/createFragmentCell.js';
8
10
  export type { CellProps, CellFailureProps, CellLoadingProps, CellSuccessProps, CellSuccessData, } from './components/cell/cellTypes.js';
9
11
  export * from './graphql.js';
10
12
  export * from './components/RedwoodProvider.js';
@@ -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,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"}
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,EACf,WAAW,GACZ,MAAM,sCAAsC,CAAA;AAC7C,YAAY,EACV,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,sCAAsC,CAAA;AAE7C,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,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/cjs/index.js CHANGED
@@ -25,7 +25,9 @@ __export(index_exports, {
25
25
  Head: () => import_react_helmet.Helmet,
26
26
  Helmet: () => import_react_helmet.Helmet,
27
27
  createCell: () => import_createCell.createCell,
28
+ createFragmentCell: () => import_createFragmentCell.createFragmentCell,
28
29
  useFetchConfig: () => import_FetchConfigProvider.useFetchConfig,
30
+ useFragment: () => import_GraphQLHooksProvider.useFragment,
29
31
  useMutation: () => import_GraphQLHooksProvider.useMutation,
30
32
  useQuery: () => import_GraphQLHooksProvider.useQuery,
31
33
  useSubscription: () => import_GraphQLHooksProvider.useSubscription
@@ -38,6 +40,7 @@ var import_FetchConfigProvider = require("./components/FetchConfigProvider.js");
38
40
  var import_GraphQLHooksProvider = require("./components/GraphQLHooksProvider.js");
39
41
  __reExport(index_exports, require("./components/cell/CellCacheContext.js"), module.exports);
40
42
  var import_createCell = require("./components/cell/createCell.js");
43
+ var import_createFragmentCell = require("./components/cell/createFragmentCell.js");
41
44
  __reExport(index_exports, require("./graphql.js"), module.exports);
42
45
  __reExport(index_exports, require("./components/RedwoodProvider.js"), module.exports);
43
46
  __reExport(index_exports, require("./components/MetaTags.js"), module.exports);
@@ -54,7 +57,9 @@ __reExport(index_exports, require("./components/ServerInject.js"), module.export
54
57
  Head,
55
58
  Helmet,
56
59
  createCell,
60
+ createFragmentCell,
57
61
  useFetchConfig,
62
+ useFragment,
58
63
  useMutation,
59
64
  useQuery,
60
65
  useSubscription,
@@ -16,6 +16,25 @@ type DefaultUseQueryType = <TData = any, TVariables extends OperationVariables =
16
16
  type DefaultUseMutationType = <TData = any, TVariables = GraphQLOperationVariables>(mutation: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLMutationHookOptions<TData, TVariables>) => MutationOperationResult<TData, TVariables>;
17
17
  type DefaultUseSubscriptionType = <TData = any, TVariables extends OperationVariables = GraphQLOperationVariables>(subscription: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLSubscriptionHookOptions<TData, TVariables>) => SubscriptionOperationResult<TData, TVariables>;
18
18
  type DefaultUseSuspenseType = <TData = any, TVariables extends OperationVariables = GraphQLOperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLSuspenseQueryHookOptions<TData, TVariables>) => SuspenseQueryOperationResult<TData, TVariables>;
19
+ export interface FragmentHookOptions {
20
+ fragment: DocumentNode;
21
+ fragmentName?: string;
22
+ /**
23
+ * The object to read the fragment data for. Usually a cache reference like
24
+ * `{ __typename: 'User', id: 1 }`, but any object that the GraphQL client
25
+ * can identify works.
26
+ */
27
+ from: Record<string, unknown>;
28
+ }
29
+ export interface FragmentHookResult<TData = any> {
30
+ /**
31
+ * The fragment data read from the client's cache, or `undefined` if the
32
+ * cache doesn't (yet) contain complete data for the fragment.
33
+ */
34
+ data: TData | undefined;
35
+ complete: boolean;
36
+ }
37
+ type DefaultUseFragmentType = <TData = any>(options: FragmentHookOptions) => FragmentHookResult<TData>;
19
38
  export interface GraphQLHooks<TuseQuery = DefaultUseQueryType, TuseMutation = DefaultUseMutationType, TuseSubscription = DefaultUseSubscriptionType, TuseSuspenseQuery = DefaultUseSuspenseType> {
20
39
  useQuery: TuseQuery;
21
40
  useMutation: TuseMutation;
@@ -23,6 +42,13 @@ export interface GraphQLHooks<TuseQuery = DefaultUseQueryType, TuseMutation = De
23
42
  useSuspenseQuery: TuseSuspenseQuery;
24
43
  useBackgroundQuery: typeof apolloUseBackgroundQuery;
25
44
  useReadQuery: typeof apolloUseReadQuery;
45
+ /**
46
+ * Synchronously read fragment data from the GraphQL client's cache.
47
+ * Optional so that custom GraphQL clients don't have to provide an
48
+ * implementation. Fragment Cells fall back to reading data from their
49
+ * data prop when this reports an incomplete result.
50
+ */
51
+ useFragment?: DefaultUseFragmentType;
26
52
  }
27
53
  export declare const GraphQLHooksContext: React.Context<GraphQLHooks<DefaultUseQueryType, DefaultUseMutationType, DefaultUseSubscriptionType, DefaultUseSuspenseType>>;
28
54
  interface GraphQlHooksProviderProps<TuseQuery = DefaultUseQueryType, TuseMutation = DefaultUseMutationType, TuseSubscription = DefaultUseSubscriptionType, TuseSuspenseQuery = DefaultUseSuspenseType> extends GraphQLHooks<TuseQuery, TuseMutation, TuseSubscription, TuseSuspenseQuery> {
@@ -35,11 +61,17 @@ interface GraphQlHooksProviderProps<TuseQuery = DefaultUseQueryType, TuseMutatio
35
61
  *
36
62
  * @todo Let the user pass in the additional type for options.
37
63
  */
38
- export declare const GraphQLHooksProvider: <TuseQuery extends DefaultUseQueryType, TuseMutation extends DefaultUseMutationType>({ useQuery, useMutation, useSubscription, useSuspenseQuery, useBackgroundQuery, useReadQuery, children, }: GraphQlHooksProviderProps<TuseQuery, TuseMutation>) => React.JSX.Element;
64
+ export declare const GraphQLHooksProvider: <TuseQuery extends DefaultUseQueryType, TuseMutation extends DefaultUseMutationType>({ useQuery, useMutation, useSubscription, useSuspenseQuery, useBackgroundQuery, useReadQuery, useFragment, children, }: GraphQlHooksProviderProps<TuseQuery, TuseMutation>) => React.JSX.Element;
39
65
  export declare function useQuery<TData = any, TVariables extends OperationVariables = GraphQLOperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLQueryHookOptions<TData, TVariables>): QueryOperationResult<TData, TVariables>;
40
66
  export declare function useMutation<TData = any, TVariables = GraphQLOperationVariables>(mutation: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLMutationHookOptions<TData, TVariables>): MutationOperationResult<TData, TVariables>;
41
67
  export declare function useSubscription<TData = any, TVariables extends OperationVariables = GraphQLOperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLSubscriptionHookOptions<TData, TVariables>): SubscriptionOperationResult<TData, TVariables>;
42
68
  export declare function useSuspenseQuery<TData = any, TVariables extends OperationVariables = GraphQLOperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLSuspenseQueryHookOptions<TData, TVariables>): SuspenseQueryOperationResult<TData, TVariables>;
43
69
  export declare const useBackgroundQuery: typeof apolloUseBackgroundQuery<any>;
44
70
  export declare const useReadQuery: typeof apolloUseReadQuery;
71
+ /**
72
+ * Read fragment data from the GraphQL client's cache without firing a
73
+ * network request. Used by fragment Cells (Cells that export `FRAGMENT`
74
+ * instead of `QUERY`).
75
+ */
76
+ export declare function useFragment<TData = any>(options: FragmentHookOptions): FragmentHookResult<TData>;
45
77
  //# sourceMappingURL=GraphQLHooksProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GraphQLHooksProvider.d.ts","sourceRoot":"","sources":["../../src/components/GraphQLHooksProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,IAAI,wBAAwB,EAC9C,YAAY,IAAI,k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E,mBAAmB,GAC3B,kBAAkB,CAAC,KAAK,CAAC,CAK3B"}
@@ -1,4 +1,7 @@
1
1
  import React from "react";
2
+ const incompleteFragmentRead = () => {
3
+ return { data: void 0, complete: false };
4
+ };
2
5
  const GraphQLHooksContext = React.createContext({
3
6
  useQuery: () => {
4
7
  throw new Error(
@@ -30,7 +33,8 @@ const GraphQLHooksContext = React.createContext({
30
33
  throw new Error(
31
34
  "You must register a useReadQuery hook via the `GraphQLHooksProvider`."
32
35
  );
33
- }
36
+ },
37
+ useFragment: incompleteFragmentRead
34
38
  });
35
39
  const GraphQLHooksProvider = ({
36
40
  useQuery: useQuery2,
@@ -39,6 +43,7 @@ const GraphQLHooksProvider = ({
39
43
  useSuspenseQuery: useSuspenseQuery2,
40
44
  useBackgroundQuery: useBackgroundQuery2,
41
45
  useReadQuery: useReadQuery2,
46
+ useFragment: useFragment2,
42
47
  children
43
48
  }) => {
44
49
  return /* @__PURE__ */ React.createElement(
@@ -50,7 +55,8 @@ const GraphQLHooksProvider = ({
50
55
  useSubscription: useSubscription2,
51
56
  useSuspenseQuery: useSuspenseQuery2,
52
57
  useBackgroundQuery: useBackgroundQuery2,
53
- useReadQuery: useReadQuery2
58
+ useReadQuery: useReadQuery2,
59
+ useFragment: useFragment2 ?? incompleteFragmentRead
54
60
  }
55
61
  },
56
62
  children
@@ -82,10 +88,15 @@ const useBackgroundQuery = (...args) => {
82
88
  const useReadQuery = (...args) => {
83
89
  return React.useContext(GraphQLHooksContext).useReadQuery(...args);
84
90
  };
91
+ function useFragment(options) {
92
+ const useFragmentHook = React.useContext(GraphQLHooksContext).useFragment ?? incompleteFragmentRead;
93
+ return useFragmentHook(options);
94
+ }
85
95
  export {
86
96
  GraphQLHooksContext,
87
97
  GraphQLHooksProvider,
88
98
  useBackgroundQuery,
99
+ useFragment,
89
100
  useMutation,
90
101
  useQuery,
91
102
  useReadQuery,
@@ -80,8 +80,21 @@ export interface CreateCellProps<CellProps, CellVariables> {
80
80
  /**
81
81
  * The GraphQL syntax tree to execute or function to call that returns it.
82
82
  * If `QUERY` is a function, it's called with the result of `beforeQuery`.
83
+ *
84
+ * Either `QUERY` or `FRAGMENT` must be provided.
85
+ */
86
+ QUERY?: DocumentNode | ((variables: Record<string, unknown>) => DocumentNode);
87
+ /**
88
+ * A GraphQL fragment that declares this Cell's data requirements. Fragment
89
+ * Cells don't fire their own query. Instead a parent Cell spreads the
90
+ * fragment in its `QUERY` and passes the fetched data object down via a
91
+ * prop named after the fragment (`AuthorCell_author` -> `author`). The
92
+ * fragment is automatically registered with the GraphQL client's fragment
93
+ * registry, so parent queries can spread it by name.
94
+ *
95
+ * Either `QUERY` or `FRAGMENT` must be provided.
83
96
  */
84
- QUERY: DocumentNode | ((variables: Record<string, unknown>) => DocumentNode);
97
+ FRAGMENT?: DocumentNode;
85
98
  /**
86
99
  * Parse `props` into query variables. Most of the time `props` are appropriate variables as is.
87
100
  */
@@ -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,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ACT,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC,CAC5E,CAAA;AAID,MAAM,WAAW,uBAAuB,CACtC,MAAM,GAAG,GAAG,EACZ,WAAW,SAAS,kBAAkB,GAAG,GAAG,CAC5C,SAAQ,wBAAwB;IAChC,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,CAAA;IAEzB,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,MAAM,EAAE,OAAO,CAAA;CAChB"}
@@ -1,10 +1,4 @@
1
1
  import React from 'react';
2
2
  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 {};
3
+ export declare function createCell<CellProps extends Record<string, unknown>, CellVariables extends Record<string, unknown>>(createCellProps: CreateCellProps<CellProps, CellVariables>): React.FC<CellProps>;
10
4
  //# 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;AAUzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAKrD,wBAAgB,UAAU,CACxB,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAE7C,eAAe,EAAE,eAAe,CAAC,SAAS,EAAE,aAAa,CAAC,GACzD,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAiCrB"}