@graphitation/apollo-react-relay-duct-tape 0.5.0 → 0.7.2

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 (41) hide show
  1. package/.eslintcache +1 -0
  2. package/CHANGELOG.json +124 -32
  3. package/CHANGELOG.md +44 -12
  4. package/README.md +0 -4
  5. package/lib/hooks.d.ts +2 -7
  6. package/lib/hooks.d.ts.map +1 -1
  7. package/lib/hooks.js +3 -12
  8. package/lib/hooks.mjs +5 -15
  9. package/lib/index.d.ts +0 -1
  10. package/lib/index.d.ts.map +1 -1
  11. package/lib/index.js +0 -1
  12. package/lib/index.mjs +3 -3
  13. package/package.json +25 -11
  14. package/lib/storeObservation/createImportDocumentsTransform.d.ts +0 -9
  15. package/lib/storeObservation/createImportDocumentsTransform.d.ts.map +0 -1
  16. package/lib/storeObservation/createImportDocumentsTransform.js +0 -92
  17. package/lib/storeObservation/createImportDocumentsTransform.mjs +0 -69
  18. package/lib/storeObservation/createImportDocumentsTransform.test.d.ts +0 -2
  19. package/lib/storeObservation/createImportDocumentsTransform.test.d.ts.map +0 -1
  20. package/lib/storeObservation/createImportDocumentsTransform.test.js +0 -62
  21. package/lib/storeObservation/createImportDocumentsTransform.test.mjs +0 -44
  22. package/lib/storeObservation/hooks.d.ts +0 -27
  23. package/lib/storeObservation/hooks.d.ts.map +0 -1
  24. package/lib/storeObservation/hooks.js +0 -81
  25. package/lib/storeObservation/hooks.mjs +0 -63
  26. package/lib/storeObservation/index.d.ts +0 -3
  27. package/lib/storeObservation/index.d.ts.map +0 -1
  28. package/lib/storeObservation/index.js +0 -21
  29. package/lib/storeObservation/index.mjs +0 -2
  30. package/lib/storeObservation/nodeFromCacheFieldPolicy.d.ts +0 -9
  31. package/lib/storeObservation/nodeFromCacheFieldPolicy.d.ts.map +0 -1
  32. package/lib/storeObservation/nodeFromCacheFieldPolicy.js +0 -47
  33. package/lib/storeObservation/nodeFromCacheFieldPolicy.mjs +0 -24
  34. package/lib/storeObservation/nodeFromCacheFieldPolicy.test.d.ts +0 -2
  35. package/lib/storeObservation/nodeFromCacheFieldPolicy.test.d.ts.map +0 -1
  36. package/lib/storeObservation/nodeFromCacheFieldPolicy.test.js +0 -112
  37. package/lib/storeObservation/nodeFromCacheFieldPolicy.test.mjs +0 -94
  38. package/lib/storeObservation/shallowCompareFragmentReferences.d.ts +0 -23
  39. package/lib/storeObservation/shallowCompareFragmentReferences.d.ts.map +0 -1
  40. package/lib/storeObservation/shallowCompareFragmentReferences.js +0 -50
  41. package/lib/storeObservation/shallowCompareFragmentReferences.mjs +0 -27
package/.eslintcache ADDED
@@ -0,0 +1 @@
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":514,"mtime":1641462656052,"results":"9","hashOfConfig":"10"},{"size":506,"mtime":1641462656056,"results":"11","hashOfConfig":"10"},{"size":463,"mtime":1641462656056,"results":"12","hashOfConfig":"10"},{"size":509,"mtime":1641462656056,"results":"13","hashOfConfig":"10"},{"size":9958,"mtime":1641462656056,"results":"14","hashOfConfig":"10"},{"size":10110,"mtime":1641462656056,"results":"15","hashOfConfig":"10"},{"size":50,"mtime":1641462656056,"results":"16","hashOfConfig":"10"},{"size":1353,"mtime":1641462656056,"results":"17","hashOfConfig":"10"},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1f7vj7d",{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"32","messages":"33","errorCount":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 CHANGED
@@ -2,61 +2,153 @@
2
2
  "name": "@graphitation/apollo-react-relay-duct-tape",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 08 Oct 2021 22:54:51 GMT",
6
- "tag": "@graphitation/apollo-react-relay-duct-tape_v0.5.0",
7
- "version": "0.5.0",
5
+ "date": "Thu, 06 Jan 2022 09:53:22 GMT",
6
+ "tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.2",
7
+ "version": "0.7.2",
8
8
  "comments": {
9
- "none": [
9
+ "patch": [
10
10
  {
11
- "comment": "Beachball sync",
12
- "author": "eloy.de.enige@gmail.com",
13
- "commit": "359e9c535021f12511b80c311cb768222f51d6a8",
14
- "package": "@graphitation/apollo-react-relay-duct-tape"
11
+ "author": "beachball",
12
+ "package": "@graphitation/apollo-react-relay-duct-tape",
13
+ "comment": "Bump relay-compiler-language-graphitation to v0.8.1",
14
+ "commit": "0268d6880be756f48acc0dd7c1faffef70f23189"
15
15
  }
16
- ],
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Wed, 05 Jan 2022 15:09:43 GMT",
21
+ "tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.1",
22
+ "version": "0.7.1",
23
+ "comments": {
17
24
  "patch": [
18
25
  {
19
- "comment": "Bump relay-compiler-language-graphitation to v0.6.0-store-observation.2",
20
- "author": "eloy.de.enige@gmail.com",
21
- "commit": "359e9c535021f12511b80c311cb768222f51d6a8",
22
- "package": "@graphitation/apollo-react-relay-duct-tape"
26
+ "author": "beachball",
27
+ "package": "@graphitation/apollo-react-relay-duct-tape",
28
+ "comment": "Bump relay-compiler-language-graphitation to v0.8.0",
29
+ "commit": "298f6ea41347e68022fd99c0898aa59e108d2e5b"
23
30
  }
24
31
  ]
25
32
  }
26
33
  },
27
34
  {
28
- "date": "Thu, 07 Oct 2021 13:10:18 GMT",
29
- "tag": "@graphitation/apollo-react-relay-duct-tape_v0.5.0-store-observation.5",
30
- "version": "0.5.0-store-observation.5",
35
+ "date": "Thu, 23 Dec 2021 13:01:22 GMT",
36
+ "tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.0",
37
+ "version": "0.7.0",
31
38
  "comments": {
32
- "prerelease": [
39
+ "none": [
33
40
  {
34
- "comment": "Fix node field-policy with default typename prefixing of ids and add test coverage",
35
41
  "author": "eloy.de.enige@gmail.com",
36
- "commit": "1e57e78cffd349c5d9ee65a5a4a4ad6e22c7422f",
37
- "package": "@graphitation/apollo-react-relay-duct-tape"
42
+ "package": "@graphitation/apollo-react-relay-duct-tape",
43
+ "commit": "bbbe8844858f53ceed2bd1c8790d3aff43b919df",
44
+ "comment": "[package] Add repo details to other packages and template"
38
45
  }
39
46
  ]
40
47
  }
41
48
  },
42
49
  {
43
- "date": "Tue, 05 Oct 2021 08:17:41 GMT",
44
- "tag": "@graphitation/apollo-react-relay-duct-tape_v0.5.0-store-observation.1",
45
- "version": "0.5.0-store-observation.1",
50
+ "date": "Thu, 23 Dec 2021 11:31:14 GMT",
51
+ "tag": "@graphitation/apollo-react-relay-duct-tape_v0.7.0",
52
+ "version": "0.7.0",
46
53
  "comments": {
47
- "prerelease": [
54
+ "minor": [
48
55
  {
49
- "comment": "Introduces ability to narrow down store observation to fragment level",
50
- "author": "eloy.de.enige@gmail.com",
51
- "commit": "9d2a2f88ca216a108f467e8cdea02bb84d35fea9",
56
+ "author": "mnovikov@microsoft.com",
57
+ "package": "@graphitation/apollo-react-relay-duct-tape",
58
+ "commit": "d3baa5116dc93bba4e38e5beb7f23c3edbbb0680",
59
+ "comment": "Added proper mjs builds (bump for main release)"
60
+ },
61
+ {
62
+ "author": "beachball",
63
+ "package": "@graphitation/apollo-react-relay-duct-tape",
64
+ "comment": "Bump @graphitation/apollo-mock-client to v0.10.0",
65
+ "commit": "d3baa5116dc93bba4e38e5beb7f23c3edbbb0680"
66
+ },
67
+ {
68
+ "author": "beachball",
69
+ "package": "@graphitation/apollo-react-relay-duct-tape",
70
+ "comment": "Bump @graphitation/graphql-js-operation-payload-generator to v0.8.0",
71
+ "commit": "d3baa5116dc93bba4e38e5beb7f23c3edbbb0680"
72
+ },
73
+ {
74
+ "author": "beachball",
75
+ "package": "@graphitation/apollo-react-relay-duct-tape",
76
+ "comment": "Bump @graphitation/graphql-js-tag to v0.8.0",
77
+ "commit": "d3baa5116dc93bba4e38e5beb7f23c3edbbb0680"
78
+ },
79
+ {
80
+ "author": "beachball",
81
+ "package": "@graphitation/apollo-react-relay-duct-tape",
82
+ "comment": "Bump relay-compiler-language-graphitation to v0.7.0",
83
+ "commit": "d3baa5116dc93bba4e38e5beb7f23c3edbbb0680"
84
+ }
85
+ ]
86
+ }
87
+ },
88
+ {
89
+ "date": "Tue, 14 Dec 2021 10:13:54 GMT",
90
+ "tag": "@graphitation/apollo-react-relay-duct-tape_v0.6.0",
91
+ "version": "0.6.0",
92
+ "comments": {
93
+ "minor": [
94
+ {
95
+ "author": "mnovikov@microsoft.com",
96
+ "package": "@graphitation/apollo-react-relay-duct-tape",
97
+ "commit": "fad5f1bc587470a2c85bf5763bb102a179a592b2",
98
+ "comment": "Support ESM in distro packages"
99
+ },
100
+ {
101
+ "author": "beachball",
102
+ "package": "@graphitation/apollo-react-relay-duct-tape",
103
+ "comment": "Bump @graphitation/apollo-mock-client to v0.9.0",
104
+ "commit": "fc3bf93bc5d50221d8539fe79704c45bc2612786"
105
+ },
106
+ {
107
+ "author": "beachball",
108
+ "package": "@graphitation/apollo-react-relay-duct-tape",
109
+ "comment": "Bump @graphitation/graphql-js-operation-payload-generator to v0.7.0",
110
+ "commit": "fc3bf93bc5d50221d8539fe79704c45bc2612786"
111
+ },
112
+ {
113
+ "author": "beachball",
114
+ "package": "@graphitation/apollo-react-relay-duct-tape",
115
+ "comment": "Bump @graphitation/graphql-js-tag to v0.7.0",
116
+ "commit": "fc3bf93bc5d50221d8539fe79704c45bc2612786"
117
+ },
118
+ {
119
+ "author": "beachball",
120
+ "package": "@graphitation/apollo-react-relay-duct-tape",
121
+ "comment": "Bump relay-compiler-language-graphitation to v0.6.0",
122
+ "commit": "fc3bf93bc5d50221d8539fe79704c45bc2612786"
123
+ }
124
+ ]
125
+ }
126
+ },
127
+ {
128
+ "date": "Tue, 26 Oct 2021 21:09:29 GMT",
129
+ "tag": "@graphitation/apollo-react-relay-duct-tape_v0.4.5",
130
+ "version": "0.4.5",
131
+ "comments": {
132
+ "patch": [
133
+ {
134
+ "comment": "Ensure that all packages listing graphql as a peerDependency also has it as a devDependency",
135
+ "author": "modevold@microsoft.com",
136
+ "commit": "6fbd717cb21f2e9f49ddca58e0365b5381358b46",
52
137
  "package": "@graphitation/apollo-react-relay-duct-tape"
53
138
  }
54
- ],
55
- "none": [
139
+ ]
140
+ }
141
+ },
142
+ {
143
+ "date": "Tue, 26 Oct 2021 12:46:12 GMT",
144
+ "tag": "@graphitation/apollo-react-relay-duct-tape_v0.4.4",
145
+ "version": "0.4.4",
146
+ "comments": {
147
+ "patch": [
56
148
  {
57
- "comment": "Bump @graphitation/apollo-mock-client to v0.6.9",
58
- "author": "eloy.de.enige@gmail.com",
59
- "commit": "9d2a2f88ca216a108f467e8cdea02bb84d35fea9",
149
+ "comment": "Align graphql dependency to version ^15.0.0 across packages",
150
+ "author": "modevold@microsoft.com",
151
+ "commit": "d8b94fe7725a968abfac81953b97a879b2bdaeb3",
60
152
  "package": "@graphitation/apollo-react-relay-duct-tape"
61
153
  }
62
154
  ]
package/CHANGELOG.md CHANGED
@@ -1,32 +1,64 @@
1
1
  # Change Log - @graphitation/apollo-react-relay-duct-tape
2
2
 
3
- This log was last generated on Fri, 08 Oct 2021 22:54:51 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 06 Jan 2022 09:53:22 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.5.0
7
+ ## 0.7.2
8
8
 
9
- Fri, 08 Oct 2021 22:54:51 GMT
9
+ Thu, 06 Jan 2022 09:53:22 GMT
10
10
 
11
11
  ### Patches
12
12
 
13
- - Bump relay-compiler-language-graphitation to v0.6.0-store-observation.2 (eloy.de.enige@gmail.com)
13
+ - Bump relay-compiler-language-graphitation to v0.8.1
14
14
 
15
- ## 0.5.0-store-observation.5
15
+ ## 0.7.1
16
16
 
17
- Thu, 07 Oct 2021 13:10:18 GMT
17
+ Wed, 05 Jan 2022 15:09:43 GMT
18
18
 
19
- ### Changes
19
+ ### Patches
20
+
21
+ - Bump relay-compiler-language-graphitation to v0.8.0
22
+
23
+ ## 0.7.0
20
24
 
21
- - Fix node field-policy with default typename prefixing of ids and add test coverage (eloy.de.enige@gmail.com)
25
+ Thu, 23 Dec 2021 11:31:14 GMT
26
+
27
+ ### Minor changes
22
28
 
23
- ## 0.5.0-store-observation.1
29
+ - Added proper mjs builds (bump for main release) (mnovikov@microsoft.com)
30
+ - Bump @graphitation/apollo-mock-client to v0.10.0
31
+ - Bump @graphitation/graphql-js-operation-payload-generator to v0.8.0
32
+ - Bump @graphitation/graphql-js-tag to v0.8.0
33
+ - Bump relay-compiler-language-graphitation to v0.7.0
34
+
35
+ ## 0.6.0
36
+
37
+ Tue, 14 Dec 2021 10:13:54 GMT
38
+
39
+ ### Minor changes
24
40
 
25
- Tue, 05 Oct 2021 08:17:41 GMT
41
+ - Support ESM in distro packages (mnovikov@microsoft.com)
42
+ - Bump @graphitation/apollo-mock-client to v0.9.0
43
+ - Bump @graphitation/graphql-js-operation-payload-generator to v0.7.0
44
+ - Bump @graphitation/graphql-js-tag to v0.7.0
45
+ - Bump relay-compiler-language-graphitation to v0.6.0
26
46
 
27
- ### Changes
47
+ ## 0.4.5
48
+
49
+ Tue, 26 Oct 2021 21:09:29 GMT
50
+
51
+ ### Patches
52
+
53
+ - Ensure that all packages listing graphql as a peerDependency also has it as a devDependency (modevold@microsoft.com)
54
+
55
+ ## 0.4.4
56
+
57
+ Tue, 26 Oct 2021 12:46:12 GMT
58
+
59
+ ### Patches
28
60
 
29
- - Introduces ability to narrow down store observation to fragment level (eloy.de.enige@gmail.com)
61
+ - Align graphql dependency to version ^15.0.0 across packages (modevold@microsoft.com)
30
62
 
31
63
  ## 0.4.3
32
64
 
package/README.md CHANGED
@@ -5,7 +5,3 @@ 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
- # Narrow Store Observation
10
-
11
- TODO
package/lib/hooks.d.ts CHANGED
@@ -1,11 +1,6 @@
1
1
  import { DocumentNode } from "graphql";
2
2
  import { KeyType, KeyTypeData, OperationType } from "./types";
3
- export declare type GraphQLTaggedNode = (DocumentNode & {
4
- watchQueryDocument?: never;
5
- }) | {
6
- watchQueryDocument: DocumentNode;
7
- executeQueryDocument?: DocumentNode;
8
- };
3
+ export declare type GraphQLTaggedNode = DocumentNode;
9
4
  /**
10
5
  * Executes a GraphQL query.
11
6
  *
@@ -121,7 +116,7 @@ export declare function useLazyLoadQuery<TQuery extends OperationType>(query: Gr
121
116
  * fragment.
122
117
  * @returns The data corresponding to the field selections.
123
118
  */
124
- export declare function useFragment<TKey extends KeyType>(fragmentInput: GraphQLTaggedNode, fragmentRef: TKey): KeyTypeData<TKey>;
119
+ export declare function useFragment<TKey extends KeyType>(_fragmentInput: GraphQLTaggedNode, fragmentRef: TKey): KeyTypeData<TKey>;
125
120
  interface GraphQLSubscriptionConfig<TSubscriptionPayload extends OperationType> {
126
121
  subscription: GraphQLTaggedNode;
127
122
  variables: TSubscriptionPayload["variables"];
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQvC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAM9D,oBAAY,iBAAiB,GACzB,CAAC,YAAY,GAAG;IAAE,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,GAC/C;IAAE,kBAAkB,EAAE,YAAY,CAAC;IA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AAC,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 CHANGED
@@ -63,20 +63,11 @@ __export(exports, {
63
63
  });
64
64
  var import_invariant = __toModule(require("invariant"));
65
65
  var import_client = __toModule(require("@apollo/client"));
66
- var import_hooks = __toModule(require("./storeObservation/hooks"));
67
66
  function useLazyLoadQuery(query, variables, options) {
68
- if (query.watchQueryDocument) {
69
- return (0, import_hooks.useCompiledLazyLoadQuery)(query, __objSpread({variables}, options));
70
- } else {
71
- return (0, import_client.useQuery)(query, __objSpread({variables}, options));
72
- }
67
+ return (0, import_client.useQuery)(query, __objSpread({variables}, options));
73
68
  }
74
- function useFragment(fragmentInput, fragmentRef) {
75
- if (fragmentInput.watchQueryDocument) {
76
- return (0, import_hooks.useCompiledFragment)(fragmentInput, fragmentRef);
77
- } else {
78
- return fragmentRef;
79
- }
69
+ function useFragment(_fragmentInput, fragmentRef) {
70
+ return fragmentRef;
80
71
  }
81
72
  function useSubscription(config) {
82
73
  const {error} = (0, import_client.useSubscription)(config.subscription, {
package/lib/hooks.mjs CHANGED
@@ -34,29 +34,19 @@ var __async = (__this, __arguments, generator) => {
34
34
  step((generator = generator.apply(__this, __arguments)).next());
35
35
  });
36
36
  };
37
+
38
+ // src/hooks.ts
37
39
  import invariant from "invariant";
38
40
  import {
39
41
  useSubscription as useApolloSubscription,
40
42
  useQuery as useApolloQuery,
41
43
  useMutation as useApolloMutation
42
44
  } from "@apollo/client";
43
- import {
44
- useCompiledFragment,
45
- useCompiledLazyLoadQuery
46
- } from "./storeObservation/hooks";
47
45
  function useLazyLoadQuery(query, variables, options) {
48
- if (query.watchQueryDocument) {
49
- return useCompiledLazyLoadQuery(query, __objSpread({variables}, options));
50
- } else {
51
- return useApolloQuery(query, __objSpread({variables}, options));
52
- }
46
+ return useApolloQuery(query, __objSpread({variables}, options));
53
47
  }
54
- function useFragment(fragmentInput, fragmentRef) {
55
- if (fragmentInput.watchQueryDocument) {
56
- return useCompiledFragment(fragmentInput, fragmentRef);
57
- } else {
58
- return fragmentRef;
59
- }
48
+ function useFragment(_fragmentInput, fragmentRef) {
49
+ return fragmentRef;
60
50
  }
61
51
  function useSubscription(config) {
62
52
  const {error} = useApolloSubscription(config.subscription, {
package/lib/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from "./hooks";
2
2
  export * from "./types";
3
- export * from "./storeObservation";
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC"}
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 CHANGED
@@ -19,4 +19,3 @@ var __toModule = (module2) => {
19
19
  __markAsModule(exports);
20
20
  __reExport(exports, __toModule(require("./hooks")));
21
21
  __reExport(exports, __toModule(require("./types")));
22
- __reExport(exports, __toModule(require("./storeObservation")));
package/lib/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./hooks";
2
- export * from "./types";
3
- export * from "./storeObservation";
1
+ // src/index.ts
2
+ export * from "./hooks.mjs";
3
+ export * from "./types.mjs";
package/package.json CHANGED
@@ -2,8 +2,13 @@
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.0",
6
- "main": "./lib/index",
5
+ "version": "0.7.2",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/microsoft/graphitation.git",
9
+ "directory": "packages/apollo-react-relay-duct-tape"
10
+ },
11
+ "main": "./lib/index.js",
7
12
  "scripts": {
8
13
  "build": "monorepo-scripts build",
9
14
  "lint": "monorepo-scripts lint",
@@ -13,26 +18,35 @@
13
18
  "generate-interfaces": "relay-compiler --language graphitation --schema ./src/__tests__/schema.graphql --src ./src"
14
19
  },
15
20
  "devDependencies": {
16
- "@apollo/client": "^3.4.13",
17
- "@graphitation/apollo-mock-client": "^0.6.9",
18
- "@graphitation/graphql-js-operation-payload-generator": "^0.5.9",
19
- "@graphitation/graphql-js-tag": "^0.5.4",
21
+ "@apollo/client": "^3.3.15",
22
+ "@graphitation/apollo-mock-client": "^0.10.0",
23
+ "@graphitation/graphql-js-operation-payload-generator": "^0.8.0",
24
+ "@graphitation/graphql-js-tag": "^0.8.0",
20
25
  "@types/jest": "^26.0.22",
21
26
  "@types/react": "^17.0.3",
27
+ "graphql": "^15.0.0",
22
28
  "monorepo-scripts": "*",
23
29
  "react": "^17.0.2",
24
30
  "relay-compiler": "^11.0.2",
25
- "relay-compiler-language-graphitation": "^0.6.0-store-observation.2",
31
+ "relay-compiler-language-graphitation": "^0.8.1",
26
32
  "ts-expect": "^1.3.0"
27
33
  },
28
34
  "peerDependencies": {
29
- "@apollo/client": "^3.4.13",
30
- "graphql": "^15.5.0",
35
+ "graphql": "^15.0.0",
31
36
  "react": "^17.0.2"
32
37
  },
33
38
  "dependencies": {
34
39
  "invariant": "^2.2.4"
35
40
  },
36
- "publishConfig": {},
37
- "types": "./lib/index.d.ts"
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "types": "./lib/index.d.ts",
45
+ "module": "./lib/index.mjs",
46
+ "exports": {
47
+ ".": {
48
+ "import": "./lib/index.mjs",
49
+ "require": "./lib/index.js"
50
+ }
51
+ }
38
52
  }
@@ -1,9 +0,0 @@
1
- /**
2
- * TODO:
3
- * - Don't hardcode identifiers but check if they're aliased from their imports.
4
- * - Support mutations and subscriptions
5
- * - Properly emit errors from transformer, is invariant ok?
6
- */
7
- import * as ts from "typescript";
8
- export declare function createImportDocumentsTransform(): ts.TransformerFactory<ts.SourceFile>;
9
- //# sourceMappingURL=createImportDocumentsTransform.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createImportDocumentsTransform.d.ts","sourceRoot":"","sources":["../../src/storeObservation/createImportDocumentsTransform.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAQjC,wBAAgB,8BAA8B,IAAI,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,UAAU,CAAC,CAiDrF"}
@@ -1,92 +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 __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, {get: all[name], enumerable: true});
11
- };
12
- var __reExport = (target, module2, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && key !== "default")
16
- __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
17
- }
18
- return target;
19
- };
20
- var __toModule = (module2) => {
21
- 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);
22
- };
23
- __markAsModule(exports);
24
- __export(exports, {
25
- createImportDocumentsTransform: () => createImportDocumentsTransform
26
- });
27
- var import_invariant = __toModule(require("invariant"));
28
- var ts = __toModule(require("typescript"));
29
- var import_graphql = __toModule(require("graphql"));
30
- var path = __toModule(require("path"));
31
- var fs = __toModule(require("fs"));
32
- const PREFIX = "__graphitation_";
33
- const QUERIES_NAMESPACE = "generatedQueries";
34
- function createImportDocumentsTransform() {
35
- return (context) => {
36
- const imports = [];
37
- const visitor = (node) => {
38
- if (ts.isTaggedTemplateExpression(node) && ts.isIdentifier(node.tag) && node.tag.escapedText === "graphql") {
39
- const documentNodes = createGraphQLDocumentNodes(node);
40
- if (documentNodes) {
41
- const [importDeclaration, replacementNode] = documentNodes;
42
- let emitImport = true;
43
- const sourceFile = node.getSourceFile();
44
- if (sourceFile) {
45
- const artefactFile = path.join(path.dirname(sourceFile.fileName), importDeclaration.moduleSpecifier.text) + ".ts";
46
- emitImport = fs.existsSync(artefactFile);
47
- }
48
- if (emitImport) {
49
- imports.push(importDeclaration);
50
- return replacementNode;
51
- }
52
- }
53
- }
54
- return ts.visitEachChild(node, visitor, context);
55
- };
56
- return (sourceFile) => {
57
- const outputSourceFile = ts.visitNode(sourceFile, visitor);
58
- return ts.factory.updateSourceFile(outputSourceFile, [
59
- ...imports,
60
- ...outputSourceFile.statements
61
- ]);
62
- };
63
- };
64
- }
65
- function createGraphQLDocumentNodes(graphqlTagTemplateNode) {
66
- var _a;
67
- const graphqlDoc = ts.isNoSubstitutionTemplateLiteral(graphqlTagTemplateNode.template) ? graphqlTagTemplateNode.template.rawText : graphqlTagTemplateNode.template.head.rawText;
68
- (0, import_invariant.default)(graphqlDoc, "Expected a GraphQL document");
69
- const graphqlAST = (0, import_graphql.parse)(graphqlDoc);
70
- const definitionNode = graphqlAST.definitions[0];
71
- if (definitionNode.kind === "OperationDefinition") {
72
- if (definitionNode.operation !== "query") {
73
- return void 0;
74
- }
75
- const operationName = (_a = definitionNode.name) == null ? void 0 : _a.value;
76
- (0, import_invariant.default)(operationName, "Operations are required to have a name");
77
- const namespaceName = `${PREFIX}${QUERIES_NAMESPACE}_${operationName}`;
78
- return [
79
- ts.factory.createImportDeclaration(void 0, void 0, ts.factory.createImportClause(false, void 0, ts.factory.createNamespaceImport(ts.factory.createIdentifier(namespaceName))), ts.factory.createStringLiteral(`./__generated__/${operationName}.graphql`)),
80
- ts.factory.createIdentifier(namespaceName)
81
- ];
82
- } else if (definitionNode.kind === "FragmentDefinition") {
83
- const fragmentName = definitionNode.name.value;
84
- const fragmentBaseName = fragmentName.replace(/Fragment$/, "");
85
- const namespaceName = `${PREFIX}${QUERIES_NAMESPACE}_${fragmentName}`;
86
- return [
87
- ts.factory.createImportDeclaration(void 0, void 0, ts.factory.createImportClause(false, void 0, ts.factory.createNamespaceImport(ts.factory.createIdentifier(namespaceName))), ts.factory.createStringLiteral(`./__generated__/${fragmentBaseName}WatchNodeQuery.graphql`)),
88
- ts.factory.createIdentifier(namespaceName)
89
- ];
90
- }
91
- (0, import_invariant.default)(false, `Unhandled GraphQL definition type: ${definitionNode.kind}`);
92
- }
@@ -1,69 +0,0 @@
1
- import invariant from "invariant";
2
- import * as ts from "typescript";
3
- import {parse as parseGraphQL} from "graphql";
4
- import * as path from "path";
5
- import * as fs from "fs";
6
- const PREFIX = "__graphitation_";
7
- const QUERIES_NAMESPACE = "generatedQueries";
8
- function createImportDocumentsTransform() {
9
- return (context) => {
10
- const imports = [];
11
- const visitor = (node) => {
12
- if (ts.isTaggedTemplateExpression(node) && ts.isIdentifier(node.tag) && node.tag.escapedText === "graphql") {
13
- const documentNodes = createGraphQLDocumentNodes(node);
14
- if (documentNodes) {
15
- const [importDeclaration, replacementNode] = documentNodes;
16
- let emitImport = true;
17
- const sourceFile = node.getSourceFile();
18
- if (sourceFile) {
19
- const artefactFile = path.join(path.dirname(sourceFile.fileName), importDeclaration.moduleSpecifier.text) + ".ts";
20
- emitImport = fs.existsSync(artefactFile);
21
- }
22
- if (emitImport) {
23
- imports.push(importDeclaration);
24
- return replacementNode;
25
- }
26
- }
27
- }
28
- return ts.visitEachChild(node, visitor, context);
29
- };
30
- return (sourceFile) => {
31
- const outputSourceFile = ts.visitNode(sourceFile, visitor);
32
- return ts.factory.updateSourceFile(outputSourceFile, [
33
- ...imports,
34
- ...outputSourceFile.statements
35
- ]);
36
- };
37
- };
38
- }
39
- function createGraphQLDocumentNodes(graphqlTagTemplateNode) {
40
- var _a;
41
- const graphqlDoc = ts.isNoSubstitutionTemplateLiteral(graphqlTagTemplateNode.template) ? graphqlTagTemplateNode.template.rawText : graphqlTagTemplateNode.template.head.rawText;
42
- invariant(graphqlDoc, "Expected a GraphQL document");
43
- const graphqlAST = parseGraphQL(graphqlDoc);
44
- const definitionNode = graphqlAST.definitions[0];
45
- if (definitionNode.kind === "OperationDefinition") {
46
- if (definitionNode.operation !== "query") {
47
- return void 0;
48
- }
49
- const operationName = (_a = definitionNode.name) == null ? void 0 : _a.value;
50
- invariant(operationName, "Operations are required to have a name");
51
- const namespaceName = `${PREFIX}${QUERIES_NAMESPACE}_${operationName}`;
52
- return [
53
- ts.factory.createImportDeclaration(void 0, void 0, ts.factory.createImportClause(false, void 0, ts.factory.createNamespaceImport(ts.factory.createIdentifier(namespaceName))), ts.factory.createStringLiteral(`./__generated__/${operationName}.graphql`)),
54
- ts.factory.createIdentifier(namespaceName)
55
- ];
56
- } else if (definitionNode.kind === "FragmentDefinition") {
57
- const fragmentName = definitionNode.name.value;
58
- const fragmentBaseName = fragmentName.replace(/Fragment$/, "");
59
- const namespaceName = `${PREFIX}${QUERIES_NAMESPACE}_${fragmentName}`;
60
- return [
61
- ts.factory.createImportDeclaration(void 0, void 0, ts.factory.createImportClause(false, void 0, ts.factory.createNamespaceImport(ts.factory.createIdentifier(namespaceName))), ts.factory.createStringLiteral(`./__generated__/${fragmentBaseName}WatchNodeQuery.graphql`)),
62
- ts.factory.createIdentifier(namespaceName)
63
- ];
64
- }
65
- invariant(false, `Unhandled GraphQL definition type: ${definitionNode.kind}`);
66
- }
67
- export {
68
- createImportDocumentsTransform
69
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=createImportDocumentsTransform.test.d.ts.map