@azure/ai-form-recognizer 4.1.0-beta.1 → 5.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 +25 -35
- package/dist/index.js +98 -302
- package/dist/index.js.map +1 -1
- package/dist-esm/src/constants.js +2 -1
- package/dist-esm/src/constants.js.map +1 -1
- package/dist-esm/src/documentAnalysisClient.js +5 -7
- package/dist-esm/src/documentAnalysisClient.js.map +1 -1
- package/dist-esm/src/documentModel.js.map +1 -1
- package/dist-esm/src/documentModelAdministrationClient.js +13 -55
- package/dist-esm/src/documentModelAdministrationClient.js.map +1 -1
- package/dist-esm/src/generated/generatedClient.js +2 -2
- package/dist-esm/src/generated/generatedClient.js.map +1 -1
- package/dist-esm/src/generated/models/index.js +10 -26
- package/dist-esm/src/generated/models/index.js.map +1 -1
- package/dist-esm/src/generated/models/mappers.js +4 -131
- package/dist-esm/src/generated/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/models/parameters.js +1 -19
- package/dist-esm/src/generated/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/operations/documentClassifiers.js +12 -5
- package/dist-esm/src/generated/operations/documentClassifiers.js.map +1 -1
- package/dist-esm/src/generated/operations/documentModels.js +15 -11
- package/dist-esm/src/generated/operations/documentModels.js.map +1 -1
- package/dist-esm/src/generated/operations/miscellaneous.js +12 -5
- package/dist-esm/src/generated/operations/miscellaneous.js.map +1 -1
- package/dist-esm/src/index.js +1 -1
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/lro/analysis.js +2 -2
- package/dist-esm/src/lro/analysis.js.map +1 -1
- package/dist-esm/src/models/contentSource.js +4 -0
- package/dist-esm/src/models/contentSource.js.map +1 -0
- package/dist-esm/src/models/documentElements.js.map +1 -1
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/options/AnalyzeDocumentOptions.js +19 -8
- package/dist-esm/src/options/AnalyzeDocumentOptions.js.map +1 -1
- package/dist-esm/src/options/FormRecognizerClientOptions.js +0 -27
- package/dist-esm/src/options/FormRecognizerClientOptions.js.map +1 -1
- package/dist-esm/src/options/index.js +2 -2
- package/dist-esm/src/options/index.js.map +1 -1
- package/dist-esm/src/util.js +2 -4
- package/dist-esm/src/util.js.map +1 -1
- package/package.json +6 -6
- package/types/ai-form-recognizer.d.ts +140 -171
package/dist/index.js
CHANGED
|
@@ -40,7 +40,8 @@ const DEFAULT_COGNITIVE_SCOPE = "https://cognitiveservices.azure.com/.default";
|
|
|
40
40
|
/**
|
|
41
41
|
* @internal
|
|
42
42
|
*/
|
|
43
|
-
const SDK_VERSION = "
|
|
43
|
+
const SDK_VERSION = "5.0.0";
|
|
44
|
+
const FORM_RECOGNIZER_API_VERSION = "2023-07-31";
|
|
44
45
|
|
|
45
46
|
/*
|
|
46
47
|
* Copyright (c) Microsoft Corporation.
|
|
@@ -332,12 +333,6 @@ const DocumentPage = {
|
|
|
332
333
|
name: "Composite",
|
|
333
334
|
className: "DocumentPage",
|
|
334
335
|
modelProperties: {
|
|
335
|
-
kind: {
|
|
336
|
-
serializedName: "kind",
|
|
337
|
-
type: {
|
|
338
|
-
name: "String"
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
336
|
pageNumber: {
|
|
342
337
|
constraints: {
|
|
343
338
|
InclusiveMinimum: 1
|
|
@@ -431,18 +426,6 @@ const DocumentPage = {
|
|
|
431
426
|
}
|
|
432
427
|
}
|
|
433
428
|
},
|
|
434
|
-
annotations: {
|
|
435
|
-
serializedName: "annotations",
|
|
436
|
-
type: {
|
|
437
|
-
name: "Sequence",
|
|
438
|
-
element: {
|
|
439
|
-
type: {
|
|
440
|
-
name: "Composite",
|
|
441
|
-
className: "DocumentAnnotation"
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
},
|
|
446
429
|
barcodes: {
|
|
447
430
|
serializedName: "barcodes",
|
|
448
431
|
type: {
|
|
@@ -466,18 +449,6 @@ const DocumentPage = {
|
|
|
466
449
|
}
|
|
467
450
|
}
|
|
468
451
|
}
|
|
469
|
-
},
|
|
470
|
-
images: {
|
|
471
|
-
serializedName: "images",
|
|
472
|
-
type: {
|
|
473
|
-
name: "Sequence",
|
|
474
|
-
element: {
|
|
475
|
-
type: {
|
|
476
|
-
name: "Composite",
|
|
477
|
-
className: "DocumentImage"
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
452
|
}
|
|
482
453
|
}
|
|
483
454
|
}
|
|
@@ -646,47 +617,6 @@ const DocumentLine = {
|
|
|
646
617
|
}
|
|
647
618
|
}
|
|
648
619
|
};
|
|
649
|
-
const DocumentAnnotation = {
|
|
650
|
-
type: {
|
|
651
|
-
name: "Composite",
|
|
652
|
-
className: "DocumentAnnotation",
|
|
653
|
-
modelProperties: {
|
|
654
|
-
kind: {
|
|
655
|
-
serializedName: "kind",
|
|
656
|
-
required: true,
|
|
657
|
-
type: {
|
|
658
|
-
name: "String"
|
|
659
|
-
}
|
|
660
|
-
},
|
|
661
|
-
polygon: {
|
|
662
|
-
serializedName: "polygon",
|
|
663
|
-
required: true,
|
|
664
|
-
type: {
|
|
665
|
-
name: "Sequence",
|
|
666
|
-
element: {
|
|
667
|
-
constraints: {
|
|
668
|
-
InclusiveMinimum: 0
|
|
669
|
-
},
|
|
670
|
-
type: {
|
|
671
|
-
name: "Number"
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
},
|
|
676
|
-
confidence: {
|
|
677
|
-
constraints: {
|
|
678
|
-
InclusiveMaximum: 1,
|
|
679
|
-
InclusiveMinimum: 0
|
|
680
|
-
},
|
|
681
|
-
serializedName: "confidence",
|
|
682
|
-
required: true,
|
|
683
|
-
type: {
|
|
684
|
-
name: "Number"
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
};
|
|
690
620
|
const DocumentBarcode = {
|
|
691
621
|
type: {
|
|
692
622
|
name: "Composite",
|
|
@@ -795,56 +725,6 @@ const DocumentFormula = {
|
|
|
795
725
|
}
|
|
796
726
|
}
|
|
797
727
|
};
|
|
798
|
-
const DocumentImage = {
|
|
799
|
-
type: {
|
|
800
|
-
name: "Composite",
|
|
801
|
-
className: "DocumentImage",
|
|
802
|
-
modelProperties: {
|
|
803
|
-
polygon: {
|
|
804
|
-
serializedName: "polygon",
|
|
805
|
-
type: {
|
|
806
|
-
name: "Sequence",
|
|
807
|
-
element: {
|
|
808
|
-
constraints: {
|
|
809
|
-
InclusiveMinimum: 0
|
|
810
|
-
},
|
|
811
|
-
type: {
|
|
812
|
-
name: "Number"
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
},
|
|
817
|
-
span: {
|
|
818
|
-
serializedName: "span",
|
|
819
|
-
type: {
|
|
820
|
-
name: "Composite",
|
|
821
|
-
className: "DocumentSpan"
|
|
822
|
-
}
|
|
823
|
-
},
|
|
824
|
-
pageNumber: {
|
|
825
|
-
constraints: {
|
|
826
|
-
InclusiveMinimum: 1
|
|
827
|
-
},
|
|
828
|
-
serializedName: "pageNumber",
|
|
829
|
-
required: true,
|
|
830
|
-
type: {
|
|
831
|
-
name: "Number"
|
|
832
|
-
}
|
|
833
|
-
},
|
|
834
|
-
confidence: {
|
|
835
|
-
constraints: {
|
|
836
|
-
InclusiveMaximum: 1,
|
|
837
|
-
InclusiveMinimum: 0
|
|
838
|
-
},
|
|
839
|
-
serializedName: "confidence",
|
|
840
|
-
required: true,
|
|
841
|
-
type: {
|
|
842
|
-
name: "Number"
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
};
|
|
848
728
|
const DocumentParagraph = {
|
|
849
729
|
type: {
|
|
850
730
|
name: "Composite",
|
|
@@ -1090,12 +970,6 @@ const DocumentKeyValuePair = {
|
|
|
1090
970
|
className: "DocumentKeyValueElement"
|
|
1091
971
|
}
|
|
1092
972
|
},
|
|
1093
|
-
commonName: {
|
|
1094
|
-
serializedName: "commonName",
|
|
1095
|
-
type: {
|
|
1096
|
-
name: "String"
|
|
1097
|
-
}
|
|
1098
|
-
},
|
|
1099
973
|
confidence: {
|
|
1100
974
|
constraints: {
|
|
1101
975
|
InclusiveMaximum: 1,
|
|
@@ -1634,7 +1508,7 @@ const BuildDocumentModelRequest = {
|
|
|
1634
1508
|
serializedName: "azureBlobFileListSource",
|
|
1635
1509
|
type: {
|
|
1636
1510
|
name: "Composite",
|
|
1637
|
-
className: "
|
|
1511
|
+
className: "AzureBlobFileListContentSource"
|
|
1638
1512
|
}
|
|
1639
1513
|
},
|
|
1640
1514
|
tags: {
|
|
@@ -1668,10 +1542,10 @@ const AzureBlobContentSource = {
|
|
|
1668
1542
|
}
|
|
1669
1543
|
}
|
|
1670
1544
|
};
|
|
1671
|
-
const
|
|
1545
|
+
const AzureBlobFileListContentSource = {
|
|
1672
1546
|
type: {
|
|
1673
1547
|
name: "Composite",
|
|
1674
|
-
className: "
|
|
1548
|
+
className: "AzureBlobFileListContentSource",
|
|
1675
1549
|
modelProperties: {
|
|
1676
1550
|
containerUrl: {
|
|
1677
1551
|
serializedName: "containerUrl",
|
|
@@ -2328,7 +2202,7 @@ const ClassifierDocumentTypeDetails = {
|
|
|
2328
2202
|
serializedName: "azureBlobFileListSource",
|
|
2329
2203
|
type: {
|
|
2330
2204
|
name: "Composite",
|
|
2331
|
-
className: "
|
|
2205
|
+
className: "AzureBlobFileListContentSource"
|
|
2332
2206
|
}
|
|
2333
2207
|
}
|
|
2334
2208
|
}
|
|
@@ -2683,10 +2557,8 @@ var Mappers = /*#__PURE__*/Object.freeze({
|
|
|
2683
2557
|
DocumentWord: DocumentWord,
|
|
2684
2558
|
DocumentSelectionMark: DocumentSelectionMark,
|
|
2685
2559
|
DocumentLine: DocumentLine,
|
|
2686
|
-
DocumentAnnotation: DocumentAnnotation,
|
|
2687
2560
|
DocumentBarcode: DocumentBarcode,
|
|
2688
2561
|
DocumentFormula: DocumentFormula,
|
|
2689
|
-
DocumentImage: DocumentImage,
|
|
2690
2562
|
DocumentParagraph: DocumentParagraph,
|
|
2691
2563
|
BoundingRegion: BoundingRegion,
|
|
2692
2564
|
DocumentTable: DocumentTable,
|
|
@@ -2701,7 +2573,7 @@ var Mappers = /*#__PURE__*/Object.freeze({
|
|
|
2701
2573
|
AddressValue: AddressValue,
|
|
2702
2574
|
BuildDocumentModelRequest: BuildDocumentModelRequest,
|
|
2703
2575
|
AzureBlobContentSource: AzureBlobContentSource,
|
|
2704
|
-
|
|
2576
|
+
AzureBlobFileListContentSource: AzureBlobFileListContentSource,
|
|
2705
2577
|
ComposeDocumentModelRequest: ComposeDocumentModelRequest,
|
|
2706
2578
|
ComponentDocumentModelDetails: ComponentDocumentModelDetails,
|
|
2707
2579
|
AuthorizeCopyRequest: AuthorizeCopyRequest,
|
|
@@ -2899,7 +2771,7 @@ const stringIndexType = {
|
|
|
2899
2771
|
const apiVersion = {
|
|
2900
2772
|
parameterPath: "apiVersion",
|
|
2901
2773
|
mapper: {
|
|
2902
|
-
defaultValue: "2023-
|
|
2774
|
+
defaultValue: "2023-07-31",
|
|
2903
2775
|
isConstant: true,
|
|
2904
2776
|
serializedName: "api-version",
|
|
2905
2777
|
type: {
|
|
@@ -2922,24 +2794,6 @@ const features = {
|
|
|
2922
2794
|
},
|
|
2923
2795
|
collectionFormat: "CSV"
|
|
2924
2796
|
};
|
|
2925
|
-
const queryFields = {
|
|
2926
|
-
parameterPath: ["options", "queryFields"],
|
|
2927
|
-
mapper: {
|
|
2928
|
-
serializedName: "queryFields",
|
|
2929
|
-
type: {
|
|
2930
|
-
name: "Sequence",
|
|
2931
|
-
element: {
|
|
2932
|
-
constraints: {
|
|
2933
|
-
Pattern: new RegExp("^[\\p{L}\\p{M}\\p{N}_]{1,64}$")
|
|
2934
|
-
},
|
|
2935
|
-
type: {
|
|
2936
|
-
name: "String"
|
|
2937
|
-
}
|
|
2938
|
-
}
|
|
2939
|
-
}
|
|
2940
|
-
},
|
|
2941
|
-
collectionFormat: "CSV"
|
|
2942
|
-
};
|
|
2943
2797
|
const resultId = {
|
|
2944
2798
|
parameterPath: "resultId",
|
|
2945
2799
|
mapper: {
|
|
@@ -3146,26 +3000,18 @@ var KnownStringIndexType;
|
|
|
3146
3000
|
var KnownDocumentAnalysisFeature;
|
|
3147
3001
|
(function (KnownDocumentAnalysisFeature) {
|
|
3148
3002
|
/** Perform OCR at a higher resolution to handle documents with fine print. */
|
|
3149
|
-
KnownDocumentAnalysisFeature["OcrHighResolution"] = "
|
|
3150
|
-
/** Enable the detection of
|
|
3151
|
-
KnownDocumentAnalysisFeature["
|
|
3003
|
+
KnownDocumentAnalysisFeature["OcrHighResolution"] = "ocrHighResolution";
|
|
3004
|
+
/** Enable the detection of the text content language. */
|
|
3005
|
+
KnownDocumentAnalysisFeature["Languages"] = "languages";
|
|
3006
|
+
/** Enable the detection of barcodes in the document. */
|
|
3007
|
+
KnownDocumentAnalysisFeature["Barcodes"] = "barcodes";
|
|
3008
|
+
/** Enable the detection of mathematical expressions in the document. */
|
|
3009
|
+
KnownDocumentAnalysisFeature["Formulas"] = "formulas";
|
|
3010
|
+
/** Enable the detection of general key value pairs (form fields) in the document. */
|
|
3011
|
+
KnownDocumentAnalysisFeature["KeyValuePairs"] = "keyValuePairs";
|
|
3152
3012
|
/** Enable the recognition of various font styles. */
|
|
3153
|
-
KnownDocumentAnalysisFeature["
|
|
3154
|
-
/** Enable extraction of additional fields via the queryFields query parameter. */
|
|
3155
|
-
KnownDocumentAnalysisFeature["QueryFieldsPremium"] = "queryFields.premium";
|
|
3013
|
+
KnownDocumentAnalysisFeature["StyleFont"] = "styleFont";
|
|
3156
3014
|
})(KnownDocumentAnalysisFeature || (KnownDocumentAnalysisFeature = {}));
|
|
3157
|
-
/** Known values of {@link DocumentPageKind} that the service accepts. */
|
|
3158
|
-
exports.KnownDocumentPageKind = void 0;
|
|
3159
|
-
(function (KnownDocumentPageKind) {
|
|
3160
|
-
/** A page from a PDF or image file. All content from Office/HTML files is represented as a single page. */
|
|
3161
|
-
KnownDocumentPageKind["Document"] = "document";
|
|
3162
|
-
/** A sheet from a spreadsheet. */
|
|
3163
|
-
KnownDocumentPageKind["Sheet"] = "sheet";
|
|
3164
|
-
/** A slide from a presentation. */
|
|
3165
|
-
KnownDocumentPageKind["Slide"] = "slide";
|
|
3166
|
-
/** An embedded image from an Office/HTML file. */
|
|
3167
|
-
KnownDocumentPageKind["Image"] = "image";
|
|
3168
|
-
})(exports.KnownDocumentPageKind || (exports.KnownDocumentPageKind = {}));
|
|
3169
3015
|
/** Known values of {@link LengthUnit} that the service accepts. */
|
|
3170
3016
|
exports.KnownLengthUnit = void 0;
|
|
3171
3017
|
(function (KnownLengthUnit) {
|
|
@@ -3182,14 +3028,6 @@ exports.KnownSelectionMarkState = void 0;
|
|
|
3182
3028
|
/** The selection mark is not selected. */
|
|
3183
3029
|
KnownSelectionMarkState["Unselected"] = "unselected";
|
|
3184
3030
|
})(exports.KnownSelectionMarkState || (exports.KnownSelectionMarkState = {}));
|
|
3185
|
-
/** Known values of {@link DocumentAnnotationKind} that the service accepts. */
|
|
3186
|
-
exports.KnownDocumentAnnotationKind = void 0;
|
|
3187
|
-
(function (KnownDocumentAnnotationKind) {
|
|
3188
|
-
/** A visual check ✓. */
|
|
3189
|
-
KnownDocumentAnnotationKind["Check"] = "check";
|
|
3190
|
-
/** A visual cross X. */
|
|
3191
|
-
KnownDocumentAnnotationKind["Cross"] = "cross";
|
|
3192
|
-
})(exports.KnownDocumentAnnotationKind || (exports.KnownDocumentAnnotationKind = {}));
|
|
3193
3031
|
/** Known values of {@link DocumentBarcodeKind} that the service accepts. */
|
|
3194
3032
|
exports.KnownDocumentBarcodeKind = void 0;
|
|
3195
3033
|
(function (KnownDocumentBarcodeKind) {
|
|
@@ -3394,17 +3232,24 @@ class DocumentModelsImpl {
|
|
|
3394
3232
|
}
|
|
3395
3233
|
listModelsPagingAll(options) {
|
|
3396
3234
|
return tslib.__asyncGenerator(this, arguments, function* listModelsPagingAll_1() {
|
|
3397
|
-
var e_1,
|
|
3235
|
+
var _a, e_1, _b, _c;
|
|
3398
3236
|
try {
|
|
3399
|
-
for (var
|
|
3400
|
-
|
|
3401
|
-
|
|
3237
|
+
for (var _d = true, _e = tslib.__asyncValues(this.listModelsPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
|
3238
|
+
_c = _f.value;
|
|
3239
|
+
_d = false;
|
|
3240
|
+
try {
|
|
3241
|
+
const page = _c;
|
|
3242
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
3243
|
+
}
|
|
3244
|
+
finally {
|
|
3245
|
+
_d = true;
|
|
3246
|
+
}
|
|
3402
3247
|
}
|
|
3403
3248
|
}
|
|
3404
3249
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3405
3250
|
finally {
|
|
3406
3251
|
try {
|
|
3407
|
-
if (
|
|
3252
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
3408
3253
|
}
|
|
3409
3254
|
finally { if (e_1) throw e_1.error; }
|
|
3410
3255
|
}
|
|
@@ -3557,8 +3402,7 @@ const analyzeDocument$binaryOperationSpec = {
|
|
|
3557
3402
|
locale,
|
|
3558
3403
|
stringIndexType,
|
|
3559
3404
|
apiVersion,
|
|
3560
|
-
features
|
|
3561
|
-
queryFields
|
|
3405
|
+
features
|
|
3562
3406
|
],
|
|
3563
3407
|
urlParameters: [endpoint, modelId],
|
|
3564
3408
|
headerParameters: [contentType, accept],
|
|
@@ -3582,8 +3426,7 @@ const analyzeDocument$textOperationSpec = {
|
|
|
3582
3426
|
locale,
|
|
3583
3427
|
stringIndexType,
|
|
3584
3428
|
apiVersion,
|
|
3585
|
-
features
|
|
3586
|
-
queryFields
|
|
3429
|
+
features
|
|
3587
3430
|
],
|
|
3588
3431
|
urlParameters: [endpoint, modelId],
|
|
3589
3432
|
headerParameters: [contentType1, accept1],
|
|
@@ -3607,8 +3450,7 @@ const analyzeDocument$jsonOperationSpec = {
|
|
|
3607
3450
|
locale,
|
|
3608
3451
|
stringIndexType,
|
|
3609
3452
|
apiVersion,
|
|
3610
|
-
features
|
|
3611
|
-
queryFields
|
|
3453
|
+
features
|
|
3612
3454
|
],
|
|
3613
3455
|
urlParameters: [endpoint, modelId],
|
|
3614
3456
|
headerParameters: [contentType2, accept2],
|
|
@@ -3815,17 +3657,24 @@ class MiscellaneousImpl {
|
|
|
3815
3657
|
}
|
|
3816
3658
|
listOperationsPagingAll(options) {
|
|
3817
3659
|
return tslib.__asyncGenerator(this, arguments, function* listOperationsPagingAll_1() {
|
|
3818
|
-
var e_1,
|
|
3660
|
+
var _a, e_1, _b, _c;
|
|
3819
3661
|
try {
|
|
3820
|
-
for (var
|
|
3821
|
-
|
|
3822
|
-
|
|
3662
|
+
for (var _d = true, _e = tslib.__asyncValues(this.listOperationsPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
|
3663
|
+
_c = _f.value;
|
|
3664
|
+
_d = false;
|
|
3665
|
+
try {
|
|
3666
|
+
const page = _c;
|
|
3667
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
3668
|
+
}
|
|
3669
|
+
finally {
|
|
3670
|
+
_d = true;
|
|
3671
|
+
}
|
|
3823
3672
|
}
|
|
3824
3673
|
}
|
|
3825
3674
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3826
3675
|
finally {
|
|
3827
3676
|
try {
|
|
3828
|
-
if (
|
|
3677
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
3829
3678
|
}
|
|
3830
3679
|
finally { if (e_1) throw e_1.error; }
|
|
3831
3680
|
}
|
|
@@ -3978,17 +3827,24 @@ class DocumentClassifiersImpl {
|
|
|
3978
3827
|
}
|
|
3979
3828
|
listClassifiersPagingAll(options) {
|
|
3980
3829
|
return tslib.__asyncGenerator(this, arguments, function* listClassifiersPagingAll_1() {
|
|
3981
|
-
var e_1,
|
|
3830
|
+
var _a, e_1, _b, _c;
|
|
3982
3831
|
try {
|
|
3983
|
-
for (var
|
|
3984
|
-
|
|
3985
|
-
|
|
3832
|
+
for (var _d = true, _e = tslib.__asyncValues(this.listClassifiersPagingPage(options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
|
3833
|
+
_c = _f.value;
|
|
3834
|
+
_d = false;
|
|
3835
|
+
try {
|
|
3836
|
+
const page = _c;
|
|
3837
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
3838
|
+
}
|
|
3839
|
+
finally {
|
|
3840
|
+
_d = true;
|
|
3841
|
+
}
|
|
3986
3842
|
}
|
|
3987
3843
|
}
|
|
3988
3844
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3989
3845
|
finally {
|
|
3990
3846
|
try {
|
|
3991
|
-
if (
|
|
3847
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
3992
3848
|
}
|
|
3993
3849
|
finally { if (e_1) throw e_1.error; }
|
|
3994
3850
|
}
|
|
@@ -4279,7 +4135,7 @@ class GeneratedClient extends coreClient__namespace.ServiceClient {
|
|
|
4279
4135
|
const defaults = {
|
|
4280
4136
|
requestContentType: "application/json; charset=utf-8"
|
|
4281
4137
|
};
|
|
4282
|
-
const packageDetails = `azsdk-js-ai-form-recognizer/
|
|
4138
|
+
const packageDetails = `azsdk-js-ai-form-recognizer/5.0.0`;
|
|
4283
4139
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
4284
4140
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
4285
4141
|
: `${packageDetails}`;
|
|
@@ -4306,7 +4162,7 @@ class GeneratedClient extends coreClient__namespace.ServiceClient {
|
|
|
4306
4162
|
// Parameter assignments
|
|
4307
4163
|
this.endpoint = endpoint;
|
|
4308
4164
|
// Assigning values to Constant parameters
|
|
4309
|
-
this.apiVersion = options.apiVersion || "2023-
|
|
4165
|
+
this.apiVersion = options.apiVersion || "2023-07-31";
|
|
4310
4166
|
this.documentModels = new DocumentModelsImpl(this);
|
|
4311
4167
|
this.miscellaneous = new MiscellaneousImpl(this);
|
|
4312
4168
|
this.documentClassifiers = new DocumentClassifiersImpl(this);
|
|
@@ -4341,32 +4197,6 @@ class GeneratedClient extends coreClient__namespace.ServiceClient {
|
|
|
4341
4197
|
|
|
4342
4198
|
// Copyright (c) Microsoft Corporation.
|
|
4343
4199
|
// Licensed under the MIT license.
|
|
4344
|
-
/**
|
|
4345
|
-
* Supported and common values of FormRecognizerApiVersion.
|
|
4346
|
-
*/
|
|
4347
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
4348
|
-
const FormRecognizerApiVersion = {
|
|
4349
|
-
/**
|
|
4350
|
-
* The newest version of the service known to be supported by the client (default).
|
|
4351
|
-
*
|
|
4352
|
-
* If using a beta package version, this will be identical to the latest preview version. Otherwise, it will be
|
|
4353
|
-
* identical to the latest stable version.
|
|
4354
|
-
*/
|
|
4355
|
-
Latest: "2023-02-28-preview",
|
|
4356
|
-
/**
|
|
4357
|
-
* The newest stable version of the service known to be supported by the package. This will be a Generally Available
|
|
4358
|
-
* (GA) version, even if the package version is a beta.
|
|
4359
|
-
*/
|
|
4360
|
-
Stable: "2022-08-31",
|
|
4361
|
-
/**
|
|
4362
|
-
* Form Recognizer API version 2022-08-31 (GA).
|
|
4363
|
-
*/
|
|
4364
|
-
"2022-08-31": "2022-08-31",
|
|
4365
|
-
/**
|
|
4366
|
-
* Form Recognizer API version 2023-02-28-preview.
|
|
4367
|
-
*/
|
|
4368
|
-
"2023-02-28-preview": "2023-02-28-preview",
|
|
4369
|
-
};
|
|
4370
4200
|
/**
|
|
4371
4201
|
* Supported values of StringIndexType.
|
|
4372
4202
|
*/
|
|
@@ -4388,7 +4218,6 @@ const StringIndexType = {
|
|
|
4388
4218
|
*/
|
|
4389
4219
|
const DEFAULT_GENERATED_CLIENT_OPTIONS = {
|
|
4390
4220
|
stringIndexType: StringIndexType.Utf16CodeUnit,
|
|
4391
|
-
apiVersion: FormRecognizerApiVersion.Latest,
|
|
4392
4221
|
};
|
|
4393
4222
|
|
|
4394
4223
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -4421,7 +4250,7 @@ const maybemap = (value, f) => value === undefined ? undefined : f(value);
|
|
|
4421
4250
|
* @internal
|
|
4422
4251
|
*/
|
|
4423
4252
|
function makeServiceClient(endpoint, credential, options) {
|
|
4424
|
-
const client = new GeneratedClient(endpoint === null || endpoint === void 0 ? void 0 : endpoint.replace(/\/$/, ""), Object.assign(Object.assign({}, DEFAULT_GENERATED_CLIENT_OPTIONS), options));
|
|
4253
|
+
const client = new GeneratedClient(endpoint === null || endpoint === void 0 ? void 0 : endpoint.replace(/\/$/, ""), Object.assign(Object.assign(Object.assign({}, DEFAULT_GENERATED_CLIENT_OPTIONS), options), { apiVersion: FORM_RECOGNIZER_API_VERSION }));
|
|
4425
4254
|
const authPolicy = coreAuth.isTokenCredential(credential)
|
|
4426
4255
|
? coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
4427
4256
|
credential,
|
|
@@ -4541,8 +4370,8 @@ function toDocumentLineFromGenerated(generated, page) {
|
|
|
4541
4370
|
return generated;
|
|
4542
4371
|
}
|
|
4543
4372
|
function toDocumentPageFromGenerated(generated) {
|
|
4544
|
-
var _a, _b, _c, _d, _e
|
|
4545
|
-
return Object.assign(Object.assign({}, generated), {
|
|
4373
|
+
var _a, _b, _c, _d, _e;
|
|
4374
|
+
return Object.assign(Object.assign({}, generated), { lines: (_a = generated.lines) === null || _a === void 0 ? void 0 : _a.map((line) => toDocumentLineFromGenerated(line, generated)), selectionMarks: (_b = generated.selectionMarks) === null || _b === void 0 ? void 0 : _b.map((mark) => (Object.assign(Object.assign({}, mark), { polygon: toBoundingPolygon(mark.polygon) }))), words: (_c = generated.words) === null || _c === void 0 ? void 0 : _c.map((word) => (Object.assign(Object.assign({}, word), { polygon: toBoundingPolygon(word.polygon) }))), barcodes: (_d = generated.barcodes) === null || _d === void 0 ? void 0 : _d.map((barcode) => (Object.assign(Object.assign({}, barcode), { polygon: toBoundingPolygon(barcode.polygon) }))), formulas: (_e = generated.formulas) === null || _e === void 0 ? void 0 : _e.map((formula) => (Object.assign(Object.assign({}, formula), { polygon: toBoundingPolygon(formula.polygon) }))) });
|
|
4546
4375
|
}
|
|
4547
4376
|
/**
|
|
4548
4377
|
* Binary search through an array of items to find the first item that could possibly be contained by the given span,
|
|
@@ -4818,14 +4647,12 @@ async function lro(spec, pollingInterval, initAbortSignal) {
|
|
|
4818
4647
|
*/
|
|
4819
4648
|
class DocumentAnalysisClient {
|
|
4820
4649
|
constructor(endpoint, credential, options = {}) {
|
|
4821
|
-
var _a;
|
|
4822
4650
|
this._restClient = makeServiceClient(endpoint, credential, options);
|
|
4823
4651
|
this._tracing = coreTracing.createTracingClient({
|
|
4824
4652
|
packageName: "@azure/ai-form-recognizer",
|
|
4825
4653
|
packageVersion: SDK_VERSION,
|
|
4826
4654
|
namespace: "Microsoft.CognitiveServices",
|
|
4827
4655
|
});
|
|
4828
|
-
this._apiVersion = (_a = options.apiVersion) !== null && _a !== void 0 ? _a : DEFAULT_GENERATED_CLIENT_OPTIONS.apiVersion;
|
|
4829
4656
|
}
|
|
4830
4657
|
async beginAnalyzeDocument(model, document, options = {}) {
|
|
4831
4658
|
return this._tracing.withSpan("DocumentAnalysisClient.beginAnalyzeDocument", options,
|
|
@@ -4848,11 +4675,12 @@ class DocumentAnalysisClient {
|
|
|
4848
4675
|
const { modelId: initialModelId, apiVersion: requestApiVersion, transformResult, } = typeof model === "string"
|
|
4849
4676
|
? { modelId: model, apiVersion: undefined, transformResult: (v) => v }
|
|
4850
4677
|
: model;
|
|
4851
|
-
if (requestApiVersion && requestApiVersion !==
|
|
4678
|
+
if (requestApiVersion && requestApiVersion !== FORM_RECOGNIZER_API_VERSION) {
|
|
4852
4679
|
throw new Error([
|
|
4853
|
-
`API Version mismatch: the provided model wants version: ${requestApiVersion}
|
|
4680
|
+
`API Version mismatch: the provided model wants version: ${requestApiVersion},`,
|
|
4681
|
+
`but the client is using ${FORM_RECOGNIZER_API_VERSION}.`,
|
|
4854
4682
|
"The API version of the model must match the client's API version.",
|
|
4855
|
-
].join("
|
|
4683
|
+
].join(" "));
|
|
4856
4684
|
}
|
|
4857
4685
|
return this.createUnifiedPoller((abortSignal) => {
|
|
4858
4686
|
const [contentType, analyzeRequest] = toAnalyzeRequest(input);
|
|
@@ -5154,60 +4982,17 @@ class DocumentModelAdministrationClient {
|
|
|
5154
4982
|
namespace: "Microsoft.CognitiveServices",
|
|
5155
4983
|
});
|
|
5156
4984
|
}
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
*
|
|
5161
|
-
* The Model ID can consist of any text, so long as it does not begin with "prebuilt-" (as these models refer to
|
|
5162
|
-
* prebuilt Form Recognizer models that are common to all resources), and so long as it does not already exist within
|
|
5163
|
-
* the resource.
|
|
5164
|
-
*
|
|
5165
|
-
* The Form Recognizer service reads the training data set from an Azure Storage container, given as a URL to the
|
|
5166
|
-
* container with a SAS token that allows the service backend to communicate with the container. At a minimum, the
|
|
5167
|
-
* "read" and "list" permissions are required. In addition, the data in the given container must be organized
|
|
5168
|
-
* according to a particular convention, which is documented in [the service's documentation for building custom
|
|
5169
|
-
* models](https://aka.ms/form-recognizer/custom).
|
|
5170
|
-
*
|
|
5171
|
-
* ### Example
|
|
5172
|
-
*
|
|
5173
|
-
* ```javascript
|
|
5174
|
-
* const modelId = "aNewModel";
|
|
5175
|
-
* const containerUrl = "<training data container SAS URL>";
|
|
5176
|
-
*
|
|
5177
|
-
* const poller = await client.beginBuildDocumentModel(modelId, containerUrl, {
|
|
5178
|
-
* // Optionally, a text description may be attached to the model
|
|
5179
|
-
* description: "This is an example model!"
|
|
5180
|
-
* });
|
|
5181
|
-
*
|
|
5182
|
-
* // Model building, like all other model creation operations, returns a poller that eventually produces a ModelDetails
|
|
5183
|
-
* // object
|
|
5184
|
-
* const modelDetails = await poller.pollUntilDone();
|
|
5185
|
-
*
|
|
5186
|
-
* const {
|
|
5187
|
-
* modelId, // identical to the modelId given when creating the model
|
|
5188
|
-
* description, // identical to the description given when creating the model
|
|
5189
|
-
* createdOn, // the Date (timestamp) that the model was created
|
|
5190
|
-
* docTypes // information about the document types in the model and their field schemas
|
|
5191
|
-
* } = modelDetails;
|
|
5192
|
-
* ```
|
|
5193
|
-
*
|
|
5194
|
-
* @param modelId - the unique ID of the model to create
|
|
5195
|
-
* @param containerUrl - SAS-encoded URL to an Azure Storage container holding the training data set
|
|
5196
|
-
* @param buildMode - the mode to use when building the model (see `DocumentModelBuildMode`)
|
|
5197
|
-
* @param options - optional settings for the model build operation
|
|
5198
|
-
* @returns a long-running operation (poller) that will eventually produce the created model information or an error
|
|
5199
|
-
*/
|
|
5200
|
-
async beginBuildDocumentModel(modelId, containerUrl, buildMode, options = {}) {
|
|
5201
|
-
return this._tracing.withSpan("DocumentModelAdministrationClient.beginBuildDocumentModel", options, (finalOptions) => this.createAdministrationPoller({
|
|
5202
|
-
options: finalOptions,
|
|
5203
|
-
start: (ctx) => this._restClient.documentModels.buildModel({
|
|
5204
|
-
modelId,
|
|
5205
|
-
description: finalOptions.description,
|
|
4985
|
+
async beginBuildDocumentModel(modelId, urlOrSource, buildMode, options = {}) {
|
|
4986
|
+
const sourceInfo = typeof urlOrSource === "string"
|
|
4987
|
+
? {
|
|
5206
4988
|
azureBlobSource: {
|
|
5207
|
-
containerUrl,
|
|
4989
|
+
containerUrl: urlOrSource,
|
|
5208
4990
|
},
|
|
5209
|
-
|
|
5210
|
-
|
|
4991
|
+
}
|
|
4992
|
+
: urlOrSource;
|
|
4993
|
+
return this._tracing.withSpan("DocumentModelAdministrationClient.beginBuildDocumentModel", options, (finalOptions) => this.createAdministrationPoller({
|
|
4994
|
+
options: finalOptions,
|
|
4995
|
+
start: (ctx) => this._restClient.documentModels.buildModel(Object.assign(Object.assign({ modelId, description: finalOptions.description }, sourceInfo), { buildMode }), Object.assign(Object.assign({}, finalOptions), { abortSignal: ctx.abortSignal })),
|
|
5211
4996
|
}));
|
|
5212
4997
|
}
|
|
5213
4998
|
/**
|
|
@@ -5393,17 +5178,18 @@ class DocumentModelAdministrationClient {
|
|
|
5393
5178
|
* ```
|
|
5394
5179
|
*
|
|
5395
5180
|
* @param classifierId - the unique ID of the classifier to create
|
|
5396
|
-
* @param
|
|
5181
|
+
* @param docTypeSources - the document types to include in the classifier and their sources (a map of document type
|
|
5182
|
+
* names to `ClassifierDocumentTypeDetails`)
|
|
5397
5183
|
* @param options - optional settings for the classifier build operation
|
|
5398
5184
|
* @returns a long-running operation (poller) that will eventually produce the created classifier details or an error
|
|
5399
5185
|
*/
|
|
5400
|
-
async beginBuildDocumentClassifier(classifierId,
|
|
5186
|
+
async beginBuildDocumentClassifier(classifierId, docTypeSources, options = {}) {
|
|
5401
5187
|
return this._tracing.withSpan("DocumentModelAdministrationClient.beginBuildDocumentClassifier", options, (finalOptions) => this.createAdministrationPoller({
|
|
5402
5188
|
options: finalOptions,
|
|
5403
5189
|
start: () => this._restClient.documentClassifiers.buildClassifier({
|
|
5404
5190
|
classifierId,
|
|
5405
5191
|
description: finalOptions.description,
|
|
5406
|
-
docTypes,
|
|
5192
|
+
docTypes: docTypeSources,
|
|
5407
5193
|
}, finalOptions),
|
|
5408
5194
|
}));
|
|
5409
5195
|
}
|
|
@@ -5801,24 +5587,35 @@ class DocumentModelAdministrationClient {
|
|
|
5801
5587
|
|
|
5802
5588
|
// Copyright (c) Microsoft Corporation.
|
|
5803
5589
|
// Licensed under the MIT license.
|
|
5590
|
+
/**
|
|
5591
|
+
* Known feature flags supported by the Form Recognizer clients.
|
|
5592
|
+
*/
|
|
5804
5593
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
5805
5594
|
const FormRecognizerFeature = {
|
|
5806
|
-
/**
|
|
5807
|
-
* Enables the use of Query Fields.
|
|
5808
|
-
*/
|
|
5809
|
-
QueryFieldsPremium: "queryFields.premium",
|
|
5810
5595
|
/**
|
|
5811
5596
|
* Enables extracting extra font information.
|
|
5812
5597
|
*/
|
|
5813
|
-
|
|
5598
|
+
Fonts: "styleFont",
|
|
5814
5599
|
/**
|
|
5815
5600
|
* Enables high-resolution processing for documents with small text.
|
|
5816
5601
|
*/
|
|
5817
|
-
OcrHighResolution: "
|
|
5602
|
+
OcrHighResolution: "ocrHighResolution",
|
|
5603
|
+
/**
|
|
5604
|
+
* Enables the detection of mathematical expressions in the document..
|
|
5605
|
+
*/
|
|
5606
|
+
Formulas: "formulas",
|
|
5607
|
+
/**
|
|
5608
|
+
* Enables the detection of the text content language.
|
|
5609
|
+
*/
|
|
5610
|
+
Languages: "languages",
|
|
5611
|
+
/**
|
|
5612
|
+
* Enables the detection of barcodes in the document.
|
|
5613
|
+
*/
|
|
5614
|
+
Barcodes: "barcodes",
|
|
5818
5615
|
/**
|
|
5819
|
-
*
|
|
5616
|
+
* Enables the detection of general key value pairs (form fields) in the document.
|
|
5820
5617
|
*/
|
|
5821
|
-
|
|
5618
|
+
KeyValuePairs: "keyValuePairs",
|
|
5822
5619
|
};
|
|
5823
5620
|
|
|
5824
5621
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -5918,7 +5715,6 @@ Object.defineProperty(exports, 'AzureKeyCredential', {
|
|
|
5918
5715
|
exports.DocumentAnalysisClient = DocumentAnalysisClient;
|
|
5919
5716
|
exports.DocumentModelAdministrationClient = DocumentModelAdministrationClient;
|
|
5920
5717
|
exports.DocumentModelBuildMode = DocumentModelBuildMode;
|
|
5921
|
-
exports.FormRecognizerApiVersion = FormRecognizerApiVersion;
|
|
5922
5718
|
exports.FormRecognizerFeature = FormRecognizerFeature;
|
|
5923
5719
|
exports.StringIndexType = StringIndexType;
|
|
5924
5720
|
exports.createModelFromSchema = createModelFromSchema;
|