@apollo/client 4.0.0-rc.1 → 4.0.0-rc.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.
- package/CHANGELOG.md +65 -0
- package/__cjs/cache/core/types/DataProxy.d.cts +4 -4
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +3 -3
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +1 -1
- package/__cjs/core/types.d.cts +94 -42
- package/__cjs/core/watchQueryOptions.d.cts +2 -2
- package/__cjs/link/context/index.cjs +18 -14
- package/__cjs/link/context/index.cjs.map +1 -1
- package/__cjs/link/context/index.d.cts +17 -5
- package/__cjs/link/utils/transformOperation.cjs +1 -0
- package/__cjs/link/utils/transformOperation.cjs.map +1 -1
- package/__cjs/version.cjs +1 -1
- package/cache/core/types/DataProxy.d.ts +4 -4
- package/core/QueryInfo.d.ts +3 -3
- package/core/QueryInfo.js.map +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js.map +1 -1
- package/core/types.d.ts +94 -42
- package/core/watchQueryOptions.d.ts +2 -2
- package/link/context/index.d.ts +17 -5
- package/link/context/index.js +18 -14
- package/link/context/index.js.map +1 -1
- package/link/utils/transformOperation.js +1 -0
- package/link/utils/transformOperation.js.map +1 -1
- package/package.json +3 -2
- package/version.js +1 -1
package/core/types.d.ts
CHANGED
|
@@ -17,40 +17,104 @@ export interface TypeOverrides {
|
|
|
17
17
|
}
|
|
18
18
|
declare namespace OverridableTypes {
|
|
19
19
|
export interface Defaults {
|
|
20
|
+
Complete: Complete;
|
|
20
21
|
Streaming: Streaming;
|
|
22
|
+
Partial: Partial;
|
|
23
|
+
}
|
|
24
|
+
interface Complete extends HKT {
|
|
25
|
+
arg1: unknown;
|
|
26
|
+
return: this["arg1"];
|
|
21
27
|
}
|
|
22
28
|
interface Streaming extends HKT {
|
|
23
29
|
arg1: unknown;
|
|
24
30
|
return: this["arg1"];
|
|
25
31
|
}
|
|
32
|
+
interface Partial extends HKT {
|
|
33
|
+
arg1: unknown;
|
|
34
|
+
return: DeepPartial<this["arg1"]>;
|
|
35
|
+
}
|
|
26
36
|
export {};
|
|
27
37
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
export declare namespace DataValue {
|
|
39
|
+
/**
|
|
40
|
+
* Returns a representation of `TData` in it's "complete" state.
|
|
41
|
+
*
|
|
42
|
+
* @defaultValue `TData` if no overrides are provided.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* You can override this type globally - this example shows how to override it
|
|
46
|
+
* with `DeepPartial<TData>`:
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { HKT, DeepPartial } from "@apollo/client/utilities";
|
|
50
|
+
*
|
|
51
|
+
* type CompleteOverride<TData> = TData extends { _complete?: infer _Complete } ? _Complete : TData;
|
|
52
|
+
*
|
|
53
|
+
* interface CompleteOverrideHKT extends HKT {
|
|
54
|
+
* return: CompleteOverride<this["arg1"]>;
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* declare module "@apollo/client" {
|
|
58
|
+
* export interface TypeOverrides {
|
|
59
|
+
* Complete: CompleteOverrideHKT;
|
|
60
|
+
* }
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
type Complete<TData> = ApplyHKTImplementationWithDefault<TypeOverrides, "Complete", OverridableTypes.Defaults, TData>;
|
|
65
|
+
/**
|
|
66
|
+
* Returns a representation of `TData` while it is streaming.
|
|
67
|
+
*
|
|
68
|
+
* @defaultValue `TData` if no overrides are provided.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* You can override this type globally - this example shows how to override it
|
|
72
|
+
* with `DeepPartial<TData>`:
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* import { HKT, DeepPartial } from "@apollo/client/utilities";
|
|
76
|
+
*
|
|
77
|
+
* type StreamingOverride<TData> = DeepPartial<TData>;
|
|
78
|
+
*
|
|
79
|
+
* interface StreamingOverrideHKT extends HKT {
|
|
80
|
+
* return: StreamingOverride<this["arg1"]>;
|
|
81
|
+
* }
|
|
82
|
+
*
|
|
83
|
+
* declare module "@apollo/client" {
|
|
84
|
+
* export interface TypeOverrides {
|
|
85
|
+
* Streaming: StreamingOverrideHKT;
|
|
86
|
+
* }
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
type Streaming<TData> = ApplyHKTImplementationWithDefault<TypeOverrides, "Streaming", OverridableTypes.Defaults, TData>;
|
|
91
|
+
/**
|
|
92
|
+
* Returns a representation of `TData` while it is partial.
|
|
93
|
+
*
|
|
94
|
+
* @defaultValue `DeepPartial<TData>` if no overrides are provided.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* You can override this type globally - this example shows how to override it
|
|
98
|
+
* with `DeepPartial<TData>`:
|
|
99
|
+
*
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { HKT, DeepPartial } from "@apollo/client/utilities";
|
|
102
|
+
*
|
|
103
|
+
* type PartialOverride<TData> = DeepPartial<Complete<TData>>;
|
|
104
|
+
*
|
|
105
|
+
* interface PartialOverrideHKT extends HKT {
|
|
106
|
+
* return: PartialOverride<this["arg1"]>;
|
|
107
|
+
* }
|
|
108
|
+
*
|
|
109
|
+
* declare module "@apollo/client" {
|
|
110
|
+
* export interface TypeOverrides {
|
|
111
|
+
* Partial: PartialOverrideHKT;
|
|
112
|
+
* }
|
|
113
|
+
* }
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
type Partial<TData> = ApplyHKTImplementationWithDefault<TypeOverrides, "Partial", OverridableTypes.Defaults, TData>;
|
|
117
|
+
}
|
|
54
118
|
export interface DefaultContext extends Record<string, any> {
|
|
55
119
|
/**
|
|
56
120
|
* Indicates whether `queryDeduplication` was enabled for the request.
|
|
@@ -133,19 +197,19 @@ export type ApolloQueryResult<TData, TStates extends DataState<TData>["dataState
|
|
|
133
197
|
partial: boolean;
|
|
134
198
|
} & GetDataState<TData, TStates>;
|
|
135
199
|
export type DataState<TData> = {
|
|
136
|
-
data: TData
|
|
200
|
+
data: DataValue.Complete<TData>;
|
|
137
201
|
/**
|
|
138
202
|
* Describes the completeness of `data`. - `empty`: No data could be fulfilled from the cache or the result is incomplete. `data` is `undefined`. - `partial`: Some data could be fulfilled from the cache but `data` is incomplete. This is only possible when `returnPartialData` is `true`. - `streaming`: `data` is incomplete as a result of a deferred query and the result is still streaming in. - `complete`: `data` is a fully satisfied query result fulfilled either from the cache or network.
|
|
139
203
|
*/
|
|
140
204
|
dataState: "complete";
|
|
141
205
|
} | {
|
|
142
|
-
data: Streaming<TData>;
|
|
206
|
+
data: DataValue.Streaming<TData>;
|
|
143
207
|
/**
|
|
144
208
|
* Describes the completeness of `data`. - `empty`: No data could be fulfilled from the cache or the result is incomplete. `data` is `undefined`. - `partial`: Some data could be fulfilled from the cache but `data` is incomplete. This is only possible when `returnPartialData` is `true`. - `streaming`: `data` is incomplete as a result of a deferred query and the result is still streaming in. - `complete`: `data` is a fully satisfied query result fulfilled either from the cache or network.
|
|
145
209
|
*/
|
|
146
210
|
dataState: "streaming";
|
|
147
211
|
} | {
|
|
148
|
-
data:
|
|
212
|
+
data: DataValue.Partial<TData>;
|
|
149
213
|
/**
|
|
150
214
|
* Describes the completeness of `data`. - `empty`: No data could be fulfilled from the cache or the result is incomplete. `data` is `undefined`. - `partial`: Some data could be fulfilled from the cache but `data` is incomplete. This is only possible when `returnPartialData` is `true`. - `streaming`: `data` is incomplete as a result of a deferred query and the result is still streaming in. - `complete`: `data` is a fully satisfied query result fulfilled either from the cache or network.
|
|
151
215
|
*/
|
|
@@ -165,19 +229,7 @@ export type GetDataState<TData, TState extends DataState<TData>["dataState"]> =
|
|
|
165
229
|
* has been normalized into a plain GraphQL result. When the result is
|
|
166
230
|
* still `streaming`, some fields might not yet be available.
|
|
167
231
|
*/
|
|
168
|
-
export type NormalizedExecutionResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> = Omit<FormattedExecutionResult<TData, TExtensions>, "data"> &
|
|
169
|
-
data: TData;
|
|
170
|
-
/**
|
|
171
|
-
* Describes the completeness of `data`. - `empty`: No data could be fulfilled from the cache or the result is incomplete. `data` is `undefined`. - `partial`: Some data could be fulfilled from the cache but `data` is incomplete. This is only possible when `returnPartialData` is `true`. - `streaming`: `data` is incomplete as a result of a deferred query and the result is still streaming in. - `complete`: `data` is a fully satisfied query result fulfilled either from the cache or network.
|
|
172
|
-
*/
|
|
173
|
-
dataState: "complete";
|
|
174
|
-
} | {
|
|
175
|
-
data: Streaming<TData>;
|
|
176
|
-
/**
|
|
177
|
-
* Describes the completeness of `data`. - `empty`: No data could be fulfilled from the cache or the result is incomplete. `data` is `undefined`. - `partial`: Some data could be fulfilled from the cache but `data` is incomplete. This is only possible when `returnPartialData` is `true`. - `streaming`: `data` is incomplete as a result of a deferred query and the result is still streaming in. - `complete`: `data` is a fully satisfied query result fulfilled either from the cache or network.
|
|
178
|
-
*/
|
|
179
|
-
dataState: "streaming";
|
|
180
|
-
});
|
|
232
|
+
export type NormalizedExecutionResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> = Omit<FormattedExecutionResult<TData, TExtensions>, "data"> & GetDataState<TData, "streaming" | "complete">;
|
|
181
233
|
export type MutationQueryReducer<T> = (previousResult: Record<string, any>, options: {
|
|
182
234
|
mutationResult: NormalizedExecutionResult<Unmasked<T>>;
|
|
183
235
|
queryName: string | undefined;
|
|
@@ -6,7 +6,7 @@ import type { Unmasked } from "@apollo/client/masking";
|
|
|
6
6
|
import type { DeepPartial } from "@apollo/client/utilities";
|
|
7
7
|
import type { NoInfer, VariablesOption } from "@apollo/client/utilities/internal";
|
|
8
8
|
import type { ObservableQuery } from "./ObservableQuery.js";
|
|
9
|
-
import type { DefaultContext, InternalRefetchQueriesInclude, MutationQueryReducersMap, MutationUpdaterFunction, NormalizedExecutionResult, OnQueryUpdated, OperationVariables } from "./types.js";
|
|
9
|
+
import type { DefaultContext, ErrorLike, InternalRefetchQueriesInclude, MutationQueryReducersMap, MutationUpdaterFunction, NormalizedExecutionResult, OnQueryUpdated, OperationVariables } from "./types.js";
|
|
10
10
|
/**
|
|
11
11
|
* fetchPolicy determines where the client may return a result from. The options are:
|
|
12
12
|
* - cache-first (default): return result from cache. Only fetch from network if cached result is not available.
|
|
@@ -227,7 +227,7 @@ export interface SubscribeToMoreOptions<TData = unknown, TSubscriptionVariables
|
|
|
227
227
|
document: DocumentNode | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;
|
|
228
228
|
variables?: TSubscriptionVariables;
|
|
229
229
|
updateQuery?: SubscribeToMoreUpdateQueryFn<TData, TVariables, TSubscriptionData>;
|
|
230
|
-
onError?: (error:
|
|
230
|
+
onError?: (error: ErrorLike) => void;
|
|
231
231
|
context?: DefaultContext;
|
|
232
232
|
}
|
|
233
233
|
export interface SubscribeToMoreFunction<TData, TVariables extends OperationVariables = OperationVariables> {
|
package/link/context/index.d.ts
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Operation, OperationContext } from "@apollo/client/link";
|
|
2
2
|
import { ApolloLink } from "@apollo/client/link";
|
|
3
|
-
export
|
|
3
|
+
export declare namespace SetContextLink {
|
|
4
|
+
type ContextSetter = (prevContext: OperationContext, operation: SetContextOperation) => Promise<Partial<OperationContext>> | Partial<OperationContext>;
|
|
5
|
+
type LegacyContextSetter = (operation: SetContextOperation, prevContext: OperationContext) => Promise<Partial<OperationContext>> | Partial<OperationContext>;
|
|
6
|
+
type SetContextOperation = Omit<Operation, "getContext" | "setContext">;
|
|
7
|
+
}
|
|
4
8
|
/**
|
|
5
9
|
* @deprecated
|
|
6
|
-
* Use `SetContextLink` from `@apollo/client/link/context` instead.
|
|
10
|
+
* Use `SetContextLink` from `@apollo/client/link/context` instead. Note you
|
|
11
|
+
* will need to flip the arguments when using `SetContextLink` as `prevContext`
|
|
12
|
+
* is the first argument.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* new SetContextLink((prevContext, operation) => {
|
|
16
|
+
* // ...
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
7
19
|
*/
|
|
8
|
-
export declare function setContext(setter:
|
|
20
|
+
export declare function setContext(setter: SetContextLink.LegacyContextSetter): SetContextLink;
|
|
9
21
|
export declare class SetContextLink extends ApolloLink {
|
|
10
|
-
constructor(setter: ContextSetter);
|
|
22
|
+
constructor(setter: SetContextLink.ContextSetter);
|
|
11
23
|
}
|
|
12
24
|
//# sourceMappingURL=index.d.ts.map
|
package/link/context/index.js
CHANGED
|
@@ -2,36 +2,40 @@ import { Observable } from "rxjs";
|
|
|
2
2
|
import { ApolloLink } from "@apollo/client/link";
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated
|
|
5
|
-
* Use `SetContextLink` from `@apollo/client/link/context` instead.
|
|
5
|
+
* Use `SetContextLink` from `@apollo/client/link/context` instead. Note you
|
|
6
|
+
* will need to flip the arguments when using `SetContextLink` as `prevContext`
|
|
7
|
+
* is the first argument.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* new SetContextLink((prevContext, operation) => {
|
|
11
|
+
* // ...
|
|
12
|
+
* })
|
|
13
|
+
* ```
|
|
6
14
|
*/
|
|
7
15
|
export function setContext(setter) {
|
|
8
|
-
return new SetContextLink(setter);
|
|
16
|
+
return new SetContextLink((prevContext, operation) => setter(operation, prevContext));
|
|
9
17
|
}
|
|
10
18
|
export class SetContextLink extends ApolloLink {
|
|
11
19
|
constructor(setter) {
|
|
12
20
|
super((operation, forward) => {
|
|
13
21
|
const { ...request } = operation;
|
|
22
|
+
Object.defineProperty(request, "client", {
|
|
23
|
+
enumerable: false,
|
|
24
|
+
value: operation.client,
|
|
25
|
+
});
|
|
14
26
|
return new Observable((observer) => {
|
|
15
|
-
let handle;
|
|
16
27
|
let closed = false;
|
|
17
28
|
Promise.resolve(request)
|
|
18
|
-
.then((req) => setter(
|
|
29
|
+
.then((req) => setter(operation.getContext(), req))
|
|
19
30
|
.then(operation.setContext)
|
|
20
31
|
.then(() => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
handle = forward(operation).subscribe({
|
|
25
|
-
next: observer.next.bind(observer),
|
|
26
|
-
error: observer.error.bind(observer),
|
|
27
|
-
complete: observer.complete.bind(observer),
|
|
28
|
-
});
|
|
32
|
+
if (!closed) {
|
|
33
|
+
forward(operation).subscribe(observer);
|
|
34
|
+
}
|
|
29
35
|
})
|
|
30
36
|
.catch(observer.error.bind(observer));
|
|
31
37
|
return () => {
|
|
32
38
|
closed = true;
|
|
33
|
-
if (handle)
|
|
34
|
-
handle.unsubscribe();
|
|
35
39
|
};
|
|
36
40
|
});
|
|
37
41
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/link/context/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/link/context/index.ts"],"sourcesContent":["import { Observable } from \"rxjs\";\n\nimport type { Operation, OperationContext } from \"@apollo/client/link\";\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace SetContextLink {\n export type ContextSetter = (\n prevContext: OperationContext,\n operation: SetContextOperation\n ) => Promise<Partial<OperationContext>> | Partial<OperationContext>;\n\n export type LegacyContextSetter = (\n operation: SetContextOperation,\n prevContext: OperationContext\n ) => Promise<Partial<OperationContext>> | Partial<OperationContext>;\n\n export type SetContextOperation = Omit<\n Operation,\n \"getContext\" | \"setContext\"\n >;\n}\n\n/**\n * @deprecated\n * Use `SetContextLink` from `@apollo/client/link/context` instead. Note you\n * will need to flip the arguments when using `SetContextLink` as `prevContext`\n * is the first argument.\n *\n * ```ts\n * new SetContextLink((prevContext, operation) => {\n * // ...\n * })\n * ```\n */\nexport function setContext(setter: SetContextLink.LegacyContextSetter) {\n return new SetContextLink((prevContext, operation) =>\n setter(operation, prevContext)\n );\n}\nexport class SetContextLink extends ApolloLink {\n constructor(setter: SetContextLink.ContextSetter) {\n super((operation, forward) => {\n const { ...request } = operation as SetContextLink.SetContextOperation;\n\n Object.defineProperty(request, \"client\", {\n enumerable: false,\n value: operation.client,\n });\n\n return new Observable((observer) => {\n let closed = false;\n Promise.resolve(request)\n .then((req) => setter(operation.getContext(), req))\n .then(operation.setContext)\n .then(() => {\n if (!closed) {\n forward(operation).subscribe(observer);\n }\n })\n .catch(observer.error.bind(observer));\n\n return () => {\n closed = true;\n };\n });\n });\n }\n}\n"],"names":[],"mappings":"AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAA2B,CAA3B,CAAA,CAAA,CAAA,CAAA,CAAiC;AAGjC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAA2B,CAA3B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgD;AAmBhD,CAAA,CAAA;;;;;;;;;;;CAWA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAgB,C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|| {},
|
|
5
5
|
extensions: operation.extensions || {},
|
|
6
6
|
operationName: operation.operationName,
|
|
7
|
+
operationType: operation.operationType,
|
|
7
8
|
query: operation.query,
|
|
8
9
|
};
|
|
9
10
|
// Best guess at an operation name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformOperation.js","sources":["../../../src/link/utils/transformOperation.ts"],"sourcesContent":["import type { GraphQLRequest
|
|
1
|
+
{"version":3,"file":"transformOperation.js","sources":["../../../src/link/utils/transformOperation.ts"],"sourcesContent":["import type { GraphQLRequest } from \"@apollo/client/link\";\nimport { getOperationName } from \"@apollo/client/utilities/internal\";\n\nexport function transformOperation(operation: GraphQLRequest): GraphQLRequest {\n const transformedOperation: GraphQLRequest = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n operationType: operation.operationType,\n query: operation.query,\n };\n\n // Best guess at an operation name\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== \"string\" ?\n getOperationName(transformedOperation.query)\n : \"\";\n }\n\n return transformedOperation;\n}\n"],"names":[],"mappings":"AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAiC,CAAjC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoE;AAEpE,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAgB,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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,CAAC,CAA9C,CAAA,CAAA,CAAA,CAAmD;gBAC7C,EAAE,CAAR,CAAU;IACR;IAEA,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B;AAC7B;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apollo/client",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.2",
|
|
4
4
|
"description": "A fully-featured caching GraphQL client.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"keywords": [
|
|
@@ -320,6 +320,7 @@
|
|
|
320
320
|
],
|
|
321
321
|
"workspaces": [
|
|
322
322
|
"dist",
|
|
323
|
-
"codegen"
|
|
323
|
+
"codegen",
|
|
324
|
+
"scripts/codemods/ac3-to-ac4"
|
|
324
325
|
]
|
|
325
326
|
}
|
package/version.js
CHANGED