@aws-amplify/api-graphql 4.0.1-console-preview.d745d43.0 → 4.0.1-mjs-test.6f5dab7.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/dist/cjs/GraphQLAPI.js +52 -0
- package/dist/cjs/GraphQLAPI.js.map +1 -0
- package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js +693 -0
- package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -0
- package/{lib → dist/cjs}/Providers/constants.js +8 -8
- package/dist/cjs/Providers/constants.js.map +1 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/internals/InternalGraphQLAPI.js +274 -0
- package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -0
- package/dist/cjs/internals/index.js +14 -0
- package/dist/cjs/internals/index.js.map +1 -0
- package/{lib → dist/cjs}/internals/v6.js +7 -4
- package/dist/cjs/internals/v6.js.map +1 -0
- package/{lib → dist/cjs}/types/PubSub.js +6 -6
- package/dist/cjs/types/PubSub.js.map +1 -0
- package/{lib → dist/cjs}/types/index.js +7 -5
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/utils/ConnectionStateMonitor.js +134 -0
- package/dist/cjs/utils/ConnectionStateMonitor.js.map +1 -0
- package/dist/cjs/utils/ReachabilityMonitor/index.js +10 -0
- package/dist/cjs/utils/ReachabilityMonitor/index.js.map +1 -0
- package/dist/cjs/utils/ReachabilityMonitor/index.native.js +12 -0
- package/dist/cjs/utils/ReachabilityMonitor/index.native.js.map +1 -0
- package/{lib → dist/cjs}/utils/ReconnectionMonitor.js +24 -25
- package/dist/cjs/utils/ReconnectionMonitor.js.map +1 -0
- package/dist/cjs/utils/errors/APIError.js +21 -0
- package/dist/cjs/utils/errors/APIError.js.map +1 -0
- package/dist/cjs/utils/errors/assertValidationError.js +19 -0
- package/dist/cjs/utils/errors/assertValidationError.js.map +1 -0
- package/dist/cjs/utils/errors/index.js +14 -0
- package/dist/cjs/utils/errors/index.js.map +1 -0
- package/{lib → dist/cjs}/utils/errors/validation.js +9 -7
- package/dist/cjs/utils/errors/validation.js.map +1 -0
- package/dist/cjs/utils/index.js +11 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/resolveConfig.js +26 -0
- package/dist/cjs/utils/resolveConfig.js.map +1 -0
- package/dist/cjs/utils/resolveLibraryOptions.js +16 -0
- package/dist/cjs/utils/resolveLibraryOptions.js.map +1 -0
- package/{lib-esm → dist/esm}/GraphQLAPI.d.ts +2 -2
- package/dist/esm/GraphQLAPI.mjs +50 -0
- package/dist/esm/GraphQLAPI.mjs.map +1 -0
- package/{lib → dist/esm}/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
- package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs +691 -0
- package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -0
- package/{lib-esm/Providers/constants.js → dist/esm/Providers/constants.mjs} +18 -14
- package/dist/esm/Providers/constants.mjs.map +1 -0
- package/dist/esm/index.mjs +5 -0
- package/dist/esm/index.mjs.map +1 -0
- package/{lib → dist/esm}/internals/InternalGraphQLAPI.d.ts +2 -2
- package/dist/esm/internals/InternalGraphQLAPI.mjs +272 -0
- package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -0
- package/dist/esm/internals/index.mjs +3 -0
- package/dist/esm/internals/index.mjs.map +1 -0
- package/{lib-esm/internals/v6.js → dist/esm/internals/v6.mjs} +10 -6
- package/dist/esm/internals/v6.mjs.map +1 -0
- package/{lib → dist/esm}/types/PubSub.d.ts +2 -2
- package/{lib-esm/types/PubSub.js → dist/esm/types/PubSub.mjs} +5 -2
- package/dist/esm/types/PubSub.mjs.map +1 -0
- package/{lib-esm → dist/esm}/types/index.d.ts +45 -25
- package/{lib-esm/types/index.js → dist/esm/types/index.mjs} +7 -3
- package/dist/esm/types/index.mjs.map +1 -0
- package/{lib-esm → dist/esm}/utils/ConnectionStateMonitor.d.ts +3 -3
- package/{lib-esm/utils/ConnectionStateMonitor.js → dist/esm/utils/ConnectionStateMonitor.mjs} +56 -66
- package/dist/esm/utils/ConnectionStateMonitor.mjs.map +1 -0
- package/dist/esm/utils/ReachabilityMonitor/index.d.ts +1 -0
- package/{lib-esm/utils/ReachabilityMonitor/index.js → dist/esm/utils/ReachabilityMonitor/index.mjs} +6 -2
- package/dist/esm/utils/ReachabilityMonitor/index.mjs.map +1 -0
- package/dist/esm/utils/ReachabilityMonitor/index.native.d.ts +1 -0
- package/dist/esm/utils/ReachabilityMonitor/index.native.mjs +9 -0
- package/dist/esm/utils/ReachabilityMonitor/index.native.mjs.map +1 -0
- package/{lib-esm/utils/ReconnectionMonitor.js → dist/esm/utils/ReconnectionMonitor.mjs} +25 -26
- package/dist/esm/utils/ReconnectionMonitor.mjs.map +1 -0
- package/dist/esm/utils/errors/APIError.mjs +19 -0
- package/dist/esm/utils/errors/APIError.mjs.map +1 -0
- package/dist/esm/utils/errors/assertValidationError.mjs +17 -0
- package/dist/esm/utils/errors/assertValidationError.mjs.map +1 -0
- package/dist/esm/utils/errors/index.mjs +4 -0
- package/dist/esm/utils/errors/index.mjs.map +1 -0
- package/{lib-esm/utils/errors/validation.js → dist/esm/utils/errors/validation.mjs} +9 -7
- package/dist/esm/utils/errors/validation.mjs.map +1 -0
- package/dist/esm/utils/index.mjs +3 -0
- package/dist/esm/utils/index.mjs.map +1 -0
- package/{lib → dist/esm}/utils/resolveConfig.d.ts +1 -1
- package/dist/esm/utils/resolveConfig.mjs +26 -0
- package/dist/esm/utils/resolveConfig.mjs.map +1 -0
- package/{lib-esm → dist/esm}/utils/resolveLibraryOptions.d.ts +2 -2
- package/dist/esm/utils/resolveLibraryOptions.mjs +13 -0
- package/dist/esm/utils/resolveLibraryOptions.mjs.map +1 -0
- package/internals/package.json +4 -4
- package/package.json +48 -26
- package/src/GraphQLAPI.ts +2 -2
- package/src/internals/InternalGraphQLAPI.ts +35 -10
- package/src/types/index.ts +51 -9
- package/lib/GraphQLAPI.d.ts +0 -38
- package/lib/GraphQLAPI.js +0 -57
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.js +0 -805
- package/lib/Providers/constants.d.ts +0 -95
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -12
- package/lib/internals/InternalGraphQLAPI.js +0 -316
- package/lib/internals/index.d.ts +0 -2
- package/lib/internals/index.js +0 -11
- package/lib/internals/v6.d.ts +0 -101
- package/lib/tsconfig.tsbuildinfo +0 -6638
- package/lib/types/index.d.ts +0 -289
- package/lib/utils/ConnectionStateMonitor.d.ts +0 -41
- package/lib/utils/ConnectionStateMonitor.js +0 -144
- package/lib/utils/ReachabilityMonitor/index.d.ts +0 -1
- package/lib/utils/ReachabilityMonitor/index.js +0 -6
- package/lib/utils/ReachabilityMonitor/index.native.d.ts +0 -1
- package/lib/utils/ReachabilityMonitor/index.native.js +0 -10
- package/lib/utils/ReconnectionMonitor.d.ts +0 -29
- package/lib/utils/errors/APIError.d.ts +0 -7
- package/lib/utils/errors/APIError.js +0 -22
- package/lib/utils/errors/assertValidationError.d.ts +0 -5
- package/lib/utils/errors/assertValidationError.js +0 -16
- package/lib/utils/errors/index.d.ts +0 -3
- package/lib/utils/errors/index.js +0 -11
- package/lib/utils/errors/validation.d.ts +0 -7
- package/lib/utils/index.d.ts +0 -2
- package/lib/utils/index.js +0 -8
- package/lib/utils/resolveConfig.js +0 -23
- package/lib/utils/resolveLibraryOptions.d.ts +0 -11
- package/lib/utils/resolveLibraryOptions.js +0 -13
- package/lib-esm/GraphQLAPI.js +0 -55
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +0 -64
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js +0 -803
- package/lib-esm/index.js +0 -5
- package/lib-esm/internals/InternalGraphQLAPI.d.ts +0 -58
- package/lib-esm/internals/InternalGraphQLAPI.js +0 -314
- package/lib-esm/internals/index.js +0 -4
- package/lib-esm/tsconfig.tsbuildinfo +0 -6638
- package/lib-esm/types/PubSub.d.ts +0 -27
- package/lib-esm/utils/ReachabilityMonitor/index.d.ts +0 -1
- package/lib-esm/utils/ReachabilityMonitor/index.native.d.ts +0 -1
- package/lib-esm/utils/ReachabilityMonitor/index.native.js +0 -7
- package/lib-esm/utils/errors/APIError.js +0 -20
- package/lib-esm/utils/errors/assertValidationError.js +0 -13
- package/lib-esm/utils/errors/index.js +0 -5
- package/lib-esm/utils/index.js +0 -4
- package/lib-esm/utils/resolveConfig.d.ts +0 -12
- package/lib-esm/utils/resolveConfig.js +0 -21
- package/lib-esm/utils/resolveLibraryOptions.js +0 -11
- /package/{lib-esm → dist/esm}/Providers/constants.d.ts +0 -0
- /package/{lib-esm → dist/esm}/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/internals/v6.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/ReconnectionMonitor.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/errors/APIError.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/errors/assertValidationError.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/errors/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/errors/validation.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/index.d.ts +0 -0
package/lib/types/index.d.ts
DELETED
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
import { AmplifyClassV6 } from '@aws-amplify/core';
|
|
2
|
-
import { Source, DocumentNode, GraphQLError } from 'graphql';
|
|
3
|
-
export { OperationTypeNode } from 'graphql';
|
|
4
|
-
import { Observable } from 'rxjs';
|
|
5
|
-
import { GraphQLAuthMode, DocumentType } from '@aws-amplify/core/internals/utils';
|
|
6
|
-
export { CONTROL_MSG, ConnectionState } from './PubSub';
|
|
7
|
-
/**
|
|
8
|
-
* Loose/Unknown options for raw GraphQLAPICategory `graphql()`.
|
|
9
|
-
*/
|
|
10
|
-
export interface GraphQLOptions {
|
|
11
|
-
query: string | DocumentNode;
|
|
12
|
-
variables?: Record<string, DocumentType>;
|
|
13
|
-
authMode?: GraphQLAuthMode;
|
|
14
|
-
authToken?: string;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated This property should not be used
|
|
17
|
-
*/
|
|
18
|
-
userAgentSuffix?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface GraphQLResult<T = object> {
|
|
21
|
-
data: T;
|
|
22
|
-
errors?: GraphQLError[];
|
|
23
|
-
extensions?: {
|
|
24
|
-
[key: string]: any;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
declare const queryType: unique symbol;
|
|
28
|
-
export declare type GraphQLQuery<T> = T & {
|
|
29
|
-
readonly [queryType]: 'query';
|
|
30
|
-
};
|
|
31
|
-
export declare type GraphQLSubscription<T> = T & {
|
|
32
|
-
readonly [queryType]: 'subscription';
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Accepts a code generated model type and returns a supertype that
|
|
36
|
-
* can accept return values from the relevant graphql operations.
|
|
37
|
-
*
|
|
38
|
-
* For example:
|
|
39
|
-
*
|
|
40
|
-
* ```typescript
|
|
41
|
-
* import { GraphQLReturnType } from 'aws-amplify/api';
|
|
42
|
-
* import { MyModel } from './API';
|
|
43
|
-
* import { getMyModel } from './graphql/queries';
|
|
44
|
-
*
|
|
45
|
-
* const [item, setItem] = useState<GraphQLReturnType<MyModel>>();
|
|
46
|
-
* setItem(await client.graphql({ query: getMyModel }).data.getMyModel!)
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* Trying to assign the result of a `getMyModel` operation directly to a
|
|
50
|
-
* `MyModel` variables won't necessarily work, because normally-required related
|
|
51
|
-
* models might not be part of the selection set.
|
|
52
|
-
*
|
|
53
|
-
* This util simply makes related model properties optional recursively.
|
|
54
|
-
*/
|
|
55
|
-
export declare type GraphQLReturnType<T> = T extends {} ? {
|
|
56
|
-
[K in keyof T]?: GraphQLReturnType<T[K]>;
|
|
57
|
-
} : T;
|
|
58
|
-
/**
|
|
59
|
-
* Describes a paged list result from AppSync, which can either
|
|
60
|
-
* live at the top query or property (e.g., related model) level.
|
|
61
|
-
*/
|
|
62
|
-
declare type PagedList<T, TYPENAME> = {
|
|
63
|
-
__typename: TYPENAME;
|
|
64
|
-
nextToken?: string | null | undefined;
|
|
65
|
-
items: Array<T>;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Recursively looks through a result type and removes nulls and
|
|
69
|
-
* and undefined from `PagedList` types.
|
|
70
|
-
*
|
|
71
|
-
* Although a graphql response might contain empty values in an
|
|
72
|
-
* array, this will only be the case when we also have errors,
|
|
73
|
-
* which will then be *thrown*.
|
|
74
|
-
*/
|
|
75
|
-
declare type WithListsFixed<T> = T extends PagedList<infer IT, infer NAME> ? PagedList<Exclude<IT, null | undefined>, NAME> : T extends {} ? {
|
|
76
|
-
[K in keyof T]: WithListsFixed<T[K]>;
|
|
77
|
-
} : T;
|
|
78
|
-
/**
|
|
79
|
-
* Returns an updated response type to always return a value.
|
|
80
|
-
*/
|
|
81
|
-
declare type NeverEmpty<T> = {
|
|
82
|
-
[K in keyof T]-?: Exclude<WithListsFixed<T[K]>, undefined | null>;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Replaces all list result types in a query result with types to exclude
|
|
86
|
-
* nulls and undefined from list member unions.
|
|
87
|
-
*
|
|
88
|
-
* If empty members are present, there will also be errors present,
|
|
89
|
-
* and the response will instead be *thrown*.
|
|
90
|
-
*/
|
|
91
|
-
declare type FixedQueryResult<T> = Exclude<T[keyof T], null | undefined> extends PagedList<any, any> ? {
|
|
92
|
-
[K in keyof T]-?: WithListsFixed<Exclude<T[K], null | undefined>>;
|
|
93
|
-
} : T;
|
|
94
|
-
/**
|
|
95
|
-
* The return value from a `graphql({query})` call when `query` is a subscription.
|
|
96
|
-
*
|
|
97
|
-
* ```ts
|
|
98
|
-
* // |-- You are here
|
|
99
|
-
* // v
|
|
100
|
-
* const subResult: GraphqlSubscriptionResult<T> = client.graphql({
|
|
101
|
-
* query: onCreateWidget
|
|
102
|
-
* });
|
|
103
|
-
*
|
|
104
|
-
* const sub = subResult.subscribe({
|
|
105
|
-
* //
|
|
106
|
-
* // |-- You are here
|
|
107
|
-
* // v
|
|
108
|
-
* next(message: GraphqlSubscriptionMessage<OnCreateWidgetSubscription>) {
|
|
109
|
-
* handle(message.value); // <-- type OnCreateWidgetSubscription
|
|
110
|
-
* }
|
|
111
|
-
* })
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
|
-
export declare type GraphqlSubscriptionResult<T> = Observable<GraphqlSubscriptionMessage<T>>;
|
|
115
|
-
/**
|
|
116
|
-
* The shape of messages passed to `next()` from a graphql subscription. E.g.,
|
|
117
|
-
*
|
|
118
|
-
* ```ts
|
|
119
|
-
* const sub = client.graphql({
|
|
120
|
-
* query: onCreateWidget,
|
|
121
|
-
* }).subscribe({
|
|
122
|
-
* //
|
|
123
|
-
* // |-- You are here
|
|
124
|
-
* // v
|
|
125
|
-
* next(message: GraphqlSubscriptionMessage<OnCreateWidgetSubscription>) {
|
|
126
|
-
* handle(message.value); // <-- type OnCreateWidgetSubscription
|
|
127
|
-
* }
|
|
128
|
-
* })
|
|
129
|
-
* ```
|
|
130
|
-
*/
|
|
131
|
-
export declare type GraphqlSubscriptionMessage<T> = {
|
|
132
|
-
data: T;
|
|
133
|
-
};
|
|
134
|
-
export interface AWSAppSyncRealTimeProviderOptions {
|
|
135
|
-
appSyncGraphqlEndpoint?: string;
|
|
136
|
-
authenticationType?: GraphQLAuthMode;
|
|
137
|
-
query?: string;
|
|
138
|
-
variables?: Record<string, unknown>;
|
|
139
|
-
apiKey?: string;
|
|
140
|
-
region?: string;
|
|
141
|
-
graphql_headers?: () => {} | (() => Promise<{}>);
|
|
142
|
-
additionalHeaders?: {
|
|
143
|
-
[key: string]: string;
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
export declare type AWSAppSyncRealTimeProvider = {
|
|
147
|
-
subscribe(options?: AWSAppSyncRealTimeProviderOptions): Observable<Record<string, unknown>>;
|
|
148
|
-
};
|
|
149
|
-
export declare enum GraphQLAuthError {
|
|
150
|
-
NO_API_KEY = "No api-key configured",
|
|
151
|
-
NO_CURRENT_USER = "No current user",
|
|
152
|
-
NO_CREDENTIALS = "No credentials",
|
|
153
|
-
NO_FEDERATED_JWT = "No federated jwt",
|
|
154
|
-
NO_AUTH_TOKEN = "No auth token specified"
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* GraphQLSource or string, the type of the parameter for calling graphql.parse
|
|
158
|
-
* @see: https://graphql.org/graphql-js/language/#parse
|
|
159
|
-
*/
|
|
160
|
-
export declare type GraphQLOperation = Source | string;
|
|
161
|
-
/**
|
|
162
|
-
* API V6 `graphql({options})` type that can leverage branded graphql `query`
|
|
163
|
-
* objects and fallback types.
|
|
164
|
-
*/
|
|
165
|
-
export interface GraphQLOptionsV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string> {
|
|
166
|
-
query: TYPED_GQL_STRING | DocumentNode;
|
|
167
|
-
variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
168
|
-
authMode?: GraphQLAuthMode;
|
|
169
|
-
authToken?: string;
|
|
170
|
-
/**
|
|
171
|
-
* @deprecated This property should not be used
|
|
172
|
-
*/
|
|
173
|
-
userAgentSuffix?: string;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Result type for `graphql()` operations that don't include any specific
|
|
177
|
-
* type information. The result could be either a `Promise` or `Subscription`.
|
|
178
|
-
*
|
|
179
|
-
* Invoking code should either cast the result or use `?` and `!` operators to
|
|
180
|
-
* navigate the result objects.
|
|
181
|
-
*/
|
|
182
|
-
export declare type UnknownGraphQLResponse = Promise<GraphQLResult<any>> | GraphqlSubscriptionResult<any>;
|
|
183
|
-
/**
|
|
184
|
-
* The expected type for `variables` in a V6 `graphql()` operation with
|
|
185
|
-
* respect to the given `FALLBACK_TYPES` and `TYPED_GQL_STRING`.
|
|
186
|
-
*/
|
|
187
|
-
export declare type GraphQLVariablesV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string> = TYPED_GQL_STRING extends GeneratedQuery<infer IN, any> ? IN : TYPED_GQL_STRING extends GeneratedMutation<infer IN, any> ? IN : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, any> ? IN : FALLBACK_TYPES extends GraphQLOperationType<infer IN, any> ? IN : any;
|
|
188
|
-
/**
|
|
189
|
-
* The expected return type with respect to the given `FALLBACK_TYPE`
|
|
190
|
-
* and `TYPED_GQL_STRING`.
|
|
191
|
-
*/
|
|
192
|
-
export declare type GraphQLResponseV6<FALLBACK_TYPE = unknown, TYPED_GQL_STRING extends string = string> = TYPED_GQL_STRING extends GeneratedQuery<infer IN, infer QUERY_OUT> ? Promise<GraphQLResult<FixedQueryResult<QUERY_OUT>>> : TYPED_GQL_STRING extends GeneratedMutation<infer IN, infer MUTATION_OUT> ? Promise<GraphQLResult<NeverEmpty<MUTATION_OUT>>> : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT> ? GraphqlSubscriptionResult<NeverEmpty<SUB_OUT>> : FALLBACK_TYPE extends GraphQLQuery<infer T> ? Promise<GraphQLResult<FALLBACK_TYPE>> : FALLBACK_TYPE extends GraphQLSubscription<infer T> ? GraphqlSubscriptionResult<FALLBACK_TYPE> : FALLBACK_TYPE extends GraphQLOperationType<infer IN, infer CUSTOM_OUT> ? CUSTOM_OUT : UnknownGraphQLResponse;
|
|
193
|
-
/**
|
|
194
|
-
* The shape customers can use to provide `T` to `graphql<T>()` to specify both
|
|
195
|
-
* `IN` and `OUT` types (the type of `variables` and the return type, respectively).
|
|
196
|
-
*
|
|
197
|
-
* I.E.,
|
|
198
|
-
*
|
|
199
|
-
* ```ts
|
|
200
|
-
* type MyVariablesType = { ... };
|
|
201
|
-
* type MyResultType = { ... };
|
|
202
|
-
* type MyOperationType = { variables: MyVariablesType, result: MyResultType };
|
|
203
|
-
*
|
|
204
|
-
* const result: MyResultType = graphql<MyOperationType>("graphql string", {
|
|
205
|
-
* variables: {
|
|
206
|
-
* // MyVariablesType
|
|
207
|
-
* }
|
|
208
|
-
* })
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
export declare type GraphQLOperationType<IN extends {}, OUT extends {}> = {
|
|
212
|
-
variables: IN;
|
|
213
|
-
result: OUT;
|
|
214
|
-
};
|
|
215
|
-
/**
|
|
216
|
-
* Nominal type for branding generated graphql query operation strings with
|
|
217
|
-
* input and output types.
|
|
218
|
-
*
|
|
219
|
-
* E.g.,
|
|
220
|
-
*
|
|
221
|
-
* ```ts
|
|
222
|
-
* export const getWidget = `...` as GeneratedQuery<
|
|
223
|
-
* GetWidgetQueryVariables,
|
|
224
|
-
* GetWidgetQuery
|
|
225
|
-
* >;
|
|
226
|
-
* ```
|
|
227
|
-
*
|
|
228
|
-
* This allows `graphql()` to extract `InputType` and `OutputType` to correctly
|
|
229
|
-
* assign types to the `variables` and result objects.
|
|
230
|
-
*/
|
|
231
|
-
export declare type GeneratedQuery<InputType, OutputType> = string & {
|
|
232
|
-
__generatedQueryInput: InputType;
|
|
233
|
-
__generatedQueryOutput: OutputType;
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Nominal type for branding generated graphql mutation operation strings with
|
|
237
|
-
* input and output types.
|
|
238
|
-
*
|
|
239
|
-
* E.g.,
|
|
240
|
-
*
|
|
241
|
-
* ```ts
|
|
242
|
-
* export const createWidget = `...` as GeneratedQuery<
|
|
243
|
-
* CreateWidgetMutationVariables,
|
|
244
|
-
* CreateWidgetMutation
|
|
245
|
-
* >;
|
|
246
|
-
* ```
|
|
247
|
-
*
|
|
248
|
-
* This allows `graphql()` to extract `InputType` and `OutputType` to correctly
|
|
249
|
-
* assign types to the `variables` and result objects.
|
|
250
|
-
*/
|
|
251
|
-
export declare type GeneratedMutation<InputType, OutputType> = string & {
|
|
252
|
-
__generatedMutationInput: InputType;
|
|
253
|
-
__generatedMutationOutput: OutputType;
|
|
254
|
-
};
|
|
255
|
-
/**
|
|
256
|
-
* Nominal type for branding generated graphql mutation operation strings with
|
|
257
|
-
* input and output types.
|
|
258
|
-
*
|
|
259
|
-
* E.g.,
|
|
260
|
-
*
|
|
261
|
-
* ```ts
|
|
262
|
-
* export const createWidget = `...` as GeneratedMutation<
|
|
263
|
-
* CreateWidgetMutationVariables,
|
|
264
|
-
* CreateWidgetMutation
|
|
265
|
-
* >;
|
|
266
|
-
* ```
|
|
267
|
-
*
|
|
268
|
-
* This allows `graphql()` to extract `InputType` and `OutputType` to correctly
|
|
269
|
-
* assign types to the `variables` and result objects.
|
|
270
|
-
*/
|
|
271
|
-
export declare type GeneratedSubscription<InputType, OutputType> = string & {
|
|
272
|
-
__generatedSubscriptionInput: InputType;
|
|
273
|
-
__generatedSubscriptionOutput: OutputType;
|
|
274
|
-
};
|
|
275
|
-
declare type FilteredKeys<T> = {
|
|
276
|
-
[P in keyof T]: T[P] extends never ? never : P;
|
|
277
|
-
}[keyof T];
|
|
278
|
-
declare type ExcludeNeverFields<O> = {
|
|
279
|
-
[K in FilteredKeys<O>]: O[K];
|
|
280
|
-
};
|
|
281
|
-
export declare const __amplify: unique symbol;
|
|
282
|
-
export declare type V6Client<T extends Record<any, any> = never> = ExcludeNeverFields<{
|
|
283
|
-
[__amplify]: AmplifyClassV6;
|
|
284
|
-
graphql: <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: {
|
|
285
|
-
[key: string]: string;
|
|
286
|
-
} | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
287
|
-
cancel: (promise: Promise<any>, message?: string) => boolean;
|
|
288
|
-
isCancelError: (error: any) => boolean;
|
|
289
|
-
}>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { ConnectionState } from '../types/PubSub';
|
|
3
|
-
declare type LinkedConnectionState = 'connected' | 'disconnected';
|
|
4
|
-
declare type LinkedHealthState = 'healthy' | 'unhealthy';
|
|
5
|
-
declare type LinkedConnectionStates = {
|
|
6
|
-
networkState: LinkedConnectionState;
|
|
7
|
-
connectionState: LinkedConnectionState | 'connecting';
|
|
8
|
-
intendedConnectionState: LinkedConnectionState;
|
|
9
|
-
keepAliveState: LinkedHealthState;
|
|
10
|
-
};
|
|
11
|
-
export declare const CONNECTION_CHANGE: {
|
|
12
|
-
[key in 'KEEP_ALIVE_MISSED' | 'KEEP_ALIVE' | 'CONNECTION_ESTABLISHED' | 'CONNECTION_FAILED' | 'CLOSING_CONNECTION' | 'OPENING_CONNECTION' | 'CLOSED' | 'ONLINE' | 'OFFLINE']: Partial<LinkedConnectionStates>;
|
|
13
|
-
};
|
|
14
|
-
export declare class ConnectionStateMonitor {
|
|
15
|
-
/**
|
|
16
|
-
* @private
|
|
17
|
-
*/
|
|
18
|
-
private _linkedConnectionState;
|
|
19
|
-
private _linkedConnectionStateObservable;
|
|
20
|
-
private _linkedConnectionStateObserver;
|
|
21
|
-
private _networkMonitoringSubscription?;
|
|
22
|
-
private _initialNetworkStateSubscription?;
|
|
23
|
-
constructor();
|
|
24
|
-
/**
|
|
25
|
-
* Turn network state monitoring on if it isn't on already
|
|
26
|
-
*/
|
|
27
|
-
private enableNetworkMonitoring;
|
|
28
|
-
/**
|
|
29
|
-
* Turn network state monitoring off if it isn't off already
|
|
30
|
-
*/
|
|
31
|
-
private disableNetworkMonitoring;
|
|
32
|
-
/**
|
|
33
|
-
* Get the observable that allows us to monitor the connection state
|
|
34
|
-
*
|
|
35
|
-
* @returns {Observable<ConnectionState>} - The observable that emits ConnectionState updates
|
|
36
|
-
*/
|
|
37
|
-
get connectionStateObservable(): Observable<ConnectionState>;
|
|
38
|
-
record(statusUpdates: Partial<LinkedConnectionStates>): void;
|
|
39
|
-
private connectionStatesTranslator;
|
|
40
|
-
}
|
|
41
|
-
export {};
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
var tslib_1 = require("tslib");
|
|
6
|
-
var rxjs_1 = require("rxjs");
|
|
7
|
-
var PubSub_1 = require("../types/PubSub");
|
|
8
|
-
var ReachabilityMonitor_1 = require("./ReachabilityMonitor");
|
|
9
|
-
exports.CONNECTION_CHANGE = {
|
|
10
|
-
KEEP_ALIVE_MISSED: { keepAliveState: 'unhealthy' },
|
|
11
|
-
KEEP_ALIVE: { keepAliveState: 'healthy' },
|
|
12
|
-
CONNECTION_ESTABLISHED: { connectionState: 'connected' },
|
|
13
|
-
CONNECTION_FAILED: {
|
|
14
|
-
intendedConnectionState: 'disconnected',
|
|
15
|
-
connectionState: 'disconnected',
|
|
16
|
-
},
|
|
17
|
-
CLOSING_CONNECTION: { intendedConnectionState: 'disconnected' },
|
|
18
|
-
OPENING_CONNECTION: {
|
|
19
|
-
intendedConnectionState: 'connected',
|
|
20
|
-
connectionState: 'connecting',
|
|
21
|
-
},
|
|
22
|
-
CLOSED: { connectionState: 'disconnected' },
|
|
23
|
-
ONLINE: { networkState: 'connected' },
|
|
24
|
-
OFFLINE: { networkState: 'disconnected' },
|
|
25
|
-
};
|
|
26
|
-
var ConnectionStateMonitor = /** @class */ (function () {
|
|
27
|
-
function ConnectionStateMonitor() {
|
|
28
|
-
var _this = this;
|
|
29
|
-
this._networkMonitoringSubscription = undefined;
|
|
30
|
-
this._linkedConnectionState = {
|
|
31
|
-
networkState: 'connected',
|
|
32
|
-
connectionState: 'disconnected',
|
|
33
|
-
intendedConnectionState: 'disconnected',
|
|
34
|
-
keepAliveState: 'healthy',
|
|
35
|
-
};
|
|
36
|
-
// Attempt to update the state with the current actual network state
|
|
37
|
-
this._initialNetworkStateSubscription = ReachabilityMonitor_1.ReachabilityMonitor().subscribe(function (_a) {
|
|
38
|
-
var online = _a.online;
|
|
39
|
-
var _b;
|
|
40
|
-
_this.record(online ? exports.CONNECTION_CHANGE.ONLINE : exports.CONNECTION_CHANGE.OFFLINE);
|
|
41
|
-
(_b = _this._initialNetworkStateSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
42
|
-
});
|
|
43
|
-
this._linkedConnectionStateObservable =
|
|
44
|
-
new rxjs_1.Observable(function (connectionStateObserver) {
|
|
45
|
-
connectionStateObserver.next(_this._linkedConnectionState);
|
|
46
|
-
_this._linkedConnectionStateObserver = connectionStateObserver;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Turn network state monitoring on if it isn't on already
|
|
51
|
-
*/
|
|
52
|
-
ConnectionStateMonitor.prototype.enableNetworkMonitoring = function () {
|
|
53
|
-
var _this = this;
|
|
54
|
-
var _a;
|
|
55
|
-
// If no initial network state was discovered, stop trying
|
|
56
|
-
(_a = this._initialNetworkStateSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
57
|
-
// Maintain the network state based on the reachability monitor
|
|
58
|
-
if (this._networkMonitoringSubscription === undefined) {
|
|
59
|
-
this._networkMonitoringSubscription = ReachabilityMonitor_1.ReachabilityMonitor().subscribe(function (_a) {
|
|
60
|
-
var online = _a.online;
|
|
61
|
-
_this.record(online ? exports.CONNECTION_CHANGE.ONLINE : exports.CONNECTION_CHANGE.OFFLINE);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Turn network state monitoring off if it isn't off already
|
|
67
|
-
*/
|
|
68
|
-
ConnectionStateMonitor.prototype.disableNetworkMonitoring = function () {
|
|
69
|
-
var _a;
|
|
70
|
-
(_a = this._networkMonitoringSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
71
|
-
this._networkMonitoringSubscription = undefined;
|
|
72
|
-
};
|
|
73
|
-
Object.defineProperty(ConnectionStateMonitor.prototype, "connectionStateObservable", {
|
|
74
|
-
/**
|
|
75
|
-
* Get the observable that allows us to monitor the connection state
|
|
76
|
-
*
|
|
77
|
-
* @returns {Observable<ConnectionState>} - The observable that emits ConnectionState updates
|
|
78
|
-
*/
|
|
79
|
-
get: function () {
|
|
80
|
-
var _this = this;
|
|
81
|
-
var previous;
|
|
82
|
-
// The linked state aggregates state changes to any of the network, connection,
|
|
83
|
-
// intendedConnection and keepAliveHealth. Some states will change these independent
|
|
84
|
-
// states without changing the overall connection state.
|
|
85
|
-
// After translating from linked states to ConnectionState, then remove any duplicates
|
|
86
|
-
return this._linkedConnectionStateObservable
|
|
87
|
-
.pipe(rxjs_1.map(function (value) {
|
|
88
|
-
return _this.connectionStatesTranslator(value);
|
|
89
|
-
}))
|
|
90
|
-
.pipe(rxjs_1.filter(function (current) {
|
|
91
|
-
var toInclude = current !== previous;
|
|
92
|
-
previous = current;
|
|
93
|
-
return toInclude;
|
|
94
|
-
}));
|
|
95
|
-
},
|
|
96
|
-
enumerable: true,
|
|
97
|
-
configurable: true
|
|
98
|
-
});
|
|
99
|
-
/*
|
|
100
|
-
* Updates local connection state and emits the full state to the observer.
|
|
101
|
-
*/
|
|
102
|
-
ConnectionStateMonitor.prototype.record = function (statusUpdates) {
|
|
103
|
-
var _a;
|
|
104
|
-
// Maintain the network monitor
|
|
105
|
-
if (statusUpdates.intendedConnectionState === 'connected') {
|
|
106
|
-
this.enableNetworkMonitoring();
|
|
107
|
-
}
|
|
108
|
-
else if (statusUpdates.intendedConnectionState === 'disconnected') {
|
|
109
|
-
this.disableNetworkMonitoring();
|
|
110
|
-
}
|
|
111
|
-
// Maintain the socket state
|
|
112
|
-
var newSocketStatus = tslib_1.__assign(tslib_1.__assign({}, this._linkedConnectionState), statusUpdates);
|
|
113
|
-
this._linkedConnectionState = tslib_1.__assign({}, newSocketStatus);
|
|
114
|
-
(_a = this._linkedConnectionStateObserver) === null || _a === void 0 ? void 0 : _a.next(this._linkedConnectionState);
|
|
115
|
-
};
|
|
116
|
-
/*
|
|
117
|
-
* Translate the ConnectionState structure into a specific ConnectionState string literal union
|
|
118
|
-
*/
|
|
119
|
-
ConnectionStateMonitor.prototype.connectionStatesTranslator = function (_a) {
|
|
120
|
-
var connectionState = _a.connectionState, networkState = _a.networkState, intendedConnectionState = _a.intendedConnectionState, keepAliveState = _a.keepAliveState;
|
|
121
|
-
if (connectionState === 'connected' && networkState === 'disconnected')
|
|
122
|
-
return PubSub_1.ConnectionState.ConnectedPendingNetwork;
|
|
123
|
-
if (connectionState === 'connected' &&
|
|
124
|
-
intendedConnectionState === 'disconnected')
|
|
125
|
-
return PubSub_1.ConnectionState.ConnectedPendingDisconnect;
|
|
126
|
-
if (connectionState === 'disconnected' &&
|
|
127
|
-
intendedConnectionState === 'connected' &&
|
|
128
|
-
networkState === 'disconnected')
|
|
129
|
-
return PubSub_1.ConnectionState.ConnectionDisruptedPendingNetwork;
|
|
130
|
-
if (connectionState === 'disconnected' &&
|
|
131
|
-
intendedConnectionState === 'connected')
|
|
132
|
-
return PubSub_1.ConnectionState.ConnectionDisrupted;
|
|
133
|
-
if (connectionState === 'connected' && keepAliveState === 'unhealthy')
|
|
134
|
-
return PubSub_1.ConnectionState.ConnectedPendingKeepAlive;
|
|
135
|
-
// All remaining states directly correspond to the connection state
|
|
136
|
-
if (connectionState === 'connecting')
|
|
137
|
-
return PubSub_1.ConnectionState.Connecting;
|
|
138
|
-
if (connectionState === 'disconnected')
|
|
139
|
-
return PubSub_1.ConnectionState.Disconnected;
|
|
140
|
-
return PubSub_1.ConnectionState.Connected;
|
|
141
|
-
};
|
|
142
|
-
return ConnectionStateMonitor;
|
|
143
|
-
}());
|
|
144
|
-
exports.ConnectionStateMonitor = ConnectionStateMonitor;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ReachabilityMonitor: () => any;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
6
|
-
exports.ReachabilityMonitor = function () { return new utils_1.Reachability().networkMonitor(); };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ReachabilityMonitor: () => any;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
|
-
var netinfo_1 = tslib_1.__importDefault(require("@react-native-community/netinfo"));
|
|
8
|
-
exports.ReachabilityMonitor = function () {
|
|
9
|
-
return new utils_1.Reachability().networkMonitor(netinfo_1.default);
|
|
10
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Observer } from 'rxjs';
|
|
2
|
-
export declare enum ReconnectEvent {
|
|
3
|
-
START_RECONNECT = "START_RECONNECT",
|
|
4
|
-
HALT_RECONNECT = "HALT_RECONNECT"
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Captures the reconnect event logic used to determine when to reconnect to PubSub providers.
|
|
8
|
-
* Reconnnect attempts are delayed by 5 seconds to let the interface settle.
|
|
9
|
-
* Attempting to reconnect only once creates unrecoverable states when the network state isn't
|
|
10
|
-
* supported by the browser, so this keeps retrying every minute until halted.
|
|
11
|
-
*/
|
|
12
|
-
export declare class ReconnectionMonitor {
|
|
13
|
-
private reconnectObservers;
|
|
14
|
-
private reconnectIntervalId?;
|
|
15
|
-
private reconnectSetTimeoutId?;
|
|
16
|
-
/**
|
|
17
|
-
* Add reconnect observer to the list of observers to alert on reconnect
|
|
18
|
-
*/
|
|
19
|
-
addObserver(reconnectObserver: Observer<void>): void;
|
|
20
|
-
/**
|
|
21
|
-
* Given a reconnect event, start the appropriate behavior
|
|
22
|
-
*/
|
|
23
|
-
record(event: ReconnectEvent): void;
|
|
24
|
-
/**
|
|
25
|
-
* Complete all reconnect observers
|
|
26
|
-
*/
|
|
27
|
-
close(): void;
|
|
28
|
-
private _triggerReconnect;
|
|
29
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
var tslib_1 = require("tslib");
|
|
6
|
-
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
|
-
/**
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
var APIError = /** @class */ (function (_super) {
|
|
11
|
-
tslib_1.__extends(APIError, _super);
|
|
12
|
-
function APIError(params) {
|
|
13
|
-
var _this = _super.call(this, params) || this;
|
|
14
|
-
// Hack for making the custom error class work when transpiled to es5
|
|
15
|
-
// TODO: Delete the following 2 lines after we change the build target to >= es2015
|
|
16
|
-
_this.constructor = APIError;
|
|
17
|
-
Object.setPrototypeOf(_this, APIError.prototype);
|
|
18
|
-
return _this;
|
|
19
|
-
}
|
|
20
|
-
return APIError;
|
|
21
|
-
}(utils_1.AmplifyError));
|
|
22
|
-
exports.APIError = APIError;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
var APIError_1 = require("./APIError");
|
|
6
|
-
var validation_1 = require("./validation");
|
|
7
|
-
/**
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
function assertValidationError(assertion, name) {
|
|
11
|
-
var _a = validation_1.validationErrorMap[name], message = _a.message, recoverySuggestion = _a.recoverySuggestion;
|
|
12
|
-
if (!assertion) {
|
|
13
|
-
throw new APIError_1.APIError({ name: name, message: message, recoverySuggestion: recoverySuggestion });
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.assertValidationError = assertValidationError;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
var APIError_1 = require("./APIError");
|
|
6
|
-
exports.APIError = APIError_1.APIError;
|
|
7
|
-
var assertValidationError_1 = require("./assertValidationError");
|
|
8
|
-
exports.assertValidationError = assertValidationError_1.assertValidationError;
|
|
9
|
-
var validation_1 = require("./validation");
|
|
10
|
-
exports.APIValidationErrorCode = validation_1.APIValidationErrorCode;
|
|
11
|
-
exports.validationErrorMap = validation_1.validationErrorMap;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AmplifyErrorMap } from '@aws-amplify/core/internals/utils';
|
|
2
|
-
export declare enum APIValidationErrorCode {
|
|
3
|
-
NoAuthSession = "NoAuthSession",
|
|
4
|
-
NoRegion = "NoRegion",
|
|
5
|
-
NoCustomEndpoint = "NoCustomEndpoint"
|
|
6
|
-
}
|
|
7
|
-
export declare const validationErrorMap: AmplifyErrorMap<APIValidationErrorCode>;
|
package/lib/utils/index.d.ts
DELETED
package/lib/utils/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
var resolveConfig_1 = require("./resolveConfig");
|
|
6
|
-
exports.resolveConfig = resolveConfig_1.resolveConfig;
|
|
7
|
-
var resolveLibraryOptions_1 = require("./resolveLibraryOptions");
|
|
8
|
-
exports.resolveLibraryOptions = resolveLibraryOptions_1.resolveLibraryOptions;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
var errors_1 = require("./errors");
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
exports.resolveConfig = function (amplify) {
|
|
10
|
-
var _a, _b;
|
|
11
|
-
var _c = (_b = (_a = amplify.getConfig().API) === null || _a === void 0 ? void 0 : _a.GraphQL) !== null && _b !== void 0 ? _b : {}, apiKey = _c.apiKey, customEndpoint = _c.customEndpoint, customEndpointRegion = _c.customEndpointRegion, defaultAuthMode = _c.defaultAuthMode, endpoint = _c.endpoint, region = _c.region;
|
|
12
|
-
// TODO: re-enable when working in all test environments:
|
|
13
|
-
// assertValidationError(!!endpoint, APIValidationErrorCode.NoEndpoint);
|
|
14
|
-
errors_1.assertValidationError(!(!customEndpoint && customEndpointRegion), errors_1.APIValidationErrorCode.NoCustomEndpoint);
|
|
15
|
-
return {
|
|
16
|
-
apiKey: apiKey,
|
|
17
|
-
customEndpoint: customEndpoint,
|
|
18
|
-
customEndpointRegion: customEndpointRegion,
|
|
19
|
-
defaultAuthMode: defaultAuthMode,
|
|
20
|
-
endpoint: endpoint,
|
|
21
|
-
region: region,
|
|
22
|
-
};
|
|
23
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AmplifyClassV6 } from '@aws-amplify/core';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export declare const resolveLibraryOptions: (amplify: AmplifyClassV6) => {
|
|
6
|
-
headers: ((options: {
|
|
7
|
-
query: string;
|
|
8
|
-
variables?: Record<string, import("@aws-amplify/core/lib-esm/libraryUtils").DocumentType> | undefined;
|
|
9
|
-
}) => Promise<Record<string, string>>) | undefined;
|
|
10
|
-
withCredentials: boolean | undefined;
|
|
11
|
-
};
|