@aws-amplify/core 6.0.1-console-preview.7919075.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 -157
  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 -154
  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 -141
  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
@@ -1,5 +1,6 @@
1
1
  export declare const Linking: {};
2
2
  export declare const AppState: {
3
3
  addEventListener: (action: any, handler: any) => undefined;
4
+ currentState: string;
4
5
  };
5
6
  export declare const AsyncStorage: any;
@@ -3,11 +3,12 @@
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.AsyncStorage = exports.AppState = exports.Linking = void 0;
6
- var JS_1 = require("../JS");
6
+ var JS_1 = require("../Util/JS");
7
7
  var StorageHelper_1 = require("../StorageHelper");
8
8
  exports.Linking = {};
9
9
  exports.AppState = {
10
10
  addEventListener: function (action, handler) { return undefined; },
11
+ currentState: 'active'
11
12
  };
12
13
  // if not in react native, just use local storage
13
14
  exports.AsyncStorage = (0, JS_1.browserOrNode)().isBrowser
@@ -0,0 +1 @@
1
+ export declare const isAppInForeground: () => boolean;
@@ -0,0 +1,10 @@
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
+ exports.isAppInForeground = void 0;
6
+ var _1 = require(".");
7
+ var isAppInForeground = function () {
8
+ return _1.AppState.currentState === 'active';
9
+ };
10
+ exports.isAppInForeground = isAppInForeground;
@@ -16,11 +16,11 @@ exports.ServiceWorkerClass = void 0;
16
16
  * and limitations under the License.
17
17
  */
18
18
  var Logger_1 = require("../Logger");
19
- var JS_1 = require("../JS");
19
+ var JS_1 = require("../Util/JS");
20
20
  var Amplify_1 = require("../Amplify");
21
21
  var AssertError_1 = require("../Util/errors/AssertError");
22
- var Errors_1 = require("../Errors");
23
- var constants_1 = require("../constants");
22
+ var Errors_1 = require("../Util/Errors");
23
+ var Constants_1 = require("../Util/Constants");
24
24
  /**
25
25
  * Provides a means to registering a service worker in the browser
26
26
  * and communicating with it via postMessage events.
@@ -44,7 +44,7 @@ var ServiceWorkerClass = /** @class */ (function () {
44
44
  */
45
45
  get: function () {
46
46
  (0, AssertError_1.asserts)(this._serviceWorker !== undefined, {
47
- name: constants_1.SERVICE_WORKER_EXCEPTION,
47
+ name: Constants_1.SERVICE_WORKER_EXCEPTION,
48
48
  message: 'Service Worker instance is undefined',
49
49
  });
50
50
  return this._serviceWorker;
@@ -94,7 +94,7 @@ var ServiceWorkerClass = /** @class */ (function () {
94
94
  .catch(function (error) {
95
95
  _this._logger.debug("Service Worker Registration Failed ".concat(error));
96
96
  return reject(new Errors_1.AmplifyError({
97
- name: constants_1.SERVICE_WORKER_EXCEPTION,
97
+ name: Constants_1.SERVICE_WORKER_EXCEPTION,
98
98
  message: 'Service Worker not available',
99
99
  underlyingError: error,
100
100
  }));
@@ -102,7 +102,7 @@ var ServiceWorkerClass = /** @class */ (function () {
102
102
  }
103
103
  else {
104
104
  return reject(new Errors_1.AmplifyError({
105
- name: constants_1.SERVICE_WORKER_EXCEPTION,
105
+ name: Constants_1.SERVICE_WORKER_EXCEPTION,
106
106
  message: 'Service Worker not available',
107
107
  }));
108
108
  }
@@ -122,14 +122,14 @@ var ServiceWorkerClass = /** @class */ (function () {
122
122
  ServiceWorkerClass.prototype.enablePush = function (publicKey) {
123
123
  var _this = this;
124
124
  (0, AssertError_1.asserts)(this._registration !== undefined, {
125
- name: constants_1.SERVICE_WORKER_EXCEPTION,
125
+ name: Constants_1.SERVICE_WORKER_EXCEPTION,
126
126
  message: 'Service Worker registration is undefined',
127
127
  });
128
128
  this._publicKey = publicKey;
129
129
  return new Promise(function (resolve, reject) {
130
130
  if ((0, JS_1.browserOrNode)().isBrowser) {
131
131
  (0, AssertError_1.asserts)(_this._registration !== undefined, {
132
- name: constants_1.SERVICE_WORKER_EXCEPTION,
132
+ name: Constants_1.SERVICE_WORKER_EXCEPTION,
133
133
  message: 'Service Worker registration is undefined',
134
134
  });
135
135
  _this._registration.pushManager.getSubscription().then(function (subscription) {
@@ -157,7 +157,7 @@ var ServiceWorkerClass = /** @class */ (function () {
157
157
  }
158
158
  else {
159
159
  return reject(new Errors_1.AmplifyError({
160
- name: constants_1.SERVICE_WORKER_EXCEPTION,
160
+ name: Constants_1.SERVICE_WORKER_EXCEPTION,
161
161
  message: 'Service Worker not available',
162
162
  }));
163
163
  }
@@ -39,7 +39,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
39
39
  };
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.LocalStorage = void 0;
42
- var Errors_1 = require("../Errors");
42
+ var Errors_1 = require("../Util/Errors");
43
43
  var LocalStorageClass = /** @class */ (function () {
44
44
  function LocalStorageClass() {
45
45
  if (typeof window !== undefined) {
@@ -39,7 +39,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
39
39
  };
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.SessionStorage = void 0;
42
- var Errors_1 = require("../Errors");
42
+ var Errors_1 = require("../Util/Errors");
43
43
  var SessionStorageClass = /** @class */ (function () {
44
44
  function SessionStorageClass() {
45
45
  if (typeof window !== undefined) {
@@ -18,7 +18,7 @@ exports.UniversalStorage = void 0;
18
18
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
19
19
  // SPDX-License-Identifier: Apache-2.0
20
20
  var universal_cookie_1 = __importDefault(require("universal-cookie"));
21
- var JS_1 = require("../JS");
21
+ var JS_1 = require("../Util/JS");
22
22
  var isBrowser = (0, JS_1.browserOrNode)().isBrowser;
23
23
  var ONE_YEAR_IN_MS = 365 * 24 * 60 * 60 * 1000;
24
24
  var UniversalStorage = /** @class */ (function () {
@@ -1,8 +1,12 @@
1
- declare const AWS_CLOUDWATCH_BASE_BUFFER_SIZE = 26;
2
- declare const AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE = 1048576;
3
- declare const AWS_CLOUDWATCH_MAX_EVENT_SIZE = 256000;
4
- declare const AWS_CLOUDWATCH_CATEGORY = "Logging";
5
- declare const AWS_CLOUDWATCH_PROVIDER_NAME = "AWSCloudWatch";
6
- declare const NO_CREDS_ERROR_STRING = "No credentials";
7
- declare const RETRY_ERROR_CODES: string[];
8
- export { AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, };
1
+ export declare const AWS_CLOUDWATCH_CATEGORY = "Logging";
2
+ export declare const NO_CREDS_ERROR_STRING = "No credentials";
3
+ export declare const RETRY_ERROR_CODES: string[];
4
+ export declare const INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER: string | symbol;
5
+ export declare const USER_AGENT_HEADER = "x-amz-user-agent";
6
+ export declare const AUTH_CONFING_EXCEPTION = "AuthConfigException";
7
+ export declare const CACHE_LIST_EXCEPTION = "CacheListException";
8
+ export declare const I18N_EXCEPTION = "I18NException";
9
+ export declare const SERVICE_WORKER_EXCEPTION = "ServiceWorkerException";
10
+ export declare const STORAGE_CACHE_EXCEPTION = "StorageCacheException";
11
+ export declare const APPLICATION_ID_EXCEPTION = "ApplicationIdException";
12
+ export declare const NO_HUBCALLBACK_PROVIDED_EXCEPTION = "NoHubcallbackProvidedException";
@@ -2,22 +2,28 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.RETRY_ERROR_CODES = exports.NO_CREDS_ERROR_STRING = exports.AWS_CLOUDWATCH_PROVIDER_NAME = exports.AWS_CLOUDWATCH_MAX_EVENT_SIZE = exports.AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE = exports.AWS_CLOUDWATCH_CATEGORY = exports.AWS_CLOUDWATCH_BASE_BUFFER_SIZE = void 0;
5
+ exports.NO_HUBCALLBACK_PROVIDED_EXCEPTION = exports.APPLICATION_ID_EXCEPTION = exports.STORAGE_CACHE_EXCEPTION = exports.SERVICE_WORKER_EXCEPTION = exports.I18N_EXCEPTION = exports.CACHE_LIST_EXCEPTION = exports.AUTH_CONFING_EXCEPTION = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.RETRY_ERROR_CODES = exports.NO_CREDS_ERROR_STRING = exports.AWS_CLOUDWATCH_CATEGORY = void 0;
6
6
  // Logging constants
7
- var AWS_CLOUDWATCH_BASE_BUFFER_SIZE = 26;
8
- exports.AWS_CLOUDWATCH_BASE_BUFFER_SIZE = AWS_CLOUDWATCH_BASE_BUFFER_SIZE;
9
- var AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE = 1048576;
10
- exports.AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE = AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE;
11
- var AWS_CLOUDWATCH_MAX_EVENT_SIZE = 256000;
12
- exports.AWS_CLOUDWATCH_MAX_EVENT_SIZE = AWS_CLOUDWATCH_MAX_EVENT_SIZE;
13
- var AWS_CLOUDWATCH_CATEGORY = 'Logging';
14
- exports.AWS_CLOUDWATCH_CATEGORY = AWS_CLOUDWATCH_CATEGORY;
15
- var AWS_CLOUDWATCH_PROVIDER_NAME = 'AWSCloudWatch';
16
- exports.AWS_CLOUDWATCH_PROVIDER_NAME = AWS_CLOUDWATCH_PROVIDER_NAME;
17
- var NO_CREDS_ERROR_STRING = 'No credentials';
18
- exports.NO_CREDS_ERROR_STRING = NO_CREDS_ERROR_STRING;
19
- var RETRY_ERROR_CODES = [
7
+ exports.AWS_CLOUDWATCH_CATEGORY = 'Logging';
8
+ exports.NO_CREDS_ERROR_STRING = 'No credentials';
9
+ exports.RETRY_ERROR_CODES = [
20
10
  'ResourceNotFoundException',
21
11
  'InvalidSequenceTokenException',
22
12
  ];
23
- exports.RETRY_ERROR_CODES = RETRY_ERROR_CODES;
13
+ /**
14
+ * This Symbol is used to reference an internal-only PubSub provider that
15
+ * is used for AppSync/GraphQL subscriptions in the API category.
16
+ */
17
+ var hasSymbol = typeof Symbol !== 'undefined' && typeof Symbol.for === 'function';
18
+ exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = hasSymbol
19
+ ? Symbol.for('INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER')
20
+ : '@@INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER';
21
+ exports.USER_AGENT_HEADER = 'x-amz-user-agent';
22
+ // Error exception code constants
23
+ exports.AUTH_CONFING_EXCEPTION = 'AuthConfigException';
24
+ exports.CACHE_LIST_EXCEPTION = 'CacheListException';
25
+ exports.I18N_EXCEPTION = 'I18NException';
26
+ exports.SERVICE_WORKER_EXCEPTION = 'ServiceWorkerException';
27
+ exports.STORAGE_CACHE_EXCEPTION = 'StorageCacheException';
28
+ exports.APPLICATION_ID_EXCEPTION = 'ApplicationIdException';
29
+ exports.NO_HUBCALLBACK_PROVIDED_EXCEPTION = 'NoHubcallbackProvidedException';
@@ -1,4 +1,4 @@
1
- import { ErrorParams } from './types/types';
1
+ import { ErrorParams } from '../types/errors';
2
2
  export declare function missingConfig(name: string): Error;
3
3
  export declare function invalidParameter(name: string): Error;
4
4
  export declare enum AmplifyErrorString {
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
18
18
  // SPDX-License-Identifier: Apache-2.0
19
19
  var zen_observable_ts_1 = __importDefault(require("zen-observable-ts"));
20
- var JS_1 = require("../JS");
20
+ var JS_1 = require("./JS");
21
21
  var ReachabilityNavigator = /** @class */ (function () {
22
22
  function ReachabilityNavigator() {
23
23
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.asserts = void 0;
4
4
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
5
  // SPDX-License-Identifier: Apache-2.0
6
- var Errors_1 = require("../../Errors");
6
+ var Errors_1 = require("../Errors");
7
7
  function asserts(assertion, errorParams) {
8
8
  if (!assertion)
9
9
  throw new Errors_1.AmplifyError(errorParams);
@@ -3,5 +3,5 @@ export { default as Mutex } from './Mutex';
3
3
  export { default as Reachability } from './Reachability';
4
4
  export { DateUtils } from './DateUtils';
5
5
  export { urlSafeDecode, urlSafeEncode } from './StringUtils';
6
- export { AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, } from './Constants';
6
+ export { AWS_CLOUDWATCH_CATEGORY, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, } from './Constants';
7
7
  export { BackgroundProcessManager, BackgroundManagerNotOpenError, BackgroundProcessManagerState, } from './BackgroundProcessManager';
package/lib/Util/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.BackgroundProcessManagerState = exports.BackgroundManagerNotOpenError = exports.BackgroundProcessManager = exports.RETRY_ERROR_CODES = exports.NO_CREDS_ERROR_STRING = exports.AWS_CLOUDWATCH_PROVIDER_NAME = exports.AWS_CLOUDWATCH_MAX_EVENT_SIZE = exports.AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE = exports.AWS_CLOUDWATCH_CATEGORY = exports.AWS_CLOUDWATCH_BASE_BUFFER_SIZE = exports.urlSafeEncode = exports.urlSafeDecode = exports.DateUtils = exports.Reachability = exports.Mutex = exports.retry = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isNonRetryableError = exports.NonRetryableError = void 0;
6
+ exports.BackgroundProcessManagerState = exports.BackgroundManagerNotOpenError = exports.BackgroundProcessManager = exports.RETRY_ERROR_CODES = exports.NO_CREDS_ERROR_STRING = exports.AWS_CLOUDWATCH_CATEGORY = exports.urlSafeEncode = exports.urlSafeDecode = exports.DateUtils = exports.Reachability = exports.Mutex = exports.retry = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isNonRetryableError = exports.NonRetryableError = void 0;
7
7
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
8
8
  // SPDX-License-Identifier: Apache-2.0
9
9
  var Retry_1 = require("./Retry");
@@ -22,11 +22,7 @@ var StringUtils_1 = require("./StringUtils");
22
22
  Object.defineProperty(exports, "urlSafeDecode", { enumerable: true, get: function () { return StringUtils_1.urlSafeDecode; } });
23
23
  Object.defineProperty(exports, "urlSafeEncode", { enumerable: true, get: function () { return StringUtils_1.urlSafeEncode; } });
24
24
  var Constants_1 = require("./Constants");
25
- Object.defineProperty(exports, "AWS_CLOUDWATCH_BASE_BUFFER_SIZE", { enumerable: true, get: function () { return Constants_1.AWS_CLOUDWATCH_BASE_BUFFER_SIZE; } });
26
25
  Object.defineProperty(exports, "AWS_CLOUDWATCH_CATEGORY", { enumerable: true, get: function () { return Constants_1.AWS_CLOUDWATCH_CATEGORY; } });
27
- Object.defineProperty(exports, "AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE", { enumerable: true, get: function () { return Constants_1.AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE; } });
28
- Object.defineProperty(exports, "AWS_CLOUDWATCH_MAX_EVENT_SIZE", { enumerable: true, get: function () { return Constants_1.AWS_CLOUDWATCH_MAX_EVENT_SIZE; } });
29
- Object.defineProperty(exports, "AWS_CLOUDWATCH_PROVIDER_NAME", { enumerable: true, get: function () { return Constants_1.AWS_CLOUDWATCH_PROVIDER_NAME; } });
30
26
  Object.defineProperty(exports, "NO_CREDS_ERROR_STRING", { enumerable: true, get: function () { return Constants_1.NO_CREDS_ERROR_STRING; } });
31
27
  Object.defineProperty(exports, "RETRY_ERROR_CODES", { enumerable: true, get: function () { return Constants_1.RETRY_ERROR_CODES; } });
32
28
  var BackgroundProcessManager_1 = require("./BackgroundProcessManager");
@@ -0,0 +1,8 @@
1
+ import { AmplifyError } from '../../libraryUtils';
2
+ export declare class AmplifyServerContextError extends AmplifyError {
3
+ constructor({ message, recoverySuggestion, underlyingError, }: {
4
+ message: string;
5
+ recoverySuggestion?: string;
6
+ underlyingError?: Error;
7
+ });
8
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ var __extends = (this && this.__extends) || (function () {
5
+ var extendStatics = function (d, b) {
6
+ extendStatics = Object.setPrototypeOf ||
7
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
9
+ return extendStatics(d, b);
10
+ };
11
+ return function (d, b) {
12
+ if (typeof b !== "function" && b !== null)
13
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
14
+ extendStatics(d, b);
15
+ function __() { this.constructor = d; }
16
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17
+ };
18
+ })();
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.AmplifyServerContextError = void 0;
21
+ var libraryUtils_1 = require("../../libraryUtils");
22
+ var AmplifyServerContextError = /** @class */ (function (_super) {
23
+ __extends(AmplifyServerContextError, _super);
24
+ function AmplifyServerContextError(_a) {
25
+ var message = _a.message, recoverySuggestion = _a.recoverySuggestion, underlyingError = _a.underlyingError;
26
+ return _super.call(this, {
27
+ name: 'AmplifyServerContextError',
28
+ message: message,
29
+ recoverySuggestion: recoverySuggestion,
30
+ underlyingError: underlyingError,
31
+ }) || this;
32
+ }
33
+ return AmplifyServerContextError;
34
+ }(libraryUtils_1.AmplifyError));
35
+ exports.AmplifyServerContextError = AmplifyServerContextError;
@@ -0,0 +1 @@
1
+ export { AmplifyServerContextError } from './AmplifyServerContextError';
@@ -0,0 +1,7 @@
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
+ exports.AmplifyServerContextError = void 0;
6
+ var AmplifyServerContextError_1 = require("./AmplifyServerContextError");
7
+ Object.defineProperty(exports, "AmplifyServerContextError", { enumerable: true, get: function () { return AmplifyServerContextError_1.AmplifyServerContextError; } });
@@ -0,0 +1,2 @@
1
+ export { createAmplifyServerContext, getAmplifyServerContext, destroyAmplifyServerContext, AmplifyServer, CookieStorage, } from './serverContext';
2
+ export { AmplifyServerContextError } from './error';
@@ -0,0 +1,11 @@
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
+ exports.AmplifyServerContextError = exports.destroyAmplifyServerContext = exports.getAmplifyServerContext = exports.createAmplifyServerContext = void 0;
6
+ var serverContext_1 = require("./serverContext");
7
+ Object.defineProperty(exports, "createAmplifyServerContext", { enumerable: true, get: function () { return serverContext_1.createAmplifyServerContext; } });
8
+ Object.defineProperty(exports, "getAmplifyServerContext", { enumerable: true, get: function () { return serverContext_1.getAmplifyServerContext; } });
9
+ Object.defineProperty(exports, "destroyAmplifyServerContext", { enumerable: true, get: function () { return serverContext_1.destroyAmplifyServerContext; } });
10
+ var error_1 = require("./error");
11
+ Object.defineProperty(exports, "AmplifyServerContextError", { enumerable: true, get: function () { return error_1.AmplifyServerContextError; } });
@@ -0,0 +1,2 @@
1
+ export { createAmplifyServerContext, destroyAmplifyServerContext, getAmplifyServerContext, } from './serverContext';
2
+ export { AmplifyServer, CookieStorage } from './types';
@@ -0,0 +1,9 @@
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
+ exports.getAmplifyServerContext = exports.destroyAmplifyServerContext = exports.createAmplifyServerContext = void 0;
6
+ var serverContext_1 = require("./serverContext");
7
+ Object.defineProperty(exports, "createAmplifyServerContext", { enumerable: true, get: function () { return serverContext_1.createAmplifyServerContext; } });
8
+ Object.defineProperty(exports, "destroyAmplifyServerContext", { enumerable: true, get: function () { return serverContext_1.destroyAmplifyServerContext; } });
9
+ Object.defineProperty(exports, "getAmplifyServerContext", { enumerable: true, get: function () { return serverContext_1.getAmplifyServerContext; } });
@@ -0,0 +1,20 @@
1
+ import { AmplifyServer } from './types';
2
+ import { LibraryOptions, ResourcesConfig } from '../../singleton/types';
3
+ /**
4
+ * Creates an Amplify server context.
5
+ * @param amplifyConfig The Amplify resource config.
6
+ * @param libraryOptions The Amplify library options.
7
+ * @returns The Amplify server context spec.
8
+ */
9
+ export declare const createAmplifyServerContext: (amplifyConfig: ResourcesConfig, libraryOptions: LibraryOptions) => AmplifyServer.ContextSpec;
10
+ /**
11
+ * Returns an Amplify server context.
12
+ * @param contextSpec The context spec used to get the Amplify server context.
13
+ * @returns The Amplify server context.
14
+ */
15
+ export declare const getAmplifyServerContext: (contextSpec: AmplifyServer.ContextSpec) => AmplifyServer.Context;
16
+ /**
17
+ * Destroys an Amplify server context.
18
+ * @param contextSpec The context spec used to destroy the Amplify server context.
19
+ */
20
+ export declare const destroyAmplifyServerContext: (contextSpec: AmplifyServer.ContextSpec) => void;
@@ -0,0 +1,42 @@
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
+ exports.destroyAmplifyServerContext = exports.getAmplifyServerContext = exports.createAmplifyServerContext = void 0;
6
+ var serverContextRegistry_1 = require("./serverContextRegistry");
7
+ var singleton_1 = require("../../singleton");
8
+ /**
9
+ * Creates an Amplify server context.
10
+ * @param amplifyConfig The Amplify resource config.
11
+ * @param libraryOptions The Amplify library options.
12
+ * @returns The Amplify server context spec.
13
+ */
14
+ var createAmplifyServerContext = function (amplifyConfig, libraryOptions) {
15
+ var amplify = new singleton_1.AmplifyClass();
16
+ amplify.configure(amplifyConfig, libraryOptions);
17
+ return serverContextRegistry_1.serverContextRegistry.register({
18
+ amplify: amplify,
19
+ });
20
+ };
21
+ exports.createAmplifyServerContext = createAmplifyServerContext;
22
+ /**
23
+ * Returns an Amplify server context.
24
+ * @param contextSpec The context spec used to get the Amplify server context.
25
+ * @returns The Amplify server context.
26
+ */
27
+ var getAmplifyServerContext = function (contextSpec) {
28
+ var context = serverContextRegistry_1.serverContextRegistry.get(contextSpec);
29
+ if (context) {
30
+ return context;
31
+ }
32
+ throw new Error('Attempted to get the Amplify Server Context that may have been destroyed.');
33
+ };
34
+ exports.getAmplifyServerContext = getAmplifyServerContext;
35
+ /**
36
+ * Destroys an Amplify server context.
37
+ * @param contextSpec The context spec used to destroy the Amplify server context.
38
+ */
39
+ var destroyAmplifyServerContext = function (contextSpec) {
40
+ serverContextRegistry_1.serverContextRegistry.deregister(contextSpec);
41
+ };
42
+ exports.destroyAmplifyServerContext = destroyAmplifyServerContext;
@@ -0,0 +1,6 @@
1
+ import { AmplifyServer } from './types';
2
+ export declare const serverContextRegistry: {
3
+ register(context: AmplifyServer.Context): AmplifyServer.ContextSpec;
4
+ deregister(contextSpec: AmplifyServer.ContextSpec): boolean;
5
+ get(contextSpec: AmplifyServer.ContextSpec): AmplifyServer.Context | undefined;
6
+ };
@@ -0,0 +1,24 @@
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
+ exports.serverContextRegistry = void 0;
6
+ var storage = new WeakMap();
7
+ function createToken() {
8
+ return {
9
+ value: Symbol('AmplifyServerContextToken'),
10
+ };
11
+ }
12
+ exports.serverContextRegistry = {
13
+ register: function (context) {
14
+ var token = createToken();
15
+ storage.set(token, context);
16
+ return { token: token };
17
+ },
18
+ deregister: function (contextSpec) {
19
+ return storage.delete(contextSpec.token);
20
+ },
21
+ get: function (contextSpec) {
22
+ return storage.get(contextSpec.token);
23
+ },
24
+ };
@@ -0,0 +1,16 @@
1
+ import { AmplifyClass } from '../../../singleton';
2
+ import { LibraryOptions, ResourcesConfig } from '../../../singleton/types';
3
+ export declare namespace AmplifyServer {
4
+ type ContextToken = {
5
+ readonly value: Symbol;
6
+ };
7
+ type ContextSpec = {
8
+ readonly token: ContextToken;
9
+ };
10
+ type Context = {
11
+ amplify: AmplifyClass;
12
+ };
13
+ interface RunOperationWithContext {
14
+ <Result>(amplifyConfig: ResourcesConfig, libraryOptions: LibraryOptions, operation: (contextSpec: AmplifyServer.ContextSpec) => Result | Promise<Result>): Promise<Result>;
15
+ }
16
+ }
@@ -0,0 +1,4 @@
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 });
@@ -0,0 +1,31 @@
1
+ import { CookieSerializeOptions } from 'cookie';
2
+ export declare namespace CookieStorage {
3
+ type SetCookieOptions = Pick<CookieSerializeOptions, 'domain' | 'expires' | 'httpOnly' | 'maxAge' | 'sameSite' | 'secure'>;
4
+ type Cookie = {
5
+ name: string;
6
+ value?: string;
7
+ } & SetCookieOptions;
8
+ interface Adapter {
9
+ /**
10
+ * Get all cookies from the storage.
11
+ */
12
+ getAll(): Cookie[];
13
+ /**
14
+ * Get a cookie from the storage.
15
+ * @param name The name of the cookie.
16
+ */
17
+ get(name: string): Cookie | undefined;
18
+ /**
19
+ * Set a cookie in the storage.
20
+ * @param name The name of the cookie.
21
+ * @param value The value of the cookie.
22
+ * @param [options] The cookie's options.
23
+ */
24
+ set(name: string, value: string, options?: SetCookieOptions): void;
25
+ /**
26
+ * Delete a cookie from the storage.
27
+ * @param name The name of the cookie.
28
+ */
29
+ delete(name: string): void;
30
+ }
31
+ }
@@ -0,0 +1,4 @@
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 });
@@ -0,0 +1,4 @@
1
+ import { AmplifyServer } from './amplifyServer';
2
+ type AmplifyServerContextSpec = AmplifyServer.ContextSpec;
3
+ export { AmplifyServerContextSpec, AmplifyServer };
4
+ export { CookieStorage } from './cookieStorage';
@@ -0,0 +1,4 @@
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 });
@@ -55,6 +55,7 @@ var memoization_1 = require("../utils/memoization");
55
55
  var shouldSendBody = function (method) {
56
56
  return !['HEAD', 'GET', 'DELETE'].includes(method.toUpperCase());
57
57
  };
58
+ // TODO[AllanZhengYP]: we need to provide isCanceledError utility
58
59
  var fetchTransferHandler = function (_a, _b) {
59
60
  var url = _a.url, method = _a.method, headers = _a.headers, body = _a.body;
60
61
  var abortSignal = _b.abortSignal;
@@ -1,8 +1,11 @@
1
1
  import { ServiceClientOptions } from '../types/aws';
2
2
  import { TransferHandler, Endpoint } from '../types/core';
3
3
  import { HttpRequest, HttpResponse } from '../types/http';
4
- export declare const composeServiceApi: <TransferHandlerOptions, Input, Output, DefaultConfig extends Partial<TransferHandlerOptions & ServiceClientOptions>>(transferHandler: TransferHandler<HttpRequest, HttpResponse, TransferHandlerOptions>, serializer: (input: Input, endpoint: Endpoint) => Promise<HttpRequest> | HttpRequest, deserializer: (output: HttpResponse) => Promise<Output>, defaultConfig: DefaultConfig) => (config: OptionalizeKey<TransferHandlerOptions & ServiceClientOptions & DefaultConfig, keyof DefaultConfig>, input: Input) => Promise<Output>;
5
- type OptionalizeKey<T, K> = Omit<T, K & keyof T> & {
4
+ export declare const composeServiceApi: <TransferHandlerOptions, Input, Output, DefaultConfig>(transferHandler: TransferHandler<HttpRequest, HttpResponse, TransferHandlerOptions>, serializer: (input: Input, endpoint: Endpoint) => Promise<HttpRequest> | HttpRequest, deserializer: (output: HttpResponse) => Promise<Output>, defaultConfig: Partial<DefaultConfig>) => (config: OptionalizeKey<TransferHandlerOptions & ServiceClientOptions & Partial<DefaultConfig> & InferEndpointResolverOptionType<DefaultConfig>, keyof DefaultConfig>, input: Input) => Promise<Output>;
5
+ type OptionalizeKey<T, K extends keyof T> = Omit<T, K> & {
6
6
  [P in K & keyof T]?: T[P];
7
7
  };
8
+ type InferEndpointResolverOptionType<T> = T extends {
9
+ endpointResolver: (options: infer EndpointOptions) => any;
10
+ } ? EndpointOptions : never;
8
11
  export {};
package/lib/index.d.ts CHANGED
@@ -1,44 +1,23 @@
1
- import { Amplify } from './Amplify';
2
- export { Amplify };
3
- export { AmplifyClass } from './Amplify';
4
1
  export { ClientDevice } from './ClientDevice';
5
2
  export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
6
- export { invalidParameter, missingConfig, AmplifyError, AmplifyErrorString, } from './Errors';
7
- export { Hub, HubCapsule, HubCallback, HubPayload } from './Hub';
8
- export { I18n } from './I18n';
9
- export { browserOrNode, filenameToContentType, generateRandomString, isEmpty, isStrictObject, isTextFile, isWebWorker, makeQuerablePromise, objectLessAttributes, sortByField, transferKeyToLowerCase, transferKeyToUpperCase, } from './JS';
10
- export { Signer } from './Signer';
11
- export { parseAWSExports } from './parseAWSExports';
12
- export { AWSCloudWatchProvider } from './Providers';
3
+ export { Hub } from './Hub';
4
+ export { HubCapsule, HubCallback, HubPayload } from './Hub/types';
13
5
  export { FacebookOAuth, GoogleOAuth } from './OAuthHelper';
14
6
  export { AppState, AsyncStorage, Linking } from './RNComponents';
15
7
  export { Credentials, CredentialsClass } from './Credentials';
16
- export { ServiceWorker } from './ServiceWorker';
17
- export { ICredentials, ErrorParams, AmplifyErrorMap, ServiceError, KeyValueStorageInterface, } from './types';
8
+ export { ICredentials } from './types';
9
+ export { TokenProvider, AuthTokens, FetchAuthSessionOptions, AWSCredentialsAndIdentityIdProvider, AWSCredentialsAndIdentityId, Identity, OAuthConfig, } from './singleton/Auth/types';
10
+ export { AuthConfig, UserPoolConfig, UserPoolConfigAndIdentityPoolConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, } from './singleton/types';
11
+ export { Amplify, fetchAuthSession, AmplifyClass as AmplifyClassV6, } from './singleton';
12
+ export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './AwsClients/CognitoIdentity';
13
+ export { UserProfile } from './types';
18
14
  export { StorageHelper, MemoryStorage, LocalStorage, CookieStorage, SessionStorage, MemoryKeyValueStorage, } from './StorageHelper';
15
+ export { KeyValueStorageInterface } from './types';
19
16
  export { UniversalStorage } from './UniversalStorage';
20
- export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
21
- export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, } from './Platform/types';
22
- export { INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, } from './constants';
23
- export declare const Constants: {
24
- userAgent: string;
25
- };
26
- export { AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, BackgroundManagerNotOpenError, BackgroundProcessManager, BackgroundProcessManagerState, DateUtils, Mutex, NO_CREDS_ERROR_STRING, NonRetryableError, RETRY_ERROR_CODES, Reachability, isNonRetryableError, jitteredBackoff, jitteredExponentialRetry, retry, urlSafeDecode, urlSafeEncode, } from './Util';
27
17
  import { BrowserStorageCache } from './Cache/BrowserStorageCache';
28
- export { asserts } from './Util/errors/AssertError';
29
- export { isTokenExpired } from './singleton/Auth';
30
18
  export { InMemoryCache } from './Cache/InMemoryCache';
31
19
  export { CacheConfig } from './Cache/types';
32
- export { ICache } from './Cache/types';
33
20
  export { BrowserStorageCache };
34
21
  export { BrowserStorageCache as Cache };
35
- export { decodeJWT, assertTokenProviderConfig, assertIdentityPooIdConfig, } from './singleton/Auth/utils';
36
- export { TokenProvider, AuthTokens, FetchAuthSessionOptions, AWSCredentialsAndIdentityIdProvider, AWSCredentialsAndIdentityId, Identity, } from './singleton/Auth/types';
37
- export { AuthConfig, UserPoolConfig, UserPoolConfigAndIdentityPoolConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, } from './singleton/types';
38
- export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './AwsClients/CognitoIdentity';
39
- export { AmplifyV6, fetchAuthSession } from './singleton';
40
- export { LibraryOptions, ResourcesConfig } from './singleton/types';
41
- /**
42
- * @deprecated use named import
43
- */
44
- export default Amplify;
22
+ export { I18n } from './I18n';
23
+ export { parseAWSExports } from './parseAWSExports';