eddev 0.2.67-beta1 → 0.3.0-beta1

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 (185) hide show
  1. package/admin/components/ImageWell.d.ts +2 -2
  2. package/admin/components/ImageWell.js +51 -39
  3. package/admin/defineField.d.ts +2 -2
  4. package/admin/defineWidget.d.ts +1 -1
  5. package/admin/defineWidget.js +2 -2
  6. package/admin/index.js +1 -5
  7. package/admin/installFieldTypes.js +26 -26
  8. package/admin/runWidgets.js +28 -17
  9. package/admin/selectMedia.d.ts +2 -2
  10. package/admin/selectMedia.js +1 -1
  11. package/blocks/ContentBlocks.d.ts +6 -6
  12. package/blocks/ContentBlocks.js +66 -58
  13. package/blocks/ErrorBoundaryEditor.d.ts +1 -1
  14. package/blocks/ErrorBoundaryEditor.js +45 -16
  15. package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
  16. package/blocks/ErrorBoundaryFrontend.js +45 -16
  17. package/blocks/InspectorControls.d.ts +1 -1
  18. package/blocks/InspectorControls.js +3 -3
  19. package/blocks/blockAttributes.d.ts +2 -2
  20. package/blocks/blockAttributes.js +44 -24
  21. package/blocks/index.js +1 -5
  22. package/blocks/inlineEditing.d.ts +6 -6
  23. package/blocks/inlineEditing.js +55 -36
  24. package/blocks/installGutenbergHooks.js +68 -48
  25. package/build/babel/plugin-name-defined-components.js +16 -15
  26. package/build/build-favicon.js +62 -11
  27. package/build/clean.js +52 -5
  28. package/build/create-codegen-worker.js +33 -78
  29. package/build/create-serverless-dev-worker.js +39 -61
  30. package/build/create-webpack-worker.js +33 -65
  31. package/build/file-tree.d.ts +2 -2
  32. package/build/file-tree.js +12 -12
  33. package/build/get-webpack-config.js +395 -341
  34. package/build/graphql-codegen/graphql-codegen-files.js +25 -31
  35. package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
  36. package/build/graphql-codegen/graphql-codegen-queries.js +99 -102
  37. package/build/manifests/manifest-blocks.d.ts +1 -1
  38. package/build/manifests/manifest-blocks.js +29 -37
  39. package/build/manifests/manifest-fields.d.ts +1 -1
  40. package/build/manifests/manifest-fields.js +21 -23
  41. package/build/manifests/manifest-views.d.ts +1 -1
  42. package/build/manifests/manifest-views.js +25 -32
  43. package/build/manifests/manifest-widgets.d.ts +1 -1
  44. package/build/manifests/manifest-widgets.js +20 -22
  45. package/build/manifests/manifest.d.ts +2 -2
  46. package/build/manifests/manifest.js +94 -30
  47. package/build/reporter.d.ts +1 -1
  48. package/build/reporter.js +32 -29
  49. package/build/serverless/create-next-app.d.ts +1 -1
  50. package/build/serverless/create-next-app.js +467 -245
  51. package/build/state/codegen-state.d.ts +4 -4
  52. package/build/state/compiler-state.d.ts +5 -5
  53. package/build/state/serverless-state.d.ts +3 -3
  54. package/build/workers/codegen-worker-script.js +519 -393
  55. package/build/workers/serverless-worker-dev-script.js +4 -4
  56. package/build/workers/webpack-worker-script.js +156 -90
  57. package/cli/build.dev.d.ts +1 -1
  58. package/cli/build.dev.js +126 -79
  59. package/cli/build.prod.d.ts +1 -1
  60. package/cli/build.prod.js +98 -42
  61. package/cli/cli.js +28 -19
  62. package/cli/display/components/BundleDisplay.d.ts +1 -1
  63. package/cli/display/components/BundleDisplay.js +24 -13
  64. package/cli/display/components/CodegenDisplay.d.ts +1 -1
  65. package/cli/display/components/CodegenDisplay.js +25 -14
  66. package/cli/display/components/DevCLIDisplay.d.ts +2 -2
  67. package/cli/display/components/DevCLIDisplay.js +25 -14
  68. package/cli/display/components/Fullscreen.js +20 -9
  69. package/cli/display/components/ServerlessDisplay.d.ts +2 -2
  70. package/cli/display/components/ServerlessDisplay.js +26 -15
  71. package/cli/display/components/StatusIcon.d.ts +2 -2
  72. package/cli/display/components/StatusIcon.js +3 -3
  73. package/cli/preinstall.js +5 -4
  74. package/cli/setup.js +73 -25
  75. package/components/AdminBar.d.ts +1 -1
  76. package/components/AdminBar.js +3 -37
  77. package/components/BrowserRouter.d.ts +2 -2
  78. package/components/BrowserRouter.js +54 -41
  79. package/components/InlinePage.d.ts +2 -2
  80. package/components/InlinePage.js +29 -17
  81. package/components/NextRouter.d.ts +2 -2
  82. package/components/NextRouter.js +29 -20
  83. package/components/index.js +1 -5
  84. package/config/config-schema.d.ts +1 -1
  85. package/config/config-schema.js +1 -1
  86. package/config/create-schema-file.js +6 -6
  87. package/config/get-config.js +13 -10
  88. package/config/index.js +1 -5
  89. package/config/parse-config.js +1 -1
  90. package/config/print-zod-errors.js +3 -3
  91. package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -2
  92. package/dev-ui/components/BreakpointColumnHeader.js +18 -7
  93. package/dev-ui/components/BreakpointIndicator.d.ts +1 -1
  94. package/dev-ui/components/BreakpointIndicator.js +32 -25
  95. package/dev-ui/components/DevUI.d.ts +1 -1
  96. package/dev-ui/components/DevUI.js +13 -13
  97. package/dev-ui/components/Launcher.d.ts +2 -2
  98. package/dev-ui/components/Launcher.js +25 -13
  99. package/dev-ui/components/PanelWrapper.d.ts +2 -2
  100. package/dev-ui/components/PanelWrapper.js +8 -8
  101. package/dev-ui/components/ResponsiveLerpControl.d.ts +2 -2
  102. package/dev-ui/components/ResponsiveLerpControl.js +38 -27
  103. package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -4
  104. package/dev-ui/components/ResponsiveScaleEditor.js +78 -64
  105. package/dev-ui/components/atoms/Button.js +1 -1
  106. package/dev-ui/components/atoms/Dropdown.d.ts +3 -3
  107. package/dev-ui/components/atoms/Dropdown.js +9 -8
  108. package/dev-ui/components/atoms/NumberField.d.ts +2 -2
  109. package/dev-ui/components/atoms/NumberField.js +42 -29
  110. package/dev-ui/components/atoms/Spacer.js +1 -1
  111. package/dev-ui/components/atoms/Text.js +1 -1
  112. package/dev-ui/components/atoms/ToggleButton.d.ts +2 -2
  113. package/dev-ui/components/atoms/ToggleButton.js +16 -5
  114. package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
  115. package/dev-ui/components/atoms/Tooltip.js +20 -8
  116. package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -1
  117. package/dev-ui/components/panels/AppDataDebugger.js +19 -8
  118. package/dev-ui/components/panels/ColorEditor.d.ts +1 -1
  119. package/dev-ui/components/panels/ColorEditor.js +42 -35
  120. package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -1
  121. package/dev-ui/components/panels/PageDataDebugger.js +20 -8
  122. package/dev-ui/components/panels/QueryDebugger.d.ts +1 -1
  123. package/dev-ui/components/panels/QueryDebugger.js +24 -12
  124. package/dev-ui/components/panels/SpacingEditor.d.ts +1 -1
  125. package/dev-ui/components/panels/SpacingEditor.js +48 -34
  126. package/dev-ui/components/panels/TypographyEditor.d.ts +1 -1
  127. package/dev-ui/components/panels/TypographyEditor.js +46 -38
  128. package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
  129. package/dev-ui/hooks/useBreakpoint.js +13 -13
  130. package/dev-ui/hooks/usePersistState.js +7 -6
  131. package/dev-ui/hooks/useStylesheet.js +6 -6
  132. package/dev-ui/icons.d.ts +15 -15
  133. package/dev-ui/icons.js +27 -16
  134. package/dev-ui/index.js +1 -5
  135. package/dev-ui/loader.d.ts +1 -1
  136. package/dev-ui/loader.js +9 -13
  137. package/dev-ui/panels.d.ts +2 -2
  138. package/dev-ui/panels.js +7 -7
  139. package/dev-ui/theme.js +3 -3
  140. package/dynamic/dynamic-component.js +1 -1
  141. package/dynamic/index.js +1 -5
  142. package/entry/Root.d.ts +2 -2
  143. package/entry/Root.js +26 -16
  144. package/entry/entry.admin.dev.js +4 -4
  145. package/entry/entry.admin.prod.js +4 -4
  146. package/entry/entry.monolith.dev.js +5 -5
  147. package/entry/entry.monolith.prod.js +5 -5
  148. package/gravityforms/gravity-forms.d.ts +2 -2
  149. package/gravityforms/index.js +1 -5
  150. package/gravityforms/useGravityForm.d.ts +2 -2
  151. package/gravityforms/useGravityForm.js +130 -126
  152. package/hooks/index.js +1 -5
  153. package/hooks/queryUtils.d.ts +14 -14
  154. package/hooks/queryUtils.js +192 -101
  155. package/hooks/useAppData.d.ts +2 -2
  156. package/hooks/useAppData.js +9 -9
  157. package/hooks/usePageLoad.js +4 -4
  158. package/hooks/useQueryDebug.d.ts +1 -1
  159. package/hooks/useQueryDebug.js +7 -7
  160. package/hooks/useRPC.d.ts +4 -4
  161. package/hooks/useRPC.js +3 -3
  162. package/package.json +11 -11
  163. package/routing/index.js +1 -5
  164. package/routing/remoteProps.d.ts +1 -1
  165. package/routing/remoteProps.js +72 -31
  166. package/routing/routing.d.ts +25 -15
  167. package/routing/routing.js +200 -112
  168. package/routing/updateEditLink.js +1 -1
  169. package/serverless/define-api.d.ts +1 -1
  170. package/serverless/define-rpc-router.js +4 -8
  171. package/serverless/index.js +2 -6
  172. package/style/createStitches.js +142 -164
  173. package/style/index.js +1 -5
  174. package/tsconfig.json +1 -1
  175. package/utils/Observable.d.ts +2 -2
  176. package/utils/Observable.js +15 -12
  177. package/utils/getRepoName.js +3 -3
  178. package/utils/promptIfRepoNameIncorrect.js +64 -18
  179. package/utils/refreshOverlayInterop.js +1 -1
  180. package/utils/reportErrorStack.d.ts +1 -1
  181. package/utils/reportErrorStack.js +1 -1
  182. package/utils/serverlessAppContext.js +1 -1
  183. package/utils/updateEnvFile.js +69 -19
  184. package/utils/useObservable.js +3 -3
  185. package/views/index.js +1 -5
@@ -1,70 +1,77 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
2
49
  Object.defineProperty(exports, "__esModule", { value: true });
3
50
  exports.useGravityForm = void 0;
4
- const react_1 = require("react");
5
- const react_2 = require("react");
6
- const react_3 = require("react");
7
- const reducer = (state, action) => {
51
+ var react_1 = require("react");
52
+ var react_2 = require("react");
53
+ var react_3 = require("react");
54
+ var reducer = function (state, action) {
55
+ var _a, _b, _c;
8
56
  switch (action.type) {
9
57
  case "field":
10
- return {
11
- ...state,
12
- errors: {
13
- ...state.errors,
14
- [action.id]: undefined,
15
- },
16
- values: {
17
- ...state.values,
18
- [action.id]: action.value,
19
- },
20
- };
58
+ return __assign(__assign({}, state), { errors: __assign(__assign({}, state.errors), (_a = {}, _a[action.id] = undefined, _a)), values: __assign(__assign({}, state.values), (_b = {}, _b[action.id] = action.value, _b)) });
21
59
  case "submitting":
22
- return {
23
- ...state,
24
- errors: {},
25
- validity: {},
26
- hasErrors: false,
27
- submitting: true,
28
- };
60
+ return __assign(__assign({}, state), { errors: {}, validity: {}, hasErrors: false, submitting: true });
29
61
  case "success":
30
- return {
31
- ...state,
32
- submitting: false,
33
- complete: true,
34
- errors: {},
35
- validity: {},
36
- hasErrors: false,
37
- successMessage: action.message,
38
- };
62
+ return __assign(__assign({}, state), { submitting: false, complete: true, errors: {}, validity: {}, hasErrors: false, successMessage: action.message });
39
63
  case "mainError":
40
- return {
41
- ...state,
42
- submitting: false,
43
- hasErrors: true,
44
- mainError: action.message,
45
- };
64
+ return __assign(__assign({}, state), { submitting: false, hasErrors: true, mainError: action.message });
46
65
  case "errors":
47
- return {
48
- ...state,
49
- submitting: false,
50
- hasErrors: true,
51
- errors: action.errors,
52
- };
66
+ return __assign(__assign({}, state), { submitting: false, hasErrors: true, errors: action.errors });
53
67
  case "clearError":
54
- return {
55
- ...state,
56
- submitting: false,
57
- errors: {
58
- ...state.errors,
59
- [action.id]: undefined,
60
- },
61
- };
68
+ return __assign(__assign({}, state), { submitting: false, errors: __assign(__assign({}, state.errors), (_c = {}, _c[action.id] = undefined, _c)) });
62
69
  default:
63
- throw new Error(`Unknown GravityForms action ${JSON.stringify(action)}`);
70
+ throw new Error("Unknown GravityForms action ".concat(JSON.stringify(action)));
64
71
  }
65
72
  return state;
66
73
  };
67
- const initializer = (form) => {
74
+ var initializer = function (form) {
68
75
  return {
69
76
  submitting: false,
70
77
  mainError: null,
@@ -77,23 +84,18 @@ const initializer = (form) => {
77
84
  };
78
85
  };
79
86
  function useGravityForm(opts) {
80
- const { form } = opts;
81
- const [state, dispatch] = (0, react_3.useReducer)(reducer, form, initializer);
82
- const fields = form.fields.map((field) => ({
83
- ...field,
84
- value: state.values[field.id],
85
- error: state.errors[field.id],
86
- set: (value) => {
87
- dispatch({ type: "field", id: field.id, value });
88
- },
89
- }));
90
- const [submitter, setSubmitter] = (0, react_2.useState)(null);
91
- (0, react_1.useEffect)(() => {
92
- let cancelled = false;
87
+ var form = opts.form;
88
+ var _a = (0, react_3.useReducer)(reducer, form, initializer), state = _a[0], dispatch = _a[1];
89
+ var fields = form.fields.map(function (field) { return (__assign(__assign({}, field), { value: state.values[field.id], error: state.errors[field.id], set: function (value) {
90
+ dispatch({ type: "field", id: field.id, value: value });
91
+ } })); });
92
+ var _b = (0, react_2.useState)(null), submitter = _b[0], setSubmitter = _b[1];
93
+ (0, react_1.useEffect)(function () {
94
+ var cancelled = false;
93
95
  setSubmitter({
94
- submit: (state) => {
96
+ submit: function (state) {
95
97
  dispatch({ type: "submitting" });
96
- submit(form, state).then((result) => {
98
+ submit(form, state).then(function (result) {
97
99
  if (cancelled)
98
100
  return;
99
101
  if (result.success) {
@@ -108,32 +110,27 @@ function useGravityForm(opts) {
108
110
  });
109
111
  },
110
112
  });
111
- return () => {
113
+ return function () {
112
114
  cancelled = true;
113
115
  };
114
116
  }, []);
115
- return {
116
- ...state,
117
- fields,
118
- submit() {
119
- submitter?.submit(state);
120
- },
121
- updateField(id, value) {
122
- dispatch({ type: "field", id, value });
123
- },
124
- };
117
+ return __assign(__assign({}, state), { fields: fields, submit: function () {
118
+ submitter === null || submitter === void 0 ? void 0 : submitter.submit(state);
119
+ }, updateField: function (id, value) {
120
+ dispatch({ type: "field", id: id, value: value });
121
+ } });
125
122
  }
126
123
  exports.useGravityForm = useGravityForm;
127
124
  function prepareValuesPayload(form, state, data) {
128
- for (const field of form.fields) {
129
- const value = state.values[field.id];
130
- let key = "input_" + field.id;
125
+ var _loop_1 = function (field) {
126
+ var value = state.values[field.id];
127
+ var key = "input_" + field.id;
131
128
  if (field.type === "consent") {
132
129
  key += "_1";
133
130
  }
134
131
  if (field.type === "checkbox") {
135
- field.choices.forEach((choice, i) => {
136
- data.append(`${key}.${i + 1}`, value?.includes(choice.value) ? choice.value : "");
132
+ field.choices.forEach(function (choice, i) {
133
+ data.append("".concat(key, ".").concat(i + 1), (value === null || value === void 0 ? void 0 : value.includes(choice.value)) ? choice.value : "");
137
134
  // data[`${key}.${i + 1}`] =
138
135
  });
139
136
  }
@@ -147,50 +144,57 @@ function prepareValuesPayload(form, state, data) {
147
144
  }
148
145
  // data[key] = value
149
146
  }
147
+ };
148
+ for (var _i = 0, _a = form.fields; _i < _a.length; _i++) {
149
+ var field = _a[_i];
150
+ _loop_1(field);
150
151
  }
151
152
  // return data
152
153
  }
153
- async function submit(form, state) {
154
- try {
155
- let url = process.serverless ? `/api/rest/form-submit` : `/wp-json/ed/v1/gf/submit-with-uploads`;
156
- const data = new FormData();
157
- data.append("formID", String(form.id));
158
- prepareValuesPayload(form, state, data);
159
- const result = await fetch(url, {
160
- method: "POST",
161
- headers: {
162
- // "Content-type": "application/json",
163
- },
164
- credentials: "include",
165
- body: data,
154
+ function submit(form, state) {
155
+ return __awaiter(this, void 0, void 0, function () {
156
+ var url, data, result, payload, err_1;
157
+ return __generator(this, function (_a) {
158
+ switch (_a.label) {
159
+ case 0:
160
+ _a.trys.push([0, 3, , 4]);
161
+ url = process.serverless ? "/api/rest/form-submit" : "/wp-json/ed/v1/gf/submit-with-uploads";
162
+ data = new FormData();
163
+ data.append("formID", String(form.id));
164
+ prepareValuesPayload(form, state, data);
165
+ return [4 /*yield*/, fetch(url, {
166
+ method: "POST",
167
+ headers: {
168
+ // "Content-type": "application/json",
169
+ },
170
+ credentials: "include",
171
+ body: data,
172
+ })];
173
+ case 1:
174
+ result = _a.sent();
175
+ return [4 /*yield*/, result.json()];
176
+ case 2:
177
+ payload = _a.sent();
178
+ if (!payload.is_valid) {
179
+ return [2 /*return*/, __assign(__assign({}, payload), { success: false, errors: payload.validation_messages })];
180
+ }
181
+ else if (payload.is_valid) {
182
+ return [2 /*return*/, __assign(__assign({}, payload), { success: true, successMessage: payload.confirmation_message })];
183
+ }
184
+ else {
185
+ console.error("Not sure what to do with GF response", payload);
186
+ return [2 /*return*/, __assign({}, payload)];
187
+ }
188
+ return [3 /*break*/, 4];
189
+ case 3:
190
+ err_1 = _a.sent();
191
+ console.error(err_1);
192
+ return [2 /*return*/, {
193
+ success: false,
194
+ mainError: "An error occurred while submitting this form. Please contact us directly if the issue persists.",
195
+ }];
196
+ case 4: return [2 /*return*/];
197
+ }
166
198
  });
167
- const payload = await result.json();
168
- if (!payload.is_valid) {
169
- return {
170
- ...payload,
171
- success: false,
172
- errors: payload.validation_messages,
173
- };
174
- }
175
- else if (payload.is_valid) {
176
- return {
177
- ...payload,
178
- success: true,
179
- successMessage: payload.confirmation_message,
180
- };
181
- }
182
- else {
183
- console.error("Not sure what to do with GF response", payload);
184
- return {
185
- ...payload,
186
- };
187
- }
188
- }
189
- catch (err) {
190
- console.error(err);
191
- return {
192
- success: false,
193
- mainError: "An error occurred while submitting this form. Please contact us directly if the issue persists.",
194
- };
195
- }
199
+ });
196
200
  }
package/hooks/index.js CHANGED
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
@@ -1,31 +1,31 @@
1
1
  /** Generic Error */
2
- type GraphQLError = {
2
+ declare type GraphQLError = {
3
3
  message: string;
4
4
  };
5
5
  /** Regular queries */
6
- type CreateUseQueryOptions = {
6
+ declare type CreateUseQueryOptions = {
7
7
  name: string;
8
8
  };
9
- type QueryOptions = {
9
+ declare type QueryOptions = {
10
10
  revalidateIfStale?: boolean;
11
11
  revalidateOnFocus?: boolean;
12
12
  };
13
- type MaybeVars = {
13
+ declare type MaybeVars = {
14
14
  [key: string]: any;
15
15
  } | undefined;
16
- type QueryHookReturn<TReturn, TVars> = {
16
+ declare type QueryHookReturn<TReturn, TVars> = {
17
17
  loading: boolean;
18
18
  errors?: GraphQLError[];
19
19
  data?: TReturn;
20
20
  refresh: (vars?: TVars) => void;
21
21
  };
22
- type QueryHook<TReturn, TVars> = TVars extends undefined ? (vars?: TVars, opts?: QueryOptions) => QueryHookReturn<TReturn, TVars> : (vars: TVars, opts?: QueryOptions) => QueryHookReturn<TReturn, TVars>;
23
- type QueryFetcher<TReturn, TVars> = {
22
+ declare type QueryHook<TReturn, TVars> = TVars extends undefined ? (vars?: TVars, opts?: QueryOptions) => QueryHookReturn<TReturn, TVars> : (vars: TVars, opts?: QueryOptions) => QueryHookReturn<TReturn, TVars>;
23
+ declare type QueryFetcher<TReturn, TVars> = {
24
24
  fetch: TVars extends undefined ? (vars?: TVars) => Promise<TReturn> : (vars: TVars) => Promise<TReturn>;
25
25
  };
26
26
  export declare function createUseQuery<TReturn extends any, TVars extends MaybeVars>(init: CreateUseQueryOptions): QueryHook<TReturn, TVars> & QueryFetcher<TReturn, TVars>;
27
27
  /** Infinite queries */
28
- type CreateUseInfiniteQueryOptions = {
28
+ declare type CreateUseInfiniteQueryOptions = {
29
29
  name: string;
30
30
  defaultLimit: number;
31
31
  paths: {
@@ -35,7 +35,7 @@ type CreateUseInfiniteQueryOptions = {
35
35
  hasNextPagePath: string[];
36
36
  };
37
37
  };
38
- type InfiniteQueryHookReturn<TItem, TVars> = {
38
+ declare type InfiniteQueryHookReturn<TItem, TVars> = {
39
39
  loading: boolean;
40
40
  loadingMore: boolean;
41
41
  errors?: GraphQLError[];
@@ -45,18 +45,18 @@ type InfiniteQueryHookReturn<TItem, TVars> = {
45
45
  refresh: () => void;
46
46
  loadMore: () => void;
47
47
  };
48
- type InfiniteQueryHasAdditionalVars<TVars> = Exclude<keyof TVars, "limit" | "cursor"> extends never ? false : true;
49
- type InfiniteQueryHook<TItem, TVars> = InfiniteQueryHasAdditionalVars<TVars> extends false ? (vars?: TVars, opts?: QueryOptions) => InfiniteQueryHookReturn<TItem, TVars> : (vars: TVars, opts?: QueryOptions) => InfiniteQueryHookReturn<TItem, TVars>;
48
+ declare type InfiniteQueryHasAdditionalVars<TVars> = Exclude<keyof TVars, "limit" | "cursor"> extends never ? false : true;
49
+ declare type InfiniteQueryHook<TItem, TVars> = InfiniteQueryHasAdditionalVars<TVars> extends false ? (vars?: TVars, opts?: QueryOptions) => InfiniteQueryHookReturn<TItem, TVars> : (vars: TVars, opts?: QueryOptions) => InfiniteQueryHookReturn<TItem, TVars>;
50
50
  export declare function createUseInfiniteQuery<TItem, TVars extends MaybeVars>(init: CreateUseInfiniteQueryOptions): InfiniteQueryHook<TItem, TVars>;
51
- type MutationHookReturn<TReturn, TVars> = {
51
+ declare type MutationHookReturn<TReturn, TVars> = {
52
52
  submitting: boolean;
53
53
  submitted: boolean;
54
54
  errors?: GraphQLError[];
55
55
  data?: TReturn;
56
56
  submit: (vars: TVars) => void;
57
57
  };
58
- type MutationHook<TReturn, TVars> = (opts?: QueryOptions) => MutationHookReturn<TReturn, TVars>;
59
- type MutationFetcher<TReturn, TVars> = {
58
+ declare type MutationHook<TReturn, TVars> = (opts?: QueryOptions) => MutationHookReturn<TReturn, TVars>;
59
+ declare type MutationFetcher<TReturn, TVars> = {
60
60
  mutate: (vars: TVars) => Promise<TReturn>;
61
61
  };
62
62
  export declare function createUseMutation<TReturn extends any, TVars extends MaybeVars>(init: CreateUseQueryOptions): MutationHook<TReturn, TVars> & MutationFetcher<TReturn, TVars>;