@graphitation/apollo-react-relay-duct-tape 0.7.8 → 0.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,39 @@
1
1
  # Change Log - @graphitation/apollo-react-relay-duct-tape
2
2
 
3
- This log was last generated on Thu, 19 May 2022 14:31:52 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 17 Jun 2022 09:48:09 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.7.11
8
+
9
+ Fri, 17 Jun 2022 09:48:09 GMT
10
+
11
+ ### Patches
12
+
13
+ - Bump @graphitation/apollo-mock-client to v0.10.9
14
+ - Bump @graphitation/graphql-js-operation-payload-generator to v0.10.2
15
+
16
+ ## 0.7.10
17
+
18
+ Fri, 17 Jun 2022 08:43:47 GMT
19
+
20
+ ### Patches
21
+
22
+ - Bump @graphitation/apollo-mock-client to v0.10.8
23
+ - Bump @graphitation/graphql-js-operation-payload-generator to v0.10.1
24
+
25
+ ## 0.7.9
26
+
27
+ Fri, 03 Jun 2022 14:02:33 GMT
28
+
29
+ ### Patches
30
+
31
+ - Bump @graphitation/apollo-mock-client to v0.10.7
32
+ - Bump @graphitation/graphql-js-operation-payload-generator to v0.9.1
33
+
7
34
  ## 0.7.8
8
35
 
9
- Thu, 19 May 2022 14:31:52 GMT
36
+ Thu, 19 May 2022 14:31:59 GMT
10
37
 
11
38
  ### Patches
12
39
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphitation/apollo-react-relay-duct-tape",
3
3
  "description": "A compatibility wrapper that provides the react-relay API on top of Apollo Client.",
4
4
  "license": "MIT",
5
- "version": "0.7.8",
5
+ "version": "0.7.11",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/microsoft/graphitation.git",
@@ -19,8 +19,8 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "@apollo/client": "^3.3.15",
22
- "@graphitation/apollo-mock-client": "^0.10.6",
23
- "@graphitation/graphql-js-operation-payload-generator": "^0.9.0",
22
+ "@graphitation/apollo-mock-client": "^0.10.9",
23
+ "@graphitation/graphql-js-operation-payload-generator": "^0.10.2",
24
24
  "@graphitation/graphql-js-tag": "^0.9.0",
25
25
  "@types/jest": "^26.0.22",
26
26
  "@types/react": "^17.0.3",
package/.eslintcache DELETED
@@ -1 +0,0 @@
1
- [{"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/__tests__/hooks.test.tsx":"1","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/hooks.ts":"2","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/index.ts":"3","/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/types.ts":"4"},{"size":10125,"mtime":1652970479055,"results":"5","hashOfConfig":"6"},{"size":10118,"mtime":1652970479055,"results":"7","hashOfConfig":"6"},{"size":50,"mtime":1652970479055,"results":"8","hashOfConfig":"6"},{"size":1353,"mtime":1652970479055,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"14v0dpj",{"filePath":"12","messages":"13","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"14","messages":"15","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/__tests__/hooks.test.tsx",[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/hooks.ts",[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/index.ts",[],"/mnt/vss/_work/1/s/packages/apollo-react-relay-duct-tape/src/types.ts",[]]
package/lib/hooks.d.ts DELETED
@@ -1,187 +0,0 @@
1
- import { DocumentNode } from "graphql";
2
- import { KeyType, KeyTypeData, OperationType } from "./types";
3
- export declare type GraphQLTaggedNode = DocumentNode;
4
- /**
5
- * Executes a GraphQL query.
6
- *
7
- * This hook is called 'lazy' as it is used to fetch a GraphQL query _during_ render. This hook can trigger multiple
8
- * round trips, one for loading and one for resolving.
9
- *
10
- * @see {useFragment} This function largely follows the documentation of `useFragment`, except that this is a root of a
11
- * GraphQL operation and thus does not take in any props such as opaque fragment references.
12
- *
13
- * @example
14
- ```typescript
15
- import { graphql, useLazyLoadQuery } from "@nova-facade/react-graphql";
16
- import { SomeReactComponent, fragment as SomeReactComponent_someGraphQLType } from "./SomeReactComponent";
17
- import { SomeRootReactComponentQuery } from "./__generated__/SomeRootReactComponentQuery.graphql";
18
-
19
- const query = graphql`
20
- query SomeRootReactComponentQuery {
21
- someGraphQLType {
22
- ...SomeReactComponent_someGraphQLType
23
- }
24
- }
25
- ${SomeReactComponent_someGraphQLType}
26
- `;
27
-
28
- export const SomeRootReactComponent: React.FC = () => {
29
- const result = useLazyLoadQuery<SomeRootReactComponentQuery>(query);
30
- if (result.error) {
31
- throw result.error;
32
- } else if (!result.data) {
33
- // Loading
34
- return null;
35
- }
36
-
37
- return (
38
- <SomeReactComponent someGraphQLType={result.data.someGraphQLType} />
39
- );
40
- };
41
- ```
42
- *
43
- * @param query The query operation to perform.
44
- * @param variables Object containing the variable values to fetch the query. These variables need to match GraphQL
45
- * variables declared inside the query.
46
- * @param options Options passed on to the underlying implementation.
47
- * @returns An object with either an error, the result data, or neither while loading.
48
- */
49
- export declare function useLazyLoadQuery<TQuery extends OperationType>(query: GraphQLTaggedNode, variables: TQuery["variables"], options?: {
50
- fetchPolicy: "cache-first";
51
- }): {
52
- error?: Error;
53
- data?: TQuery["response"];
54
- };
55
- /**
56
- * A first-class way for an individual component to express its direct data requirements using GraphQL. The fragment
57
- * should select all the fields that the component directly uses in its rendering or needs to pass to external
58
- * functions. It should *not* select data that its children need, unless those children are intended to remain their
59
- * pure React props as data inputs.
60
- *
61
- * For children that *do* have their own data requirements expressed using GraphQL, the fragment should ensure to
62
- * spread in the child's fragment.
63
- *
64
- * For each fragment defined using the `graphql` tagged template function, the Nova graphql-compiler will emit
65
- * TypeScript typings that correspond to the selected fields and referenced child component fragments. These typings
66
- * live in files in the sibling `./__generated__/` directory and are called after the fragment name. The compiler will
67
- * enforce some constraints about the fragment name, such that it starts with the name of the file it is defined in
68
- * (i.e. the name of the component) and ends with the name of the fragment reference prop that this component takes in
69
- * (which typically will be named after the GraphQL type that the fragment is defined on).
70
- *
71
- * The typing that has a `$key` suffix is meant to be used for the opaque fragment reference prop, whereas the typing
72
- * without a suffix describes the actual data and is only meant for usage internally to the file. When the opaque
73
- * fragment reference prop is passed to a `useFragment` call, the returned data will be unmasked and be typed according
74
- * to the typing without a suffix. As such, the unmasked typing is only ever needed when extracting pieces of the
75
- * component to the file scope. For functions extracted to different files, however, you should type those separately
76
- * and *not* use the emitted typings.
77
- *
78
- * @example
79
- ```typescript
80
- import { graphql, useFragment } from "@nova-facade/react-graphql";
81
- import { SomeChildReactComponent, fragment as SomeChildReactComponent_someGraphQLType } from "./SomeChildReactComponent";
82
- import { SomeReactComponent_someGraphQLType$key } from "./__generated__/SomeReactComponent_someGraphQLType.graphql";
83
-
84
- export const fragment = graphql`
85
- fragment SomeReactComponent_someGraphQLType on SomeGraphQLType {
86
- someDataThatThisComponentNeeds
87
- ...SomeChildReactComponent_someGraphQLType
88
- }
89
- ${SomeChildReactComponent_someGraphQLType}
90
- `;
91
-
92
- export interface SomeReactComponentProps {
93
- someGraphQLType: SomeReactComponent_someGraphQLType$key;
94
- }
95
-
96
- export const SomeReactComponent: React.FunctionComponent<SomeReactComponentProps> = props => {
97
- const someGraphQLType = useFragment(fragment, props.someGraphQLType);
98
- return (
99
- <div>
100
- <span>{someGraphQLType.someDataThatThisComponentNeeds}</span>
101
- <SomeChildReactComponent someGraphQLType={someGraphQLType} />
102
- </div>
103
- );
104
- }
105
- ```
106
- *
107
- * @note For now, the fragment objects should be exported such that parent's can interpolate them into their own
108
- * GraphQL documents. This may change in the future when/if we entirely switch to static compilation and will
109
- * allow us to also move the usage of the graphql tagged template function inline at the `useFragment` call-site.
110
- *
111
- * @todo 1613321: Connect useFragment hooks directly to a GraphQL client store for targeted updates. Currently the data
112
- * is simply unmasked at compile-time but otherwise passed through from the parent at run-time.
113
- *
114
- * @param _fragmentInput The GraphQL fragment document created using the `graphql` tagged template function.
115
- * @param fragmentRef The opaque fragment reference passed in by a parent component that has spread in this component's
116
- * fragment.
117
- * @returns The data corresponding to the field selections.
118
- */
119
- export declare function useFragment<TKey extends KeyType>(_fragmentInput: GraphQLTaggedNode, fragmentRef: TKey): KeyTypeData<TKey>;
120
- interface GraphQLSubscriptionConfig<TSubscriptionPayload extends OperationType> {
121
- subscription: GraphQLTaggedNode;
122
- variables: TSubscriptionPayload["variables"];
123
- /**
124
- * Should response be nullable?
125
- */
126
- onNext?: (response: TSubscriptionPayload["response"]) => void;
127
- onError?: (error: Error) => void;
128
- }
129
- export declare function useSubscription<TSubscriptionPayload extends OperationType>(config: GraphQLSubscriptionConfig<TSubscriptionPayload>): void;
130
- interface IMutationCommitterOptions<TMutationPayload extends OperationType> {
131
- variables: TMutationPayload["variables"];
132
- optimisticResponse?: Partial<TMutationPayload["response"]> | null;
133
- }
134
- declare type MutationCommiter<TMutationPayload extends OperationType> = (options: IMutationCommitterOptions<TMutationPayload>) => Promise<{
135
- errors?: Error[];
136
- data?: TMutationPayload["response"];
137
- }>;
138
- /**
139
- * Declare use of a mutation within component. Returns an array of a function and loading state boolean.
140
- *
141
- * Returned function can be called to perform the actual mutation with provided variables.
142
- *
143
- * @param mutation Mutation document
144
- * @returns [commitMutationFn, isInFlight]
145
- *
146
- * commitMutationFn
147
- * @param options.variables map of variables to pass to mutation
148
- * @param options.optimisticResponse proposed response to apply to the store while mutation is in flight
149
- * @returns A Promise to an object with either errors or/and the result data
150
- *
151
- * Example
152
- ```
153
-
154
- const mutation = graphql`
155
- mutation SomeReactComponentMutation($newName: String!) {
156
- someMutation(newName: $newName) {
157
- __typeName
158
- id
159
- newName
160
- }
161
- }
162
- `
163
-
164
- export const SomeReactComponent: React.FunctionComponent<SomeReactComponentProps> = props => {
165
- const [commitMutation, isInFlight] = useMutation(mutation);
166
- return (
167
- <div>
168
- <button onClick={() => commitMutation({
169
- variables: {
170
- newName: "foo"
171
- },
172
- optimisticResponse: {
173
- someMutation: {
174
- __typename: "SomeMutationPayload",
175
- id: "1",
176
- newName: "foo",
177
- }
178
- }
179
- })} disabled={isInFlight}/>
180
- </div>
181
- );
182
- }
183
- ```
184
- */
185
- export declare function useMutation<TMutationPayload extends OperationType>(mutation: GraphQLTaggedNode): [MutationCommiter<TMutationPayload>, boolean];
186
- export {};
187
- //# sourceMappingURL=hooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AASvC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAa,MAAM,SAAS,CAAC;AAEzE,oBAAY,iBAAiB,GAAG,YAAY,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,SAAS,aAAa,EAC3D,KAAK,EAAE,iBAAiB,EACxB,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,EAC9B,OAAO,CAAC,EAAE;IAAE,WAAW,EAAE,aAAa,CAAA;CAAE,GACvC;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;CAAE,CAE9C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,wBAAgB,WAAW,CAAC,IAAI,SAAS,OAAO,EAC9C,cAAc,EAAE,iBAAiB,EACjC,WAAW,EAAE,IAAI,GAChB,WAAW,CAAC,IAAI,CAAC,CAEnB;AAGD,UAAU,yBAAyB,CACjC,oBAAoB,SAAS,aAAa;IAE1C,YAAY,EAAE,iBAAiB,CAAC;IAChC,SAAS,EAAE,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAC7C;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC9D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,wBAAgB,eAAe,CAAC,oBAAoB,SAAS,aAAa,EACxE,MAAM,EAAE,yBAAyB,CAAC,oBAAoB,CAAC,GACtD,IAAI,CAwBN;AAED,UAAU,yBAAyB,CAAC,gBAAgB,SAAS,aAAa;IACxE,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACzC,kBAAkB,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,GAAG,IAAI,CAAC;CACnE;AAED,aAAK,gBAAgB,CAAC,gBAAgB,SAAS,aAAa,IAAI,CAC9D,OAAO,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,KACjD,OAAO,CAAC;IAAE,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAA;CAAE,CAAC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,WAAW,CAAC,gBAAgB,SAAS,aAAa,EAChE,QAAQ,EAAE,iBAAiB,GAC1B,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAuB/C"}
package/lib/hooks.js DELETED
@@ -1,110 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
10
- var __objSpread = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
22
- var __export = (target, all) => {
23
- for (var name in all)
24
- __defProp(target, name, {get: all[name], enumerable: true});
25
- };
26
- var __reExport = (target, module2, desc) => {
27
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
28
- for (let key of __getOwnPropNames(module2))
29
- if (!__hasOwnProp.call(target, key) && key !== "default")
30
- __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
31
- }
32
- return target;
33
- };
34
- var __toModule = (module2) => {
35
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
36
- };
37
- var __async = (__this, __arguments, generator) => {
38
- return new Promise((resolve, reject) => {
39
- var fulfilled = (value) => {
40
- try {
41
- step(generator.next(value));
42
- } catch (e) {
43
- reject(e);
44
- }
45
- };
46
- var rejected = (value) => {
47
- try {
48
- step(generator.throw(value));
49
- } catch (e) {
50
- reject(e);
51
- }
52
- };
53
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
54
- step((generator = generator.apply(__this, __arguments)).next());
55
- });
56
- };
57
- __markAsModule(exports);
58
- __export(exports, {
59
- useFragment: () => useFragment,
60
- useLazyLoadQuery: () => useLazyLoadQuery,
61
- useMutation: () => useMutation,
62
- useSubscription: () => useSubscription
63
- });
64
- var import_invariant = __toModule(require("invariant"));
65
- var import_client = __toModule(require("@apollo/client"));
66
- function useLazyLoadQuery(query, variables, options) {
67
- return (0, import_client.useQuery)(query, __objSpread({variables}, options));
68
- }
69
- function useFragment(_fragmentInput, fragmentRef) {
70
- return fragmentRef;
71
- }
72
- function useSubscription(config) {
73
- const {error} = (0, import_client.useSubscription)(config.subscription, {
74
- variables: config.variables,
75
- onSubscriptionData: ({subscriptionData}) => {
76
- (0, import_invariant.default)(!subscriptionData.error, "Did not expect to receive an error here");
77
- if (subscriptionData.data && config.onNext) {
78
- config.onNext(subscriptionData.data);
79
- }
80
- }
81
- });
82
- if (error) {
83
- if (config.onError) {
84
- config.onError(error);
85
- } else {
86
- console.warn(`An unhandled GraphQL subscription error occurred: ${error.message}`);
87
- }
88
- }
89
- }
90
- function useMutation(mutation) {
91
- const [apolloUpdater, {loading: mutationLoading}] = (0, import_client.useMutation)(mutation);
92
- return [
93
- (options) => __async(this, null, function* () {
94
- const apolloResult = yield apolloUpdater({
95
- variables: options.variables || {},
96
- optimisticResponse: options.optimisticResponse
97
- });
98
- if (apolloResult.errors) {
99
- return {
100
- errors: Array.from(Object.values(apolloResult.errors)),
101
- data: apolloResult.data
102
- };
103
- }
104
- return {
105
- data: apolloResult.data
106
- };
107
- }),
108
- mutationLoading
109
- ];
110
- }
package/lib/hooks.mjs DELETED
@@ -1,95 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __hasOwnProp = Object.prototype.hasOwnProperty;
3
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
6
- var __objSpread = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
- var __async = (__this, __arguments, generator) => {
18
- return new Promise((resolve, reject) => {
19
- var fulfilled = (value) => {
20
- try {
21
- step(generator.next(value));
22
- } catch (e) {
23
- reject(e);
24
- }
25
- };
26
- var rejected = (value) => {
27
- try {
28
- step(generator.throw(value));
29
- } catch (e) {
30
- reject(e);
31
- }
32
- };
33
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
34
- step((generator = generator.apply(__this, __arguments)).next());
35
- });
36
- };
37
-
38
- // src/hooks.ts
39
- import invariant from "invariant";
40
- import {
41
- useSubscription as useApolloSubscription,
42
- useQuery as useApolloQuery,
43
- useMutation as useApolloMutation
44
- } from "@apollo/client";
45
- function useLazyLoadQuery(query, variables, options) {
46
- return useApolloQuery(query, __objSpread({variables}, options));
47
- }
48
- function useFragment(_fragmentInput, fragmentRef) {
49
- return fragmentRef;
50
- }
51
- function useSubscription(config) {
52
- const {error} = useApolloSubscription(config.subscription, {
53
- variables: config.variables,
54
- onSubscriptionData: ({subscriptionData}) => {
55
- invariant(!subscriptionData.error, "Did not expect to receive an error here");
56
- if (subscriptionData.data && config.onNext) {
57
- config.onNext(subscriptionData.data);
58
- }
59
- }
60
- });
61
- if (error) {
62
- if (config.onError) {
63
- config.onError(error);
64
- } else {
65
- console.warn(`An unhandled GraphQL subscription error occurred: ${error.message}`);
66
- }
67
- }
68
- }
69
- function useMutation(mutation) {
70
- const [apolloUpdater, {loading: mutationLoading}] = useApolloMutation(mutation);
71
- return [
72
- (options) => __async(this, null, function* () {
73
- const apolloResult = yield apolloUpdater({
74
- variables: options.variables || {},
75
- optimisticResponse: options.optimisticResponse
76
- });
77
- if (apolloResult.errors) {
78
- return {
79
- errors: Array.from(Object.values(apolloResult.errors)),
80
- data: apolloResult.data
81
- };
82
- }
83
- return {
84
- data: apolloResult.data
85
- };
86
- }),
87
- mutationLoading
88
- ];
89
- }
90
- export {
91
- useFragment,
92
- useLazyLoadQuery,
93
- useMutation,
94
- useSubscription
95
- };
package/lib/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from "./hooks";
2
- export * from "./types";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/lib/index.js DELETED
@@ -1,21 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
8
- var __reExport = (target, module2, desc) => {
9
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
10
- for (let key of __getOwnPropNames(module2))
11
- if (!__hasOwnProp.call(target, key) && key !== "default")
12
- __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
13
- }
14
- return target;
15
- };
16
- var __toModule = (module2) => {
17
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
18
- };
19
- __markAsModule(exports);
20
- __reExport(exports, __toModule(require("./hooks")));
21
- __reExport(exports, __toModule(require("./types")));
package/lib/index.mjs DELETED
@@ -1,3 +0,0 @@
1
- // src/index.ts
2
- export * from "./hooks.mjs";
3
- export * from "./types.mjs";
package/lib/types.d.ts DELETED
@@ -1,33 +0,0 @@
1
- export interface Variables {
2
- [name: string]: any;
3
- }
4
- export interface OperationType {
5
- readonly variables: Variables;
6
- readonly response: unknown;
7
- readonly rawResponse?: unknown;
8
- }
9
- /**
10
- * relay-compiler-language-typescript support for fragment references
11
- */
12
- export interface _RefType<Ref extends string> {
13
- " $refType": Ref;
14
- }
15
- export interface _FragmentRefs<Refs extends string> {
16
- " $fragmentRefs": FragmentRefs<Refs>;
17
- }
18
- export declare type FragmentRefs<Refs extends string> = {
19
- [ref in Refs]: true;
20
- };
21
- export declare type FragmentRef<Fragment> = Fragment extends _RefType<infer U> ? _FragmentRefs<U> : never;
22
- /**
23
- * react-relay DT
24
- */
25
- export declare type FragmentReference = unknown;
26
- export declare type KeyType<TData = unknown> = Readonly<{
27
- " $data"?: TData;
28
- " $fragmentRefs": FragmentReference;
29
- }>;
30
- export declare type KeyTypeData<TKey extends KeyType<TData>, TData = unknown> = Required<TKey>[" $data"];
31
- export declare type ArrayKeyType<TData = unknown> = ReadonlyArray<KeyType<ReadonlyArray<TData>> | null>;
32
- export declare type ArrayKeyTypeData<TKey extends ArrayKeyType<TData>, TData = unknown> = KeyTypeData<NonNullable<TKey[number]>>;
33
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AAEH,MAAM,WAAW,QAAQ,CAAC,GAAG,SAAS,MAAM;IAC1C,WAAW,EAAE,GAAG,CAAC;CAClB;AAED,MAAM,WAAW,aAAa,CAAC,IAAI,SAAS,MAAM;IAChD,gBAAgB,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CACtC;AAGD,oBAAY,YAAY,CAAC,IAAI,SAAS,MAAM,IAAI;KAC7C,GAAG,IAAI,IAAI,GAAG,IAAI;CACpB,CAAC;AAGF,oBAAY,WAAW,CAAC,QAAQ,IAAI,QAAQ,SAAS,QAAQ,CAAC,MAAM,CAAC,CAAC,GAClE,aAAa,CAAC,CAAC,CAAC,GAChB,KAAK,CAAC;AAEV;;GAEG;AAEH,oBAAY,iBAAiB,GAAG,OAAO,CAAC;AAExC,oBAAY,OAAO,CAAC,KAAK,GAAG,OAAO,IAAI,QAAQ,CAAC;IAC9C,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,gBAAgB,EAAE,iBAAiB,CAAC;CACrC,CAAC,CAAC;AAEH,oBAAY,WAAW,CACrB,IAAI,SAAS,OAAO,CAAC,KAAK,CAAC,EAC3B,KAAK,GAAG,OAAO,IACb,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC;AAE7B,oBAAY,YAAY,CAAC,KAAK,GAAG,OAAO,IAAI,aAAa,CAAC,OAAO,CAC/D,aAAa,CAAC,KAAK,CAAC,CACrB,GAAG,IAAI,CAAC,CAAC;AACV,oBAAY,gBAAgB,CAC1B,IAAI,SAAS,YAAY,CAAC,KAAK,CAAC,EAChC,KAAK,GAAG,OAAO,IACb,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC"}
package/lib/types.js DELETED
@@ -1,3 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
3
- __markAsModule(exports);
package/lib/types.mjs DELETED
File without changes