@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.
- package/README.md +3 -0
- package/lib/Predictions.d.ts +11 -45
- package/lib/Predictions.js +24 -132
- package/lib/errors/PredictionsError.d.ts +4 -0
- package/lib/errors/PredictionsError.js +15 -0
- package/lib/errors/types/validation.d.ts +14 -0
- package/lib/errors/types/validation.js +50 -0
- package/lib/errors/utils/assertValidationError.d.ts +2 -0
- package/lib/errors/utils/assertValidationError.js +14 -0
- package/lib/index.d.ts +2 -4
- package/lib/index.js +2 -9
- package/{lib-esm/Providers → lib/providers}/AmazonAIConvertPredictionsProvider.d.ts +6 -7
- package/lib/providers/AmazonAIConvertPredictionsProvider.js +307 -0
- package/lib/{Providers → providers}/AmazonAIIdentifyPredictionsProvider.d.ts +5 -6
- package/lib/providers/AmazonAIIdentifyPredictionsProvider.js +334 -0
- package/lib/{Providers → providers}/AmazonAIInterpretPredictionsProvider.d.ts +3 -4
- package/lib/providers/AmazonAIInterpretPredictionsProvider.js +208 -0
- package/lib/providers/IdentifyTextUtils.d.ts +16 -0
- package/lib/{Providers → providers}/IdentifyTextUtils.js +97 -148
- package/lib/{Providers → providers}/Utils.d.ts +2 -2
- package/lib/{Providers → providers}/Utils.js +11 -12
- package/lib/{Providers → providers}/index.d.ts +1 -2
- package/lib/providers/index.js +11 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/AWSTypes.d.ts +8 -9
- package/lib/types/AWSTypes.js +0 -1
- package/lib/types/Predictions.d.ts +63 -59
- package/lib/types/Predictions.js +41 -28
- package/lib/types/index.js +1 -2
- package/lib-esm/Predictions.d.ts +11 -45
- package/lib-esm/Predictions.js +23 -133
- package/lib-esm/errors/PredictionsError.d.ts +4 -0
- package/lib-esm/errors/PredictionsError.js +11 -0
- package/lib-esm/errors/types/validation.d.ts +14 -0
- package/lib-esm/errors/types/validation.js +47 -0
- package/lib-esm/errors/utils/assertValidationError.d.ts +2 -0
- package/lib-esm/errors/utils/assertValidationError.js +10 -0
- package/lib-esm/index.d.ts +2 -4
- package/lib-esm/index.js +1 -5
- package/{lib/Providers → lib-esm/providers}/AmazonAIConvertPredictionsProvider.d.ts +6 -7
- package/lib-esm/providers/AmazonAIConvertPredictionsProvider.js +303 -0
- package/lib-esm/{Providers → providers}/AmazonAIIdentifyPredictionsProvider.d.ts +5 -6
- package/lib-esm/providers/AmazonAIIdentifyPredictionsProvider.js +330 -0
- package/lib-esm/{Providers → providers}/AmazonAIInterpretPredictionsProvider.d.ts +3 -4
- package/lib-esm/providers/AmazonAIInterpretPredictionsProvider.js +204 -0
- package/lib-esm/providers/IdentifyTextUtils.d.ts +16 -0
- package/lib-esm/providers/IdentifyTextUtils.js +264 -0
- package/lib-esm/{Providers → providers}/Utils.d.ts +2 -2
- package/lib-esm/{Providers → providers}/Utils.js +10 -12
- package/lib-esm/{Providers → providers}/index.d.ts +1 -2
- package/lib-esm/{Providers → providers}/index.js +1 -3
- package/lib-esm/tsconfig.tsbuildinfo +1 -0
- package/lib-esm/types/AWSTypes.d.ts +8 -9
- package/lib-esm/types/AWSTypes.js +1 -1
- package/lib-esm/types/Predictions.d.ts +63 -59
- package/lib-esm/types/Predictions.js +34 -27
- package/lib-esm/types/index.js +0 -1
- package/package.json +39 -48
- package/src/Predictions.ts +33 -220
- package/src/errors/PredictionsError.ts +16 -0
- package/src/errors/types/validation.ts +51 -0
- package/src/errors/utils/assertValidationError.ts +18 -0
- package/src/index.ts +16 -16
- package/src/{Providers → providers}/AmazonAIConvertPredictionsProvider.ts +210 -171
- package/src/{Providers → providers}/AmazonAIIdentifyPredictionsProvider.ts +244 -246
- package/src/providers/AmazonAIInterpretPredictionsProvider.ts +293 -0
- package/src/{Providers → providers}/IdentifyTextUtils.ts +69 -52
- package/src/{Providers → providers}/Utils.ts +2 -2
- package/src/{Providers → providers}/index.ts +0 -2
- package/src/types/AWSTypes.ts +5 -6
- package/src/types/Predictions.ts +107 -62
- package/lib/.tsbuildinfo +0 -3
- package/lib/Predictions.js.map +0 -1
- package/lib/Providers/AmazonAIConvertPredictionsProvider.js +0 -377
- package/lib/Providers/AmazonAIConvertPredictionsProvider.js.map +0 -1
- package/lib/Providers/AmazonAIIdentifyPredictionsProvider.js +0 -441
- package/lib/Providers/AmazonAIIdentifyPredictionsProvider.js.map +0 -1
- package/lib/Providers/AmazonAIInterpretPredictionsProvider.js +0 -321
- package/lib/Providers/AmazonAIInterpretPredictionsProvider.js.map +0 -1
- package/lib/Providers/AmazonAIPredictionsProvider.d.ts +0 -14
- package/lib/Providers/AmazonAIPredictionsProvider.js +0 -43
- package/lib/Providers/AmazonAIPredictionsProvider.js.map +0 -1
- package/lib/Providers/IdentifyTextUtils.d.ts +0 -40
- package/lib/Providers/IdentifyTextUtils.js.map +0 -1
- package/lib/Providers/Utils.js.map +0 -1
- package/lib/Providers/index.js +0 -13
- package/lib/Providers/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/types/AWSTypes.js.map +0 -1
- package/lib/types/Predictions.js.map +0 -1
- package/lib/types/Providers/AbstractConvertPredictionsProvider.d.ts +0 -9
- package/lib/types/Providers/AbstractConvertPredictionsProvider.js +0 -44
- package/lib/types/Providers/AbstractConvertPredictionsProvider.js.map +0 -1
- package/lib/types/Providers/AbstractIdentifyPredictionsProvider.d.ts +0 -9
- package/lib/types/Providers/AbstractIdentifyPredictionsProvider.js +0 -44
- package/lib/types/Providers/AbstractIdentifyPredictionsProvider.js.map +0 -1
- package/lib/types/Providers/AbstractInterpretPredictionsProvider.d.ts +0 -7
- package/lib/types/Providers/AbstractInterpretPredictionsProvider.js +0 -27
- package/lib/types/Providers/AbstractInterpretPredictionsProvider.js.map +0 -1
- package/lib/types/Providers/AbstractPredictionsProvider.d.ts +0 -7
- package/lib/types/Providers/AbstractPredictionsProvider.js +0 -16
- package/lib/types/Providers/AbstractPredictionsProvider.js.map +0 -1
- package/lib/types/Providers/index.d.ts +0 -4
- package/lib/types/Providers/index.js +0 -10
- package/lib/types/Providers/index.js.map +0 -1
- package/lib/types/index.js.map +0 -1
- package/lib-esm/.tsbuildinfo +0 -3
- package/lib-esm/Predictions.js.map +0 -1
- package/lib-esm/Providers/AmazonAIConvertPredictionsProvider.js +0 -375
- package/lib-esm/Providers/AmazonAIConvertPredictionsProvider.js.map +0 -1
- package/lib-esm/Providers/AmazonAIIdentifyPredictionsProvider.js +0 -439
- package/lib-esm/Providers/AmazonAIIdentifyPredictionsProvider.js.map +0 -1
- package/lib-esm/Providers/AmazonAIInterpretPredictionsProvider.js +0 -319
- package/lib-esm/Providers/AmazonAIInterpretPredictionsProvider.js.map +0 -1
- package/lib-esm/Providers/AmazonAIPredictionsProvider.d.ts +0 -14
- package/lib-esm/Providers/AmazonAIPredictionsProvider.js +0 -41
- package/lib-esm/Providers/AmazonAIPredictionsProvider.js.map +0 -1
- package/lib-esm/Providers/IdentifyTextUtils.d.ts +0 -40
- package/lib-esm/Providers/IdentifyTextUtils.js +0 -313
- package/lib-esm/Providers/IdentifyTextUtils.js.map +0 -1
- package/lib-esm/Providers/Utils.js.map +0 -1
- package/lib-esm/Providers/index.js.map +0 -1
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/types/AWSTypes.js.map +0 -1
- package/lib-esm/types/Predictions.js.map +0 -1
- package/lib-esm/types/Providers/AbstractConvertPredictionsProvider.d.ts +0 -9
- package/lib-esm/types/Providers/AbstractConvertPredictionsProvider.js +0 -42
- package/lib-esm/types/Providers/AbstractConvertPredictionsProvider.js.map +0 -1
- package/lib-esm/types/Providers/AbstractIdentifyPredictionsProvider.d.ts +0 -9
- package/lib-esm/types/Providers/AbstractIdentifyPredictionsProvider.js +0 -42
- package/lib-esm/types/Providers/AbstractIdentifyPredictionsProvider.js.map +0 -1
- package/lib-esm/types/Providers/AbstractInterpretPredictionsProvider.d.ts +0 -7
- package/lib-esm/types/Providers/AbstractInterpretPredictionsProvider.js +0 -25
- package/lib-esm/types/Providers/AbstractInterpretPredictionsProvider.js.map +0 -1
- package/lib-esm/types/Providers/AbstractPredictionsProvider.d.ts +0 -7
- package/lib-esm/types/Providers/AbstractPredictionsProvider.js +0 -14
- package/lib-esm/types/Providers/AbstractPredictionsProvider.js.map +0 -1
- package/lib-esm/types/Providers/index.d.ts +0 -4
- package/lib-esm/types/Providers/index.js +0 -7
- package/lib-esm/types/Providers/index.js.map +0 -1
- package/lib-esm/types/index.js.map +0 -1
- package/src/Providers/AmazonAIInterpretPredictionsProvider.ts +0 -281
- package/src/Providers/AmazonAIPredictionsProvider.ts +0 -69
- package/src/types/Providers/AbstractConvertPredictionsProvider.ts +0 -55
- package/src/types/Providers/AbstractIdentifyPredictionsProvider.ts +0 -57
- package/src/types/Providers/AbstractInterpretPredictionsProvider.ts +0 -26
- package/src/types/Providers/AbstractPredictionsProvider.ts +0 -20
- 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
|
|
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
|
|
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
|
|
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
|
|
26
|
+
type: Extract<InterpretTextCategories, 'all'>;
|
|
43
27
|
}
|
|
44
28
|
export interface TextEntities {
|
|
45
|
-
type
|
|
46
|
-
text
|
|
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?:
|
|
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?: '
|
|
91
|
+
level?: 'guest' | 'private' | 'protected';
|
|
103
92
|
identityId?: string;
|
|
104
93
|
}
|
|
105
94
|
export interface FileSource {
|
|
106
95
|
file: File;
|
|
107
96
|
}
|
|
108
|
-
export
|
|
109
|
-
|
|
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
|
|
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
|
|
157
|
-
boundingBox
|
|
152
|
+
polygon?: Polygon;
|
|
153
|
+
boundingBox?: BoundingBox;
|
|
158
154
|
}
|
|
159
155
|
export interface KeyValue {
|
|
160
156
|
key: string;
|
|
161
157
|
value: Content;
|
|
162
|
-
polygon
|
|
163
|
-
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
|
|
176
|
-
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
|
|
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
|
|
200
|
-
boundingBoxes
|
|
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
|
|
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
|
|
281
|
-
export
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
18
|
-
|
|
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
|
-
|
|
23
|
+
const key = 'celebrityDetection';
|
|
23
24
|
return obj && obj.hasOwnProperty(key);
|
|
24
25
|
}
|
|
25
26
|
export function isTranslateTextInput(obj) {
|
|
26
|
-
|
|
27
|
+
const key = 'translateText';
|
|
27
28
|
return obj && obj.hasOwnProperty(key);
|
|
28
29
|
}
|
|
29
30
|
export function isTextToSpeechInput(obj) {
|
|
30
|
-
|
|
31
|
+
const key = 'textToSpeech';
|
|
31
32
|
return obj && obj.hasOwnProperty(key);
|
|
32
33
|
}
|
|
33
34
|
export function isSpeechToTextInput(obj) {
|
|
34
|
-
|
|
35
|
+
const key = 'transcription';
|
|
35
36
|
return obj && obj.hasOwnProperty(key);
|
|
36
37
|
}
|
|
37
38
|
export function isStorageSource(obj) {
|
|
38
|
-
|
|
39
|
+
const key = 'key';
|
|
39
40
|
return obj && obj.hasOwnProperty(key);
|
|
40
41
|
}
|
|
41
42
|
export function isFileSource(obj) {
|
|
42
|
-
|
|
43
|
+
const key = 'file';
|
|
43
44
|
return obj && obj.hasOwnProperty(key);
|
|
44
45
|
}
|
|
45
|
-
export function
|
|
46
|
-
|
|
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
|
-
|
|
55
|
+
const key = 'text';
|
|
51
56
|
return obj && obj.hasOwnProperty(key);
|
|
52
57
|
}
|
|
53
58
|
export function isIdentifyLabelsInput(obj) {
|
|
54
|
-
|
|
59
|
+
const key = 'labels';
|
|
55
60
|
return obj && obj.hasOwnProperty(key);
|
|
56
61
|
}
|
|
57
62
|
export function isIdentifyEntitiesInput(obj) {
|
|
58
|
-
|
|
63
|
+
const key = 'entities';
|
|
59
64
|
return obj && obj.hasOwnProperty(key);
|
|
60
65
|
}
|
|
61
66
|
export function isInterpretTextInput(obj) {
|
|
62
|
-
|
|
67
|
+
const key = 'text';
|
|
63
68
|
return obj && obj.hasOwnProperty(key);
|
|
64
69
|
}
|
|
65
|
-
|
|
70
|
+
export function isInterpretTextOthers(text) {
|
|
71
|
+
return text.source.language !== undefined;
|
|
72
|
+
}
|
package/lib-esm/types/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/predictions",
|
|
3
|
-
"version": "
|
|
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
|
|
19
|
-
"build:cjs": "
|
|
20
|
-
"build:esm": "
|
|
21
|
-
"build:cjs:watch": "
|
|
22
|
-
"build:esm: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.
|
|
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/
|
|
49
|
-
"@aws-
|
|
50
|
-
"@aws-sdk/client-
|
|
51
|
-
"@aws-sdk/client-
|
|
52
|
-
"@aws-sdk/client-
|
|
53
|
-
"@aws-sdk/client-
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
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": "^
|
|
59
|
-
"uuid": "^
|
|
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
|
|
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
|
|
84
|
-
"limit": "
|
|
71
|
+
"import": "{ Amplify, Predictions }",
|
|
72
|
+
"limit": "66 kB"
|
|
85
73
|
}
|
|
86
74
|
],
|
|
87
75
|
"jest": {
|
|
88
76
|
"globals": {
|
|
89
77
|
"ts-jest": {
|
|
90
|
-
"diagnostics":
|
|
78
|
+
"diagnostics": {
|
|
79
|
+
"pathRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$"
|
|
80
|
+
},
|
|
91
81
|
"tsConfig": {
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
"esnext.asynciterable",
|
|
97
|
-
"es2017.object"
|
|
82
|
+
"downlevelIteration": true,
|
|
83
|
+
"allowJs": true,
|
|
84
|
+
"types": [
|
|
85
|
+
"@types/jest"
|
|
98
86
|
],
|
|
99
|
-
"
|
|
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": "
|
|
122
|
+
"gitHead": "d505105326d7f6214f6bd1e06eb20be3a3651377"
|
|
132
123
|
}
|