@azure-rest/ai-anomaly-detector 1.0.0-alpha.20241029.1 → 1.0.0-alpha.20241030.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js.map +1 -1
- package/dist-esm/src/anomalyDetectorRest.js.map +1 -1
- package/dist-esm/src/clientDefinitions.js.map +1 -1
- package/dist-esm/src/isUnexpected.js.map +1 -1
- package/dist-esm/src/paginateHelper.js.map +1 -1
- package/dist-esm/src/parameters.js.map +1 -1
- package/dist-esm/src/responses.js.map +1 -1
- package/package.json +1 -1
- package/review/ai-anomaly-detector.api.md +9 -9
- package/types/ai-anomaly-detector.d.ts +9 -9
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/anomalyDetectorRest.ts","../src/isUnexpected.ts","../src/paginateHelper.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { KeyCredential } from \"@azure/core-auth\";\nimport { AnomalyDetectorRestClient } from \"./clientDefinitions\";\n\nexport interface AnomalyDetectorRestClientOptions extends ClientOptions {\n ApiVersion?: string;\n}\n\n/**\n * Initialize a new instance of the class AnomalyDetectorRestClient class.\n * @param Endpoint type: string\n * @param credentials type: KeyCredential\n */\nexport default function createClient(\n Endpoint: string,\n credentials: KeyCredential,\n options: AnomalyDetectorRestClientOptions = {},\n): AnomalyDetectorRestClient {\n const ApiVersion = options.ApiVersion ?? \"v1.1\";\n const baseUrl = options.baseUrl ?? `${Endpoint}/anomalydetector/${ApiVersion}`;\n\n options = {\n ...options,\n credentials: {\n apiKeyHeaderName: \"Ocp-Apim-Subscription-Key\",\n },\n };\n\n const userAgentInfo = `azsdk-js-ai-anomaly-detector-rest/1.0.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n };\n\n const client = getClient(baseUrl, credentials, options) as AnomalyDetectorRestClient;\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n DetectUnivariateEntireSeries200Response,\n DetectUnivariateEntireSeriesDefaultResponse,\n DetectUnivariateLastPoint200Response,\n DetectUnivariateLastPointDefaultResponse,\n DetectUnivariateChangePoint200Response,\n DetectUnivariateChangePointDefaultResponse,\n GetMultivariateBatchDetectionResult200Response,\n GetMultivariateBatchDetectionResultDefaultResponse,\n TrainMultivariateModel201Response,\n TrainMultivariateModelDefaultResponse,\n ListMultivariateModels200Response,\n ListMultivariateModelsDefaultResponse,\n DeleteMultivariateModel204Response,\n DeleteMultivariateModelDefaultResponse,\n GetMultivariateModel200Response,\n GetMultivariateModelDefaultResponse,\n DetectMultivariateBatchAnomaly202Response,\n DetectMultivariateBatchAnomalyDefaultResponse,\n DetectMultivariateLastAnomaly200Response,\n DetectMultivariateLastAnomalyDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"POST /timeseries/entire/detect\": [\"200\"],\n \"POST /timeseries/last/detect\": [\"200\"],\n \"POST /timeseries/changepoint/detect\": [\"200\"],\n \"GET /multivariate/detect-batch/{resultId}\": [\"200\"],\n \"POST /multivariate/models\": [\"201\"],\n \"GET /multivariate/models\": [\"200\"],\n \"DELETE /multivariate/models/{modelId}\": [\"204\"],\n \"GET /multivariate/models/{modelId}\": [\"200\"],\n \"POST /multivariate/models/{modelId}:detect-batch\": [\"202\"],\n \"POST /multivariate/models/{modelId}:detect-last\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: DetectUnivariateEntireSeries200Response | DetectUnivariateEntireSeriesDefaultResponse,\n): response is DetectUnivariateEntireSeriesDefaultResponse;\nexport function isUnexpected(\n response: DetectUnivariateLastPoint200Response | DetectUnivariateLastPointDefaultResponse,\n): response is DetectUnivariateLastPointDefaultResponse;\nexport function isUnexpected(\n response: DetectUnivariateChangePoint200Response | DetectUnivariateChangePointDefaultResponse,\n): response is DetectUnivariateChangePointDefaultResponse;\nexport function isUnexpected(\n response:\n | GetMultivariateBatchDetectionResult200Response\n | GetMultivariateBatchDetectionResultDefaultResponse,\n): response is GetMultivariateBatchDetectionResultDefaultResponse;\nexport function isUnexpected(\n response: TrainMultivariateModel201Response | TrainMultivariateModelDefaultResponse,\n): response is TrainMultivariateModelDefaultResponse;\nexport function isUnexpected(\n response: ListMultivariateModels200Response | ListMultivariateModelsDefaultResponse,\n): response is ListMultivariateModelsDefaultResponse;\nexport function isUnexpected(\n response: DeleteMultivariateModel204Response | DeleteMultivariateModelDefaultResponse,\n): response is DeleteMultivariateModelDefaultResponse;\nexport function isUnexpected(\n response: GetMultivariateModel200Response | GetMultivariateModelDefaultResponse,\n): response is GetMultivariateModelDefaultResponse;\nexport function isUnexpected(\n response:\n | DetectMultivariateBatchAnomaly202Response\n | DetectMultivariateBatchAnomalyDefaultResponse,\n): response is DetectMultivariateBatchAnomalyDefaultResponse;\nexport function isUnexpected(\n response: DetectMultivariateLastAnomaly200Response | DetectMultivariateLastAnomalyDefaultResponse,\n): response is DetectMultivariateLastAnomalyDefaultResponse;\nexport function isUnexpected(\n response:\n | DetectUnivariateEntireSeries200Response\n | DetectUnivariateEntireSeriesDefaultResponse\n | DetectUnivariateLastPoint200Response\n | DetectUnivariateLastPointDefaultResponse\n | DetectUnivariateChangePoint200Response\n | DetectUnivariateChangePointDefaultResponse\n | GetMultivariateBatchDetectionResult200Response\n | GetMultivariateBatchDetectionResultDefaultResponse\n | TrainMultivariateModel201Response\n | TrainMultivariateModelDefaultResponse\n | ListMultivariateModels200Response\n | ListMultivariateModelsDefaultResponse\n | DeleteMultivariateModel204Response\n | DeleteMultivariateModelDefaultResponse\n | GetMultivariateModel200Response\n | GetMultivariateModelDefaultResponse\n | DetectMultivariateBatchAnomaly202Response\n | DetectMultivariateBatchAnomalyDefaultResponse\n | DetectMultivariateLastAnomaly200Response\n | DetectMultivariateLastAnomalyDefaultResponse,\n): response is\n | DetectUnivariateEntireSeriesDefaultResponse\n | DetectUnivariateLastPointDefaultResponse\n | DetectUnivariateChangePointDefaultResponse\n | GetMultivariateBatchDetectionResultDefaultResponse\n | TrainMultivariateModelDefaultResponse\n | ListMultivariateModelsDefaultResponse\n | DeleteMultivariateModelDefaultResponse\n | GetMultivariateModelDefaultResponse\n | DetectMultivariateBatchAnomalyDefaultResponse\n | DetectMultivariateLastAnomalyDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n","// 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 | {\n body: { value?: infer TPage };\n }\n | {\n body: { models?: 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 // We need to check the response for success before trying to inspect it looking for\n // the properties to use for nextLink and itemName\n checkPagingRequest(initialResponse);\n const { itemName, nextLinkName } = getPaginationProperties(initialResponse);\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\n/**\n * Extracts the itemName and nextLinkName from the initial response to use them for pagination\n */\nfunction getPaginationProperties(initialResponse: PathUncheckedResponse) {\n // Build a set with the passed custom nextLinkNames\n const nextLinkNames = new Set([\"nextLink\"]);\n\n // Build a set with the passed custom set of itemNames\n const itemNames = new Set([\"value\", \"models\"]);\n\n let nextLinkName: string | undefined;\n let itemName: string | undefined;\n\n for (const name of nextLinkNames) {\n const nextLink = (initialResponse.body as Record<string, unknown>)[name] as string;\n if (nextLink) {\n nextLinkName = name;\n break;\n }\n }\n\n for (const name of itemNames) {\n const item = (initialResponse.body as Record<string, unknown>)[name] as string;\n if (item) {\n itemName = name;\n break;\n }\n }\n\n if (!itemName) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${[\n ...itemNames,\n ].join(\" OR \")}`,\n );\n }\n\n return { itemName, nextLinkName };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport AnomalyDetectorRest from \"./anomalyDetectorRest\";\n\nexport * from \"./anomalyDetectorRest\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./isUnexpected\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./paginateHelper\";\n\nexport default AnomalyDetectorRest;\n"],"names":["getClient","getPagedAsyncIterator","createRestError"],"mappings":";;;;;;;AAAA;AACA;AAUA;;;;AAIG;AACW,SAAU,YAAY,CAClC,QAAgB,EAChB,WAA0B,EAC1B,OAAA,GAA4C,EAAE,EAAA;;IAE9C,MAAM,UAAU,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAA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G,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAE9C,IAAA,IAAI,YAAgC;AACpC,IAAA,IAAI,QAA4B;AAEhC,IAAA,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE;QAChC,MAAM,QAAQ,GAAI,eAAe,CAAC,IAAgC,CAAC,IAAI,CAAW;QAClF,IAAI,QAAQ,EAAE;YACZ,YAAY,GAAG,IAAI;YACnB;;;AAIJ,IAAA,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;QAC5B,MAAM,IAAI,GAAI,eAAe,CAAC,IAAgC,CAAC,IAAI,CAAW;QAC9E,IAAI,IAAI,EAAE;YACR,QAAQ,GAAG,IAAI;YACf;;;IAIJ,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,CAAkF,+EAAA,EAAA;AAChF,YAAA,GAAG,SAAS;AACb,SAAA,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,CAAE,CACjB;;AAGH,IAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE;AACnC;;AChLA;AACA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/anomalyDetectorRest.ts","../src/isUnexpected.ts","../src/paginateHelper.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport type { KeyCredential } from \"@azure/core-auth\";\nimport type { AnomalyDetectorRestClient } from \"./clientDefinitions\";\n\nexport interface AnomalyDetectorRestClientOptions extends ClientOptions {\n ApiVersion?: string;\n}\n\n/**\n * Initialize a new instance of the class AnomalyDetectorRestClient class.\n * @param Endpoint type: string\n * @param credentials type: KeyCredential\n */\nexport default function createClient(\n Endpoint: string,\n credentials: KeyCredential,\n options: AnomalyDetectorRestClientOptions = {},\n): AnomalyDetectorRestClient {\n const ApiVersion = options.ApiVersion ?? \"v1.1\";\n const baseUrl = options.baseUrl ?? `${Endpoint}/anomalydetector/${ApiVersion}`;\n\n options = {\n ...options,\n credentials: {\n apiKeyHeaderName: \"Ocp-Apim-Subscription-Key\",\n },\n };\n\n const userAgentInfo = `azsdk-js-ai-anomaly-detector-rest/1.0.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n };\n\n const client = getClient(baseUrl, credentials, options) as AnomalyDetectorRestClient;\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n DetectUnivariateEntireSeries200Response,\n DetectUnivariateEntireSeriesDefaultResponse,\n DetectUnivariateLastPoint200Response,\n DetectUnivariateLastPointDefaultResponse,\n DetectUnivariateChangePoint200Response,\n DetectUnivariateChangePointDefaultResponse,\n GetMultivariateBatchDetectionResult200Response,\n GetMultivariateBatchDetectionResultDefaultResponse,\n TrainMultivariateModel201Response,\n TrainMultivariateModelDefaultResponse,\n ListMultivariateModels200Response,\n ListMultivariateModelsDefaultResponse,\n DeleteMultivariateModel204Response,\n DeleteMultivariateModelDefaultResponse,\n GetMultivariateModel200Response,\n GetMultivariateModelDefaultResponse,\n DetectMultivariateBatchAnomaly202Response,\n DetectMultivariateBatchAnomalyDefaultResponse,\n DetectMultivariateLastAnomaly200Response,\n DetectMultivariateLastAnomalyDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"POST /timeseries/entire/detect\": [\"200\"],\n \"POST /timeseries/last/detect\": [\"200\"],\n \"POST /timeseries/changepoint/detect\": [\"200\"],\n \"GET /multivariate/detect-batch/{resultId}\": [\"200\"],\n \"POST /multivariate/models\": [\"201\"],\n \"GET /multivariate/models\": [\"200\"],\n \"DELETE /multivariate/models/{modelId}\": [\"204\"],\n \"GET /multivariate/models/{modelId}\": [\"200\"],\n \"POST /multivariate/models/{modelId}:detect-batch\": [\"202\"],\n \"POST /multivariate/models/{modelId}:detect-last\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: DetectUnivariateEntireSeries200Response | DetectUnivariateEntireSeriesDefaultResponse,\n): response is DetectUnivariateEntireSeriesDefaultResponse;\nexport function isUnexpected(\n response: DetectUnivariateLastPoint200Response | DetectUnivariateLastPointDefaultResponse,\n): response is DetectUnivariateLastPointDefaultResponse;\nexport function isUnexpected(\n response: DetectUnivariateChangePoint200Response | DetectUnivariateChangePointDefaultResponse,\n): response is DetectUnivariateChangePointDefaultResponse;\nexport function isUnexpected(\n response:\n | GetMultivariateBatchDetectionResult200Response\n | GetMultivariateBatchDetectionResultDefaultResponse,\n): response is GetMultivariateBatchDetectionResultDefaultResponse;\nexport function isUnexpected(\n response: TrainMultivariateModel201Response | TrainMultivariateModelDefaultResponse,\n): response is TrainMultivariateModelDefaultResponse;\nexport function isUnexpected(\n response: ListMultivariateModels200Response | ListMultivariateModelsDefaultResponse,\n): response is ListMultivariateModelsDefaultResponse;\nexport function isUnexpected(\n response: DeleteMultivariateModel204Response | DeleteMultivariateModelDefaultResponse,\n): response is DeleteMultivariateModelDefaultResponse;\nexport function isUnexpected(\n response: GetMultivariateModel200Response | GetMultivariateModelDefaultResponse,\n): response is GetMultivariateModelDefaultResponse;\nexport function isUnexpected(\n response:\n | DetectMultivariateBatchAnomaly202Response\n | DetectMultivariateBatchAnomalyDefaultResponse,\n): response is DetectMultivariateBatchAnomalyDefaultResponse;\nexport function isUnexpected(\n response: DetectMultivariateLastAnomaly200Response | DetectMultivariateLastAnomalyDefaultResponse,\n): response is DetectMultivariateLastAnomalyDefaultResponse;\nexport function isUnexpected(\n response:\n | DetectUnivariateEntireSeries200Response\n | DetectUnivariateEntireSeriesDefaultResponse\n | DetectUnivariateLastPoint200Response\n | DetectUnivariateLastPointDefaultResponse\n | DetectUnivariateChangePoint200Response\n | DetectUnivariateChangePointDefaultResponse\n | GetMultivariateBatchDetectionResult200Response\n | GetMultivariateBatchDetectionResultDefaultResponse\n | TrainMultivariateModel201Response\n | TrainMultivariateModelDefaultResponse\n | ListMultivariateModels200Response\n | ListMultivariateModelsDefaultResponse\n | DeleteMultivariateModel204Response\n | DeleteMultivariateModelDefaultResponse\n | GetMultivariateModel200Response\n | GetMultivariateModelDefaultResponse\n | DetectMultivariateBatchAnomaly202Response\n | DetectMultivariateBatchAnomalyDefaultResponse\n | DetectMultivariateLastAnomaly200Response\n | DetectMultivariateLastAnomalyDefaultResponse,\n): response is\n | DetectUnivariateEntireSeriesDefaultResponse\n | DetectUnivariateLastPointDefaultResponse\n | DetectUnivariateChangePointDefaultResponse\n | GetMultivariateBatchDetectionResultDefaultResponse\n | TrainMultivariateModelDefaultResponse\n | ListMultivariateModelsDefaultResponse\n | DeleteMultivariateModelDefaultResponse\n | GetMultivariateModelDefaultResponse\n | DetectMultivariateBatchAnomalyDefaultResponse\n | DetectMultivariateLastAnomalyDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\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 | {\n body: { value?: infer TPage };\n }\n | {\n body: { models?: 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 // We need to check the response for success before trying to inspect it looking for\n // the properties to use for nextLink and itemName\n checkPagingRequest(initialResponse);\n const { itemName, nextLinkName } = getPaginationProperties(initialResponse);\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\n/**\n * Extracts the itemName and nextLinkName from the initial response to use them for pagination\n */\nfunction getPaginationProperties(initialResponse: PathUncheckedResponse) {\n // Build a set with the passed custom nextLinkNames\n const nextLinkNames = new Set([\"nextLink\"]);\n\n // Build a set with the passed custom set of itemNames\n const itemNames = new Set([\"value\", \"models\"]);\n\n let nextLinkName: string | undefined;\n let itemName: string | undefined;\n\n for (const name of nextLinkNames) {\n const nextLink = (initialResponse.body as Record<string, unknown>)[name] as string;\n if (nextLink) {\n nextLinkName = name;\n break;\n }\n }\n\n for (const name of itemNames) {\n const item = (initialResponse.body as Record<string, unknown>)[name] as string;\n if (item) {\n itemName = name;\n break;\n }\n }\n\n if (!itemName) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${[\n ...itemNames,\n ].join(\" OR \")}`,\n );\n }\n\n return { itemName, nextLinkName };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport AnomalyDetectorRest from \"./anomalyDetectorRest\";\n\nexport * from \"./anomalyDetectorRest\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./isUnexpected\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./paginateHelper\";\n\nexport default AnomalyD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AC,MAAM,CAAC,EAAE;QACjD,MAAMC,0BAAe,CACnB,CAAA,6CAAA,EAAgD,QAAQ,CAAC,MAAM,CAAE,CAAA,EACjE,QAAQ,CACT;;AAEL;AAEA;;AAEG;AACH,SAAS,uBAAuB,CAAC,eAAsC,EAAA;;IAErE,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC;;IAG3C,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAE9C,IAAA,IAAI,YAAgC;AACpC,IAAA,IAAI,QAA4B;AAEhC,IAAA,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE;QAChC,MAAM,QAAQ,GAAI,eAAe,CAAC,IAAgC,CAAC,IAAI,CAAW;QAClF,IAAI,QAAQ,EAAE;YACZ,YAAY,GAAG,IAAI;YACnB;;;AAIJ,IAAA,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;QAC5B,MAAM,IAAI,GAAI,eAAe,CAAC,IAAgC,CAAC,IAAI,CAAW;QAC9E,IAAI,IAAI,EAAE;YACR,QAAQ,GAAG,IAAI;YACf;;;IAIJ,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,CAAkF,+EAAA,EAAA;AAChF,YAAA,GAAG,SAAS;AACb,SAAA,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,CAAE,CACjB;;AAGH,IAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE;AACnC;;AClLA;AACA;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anomalyDetectorRest.js","sourceRoot":"","sources":["../../src/anomalyDetectorRest.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"anomalyDetectorRest.js","sourceRoot":"","sources":["../../src/anomalyDetectorRest.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAQpD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,QAAgB,EAChB,WAA0B,EAC1B,UAA4C,EAAE;;IAE9C,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,MAAM,CAAC;IAChD,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,GAAG,QAAQ,oBAAoB,UAAU,EAAE,CAAC;IAE/E,OAAO,mCACF,OAAO,KACV,WAAW,EAAE;YACX,gBAAgB,EAAE,2BAA2B;SAC9C,GACF,CAAC;IAEF,MAAM,aAAa,GAAG,gDAAgD,CAAC;IACvE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,GACF,CAAC;IAEF,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAA8B,CAAC;IAErF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport type { KeyCredential } from \"@azure/core-auth\";\nimport type { AnomalyDetectorRestClient } from \"./clientDefinitions\";\n\nexport interface AnomalyDetectorRestClientOptions extends ClientOptions {\n ApiVersion?: string;\n}\n\n/**\n * Initialize a new instance of the class AnomalyDetectorRestClient class.\n * @param Endpoint type: string\n * @param credentials type: KeyCredential\n */\nexport default function createClient(\n Endpoint: string,\n credentials: KeyCredential,\n options: AnomalyDetectorRestClientOptions = {},\n): AnomalyDetectorRestClient {\n const ApiVersion = options.ApiVersion ?? \"v1.1\";\n const baseUrl = options.baseUrl ?? `${Endpoint}/anomalydetector/${ApiVersion}`;\n\n options = {\n ...options,\n credentials: {\n apiKeyHeaderName: \"Ocp-Apim-Subscription-Key\",\n },\n };\n\n const userAgentInfo = `azsdk-js-ai-anomaly-detector-rest/1.0.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n };\n\n const client = getClient(baseUrl, credentials, options) as AnomalyDetectorRestClient;\n\n return client;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../src/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n DetectUnivariateEntireSeriesParameters,\n DetectUnivariateLastPointParameters,\n DetectUnivariateChangePointParameters,\n GetMultivariateBatchDetectionResultParameters,\n TrainMultivariateModelParameters,\n ListMultivariateModelsParameters,\n DeleteMultivariateModelParameters,\n GetMultivariateModelParameters,\n DetectMultivariateBatchAnomalyParameters,\n DetectMultivariateLastAnomalyParameters,\n} from \"./parameters\";\nimport {\n DetectUnivariateEntireSeries200Response,\n DetectUnivariateEntireSeriesDefaultResponse,\n DetectUnivariateLastPoint200Response,\n DetectUnivariateLastPointDefaultResponse,\n DetectUnivariateChangePoint200Response,\n DetectUnivariateChangePointDefaultResponse,\n GetMultivariateBatchDetectionResult200Response,\n GetMultivariateBatchDetectionResultDefaultResponse,\n TrainMultivariateModel201Response,\n TrainMultivariateModelDefaultResponse,\n ListMultivariateModels200Response,\n ListMultivariateModelsDefaultResponse,\n DeleteMultivariateModel204Response,\n DeleteMultivariateModelDefaultResponse,\n GetMultivariateModel200Response,\n GetMultivariateModelDefaultResponse,\n DetectMultivariateBatchAnomaly202Response,\n DetectMultivariateBatchAnomalyDefaultResponse,\n DetectMultivariateLastAnomaly200Response,\n DetectMultivariateLastAnomalyDefaultResponse,\n} from \"./responses\";\nimport { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface DetectUnivariateEntireSeries {\n /**\n * This operation generates a model with an entire series, each point is detected\n * with the same model. With this method, points before and after a certain point\n * are used to determine whether it is an anomaly. The entire detection can give\n * user an overall status of the time series.\n */\n post(\n options: DetectUnivariateEntireSeriesParameters,\n ): StreamableMethod<\n DetectUnivariateEntireSeries200Response | DetectUnivariateEntireSeriesDefaultResponse\n >;\n}\n\nexport interface DetectUnivariateLastPoint {\n /**\n * This operation generates a model using the points that you sent into the API,\n * and based on all data to determine whether the last point is anomalous.\n */\n post(\n options: DetectUnivariateLastPointParameters,\n ): StreamableMethod<\n DetectUnivariateLastPoint200Response | DetectUnivariateLastPointDefaultResponse\n >;\n}\n\nexport interface DetectUnivariateChangePoint {\n /** Evaluate change point score of every series point */\n post(\n options: DetectUnivariateChangePointParameters,\n ): StreamableMethod<\n DetectUnivariateChangePoint200Response | DetectUnivariateChangePointDefaultResponse\n >;\n}\n\nexport interface GetMultivariateBatchDetectionResult {\n /**\n * For asynchronous inference, get multivariate anomaly detection result based on\n * resultId returned by the BatchDetectAnomaly api.\n */\n get(\n options?: GetMultivariateBatchDetectionResultParameters,\n ): StreamableMethod<\n | GetMultivariateBatchDetectionResult200Response\n | GetMultivariateBatchDetectionResultDefaultResponse\n >;\n}\n\nexport interface TrainMultivariateModel {\n /**\n * Create and train a multivariate anomaly detection model. The request must\n * include a source parameter to indicate an externally accessible Azure blob\n * storage URI.There are two types of data input: An URI pointed to an Azure blob\n * storage folder which contains multiple CSV files, and each CSV file contains\n * two columns, timestamp and variable. Another type of input is an URI pointed to\n * a CSV file in Azure blob storage, which contains all the variables and a\n * timestamp column.\n */\n post(\n options: TrainMultivariateModelParameters,\n ): StreamableMethod<TrainMultivariateModel201Response | TrainMultivariateModelDefaultResponse>;\n /** List models of a resource. */\n get(\n options?: ListMultivariateModelsParameters,\n ): StreamableMethod<ListMultivariateModels200Response | ListMultivariateModelsDefaultResponse>;\n}\n\nexport interface DeleteMultivariateModel {\n /** Delete an existing multivariate model according to the modelId */\n delete(\n options?: DeleteMultivariateModelParameters,\n ): StreamableMethod<DeleteMultivariateModel204Response | DeleteMultivariateModelDefaultResponse>;\n /**\n * Get detailed information of multivariate model, including the training status\n * and variables used in the model.\n */\n get(\n options?: GetMultivariateModelParameters,\n ): StreamableMethod<GetMultivariateModel200Response | GetMultivariateModelDefaultResponse>;\n}\n\nexport interface DetectMultivariateBatchAnomaly {\n /**\n * Submit multivariate anomaly detection task with the modelId of trained model\n * and inference data, the input schema should be the same with the training\n * request. The request will complete asynchronously and return a resultId to\n * query the detection result.The request should be a source link to indicate an\n * externally accessible Azure storage Uri, either pointed to an Azure blob\n * storage folder, or pointed to a CSV file in Azure blob storage.\n */\n post(\n options: DetectMultivariateBatchAnomalyParameters,\n ): StreamableMethod<\n DetectMultivariateBatchAnomaly202Response | DetectMultivariateBatchAnomalyDefaultResponse\n >;\n}\n\nexport interface DetectMultivariateLastAnomaly {\n /**\n * Submit multivariate anomaly detection task with the modelId of trained model\n * and inference data, and the inference data should be put into request body in a\n * JSON format. The request will complete synchronously and return the detection\n * immediately in the response body.\n */\n post(\n options: DetectMultivariateLastAnomalyParameters,\n ): StreamableMethod<\n DetectMultivariateLastAnomaly200Response | DetectMultivariateLastAnomalyDefaultResponse\n >;\n}\n\nexport interface Routes {\n /** Resource for '/timeseries/entire/detect' has methods for the following verbs: post */\n (path: \"/timeseries/entire/detect\"): DetectUnivariateEntireSeries;\n /** Resource for '/timeseries/last/detect' has methods for the following verbs: post */\n (path: \"/timeseries/last/detect\"): DetectUnivariateLastPoint;\n /** Resource for '/timeseries/changepoint/detect' has methods for the following verbs: post */\n (path: \"/timeseries/changepoint/detect\"): DetectUnivariateChangePoint;\n /** Resource for '/multivariate/detect-batch/\\{resultId\\}' has methods for the following verbs: get */\n (\n path: \"/multivariate/detect-batch/{resultId}\",\n resultId: string,\n ): GetMultivariateBatchDetectionResult;\n /** Resource for '/multivariate/models' has methods for the following verbs: post, get */\n (path: \"/multivariate/models\"): TrainMultivariateModel;\n /** Resource for '/multivariate/models/\\{modelId\\}' has methods for the following verbs: delete, get */\n (path: \"/multivariate/models/{modelId}\", modelId: string): DeleteMultivariateModel;\n /** Resource for '/multivariate/models/\\{modelId\\}:detect-batch' has methods for the following verbs: post */\n (\n path: \"/multivariate/models/{modelId}:detect-batch\",\n modelId: string,\n ): DetectMultivariateBatchAnomaly;\n /** Resource for '/multivariate/models/\\{modelId\\}:detect-last' has methods for the following verbs: post */\n (\n path: \"/multivariate/models/{modelId}:detect-last\",\n modelId: string,\n ): DetectMultivariateLastAnomaly;\n}\n\nexport type AnomalyDetectorRestClient = Client & {\n path: Routes;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../src/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n DetectUnivariateEntireSeriesParameters,\n DetectUnivariateLastPointParameters,\n DetectUnivariateChangePointParameters,\n GetMultivariateBatchDetectionResultParameters,\n TrainMultivariateModelParameters,\n ListMultivariateModelsParameters,\n DeleteMultivariateModelParameters,\n GetMultivariateModelParameters,\n DetectMultivariateBatchAnomalyParameters,\n DetectMultivariateLastAnomalyParameters,\n} from \"./parameters\";\nimport type {\n DetectUnivariateEntireSeries200Response,\n DetectUnivariateEntireSeriesDefaultResponse,\n DetectUnivariateLastPoint200Response,\n DetectUnivariateLastPointDefaultResponse,\n DetectUnivariateChangePoint200Response,\n DetectUnivariateChangePointDefaultResponse,\n GetMultivariateBatchDetectionResult200Response,\n GetMultivariateBatchDetectionResultDefaultResponse,\n TrainMultivariateModel201Response,\n TrainMultivariateModelDefaultResponse,\n ListMultivariateModels200Response,\n ListMultivariateModelsDefaultResponse,\n DeleteMultivariateModel204Response,\n DeleteMultivariateModelDefaultResponse,\n GetMultivariateModel200Response,\n GetMultivariateModelDefaultResponse,\n DetectMultivariateBatchAnomaly202Response,\n DetectMultivariateBatchAnomalyDefaultResponse,\n DetectMultivariateLastAnomaly200Response,\n DetectMultivariateLastAnomalyDefaultResponse,\n} from \"./responses\";\nimport type { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface DetectUnivariateEntireSeries {\n /**\n * This operation generates a model with an entire series, each point is detected\n * with the same model. With this method, points before and after a certain point\n * are used to determine whether it is an anomaly. The entire detection can give\n * user an overall status of the time series.\n */\n post(\n options: DetectUnivariateEntireSeriesParameters,\n ): StreamableMethod<\n DetectUnivariateEntireSeries200Response | DetectUnivariateEntireSeriesDefaultResponse\n >;\n}\n\nexport interface DetectUnivariateLastPoint {\n /**\n * This operation generates a model using the points that you sent into the API,\n * and based on all data to determine whether the last point is anomalous.\n */\n post(\n options: DetectUnivariateLastPointParameters,\n ): StreamableMethod<\n DetectUnivariateLastPoint200Response | DetectUnivariateLastPointDefaultResponse\n >;\n}\n\nexport interface DetectUnivariateChangePoint {\n /** Evaluate change point score of every series point */\n post(\n options: DetectUnivariateChangePointParameters,\n ): StreamableMethod<\n DetectUnivariateChangePoint200Response | DetectUnivariateChangePointDefaultResponse\n >;\n}\n\nexport interface GetMultivariateBatchDetectionResult {\n /**\n * For asynchronous inference, get multivariate anomaly detection result based on\n * resultId returned by the BatchDetectAnomaly api.\n */\n get(\n options?: GetMultivariateBatchDetectionResultParameters,\n ): StreamableMethod<\n | GetMultivariateBatchDetectionResult200Response\n | GetMultivariateBatchDetectionResultDefaultResponse\n >;\n}\n\nexport interface TrainMultivariateModel {\n /**\n * Create and train a multivariate anomaly detection model. The request must\n * include a source parameter to indicate an externally accessible Azure blob\n * storage URI.There are two types of data input: An URI pointed to an Azure blob\n * storage folder which contains multiple CSV files, and each CSV file contains\n * two columns, timestamp and variable. Another type of input is an URI pointed to\n * a CSV file in Azure blob storage, which contains all the variables and a\n * timestamp column.\n */\n post(\n options: TrainMultivariateModelParameters,\n ): StreamableMethod<TrainMultivariateModel201Response | TrainMultivariateModelDefaultResponse>;\n /** List models of a resource. */\n get(\n options?: ListMultivariateModelsParameters,\n ): StreamableMethod<ListMultivariateModels200Response | ListMultivariateModelsDefaultResponse>;\n}\n\nexport interface DeleteMultivariateModel {\n /** Delete an existing multivariate model according to the modelId */\n delete(\n options?: DeleteMultivariateModelParameters,\n ): StreamableMethod<DeleteMultivariateModel204Response | DeleteMultivariateModelDefaultResponse>;\n /**\n * Get detailed information of multivariate model, including the training status\n * and variables used in the model.\n */\n get(\n options?: GetMultivariateModelParameters,\n ): StreamableMethod<GetMultivariateModel200Response | GetMultivariateModelDefaultResponse>;\n}\n\nexport interface DetectMultivariateBatchAnomaly {\n /**\n * Submit multivariate anomaly detection task with the modelId of trained model\n * and inference data, the input schema should be the same with the training\n * request. The request will complete asynchronously and return a resultId to\n * query the detection result.The request should be a source link to indicate an\n * externally accessible Azure storage Uri, either pointed to an Azure blob\n * storage folder, or pointed to a CSV file in Azure blob storage.\n */\n post(\n options: DetectMultivariateBatchAnomalyParameters,\n ): StreamableMethod<\n DetectMultivariateBatchAnomaly202Response | DetectMultivariateBatchAnomalyDefaultResponse\n >;\n}\n\nexport interface DetectMultivariateLastAnomaly {\n /**\n * Submit multivariate anomaly detection task with the modelId of trained model\n * and inference data, and the inference data should be put into request body in a\n * JSON format. The request will complete synchronously and return the detection\n * immediately in the response body.\n */\n post(\n options: DetectMultivariateLastAnomalyParameters,\n ): StreamableMethod<\n DetectMultivariateLastAnomaly200Response | DetectMultivariateLastAnomalyDefaultResponse\n >;\n}\n\nexport interface Routes {\n /** Resource for '/timeseries/entire/detect' has methods for the following verbs: post */\n (path: \"/timeseries/entire/detect\"): DetectUnivariateEntireSeries;\n /** Resource for '/timeseries/last/detect' has methods for the following verbs: post */\n (path: \"/timeseries/last/detect\"): DetectUnivariateLastPoint;\n /** Resource for '/timeseries/changepoint/detect' has methods for the following verbs: post */\n (path: \"/timeseries/changepoint/detect\"): DetectUnivariateChangePoint;\n /** Resource for '/multivariate/detect-batch/\\{resultId\\}' has methods for the following verbs: get */\n (\n path: \"/multivariate/detect-batch/{resultId}\",\n resultId: string,\n ): GetMultivariateBatchDetectionResult;\n /** Resource for '/multivariate/models' has methods for the following verbs: post, get */\n (path: \"/multivariate/models\"): TrainMultivariateModel;\n /** Resource for '/multivariate/models/\\{modelId\\}' has methods for the following verbs: delete, get */\n (path: \"/multivariate/models/{modelId}\", modelId: string): DeleteMultivariateModel;\n /** Resource for '/multivariate/models/\\{modelId\\}:detect-batch' has methods for the following verbs: post */\n (\n path: \"/multivariate/models/{modelId}:detect-batch\",\n modelId: string,\n ): DetectMultivariateBatchAnomaly;\n /** Resource for '/multivariate/models/\\{modelId\\}:detect-last' has methods for the following verbs: post */\n (\n path: \"/multivariate/models/{modelId}:detect-last\",\n modelId: string,\n ): DetectMultivariateLastAnomaly;\n}\n\nexport type AnomalyDetectorRestClient = Client & {\n path: Routes;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAyBlC,MAAM,WAAW,GAA6B;IAC5C,gCAAgC,EAAE,CAAC,KAAK,CAAC;IACzC,8BAA8B,EAAE,CAAC,KAAK,CAAC;IACvC,qCAAqC,EAAE,CAAC,KAAK,CAAC;IAC9C,2CAA2C,EAAE,CAAC,KAAK,CAAC;IACpD,2BAA2B,EAAE,CAAC,KAAK,CAAC;IACpC,0BAA0B,EAAE,CAAC,KAAK,CAAC;IACnC,uCAAuC,EAAE,CAAC,KAAK,CAAC;IAChD,oCAAoC,EAAE,CAAC,KAAK,CAAC;IAC7C,kDAAkD,EAAE,CAAC,KAAK,C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KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n DetectUnivariateEntireSeries200Response,\n DetectUnivariateEntireSeriesDefaultResponse,\n DetectUnivariateLastPoint200Response,\n DetectUnivariateLastPointDefaultResponse,\n DetectUnivariateChangePoint200Response,\n DetectUnivariateChangePointDefaultResponse,\n GetMultivariateBatchDetectionResult200Response,\n GetMultivariateBatchDetectionResultDefaultResponse,\n TrainMultivariateModel201Response,\n TrainMultivariateModelDefaultResponse,\n ListMultivariateModels200Response,\n ListMultivariateModelsDefaultResponse,\n DeleteMultivariateModel204Response,\n DeleteMultivariateModelDefaultResponse,\n GetMultivariateModel200Response,\n GetMultivariateModelDefaultResponse,\n DetectMultivariateBatchAnomaly202Response,\n DetectMultivariateBatchAnomalyDefaultResponse,\n DetectMultivariateLastAnomaly200Response,\n DetectMultivariateLastAnomalyDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"POST /timeseries/entire/detect\": [\"200\"],\n \"POST /timeseries/last/detect\": [\"200\"],\n \"POST /timeseries/changepoint/detect\": [\"200\"],\n \"GET /multivariate/detect-batch/{resultId}\": [\"200\"],\n \"POST /multivariate/models\": [\"201\"],\n \"GET /multivariate/models\": [\"200\"],\n \"DELETE /multivariate/models/{modelId}\": [\"204\"],\n \"GET /multivariate/models/{modelId}\": [\"200\"],\n \"POST /multivariate/models/{modelId}:detect-batch\": [\"202\"],\n \"POST /multivariate/models/{modelId}:detect-last\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: DetectUnivariateEntireSeries200Response | DetectUnivariateEntireSeriesDefaultResponse,\n): response is DetectUnivariateEntireSeriesDefaultResponse;\nexport function isUnexpected(\n response: DetectUnivariateLastPoint200Response | DetectUnivariateLastPointDefaultResponse,\n): response is DetectUnivariateLastPointDefaultResponse;\nexport function isUnexpected(\n response: DetectUnivariateChangePoint200Response | DetectUnivariateChangePointDefaultResponse,\n): response is DetectUnivariateChangePointDefaultResponse;\nexport function isUnexpected(\n response:\n | GetMultivariateBatchDetectionResult200Response\n | GetMultivariateBatchDetectionResultDefaultResponse,\n): response is GetMultivariateBatchDetectionResultDefaultResponse;\nexport function isUnexpected(\n response: TrainMultivariateModel201Response | TrainMultivariateModelDefaultResponse,\n): response is TrainMultivariateModelDefaultResponse;\nexport function isUnexpected(\n response: ListMultivariateModels200Response | ListMultivariateModelsDefaultResponse,\n): response is ListMultivariateModelsDefaultResponse;\nexport function isUnexpected(\n response: DeleteMultivariateModel204Response | DeleteMultivariateModelDefaultResponse,\n): response is DeleteMultivariateModelDefaultResponse;\nexport function isUnexpected(\n response: GetMultivariateModel200Response | GetMultivariateModelDefaultResponse,\n): response is GetMultivariateModelDefaultResponse;\nexport function isUnexpected(\n response:\n | DetectMultivariateBatchAnomaly202Response\n | DetectMultivariateBatchAnomalyDefaultResponse,\n): response is DetectMultivariateBatchAnomalyDefaultResponse;\nexport function isUnexpected(\n response: DetectMultivariateLastAnomaly200Response | DetectMultivariateLastAnomalyDefaultResponse,\n): response is DetectMultivariateLastAnomalyDefaultResponse;\nexport function isUnexpected(\n response:\n | DetectUnivariateEntireSeries200Response\n | DetectUnivariateEntireSeriesDefaultResponse\n | DetectUnivariateLastPoint200Response\n | DetectUnivariateLastPointDefaultResponse\n | DetectUnivariateChangePoint200Response\n | DetectUnivariateChangePointDefaultResponse\n | GetMultivariateBatchDetectionResult200Response\n | GetMultivariateBatchDetectionResultDefaultResponse\n | TrainMultivariateModel201Response\n | TrainMultivariateModelDefaultResponse\n | ListMultivariateModels200Response\n | ListMultivariateModelsDefaultResponse\n | DeleteMultivariateModel204Response\n | DeleteMultivariateModelDefaultResponse\n | GetMultivariateModel200Response\n | GetMultivariateModelDefaultResponse\n | DetectMultivariateBatchAnomaly202Response\n | DetectMultivariateBatchAnomalyDefaultResponse\n | DetectMultivariateLastAnomaly200Response\n | DetectMultivariateLastAnomalyDefaultResponse,\n): response is\n | DetectUnivariateEntireSeriesDefaultResponse\n | DetectUnivariateLastPointDefaultResponse\n | DetectUnivariateChangePointDefaultResponse\n | GetMultivariateBatchDetectionResultDefaultResponse\n | TrainMultivariateModelDefaultResponse\n | ListMultivariateModelsDefaultResponse\n | DeleteMultivariateModelDefaultResponse\n | GetMultivariateModelDefaultResponse\n | DetectMultivariateBatchAnomalyDefaultResponse\n | DetectMultivariateLastAnomalyDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAyBlC,MAAM,WAAW,GAA6B;IAC5C,gCAAgC,EAAE,CAAC,KAAK,CAAC;IACzC,8BAA8B,EAAE,CAAC,KAAK,CAAC;IACvC,qCAAqC,EAAE,CAAC,KAAK,CAAC;IAC9C,2CAA2C,EAAE,CAAC,KAAK,CAAC;IACpD,2BAA2B,EAAE,CAAC,KAAK,CAAC;IACpC,0BAA0B,EAAE,CAAC,KAAK,CAAC;IACnC,uCAAuC,EAAE,CAAC,KAAK,CAAC;IAChD,oCAAoC,EAAE,CAAC,KAAK,CAAC;IAC7C,kDAAkD,EAAE,CAAC,KAAK,CAAC;IAC3D,iDAAiD,EAAE,CAAC,KAAK,CAAC;CAC3D,CAAC;AAoCF,MAAM,UAAU,YAAY,CAC1B,QAoBgD;IAYhD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC1D,MA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CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n DetectUnivariateEntireSeries200Response,\n DetectUnivariateEntireSeriesDefaultResponse,\n DetectUnivariateLastPoint200Response,\n DetectUnivariateLastPointDefaultResponse,\n DetectUnivariateChangePoint200Response,\n DetectUnivariateChangePointDefaultResponse,\n GetMultivariateBatchDetectionResult200Response,\n GetMultivariateBatchDetectionResultDefaultResponse,\n TrainMultivariateModel201Response,\n TrainMultivariateModelDefaultResponse,\n ListMultivariateModels200Response,\n ListMultivariateModelsDefaultResponse,\n DeleteMultivariateModel204Response,\n DeleteMultivariateModelDefaultResponse,\n GetMultivariateModel200Response,\n GetMultivariateModelDefaultResponse,\n DetectMultivariateBatchAnomaly202Response,\n DetectMultivariateBatchAnomalyDefaultResponse,\n DetectMultivariateLastAnomaly200Response,\n DetectMultivariateLastAnomalyDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"POST /timeseries/entire/detect\": [\"200\"],\n \"POST /timeseries/last/detect\": [\"200\"],\n \"POST /timeseries/changepoint/detect\": [\"200\"],\n \"GET /multivariate/detect-batch/{resultId}\": [\"200\"],\n \"POST /multivariate/models\": [\"201\"],\n \"GET /multivariate/models\": [\"200\"],\n \"DELETE /multivariate/models/{modelId}\": [\"204\"],\n \"GET /multivariate/models/{modelId}\": [\"200\"],\n \"POST /multivariate/models/{modelId}:detect-batch\": [\"202\"],\n \"POST /multivariate/models/{modelId}:detect-last\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: DetectUnivariateEntireSeries200Response | DetectUnivariateEntireSeriesDefaultResponse,\n): response is DetectUnivariateEntireSeriesDefaultResponse;\nexport function isUnexpected(\n response: DetectUnivariateLastPoint200Response | DetectUnivariateLastPointDefaultResponse,\n): response is DetectUnivariateLastPointDefaultResponse;\nexport function isUnexpected(\n response: DetectUnivariateChangePoint200Response | DetectUnivariateChangePointDefaultResponse,\n): response is DetectUnivariateChangePointDefaultResponse;\nexport function isUnexpected(\n response:\n | GetMultivariateBatchDetectionResult200Response\n | GetMultivariateBatchDetectionResultDefaultResponse,\n): response is GetMultivariateBatchDetectionResultDefaultResponse;\nexport function isUnexpected(\n response: TrainMultivariateModel201Response | TrainMultivariateModelDefaultResponse,\n): response is TrainMultivariateModelDefaultResponse;\nexport function isUnexpected(\n response: ListMultivariateModels200Response | ListMultivariateModelsDefaultResponse,\n): response is ListMultivariateModelsDefaultResponse;\nexport function isUnexpected(\n response: DeleteMultivariateModel204Response | DeleteMultivariateModelDefaultResponse,\n): response is DeleteMultivariateModelDefaultResponse;\nexport function isUnexpected(\n response: GetMultivariateModel200Response | GetMultivariateModelDefaultResponse,\n): response is GetMultivariateModelDefaultResponse;\nexport function isUnexpected(\n response:\n | DetectMultivariateBatchAnomaly202Response\n | DetectMultivariateBatchAnomalyDefaultResponse,\n): response is DetectMultivariateBatchAnomalyDefaultResponse;\nexport function isUnexpected(\n response: DetectMultivariateLastAnomaly200Response | DetectMultivariateLastAnomalyDefaultResponse,\n): response is DetectMultivariateLastAnomalyDefaultResponse;\nexport function isUnexpected(\n response:\n | DetectUnivariateEntireSeries200Response\n | DetectUnivariateEntireSeriesDefaultResponse\n | DetectUnivariateLastPoint200Response\n | DetectUnivariateLastPointDefaultResponse\n | DetectUnivariateChangePoint200Response\n | DetectUnivariateChangePointDefaultResponse\n | GetMultivariateBatchDetectionResult200Response\n | GetMultivariateBatchDetectionResultDefaultResponse\n | TrainMultivariateModel201Response\n | TrainMultivariateModelDefaultResponse\n | ListMultivariateModels200Response\n | ListMultivariateModelsDefaultResponse\n | DeleteMultivariateModel204Response\n | DeleteMultivariateModelDefaultResponse\n | GetMultivariateModel200Response\n | GetMultivariateModelDefaultResponse\n | DetectMultivariateBatchAnomaly202Response\n | DetectMultivariateBatchAnomalyDefaultResponse\n | DetectMultivariateLastAnomaly200Response\n | DetectMultivariateLastAnomalyDefaultResponse,\n): response is\n | DetectUnivariateEntireSeriesDefaultResponse\n | DetectUnivariateLastPointDefaultResponse\n | DetectUnivariateChangePointDefaultResponse\n | GetMultivariateBatchDetectionResultDefaultResponse\n | TrainMultivariateModelDefaultResponse\n | ListMultivariateModelsDefaultResponse\n | DeleteMultivariateModelDefaultResponse\n | GetMultivariateModelDefaultResponse\n | DetectMultivariateBatchAnomalyDefaultResponse\n | DetectMultivariateLastAnomalyDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AA6C1D;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CACtB,MAAc,EACd,eAA0B,EAC1B,UAAoC,EAAE;IAItC,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,oFAAoF;IACpF,kDAAkD;IAClD,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACpC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,uBAAuB,CAAC,eAAe,CAAC,CAAC;IAC5E,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;gB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SAAS;SACb,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CACjB,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AACpC,CAAC","sourcesContent":["// 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 | {\n body: { value?: infer TPage };\n }\n | {\n body: { models?: 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 // We need to check the response for success before trying to inspect it looking for\n // the properties to use for nextLink and itemName\n checkPagingRequest(initialResponse);\n const { itemName, nextLinkName } = getPaginationProperties(initialResponse);\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\n/**\n * Extracts the itemName and nextLinkName from the initial response to use them for pagination\n */\nfunction getPaginationProperties(initialResponse: PathUncheckedResponse) {\n // Build a set with the passed custom nextLinkNames\n const nextLinkNames = new Set([\"nextLink\"]);\n\n // Build a set with the passed custom set of itemNames\n const itemNames = new Set([\"value\", \"models\"]);\n\n let nextLinkName: string | undefined;\n let itemName: string | undefined;\n\n for (const name of nextLinkNames) {\n const nextLink = (initialResponse.body as Record<string, unknown>)[name] as string;\n if (nextLink) {\n nextLinkName = name;\n break;\n }\n }\n\n for (const name of itemNames) {\n const item = (initialResponse.body as Record<string, unknown>)[name] as string;\n if (item) {\n itemName = name;\n break;\n }\n }\n\n if (!itemName) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${[\n ...itemNames,\n ].join(\" OR \")}`,\n );\n }\n\n return { itemName, nextLinkName };\n}\n"]}
|
|
@@ -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 { RequestParameters } from \"@azure-rest/core-client\";\nimport {\n UnivariateDetectionOptions,\n UnivariateChangePointDetectionOptions,\n ModelInfo,\n MultivariateBatchDetectionOptions,\n MultivariateLastDetectionOptions,\n} from \"./models\";\n\nexport interface DetectUnivariateEntireSeriesBodyParam {\n /** Method of univariate anomaly detection. */\n body: UnivariateDetectionOptions;\n}\n\nexport type DetectUnivariateEntireSeriesParameters = DetectUnivariateEntireSeriesBodyParam &\n RequestParameters;\n\nexport interface DetectUnivariateLastPointBodyParam {\n /** Method of univariate anomaly detection. */\n body: UnivariateDetectionOptions;\n}\n\nexport type DetectUnivariateLastPointParameters = DetectUnivariateLastPointBodyParam &\n RequestParameters;\n\nexport interface DetectUnivariateChangePointBodyParam {\n /** Method of univariate anomaly detection. */\n body: UnivariateChangePointDetectionOptions;\n}\n\nexport type DetectUnivariateChangePointParameters = DetectUnivariateChangePointBodyParam &\n RequestParameters;\nexport type GetMultivariateBatchDetectionResultParameters = RequestParameters;\n\nexport interface TrainMultivariateModelBodyParam {\n /** Model information. */\n body: ModelInfo;\n}\n\nexport type TrainMultivariateModelParameters = TrainMultivariateModelBodyParam & RequestParameters;\n\nexport interface ListMultivariateModelsQueryParamProperties {\n /** Skip indicates how many models will be skipped. */\n skip?: number;\n /** Top indicates how many models will be fetched. */\n top?: number;\n}\n\nexport interface ListMultivariateModelsQueryParam {\n queryParameters?: ListMultivariateModelsQueryParamProperties;\n}\n\nexport type ListMultivariateModelsParameters = ListMultivariateModelsQueryParam & RequestParameters;\nexport type DeleteMultivariateModelParameters = RequestParameters;\nexport type GetMultivariateModelParameters = RequestParameters;\n\nexport interface DetectMultivariateBatchAnomalyBodyParam {\n /** Request of multivariate anomaly detection. */\n body: MultivariateBatchDetectionOptions;\n}\n\nexport type DetectMultivariateBatchAnomalyParameters = DetectMultivariateBatchAnomalyBodyParam &\n RequestParameters;\n\nexport interface DetectMultivariateLastAnomalyBodyParam {\n /** Request of last detection. */\n body: MultivariateLastDetectionOptions;\n}\n\nexport type DetectMultivariateLastAnomalyParameters = DetectMultivariateLastAnomalyBodyParam &\n 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\nimport type { RequestParameters } from \"@azure-rest/core-client\";\nimport type {\n UnivariateDetectionOptions,\n UnivariateChangePointDetectionOptions,\n ModelInfo,\n MultivariateBatchDetectionOptions,\n MultivariateLastDetectionOptions,\n} from \"./models\";\n\nexport interface DetectUnivariateEntireSeriesBodyParam {\n /** Method of univariate anomaly detection. */\n body: UnivariateDetectionOptions;\n}\n\nexport type DetectUnivariateEntireSeriesParameters = DetectUnivariateEntireSeriesBodyParam &\n RequestParameters;\n\nexport interface DetectUnivariateLastPointBodyParam {\n /** Method of univariate anomaly detection. */\n body: UnivariateDetectionOptions;\n}\n\nexport type DetectUnivariateLastPointParameters = DetectUnivariateLastPointBodyParam &\n RequestParameters;\n\nexport interface DetectUnivariateChangePointBodyParam {\n /** Method of univariate anomaly detection. */\n body: UnivariateChangePointDetectionOptions;\n}\n\nexport type DetectUnivariateChangePointParameters = DetectUnivariateChangePointBodyParam &\n RequestParameters;\nexport type GetMultivariateBatchDetectionResultParameters = RequestParameters;\n\nexport interface TrainMultivariateModelBodyParam {\n /** Model information. */\n body: ModelInfo;\n}\n\nexport type TrainMultivariateModelParameters = TrainMultivariateModelBodyParam & RequestParameters;\n\nexport interface ListMultivariateModelsQueryParamProperties {\n /** Skip indicates how many models will be skipped. */\n skip?: number;\n /** Top indicates how many models will be fetched. */\n top?: number;\n}\n\nexport interface ListMultivariateModelsQueryParam {\n queryParameters?: ListMultivariateModelsQueryParamProperties;\n}\n\nexport type ListMultivariateModelsParameters = ListMultivariateModelsQueryParam & RequestParameters;\nexport type DeleteMultivariateModelParameters = RequestParameters;\nexport type GetMultivariateModelParameters = RequestParameters;\n\nexport interface DetectMultivariateBatchAnomalyBodyParam {\n /** Request of multivariate anomaly detection. */\n body: MultivariateBatchDetectionOptions;\n}\n\nexport type DetectMultivariateBatchAnomalyParameters = DetectMultivariateBatchAnomalyBodyParam &\n RequestParameters;\n\nexport interface DetectMultivariateLastAnomalyBodyParam {\n /** Request of last detection. */\n body: MultivariateLastDetectionOptions;\n}\n\nexport type DetectMultivariateLastAnomalyParameters = DetectMultivariateLastAnomalyBodyParam &\n RequestParameters;\n"]}
|
|
@@ -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 } from \"@azure-rest/core-client\";\nimport {\n UnivariateEntireDetectionResultOutput,\n AnomalyDetectorErrorOutput,\n UnivariateLastDetectionResultOutput,\n UnivariateChangePointDetectionResultOutput,\n MultivariateDetectionResultOutput,\n ErrorResponseOutput,\n AnomalyDetectionModelOutput,\n ModelListOutput,\n MultivariateLastDetectionResultOutput,\n} from \"./outputModels\";\n\n/** The request has succeeded. */\nexport interface DetectUnivariateEntireSeries200Response extends HttpResponse {\n status: \"200\";\n body: UnivariateEntireDetectionResultOutput;\n}\n\nexport interface DetectUnivariateEntireSeriesDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DetectUnivariateEntireSeriesDefaultResponse extends HttpResponse {\n status: string;\n body: AnomalyDetectorErrorOutput;\n headers: RawHttpHeaders & DetectUnivariateEntireSeriesDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface DetectUnivariateLastPoint200Response extends HttpResponse {\n status: \"200\";\n body: UnivariateLastDetectionResultOutput;\n}\n\nexport interface DetectUnivariateLastPointDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DetectUnivariateLastPointDefaultResponse extends HttpResponse {\n status: string;\n body: AnomalyDetectorErrorOutput;\n headers: RawHttpHeaders & DetectUnivariateLastPointDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface DetectUnivariateChangePoint200Response extends HttpResponse {\n status: \"200\";\n body: UnivariateChangePointDetectionResultOutput;\n}\n\nexport interface DetectUnivariateChangePointDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DetectUnivariateChangePointDefaultResponse extends HttpResponse {\n status: string;\n body: AnomalyDetectorErrorOutput;\n headers: RawHttpHeaders & DetectUnivariateChangePointDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetMultivariateBatchDetectionResult200Response extends HttpResponse {\n status: \"200\";\n body: MultivariateDetectionResultOutput;\n}\n\nexport interface GetMultivariateBatchDetectionResultDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetMultivariateBatchDetectionResultDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & GetMultivariateBatchDetectionResultDefaultHeaders;\n}\n\nexport interface TrainMultivariateModel201Headers {\n /** Location and ID of the model. */\n location: string;\n}\n\n/** The request has succeeded and a new resource has been created as a result. */\nexport interface TrainMultivariateModel201Response extends HttpResponse {\n status: \"201\";\n body: AnomalyDetectionModelOutput;\n headers: RawHttpHeaders & TrainMultivariateModel201Headers;\n}\n\nexport interface TrainMultivariateModelDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface TrainMultivariateModelDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & TrainMultivariateModelDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface ListMultivariateModels200Response extends HttpResponse {\n status: \"200\";\n body: ModelListOutput;\n}\n\nexport interface ListMultivariateModelsDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface ListMultivariateModelsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & ListMultivariateModelsDefaultHeaders;\n}\n\n/** There is no content to send for this request, but the headers may be useful. */\nexport interface DeleteMultivariateModel204Response extends HttpResponse {\n status: \"204\";\n}\n\nexport interface DeleteMultivariateModelDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DeleteMultivariateModelDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & DeleteMultivariateModelDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetMultivariateModel200Response extends HttpResponse {\n status: \"200\";\n body: AnomalyDetectionModelOutput;\n}\n\nexport interface GetMultivariateModelDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetMultivariateModelDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & GetMultivariateModelDefaultHeaders;\n}\n\nexport interface DetectMultivariateBatchAnomaly202Headers {\n /** Id of the detection result. */\n \"operation-id\": string;\n /** Location of the detection result. */\n \"operation-location\": string;\n}\n\n/** The request has been accepted for processing, but processing has not yet completed. */\nexport interface DetectMultivariateBatchAnomaly202Response extends HttpResponse {\n status: \"202\";\n body: MultivariateDetectionResultOutput;\n headers: RawHttpHeaders & DetectMultivariateBatchAnomaly202Headers;\n}\n\nexport interface DetectMultivariateBatchAnomalyDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DetectMultivariateBatchAnomalyDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & DetectMultivariateBatchAnomalyDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface DetectMultivariateLastAnomaly200Response extends HttpResponse {\n status: \"200\";\n body: MultivariateLastDetectionResultOutput;\n}\n\nexport interface DetectMultivariateLastAnomalyDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DetectMultivariateLastAnomalyDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & DetectMultivariateLastAnomalyDefaultHeaders;\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\nimport type { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport type { HttpResponse } from \"@azure-rest/core-client\";\nimport type {\n UnivariateEntireDetectionResultOutput,\n AnomalyDetectorErrorOutput,\n UnivariateLastDetectionResultOutput,\n UnivariateChangePointDetectionResultOutput,\n MultivariateDetectionResultOutput,\n ErrorResponseOutput,\n AnomalyDetectionModelOutput,\n ModelListOutput,\n MultivariateLastDetectionResultOutput,\n} from \"./outputModels\";\n\n/** The request has succeeded. */\nexport interface DetectUnivariateEntireSeries200Response extends HttpResponse {\n status: \"200\";\n body: UnivariateEntireDetectionResultOutput;\n}\n\nexport interface DetectUnivariateEntireSeriesDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DetectUnivariateEntireSeriesDefaultResponse extends HttpResponse {\n status: string;\n body: AnomalyDetectorErrorOutput;\n headers: RawHttpHeaders & DetectUnivariateEntireSeriesDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface DetectUnivariateLastPoint200Response extends HttpResponse {\n status: \"200\";\n body: UnivariateLastDetectionResultOutput;\n}\n\nexport interface DetectUnivariateLastPointDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DetectUnivariateLastPointDefaultResponse extends HttpResponse {\n status: string;\n body: AnomalyDetectorErrorOutput;\n headers: RawHttpHeaders & DetectUnivariateLastPointDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface DetectUnivariateChangePoint200Response extends HttpResponse {\n status: \"200\";\n body: UnivariateChangePointDetectionResultOutput;\n}\n\nexport interface DetectUnivariateChangePointDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DetectUnivariateChangePointDefaultResponse extends HttpResponse {\n status: string;\n body: AnomalyDetectorErrorOutput;\n headers: RawHttpHeaders & DetectUnivariateChangePointDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetMultivariateBatchDetectionResult200Response extends HttpResponse {\n status: \"200\";\n body: MultivariateDetectionResultOutput;\n}\n\nexport interface GetMultivariateBatchDetectionResultDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetMultivariateBatchDetectionResultDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & GetMultivariateBatchDetectionResultDefaultHeaders;\n}\n\nexport interface TrainMultivariateModel201Headers {\n /** Location and ID of the model. */\n location: string;\n}\n\n/** The request has succeeded and a new resource has been created as a result. */\nexport interface TrainMultivariateModel201Response extends HttpResponse {\n status: \"201\";\n body: AnomalyDetectionModelOutput;\n headers: RawHttpHeaders & TrainMultivariateModel201Headers;\n}\n\nexport interface TrainMultivariateModelDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface TrainMultivariateModelDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & TrainMultivariateModelDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface ListMultivariateModels200Response extends HttpResponse {\n status: \"200\";\n body: ModelListOutput;\n}\n\nexport interface ListMultivariateModelsDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface ListMultivariateModelsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & ListMultivariateModelsDefaultHeaders;\n}\n\n/** There is no content to send for this request, but the headers may be useful. */\nexport interface DeleteMultivariateModel204Response extends HttpResponse {\n status: \"204\";\n}\n\nexport interface DeleteMultivariateModelDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DeleteMultivariateModelDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & DeleteMultivariateModelDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetMultivariateModel200Response extends HttpResponse {\n status: \"200\";\n body: AnomalyDetectionModelOutput;\n}\n\nexport interface GetMultivariateModelDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetMultivariateModelDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & GetMultivariateModelDefaultHeaders;\n}\n\nexport interface DetectMultivariateBatchAnomaly202Headers {\n /** Id of the detection result. */\n \"operation-id\": string;\n /** Location of the detection result. */\n \"operation-location\": string;\n}\n\n/** The request has been accepted for processing, but processing has not yet completed. */\nexport interface DetectMultivariateBatchAnomaly202Response extends HttpResponse {\n status: \"202\";\n body: MultivariateDetectionResultOutput;\n headers: RawHttpHeaders & DetectMultivariateBatchAnomaly202Headers;\n}\n\nexport interface DetectMultivariateBatchAnomalyDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DetectMultivariateBatchAnomalyDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & DetectMultivariateBatchAnomalyDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface DetectMultivariateLastAnomaly200Response extends HttpResponse {\n status: \"200\";\n body: MultivariateLastDetectionResultOutput;\n}\n\nexport interface DetectMultivariateLastAnomalyDefaultHeaders {\n /** Error code. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface DetectMultivariateLastAnomalyDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & DetectMultivariateLastAnomalyDefaultHeaders;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@azure-rest/ai-anomaly-detector",
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
|
-
"version": "1.0.0-alpha.
|
|
5
|
+
"version": "1.0.0-alpha.20241030.2",
|
|
6
6
|
"description": "A generated SDK for AnomalyDetectorRest.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { Client } from '@azure-rest/core-client';
|
|
8
|
-
import { ClientOptions } from '@azure-rest/core-client';
|
|
9
|
-
import { HttpResponse } from '@azure-rest/core-client';
|
|
10
|
-
import { KeyCredential } from '@azure/core-auth';
|
|
11
|
-
import { PagedAsyncIterableIterator } from '@azure/core-paging';
|
|
12
|
-
import { PathUncheckedResponse } from '@azure-rest/core-client';
|
|
13
|
-
import { RawHttpHeaders } from '@azure/core-rest-pipeline';
|
|
14
|
-
import { RequestParameters } from '@azure-rest/core-client';
|
|
15
|
-
import { StreamableMethod } from '@azure-rest/core-client';
|
|
7
|
+
import type { Client } from '@azure-rest/core-client';
|
|
8
|
+
import type { ClientOptions } from '@azure-rest/core-client';
|
|
9
|
+
import type { HttpResponse } from '@azure-rest/core-client';
|
|
10
|
+
import type { KeyCredential } from '@azure/core-auth';
|
|
11
|
+
import type { PagedAsyncIterableIterator } from '@azure/core-paging';
|
|
12
|
+
import type { PathUncheckedResponse } from '@azure-rest/core-client';
|
|
13
|
+
import type { RawHttpHeaders } from '@azure/core-rest-pipeline';
|
|
14
|
+
import type { RequestParameters } from '@azure-rest/core-client';
|
|
15
|
+
import type { StreamableMethod } from '@azure-rest/core-client';
|
|
16
16
|
|
|
17
17
|
// @public
|
|
18
18
|
export interface AlignPolicy {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Client } from '@azure-rest/core-client';
|
|
2
|
-
import { ClientOptions } from '@azure-rest/core-client';
|
|
3
|
-
import { HttpResponse } from '@azure-rest/core-client';
|
|
4
|
-
import { KeyCredential } from '@azure/core-auth';
|
|
5
|
-
import { PagedAsyncIterableIterator } from '@azure/core-paging';
|
|
6
|
-
import { PathUncheckedResponse } from '@azure-rest/core-client';
|
|
7
|
-
import { RawHttpHeaders } from '@azure/core-rest-pipeline';
|
|
8
|
-
import { RequestParameters } from '@azure-rest/core-client';
|
|
9
|
-
import { StreamableMethod } from '@azure-rest/core-client';
|
|
1
|
+
import type { Client } from '@azure-rest/core-client';
|
|
2
|
+
import type { ClientOptions } from '@azure-rest/core-client';
|
|
3
|
+
import type { HttpResponse } from '@azure-rest/core-client';
|
|
4
|
+
import type { KeyCredential } from '@azure/core-auth';
|
|
5
|
+
import type { PagedAsyncIterableIterator } from '@azure/core-paging';
|
|
6
|
+
import type { PathUncheckedResponse } from '@azure-rest/core-client';
|
|
7
|
+
import type { RawHttpHeaders } from '@azure/core-rest-pipeline';
|
|
8
|
+
import type { RequestParameters } from '@azure-rest/core-client';
|
|
9
|
+
import type { StreamableMethod } from '@azure-rest/core-client';
|
|
10
10
|
|
|
11
11
|
/** An optional field, indicating the manner to align multiple variables. */
|
|
12
12
|
export declare interface AlignPolicy {
|