@aws-amplify/core 6.0.1-console-preview.f63250a.0 → 6.0.1-console-preview.5dc0b68.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 (354) hide show
  1. package/internals/adapter-core/package.json +8 -0
  2. package/internals/providers/pinpoint/package.json +8 -0
  3. package/internals/utils/package.json +7 -0
  4. package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +1 -1
  5. package/lib/AwsClients/CognitoIdentity/getId.d.ts +1 -1
  6. package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +1 -1
  7. package/lib/AwsClients/Pinpoint/index.d.ts +1 -1
  8. package/lib/AwsClients/Pinpoint/putEvents.d.ts +1 -1
  9. package/lib/AwsClients/Pinpoint/putEvents.js +2 -2
  10. package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +1 -1
  11. package/lib/Cache/AsyncStorageCache.js +3 -3
  12. package/lib/Cache/BrowserStorageCache.js +5 -5
  13. package/lib/Cache/InMemoryCache.js +3 -3
  14. package/lib/Cache/StorageCache.js +1 -1
  15. package/lib/Cache/Utils/CacheList.js +5 -5
  16. package/lib/Credentials.js +2 -5
  17. package/lib/{Hub.d.ts → Hub/index.d.ts} +5 -21
  18. package/lib/Hub/index.js +151 -0
  19. package/lib/Hub/types/AuthTypes.d.ts +11 -0
  20. package/lib/Hub/types/HubTypes.d.ts +28 -0
  21. package/lib/Hub/types/HubTypes.js +4 -0
  22. package/lib/Hub/types/index.d.ts +2 -0
  23. package/lib/Hub/types/index.js +20 -0
  24. package/lib/I18n/I18n.js +1 -1
  25. package/lib/I18n/index.js +5 -5
  26. package/lib/OAuthHelper/FacebookOAuth.js +1 -1
  27. package/lib/OAuthHelper/GoogleOAuth.js +1 -1
  28. package/lib/Platform/version.d.ts +1 -1
  29. package/lib/Platform/version.js +1 -1
  30. package/lib/RNComponents/index.d.ts +1 -0
  31. package/lib/RNComponents/index.js +2 -1
  32. package/lib/RNComponents/isAppInForeground.d.ts +1 -0
  33. package/lib/RNComponents/isAppInForeground.js +10 -0
  34. package/lib/ServiceWorker/ServiceWorker.js +9 -9
  35. package/lib/StorageHelper/localStorage.js +1 -1
  36. package/lib/StorageHelper/sessionStorage.js +1 -1
  37. package/lib/UniversalStorage/index.js +1 -1
  38. package/lib/Util/Constants.d.ts +12 -8
  39. package/lib/Util/Constants.js +21 -15
  40. package/lib/{Errors.d.ts → Util/Errors.d.ts} +1 -1
  41. package/lib/Util/Reachability.js +1 -1
  42. package/lib/Util/errors/AssertError.js +1 -1
  43. package/lib/Util/index.d.ts +1 -1
  44. package/lib/Util/index.js +1 -5
  45. package/lib/adapterCore/error/AmplifyServerContextError.d.ts +8 -0
  46. package/lib/adapterCore/error/AmplifyServerContextError.js +35 -0
  47. package/lib/adapterCore/error/index.d.ts +1 -0
  48. package/lib/adapterCore/error/index.js +7 -0
  49. package/lib/adapterCore/index.d.ts +2 -0
  50. package/lib/adapterCore/index.js +11 -0
  51. package/lib/adapterCore/serverContext/index.d.ts +2 -0
  52. package/lib/adapterCore/serverContext/index.js +9 -0
  53. package/lib/adapterCore/serverContext/serverContext.d.ts +20 -0
  54. package/lib/adapterCore/serverContext/serverContext.js +42 -0
  55. package/lib/adapterCore/serverContext/serverContextRegistry.d.ts +6 -0
  56. package/lib/adapterCore/serverContext/serverContextRegistry.js +24 -0
  57. package/lib/adapterCore/serverContext/types/amplifyServer.d.ts +16 -0
  58. package/lib/adapterCore/serverContext/types/amplifyServer.js +4 -0
  59. package/lib/adapterCore/serverContext/types/cookieStorage.d.ts +31 -0
  60. package/lib/adapterCore/serverContext/types/cookieStorage.js +4 -0
  61. package/lib/adapterCore/serverContext/types/index.d.ts +4 -0
  62. package/lib/adapterCore/serverContext/types/index.js +4 -0
  63. package/lib/clients/handlers/fetch.js +1 -0
  64. package/lib/clients/internal/composeServiceApi.d.ts +5 -2
  65. package/lib/index.d.ts +11 -32
  66. package/lib/index.js +19 -100
  67. package/lib/libraryUtils.d.ts +21 -0
  68. package/lib/libraryUtils.js +105 -0
  69. package/lib/providers/pinpoint/apis/index.d.ts +2 -0
  70. package/lib/providers/pinpoint/apis/index.js +9 -0
  71. package/lib/providers/pinpoint/apis/record.d.ts +5 -0
  72. package/lib/providers/pinpoint/apis/record.js +120 -0
  73. package/lib/providers/pinpoint/apis/updateEndpoint.d.ts +5 -0
  74. package/lib/providers/pinpoint/apis/updateEndpoint.js +120 -0
  75. package/lib/providers/pinpoint/index.d.ts +2 -0
  76. package/lib/providers/pinpoint/index.js +19 -0
  77. package/lib/providers/pinpoint/types/buffer.d.ts +25 -0
  78. package/lib/providers/pinpoint/types/buffer.js +4 -0
  79. package/lib/providers/pinpoint/types/index.d.ts +1 -0
  80. package/lib/providers/pinpoint/types/index.js +19 -0
  81. package/lib/providers/pinpoint/types/pinpoint.d.ts +40 -0
  82. package/lib/providers/pinpoint/types/pinpoint.js +4 -0
  83. package/lib/providers/pinpoint/utils/PinpointEventBuffer.d.ts +23 -0
  84. package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +278 -0
  85. package/lib/providers/pinpoint/utils/cacheEndpointId.d.ts +7 -0
  86. package/lib/providers/pinpoint/utils/cacheEndpointId.js +61 -0
  87. package/lib/providers/pinpoint/utils/constants.d.ts +4 -0
  88. package/lib/providers/pinpoint/utils/constants.js +10 -0
  89. package/lib/providers/pinpoint/utils/getCacheKey.d.ts +7 -0
  90. package/lib/providers/pinpoint/utils/getCacheKey.js +13 -0
  91. package/lib/providers/pinpoint/utils/getEndpointId.d.ts +7 -0
  92. package/lib/providers/pinpoint/utils/getEndpointId.js +62 -0
  93. package/lib/providers/pinpoint/utils/getEventBuffer.d.ts +8 -0
  94. package/lib/providers/pinpoint/utils/getEventBuffer.js +48 -0
  95. package/lib/providers/pinpoint/utils/index.d.ts +3 -0
  96. package/lib/providers/pinpoint/utils/index.js +11 -0
  97. package/lib/server.d.ts +1 -0
  98. package/lib/server.js +7 -0
  99. package/lib/singleton/Amplify.d.ts +36 -0
  100. package/lib/singleton/Amplify.js +138 -0
  101. package/lib/singleton/Analytics/types.d.ts +2 -0
  102. package/lib/singleton/Analytics/types.js +4 -0
  103. package/lib/singleton/Auth/index.js +15 -12
  104. package/lib/singleton/Auth/types.d.ts +28 -3
  105. package/lib/singleton/Auth/utils/index.d.ts +3 -2
  106. package/lib/singleton/Auth/utils/index.js +15 -1
  107. package/lib/singleton/Storage/types.d.ts +6 -2
  108. package/lib/singleton/apis/fetchAuthSession.d.ts +2 -0
  109. package/lib/singleton/apis/fetchAuthSession.js +11 -0
  110. package/lib/singleton/apis/internal/fetchAuthSession.d.ts +3 -0
  111. package/lib/singleton/apis/internal/fetchAuthSession.js +9 -0
  112. package/lib/singleton/apis/server/fetchAuthSession.d.ts +3 -0
  113. package/lib/singleton/apis/server/fetchAuthSession.js +11 -0
  114. package/lib/singleton/index.d.ts +2 -46
  115. package/lib/singleton/index.js +7 -144
  116. package/lib/singleton/types.d.ts +3 -1
  117. package/lib/tsconfig.tsbuildinfo +1 -1
  118. package/lib/types/core.d.ts +47 -0
  119. package/lib/types/core.js +4 -0
  120. package/lib/types/errors.d.ts +16 -0
  121. package/lib/types/errors.js +4 -0
  122. package/lib/types/index.d.ts +4 -1
  123. package/lib/types/index.js +6 -3
  124. package/lib/types/logging.d.ts +13 -0
  125. package/lib/types/logging.js +4 -0
  126. package/lib/types/storage.d.ts +14 -0
  127. package/lib/types/storage.js +4 -0
  128. package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +1 -1
  129. package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +1 -1
  130. package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +1 -1
  131. package/lib-esm/AwsClients/Pinpoint/index.d.ts +1 -1
  132. package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +1 -1
  133. package/lib-esm/AwsClients/Pinpoint/putEvents.js +1 -1
  134. package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +1 -1
  135. package/lib-esm/Cache/AsyncStorageCache.js +1 -1
  136. package/lib-esm/Cache/BrowserStorageCache.js +1 -1
  137. package/lib-esm/Cache/InMemoryCache.js +1 -1
  138. package/lib-esm/Cache/StorageCache.js +2 -2
  139. package/lib-esm/Cache/Utils/CacheList.js +1 -1
  140. package/lib-esm/Credentials.js +2 -5
  141. package/lib-esm/{Hub.d.ts → Hub/index.d.ts} +5 -21
  142. package/lib-esm/Hub/index.js +148 -0
  143. package/lib-esm/Hub/types/AuthTypes.d.ts +11 -0
  144. package/lib-esm/Hub/types/HubTypes.d.ts +28 -0
  145. package/lib-esm/Hub/types/HubTypes.js +3 -0
  146. package/lib-esm/Hub/types/index.d.ts +2 -0
  147. package/lib-esm/Hub/types/index.js +4 -0
  148. package/lib-esm/I18n/I18n.js +2 -2
  149. package/lib-esm/I18n/index.js +1 -1
  150. package/lib-esm/OAuthHelper/FacebookOAuth.js +1 -1
  151. package/lib-esm/OAuthHelper/GoogleOAuth.js +1 -1
  152. package/lib-esm/Platform/version.d.ts +1 -1
  153. package/lib-esm/Platform/version.js +1 -1
  154. package/lib-esm/RNComponents/index.d.ts +1 -0
  155. package/lib-esm/RNComponents/index.js +2 -1
  156. package/lib-esm/RNComponents/isAppInForeground.d.ts +1 -0
  157. package/lib-esm/RNComponents/isAppInForeground.js +6 -0
  158. package/lib-esm/ServiceWorker/ServiceWorker.js +3 -3
  159. package/lib-esm/StorageHelper/localStorage.js +1 -1
  160. package/lib-esm/StorageHelper/sessionStorage.js +1 -1
  161. package/lib-esm/UniversalStorage/index.js +1 -1
  162. package/lib-esm/Util/Constants.d.ts +12 -8
  163. package/lib-esm/Util/Constants.js +20 -8
  164. package/lib-esm/{Errors.d.ts → Util/Errors.d.ts} +1 -1
  165. package/lib-esm/Util/Reachability.js +1 -1
  166. package/lib-esm/Util/errors/AssertError.js +1 -1
  167. package/lib-esm/Util/index.d.ts +1 -1
  168. package/lib-esm/Util/index.js +1 -1
  169. package/lib-esm/adapterCore/error/AmplifyServerContextError.d.ts +8 -0
  170. package/lib-esm/adapterCore/error/AmplifyServerContextError.js +32 -0
  171. package/lib-esm/adapterCore/error/index.d.ts +1 -0
  172. package/lib-esm/adapterCore/error/index.js +3 -0
  173. package/lib-esm/adapterCore/index.d.ts +2 -0
  174. package/lib-esm/adapterCore/index.js +4 -0
  175. package/lib-esm/adapterCore/serverContext/index.d.ts +2 -0
  176. package/lib-esm/adapterCore/serverContext/index.js +3 -0
  177. package/lib-esm/adapterCore/serverContext/serverContext.d.ts +20 -0
  178. package/lib-esm/adapterCore/serverContext/serverContext.js +36 -0
  179. package/lib-esm/adapterCore/serverContext/serverContextRegistry.d.ts +6 -0
  180. package/lib-esm/adapterCore/serverContext/serverContextRegistry.js +21 -0
  181. package/lib-esm/adapterCore/serverContext/types/amplifyServer.d.ts +16 -0
  182. package/lib-esm/adapterCore/serverContext/types/amplifyServer.js +3 -0
  183. package/lib-esm/adapterCore/serverContext/types/cookieStorage.d.ts +31 -0
  184. package/lib-esm/adapterCore/serverContext/types/cookieStorage.js +3 -0
  185. package/lib-esm/adapterCore/serverContext/types/index.d.ts +4 -0
  186. package/lib-esm/adapterCore/serverContext/types/index.js +3 -0
  187. package/lib-esm/clients/handlers/fetch.js +1 -0
  188. package/lib-esm/clients/internal/composeServiceApi.d.ts +5 -2
  189. package/lib-esm/index.d.ts +11 -32
  190. package/lib-esm/index.js +11 -29
  191. package/lib-esm/libraryUtils.d.ts +21 -0
  192. package/lib-esm/libraryUtils.js +33 -0
  193. package/lib-esm/providers/pinpoint/apis/index.d.ts +2 -0
  194. package/lib-esm/providers/pinpoint/apis/index.js +4 -0
  195. package/lib-esm/providers/pinpoint/apis/record.d.ts +5 -0
  196. package/lib-esm/providers/pinpoint/apis/record.js +116 -0
  197. package/lib-esm/providers/pinpoint/apis/updateEndpoint.d.ts +5 -0
  198. package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +116 -0
  199. package/lib-esm/providers/pinpoint/index.d.ts +2 -0
  200. package/lib-esm/providers/pinpoint/index.js +3 -0
  201. package/lib-esm/providers/pinpoint/types/buffer.d.ts +25 -0
  202. package/lib-esm/providers/pinpoint/types/buffer.js +3 -0
  203. package/lib-esm/providers/pinpoint/types/index.d.ts +1 -0
  204. package/lib-esm/providers/pinpoint/types/index.js +3 -0
  205. package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +40 -0
  206. package/lib-esm/providers/pinpoint/types/pinpoint.js +3 -0
  207. package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.d.ts +23 -0
  208. package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +275 -0
  209. package/lib-esm/providers/pinpoint/utils/cacheEndpointId.d.ts +7 -0
  210. package/lib-esm/providers/pinpoint/utils/cacheEndpointId.js +57 -0
  211. package/lib-esm/providers/pinpoint/utils/constants.d.ts +4 -0
  212. package/lib-esm/providers/pinpoint/utils/constants.js +7 -0
  213. package/lib-esm/providers/pinpoint/utils/getCacheKey.d.ts +7 -0
  214. package/lib-esm/providers/pinpoint/utils/getCacheKey.js +9 -0
  215. package/lib-esm/providers/pinpoint/utils/getEndpointId.d.ts +7 -0
  216. package/lib-esm/providers/pinpoint/utils/getEndpointId.js +58 -0
  217. package/lib-esm/providers/pinpoint/utils/getEventBuffer.d.ts +8 -0
  218. package/lib-esm/providers/pinpoint/utils/getEventBuffer.js +44 -0
  219. package/lib-esm/providers/pinpoint/utils/index.d.ts +3 -0
  220. package/lib-esm/providers/pinpoint/utils/index.js +5 -0
  221. package/lib-esm/server.d.ts +1 -0
  222. package/lib-esm/server.js +3 -0
  223. package/lib-esm/singleton/Amplify.d.ts +36 -0
  224. package/lib-esm/singleton/Amplify.js +135 -0
  225. package/lib-esm/singleton/Analytics/types.d.ts +2 -0
  226. package/lib-esm/singleton/Analytics/types.js +3 -0
  227. package/lib-esm/singleton/Auth/index.js +14 -11
  228. package/lib-esm/singleton/Auth/types.d.ts +28 -3
  229. package/lib-esm/singleton/Auth/utils/index.d.ts +3 -2
  230. package/lib-esm/singleton/Auth/utils/index.js +13 -0
  231. package/lib-esm/singleton/Storage/types.d.ts +6 -2
  232. package/lib-esm/singleton/apis/fetchAuthSession.d.ts +2 -0
  233. package/lib-esm/singleton/apis/fetchAuthSession.js +7 -0
  234. package/lib-esm/singleton/apis/internal/fetchAuthSession.d.ts +3 -0
  235. package/lib-esm/singleton/apis/internal/fetchAuthSession.js +5 -0
  236. package/lib-esm/singleton/apis/server/fetchAuthSession.d.ts +3 -0
  237. package/lib-esm/singleton/apis/server/fetchAuthSession.js +7 -0
  238. package/lib-esm/singleton/index.d.ts +2 -46
  239. package/lib-esm/singleton/index.js +2 -141
  240. package/lib-esm/singleton/types.d.ts +3 -1
  241. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  242. package/lib-esm/types/core.d.ts +47 -0
  243. package/lib-esm/types/core.js +3 -0
  244. package/lib-esm/types/errors.d.ts +16 -0
  245. package/lib-esm/types/errors.js +3 -0
  246. package/lib-esm/types/index.d.ts +4 -1
  247. package/lib-esm/types/index.js +4 -1
  248. package/lib-esm/types/logging.d.ts +13 -0
  249. package/lib-esm/types/logging.js +3 -0
  250. package/lib-esm/types/storage.d.ts +14 -0
  251. package/lib-esm/types/storage.js +3 -0
  252. package/package.json +15 -12
  253. package/server/package.json +8 -0
  254. package/src/AwsClients/Pinpoint/index.ts +1 -1
  255. package/src/AwsClients/Pinpoint/putEvents.ts +1 -1
  256. package/src/Cache/AsyncStorageCache.ts +1 -1
  257. package/src/Cache/BrowserStorageCache.ts +1 -1
  258. package/src/Cache/InMemoryCache.ts +1 -1
  259. package/src/Cache/StorageCache.ts +2 -2
  260. package/src/Cache/Utils/CacheList.ts +1 -1
  261. package/src/Credentials.ts +2 -8
  262. package/src/Hub/index.ts +204 -0
  263. package/src/Hub/types/AuthTypes.ts +10 -0
  264. package/src/Hub/types/HubTypes.ts +46 -0
  265. package/src/{Providers → Hub/types}/index.ts +3 -1
  266. package/src/I18n/I18n.ts +2 -2
  267. package/src/I18n/index.ts +1 -1
  268. package/src/Logger/ConsoleLogger.ts +1 -2
  269. package/src/OAuthHelper/FacebookOAuth.ts +1 -1
  270. package/src/OAuthHelper/GoogleOAuth.ts +1 -1
  271. package/src/Platform/version.ts +1 -1
  272. package/src/RNComponents/index.ts +2 -1
  273. package/src/RNComponents/isAppInForeground.ts +8 -0
  274. package/src/ServiceWorker/ServiceWorker.ts +3 -3
  275. package/src/StorageHelper/localStorage.ts +1 -1
  276. package/src/StorageHelper/sessionStorage.ts +1 -1
  277. package/src/UniversalStorage/index.ts +1 -1
  278. package/src/Util/Constants.ts +25 -16
  279. package/src/{Errors.ts → Util/Errors.ts} +1 -1
  280. package/src/Util/Reachability.ts +1 -1
  281. package/src/Util/errors/AssertError.ts +1 -1
  282. package/src/Util/index.ts +0 -4
  283. package/src/adapterCore/error/AmplifyServerContextError.ts +23 -0
  284. package/src/adapterCore/error/index.ts +4 -0
  285. package/src/adapterCore/index.ts +11 -0
  286. package/src/adapterCore/serverContext/index.ts +10 -0
  287. package/src/adapterCore/serverContext/serverContext.ts +54 -0
  288. package/src/adapterCore/serverContext/serverContextRegistry.ts +31 -0
  289. package/src/adapterCore/serverContext/types/amplifyServer.ts +29 -0
  290. package/src/adapterCore/serverContext/types/cookieStorage.ts +43 -0
  291. package/src/adapterCore/serverContext/types/index.ts +9 -0
  292. package/src/clients/handlers/fetch.ts +1 -0
  293. package/src/clients/internal/composeServiceApi.ts +13 -4
  294. package/src/index.ts +40 -120
  295. package/src/libraryUtils.ts +102 -0
  296. package/src/providers/pinpoint/apis/index.ts +5 -0
  297. package/src/providers/pinpoint/apis/record.ts +90 -0
  298. package/src/providers/pinpoint/apis/updateEndpoint.ts +82 -0
  299. package/src/providers/pinpoint/index.ts +5 -0
  300. package/src/providers/pinpoint/types/buffer.ts +32 -0
  301. package/{lib-esm/Providers/index.js → src/providers/pinpoint/types/index.ts} +2 -1
  302. package/src/providers/pinpoint/types/pinpoint.ts +55 -0
  303. package/src/providers/pinpoint/utils/PinpointEventBuffer.ts +248 -0
  304. package/src/providers/pinpoint/utils/cacheEndpointId.ts +27 -0
  305. package/src/providers/pinpoint/utils/constants.ts +8 -0
  306. package/src/providers/pinpoint/utils/getCacheKey.ts +16 -0
  307. package/src/providers/pinpoint/utils/getEndpointId.ts +20 -0
  308. package/src/providers/pinpoint/utils/getEventBuffer.ts +60 -0
  309. package/src/providers/pinpoint/utils/index.ts +6 -0
  310. package/src/server.ts +4 -0
  311. package/src/singleton/Amplify.ts +121 -0
  312. package/src/singleton/Analytics/types.ts +6 -0
  313. package/src/singleton/Auth/index.ts +7 -5
  314. package/src/singleton/Auth/types.ts +38 -6
  315. package/src/singleton/Auth/utils/index.ts +27 -1
  316. package/src/singleton/Storage/types.ts +6 -3
  317. package/src/singleton/apis/fetchAuthSession.ts +12 -0
  318. package/src/singleton/apis/internal/fetchAuthSession.ts +12 -0
  319. package/src/singleton/apis/server/fetchAuthSession.ts +16 -0
  320. package/src/singleton/index.ts +2 -128
  321. package/src/singleton/types.ts +4 -4
  322. package/src/types/core.ts +58 -0
  323. package/src/types/errors.ts +21 -0
  324. package/src/types/index.ts +5 -1
  325. package/src/types/logging.ts +24 -0
  326. package/src/types/storage.ts +19 -0
  327. package/lib/Hub.js +0 -220
  328. package/lib/Providers/AWSCloudWatchProvider.d.ts +0 -34
  329. package/lib/Providers/AWSCloudWatchProvider.js +0 -619
  330. package/lib/Providers/index.d.ts +0 -1
  331. package/lib/Providers/index.js +0 -7
  332. package/lib/constants.d.ts +0 -9
  333. package/lib/constants.js +0 -22
  334. package/lib/types/types.d.ts +0 -76
  335. package/lib-esm/Hub.js +0 -217
  336. package/lib-esm/Providers/AWSCloudWatchProvider.d.ts +0 -34
  337. package/lib-esm/Providers/AWSCloudWatchProvider.js +0 -616
  338. package/lib-esm/Providers/index.d.ts +0 -1
  339. package/lib-esm/constants.d.ts +0 -9
  340. package/lib-esm/constants.js +0 -19
  341. package/lib-esm/types/types.d.ts +0 -76
  342. package/src/Hub.ts +0 -236
  343. package/src/Providers/AWSCloudWatchProvider.ts +0 -540
  344. package/src/constants.ts +0 -31
  345. package/src/types/types.ts +0 -104
  346. /package/lib/{types/types.js → Hub/types/AuthTypes.js} +0 -0
  347. /package/lib/{Errors.js → Util/Errors.js} +0 -0
  348. /package/lib/{JS.d.ts → Util/JS.d.ts} +0 -0
  349. /package/lib/{JS.js → Util/JS.js} +0 -0
  350. /package/lib-esm/{types/types.js → Hub/types/AuthTypes.js} +0 -0
  351. /package/lib-esm/{Errors.js → Util/Errors.js} +0 -0
  352. /package/lib-esm/{JS.d.ts → Util/JS.d.ts} +0 -0
  353. /package/lib-esm/{JS.js → Util/JS.js} +0 -0
  354. /package/src/{JS.ts → Util/JS.ts} +0 -0
@@ -0,0 +1,60 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { EventBufferConfig } from '../types/buffer';
5
+ import { PinpointEventBuffer } from './PinpointEventBuffer';
6
+ import { BUFFER_SIZE, FLUSH_INTERVAL, FLUSH_SIZE, RESEND_LIMIT } from './constants';
7
+
8
+ // Map of buffers by region -> appId
9
+ const eventBufferMap: Record<string, Record<string, PinpointEventBuffer>> = {};
10
+
11
+ /**
12
+ * Returns a PinpointEventBuffer instance for the specified region & app ID, creating one if it does not yet exist.
13
+ *
14
+ * @internal
15
+ */
16
+ export const getEventBuffer = ({
17
+ appId,
18
+ bufferSize = BUFFER_SIZE,
19
+ credentials,
20
+ flushInterval = FLUSH_INTERVAL,
21
+ flushSize = FLUSH_SIZE,
22
+ identityId,
23
+ region,
24
+ resendLimit = RESEND_LIMIT,
25
+ userAgentValue
26
+ }: EventBufferConfig): PinpointEventBuffer => {
27
+ if (eventBufferMap[region]?.[appId]) {
28
+ const buffer = eventBufferMap[region][appId];
29
+
30
+ /*
31
+ If the identity has changed flush out the buffer and create a new instance. The old instance will be garbage
32
+ collected.
33
+ */
34
+ if (buffer.identityHasChanged(identityId)) {
35
+ buffer.flush();
36
+ } else {
37
+ return buffer;
38
+ }
39
+ }
40
+
41
+ const buffer = new PinpointEventBuffer({
42
+ appId,
43
+ bufferSize,
44
+ credentials,
45
+ flushInterval,
46
+ flushSize,
47
+ identityId,
48
+ region,
49
+ resendLimit,
50
+ userAgentValue
51
+ });
52
+
53
+ if (!eventBufferMap[region]) {
54
+ eventBufferMap[region] = {};
55
+ }
56
+
57
+ eventBufferMap[region][appId] = buffer;
58
+
59
+ return buffer;
60
+ };
@@ -0,0 +1,6 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export { cacheEndpointId } from './cacheEndpointId';
5
+ export { getCacheKey } from './getCacheKey';
6
+ export { getEndpointId } from './getEndpointId';
package/src/server.ts ADDED
@@ -0,0 +1,4 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export { fetchAuthSession } from './singleton/apis/server/fetchAuthSession';
@@ -0,0 +1,121 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { AuthClass } from './Auth';
4
+ import { Hub, AMPLIFY_SYMBOL } from '../Hub';
5
+ import { LibraryOptions, ResourcesConfig } from './types';
6
+
7
+ // TODO(v6): add default AuthTokenStore for each platform
8
+
9
+ export class AmplifyClass {
10
+ resourcesConfig: ResourcesConfig;
11
+ libraryOptions: LibraryOptions;
12
+ /**
13
+ * Cross-category Auth utilities.
14
+ *
15
+ * @internal
16
+ */
17
+ public readonly Auth: AuthClass;
18
+ constructor() {
19
+ this.resourcesConfig = {};
20
+ this.Auth = new AuthClass();
21
+
22
+ // TODO(v6): add default providers for getting started
23
+ this.libraryOptions = {};
24
+ }
25
+
26
+ /**
27
+ * Configures Amplify for use with your back-end resources.
28
+ *
29
+ * @remarks
30
+ * `configure` can be used to specify additional library options where available for supported categories.
31
+ *
32
+ * @param resourceConfig - Back-end resource configuration. Typically provided via the `aws-exports.js` file.
33
+ * @param libraryOptions - Additional options for customizing the behavior of the library.
34
+ */
35
+ configure(
36
+ resourcesConfig: ResourcesConfig,
37
+ libraryOptions: LibraryOptions = {}
38
+ ): void {
39
+ this.resourcesConfig = mergeResourceConfig(
40
+ this.resourcesConfig,
41
+ resourcesConfig
42
+ );
43
+
44
+ this.libraryOptions = mergeLibraryOptions(
45
+ this.libraryOptions,
46
+ libraryOptions
47
+ );
48
+
49
+ this.Auth.configure(this.resourcesConfig.Auth!, this.libraryOptions.Auth);
50
+
51
+ Hub.dispatch(
52
+ 'core',
53
+ {
54
+ event: 'configure',
55
+ data: resourcesConfig,
56
+ },
57
+ 'Configure',
58
+ AMPLIFY_SYMBOL
59
+ );
60
+ }
61
+
62
+ /**
63
+ * Provides access to the current back-end resource configuration for the Library.
64
+ *
65
+ * @returns Returns the current back-end resource configuration.
66
+ */
67
+ getConfig(): ResourcesConfig {
68
+ return JSON.parse(JSON.stringify(this.resourcesConfig));
69
+ }
70
+ }
71
+
72
+ /**
73
+ * The `Amplify` utility is used to configure the library.
74
+ *
75
+ * @remarks
76
+ * `Amplify` is responsible for orchestrating cross-category communication within the library.
77
+ */
78
+ export const Amplify = new AmplifyClass();
79
+
80
+ // TODO(v6): validate until which level this will nested, during Amplify.configure API review.
81
+ function mergeResourceConfig(
82
+ existingConfig: ResourcesConfig,
83
+ newConfig: ResourcesConfig
84
+ ): ResourcesConfig {
85
+ const resultConfig: Record<string, any> = {};
86
+
87
+ for (const category of Object.keys(existingConfig)) {
88
+ resultConfig[category] = existingConfig[category as keyof ResourcesConfig];
89
+ }
90
+
91
+ for (const key of Object.keys(newConfig).filter(key => key !== 'ssr')) {
92
+ resultConfig[key] = {
93
+ ...resultConfig[key],
94
+ ...newConfig[key as Exclude<keyof ResourcesConfig, 'ssr'>],
95
+ };
96
+ }
97
+
98
+ resultConfig.ssr = newConfig.ssr;
99
+
100
+ return resultConfig;
101
+ }
102
+
103
+ function mergeLibraryOptions(
104
+ existingConfig: LibraryOptions,
105
+ newConfig: LibraryOptions
106
+ ): LibraryOptions {
107
+ const resultConfig: Record<string, any> = {};
108
+
109
+ for (const category of Object.keys(existingConfig)) {
110
+ resultConfig[category] = existingConfig[category as keyof LibraryOptions];
111
+ }
112
+
113
+ for (const category of Object.keys(newConfig)) {
114
+ resultConfig[category] = {
115
+ ...resultConfig[category],
116
+ ...newConfig[category as keyof LibraryOptions],
117
+ };
118
+ }
119
+
120
+ return resultConfig;
121
+ }
@@ -0,0 +1,6 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { PinpointProviderConfig } from '../../providers/pinpoint/types';
5
+
6
+ export type AnalyticsConfig = PinpointProviderConfig;
@@ -11,7 +11,7 @@ import {
11
11
  LibraryAuthOptions,
12
12
  } from './types';
13
13
  import { asserts } from '../../Util/errors/AssertError';
14
- import { AUTH_CONFING_EXCEPTION } from '../../constants';
14
+ import { AUTH_CONFING_EXCEPTION } from '../../Util/Constants';
15
15
 
16
16
  export function isTokenExpired({
17
17
  expiresAt,
@@ -57,15 +57,17 @@ export class AuthClass {
57
57
  let tokens: AuthTokens | undefined;
58
58
  let credentialsAndIdentityId: AWSCredentialsAndIdentityId | undefined;
59
59
 
60
- // Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available
61
- tokens =
62
- (await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined;
63
60
  asserts(!!this.authConfig, {
64
61
  name: AUTH_CONFING_EXCEPTION,
65
62
  message: 'AuthConfig is required',
66
63
  recoverySuggestion:
67
64
  'call Amplify.configure in your app with a valid AuthConfig',
68
65
  });
66
+
67
+ // Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available
68
+ tokens =
69
+ (await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined;
70
+
69
71
  if (tokens) {
70
72
  // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)
71
73
  credentialsAndIdentityId =
@@ -77,7 +79,7 @@ export class AuthClass {
77
79
  forceRefresh: options.forceRefresh,
78
80
  }
79
81
  );
80
- } else {
82
+ } else if (!this.authConfig.isMandatorySignInEnabled) {
81
83
  // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)
82
84
  credentialsAndIdentityId =
83
85
  await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId(
@@ -3,8 +3,6 @@
3
3
  // From https://github.com/awslabs/aws-jwt-verify/blob/main/src/safe-json-parse.ts
4
4
  // From https://github.com/awslabs/aws-jwt-verify/blob/main/src/jwt-model.ts
5
5
 
6
- import { Credentials } from '@aws-sdk/types';
7
-
8
6
  interface JwtPayloadStandardFields {
9
7
  exp?: number; // expires: https://tools.ietf.org/html/rfc7519#section-4.1.4
10
8
  iss?: string; // issuer: https://tools.ietf.org/html/rfc7519#section-4.1.1
@@ -56,7 +54,7 @@ export interface AWSCredentialsAndIdentityIdProvider {
56
54
  export type TokenProvider = {
57
55
  getTokens: ({
58
56
  forceRefresh,
59
- }: {
57
+ }?: {
60
58
  forceRefresh?: boolean;
61
59
  }) => Promise<AuthTokens | null>;
62
60
  };
@@ -70,10 +68,19 @@ export type AuthTokens = {
70
68
  accessToken: JWT;
71
69
  };
72
70
 
73
- export type AuthConfig =
71
+ export type AuthConfig = StrictUnion<
74
72
  | IdentityPoolConfig
75
73
  | UserPoolConfig
76
- | UserPoolConfigAndIdentityPoolConfig;
74
+ | UserPoolConfigWithOAuth
75
+ | UserPoolConfigAndIdentityPoolConfig
76
+ | UserPoolConfigAndIdentityPoolConfigWithOAuth
77
+ >;
78
+
79
+ type UnionKeys<T> = T extends T ? keyof T : never;
80
+ type StrictUnionHelper<T, TAll> = T extends any
81
+ ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>>
82
+ : never;
83
+ type StrictUnion<T> = StrictUnionHelper<T, T>;
77
84
 
78
85
  export type IdentityPoolConfig = {
79
86
  identityPoolId: string;
@@ -90,6 +97,22 @@ export type UserPoolConfig = {
90
97
  clientMetadata?: Record<string, string>;
91
98
  };
92
99
 
100
+ export type UserPoolConfigWithOAuth = {
101
+ userPoolWebClientId: string;
102
+ userPoolId: string;
103
+ identityPoolId?: never;
104
+ clientMetadata?: Record<string, string>;
105
+ oauth: OAuthConfig;
106
+ };
107
+
108
+ export type OAuthConfig = {
109
+ domain: string;
110
+ scopes: Array<string>;
111
+ redirectSignIn: string;
112
+ redirectSignOut: string;
113
+ responseType: string;
114
+ };
115
+
93
116
  export type UserPoolConfigAndIdentityPoolConfig = {
94
117
  userPoolWebClientId: string;
95
118
  userPoolId: string;
@@ -98,6 +121,15 @@ export type UserPoolConfigAndIdentityPoolConfig = {
98
121
  isMandatorySignInEnabled?: boolean;
99
122
  };
100
123
 
124
+ export type UserPoolConfigAndIdentityPoolConfigWithOAuth = {
125
+ userPoolWebClientId: string;
126
+ userPoolId: string;
127
+ identityPoolId: string;
128
+ clientMetadata?: Record<string, string>;
129
+ isMandatorySignInEnabled?: boolean;
130
+ oauth: OAuthConfig;
131
+ };
132
+
101
133
  export type GetCredentialsOptions =
102
134
  | GetCredentialsAuthenticatedUser
103
135
  | GetCredentialsUnauthenticatedUser;
@@ -106,7 +138,7 @@ type GetCredentialsAuthenticatedUser = {
106
138
  authenticated: true;
107
139
  forceRefresh?: boolean;
108
140
  authConfig: AuthConfig;
109
- tokens?: AuthTokens;
141
+ tokens: AuthTokens;
110
142
  };
111
143
 
112
144
  type GetCredentialsUnauthenticatedUser = {
@@ -8,11 +8,17 @@ import {
8
8
  JWT,
9
9
  UserPoolConfig,
10
10
  UserPoolConfigAndIdentityPoolConfig,
11
+ UserPoolConfigAndIdentityPoolConfigWithOAuth,
12
+ UserPoolConfigWithOAuth,
11
13
  } from '../types';
12
14
 
13
15
  export function assertTokenProviderConfig(
14
16
  authConfig?: AuthConfig
15
- ): asserts authConfig is UserPoolConfig {
17
+ ): asserts authConfig is
18
+ | UserPoolConfigAndIdentityPoolConfigWithOAuth
19
+ | UserPoolConfigWithOAuth
20
+ | UserPoolConfigAndIdentityPoolConfig
21
+ | UserPoolConfig {
16
22
  const validConfig =
17
23
  !!authConfig?.userPoolId && !!authConfig?.userPoolWebClientId;
18
24
  return asserts(validConfig, {
@@ -22,6 +28,26 @@ export function assertTokenProviderConfig(
22
28
  });
23
29
  }
24
30
 
31
+ export function assertOAuthConfig(
32
+ authConfig?: AuthConfig
33
+ ): asserts authConfig is
34
+ | UserPoolConfigAndIdentityPoolConfigWithOAuth
35
+ | UserPoolConfigWithOAuth {
36
+ assertTokenProviderConfig(authConfig);
37
+ const validOAuthConfig =
38
+ !!authConfig.oauth?.domain &&
39
+ !!authConfig.oauth?.redirectSignOut &&
40
+ !!authConfig.oauth?.redirectSignIn &&
41
+ !!authConfig.oauth?.responseType;
42
+
43
+ return asserts(validOAuthConfig, {
44
+ name: 'OAuthNotConfigureException',
45
+ message: 'oauth param not configured',
46
+ recoverySuggestion:
47
+ 'Make sure to call Amplify.configure with oauth parameter in your app',
48
+ });
49
+ }
50
+
25
51
  export function assertIdentityPooIdConfig(
26
52
  authConfig: AuthConfig
27
53
  ): asserts authConfig is IdentityPoolConfig {
@@ -6,6 +6,7 @@ export type StorageAccessLevel = 'guest' | 'protected' | 'private';
6
6
  export interface StorageConfig {
7
7
  bucket?: string;
8
8
  region?: string;
9
+ dangerouslyConnectToHttpEndpointForTesting?: string;
9
10
  }
10
11
 
11
12
  type StoragePrefixResolver = (params: {
@@ -13,9 +14,11 @@ type StoragePrefixResolver = (params: {
13
14
  targetIdentityId?: string;
14
15
  }) => Promise<string>;
15
16
 
16
- // TODO[AllanZhengYP]: support isObjectLockEnabled config to S3 plugin config
17
17
  // TODO[AllanZhengYP]: need to finalize the decision whether to move defaultAccessLevel to StorageConfig
18
18
  export interface LibraryStorageOptions {
19
- prefixResolver?: StoragePrefixResolver;
20
- defaultAccessLevel?: StorageAccessLevel;
19
+ AWSS3: {
20
+ prefixResolver?: StoragePrefixResolver;
21
+ defaultAccessLevel?: StorageAccessLevel;
22
+ isObjectLockEnabled?: boolean;
23
+ };
21
24
  }
@@ -0,0 +1,12 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { fetchAuthSession as fetchAuthSessionInternal } from './internal/fetchAuthSession';
5
+ import { Amplify } from '../Amplify';
6
+ import { AuthSession, FetchAuthSessionOptions } from '../Auth/types';
7
+
8
+ export const fetchAuthSession = (
9
+ options?: FetchAuthSessionOptions
10
+ ): Promise<AuthSession> => {
11
+ return fetchAuthSessionInternal(Amplify, options);
12
+ };
@@ -0,0 +1,12 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { AmplifyClass } from '../../Amplify';
5
+ import { AuthSession, FetchAuthSessionOptions } from '../../Auth/types';
6
+
7
+ export const fetchAuthSession = (
8
+ amplify: AmplifyClass,
9
+ options?: FetchAuthSessionOptions
10
+ ): Promise<AuthSession> => {
11
+ return amplify.Auth.fetchAuthSession(options);
12
+ };
@@ -0,0 +1,16 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { AmplifyServer, getAmplifyServerContext } from '../../../adapterCore';
5
+ import { AuthSession, FetchAuthSessionOptions } from '../../Auth/types';
6
+ import { fetchAuthSession as fetchAuthSessionInternal } from '../internal/fetchAuthSession';
7
+
8
+ export const fetchAuthSession = (
9
+ contextSpec: AmplifyServer.ContextSpec,
10
+ options?: FetchAuthSessionOptions
11
+ ): Promise<AuthSession> => {
12
+ return fetchAuthSessionInternal(
13
+ getAmplifyServerContext(contextSpec).amplify,
14
+ options
15
+ );
16
+ };
@@ -1,131 +1,5 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { AuthClass } from './Auth';
4
- import { Hub } from '../Hub';
5
- import { LibraryOptions, ResourcesConfig } from './types';
6
- import { AmplifyError } from '../Errors';
7
- import { FetchAuthSessionOptions } from './Auth/types';
8
3
 
9
- // TODO(v6): add default AuthTokenStore for each platform
10
-
11
- class AmplifyClass {
12
- resourcesConfig: ResourcesConfig;
13
- libraryOptions: LibraryOptions;
14
- /**
15
- * Cross-category Auth utilities.
16
- *
17
- * @internal
18
- */
19
- public readonly Auth: AuthClass;
20
- constructor() {
21
- this.resourcesConfig = {};
22
- this.Auth = new AuthClass();
23
-
24
- // TODO(v6): add default providers for getting started
25
- this.libraryOptions = {};
26
- }
27
-
28
- /**
29
- * Configures Amplify for use with your back-end resources.
30
- *
31
- * @remarks
32
- * `configure` can be used to specify additional library options where available for supported categories.
33
- *
34
- * @param resourceConfig - Back-end resource configuration. Typically provided via the `aws-exports.js` file.
35
- * @param libraryOptions - Additional options for customizing the behavior of the library.
36
- */
37
- configure(
38
- resourcesConfig: ResourcesConfig,
39
- libraryOptions: LibraryOptions = {}
40
- ): void {
41
- this.resourcesConfig = mergeResourceConfig(
42
- this.resourcesConfig,
43
- resourcesConfig
44
- );
45
-
46
- this.libraryOptions = mergeLibraryOptions(
47
- this.libraryOptions,
48
- libraryOptions
49
- );
50
-
51
- this.Auth.configure(this.resourcesConfig.Auth!, this.libraryOptions.Auth);
52
-
53
- Hub.dispatch(
54
- 'core',
55
- {
56
- event: 'configure',
57
- data: resourcesConfig,
58
- },
59
- 'Configure'
60
- );
61
- }
62
-
63
- /**
64
- * Provides access to the current back-end resource configuration for the Library.
65
- *
66
- * @returns Returns the current back-end resource configuration.
67
- */
68
- getConfig(): ResourcesConfig {
69
- return JSON.parse(JSON.stringify(this.resourcesConfig));
70
- }
71
- }
72
-
73
- /**
74
- * The `Amplify` utility is used to configure the library.
75
- *
76
- * @remarks
77
- * `Amplify` is responsible for orchestrating cross-category communication within the library.
78
- */
79
- export const AmplifyV6 = new AmplifyClass();
80
-
81
- /**
82
- * Returns current session tokens and credentials
83
- *
84
- * @param options{FetchAuthSessionOptions} - Options for fetching session.
85
- *
86
- * @returns Returns a promise that will resolve with fresh authentication tokens.
87
- */
88
- export const fetchAuthSession = (options: FetchAuthSessionOptions) => {
89
- return AmplifyV6.Auth.fetchAuthSession(options);
90
- };
91
-
92
- // TODO(v6): validate until which level this will nested, during Amplify.configure API review.
93
- function mergeResourceConfig(
94
- existingConfig: ResourcesConfig,
95
- newConfig: ResourcesConfig
96
- ): ResourcesConfig {
97
- const resultConfig: Record<string, any> = {};
98
-
99
- for (const category of Object.keys(existingConfig)) {
100
- resultConfig[category] = existingConfig[category as keyof ResourcesConfig];
101
- }
102
-
103
- for (const category of Object.keys(newConfig)) {
104
- resultConfig[category] = {
105
- ...resultConfig[category],
106
- ...newConfig[category as keyof ResourcesConfig],
107
- };
108
- }
109
-
110
- return resultConfig;
111
- }
112
-
113
- function mergeLibraryOptions(
114
- existingConfig: LibraryOptions,
115
- newConfig: LibraryOptions
116
- ): LibraryOptions {
117
- const resultConfig: Record<string, any> = {};
118
-
119
- for (const category of Object.keys(existingConfig)) {
120
- resultConfig[category] = existingConfig[category as keyof LibraryOptions];
121
- }
122
-
123
- for (const category of Object.keys(newConfig)) {
124
- resultConfig[category] = {
125
- ...resultConfig[category],
126
- ...newConfig[category as keyof LibraryOptions],
127
- };
128
- }
129
-
130
- return resultConfig;
131
- }
4
+ export { AmplifyClass, Amplify } from './Amplify';
5
+ export { fetchAuthSession } from './apis/fetchAuthSession';
@@ -1,6 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import { AnalyticsConfig } from './Analytics/types';
4
5
  import {
5
6
  AuthConfig,
6
7
  LibraryAuthOptions,
@@ -14,14 +15,12 @@ import {
14
15
  StorageAccessLevel,
15
16
  StorageConfig,
16
17
  } from './Storage/types';
17
- import {
18
- CacheConfig
19
- } from '../Cache/types';
18
+ import { CacheConfig } from '../Cache/types';
20
19
  import { I18nOptions } from '../I18n/types';
21
20
 
22
21
  export type ResourcesConfig = {
23
22
  API?: {};
24
- Analytics?: {};
23
+ Analytics?: AnalyticsConfig;
25
24
  Auth?: AuthConfig;
26
25
  Cache?: CacheConfig;
27
26
  DataStore?: {};
@@ -30,6 +29,7 @@ export type ResourcesConfig = {
30
29
  Notifications?: {};
31
30
  Predictions?: {};
32
31
  Storage?: StorageConfig;
32
+ ssr?: boolean;
33
33
  };
34
34
 
35
35
  export type LibraryOptions = {
@@ -0,0 +1,58 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export interface AmplifyConfig {
5
+ Analytics?: object;
6
+ Auth?: object;
7
+ API?: object;
8
+ Logging?: object;
9
+ Storage?: object;
10
+ Cache?: object;
11
+ Geo?: object;
12
+ Notifications?: {
13
+ InAppMessaging?: object;
14
+ };
15
+ ssr?: boolean;
16
+ }
17
+
18
+ export type UserProfile = {
19
+ attributes?: Record<string, string[]>;
20
+ demographic?: {
21
+ appVersion?: string;
22
+ locale?: string;
23
+ make?: string;
24
+ model?: string;
25
+ modelVersion?: string;
26
+ platform?: string;
27
+ platformVersion?: string;
28
+ timezone?: string;
29
+ };
30
+ location?: {
31
+ city?: string;
32
+ country?: string;
33
+ latitude?: number;
34
+ longitude?: number;
35
+ postalCode?: string;
36
+ region?: string;
37
+ };
38
+ metrics?: Record<string, number>;
39
+ };
40
+
41
+ export interface ICredentials {
42
+ accessKeyId: string;
43
+ sessionToken: string;
44
+ secretAccessKey: string;
45
+ identityId: string;
46
+ authenticated: boolean;
47
+ // Long term creds do not provide an expiration date
48
+ expiration?: Date;
49
+ }
50
+
51
+ /**
52
+ * @internal
53
+ */
54
+ export type DelayFunction = (
55
+ attempt: number,
56
+ args?: any[],
57
+ error?: unknown
58
+ ) => number | false;
@@ -0,0 +1,21 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export type ErrorParams = {
5
+ message: string;
6
+ name: string;
7
+ recoverySuggestion?: string;
8
+ underlyingError?: Error | unknown;
9
+ };
10
+
11
+ export type AmplifyErrorMap<ErrorCode extends string> = {
12
+ [name in ErrorCode]: {
13
+ message: string;
14
+ recoverySuggestion?: string;
15
+ };
16
+ };
17
+
18
+ export type ServiceError = {
19
+ name: string;
20
+ message: string;
21
+ };