@apollo/client 3.12.0-rc.3 → 3.12.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 +66 -0
- package/README.md +2 -0
- package/apollo-client.cjs +69 -66
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +4 -165
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +4 -165
- package/cache/core/cache.js +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/inmemory/policies.js +1 -1
- package/cache/inmemory/policies.js.map +1 -1
- package/config/jest/setup.js +0 -2
- package/config/jest/setup.js.map +1 -1
- package/core/QueryManager.js +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +4 -188
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +4 -188
- package/dev/dev.cjs +37 -37
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +37 -37
- package/invariantErrorCodes.js +42 -42
- package/link/core/ApolloLink.js +2 -2
- package/link/core/core.cjs +2 -2
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +2 -2
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/http.cjs +3 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +3 -3
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs +2 -2
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
- package/link/utils/toPromise.js +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js +1 -1
- package/masking/__benches__/types.bench.d.ts +2 -0
- package/masking/__benches__/types.bench.js +131 -0
- package/masking/__benches__/types.bench.js.map +1 -0
- package/masking/index.d.ts +3 -0
- package/masking/index.js +3 -1
- package/masking/index.js.map +1 -1
- package/masking/internal/types.d.ts +114 -9
- package/masking/internal/types.js.map +1 -1
- package/masking/maskDefinition.d.ts +14 -0
- package/{core/masking.js → masking/maskDefinition.js} +6 -77
- package/masking/maskDefinition.js.map +1 -0
- package/masking/maskFragment.d.ts +4 -0
- package/masking/maskFragment.js +43 -0
- package/masking/maskFragment.js.map +1 -0
- package/masking/maskOperation.d.ts +4 -0
- package/masking/maskOperation.js +29 -0
- package/masking/maskOperation.js.map +1 -0
- package/masking/masking.cjs +202 -0
- package/masking/masking.cjs.map +1 -1
- package/masking/masking.cjs.native.js +202 -0
- package/masking/types.d.ts +4 -4
- package/masking/types.js.map +1 -1
- package/masking/utils.d.ts +11 -0
- package/masking/utils.js +17 -0
- package/masking/utils.js.map +1 -0
- package/package.json +10 -7
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/mutation-hoc.js +3 -2
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/internal/internal.cjs +1 -1
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +1 -1
- package/testing/internal/disposables/index.d.ts +0 -1
- package/testing/internal/disposables/index.js +0 -1
- package/testing/internal/disposables/index.js.map +1 -1
- package/testing/internal/index.d.ts +4 -1
- package/testing/internal/index.js +4 -1
- package/testing/internal/index.js.map +1 -1
- package/testing/internal/rtl/actAsync.d.ts +2 -0
- package/testing/internal/rtl/actAsync.js +21 -0
- package/testing/internal/rtl/actAsync.js.map +1 -0
- package/testing/internal/rtl/renderAsync.d.ts +9 -0
- package/testing/internal/rtl/renderAsync.js +23 -0
- package/testing/internal/rtl/renderAsync.js.map +1 -0
- package/testing/internal/rtl/renderHookAsync.d.ts +8 -0
- package/testing/internal/rtl/renderHookAsync.js +45 -0
- package/testing/internal/rtl/renderHookAsync.js.map +1 -0
- package/testing/internal/scenarios/index.d.ts +10 -0
- package/testing/internal/scenarios/index.js +9 -2
- package/testing/internal/scenarios/index.js.map +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/version.js +1 -1
- package/.changeset/brown-readers-smash.md +0 -5
- package/.changeset/clean-turkeys-kick.md +0 -5
- package/.changeset/cold-apes-bow.md +0 -5
- package/.changeset/early-bobcats-eat.md +0 -5
- package/.changeset/flat-beans-knock.md +0 -15
- package/.changeset/gorgeous-zebras-confess.md +0 -5
- package/.changeset/itchy-penguins-worry.md +0 -5
- package/.changeset/kind-toys-tie.md +0 -5
- package/.changeset/long-zoos-ring.md +0 -5
- package/.changeset/mean-bottles-travel.md +0 -5
- package/.changeset/nasty-camels-pay.md +0 -36
- package/.changeset/nervous-owls-hear.md +0 -5
- package/.changeset/nice-countries-share.md +0 -5
- package/.changeset/perfect-jobs-flow.md +0 -5
- package/.changeset/pre.json +0 -26
- package/.changeset/slimy-points-end.md +0 -5
- package/.changeset/small-bears-confess.md +0 -5
- package/.changeset/wicked-pans-appear.md +0 -5
- package/core/masking.d.ts +0 -10
- package/core/masking.js.map +0 -1
- package/testing/internal/disposables/disableActWarnings.d.ts +0 -9
- package/testing/internal/disposables/disableActWarnings.js +0 -15
- package/testing/internal/disposables/disableActWarnings.js.map +0 -1
package/dev/dev.cjs.native.js
CHANGED
|
@@ -116,54 +116,54 @@ const errorCodes =
|
|
|
116
116
|
file: "@apollo/client/core/QueryManager.js",
|
|
117
117
|
message: "Store reset while query was in flight (not completed in link chain)"
|
|
118
118
|
},
|
|
119
|
-
38: {
|
|
120
|
-
file: "@apollo/client/core/masking.js",
|
|
121
|
-
condition: "definition",
|
|
122
|
-
message: "Expected a parsed GraphQL document with a query, mutation, or subscription."
|
|
123
|
-
},
|
|
124
119
|
39: {
|
|
125
|
-
file: "@apollo/client/core/masking.js",
|
|
126
|
-
condition: "fragments.length === 1",
|
|
127
|
-
message: "Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment."
|
|
128
|
-
},
|
|
129
|
-
40: {
|
|
130
|
-
file: "@apollo/client/core/masking.js",
|
|
131
|
-
condition: "!!fragment",
|
|
132
|
-
message: "Could not find fragment with name \"%s\"."
|
|
133
|
-
},
|
|
134
|
-
41: {
|
|
135
|
-
file: "@apollo/client/core/masking.js",
|
|
136
|
-
condition: "fragment",
|
|
137
|
-
message: "Could not find fragment with name '%s'."
|
|
138
|
-
},
|
|
139
|
-
45: {
|
|
140
120
|
file: "@apollo/client/link/core/ApolloLink.js",
|
|
141
121
|
message: "request is not implemented"
|
|
142
122
|
},
|
|
143
|
-
|
|
123
|
+
40: {
|
|
144
124
|
file: "@apollo/client/link/http/checkFetcher.js",
|
|
145
125
|
message: "\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n "
|
|
146
126
|
},
|
|
147
|
-
|
|
127
|
+
42: {
|
|
148
128
|
file: "@apollo/client/link/http/serializeFetchParameter.js",
|
|
149
129
|
message: "Network request failed. %s is not serializable: %s"
|
|
150
130
|
},
|
|
151
|
-
|
|
131
|
+
43: {
|
|
152
132
|
file: "@apollo/client/link/persisted-queries/index.js",
|
|
153
133
|
condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")",
|
|
154
134
|
message: 'Missing/invalid "sha256" or "generateHash" function. Please ' +
|
|
155
135
|
'configure one using the "createPersistedQueryLink(options)" options ' +
|
|
156
136
|
"parameter."
|
|
157
137
|
},
|
|
158
|
-
|
|
138
|
+
44: {
|
|
159
139
|
file: "@apollo/client/link/persisted-queries/index.js",
|
|
160
140
|
condition: "forward",
|
|
161
141
|
message: "PersistedQueryLink cannot be the last link in the chain."
|
|
162
142
|
},
|
|
163
|
-
|
|
143
|
+
46: {
|
|
164
144
|
file: "@apollo/client/link/utils/validateOperation.js",
|
|
165
145
|
message: "illegal argument: %s"
|
|
166
146
|
},
|
|
147
|
+
47: {
|
|
148
|
+
file: "@apollo/client/masking/maskDefinition.js",
|
|
149
|
+
condition: "fragment",
|
|
150
|
+
message: "Could not find fragment with name '%s'."
|
|
151
|
+
},
|
|
152
|
+
49: {
|
|
153
|
+
file: "@apollo/client/masking/maskFragment.js",
|
|
154
|
+
condition: "fragments.length === 1",
|
|
155
|
+
message: "Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment."
|
|
156
|
+
},
|
|
157
|
+
50: {
|
|
158
|
+
file: "@apollo/client/masking/maskFragment.js",
|
|
159
|
+
condition: "!!fragment",
|
|
160
|
+
message: "Could not find fragment with name \"%s\"."
|
|
161
|
+
},
|
|
162
|
+
51: {
|
|
163
|
+
file: "@apollo/client/masking/maskOperation.js",
|
|
164
|
+
condition: "definition",
|
|
165
|
+
message: "Expected a parsed GraphQL document with a query, mutation, or subscription."
|
|
166
|
+
},
|
|
167
167
|
53: {
|
|
168
168
|
file: "@apollo/client/react/context/ApolloConsumer.js",
|
|
169
169
|
condition: "context && context.client",
|
|
@@ -411,26 +411,26 @@ const devWarn = {
|
|
|
411
411
|
file: "@apollo/client/core/QueryManager.js",
|
|
412
412
|
message: '[%s]: Fragments masked by data masking are inaccessible when using fetch policy "no-cache". Please add `@unmask` to each fragment spread to access the data.'
|
|
413
413
|
},
|
|
414
|
-
|
|
415
|
-
file: "@apollo/client/core/masking.js",
|
|
416
|
-
message: "Accessing unmasked field on %s at path '%s'. This field will not be available when masking is enabled. Please read the field from the fragment instead."
|
|
417
|
-
},
|
|
418
|
-
43: {
|
|
419
|
-
file: "@apollo/client/core/masking.js",
|
|
420
|
-
message: "The configured cache does not support data masking which effectively disables it. Please use a cache that supports data masking or disable data masking to silence this warning."
|
|
421
|
-
},
|
|
422
|
-
44: {
|
|
414
|
+
38: {
|
|
423
415
|
file: "@apollo/client/link/core/ApolloLink.js",
|
|
424
416
|
message: "You are calling concat on a terminating link, which will have no effect %o"
|
|
425
417
|
},
|
|
426
|
-
|
|
418
|
+
41: {
|
|
427
419
|
file: "@apollo/client/link/http/createHttpLink.js",
|
|
428
420
|
message: "Multipart-subscriptions do not support @defer"
|
|
429
421
|
},
|
|
430
|
-
|
|
422
|
+
45: {
|
|
431
423
|
file: "@apollo/client/link/utils/toPromise.js",
|
|
432
424
|
message: "Promise Wrapper does not support multiple results from Observable"
|
|
433
425
|
},
|
|
426
|
+
48: {
|
|
427
|
+
file: "@apollo/client/masking/maskDefinition.js",
|
|
428
|
+
message: "Accessing unmasked field on %s at path '%s'. This field will not be available when masking is enabled. Please read the field from the fragment instead."
|
|
429
|
+
},
|
|
430
|
+
52: {
|
|
431
|
+
file: "@apollo/client/masking/utils.js",
|
|
432
|
+
message: "The configured cache does not support data masking which effectively disables it. Please use a cache that supports data masking or disable data masking to silence this warning."
|
|
433
|
+
},
|
|
434
434
|
61: {
|
|
435
435
|
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
436
436
|
message: "'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used."
|
|
@@ -492,7 +492,7 @@ const devError = {
|
|
|
492
492
|
}
|
|
493
493
|
};
|
|
494
494
|
|
|
495
|
-
var version = "3.12.0
|
|
495
|
+
var version = "3.12.0";
|
|
496
496
|
|
|
497
497
|
function maybe(thunk) {
|
|
498
498
|
try {
|
package/invariantErrorCodes.js
CHANGED
|
@@ -136,46 +136,22 @@ export const errorCodes = // This file is used by the error message display webs
|
|
|
136
136
|
message: "Store reset while query was in flight (not completed in link chain)"
|
|
137
137
|
},
|
|
138
138
|
|
|
139
|
-
38: {
|
|
140
|
-
file: "@apollo/client/core/masking.js",
|
|
141
|
-
condition: "definition",
|
|
142
|
-
message: "Expected a parsed GraphQL document with a query, mutation, or subscription."
|
|
143
|
-
},
|
|
144
|
-
|
|
145
139
|
39: {
|
|
146
|
-
file: "@apollo/client/core/masking.js",
|
|
147
|
-
condition: "fragments.length === 1",
|
|
148
|
-
message: "Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment."
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
40: {
|
|
152
|
-
file: "@apollo/client/core/masking.js",
|
|
153
|
-
condition: "!!fragment",
|
|
154
|
-
message: "Could not find fragment with name \"%s\"."
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
41: {
|
|
158
|
-
file: "@apollo/client/core/masking.js",
|
|
159
|
-
condition: "fragment",
|
|
160
|
-
message: "Could not find fragment with name '%s'."
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
45: {
|
|
164
140
|
file: "@apollo/client/link/core/ApolloLink.js",
|
|
165
141
|
message: "request is not implemented"
|
|
166
142
|
},
|
|
167
143
|
|
|
168
|
-
|
|
144
|
+
40: {
|
|
169
145
|
file: "@apollo/client/link/http/checkFetcher.js",
|
|
170
146
|
message: "\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n "
|
|
171
147
|
},
|
|
172
148
|
|
|
173
|
-
|
|
149
|
+
42: {
|
|
174
150
|
file: "@apollo/client/link/http/serializeFetchParameter.js",
|
|
175
151
|
message: "Network request failed. %s is not serializable: %s"
|
|
176
152
|
},
|
|
177
153
|
|
|
178
|
-
|
|
154
|
+
43: {
|
|
179
155
|
file: "@apollo/client/link/persisted-queries/index.js",
|
|
180
156
|
condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")",
|
|
181
157
|
|
|
@@ -184,17 +160,41 @@ export const errorCodes = // This file is used by the error message display webs
|
|
|
184
160
|
"parameter."
|
|
185
161
|
},
|
|
186
162
|
|
|
187
|
-
|
|
163
|
+
44: {
|
|
188
164
|
file: "@apollo/client/link/persisted-queries/index.js",
|
|
189
165
|
condition: "forward",
|
|
190
166
|
message: "PersistedQueryLink cannot be the last link in the chain."
|
|
191
167
|
},
|
|
192
168
|
|
|
193
|
-
|
|
169
|
+
46: {
|
|
194
170
|
file: "@apollo/client/link/utils/validateOperation.js",
|
|
195
171
|
message: "illegal argument: %s"
|
|
196
172
|
},
|
|
197
173
|
|
|
174
|
+
47: {
|
|
175
|
+
file: "@apollo/client/masking/maskDefinition.js",
|
|
176
|
+
condition: "fragment",
|
|
177
|
+
message: "Could not find fragment with name '%s'."
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
49: {
|
|
181
|
+
file: "@apollo/client/masking/maskFragment.js",
|
|
182
|
+
condition: "fragments.length === 1",
|
|
183
|
+
message: "Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment."
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
50: {
|
|
187
|
+
file: "@apollo/client/masking/maskFragment.js",
|
|
188
|
+
condition: "!!fragment",
|
|
189
|
+
message: "Could not find fragment with name \"%s\"."
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
51: {
|
|
193
|
+
file: "@apollo/client/masking/maskOperation.js",
|
|
194
|
+
condition: "definition",
|
|
195
|
+
message: "Expected a parsed GraphQL document with a query, mutation, or subscription."
|
|
196
|
+
},
|
|
197
|
+
|
|
198
198
|
53: {
|
|
199
199
|
file: "@apollo/client/react/context/ApolloConsumer.js",
|
|
200
200
|
condition: "context && context.client",
|
|
@@ -505,31 +505,31 @@ export const devWarn = {
|
|
|
505
505
|
message: '[%s]: Fragments masked by data masking are inaccessible when using fetch policy "no-cache". Please add `@unmask` to each fragment spread to access the data.'
|
|
506
506
|
},
|
|
507
507
|
|
|
508
|
-
|
|
509
|
-
file: "@apollo/client/core/masking.js",
|
|
510
|
-
message: "Accessing unmasked field on %s at path '%s'. This field will not be available when masking is enabled. Please read the field from the fragment instead."
|
|
511
|
-
},
|
|
512
|
-
|
|
513
|
-
43: {
|
|
514
|
-
file: "@apollo/client/core/masking.js",
|
|
515
|
-
message: "The configured cache does not support data masking which effectively disables it. Please use a cache that supports data masking or disable data masking to silence this warning."
|
|
516
|
-
},
|
|
517
|
-
|
|
518
|
-
44: {
|
|
508
|
+
38: {
|
|
519
509
|
file: "@apollo/client/link/core/ApolloLink.js",
|
|
520
510
|
message: "You are calling concat on a terminating link, which will have no effect %o"
|
|
521
511
|
},
|
|
522
512
|
|
|
523
|
-
|
|
513
|
+
41: {
|
|
524
514
|
file: "@apollo/client/link/http/createHttpLink.js",
|
|
525
515
|
message: "Multipart-subscriptions do not support @defer"
|
|
526
516
|
},
|
|
527
517
|
|
|
528
|
-
|
|
518
|
+
45: {
|
|
529
519
|
file: "@apollo/client/link/utils/toPromise.js",
|
|
530
520
|
message: "Promise Wrapper does not support multiple results from Observable"
|
|
531
521
|
},
|
|
532
522
|
|
|
523
|
+
48: {
|
|
524
|
+
file: "@apollo/client/masking/maskDefinition.js",
|
|
525
|
+
message: "Accessing unmasked field on %s at path '%s'. This field will not be available when masking is enabled. Please read the field from the fragment instead."
|
|
526
|
+
},
|
|
527
|
+
|
|
528
|
+
52: {
|
|
529
|
+
file: "@apollo/client/masking/utils.js",
|
|
530
|
+
message: "The configured cache does not support data masking which effectively disables it. Please use a cache that supports data masking or disable data masking to silence this warning."
|
|
531
|
+
},
|
|
532
|
+
|
|
533
533
|
61: {
|
|
534
534
|
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
535
535
|
message: "'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used."
|
package/link/core/ApolloLink.js
CHANGED
|
@@ -49,7 +49,7 @@ var ApolloLink = /** @class */ (function () {
|
|
|
49
49
|
ApolloLink.concat = function (first, second) {
|
|
50
50
|
var firstLink = toLink(first);
|
|
51
51
|
if (isTerminating(firstLink)) {
|
|
52
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
52
|
+
globalThis.__DEV__ !== false && invariant.warn(38, firstLink);
|
|
53
53
|
return firstLink;
|
|
54
54
|
}
|
|
55
55
|
var nextLink = toLink(second);
|
|
@@ -75,7 +75,7 @@ var ApolloLink = /** @class */ (function () {
|
|
|
75
75
|
return ApolloLink.concat(this, next);
|
|
76
76
|
};
|
|
77
77
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
78
|
-
throw newInvariantError(
|
|
78
|
+
throw newInvariantError(39);
|
|
79
79
|
};
|
|
80
80
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
81
81
|
if (observer && observer.error) {
|
package/link/core/core.cjs
CHANGED
|
@@ -54,7 +54,7 @@ var ApolloLink = (function () {
|
|
|
54
54
|
ApolloLink.concat = function (first, second) {
|
|
55
55
|
var firstLink = toLink(first);
|
|
56
56
|
if (isTerminating(firstLink)) {
|
|
57
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
57
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(38, firstLink);
|
|
58
58
|
return firstLink;
|
|
59
59
|
}
|
|
60
60
|
var nextLink = toLink(second);
|
|
@@ -80,7 +80,7 @@ var ApolloLink = (function () {
|
|
|
80
80
|
return ApolloLink.concat(this, next);
|
|
81
81
|
};
|
|
82
82
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
83
|
-
throw globals.newInvariantError(
|
|
83
|
+
throw globals.newInvariantError(39);
|
|
84
84
|
};
|
|
85
85
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
86
86
|
if (observer && observer.error) {
|
package/link/core/core.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.cjs","sources":["ApolloLink.js","empty.js","from.js","split.js","concat.js","execute.js"],"sourcesContent":["import { newInvariantError, invariant } from \"../../utilities/globals/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport { validateOperation, createOperation, transformOperation, } from \"../utils/index.js\";\nfunction passthrough(op, forward) {\n return (forward ? forward(op) : Observable.of());\n}\nfunction toLink(handler) {\n return typeof handler === \"function\" ? new ApolloLink(handler) : handler;\n}\nfunction isTerminating(link) {\n return link.request.length <= 1;\n}\nvar ApolloLink = /** @class */ (function () {\n function ApolloLink(request) {\n if (request)\n this.request = request;\n }\n ApolloLink.empty = function () {\n return new ApolloLink(function () { return Observable.of(); });\n };\n ApolloLink.from = function (links) {\n if (links.length === 0)\n return ApolloLink.empty();\n return links.map(toLink).reduce(function (x, y) { return x.concat(y); });\n };\n ApolloLink.split = function (test, left, right) {\n var leftLink = toLink(left);\n var rightLink = toLink(right || new ApolloLink(passthrough));\n var ret;\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n ret = new ApolloLink(function (operation) {\n return test(operation) ?\n leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n }\n else {\n ret = new ApolloLink(function (operation, forward) {\n return test(operation) ?\n leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n return Object.assign(ret, { left: leftLink, right: rightLink });\n };\n ApolloLink.execute = function (link, operation) {\n return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of());\n };\n ApolloLink.concat = function (first, second) {\n var firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n globalThis.__DEV__ !== false && invariant.warn(
|
|
1
|
+
{"version":3,"file":"core.cjs","sources":["ApolloLink.js","empty.js","from.js","split.js","concat.js","execute.js"],"sourcesContent":["import { newInvariantError, invariant } from \"../../utilities/globals/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport { validateOperation, createOperation, transformOperation, } from \"../utils/index.js\";\nfunction passthrough(op, forward) {\n return (forward ? forward(op) : Observable.of());\n}\nfunction toLink(handler) {\n return typeof handler === \"function\" ? new ApolloLink(handler) : handler;\n}\nfunction isTerminating(link) {\n return link.request.length <= 1;\n}\nvar ApolloLink = /** @class */ (function () {\n function ApolloLink(request) {\n if (request)\n this.request = request;\n }\n ApolloLink.empty = function () {\n return new ApolloLink(function () { return Observable.of(); });\n };\n ApolloLink.from = function (links) {\n if (links.length === 0)\n return ApolloLink.empty();\n return links.map(toLink).reduce(function (x, y) { return x.concat(y); });\n };\n ApolloLink.split = function (test, left, right) {\n var leftLink = toLink(left);\n var rightLink = toLink(right || new ApolloLink(passthrough));\n var ret;\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n ret = new ApolloLink(function (operation) {\n return test(operation) ?\n leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n }\n else {\n ret = new ApolloLink(function (operation, forward) {\n return test(operation) ?\n leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n return Object.assign(ret, { left: leftLink, right: rightLink });\n };\n ApolloLink.execute = function (link, operation) {\n return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of());\n };\n ApolloLink.concat = function (first, second) {\n var firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n globalThis.__DEV__ !== false && invariant.warn(38, firstLink);\n return firstLink;\n }\n var nextLink = toLink(second);\n var ret;\n if (isTerminating(nextLink)) {\n ret = new ApolloLink(function (operation) {\n return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of();\n });\n }\n else {\n ret = new ApolloLink(function (operation, forward) {\n return (firstLink.request(operation, function (op) {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of());\n });\n }\n return Object.assign(ret, { left: firstLink, right: nextLink });\n };\n ApolloLink.prototype.split = function (test, left, right) {\n return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough)));\n };\n ApolloLink.prototype.concat = function (next) {\n return ApolloLink.concat(this, next);\n };\n ApolloLink.prototype.request = function (operation, forward) {\n throw newInvariantError(39);\n };\n ApolloLink.prototype.onError = function (error, observer) {\n if (observer && observer.error) {\n observer.error(error);\n // Returning false indicates that observer.error does not need to be\n // called again, since it was already called (on the previous line).\n // Calling observer.error again would not cause any real problems,\n // since only the first call matters, but custom onError functions\n // might have other reasons for wanting to prevent the default\n // behavior by returning false.\n return false;\n }\n // Throw errors will be passed to observer.error.\n throw error;\n };\n ApolloLink.prototype.setOnError = function (fn) {\n this.onError = fn;\n return this;\n };\n return ApolloLink;\n}());\nexport { ApolloLink };\n//# sourceMappingURL=ApolloLink.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var empty = ApolloLink.empty;\n//# sourceMappingURL=empty.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var from = ApolloLink.from;\n//# sourceMappingURL=from.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var split = ApolloLink.split;\n//# sourceMappingURL=split.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var concat = ApolloLink.concat;\n//# sourceMappingURL=concat.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var execute = ApolloLink.execute;\n//# sourceMappingURL=execute.js.map"],"names":["Observable","createOperation","transformOperation","validateOperation","invariant","newInvariantError"],"mappings":";;;;;;;;AAGA,SAAS,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE;AAClC,IAAI,QAAQ,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,GAAGA,oBAAU,CAAC,EAAE,EAAE,EAAE;AACrD,CAAC;AACD,SAAS,MAAM,CAAC,OAAO,EAAE;AACzB,IAAI,OAAO,OAAO,OAAO,KAAK,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAC7E,CAAC;AACD,SAAS,aAAa,CAAC,IAAI,EAAE;AAC7B,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;AACpC,CAAC;AACE,IAAC,UAAU,KAAkB,YAAY;AAC5C,IAAI,SAAS,UAAU,CAAC,OAAO,EAAE;AACjC,QAAQ,IAAI,OAAO;AACnB,YAAY,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACnC,KAAK;AACL,IAAI,UAAU,CAAC,KAAK,GAAG,YAAY;AACnC,QAAQ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AE,CAAC,CAAC;AACpC,KAAK,CAAC;AACN,IAAI,UAAU,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,KAAK,EAAE,QAAQ,EAAE;AAC9D,QAAQ,IAAI,QAAQ,IAAI,QAAQ,CAAC,KAAK,EAAE;AACxC,YAAY,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAOlC,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AAET,QAAQ,MAAM,KAAK,CAAC;AACpB,KAAK,CAAC;AACN,IAAI,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,UAAU,EAAE,EAAE;AACpD,QAAQ,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;AAC1B,QAAQ,OAAO,IAAI,CAAC;AACpB,KAAK,CAAC;AACN,IAAI,OAAO,UAAU,CAAC;AACtB,CAAC,EAAE;;ACjGO,IAAC,KAAK,GAAG,UAAU,CAAC;;ACApB,IAAC,IAAI,GAAG,UAAU,CAAC;;ACAnB,IAAC,KAAK,GAAG,UAAU,CAAC;;ACApB,IAAC,MAAM,GAAG,UAAU,CAAC;;ACArB,IAAC,OAAO,GAAG,UAAU,CAAC;;;;;;;;;"}
|
|
@@ -54,7 +54,7 @@ var ApolloLink = (function () {
|
|
|
54
54
|
ApolloLink.concat = function (first, second) {
|
|
55
55
|
var firstLink = toLink(first);
|
|
56
56
|
if (isTerminating(firstLink)) {
|
|
57
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
57
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(38, firstLink);
|
|
58
58
|
return firstLink;
|
|
59
59
|
}
|
|
60
60
|
var nextLink = toLink(second);
|
|
@@ -80,7 +80,7 @@ var ApolloLink = (function () {
|
|
|
80
80
|
return ApolloLink.concat(this, next);
|
|
81
81
|
};
|
|
82
82
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
83
|
-
throw globals.newInvariantError(
|
|
83
|
+
throw globals.newInvariantError(39);
|
|
84
84
|
};
|
|
85
85
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
86
86
|
if (observer && observer.error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { newInvariantError } from "../../utilities/globals/index.js";
|
|
2
2
|
export var checkFetcher = function (fetcher) {
|
|
3
3
|
if (!fetcher && typeof fetch === "undefined") {
|
|
4
|
-
throw newInvariantError(
|
|
4
|
+
throw newInvariantError(40);
|
|
5
5
|
}
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=checkFetcher.js.map
|
|
@@ -90,7 +90,7 @@ export var createHttpLink = function (linkOptions) {
|
|
|
90
90
|
// Omit defer-specific headers if the user attempts to defer a selection
|
|
91
91
|
// set on a subscription and log a warning.
|
|
92
92
|
if (isSubscription && hasDefer) {
|
|
93
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
93
|
+
globalThis.__DEV__ !== false && invariant.warn(41);
|
|
94
94
|
}
|
|
95
95
|
if (isSubscription) {
|
|
96
96
|
acceptHeader +=
|
package/link/http/http.cjs
CHANGED
|
@@ -331,7 +331,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
331
331
|
serialized = JSON.stringify(p);
|
|
332
332
|
}
|
|
333
333
|
catch (e) {
|
|
334
|
-
var parseError = globals.newInvariantError(
|
|
334
|
+
var parseError = globals.newInvariantError(42, label, e.message);
|
|
335
335
|
parseError.parseError = e;
|
|
336
336
|
throw parseError;
|
|
337
337
|
}
|
|
@@ -417,7 +417,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
417
417
|
|
|
418
418
|
var checkFetcher = function (fetcher) {
|
|
419
419
|
if (!fetcher && typeof fetch === "undefined") {
|
|
420
|
-
throw globals.newInvariantError(
|
|
420
|
+
throw globals.newInvariantError(40);
|
|
421
421
|
}
|
|
422
422
|
};
|
|
423
423
|
|
|
@@ -551,7 +551,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
551
551
|
options.headers = options.headers || {};
|
|
552
552
|
var acceptHeader = "multipart/mixed;";
|
|
553
553
|
if (isSubscription && hasDefer) {
|
|
554
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
554
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(41);
|
|
555
555
|
}
|
|
556
556
|
if (isSubscription) {
|
|
557
557
|
acceptHeader +=
|