diff --git a/sdk/formrecognizer/ai-form-recognizer/src/azureKeyCredentialPolicy.ts b/sdk/formrecognizer/ai-form-recognizer/src/azureKeyCredentialPolicy.ts index cfbf4955750d..5be0796948d3 100644 --- a/sdk/formrecognizer/ai-form-recognizer/src/azureKeyCredentialPolicy.ts +++ b/sdk/formrecognizer/ai-form-recognizer/src/azureKeyCredentialPolicy.ts @@ -17,6 +17,8 @@ const API_KEY_HEADER_NAME = "Ocp-Apim-Subscription-Key"; /** * Create an HTTP pipeline policy to authenticate a request * using an `AzureKeyCredential` for Azure Form Recognizer + * + * @internal */ export function createFormRecognizerAzureKeyCredentialPolicy( credential: KeyCredential diff --git a/sdk/formrecognizer/ai-form-recognizer/src/constants.ts b/sdk/formrecognizer/ai-form-recognizer/src/constants.ts index 3d6067e4ef0a..7c4981d61cf3 100644 --- a/sdk/formrecognizer/ai-form-recognizer/src/constants.ts +++ b/sdk/formrecognizer/ai-form-recognizer/src/constants.ts @@ -9,10 +9,14 @@ export const LIB_INFO = `azsdk-js-ai-formrecognizer/${SDK_VERSION}`; /** * Maximum size of input documents allowed by the Azure Form Recognizer service. + * * @internal */ export const MAX_INPUT_DOCUMENT_SIZE = 50 * 1024 * 1024; // 50 MB +/** + * @internal + */ export const FormRecognizerLoggingAllowedHeaderNames = [ "apim-request-id", "Location", @@ -22,6 +26,9 @@ export const FormRecognizerLoggingAllowedHeaderNames = [ "x-envoy-upstream-service-time" ]; +/** + * @internal + */ export const FormRecognizerLoggingAllowedQueryParameters = [ "includeTextDetails", "includeKeys", diff --git a/sdk/formrecognizer/ai-form-recognizer/src/formTrainingClient.ts b/sdk/formrecognizer/ai-form-recognizer/src/formTrainingClient.ts index 9e4e5eab951b..028cc841d6b4 100644 --- a/sdk/formrecognizer/ai-form-recognizer/src/formTrainingClient.ts +++ b/sdk/formrecognizer/ai-form-recognizer/src/formTrainingClient.ts @@ -352,6 +352,11 @@ export class FormTrainingClient { } } + /** + * (INTERNAL) Provides an async iterable of model pages. + * + * @hidden + */ private async *listModelsPage( settings: PageSettings, options: ListModelsOptions = {} @@ -370,6 +375,11 @@ export class FormTrainingClient { } } + /** + * (INTERNAL) Create an async iterable of all models in an account. + * + * @hidden + */ private async *listModelsAll( settings: PageSettings, options: ListModelsOptions = {} @@ -441,6 +451,11 @@ export class FormTrainingClient { }; } + /** + * (INTERNAL) Get the first page of models + * + * @hidden + */ private async list(options?: ListModelsOptions): Promise { const realOptions: ListModelsOptions = options || {}; const { span, updatedOptions: finalOptions } = createSpan( @@ -465,6 +480,11 @@ export class FormTrainingClient { } } + /** + * (INTERNAL) Get a page of models using a nextLink + * + * @hidden + */ private async listNextPage( nextLink: string, options?: ListModelsOptions @@ -710,6 +730,11 @@ export class FormTrainingClient { return poller; } + /** + * (INTERNAL) Start a model copying operation. + * + * @hidden + */ private async beginCopyModelInternal( modelId: string, copyAuthorization: CopyAuthorization, @@ -745,6 +770,11 @@ export class FormTrainingClient { } } + /** + * (INTERNAL) Get the result of an in-progress model copying operation. + * + * @hidden + */ private async getCopyModelResult( modelId: string, resultId: string, diff --git a/sdk/formrecognizer/ai-form-recognizer/src/internalModels.ts b/sdk/formrecognizer/ai-form-recognizer/src/internalModels.ts index 6e841b0c911f..7659c9a2e5c6 100644 --- a/sdk/formrecognizer/ai-form-recognizer/src/internalModels.ts +++ b/sdk/formrecognizer/ai-form-recognizer/src/internalModels.ts @@ -11,6 +11,8 @@ import { RecognizedForm, FormPage } from "./models"; /** * Represents the result from an Recognize Content operation + * + * @internal */ export interface RecognizedContent { /** @@ -41,6 +43,8 @@ export interface RecognizedContent { /** * Contains response data for the Recognize Content operation. + * + * @internal */ export type RecognizeContentResultResponse = RecognizedContent & { /** @@ -60,6 +64,8 @@ export type RecognizeContentResultResponse = RecognizedContent & { /** * Represents the result from an recognize form operation using a custom model from training. + * + * @internal */ export interface RecognizedForms { /** diff --git a/sdk/formrecognizer/ai-form-recognizer/src/logger.ts b/sdk/formrecognizer/ai-form-recognizer/src/logger.ts index 660d6424e827..e6c1dcd287a9 100644 --- a/sdk/formrecognizer/ai-form-recognizer/src/logger.ts +++ b/sdk/formrecognizer/ai-form-recognizer/src/logger.ts @@ -5,5 +5,7 @@ import { createClientLogger } from "@azure/logger"; /** * The \@azure/logger configuration for this package. + * + * @internal */ export const logger = createClientLogger("ai-form-recognizer"); diff --git a/sdk/formrecognizer/ai-form-recognizer/src/lro/analyze/contentPoller.ts b/sdk/formrecognizer/ai-form-recognizer/src/lro/analyze/contentPoller.ts index 97fa67635027..dbbe60affdd9 100644 --- a/sdk/formrecognizer/ai-form-recognizer/src/lro/analyze/contentPoller.ts +++ b/sdk/formrecognizer/ai-form-recognizer/src/lro/analyze/contentPoller.ts @@ -14,6 +14,9 @@ import { FormRecognizerRequestBody, FormPageArray } from "../../models"; import { RecognizeContentResultResponse } from "../../internalModels"; export { OperationStatus }; +/** + * @internal + */ export interface ContentPollerOperationOptions { /** * Time between each polling in milliseconds. @@ -32,6 +35,8 @@ export interface ContentPollerOperationOptions { /** * Defines the operations from a analyze client that are needed for the poller * to work + * + * @internal */ export type RecognizeContentPollerClient = { // returns a result id to retrieve results @@ -56,6 +61,9 @@ export interface BeginRecognizeContentPollState extends PollOperationState {} @@ -74,6 +82,8 @@ export type BeginRecognizeContentPollerOptions = { /** * Class that represents a poller that waits until a model has been trained. + * + * @internal */ export class BeginRecognizeContentPoller extends Poller< BeginRecognizeContentPollState, @@ -121,8 +131,10 @@ export class BeginRecognizeContentPoller extends Poller< return delay(this.updateIntervalInMs); } } + /** * Creates a poll operation given the provided state. + * * @internal */ function makeBeginRecognizePollOperation( diff --git a/sdk/formrecognizer/ai-form-recognizer/src/lro/analyze/recognitionPoller.ts b/sdk/formrecognizer/ai-form-recognizer/src/lro/analyze/recognitionPoller.ts index cebce56d1123..f285d8a03ea3 100644 --- a/sdk/formrecognizer/ai-form-recognizer/src/lro/analyze/recognitionPoller.ts +++ b/sdk/formrecognizer/ai-form-recognizer/src/lro/analyze/recognitionPoller.ts @@ -13,6 +13,7 @@ import { toRecognizedFormArray } from "../../transforms"; /** * Options for Form Recognition shared between prebuilt and custom models. + * @internal */ export interface FormPollerOperationOptions { /** @@ -35,6 +36,8 @@ export interface FormPollerOperationOptions { /** * Encapsulates the steps to start and query the status of * a form recognition operation + * + * @internal */ export interface FormRecognitionOperationClient { /** @@ -133,6 +136,7 @@ function makeFormRecognitionOperation( /** * Set of intrinsic properties that describe a form recognition polling operation. + * @internal */ export type FormPollerOperationDescription = FormPollerOperationOptions & FormRecognitionOperationClient & { @@ -152,6 +156,8 @@ const DEFAULT_POLLING_INTERVAL = 5000; /** * A poller for Form Recognition that works for all analysis endpoints * that return the basic, weakly-typed `RecognizedFormArray` type. + * + * @internal */ export class FormRecognitionPoller extends Poller< RecognizeFormsOperationState, diff --git a/sdk/formrecognizer/ai-form-recognizer/src/lro/copy/poller.ts b/sdk/formrecognizer/ai-form-recognizer/src/lro/copy/poller.ts index ca12745c97d5..8a283f61e162 100644 --- a/sdk/formrecognizer/ai-form-recognizer/src/lro/copy/poller.ts +++ b/sdk/formrecognizer/ai-form-recognizer/src/lro/copy/poller.ts @@ -13,6 +13,9 @@ import { import { CopyAuthorization, CustomFormModelInfo } from "../../models"; export { OperationStatus }; +/** + * @internal + */ export interface CopyPollerOperationOptions { /** * Time between each polling in milliseconds. @@ -31,6 +34,8 @@ export interface CopyPollerOperationOptions { /** * Defines the operations from a training client that are needed for the poller * to work + * + * @internal */ export type CopyModelPollerClient = { // returns a result id to retrieve results @@ -88,6 +93,9 @@ export interface BeginCopyModelPollState extends PollOperationState {} @@ -108,6 +116,7 @@ export type BeginCopyModelPollerOptions = { /** * Class that represents a poller that waits until a model has been trained. + * @internal */ export class BeginCopyModelPoller extends Poller { public updateIntervalInMs: number; diff --git a/sdk/formrecognizer/ai-form-recognizer/src/lro/train/poller.ts b/sdk/formrecognizer/ai-form-recognizer/src/lro/train/poller.ts index 445380d6cedd..69bbfc3d4a9e 100644 --- a/sdk/formrecognizer/ai-form-recognizer/src/lro/train/poller.ts +++ b/sdk/formrecognizer/ai-form-recognizer/src/lro/train/poller.ts @@ -15,6 +15,8 @@ export { ModelStatus, TrainCustomModelAsyncResponse }; /** * Defines the operations from a {@link FormRecognizerClient} that are needed for the poller * returned by {@link FormRecognizerClient.beginTraining} to work. + * + * @internal */ export type TrainPollerClient = { getCustomModel: (modelId: string, options: GetModelOptions) => Promise; @@ -67,6 +69,8 @@ export interface BeginTrainingPollerOptions { /** * Class that represents a poller that waits until a model has been trained. + * + * @internal */ export class BeginTrainingPoller extends Poller { public updateIntervalInMs: number; diff --git a/sdk/formrecognizer/ai-form-recognizer/src/tracing.ts b/sdk/formrecognizer/ai-form-recognizer/src/tracing.ts index ca9e15799641..7a77793a613a 100644 --- a/sdk/formrecognizer/ai-form-recognizer/src/tracing.ts +++ b/sdk/formrecognizer/ai-form-recognizer/src/tracing.ts @@ -5,6 +5,7 @@ import { createSpanFunction } from "@azure/core-tracing"; /** * Creates a span using the global tracer. + * * @internal */ export const createSpan = createSpanFunction({ diff --git a/sdk/formrecognizer/ai-form-recognizer/src/transforms.ts b/sdk/formrecognizer/ai-form-recognizer/src/transforms.ts index 5008cc1b48ff..8e1cc34cea4b 100644 --- a/sdk/formrecognizer/ai-form-recognizer/src/transforms.ts +++ b/sdk/formrecognizer/ai-form-recognizer/src/transforms.ts @@ -39,6 +39,9 @@ import { } from "./models"; import { RecognizeContentResultResponse } from "./internalModels"; +/** + * @internal + */ function toBoundingBox(original: number[]): Point2D[] { return [ { x: original[0], y: original[1] }, @@ -48,6 +51,9 @@ function toBoundingBox(original: number[]): Point2D[] { ]; } +/** + * @internal + */ export function toTextLine(original: TextLineModel, pageNumber: number): FormLine { const appearance = original.appearance !== undefined @@ -77,6 +83,9 @@ export function toTextLine(original: TextLineModel, pageNumber: number): FormLin return line; } +/** + * @internal + */ export function toSelectionMark(original: SelectionMark, pageNumber: number): FormSelectionMark { return { kind: "selectionMark", @@ -87,6 +96,9 @@ export function toSelectionMark(original: SelectionMark, pageNumber: number): Fo }; } +/** + * @internal + */ export function toFormPage(original: ReadResultModel): FormPage { return { pageNumber: original.pageNumber, @@ -102,6 +114,9 @@ export function toFormPage(original: ReadResultModel): FormPage { // Note: might need to support other element types in future, e.g., checkbox const textPattern = /\/readResults\/(\d+)\/lines\/(\d+)(?:\/words\/(\d+))?/; +/** + * @internal + */ export function toFormContent(element: string, readResults: FormPage[]): FormElement { const result = textPattern.exec(element); if (!result || !result[0] || !result[1] || !result[2]) { @@ -118,6 +133,9 @@ export function toFormContent(element: string, readResults: FormPage[]): FormEle } } +/** + * @internal + */ export function toFieldData( pageNumber: number, original: KeyValueElementModel, @@ -131,6 +149,9 @@ export function toFieldData( }; } +/** + * @internal + */ export function toFormFieldFromKeyValuePairModel( pageNumber: number, original: KeyValuePairModel, @@ -146,6 +167,9 @@ export function toFormFieldFromKeyValuePairModel( }; } +/** + * @internal + */ export function toFormTable( original: DataTableModel, readResults: FormPage[], @@ -172,6 +196,9 @@ export function toFormTable( }; } +/** + * @internal + */ export function toFormPages( readResults?: ReadResultModel[], pageResults?: PageResultModel[] @@ -192,6 +219,9 @@ export function toFormPages( ); } +/** + * @internal + */ export function toRecognizedFormArray( original: GetAnalyzeFormResultResponse, expectedDocTypePrefix?: string @@ -221,6 +251,9 @@ export function toRecognizedFormArray( } } +/** + * @internal + */ export function toFormFieldFromFieldValueModel( original: FieldValueModel, key: string, @@ -290,6 +323,9 @@ export function toFormFieldFromFieldValueModel( } as FormField; } +/** + * @internal + */ export function toFieldsFromFieldValue( original: { [propertyName: string]: FieldValueModel | null }, readResults: FormPage[] @@ -309,6 +345,9 @@ export function toFieldsFromFieldValue( return result; } +/** + * @internal + */ export function toFieldsFromKeyValuePairs( pageNumber: number, original: KeyValuePairModel[], @@ -326,6 +365,9 @@ export function toFieldsFromKeyValuePairs( return result; } +/** + * @internal + */ export function toFormFromPageResult(original: PageResultModel, pages: FormPage[]): RecognizedForm { return { formType: `form-${original.clusterId}`, @@ -337,6 +379,9 @@ export function toFormFromPageResult(original: PageResultModel, pages: FormPage[ }; } +/** + * @internal + */ export function toRecognizedForm(original: DocumentResultModel, pages: FormPage[]): RecognizedForm { return { formType: original.docType, @@ -350,6 +395,9 @@ export function toRecognizedForm(original: DocumentResultModel, pages: FormPage[ }; } +/** + * @internal + */ export function toRecognizeContentResultResponse( original: GetAnalyzeLayoutResultResponse ): RecognizeContentResultResponse { @@ -383,6 +431,9 @@ export function toRecognizeContentResultResponse( } } +/** + * @internal + */ function flattenTrainingDocuments( original: GetCustomModelResponse ): TrainingDocumentInfo[] | undefined { @@ -409,6 +460,9 @@ function flattenTrainingDocuments( return undefined; } +/** + * @internal + */ function toSubmodelsFromComposedTrainResults(results: TrainResult[]): CustomFormSubmodel[] { const mappedSubmodels = results.map((r) => toSubmodelsFromTrainResultLabeled(r)); @@ -416,6 +470,9 @@ function toSubmodelsFromComposedTrainResults(results: TrainResult[]): CustomForm return ([] as CustomFormSubmodel[]).concat(...mappedSubmodels); } +/** + * @internal + */ function toSubmodelsFromTrainResultLabeled( result: TrainResult, modelName?: string @@ -438,6 +495,9 @@ function toSubmodelsFromTrainResultLabeled( ]; } +/** + * @internal + */ function toSubmodelsFromTrainResultUnlabeled( keys: KeysResult, modelId: string @@ -460,6 +520,9 @@ function toSubmodelsFromTrainResultUnlabeled( ); } +/** + * @internal + */ function flattenCustomFormSubmodels( original: GetCustomModelResponse ): CustomFormSubmodel[] | undefined { @@ -477,6 +540,9 @@ function flattenCustomFormSubmodels( return undefined; } +/** + * @internal + */ export function toCustomFormModelProperties( original: Attributes | undefined ): CustomFormModelProperties | undefined { @@ -489,6 +555,9 @@ export function toCustomFormModelProperties( } } +/** + * @internal + */ export function toFormModelResponse(response: GetCustomModelResponse): FormModelResponse { return { status: response.modelInfo.status, diff --git a/sdk/formrecognizer/ai-form-recognizer/src/utils/utils.node.ts b/sdk/formrecognizer/ai-form-recognizer/src/utils/utils.node.ts index fadeb16eeea5..1f7b40720e39 100644 --- a/sdk/formrecognizer/ai-form-recognizer/src/utils/utils.node.ts +++ b/sdk/formrecognizer/ai-form-recognizer/src/utils/utils.node.ts @@ -10,6 +10,8 @@ const SIZE_ONE_MEGA = 1024 * 1024; * @param stream - A Node.js Readable stream * @returns The resultant buffer. * @throws If buffer size is not big enough. + * + * @internal */ export async function streamToBuffer( stream: NodeJS.ReadableStream, @@ -58,6 +60,9 @@ export async function streamToBuffer( }); } +/** + * @internal + */ export function getFirstFourBytesFromBlob(_data: Blob): Promise { throw new Error("Blob is not supported in NodeJS environment"); }