@aws-amplify/api-graphql 4.0.1-unstable.cfbde4c.0 → 4.0.1
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/{lib → dist/cjs}/GraphQLAPI.js +8 -4
- package/dist/cjs/GraphQLAPI.js.map +1 -0
- package/{lib → dist/cjs}/Providers/AWSAppSyncRealTimeProvider/index.js +11 -8
- 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/{lib → dist/cjs}/internals/InternalGraphQLAPI.js +18 -18
- 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 +4 -1
- 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/{lib → dist/cjs}/utils/ConnectionStateMonitor.js +8 -5
- package/dist/cjs/utils/ConnectionStateMonitor.js.map +1 -0
- package/{lib → dist/cjs}/utils/ReachabilityMonitor/index.js +6 -2
- package/dist/cjs/utils/ReachabilityMonitor/index.js.map +1 -0
- package/{lib → dist/cjs}/utils/ReachabilityMonitor/index.native.js +6 -2
- package/dist/cjs/utils/ReachabilityMonitor/index.native.js.map +1 -0
- package/{lib → dist/cjs}/utils/ReconnectionMonitor.js +4 -1
- package/dist/cjs/utils/ReconnectionMonitor.js.map +1 -0
- package/{lib → dist/cjs}/utils/errors/APIError.js +4 -1
- package/dist/cjs/utils/errors/APIError.js.map +1 -0
- package/{lib → dist/cjs}/utils/errors/assertValidationError.js +4 -1
- 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 +4 -1
- 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/{lib → dist/cjs}/utils/resolveConfig.js +7 -3
- package/dist/cjs/utils/resolveConfig.js.map +1 -0
- package/{lib-esm → dist/cjs}/utils/resolveLibraryOptions.js +7 -1
- package/dist/cjs/utils/resolveLibraryOptions.js.map +1 -0
- package/{lib-esm → dist/esm}/GraphQLAPI.d.ts +2 -2
- package/{lib-esm/GraphQLAPI.js → dist/esm/GraphQLAPI.mjs} +8 -4
- package/dist/esm/GraphQLAPI.mjs.map +1 -0
- package/{lib → dist/esm}/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
- package/{lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js → dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs} +13 -9
- 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 +1 -1
- package/{lib-esm/internals/InternalGraphQLAPI.js → dist/esm/internals/InternalGraphQLAPI.mjs} +19 -18
- 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} +9 -5
- 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 +25 -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} +9 -5
- 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} +7 -3
- package/dist/esm/utils/ReconnectionMonitor.mjs.map +1 -0
- package/{lib-esm/utils/errors/APIError.js → dist/esm/utils/errors/APIError.mjs} +6 -2
- package/dist/esm/utils/errors/APIError.mjs.map +1 -0
- package/{lib-esm/utils/errors/assertValidationError.js → dist/esm/utils/errors/assertValidationError.mjs} +7 -3
- 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} +5 -2
- 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/{lib-esm/utils/resolveConfig.js → dist/esm/utils/resolveConfig.mjs} +8 -2
- package/dist/esm/utils/resolveConfig.mjs.map +1 -0
- package/{lib → dist/esm}/utils/resolveLibraryOptions.d.ts +2 -2
- package/{lib/utils/resolveLibraryOptions.js → dist/esm/utils/resolveLibraryOptions.mjs} +4 -3
- package/dist/esm/utils/resolveLibraryOptions.mjs.map +1 -0
- package/internals/package.json +4 -4
- package/package.json +49 -25
- package/src/GraphQLAPI.ts +1 -1
- package/lib/GraphQLAPI.d.ts +0 -38
- package/lib/Providers/constants.d.ts +0 -95
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -12
- 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 -6813
- package/lib/types/index.d.ts +0 -309
- package/lib/utils/ConnectionStateMonitor.d.ts +0 -41
- package/lib/utils/ReachabilityMonitor/index.d.ts +0 -1
- package/lib/utils/ReachabilityMonitor/index.native.d.ts +0 -1
- package/lib/utils/ReconnectionMonitor.d.ts +0 -29
- package/lib/utils/errors/APIError.d.ts +0 -7
- package/lib/utils/errors/assertValidationError.d.ts +0 -5
- 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-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +0 -64
- package/lib-esm/index.js +0 -5
- package/lib-esm/internals/InternalGraphQLAPI.d.ts +0 -58
- package/lib-esm/internals/index.js +0 -4
- package/lib-esm/tsconfig.tsbuildinfo +0 -6813
- 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 -5
- 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/resolveLibraryOptions.d.ts +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,309 +0,0 @@
|
|
|
1
|
-
import { AmplifyClassV6, ResourcesConfig } 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
|
-
import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
|
|
7
|
-
export { CONTROL_MSG, ConnectionState } from './PubSub';
|
|
8
|
-
/**
|
|
9
|
-
* Loose/Unknown options for raw GraphQLAPICategory `graphql()`.
|
|
10
|
-
*/
|
|
11
|
-
export interface GraphQLOptions {
|
|
12
|
-
query: string | DocumentNode;
|
|
13
|
-
variables?: Record<string, DocumentType>;
|
|
14
|
-
authMode?: GraphQLAuthMode;
|
|
15
|
-
authToken?: string;
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated This property should not be used
|
|
18
|
-
*/
|
|
19
|
-
userAgentSuffix?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface GraphQLResult<T = object> {
|
|
22
|
-
data: T;
|
|
23
|
-
errors?: GraphQLError[];
|
|
24
|
-
extensions?: {
|
|
25
|
-
[key: string]: any;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
declare const queryType: unique symbol;
|
|
29
|
-
export declare type GraphQLQuery<T> = T & {
|
|
30
|
-
readonly [queryType]: 'query';
|
|
31
|
-
};
|
|
32
|
-
export declare type GraphQLSubscription<T> = T & {
|
|
33
|
-
readonly [queryType]: 'subscription';
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Accepts a code generated model type and returns a supertype that
|
|
37
|
-
* can accept return values from the relevant graphql operations.
|
|
38
|
-
*
|
|
39
|
-
* For example:
|
|
40
|
-
*
|
|
41
|
-
* ```typescript
|
|
42
|
-
* import { GraphQLReturnType } from 'aws-amplify/api';
|
|
43
|
-
* import { MyModel } from './API';
|
|
44
|
-
* import { getMyModel } from './graphql/queries';
|
|
45
|
-
*
|
|
46
|
-
* const [item, setItem] = useState<GraphQLReturnType<MyModel>>();
|
|
47
|
-
* setItem(await client.graphql({ query: getMyModel }).data.getMyModel!)
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* Trying to assign the result of a `getMyModel` operation directly to a
|
|
51
|
-
* `MyModel` variables won't necessarily work, because normally-required related
|
|
52
|
-
* models might not be part of the selection set.
|
|
53
|
-
*
|
|
54
|
-
* This util simply makes related model properties optional recursively.
|
|
55
|
-
*/
|
|
56
|
-
export declare type GraphQLReturnType<T> = T extends {} ? {
|
|
57
|
-
[K in keyof T]?: GraphQLReturnType<T[K]>;
|
|
58
|
-
} : T;
|
|
59
|
-
/**
|
|
60
|
-
* Describes a paged list result from AppSync, which can either
|
|
61
|
-
* live at the top query or property (e.g., related model) level.
|
|
62
|
-
*/
|
|
63
|
-
declare type PagedList<T, TYPENAME> = {
|
|
64
|
-
__typename: TYPENAME;
|
|
65
|
-
nextToken?: string | null | undefined;
|
|
66
|
-
items: Array<T>;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Recursively looks through a result type and removes nulls and
|
|
70
|
-
* and undefined from `PagedList` types.
|
|
71
|
-
*
|
|
72
|
-
* Although a graphql response might contain empty values in an
|
|
73
|
-
* array, this will only be the case when we also have errors,
|
|
74
|
-
* which will then be *thrown*.
|
|
75
|
-
*/
|
|
76
|
-
declare type WithListsFixed<T> = T extends PagedList<infer IT, infer NAME> ? PagedList<Exclude<IT, null | undefined>, NAME> : T extends {} ? {
|
|
77
|
-
[K in keyof T]: WithListsFixed<T[K]>;
|
|
78
|
-
} : T;
|
|
79
|
-
/**
|
|
80
|
-
* Returns an updated response type to always return a value.
|
|
81
|
-
*/
|
|
82
|
-
declare type NeverEmpty<T> = {
|
|
83
|
-
[K in keyof T]-?: Exclude<WithListsFixed<T[K]>, undefined | null>;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Replaces all list result types in a query result with types to exclude
|
|
87
|
-
* nulls and undefined from list member unions.
|
|
88
|
-
*
|
|
89
|
-
* If empty members are present, there will also be errors present,
|
|
90
|
-
* and the response will instead be *thrown*.
|
|
91
|
-
*/
|
|
92
|
-
declare type FixedQueryResult<T> = Exclude<T[keyof T], null | undefined> extends PagedList<any, any> ? {
|
|
93
|
-
[K in keyof T]-?: WithListsFixed<Exclude<T[K], null | undefined>>;
|
|
94
|
-
} : T;
|
|
95
|
-
/**
|
|
96
|
-
* The return value from a `graphql({query})` call when `query` is a subscription.
|
|
97
|
-
*
|
|
98
|
-
* ```ts
|
|
99
|
-
* // |-- You are here
|
|
100
|
-
* // v
|
|
101
|
-
* const subResult: GraphqlSubscriptionResult<T> = client.graphql({
|
|
102
|
-
* query: onCreateWidget
|
|
103
|
-
* });
|
|
104
|
-
*
|
|
105
|
-
* const sub = subResult.subscribe({
|
|
106
|
-
* //
|
|
107
|
-
* // |-- You are here
|
|
108
|
-
* // v
|
|
109
|
-
* next(message: GraphqlSubscriptionMessage<OnCreateWidgetSubscription>) {
|
|
110
|
-
* handle(message.value); // <-- type OnCreateWidgetSubscription
|
|
111
|
-
* }
|
|
112
|
-
* })
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
export declare type GraphqlSubscriptionResult<T> = Observable<GraphqlSubscriptionMessage<T>>;
|
|
116
|
-
/**
|
|
117
|
-
* The shape of messages passed to `next()` from a graphql subscription. E.g.,
|
|
118
|
-
*
|
|
119
|
-
* ```ts
|
|
120
|
-
* const sub = client.graphql({
|
|
121
|
-
* query: onCreateWidget,
|
|
122
|
-
* }).subscribe({
|
|
123
|
-
* //
|
|
124
|
-
* // |-- You are here
|
|
125
|
-
* // v
|
|
126
|
-
* next(message: GraphqlSubscriptionMessage<OnCreateWidgetSubscription>) {
|
|
127
|
-
* handle(message.value); // <-- type OnCreateWidgetSubscription
|
|
128
|
-
* }
|
|
129
|
-
* })
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
export declare type GraphqlSubscriptionMessage<T> = {
|
|
133
|
-
data: T;
|
|
134
|
-
};
|
|
135
|
-
export interface AWSAppSyncRealTimeProviderOptions {
|
|
136
|
-
appSyncGraphqlEndpoint?: string;
|
|
137
|
-
authenticationType?: GraphQLAuthMode;
|
|
138
|
-
query?: string;
|
|
139
|
-
variables?: Record<string, unknown>;
|
|
140
|
-
apiKey?: string;
|
|
141
|
-
region?: string;
|
|
142
|
-
graphql_headers?: () => {} | (() => Promise<{}>);
|
|
143
|
-
additionalHeaders?: {
|
|
144
|
-
[key: string]: string;
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
export declare type AWSAppSyncRealTimeProvider = {
|
|
148
|
-
subscribe(options?: AWSAppSyncRealTimeProviderOptions): Observable<Record<string, unknown>>;
|
|
149
|
-
};
|
|
150
|
-
export declare enum GraphQLAuthError {
|
|
151
|
-
NO_API_KEY = "No api-key configured",
|
|
152
|
-
NO_CURRENT_USER = "No current user",
|
|
153
|
-
NO_CREDENTIALS = "No credentials",
|
|
154
|
-
NO_FEDERATED_JWT = "No federated jwt",
|
|
155
|
-
NO_AUTH_TOKEN = "No auth token specified"
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* GraphQLSource or string, the type of the parameter for calling graphql.parse
|
|
159
|
-
* @see: https://graphql.org/graphql-js/language/#parse
|
|
160
|
-
*/
|
|
161
|
-
export declare type GraphQLOperation = Source | string;
|
|
162
|
-
/**
|
|
163
|
-
* API V6 `graphql({options})` type that can leverage branded graphql `query`
|
|
164
|
-
* objects and fallback types.
|
|
165
|
-
*/
|
|
166
|
-
export interface GraphQLOptionsV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string> {
|
|
167
|
-
query: TYPED_GQL_STRING | DocumentNode;
|
|
168
|
-
variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
169
|
-
authMode?: GraphQLAuthMode;
|
|
170
|
-
authToken?: string;
|
|
171
|
-
/**
|
|
172
|
-
* @deprecated This property should not be used
|
|
173
|
-
*/
|
|
174
|
-
userAgentSuffix?: string;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Result type for `graphql()` operations that don't include any specific
|
|
178
|
-
* type information. The result could be either a `Promise` or `Subscription`.
|
|
179
|
-
*
|
|
180
|
-
* Invoking code should either cast the result or use `?` and `!` operators to
|
|
181
|
-
* navigate the result objects.
|
|
182
|
-
*/
|
|
183
|
-
export declare type UnknownGraphQLResponse = Promise<GraphQLResult<any>> | GraphqlSubscriptionResult<any>;
|
|
184
|
-
/**
|
|
185
|
-
* The expected type for `variables` in a V6 `graphql()` operation with
|
|
186
|
-
* respect to the given `FALLBACK_TYPES` and `TYPED_GQL_STRING`.
|
|
187
|
-
*/
|
|
188
|
-
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;
|
|
189
|
-
/**
|
|
190
|
-
* The expected return type with respect to the given `FALLBACK_TYPE`
|
|
191
|
-
* and `TYPED_GQL_STRING`.
|
|
192
|
-
*/
|
|
193
|
-
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;
|
|
194
|
-
/**
|
|
195
|
-
* The shape customers can use to provide `T` to `graphql<T>()` to specify both
|
|
196
|
-
* `IN` and `OUT` types (the type of `variables` and the return type, respectively).
|
|
197
|
-
*
|
|
198
|
-
* I.E.,
|
|
199
|
-
*
|
|
200
|
-
* ```ts
|
|
201
|
-
* type MyVariablesType = { ... };
|
|
202
|
-
* type MyResultType = { ... };
|
|
203
|
-
* type MyOperationType = { variables: MyVariablesType, result: MyResultType };
|
|
204
|
-
*
|
|
205
|
-
* const result: MyResultType = graphql<MyOperationType>("graphql string", {
|
|
206
|
-
* variables: {
|
|
207
|
-
* // MyVariablesType
|
|
208
|
-
* }
|
|
209
|
-
* })
|
|
210
|
-
* ```
|
|
211
|
-
*/
|
|
212
|
-
export declare type GraphQLOperationType<IN extends {}, OUT extends {}> = {
|
|
213
|
-
variables: IN;
|
|
214
|
-
result: OUT;
|
|
215
|
-
};
|
|
216
|
-
/**
|
|
217
|
-
* Nominal type for branding generated graphql query operation strings with
|
|
218
|
-
* input and output types.
|
|
219
|
-
*
|
|
220
|
-
* E.g.,
|
|
221
|
-
*
|
|
222
|
-
* ```ts
|
|
223
|
-
* export const getWidget = `...` as GeneratedQuery<
|
|
224
|
-
* GetWidgetQueryVariables,
|
|
225
|
-
* GetWidgetQuery
|
|
226
|
-
* >;
|
|
227
|
-
* ```
|
|
228
|
-
*
|
|
229
|
-
* This allows `graphql()` to extract `InputType` and `OutputType` to correctly
|
|
230
|
-
* assign types to the `variables` and result objects.
|
|
231
|
-
*/
|
|
232
|
-
export declare type GeneratedQuery<InputType, OutputType> = string & {
|
|
233
|
-
__generatedQueryInput: InputType;
|
|
234
|
-
__generatedQueryOutput: OutputType;
|
|
235
|
-
};
|
|
236
|
-
/**
|
|
237
|
-
* Nominal type for branding generated graphql mutation operation strings with
|
|
238
|
-
* input and output types.
|
|
239
|
-
*
|
|
240
|
-
* E.g.,
|
|
241
|
-
*
|
|
242
|
-
* ```ts
|
|
243
|
-
* export const createWidget = `...` as GeneratedQuery<
|
|
244
|
-
* CreateWidgetMutationVariables,
|
|
245
|
-
* CreateWidgetMutation
|
|
246
|
-
* >;
|
|
247
|
-
* ```
|
|
248
|
-
*
|
|
249
|
-
* This allows `graphql()` to extract `InputType` and `OutputType` to correctly
|
|
250
|
-
* assign types to the `variables` and result objects.
|
|
251
|
-
*/
|
|
252
|
-
export declare type GeneratedMutation<InputType, OutputType> = string & {
|
|
253
|
-
__generatedMutationInput: InputType;
|
|
254
|
-
__generatedMutationOutput: OutputType;
|
|
255
|
-
};
|
|
256
|
-
/**
|
|
257
|
-
* Nominal type for branding generated graphql mutation operation strings with
|
|
258
|
-
* input and output types.
|
|
259
|
-
*
|
|
260
|
-
* E.g.,
|
|
261
|
-
*
|
|
262
|
-
* ```ts
|
|
263
|
-
* export const createWidget = `...` as GeneratedMutation<
|
|
264
|
-
* CreateWidgetMutationVariables,
|
|
265
|
-
* CreateWidgetMutation
|
|
266
|
-
* >;
|
|
267
|
-
* ```
|
|
268
|
-
*
|
|
269
|
-
* This allows `graphql()` to extract `InputType` and `OutputType` to correctly
|
|
270
|
-
* assign types to the `variables` and result objects.
|
|
271
|
-
*/
|
|
272
|
-
export declare type GeneratedSubscription<InputType, OutputType> = string & {
|
|
273
|
-
__generatedSubscriptionInput: InputType;
|
|
274
|
-
__generatedSubscriptionOutput: OutputType;
|
|
275
|
-
};
|
|
276
|
-
declare type FilteredKeys<T> = {
|
|
277
|
-
[P in keyof T]: T[P] extends never ? never : P;
|
|
278
|
-
}[keyof T];
|
|
279
|
-
declare type ExcludeNeverFields<O> = {
|
|
280
|
-
[K in FilteredKeys<O>]: O[K];
|
|
281
|
-
};
|
|
282
|
-
export declare const __amplify: unique symbol;
|
|
283
|
-
export declare type V6Client<T extends Record<any, any> = never> = ExcludeNeverFields<{
|
|
284
|
-
[__amplify]: AmplifyClassV6;
|
|
285
|
-
graphql: GraphQLMethod;
|
|
286
|
-
cancel: (promise: Promise<any>, message?: string) => boolean;
|
|
287
|
-
isCancelError: (error: any) => boolean;
|
|
288
|
-
}>;
|
|
289
|
-
export declare type V6ClientSSR<T extends Record<any, any> = never> = ExcludeNeverFields<{
|
|
290
|
-
[__amplify]: AmplifyClassV6;
|
|
291
|
-
graphql: GraphQLMethodSSR;
|
|
292
|
-
cancel: (promise: Promise<any>, message?: string) => boolean;
|
|
293
|
-
isCancelError: (error: any) => boolean;
|
|
294
|
-
}>;
|
|
295
|
-
export declare type GraphQLMethod = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: {
|
|
296
|
-
[key: string]: string;
|
|
297
|
-
} | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
298
|
-
export declare type GraphQLMethodSSR = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(contextSpec: AmplifyServer.ContextSpec, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: {
|
|
299
|
-
[key: string]: string;
|
|
300
|
-
} | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
301
|
-
/**
|
|
302
|
-
* @private
|
|
303
|
-
*
|
|
304
|
-
* The knobs available for configuring `server/generateClient` internally.
|
|
305
|
-
*/
|
|
306
|
-
export declare type ServerClientGenerationParams = {
|
|
307
|
-
amplify: null | ((fn: (amplify: any) => Promise<any>) => Promise<AmplifyClassV6>);
|
|
308
|
-
config: ResourcesConfig;
|
|
309
|
-
};
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export declare const ReachabilityMonitor: () => any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ReachabilityMonitor: () => any;
|
|
@@ -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,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,64 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { GraphQLAuthMode, CustomUserAgentDetails, DocumentType } from '@aws-amplify/core/internals/utils';
|
|
3
|
-
import { PubSubContentObserver } from '../../types/PubSub';
|
|
4
|
-
import { SUBSCRIPTION_STATUS } from '../constants';
|
|
5
|
-
export declare type ObserverQuery = {
|
|
6
|
-
observer: PubSubContentObserver;
|
|
7
|
-
query: string;
|
|
8
|
-
variables: Record<string, DocumentType>;
|
|
9
|
-
subscriptionState: SUBSCRIPTION_STATUS;
|
|
10
|
-
subscriptionReadyCallback?: Function;
|
|
11
|
-
subscriptionFailedCallback?: Function;
|
|
12
|
-
startAckTimeoutId?: ReturnType<typeof setTimeout>;
|
|
13
|
-
};
|
|
14
|
-
export interface AWSAppSyncRealTimeProviderOptions {
|
|
15
|
-
appSyncGraphqlEndpoint?: string;
|
|
16
|
-
authenticationType?: GraphQLAuthMode;
|
|
17
|
-
query?: string;
|
|
18
|
-
variables?: Record<string, DocumentType>;
|
|
19
|
-
apiKey?: string;
|
|
20
|
-
region?: string;
|
|
21
|
-
graphql_headers?: () => {} | (() => Promise<{}>);
|
|
22
|
-
additionalHeaders?: {
|
|
23
|
-
[key: string]: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export declare class AWSAppSyncRealTimeProvider {
|
|
27
|
-
private awsRealTimeSocket?;
|
|
28
|
-
private socketStatus;
|
|
29
|
-
private keepAliveTimeoutId?;
|
|
30
|
-
private keepAliveTimeout;
|
|
31
|
-
private keepAliveAlertTimeoutId?;
|
|
32
|
-
private subscriptionObserverMap;
|
|
33
|
-
private promiseArray;
|
|
34
|
-
private connectionState;
|
|
35
|
-
private readonly connectionStateMonitor;
|
|
36
|
-
private readonly reconnectionMonitor;
|
|
37
|
-
private connectionStateMonitorSubscription;
|
|
38
|
-
constructor(options?: AWSAppSyncRealTimeProviderOptions);
|
|
39
|
-
/**
|
|
40
|
-
* Mark the socket closed and release all active listeners
|
|
41
|
-
*/
|
|
42
|
-
close(): void;
|
|
43
|
-
getNewWebSocket(url: string, protocol: string): WebSocket;
|
|
44
|
-
getProviderName(): string;
|
|
45
|
-
private isCustomDomain;
|
|
46
|
-
subscribe(options?: AWSAppSyncRealTimeProviderOptions, customUserAgentDetails?: CustomUserAgentDetails): Observable<Record<string, unknown>>;
|
|
47
|
-
private _startSubscriptionWithAWSAppSyncRealTime;
|
|
48
|
-
private _logStartSubscriptionError;
|
|
49
|
-
private _waitForSubscriptionToBeConnected;
|
|
50
|
-
private _sendUnsubscriptionMessage;
|
|
51
|
-
private _removeSubscriptionObserver;
|
|
52
|
-
private _closeSocketIfRequired;
|
|
53
|
-
private _handleIncomingSubscriptionMessage;
|
|
54
|
-
private _errorDisconnect;
|
|
55
|
-
private _timeoutStartSubscriptionAck;
|
|
56
|
-
private _initializeWebSocketConnection;
|
|
57
|
-
private _initializeRetryableHandshake;
|
|
58
|
-
private _initializeHandshake;
|
|
59
|
-
private _awsRealTimeHeaderBasedAuth;
|
|
60
|
-
private _awsAuthTokenHeader;
|
|
61
|
-
private _awsRealTimeApiKeyHeader;
|
|
62
|
-
private _awsRealTimeIAMHeader;
|
|
63
|
-
private _customAuthHeader;
|
|
64
|
-
}
|
package/lib-esm/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
export { GraphQLAPI, GraphQLAPIClass, graphqlOperation } from './GraphQLAPI';
|
|
4
|
-
export * from './types';
|
|
5
|
-
export { CONNECTION_STATE_CHANGE } from './Providers/constants';
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { OperationTypeNode } from 'graphql';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { AmplifyClassV6 } from '@aws-amplify/core';
|
|
4
|
-
import { CustomUserAgentDetails } from '@aws-amplify/core/internals/utils';
|
|
5
|
-
import { GraphQLResult, GraphQLOperation, GraphQLOptions } from '../types';
|
|
6
|
-
export declare const graphqlOperation: (query: any, variables?: {}, authToken?: string | undefined) => {
|
|
7
|
-
query: any;
|
|
8
|
-
variables: {};
|
|
9
|
-
authToken: string | undefined;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Export Cloud Logic APIs
|
|
13
|
-
*/
|
|
14
|
-
export declare class InternalGraphQLAPIClass {
|
|
15
|
-
/**
|
|
16
|
-
* @private
|
|
17
|
-
*/
|
|
18
|
-
private _options;
|
|
19
|
-
private appSyncRealTime;
|
|
20
|
-
private _api;
|
|
21
|
-
/**
|
|
22
|
-
* Initialize GraphQL API with AWS configuration
|
|
23
|
-
* @param {Object} options - Configuration object for API
|
|
24
|
-
*/
|
|
25
|
-
constructor(options: any);
|
|
26
|
-
getModuleName(): string;
|
|
27
|
-
private _headerBasedAuth;
|
|
28
|
-
/**
|
|
29
|
-
* to get the operation type
|
|
30
|
-
* @param operation
|
|
31
|
-
*/
|
|
32
|
-
getGraphqlOperationType(operation: GraphQLOperation): OperationTypeNode;
|
|
33
|
-
/**
|
|
34
|
-
* Executes a GraphQL operation
|
|
35
|
-
*
|
|
36
|
-
* @param options - GraphQL Options
|
|
37
|
-
* @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config
|
|
38
|
-
* @returns An Observable if the query is a subscription query, else a promise of the graphql result.
|
|
39
|
-
*/
|
|
40
|
-
graphql<T = any>(amplify: AmplifyClassV6 | ((fn: (amplify: any) => Promise<any>) => Promise<AmplifyClassV6>), { query: paramQuery, variables, authMode, authToken }: GraphQLOptions, additionalHeaders?: {
|
|
41
|
-
[key: string]: string;
|
|
42
|
-
}, customUserAgentDetails?: CustomUserAgentDetails): Observable<GraphQLResult<T>> | Promise<GraphQLResult<T>>;
|
|
43
|
-
private _graphql;
|
|
44
|
-
/**
|
|
45
|
-
* Checks to see if an error thrown is from an api request cancellation
|
|
46
|
-
* @param {any} error - Any error
|
|
47
|
-
* @return {boolean} - A boolean indicating if the error was from an api request cancellation
|
|
48
|
-
*/
|
|
49
|
-
isCancelError(error: any): boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Cancels an inflight request. Only applicable for graphql queries and mutations
|
|
52
|
-
* @param {any} request - request to cancel
|
|
53
|
-
* @returns - A boolean indicating if the request was cancelled
|
|
54
|
-
*/
|
|
55
|
-
cancel(request: Promise<any>, message?: string): boolean;
|
|
56
|
-
private _graphqlSubscribe;
|
|
57
|
-
}
|
|
58
|
-
export declare const InternalGraphQLAPI: InternalGraphQLAPIClass;
|