@graphitation/apollo-react-relay-duct-tape 0.7.6 → 1.0.0
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 +6 -15
- package/README.md +122 -0
- package/graphitation-apollo-react-relay-duct-tape-0.5.0-store-observation.8.tgz +0 -0
- package/package.json +13 -9
- package/.eslintcache +0 -1
- package/CHANGELOG.json +0 -513
- package/lib/hooks.d.ts +0 -187
- package/lib/hooks.d.ts.map +0 -1
- package/lib/hooks.js +0 -110
- package/lib/hooks.mjs +0 -95
- package/lib/index.d.ts +0 -3
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -21
- package/lib/index.mjs +0 -3
- package/lib/types.d.ts +0 -33
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js +0 -3
- package/lib/types.mjs +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,29 +1,20 @@
|
|
|
1
1
|
# Change Log - @graphitation/apollo-react-relay-duct-tape
|
|
2
2
|
|
|
3
|
-
This log was last generated on Tue,
|
|
3
|
+
This log was last generated on Tue, 01 Feb 2022 12:17:19 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 0.
|
|
7
|
+
## 1.0.0
|
|
8
8
|
|
|
9
|
-
Tue,
|
|
9
|
+
Tue, 01 Feb 2022 12:17:19 GMT
|
|
10
10
|
|
|
11
11
|
### Patches
|
|
12
12
|
|
|
13
|
-
- Bump
|
|
14
|
-
- Bump @graphitation/graphql-js-operation-payload-generator to v0.8.4
|
|
15
|
-
- Bump @graphitation/graphql-js-tag to v0.8.3
|
|
13
|
+
- Bump relay-compiler-language-graphitation to v1.0.0-alpha.2
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
### Changes
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
### Patches
|
|
22
|
-
|
|
23
|
-
- Fix Webpack 4 compat (mnovikov@microsoft.com)
|
|
24
|
-
- Bump @graphitation/apollo-mock-client to v0.10.3
|
|
25
|
-
- Bump @graphitation/graphql-js-operation-payload-generator to v0.8.3
|
|
26
|
-
- Bump relay-compiler-language-graphitation to v0.8.2
|
|
17
|
+
- Various changes (eloy.de.enige@gmail.com)
|
|
27
18
|
|
|
28
19
|
## 0.7.4
|
|
29
20
|
|
package/README.md
CHANGED
|
@@ -5,3 +5,125 @@ A compatibility wrapper that provides the react-relay API on top of Apollo Clien
|
|
|
5
5
|
_The name is a reference to the Apollo 13 mission._
|
|
6
6
|
|
|
7
7
|
Use this together with [relay-compiler-language-graphitation](../relay-compiler-language-graphitation) to have typings generated.
|
|
8
|
+
|
|
9
|
+
# Setup
|
|
10
|
+
|
|
11
|
+
### Installation
|
|
12
|
+
|
|
13
|
+
- Install the packages from this repo:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
yarn add @graphitation/apollo-react-relay-duct-tape
|
|
17
|
+
yarn add --dev relay-compiler-language-graphitation
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- Patch your version of `@apollo/client` using the patch found in [the patches directory](../../patches). You can either do so manually or use a tool like [patch-package](https://github.com/ds300/patch-package).
|
|
21
|
+
|
|
22
|
+
- For an expedient developer-experience, you will want to install [the `watchman` tool](https://facebook.github.io/watchman/).
|
|
23
|
+
- On macOS (using [homebrew](https://brew.sh)): `$ brew install watchman`
|
|
24
|
+
- On Windows (using [chocolatey](https://chocolatey.org)): `$ choco install watchman`
|
|
25
|
+
|
|
26
|
+
### Configuration
|
|
27
|
+
|
|
28
|
+
- Configure Apollo Client's cache to automatically add `__typename` field selections, which concrete types implement the `Node` interface, and the type-policies needed to read the watch query data from the store:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { InMemoryCache } from "@apollo/client";
|
|
32
|
+
import { typePolicies } from "@graphitation/apollo-react-relay-duct-tape";
|
|
33
|
+
|
|
34
|
+
const cache = new InMemoryCache({
|
|
35
|
+
addTypename: true,
|
|
36
|
+
// Be sure to specify types that implement the Node interface
|
|
37
|
+
// See https://www.apollographql.com/docs/react/data/fragments/#using-fragments-with-unions-and-interfaces
|
|
38
|
+
possibleTypes: {
|
|
39
|
+
Node: ["Todo"],
|
|
40
|
+
},
|
|
41
|
+
// Either use the `typePolicies` object directly or otherwise extend appropriately
|
|
42
|
+
typePolicies: {
|
|
43
|
+
Query: {
|
|
44
|
+
fields: {
|
|
45
|
+
__fragments: {
|
|
46
|
+
read: typePolicies.Query.fields.__fragments.read,
|
|
47
|
+
},
|
|
48
|
+
node: {
|
|
49
|
+
read: typePolicies.Query.fields.node.read,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
Node: {
|
|
54
|
+
fields: {
|
|
55
|
+
__fragments: {
|
|
56
|
+
read: typePolicies.Node.fields.__fragments.read,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- Configure webpack to transform your code by replacing inline GraphQL documents with their compiled artefacts:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const {
|
|
68
|
+
createImportDocumentsTransform,
|
|
69
|
+
} = require("@graphitation/apollo-react-relay-duct-tape/lib/storeObservation/createImportDocumentsTransform");
|
|
70
|
+
|
|
71
|
+
const config: webpack.Configuration = {
|
|
72
|
+
module: {
|
|
73
|
+
rules: [
|
|
74
|
+
{
|
|
75
|
+
test: /\.tsx?$/,
|
|
76
|
+
loader: "ts-loader",
|
|
77
|
+
exclude: /node_modules/,
|
|
78
|
+
options: {
|
|
79
|
+
getCustomTransformers: () => ({
|
|
80
|
+
before: [createImportDocumentsTransform()],
|
|
81
|
+
}),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- TODO: Have a `Node` interface definition
|
|
90
|
+
- TODO: Add `node` root field
|
|
91
|
+
|
|
92
|
+
- Optionally, if you rely on Apollo Client's `@client` directive, be sure to explicitly add it to your local copy of your schema, otherwise the compiler will not accept its use.
|
|
93
|
+
|
|
94
|
+
```graphql
|
|
95
|
+
directive @client(always: Boolean) on FIELD
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Usage
|
|
99
|
+
|
|
100
|
+
### Build
|
|
101
|
+
|
|
102
|
+
In a shell, start the compiler and point it to your schema and source. Depending on the size of the code-base a first run may take a while, but subsequent builds should cached. For developer-expedience, it is advised to run the compiler using the watch mode -- provided you have installed the `watchman` tool.
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
$ yarn graphitation-compiler \
|
|
106
|
+
--schema ./path/to/schema.graphql \
|
|
107
|
+
--src ./path/to/source \
|
|
108
|
+
--watch
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
TODO:
|
|
112
|
+
|
|
113
|
+
- Add `Node` interface to type that you want to start a new watch query for
|
|
114
|
+
- Restart compiler
|
|
115
|
+
|
|
116
|
+
### Runtime
|
|
117
|
+
|
|
118
|
+
TODO:
|
|
119
|
+
|
|
120
|
+
- Add query hook
|
|
121
|
+
- Add fragment hook
|
|
122
|
+
- Import and use typings
|
|
123
|
+
|
|
124
|
+
## Architecture
|
|
125
|
+
|
|
126
|
+
- Fragment reference variables need to be propagated to child fragment hooks, so refetch hooks can re-use original request variables.
|
|
127
|
+
- This cannot be done through React Context, because a refetch hook needs to be able to [partially] update original variables, which cannot be done with React Context.
|
|
128
|
+
- Instead, we pass these as React props, which are populated through GraphQL as we can know exactly where [child] fragments are being referenced and the data needs to be encoded. The actual resolving of the data is done through the (./packages/apollo-react-relay-duct-tape/src/storeObservation/fragmentReferencesFieldPolicy.ts)[fragmentReferencesFieldPolicy] Apollo Cache field policy.
|
|
129
|
+
- Because we can't just add a Apollo Cache field policy to _any_ type, as we don't even know all types, we add it to the `Node` interface instead. The one other type we can assume to exist is the `Query` type.
|
package/package.json
CHANGED
|
@@ -2,41 +2,45 @@
|
|
|
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.
|
|
5
|
+
"version": "1.0.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/microsoft/graphitation.git",
|
|
9
9
|
"directory": "packages/apollo-react-relay-duct-tape"
|
|
10
10
|
},
|
|
11
|
-
"main": "./lib/index",
|
|
11
|
+
"main": "./lib/index.js",
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "monorepo-scripts build",
|
|
14
14
|
"lint": "monorepo-scripts lint",
|
|
15
15
|
"test": "monorepo-scripts test",
|
|
16
16
|
"types": "monorepo-scripts types",
|
|
17
17
|
"just": "monorepo-scripts",
|
|
18
|
-
"
|
|
18
|
+
"relay": "graphitation-compiler --printWatchQueries --schema ./src/__tests__/schema.graphql --src ./src --exclude src/storeObservation/*FieldPolicy.test.ts"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@apollo/client": "^3.3.15",
|
|
22
|
-
"@graphitation/apollo-mock-client": "^0.10.
|
|
23
|
-
"@graphitation/graphql-js-operation-payload-generator": "^0.8.
|
|
24
|
-
"@graphitation/graphql-js-tag": "^0.8.
|
|
22
|
+
"@graphitation/apollo-mock-client": "^0.10.2",
|
|
23
|
+
"@graphitation/graphql-js-operation-payload-generator": "^0.8.2",
|
|
24
|
+
"@graphitation/graphql-js-tag": "^0.8.2",
|
|
25
25
|
"@types/jest": "^26.0.22",
|
|
26
|
+
"@types/lodash": "^4.14.176",
|
|
26
27
|
"@types/react": "^17.0.3",
|
|
27
28
|
"graphql": "^15.0.0",
|
|
28
29
|
"monorepo-scripts": "*",
|
|
29
30
|
"react": "^17.0.2",
|
|
30
31
|
"relay-compiler": "^11.0.2",
|
|
31
|
-
"relay-compiler-language-graphitation": "^0.
|
|
32
|
+
"relay-compiler-language-graphitation": "^1.0.0-alpha.2",
|
|
32
33
|
"ts-expect": "^1.3.0"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
36
|
+
"@apollo/client": "^3.3.0",
|
|
35
37
|
"graphql": "^15.0.0",
|
|
36
|
-
"react": "^17.0.2"
|
|
38
|
+
"react": "^17.0.2",
|
|
39
|
+
"relay-compiler-language-graphitation": "^1.0.0-alpha.2"
|
|
37
40
|
},
|
|
38
41
|
"dependencies": {
|
|
39
|
-
"invariant": "^2.2.4"
|
|
42
|
+
"invariant": "^2.2.4",
|
|
43
|
+
"lodash": "^4.17.15"
|
|
40
44
|
},
|
|
41
45
|
"sideEffects": false,
|
|
42
46
|
"access": "public",
|
package/.eslintcache
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/__tests__/__generated__/hooksTestFragment.graphql.ts":"1","/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/__tests__/__generated__/hooksTestMutation.graphql.ts":"2","/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/__tests__/__generated__/hooksTestQuery.graphql.ts":"3","/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/__tests__/__generated__/hooksTestSubscription.graphql.ts":"4","/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/__tests__/hooks.test.tsx":"5","/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/hooks.ts":"6","/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/index.ts":"7","/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/types.ts":"8"},{"size":500,"mtime":1643104881916,"results":"9","hashOfConfig":"10"},{"size":488,"mtime":1643104881916,"results":"11","hashOfConfig":"10"},{"size":447,"mtime":1643104881916,"results":"12","hashOfConfig":"10"},{"size":493,"mtime":1643104881916,"results":"13","hashOfConfig":"10"},{"size":9975,"mtime":1643104881916,"results":"14","hashOfConfig":"10"},{"size":10118,"mtime":1643104881916,"results":"15","hashOfConfig":"10"},{"size":50,"mtime":1643104881916,"results":"16","hashOfConfig":"10"},{"size":1353,"mtime":1643104881916,"results":"17","hashOfConfig":"10"},{"filePath":"18","messages":"19","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"2c0p4f",{"filePath":"20","messages":"21","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"22","messages":"23","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"24","messages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"26","messages":"27","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"32","messages":"33","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/__tests__/__generated__/hooksTestFragment.graphql.ts",[],"/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/__tests__/__generated__/hooksTestMutation.graphql.ts",[],"/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/__tests__/__generated__/hooksTestQuery.graphql.ts",[],"/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/__tests__/__generated__/hooksTestSubscription.graphql.ts",[],"/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/__tests__/hooks.test.tsx",[],"/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/hooks.ts",[],"/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/index.ts",[],"/home/runner/work/graphitation/graphitation/packages/apollo-react-relay-duct-tape/src/types.ts",[]]
|
package/CHANGELOG.json
DELETED
|
@@ -1,513 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@graphitation/apollo-react-relay-duct-tape",
|
|
3
|
-
"entries": [
|
|
4
|
-
{
|
|
5
|
-
"date": "Tue, 25 Jan 2022 10:04:19 GMT",
|
|
6
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.6",
|
|
7
|
-
"version": "0.7.6",
|
|
8
|
-
"comments": {
|
|
9
|
-
"patch": [
|
|
10
|
-
{
|
|
11
|
-
"author": "beachball",
|
|
12
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
13
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.10.4",
|
|
14
|
-
"commit": "76619c9ce06f97d886b80c74f27496baead95982"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"author": "beachball",
|
|
18
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
19
|
-
"comment": "Bump @graphitation/graphql-js-operation-payload-generator to v0.8.4",
|
|
20
|
-
"commit": "76619c9ce06f97d886b80c74f27496baead95982"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"author": "beachball",
|
|
24
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
25
|
-
"comment": "Bump @graphitation/graphql-js-tag to v0.8.3",
|
|
26
|
-
"commit": "76619c9ce06f97d886b80c74f27496baead95982"
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"date": "Tue, 25 Jan 2022 09:56:59 GMT",
|
|
33
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.5",
|
|
34
|
-
"version": "0.7.5",
|
|
35
|
-
"comments": {
|
|
36
|
-
"none": [
|
|
37
|
-
{
|
|
38
|
-
"author": "mnovikov@microsoft.com",
|
|
39
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
40
|
-
"commit": "5fddfaa87809a5e094f61cb2bbd3f1b69202e7f1",
|
|
41
|
-
"comment": "Add prettierrc, add it to linter and force it to do it"
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"date": "Mon, 24 Jan 2022 13:40:52 GMT",
|
|
48
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.5",
|
|
49
|
-
"version": "0.7.5",
|
|
50
|
-
"comments": {
|
|
51
|
-
"patch": [
|
|
52
|
-
{
|
|
53
|
-
"author": "mnovikov@microsoft.com",
|
|
54
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
55
|
-
"commit": "ce2d4f019baf1717202a3c33ec0d75fa3b5a4fb3",
|
|
56
|
-
"comment": "Fix Webpack 4 compat"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"author": "beachball",
|
|
60
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
61
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.10.3",
|
|
62
|
-
"commit": "a222ddaf6f18507f67378f06fde9833bab69d52c"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"author": "beachball",
|
|
66
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
67
|
-
"comment": "Bump @graphitation/graphql-js-operation-payload-generator to v0.8.3",
|
|
68
|
-
"commit": "a222ddaf6f18507f67378f06fde9833bab69d52c"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"author": "beachball",
|
|
72
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
73
|
-
"comment": "Bump relay-compiler-language-graphitation to v0.8.2",
|
|
74
|
-
"commit": "a222ddaf6f18507f67378f06fde9833bab69d52c"
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"date": "Fri, 14 Jan 2022 11:15:34 GMT",
|
|
81
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.4",
|
|
82
|
-
"version": "0.7.4",
|
|
83
|
-
"comments": {
|
|
84
|
-
"patch": [
|
|
85
|
-
{
|
|
86
|
-
"author": "mnovikov@microsoft.com",
|
|
87
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
88
|
-
"commit": "9882765303f4e5ff5820e243ab498d9627825d8b",
|
|
89
|
-
"comment": "Make sideffects false actually work"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"author": "beachball",
|
|
93
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
94
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.10.2",
|
|
95
|
-
"commit": "9882765303f4e5ff5820e243ab498d9627825d8b"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"author": "beachball",
|
|
99
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
100
|
-
"comment": "Bump @graphitation/graphql-js-operation-payload-generator to v0.8.2",
|
|
101
|
-
"commit": "9882765303f4e5ff5820e243ab498d9627825d8b"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"author": "beachball",
|
|
105
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
106
|
-
"comment": "Bump @graphitation/graphql-js-tag to v0.8.2",
|
|
107
|
-
"commit": "9882765303f4e5ff5820e243ab498d9627825d8b"
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"date": "Fri, 14 Jan 2022 10:12:20 GMT",
|
|
114
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.3",
|
|
115
|
-
"version": "0.7.3",
|
|
116
|
-
"comments": {
|
|
117
|
-
"patch": [
|
|
118
|
-
{
|
|
119
|
-
"author": "mnovikov@microsoft.com",
|
|
120
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
121
|
-
"commit": "31a3867a32c3001ded73331c7a546057eb480a62",
|
|
122
|
-
"comment": "Add side-effects false to all production packages for webpack opt"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"author": "beachball",
|
|
126
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
127
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.10.1",
|
|
128
|
-
"commit": "31a3867a32c3001ded73331c7a546057eb480a62"
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
"author": "beachball",
|
|
132
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
133
|
-
"comment": "Bump @graphitation/graphql-js-operation-payload-generator to v0.8.1",
|
|
134
|
-
"commit": "31a3867a32c3001ded73331c7a546057eb480a62"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"author": "beachball",
|
|
138
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
139
|
-
"comment": "Bump @graphitation/graphql-js-tag to v0.8.1",
|
|
140
|
-
"commit": "31a3867a32c3001ded73331c7a546057eb480a62"
|
|
141
|
-
}
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
"date": "Thu, 06 Jan 2022 09:53:33 GMT",
|
|
147
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.2",
|
|
148
|
-
"version": "0.7.2",
|
|
149
|
-
"comments": {
|
|
150
|
-
"patch": [
|
|
151
|
-
{
|
|
152
|
-
"author": "beachball",
|
|
153
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
154
|
-
"comment": "Bump relay-compiler-language-graphitation to v0.8.1",
|
|
155
|
-
"commit": "0268d6880be756f48acc0dd7c1faffef70f23189"
|
|
156
|
-
}
|
|
157
|
-
]
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
"date": "Wed, 05 Jan 2022 15:09:43 GMT",
|
|
162
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.1",
|
|
163
|
-
"version": "0.7.1",
|
|
164
|
-
"comments": {
|
|
165
|
-
"patch": [
|
|
166
|
-
{
|
|
167
|
-
"author": "beachball",
|
|
168
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
169
|
-
"comment": "Bump relay-compiler-language-graphitation to v0.8.0",
|
|
170
|
-
"commit": "298f6ea41347e68022fd99c0898aa59e108d2e5b"
|
|
171
|
-
}
|
|
172
|
-
]
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"date": "Thu, 23 Dec 2021 13:01:22 GMT",
|
|
177
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.0",
|
|
178
|
-
"version": "0.7.0",
|
|
179
|
-
"comments": {
|
|
180
|
-
"none": [
|
|
181
|
-
{
|
|
182
|
-
"author": "eloy.de.enige@gmail.com",
|
|
183
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
184
|
-
"commit": "bbbe8844858f53ceed2bd1c8790d3aff43b919df",
|
|
185
|
-
"comment": "[package] Add repo details to other packages and template"
|
|
186
|
-
}
|
|
187
|
-
]
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
"date": "Thu, 23 Dec 2021 11:31:14 GMT",
|
|
192
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.0",
|
|
193
|
-
"version": "0.7.0",
|
|
194
|
-
"comments": {
|
|
195
|
-
"minor": [
|
|
196
|
-
{
|
|
197
|
-
"author": "mnovikov@microsoft.com",
|
|
198
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
199
|
-
"commit": "d3baa5116dc93bba4e38e5beb7f23c3edbbb0680",
|
|
200
|
-
"comment": "Added proper mjs builds (bump for main release)"
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"author": "beachball",
|
|
204
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
205
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.10.0",
|
|
206
|
-
"commit": "d3baa5116dc93bba4e38e5beb7f23c3edbbb0680"
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
"author": "beachball",
|
|
210
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
211
|
-
"comment": "Bump @graphitation/graphql-js-operation-payload-generator to v0.8.0",
|
|
212
|
-
"commit": "d3baa5116dc93bba4e38e5beb7f23c3edbbb0680"
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
"author": "beachball",
|
|
216
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
217
|
-
"comment": "Bump @graphitation/graphql-js-tag to v0.8.0",
|
|
218
|
-
"commit": "d3baa5116dc93bba4e38e5beb7f23c3edbbb0680"
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
"author": "beachball",
|
|
222
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
223
|
-
"comment": "Bump relay-compiler-language-graphitation to v0.7.0",
|
|
224
|
-
"commit": "d3baa5116dc93bba4e38e5beb7f23c3edbbb0680"
|
|
225
|
-
}
|
|
226
|
-
]
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
"date": "Tue, 14 Dec 2021 10:13:54 GMT",
|
|
231
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.6.0",
|
|
232
|
-
"version": "0.6.0",
|
|
233
|
-
"comments": {
|
|
234
|
-
"minor": [
|
|
235
|
-
{
|
|
236
|
-
"author": "mnovikov@microsoft.com",
|
|
237
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
238
|
-
"commit": "fad5f1bc587470a2c85bf5763bb102a179a592b2",
|
|
239
|
-
"comment": "Support ESM in distro packages"
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
"author": "beachball",
|
|
243
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
244
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.9.0",
|
|
245
|
-
"commit": "fc3bf93bc5d50221d8539fe79704c45bc2612786"
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
"author": "beachball",
|
|
249
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
250
|
-
"comment": "Bump @graphitation/graphql-js-operation-payload-generator to v0.7.0",
|
|
251
|
-
"commit": "fc3bf93bc5d50221d8539fe79704c45bc2612786"
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
"author": "beachball",
|
|
255
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
256
|
-
"comment": "Bump @graphitation/graphql-js-tag to v0.7.0",
|
|
257
|
-
"commit": "fc3bf93bc5d50221d8539fe79704c45bc2612786"
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
"author": "beachball",
|
|
261
|
-
"package": "@graphitation/apollo-react-relay-duct-tape",
|
|
262
|
-
"comment": "Bump relay-compiler-language-graphitation to v0.6.0",
|
|
263
|
-
"commit": "fc3bf93bc5d50221d8539fe79704c45bc2612786"
|
|
264
|
-
}
|
|
265
|
-
]
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
"date": "Tue, 26 Oct 2021 21:09:29 GMT",
|
|
270
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.4.5",
|
|
271
|
-
"version": "0.4.5",
|
|
272
|
-
"comments": {
|
|
273
|
-
"patch": [
|
|
274
|
-
{
|
|
275
|
-
"comment": "Ensure that all packages listing graphql as a peerDependency also has it as a devDependency",
|
|
276
|
-
"author": "modevold@microsoft.com",
|
|
277
|
-
"commit": "6fbd717cb21f2e9f49ddca58e0365b5381358b46",
|
|
278
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
279
|
-
}
|
|
280
|
-
]
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
"date": "Tue, 26 Oct 2021 12:46:12 GMT",
|
|
285
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.4.4",
|
|
286
|
-
"version": "0.4.4",
|
|
287
|
-
"comments": {
|
|
288
|
-
"patch": [
|
|
289
|
-
{
|
|
290
|
-
"comment": "Align graphql dependency to version ^15.0.0 across packages",
|
|
291
|
-
"author": "modevold@microsoft.com",
|
|
292
|
-
"commit": "d8b94fe7725a968abfac81953b97a879b2bdaeb3",
|
|
293
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
294
|
-
}
|
|
295
|
-
]
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"date": "Mon, 04 Oct 2021 13:48:04 GMT",
|
|
300
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.4.3",
|
|
301
|
-
"version": "0.4.3",
|
|
302
|
-
"comments": {
|
|
303
|
-
"patch": [
|
|
304
|
-
{
|
|
305
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.6.9",
|
|
306
|
-
"author": "eloy.de.enige@gmail.com",
|
|
307
|
-
"commit": "ceb24aa25210090e38251be53d010d75abdad9ba",
|
|
308
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
309
|
-
}
|
|
310
|
-
]
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
"date": "Fri, 30 Jul 2021 23:21:22 GMT",
|
|
315
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.4.2",
|
|
316
|
-
"version": "0.4.2",
|
|
317
|
-
"comments": {
|
|
318
|
-
"patch": [
|
|
319
|
-
{
|
|
320
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.6.8",
|
|
321
|
-
"author": "eloy.de.enige@gmail.com",
|
|
322
|
-
"commit": "f78957783804c777d9e38adc433882058367b6cd",
|
|
323
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
324
|
-
}
|
|
325
|
-
]
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
"date": "Fri, 30 Jul 2021 21:57:33 GMT",
|
|
330
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.4.1",
|
|
331
|
-
"version": "0.4.1",
|
|
332
|
-
"comments": {
|
|
333
|
-
"patch": [
|
|
334
|
-
{
|
|
335
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.6.7",
|
|
336
|
-
"author": "eloy.de.enige@gmail.com",
|
|
337
|
-
"commit": "17478cbf5d33c03408bf2e23949619b00a66bce5",
|
|
338
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
339
|
-
}
|
|
340
|
-
]
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
"date": "Tue, 13 Jul 2021 19:42:21 GMT",
|
|
345
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.4.0",
|
|
346
|
-
"version": "0.4.0",
|
|
347
|
-
"comments": {
|
|
348
|
-
"minor": [
|
|
349
|
-
{
|
|
350
|
-
"comment": "Add `useMutation` hook",
|
|
351
|
-
"author": "eloy.de.enige@gmail.com",
|
|
352
|
-
"commit": "9884e0fea963021c764c176297a864f660ebd87f",
|
|
353
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
354
|
-
}
|
|
355
|
-
]
|
|
356
|
-
}
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
"date": "Wed, 05 May 2021 19:48:35 GMT",
|
|
360
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.3.6",
|
|
361
|
-
"version": "0.3.6",
|
|
362
|
-
"comments": {
|
|
363
|
-
"patch": [
|
|
364
|
-
{
|
|
365
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.6.6",
|
|
366
|
-
"author": "eloy.de.enige@gmail.com",
|
|
367
|
-
"commit": "120ae2d106a4622d6b1ea25ac912663a77ce4980",
|
|
368
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
369
|
-
}
|
|
370
|
-
]
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
"date": "Tue, 04 May 2021 15:15:49 GMT",
|
|
375
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.3.5",
|
|
376
|
-
"version": "0.3.5",
|
|
377
|
-
"comments": {
|
|
378
|
-
"patch": [
|
|
379
|
-
{
|
|
380
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.6.5",
|
|
381
|
-
"author": "eloy.de.enige@gmail.com",
|
|
382
|
-
"commit": "0933b2155e24f057379c24917d0872c8b5491fec",
|
|
383
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
384
|
-
}
|
|
385
|
-
]
|
|
386
|
-
}
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
"date": "Tue, 27 Apr 2021 21:34:50 GMT",
|
|
390
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.3.4",
|
|
391
|
-
"version": "0.3.4",
|
|
392
|
-
"comments": {
|
|
393
|
-
"patch": [
|
|
394
|
-
{
|
|
395
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.6.4",
|
|
396
|
-
"author": "eloy.de.enige@gmail.com",
|
|
397
|
-
"commit": "a6b3ad721b0bcb71de889bbdde778fcd87503217",
|
|
398
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
399
|
-
}
|
|
400
|
-
]
|
|
401
|
-
}
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
"date": "Sat, 24 Apr 2021 23:10:54 GMT",
|
|
405
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.3.3",
|
|
406
|
-
"version": "0.3.3",
|
|
407
|
-
"comments": {
|
|
408
|
-
"patch": [
|
|
409
|
-
{
|
|
410
|
-
"comment": "Include commonjs modules",
|
|
411
|
-
"author": "eloy.de.enige@gmail.com",
|
|
412
|
-
"commit": "1959ee4fa8b12688916df580b3c4dd0afa93f2ba",
|
|
413
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
414
|
-
}
|
|
415
|
-
]
|
|
416
|
-
}
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
"date": "Fri, 23 Apr 2021 22:48:59 GMT",
|
|
420
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.3.2",
|
|
421
|
-
"version": "0.3.2",
|
|
422
|
-
"comments": {
|
|
423
|
-
"patch": [
|
|
424
|
-
{
|
|
425
|
-
"comment": "[package] Bump minor versions",
|
|
426
|
-
"author": "eloy.de.enige@gmail.com",
|
|
427
|
-
"commit": "1b8e8ab11de78ce4d65f972a35504e246a89a22d",
|
|
428
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
429
|
-
}
|
|
430
|
-
]
|
|
431
|
-
}
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
"date": "Fri, 23 Apr 2021 21:44:28 GMT",
|
|
435
|
-
"tag": "@graphitation/apollo-react-relay-duct-tape_v0.3.0",
|
|
436
|
-
"version": "0.3.0",
|
|
437
|
-
"comments": {
|
|
438
|
-
"patch": [
|
|
439
|
-
{
|
|
440
|
-
"comment": "Include correct files",
|
|
441
|
-
"author": "eloy.de.enige@gmail.com",
|
|
442
|
-
"commit": "2834a8b6a60213e786c15b923ca3270ed2dcfe4e",
|
|
443
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
"comment": "fixing the publish process, publishing a new patch level",
|
|
447
|
-
"author": "kchau@microsoft.com",
|
|
448
|
-
"commit": "2834a8b6a60213e786c15b923ca3270ed2dcfe4e",
|
|
449
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
450
|
-
},
|
|
451
|
-
{
|
|
452
|
-
"comment": "fixing the publish process, publishing a new patch level (again)",
|
|
453
|
-
"author": "kchau@microsoft.com",
|
|
454
|
-
"commit": "2834a8b6a60213e786c15b923ca3270ed2dcfe4e",
|
|
455
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
456
|
-
},
|
|
457
|
-
{
|
|
458
|
-
"comment": "Bump @graphitation/graphql-js-operation-payload-generator to v0.5.0",
|
|
459
|
-
"author": "eloy.de.enige@gmail.com",
|
|
460
|
-
"commit": "2834a8b6a60213e786c15b923ca3270ed2dcfe4e",
|
|
461
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
462
|
-
},
|
|
463
|
-
{
|
|
464
|
-
"comment": "Bump @graphitation/apollo-mock-client to v0.6.0",
|
|
465
|
-
"author": "eloy.de.enige@gmail.com",
|
|
466
|
-
"commit": "2834a8b6a60213e786c15b923ca3270ed2dcfe4e",
|
|
467
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
"comment": "Bump @graphitation/graphql-js-tag to v0.5.0",
|
|
471
|
-
"author": "eloy.de.enige@gmail.com",
|
|
472
|
-
"commit": "2834a8b6a60213e786c15b923ca3270ed2dcfe4e",
|
|
473
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
474
|
-
}
|
|
475
|
-
],
|
|
476
|
-
"none": [
|
|
477
|
-
{
|
|
478
|
-
"comment": "fixing publish again - leveraging the previously generated change files to publish",
|
|
479
|
-
"author": "kchau@microsoft.com",
|
|
480
|
-
"commit": "2834a8b6a60213e786c15b923ca3270ed2dcfe4e",
|
|
481
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
"comment": "Initial import",
|
|
485
|
-
"author": "eloy.de.enige@gmail.com",
|
|
486
|
-
"commit": "2834a8b6a60213e786c15b923ca3270ed2dcfe4e",
|
|
487
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
488
|
-
},
|
|
489
|
-
{
|
|
490
|
-
"comment": "Use generated typings in tests",
|
|
491
|
-
"author": "eloy.de.enige@gmail.com",
|
|
492
|
-
"commit": "2834a8b6a60213e786c15b923ca3270ed2dcfe4e",
|
|
493
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
494
|
-
},
|
|
495
|
-
{
|
|
496
|
-
"comment": "Bump relay-compiler-language-graphitation to v0.5.0",
|
|
497
|
-
"author": "eloy.de.enige@gmail.com",
|
|
498
|
-
"commit": "2834a8b6a60213e786c15b923ca3270ed2dcfe4e",
|
|
499
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
500
|
-
}
|
|
501
|
-
],
|
|
502
|
-
"minor": [
|
|
503
|
-
{
|
|
504
|
-
"comment": "First proper release",
|
|
505
|
-
"author": "eloy.de.enige@gmail.com",
|
|
506
|
-
"commit": "2834a8b6a60213e786c15b923ca3270ed2dcfe4e",
|
|
507
|
-
"package": "@graphitation/apollo-react-relay-duct-tape"
|
|
508
|
-
}
|
|
509
|
-
]
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
]
|
|
513
|
-
}
|
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
|
package/lib/hooks.d.ts.map
DELETED
|
@@ -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
package/lib/index.d.ts.map
DELETED
|
@@ -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
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
|
package/lib/types.d.ts.map
DELETED
|
@@ -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
package/lib/types.mjs
DELETED
|
File without changes
|