super-ads-aws-amplify 6.15.8

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 (234) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +5 -0
  3. package/adapter-core/internals/package.json +7 -0
  4. package/adapter-core/package.json +7 -0
  5. package/analytics/kinesis/package.json +8 -0
  6. package/analytics/kinesis-firehose/package.json +8 -0
  7. package/analytics/package.json +8 -0
  8. package/analytics/personalize/package.json +8 -0
  9. package/analytics/pinpoint/package.json +8 -0
  10. package/api/internals/package.json +7 -0
  11. package/api/package.json +8 -0
  12. package/api/server/package.json +7 -0
  13. package/auth/cognito/package.json +8 -0
  14. package/auth/cognito/server/package.json +7 -0
  15. package/auth/enable-oauth-listener/package.json +8 -0
  16. package/auth/package.json +8 -0
  17. package/auth/server/package.json +7 -0
  18. package/data/package.json +8 -0
  19. package/data/server/package.json +7 -0
  20. package/datastore/package.json +8 -0
  21. package/dist/cjs/adapter-core/authProvidersFactories/cognito/createAWSCredentialsAndIdentityIdProvider.js +20 -0
  22. package/dist/cjs/adapter-core/authProvidersFactories/cognito/createAWSCredentialsAndIdentityIdProvider.js.map +1 -0
  23. package/dist/cjs/adapter-core/authProvidersFactories/cognito/createUserPoolsTokenProvider.js +27 -0
  24. package/dist/cjs/adapter-core/authProvidersFactories/cognito/createUserPoolsTokenProvider.js.map +1 -0
  25. package/dist/cjs/adapter-core/authProvidersFactories/cognito/index.js +11 -0
  26. package/dist/cjs/adapter-core/authProvidersFactories/cognito/index.js.map +1 -0
  27. package/dist/cjs/adapter-core/constants.js +8 -0
  28. package/dist/cjs/adapter-core/constants.js.map +1 -0
  29. package/dist/cjs/adapter-core/index.js +23 -0
  30. package/dist/cjs/adapter-core/index.js.map +1 -0
  31. package/dist/cjs/adapter-core/internals.js +15 -0
  32. package/dist/cjs/adapter-core/internals.js.map +1 -0
  33. package/dist/cjs/adapter-core/runWithAmplifyServerContext.js +32 -0
  34. package/dist/cjs/adapter-core/runWithAmplifyServerContext.js.map +1 -0
  35. package/dist/cjs/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.js +59 -0
  36. package/dist/cjs/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.js.map +1 -0
  37. package/dist/cjs/adapter-core/storageFactories/index.js +9 -0
  38. package/dist/cjs/adapter-core/storageFactories/index.js.map +1 -0
  39. package/dist/cjs/analytics/index.js +12 -0
  40. package/dist/cjs/analytics/index.js.map +1 -0
  41. package/dist/cjs/analytics/kinesis/index.js +8 -0
  42. package/dist/cjs/analytics/kinesis/index.js.map +1 -0
  43. package/dist/cjs/analytics/kinesis-firehose/index.js +8 -0
  44. package/dist/cjs/analytics/kinesis-firehose/index.js.map +1 -0
  45. package/dist/cjs/analytics/personalize/index.js +8 -0
  46. package/dist/cjs/analytics/personalize/index.js.map +1 -0
  47. package/dist/cjs/analytics/pinpoint/index.js +11 -0
  48. package/dist/cjs/analytics/pinpoint/index.js.map +1 -0
  49. package/dist/cjs/api/index.js +11 -0
  50. package/dist/cjs/api/index.js.map +1 -0
  51. package/dist/cjs/api/internals.js +9 -0
  52. package/dist/cjs/api/internals.js.map +1 -0
  53. package/dist/cjs/api/server.js +8 -0
  54. package/dist/cjs/api/server.js.map +1 -0
  55. package/dist/cjs/auth/cognito/index.js +11 -0
  56. package/dist/cjs/auth/cognito/index.js.map +1 -0
  57. package/dist/cjs/auth/cognito/server/index.js +11 -0
  58. package/dist/cjs/auth/cognito/server/index.js.map +1 -0
  59. package/dist/cjs/auth/enableOAuthListener.js +7 -0
  60. package/dist/cjs/auth/enableOAuthListener.js.map +1 -0
  61. package/dist/cjs/auth/index.js +11 -0
  62. package/dist/cjs/auth/index.js.map +1 -0
  63. package/dist/cjs/auth/server.js +8 -0
  64. package/dist/cjs/auth/server.js.map +1 -0
  65. package/dist/cjs/datastore/index.js +11 -0
  66. package/dist/cjs/datastore/index.js.map +1 -0
  67. package/dist/cjs/in-app-messaging/index.js +11 -0
  68. package/dist/cjs/in-app-messaging/index.js.map +1 -0
  69. package/dist/cjs/in-app-messaging/pinpoint/index.js +12 -0
  70. package/dist/cjs/in-app-messaging/pinpoint/index.js.map +1 -0
  71. package/dist/cjs/index.js +12 -0
  72. package/dist/cjs/index.js.map +1 -0
  73. package/dist/cjs/initSingleton.js +90 -0
  74. package/dist/cjs/initSingleton.js.map +1 -0
  75. package/dist/cjs/push-notifications/index.js +11 -0
  76. package/dist/cjs/push-notifications/index.js.map +1 -0
  77. package/dist/cjs/push-notifications/pinpoint/index.js +12 -0
  78. package/dist/cjs/push-notifications/pinpoint/index.js.map +1 -0
  79. package/dist/cjs/storage/index.js +12 -0
  80. package/dist/cjs/storage/index.js.map +1 -0
  81. package/dist/cjs/storage/s3/index.js +11 -0
  82. package/dist/cjs/storage/s3/index.js.map +1 -0
  83. package/dist/cjs/storage/s3/server.js +11 -0
  84. package/dist/cjs/storage/s3/server.js.map +1 -0
  85. package/dist/cjs/storage/server.js +12 -0
  86. package/dist/cjs/storage/server.js.map +1 -0
  87. package/dist/cjs/utils/index.js +22 -0
  88. package/dist/cjs/utils/index.js.map +1 -0
  89. package/dist/esm/adapter-core/authProvidersFactories/cognito/createAWSCredentialsAndIdentityIdProvider.d.ts +9 -0
  90. package/dist/esm/adapter-core/authProvidersFactories/cognito/createAWSCredentialsAndIdentityIdProvider.mjs +18 -0
  91. package/dist/esm/adapter-core/authProvidersFactories/cognito/createAWSCredentialsAndIdentityIdProvider.mjs.map +1 -0
  92. package/dist/esm/adapter-core/authProvidersFactories/cognito/createUserPoolsTokenProvider.d.ts +8 -0
  93. package/dist/esm/adapter-core/authProvidersFactories/cognito/createUserPoolsTokenProvider.mjs +25 -0
  94. package/dist/esm/adapter-core/authProvidersFactories/cognito/createUserPoolsTokenProvider.mjs.map +1 -0
  95. package/dist/esm/adapter-core/authProvidersFactories/cognito/index.d.ts +2 -0
  96. package/dist/esm/adapter-core/authProvidersFactories/cognito/index.mjs +3 -0
  97. package/dist/esm/adapter-core/authProvidersFactories/cognito/index.mjs.map +1 -0
  98. package/dist/esm/adapter-core/constants.d.ts +1 -0
  99. package/dist/esm/adapter-core/constants.mjs +6 -0
  100. package/dist/esm/adapter-core/constants.mjs.map +1 -0
  101. package/dist/esm/adapter-core/index.d.ts +11 -0
  102. package/dist/esm/adapter-core/index.mjs +7 -0
  103. package/dist/esm/adapter-core/index.mjs.map +1 -0
  104. package/dist/esm/adapter-core/internals.d.ts +3 -0
  105. package/dist/esm/adapter-core/internals.mjs +3 -0
  106. package/dist/esm/adapter-core/internals.mjs.map +1 -0
  107. package/dist/esm/adapter-core/runWithAmplifyServerContext.d.ts +13 -0
  108. package/dist/esm/adapter-core/runWithAmplifyServerContext.mjs +30 -0
  109. package/dist/esm/adapter-core/runWithAmplifyServerContext.mjs.map +1 -0
  110. package/dist/esm/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.d.ts +10 -0
  111. package/dist/esm/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.mjs +57 -0
  112. package/dist/esm/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.mjs.map +1 -0
  113. package/dist/esm/adapter-core/storageFactories/index.d.ts +1 -0
  114. package/dist/esm/adapter-core/storageFactories/index.mjs +2 -0
  115. package/dist/esm/adapter-core/storageFactories/index.mjs.map +1 -0
  116. package/dist/esm/analytics/index.d.ts +1 -0
  117. package/dist/esm/analytics/index.mjs +2 -0
  118. package/dist/esm/analytics/index.mjs.map +1 -0
  119. package/dist/esm/analytics/kinesis/index.d.ts +1 -0
  120. package/dist/esm/analytics/kinesis/index.mjs +2 -0
  121. package/dist/esm/analytics/kinesis/index.mjs.map +1 -0
  122. package/dist/esm/analytics/kinesis-firehose/index.d.ts +1 -0
  123. package/dist/esm/analytics/kinesis-firehose/index.mjs +2 -0
  124. package/dist/esm/analytics/kinesis-firehose/index.mjs.map +1 -0
  125. package/dist/esm/analytics/personalize/index.d.ts +1 -0
  126. package/dist/esm/analytics/personalize/index.mjs +2 -0
  127. package/dist/esm/analytics/personalize/index.mjs.map +1 -0
  128. package/dist/esm/analytics/pinpoint/index.d.ts +1 -0
  129. package/dist/esm/analytics/pinpoint/index.mjs +2 -0
  130. package/dist/esm/analytics/pinpoint/index.mjs.map +1 -0
  131. package/dist/esm/api/index.d.ts +1 -0
  132. package/dist/esm/api/index.mjs +2 -0
  133. package/dist/esm/api/index.mjs.map +1 -0
  134. package/dist/esm/api/internals.d.ts +1 -0
  135. package/dist/esm/api/internals.mjs +2 -0
  136. package/dist/esm/api/internals.mjs.map +1 -0
  137. package/dist/esm/api/server.d.ts +1 -0
  138. package/dist/esm/api/server.mjs +2 -0
  139. package/dist/esm/api/server.mjs.map +1 -0
  140. package/dist/esm/auth/cognito/index.d.ts +1 -0
  141. package/dist/esm/auth/cognito/index.mjs +2 -0
  142. package/dist/esm/auth/cognito/index.mjs.map +1 -0
  143. package/dist/esm/auth/cognito/server/index.d.ts +1 -0
  144. package/dist/esm/auth/cognito/server/index.mjs +2 -0
  145. package/dist/esm/auth/cognito/server/index.mjs.map +1 -0
  146. package/dist/esm/auth/enableOAuthListener.d.ts +1 -0
  147. package/dist/esm/auth/enableOAuthListener.mjs +2 -0
  148. package/dist/esm/auth/enableOAuthListener.mjs.map +1 -0
  149. package/dist/esm/auth/index.d.ts +1 -0
  150. package/dist/esm/auth/index.mjs +2 -0
  151. package/dist/esm/auth/index.mjs.map +1 -0
  152. package/dist/esm/auth/server.d.ts +1 -0
  153. package/dist/esm/auth/server.mjs +2 -0
  154. package/dist/esm/auth/server.mjs.map +1 -0
  155. package/dist/esm/datastore/index.d.ts +1 -0
  156. package/dist/esm/datastore/index.mjs +2 -0
  157. package/dist/esm/datastore/index.mjs.map +1 -0
  158. package/dist/esm/in-app-messaging/index.d.ts +1 -0
  159. package/dist/esm/in-app-messaging/index.mjs +2 -0
  160. package/dist/esm/in-app-messaging/index.mjs.map +1 -0
  161. package/dist/esm/in-app-messaging/pinpoint/index.d.ts +1 -0
  162. package/dist/esm/in-app-messaging/pinpoint/index.mjs +2 -0
  163. package/dist/esm/in-app-messaging/pinpoint/index.mjs.map +1 -0
  164. package/dist/esm/index.d.ts +2 -0
  165. package/dist/esm/index.mjs +2 -0
  166. package/dist/esm/index.mjs.map +1 -0
  167. package/dist/esm/initSingleton.d.ts +24 -0
  168. package/dist/esm/initSingleton.mjs +89 -0
  169. package/dist/esm/initSingleton.mjs.map +1 -0
  170. package/dist/esm/push-notifications/index.d.ts +1 -0
  171. package/dist/esm/push-notifications/index.mjs +2 -0
  172. package/dist/esm/push-notifications/index.mjs.map +1 -0
  173. package/dist/esm/push-notifications/pinpoint/index.d.ts +1 -0
  174. package/dist/esm/push-notifications/pinpoint/index.mjs +2 -0
  175. package/dist/esm/push-notifications/pinpoint/index.mjs.map +1 -0
  176. package/dist/esm/storage/index.d.ts +1 -0
  177. package/dist/esm/storage/index.mjs +2 -0
  178. package/dist/esm/storage/index.mjs.map +1 -0
  179. package/dist/esm/storage/s3/index.d.ts +1 -0
  180. package/dist/esm/storage/s3/index.mjs +2 -0
  181. package/dist/esm/storage/s3/index.mjs.map +1 -0
  182. package/dist/esm/storage/s3/server.d.ts +1 -0
  183. package/dist/esm/storage/s3/server.mjs +2 -0
  184. package/dist/esm/storage/s3/server.mjs.map +1 -0
  185. package/dist/esm/storage/server.d.ts +1 -0
  186. package/dist/esm/storage/server.mjs +2 -0
  187. package/dist/esm/storage/server.mjs.map +1 -0
  188. package/dist/esm/utils/index.d.ts +2 -0
  189. package/dist/esm/utils/index.mjs +3 -0
  190. package/dist/esm/utils/index.mjs.map +1 -0
  191. package/in-app-messaging/package.json +8 -0
  192. package/in-app-messaging/pinpoint/package.json +8 -0
  193. package/package.json +535 -0
  194. package/push-notifications/package.json +8 -0
  195. package/push-notifications/pinpoint/package.json +8 -0
  196. package/src/adapter-core/authProvidersFactories/cognito/createAWSCredentialsAndIdentityIdProvider.ts +30 -0
  197. package/src/adapter-core/authProvidersFactories/cognito/createUserPoolsTokenProvider.ts +37 -0
  198. package/src/adapter-core/authProvidersFactories/cognito/index.ts +5 -0
  199. package/src/adapter-core/constants.ts +4 -0
  200. package/src/adapter-core/index.ts +28 -0
  201. package/src/adapter-core/internals.ts +19 -0
  202. package/src/adapter-core/runWithAmplifyServerContext.ts +37 -0
  203. package/src/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.ts +72 -0
  204. package/src/adapter-core/storageFactories/index.ts +4 -0
  205. package/src/analytics/index.ts +8 -0
  206. package/src/analytics/kinesis/index.ts +4 -0
  207. package/src/analytics/kinesis-firehose/index.ts +4 -0
  208. package/src/analytics/personalize/index.ts +4 -0
  209. package/src/analytics/pinpoint/index.ts +7 -0
  210. package/src/api/index.ts +7 -0
  211. package/src/api/internals.ts +10 -0
  212. package/src/api/server.ts +4 -0
  213. package/src/auth/cognito/index.ts +7 -0
  214. package/src/auth/cognito/server/index.ts +7 -0
  215. package/src/auth/enableOAuthListener.ts +4 -0
  216. package/src/auth/index.ts +7 -0
  217. package/src/auth/server.ts +4 -0
  218. package/src/datastore/index.ts +7 -0
  219. package/src/in-app-messaging/index.ts +7 -0
  220. package/src/in-app-messaging/pinpoint/index.ts +8 -0
  221. package/src/index.ts +8 -0
  222. package/src/initSingleton.ts +121 -0
  223. package/src/push-notifications/index.ts +7 -0
  224. package/src/push-notifications/pinpoint/index.ts +8 -0
  225. package/src/storage/index.ts +8 -0
  226. package/src/storage/s3/index.ts +7 -0
  227. package/src/storage/s3/server.ts +7 -0
  228. package/src/storage/server.ts +8 -0
  229. package/src/utils/index.ts +21 -0
  230. package/storage/package.json +8 -0
  231. package/storage/s3/package.json +8 -0
  232. package/storage/s3/server/package.json +7 -0
  233. package/storage/server/package.json +7 -0
  234. package/utils/package.json +8 -0
@@ -0,0 +1,19 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export {
5
+ KeyValueStorageMethodValidator,
6
+ AmplifyServerContextError,
7
+ getAmplifyServerContext,
8
+ AmplifyServer,
9
+ CookieStorage,
10
+ } from '@aws-amplify/core/internals/adapter-core';
11
+ export { OAuthConfig } from '@aws-amplify/core';
12
+ export {
13
+ assertOAuthConfig,
14
+ assertTokenProviderConfig,
15
+ urlSafeEncode,
16
+ decodeJWT,
17
+ LegacyConfig,
18
+ AmplifyOutputsUnknown,
19
+ } from '@aws-amplify/core/internals/utils';
@@ -0,0 +1,37 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import {
5
+ AmplifyServer,
6
+ createAmplifyServerContext,
7
+ destroyAmplifyServerContext,
8
+ } from '@aws-amplify/core/internals/adapter-core';
9
+
10
+ /**
11
+ * The low level function that supports framework specific helpers.
12
+ * It creates an Amplify server context based on the input and runs the operation
13
+ * with injecting the context, and finally returns the result of the operation.
14
+ *
15
+ * @param amplifyConfig The Amplify resource config.
16
+ * @param libraryOptions The Amplify library options.
17
+ * @param operation The operation to run with the server context created from
18
+ * `amplifyConfig` and `libraryOptions`.
19
+ * @returns The result returned by the `operation`.
20
+ */
21
+ export const runWithAmplifyServerContext: AmplifyServer.RunOperationWithContext =
22
+ async (amplifyConfig, libraryOptions, operation) => {
23
+ const contextSpec = createAmplifyServerContext(
24
+ amplifyConfig,
25
+ libraryOptions,
26
+ );
27
+
28
+ // run the operation with injecting the context
29
+ try {
30
+ const result = await operation(contextSpec);
31
+
32
+ return result;
33
+ } finally {
34
+ // ensures destroy the context regardless whether the operation succeeded or failed
35
+ destroyAmplifyServerContext(contextSpec);
36
+ }
37
+ };
@@ -0,0 +1,72 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { KeyValueStorageInterface } from '@aws-amplify/core';
5
+ import {
6
+ CookieStorage,
7
+ KeyValueStorageMethodValidator,
8
+ } from '@aws-amplify/core/internals/adapter-core';
9
+
10
+ import { DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE } from '../constants';
11
+
12
+ export const defaultSetCookieOptions: CookieStorage.SetCookieOptions = {
13
+ // TODO: allow configure with a public interface
14
+ sameSite: 'lax',
15
+ secure: true,
16
+ path: '/',
17
+ };
18
+
19
+ /**
20
+ * Creates a Key Value storage interface using the `cookieStorageAdapter` as the
21
+ * underlying storage.
22
+ * @param cookieStorageAdapter An implementation of the `Adapter` in {@link CookieStorage}.
23
+ * @returns An object that implements {@link KeyValueStorageInterface}.
24
+ */
25
+ export const createKeyValueStorageFromCookieStorageAdapter = (
26
+ cookieStorageAdapter: CookieStorage.Adapter,
27
+ validator?: KeyValueStorageMethodValidator,
28
+ setCookieOptions: CookieStorage.SetCookieOptions = {},
29
+ ): KeyValueStorageInterface => {
30
+ return {
31
+ setItem(key, value) {
32
+ // Delete the cookie item first then set it. This results:
33
+ // SetCookie: key=;expires=1970-01-01;(path='current-path') <- remove path'ed cookies
34
+ // SetCookie: key=value;expires=Date.now() + 365 days;path=/;secure=true
35
+ cookieStorageAdapter.delete(key);
36
+
37
+ const mergedCookieOptions = {
38
+ ...defaultSetCookieOptions,
39
+ ...setCookieOptions,
40
+ };
41
+
42
+ // when expires and maxAge both are not specified, we set a default maxAge
43
+ if (!mergedCookieOptions.expires && !mergedCookieOptions.maxAge) {
44
+ mergedCookieOptions.maxAge = DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE;
45
+ }
46
+
47
+ cookieStorageAdapter.set(key, value, mergedCookieOptions);
48
+
49
+ return Promise.resolve();
50
+ },
51
+ async getItem(key) {
52
+ const cookie = cookieStorageAdapter.get(key);
53
+ const value = cookie?.value ?? null;
54
+
55
+ if (value && validator?.getItem) {
56
+ const isValid = await validator.getItem(key, value);
57
+ if (!isValid) return null;
58
+ }
59
+
60
+ return value;
61
+ },
62
+ removeItem(key) {
63
+ cookieStorageAdapter.delete(key);
64
+
65
+ return Promise.resolve();
66
+ },
67
+ clear() {
68
+ // TODO(HuiSF): follow up the implementation.
69
+ throw new Error('This method has not implemented.');
70
+ },
71
+ };
72
+ };
@@ -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 { createKeyValueStorageFromCookieStorageAdapter } from './createKeyValueStorageFromCookieStorageAdapter';
@@ -0,0 +1,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/analytics`. It provides access to the default Analytics provider and category
6
+ utils.
7
+ */
8
+ export * from '@aws-amplify/analytics';
@@ -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 * from '@aws-amplify/analytics/kinesis';
@@ -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 * from '@aws-amplify/analytics/kinesis-firehose';
@@ -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 * from '@aws-amplify/analytics/personalize';
@@ -0,0 +1,7 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/analytics/pinpoint`. It provides access to Pinpoint APIs.
6
+ */
7
+ export * from '@aws-amplify/analytics/pinpoint';
@@ -0,0 +1,7 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/api`. It provides access to the default API provider and category utils.
6
+ */
7
+ export * from '@aws-amplify/api';
@@ -0,0 +1,10 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export {
5
+ generateClientWithAmplifyInstance,
6
+ V6ClientSSRCookies,
7
+ V6ClientSSRRequest,
8
+ CommonPublicClientOptions,
9
+ DefaultCommonClientOptions,
10
+ } from '@aws-amplify/api/internals';
@@ -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 * from '@aws-amplify/api/server';
@@ -0,0 +1,7 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/auth/cognito`. It provides access to Cognito APIs.
6
+ */
7
+ export * from 'super-ads-aws-amplify-auth/cognito';
@@ -0,0 +1,7 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/auth/cognito/server`. It provides access to server-enabled Cognito APIs.
6
+ */
7
+ export * from 'super-ads-aws-amplify-auth/cognito/server';
@@ -0,0 +1,4 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import 'super-ads-aws-amplify-auth/enable-oauth-listener';
@@ -0,0 +1,7 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/auth`. It provides access to the default Auth provider and category utils.
6
+ */
7
+ export * from 'super-ads-aws-amplify-auth';
@@ -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 * from 'super-ads-aws-amplify-auth/server';
@@ -0,0 +1,7 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/datastore`. It provides access to DataStore APIs and category utils.
6
+ */
7
+ export * from '@aws-amplify/datastore';
@@ -0,0 +1,7 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/in-app-messaging`. It provides access to the InAppMessaging sub-category.
6
+ */
7
+ export * from '@aws-amplify/notifications/in-app-messaging';
@@ -0,0 +1,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/in-app-messaging/pinpoint`.
6
+ It provides access to the Pinpoint provider of the InAppMessaging sub-category.
7
+ */
8
+ export * from '@aws-amplify/notifications/in-app-messaging/pinpoint';
package/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps top-level exports from `aws-amplify`.
6
+ */
7
+ export { DefaultAmplify as Amplify } from './initSingleton';
8
+ export { ResourcesConfig } from '@aws-amplify/core';
@@ -0,0 +1,121 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import {
4
+ Amplify,
5
+ CookieStorage,
6
+ LibraryOptions,
7
+ ResourcesConfig,
8
+ defaultStorage,
9
+ } from '@aws-amplify/core';
10
+ import {
11
+ AmplifyOutputsUnknown,
12
+ LegacyConfig,
13
+ parseAmplifyConfig,
14
+ } from '@aws-amplify/core/internals/utils';
15
+
16
+ import {
17
+ CognitoAWSCredentialsAndIdentityIdProvider,
18
+ DefaultIdentityIdStore,
19
+ cognitoCredentialsProvider,
20
+ cognitoUserPoolsTokenProvider,
21
+ } from './auth/cognito';
22
+
23
+ export const DefaultAmplify = {
24
+ /**
25
+ * Configures Amplify with the {@link resourceConfig} and {@link libraryOptions}.
26
+ *
27
+ * @param resourceConfig The {@link ResourcesConfig} object that is typically imported from the
28
+ * `amplifyconfiguration.json` file. It can also be an object literal created inline when calling `Amplify.configure`.
29
+ * @param libraryOptions The {@link LibraryOptions} additional options for the library.
30
+ *
31
+ * @example
32
+ * import config from './amplifyconfiguration.json';
33
+ *
34
+ * Amplify.configure(config);
35
+ */
36
+ configure(
37
+ resourceConfig: ResourcesConfig | LegacyConfig | AmplifyOutputsUnknown,
38
+ libraryOptions?: LibraryOptions,
39
+ ): void {
40
+ const resolvedResourceConfig = parseAmplifyConfig(resourceConfig);
41
+ const cookieBasedKeyValueStorage = new CookieStorage({ sameSite: 'lax' });
42
+ const resolvedKeyValueStorage = libraryOptions?.ssr
43
+ ? cookieBasedKeyValueStorage
44
+ : defaultStorage;
45
+ const resolvedCredentialsProvider = libraryOptions?.ssr
46
+ ? new CognitoAWSCredentialsAndIdentityIdProvider(
47
+ new DefaultIdentityIdStore(cookieBasedKeyValueStorage),
48
+ )
49
+ : cognitoCredentialsProvider;
50
+
51
+ // If no Auth config is provided, no special handling will be required, configure as is.
52
+ // Otherwise, we can assume an Auth config is provided from here on.
53
+ if (!resolvedResourceConfig.Auth) {
54
+ Amplify.configure(resolvedResourceConfig, libraryOptions);
55
+
56
+ return;
57
+ }
58
+
59
+ // If Auth options are provided, always just configure as is.
60
+ // Otherwise, we can assume no Auth libraryOptions were provided from here on.
61
+ if (libraryOptions?.Auth) {
62
+ Amplify.configure(resolvedResourceConfig, libraryOptions);
63
+
64
+ return;
65
+ }
66
+
67
+ // If no Auth libraryOptions were previously configured, then always add default providers.
68
+ if (!Amplify.libraryOptions.Auth) {
69
+ cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);
70
+ cognitoUserPoolsTokenProvider.setKeyValueStorage(
71
+ // TODO: allow configure with a public interface
72
+ resolvedKeyValueStorage,
73
+ );
74
+
75
+ Amplify.configure(resolvedResourceConfig, {
76
+ ...libraryOptions,
77
+ Auth: {
78
+ tokenProvider: cognitoUserPoolsTokenProvider,
79
+ credentialsProvider: resolvedCredentialsProvider,
80
+ },
81
+ });
82
+
83
+ return;
84
+ }
85
+
86
+ // At this point, Auth libraryOptions would have been previously configured and no overriding
87
+ // Auth options were given, so we should preserve the currently configured Auth libraryOptions.
88
+ if (libraryOptions) {
89
+ const authLibraryOptions = Amplify.libraryOptions.Auth;
90
+ // If ssr is provided through libraryOptions, we should respect the intentional reconfiguration.
91
+ if (libraryOptions.ssr !== undefined) {
92
+ cognitoUserPoolsTokenProvider.setKeyValueStorage(
93
+ // TODO: allow configure with a public interface
94
+ resolvedKeyValueStorage,
95
+ );
96
+
97
+ authLibraryOptions.credentialsProvider = resolvedCredentialsProvider;
98
+ }
99
+
100
+ Amplify.configure(resolvedResourceConfig, {
101
+ Auth: authLibraryOptions,
102
+ ...libraryOptions,
103
+ });
104
+
105
+ return;
106
+ }
107
+
108
+ // Finally, if there were no libraryOptions given at all, we should simply not touch the currently
109
+ // configured libraryOptions.
110
+ Amplify.configure(resolvedResourceConfig);
111
+ },
112
+ /**
113
+ * Returns the {@link ResourcesConfig} object passed in as the `resourceConfig` parameter when calling
114
+ * `Amplify.configure`.
115
+ *
116
+ * @returns An {@link ResourcesConfig} object.
117
+ */
118
+ getConfig(): ResourcesConfig {
119
+ return Amplify.getConfig();
120
+ },
121
+ };
@@ -0,0 +1,7 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/push-notifications`. It provides access to the Push Notifications sub-category.
6
+ */
7
+ export * from '@aws-amplify/notifications/push-notifications';
@@ -0,0 +1,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/push-notifications/pinpoint`.
6
+ It provides access to the Pinpoint provider of the PushNotification sub-category.
7
+ */
8
+ export * from '@aws-amplify/notifications/push-notifications/pinpoint';
@@ -0,0 +1,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/storage`.
6
+ It provides access to the default Storage provider and category utils.
7
+ */
8
+ export * from '@aws-amplify/storage';
@@ -0,0 +1,7 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/storage/s3`. It provides access to S3 APIs.
6
+ */
7
+ export * from '@aws-amplify/storage/s3';
@@ -0,0 +1,7 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/storage/s3/server`. It provides access to server context enabled S3 APIs.
6
+ */
7
+ export * from '@aws-amplify/storage/s3/server';
@@ -0,0 +1,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/storage/server`.
6
+ It provides access to the default server context enabled Storage provider and category utils.
7
+ */
8
+ export * from '@aws-amplify/storage/server';
@@ -0,0 +1,21 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /*
5
+ This file maps exports from `aws-amplify/utils`.
6
+ */
7
+ export {
8
+ Hub,
9
+ HubCapsule,
10
+ I18n,
11
+ Cache,
12
+ ConsoleLogger,
13
+ ServiceWorker,
14
+ CookieStorage,
15
+ defaultStorage,
16
+ sessionStorage,
17
+ sharedInMemoryStorage,
18
+ KeyValueStorageInterface,
19
+ } from '@aws-amplify/core';
20
+
21
+ export { parseAmplifyConfig } from '@aws-amplify/core/internals/utils';
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "aws-amplify/storage",
3
+ "main": "../dist/cjs/storage/index.js",
4
+ "react-native": "../dist/cjs/storage/index.js",
5
+ "browser": "../dist/esm/storage/index.mjs",
6
+ "module": "../dist/esm/storage/index.mjs",
7
+ "typings": "../dist/esm/storage/index.d.ts"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "aws-amplify/storage/s3",
3
+ "main": "../../dist/cjs/storage/s3/index.js",
4
+ "react-native": "../../dist/cjs/storage/s3/index.js",
5
+ "browser": "../../dist/esm/storage/s3/index.mjs",
6
+ "module": "../../dist/esm/storage/s3/index.mjs",
7
+ "typings": "../../dist/esm/storage/s3/index.d.ts"
8
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "aws-amplify/storage/s3/server",
3
+ "main": "../../../dist/cjs/storage/s3/server.js",
4
+ "browser": "../../../dist/esm/storage/s3/server.mjs",
5
+ "module": "../../../dist/esm/storage/s3/server.mjs",
6
+ "typings": "../../../dist/esm/storage/s3/server.d.ts"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "aws-amplify/storage/server",
3
+ "main": "../../dist/cjs/storage/server.js",
4
+ "browser": "../../dist/esm/storage/server.mjs",
5
+ "module": "../../dist/esm/storage/server.mjs",
6
+ "typings": "../../dist/esm/storage/server.d.ts"
7
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "aws-amplify/utils",
3
+ "main": "../dist/cjs/utils/index.js",
4
+ "react-native": "../dist/cjs/utils/index.js",
5
+ "browser": "../dist/esm/utils/index.mjs",
6
+ "module": "../dist/esm/utils/index.mjs",
7
+ "typings": "../dist/esm/utils/index.d.ts"
8
+ }