@aws-amplify/core 6.0.1-console-preview.be08038.0 → 6.0.1-console-preview.d745d43.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/core",
3
- "version": "6.0.1-console-preview.be08038.0+be08038",
3
+ "version": "6.0.1-console-preview.d745d43.0+d745d43",
4
4
  "description": "Core category of aws-amplify",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib-esm/index.js",
@@ -64,7 +64,7 @@
64
64
  "uuid": "^9.0.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@aws-amplify/react-native": "1.0.1-console-preview.be08038.0+be08038",
67
+ "@aws-amplify/react-native": "1.0.1-console-preview.d745d43.0+d745d43",
68
68
  "@types/js-cookie": "3.0.2",
69
69
  "@types/uuid": "^9.0.0",
70
70
  "find": "^0.2.7",
@@ -169,5 +169,5 @@
169
169
  "lib-esm"
170
170
  ]
171
171
  },
172
- "gitHead": "be08038c5b37a510243f077c6d3209e5383f8866"
172
+ "gitHead": "d745d43595a690928a86070deff39f3eed526437"
173
173
  }
@@ -95,7 +95,7 @@ export enum GeoAction {
95
95
  export enum InAppMessagingAction {
96
96
  SyncMessages = '1',
97
97
  IdentifyUser = '2',
98
- DispatchEvent = '3',
98
+ NotifyMessageInteraction = '3',
99
99
  }
100
100
  export enum InteractionsAction {
101
101
  None = '0',
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '6.0.1-console-preview.be08038.0+be08038';
2
+ export const version = '6.0.1-console-preview.d745d43.0+d745d43';
package/src/index.ts CHANGED
@@ -24,6 +24,7 @@ export {
24
24
  AuthUserPoolConfig,
25
25
  AuthUserPoolAndIdentityPoolConfig,
26
26
  APIConfig,
27
+ PredictionsConfig,
27
28
  StorageAccessLevel,
28
29
  StorageConfig,
29
30
  GetCredentialsOptions,
@@ -1,7 +1,11 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { ConsoleLogger as Logger } from './Logger';
4
- import { OAuthConfig, AuthConfigUserAttributes, OAuthProvider } from './singleton/Auth/types';
4
+ import {
5
+ OAuthConfig,
6
+ AuthConfigUserAttributes,
7
+ OAuthProvider,
8
+ } from './singleton/Auth/types';
5
9
  import { ResourcesConfig } from './singleton/types';
6
10
 
7
11
  const logger = new Logger('parseAWSExports');
@@ -53,6 +57,7 @@ export const parseAWSExports = (
53
57
  aws_user_pools_web_client_id,
54
58
  geo,
55
59
  oauth,
60
+ predictions,
56
61
  aws_cloud_logic_custom,
57
62
  Notifications,
58
63
  } = config;
@@ -179,22 +184,24 @@ export const parseAWSExports = (
179
184
  username:
180
185
  loginWithEmailEnabled || loginWithPhoneEnabled ? false : true,
181
186
  email: loginWithEmailEnabled,
182
- phone: loginWithPhoneEnabled
187
+ phone: loginWithPhoneEnabled,
183
188
  },
184
189
  },
185
190
  };
186
191
  }
187
192
 
188
193
  const hasOAuthConfig = oauth ? Object.keys(oauth).length > 0 : false;
189
- const hasSocialProviderConfig = aws_cognito_social_providers ? aws_cognito_social_providers.length > 0 : false;
194
+ const hasSocialProviderConfig = aws_cognito_social_providers
195
+ ? aws_cognito_social_providers.length > 0
196
+ : false;
190
197
  if (amplifyConfig.Auth && hasOAuthConfig) {
191
198
  amplifyConfig.Auth.Cognito.loginWith = {
192
199
  ...amplifyConfig.Auth.Cognito.loginWith,
193
200
  oauth: {
194
- ...(getOAuthConfig(oauth)),
201
+ ...getOAuthConfig(oauth),
195
202
  ...(hasSocialProviderConfig && {
196
- providers: parseSocialProviders(aws_cognito_social_providers)
197
- })
203
+ providers: parseSocialProviders(aws_cognito_social_providers),
204
+ }),
198
205
  },
199
206
  };
200
207
  }
@@ -246,6 +253,25 @@ export const parseAWSExports = (
246
253
  };
247
254
  }
248
255
 
256
+ // Predictions
257
+ if (predictions) {
258
+ // map VoiceId from speechGenerator defaults to voiceId
259
+ const { VoiceId: voiceId } =
260
+ predictions?.convert?.speechGenerator?.defaults ?? {};
261
+ amplifyConfig.Predictions = voiceId
262
+ ? {
263
+ ...predictions,
264
+ convert: {
265
+ ...predictions.convert,
266
+ speechGenerator: {
267
+ ...predictions.convert.speechGenerator,
268
+ defaults: { voiceId },
269
+ },
270
+ },
271
+ }
272
+ : predictions;
273
+ }
274
+
249
275
  return amplifyConfig;
250
276
  };
251
277
 
@@ -263,7 +289,7 @@ const getOAuthConfig = ({
263
289
  scopes: scope,
264
290
  redirectSignIn: getRedirectUrl(redirectSignIn),
265
291
  redirectSignOut: getRedirectUrl(redirectSignOut),
266
- responseType
292
+ responseType,
267
293
  });
268
294
 
269
295
  const parseSocialProviders = (aws_cognito_social_providers: string[]) => {
@@ -0,0 +1,61 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // Defaults for ConvertConfig
5
+ type SpeechGeneratorDefaults = {
6
+ voiceId?: string;
7
+ };
8
+ type TranscriptionDefaults = {
9
+ language?: string;
10
+ };
11
+ type TranslateTextDefaults = {
12
+ sourceLanguage?: string;
13
+ targetLanguage?: string;
14
+ };
15
+
16
+ // Defaults for IdentifyConfig
17
+ type IdentifyEntitiesDefaults = {
18
+ collectionId?: string;
19
+ maxEntities?: number;
20
+ };
21
+ type IdentityLabelsDefaults = {
22
+ type?: string;
23
+ };
24
+ type IdentifyTextDefaults = {
25
+ format?: string;
26
+ };
27
+
28
+ // Defaults for InterpretConfig
29
+ type InterpretTextDefaults = {
30
+ type?: string;
31
+ };
32
+
33
+ type ConvertConfig = {
34
+ speechGenerator?: PredictionsProviderConfig<SpeechGeneratorDefaults>;
35
+ transcription?: PredictionsProviderConfig<TranscriptionDefaults>;
36
+ translateText?: PredictionsProviderConfig<TranslateTextDefaults>;
37
+ };
38
+
39
+ type IdentifyConfig = {
40
+ identifyEntities?: PredictionsProviderConfig<IdentifyEntitiesDefaults> & {
41
+ celebrityDetectionEnabled?: boolean;
42
+ };
43
+ identifyLabels?: PredictionsProviderConfig<IdentityLabelsDefaults>;
44
+ identifyText?: PredictionsProviderConfig<IdentifyTextDefaults>;
45
+ };
46
+
47
+ type InterpretConfig = {
48
+ interpretText?: PredictionsProviderConfig<InterpretTextDefaults>;
49
+ };
50
+
51
+ export type PredictionsProviderConfig<T> = {
52
+ region?: string;
53
+ proxy?: boolean;
54
+ defaults?: T;
55
+ };
56
+
57
+ export type PredictionsConfig = {
58
+ convert?: ConvertConfig;
59
+ identify?: IdentifyConfig;
60
+ interpret?: InterpretConfig;
61
+ };
@@ -13,6 +13,7 @@ import {
13
13
  CognitoIdentityPoolConfig,
14
14
  } from './Auth/types';
15
15
  import { GeoConfig } from './Geo/types';
16
+ import { PredictionsConfig } from './Predictions/types';
16
17
  import {
17
18
  LibraryStorageOptions,
18
19
  StorageAccessLevel,
@@ -34,7 +35,7 @@ export type ResourcesConfig = {
34
35
  Auth?: AuthConfig;
35
36
  Interactions?: InteractionsConfig;
36
37
  Notifications?: NotificationsConfig;
37
- // Predictions?: {};
38
+ Predictions?: PredictionsConfig;
38
39
  Storage?: StorageConfig;
39
40
  Geo?: GeoConfig;
40
41
  };
@@ -54,6 +55,7 @@ export {
54
55
  AuthUserPoolAndIdentityPoolConfig,
55
56
  GetCredentialsOptions,
56
57
  InteractionsConfig,
58
+ PredictionsConfig,
57
59
  StorageAccessLevel,
58
60
  StorageConfig,
59
61
  AnalyticsConfig,