@azure/ai-form-recognizer 4.0.0-beta.6 → 4.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 (29) hide show
  1. package/README.md +20 -22
  2. package/dist/index.js +274 -327
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/constants.js +1 -1
  5. package/dist-esm/src/constants.js.map +1 -1
  6. package/dist-esm/src/documentModel.js.map +1 -1
  7. package/dist-esm/src/documentModelAdministrationClient.js +32 -32
  8. package/dist-esm/src/documentModelAdministrationClient.js.map +1 -1
  9. package/dist-esm/src/generated/generatedClient.js +33 -54
  10. package/dist-esm/src/generated/generatedClient.js.map +1 -1
  11. package/dist-esm/src/generated/models/index.js +2 -14
  12. package/dist-esm/src/generated/models/index.js.map +1 -1
  13. package/dist-esm/src/generated/models/mappers.js +189 -189
  14. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  15. package/dist-esm/src/generated/models/parameters.js +4 -38
  16. package/dist-esm/src/generated/models/parameters.js.map +1 -1
  17. package/dist-esm/src/index.js.map +1 -1
  18. package/dist-esm/src/lro/administration.js +3 -3
  19. package/dist-esm/src/lro/administration.js.map +1 -1
  20. package/dist-esm/src/lro/analysis.js +2 -2
  21. package/dist-esm/src/lro/analysis.js.map +1 -1
  22. package/dist-esm/src/models/documentElements.js.map +1 -1
  23. package/dist-esm/src/options/BuildModelOptions.js.map +1 -1
  24. package/dist-esm/src/options/DeleteModelOptions.js.map +1 -1
  25. package/dist-esm/src/options/FormRecognizerClientOptions.js +3 -2
  26. package/dist-esm/src/options/FormRecognizerClientOptions.js.map +1 -1
  27. package/dist-esm/src/options/index.js.map +1 -1
  28. package/package.json +1 -1
  29. package/types/ai-form-recognizer.d.ts +108 -65
@@ -1 +1 @@
1
- {"version":3,"file":"analysis.js","sourceRoot":"","sources":["../../../src/lro/analysis.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,mBAA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IAAI,EAAE,EAAE,CAAC,iCACxC,IAAI,KACP,eAAe,EAAE,iBAAiB,CAAC,IAAI,CAAC,eAAe,CAAC,IACxD,CAAC;QACH,SAAS,EAAE,MAAA,MAAM,CAAC,SAAS,0CAAE,GAAG,CAAC,+BAA+B,CAAC;KAClE,CAAC;AACJ,CAAC;AAeD;;;GAGG;AACH,MAAM,UAAU,oCAAoC,CAClD,UAA+C,EAC/C,OAAe,EACf,iBAAyB,EACzB,QAAgC;IAEhC,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,OAAO,EAAE,OAAO;QAChB,aAAa,EAAE,QAAQ,CAAC,mBAAmB;QAC3C,SAAS,EAAE,QAAQ,CAAC,eAAe;QACnC,iBAAiB;QACjB,MAAM,EAAE,QAAQ,CAAC,aAAa,IAAI,UAAU,CAAC,eAAe,CAAC,QAAQ,CAAC,aAAa,CAAC;QACpF,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,IAAI,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC;QAChE,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,QAAQ,CAAC,MAAM,KAAK,YAAY;QAC3C,WAAW,EAAE,QAAQ,CAAC,MAAM,KAAK,WAAW;KAC7C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport { FormRecognizerError } from \"../error\";\nimport {\n AnalyzeResult as GeneratedAnalyzeResult,\n AnalyzeResultOperation,\n AnalyzeResultOperationStatus as AnalyzeOperationStatus,\n DocumentLanguage,\n DocumentSpan,\n DocumentStyle,\n} from \"../generated\";\nimport { DocumentField, toAnalyzedDocumentFieldsFromGenerated } from \"../models/fields\";\nimport { FormRecognizerApiVersion, PollerOptions } from \"../options\";\nimport { AnalyzeDocumentOptions } from \"../options/AnalyzeDocumentsOptions\";\nimport {\n toBoundingPolygon,\n toBoundingRegions,\n toDocumentTableFromGenerated,\n toKeyValuePairFromGenerated,\n} from \"../transforms/polygon\";\nimport {\n BoundingRegion,\n DocumentTable,\n DocumentKeyValuePair,\n DocumentPage,\n DocumentLine,\n DocumentParagraph,\n} from \"../models/documentElements\";\nimport {\n Document as GeneratedDocument,\n DocumentPage as GeneratedDocumentPage,\n DocumentLine as GeneratedDocumentLine,\n} from \"../generated\";\n\n/**\n * A request input that can be uploaded as binary data to the Form Recognizer service. Form Recognizer treats `string`\n * inputs as URLs, so to send a string as a _binary_ input, first convert the string to one of the following input\n * types.\n */\nexport type FormRecognizerRequestBody =\n | NodeJS.ReadableStream\n | Blob\n | ArrayBuffer\n | ArrayBufferView;\n\n/**\n * An extracted document object.\n *\n * An AnalyzedDocument is an instance of one of the document types within a model. Its fields correspond to the field\n * schema of the document type.\n */\nexport interface AnalyzedDocument {\n /**\n * The type of the document that was extracted. A model can have multiple document types (for example, in a composed\n * model), so this property indicates which document type the fields of this document correspond to.\n */\n docType: string;\n\n /**\n * The extracted fields, which correspond to the document type's field schema.\n */\n fields: { [field: string]: DocumentField };\n\n /**\n * Bounding regions covering the document.\n */\n boundingRegions?: BoundingRegion[];\n\n /**\n * Locations of the document's elements in the `content` text (reading-order-concatenated content).\n */\n spans: DocumentSpan[];\n\n /**\n * The service's confidence that it has correctly extracted the document.\n */\n confidence: number;\n}\n\n/**\n * Transform a REST-level Document response object into the more strongly-typed AnalyzedDocument.\n *\n * @internal\n * @param document - a REST-level document response object\n * @returns an AnalyzedDocument (which has had its fields mapped to stronger DocumentField types)\n */\nexport function toAnalyzedDocumentFromGenerated(document: GeneratedDocument): AnalyzedDocument {\n return {\n ...document,\n boundingRegions: toBoundingRegions(document.boundingRegions),\n fields: toAnalyzedDocumentFieldsFromGenerated(document.fields ?? {}),\n };\n}\n\n/**\n * The common fields of all AnalyzeResult-like types, such as LayoutResult, ReadResult, and GeneralDocumentResult.\n */\nexport interface AnalyzeResultCommon {\n /**\n * The service API version used to produce this result.\n */\n apiVersion: FormRecognizerApiVersion;\n\n /**\n * The unique ID of the model that was used to produce this result.\n */\n modelId: string;\n\n /**\n * A string representation of all textual and visual elements in the input, concatenated by reading order (the order\n * in which the service \"reads\" or extracts the textual and visual content from the document).\n */\n content: string;\n}\n\n/**\n * The result of an analysis operation. The type of the Document may be determined by the model used to perform the\n * analysis.\n */\nexport interface AnalyzeResult<Document = AnalyzedDocument> extends AnalyzeResultCommon {\n /**\n * Extracted pages.\n */\n pages?: DocumentPage[];\n\n /**\n * Extracted tables.\n */\n tables?: DocumentTable[];\n\n /**\n * Extracted key-value pairs.\n */\n keyValuePairs?: DocumentKeyValuePair[];\n\n /**\n * Extracted text languages.\n */\n languages?: DocumentLanguage[];\n\n /**\n * Extracted font styles.\n */\n styles?: DocumentStyle[];\n\n /**\n * Extracted documents (instances of any of the model's document types and corresponding field schemas).\n */\n documents?: Document[];\n\n /**\n * Extracted document paragraphs.\n */\n paragraphs?: DocumentParagraph[];\n}\n\n/**\n * Tests if one span contains another, by testing that the outer span starts before or at the same character as the\n * inner span, and that the end position of the outer span is greater than or equal to the end position of the inner\n * span.\n *\n * @internal\n * @param outer - the outer (potentially containing) span\n * @param inner - the span to test if `outer` contains\n * @returns true if `inner` is contained inside of `outer`.\n */\nexport function contains(outer: DocumentSpan, inner: DocumentSpan): boolean {\n return outer.offset <= inner.offset && outer.offset + outer.length >= inner.offset + inner.length;\n}\n\n/**\n * Make an empty generator. This might seem silly, but it's useful for satisfying invariants.\n */\nfunction* empty(): Generator<never> {\n /* intentionally empty */\n}\n\n/**\n * Produces an iterator of the given items starting from the given index.\n *\n * @param items - the items to iterate over\n * @param idx - the index of the first item to begin iterating from\n */\nexport function* iterFrom<T>(items: T[], idx: number): Generator<T> {\n let i = idx;\n\n while (i < items.length) {\n yield items[i++];\n }\n}\n\nexport function toDocumentLineFromGenerated(\n generated: GeneratedDocumentLine,\n page: GeneratedDocumentPage\n): DocumentLine {\n (generated as DocumentLine).words = () =>\n fastGetChildren(\n iterFrom(generated.spans, 0),\n page.words?.map((word) => {\n return { ...word, polygon: toBoundingPolygon(word.polygon) };\n }) ?? []\n );\n\n (generated as DocumentLine).polygon = toBoundingPolygon(generated.polygon);\n\n Object.defineProperty(generated, \"words\", {\n enumerable: false,\n });\n\n return generated as DocumentLine;\n}\n\nexport function toDocumentPageFromGenerated(generated: GeneratedDocumentPage): DocumentPage {\n return {\n ...generated,\n lines: generated.lines?.map((line) => toDocumentLineFromGenerated(line, generated)),\n selectionMarks: generated.selectionMarks?.map((mark) => ({\n ...mark,\n polygon: toBoundingPolygon(mark.polygon),\n })),\n words: generated.words?.map((word) => ({\n ...word,\n polygon: toBoundingPolygon(word.polygon),\n })),\n };\n}\n\n/**\n * Binary search through an array of items to find the first item that could possibly be contained by the given span,\n * then return an iterator beginning from that item.\n *\n * This allows a program to quickly find the first relevant item in the array for consideration when testing for span\n * inclusion.\n *\n * @internal\n * @param span - the span to use when testing each individual item\n * @param items - an array of items to binary search through\n * @returns an iterator beginning from the item identified by the search\n */\nexport function iteratorFromFirstMatchBinarySearch<Spanned extends { span: DocumentSpan }>(\n span: DocumentSpan,\n items: Spanned[]\n): IterableIterator<Spanned> {\n let idx = Math.floor(items.length / 2);\n let prevIdx = idx;\n let min = 0;\n let max = items.length;\n\n const found = (): boolean =>\n // The item is found if it starts after the current span and the item before it does not. That means it is the first\n // item in the array that could be a child if the spans are sorted.\n items[idx].span.offset >= span.offset && (items[idx - 1]?.span?.offset ?? -1) < span.offset;\n\n // Binary search to find the first element that could be a child\n do {\n if (found()) {\n return iterFrom(items, idx);\n } else if (span.offset > items[idx].span.offset) {\n min = prevIdx = idx;\n idx = Math.floor(idx + (max - idx) / 2);\n } else {\n max = prevIdx = idx;\n idx = Math.floor(idx - (idx - min) / 2);\n }\n } while (idx !== prevIdx);\n\n // This might seem weird, but it's a simple way to make the types a little more elegant.\n return empty();\n}\n\n/**\n * This fast algorithm tests the elements of `childArray` for inclusion in any of the given `spans`, assuming that both\n * the spans and child items are sorted.\n *\n * INVARIANT: the items in both the `spans` iterator and `childrenArray` MUST BE SORTED INCREASING by span _offset_.\n *\n * @internal\n * @param spans - the spans that contain the child elements\n * @param childrenArray - an array of child items (items that have spans) to test for inclusion in the spans\n * @returns - an IterableIterator of child items that are included in any span in the `spans` iterator\n */\nexport function* fastGetChildren<Spanned extends { span: DocumentSpan }>(\n spans: Iterator<DocumentSpan>,\n childrenArray: Spanned[]\n): Generator<Spanned> {\n let curSpan = spans.next();\n\n // Need to exit early if there are no spans.\n if (curSpan.done) {\n return;\n }\n\n const children = iteratorFromFirstMatchBinarySearch(curSpan.value as DocumentSpan, childrenArray);\n let curChild = children.next();\n\n while (!(curChild.done || curSpan.done)) {\n if (contains(curSpan.value, curChild.value.span)) {\n // The span is contained, so yield the current child and advance it.\n yield curChild.value;\n curChild = children.next();\n } else if (curSpan.value.offset + curSpan.value.length < curChild.value.span.offset) {\n // The current span ends before the next potential child starts, so advance the span\n curSpan = spans.next();\n } else {\n // The current child was not contained in the current span, so advance to the next child.\n curChild = children.next();\n }\n }\n}\n\n/**\n * The state of an analysis operation, which will eventually produce the result type that corresponds to the model.\n */\nexport interface DocumentAnalysisPollOperationState<Result = AnalyzeResult<AnalyzedDocument>>\n extends PollOperationState<Result> {\n /**\n * The status of the operation. One of:\n *\n * - \"notStarted\"\n * - \"running\"\n * - \"succeeded\"\n * - \"failed\"\n */\n status: AnalyzeOperationStatus;\n\n /**\n * The model ID that the analysis operation will use to produce the result.\n */\n modelId: string;\n\n /**\n * The URL to the operation.\n */\n operationLocation: string;\n\n /**\n * The Date and Time that the operation was created.\n */\n createdOn: Date;\n\n /**\n * The date & time that the operation state was last modified.\n */\n lastUpdatedOn: Date;\n}\n\n/**\n * A long-running operation (poller) that tracks the state of an analysis operation, eventually producing the result\n * type that corresponds to the model.\n */\nexport type AnalysisPoller<Result = AnalyzeResult<AnalyzedDocument>> = PollerLike<\n DocumentAnalysisPollOperationState<Result>,\n Result\n>;\n\n/**\n * Convert a generated AnalyzeResult into a convenience layer AnalyzeResult.\n * @internal\n */\nexport function toAnalyzeResultFromGenerated(result: GeneratedAnalyzeResult): AnalyzeResult {\n return {\n apiVersion: result.apiVersion as FormRecognizerApiVersion,\n modelId: result.modelId,\n content: result.content,\n pages: result.pages.map((page) => toDocumentPageFromGenerated(page)),\n tables: result.tables?.map((table) => toDocumentTableFromGenerated(table)),\n keyValuePairs: result.keyValuePairs?.map((pair) => toKeyValuePairFromGenerated(pair)),\n languages: result.languages,\n styles: result.styles,\n paragraphs: result.paragraphs?.map((para) => ({\n ...para,\n boundingRegions: toBoundingRegions(para.boundingRegions),\n })),\n documents: result.documents?.map(toAnalyzedDocumentFromGenerated),\n };\n}\n\n/**\n * Defines an analysis operation by the initial request model ID, poller options, and a transform to apply to the\n * eventual result,\n *\n * @internal\n */\nexport interface AnalysisOperationDefinition<Result = AnalyzeResult> {\n transformResult: (primitiveResult: GeneratedAnalyzeResult) => Result;\n initialModelId: string;\n options: PollerOptions<DocumentAnalysisPollOperationState<Result>> &\n AnalyzeDocumentOptions<Result>;\n}\n\n/**\n * Converts an AnalyzeResultOperation (LRO response) to a DocumentAnalysisPollOperationState\n * @internal\n */\nexport function toDocumentAnalysisPollOperationState<Result>(\n definition: AnalysisOperationDefinition<Result>,\n modelId: string,\n operationLocation: string,\n response: AnalyzeResultOperation\n): DocumentAnalysisPollOperationState<Result> {\n return {\n status: response.status,\n modelId: modelId,\n lastUpdatedOn: response.lastUpdatedDateTime,\n createdOn: response.createdDateTime,\n operationLocation,\n result: response.analyzeResult && definition.transformResult(response.analyzeResult),\n error: response.error && new FormRecognizerError(response.error),\n isCancelled: false, // Not supported\n isStarted: response.status !== \"notStarted\",\n isCompleted: response.status === \"succeeded\",\n };\n}\n"]}
1
+ {"version":3,"file":"analysis.js","sourceRoot":"","sources":["../../../src/lro/analysis.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAS/C,OAAO,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,eAAe,EAAE,iBAAiB,CAAC,IAAI,CAAC,eAAe,CAAC,IACxD,CAAC;QACH,SAAS,EAAE,MAAA,MAAM,CAAC,SAAS,0CAAE,GAAG,CAAC,+BAA+B,CAAC;KAClE,CAAC;AACJ,CAAC;AAeD;;;GAGG;AACH,MAAM,UAAU,oCAAoC,CAClD,UAA+C,EAC/C,OAAe,EACf,iBAAyB,EACzB,QAAgC;IAEhC,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,OAAO,EAAE,OAAO;QAChB,aAAa,EAAE,QAAQ,CAAC,aAAa;QACrC,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,iBAAiB;QACjB,MAAM,EAAE,QAAQ,CAAC,aAAa,IAAI,UAAU,CAAC,eAAe,CAAC,QAAQ,CAAC,aAAa,CAAC;QACpF,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,IAAI,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC;QAChE,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,QAAQ,CAAC,MAAM,KAAK,YAAY;QAC3C,WAAW,EAAE,QAAQ,CAAC,MAAM,KAAK,WAAW;KAC7C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport { FormRecognizerError } from \"../error\";\nimport {\n AnalyzeResult as GeneratedAnalyzeResult,\n AnalyzeResultOperation,\n AnalyzeResultOperationStatus as AnalyzeOperationStatus,\n DocumentLanguage,\n DocumentSpan,\n DocumentStyle,\n} from \"../generated\";\nimport { DocumentField, toAnalyzedDocumentFieldsFromGenerated } from \"../models/fields\";\nimport { FormRecognizerApiVersion, PollerOptions } from \"../options\";\nimport { AnalyzeDocumentOptions } from \"../options/AnalyzeDocumentsOptions\";\nimport {\n toBoundingPolygon,\n toBoundingRegions,\n toDocumentTableFromGenerated,\n toKeyValuePairFromGenerated,\n} from \"../transforms/polygon\";\nimport {\n BoundingRegion,\n DocumentTable,\n DocumentKeyValuePair,\n DocumentPage,\n DocumentLine,\n DocumentParagraph,\n} from \"../models/documentElements\";\nimport {\n Document as GeneratedDocument,\n DocumentPage as GeneratedDocumentPage,\n DocumentLine as GeneratedDocumentLine,\n} from \"../generated\";\n\n/**\n * A request input that can be uploaded as binary data to the Form Recognizer service. Form Recognizer treats `string`\n * inputs as URLs, so to send a string as a _binary_ input, first convert the string to one of the following input\n * types.\n */\nexport type FormRecognizerRequestBody =\n | NodeJS.ReadableStream\n | Blob\n | ArrayBuffer\n | ArrayBufferView;\n\n/**\n * An extracted document object.\n *\n * An AnalyzedDocument is an instance of one of the document types within a model. Its fields correspond to the field\n * schema of the document type.\n */\nexport interface AnalyzedDocument {\n /**\n * The type of the document that was extracted. A model can have multiple document types (for example, in a composed\n * model), so this property indicates which document type the fields of this document correspond to.\n */\n docType: string;\n\n /**\n * The extracted fields, which correspond to the document type's field schema.\n */\n fields: { [field: string]: DocumentField };\n\n /**\n * Bounding regions covering the document.\n */\n boundingRegions?: BoundingRegion[];\n\n /**\n * Locations of the document's elements in the `content` text (reading-order-concatenated content).\n */\n spans: DocumentSpan[];\n\n /**\n * The service's confidence that it has correctly extracted the document.\n */\n confidence: number;\n}\n\n/**\n * Transform a REST-level Document response object into the more strongly-typed AnalyzedDocument.\n *\n * @internal\n * @param document - a REST-level document response object\n * @returns an AnalyzedDocument (which has had its fields mapped to stronger DocumentField types)\n */\nexport function toAnalyzedDocumentFromGenerated(document: GeneratedDocument): AnalyzedDocument {\n return {\n ...document,\n boundingRegions: toBoundingRegions(document.boundingRegions),\n fields: toAnalyzedDocumentFieldsFromGenerated(document.fields ?? {}),\n };\n}\n\n/**\n * The common fields of all AnalyzeResult-like types, such as LayoutResult, ReadResult, and GeneralDocumentResult.\n */\nexport interface AnalyzeResultCommon {\n /**\n * The service API version used to produce this result.\n */\n apiVersion: FormRecognizerApiVersion;\n\n /**\n * The unique ID of the model that was used to produce this result.\n */\n modelId: string;\n\n /**\n * A string representation of all textual and visual elements in the input, concatenated by reading order (the order\n * in which the service \"reads\" or extracts the textual and visual content from the document).\n */\n content: string;\n}\n\n/**\n * The result of an analysis operation. The type of the Document may be determined by the model used to perform the\n * analysis.\n */\nexport interface AnalyzeResult<Document = AnalyzedDocument> extends AnalyzeResultCommon {\n /**\n * Extracted pages.\n */\n pages?: DocumentPage[];\n\n /**\n * Extracted tables.\n */\n tables?: DocumentTable[];\n\n /**\n * Extracted key-value pairs.\n */\n keyValuePairs?: DocumentKeyValuePair[];\n\n /**\n * Extracted text languages.\n */\n languages?: DocumentLanguage[];\n\n /**\n * Extracted font styles.\n */\n styles?: DocumentStyle[];\n\n /**\n * Extracted documents (instances of any of the model's document types and corresponding field schemas).\n */\n documents?: Document[];\n\n /**\n * Extracted document paragraphs.\n */\n paragraphs?: DocumentParagraph[];\n}\n\n/**\n * Tests if one span contains another, by testing that the outer span starts before or at the same character as the\n * inner span, and that the end position of the outer span is greater than or equal to the end position of the inner\n * span.\n *\n * @internal\n * @param outer - the outer (potentially containing) span\n * @param inner - the span to test if `outer` contains\n * @returns true if `inner` is contained inside of `outer`.\n */\nexport function contains(outer: DocumentSpan, inner: DocumentSpan): boolean {\n return outer.offset <= inner.offset && outer.offset + outer.length >= inner.offset + inner.length;\n}\n\n/**\n * Make an empty generator. This might seem silly, but it's useful for satisfying invariants.\n */\nfunction* empty(): Generator<never> {\n /* intentionally empty */\n}\n\n/**\n * Produces an iterator of the given items starting from the given index.\n *\n * @param items - the items to iterate over\n * @param idx - the index of the first item to begin iterating from\n */\nexport function* iterFrom<T>(items: T[], idx: number): Generator<T> {\n let i = idx;\n\n while (i < items.length) {\n yield items[i++];\n }\n}\n\nexport function toDocumentLineFromGenerated(\n generated: GeneratedDocumentLine,\n page: GeneratedDocumentPage\n): DocumentLine {\n (generated as DocumentLine).words = () =>\n fastGetChildren(\n iterFrom(generated.spans, 0),\n page.words?.map((word) => {\n return { ...word, polygon: toBoundingPolygon(word.polygon) };\n }) ?? []\n );\n\n (generated as DocumentLine).polygon = toBoundingPolygon(generated.polygon);\n\n Object.defineProperty(generated, \"words\", {\n enumerable: false,\n });\n\n return generated as DocumentLine;\n}\n\nexport function toDocumentPageFromGenerated(generated: GeneratedDocumentPage): DocumentPage {\n return {\n ...generated,\n lines: generated.lines?.map((line) => toDocumentLineFromGenerated(line, generated)),\n selectionMarks: generated.selectionMarks?.map((mark) => ({\n ...mark,\n polygon: toBoundingPolygon(mark.polygon),\n })),\n words: generated.words?.map((word) => ({\n ...word,\n polygon: toBoundingPolygon(word.polygon),\n })),\n };\n}\n\n/**\n * Binary search through an array of items to find the first item that could possibly be contained by the given span,\n * then return an iterator beginning from that item.\n *\n * This allows a program to quickly find the first relevant item in the array for consideration when testing for span\n * inclusion.\n *\n * @internal\n * @param span - the span to use when testing each individual item\n * @param items - an array of items to binary search through\n * @returns an iterator beginning from the item identified by the search\n */\nexport function iteratorFromFirstMatchBinarySearch<Spanned extends { span: DocumentSpan }>(\n span: DocumentSpan,\n items: Spanned[]\n): IterableIterator<Spanned> {\n let idx = Math.floor(items.length / 2);\n let prevIdx = idx;\n let min = 0;\n let max = items.length;\n\n const found = (): boolean =>\n // The item is found if it starts after the current span and the item before it does not. That means it is the first\n // item in the array that could be a child if the spans are sorted.\n items[idx].span.offset >= span.offset && (items[idx - 1]?.span?.offset ?? -1) < span.offset;\n\n // Binary search to find the first element that could be a child\n do {\n if (found()) {\n return iterFrom(items, idx);\n } else if (span.offset > items[idx].span.offset) {\n min = prevIdx = idx;\n idx = Math.floor(idx + (max - idx) / 2);\n } else {\n max = prevIdx = idx;\n idx = Math.floor(idx - (idx - min) / 2);\n }\n } while (idx !== prevIdx);\n\n // This might seem weird, but it's a simple way to make the types a little more elegant.\n return empty();\n}\n\n/**\n * This fast algorithm tests the elements of `childArray` for inclusion in any of the given `spans`, assuming that both\n * the spans and child items are sorted.\n *\n * INVARIANT: the items in both the `spans` iterator and `childrenArray` MUST BE SORTED INCREASING by span _offset_.\n *\n * @internal\n * @param spans - the spans that contain the child elements\n * @param childrenArray - an array of child items (items that have spans) to test for inclusion in the spans\n * @returns - an IterableIterator of child items that are included in any span in the `spans` iterator\n */\nexport function* fastGetChildren<Spanned extends { span: DocumentSpan }>(\n spans: Iterator<DocumentSpan>,\n childrenArray: Spanned[]\n): Generator<Spanned> {\n let curSpan = spans.next();\n\n // Need to exit early if there are no spans.\n if (curSpan.done) {\n return;\n }\n\n const children = iteratorFromFirstMatchBinarySearch(curSpan.value as DocumentSpan, childrenArray);\n let curChild = children.next();\n\n while (!(curChild.done || curSpan.done)) {\n if (contains(curSpan.value, curChild.value.span)) {\n // The span is contained, so yield the current child and advance it.\n yield curChild.value;\n curChild = children.next();\n } else if (curSpan.value.offset + curSpan.value.length < curChild.value.span.offset) {\n // The current span ends before the next potential child starts, so advance the span\n curSpan = spans.next();\n } else {\n // The current child was not contained in the current span, so advance to the next child.\n curChild = children.next();\n }\n }\n}\n\n/**\n * The state of an analysis operation, which will eventually produce the result type that corresponds to the model.\n */\nexport interface DocumentAnalysisPollOperationState<Result = AnalyzeResult<AnalyzedDocument>>\n extends PollOperationState<Result> {\n /**\n * The status of the operation. One of:\n *\n * - \"notStarted\"\n * - \"running\"\n * - \"succeeded\"\n * - \"failed\"\n */\n status: AnalyzeOperationStatus;\n\n /**\n * The model ID that the analysis operation will use to produce the result.\n */\n modelId: string;\n\n /**\n * The URL to the operation.\n */\n operationLocation: string;\n\n /**\n * The Date and Time that the operation was created.\n */\n createdOn: Date;\n\n /**\n * The date & time that the operation state was last modified.\n */\n lastUpdatedOn: Date;\n}\n\n/**\n * A long-running operation (poller) that tracks the state of an analysis operation, eventually producing the result\n * type that corresponds to the model.\n */\nexport type AnalysisPoller<Result = AnalyzeResult<AnalyzedDocument>> = PollerLike<\n DocumentAnalysisPollOperationState<Result>,\n Result\n>;\n\n/**\n * Convert a generated AnalyzeResult into a convenience layer AnalyzeResult.\n * @internal\n */\nexport function toAnalyzeResultFromGenerated(result: GeneratedAnalyzeResult): AnalyzeResult {\n return {\n apiVersion: result.apiVersion as FormRecognizerApiVersion,\n modelId: result.modelId,\n content: result.content,\n pages: result.pages.map((page) => toDocumentPageFromGenerated(page)),\n tables: result.tables?.map((table) => toDocumentTableFromGenerated(table)),\n keyValuePairs: result.keyValuePairs?.map((pair) => toKeyValuePairFromGenerated(pair)),\n languages: result.languages,\n styles: result.styles,\n paragraphs: result.paragraphs?.map((para) => ({\n ...para,\n boundingRegions: toBoundingRegions(para.boundingRegions),\n })),\n documents: result.documents?.map(toAnalyzedDocumentFromGenerated),\n };\n}\n\n/**\n * Defines an analysis operation by the initial request model ID, poller options, and a transform to apply to the\n * eventual result,\n *\n * @internal\n */\nexport interface AnalysisOperationDefinition<Result = AnalyzeResult> {\n transformResult: (primitiveResult: GeneratedAnalyzeResult) => Result;\n initialModelId: string;\n options: PollerOptions<DocumentAnalysisPollOperationState<Result>> &\n AnalyzeDocumentOptions<Result>;\n}\n\n/**\n * Converts an AnalyzeResultOperation (LRO response) to a DocumentAnalysisPollOperationState\n * @internal\n */\nexport function toDocumentAnalysisPollOperationState<Result>(\n definition: AnalysisOperationDefinition<Result>,\n modelId: string,\n operationLocation: string,\n response: AnalyzeResultOperation\n): DocumentAnalysisPollOperationState<Result> {\n return {\n status: response.status,\n modelId: modelId,\n lastUpdatedOn: response.lastUpdatedOn,\n createdOn: response.createdOn,\n operationLocation,\n result: response.analyzeResult && definition.transformResult(response.analyzeResult),\n error: response.error && new FormRecognizerError(response.error),\n isCancelled: false, // Not supported\n isStarted: response.status !== \"notStarted\",\n isCompleted: response.status === \"succeeded\",\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"documentElements.js","sourceRoot":"","sources":["../../../src/models/documentElements.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Point2D } from \"../transforms/polygon\";\nimport {\n DocumentPageKind,\n DocumentSpan,\n DocumentTableCellKind,\n DocumentField as GeneratedDocumentField,\n LengthUnit,\n ParagraphRole,\n SelectionMarkState,\n} from \"../generated\";\n\n/** Simple document elements such as words, selection marks and lines are bounded by the polygon. */\nexport interface HasBoundingPolygon {\n /** Bounding polygon of the entity. */\n polygon?: Point2D[];\n}\n\n// ------------------------------------\n// Following are the interfaces that are redefined with the property `polygon?: Point2D[];`\n// instead of the generated `polygon?: number[];` for the interfaces in the generated code with the same names.\n//\n// To avoid going out-of-sync with the generated types, we test the re-constructed interfaces are following the shapes in the generated interfaces in the following test file.\n// `test/internal/convenienceModelAssignability.spec.ts`\n//\n// If the generated code is updated and if there are new additions in the generated interfaces, the function calls \"checkAssign\" would fail in the test file, which would mean we need to revisit the re-constructed shapes here.\n\n/** Bounding polygon on a specific page of the input. */\nexport interface BoundingRegion extends HasBoundingPolygon {\n /** 1-based page number of page containing the bounding region. */\n pageNumber: number;\n}\n\n/** A word object consisting of a contiguous sequence of characters. For non-space delimited languages, such as Chinese, Japanese, and Korean, each character is represented as its own word. */\nexport interface DocumentWord extends HasBoundingPolygon {\n /** Text content of the word. */\n content: string;\n /** Location of the word in the reading order concatenated content. */\n span: DocumentSpan;\n /** Confidence of correctly extracting the word. */\n confidence: number;\n}\n\n/** A selection mark object representing check boxes, radio buttons, and other elements indicating a selection. */\nexport interface DocumentSelectionMark extends HasBoundingPolygon {\n /** State of the selection mark. */\n state: SelectionMarkState;\n /** Location of the selection mark in the reading order concatenated content. */\n span: DocumentSpan;\n /** Confidence of correctly extracting the selection mark. */\n confidence: number;\n}\n\n/** A content line object consisting of an adjacent sequence of content elements, such as words and selection marks. */\nexport interface DocumentLine extends HasBoundingPolygon {\n /** Concatenated content of the contained elements in reading order. */\n content: string;\n /** Location of the line in the reading order concatenated content. */\n spans: DocumentSpan[];\n /**\n * Compute the `DocumentWord`s that are related to this line.\n *\n * This function produces a lazy iterator that will yield one word before computing the next.\n */\n words: () => IterableIterator<DocumentWord>;\n}\n\n/** A paragraph object consisting with contiguous lines generally with common alignment and spacing. */\nexport interface DocumentParagraph {\n /** Semantic role of the paragraph. */\n role?: ParagraphRole;\n /** Concatenated content of the paragraph in reading order. */\n content: string;\n /** Bounding regions covering the paragraph. */\n boundingRegions?: BoundingRegion[];\n /** Location of the paragraph in the reading order concatenated content. */\n spans: DocumentSpan[];\n}\n\n/** A table object consisting table cells arranged in a rectangular layout. */\nexport interface DocumentTable {\n /** Number of rows in the table. */\n rowCount: number;\n /** Number of columns in the table. */\n columnCount: number;\n /** Cells contained within the table. */\n cells: DocumentTableCell[];\n /** Bounding regions covering the table. */\n boundingRegions?: BoundingRegion[];\n /** Location of the table in the reading order concatenated content. */\n spans: DocumentSpan[];\n}\n\n/** An object representing the location and content of a table cell. */\nexport interface DocumentTableCell {\n /** Table cell kind. */\n kind?: DocumentTableCellKind;\n /** Row index of the cell. */\n rowIndex: number;\n /** Column index of the cell. */\n columnIndex: number;\n /** Number of rows spanned by this cell. */\n rowSpan?: number;\n /** Number of columns spanned by this cell. */\n columnSpan?: number;\n /** Concatenated content of the table cell in reading order. */\n content: string;\n /** Bounding regions covering the table cell. */\n boundingRegions?: BoundingRegion[];\n /** Location of the table cell in the reading order concatenated content. */\n spans: DocumentSpan[];\n}\n\n/** An object representing the location and content of a table caption. */\nexport interface DocumentCaption {\n /** Table caption content. */\n content: string;\n /** Bounding regions covering the table caption. */\n boundingRegions?: BoundingRegion[];\n /** Location of the table caption in the reading order concatenated content. */\n spans: DocumentSpan[];\n}\n\n/** An object representing the location and content of a table footnote. */\nexport interface DocumentFootnote {\n /** Table footnote content. */\n content: string;\n /** Bounding regions covering the table footnote. */\n boundingRegions?: BoundingRegion[];\n /** Location of the table footnote in the reading order concatenated content. */\n spans: DocumentSpan[];\n}\n\n/** An object representing the field key or value in a key-value pair. */\nexport interface DocumentKeyValueElement {\n /** Concatenated content of the key-value element in reading order. */\n content: string;\n /** Bounding regions covering the key-value element. */\n boundingRegions?: BoundingRegion[];\n /** Location of the key-value element in the reading order concatenated content. */\n spans: DocumentSpan[];\n}\n\n/** An object describing the location and semantic content of a document. */\nexport interface Document {\n /** Document type. */\n docType: string;\n /** Bounding regions covering the document. */\n boundingRegions?: BoundingRegion[];\n /** Location of the document in the reading order concatenated content. */\n spans: DocumentSpan[];\n /** Dictionary of named field values. */\n fields?: { [propertyName: string]: GeneratedDocumentField };\n /** Confidence of correctly extracting the document. */\n confidence: number;\n}\n\n/** An object representing a form field with distinct field label (key) and field value (may be empty). */\nexport interface DocumentKeyValuePair {\n /** Field label of the key-value pair. */\n key: DocumentKeyValueElement;\n /** Field value of the key-value pair. */\n value?: DocumentKeyValueElement;\n /** Confidence of correctly extracting the key-value pair. */\n confidence: number;\n}\n\n/** Content and layout elements extracted from a page from the input. */\nexport interface DocumentPage {\n /** Kind of document page. */\n kind: DocumentPageKind;\n /** 1-based page number in the input document. */\n pageNumber: number;\n /** The general orientation of the content in clockwise direction, measured in degrees between (-180, 180]. */\n angle?: number;\n /** The width of the image/PDF in pixels/inches, respectively. */\n width?: number;\n /** The height of the image/PDF in pixels/inches, respectively. */\n height?: number;\n /** The unit used by the width, height, and polygon properties. For images, the unit is \"pixel\". PDF, the unit is \"inch\". */\n unit?: LengthUnit;\n /** Location of the page in the reading order concatenated content. */\n spans: DocumentSpan[];\n /** Extracted words from the page. */\n words?: DocumentWord[];\n /** Extracted selection marks from the page. */\n selectionMarks?: DocumentSelectionMark[];\n /** Extracted lines from the page, potentially containing both textual and visual elements. */\n lines?: DocumentLine[];\n}\n"]}
1
+ {"version":3,"file":"documentElements.js","sourceRoot":"","sources":["../../../src/models/documentElements.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Point2D } from \"../transforms/polygon\";\nimport {\n DocumentSpan,\n DocumentTableCellKind,\n DocumentField as GeneratedDocumentField,\n LengthUnit,\n ParagraphRole,\n SelectionMarkState,\n} from \"../generated\";\n\n/** Simple document elements such as words, selection marks and lines are bounded by the polygon. */\nexport interface HasBoundingPolygon {\n /** Bounding polygon of the entity. */\n polygon?: Point2D[];\n}\n\n// ------------------------------------\n// Following are the interfaces that are redefined with the property `polygon?: Point2D[];`\n// instead of the generated `polygon?: number[];` for the interfaces in the generated code with the same names.\n//\n// To avoid going out-of-sync with the generated types, we test the re-constructed interfaces are following the shapes in the generated interfaces in the following test file.\n// `test/internal/convenienceModelAssignability.spec.ts`\n//\n// If the generated code is updated and if there are new additions in the generated interfaces, the function calls \"checkAssign\" would fail in the test file, which would mean we need to revisit the re-constructed shapes here.\n\n/** Bounding polygon on a specific page of the input. */\nexport interface BoundingRegion extends HasBoundingPolygon {\n /** 1-based page number of page containing the bounding region. */\n pageNumber: number;\n}\n\n/** A word object consisting of a contiguous sequence of characters. For non-space delimited languages, such as Chinese, Japanese, and Korean, each character is represented as its own word. */\nexport interface DocumentWord extends HasBoundingPolygon {\n /** Text content of the word. */\n content: string;\n /** Location of the word in the reading order concatenated content. */\n span: DocumentSpan;\n /** Confidence of correctly extracting the word. */\n confidence: number;\n}\n\n/** A selection mark object representing check boxes, radio buttons, and other elements indicating a selection. */\nexport interface DocumentSelectionMark extends HasBoundingPolygon {\n /** State of the selection mark. */\n state: SelectionMarkState;\n /** Location of the selection mark in the reading order concatenated content. */\n span: DocumentSpan;\n /** Confidence of correctly extracting the selection mark. */\n confidence: number;\n}\n\n/** A content line object consisting of an adjacent sequence of content elements, such as words and selection marks. */\nexport interface DocumentLine extends HasBoundingPolygon {\n /** Concatenated content of the contained elements in reading order. */\n content: string;\n /** Location of the line in the reading order concatenated content. */\n spans: DocumentSpan[];\n /**\n * Compute the `DocumentWord`s that are related to this line.\n *\n * This function produces a lazy iterator that will yield one word before computing the next.\n */\n words: () => IterableIterator<DocumentWord>;\n}\n\n/** A paragraph object consisting with contiguous lines generally with common alignment and spacing. */\nexport interface DocumentParagraph {\n /** Semantic role of the paragraph. */\n role?: ParagraphRole;\n /** Concatenated content of the paragraph in reading order. */\n content: string;\n /** Bounding regions covering the paragraph. */\n boundingRegions?: BoundingRegion[];\n /** Location of the paragraph in the reading order concatenated content. */\n spans: DocumentSpan[];\n}\n\n/** A table object consisting table cells arranged in a rectangular layout. */\nexport interface DocumentTable {\n /** Number of rows in the table. */\n rowCount: number;\n /** Number of columns in the table. */\n columnCount: number;\n /** Cells contained within the table. */\n cells: DocumentTableCell[];\n /** Bounding regions covering the table. */\n boundingRegions?: BoundingRegion[];\n /** Location of the table in the reading order concatenated content. */\n spans: DocumentSpan[];\n}\n\n/** An object representing the location and content of a table cell. */\nexport interface DocumentTableCell {\n /** Table cell kind. */\n kind?: DocumentTableCellKind;\n /** Row index of the cell. */\n rowIndex: number;\n /** Column index of the cell. */\n columnIndex: number;\n /** Number of rows spanned by this cell. */\n rowSpan?: number;\n /** Number of columns spanned by this cell. */\n columnSpan?: number;\n /** Concatenated content of the table cell in reading order. */\n content: string;\n /** Bounding regions covering the table cell. */\n boundingRegions?: BoundingRegion[];\n /** Location of the table cell in the reading order concatenated content. */\n spans: DocumentSpan[];\n}\n\n/** An object representing the location and content of a table caption. */\nexport interface DocumentCaption {\n /** Table caption content. */\n content: string;\n /** Bounding regions covering the table caption. */\n boundingRegions?: BoundingRegion[];\n /** Location of the table caption in the reading order concatenated content. */\n spans: DocumentSpan[];\n}\n\n/** An object representing the location and content of a table footnote. */\nexport interface DocumentFootnote {\n /** Table footnote content. */\n content: string;\n /** Bounding regions covering the table footnote. */\n boundingRegions?: BoundingRegion[];\n /** Location of the table footnote in the reading order concatenated content. */\n spans: DocumentSpan[];\n}\n\n/** An object representing the field key or value in a key-value pair. */\nexport interface DocumentKeyValueElement {\n /** Concatenated content of the key-value element in reading order. */\n content: string;\n /** Bounding regions covering the key-value element. */\n boundingRegions?: BoundingRegion[];\n /** Location of the key-value element in the reading order concatenated content. */\n spans: DocumentSpan[];\n}\n\n/** An object describing the location and semantic content of a document. */\nexport interface Document {\n /** Document type. */\n docType: string;\n /** Bounding regions covering the document. */\n boundingRegions?: BoundingRegion[];\n /** Location of the document in the reading order concatenated content. */\n spans: DocumentSpan[];\n /** Dictionary of named field values. */\n fields?: { [propertyName: string]: GeneratedDocumentField };\n /** Confidence of correctly extracting the document. */\n confidence: number;\n}\n\n/** An object representing a form field with distinct field label (key) and field value (may be empty). */\nexport interface DocumentKeyValuePair {\n /** Field label of the key-value pair. */\n key: DocumentKeyValueElement;\n /** Field value of the key-value pair. */\n value?: DocumentKeyValueElement;\n /** Confidence of correctly extracting the key-value pair. */\n confidence: number;\n}\n\n/** Content and layout elements extracted from a page from the input. */\nexport interface DocumentPage {\n /** 1-based page number in the input document. */\n pageNumber: number;\n /** The general orientation of the content in clockwise direction, measured in degrees between (-180, 180]. */\n angle?: number;\n /** The width of the image/PDF in pixels/inches, respectively. */\n width?: number;\n /** The height of the image/PDF in pixels/inches, respectively. */\n height?: number;\n /** The unit used by the width, height, and polygon properties. For images, the unit is \"pixel\". PDF, the unit is \"inch\". */\n unit?: LengthUnit;\n /** Location of the page in the reading order concatenated content. */\n spans: DocumentSpan[];\n /** Extracted words from the page. */\n words?: DocumentWord[];\n /** Extracted selection marks from the page. */\n selectionMarks?: DocumentSelectionMark[];\n /** Extracted lines from the page, potentially containing both textual and visual elements. */\n lines?: DocumentLine[];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BuildModelOptions.js","sourceRoot":"","sources":["../../../src/options/BuildModelOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAqBlC;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC;;;OAGG;IACH,QAAQ,EAAE,UAAU;IACpB;;;OAGG;IACH,MAAM,EAAE,QAAQ;CACR,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure/core-client\";\nimport { DocumentModelOperationState } from \"../lro/administration\";\nimport { PollerOptions } from \"./PollerOptions\";\n\n/**\n * Supported model build modes. The model build mode selects the engine that the service uses to train the model based\n * on the labeled training data.\n *\n * The options are:\n * - \"neural\", which yields the highest quality of model that is capable of extracting data from classes of documents\n * that have the same structure of data, but different layouts (for example, W2 tax forms, which may vary from company\n * to company, but always contain the same information).\n * - \"template\", which requires all documents to have the same fixed layout (template).\n *\n * Please see the following link for more information: https://aka.ms/azsdk/formrecognizer/buildmode\n */\nexport type DocumentModelBuildMode =\n typeof DocumentModelBuildMode[keyof typeof DocumentModelBuildMode];\n\n/**\n * Supported values of `DocumentModelBuildMode`.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const DocumentModelBuildMode = {\n /**\n * A mode that builds a model assuming that documents all follow the same, fixed template layout (the same relative\n * positioning of fields between documents).\n */\n Template: \"template\",\n /**\n * A mode that uses a neural engine to extract fields, allowing for documents that have different visual appearances,\n * but that contain the same information.\n */\n Neural: \"neural\",\n} as const;\n\n/**\n * Options common to all operations that define new models, such as `beginBuildModel`, `beginComposeModel`, and\n * `getCopyAuthorization`.\n */\nexport interface CommonModelCreationOptions {\n /**\n * A textual description of the model (can be any text).\n */\n description?: string;\n\n /**\n * Additional, user-specified key-value pairs to associate with the model as persistent metadata.\n */\n tags?: Record<string, string>;\n}\n\n/**\n * Options for the model creation operation.\n */\nexport interface CreateModelOptions\n extends OperationOptions,\n CommonModelCreationOptions,\n PollerOptions<DocumentModelOperationState> {}\n\n/**\n * Options for the model build operation.\n */\nexport interface BeginBuildModelOptions extends CreateModelOptions {}\n\n/**\n * Options for the model compose operation.\n */\nexport interface BeginComposeModelOptions extends CreateModelOptions {}\n"]}
1
+ {"version":3,"file":"BuildModelOptions.js","sourceRoot":"","sources":["../../../src/options/BuildModelOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAqBlC;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC;;;OAGG;IACH,QAAQ,EAAE,UAAU;IACpB;;;OAGG;IACH,MAAM,EAAE,QAAQ;CACR,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure/core-client\";\nimport { DocumentModelOperationState } from \"../lro/administration\";\nimport { PollerOptions } from \"./PollerOptions\";\n\n/**\n * Supported model build modes. The model build mode selects the engine that the service uses to train the model based\n * on the labeled training data.\n *\n * The options are:\n * - \"neural\", which yields the highest quality of model that is capable of extracting data from classes of documents\n * that have the same structure of data, but different layouts (for example, W2 tax forms, which may vary from company\n * to company, but always contain the same information).\n * - \"template\", which requires all documents to have the same fixed layout (template).\n *\n * Please see the following link for more information: https://aka.ms/azsdk/formrecognizer/buildmode\n */\nexport type DocumentModelBuildMode =\n typeof DocumentModelBuildMode[keyof typeof DocumentModelBuildMode];\n\n/**\n * Supported values of `DocumentModelBuildMode`.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const DocumentModelBuildMode = {\n /**\n * A mode that builds a model assuming that documents all follow the same, fixed template layout (the same relative\n * positioning of fields between documents).\n */\n Template: \"template\",\n /**\n * A mode that uses a neural engine to extract fields, allowing for documents that have different visual appearances,\n * but that contain the same information.\n */\n Neural: \"neural\",\n} as const;\n\n/**\n * Options common to all operations that define new models, such as `beginBuildDocumentModel`,\n * `beginComposeDocumentModel`, and `getCopyAuthorization`.\n */\nexport interface CommonModelCreationOptions {\n /**\n * A textual description of the model (can be any text).\n */\n description?: string;\n\n /**\n * Additional, user-specified key-value pairs to associate with the model as persistent metadata.\n */\n tags?: Record<string, string>;\n}\n\n/**\n * Options for the model creation operation.\n */\nexport interface CreateDocumentModelOptions\n extends OperationOptions,\n CommonModelCreationOptions,\n PollerOptions<DocumentModelOperationState> {}\n\n/**\n * Options for the model build operation.\n */\nexport interface BeginBuildDocumentModelOptions extends CreateDocumentModelOptions {}\n\n/**\n * Options for the model compose operation.\n */\nexport interface BeginComposeDocumentModelOptions extends CreateDocumentModelOptions {}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DeleteModelOptions.js","sourceRoot":"","sources":["../../../src/options/DeleteModelOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure/core-client\";\n\n/**\n * Options for model deletion.\n */\nexport interface DeleteModelOptions extends OperationOptions {}\n"]}
1
+ {"version":3,"file":"DeleteModelOptions.js","sourceRoot":"","sources":["../../../src/options/DeleteModelOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure/core-client\";\n\n/**\n * Options for model deletion.\n */\nexport interface DeleteDocumentModelOptions extends OperationOptions {}\n"]}
@@ -11,9 +11,10 @@ export const FormRecognizerApiVersion = {
11
11
  * If using a beta package version, this will be identical to the latest preview version. Otherwise, it will be
12
12
  * identical to the latest stable version.
13
13
  */
14
- Latest: "2022-06-30-preview",
14
+ Latest: "2022-08-31",
15
15
  // TODO (GA): Add a `Stable` version selector that picks the latest GA version, even in beta packages, and an exact
16
16
  // version entry for the GA version.
17
+ Stable: "2022-08-31",
17
18
  };
18
19
  /**
19
20
  * Supported values of StringIndexType.
@@ -36,6 +37,6 @@ export const StringIndexType = {
36
37
  */
37
38
  export const DEFAULT_GENERATED_CLIENT_OPTIONS = {
38
39
  stringIndexType: StringIndexType.Utf16CodeUnit,
39
- apiVersion: FormRecognizerApiVersion.Latest,
40
+ apiVersion: FormRecognizerApiVersion.Stable,
40
41
  };
41
42
  //# sourceMappingURL=FormRecognizerClientOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormRecognizerClientOptions.js","sourceRoot":"","sources":["../../../src/options/FormRecognizerClientOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC;;;;;OAKG;IACH,MAAM,EAAE,oBAAoB;IAC5B,mHAAmH;IACnH,oCAAoC;CAC5B,CAAC;AAOX;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B;;OAEG;IACH,aAAa,EAAE,eAAe;IAC9B;;OAEG;IACH,gBAAgB,EAAE,kBAAkB;CAC5B,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,eAAe,EAAE,eAAe,CAAC,aAAa;IAC9C,UAAU,EAAE,wBAAwB,CAAC,MAAM;CACnC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CommonClientOptions } from \"@azure/core-client\";\n\n/**\n * Valid values of the Form Recognizer service REST API version.\n */\nexport type FormRecognizerApiVersion =\n typeof FormRecognizerApiVersion[keyof typeof FormRecognizerApiVersion];\n\n/**\n * Supported and common values of FormRecognizerApiVersion.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const FormRecognizerApiVersion = {\n /**\n * The newest version of the service known to be supported by the client (default).\n *\n * If using a beta package version, this will be identical to the latest preview version. Otherwise, it will be\n * identical to the latest stable version.\n */\n Latest: \"2022-06-30-preview\",\n // TODO (GA): Add a `Stable` version selector that picks the latest GA version, even in beta packages, and an exact\n // version entry for the GA version.\n} as const;\n\n/**\n * Valid string index types supported by the Form Recognizer service and SDK clients.\n */\nexport type StringIndexType = typeof StringIndexType[keyof typeof StringIndexType];\n\n/**\n * Supported values of StringIndexType.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const StringIndexType = {\n /**\n * UTF-16 code units\n */\n Utf16CodeUnit: \"utf16CodeUnit\",\n /**\n * Unicode code points\n */\n UnicodeCodePoint: \"unicodeCodePoint\",\n} as const;\n\n/**\n * Default settings for Form Recognizer clients.\n *\n * @internal\n */\nexport const DEFAULT_GENERATED_CLIENT_OPTIONS = {\n stringIndexType: StringIndexType.Utf16CodeUnit,\n apiVersion: FormRecognizerApiVersion.Latest,\n} as const;\n\n/**\n * Configurable options for the Form Recognizer service clients (DocumentAnalysisClient and\n * DocumentModelAdministrationClient).\n */\nexport interface FormRecognizerCommonClientOptions extends CommonClientOptions {\n /**\n * The version of the Form Recognizer REST API to call. Service versions 2.1 and lower (non-date-based versions) are\n * not supported by this client. To use API version 2.1, please use version 3 of the Azure Form Recognizer SDK for\n * JavaScript (\\@azure/ai-form-recognizer\\@^3.2.0).\n *\n * Default: FormRecognizerApiVersion.Latest (\"2022-06-30-preview\")\n */\n apiVersion?: FormRecognizerApiVersion;\n}\n\n/**\n * Configurable options for DocumentAnalysisClient.\n */\nexport interface DocumentAnalysisClientOptions extends FormRecognizerCommonClientOptions {\n /**\n * The unit of string offset/length values that the service returns.\n *\n * In JavaScript, strings are indexed by UTF-16 code units. Do _NOT_ set this value unless you are certain you need\n * Unicode code-point units instead.\n *\n * Default: \"utf16CodeUnit\"\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Configurable options for DocumentModelAdministrationClient.\n */\nexport interface DocumentModelAdministrationClientOptions\n extends FormRecognizerCommonClientOptions {}\n"]}
1
+ {"version":3,"file":"FormRecognizerClientOptions.js","sourceRoot":"","sources":["../../../src/options/FormRecognizerClientOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC;;;;;OAKG;IACH,MAAM,EAAE,YAAY;IACpB,mHAAmH;IACnH,oCAAoC;IACpC,MAAM,EAAE,YAAY;CACZ,CAAC;AAOX;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B;;OAEG;IACH,aAAa,EAAE,eAAe;IAC9B;;OAEG;IACH,gBAAgB,EAAE,kBAAkB;CAC5B,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,eAAe,EAAE,eAAe,CAAC,aAAa;IAC9C,UAAU,EAAE,wBAAwB,CAAC,MAAM;CACnC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CommonClientOptions } from \"@azure/core-client\";\n\n/**\n * Valid values of the Form Recognizer service REST API version.\n */\nexport type FormRecognizerApiVersion =\n typeof FormRecognizerApiVersion[keyof typeof FormRecognizerApiVersion];\n\n/**\n * Supported and common values of FormRecognizerApiVersion.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const FormRecognizerApiVersion = {\n /**\n * The newest version of the service known to be supported by the client (default).\n *\n * If using a beta package version, this will be identical to the latest preview version. Otherwise, it will be\n * identical to the latest stable version.\n */\n Latest: \"2022-08-31\",\n // TODO (GA): Add a `Stable` version selector that picks the latest GA version, even in beta packages, and an exact\n // version entry for the GA version.\n Stable: \"2022-08-31\",\n} as const;\n\n/**\n * Valid string index types supported by the Form Recognizer service and SDK clients.\n */\nexport type StringIndexType = typeof StringIndexType[keyof typeof StringIndexType];\n\n/**\n * Supported values of StringIndexType.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const StringIndexType = {\n /**\n * UTF-16 code units\n */\n Utf16CodeUnit: \"utf16CodeUnit\",\n /**\n * Unicode code points\n */\n UnicodeCodePoint: \"unicodeCodePoint\",\n} as const;\n\n/**\n * Default settings for Form Recognizer clients.\n *\n * @internal\n */\nexport const DEFAULT_GENERATED_CLIENT_OPTIONS = {\n stringIndexType: StringIndexType.Utf16CodeUnit,\n apiVersion: FormRecognizerApiVersion.Stable,\n} as const;\n\n/**\n * Configurable options for the Form Recognizer service clients (DocumentAnalysisClient and\n * DocumentModelAdministrationClient).\n */\nexport interface FormRecognizerCommonClientOptions extends CommonClientOptions {\n /**\n * The version of the Form Recognizer REST API to call. Service versions 2.1 and lower (non-date-based versions) are\n * not supported by this client. To use API version 2.1, please use version 3 of the Azure Form Recognizer SDK for\n * JavaScript (\\@azure/ai-form-recognizer\\@^3.2.0).\n *\n * Default: FormRecognizerApiVersion.Stable (\"2022-08-31\")\n */\n apiVersion?: FormRecognizerApiVersion;\n}\n\n/**\n * Configurable options for DocumentAnalysisClient.\n */\nexport interface DocumentAnalysisClientOptions extends FormRecognizerCommonClientOptions {\n /**\n * The unit of string offset/length values that the service returns.\n *\n * In JavaScript, strings are indexed by UTF-16 code units. Do _NOT_ set this value unless you are certain you need\n * Unicode code-point units instead.\n *\n * Default: \"utf16CodeUnit\"\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Configurable options for DocumentModelAdministrationClient.\n */\nexport interface DocumentModelAdministrationClientOptions\n extends FormRecognizerCommonClientOptions {}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/options/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAGL,sBAAsB,GAGvB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAGL,wBAAwB,EAExB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AASvC,OAAO,EAOL,sBAAsB,EAYtB,eAAe,EACf,wBAAwB,GACzB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AnalyzeDocumentOptions } from \"./AnalyzeDocumentsOptions\";\nimport {\n CreateModelOptions,\n CommonModelCreationOptions,\n DocumentModelBuildMode,\n BeginBuildModelOptions,\n BeginComposeModelOptions,\n} from \"./BuildModelOptions\";\nimport { BeginCopyModelOptions } from \"./BeginCopyModelOptions\";\nimport { DeleteModelOptions } from \"./DeleteModelOptions\";\nimport {\n DocumentAnalysisClientOptions,\n DocumentModelAdministrationClientOptions,\n FormRecognizerApiVersion,\n FormRecognizerCommonClientOptions,\n StringIndexType,\n} from \"./FormRecognizerClientOptions\";\nimport { GetCopyAuthorizationOptions } from \"./GetCopyAuthorizationOptions\";\nimport { GetResourceDetailsOptions } from \"./GetResourceDetailsOptions\";\nimport { GetModelOptions } from \"./GetModelOptions\";\nimport { GetOperationOptions } from \"./GetOperationOptions\";\nimport { ListModelsOptions } from \"./ListModelsOptions\";\nimport { ListOperationsOptions } from \"./ListOperationsOptions\";\nimport { PollerOptions } from \"./PollerOptions\";\n\nexport {\n AnalyzeDocumentOptions,\n CreateModelOptions,\n BeginBuildModelOptions,\n BeginComposeModelOptions,\n CommonModelCreationOptions,\n BeginCopyModelOptions,\n DocumentModelBuildMode,\n FormRecognizerCommonClientOptions,\n DocumentAnalysisClientOptions,\n DocumentModelAdministrationClientOptions,\n GetCopyAuthorizationOptions,\n GetResourceDetailsOptions,\n GetModelOptions,\n GetOperationOptions,\n DeleteModelOptions,\n ListModelsOptions,\n ListOperationsOptions,\n PollerOptions,\n StringIndexType,\n FormRecognizerApiVersion,\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/options/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAGL,sBAAsB,GAGvB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAGL,wBAAwB,EAExB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AASvC,OAAO,EAOL,sBAAsB,EAYtB,eAAe,EACf,wBAAwB,GACzB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AnalyzeDocumentOptions } from \"./AnalyzeDocumentsOptions\";\nimport {\n CreateDocumentModelOptions,\n CommonModelCreationOptions,\n DocumentModelBuildMode,\n BeginBuildDocumentModelOptions,\n BeginComposeDocumentModelOptions,\n} from \"./BuildModelOptions\";\nimport { BeginCopyModelOptions } from \"./BeginCopyModelOptions\";\nimport { DeleteDocumentModelOptions } from \"./DeleteModelOptions\";\nimport {\n DocumentAnalysisClientOptions,\n DocumentModelAdministrationClientOptions,\n FormRecognizerApiVersion,\n FormRecognizerCommonClientOptions,\n StringIndexType,\n} from \"./FormRecognizerClientOptions\";\nimport { GetCopyAuthorizationOptions } from \"./GetCopyAuthorizationOptions\";\nimport { GetResourceDetailsOptions } from \"./GetResourceDetailsOptions\";\nimport { GetModelOptions } from \"./GetModelOptions\";\nimport { GetOperationOptions } from \"./GetOperationOptions\";\nimport { ListModelsOptions } from \"./ListModelsOptions\";\nimport { ListOperationsOptions } from \"./ListOperationsOptions\";\nimport { PollerOptions } from \"./PollerOptions\";\n\nexport {\n AnalyzeDocumentOptions,\n CreateDocumentModelOptions,\n BeginBuildDocumentModelOptions,\n BeginComposeDocumentModelOptions,\n CommonModelCreationOptions,\n BeginCopyModelOptions,\n DocumentModelBuildMode,\n FormRecognizerCommonClientOptions,\n DocumentAnalysisClientOptions,\n DocumentModelAdministrationClientOptions,\n GetCopyAuthorizationOptions,\n GetResourceDetailsOptions,\n GetModelOptions,\n GetOperationOptions,\n DeleteDocumentModelOptions,\n ListModelsOptions,\n ListOperationsOptions,\n PollerOptions,\n StringIndexType,\n FormRecognizerApiVersion,\n};\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "An isomorphic client library for the Azure Form Recognizer service.",
6
- "version": "4.0.0-beta.6",
6
+ "version": "4.0.0",
7
7
  "keywords": [
8
8
  "node",
9
9
  "azure",
@@ -158,13 +158,13 @@ export { AzureKeyCredential }
158
158
  /**
159
159
  * Options for the model build operation.
160
160
  */
161
- export declare interface BeginBuildModelOptions extends CreateModelOptions {
161
+ export declare interface BeginBuildDocumentModelOptions extends CreateDocumentModelOptions {
162
162
  }
163
163
 
164
164
  /**
165
165
  * Options for the model compose operation.
166
166
  */
167
- export declare interface BeginComposeModelOptions extends CreateModelOptions {
167
+ export declare interface BeginComposeDocumentModelOptions extends CreateDocumentModelOptions {
168
168
  }
169
169
 
170
170
  /**
@@ -180,8 +180,8 @@ export declare interface BoundingRegion extends HasBoundingPolygon {
180
180
  }
181
181
 
182
182
  /**
183
- * Options common to all operations that define new models, such as `beginBuildModel`, `beginComposeModel`, and
184
- * `getCopyAuthorization`.
183
+ * Options common to all operations that define new models, such as `beginBuildDocumentModel`,
184
+ * `beginComposeDocumentModel`, and `getCopyAuthorization`.
185
185
  */
186
186
  export declare interface CommonModelCreationOptions {
187
187
  /**
@@ -210,6 +210,12 @@ export declare interface CopyAuthorization {
210
210
  expirationDateTime: Date;
211
211
  }
212
212
 
213
+ /**
214
+ * Options for the model creation operation.
215
+ */
216
+ export declare interface CreateDocumentModelOptions extends OperationOptions, CommonModelCreationOptions, PollerOptions<DocumentModelOperationState> {
217
+ }
218
+
213
219
  /**
214
220
  * Create a DocumentModel that performs analysis using the given schema.
215
221
  *
@@ -220,13 +226,7 @@ export declare interface CopyAuthorization {
220
226
  * @param schema - model schema contents
221
227
  * @returns - a DocumentModel that encodes the schema
222
228
  */
223
- export declare function createModelFromSchema(schema: Omit<DocumentModelDetails, "createdDateTime">): DocumentModel<AnalyzeResult<unknown>>;
224
-
225
- /**
226
- * Options for the model creation operation.
227
- */
228
- export declare interface CreateModelOptions extends OperationOptions, CommonModelCreationOptions, PollerOptions<DocumentModelOperationState> {
229
- }
229
+ export declare function createModelFromSchema(schema: Omit<DocumentModelDetails, "createdOn">): DocumentModel<AnalyzeResult<unknown>>;
230
230
 
231
231
  /** Currency field value. */
232
232
  export declare interface CurrencyValue {
@@ -247,7 +247,7 @@ export declare interface CustomDocumentModelsDetails {
247
247
  /**
248
248
  * Options for model deletion.
249
249
  */
250
- export declare interface DeleteModelOptions extends OperationOptions {
250
+ export declare interface DeleteDocumentModelOptions extends OperationOptions {
251
251
  }
252
252
 
253
253
  /**
@@ -911,7 +911,7 @@ export declare class DocumentModelAdministrationClient {
911
911
  * const modelId = "aNewModel";
912
912
  * const containerUrl = "<training data container SAS URL>";
913
913
  *
914
- * const poller = await client.beginBuildModel(modelId, containerUrl, {
914
+ * const poller = await client.beginBuildDocumentModel(modelId, containerUrl, {
915
915
  * // Optionally, a text description may be attached to the model
916
916
  * description: "This is an example model!"
917
917
  * });
@@ -923,7 +923,7 @@ export declare class DocumentModelAdministrationClient {
923
923
  * const {
924
924
  * modelId, // identical to the modelId given when creating the model
925
925
  * description, // identical to the description given when creating the model
926
- * createdDateTime, // the Date (timestamp) that the model was created
926
+ * createdOn, // the Date (timestamp) that the model was created
927
927
  * docTypes // information about the document types in the model and their field schemas
928
928
  * } = modelDetails;
929
929
  * ```
@@ -934,7 +934,7 @@ export declare class DocumentModelAdministrationClient {
934
934
  * @param options - optional settings for the model build operation
935
935
  * @returns a long-running operation (poller) that will eventually produce the created model information or an error
936
936
  */
937
- beginBuildModel(modelId: string, containerUrl: string, buildMode: DocumentModelBuildMode, options?: BeginBuildModelOptions): Promise<DocumentModelPoller>;
937
+ beginBuildDocumentModel(modelId: string, containerUrl: string, buildMode: DocumentModelBuildMode, options?: BeginBuildDocumentModelOptions): Promise<DocumentModelPoller>;
938
938
  /**
939
939
  * Creates a single composed model from several pre-existing submodels.
940
940
  *
@@ -953,7 +953,7 @@ export declare class DocumentModelAdministrationClient {
953
953
  *
954
954
  * // The resulting composed model can classify and extract data from documents
955
955
  * // conforming to any of the above document types
956
- * const poller = await client.beginComposeModel(modelId, subModelIds, {
956
+ * const poller = await client.beginComposeDocumentModel(modelId, subModelIds, {
957
957
  * description: "This is a composed model that can handle several document types."
958
958
  * });
959
959
  *
@@ -964,7 +964,7 @@ export declare class DocumentModelAdministrationClient {
964
964
  * const {
965
965
  * modelId, // identical to the modelId given when creating the model
966
966
  * description, // identical to the description given when creating the model
967
- * createdDateTime, // the Date (timestamp) that the model was created
967
+ * createdOn, // the Date (timestamp) that the model was created
968
968
  * docTypes // information about the document types of the composed submodels
969
969
  * } = modelDetails;
970
970
  * ```
@@ -974,7 +974,7 @@ export declare class DocumentModelAdministrationClient {
974
974
  * @param options - optional settings for model creation
975
975
  * @returns a long-running operation (poller) that will eventually produce the created model information or an error
976
976
  */
977
- beginComposeModel(modelId: string, componentModelIds: Iterable<string>, options?: BeginComposeModelOptions): Promise<DocumentModelPoller>;
977
+ beginComposeDocumentModel(modelId: string, componentModelIds: Iterable<string>, options?: BeginComposeDocumentModelOptions): Promise<DocumentModelPoller>;
978
978
  /**
979
979
  * Creates an authorization to copy a model into the resource, used with the `beginCopyModelTo` method.
980
980
  *
@@ -1021,7 +1021,7 @@ export declare class DocumentModelAdministrationClient {
1021
1021
  * const {
1022
1022
  * modelId, // identical to the modelId given when creating the copy authorization
1023
1023
  * description, // identical to the description given when creating the copy authorization
1024
- * createdDateTime, // the Date (timestamp) that the model was created
1024
+ * createdOn, // the Date (timestamp) that the model was created
1025
1025
  * docTypes // information about the document types of the model (identical to the original, source model)
1026
1026
  * } = modelDetails;
1027
1027
  * ```
@@ -1070,9 +1070,9 @@ export declare class DocumentModelAdministrationClient {
1070
1070
  * ### **Breaking Change**
1071
1071
  *
1072
1072
  * In previous versions of the Form Recognizer REST API and SDK, the `getModel` method could return any model, even
1073
- * one that failed to create due to errors. In the new service versions, `getModel` and `listModels` _only produce
1074
- * successfully created models_ (i.e. models that are "ready" for use). Failed models are now retrieved through the
1075
- * "operations" APIs, see {@link getOperation} and {@link listOperations}.
1073
+ * one that failed to create due to errors. In the new service versions, `getDocumentModel` and `listDocumentModels`
1074
+ * _only produce successfully created models_ (i.e. models that are "ready" for use). Failed models are now retrieved
1075
+ * through the "operations" APIs, see {@link getOperation} and {@link listOperations}.
1076
1076
  *
1077
1077
  * ### Example
1078
1078
  *
@@ -1081,9 +1081,9 @@ export declare class DocumentModelAdministrationClient {
1081
1081
  * const modelId = "prebuilt-businessCard";
1082
1082
  *
1083
1083
  * const {
1084
- * modelId, // identical to the modelId given when calling `getModel`
1084
+ * modelId, // identical to the modelId given when calling `getDocumentModel`
1085
1085
  * description, // a textual description of the model, if provided during model creation
1086
- * createdDateTime, // the Date (timestamp) that the model was created
1086
+ * createdOn, // the Date (timestamp) that the model was created
1087
1087
  * // information about the document types in the model and their field schemas
1088
1088
  * docTypes: {
1089
1089
  * // the document type of the prebuilt business card model
@@ -1097,14 +1097,14 @@ export declare class DocumentModelAdministrationClient {
1097
1097
  * fieldConfidence
1098
1098
  * }
1099
1099
  * }
1100
- * } = await client.getModel(modelId);
1100
+ * } = await client.getDocumentModel(modelId);
1101
1101
  * ```
1102
1102
  *
1103
1103
  * @param modelId - the unique ID of the model to query
1104
1104
  * @param options - optional settings for the request
1105
1105
  * @returns information about the model with the given ID
1106
1106
  */
1107
- getModel(modelId: string, options?: GetModelOptions): Promise<DocumentModelDetails>;
1107
+ getDocumentModel(modelId: string, options?: GetModelOptions): Promise<DocumentModelDetails>;
1108
1108
  /**
1109
1109
  * List summaries of models in the resource. Custom as well as prebuilt models will be included. This operation
1110
1110
  * supports paging.
@@ -1112,36 +1112,36 @@ export declare class DocumentModelAdministrationClient {
1112
1112
  * The model summary ({@link ModelSummary}) includes only the basic information about the model, and does not include
1113
1113
  * information about the document types in the model (such as the field schemas and confidence values).
1114
1114
  *
1115
- * To access the full information about the model, use {@link getModel}.
1115
+ * To access the full information about the model, use {@link getDocumentModel}.
1116
1116
  *
1117
1117
  * ### **Breaking Change**
1118
1118
  *
1119
1119
  * In previous versions of the Form Recognizer REST API and SDK, the `listModels` method would return all models, even
1120
- * those that failed to create due to errors. In the new service versions, `listModels` and `getModels` _only produce
1121
- * successfully created models_ (i.e. models that are "ready" for use). Failed models are now retrieved through the
1122
- * "operations" APIs, see {@link getOperation} and {@link listOperations}.
1120
+ * those that failed to create due to errors. In the new service versions, `listDocumentModels` and `getDocumentModel`
1121
+ * _only produce successfully created models_ (i.e. models that are "ready" for use). Failed models are now retrieved
1122
+ * through the "operations" APIs, see {@link getOperation} and {@link listOperations}.
1123
1123
  *
1124
1124
  * ### Examples
1125
1125
  *
1126
1126
  * #### Async Iteration
1127
1127
  *
1128
1128
  * ```javascript
1129
- * for await (const summary of client.listModels()) {
1129
+ * for await (const summary of client.listDocumentModels()) {
1130
1130
  * const {
1131
1131
  * modelId, // The model's unique ID
1132
1132
  * description, // a textual description of the model, if provided during model creation
1133
1133
  * } = summary;
1134
1134
  *
1135
- * // You can get the full model info using `getModel`
1136
- * const model = await client.getModel(modelId);
1135
+ * // You can get the full model info using `getDocumentModel`
1136
+ * const model = await client.getDocumentModel(modelId);
1137
1137
  * }
1138
1138
  * ```
1139
1139
  *
1140
1140
  * #### By Page
1141
1141
  *
1142
1142
  * ```javascript
1143
- * // The listModels method is paged, and you can iterate by page using the `byPage` method.
1144
- * const pages = client.listModels().byPage();
1143
+ * // The listDocumentModels method is paged, and you can iterate by page using the `byPage` method.
1144
+ * const pages = client.listDocumentModels().byPage();
1145
1145
  *
1146
1146
  * for await (const page of pages) {
1147
1147
  * // Each page is an array of models and can be iterated synchronously
@@ -1151,8 +1151,8 @@ export declare class DocumentModelAdministrationClient {
1151
1151
  * description, // a textual description of the model, if provided during model creation
1152
1152
  * } = summary;
1153
1153
  *
1154
- * // You can get the full model info using `getModel`
1155
- * const model = await client.getModel(modelId);
1154
+ * // You can get the full model info using `getDocumentModel`
1155
+ * const model = await client.getDocumentModel(modelId);
1156
1156
  * }
1157
1157
  * }
1158
1158
  * ```
@@ -1160,7 +1160,7 @@ export declare class DocumentModelAdministrationClient {
1160
1160
  * @param options - optional settings for the model requests
1161
1161
  * @returns an async iterable of model summaries that supports paging
1162
1162
  */
1163
- listModels(options?: ListModelsOptions): PagedAsyncIterableIterator<DocumentModelSummary>;
1163
+ listDocumentModels(options?: ListModelsOptions): PagedAsyncIterableIterator<DocumentModelSummary>;
1164
1164
  /**
1165
1165
  * Retrieves information about an operation (`OperationDetails`) by its ID.
1166
1166
  *
@@ -1181,8 +1181,8 @@ export declare class DocumentModelAdministrationClient {
1181
1181
  * kind, // the operation kind, one of "documentModelBuild", "documentModelCompose", or "documentModelCopyTo"
1182
1182
  * status, // the status of the operation, one of "notStarted", "running", "failed", "succeeded", or "canceled"
1183
1183
  * percentCompleted, // a number between 0 and 100 representing the progress of the operation
1184
- * createdDateTime, // a Date object that reflects the time when the operation was started
1185
- * lastUpdatedDateTime, // a Date object that reflects the time when the operation state was last modified
1184
+ * createdOn, // a Date object that reflects the time when the operation was started
1185
+ * lastUpdatedOn, // a Date object that reflects the time when the operation state was last modified
1186
1186
  * } = await client.getOperation(operationId);
1187
1187
  * ```
1188
1188
  */
@@ -1239,7 +1239,7 @@ export declare class DocumentModelAdministrationClient {
1239
1239
  * @param modelId - the unique ID of the model to delete from the resource
1240
1240
  * @param options - optional settings for the request
1241
1241
  */
1242
- deleteModel(modelId: string, options?: DeleteModelOptions): Promise<void>;
1242
+ deleteDocumentModel(modelId: string, options?: DeleteDocumentModelOptions): Promise<void>;
1243
1243
  }
1244
1244
 
1245
1245
  /**
@@ -1278,8 +1278,44 @@ export declare const DocumentModelBuildMode: {
1278
1278
  readonly Neural: "neural";
1279
1279
  };
1280
1280
 
1281
+ /** Get Operation response object. */
1282
+ export declare interface DocumentModelBuildOperationDetails extends OperationDetails {
1283
+ /** Polymorphic discriminator, which specifies the different types this object can be */
1284
+ kind: "documentModelBuild";
1285
+ /** Operation result upon success. */
1286
+ result?: DocumentModelDetails;
1287
+ }
1288
+
1289
+ /** Get Operation response object. */
1290
+ export declare interface DocumentModelComposeOperationDetails extends OperationDetails {
1291
+ /** Polymorphic discriminator, which specifies the different types this object can be */
1292
+ kind: "documentModelCompose";
1293
+ /** Operation result upon success. */
1294
+ result?: DocumentModelDetails;
1295
+ }
1296
+
1297
+ /** Get Operation response object. */
1298
+ export declare interface DocumentModelCopyToOperationDetails extends OperationDetails {
1299
+ /** Polymorphic discriminator, which specifies the different types this object can be */
1300
+ kind: "documentModelCopyTo";
1301
+ /** Operation result upon success. */
1302
+ result?: DocumentModelDetails;
1303
+ }
1304
+
1281
1305
  /** Document model info. */
1282
- export declare interface DocumentModelDetails extends DocumentModelSummary {
1306
+ export declare interface DocumentModelDetails {
1307
+ /** Unique document model name. */
1308
+ modelId: string;
1309
+ /** Document model description. */
1310
+ description?: string;
1311
+ /** Date and time (UTC) when the document model was created. */
1312
+ createdOn: Date;
1313
+ /** API version used to create this document model. */
1314
+ apiVersion?: string;
1315
+ /** List of key-value tag attributes associated with the document model. */
1316
+ tags?: {
1317
+ [propertyName: string]: string;
1318
+ };
1283
1319
  /** Supported document types. */
1284
1320
  docTypes?: {
1285
1321
  [propertyName: string]: DocumentTypeDetails;
@@ -1339,7 +1375,7 @@ export declare interface DocumentModelSummary {
1339
1375
  /** Document model description. */
1340
1376
  description?: string;
1341
1377
  /** Date and time (UTC) when the document model was created. */
1342
- createdDateTime: Date;
1378
+ createdOn: Date;
1343
1379
  /** API version used to create this document model. */
1344
1380
  apiVersion?: string;
1345
1381
  /** List of key-value tag attributes associated with the document model. */
@@ -1372,8 +1408,6 @@ export declare interface DocumentObjectField<Properties = {
1372
1408
 
1373
1409
  /** Content and layout elements extracted from a page from the input. */
1374
1410
  export declare interface DocumentPage {
1375
- /** Kind of document page. */
1376
- kind: DocumentPageKind;
1377
1411
  /** 1-based page number in the input document. */
1378
1412
  pageNumber: number;
1379
1413
  /** The general orientation of the content in clockwise direction, measured in degrees between (-180, 180]. */
@@ -1394,18 +1428,6 @@ export declare interface DocumentPage {
1394
1428
  lines?: DocumentLine[];
1395
1429
  }
1396
1430
 
1397
- /**
1398
- * Defines values for DocumentPageKind. \
1399
- * {@link KnownDocumentPageKind} can be used interchangeably with DocumentPageKind,
1400
- * this enum contains the known values that the service supports.
1401
- * ### Known values supported by the service
1402
- * **document** \
1403
- * **sheet** \
1404
- * **slide** \
1405
- * **image**
1406
- */
1407
- export declare type DocumentPageKind = string;
1408
-
1409
1431
  /** A paragraph object consisting with contiguous lines generally with common alignment and spacing. */
1410
1432
  export declare interface DocumentParagraph {
1411
1433
  /** Semantic role of the paragraph. */
@@ -1639,7 +1661,8 @@ export declare const FormRecognizerApiVersion: {
1639
1661
  * If using a beta package version, this will be identical to the latest preview version. Otherwise, it will be
1640
1662
  * identical to the latest stable version.
1641
1663
  */
1642
- readonly Latest: "2022-06-30-preview";
1664
+ readonly Latest: "2022-08-31";
1665
+ readonly Stable: "2022-08-31";
1643
1666
  };
1644
1667
 
1645
1668
  /**
@@ -1652,7 +1675,7 @@ export declare interface FormRecognizerCommonClientOptions extends CommonClientO
1652
1675
  * not supported by this client. To use API version 2.1, please use version 3 of the Azure Form Recognizer SDK for
1653
1676
  * JavaScript (\@azure/ai-form-recognizer\@^3.2.0).
1654
1677
  *
1655
- * Default: FormRecognizerApiVersion.Latest ("2022-06-30-preview")
1678
+ * Default: FormRecognizerApiVersion.Stable ("2022-08-31")
1656
1679
  */
1657
1680
  apiVersion?: FormRecognizerApiVersion;
1658
1681
  }
@@ -1683,7 +1706,7 @@ export declare interface GetOperationOptions extends OperationOptions {
1683
1706
  }
1684
1707
 
1685
1708
  /** Contains response data for the getOperation operation. */
1686
- export declare type GetOperationResponse = OperationDetails;
1709
+ export declare type GetOperationResponse = OperationDetailsUnion;
1687
1710
 
1688
1711
  /**
1689
1712
  * Options for retrieving Form Recognizer resource information.
@@ -1730,13 +1753,33 @@ export declare interface ListOperationsOptions extends OperationOptions {
1730
1753
  }
1731
1754
 
1732
1755
  /** Get Operation response object. */
1733
- export declare interface OperationDetails extends OperationSummary {
1756
+ export declare interface OperationDetails {
1757
+ /** Polymorphic discriminator, which specifies the different types this object can be */
1758
+ kind: "documentModelBuild" | "documentModelCompose" | "documentModelCopyTo";
1759
+ /** Operation ID */
1760
+ operationId: string;
1761
+ /** Operation status. */
1762
+ status: OperationStatus;
1763
+ /** Operation progress (0-100). */
1764
+ percentCompleted?: number;
1765
+ /** Date and time (UTC) when the operation was created. */
1766
+ createdOn: Date;
1767
+ /** Date and time (UTC) when the status was last updated. */
1768
+ lastUpdatedOn: Date;
1769
+ /** URL of the resource targeted by this operation. */
1770
+ resourceLocation: string;
1771
+ /** API version used to create this operation. */
1772
+ apiVersion?: string;
1773
+ /** List of key-value tag attributes associated with the document model. */
1774
+ tags?: {
1775
+ [propertyName: string]: string;
1776
+ };
1734
1777
  /** Encountered error. */
1735
1778
  error?: ErrorModel;
1736
- /** Operation result upon success. */
1737
- result?: Record<string, unknown>;
1738
1779
  }
1739
1780
 
1781
+ export declare type OperationDetailsUnion = OperationDetails | DocumentModelBuildOperationDetails | DocumentModelComposeOperationDetails | DocumentModelCopyToOperationDetails;
1782
+
1740
1783
  /**
1741
1784
  * Defines values for OperationKind. \
1742
1785
  * {@link KnownOperationKind} can be used interchangeably with OperationKind,
@@ -1760,9 +1803,9 @@ export declare interface OperationSummary {
1760
1803
  /** Operation progress (0-100). */
1761
1804
  percentCompleted?: number;
1762
1805
  /** Date and time (UTC) when the operation was created. */
1763
- createdDateTime: Date;
1806
+ createdOn: Date;
1764
1807
  /** Date and time (UTC) when the status was last updated. */
1765
- lastUpdatedDateTime: Date;
1808
+ lastUpdatedOn: Date;
1766
1809
  /** Type of operation. */
1767
1810
  kind: OperationKind;
1768
1811
  /** URL of the resource targeted by this operation. */