@azure/ai-form-recognizer 5.1.0-alpha.20251128.1 → 5.1.0-alpha.20251201.1
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/dist/browser/lro/administration.d.ts.map +1 -1
- package/dist/browser/lro/administration.js.map +1 -1
- package/dist/browser/lro/analysis.d.ts.map +1 -1
- package/dist/browser/lro/analysis.js.map +1 -1
- package/dist/browser/models/fields.d.ts.map +1 -1
- package/dist/browser/models/fields.js.map +1 -1
- package/dist/browser/options/AnalyzeDocumentOptions.d.ts.map +1 -1
- package/dist/browser/options/AnalyzeDocumentOptions.js.map +1 -1
- package/dist/browser/options/BeginCopyModelOptions.d.ts.map +1 -1
- package/dist/browser/options/BeginCopyModelOptions.js.map +1 -1
- package/dist/browser/options/BuildDocumentClassifierOptions.d.ts.map +1 -1
- package/dist/browser/options/BuildDocumentClassifierOptions.js.map +1 -1
- package/dist/browser/options/BuildModelOptions.d.ts.map +1 -1
- package/dist/browser/options/BuildModelOptions.js.map +1 -1
- package/dist/browser/options/ClassifyDocumentOptions.d.ts.map +1 -1
- package/dist/browser/options/ClassifyDocumentOptions.js.map +1 -1
- package/dist/browser/options/PollerOptions.d.ts.map +1 -1
- package/dist/browser/options/PollerOptions.js.map +1 -1
- package/dist/commonjs/lro/administration.d.ts.map +1 -1
- package/dist/commonjs/lro/administration.js.map +1 -1
- package/dist/commonjs/lro/analysis.d.ts.map +1 -1
- package/dist/commonjs/lro/analysis.js.map +1 -1
- package/dist/commonjs/models/fields.d.ts.map +1 -1
- package/dist/commonjs/models/fields.js.map +1 -1
- package/dist/commonjs/options/AnalyzeDocumentOptions.d.ts.map +1 -1
- package/dist/commonjs/options/AnalyzeDocumentOptions.js.map +1 -1
- package/dist/commonjs/options/BeginCopyModelOptions.d.ts.map +1 -1
- package/dist/commonjs/options/BeginCopyModelOptions.js.map +1 -1
- package/dist/commonjs/options/BuildDocumentClassifierOptions.d.ts.map +1 -1
- package/dist/commonjs/options/BuildDocumentClassifierOptions.js.map +1 -1
- package/dist/commonjs/options/BuildModelOptions.d.ts.map +1 -1
- package/dist/commonjs/options/BuildModelOptions.js.map +1 -1
- package/dist/commonjs/options/ClassifyDocumentOptions.d.ts.map +1 -1
- package/dist/commonjs/options/ClassifyDocumentOptions.js.map +1 -1
- package/dist/commonjs/options/PollerOptions.d.ts.map +1 -1
- package/dist/commonjs/options/PollerOptions.js.map +1 -1
- package/dist/esm/lro/administration.d.ts.map +1 -1
- package/dist/esm/lro/administration.js.map +1 -1
- package/dist/esm/lro/analysis.d.ts.map +1 -1
- package/dist/esm/lro/analysis.js.map +1 -1
- package/dist/esm/models/fields.d.ts.map +1 -1
- package/dist/esm/models/fields.js.map +1 -1
- package/dist/esm/options/AnalyzeDocumentOptions.d.ts.map +1 -1
- package/dist/esm/options/AnalyzeDocumentOptions.js.map +1 -1
- package/dist/esm/options/BeginCopyModelOptions.d.ts.map +1 -1
- package/dist/esm/options/BeginCopyModelOptions.js.map +1 -1
- package/dist/esm/options/BuildDocumentClassifierOptions.d.ts.map +1 -1
- package/dist/esm/options/BuildDocumentClassifierOptions.js.map +1 -1
- package/dist/esm/options/BuildModelOptions.d.ts.map +1 -1
- package/dist/esm/options/BuildModelOptions.js.map +1 -1
- package/dist/esm/options/ClassifyDocumentOptions.d.ts.map +1 -1
- package/dist/esm/options/ClassifyDocumentOptions.js.map +1 -1
- package/dist/esm/options/PollerOptions.d.ts.map +1 -1
- package/dist/esm/options/PollerOptions.js.map +1 -1
- package/dist/react-native/lro/administration.d.ts.map +1 -1
- package/dist/react-native/lro/administration.js.map +1 -1
- package/dist/react-native/lro/analysis.d.ts.map +1 -1
- package/dist/react-native/lro/analysis.js.map +1 -1
- package/dist/react-native/models/fields.d.ts.map +1 -1
- package/dist/react-native/models/fields.js.map +1 -1
- package/dist/react-native/options/AnalyzeDocumentOptions.d.ts.map +1 -1
- package/dist/react-native/options/AnalyzeDocumentOptions.js.map +1 -1
- package/dist/react-native/options/BeginCopyModelOptions.d.ts.map +1 -1
- package/dist/react-native/options/BeginCopyModelOptions.js.map +1 -1
- package/dist/react-native/options/BuildDocumentClassifierOptions.d.ts.map +1 -1
- package/dist/react-native/options/BuildDocumentClassifierOptions.js.map +1 -1
- package/dist/react-native/options/BuildModelOptions.d.ts.map +1 -1
- package/dist/react-native/options/BuildModelOptions.js.map +1 -1
- package/dist/react-native/options/ClassifyDocumentOptions.d.ts.map +1 -1
- package/dist/react-native/options/ClassifyDocumentOptions.js.map +1 -1
- package/dist/react-native/options/PollerOptions.d.ts.map +1 -1
- package/dist/react-native/options/PollerOptions.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"administration.d.ts","sourceRoot":"","sources":["../../../src/lro/administration.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EACf,kCAAkC,EAClC,mCAAmC,EACnC,oCAAoC,EACpC,yBAAyB,EACzB,uCAAuC,EACxC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GACpC,2BAA2B,GAC3B,gCAAgC,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,uCAAuC;IACtD;;;;;;;;OAQG;IACH,MAAM,EAAE,eAAe,CAAC;IAExB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,SAAS,EAAE,IA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,uCAAuC;CAAG;AAE9F;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAClC,kCAAkC,GAClC,mCAAmC,GACnC,oCAAoC,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,mCAAmC,GAC3C,0BAA0B,GAC1B,uCAAuC,CAAC;AAE5C;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,mCAAmC,GAC5C,OAAO,CAAC,2BAA2B,GAAG,gCAAgC,CAAC,CAoBzE;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,2BAA2B,EAAE,oBAAoB,CAAC,CAAC;AAEhG;;;GAGG;AACH,MAAM,WAAW,2BAA2B,CAAC,KAAK,SAAS,4BAA4B;IACrF;;OAEG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,OAAO,CAAC;QAAE,iBAAiB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1E;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC;CAClD;AAED;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAC/C,gCAAgC,EAChC,yBAAyB,CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gCACf,SAAQ,kBAAkB,CAAC,yBAAyB,CAAC,EAAE,uCAAuC;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"administration.js","sourceRoot":"","sources":["../../../src/lro/administration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"administration.js","sourceRoot":"","sources":["../../../src/lro/administration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AA0FlD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,QAA6C;IAE7C,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,IAAI,CAAC;QAChD,aAAa,EAAE,QAAQ,CAAC,aAAa;QACrC,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,IAAI,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC;QAChE,WAAW,EAAE,QAAQ,CAAC,MAAM,KAAK,UAAU;QAC3C,WAAW,EAAE,QAAQ,CAAC,MAAM,KAAK,WAAW;QAC5C,SAAS,EAAE,QAAQ,CAAC,MAAM,KAAK,YAAY;QAC3C,IAAI,EAAE,QAAQ,CAAC,IAAI;QAEnB,oFAAoF;QACpF,wGAAwG;QACxG,mHAAmH;QACnH,gEAAgE;QAChE,MAAM,EAAE,QAAQ,CAAC,MAAM;KAC0C,CAAC;AACtE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport type { OperationOptions } from \"@azure/core-client\";\nimport { FormRecognizerError } from \"../error.js\";\nimport type {\n DocumentModelDetails,\n OperationStatus,\n DocumentModelBuildOperationDetails,\n DocumentModelCopyToOperationDetails,\n DocumentModelComposeOperationDetails,\n DocumentClassifierDetails,\n DocumentClassifierBuildOperationDetails,\n} from \"../generated/index.js\";\nimport type { PollerOptions } from \"../options/PollerOptions.js\";\nimport type { OperationContext } from \"./util/poller.js\";\n\n/**\n * The possible types of all administration operation states.\n * @internal\n */\nexport type AdministrationOperationState =\n | DocumentModelOperationState\n | DocumentClassifierOperationState;\n\n/**\n * The set of fields common to all administration operations.\n */\nexport interface ModelAdministrationOperationStateCommon {\n /**\n * The status of the operation. One of:\n *\n * - \"notStarted\"\n * - \"running\"\n * - \"succeeded\"\n * - \"failed\"\n * - \"canceled\"\n */\n status: OperationStatus;\n\n /**\n * The API version used to train this model.\n */\n apiVersion?: string;\n\n /**\n * The unique ID of this operation.\n */\n operationId: string;\n\n /**\n * A number between 0 and 100 representing the progress of the operation.\n */\n percentCompleted: number;\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 * Additional, user-defined key-value pairs associated with the model as metadata.\n */\n tags?: Record<string, string>;\n}\n\n/**\n * The state of a model creation operation.\n */\nexport interface DocumentModelOperationState\n extends PollOperationState<DocumentModelDetails>, ModelAdministrationOperationStateCommon {}\n\n/**\n * The respones of a model creation operation.\n * @internal\n */\nexport type DocumentModelBuildResponse =\n | DocumentModelBuildOperationDetails\n | DocumentModelCopyToOperationDetails\n | DocumentModelComposeOperationDetails;\n\n/**\n * The possible responses of an administration operation.\n * @internal\n */\nexport type DocumentModelAdministrationResponse =\n | DocumentModelBuildResponse\n | DocumentClassifierBuildOperationDetails;\n\n/**\n * Convert an operation result into a training poller state.\n * @internal\n */\nexport async function toTrainingPollOperationState(\n response: DocumentModelAdministrationResponse,\n): Promise<DocumentModelOperationState | DocumentClassifierOperationState> {\n return {\n operationId: response.operationId,\n status: response.status,\n apiVersion: response.apiVersion,\n percentCompleted: response.percentCompleted ?? 0,\n lastUpdatedOn: response.lastUpdatedOn,\n createdOn: response.createdOn,\n error: response.error && new FormRecognizerError(response.error),\n isCancelled: response.status === \"canceled\",\n isCompleted: response.status === \"succeeded\",\n isStarted: response.status !== \"notStarted\",\n tags: response.tags,\n\n // The following assertion is required. Technically the type of `response.result` is\n // `DocumentModelDetails | DocumentClassifierDetails | undefined`, which isn't assignable to the type of\n // either operation state's result. We would need some kind of dependent typing to express how the type of `result`\n // actually _determines_ the type of the resulting return value.\n result: response.result,\n } as DocumentModelOperationState | DocumentClassifierOperationState;\n}\n\n/**\n * A long-running operation (poller) that tracks the state of a model creation operation, eventually producing a\n * {@link DocumentModelDetails}.\n */\nexport type DocumentModelPoller = PollerLike<DocumentModelOperationState, DocumentModelDetails>;\n\n/**\n * Defines a training operation.\n * @internal\n */\nexport interface TrainingOperationDefinition<State extends AdministrationOperationState> {\n /**\n * A function to start the operation, producing an operationLocation.\n */\n start: (ctx: OperationContext) => Promise<{ operationLocation?: string }>;\n /**\n * Options for the poller and requests.\n */\n options: PollerOptions<State> & OperationOptions;\n}\n\n/**\n * A long-running operation (poller) that tracks the state of a custom classifier creation operation, eventually\n * producing a {@link DocumentClassifierDetails}.\n */\nexport type DocumentClassifierPoller = PollerLike<\n DocumentClassifierOperationState,\n DocumentClassifierDetails\n>;\n\n/**\n * The state of a model creation operation.\n */\nexport interface DocumentClassifierOperationState\n extends PollOperationState<DocumentClassifierDetails>, ModelAdministrationOperationStateCommon {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../../../src/lro/analysis.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,KAAK,EACV,aAAa,IAAI,sBAAsB,EACvC,sBAAsB,EACtB,4BAA4B,IAAI,sBAAsB,EACtD,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAOnF,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EAElB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,QAAQ,IAAI,iBAAiB,EAC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ike } from \"@azure/core-lro\";\nimport { FormRecognizerError } from \"../error.js\";\nimport type {\n AnalyzeResult as GeneratedAnalyzeResult,\n AnalyzeResultOperation,\n AnalyzeResultOperationStatus as AnalyzeOperationStatus,\n DocumentLanguage,\n DocumentSpan,\n DocumentStyle,\n} from \"../generated/index.js\";\nimport type { DocumentField } from \"../models/fields.js\";\nimport { toAnalyzedDocumentFieldsFromGenerated } from \"../models/fields.js\";\nimport type { PollerOptions } from \"../options/index.js\";\nimport type { AnalyzeDocumentOptions } from \"../options/AnalyzeDocumentOptions.js\";\nimport {\n toBoundingPolygon,\n toBoundingRegions,\n toDocumentTableFromGenerated,\n toKeyValuePairFromGenerated,\n} from \"../transforms/polygon.js\";\nimport type {\n BoundingRegion,\n DocumentTable,\n DocumentKeyValuePair,\n DocumentPage,\n DocumentLine,\n DocumentParagraph,\n DocumentFormula,\n} from \"../models/documentElements.js\";\nimport type {\n Document as GeneratedDocument,\n DocumentPage as GeneratedDocumentPage,\n DocumentLine as GeneratedDocumentLine,\n} from \"../generated/index.js\";\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: string;\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 barcodes: generated.barcodes?.map((barcode) => ({\n ...barcode,\n polygon: toBoundingPolygon(barcode.polygon),\n })),\n formulas: generated.formulas?.map(\n (formula): DocumentFormula => ({\n ...formula,\n polygon: toBoundingPolygon(formula.polygon),\n }),\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,\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
|
+
{"version":3,"file":"analysis.js","sourceRoot":"","sources":["../../../src/lro/analysis.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAUlD,OAAO,EAAE,qCAAqC,EAAE,MAAM,qBAAqB,CAAC;AAG5E,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AA6DlC;;;;;;GAMG;AACH,MAAM,UAAU,+BAA+B,CAAC,QAA2B;IACzE,OAAO;QACL,GAAG,QAAQ;QACX,eAAe,EAAE,iBAAiB,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC5D,MAAM,EAAE,qCAAqC,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;KACrE,CAAC;AACJ,CAAC;AAgED;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAmB,EAAE,KAAmB;IAC/D,OAAO,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;AACpG,CAAC;AAED;;GAEG;AACH,QAAQ,CAAC,CAAC,KAAK;IACb,yBAAyB;AA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C/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,EAAE,gBAAgB;QACpC,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 type { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport { FormRecognizerError } from \"../error.js\";\nimport type {\n AnalyzeResult as GeneratedAnalyzeResult,\n AnalyzeResultOperation,\n AnalyzeResultOperationStatus as AnalyzeOperationStatus,\n DocumentLanguage,\n DocumentSpan,\n DocumentStyle,\n} from \"../generated/index.js\";\nimport type { DocumentField } from \"../models/fields.js\";\nimport { toAnalyzedDocumentFieldsFromGenerated } from \"../models/fields.js\";\nimport type { PollerOptions } from \"../options/index.js\";\nimport type { AnalyzeDocumentOptions } from \"../options/AnalyzeDocumentOptions.js\";\nimport {\n toBoundingPolygon,\n toBoundingRegions,\n toDocumentTableFromGenerated,\n toKeyValuePairFromGenerated,\n} from \"../transforms/polygon.js\";\nimport type {\n BoundingRegion,\n DocumentTable,\n DocumentKeyValuePair,\n DocumentPage,\n DocumentLine,\n DocumentParagraph,\n DocumentFormula,\n} from \"../models/documentElements.js\";\nimport type {\n Document as GeneratedDocument,\n DocumentPage as GeneratedDocumentPage,\n DocumentLine as GeneratedDocumentLine,\n} from \"../generated/index.js\";\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: string;\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 barcodes: generated.barcodes?.map((barcode) => ({\n ...barcode,\n polygon: toBoundingPolygon(barcode.polygon),\n })),\n formulas: generated.formulas?.map(\n (formula): DocumentFormula => ({\n ...formula,\n polygon: toBoundingPolygon(formula.polygon),\n }),\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<\n 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,\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":"fields.d.ts","sourceRoot":"","sources":["../../../src/models/fields.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,aAAa,IAAI,sBAAsB,EACxC,MA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,aAAa,CAAC;YACnB,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,SAAS,CAAC;YACf,KAAK,eAAe,CAAC;YACrB,KAAK,eAAe,CAAC;YACrB,KAAK,WAAW,CAAC;YACjB,KAAK,UAAU,CAAC;YAChB,KAAK,SAAS;gBACZ,OAAO;oBACL,KAAK,EACH,KAAK,CACH,CAAC,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAG1B,CACF;iBACJ,CAAC;YACJ,KAAK,OAAO;gBACV,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;YAC5E,KAAK,QAAQ;gBACX,OAAO,EAAE,UAAU,EAAE,qCAAqC,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,CAAC;YACxF;gBACE,uBAAuB;gBACvB,gDAAgD;gBAChD,MAAM,SAAS,GAAU,IAAI,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,oCAAoC,SAAS,EAAE,CAAC,CAAC;QACrE,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO;QACL,IAAI;QACJ,GAAG,KAAK;QACR,eAAe,EAAE,iBAAiB,CAAC,KAAK,CAAC,eAAe,CAAC;QACzD,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,UAAU,EAAE,KAAK,CAAC,UAAU;KACZ,CAAC;AACrB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { DocumentSpan } from \"../index.js\";\n\nimport type {\n AddressValue,\n CurrencyValue,\n DocumentField as GeneratedDocumentField,\n} from \"../generated/index.js\";\nimport { toBoundingRegions } from \"../transforms/polygon.js\";\nimport { capitalize } from \"../util.js\";\nimport type { BoundingRegion } from \"./documentElements.js\";\n\n/**\n * Fields that are common to all DocumentField variants.\n */\nexport interface DocumentFieldCommon {\n /**\n * The verbatim extracted text content of the field.\n */\n content?: string;\n\n /**\n * Bounding regions covering the field.\n */\n boundingRegions?: BoundingRegion[];\n\n /**\n * Confidence of correctly extracting the field.\n */\n confidence?: number;\n\n /**\n * Location of the field in the reading order concatenated content.\n */\n spans?: DocumentSpan[];\n}\n\n/**\n * A simple field that has a primitive value, such as a string, number etc.\n */\nexport interface DocumentValueField<T> extends DocumentFieldCommon {\n /**\n * The field's value, which has the type specified in the field's schema.\n */\n value?: T;\n}\n\n/**\n * An extracted field. The `kind` property identifies (discriminates) the type of the `DocumentField`.\n */\nexport type DocumentField =\n | DocumentStringField\n | DocumentDateField\n | DocumentTimeField\n | DocumentPhoneNumberField\n | DocumentNumberField\n | DocumentIntegerField\n | DocumentBooleanField\n | DocumentSelectionMarkField\n | DocumentCountryRegionField\n | DocumentSignatureField\n | DocumentCurrencyField\n | DocumentAddressField\n | DocumentArrayField\n | DocumentObjectField;\n\n/**\n * A DocumentField that has a string value.\n */\nexport interface DocumentStringField<Value extends string = string>\n extends DocumentValueField<Value> {\n /** Field kind: \"string\". */\n kind: \"string\";\n}\n\n/**\n * A DocumentField that has a Date value.\n */\nexport interface DocumentDateField extends DocumentValueField<Date> {\n /** Field kind: \"date\". */\n kind: \"date\";\n}\n\n/**\n * A DocumentField that has a time value, represented as a string.\n */\nexport interface DocumentTimeField extends DocumentFieldCommon {\n /** Field kind: \"time\". */\n kind: \"time\";\n /**\n * The field's value, which is a time in \"HH:MM:SS\" (ISO 8601) format.\n */\n value?: string;\n}\n\n/**\n * A DocumentField that has a phone number value, represented as a string.\n */\nexport interface DocumentPhoneNumberField extends DocumentFieldCommon {\n /** Field kind: \"phoneNumber\". */\n kind: \"phoneNumber\";\n /**\n * The field's value, which is a string containing the phone number.\n *\n * The phone number value is normalized to a standard format. If the value could not be normalized, this value may be\n * undefined, and the `content` property will contain the verbatim text of the DocumentField as it appeared in the\n * input.\n */\n value?: string;\n}\n\n/**\n * A DocumentField that has a number value.\n */\nexport interface DocumentNumberField extends DocumentValueField<number> {\n /** Field kind: \"number\". */\n kind: \"number\";\n}\n\n/**\n * A DocumentField that has an integer value.\n */\nexport interface DocumentIntegerField extends DocumentValueField<number> {\n /** Field kind: \"integer\". */\n kind: \"integer\";\n}\n\n/**\n * A DocumentField that is has a value indicating a selection mark state (such as a checkbox or radio button),\n * represented as a string.\n */\nexport interface DocumentSelectionMarkField extends DocumentFieldCommon {\n /** Field kind: \"selectionMark\". */\n kind: \"selectionMark\";\n /**\n * The state of the selection mark. One of:\n *\n * - \"selected\"\n * - \"unselected\"\n *\n * This value may be undefined, and other variants may be introduced in the future.\n */\n value?: string;\n}\n\n/**\n * A DocumentField that has a value indicating a country or region, represented as a string.\n */\nexport interface DocumentCountryRegionField extends DocumentFieldCommon {\n /** Field kind: \"countryRegion\". */\n kind: \"countryRegion\";\n /**\n * The 3-letter country/region code (ISO 3166-1 alpha-3) of the extracted country or region.\n */\n value?: string;\n}\n\n/**\n * A DocumentField that indicates the state of a signature, represented as a string.\n */\nexport interface DocumentSignatureField extends DocumentFieldCommon {\n /** Field kind: \"signature\". */\n kind: \"signature\";\n /**\n * The state of the signature field. One of:\n *\n * - \"unsigned\"\n * - \"signed\"\n *\n * This value may be undefined, and other variants may be introduced in the future.\n */\n value: \"signed\" | \"unsigned\";\n}\n\n/**\n * A DocumentField that consists of an array of nested fields. All fields in the array will have the same type.\n */\nexport interface DocumentArrayField<T = DocumentField> extends DocumentFieldCommon {\n /** Field kind: \"array\". */\n kind: \"array\";\n\n /**\n * The extracted members of the array field.\n */\n values: T[];\n}\n\n/**\n * A DocumentField that describes an amount of a certain currency.\n */\nexport interface DocumentCurrencyField extends DocumentFieldCommon {\n /** Field kind: \"currency\". */\n kind: \"currency\";\n\n /**\n * The properties of the extracted currency.\n */\n value?: CurrencyValue;\n}\n\n/**\n * A document field that describes a structured physical address.\n */\nexport interface DocumentAddressField extends DocumentFieldCommon {\n /** Field kind: \"address\". */\n kind: \"address\";\n\n /**\n * The properties of the extracted address.\n */\n value?: AddressValue;\n}\n\n/**\n * A DocumentField that has a boolean value.\n */\nexport interface DocumentBooleanField extends DocumentValueField<boolean> {\n /** Field kind: \"boolean\". */\n kind: \"boolean\";\n}\n\n/**\n * A DocumentField that consists of several named properties that have their own DocumentField values.\n */\nexport interface DocumentObjectField<Properties = { [k: string]: DocumentField | undefined }>\n extends DocumentFieldCommon {\n /** Field kind: \"object\". */\n kind: \"object\";\n\n /**\n * The extracted object properties. Each property of this object is, itself, a nested DocumentField.\n */\n properties: Properties;\n}\n\n/**\n * Convert a record of generated fields to a record of strongly-typed fields.\n * @internal\n * @param fields - a map of field names to generated field values\n * @returns - an object with the same keys, where all values have been mapped to DocumentFields\n */\nexport function toAnalyzedDocumentFieldsFromGenerated(fields: {\n [k: string]: GeneratedDocumentField;\n}): { [k: string]: DocumentField } {\n return Object.entries(fields ?? {}).reduce(\n (transformedFields, [name, value]) => {\n transformedFields[name] = toDocumentField(value);\n return transformedFields;\n },\n {} as { [k: string]: DocumentField },\n );\n}\n\n/**\n * Convert a generated document field into a strong TypeScriptified document field.\n * @internal\n */\nexport function toDocumentField(field: GeneratedDocumentField): DocumentField {\n const kind = field.type as DocumentField[\"kind\"];\n\n const value: Omit<DocumentField, keyof DocumentFieldCommon | \"kind\"> = (() => {\n switch (kind) {\n // Almost all value kinds are represented as simple elemental values\n case \"string\":\n case \"date\":\n case \"time\":\n case \"phoneNumber\":\n case \"number\":\n case \"boolean\":\n case \"integer\":\n case \"selectionMark\":\n case \"countryRegion\":\n case \"signature\":\n case \"currency\":\n case \"address\":\n return {\n value:\n field[\n (\"value\" + capitalize(kind)) as Extract<\n keyof GeneratedDocumentField,\n `value${string}`\n >\n ],\n };\n case \"array\":\n return { values: field.valueArray?.map((v) => toDocumentField(v) ?? []) };\n case \"object\":\n return { properties: toAnalyzedDocumentFieldsFromGenerated(field.valueObject ?? {}) };\n default:\n // Exhaustiveness check\n // eslint-disable-next-line no-case-declarations\n const __exhaust: never = kind;\n throw new Error(`Unrecognized DocumentField type: ${__exhaust}`);\n }\n })();\n\n return {\n kind,\n ...value,\n boundingRegions: toBoundingRegions(field.boundingRegions),\n content: field.content,\n spans: field.spans,\n confidence: field.confidence,\n } as DocumentField;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../src/models/fields.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAoOxC;;;;;GAKG;AACH,MAAM,UAAU,qCAAqC,CAAC,MAErD;IACC,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CACxC,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;QACnC,iBAAiB,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;QACjD,OAAO,iBAAiB,CAAC;IAC3B,CAAC,EACD,EAAoC,CACrC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAA6B;IAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,IAA6B,CAAC;IAEjD,MAAM,KAAK,GAA4D,CAAC,GAAG,EAAE;QAC3E,QAAQ,IAAI,EAAE,CAAC;YACb,oEAAoE;YACpE,KAAK,QAAQ,CAAC;YACd,KAAK,MAAM,CAAC;YACZ,KAAK,MAAM,CAAC;YACZ,KAAK,aAAa,CAAC;YACnB,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,SAAS,CAAC;YACf,KAAK,eAAe,CAAC;YACrB,KAAK,eAAe,CAAC;YACrB,KAAK,WAAW,CAAC;YACjB,KAAK,UAAU,CAAC;YAChB,KAAK,SAAS;gBACZ,OAAO;oBACL,KAAK,EACH,KAAK,CACH,CAAC,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAG1B,CACF;iBACJ,CAAC;YACJ,KAAK,OAAO;gBACV,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;YAC5E,KAAK,QAAQ;gBACX,OAAO,EAAE,UAAU,EAAE,qCAAqC,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,CAAC;YACxF;gBACE,uBAAuB;gBACvB,gDAAgD;gBAChD,MAAM,SAAS,GAAU,IAAI,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,oCAAoC,SAAS,EAAE,CAAC,CAAC;QACrE,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO;QACL,IAAI;QACJ,GAAG,KAAK;QACR,eAAe,EAAE,iBAAiB,CAAC,KAAK,CAAC,eAAe,CAAC;QACzD,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,UAAU,EAAE,KAAK,CAAC,UAAU;KACZ,CAAC;AACrB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { DocumentSpan } from \"../index.js\";\n\nimport type {\n AddressValue,\n CurrencyValue,\n DocumentField as GeneratedDocumentField,\n} from \"../generated/index.js\";\nimport { toBoundingRegions } from \"../transforms/polygon.js\";\nimport { capitalize } from \"../util.js\";\nimport type { BoundingRegion } from \"./documentElements.js\";\n\n/**\n * Fields that are common to all DocumentField variants.\n */\nexport interface DocumentFieldCommon {\n /**\n * The verbatim extracted text content of the field.\n */\n content?: string;\n\n /**\n * Bounding regions covering the field.\n */\n boundingRegions?: BoundingRegion[];\n\n /**\n * Confidence of correctly extracting the field.\n */\n confidence?: number;\n\n /**\n * Location of the field in the reading order concatenated content.\n */\n spans?: DocumentSpan[];\n}\n\n/**\n * A simple field that has a primitive value, such as a string, number etc.\n */\nexport interface DocumentValueField<T> extends DocumentFieldCommon {\n /**\n * The field's value, which has the type specified in the field's schema.\n */\n value?: T;\n}\n\n/**\n * An extracted field. The `kind` property identifies (discriminates) the type of the `DocumentField`.\n */\nexport type DocumentField =\n | DocumentStringField\n | DocumentDateField\n | DocumentTimeField\n | DocumentPhoneNumberField\n | DocumentNumberField\n | DocumentIntegerField\n | DocumentBooleanField\n | DocumentSelectionMarkField\n | DocumentCountryRegionField\n | DocumentSignatureField\n | DocumentCurrencyField\n | DocumentAddressField\n | DocumentArrayField\n | DocumentObjectField;\n\n/**\n * A DocumentField that has a string value.\n */\nexport interface DocumentStringField<\n Value extends string = string,\n> extends DocumentValueField<Value> {\n /** Field kind: \"string\". */\n kind: \"string\";\n}\n\n/**\n * A DocumentField that has a Date value.\n */\nexport interface DocumentDateField extends DocumentValueField<Date> {\n /** Field kind: \"date\". */\n kind: \"date\";\n}\n\n/**\n * A DocumentField that has a time value, represented as a string.\n */\nexport interface DocumentTimeField extends DocumentFieldCommon {\n /** Field kind: \"time\". */\n kind: \"time\";\n /**\n * The field's value, which is a time in \"HH:MM:SS\" (ISO 8601) format.\n */\n value?: string;\n}\n\n/**\n * A DocumentField that has a phone number value, represented as a string.\n */\nexport interface DocumentPhoneNumberField extends DocumentFieldCommon {\n /** Field kind: \"phoneNumber\". */\n kind: \"phoneNumber\";\n /**\n * The field's value, which is a string containing the phone number.\n *\n * The phone number value is normalized to a standard format. If the value could not be normalized, this value may be\n * undefined, and the `content` property will contain the verbatim text of the DocumentField as it appeared in the\n * input.\n */\n value?: string;\n}\n\n/**\n * A DocumentField that has a number value.\n */\nexport interface DocumentNumberField extends DocumentValueField<number> {\n /** Field kind: \"number\". */\n kind: \"number\";\n}\n\n/**\n * A DocumentField that has an integer value.\n */\nexport interface DocumentIntegerField extends DocumentValueField<number> {\n /** Field kind: \"integer\". */\n kind: \"integer\";\n}\n\n/**\n * A DocumentField that is has a value indicating a selection mark state (such as a checkbox or radio button),\n * represented as a string.\n */\nexport interface DocumentSelectionMarkField extends DocumentFieldCommon {\n /** Field kind: \"selectionMark\". */\n kind: \"selectionMark\";\n /**\n * The state of the selection mark. One of:\n *\n * - \"selected\"\n * - \"unselected\"\n *\n * This value may be undefined, and other variants may be introduced in the future.\n */\n value?: string;\n}\n\n/**\n * A DocumentField that has a value indicating a country or region, represented as a string.\n */\nexport interface DocumentCountryRegionField extends DocumentFieldCommon {\n /** Field kind: \"countryRegion\". */\n kind: \"countryRegion\";\n /**\n * The 3-letter country/region code (ISO 3166-1 alpha-3) of the extracted country or region.\n */\n value?: string;\n}\n\n/**\n * A DocumentField that indicates the state of a signature, represented as a string.\n */\nexport interface DocumentSignatureField extends DocumentFieldCommon {\n /** Field kind: \"signature\". */\n kind: \"signature\";\n /**\n * The state of the signature field. One of:\n *\n * - \"unsigned\"\n * - \"signed\"\n *\n * This value may be undefined, and other variants may be introduced in the future.\n */\n value: \"signed\" | \"unsigned\";\n}\n\n/**\n * A DocumentField that consists of an array of nested fields. All fields in the array will have the same type.\n */\nexport interface DocumentArrayField<T = DocumentField> extends DocumentFieldCommon {\n /** Field kind: \"array\". */\n kind: \"array\";\n\n /**\n * The extracted members of the array field.\n */\n values: T[];\n}\n\n/**\n * A DocumentField that describes an amount of a certain currency.\n */\nexport interface DocumentCurrencyField extends DocumentFieldCommon {\n /** Field kind: \"currency\". */\n kind: \"currency\";\n\n /**\n * The properties of the extracted currency.\n */\n value?: CurrencyValue;\n}\n\n/**\n * A document field that describes a structured physical address.\n */\nexport interface DocumentAddressField extends DocumentFieldCommon {\n /** Field kind: \"address\". */\n kind: \"address\";\n\n /**\n * The properties of the extracted address.\n */\n value?: AddressValue;\n}\n\n/**\n * A DocumentField that has a boolean value.\n */\nexport interface DocumentBooleanField extends DocumentValueField<boolean> {\n /** Field kind: \"boolean\". */\n kind: \"boolean\";\n}\n\n/**\n * A DocumentField that consists of several named properties that have their own DocumentField values.\n */\nexport interface DocumentObjectField<\n Properties = { [k: string]: DocumentField | undefined },\n> extends DocumentFieldCommon {\n /** Field kind: \"object\". */\n kind: \"object\";\n\n /**\n * The extracted object properties. Each property of this object is, itself, a nested DocumentField.\n */\n properties: Properties;\n}\n\n/**\n * Convert a record of generated fields to a record of strongly-typed fields.\n * @internal\n * @param fields - a map of field names to generated field values\n * @returns - an object with the same keys, where all values have been mapped to DocumentFields\n */\nexport function toAnalyzedDocumentFieldsFromGenerated(fields: {\n [k: string]: GeneratedDocumentField;\n}): { [k: string]: DocumentField } {\n return Object.entries(fields ?? {}).reduce(\n (transformedFields, [name, value]) => {\n transformedFields[name] = toDocumentField(value);\n return transformedFields;\n },\n {} as { [k: string]: DocumentField },\n );\n}\n\n/**\n * Convert a generated document field into a strong TypeScriptified document field.\n * @internal\n */\nexport function toDocumentField(field: GeneratedDocumentField): DocumentField {\n const kind = field.type as DocumentField[\"kind\"];\n\n const value: Omit<DocumentField, keyof DocumentFieldCommon | \"kind\"> = (() => {\n switch (kind) {\n // Almost all value kinds are represented as simple elemental values\n case \"string\":\n case \"date\":\n case \"time\":\n case \"phoneNumber\":\n case \"number\":\n case \"boolean\":\n case \"integer\":\n case \"selectionMark\":\n case \"countryRegion\":\n case \"signature\":\n case \"currency\":\n case \"address\":\n return {\n value:\n field[\n (\"value\" + capitalize(kind)) as Extract<\n keyof GeneratedDocumentField,\n `value${string}`\n >\n ],\n };\n case \"array\":\n return { values: field.valueArray?.map((v) => toDocumentField(v) ?? []) };\n case \"object\":\n return { properties: toAnalyzedDocumentFieldsFromGenerated(field.valueObject ?? {}) };\n default:\n // Exhaustiveness check\n // eslint-disable-next-line no-case-declarations\n const __exhaust: never = kind;\n throw new Error(`Unrecognized DocumentField type: ${__exhaust}`);\n }\n })();\n\n return {\n kind,\n ...value,\n boundingRegions: toBoundingRegions(field.boundingRegions),\n content: field.content,\n spans: field.spans,\n confidence: field.confidence,\n } as DocumentField;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyzeDocumentOptions.d.ts","sourceRoot":"","sources":["../../../src/options/AnalyzeDocumentOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,kCAAkC,EACnC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAC7B,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,GAClE,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;GAEG;AAEH,eAAO,MAAM,qBAAqB;IAChC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEK,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,MAAM,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAC9E,SAAQ,gBAAgB,
|
|
1
|
+
{"version":3,"file":"AnalyzeDocumentOptions.d.ts","sourceRoot":"","sources":["../../../src/options/AnalyzeDocumentOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,kCAAkC,EACnC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAC7B,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,GAClE,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;GAEG;AAEH,eAAO,MAAM,qBAAqB;IAChC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEK,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,MAAM,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAC9E,SAAQ,gBAAgB,EAAE,aAAa,CAAC,kCAAkC,CAAC,MAAM,CAAC,CAAC;IACnF;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyzeDocumentOptions.js","sourceRoot":"","sources":["../../../src/options/AnalyzeDocumentOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAqBlC;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC;;OAEG;IACH,KAAK,EAAE,WAAW;IAElB;;OAEG;IACH,iBAAiB,EAAE,mBAAmB;IAEtC;;OAEG;IACH,QAAQ,EAAE,UAAU;IAEpB;;OAEG;IACH,SAAS,EAAE,WAAW;IAEtB;;OAEG;IACH,QAAQ,EAAE,UAAU;IAEpB;;OAEG;IACH,aAAa,EAAE,eAAe;CACtB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type {\n AnalyzeResult,\n AnalyzedDocument,\n DocumentAnalysisPollOperationState,\n} from \"../lro/analysis.js\";\nimport type { PollerOptions } from \"./PollerOptions.js\";\n\n/**\n * Add-on capabilities (features) that can be enabled for the request.\n *\n * For more information about the features available in Form Recognizer, see the service documentation:\n *\n * https://aka.ms/azsdk/formrecognizer/features\n */\nexport type FormRecognizerFeature =\n | (typeof FormRecognizerFeature)[keyof typeof FormRecognizerFeature]\n | (string & {});\n\n/**\n * Known feature flags supported by the Form Recognizer clients.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const FormRecognizerFeature = {\n /**\n * Enables extracting extra font information.\n */\n Fonts: \"styleFont\",\n\n /**\n * Enables high-resolution processing for documents with small text.\n */\n OcrHighResolution: \"ocrHighResolution\",\n\n /**\n * Enables the detection of mathematical expressions in the document..\n */\n Formulas: \"formulas\",\n\n /**\n * Enables the detection of the text content language.\n */\n Languages: \"languages\",\n\n /**\n * Enables the detection of barcodes in the document.\n */\n Barcodes: \"barcodes\",\n\n /**\n * Enables the detection of general key value pairs (form fields) in the document.\n */\n KeyValuePairs: \"keyValuePairs\",\n} as const;\n\n/**\n * Options for the document analysis operation.\n */\nexport interface AnalyzeDocumentOptions<Result = AnalyzeResult<AnalyzedDocument>>\n extends OperationOptions
|
|
1
|
+
{"version":3,"file":"AnalyzeDocumentOptions.js","sourceRoot":"","sources":["../../../src/options/AnalyzeDocumentOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAqBlC;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC;;OAEG;IACH,KAAK,EAAE,WAAW;IAElB;;OAEG;IACH,iBAAiB,EAAE,mBAAmB;IAEtC;;OAEG;IACH,QAAQ,EAAE,UAAU;IAEpB;;OAEG;IACH,SAAS,EAAE,WAAW;IAEtB;;OAEG;IACH,QAAQ,EAAE,UAAU;IAEpB;;OAEG;IACH,aAAa,EAAE,eAAe;CACtB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type {\n AnalyzeResult,\n AnalyzedDocument,\n DocumentAnalysisPollOperationState,\n} from \"../lro/analysis.js\";\nimport type { PollerOptions } from \"./PollerOptions.js\";\n\n/**\n * Add-on capabilities (features) that can be enabled for the request.\n *\n * For more information about the features available in Form Recognizer, see the service documentation:\n *\n * https://aka.ms/azsdk/formrecognizer/features\n */\nexport type FormRecognizerFeature =\n | (typeof FormRecognizerFeature)[keyof typeof FormRecognizerFeature]\n | (string & {});\n\n/**\n * Known feature flags supported by the Form Recognizer clients.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const FormRecognizerFeature = {\n /**\n * Enables extracting extra font information.\n */\n Fonts: \"styleFont\",\n\n /**\n * Enables high-resolution processing for documents with small text.\n */\n OcrHighResolution: \"ocrHighResolution\",\n\n /**\n * Enables the detection of mathematical expressions in the document..\n */\n Formulas: \"formulas\",\n\n /**\n * Enables the detection of the text content language.\n */\n Languages: \"languages\",\n\n /**\n * Enables the detection of barcodes in the document.\n */\n Barcodes: \"barcodes\",\n\n /**\n * Enables the detection of general key value pairs (form fields) in the document.\n */\n KeyValuePairs: \"keyValuePairs\",\n} as const;\n\n/**\n * Options for the document analysis operation.\n */\nexport interface AnalyzeDocumentOptions<Result = AnalyzeResult<AnalyzedDocument>>\n extends OperationOptions, PollerOptions<DocumentAnalysisPollOperationState<Result>> {\n /**\n * Locale hint for text recognition and document analysis.\n *\n * The value may specify only the two-letter language code or a BCP-47 language tag indicating both language and region.\n *\n * Examples:\n * - \"en-US\" (US English)\n * - \"fr\" (French - no region)\n */\n locale?: string;\n /**\n * A list of page ranges (1-indexed) within the input document to analyze, separated by commas\n *\n * Examples: \"1\", \"3-5\", \"1,3-5\"\n */\n pages?: string;\n\n /**\n * A list of features to enable in the model. Enabling features may incur additional costs, so be sure to consult the\n * service documentation to understand the nature of the features and any added costs associated with using them.\n *\n * For more information about the features available in Form Recognizer, see the service documentation: https://aka.ms/azsdk/formrecognizer/features\n */\n features?: FormRecognizerFeature[];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BeginCopyModelOptions.d.ts","sourceRoot":"","sources":["../../../src/options/BeginCopyModelOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,qBACf,SAAQ,gBAAgB,
|
|
1
|
+
{"version":3,"file":"BeginCopyModelOptions.d.ts","sourceRoot":"","sources":["../../../src/options/BeginCopyModelOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,qBACf,SAAQ,gBAAgB,EAAE,aAAa,CAAC,2BAA2B,CAAC;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BeginCopyModelOptions.js","sourceRoot":"","sources":["../../../src/options/BeginCopyModelOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { DocumentModelOperationState } from \"../lro/administration.js\";\nimport type { PollerOptions } from \"./PollerOptions.js\";\n\n/**\n * Options for the copy model operation.\n */\nexport interface BeginCopyModelOptions\n extends OperationOptions
|
|
1
|
+
{"version":3,"file":"BeginCopyModelOptions.js","sourceRoot":"","sources":["../../../src/options/BeginCopyModelOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { DocumentModelOperationState } from \"../lro/administration.js\";\nimport type { PollerOptions } from \"./PollerOptions.js\";\n\n/**\n * Options for the copy model operation.\n */\nexport interface BeginCopyModelOptions\n extends OperationOptions, PollerOptions<DocumentModelOperationState> {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildDocumentClassifierOptions.d.ts","sourceRoot":"","sources":["../../../src/options/BuildDocumentClassifierOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,mCACf,SAAQ,gBAAgB,
|
|
1
|
+
{"version":3,"file":"BuildDocumentClassifierOptions.d.ts","sourceRoot":"","sources":["../../../src/options/BuildDocumentClassifierOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,mCACf,SAAQ,gBAAgB,EAAE,aAAa,CAAC,gCAAgC,CAAC;IACzE;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildDocumentClassifierOptions.js","sourceRoot":"","sources":["../../../src/options/BuildDocumentClassifierOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { DocumentClassifierOperationState } from \"../lro/administration.js\";\nimport type { PollerOptions } from \"./PollerOptions.js\";\n\n/**\n * Options for the document classifier build operation.\n */\nexport interface BeginBuildDocumentClassifierOptions\n extends OperationOptions
|
|
1
|
+
{"version":3,"file":"BuildDocumentClassifierOptions.js","sourceRoot":"","sources":["../../../src/options/BuildDocumentClassifierOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { DocumentClassifierOperationState } from \"../lro/administration.js\";\nimport type { PollerOptions } from \"./PollerOptions.js\";\n\n/**\n * Options for the document classifier build operation.\n */\nexport interface BeginBuildDocumentClassifierOptions\n extends OperationOptions, PollerOptions<DocumentClassifierOperationState> {\n /**\n * A textual description of the classifier (can be any text).\n */\n description?: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildModelOptions.d.ts","sourceRoot":"","sources":["../../../src/options/BuildModelOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC;AAEvE;;GAEG;AAEH,eAAO,MAAM,sBAAsB;IACjC;;;OAGG;;IAEH;;;OAGG;;CAEK,CAAC;AAEX;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,0BACf,
|
|
1
|
+
{"version":3,"file":"BuildModelOptions.d.ts","sourceRoot":"","sources":["../../../src/options/BuildModelOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC;AAEvE;;GAEG;AAEH,eAAO,MAAM,sBAAsB;IACjC;;;OAGG;;IAEH;;;OAGG;;CAEK,CAAC;AAEX;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,0BACf,SACE,gBAAgB,EAChB,0BAA0B,EAC1B,aAAa,CAAC,2BAA2B,CAAC;CAAG;AAEjD;;GAEG;AACH,MAAM,WAAW,8BAA+B,SAAQ,0BAA0B;CAAG;AAErF;;GAEG;AACH,MAAM,WAAW,gCAAiC,SAAQ,0BAA0B;CAAG"}
|
|
@@ -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 type { OperationOptions } from \"@azure/core-client\";\nimport type { DocumentModelOperationState } from \"../lro/administration.js\";\nimport type { PollerOptions } from \"./PollerOptions.js\";\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
|
|
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 type { OperationOptions } from \"@azure/core-client\";\nimport type { DocumentModelOperationState } from \"../lro/administration.js\";\nimport type { PollerOptions } from \"./PollerOptions.js\";\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\n 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":"ClassifyDocumentOptions.d.ts","sourceRoot":"","sources":["../../../src/options/ClassifyDocumentOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,uBACf,SAAQ,gBAAgB,
|
|
1
|
+
{"version":3,"file":"ClassifyDocumentOptions.d.ts","sourceRoot":"","sources":["../../../src/options/ClassifyDocumentOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,uBACf,SAAQ,gBAAgB,EAAE,aAAa,CAAC,kCAAkC,CAAC;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClassifyDocumentOptions.js","sourceRoot":"","sources":["../../../src/options/ClassifyDocumentOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { DocumentAnalysisPollOperationState } from \"../lro/analysis.js\";\nimport type { PollerOptions } from \"./PollerOptions.js\";\n\n/**\n * Options for the document classification operation.\n */\nexport interface ClassifyDocumentOptions\n extends OperationOptions
|
|
1
|
+
{"version":3,"file":"ClassifyDocumentOptions.js","sourceRoot":"","sources":["../../../src/options/ClassifyDocumentOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { DocumentAnalysisPollOperationState } from \"../lro/analysis.js\";\nimport type { PollerOptions } from \"./PollerOptions.js\";\n\n/**\n * Options for the document classification operation.\n */\nexport interface ClassifyDocumentOptions\n extends OperationOptions, PollerOptions<DocumentAnalysisPollOperationState> {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PollerOptions.d.ts","sourceRoot":"","sources":["../../../src/options/PollerOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,aAAa,
|
|
1
|
+
{"version":3,"file":"PollerOptions.d.ts","sourceRoot":"","sources":["../../../src/options/PollerOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,aAAa,CAC5B,MAAM,SAAS,kBAAkB,CAAC,OAAO,CAAC,CAC1C,SAAQ,gBAAgB;IACxB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PollerOptions.js","sourceRoot":"","sources":["../../../src/options/PollerOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { PollOperationState } from \"@azure/core-lro\";\n\n/**\n * Options for long-running operations (pollers) in the Form Recognizer clients.\n */\nexport interface PollerOptions
|
|
1
|
+
{"version":3,"file":"PollerOptions.js","sourceRoot":"","sources":["../../../src/options/PollerOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { PollOperationState } from \"@azure/core-lro\";\n\n/**\n * Options for long-running operations (pollers) in the Form Recognizer clients.\n */\nexport interface PollerOptions<\n TState extends PollOperationState<unknown>,\n> extends OperationOptions {\n /**\n * The amount of time to wait (in milliseconds) between subsequent requests relating to the same operation.\n */\n updateIntervalInMs?: number;\n /**\n * A serialized poller state. If provided, the polling operation will be resumed from the given state instead of\n * started as if it were a new operation.\n */\n resumeFrom?: string;\n /**\n * An optional initial progress handler that will be called when the poller state updates. This handler will be called\n * once immediately after the poller state is initialized.\n */\n onProgress?: (state: TState) => void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"administration.d.ts","sourceRoot":"","sources":["../../../src/lro/administration.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EACf,kCAAkC,EAClC,mCAAmC,EACnC,oCAAoC,EACpC,yBAAyB,EACzB,uCAAuC,EACxC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GACpC,2BAA2B,GAC3B,gCAAgC,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,uCAAuC;IACtD;;;;;;;;OAQG;IACH,MAAM,EAAE,eAAe,CAAC;IAExB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEp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AED;;GAEG;AACH,MAAM,WAAW,2BACf,SAAQ,kBAAkB,CAAC,oBAAoB,CAAC,EAAE,uCAAuC;CAAG;AAE9F;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAClC,kCAAkC,GAClC,mCAAmC,GACnC,oCAAoC,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,mCAAmC,GAC3C,0BAA0B,GAC1B,uCAAuC,CAAC;AAE5C;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,mCAAmC,GAC5C,OAAO,CAAC,2BAA2B,GAAG,gCAAgC,CAAC,CAoBzE;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,2BAA2B,EAAE,oBAAoB,CAAC,CAAC;AAEhG;;;GAGG;AACH,MAAM,WAAW,2BAA2B,CAAC,KAAK,SAAS,4BAA4B;IACrF;;OAEG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,OAAO,CAAC;QAAE,iBAAiB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1E;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC;CAClD;AAED;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAC/C,gCAAgC,EAChC,yBAAyB,CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gCACf,SAAQ,kBAAkB,CAAC,yBAAyB,CAAC,EAAE,uCAAuC;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"administration.js","sourceRoot":"","sources":["../../../src/lro/administration.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;
|
|
1
|
+
{"version":3,"file":"administration.js","sourceRoot":"","sources":["../../../src/lro/administration.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAkGlC,oEAsBC;AApHD,0CAAkD;AA0FlD;;;GAGG;AACI,KAAK,UAAU,4BAA4B,CAChD,QAA6C;IAE7C,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,IAAI,CAAC;QAChD,aAAa,EAAE,QAAQ,CAAC,aAAa;QACrC,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,IAAI,8BAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC;QAChE,WAAW,EAAE,QAAQ,CAAC,MAAM,KAAK,UAAU;QAC3C,WAAW,EAAE,QAAQ,CAAC,MAAM,KAAK,WAAW;QAC5C,SAAS,EAAE,QAAQ,CAAC,MAAM,KAAK,YAAY;QAC3C,IAAI,EAAE,QAAQ,CAAC,IAAI;QAEnB,oFAAoF;QACpF,wGAAwG;QACxG,mHAAmH;QACnH,gEAAgE;QAChE,MAAM,EAAE,QAAQ,CAAC,MAAM;KAC0C,CAAC;AACtE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport type { OperationOptions } from \"@azure/core-client\";\nimport { FormRecognizerError } from \"../error.js\";\nimport type {\n DocumentModelDetails,\n OperationStatus,\n DocumentModelBuildOperationDetails,\n DocumentModelCopyToOperationDetails,\n DocumentModelComposeOperationDetails,\n DocumentClassifierDetails,\n DocumentClassifierBuildOperationDetails,\n} from \"../generated/index.js\";\nimport type { PollerOptions } from \"../options/PollerOptions.js\";\nimport type { OperationContext } from \"./util/poller.js\";\n\n/**\n * The possible types of all administration operation states.\n * @internal\n */\nexport type AdministrationOperationState =\n | DocumentModelOperationState\n | DocumentClassifierOperationState;\n\n/**\n * The set of fields common to all administration operations.\n */\nexport interface ModelAdministrationOperationStateCommon {\n /**\n * The status of the operation. One of:\n *\n * - \"notStarted\"\n * - \"running\"\n * - \"succeeded\"\n * - \"failed\"\n * - \"canceled\"\n */\n status: OperationStatus;\n\n /**\n * The API version used to train this model.\n */\n apiVersion?: string;\n\n /**\n * The unique ID of this operation.\n */\n operationId: string;\n\n /**\n * A number between 0 and 100 representing the progress of the operation.\n */\n percentCompleted: number;\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 * Additional, user-defined key-value pairs associated with the model as metadata.\n */\n tags?: Record<string, string>;\n}\n\n/**\n * The state of a model creation operation.\n */\nexport interface DocumentModelOperationState\n extends PollOperationState<DocumentModelDetails>, ModelAdministrationOperationStateCommon {}\n\n/**\n * The respones of a model creation operation.\n * @internal\n */\nexport type DocumentModelBuildResponse =\n | DocumentModelBuildOperationDetails\n | DocumentModelCopyToOperationDetails\n | DocumentModelComposeOperationDetails;\n\n/**\n * The possible responses of an administration operation.\n * @internal\n */\nexport type DocumentModelAdministrationResponse =\n | DocumentModelBuildResponse\n | DocumentClassifierBuildOperationDetails;\n\n/**\n * Convert an operation result into a training poller state.\n * @internal\n */\nexport async function toTrainingPollOperationState(\n response: DocumentModelAdministrationResponse,\n): Promise<DocumentModelOperationState | DocumentClassifierOperationState> {\n return {\n operationId: response.operationId,\n status: response.status,\n apiVersion: response.apiVersion,\n percentCompleted: response.percentCompleted ?? 0,\n lastUpdatedOn: response.lastUpdatedOn,\n createdOn: response.createdOn,\n error: response.error && new FormRecognizerError(response.error),\n isCancelled: response.status === \"canceled\",\n isCompleted: response.status === \"succeeded\",\n isStarted: response.status !== \"notStarted\",\n tags: response.tags,\n\n // The following assertion is required. Technically the type of `response.result` is\n // `DocumentModelDetails | DocumentClassifierDetails | undefined`, which isn't assignable to the type of\n // either operation state's result. We would need some kind of dependent typing to express how the type of `result`\n // actually _determines_ the type of the resulting return value.\n result: response.result,\n } as DocumentModelOperationState | DocumentClassifierOperationState;\n}\n\n/**\n * A long-running operation (poller) that tracks the state of a model creation operation, eventually producing a\n * {@link DocumentModelDetails}.\n */\nexport type DocumentModelPoller = PollerLike<DocumentModelOperationState, DocumentModelDetails>;\n\n/**\n * Defines a training operation.\n * @internal\n */\nexport interface TrainingOperationDefinition<State extends AdministrationOperationState> {\n /**\n * A function to start the operation, producing an operationLocation.\n */\n start: (ctx: OperationContext) => Promise<{ operationLocation?: string }>;\n /**\n * Options for the poller and requests.\n */\n options: PollerOptions<State> & OperationOptions;\n}\n\n/**\n * A long-running operation (poller) that tracks the state of a custom classifier creation operation, eventually\n * producing a {@link DocumentClassifierDetails}.\n */\nexport type DocumentClassifierPoller = PollerLike<\n DocumentClassifierOperationState,\n DocumentClassifierDetails\n>;\n\n/**\n * The state of a model creation operation.\n */\nexport interface DocumentClassifierOperationState\n extends PollOperationState<DocumentClassifierDetails>, ModelAdministrationOperationStateCommon {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../../../src/lro/analysis.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,KAAK,EACV,aAAa,IAAI,sBAAsB,EACvC,sBAAsB,EACtB,4BAA4B,IAAI,sBAAsB,EACtD,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAOnF,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EAElB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,QAAQ,IAAI,iBAAiB,EAC7B,YAA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AAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,yCAA4B,EAAC,KAAK,CAAC,CAAC;QAC1E,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,wCAA2B,EAAC,IAAI,CAAC,CAAC;QACrF,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC5C,GAAG,IAAI;YACP,eAAe,EAAE,IAAA,8BAAiB,EAAC,IAAI,CAAC,eAAe,CAAC;SACzD,CAAC,CAAC;QACH,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,+BAA+B,CAAC;KAClE,CAAC;AACJ,CAAC;AAeD;;;GAGG;AACH,SAAgB,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,8BAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC;QAChE,WAAW,EAAE,KAAK,EAAE,gBAAgB;QACpC,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 type { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport { FormRecognizerError } from \"../error.js\";\nimport type {\n AnalyzeResult as GeneratedAnalyzeResult,\n AnalyzeResultOperation,\n AnalyzeResultOperationStatus as AnalyzeOperationStatus,\n DocumentLanguage,\n DocumentSpan,\n DocumentStyle,\n} from \"../generated/index.js\";\nimport type { DocumentField } from \"../models/fields.js\";\nimport { toAnalyzedDocumentFieldsFromGenerated } from \"../models/fields.js\";\nimport type { PollerOptions } from \"../options/index.js\";\nimport type { AnalyzeDocumentOptions } from \"../options/AnalyzeDocumentOptions.js\";\nimport {\n toBoundingPolygon,\n toBoundingRegions,\n toDocumentTableFromGenerated,\n toKeyValuePairFromGenerated,\n} from \"../transforms/polygon.js\";\nimport type {\n BoundingRegion,\n DocumentTable,\n DocumentKeyValuePair,\n DocumentPage,\n DocumentLine,\n DocumentParagraph,\n DocumentFormula,\n} from \"../models/documentElements.js\";\nimport type {\n Document as GeneratedDocument,\n DocumentPage as GeneratedDocumentPage,\n DocumentLine as GeneratedDocumentLine,\n} from \"../generated/index.js\";\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: string;\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 barcodes: generated.barcodes?.map((barcode) => ({\n ...barcode,\n polygon: toBoundingPolygon(barcode.polygon),\n })),\n formulas: generated.formulas?.map(\n (formula): DocumentFormula => ({\n ...formula,\n polygon: toBoundingPolygon(formula.polygon),\n }),\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,\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
|
+
{"version":3,"file":"analysis.js","sourceRoot":"","sources":["../../../src/lro/analysis.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAyFlC,0EAMC;AA0ED,4BAEC;AAeD,4BAMC;AAED,kEAmBC;AAED,kEAuBC;AAcD,gFA6BC;AAaD,0CA2BC;AAoDD,oEAgBC;AAmBD,oFAkBC;AAvaD,0CAAkD;AAUlD,mDAA4E;AAG5E,yDAKkC;AA6DlC;;;;;;GAMG;AACH,SAAgB,+BAA+B,CAAC,QAA2B;IACzE,OAAO;QACL,GAAG,QAAQ;QACX,eAAe,EAAE,IAAA,8BAAiB,EAAC,QAAQ,CAAC,eAAe,CAAC;QAC5D,MAAM,EAAE,IAAA,iDAAqC,EAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;KACrE,CAAC;AACJ,CAAC;AAgED;;;;;;;;;GASG;AACH,SAAgB,QAAQ,CAAC,KAAmB,EAAE,KAAmB;IAC/D,OAAO,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;AACpG,CAAC;AAED;;GAEG;AACH,QAAQ,CAAC,CAAC,KAAK;IACb,yBAAyB;AAC3B,CAAC;AAED;;;;;GAKG;AACH,QAAe,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AyB,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,8BAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC;QAChE,WAAW,EAAE,KAAK,EAAE,gBAAgB;QACpC,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 type { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport { FormRecognizerError } from \"../error.js\";\nimport type {\n AnalyzeResult as GeneratedAnalyzeResult,\n AnalyzeResultOperation,\n AnalyzeResultOperationStatus as AnalyzeOperationStatus,\n DocumentLanguage,\n DocumentSpan,\n DocumentStyle,\n} from \"../generated/index.js\";\nimport type { DocumentField } from \"../models/fields.js\";\nimport { toAnalyzedDocumentFieldsFromGenerated } from \"../models/fields.js\";\nimport type { PollerOptions } from \"../options/index.js\";\nimport type { AnalyzeDocumentOptions } from \"../options/AnalyzeDocumentOptions.js\";\nimport {\n toBoundingPolygon,\n toBoundingRegions,\n toDocumentTableFromGenerated,\n toKeyValuePairFromGenerated,\n} from \"../transforms/polygon.js\";\nimport type {\n BoundingRegion,\n DocumentTable,\n DocumentKeyValuePair,\n DocumentPage,\n DocumentLine,\n DocumentParagraph,\n DocumentFormula,\n} from \"../models/documentElements.js\";\nimport type {\n Document as GeneratedDocument,\n DocumentPage as GeneratedDocumentPage,\n DocumentLine as GeneratedDocumentLine,\n} from \"../generated/index.js\";\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: string;\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 barcodes: generated.barcodes?.map((barcode) => ({\n ...barcode,\n polygon: toBoundingPolygon(barcode.polygon),\n })),\n formulas: generated.formulas?.map(\n (formula): DocumentFormula => ({\n ...formula,\n polygon: toBoundingPolygon(formula.polygon),\n }),\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<\n 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,\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":"fields.d.ts","sourceRoot":"","sources":["../../../src/models/fields.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,aAAa,IAAI,sBAAsB,EACxC,MAAM,uBAAuB,CAAC;A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