@azure-rest/ai-translation-document 1.0.0-beta.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/** Translation job Status Response */\nexport interface TranslationsStatusOutput {\n /** The summary status of individual operation */\n value: Array<TranslationStatusOutput>;\n /** Url for the next page. Null if no more pages available */\n nextLink?: string;\n}\n\n/** Translation job status response */\nexport interface TranslationStatusOutput {\n /** Id of the operation. */\n id: string;\n /** Operation created date time */\n createdDateTimeUtc: string;\n /** Date time in which the operation's status has been updated */\n lastActionDateTimeUtc: string;\n /** List of possible statuses for job or document */\n status: StatusOutput;\n /**\n * This contains an outer error with error code, message, details, target and an\n * inner error with more descriptive details.\n */\n error?: TranslationErrorOutput;\n /** Status Summary */\n summary: StatusSummaryOutput;\n}\n\n/**\n * This contains an outer error with error code, message, details, target and an\n * inner error with more descriptive details.\n */\nexport interface TranslationErrorOutput {\n /** Enums containing high level error codes. */\n code: TranslationErrorCodeOutput;\n /** Gets high level error message. */\n message: string;\n /**\n * Gets the source of the error.\n * For example it would be \"documents\" or\n * \"document id\" in case of invalid document.\n */\n readonly target?: string;\n /**\n * New Inner Error format which conforms to Cognitive Services API Guidelines\n * which is available at\n * https://microsoft.sharepoint.com/%3Aw%3A/t/CognitiveServicesPMO/EUoytcrjuJdKpeOKIK_QRC8BPtUYQpKBi8JsWyeDMRsWlQ?e=CPq8ow.\n * This\n * contains required properties ErrorCode, message and optional properties target,\n * details(key value pair), inner error(this can be nested).\n */\n innerError?: InnerTranslationErrorOutput;\n}\n\n/**\n * New Inner Error format which conforms to Cognitive Services API Guidelines\n * which is available at\n * https://microsoft.sharepoint.com/%3Aw%3A/t/CognitiveServicesPMO/EUoytcrjuJdKpeOKIK_QRC8BPtUYQpKBi8JsWyeDMRsWlQ?e=CPq8ow.\n * This\n * contains required properties ErrorCode, message and optional properties target,\n * details(key value pair), inner error(this can be nested).\n */\nexport interface InnerTranslationErrorOutput {\n /** Gets code error string. */\n code: string;\n /** Gets high level error message. */\n message: string;\n /**\n * Gets the source of the error.\n * For example it would be \"documents\" or\n * \"document id\" in case of invalid document.\n */\n readonly target?: string;\n /**\n * New Inner Error format which conforms to Cognitive Services API Guidelines\n * which is available at\n * https://microsoft.sharepoint.com/%3Aw%3A/t/CognitiveServicesPMO/EUoytcrjuJdKpeOKIK_QRC8BPtUYQpKBi8JsWyeDMRsWlQ?e=CPq8ow.\n * This\n * contains required properties ErrorCode, message and optional properties target,\n * details(key value pair), inner error(this can be nested).\n */\n innerError?: InnerTranslationErrorOutput;\n}\n\n/** Status Summary */\nexport interface StatusSummaryOutput {\n /** Total count */\n total: number;\n /** Failed count */\n failed: number;\n /** Number of Success */\n success: number;\n /** Number of in progress */\n inProgress: number;\n /** Count of not yet started */\n notYetStarted: number;\n /** Number of cancelled */\n cancelled: number;\n /** Total characters charged by the API */\n totalCharacterCharged: number;\n}\n\n/** Document Status Response */\nexport interface DocumentStatusOutput {\n /** Location of the document or folder */\n path?: string;\n /** Location of the source document */\n sourcePath: string;\n /** Operation created date time */\n createdDateTimeUtc: string;\n /** Date time in which the operation's status has been updated */\n lastActionDateTimeUtc: string;\n /** List of possible statuses for job or document */\n status: StatusOutput;\n /** To language */\n to: string;\n /**\n * This contains an outer error with error code, message, details, target and an\n * inner error with more descriptive details.\n */\n error?: TranslationErrorOutput;\n /** Progress of the translation if available */\n progress: number;\n /** Document Id */\n id: string;\n /** Character charged by the API */\n characterCharged?: number;\n}\n\n/** Documents Status Response */\nexport interface DocumentsStatusOutput {\n /** The detail status of individual documents */\n value: Array<DocumentStatusOutput>;\n /** Url for the next page. Null if no more pages available */\n nextLink?: string;\n}\n\n/** List of supported file formats */\nexport interface SupportedFileFormatsOutput {\n /** list of objects */\n value: Array<FileFormatOutput>;\n}\n\n/** File Format */\nexport interface FileFormatOutput {\n /** Name of the format */\n format: string;\n /** Supported file extension for this format */\n fileExtensions: string[];\n /** Supported Content-Types for this format */\n contentTypes: string[];\n /** Default version if none is specified */\n defaultVersion?: string;\n /** Supported Version */\n versions?: string[];\n /** Supported Type for this format */\n type?: string;\n}\n\n/** Alias for StatusOutput */\nexport type StatusOutput =\n | \"NotStarted\"\n | \"Running\"\n | \"Succeeded\"\n | \"Failed\"\n | \"Cancelled\"\n | \"Cancelling\"\n | \"ValidationFailed\"\n | string;\n/** Alias for TranslationErrorCodeOutput */\nexport type TranslationErrorCodeOutput =\n | \"InvalidRequest\"\n | \"InvalidArgument\"\n | \"InternalServerError\"\n | \"ServiceUnavailable\"\n | \"ResourceNotFound\"\n | \"Unauthorized\"\n | \"RequestRateTooHigh\"\n | string;\n"]}
1
+ {"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/** Translation job Status Response */\nexport interface TranslationsStatusOutput {\n /** The summary status of individual operation */\n value: Array<TranslationStatusOutput>;\n /** Url for the next page. Null if no more pages available */\n nextLink?: string;\n}\n\n/** Translation job status response */\nexport interface TranslationStatusOutput {\n /** Id of the operation. */\n id: string;\n /** Operation created date time */\n createdDateTimeUtc: string;\n /** Date time in which the operation's status has been updated */\n lastActionDateTimeUtc: string;\n /**\n * List of possible statuses for job or document\n *\n * Possible values: \"NotStarted\", \"Running\", \"Succeeded\", \"Failed\", \"Cancelled\", \"Cancelling\", \"ValidationFailed\"\n */\n status: StatusOutput;\n /**\n * This contains an outer error with error code, message, details, target and an\n * inner error with more descriptive details.\n */\n error?: TranslationErrorOutput;\n /** Status Summary */\n summary: StatusSummaryOutput;\n}\n\n/**\n * This contains an outer error with error code, message, details, target and an\n * inner error with more descriptive details.\n */\nexport interface TranslationErrorOutput {\n /**\n * Enums containing high level error codes.\n *\n * Possible values: \"InvalidRequest\", \"InvalidArgument\", \"InternalServerError\", \"ServiceUnavailable\", \"ResourceNotFound\", \"Unauthorized\", \"RequestRateTooHigh\"\n */\n code: TranslationErrorCodeOutput;\n /** Gets high level error message. */\n message: string;\n /**\n * Gets the source of the error.\n * For example it would be \"documents\" or\n * \"document id\" in case of invalid document.\n */\n readonly target?: string;\n /**\n * New Inner Error format which conforms to Cognitive Services API Guidelines\n * which is available at\n * https://microsoft.sharepoint.com/%3Aw%3A/t/CognitiveServicesPMO/EUoytcrjuJdKpeOKIK_QRC8BPtUYQpKBi8JsWyeDMRsWlQ?e=CPq8ow.\n * This\n * contains required properties ErrorCode, message and optional properties target,\n * details(key value pair), inner error(this can be nested).\n */\n innerError?: InnerTranslationErrorOutput;\n}\n\n/**\n * New Inner Error format which conforms to Cognitive Services API Guidelines\n * which is available at\n * https://microsoft.sharepoint.com/%3Aw%3A/t/CognitiveServicesPMO/EUoytcrjuJdKpeOKIK_QRC8BPtUYQpKBi8JsWyeDMRsWlQ?e=CPq8ow.\n * This\n * contains required properties ErrorCode, message and optional properties target,\n * details(key value pair), inner error(this can be nested).\n */\nexport interface InnerTranslationErrorOutput {\n /** Gets code error string. */\n code: string;\n /** Gets high level error message. */\n message: string;\n /**\n * Gets the source of the error.\n * For example it would be \"documents\" or\n * \"document id\" in case of invalid document.\n */\n readonly target?: string;\n /**\n * New Inner Error format which conforms to Cognitive Services API Guidelines\n * which is available at\n * https://microsoft.sharepoint.com/%3Aw%3A/t/CognitiveServicesPMO/EUoytcrjuJdKpeOKIK_QRC8BPtUYQpKBi8JsWyeDMRsWlQ?e=CPq8ow.\n * This\n * contains required properties ErrorCode, message and optional properties target,\n * details(key value pair), inner error(this can be nested).\n */\n innerError?: InnerTranslationErrorOutput;\n}\n\n/** Status Summary */\nexport interface StatusSummaryOutput {\n /** Total count */\n total: number;\n /** Failed count */\n failed: number;\n /** Number of Success */\n success: number;\n /** Number of in progress */\n inProgress: number;\n /** Count of not yet started */\n notYetStarted: number;\n /** Number of cancelled */\n cancelled: number;\n /** Total characters charged by the API */\n totalCharacterCharged: number;\n}\n\n/** Document Status Response */\nexport interface DocumentStatusOutput {\n /** Location of the document or folder */\n path?: string;\n /** Location of the source document */\n sourcePath: string;\n /** Operation created date time */\n createdDateTimeUtc: string;\n /** Date time in which the operation's status has been updated */\n lastActionDateTimeUtc: string;\n /**\n * List of possible statuses for job or document\n *\n * Possible values: \"NotStarted\", \"Running\", \"Succeeded\", \"Failed\", \"Cancelled\", \"Cancelling\", \"ValidationFailed\"\n */\n status: StatusOutput;\n /** To language */\n to: string;\n /**\n * This contains an outer error with error code, message, details, target and an\n * inner error with more descriptive details.\n */\n error?: TranslationErrorOutput;\n /** Progress of the translation if available */\n progress: number;\n /** Document Id */\n id: string;\n /** Character charged by the API */\n characterCharged?: number;\n}\n\n/** Documents Status Response */\nexport interface DocumentsStatusOutput {\n /** The detail status of individual documents */\n value: Array<DocumentStatusOutput>;\n /** Url for the next page. Null if no more pages available */\n nextLink?: string;\n}\n\n/** List of supported file formats */\nexport interface SupportedFileFormatsOutput {\n /** list of objects */\n value: Array<FileFormatOutput>;\n}\n\n/** File Format */\nexport interface FileFormatOutput {\n /** Name of the format */\n format: string;\n /** Supported file extension for this format */\n fileExtensions: string[];\n /** Supported Content-Types for this format */\n contentTypes: string[];\n /** Default version if none is specified */\n defaultVersion?: string;\n /** Supported Version */\n versions?: string[];\n /** Supported Type for this format */\n type?: string;\n}\n\n/** Alias for StatusOutput */\nexport type StatusOutput = string;\n/** Alias for TranslationErrorCodeOutput */\nexport type TranslationErrorCodeOutput = string;\n"]}
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  import { getPagedAsyncIterator } from "@azure/core-paging";
4
4
  import { createRestError } from "@azure-rest/core-client";
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,qBAAqB,EAA2C,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAU,eAAe,EAAyB,MAAM,yBAAyB,CAAC;AAyCzF;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CACtB,MAAc,EACd,eAA0B,EAC1B,UAAoC,EAAE;IAItC,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,MAAM,QAAQ,GAAG,OAAO,CAAC;IACzB,MAAM,YAAY,GAAG,UAAU,CAAC;IAChC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAClC,MAAM,WAAW,GAA4B;QAC3C,aAAa,EAAE,EAAE;QACjB,OAAO,EACL,OAAO,aAAa,KAAK,UAAU;YACjC,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,KAAK,EAAE,QAAgB,EAAE,EAAE;gBACzB,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;gBACvF,QAAQ,GAAG,KAAK,CAAC;gBACjB,kBAAkB,CAAC,MAAM,CAAC,CAAC;gBAC3B,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;gBACxD,MAAM,MAAM,GAAG,WAAW,CAAW,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAC5D,OAAO;oBACL,IAAI,EAAE,MAAM;oBACZ,YAAY,EAAE,QAAQ;iBACvB,CAAC;YACJ,CAAC;KACR,CAAC;IAEF,OAAO,qBAAqB,CAAC,WAAW,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,IAAa,EAAE,YAAqB;IACvD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAI,IAAgC,CAAC,YAAY,CAAC,CAAC;IAEjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,kCAAkC,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB;IAC/D,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;IAEjE,qEAAqE;IACrE,qEAAqE;IACrE,iDAAiD;IACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B;IACzD,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAClG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number,\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends {\n body: { value?: infer TPage };\n}\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {},\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n const itemName = \"value\";\n const nextLinkName = \"nextLink\";\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\"200\", \"201\", \"202\", \"203\", \"204\", \"205\", \"206\", \"207\", \"208\", \"226\"];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAyC1D;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CACtB,MAAc,EACd,eAA0B,EAC1B,UAAoC,EAAE;IAItC,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,MAAM,QAAQ,GAAG,OAAO,CAAC;IACzB,MAAM,YAAY,GAAG,UAAU,C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AQ,CAAC;IAEjE,qEAAqE;IACrE,qEAAqE;IACrE,iDAAiD;IACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B;IACzD,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAClG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport type { PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { getPagedAsyncIterator } from \"@azure/core-paging\";\nimport type { Client, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError } from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number,\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends {\n body: { value?: infer TPage };\n}\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {},\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n const itemName = \"value\";\n const nextLinkName = \"nextLink\";\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\"200\", \"201\", \"202\", \"203\", \"204\", \"205\", \"206\", \"207\", \"208\", \"226\"];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  export {};
4
4
  //# sourceMappingURL=parameters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport { RequestParameters } from \"@azure-rest/core-client\";\nimport { DocumentTranslateContent, StartTranslationDetails, FileFormatType } from \"./models.js\";\n\nexport interface DocumentTranslateHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface DocumentTranslateBodyParam {\n body?: DocumentTranslateContent;\n}\n\nexport interface DocumentTranslateQueryParamProperties {\n /**\n * Specifies source language of the input document.\n * If this parameter isn't specified, automatic language detection is applied to determine the source language.\n * For example if the source document is written in English, then use sourceLanguage=en\n */\n sourceLanguage?: string;\n /**\n * Specifies the language of the output document.\n * The target language must be one of the supported languages included in the translation scope.\n * For example if you want to translate the document in German language, then use targetLanguage=de\n */\n targetLanguage: string;\n /**\n * A string specifying the category (domain) of the translation. This parameter is used to get translations\n * from a customized system built with Custom Translator. Add the Category ID from your Custom Translator\n * project details to this parameter to use your deployed customized system. Default value is: general.\n */\n category?: string;\n /**\n * Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.\n * Possible values are: true (default) or false.\n */\n allowFallback?: boolean;\n}\n\nexport interface DocumentTranslateQueryParam {\n queryParameters: DocumentTranslateQueryParamProperties;\n}\n\nexport interface DocumentTranslateHeaderParam {\n headers?: RawHttpHeadersInput & DocumentTranslateHeaders;\n}\n\nexport interface DocumentTranslateMediaTypesParam {\n /** Content Type as multipart/form-data */\n contentType: \"multipart/form-data\";\n}\n\nexport type DocumentTranslateParameters = DocumentTranslateQueryParam &\n DocumentTranslateHeaderParam &\n DocumentTranslateMediaTypesParam &\n DocumentTranslateBodyParam &\n RequestParameters;\n\nexport interface StartTranslationBodyParam {\n body?: StartTranslationDetails;\n}\n\nexport type StartTranslationParameters = StartTranslationBodyParam & RequestParameters;\n\nexport interface GetTranslationsStatusQueryParamProperties {\n /**\n * top indicates the total number of records the user wants to be returned across\n * all pages.\n *\n * Clients MAY use top and skip query parameters to\n * specify a number of results to return and an offset into the collection.\n * When\n * both top and skip are given by a client, the server SHOULD first apply skip\n * and then top on the collection.\n *\n * Note: If the server can't honor\n * top and/or skip, the server MUST return an error to the client informing\n * about it instead of just ignoring the query options.\n */\n top?: number;\n /**\n * skip indicates the number of records to skip from the list of records held by\n * the server based on the sorting method specified. By default, we sort by\n * descending start time.\n *\n * Clients MAY use top and skip query\n * parameters to specify a number of results to return and an offset into the\n * collection.\n * When both top and skip are given by a client, the server SHOULD\n * first apply skip and then top on the collection.\n *\n * Note: If the\n * server can't honor top and/or skip, the server MUST return an error to the\n * client informing about it instead of just ignoring the query options.\n */\n skip?: number;\n /**\n * maxpagesize is the maximum items returned in a page. If more items are\n * requested via top (or top is not specified and there are more items to be\n * returned), @nextLink will contain the link to the next page.\n *\n *\n * Clients MAY request server-driven paging with a specific page size by\n * specifying a maxpagesize preference. The server SHOULD honor this preference\n * if the specified page size is smaller than the server's default page size.\n */\n maxpagesize?: number;\n /** Ids to use in filtering */\n ids?: string[];\n /** Statuses to use in filtering */\n statuses?: string[];\n /** the start datetime to get items after */\n createdDateTimeUtcStart?: Date | string;\n /** the end datetime to get items before */\n createdDateTimeUtcEnd?: Date | string;\n /** the sorting query for the collection (ex: 'CreatedDateTimeUtc asc','CreatedDateTimeUtc desc') */\n orderby?: string[];\n}\n\nexport interface GetTranslationsStatusQueryParam {\n queryParameters?: GetTranslationsStatusQueryParamProperties;\n}\n\nexport type GetTranslationsStatusParameters = GetTranslationsStatusQueryParam & RequestParameters;\nexport type GetDocumentStatusParameters = RequestParameters;\nexport type GetTranslationStatusParameters = RequestParameters;\nexport type CancelTranslationParameters = RequestParameters;\n\nexport interface GetDocumentsStatusQueryParamProperties {\n /**\n * top indicates the total number of records the user wants to be returned across\n * all pages.\n *\n * Clients MAY use top and skip query parameters to\n * specify a number of results to return and an offset into the collection.\n * When\n * both top and skip are given by a client, the server SHOULD first apply skip\n * and then top on the collection.\n *\n * Note: If the server can't honor\n * top and/or skip, the server MUST return an error to the client informing\n * about it instead of just ignoring the query options.\n */\n top?: number;\n /**\n * skip indicates the number of records to skip from the list of records held by\n * the server based on the sorting method specified. By default, we sort by\n * descending start time.\n *\n * Clients MAY use top and skip query\n * parameters to specify a number of results to return and an offset into the\n * collection.\n * When both top and skip are given by a client, the server SHOULD\n * first apply skip and then top on the collection.\n *\n * Note: If the\n * server can't honor top and/or skip, the server MUST return an error to the\n * client informing about it instead of just ignoring the query options.\n */\n skip?: number;\n /**\n * maxpagesize is the maximum items returned in a page. If more items are\n * requested via top (or top is not specified and there are more items to be\n * returned), @nextLink will contain the link to the next page.\n *\n *\n * Clients MAY request server-driven paging with a specific page size by\n * specifying a maxpagesize preference. The server SHOULD honor this preference\n * if the specified page size is smaller than the server's default page size.\n */\n maxpagesize?: number;\n /** Ids to use in filtering */\n ids?: string[];\n /** Statuses to use in filtering */\n statuses?: string[];\n /** the start datetime to get items after */\n createdDateTimeUtcStart?: Date | string;\n /** the end datetime to get items before */\n createdDateTimeUtcEnd?: Date | string;\n /** the sorting query for the collection (ex: 'CreatedDateTimeUtc asc','CreatedDateTimeUtc desc') */\n orderby?: string[];\n}\n\nexport interface GetDocumentsStatusQueryParam {\n queryParameters?: GetDocumentsStatusQueryParamProperties;\n}\n\nexport type GetDocumentsStatusParameters = GetDocumentsStatusQueryParam & RequestParameters;\n\nexport interface GetSupportedFormatsQueryParamProperties {\n /** the type of format like document or glossary */\n type?: FileFormatType;\n}\n\nexport interface GetSupportedFormatsQueryParam {\n queryParameters?: GetSupportedFormatsQueryParamProperties;\n}\n\nexport type GetSupportedFormatsParameters = GetSupportedFormatsQueryParam & RequestParameters;\n"]}
1
+ {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport type { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport type { RequestParameters } from \"@azure-rest/core-client\";\nimport type {\n DocumentTranslateContent,\n StartTranslationDetails,\n FileFormatType,\n} from \"./models.js\";\n\nexport interface DocumentTranslateHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface DocumentTranslateBodyParam {\n /** Document Translate Request Content */\n body: DocumentTranslateContent;\n}\n\nexport interface DocumentTranslateQueryParamProperties {\n /**\n * Specifies source language of the input document.\n * If this parameter isn't specified, automatic language detection is applied to determine the source language.\n * For example if the source document is written in English, then use sourceLanguage=en\n */\n sourceLanguage?: string;\n /**\n * Specifies the language of the output document.\n * The target language must be one of the supported languages included in the translation scope.\n * For example if you want to translate the document in German language, then use targetLanguage=de\n */\n targetLanguage: string;\n /**\n * A string specifying the category (domain) of the translation. This parameter is used to get translations\n * from a customized system built with Custom Translator. Add the Category ID from your Custom Translator\n * project details to this parameter to use your deployed customized system. Default value is: general.\n */\n category?: string;\n /**\n * Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.\n * Possible values are: true (default) or false.\n */\n allowFallback?: boolean;\n}\n\nexport interface DocumentTranslateQueryParam {\n queryParameters: DocumentTranslateQueryParamProperties;\n}\n\nexport interface DocumentTranslateHeaderParam {\n headers?: RawHttpHeadersInput & DocumentTranslateHeaders;\n}\n\nexport interface DocumentTranslateMediaTypesParam {\n /** Content Type as multipart/form-data */\n contentType: \"multipart/form-data\";\n}\n\nexport type DocumentTranslateParameters = DocumentTranslateQueryParam &\n DocumentTranslateHeaderParam &\n DocumentTranslateMediaTypesParam &\n DocumentTranslateBodyParam &\n RequestParameters;\n\nexport interface StartTranslationBodyParam {\n /** Translation job submission batch request */\n body: StartTranslationDetails;\n}\n\nexport type StartTranslationParameters = StartTranslationBodyParam & RequestParameters;\n\nexport interface GetTranslationsStatusQueryParamProperties {\n /**\n * top indicates the total number of records the user wants to be returned across\n * all pages.\n *\n * Clients MAY use top and skip query parameters to\n * specify a number of results to return and an offset into the collection.\n * When\n * both top and skip are given by a client, the server SHOULD first apply skip\n * and then top on the collection.\n *\n * Note: If the server can't honor\n * top and/or skip, the server MUST return an error to the client informing\n * about it instead of just ignoring the query options.\n */\n top?: number;\n /**\n * skip indicates the number of records to skip from the list of records held by\n * the server based on the sorting method specified. By default, we sort by\n * descending start time.\n *\n * Clients MAY use top and skip query\n * parameters to specify a number of results to return and an offset into the\n * collection.\n * When both top and skip are given by a client, the server SHOULD\n * first apply skip and then top on the collection.\n *\n * Note: If the\n * server can't honor top and/or skip, the server MUST return an error to the\n * client informing about it instead of just ignoring the query options.\n */\n skip?: number;\n /**\n * maxpagesize is the maximum items returned in a page. If more items are\n * requested via top (or top is not specified and there are more items to be\n * returned), @nextLink will contain the link to the next page.\n *\n *\n * Clients MAY request server-driven paging with a specific page size by\n * specifying a maxpagesize preference. The server SHOULD honor this preference\n * if the specified page size is smaller than the server's default page size.\n */\n maxpagesize?: number;\n /** Ids to use in filtering */\n ids?: string[];\n /** Statuses to use in filtering */\n statuses?: string[];\n /** the start datetime to get items after */\n createdDateTimeUtcStart?: Date | string;\n /** the end datetime to get items before */\n createdDateTimeUtcEnd?: Date | string;\n /** the sorting query for the collection (ex: 'CreatedDateTimeUtc asc','CreatedDateTimeUtc desc') */\n orderby?: string[];\n}\n\nexport interface GetTranslationsStatusQueryParam {\n queryParameters?: GetTranslationsStatusQueryParamProperties;\n}\n\nexport type GetTranslationsStatusParameters = GetTranslationsStatusQueryParam & RequestParameters;\nexport type GetDocumentStatusParameters = RequestParameters;\nexport type GetTranslationStatusParameters = RequestParameters;\nexport type CancelTranslationParameters = RequestParameters;\n\nexport interface GetDocumentsStatusQueryParamProperties {\n /**\n * top indicates the total number of records the user wants to be returned across\n * all pages.\n *\n * Clients MAY use top and skip query parameters to\n * specify a number of results to return and an offset into the collection.\n * When\n * both top and skip are given by a client, the server SHOULD first apply skip\n * and then top on the collection.\n *\n * Note: If the server can't honor\n * top and/or skip, the server MUST return an error to the client informing\n * about it instead of just ignoring the query options.\n */\n top?: number;\n /**\n * skip indicates the number of records to skip from the list of records held by\n * the server based on the sorting method specified. By default, we sort by\n * descending start time.\n *\n * Clients MAY use top and skip query\n * parameters to specify a number of results to return and an offset into the\n * collection.\n * When both top and skip are given by a client, the server SHOULD\n * first apply skip and then top on the collection.\n *\n * Note: If the\n * server can't honor top and/or skip, the server MUST return an error to the\n * client informing about it instead of just ignoring the query options.\n */\n skip?: number;\n /**\n * maxpagesize is the maximum items returned in a page. If more items are\n * requested via top (or top is not specified and there are more items to be\n * returned), @nextLink will contain the link to the next page.\n *\n *\n * Clients MAY request server-driven paging with a specific page size by\n * specifying a maxpagesize preference. The server SHOULD honor this preference\n * if the specified page size is smaller than the server's default page size.\n */\n maxpagesize?: number;\n /** Ids to use in filtering */\n ids?: string[];\n /** Statuses to use in filtering */\n statuses?: string[];\n /** the start datetime to get items after */\n createdDateTimeUtcStart?: Date | string;\n /** the end datetime to get items before */\n createdDateTimeUtcEnd?: Date | string;\n /** the sorting query for the collection (ex: 'CreatedDateTimeUtc asc','CreatedDateTimeUtc desc') */\n orderby?: string[];\n}\n\nexport interface GetDocumentsStatusQueryParam {\n queryParameters?: GetDocumentsStatusQueryParamProperties;\n}\n\nexport type GetDocumentsStatusParameters = GetDocumentsStatusQueryParam & RequestParameters;\n\nexport interface GetSupportedFormatsQueryParamProperties {\n /**\n * the type of format like document or glossary\n *\n * Possible values: \"document\", \"glossary\"\n */\n type?: FileFormatType;\n}\n\nexport interface GetSupportedFormatsQueryParam {\n queryParameters?: GetSupportedFormatsQueryParamProperties;\n}\n\nexport type GetSupportedFormatsParameters = GetSupportedFormatsQueryParam & RequestParameters;\n"]}
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { createHttpPoller, } from "@azure/core-lro";
2
+ // Licensed under the MIT License.
3
+ import { createHttpPoller } from "@azure/core-lro";
4
4
  export async function getLongRunningPoller(client, initialResponse, options = {}) {
5
5
  var _a;
6
6
  const abortController = new AbortController();
@@ -11,7 +11,7 @@ export async function getLongRunningPoller(client, initialResponse, options = {}
11
11
  // response we were provided.
12
12
  return getLroResponse(initialResponse);
13
13
  },
14
- sendPollRequest: async (path, sendPollRequestOptions) => {
14
+ sendPollRequest: async (path, pollOptions) => {
15
15
  // This is the callback that is going to be called to poll the service
16
16
  // to get the latest status. We use the client provided and the polling path
17
17
  // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
@@ -19,7 +19,7 @@ export async function getLongRunningPoller(client, initialResponse, options = {}
19
19
  function abortListener() {
20
20
  abortController.abort();
21
21
  }
22
- const inputAbortSignal = sendPollRequestOptions === null || sendPollRequestOptions === void 0 ? void 0 : sendPollRequestOptions.abortSignal;
22
+ const inputAbortSignal = pollOptions === null || pollOptions === void 0 ? void 0 : pollOptions.abortSignal;
23
23
  const abortSignal = abortController.signal;
24
24
  if (inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.aborted) {
25
25
  abortController.abort();
@@ -50,7 +50,7 @@ export async function getLongRunningPoller(client, initialResponse, options = {}
50
50
  return httpPoller.isDone;
51
51
  },
52
52
  isStopped() {
53
- return httpPoller.isStopped;
53
+ return abortController.signal.aborted;
54
54
  },
55
55
  getOperationState() {
56
56
  if (!httpPoller.operationState) {
@@ -1 +1 @@
1
- {"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAML,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAqFzB,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAc,EACd,eAAwB,EACxB,UAAqE,EAAE;;IAEvE,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAC9C,MAAM,MAAM,GAAkC;QAC5C,kBAAkB,EAAE,KAAK,IAAI,EAAE;YAC7B,sGAAsG;YACtG,2FAA2F;YAC3F,6BAA6B;YAC7B,OAAO,cAAc,CAAC,eAAe,CAAC,CAAC;QACzC,CAAC;QACD,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,sBAA0D,EAAE,EAAE;YAC1F,sEAAsE;YACtE,4EAA4E;YAC5E,0JAA0J;YAC1J,+GAA+G;YAC/G,SAAS,aAAa;gBACpB,eAAe,CAAC,KAAK,EAAE,CAAC;YAC1B,CAAC;YACD,MAAM,gBAAgB,GAAG,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAE,WAAW,CAAC;YAC7D,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,CAAC;YAC3C,IAAI,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,OAAO,EAAE,CAAC;gBAC9B,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AAc,CAAC;QACnC,CAAC;QACD,SAAS;YACP,OAAO,UAAU,CAAC,MAAM,CAAC;QAC3B,CAAC;QACD,QAAQ;YACN,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CACb,4IAA4I,CAC7I,CAAC;YACJ,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,KAAK,EAAE,UAAU,CAAC,cAAc;aACjC,CAAC,CAAC;QACL,CAAC;QACD,WAAW;YACT,eAAe,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC;QACD,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,SAAS,EAAE,UAAU,CAAC,SAAS;KAChC,CAAC;IACF,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CACrB,QAAiB;IAEjB,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,SAAS,CAAC,uDAAuD,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,OAAO;QACL,YAAY,EAAE,QAAQ;QACtB,WAAW,kCACN,QAAQ,KACX,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI,GACpB;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport {\n CancelOnProgress,\n CreateHttpPollerOptions,\n LongRunningOperation,\n OperationResponse,\n OperationState,\n createHttpPoller,\n} from \"@azure/core-lro\";\nimport {\n StartTranslation202Response,\n StartTranslationDefaultResponse,\n StartTranslationLogicalResponse,\n} from \"./responses.js\";\n\n/**\n * A simple poller that can be used to poll a long running operation.\n */\nexport interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {\n /**\n * Returns true if the poller has finished polling.\n */\n isDone(): boolean;\n /**\n * Returns true if the poller is stopped.\n */\n isStopped(): boolean;\n /**\n * Returns the state of the operation.\n */\n getOperationState(): TState;\n /**\n * Returns the result value of the operation,\n * regardless of the state of the poller.\n * It can return undefined or an incomplete form of the final TResult value\n * depending on the implementation.\n */\n getResult(): TResult | undefined;\n /**\n * Returns a promise that will resolve once a single polling request finishes.\n * It does this by calling the update method of the Poller's operation.\n */\n poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;\n /**\n * Returns a promise that will resolve once the underlying operation is completed.\n */\n pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;\n /**\n * Invokes the provided callback after each polling is completed,\n * sending the current state of the poller's operation.\n *\n * It returns a method that can be used to stop receiving updates on the given callback function.\n */\n onProgress(callback: (state: TState) => void): CancelOnProgress;\n\n /**\n * Returns a promise that could be used for serialized version of the poller's operation\n * by invoking the operation's serialize method.\n */\n serialize(): Promise<string>;\n\n /**\n * Wait the poller to be submitted.\n */\n submitted(): Promise<void>;\n\n /**\n * Returns a string representation of the poller's operation. Similar to serialize but returns a string.\n * @deprecated Use serialize() instead.\n */\n toString(): string;\n\n /**\n * Stops the poller from continuing to poll. Please note this will only stop the client-side polling\n * @deprecated Use abortSignal to stop polling instead.\n */\n stopPolling(): void;\n}\n\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport async function getLongRunningPoller<\n TResult extends StartTranslationLogicalResponse | StartTranslationDefaultResponse,\n>(\n client: Client,\n initialResponse: StartTranslation202Response | StartTranslationDefaultResponse,\n options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>,\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;\nexport async function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {},\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {\n const abortController = new AbortController();\n const poller: LongRunningOperation<TResult> = {\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path, sendPollRequestOptions?: { abortSignal?: AbortSignalLike }) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n function abortListener(): void {\n abortController.abort();\n }\n const inputAbortSignal = sendPollRequestOptions?.abortSignal;\n const abortSignal = abortController.signal;\n if (inputAbortSignal?.aborted) {\n abortController.abort();\n } else if (!abortSignal.aborted) {\n inputAbortSignal?.addEventListener(\"abort\", abortListener, {\n once: true,\n });\n }\n let response;\n try {\n response = await client\n .pathUnchecked(path ?? initialResponse.request.url)\n .get({ abortSignal });\n } finally {\n inputAbortSignal?.removeEventListener(\"abort\", abortListener);\n }\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;\n const httpPoller = createHttpPoller(poller, options);\n const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {\n isDone() {\n return httpPoller.isDone;\n },\n isStopped() {\n return httpPoller.isStopped;\n },\n getOperationState() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return httpPoller.operationState;\n },\n getResult() {\n return httpPoller.result;\n },\n toString() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return JSON.stringify({\n state: httpPoller.operationState,\n });\n },\n stopPolling() {\n abortController.abort();\n },\n onProgress: httpPoller.onProgress,\n poll: httpPoller.poll,\n pollUntilDone: httpPoller.pollUntilDone,\n serialize: httpPoller.serialize,\n submitted: httpPoller.submitted,\n };\n return simplePoller;\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResult extends HttpResponse>(\n response: TResult,\n): OperationResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n"]}
1
+ {"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAclC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAuFnD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAc,EACd,eAAwB,EACxB,UAAqE,EAAE;;IAEvE,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAC9C,MAAM,MAAM,GAA8B;QACxC,kBAAkB,EAAE,KAAK,IAAI,EAAE;YAC7B,sGAAsG;YACtG,2FAA2F;YAC3F,6BAA6B;YAC7B,OAAO,cAAc,CAAC,eAAe,CAAC,CAAC;QACzC,CAAC;QACD,eAAe,EAAE,KAAK,EAAE,IAAY,EAAE,WAA+C,EAAE,EAAE;YACvF,sEAAsE;YACtE,4EAA4E;YAC5E,0JAA0J;YAC1J,+GAA+G;YAC/G,SAAS,aAAa;gBACpB,eAAe,CAAC,KAAK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J,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport type { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type {\n CancelOnProgress,\n CreateHttpPollerOptions,\n RunningOperation,\n OperationResponse,\n OperationState,\n} from \"@azure/core-lro\";\nimport { createHttpPoller } from \"@azure/core-lro\";\nimport type {\n StartTranslation202Response,\n StartTranslationDefaultResponse,\n StartTranslationLogicalResponse,\n} from \"./responses.js\";\n\n/**\n * A simple poller that can be used to poll a long running operation.\n */\nexport interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {\n /**\n * Returns true if the poller has finished polling.\n */\n isDone(): boolean;\n /**\n * Returns the state of the operation.\n */\n getOperationState(): TState;\n /**\n * Returns the result value of the operation,\n * regardless of the state of the poller.\n * It can return undefined or an incomplete form of the final TResult value\n * depending on the implementation.\n */\n getResult(): TResult | undefined;\n /**\n * Returns a promise that will resolve once a single polling request finishes.\n * It does this by calling the update method of the Poller's operation.\n */\n poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;\n /**\n * Returns a promise that will resolve once the underlying operation is completed.\n */\n pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;\n /**\n * Invokes the provided callback after each polling is completed,\n * sending the current state of the poller's operation.\n *\n * It returns a method that can be used to stop receiving updates on the given callback function.\n */\n onProgress(callback: (state: TState) => void): CancelOnProgress;\n\n /**\n * Returns a promise that could be used for serialized version of the poller's operation\n * by invoking the operation's serialize method.\n */\n serialize(): Promise<string>;\n\n /**\n * Wait the poller to be submitted.\n */\n submitted(): Promise<void>;\n\n /**\n * Returns a string representation of the poller's operation. Similar to serialize but returns a string.\n * @deprecated Use serialize() instead.\n */\n toString(): string;\n\n /**\n * Stops the poller from continuing to poll. Please note this will only stop the client-side polling\n * @deprecated Use abortSignal to stop polling instead.\n */\n stopPolling(): void;\n\n /**\n * Returns true if the poller is stopped.\n * @deprecated Use abortSignal status to track this instead.\n */\n isStopped(): boolean;\n}\n\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport async function getLongRunningPoller<\n TResult extends StartTranslationLogicalResponse | StartTranslationDefaultResponse,\n>(\n client: Client,\n initialResponse: StartTranslation202Response | StartTranslationDefaultResponse,\n options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>,\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;\nexport async function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {},\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {\n const abortController = new AbortController();\n const poller: RunningOperation<TResult> = {\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path: string, pollOptions?: { abortSignal?: AbortSignalLike }) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n function abortListener(): void {\n abortController.abort();\n }\n const inputAbortSignal = pollOptions?.abortSignal;\n const abortSignal = abortController.signal;\n if (inputAbortSignal?.aborted) {\n abortController.abort();\n } else if (!abortSignal.aborted) {\n inputAbortSignal?.addEventListener(\"abort\", abortListener, {\n once: true,\n });\n }\n let response;\n try {\n response = await client\n .pathUnchecked(path ?? initialResponse.request.url)\n .get({ abortSignal });\n } finally {\n inputAbortSignal?.removeEventListener(\"abort\", abortListener);\n }\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;\n const httpPoller = createHttpPoller(poller, options);\n const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {\n isDone() {\n return httpPoller.isDone;\n },\n isStopped() {\n return abortController.signal.aborted;\n },\n getOperationState() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return httpPoller.operationState;\n },\n getResult() {\n return httpPoller.result;\n },\n toString() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return JSON.stringify({\n state: httpPoller.operationState,\n });\n },\n stopPolling() {\n abortController.abort();\n },\n onProgress: httpPoller.onProgress,\n poll: httpPoller.poll,\n pollUntilDone: httpPoller.pollUntilDone,\n serialize: httpPoller.serialize,\n submitted: httpPoller.submitted,\n };\n return simplePoller;\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResult extends HttpResponse>(\n response: TResult,\n): OperationResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  export {};
4
4
  //# sourceMappingURL=responses.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/responses.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { HttpResponse, ErrorResponse } from \"@azure-rest/core-client\";\nimport {\n TranslationsStatusOutput,\n DocumentStatusOutput,\n TranslationStatusOutput,\n DocumentsStatusOutput,\n SupportedFileFormatsOutput,\n} from \"./outputModels.js\";\n\nexport interface DocumentTranslate200Headers {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\n/** The request has succeeded. */\nexport interface DocumentTranslate200Response extends HttpResponse {\n status: \"200\";\n /** Value may contain any sequence of octets */\n body: Uint8Array;\n headers: RawHttpHeaders & DocumentTranslate200Headers;\n}\n\nexport interface DocumentTranslateDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DocumentTranslateDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & DocumentTranslateDefaultHeaders;\n}\n\nexport interface StartTranslation202Headers {\n /** Link to the translation operation status */\n \"operation-location\": string;\n}\n\n/** The request has been accepted for processing, but processing has not yet completed. */\nexport interface StartTranslation202Response extends HttpResponse {\n status: \"202\";\n headers: RawHttpHeaders & StartTranslation202Headers;\n}\n\nexport interface StartTranslationDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface StartTranslationDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & StartTranslationDefaultHeaders;\n}\n\n/** The final response for long-running startTranslation operation */\nexport interface StartTranslationLogicalResponse extends HttpResponse {\n status: \"200\";\n}\n\n/** The request has succeeded. */\nexport interface GetTranslationsStatus200Response extends HttpResponse {\n status: \"200\";\n body: TranslationsStatusOutput;\n}\n\nexport interface GetTranslationsStatusDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetTranslationsStatusDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetTranslationsStatusDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetDocumentStatus200Response extends HttpResponse {\n status: \"200\";\n body: DocumentStatusOutput;\n}\n\nexport interface GetDocumentStatusDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetDocumentStatusDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetDocumentStatusDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetTranslationStatus200Response extends HttpResponse {\n status: \"200\";\n body: TranslationStatusOutput;\n}\n\nexport interface GetTranslationStatusDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetTranslationStatusDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetTranslationStatusDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface CancelTranslation200Response extends HttpResponse {\n status: \"200\";\n body: TranslationStatusOutput;\n}\n\nexport interface CancelTranslationDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface CancelTranslationDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & CancelTranslationDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetDocumentsStatus200Response extends HttpResponse {\n status: \"200\";\n body: DocumentsStatusOutput;\n}\n\nexport interface GetDocumentsStatusDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetDocumentsStatusDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetDocumentsStatusDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetSupportedFormats200Response extends HttpResponse {\n status: \"200\";\n body: SupportedFileFormatsOutput;\n}\n\nexport interface GetSupportedFormatsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetSupportedFormatsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetSupportedFormatsDefaultHeaders;\n}\n"]}
1
+ {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/responses.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport type { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport type { HttpResponse, ErrorResponse } from \"@azure-rest/core-client\";\nimport type {\n TranslationsStatusOutput,\n DocumentStatusOutput,\n TranslationStatusOutput,\n DocumentsStatusOutput,\n SupportedFileFormatsOutput,\n} from \"./outputModels.js\";\n\nexport interface DocumentTranslate200Headers {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n /** response content type */\n \"content-type\": \"application/octet-stream\";\n}\n\n/** The request has succeeded. */\nexport interface DocumentTranslate200Response extends HttpResponse {\n status: \"200\";\n /** Value may contain any sequence of octets */\n body: Uint8Array;\n headers: RawHttpHeaders & DocumentTranslate200Headers;\n}\n\nexport interface DocumentTranslateDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DocumentTranslateDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & DocumentTranslateDefaultHeaders;\n}\n\nexport interface StartTranslation202Headers {\n /** Link to the translation operation status */\n \"operation-location\": string;\n}\n\n/** The request has been accepted for processing, but processing has not yet completed. */\nexport interface StartTranslation202Response extends HttpResponse {\n status: \"202\";\n headers: RawHttpHeaders & StartTranslation202Headers;\n}\n\nexport interface StartTranslationDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface StartTranslationDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & StartTranslationDefaultHeaders;\n}\n\n/** The final response for long-running startTranslation operation */\nexport interface StartTranslationLogicalResponse extends HttpResponse {\n status: \"200\";\n}\n\n/** The request has succeeded. */\nexport interface GetTranslationsStatus200Response extends HttpResponse {\n status: \"200\";\n body: TranslationsStatusOutput;\n}\n\nexport interface GetTranslationsStatusDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetTranslationsStatusDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetTranslationsStatusDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetDocumentStatus200Response extends HttpResponse {\n status: \"200\";\n body: DocumentStatusOutput;\n}\n\nexport interface GetDocumentStatusDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetDocumentStatusDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetDocumentStatusDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetTranslationStatus200Response extends HttpResponse {\n status: \"200\";\n body: TranslationStatusOutput;\n}\n\nexport interface GetTranslationStatusDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetTranslationStatusDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetTranslationStatusDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface CancelTranslation200Response extends HttpResponse {\n status: \"200\";\n body: TranslationStatusOutput;\n}\n\nexport interface CancelTranslationDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface CancelTranslationDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & CancelTranslationDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetDocumentsStatus200Response extends HttpResponse {\n status: \"200\";\n body: DocumentsStatusOutput;\n}\n\nexport interface GetDocumentsStatusDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetDocumentsStatusDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetDocumentsStatusDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetSupportedFormats200Response extends HttpResponse {\n status: \"200\";\n body: SupportedFileFormatsOutput;\n}\n\nexport interface GetSupportedFormatsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetSupportedFormatsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetSupportedFormatsDefaultHeaders;\n}\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "A generated SDK for DocumentTranslationClient.",
6
- "version": "1.0.0-beta.2",
6
+ "version": "1.0.0",
7
7
  "keywords": [
8
8
  "node",
9
9
  "azure",
@@ -46,77 +46,71 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@azure/core-rest-pipeline": "^1.8.0",
50
- "@azure/logger": "^1.0.0",
51
- "@azure/core-paging": "^1.2.0",
52
49
  "@azure-rest/core-client": "^2.0.0",
50
+ "@azure/abort-controller": "^2.1.2",
53
51
  "@azure/core-auth": "^1.6.0",
54
- "tslib": "^2.6.2",
55
- "@azure/core-lro": "3.0.0-beta.1",
56
- "@azure/abort-controller": "^2.0.0"
52
+ "@azure/core-lro": "^3.0.0",
53
+ "@azure/core-paging": "^1.5.0",
54
+ "@azure/core-rest-pipeline": "^1.16.3",
55
+ "@azure/logger": "^1.0.0",
56
+ "tslib": "^2.6.2"
57
57
  },
58
58
  "devDependencies": {
59
- "@azure/storage-blob": "^12.23.0",
60
- "@microsoft/api-extractor": "^7.47.0",
61
- "rimraf": "^5.0.5",
62
- "autorest": "latest",
63
- "@types/node": "^18.0.0",
64
- "dotenv": "^16.0.0",
65
- "eslint": "^8.55.0",
66
- "mkdirp": "^3.0.1",
67
- "source-map-support": "^0.5.9",
68
- "typescript": "~5.4.5",
59
+ "@azure-tools/test-credential": "^1.0.0",
60
+ "@azure-tools/test-recorder": "^3.5.2",
69
61
  "@azure/dev-tool": "^1.0.0",
70
62
  "@azure/eslint-plugin-azure-sdk": "^3.0.0",
71
- "@azure-tools/test-credential": "^1.0.0",
72
63
  "@azure/identity": "^4.0.1",
73
- "@azure-tools/test-recorder": "^3.5.2",
74
- "mocha": "^10.0.0",
75
- "@types/mocha": "^10.0.0",
76
- "cross-env": "^7.0.2",
64
+ "@azure/storage-blob": "^12.23.0",
77
65
  "@types/chai": "^4.2.8",
66
+ "@types/mocha": "^10.0.0",
67
+ "@types/node": "^18.0.0",
68
+ "autorest": "latest",
78
69
  "chai": "^4.2.0",
70
+ "dotenv": "^16.0.0",
71
+ "eslint": "^9.9.0",
72
+ "karma": "^6.2.0",
79
73
  "karma-chrome-launcher": "^3.0.0",
80
74
  "karma-coverage": "^2.0.0",
81
75
  "karma-env-preprocessor": "^0.1.1",
82
76
  "karma-firefox-launcher": "^1.1.0",
83
77
  "karma-junit-reporter": "^2.0.1",
84
- "karma-mocha-reporter": "^2.2.5",
85
78
  "karma-mocha": "^2.0.1",
79
+ "karma-mocha-reporter": "^2.2.5",
86
80
  "karma-source-map-support": "~1.4.0",
87
81
  "karma-sourcemap-loader": "^0.3.8",
88
- "karma": "^6.2.0",
82
+ "mocha": "^10.0.0",
89
83
  "nyc": "^17.0.0",
84
+ "source-map-support": "^0.5.9",
90
85
  "ts-node": "^10.0.0",
91
- "prettier": "^3.2.5",
92
- "tshy": "1.15.1"
86
+ "typescript": "~5.6.2"
93
87
  },
94
88
  "scripts": {
95
- "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
89
+ "build": "npm run clean && tsc -p . && dev-tool run bundle && dev-tool run vendored mkdirp ./review && dev-tool run extract-api",
96
90
  "build:browser": "tsc -p . && dev-tool run bundle",
91
+ "build:debug": "tsc -p . && dev-tool run bundle && dev-tool run extract-api",
97
92
  "build:node": "tsc -p . && dev-tool run bundle --browser-test false",
98
93
  "build:samples": "echo Obsolete.",
99
94
  "build:test": "tsc -p . && dev-tool run bundle",
100
- "build:debug": "tsc -p . && dev-tool run bundle && dev-tool run extract-api",
101
95
  "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
102
- "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
96
+ "clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
103
97
  "execute:samples": "dev-tool samples run samples-dev",
104
- "extract-api": "rimraf review && mkdirp ./review && dev-tool run extract-api",
98
+ "extract-api": "dev-tool run vendored rimraf review && dev-tool run vendored mkdirp ./review && dev-tool run extract-api",
105
99
  "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
106
100
  "generate:client": "echo skipped",
101
+ "integration-test": "npm run integration-test:node && npm run integration-test:browser",
107
102
  "integration-test:browser": "dev-tool run test:browser",
108
103
  "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'",
109
- "integration-test": "npm run integration-test:node && npm run integration-test:browser",
110
- "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
111
- "lint": "eslint package.json api-extractor.json src test --ext .ts",
104
+ "lint": "eslint package.json api-extractor.json src test",
105
+ "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
112
106
  "pack": "npm pack 2>&1",
107
+ "test": "npm run clean && npm run build:test && npm run unit-test",
113
108
  "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
114
109
  "test:node": "npm run clean && npm run build:test && npm run unit-test:node",
115
- "test": "npm run clean && npm run build:test && npm run unit-test",
116
110
  "unit-test": "npm run unit-test:node && npm run unit-test:browser",
117
- "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'",
118
111
  "unit-test:browser": "dev-tool run test:browser",
119
- "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && dev-tool run extract-api"
112
+ "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'",
113
+ "update-snippets": "echo skipped"
120
114
  },
121
115
  "sideEffects": false,
122
116
  "autoPublish": false