@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.
Files changed (136) hide show
  1. package/{lib → dist/cjs}/GraphQLAPI.js +8 -4
  2. package/dist/cjs/GraphQLAPI.js.map +1 -0
  3. package/{lib → dist/cjs}/Providers/AWSAppSyncRealTimeProvider/index.js +11 -8
  4. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -0
  5. package/{lib → dist/cjs}/Providers/constants.js +8 -8
  6. package/dist/cjs/Providers/constants.js.map +1 -0
  7. package/dist/cjs/index.js +15 -0
  8. package/dist/cjs/index.js.map +1 -0
  9. package/{lib → dist/cjs}/internals/InternalGraphQLAPI.js +18 -18
  10. package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -0
  11. package/dist/cjs/internals/index.js +14 -0
  12. package/dist/cjs/internals/index.js.map +1 -0
  13. package/{lib → dist/cjs}/internals/v6.js +4 -1
  14. package/dist/cjs/internals/v6.js.map +1 -0
  15. package/{lib → dist/cjs}/types/PubSub.js +6 -6
  16. package/dist/cjs/types/PubSub.js.map +1 -0
  17. package/{lib → dist/cjs}/types/index.js +7 -5
  18. package/dist/cjs/types/index.js.map +1 -0
  19. package/{lib → dist/cjs}/utils/ConnectionStateMonitor.js +8 -5
  20. package/dist/cjs/utils/ConnectionStateMonitor.js.map +1 -0
  21. package/{lib → dist/cjs}/utils/ReachabilityMonitor/index.js +6 -2
  22. package/dist/cjs/utils/ReachabilityMonitor/index.js.map +1 -0
  23. package/{lib → dist/cjs}/utils/ReachabilityMonitor/index.native.js +6 -2
  24. package/dist/cjs/utils/ReachabilityMonitor/index.native.js.map +1 -0
  25. package/{lib → dist/cjs}/utils/ReconnectionMonitor.js +4 -1
  26. package/dist/cjs/utils/ReconnectionMonitor.js.map +1 -0
  27. package/{lib → dist/cjs}/utils/errors/APIError.js +4 -1
  28. package/dist/cjs/utils/errors/APIError.js.map +1 -0
  29. package/{lib → dist/cjs}/utils/errors/assertValidationError.js +4 -1
  30. package/dist/cjs/utils/errors/assertValidationError.js.map +1 -0
  31. package/dist/cjs/utils/errors/index.js +14 -0
  32. package/dist/cjs/utils/errors/index.js.map +1 -0
  33. package/{lib → dist/cjs}/utils/errors/validation.js +4 -1
  34. package/dist/cjs/utils/errors/validation.js.map +1 -0
  35. package/dist/cjs/utils/index.js +11 -0
  36. package/dist/cjs/utils/index.js.map +1 -0
  37. package/{lib → dist/cjs}/utils/resolveConfig.js +7 -3
  38. package/dist/cjs/utils/resolveConfig.js.map +1 -0
  39. package/{lib-esm → dist/cjs}/utils/resolveLibraryOptions.js +7 -1
  40. package/dist/cjs/utils/resolveLibraryOptions.js.map +1 -0
  41. package/{lib-esm → dist/esm}/GraphQLAPI.d.ts +2 -2
  42. package/{lib-esm/GraphQLAPI.js → dist/esm/GraphQLAPI.mjs} +8 -4
  43. package/dist/esm/GraphQLAPI.mjs.map +1 -0
  44. package/{lib → dist/esm}/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
  45. package/{lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js → dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs} +13 -9
  46. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -0
  47. package/{lib-esm/Providers/constants.js → dist/esm/Providers/constants.mjs} +18 -14
  48. package/dist/esm/Providers/constants.mjs.map +1 -0
  49. package/dist/esm/index.mjs +5 -0
  50. package/dist/esm/index.mjs.map +1 -0
  51. package/{lib → dist/esm}/internals/InternalGraphQLAPI.d.ts +1 -1
  52. package/{lib-esm/internals/InternalGraphQLAPI.js → dist/esm/internals/InternalGraphQLAPI.mjs} +19 -18
  53. package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -0
  54. package/dist/esm/internals/index.mjs +3 -0
  55. package/dist/esm/internals/index.mjs.map +1 -0
  56. package/{lib-esm/internals/v6.js → dist/esm/internals/v6.mjs} +9 -5
  57. package/dist/esm/internals/v6.mjs.map +1 -0
  58. package/{lib → dist/esm}/types/PubSub.d.ts +2 -2
  59. package/{lib-esm/types/PubSub.js → dist/esm/types/PubSub.mjs} +5 -2
  60. package/dist/esm/types/PubSub.mjs.map +1 -0
  61. package/{lib-esm → dist/esm}/types/index.d.ts +25 -25
  62. package/{lib-esm/types/index.js → dist/esm/types/index.mjs} +7 -3
  63. package/dist/esm/types/index.mjs.map +1 -0
  64. package/{lib-esm → dist/esm}/utils/ConnectionStateMonitor.d.ts +3 -3
  65. package/{lib-esm/utils/ConnectionStateMonitor.js → dist/esm/utils/ConnectionStateMonitor.mjs} +9 -5
  66. package/dist/esm/utils/ConnectionStateMonitor.mjs.map +1 -0
  67. package/dist/esm/utils/ReachabilityMonitor/index.d.ts +1 -0
  68. package/{lib-esm/utils/ReachabilityMonitor/index.js → dist/esm/utils/ReachabilityMonitor/index.mjs} +6 -2
  69. package/dist/esm/utils/ReachabilityMonitor/index.mjs.map +1 -0
  70. package/dist/esm/utils/ReachabilityMonitor/index.native.d.ts +1 -0
  71. package/dist/esm/utils/ReachabilityMonitor/index.native.mjs +9 -0
  72. package/dist/esm/utils/ReachabilityMonitor/index.native.mjs.map +1 -0
  73. package/{lib-esm/utils/ReconnectionMonitor.js → dist/esm/utils/ReconnectionMonitor.mjs} +7 -3
  74. package/dist/esm/utils/ReconnectionMonitor.mjs.map +1 -0
  75. package/{lib-esm/utils/errors/APIError.js → dist/esm/utils/errors/APIError.mjs} +6 -2
  76. package/dist/esm/utils/errors/APIError.mjs.map +1 -0
  77. package/{lib-esm/utils/errors/assertValidationError.js → dist/esm/utils/errors/assertValidationError.mjs} +7 -3
  78. package/dist/esm/utils/errors/assertValidationError.mjs.map +1 -0
  79. package/dist/esm/utils/errors/index.mjs +4 -0
  80. package/dist/esm/utils/errors/index.mjs.map +1 -0
  81. package/{lib-esm/utils/errors/validation.js → dist/esm/utils/errors/validation.mjs} +5 -2
  82. package/dist/esm/utils/errors/validation.mjs.map +1 -0
  83. package/dist/esm/utils/index.mjs +3 -0
  84. package/dist/esm/utils/index.mjs.map +1 -0
  85. package/{lib → dist/esm}/utils/resolveConfig.d.ts +1 -1
  86. package/{lib-esm/utils/resolveConfig.js → dist/esm/utils/resolveConfig.mjs} +8 -2
  87. package/dist/esm/utils/resolveConfig.mjs.map +1 -0
  88. package/{lib → dist/esm}/utils/resolveLibraryOptions.d.ts +2 -2
  89. package/{lib/utils/resolveLibraryOptions.js → dist/esm/utils/resolveLibraryOptions.mjs} +4 -3
  90. package/dist/esm/utils/resolveLibraryOptions.mjs.map +1 -0
  91. package/internals/package.json +4 -4
  92. package/package.json +49 -25
  93. package/src/GraphQLAPI.ts +1 -1
  94. package/lib/GraphQLAPI.d.ts +0 -38
  95. package/lib/Providers/constants.d.ts +0 -95
  96. package/lib/index.d.ts +0 -3
  97. package/lib/index.js +0 -12
  98. package/lib/internals/index.d.ts +0 -2
  99. package/lib/internals/index.js +0 -11
  100. package/lib/internals/v6.d.ts +0 -101
  101. package/lib/tsconfig.tsbuildinfo +0 -6813
  102. package/lib/types/index.d.ts +0 -309
  103. package/lib/utils/ConnectionStateMonitor.d.ts +0 -41
  104. package/lib/utils/ReachabilityMonitor/index.d.ts +0 -1
  105. package/lib/utils/ReachabilityMonitor/index.native.d.ts +0 -1
  106. package/lib/utils/ReconnectionMonitor.d.ts +0 -29
  107. package/lib/utils/errors/APIError.d.ts +0 -7
  108. package/lib/utils/errors/assertValidationError.d.ts +0 -5
  109. package/lib/utils/errors/index.d.ts +0 -3
  110. package/lib/utils/errors/index.js +0 -11
  111. package/lib/utils/errors/validation.d.ts +0 -7
  112. package/lib/utils/index.d.ts +0 -2
  113. package/lib/utils/index.js +0 -8
  114. package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +0 -64
  115. package/lib-esm/index.js +0 -5
  116. package/lib-esm/internals/InternalGraphQLAPI.d.ts +0 -58
  117. package/lib-esm/internals/index.js +0 -4
  118. package/lib-esm/tsconfig.tsbuildinfo +0 -6813
  119. package/lib-esm/types/PubSub.d.ts +0 -27
  120. package/lib-esm/utils/ReachabilityMonitor/index.d.ts +0 -1
  121. package/lib-esm/utils/ReachabilityMonitor/index.native.d.ts +0 -1
  122. package/lib-esm/utils/ReachabilityMonitor/index.native.js +0 -5
  123. package/lib-esm/utils/errors/index.js +0 -5
  124. package/lib-esm/utils/index.js +0 -4
  125. package/lib-esm/utils/resolveConfig.d.ts +0 -12
  126. package/lib-esm/utils/resolveLibraryOptions.d.ts +0 -11
  127. /package/{lib-esm → dist/esm}/Providers/constants.d.ts +0 -0
  128. /package/{lib-esm → dist/esm}/index.d.ts +0 -0
  129. /package/{lib-esm → dist/esm}/internals/index.d.ts +0 -0
  130. /package/{lib-esm → dist/esm}/internals/v6.d.ts +0 -0
  131. /package/{lib-esm → dist/esm}/utils/ReconnectionMonitor.d.ts +0 -0
  132. /package/{lib-esm → dist/esm}/utils/errors/APIError.d.ts +0 -0
  133. /package/{lib-esm → dist/esm}/utils/errors/assertValidationError.d.ts +0 -0
  134. /package/{lib-esm → dist/esm}/utils/errors/index.d.ts +0 -0
  135. /package/{lib-esm → dist/esm}/utils/errors/validation.d.ts +0 -0
  136. /package/{lib-esm → dist/esm}/utils/index.d.ts +0 -0
@@ -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,7 +0,0 @@
1
- import { AmplifyError, AmplifyErrorParams } from '@aws-amplify/core/internals/utils';
2
- /**
3
- * @internal
4
- */
5
- export declare class APIError extends AmplifyError {
6
- constructor(params: AmplifyErrorParams);
7
- }
@@ -1,5 +0,0 @@
1
- import { APIValidationErrorCode } from './validation';
2
- /**
3
- * @internal
4
- */
5
- export declare function assertValidationError(assertion: boolean, name: APIValidationErrorCode): asserts assertion;
@@ -1,3 +0,0 @@
1
- export { APIError } from './APIError';
2
- export { assertValidationError } from './assertValidationError';
3
- export { APIValidationErrorCode, validationErrorMap } from './validation';
@@ -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>;
@@ -1,2 +0,0 @@
1
- export { resolveConfig } from './resolveConfig';
2
- export { resolveLibraryOptions } from './resolveLibraryOptions';
@@ -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;
@@ -1,4 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- export { InternalGraphQLAPI, InternalGraphQLAPIClass, } from './InternalGraphQLAPI';
4
- export { graphql, cancel, isCancelError } from './v6';