@aws-amplify/predictions 5.5.6-api-v6-models.b3abc9b.0 → 6.0.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 (148) hide show
  1. package/README.md +3 -0
  2. package/lib/Predictions.d.ts +11 -45
  3. package/lib/Predictions.js +24 -132
  4. package/lib/errors/PredictionsError.d.ts +4 -0
  5. package/lib/errors/PredictionsError.js +15 -0
  6. package/lib/errors/types/validation.d.ts +14 -0
  7. package/lib/errors/types/validation.js +50 -0
  8. package/lib/errors/utils/assertValidationError.d.ts +2 -0
  9. package/lib/errors/utils/assertValidationError.js +14 -0
  10. package/lib/index.d.ts +2 -4
  11. package/lib/index.js +2 -9
  12. package/{lib-esm/Providers → lib/providers}/AmazonAIConvertPredictionsProvider.d.ts +6 -7
  13. package/lib/providers/AmazonAIConvertPredictionsProvider.js +307 -0
  14. package/lib/{Providers → providers}/AmazonAIIdentifyPredictionsProvider.d.ts +5 -6
  15. package/lib/providers/AmazonAIIdentifyPredictionsProvider.js +334 -0
  16. package/lib/{Providers → providers}/AmazonAIInterpretPredictionsProvider.d.ts +3 -4
  17. package/lib/providers/AmazonAIInterpretPredictionsProvider.js +208 -0
  18. package/lib/providers/IdentifyTextUtils.d.ts +16 -0
  19. package/lib/{Providers → providers}/IdentifyTextUtils.js +97 -148
  20. package/lib/{Providers → providers}/Utils.d.ts +2 -2
  21. package/lib/{Providers → providers}/Utils.js +11 -12
  22. package/lib/{Providers → providers}/index.d.ts +1 -2
  23. package/lib/providers/index.js +11 -0
  24. package/lib/tsconfig.tsbuildinfo +1 -0
  25. package/lib/types/AWSTypes.d.ts +8 -9
  26. package/lib/types/AWSTypes.js +0 -1
  27. package/lib/types/Predictions.d.ts +63 -59
  28. package/lib/types/Predictions.js +41 -28
  29. package/lib/types/index.js +1 -2
  30. package/lib-esm/Predictions.d.ts +11 -45
  31. package/lib-esm/Predictions.js +23 -133
  32. package/lib-esm/errors/PredictionsError.d.ts +4 -0
  33. package/lib-esm/errors/PredictionsError.js +11 -0
  34. package/lib-esm/errors/types/validation.d.ts +14 -0
  35. package/lib-esm/errors/types/validation.js +47 -0
  36. package/lib-esm/errors/utils/assertValidationError.d.ts +2 -0
  37. package/lib-esm/errors/utils/assertValidationError.js +10 -0
  38. package/lib-esm/index.d.ts +2 -4
  39. package/lib-esm/index.js +1 -5
  40. package/{lib/Providers → lib-esm/providers}/AmazonAIConvertPredictionsProvider.d.ts +6 -7
  41. package/lib-esm/providers/AmazonAIConvertPredictionsProvider.js +303 -0
  42. package/lib-esm/{Providers → providers}/AmazonAIIdentifyPredictionsProvider.d.ts +5 -6
  43. package/lib-esm/providers/AmazonAIIdentifyPredictionsProvider.js +330 -0
  44. package/lib-esm/{Providers → providers}/AmazonAIInterpretPredictionsProvider.d.ts +3 -4
  45. package/lib-esm/providers/AmazonAIInterpretPredictionsProvider.js +204 -0
  46. package/lib-esm/providers/IdentifyTextUtils.d.ts +16 -0
  47. package/lib-esm/providers/IdentifyTextUtils.js +264 -0
  48. package/lib-esm/{Providers → providers}/Utils.d.ts +2 -2
  49. package/lib-esm/{Providers → providers}/Utils.js +10 -12
  50. package/lib-esm/{Providers → providers}/index.d.ts +1 -2
  51. package/lib-esm/{Providers → providers}/index.js +1 -3
  52. package/lib-esm/tsconfig.tsbuildinfo +1 -0
  53. package/lib-esm/types/AWSTypes.d.ts +8 -9
  54. package/lib-esm/types/AWSTypes.js +1 -1
  55. package/lib-esm/types/Predictions.d.ts +63 -59
  56. package/lib-esm/types/Predictions.js +34 -27
  57. package/lib-esm/types/index.js +0 -1
  58. package/package.json +39 -48
  59. package/src/Predictions.ts +33 -220
  60. package/src/errors/PredictionsError.ts +16 -0
  61. package/src/errors/types/validation.ts +51 -0
  62. package/src/errors/utils/assertValidationError.ts +18 -0
  63. package/src/index.ts +16 -16
  64. package/src/{Providers → providers}/AmazonAIConvertPredictionsProvider.ts +210 -171
  65. package/src/{Providers → providers}/AmazonAIIdentifyPredictionsProvider.ts +244 -246
  66. package/src/providers/AmazonAIInterpretPredictionsProvider.ts +293 -0
  67. package/src/{Providers → providers}/IdentifyTextUtils.ts +69 -52
  68. package/src/{Providers → providers}/Utils.ts +2 -2
  69. package/src/{Providers → providers}/index.ts +0 -2
  70. package/src/types/AWSTypes.ts +5 -6
  71. package/src/types/Predictions.ts +107 -62
  72. package/lib/.tsbuildinfo +0 -3
  73. package/lib/Predictions.js.map +0 -1
  74. package/lib/Providers/AmazonAIConvertPredictionsProvider.js +0 -377
  75. package/lib/Providers/AmazonAIConvertPredictionsProvider.js.map +0 -1
  76. package/lib/Providers/AmazonAIIdentifyPredictionsProvider.js +0 -441
  77. package/lib/Providers/AmazonAIIdentifyPredictionsProvider.js.map +0 -1
  78. package/lib/Providers/AmazonAIInterpretPredictionsProvider.js +0 -321
  79. package/lib/Providers/AmazonAIInterpretPredictionsProvider.js.map +0 -1
  80. package/lib/Providers/AmazonAIPredictionsProvider.d.ts +0 -14
  81. package/lib/Providers/AmazonAIPredictionsProvider.js +0 -43
  82. package/lib/Providers/AmazonAIPredictionsProvider.js.map +0 -1
  83. package/lib/Providers/IdentifyTextUtils.d.ts +0 -40
  84. package/lib/Providers/IdentifyTextUtils.js.map +0 -1
  85. package/lib/Providers/Utils.js.map +0 -1
  86. package/lib/Providers/index.js +0 -13
  87. package/lib/Providers/index.js.map +0 -1
  88. package/lib/index.js.map +0 -1
  89. package/lib/types/AWSTypes.js.map +0 -1
  90. package/lib/types/Predictions.js.map +0 -1
  91. package/lib/types/Providers/AbstractConvertPredictionsProvider.d.ts +0 -9
  92. package/lib/types/Providers/AbstractConvertPredictionsProvider.js +0 -44
  93. package/lib/types/Providers/AbstractConvertPredictionsProvider.js.map +0 -1
  94. package/lib/types/Providers/AbstractIdentifyPredictionsProvider.d.ts +0 -9
  95. package/lib/types/Providers/AbstractIdentifyPredictionsProvider.js +0 -44
  96. package/lib/types/Providers/AbstractIdentifyPredictionsProvider.js.map +0 -1
  97. package/lib/types/Providers/AbstractInterpretPredictionsProvider.d.ts +0 -7
  98. package/lib/types/Providers/AbstractInterpretPredictionsProvider.js +0 -27
  99. package/lib/types/Providers/AbstractInterpretPredictionsProvider.js.map +0 -1
  100. package/lib/types/Providers/AbstractPredictionsProvider.d.ts +0 -7
  101. package/lib/types/Providers/AbstractPredictionsProvider.js +0 -16
  102. package/lib/types/Providers/AbstractPredictionsProvider.js.map +0 -1
  103. package/lib/types/Providers/index.d.ts +0 -4
  104. package/lib/types/Providers/index.js +0 -10
  105. package/lib/types/Providers/index.js.map +0 -1
  106. package/lib/types/index.js.map +0 -1
  107. package/lib-esm/.tsbuildinfo +0 -3
  108. package/lib-esm/Predictions.js.map +0 -1
  109. package/lib-esm/Providers/AmazonAIConvertPredictionsProvider.js +0 -375
  110. package/lib-esm/Providers/AmazonAIConvertPredictionsProvider.js.map +0 -1
  111. package/lib-esm/Providers/AmazonAIIdentifyPredictionsProvider.js +0 -439
  112. package/lib-esm/Providers/AmazonAIIdentifyPredictionsProvider.js.map +0 -1
  113. package/lib-esm/Providers/AmazonAIInterpretPredictionsProvider.js +0 -319
  114. package/lib-esm/Providers/AmazonAIInterpretPredictionsProvider.js.map +0 -1
  115. package/lib-esm/Providers/AmazonAIPredictionsProvider.d.ts +0 -14
  116. package/lib-esm/Providers/AmazonAIPredictionsProvider.js +0 -41
  117. package/lib-esm/Providers/AmazonAIPredictionsProvider.js.map +0 -1
  118. package/lib-esm/Providers/IdentifyTextUtils.d.ts +0 -40
  119. package/lib-esm/Providers/IdentifyTextUtils.js +0 -313
  120. package/lib-esm/Providers/IdentifyTextUtils.js.map +0 -1
  121. package/lib-esm/Providers/Utils.js.map +0 -1
  122. package/lib-esm/Providers/index.js.map +0 -1
  123. package/lib-esm/index.js.map +0 -1
  124. package/lib-esm/types/AWSTypes.js.map +0 -1
  125. package/lib-esm/types/Predictions.js.map +0 -1
  126. package/lib-esm/types/Providers/AbstractConvertPredictionsProvider.d.ts +0 -9
  127. package/lib-esm/types/Providers/AbstractConvertPredictionsProvider.js +0 -42
  128. package/lib-esm/types/Providers/AbstractConvertPredictionsProvider.js.map +0 -1
  129. package/lib-esm/types/Providers/AbstractIdentifyPredictionsProvider.d.ts +0 -9
  130. package/lib-esm/types/Providers/AbstractIdentifyPredictionsProvider.js +0 -42
  131. package/lib-esm/types/Providers/AbstractIdentifyPredictionsProvider.js.map +0 -1
  132. package/lib-esm/types/Providers/AbstractInterpretPredictionsProvider.d.ts +0 -7
  133. package/lib-esm/types/Providers/AbstractInterpretPredictionsProvider.js +0 -25
  134. package/lib-esm/types/Providers/AbstractInterpretPredictionsProvider.js.map +0 -1
  135. package/lib-esm/types/Providers/AbstractPredictionsProvider.d.ts +0 -7
  136. package/lib-esm/types/Providers/AbstractPredictionsProvider.js +0 -14
  137. package/lib-esm/types/Providers/AbstractPredictionsProvider.js.map +0 -1
  138. package/lib-esm/types/Providers/index.d.ts +0 -4
  139. package/lib-esm/types/Providers/index.js +0 -7
  140. package/lib-esm/types/Providers/index.js.map +0 -1
  141. package/lib-esm/types/index.js.map +0 -1
  142. package/src/Providers/AmazonAIInterpretPredictionsProvider.ts +0 -281
  143. package/src/Providers/AmazonAIPredictionsProvider.ts +0 -69
  144. package/src/types/Providers/AbstractConvertPredictionsProvider.ts +0 -55
  145. package/src/types/Providers/AbstractIdentifyPredictionsProvider.ts +0 -57
  146. package/src/types/Providers/AbstractInterpretPredictionsProvider.ts +0 -26
  147. package/src/types/Providers/AbstractPredictionsProvider.ts +0 -20
  148. package/src/types/Providers/index.ts +0 -6
@@ -1,24 +1,8 @@
1
1
  /// <reference types="node" />
2
- /**
3
- * Base types
4
- */
5
- export interface PredictionsOptions {
6
- [key: string]: any;
7
- }
8
- export interface ProviderOptions {
9
- providerName?: string;
10
- }
11
2
  /**
12
3
  * Convert types
13
4
  */
14
- export declare enum InterpretTextCategories {
15
- ALL = "ALL",
16
- LANGUAGE = "LANGUAGE",
17
- ENTITIES = "ENTITIES",
18
- SENTIMENT = "SENTIMENT",
19
- SYNTAX = "SYNTAX",
20
- KEY_PHRASES = "KEY_PHRASES"
21
- }
5
+ export type InterpretTextCategories = 'all' | 'language' | 'entities' | 'sentiment' | 'syntax' | 'keyPhrases';
22
6
  export interface InterpretTextInput {
23
7
  text: InterpretTextInputLanguage | InterpretTextOthers | InterpretTextAll;
24
8
  }
@@ -26,28 +10,29 @@ export interface InterpretTextInputLanguage {
26
10
  source: {
27
11
  text: string;
28
12
  };
29
- type: InterpretTextCategories.LANGUAGE;
13
+ type: Extract<InterpretTextCategories, 'language'>;
30
14
  }
31
15
  export interface InterpretTextOthers {
32
16
  source: {
33
17
  text: string;
34
18
  language: string;
35
19
  };
36
- type: InterpretTextCategories.ENTITIES | InterpretTextCategories.SENTIMENT | InterpretTextCategories.SYNTAX | InterpretTextCategories.KEY_PHRASES;
20
+ type: Extract<InterpretTextCategories, 'entities' | 'sentiment' | 'syntax' | 'keyPhrases'>;
37
21
  }
38
22
  export interface InterpretTextAll {
39
23
  source: {
40
24
  text: string;
41
25
  };
42
- type: InterpretTextCategories.ALL;
26
+ type: Extract<InterpretTextCategories, 'all'>;
43
27
  }
44
28
  export interface TextEntities {
45
- type: string;
46
- text: string;
47
- }
48
- export interface KeyPhrases {
49
- text: string;
29
+ type?: string;
30
+ text?: string;
50
31
  }
32
+ export type KeyPhrases = KeyPhrase[];
33
+ export type KeyPhrase = {
34
+ text?: string;
35
+ };
51
36
  export interface TextSyntax {
52
37
  text: string;
53
38
  syntax: string;
@@ -59,11 +44,15 @@ export interface TextSentiment {
59
44
  neutral: number;
60
45
  mixed: number;
61
46
  }
47
+ export type DetectParams = {
48
+ Text: string;
49
+ LanguageCode: string;
50
+ };
62
51
  export interface InterpretTextOutput {
63
52
  textInterpretation: {
64
53
  language?: string;
65
54
  textEntities?: Array<TextEntities>;
66
- keyPhrases?: Array<KeyPhrases>;
55
+ keyPhrases?: KeyPhrases;
67
56
  sentiment?: TextSentiment;
68
57
  syntax?: Array<TextSyntax>;
69
58
  };
@@ -99,27 +88,34 @@ export interface TextToSpeechOutput {
99
88
  }
100
89
  export interface StorageSource {
101
90
  key: string;
102
- level?: 'public' | 'private' | 'protected';
91
+ level?: 'guest' | 'private' | 'protected';
103
92
  identityId?: string;
104
93
  }
105
94
  export interface FileSource {
106
95
  file: File;
107
96
  }
108
- export interface BytesSource {
109
- bytes: Buffer | ArrayBuffer | Blob | string;
97
+ export type ConvertBytes = Buffer | ArrayBuffer | string;
98
+ export type IdentifyBytes = ConvertBytes | Blob;
99
+ export interface BytesSource<T> {
100
+ bytes: T;
110
101
  }
111
102
  export interface SpeechToTextInput {
112
103
  transcription: {
113
- source: BytesSource;
104
+ source: BytesSource<ConvertBytes>;
114
105
  language?: string;
115
106
  };
116
107
  }
108
+ export type TranscribeData = {
109
+ connection: WebSocket;
110
+ raw: ConvertBytes;
111
+ languageCode: string;
112
+ };
117
113
  export interface SpeechToTextOutput {
118
114
  transcription: {
119
115
  fullText: string;
120
116
  };
121
117
  }
122
- export declare type IdentifySource = StorageSource | FileSource | BytesSource;
118
+ export type IdentifySource = StorageSource | FileSource | BytesSource<IdentifyBytes>;
123
119
  export interface IdentifyTextInput {
124
120
  text: {
125
121
  source: IdentifySource;
@@ -153,14 +149,14 @@ export interface Table {
153
149
  columns: number;
154
150
  };
155
151
  table: TableCell[][];
156
- polygon: Polygon;
157
- boundingBox: BoundingBox;
152
+ polygon?: Polygon;
153
+ boundingBox?: BoundingBox;
158
154
  }
159
155
  export interface KeyValue {
160
156
  key: string;
161
157
  value: Content;
162
- polygon: Polygon;
163
- boundingBox: BoundingBox;
158
+ polygon?: Polygon;
159
+ boundingBox?: BoundingBox;
164
160
  }
165
161
  export interface IdentifyTextOutput {
166
162
  text: {
@@ -172,8 +168,8 @@ export interface IdentifyTextOutput {
172
168
  tables?: Table[];
173
169
  selections?: {
174
170
  selected: boolean;
175
- polygon: Polygon;
176
- boundingBox: BoundingBox;
171
+ polygon?: Polygon;
172
+ boundingBox?: BoundingBox;
177
173
  }[];
178
174
  };
179
175
  }
@@ -187,7 +183,7 @@ export interface Point {
187
183
  x?: Number;
188
184
  y?: Number;
189
185
  }
190
- export declare type Polygon = Array<Point> | Iterable<Point>;
186
+ export type Polygon = Array<Point> | Iterable<Point>;
191
187
  export interface BoundingBox {
192
188
  width?: Number;
193
189
  height?: Number;
@@ -196,8 +192,8 @@ export interface BoundingBox {
196
192
  }
197
193
  export interface IdentifyLabelsOutput {
198
194
  labels?: {
199
- name: string;
200
- boundingBoxes: BoundingBox[];
195
+ name?: string;
196
+ boundingBoxes?: (BoundingBox | undefined)[];
201
197
  metadata?: Object;
202
198
  }[];
203
199
  unsafe?: 'YES' | 'NO' | 'UNKNOWN';
@@ -227,24 +223,30 @@ export interface FaceAttributes {
227
223
  mustache?: boolean;
228
224
  eyesOpen?: boolean;
229
225
  mouthOpen?: boolean;
230
- emotions?: string[];
231
- }
226
+ emotions?: (string | undefined)[];
227
+ }
228
+ export type EntityAgeRange = {
229
+ low?: Number;
230
+ high?: Number;
231
+ };
232
+ export type EntityLandmark = {
233
+ type?: string;
234
+ x?: number;
235
+ y?: number;
236
+ };
237
+ export type IdentifyEntity = {
238
+ boundingBox?: BoundingBox;
239
+ ageRange?: EntityAgeRange;
240
+ landmarks?: (EntityLandmark | undefined)[];
241
+ attributes?: FaceAttributes;
242
+ metadata?: object;
243
+ };
232
244
  export interface IdentifyEntitiesOutput {
233
- entities: {
234
- boundingBox?: BoundingBox;
235
- ageRange?: {
236
- low?: Number;
237
- high?: Number;
238
- };
239
- landmarks?: {
240
- type?: string;
241
- x?: number;
242
- y?: number;
243
- }[];
244
- attributes?: FaceAttributes;
245
- metadata?: object;
246
- }[];
245
+ entities: IdentifyEntity[];
247
246
  }
247
+ export declare function isValidConvertInput(obj: any): boolean;
248
+ export declare function isValidIdentifyInput(obj: any): boolean;
249
+ export declare function isValidInterpretInput(obj: any): boolean;
248
250
  export declare function isIdentifyFromCollection(obj: any): obj is IdentifyFromCollection;
249
251
  export declare function isIdentifyCelebrities(obj: any): obj is IdentifyCelebrities;
250
252
  export declare function isTranslateTextInput(obj: any): obj is TranslateTextInput;
@@ -252,11 +254,13 @@ export declare function isTextToSpeechInput(obj: any): obj is TextToSpeechInput;
252
254
  export declare function isSpeechToTextInput(obj: any): obj is SpeechToTextInput;
253
255
  export declare function isStorageSource(obj: any): obj is StorageSource;
254
256
  export declare function isFileSource(obj: any): obj is FileSource;
255
- export declare function isBytesSource(obj: any): obj is BytesSource;
257
+ export declare function isConvertBytesSource(obj: any): obj is BytesSource<ConvertBytes>;
258
+ export declare function isIdentifyBytesSource(obj: any): obj is BytesSource<IdentifyBytes>;
256
259
  export declare function isIdentifyTextInput(obj: any): obj is IdentifyTextInput;
257
260
  export declare function isIdentifyLabelsInput(obj: any): obj is IdentifyLabelsInput;
258
261
  export declare function isIdentifyEntitiesInput(obj: any): obj is IdentifyEntitiesInput;
259
262
  export declare function isInterpretTextInput(obj: any): obj is InterpretTextInput;
263
+ export declare function isInterpretTextOthers(text: InterpretTextInput['text']): text is InterpretTextOthers;
260
264
  export interface Geometry {
261
265
  /**
262
266
  * <p>An axis-aligned coarse representation of the detected text's location on the image.</p>
@@ -277,5 +281,5 @@ export interface Relationship {
277
281
  */
278
282
  Ids?: Array<string> | Iterable<string>;
279
283
  }
280
- export declare type FeatureType = 'TABLES' | 'FORMS' | string;
281
- export declare type FeatureTypes = FeatureType[];
284
+ export type FeatureType = 'TABLES' | 'FORMS' | string;
285
+ export type FeatureTypes = FeatureType[];
@@ -1,65 +1,72 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  /* tslint:disable:max-line-length */
4
- /**
5
- * Convert types
6
- */
7
- export var InterpretTextCategories;
8
- (function (InterpretTextCategories) {
9
- InterpretTextCategories["ALL"] = "ALL";
10
- InterpretTextCategories["LANGUAGE"] = "LANGUAGE";
11
- InterpretTextCategories["ENTITIES"] = "ENTITIES";
12
- InterpretTextCategories["SENTIMENT"] = "SENTIMENT";
13
- InterpretTextCategories["SYNTAX"] = "SYNTAX";
14
- InterpretTextCategories["KEY_PHRASES"] = "KEY_PHRASES";
15
- })(InterpretTextCategories || (InterpretTextCategories = {}));
4
+ export function isValidConvertInput(obj) {
5
+ return (isTranslateTextInput(obj) ||
6
+ isTextToSpeechInput(obj) ||
7
+ isSpeechToTextInput(obj));
8
+ }
9
+ export function isValidIdentifyInput(obj) {
10
+ return (isIdentifyTextInput(obj) ||
11
+ isIdentifyLabelsInput(obj) ||
12
+ isIdentifyEntitiesInput(obj));
13
+ }
14
+ export function isValidInterpretInput(obj) {
15
+ return isInterpretTextInput(obj);
16
+ }
16
17
  export function isIdentifyFromCollection(obj) {
17
- var key = 'collection';
18
- var keyId = 'collectionId';
18
+ const key = 'collection';
19
+ const keyId = 'collectionId';
19
20
  return obj && (obj.hasOwnProperty(key) || obj.hasOwnProperty(keyId));
20
21
  }
21
22
  export function isIdentifyCelebrities(obj) {
22
- var key = 'celebrityDetection';
23
+ const key = 'celebrityDetection';
23
24
  return obj && obj.hasOwnProperty(key);
24
25
  }
25
26
  export function isTranslateTextInput(obj) {
26
- var key = 'translateText';
27
+ const key = 'translateText';
27
28
  return obj && obj.hasOwnProperty(key);
28
29
  }
29
30
  export function isTextToSpeechInput(obj) {
30
- var key = 'textToSpeech';
31
+ const key = 'textToSpeech';
31
32
  return obj && obj.hasOwnProperty(key);
32
33
  }
33
34
  export function isSpeechToTextInput(obj) {
34
- var key = 'transcription';
35
+ const key = 'transcription';
35
36
  return obj && obj.hasOwnProperty(key);
36
37
  }
37
38
  export function isStorageSource(obj) {
38
- var key = 'key';
39
+ const key = 'key';
39
40
  return obj && obj.hasOwnProperty(key);
40
41
  }
41
42
  export function isFileSource(obj) {
42
- var key = 'file';
43
+ const key = 'file';
43
44
  return obj && obj.hasOwnProperty(key);
44
45
  }
45
- export function isBytesSource(obj) {
46
- var key = 'bytes';
46
+ export function isConvertBytesSource(obj) {
47
+ const key = 'bytes';
48
+ return obj && obj.hasOwnProperty(key);
49
+ }
50
+ export function isIdentifyBytesSource(obj) {
51
+ const key = 'bytes';
47
52
  return obj && obj.hasOwnProperty(key);
48
53
  }
49
54
  export function isIdentifyTextInput(obj) {
50
- var key = 'text';
55
+ const key = 'text';
51
56
  return obj && obj.hasOwnProperty(key);
52
57
  }
53
58
  export function isIdentifyLabelsInput(obj) {
54
- var key = 'labels';
59
+ const key = 'labels';
55
60
  return obj && obj.hasOwnProperty(key);
56
61
  }
57
62
  export function isIdentifyEntitiesInput(obj) {
58
- var key = 'entities';
63
+ const key = 'entities';
59
64
  return obj && obj.hasOwnProperty(key);
60
65
  }
61
66
  export function isInterpretTextInput(obj) {
62
- var key = 'text';
67
+ const key = 'text';
63
68
  return obj && obj.hasOwnProperty(key);
64
69
  }
65
- //# sourceMappingURL=Predictions.js.map
70
+ export function isInterpretTextOthers(text) {
71
+ return text.source.language !== undefined;
72
+ }
@@ -1,4 +1,3 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  export * from './Predictions';
4
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/predictions",
3
- "version": "5.5.6-api-v6-models.b3abc9b.0+b3abc9b",
3
+ "version": "6.0.0",
4
4
  "description": "Machine learning category of aws-amplify",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib-esm/index.js",
@@ -15,11 +15,11 @@
15
15
  "scripts": {
16
16
  "test": "npm run lint && jest -w 1 --passWithNoTests --coverage --maxWorkers 2",
17
17
  "test:size": "size-limit",
18
- "build-with-test": "npm run clean && npm test && tsc && webpack -p",
19
- "build:cjs": "node ./build es5 && webpack && webpack --config ./webpack.config.dev.js",
20
- "build:esm": "node ./build es6",
21
- "build:cjs:watch": "node ./build es5 --watch",
22
- "build:esm:watch": "node ./build es6 --watch",
18
+ "build-with-test": "npm test && npm run build",
19
+ "build:cjs": "rimraf lib && tsc -m commonjs --outDir lib && webpack && webpack --config ./webpack.config.dev.js",
20
+ "build:esm": "rimraf lib-esm && tsc -m esnext --outDir lib-esm",
21
+ "build:cjs:watch": "rimraf lib && tsc -m commonjs --outDir lib --watch",
22
+ "build:esm:watch": "rimraf lib-esm && tsc -m esnext --outDir lib-esm --watch",
23
23
  "build": "npm run clean && npm run build:esm && npm run build:cjs",
24
24
  "clean": "npm run clean:size && rimraf lib-esm lib dist",
25
25
  "clean:size": "rimraf dual-publish-tmp tmp*",
@@ -27,7 +27,7 @@
27
27
  "lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
28
28
  "generate-docs-local": "typedoc --out docs src",
29
29
  "generate-docs-root": "typedoc --out ../../docs src",
30
- "ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 87.84"
30
+ "ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 87.84"
31
31
  },
32
32
  "repository": {
33
33
  "type": "git",
@@ -45,58 +45,49 @@
45
45
  "src"
46
46
  ],
47
47
  "dependencies": {
48
- "@aws-amplify/core": "5.8.6-api-v6-models.b3abc9b.0+b3abc9b",
49
- "@aws-amplify/storage": "5.9.6-api-v6-models.b3abc9b.0+b3abc9b",
50
- "@aws-sdk/client-comprehend": "3.6.1",
51
- "@aws-sdk/client-polly": "3.6.1",
52
- "@aws-sdk/client-rekognition": "3.6.1",
53
- "@aws-sdk/client-textract": "3.6.1",
54
- "@aws-sdk/client-translate": "3.6.1",
55
- "@aws-sdk/eventstream-marshaller": "3.6.1",
56
- "@aws-sdk/util-utf8-node": "3.6.1",
48
+ "@aws-amplify/storage": "6.0.0",
49
+ "@aws-sdk/client-comprehend": "3.398.0",
50
+ "@aws-sdk/client-polly": "3.398.0",
51
+ "@aws-sdk/client-rekognition": "3.398.0",
52
+ "@aws-sdk/client-textract": "3.398.0",
53
+ "@aws-sdk/client-translate": "3.398.0",
54
+ "@smithy/eventstream-codec": "2.0.9",
55
+ "@smithy/util-utf8": "2.0.0",
57
56
  "buffer": "4.9.2",
58
- "tslib": "^1.8.0",
59
- "uuid": "^3.2.1"
57
+ "tslib": "^2.5.0",
58
+ "uuid": "^9.0.0"
59
+ },
60
+ "peerDependencies": {
61
+ "@aws-amplify/core": "^6.0.0"
62
+ },
63
+ "devDependencies": {
64
+ "@aws-amplify/core": "6.0.0",
65
+ "typescript": "5.0.2"
60
66
  },
61
67
  "size-limit": [
62
68
  {
63
- "name": "Predictions (all providers)",
64
- "path": "./lib-esm/index.js",
65
- "import": "{ Amplify, Predictions, AmazonAIPredictionsProvider }",
66
- "limit": "103.2 kB"
67
- },
68
- {
69
- "name": "Predictions (Convert provider)",
70
- "path": "./lib-esm/index.js",
71
- "import": "{ Amplify, Predictions, AmazonAIConvertPredictionsProvider }",
72
- "limit": "60.09 kB"
73
- },
74
- {
75
- "name": "Predictions (Identify provider)",
76
- "path": "./lib-esm/index.js",
77
- "import": "{ Amplify, Predictions, AmazonAIIdentifyPredictionsProvider }",
78
- "limit": "76.22 kB"
79
- },
80
- {
81
- "name": "Predictions (Interpret provider)",
69
+ "name": "Predictions",
82
70
  "path": "./lib-esm/index.js",
83
- "import": "{ Amplify, Predictions, AmazonAIInterpretPredictionsProvider }",
84
- "limit": "46.77 kB"
71
+ "import": "{ Amplify, Predictions }",
72
+ "limit": "66 kB"
85
73
  }
86
74
  ],
87
75
  "jest": {
88
76
  "globals": {
89
77
  "ts-jest": {
90
- "diagnostics": false,
78
+ "diagnostics": {
79
+ "pathRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$"
80
+ },
91
81
  "tsConfig": {
92
- "lib": [
93
- "es5",
94
- "es2015",
95
- "dom",
96
- "esnext.asynciterable",
97
- "es2017.object"
82
+ "downlevelIteration": true,
83
+ "allowJs": true,
84
+ "types": [
85
+ "@types/jest"
98
86
  ],
99
- "allowJs": true
87
+ "outDir": "./tsconfig.json",
88
+ "noEmitOnError": false,
89
+ "noImplicitAny": false,
90
+ "skipLibCheck": true
100
91
  }
101
92
  }
102
93
  },
@@ -128,5 +119,5 @@
128
119
  "lib-esm"
129
120
  ]
130
121
  },
131
- "gitHead": "b3abc9b75f6f1353f4c2fbc10cd3369be498e9fc"
122
+ "gitHead": "d505105326d7f6214f6bd1e06eb20be3a3651377"
132
123
  }