@aws-amplify/api-graphql 4.0.1-api-v6-models.bc74e14.0 → 4.0.1-api-v6-models.13c9b49.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.
Files changed (219) hide show
  1. package/{lib → dist/cjs}/GraphQLAPI.js +5 -3
  2. package/dist/cjs/GraphQLAPI.js.map +1 -0
  3. package/{lib → dist/cjs}/Providers/AWSAppSyncRealTimeProvider/index.js +3 -1
  4. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -0
  5. package/{lib → dist/cjs}/Providers/constants.js +6 -7
  6. package/dist/cjs/Providers/constants.js.map +1 -0
  7. package/{lib → dist/cjs}/index.js +3 -1
  8. package/dist/cjs/index.js.map +1 -0
  9. package/{lib → dist/cjs}/internals/APIClient.js +3 -4
  10. package/dist/cjs/internals/APIClient.js.map +1 -0
  11. package/{lib → dist/cjs}/internals/InternalGraphQLAPI.js +4 -6
  12. package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -0
  13. package/{lib → dist/cjs}/internals/generateClient.js +3 -1
  14. package/dist/cjs/internals/generateClient.js.map +1 -0
  15. package/{lib → dist/cjs}/internals/generateModelsProperty.js +3 -1
  16. package/dist/cjs/internals/generateModelsProperty.js.map +1 -0
  17. package/{lib → dist/cjs}/internals/index.js +3 -1
  18. package/dist/cjs/internals/index.js.map +1 -0
  19. package/{lib → dist/cjs}/internals/operations/get.js +3 -1
  20. package/dist/cjs/internals/operations/get.js.map +1 -0
  21. package/{lib → dist/cjs}/internals/operations/list.js +3 -1
  22. package/dist/cjs/internals/operations/list.js.map +1 -0
  23. package/{lib → dist/cjs}/internals/operations/observeQuery.js +3 -1
  24. package/dist/cjs/internals/operations/observeQuery.js.map +1 -0
  25. package/{lib → dist/cjs}/internals/operations/subscription.js +3 -1
  26. package/dist/cjs/internals/operations/subscription.js.map +1 -0
  27. package/{lib → dist/cjs}/internals/server/generateClient.js +3 -1
  28. package/dist/cjs/internals/server/generateClient.js.map +1 -0
  29. package/{lib → dist/cjs}/internals/server/generateModelsProperty.js +3 -1
  30. package/dist/cjs/internals/server/generateModelsProperty.js.map +1 -0
  31. package/{lib → dist/cjs}/internals/server/index.js +3 -1
  32. package/dist/cjs/internals/server/index.js.map +1 -0
  33. package/{lib → dist/cjs}/internals/types.js +3 -1
  34. package/dist/cjs/internals/types.js.map +1 -0
  35. package/{lib → dist/cjs}/internals/v6.js +3 -1
  36. package/dist/cjs/internals/v6.js.map +1 -0
  37. package/{lib → dist/cjs}/types/PubSub.js +5 -6
  38. package/dist/cjs/types/PubSub.js.map +1 -0
  39. package/{lib → dist/cjs}/types/index.js +4 -3
  40. package/dist/cjs/types/index.js.map +1 -0
  41. package/{lib → dist/cjs}/utils/ConnectionStateMonitor.js +3 -1
  42. package/dist/cjs/utils/ConnectionStateMonitor.js.map +1 -0
  43. package/{lib → dist/cjs}/utils/ReachabilityMonitor/index.js +3 -1
  44. package/dist/cjs/utils/ReachabilityMonitor/index.js.map +1 -0
  45. package/{lib → dist/cjs}/utils/ReachabilityMonitor/index.native.js +3 -1
  46. package/dist/cjs/utils/ReachabilityMonitor/index.native.js.map +1 -0
  47. package/{lib → dist/cjs}/utils/ReconnectionMonitor.js +4 -2
  48. package/dist/cjs/utils/ReconnectionMonitor.js.map +1 -0
  49. package/{lib → dist/cjs}/utils/errors/APIError.js +3 -1
  50. package/dist/cjs/utils/errors/APIError.js.map +1 -0
  51. package/{lib → dist/cjs}/utils/errors/assertValidationError.js +3 -1
  52. package/dist/cjs/utils/errors/assertValidationError.js.map +1 -0
  53. package/{lib → dist/cjs}/utils/errors/index.js +3 -1
  54. package/dist/cjs/utils/errors/index.js.map +1 -0
  55. package/{lib → dist/cjs}/utils/errors/validation.js +4 -2
  56. package/dist/cjs/utils/errors/validation.js.map +1 -0
  57. package/{lib → dist/cjs}/utils/findIndexByFields.js +3 -1
  58. package/dist/cjs/utils/findIndexByFields.js.map +1 -0
  59. package/{lib → dist/cjs}/utils/index.js +3 -1
  60. package/dist/cjs/utils/index.js.map +1 -0
  61. package/{lib → dist/cjs}/utils/resolveConfig.js +3 -1
  62. package/dist/cjs/utils/resolveConfig.js.map +1 -0
  63. package/{lib → dist/cjs}/utils/resolveLibraryOptions.js +3 -1
  64. package/dist/cjs/utils/resolveLibraryOptions.js.map +1 -0
  65. package/{lib → dist/cjs}/utils/resolveOwnerFields.js +3 -1
  66. package/dist/cjs/utils/resolveOwnerFields.js.map +1 -0
  67. package/{lib → dist/cjs}/utils/resolvePKFields.js +3 -1
  68. package/dist/cjs/utils/resolvePKFields.js.map +1 -0
  69. package/{lib-esm → dist/esm}/GraphQLAPI.d.ts +1 -1
  70. package/{lib-esm/GraphQLAPI.js → dist/esm/GraphQLAPI.mjs} +8 -4
  71. package/dist/esm/GraphQLAPI.mjs.map +1 -0
  72. package/{lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js → dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs} +13 -9
  73. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -0
  74. package/{lib-esm/Providers/constants.js → dist/esm/Providers/constants.mjs} +18 -14
  75. package/dist/esm/Providers/constants.mjs.map +1 -0
  76. package/dist/esm/index.mjs +5 -0
  77. package/dist/esm/index.mjs.map +1 -0
  78. package/{lib-esm/internals/APIClient.js → dist/esm/internals/APIClient.mjs} +16 -15
  79. package/dist/esm/internals/APIClient.mjs.map +1 -0
  80. package/{lib-esm/internals/InternalGraphQLAPI.js → dist/esm/internals/InternalGraphQLAPI.mjs} +19 -18
  81. package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -0
  82. package/{lib-esm/internals/generateClient.js → dist/esm/internals/generateClient.mjs} +8 -4
  83. package/dist/esm/internals/generateClient.mjs.map +1 -0
  84. package/{lib-esm/internals/generateModelsProperty.js → dist/esm/internals/generateModelsProperty.mjs} +10 -6
  85. package/dist/esm/internals/generateModelsProperty.mjs.map +1 -0
  86. package/dist/esm/internals/index.mjs +4 -0
  87. package/dist/esm/internals/index.mjs.map +1 -0
  88. package/{lib-esm/internals/operations/get.js → dist/esm/internals/operations/get.mjs} +6 -2
  89. package/dist/esm/internals/operations/get.mjs.map +1 -0
  90. package/{lib-esm/internals/operations/list.js → dist/esm/internals/operations/list.mjs} +6 -2
  91. package/dist/esm/internals/operations/list.mjs.map +1 -0
  92. package/{lib-esm/internals/operations/observeQuery.js → dist/esm/internals/operations/observeQuery.mjs} +10 -3
  93. package/dist/esm/internals/operations/observeQuery.mjs.map +1 -0
  94. package/{lib-esm/internals/operations/subscription.js → dist/esm/internals/operations/subscription.mjs} +7 -3
  95. package/dist/esm/internals/operations/subscription.mjs.map +1 -0
  96. package/{lib-esm/internals/server/generateClient.js → dist/esm/internals/server/generateClient.mjs} +12 -4
  97. package/dist/esm/internals/server/generateClient.mjs.map +1 -0
  98. package/{lib-esm/internals/server/generateModelsProperty.js → dist/esm/internals/server/generateModelsProperty.mjs} +8 -4
  99. package/dist/esm/internals/server/generateModelsProperty.mjs.map +1 -0
  100. package/dist/esm/internals/server/index.mjs +2 -0
  101. package/dist/esm/internals/server/index.mjs.map +1 -0
  102. package/dist/esm/internals/types.mjs +2 -0
  103. package/dist/esm/internals/types.mjs.map +1 -0
  104. package/{lib-esm/internals/v6.js → dist/esm/internals/v6.mjs} +9 -5
  105. package/dist/esm/internals/v6.mjs.map +1 -0
  106. package/{lib-esm/types/PubSub.js → dist/esm/types/PubSub.mjs} +5 -2
  107. package/dist/esm/types/PubSub.mjs.map +1 -0
  108. package/{lib-esm/types/index.js → dist/esm/types/index.mjs} +9 -5
  109. package/dist/esm/types/index.mjs.map +1 -0
  110. package/{lib-esm/utils/ConnectionStateMonitor.js → dist/esm/utils/ConnectionStateMonitor.mjs} +9 -5
  111. package/dist/esm/utils/ConnectionStateMonitor.mjs.map +1 -0
  112. package/dist/esm/utils/ReachabilityMonitor/index.d.ts +1 -0
  113. package/{lib-esm/utils/ReachabilityMonitor/index.js → dist/esm/utils/ReachabilityMonitor/index.mjs} +6 -2
  114. package/dist/esm/utils/ReachabilityMonitor/index.mjs.map +1 -0
  115. package/dist/esm/utils/ReachabilityMonitor/index.native.d.ts +1 -0
  116. package/dist/esm/utils/ReachabilityMonitor/index.native.mjs +9 -0
  117. package/dist/esm/utils/ReachabilityMonitor/index.native.mjs.map +1 -0
  118. package/{lib-esm/utils/ReconnectionMonitor.js → dist/esm/utils/ReconnectionMonitor.mjs} +7 -3
  119. package/dist/esm/utils/ReconnectionMonitor.mjs.map +1 -0
  120. package/{lib-esm/utils/errors/APIError.js → dist/esm/utils/errors/APIError.mjs} +6 -2
  121. package/dist/esm/utils/errors/APIError.mjs.map +1 -0
  122. package/{lib-esm/utils/errors/assertValidationError.js → dist/esm/utils/errors/assertValidationError.mjs} +7 -3
  123. package/dist/esm/utils/errors/assertValidationError.mjs.map +1 -0
  124. package/dist/esm/utils/errors/index.mjs +4 -0
  125. package/dist/esm/utils/errors/index.mjs.map +1 -0
  126. package/{lib-esm/utils/errors/validation.js → dist/esm/utils/errors/validation.mjs} +5 -2
  127. package/dist/esm/utils/errors/validation.mjs.map +1 -0
  128. package/{lib-esm/utils/findIndexByFields.js → dist/esm/utils/findIndexByFields.mjs} +4 -1
  129. package/dist/esm/utils/findIndexByFields.mjs.map +1 -0
  130. package/dist/esm/utils/index.mjs +5 -0
  131. package/dist/esm/utils/index.mjs.map +1 -0
  132. package/{lib-esm → dist/esm}/utils/resolveConfig.d.ts +1 -1
  133. package/{lib-esm/utils/resolveConfig.js → dist/esm/utils/resolveConfig.mjs} +8 -2
  134. package/dist/esm/utils/resolveConfig.mjs.map +1 -0
  135. package/{lib → dist/esm}/utils/resolveLibraryOptions.d.ts +2 -2
  136. package/{lib-esm/utils/resolveLibraryOptions.js → dist/esm/utils/resolveLibraryOptions.mjs} +4 -1
  137. package/dist/esm/utils/resolveLibraryOptions.mjs.map +1 -0
  138. package/{lib-esm/utils/resolveOwnerFields.js → dist/esm/utils/resolveOwnerFields.mjs} +4 -1
  139. package/dist/esm/utils/resolveOwnerFields.mjs.map +1 -0
  140. package/{lib-esm/utils/resolvePKFields.js → dist/esm/utils/resolvePKFields.mjs} +4 -1
  141. package/dist/esm/utils/resolvePKFields.mjs.map +1 -0
  142. package/internals/package.json +4 -4
  143. package/internals/server/package.json +4 -4
  144. package/package.json +51 -25
  145. package/src/GraphQLAPI.ts +1 -1
  146. package/lib/GraphQLAPI.d.ts +0 -38
  147. package/lib/Providers/AWSAppSyncRealTimeProvider/index.d.ts +0 -64
  148. package/lib/Providers/constants.d.ts +0 -95
  149. package/lib/index.d.ts +0 -3
  150. package/lib/internals/APIClient.d.ts +0 -121
  151. package/lib/internals/InternalGraphQLAPI.d.ts +0 -58
  152. package/lib/internals/generateClient.d.ts +0 -12
  153. package/lib/internals/generateModelsProperty.d.ts +0 -4
  154. package/lib/internals/index.d.ts +0 -3
  155. package/lib/internals/operations/get.d.ts +0 -2
  156. package/lib/internals/operations/list.d.ts +0 -2
  157. package/lib/internals/operations/observeQuery.d.ts +0 -2
  158. package/lib/internals/operations/subscription.d.ts +0 -1
  159. package/lib/internals/server/generateClient.d.ts +0 -11
  160. package/lib/internals/server/generateModelsProperty.d.ts +0 -3
  161. package/lib/internals/server/index.d.ts +0 -1
  162. package/lib/internals/types.d.ts +0 -17
  163. package/lib/internals/v6.d.ts +0 -101
  164. package/lib/tsconfig.tsbuildinfo +0 -1
  165. package/lib/types/PubSub.d.ts +0 -27
  166. package/lib/types/index.d.ts +0 -329
  167. package/lib/utils/ConnectionStateMonitor.d.ts +0 -41
  168. package/lib/utils/ReachabilityMonitor/index.d.ts +0 -1
  169. package/lib/utils/ReachabilityMonitor/index.native.d.ts +0 -1
  170. package/lib/utils/ReconnectionMonitor.d.ts +0 -29
  171. package/lib/utils/errors/APIError.d.ts +0 -7
  172. package/lib/utils/errors/assertValidationError.d.ts +0 -5
  173. package/lib/utils/errors/index.d.ts +0 -3
  174. package/lib/utils/errors/validation.d.ts +0 -7
  175. package/lib/utils/findIndexByFields.d.ts +0 -9
  176. package/lib/utils/index.d.ts +0 -4
  177. package/lib/utils/resolveConfig.d.ts +0 -12
  178. package/lib/utils/resolveOwnerFields.d.ts +0 -12
  179. package/lib/utils/resolvePKFields.d.ts +0 -13
  180. package/lib-esm/index.js +0 -5
  181. package/lib-esm/internals/index.js +0 -5
  182. package/lib-esm/internals/server/index.js +0 -3
  183. package/lib-esm/internals/types.js +0 -1
  184. package/lib-esm/tsconfig.tsbuildinfo +0 -1
  185. package/lib-esm/utils/ReachabilityMonitor/index.d.ts +0 -1
  186. package/lib-esm/utils/ReachabilityMonitor/index.native.d.ts +0 -1
  187. package/lib-esm/utils/ReachabilityMonitor/index.native.js +0 -5
  188. package/lib-esm/utils/errors/index.js +0 -5
  189. package/lib-esm/utils/index.js +0 -6
  190. package/lib-esm/utils/resolveLibraryOptions.d.ts +0 -11
  191. /package/{lib-esm → dist/esm}/Providers/AWSAppSyncRealTimeProvider/index.d.ts +0 -0
  192. /package/{lib-esm → dist/esm}/Providers/constants.d.ts +0 -0
  193. /package/{lib-esm → dist/esm}/index.d.ts +0 -0
  194. /package/{lib-esm → dist/esm}/internals/APIClient.d.ts +0 -0
  195. /package/{lib-esm → dist/esm}/internals/InternalGraphQLAPI.d.ts +0 -0
  196. /package/{lib-esm → dist/esm}/internals/generateClient.d.ts +0 -0
  197. /package/{lib-esm → dist/esm}/internals/generateModelsProperty.d.ts +0 -0
  198. /package/{lib-esm → dist/esm}/internals/index.d.ts +0 -0
  199. /package/{lib-esm → dist/esm}/internals/operations/get.d.ts +0 -0
  200. /package/{lib-esm → dist/esm}/internals/operations/list.d.ts +0 -0
  201. /package/{lib-esm → dist/esm}/internals/operations/observeQuery.d.ts +0 -0
  202. /package/{lib-esm → dist/esm}/internals/operations/subscription.d.ts +0 -0
  203. /package/{lib-esm → dist/esm}/internals/server/generateClient.d.ts +0 -0
  204. /package/{lib-esm → dist/esm}/internals/server/generateModelsProperty.d.ts +0 -0
  205. /package/{lib-esm → dist/esm}/internals/server/index.d.ts +0 -0
  206. /package/{lib-esm → dist/esm}/internals/types.d.ts +0 -0
  207. /package/{lib-esm → dist/esm}/internals/v6.d.ts +0 -0
  208. /package/{lib-esm → dist/esm}/types/PubSub.d.ts +0 -0
  209. /package/{lib-esm → dist/esm}/types/index.d.ts +0 -0
  210. /package/{lib-esm → dist/esm}/utils/ConnectionStateMonitor.d.ts +0 -0
  211. /package/{lib-esm → dist/esm}/utils/ReconnectionMonitor.d.ts +0 -0
  212. /package/{lib-esm → dist/esm}/utils/errors/APIError.d.ts +0 -0
  213. /package/{lib-esm → dist/esm}/utils/errors/assertValidationError.d.ts +0 -0
  214. /package/{lib-esm → dist/esm}/utils/errors/index.d.ts +0 -0
  215. /package/{lib-esm → dist/esm}/utils/errors/validation.d.ts +0 -0
  216. /package/{lib-esm → dist/esm}/utils/findIndexByFields.d.ts +0 -0
  217. /package/{lib-esm → dist/esm}/utils/index.d.ts +0 -0
  218. /package/{lib-esm → dist/esm}/utils/resolveOwnerFields.d.ts +0 -0
  219. /package/{lib-esm → dist/esm}/utils/resolvePKFields.d.ts +0 -0
@@ -1,329 +0,0 @@
1
- import { AmplifyClassV6, ResourcesConfig } from '@aws-amplify/core';
2
- import { ModelTypes } from '@aws-amplify/amplify-api-next-types-alpha';
3
- import { Source, DocumentNode, GraphQLError } from 'graphql';
4
- export { OperationTypeNode } from 'graphql';
5
- import { Observable } from 'rxjs';
6
- import { GraphQLAuthMode, DocumentType } from '@aws-amplify/core/internals/utils';
7
- import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
8
- export { CONTROL_MSG, ConnectionState } from './PubSub';
9
- export { SelectionSet } from '@aws-amplify/amplify-api-next-types-alpha';
10
- export { CommonPublicClientOptions } from '../internals/types';
11
- /**
12
- * Loose/Unknown options for raw GraphQLAPICategory `graphql()`.
13
- */
14
- export interface GraphQLOptions {
15
- query: string | DocumentNode;
16
- variables?: Record<string, DocumentType>;
17
- authMode?: GraphQLAuthMode;
18
- authToken?: string;
19
- /**
20
- * @deprecated This property should not be used
21
- */
22
- userAgentSuffix?: string;
23
- }
24
- export interface GraphQLResult<T = object> {
25
- data: T;
26
- errors?: GraphQLError[];
27
- extensions?: {
28
- [key: string]: any;
29
- };
30
- }
31
- declare const queryType: unique symbol;
32
- export type GraphQLQuery<T> = T & {
33
- readonly [queryType]: 'query';
34
- };
35
- export type GraphQLSubscription<T> = T & {
36
- readonly [queryType]: 'subscription';
37
- };
38
- /**
39
- * Accepts a code generated model type and returns a supertype that
40
- * can accept return values from the relevant graphql operations.
41
- *
42
- * For example:
43
- *
44
- * ```typescript
45
- * import { GraphQLReturnType } from 'aws-amplify/api';
46
- * import { MyModel } from './API';
47
- * import { getMyModel } from './graphql/queries';
48
- *
49
- * const [item, setItem] = useState<GraphQLReturnType<MyModel>>();
50
- * setItem(await client.graphql({ query: getMyModel }).data.getMyModel!)
51
- * ```
52
- *
53
- * Trying to assign the result of a `getMyModel` operation directly to a
54
- * `MyModel` variables won't necessarily work, because normally-required related
55
- * models might not be part of the selection set.
56
- *
57
- * This util simply makes related model properties optional recursively.
58
- */
59
- export type GraphQLReturnType<T> = T extends {} ? {
60
- [K in keyof T]?: GraphQLReturnType<T[K]>;
61
- } : T;
62
- /**
63
- * Describes a paged list result from AppSync, which can either
64
- * live at the top query or property (e.g., related model) level.
65
- */
66
- type PagedList<T, TYPENAME> = {
67
- __typename: TYPENAME;
68
- nextToken?: string | null | undefined;
69
- items: Array<T>;
70
- };
71
- /**
72
- * Recursively looks through a result type and removes nulls and
73
- * and undefined from `PagedList` types.
74
- *
75
- * Although a graphql response might contain empty values in an
76
- * array, this will only be the case when we also have errors,
77
- * which will then be *thrown*.
78
- */
79
- type WithListsFixed<T> = T extends PagedList<infer IT, infer NAME> ? PagedList<Exclude<IT, null | undefined>, NAME> : T extends {} ? {
80
- [K in keyof T]: WithListsFixed<T[K]>;
81
- } : T;
82
- /**
83
- * Returns an updated response type to always return a value.
84
- */
85
- type NeverEmpty<T> = {
86
- [K in keyof T]-?: Exclude<WithListsFixed<T[K]>, undefined | null>;
87
- };
88
- /**
89
- * Replaces all list result types in a query result with types to exclude
90
- * nulls and undefined from list member unions.
91
- *
92
- * If empty members are present, there will also be errors present,
93
- * and the response will instead be *thrown*.
94
- */
95
- type FixedQueryResult<T> = Exclude<T[keyof T], null | undefined> extends PagedList<any, any> ? {
96
- [K in keyof T]-?: WithListsFixed<Exclude<T[K], null | undefined>>;
97
- } : T;
98
- /**
99
- * The return value from a `graphql({query})` call when `query` is a subscription.
100
- *
101
- * ```ts
102
- * // |-- You are here
103
- * // v
104
- * const subResult: GraphqlSubscriptionResult<T> = client.graphql({
105
- * query: onCreateWidget
106
- * });
107
- *
108
- * const sub = subResult.subscribe({
109
- * //
110
- * // |-- You are here
111
- * // v
112
- * next(message: GraphqlSubscriptionMessage<OnCreateWidgetSubscription>) {
113
- * handle(message.value); // <-- type OnCreateWidgetSubscription
114
- * }
115
- * })
116
- * ```
117
- */
118
- export type GraphqlSubscriptionResult<T> = Observable<GraphqlSubscriptionMessage<T>>;
119
- /**
120
- * The shape of messages passed to `next()` from a graphql subscription. E.g.,
121
- *
122
- * ```ts
123
- * const sub = client.graphql({
124
- * query: onCreateWidget,
125
- * }).subscribe({
126
- * //
127
- * // |-- You are here
128
- * // v
129
- * next(message: GraphqlSubscriptionMessage<OnCreateWidgetSubscription>) {
130
- * handle(message.value); // <-- type OnCreateWidgetSubscription
131
- * }
132
- * })
133
- * ```
134
- */
135
- export type GraphqlSubscriptionMessage<T> = {
136
- data: T;
137
- };
138
- export interface AWSAppSyncRealTimeProviderOptions {
139
- appSyncGraphqlEndpoint?: string;
140
- authenticationType?: GraphQLAuthMode;
141
- query?: string;
142
- variables?: Record<string, unknown>;
143
- apiKey?: string;
144
- region?: string;
145
- graphql_headers?: () => {} | (() => Promise<{}>);
146
- additionalHeaders?: {
147
- [key: string]: string;
148
- };
149
- }
150
- export type AWSAppSyncRealTimeProvider = {
151
- subscribe(options?: AWSAppSyncRealTimeProviderOptions): Observable<Record<string, unknown>>;
152
- };
153
- export declare enum GraphQLAuthError {
154
- NO_API_KEY = "No api-key configured",
155
- NO_CURRENT_USER = "No current user",
156
- NO_CREDENTIALS = "No credentials",
157
- NO_FEDERATED_JWT = "No federated jwt",
158
- NO_AUTH_TOKEN = "No auth token specified"
159
- }
160
- /**
161
- * GraphQLSource or string, the type of the parameter for calling graphql.parse
162
- * @see: https://graphql.org/graphql-js/language/#parse
163
- */
164
- export type GraphQLOperation = Source | string;
165
- /**
166
- * API V6 `graphql({options})` type that can leverage branded graphql `query`
167
- * objects and fallback types.
168
- */
169
- export interface GraphQLOptionsV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string> {
170
- query: TYPED_GQL_STRING | DocumentNode;
171
- variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
172
- authMode?: GraphQLAuthMode;
173
- authToken?: string;
174
- /**
175
- * @deprecated This property should not be used
176
- */
177
- userAgentSuffix?: string;
178
- }
179
- /**
180
- * Result type for `graphql()` operations that don't include any specific
181
- * type information. The result could be either a `Promise` or `Subscription`.
182
- *
183
- * Invoking code should either cast the result or use `?` and `!` operators to
184
- * navigate the result objects.
185
- */
186
- export type UnknownGraphQLResponse = Promise<GraphQLResult<any>> | GraphqlSubscriptionResult<any>;
187
- /**
188
- * The expected type for `variables` in a V6 `graphql()` operation with
189
- * respect to the given `FALLBACK_TYPES` and `TYPED_GQL_STRING`.
190
- */
191
- export 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;
192
- /**
193
- * The expected return type with respect to the given `FALLBACK_TYPE`
194
- * and `TYPED_GQL_STRING`.
195
- */
196
- export 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;
197
- /**
198
- * The shape customers can use to provide `T` to `graphql<T>()` to specify both
199
- * `IN` and `OUT` types (the type of `variables` and the return type, respectively).
200
- *
201
- * I.E.,
202
- *
203
- * ```ts
204
- * type MyVariablesType = { ... };
205
- * type MyResultType = { ... };
206
- * type MyOperationType = { variables: MyVariablesType, result: MyResultType };
207
- *
208
- * const result: MyResultType = graphql<MyOperationType>("graphql string", {
209
- * variables: {
210
- * // MyVariablesType
211
- * }
212
- * })
213
- * ```
214
- */
215
- export type GraphQLOperationType<IN extends {}, OUT extends {}> = {
216
- variables: IN;
217
- result: OUT;
218
- };
219
- /**
220
- * Nominal type for branding generated graphql query operation strings with
221
- * input and output types.
222
- *
223
- * E.g.,
224
- *
225
- * ```ts
226
- * export const getWidget = `...` as GeneratedQuery<
227
- * GetWidgetQueryVariables,
228
- * GetWidgetQuery
229
- * >;
230
- * ```
231
- *
232
- * This allows `graphql()` to extract `InputType` and `OutputType` to correctly
233
- * assign types to the `variables` and result objects.
234
- */
235
- export type GeneratedQuery<InputType, OutputType> = string & {
236
- __generatedQueryInput: InputType;
237
- __generatedQueryOutput: OutputType;
238
- };
239
- /**
240
- * Nominal type for branding generated graphql mutation operation strings with
241
- * input and output types.
242
- *
243
- * E.g.,
244
- *
245
- * ```ts
246
- * export const createWidget = `...` as GeneratedQuery<
247
- * CreateWidgetMutationVariables,
248
- * CreateWidgetMutation
249
- * >;
250
- * ```
251
- *
252
- * This allows `graphql()` to extract `InputType` and `OutputType` to correctly
253
- * assign types to the `variables` and result objects.
254
- */
255
- export type GeneratedMutation<InputType, OutputType> = string & {
256
- __generatedMutationInput: InputType;
257
- __generatedMutationOutput: OutputType;
258
- };
259
- /**
260
- * Nominal type for branding generated graphql mutation operation strings with
261
- * input and output types.
262
- *
263
- * E.g.,
264
- *
265
- * ```ts
266
- * export const createWidget = `...` as GeneratedMutation<
267
- * CreateWidgetMutationVariables,
268
- * CreateWidgetMutation
269
- * >;
270
- * ```
271
- *
272
- * This allows `graphql()` to extract `InputType` and `OutputType` to correctly
273
- * assign types to the `variables` and result objects.
274
- */
275
- export type GeneratedSubscription<InputType, OutputType> = string & {
276
- __generatedSubscriptionInput: InputType;
277
- __generatedSubscriptionOutput: OutputType;
278
- };
279
- type FilteredKeys<T> = {
280
- [P in keyof T]: T[P] extends never ? never : P;
281
- }[keyof T];
282
- type ExcludeNeverFields<O> = {
283
- [K in FilteredKeys<O>]: O[K];
284
- };
285
- export declare const __amplify: unique symbol;
286
- export declare const __authMode: unique symbol;
287
- export declare const __authToken: unique symbol;
288
- export type V6Client<T extends Record<any, any> = never> = ExcludeNeverFields<{
289
- [__amplify]: AmplifyClassV6;
290
- [__authMode]?: GraphQLAuthMode;
291
- [__authToken]?: string;
292
- graphql: GraphQLMethod;
293
- cancel: (promise: Promise<any>, message?: string) => boolean;
294
- isCancelError: (error: any) => boolean;
295
- models: ModelTypes<T>;
296
- }>;
297
- export type V6ClientSSRRequest<T extends Record<any, any> = never> = ExcludeNeverFields<{
298
- [__amplify]: AmplifyClassV6;
299
- [__authMode]?: GraphQLAuthMode;
300
- [__authToken]?: string;
301
- graphql: GraphQLMethodSSR;
302
- cancel: (promise: Promise<any>, message?: string) => boolean;
303
- isCancelError: (error: any) => boolean;
304
- models: ModelTypes<T, 'REQUEST'>;
305
- }>;
306
- export type V6ClientSSRCookies<T extends Record<any, any> = never> = ExcludeNeverFields<{
307
- [__amplify]: AmplifyClassV6;
308
- [__authMode]?: GraphQLAuthMode;
309
- [__authToken]?: string;
310
- graphql: GraphQLMethod;
311
- cancel: (promise: Promise<any>, message?: string) => boolean;
312
- isCancelError: (error: any) => boolean;
313
- models: ModelTypes<T, 'COOKIES'>;
314
- }>;
315
- export type GraphQLMethod = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: {
316
- [key: string]: string;
317
- } | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
318
- export type GraphQLMethodSSR = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(contextSpec: AmplifyServer.ContextSpec, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: {
319
- [key: string]: string;
320
- } | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
321
- /**
322
- * @private
323
- *
324
- * The knobs available for configuring `server/generateClient` internally.
325
- */
326
- export type ServerClientGenerationParams = {
327
- amplify: null | ((fn: (amplify: AmplifyClassV6) => Promise<any>) => Promise<any>);
328
- config: ResourcesConfig;
329
- };
@@ -1,41 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { ConnectionState } from '../types/PubSub';
3
- type LinkedConnectionState = 'connected' | 'disconnected';
4
- type LinkedHealthState = 'healthy' | 'unhealthy';
5
- 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: () => import("rxjs").Observable<import("@aws-amplify/core/lib-esm/Reachability/types").NetworkStatus>;
@@ -1 +0,0 @@
1
- export declare const ReachabilityMonitor: () => import("rxjs").Observable<import("@aws-amplify/core/lib-esm/Reachability/types").NetworkStatus>;
@@ -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,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,9 +0,0 @@
1
- /**
2
- * Iterates through a collection to find a matching item and returns the index.
3
- *
4
- * @param needle The item to search for
5
- * @param haystack The collection to search
6
- * @param keyFields The fields used to indicate a match
7
- * @returns Index of `needle` in `haystack`, otherwise -1 if not found.
8
- */
9
- export declare function findIndexByFields<T>(needle: T, haystack: T[], keyFields: Array<keyof T>): number;
@@ -1,4 +0,0 @@
1
- export { resolveConfig } from './resolveConfig';
2
- export { resolveLibraryOptions } from './resolveLibraryOptions';
3
- export { resolvePKFields } from './resolvePKFields';
4
- export { findIndexByFields } from './findIndexByFields';
@@ -1,12 +0,0 @@
1
- import { AmplifyClassV6 } from '@aws-amplify/core';
2
- /**
3
- * @internal
4
- */
5
- export declare const resolveConfig: (amplify: AmplifyClassV6) => {
6
- apiKey: string | undefined;
7
- customEndpoint: string | undefined;
8
- customEndpointRegion: string | undefined;
9
- defaultAuthMode: import("@aws-amplify/core/lib-esm/libraryUtils").GraphQLAuthMode | undefined;
10
- endpoint: string | undefined;
11
- region: string | undefined;
12
- };
@@ -1,12 +0,0 @@
1
- import { ResourcesConfig } from '@aws-amplify/core';
2
- type GraphQLConfig = Exclude<ResourcesConfig['API'], undefined>['GraphQL'];
3
- type ModelIntrospectionSchema = Exclude<Exclude<GraphQLConfig, undefined>['modelIntrospection'], undefined>;
4
- type Model = ModelIntrospectionSchema['models'][string];
5
- /**
6
- * Given an introspection schema model, returns all owner fields.
7
- *
8
- * @param model Model from an introspection schema
9
- * @returns List of owner field names
10
- */
11
- export declare function resolveOwnerFields(model: Model): string[];
12
- export {};
@@ -1,13 +0,0 @@
1
- import { ResourcesConfig } from '@aws-amplify/core';
2
- type GraphQLConfig = Exclude<ResourcesConfig['API'], undefined>['GraphQL'];
3
- type ModelIntrospectionSchema = Exclude<Exclude<GraphQLConfig, undefined>['modelIntrospection'], undefined>;
4
- type SchemaModel = ModelIntrospectionSchema['models'][string];
5
- /**
6
- * Given a SchemaModel from a ModelIntrospectionSchema, returns the primary key
7
- * as an array of field names.
8
- *
9
- * @param model The model object
10
- * @returns Array of field names
11
- */
12
- export declare function resolvePKFields(model: SchemaModel): string[];
13
- export {};
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,5 +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';
5
- export { generateClient } from './generateClient';
@@ -1,3 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- export { generateClient } from './generateClient';
@@ -1 +0,0 @@
1
- export {};