@azure-rest/ai-anomaly-detector 1.0.0-alpha.20221107.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/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/index.js +266 -0
- package/dist/index.js.map +1 -0
- package/dist-esm/src/anomalyDetectorRest.js +27 -0
- package/dist-esm/src/anomalyDetectorRest.js.map +1 -0
- package/dist-esm/src/clientDefinitions.js +4 -0
- package/dist-esm/src/clientDefinitions.js.map +1 -0
- package/dist-esm/src/index.js +14 -0
- package/dist-esm/src/index.js.map +1 -0
- package/dist-esm/src/isUnexpected.js +80 -0
- package/dist-esm/src/isUnexpected.js.map +1 -0
- package/dist-esm/src/models.js +4 -0
- package/dist-esm/src/models.js.map +1 -0
- package/dist-esm/src/outputModels.js +4 -0
- package/dist-esm/src/outputModels.js.map +1 -0
- package/dist-esm/src/paginateHelper.js +103 -0
- package/dist-esm/src/paginateHelper.js.map +1 -0
- package/dist-esm/src/parameters.js +4 -0
- package/dist-esm/src/parameters.js.map +1 -0
- package/dist-esm/src/pollingHelper.js +48 -0
- package/dist-esm/src/pollingHelper.js.map +1 -0
- package/dist-esm/src/responses.js +4 -0
- package/dist-esm/src/responses.js.map +1 -0
- package/package.json +129 -0
- package/review/ai-anomaly-detector.api.md +768 -0
- package/types/ai-anomaly-detector.d.ts +834 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/** The response of entire anomaly detection. */\nexport interface EntireDetectResponseOutput {\n /** Frequency extracted from the series, zero means no recurrent pattern has been found. */\n period: number;\n /** ExpectedValues contain expected value for each input point. The index of the array is consistent with the input series. */\n expectedValues: Array<number>;\n /** UpperMargins contain upper margin of each input point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - marginScale)*upperMargin. Anomalies in response can be filtered by upperBoundary and lowerBoundary. By adjusting marginScale value, less significant anomalies can be filtered in client side. The index of the array is consistent with the input series. */\n upperMargins: Array<number>;\n /** LowerMargins contain lower margin of each input point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin. Points between the boundary can be marked as normal ones in client side. The index of the array is consistent with the input series. */\n lowerMargins: Array<number>;\n /** IsAnomaly contains anomaly properties for each input point. True means an anomaly either negative or positive has been detected. The index of the array is consistent with the input series. */\n isAnomaly: Array<boolean>;\n /** IsNegativeAnomaly contains anomaly status in negative direction for each input point. True means a negative anomaly has been detected. A negative anomaly means the point is detected as an anomaly and its real value is smaller than the expected one. The index of the array is consistent with the input series. */\n isNegativeAnomaly: Array<boolean>;\n /** IsPositiveAnomaly contain anomaly status in positive direction for each input point. True means a positive anomaly has been detected. A positive anomaly means the point is detected as an anomaly and its real value is larger than the expected one. The index of the array is consistent with the input series. */\n isPositiveAnomaly: Array<boolean>;\n /** The severity score for each input point. The larger the value is, the more sever the anomaly is. For normal points, the \"severity\" is always 0. */\n severity?: Array<number>;\n}\n\n/** Error information returned by the API. */\nexport interface AnomalyDetectorErrorOutput {\n /** The error code. */\n code?:\n | \"InvalidCustomInterval\"\n | \"BadArgument\"\n | \"InvalidGranularity\"\n | \"InvalidPeriod\"\n | \"InvalidModelArgument\"\n | \"InvalidSeries\"\n | \"InvalidJsonFormat\"\n | \"RequiredGranularity\"\n | \"RequiredSeries\"\n | \"InvalidImputeMode\"\n | \"InvalidImputeFixedValue\";\n /** A message explaining the error reported by the service. */\n message?: string;\n}\n\n/** The response of last anomaly detection. */\nexport interface LastDetectResponseOutput {\n /** Frequency extracted from the series, zero means no recurrent pattern has been found. */\n period: number;\n /** Suggested input series points needed for detecting the latest point. */\n suggestedWindow: number;\n /** Expected value of the latest point. */\n expectedValue: number;\n /** Upper margin of the latest point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - marginScale)*upperMargin. If the value of latest point is between upperBoundary and lowerBoundary, it should be treated as normal value. By adjusting marginScale value, anomaly status of latest point can be changed. */\n upperMargin: number;\n /** Lower margin of the latest point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin. */\n lowerMargin: number;\n /** Anomaly status of the latest point, true means the latest point is an anomaly either in negative direction or positive direction. */\n isAnomaly: boolean;\n /** Anomaly status in negative direction of the latest point. True means the latest point is an anomaly and its real value is smaller than the expected one. */\n isNegativeAnomaly: boolean;\n /** Anomaly status in positive direction of the latest point. True means the latest point is an anomaly and its real value is larger than the expected one. */\n isPositiveAnomaly: boolean;\n /** The severity score for the last input point. The larger the value is, the more sever the anomaly is. For normal points, the \"severity\" is always 0. */\n severity?: number;\n}\n\n/** The response of change point detection. */\nexport interface ChangePointDetectResponseOutput {\n /** Frequency extracted from the series, zero means no recurrent pattern has been found. */\n period?: number;\n /** isChangePoint contains change point properties for each input point. True means an anomaly either negative or positive has been detected. The index of the array is consistent with the input series. */\n isChangePoint?: Array<boolean>;\n /** the change point confidence of each point */\n confidenceScores?: Array<number>;\n}\n\n/** Detection results for the given resultId. */\nexport interface DetectionResultOutput {\n /**\n * Result identifier, which is used to fetch the results of an inference call.\n *\n * Value may contain a UUID\n */\n resultId: string;\n /** Multivariate anomaly detection status. */\n summary: DetectionResultSummaryOutput;\n /** Detection result for each timestamp. */\n results: Array<AnomalyStateOutput>;\n}\n\n/** Multivariate anomaly detection status. */\nexport interface DetectionResultSummaryOutput {\n /** Status of detection results. One of CREATED, RUNNING, READY, and FAILED. */\n status: \"CREATED\" | \"RUNNING\" | \"READY\" | \"FAILED\";\n /** Error message when detection is failed. */\n errors?: Array<ErrorResponseOutput>;\n variableStates?: Array<VariableStateOutput>;\n /** Detection request for batch inference. This is an asynchronous inference which will need another API to get detection results. */\n setupInfo: DetectionRequestOutput;\n}\n\nexport interface ErrorResponseOutput {\n /** The error code. */\n code: string;\n /** The message explaining the error reported by the service. */\n message: string;\n}\n\nexport interface VariableStateOutput {\n /** Variable name in variable states. */\n variable?: string;\n /** Proportion of missing values that need to be filled by fillNAMethod. */\n filledNARatio?: number;\n /** Number of effective data points before applying fillNAMethod. */\n effectiveCount?: number;\n /** First valid timestamp with value of input data. */\n firstTimestamp?: string;\n /** Last valid timestamp with value of input data. */\n lastTimestamp?: string;\n}\n\n/** Detection request for batch inference. This is an asynchronous inference which will need another API to get detection results. */\nexport interface DetectionRequestOutput {\n /** Source link to the input data to indicate an accessible Azure storage Uri, either pointed to an Azure blob storage folder, or pointed to a CSV file in Azure blob storage based on you data schema selection. The data schema should be exactly the same with those used in the training phase. */\n dataSource: string;\n /** An optional field, which is used to specify the number of top contributed variables for one anomalous timestamp in the response. The default number is 10. */\n topContributorCount: number;\n /** A required field, indicating the start time of data for detection, which should be date-time of ISO 8601 format. */\n startTime: string;\n /** A required field, indicating the end time of data for detection, which should be date-time of ISO 8601 format. */\n endTime: string;\n}\n\nexport interface AnomalyStateOutput {\n /** The timestamp for this anomaly. */\n timestamp: string;\n value?: AnomalyValueOutput;\n /** Error message for the current timestamp. */\n errors?: Array<ErrorResponseOutput>;\n}\n\nexport interface AnomalyValueOutput {\n /** True if an anomaly is detected at the current timestamp. */\n isAnomaly: boolean;\n /** Indicates the significance of the anomaly. The higher the severity, the more significant the anomaly is. */\n severity: number;\n /** Raw anomaly score of severity, will help indicate the degree of abnormality as well. */\n score: number;\n interpretation?: Array<AnomalyValueInterpretationItemOutput>;\n}\n\n/** Interpretation contains more details of the anomaly, which will help with root cause analysis. */\nexport interface AnomalyValueInterpretationItemOutput extends AnomalyInterpretationOutput {}\n\nexport interface AnomalyInterpretationOutput {\n /** Variable. */\n variable?: string;\n /** This score shows the percentage contributing to the anomalous timestamp. A number between 0 and 1. */\n contributionScore?: number;\n correlationChanges?: CorrelationChangesOutput;\n}\n\nexport interface CorrelationChangesOutput {\n /** The correlated variables that have correlation changes under an anomaly. */\n changedVariables?: Array<string>;\n}\n\n/** Training result of a model including its status, errors and diagnostics information. */\nexport interface ModelInfoOutput {\n /** Source link to the input data to indicate an accessible Azure storage Uri, either pointed to an Azure blob storage folder, or pointed to a CSV file in Azure blob storage based on you data schema selection. */\n dataSource: string;\n /** Data schema of input data source: OneTable or MultiTable. The default DataSchema is OneTable. */\n dataSchema?: \"OneTable\" | \"MultiTable\";\n /** A required field, indicating the start time of training data, which should be date-time of ISO 8601 format. */\n startTime: string;\n /** A required field, indicating the end time of training data, which should be date-time of ISO 8601 format. */\n endTime: string;\n /** An optional field. The display name of the model whose maximum length is 24 characters. */\n displayName?: string;\n /** An optional field, indicating how many previous timestamps will be used to detect whether the timestamp is anomaly or not. */\n slidingWindow?: number;\n /** An optional field, indicating the manner to align multiple variables. */\n alignPolicy?: AlignPolicyOutput;\n /** Model status. One of CREATED, RUNNING, READY, and FAILED. */\n status?: \"CREATED\" | \"RUNNING\" | \"READY\" | \"FAILED\";\n /** Error messages when failed to create a model. */\n errors?: Array<ErrorResponseOutput>;\n /** Diagnostics information to help inspect the states of model or variable. */\n diagnosticsInfo?: DiagnosticsInfoOutput;\n}\n\n/** An optional field, indicating the manner to align multiple variables. */\nexport interface AlignPolicyOutput {\n /** An optional field, indicating how to align different variables to the same time-range. Either Inner or Outer. */\n alignMode?: \"Inner\" | \"Outer\";\n /** An optional field, indicating how missing values will be filled. One of Previous, Subsequent, Linear, Zero, Fixed. */\n fillNAMethod?: \"Previous\" | \"Subsequent\" | \"Linear\" | \"Zero\" | \"Fixed\";\n /** An optional field. Required when fillNAMethod is Fixed. */\n paddingValue?: number;\n}\n\n/** Diagnostics information to help inspect the states of model or variable. */\nexport interface DiagnosticsInfoOutput {\n modelState?: ModelStateOutput;\n variableStates?: Array<VariableStateOutput>;\n}\n\nexport interface ModelStateOutput {\n /** This indicates the number of passes of the entire training dataset the algorithm has completed. */\n epochIds?: Array<number>;\n /** List of metrics used to assess how the model fits the training data for each epoch. */\n trainLosses?: Array<number>;\n /** List of metrics used to assess how the model fits the validation set for each epoch. */\n validationLosses?: Array<number>;\n /** Latency for each epoch. */\n latenciesInSeconds?: Array<number>;\n}\n\n/** Response of getting a model. */\nexport interface ModelOutput {\n /**\n * Model identifier.\n *\n * Value may contain a UUID\n */\n modelId: string;\n /** Date and time (UTC) when the model was created. */\n createdTime: string;\n /** Date and time (UTC) when the model was last updated. */\n lastUpdatedTime: string;\n /** Training result of a model including its status, errors and diagnostics information. */\n modelInfo?: ModelInfoOutput;\n}\n\n/** Response of listing models. */\nexport interface ModelListOutput {\n /** List of models. */\n models: Array<ModelOutput>;\n /** Number of trained multivariate models. */\n currentCount: number;\n /** Maximum number of models that can be trained for this Anomaly Detector resource. */\n maxCount: number;\n /** The link to fetch more models. */\n nextLink?: string;\n}\n\nexport interface LastDetectionResultOutput {\n variableStates?: Array<VariableStateOutput>;\n results?: Array<AnomalyStateOutput>;\n}\n"]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { getPagedAsyncIterator } from "@azure/core-paging";
|
|
4
|
+
import { createRestError } from "@azure-rest/core-client";
|
|
5
|
+
/**
|
|
6
|
+
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
7
|
+
* @param client - Client to use for sending the next page requests
|
|
8
|
+
* @param initialResponse - Initial response containing the nextLink and current page of elements
|
|
9
|
+
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
|
|
10
|
+
* @returns - PagedAsyncIterableIterator to iterate the elements
|
|
11
|
+
*/
|
|
12
|
+
export function paginate(client, initialResponse, options = {}) {
|
|
13
|
+
let firstRun = true;
|
|
14
|
+
// We need to check the response for success before trying to inspect it looking for
|
|
15
|
+
// the properties to use for nextLink and itemName
|
|
16
|
+
checkPagingRequest(initialResponse);
|
|
17
|
+
const { itemName, nextLinkName } = getPaginationProperties(initialResponse);
|
|
18
|
+
const { customGetPage } = options;
|
|
19
|
+
const pagedResult = {
|
|
20
|
+
firstPageLink: "",
|
|
21
|
+
getPage: typeof customGetPage === "function"
|
|
22
|
+
? customGetPage
|
|
23
|
+
: async (pageLink) => {
|
|
24
|
+
const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();
|
|
25
|
+
firstRun = false;
|
|
26
|
+
checkPagingRequest(result);
|
|
27
|
+
const nextLink = getNextLink(result.body, nextLinkName);
|
|
28
|
+
const values = getElements(result.body, itemName);
|
|
29
|
+
return {
|
|
30
|
+
page: values,
|
|
31
|
+
nextPageLink: nextLink,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
return getPagedAsyncIterator(pagedResult);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Gets for the value of nextLink in the body
|
|
39
|
+
*/
|
|
40
|
+
function getNextLink(body, nextLinkName) {
|
|
41
|
+
if (!nextLinkName) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const nextLink = body[nextLinkName];
|
|
45
|
+
if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
|
|
46
|
+
throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
|
|
47
|
+
}
|
|
48
|
+
return nextLink;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Gets the elements of the current request in the body.
|
|
52
|
+
*/
|
|
53
|
+
function getElements(body, itemName) {
|
|
54
|
+
const value = body[itemName];
|
|
55
|
+
// value has to be an array according to the x-ms-pageable extension.
|
|
56
|
+
// The fact that this must be an array is used above to calculate the
|
|
57
|
+
// type of elements in the page in PaginateReturn
|
|
58
|
+
if (!Array.isArray(value)) {
|
|
59
|
+
throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
60
|
+
}
|
|
61
|
+
return value !== null && value !== void 0 ? value : [];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Checks if a request failed
|
|
65
|
+
*/
|
|
66
|
+
function checkPagingRequest(response) {
|
|
67
|
+
const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"];
|
|
68
|
+
if (!Http2xxStatusCodes.includes(response.status)) {
|
|
69
|
+
throw createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Extracts the itemName and nextLinkName from the initial response to use them for pagination
|
|
74
|
+
*/
|
|
75
|
+
function getPaginationProperties(initialResponse) {
|
|
76
|
+
// Build a set with the passed custom nextLinkNames
|
|
77
|
+
const nextLinkNames = new Set(["nextLink"]);
|
|
78
|
+
// Build a set with the passed custom set of itemNames
|
|
79
|
+
const itemNames = new Set(["value", "models"]);
|
|
80
|
+
let nextLinkName;
|
|
81
|
+
let itemName;
|
|
82
|
+
for (const name of nextLinkNames) {
|
|
83
|
+
const nextLink = initialResponse.body[name];
|
|
84
|
+
if (nextLink) {
|
|
85
|
+
nextLinkName = name;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (const name of itemNames) {
|
|
90
|
+
const item = initialResponse.body[name];
|
|
91
|
+
if (item) {
|
|
92
|
+
itemName = name;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (!itemName) {
|
|
97
|
+
throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${[
|
|
98
|
+
...itemNames,
|
|
99
|
+
].join(" OR ")}`);
|
|
100
|
+
}
|
|
101
|
+
return { itemName, nextLinkName };
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=paginateHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends\n | {\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"]}
|
|
@@ -0,0 +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 DetectRequest,\n ChangePointDetectRequest,\n ModelInfo,\n DetectionRequest,\n LastDetectionRequest,\n} from \"./models\";\n\nexport interface DetectUnivariateEntireSeriesBodyParam {\n /** Time series points and period if needed. Advanced model parameters can also be set in the request. */\n body: DetectRequest;\n}\n\nexport interface DetectUnivariateEntireSeriesMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DetectUnivariateEntireSeriesParameters = DetectUnivariateEntireSeriesMediaTypesParam &\n DetectUnivariateEntireSeriesBodyParam &\n RequestParameters;\n\nexport interface DetectUnivariateLastPointBodyParam {\n /** Time series points and period if needed. Advanced model parameters can also be set in the request. */\n body: DetectRequest;\n}\n\nexport interface DetectUnivariateLastPointMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DetectUnivariateLastPointParameters = DetectUnivariateLastPointMediaTypesParam &\n DetectUnivariateLastPointBodyParam &\n RequestParameters;\n\nexport interface DetectUnivariateChangePointBodyParam {\n /** Time series points and granularity is needed. Advanced model parameters can also be set in the request if needed. */\n body: ChangePointDetectRequest;\n}\n\nexport interface DetectUnivariateChangePointMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DetectUnivariateChangePointParameters = DetectUnivariateChangePointMediaTypesParam &\n DetectUnivariateChangePointBodyParam &\n RequestParameters;\nexport type GetMultivariateBatchDetectionResultParameters = RequestParameters;\n\nexport interface CreateAndTrainMultivariateModelBodyParam {\n /** Training request */\n body: ModelInfo;\n}\n\nexport interface CreateAndTrainMultivariateModelMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type CreateAndTrainMultivariateModelParameters = CreateAndTrainMultivariateModelMediaTypesParam &\n CreateAndTrainMultivariateModelBodyParam &\n 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 /** Detect anomaly request */\n body: DetectionRequest;\n}\n\nexport interface DetectMultivariateBatchAnomalyMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DetectMultivariateBatchAnomalyParameters = DetectMultivariateBatchAnomalyMediaTypesParam &\n DetectMultivariateBatchAnomalyBodyParam &\n RequestParameters;\n\nexport interface DetectMultivariateLastAnomalyBodyParam {\n /** Request for last detection */\n body: LastDetectionRequest;\n}\n\nexport interface DetectMultivariateLastAnomalyMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DetectMultivariateLastAnomalyParameters = DetectMultivariateLastAnomalyMediaTypesParam &\n DetectMultivariateLastAnomalyBodyParam &\n RequestParameters;\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { LroEngine, } from "@azure/core-lro";
|
|
4
|
+
/**
|
|
5
|
+
* Helper function that builds a Poller object to help polling a long running operation.
|
|
6
|
+
* @param client - Client to use for sending the request to get additional pages.
|
|
7
|
+
* @param initialResponse - The initial response.
|
|
8
|
+
* @param options - Options to set a resume state or custom polling interval.
|
|
9
|
+
* @returns - A poller object to poll for operation state updates and eventually get the final response.
|
|
10
|
+
*/
|
|
11
|
+
export function getLongRunningPoller(client, initialResponse, options = {}) {
|
|
12
|
+
const poller = {
|
|
13
|
+
requestMethod: initialResponse.request.method,
|
|
14
|
+
requestPath: initialResponse.request.url,
|
|
15
|
+
sendInitialRequest: async () => {
|
|
16
|
+
// In the case of Rest Clients we are building the LRO poller object from a response that's the reason
|
|
17
|
+
// we are not triggering the initial request here, just extracting the information from the
|
|
18
|
+
// response we were provided.
|
|
19
|
+
return getLroResponse(initialResponse);
|
|
20
|
+
},
|
|
21
|
+
sendPollRequest: async (path) => {
|
|
22
|
+
// This is the callback that is going to be called to poll the service
|
|
23
|
+
// to get the latest status. We use the client provided and the polling path
|
|
24
|
+
// which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
|
|
25
|
+
// depending on the lro pattern that the service implements. If non is provided we default to the initial path.
|
|
26
|
+
const response = await client.pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url).get();
|
|
27
|
+
const lroResponse = getLroResponse(response);
|
|
28
|
+
lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url;
|
|
29
|
+
return lroResponse;
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
return new LroEngine(poller, options);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Converts a Rest Client response to a response that the LRO engine knows about
|
|
36
|
+
* @param response - a rest client http response
|
|
37
|
+
* @returns - An LRO response that the LRO engine can work with
|
|
38
|
+
*/
|
|
39
|
+
function getLroResponse(response) {
|
|
40
|
+
if (Number.isNaN(response.status)) {
|
|
41
|
+
throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
flatResponse: response,
|
|
45
|
+
rawResponse: Object.assign(Object.assign({}, response), { statusCode: Number.parseInt(response.status), body: response.body }),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=pollingHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,SAAS,GAKV,MAAM,iBAAiB,CAAC;AAEzB;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAc,EACd,eAAwB,EACxB,UAAkE,EAAE;IAEpE,MAAM,MAAM,GAAkC;QAC5C,aAAa,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM;QAC7C,WAAW,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG;QACxC,kBAAkB,EAAE,KAAK,IAAI,EAAE;YAC7B,sGAAsG;YACtG,2FAA2F;YAC3F,6BAA6B;YAC7B,OAAO,cAAc,CAAC,eAAe,CAAC,CAAC;QACzC,CAAC;QACD,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YAC9B,sEAAsE;YACtE,4EAA4E;YAC5E,0JAA0J;YAC1J,+GAA+G;YAC/G,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;YACvF,MAAM,WAAW,GAAG,cAAc,CAAC,QAAmB,CAAC,CAAC;YACxD,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC;YACnF,OAAO,WAAW,CAAC;QACrB,CAAC;KACF,CAAC;IAEF,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAA+B,QAAiB;IACrE,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjC,MAAM,IAAI,SAAS,CAAC,uDAAuD,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;KAC/F;IAED,OAAO;QACL,YAAY,EAAE,QAAQ;QACtB,WAAW,kCACN,QAAQ,KACX,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI,GACpB;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport {\n LongRunningOperation,\n LroEngine,\n LroEngineOptions,\n LroResponse,\n PollerLike,\n PollOperationState,\n} from \"@azure/core-lro\";\n\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: LroEngineOptions<TResult, PollOperationState<TResult>> = {}\n): PollerLike<PollOperationState<TResult>, TResult> {\n const poller: LongRunningOperation<TResult> = {\n requestMethod: initialResponse.request.method,\n requestPath: initialResponse.request.url,\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n const response = await client.pathUnchecked(path ?? initialResponse.request.url).get();\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n return new LroEngine(poller, options);\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO engine knows about\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO engine can work with\n */\nfunction getLroResponse<TResult extends HttpResponse>(response: TResult): LroResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n"]}
|
|
@@ -0,0 +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 EntireDetectResponseOutput,\n AnomalyDetectorErrorOutput,\n LastDetectResponseOutput,\n ChangePointDetectResponseOutput,\n DetectionResultOutput,\n ErrorResponseOutput,\n ModelOutput,\n ModelListOutput,\n LastDetectionResultOutput,\n} from \"./outputModels\";\n\n/** This operation generates a model with an entire series, each point is detected with the same model. With this method, points before and after a certain point are used to determine whether it is an anomaly. The entire detection can give user an overall status of the time series. */\nexport interface DetectUnivariateEntireSeries200Response extends HttpResponse {\n status: \"200\";\n body: EntireDetectResponseOutput;\n}\n\nexport interface DetectUnivariateEntireSeriesDefaultHeaders {\n /** error code */\n \"x-ms-error-code\"?: string;\n}\n\n/** This operation generates a model with an entire series, each point is detected with the same model. With this method, points before and after a certain point are used to determine whether it is an anomaly. The entire detection can give user an overall status of the time series. */\nexport interface DetectUnivariateEntireSeriesDefaultResponse extends HttpResponse {\n status: string;\n body: AnomalyDetectorErrorOutput;\n headers: RawHttpHeaders & DetectUnivariateEntireSeriesDefaultHeaders;\n}\n\n/** This operation generates a model using the points that you sent into the API, and based on all data to determine whether the last point is anomalous. */\nexport interface DetectUnivariateLastPoint200Response extends HttpResponse {\n status: \"200\";\n body: LastDetectResponseOutput;\n}\n\nexport interface DetectUnivariateLastPointDefaultHeaders {\n /** error code */\n \"x-ms-error-code\"?: string;\n}\n\n/** This operation generates a model using the points that you sent into the API, and based on all data to determine whether the last point is anomalous. */\nexport interface DetectUnivariateLastPointDefaultResponse extends HttpResponse {\n status: string;\n body: AnomalyDetectorErrorOutput;\n headers: RawHttpHeaders & DetectUnivariateLastPointDefaultHeaders;\n}\n\n/** Evaluate change point score of every series point */\nexport interface DetectUnivariateChangePoint200Response extends HttpResponse {\n status: \"200\";\n body: ChangePointDetectResponseOutput;\n}\n\nexport interface DetectUnivariateChangePointDefaultHeaders {\n /** error code */\n \"x-ms-error-code\"?: string;\n}\n\n/** Evaluate change point score of every series point */\nexport interface DetectUnivariateChangePointDefaultResponse extends HttpResponse {\n status: string;\n body: AnomalyDetectorErrorOutput;\n headers: RawHttpHeaders & DetectUnivariateChangePointDefaultHeaders;\n}\n\n/** For asynchronous inference, get multivariate anomaly detection result based on resultId returned by the BatchDetectAnomaly api. */\nexport interface GetMultivariateBatchDetectionResult200Response extends HttpResponse {\n status: \"200\";\n body: DetectionResultOutput;\n}\n\nexport interface GetMultivariateBatchDetectionResultDefaultHeaders {\n /** Error code */\n \"x-ms-error-code\"?: string;\n}\n\n/** For asynchronous inference, get multivariate anomaly detection result based on resultId returned by the BatchDetectAnomaly api. */\nexport interface GetMultivariateBatchDetectionResultDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & GetMultivariateBatchDetectionResultDefaultHeaders;\n}\n\nexport interface CreateAndTrainMultivariateModel201Headers {\n /** Location and ID of the model. */\n location?: string;\n}\n\n/** Create and train a multivariate anomaly detection model. The request must include a source parameter to indicate an externally accessible Azure blob storage URI.There are two types of data input: An URI pointed to an Azure blob storage folder which contains multiple CSV files, and each CSV file contains two columns, timestamp and variable. Another type of input is an URI pointed to a CSV file in Azure blob storage, which contains all the variables and a timestamp column. */\nexport interface CreateAndTrainMultivariateModel201Response extends HttpResponse {\n status: \"201\";\n body: ModelOutput;\n headers: RawHttpHeaders & CreateAndTrainMultivariateModel201Headers;\n}\n\nexport interface CreateAndTrainMultivariateModelDefaultHeaders {\n /** Error code */\n \"x-ms-error-code\"?: string;\n}\n\n/** Create and train a multivariate anomaly detection model. The request must include a source parameter to indicate an externally accessible Azure blob storage URI.There are two types of data input: An URI pointed to an Azure blob storage folder which contains multiple CSV files, and each CSV file contains two columns, timestamp and variable. Another type of input is an URI pointed to a CSV file in Azure blob storage, which contains all the variables and a timestamp column. */\nexport interface CreateAndTrainMultivariateModelDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & CreateAndTrainMultivariateModelDefaultHeaders;\n}\n\n/** List models of a resource. */\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\n/** List models of a resource. */\nexport interface ListMultivariateModelsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & ListMultivariateModelsDefaultHeaders;\n}\n\n/** Delete an existing multivariate model according to the modelId */\nexport interface DeleteMultivariateModel204Response extends HttpResponse {\n status: \"204\";\n body: Record<string, unknown>;\n}\n\nexport interface DeleteMultivariateModelDefaultHeaders {\n /** Error code */\n \"x-ms-error-code\"?: string;\n}\n\n/** Delete an existing multivariate model according to the modelId */\nexport interface DeleteMultivariateModelDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & DeleteMultivariateModelDefaultHeaders;\n}\n\n/** Get detailed information of multivariate model, including the training status and variables used in the model. */\nexport interface GetMultivariateModel200Response extends HttpResponse {\n status: \"200\";\n body: ModelOutput;\n}\n\nexport interface GetMultivariateModelDefaultHeaders {\n /** Error code */\n \"x-ms-error-code\"?: string;\n}\n\n/** Get detailed information of multivariate model, including the training status and variables used in the model. */\nexport interface GetMultivariateModelDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & GetMultivariateModelDefaultHeaders;\n}\n\nexport interface DetectMultivariateBatchAnomaly202Headers {\n /** Location of the detection result. */\n \"operation-location\"?: string;\n /** Id of the detection result. */\n \"operation-id\"?: string;\n}\n\n/** Submit multivariate anomaly detection task with the modelId of trained model and inference data, the input schema should be the same with the training request. The request will complete asynchronously and return a resultId to query the detection result.The request should be a source link to indicate an externally accessible Azure storage Uri, either pointed to an Azure blob storage folder, or pointed to a CSV file in Azure blob storage. */\nexport interface DetectMultivariateBatchAnomaly202Response extends HttpResponse {\n status: \"202\";\n body: DetectionResultOutput;\n headers: RawHttpHeaders & DetectMultivariateBatchAnomaly202Headers;\n}\n\nexport interface DetectMultivariateBatchAnomalyDefaultHeaders {\n /** Error code */\n \"x-ms-error-code\"?: string;\n}\n\n/** Submit multivariate anomaly detection task with the modelId of trained model and inference data, the input schema should be the same with the training request. The request will complete asynchronously and return a resultId to query the detection result.The request should be a source link to indicate an externally accessible Azure storage Uri, either pointed to an Azure blob storage folder, or pointed to a CSV file in Azure blob storage. */\nexport interface DetectMultivariateBatchAnomalyDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & DetectMultivariateBatchAnomalyDefaultHeaders;\n}\n\n/** Submit multivariate anomaly detection task with the modelId of trained model and inference data, and the inference data should be put into request body in a JSON format. The request will complete synchronously and return the detection immediately in the response body. */\nexport interface DetectMultivariateLastAnomaly200Response extends HttpResponse {\n status: \"200\";\n body: LastDetectionResultOutput;\n}\n\nexport interface DetectMultivariateLastAnomalyDefaultHeaders {\n /** Error code */\n \"x-ms-error-code\"?: string;\n}\n\n/** Submit multivariate anomaly detection task with the modelId of trained model and inference data, and the inference data should be put into request body in a JSON format. The request will complete synchronously and return the detection immediately in the response body. */\nexport interface DetectMultivariateLastAnomalyDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n headers: RawHttpHeaders & DetectMultivariateLastAnomalyDefaultHeaders;\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@azure-rest/ai-anomaly-detector",
|
|
3
|
+
"sdk-type": "client",
|
|
4
|
+
"author": "Microsoft Corporation",
|
|
5
|
+
"version": "1.0.0-alpha.20221107.2",
|
|
6
|
+
"description": "A generated SDK for AnomalyDetectorRest.",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"node",
|
|
9
|
+
"azure",
|
|
10
|
+
"cloud",
|
|
11
|
+
"typescript",
|
|
12
|
+
"browser",
|
|
13
|
+
"isomorphic"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"module": "./dist-esm/src/index.js",
|
|
18
|
+
"types": "./types/ai-anomaly-detector.d.ts",
|
|
19
|
+
"repository": "github:Azure/azure-sdk-for-js",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist/",
|
|
25
|
+
"dist-esm/src/",
|
|
26
|
+
"types/ai-anomaly-detector.d.ts",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"review/*"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=14.0.0"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
|
|
36
|
+
"build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1",
|
|
37
|
+
"build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
|
|
38
|
+
"build:samples": "echo skipped.",
|
|
39
|
+
"build:test": "tsc -p . && dev-tool run bundle",
|
|
40
|
+
"build:debug": "tsc -p . && dev-tool run bundle && api-extractor run --local",
|
|
41
|
+
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
42
|
+
"clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log",
|
|
43
|
+
"execute:samples": "dev-tool samples run samples-dev",
|
|
44
|
+
"extract-api": "rimraf review && mkdirp ./review && api-extractor run --local",
|
|
45
|
+
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
46
|
+
"generate:client": "autorest --typescript swagger/README.md && npm run format",
|
|
47
|
+
"integration-test:browser": "dev-tool run test:browser",
|
|
48
|
+
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'",
|
|
49
|
+
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
|
|
50
|
+
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
|
|
51
|
+
"lint": "eslint package.json api-extractor.json src test --ext .ts",
|
|
52
|
+
"pack": "npm pack 2>&1",
|
|
53
|
+
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
|
|
54
|
+
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
|
|
55
|
+
"test": "npm run clean && npm run build:test && npm run unit-test",
|
|
56
|
+
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
|
57
|
+
"unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'",
|
|
58
|
+
"unit-test:browser": "dev-tool run test:browser",
|
|
59
|
+
"build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && api-extractor run --local"
|
|
60
|
+
},
|
|
61
|
+
"sideEffects": false,
|
|
62
|
+
"autoPublish": false,
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@azure/core-auth": "^1.3.0",
|
|
65
|
+
"@azure-rest/core-client": "^1.0.0",
|
|
66
|
+
"@azure/core-rest-pipeline": "^1.8.0",
|
|
67
|
+
"@azure/logger": "^1.0.0",
|
|
68
|
+
"tslib": "^2.2.0",
|
|
69
|
+
"@azure/core-paging": "^1.2.0",
|
|
70
|
+
"@azure/core-lro": "^2.2.0"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@microsoft/api-extractor": "^7.31.1",
|
|
74
|
+
"autorest": "latest",
|
|
75
|
+
"@types/node": "^14.0.0",
|
|
76
|
+
"dotenv": "^8.2.0",
|
|
77
|
+
"eslint": "^8.0.0",
|
|
78
|
+
"mkdirp": "^1.0.4",
|
|
79
|
+
"prettier": "2.2.1",
|
|
80
|
+
"rimraf": "^3.0.0",
|
|
81
|
+
"source-map-support": "^0.5.9",
|
|
82
|
+
"typescript": "~4.6.0",
|
|
83
|
+
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
|
|
84
|
+
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
|
|
85
|
+
"@azure-tools/test-credential": ">=1.0.0-alpha <1.0.0-alphb",
|
|
86
|
+
"@azure/identity": "^2.0.1",
|
|
87
|
+
"@azure-tools/test-recorder": "^2.0.0",
|
|
88
|
+
"mocha": "^7.1.1",
|
|
89
|
+
"@types/mocha": "^7.0.2",
|
|
90
|
+
"mocha-junit-reporter": "^1.18.0",
|
|
91
|
+
"cross-env": "^7.0.2",
|
|
92
|
+
"@types/chai": "^4.2.8",
|
|
93
|
+
"chai": "^4.2.0",
|
|
94
|
+
"karma-chrome-launcher": "^3.0.0",
|
|
95
|
+
"karma-coverage": "^2.0.0",
|
|
96
|
+
"karma-edge-launcher": "^0.4.2",
|
|
97
|
+
"karma-env-preprocessor": "^0.1.1",
|
|
98
|
+
"karma-firefox-launcher": "^1.1.0",
|
|
99
|
+
"karma-ie-launcher": "^1.0.0",
|
|
100
|
+
"karma-junit-reporter": "^2.0.1",
|
|
101
|
+
"karma-mocha-reporter": "^2.2.5",
|
|
102
|
+
"karma-mocha": "^2.0.1",
|
|
103
|
+
"karma-source-map-support": "~1.4.0",
|
|
104
|
+
"karma-sourcemap-loader": "^0.3.8",
|
|
105
|
+
"karma": "^6.2.0",
|
|
106
|
+
"nyc": "^14.0.0",
|
|
107
|
+
"csv-parse": "^5.0.3"
|
|
108
|
+
},
|
|
109
|
+
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/anomalydetector/ai-anomaly-detector-rest/README.md",
|
|
110
|
+
"//metadata": {
|
|
111
|
+
"constantPaths": [
|
|
112
|
+
{
|
|
113
|
+
"path": "swagger/README.md",
|
|
114
|
+
"prefix": "package-version"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"browser": {
|
|
119
|
+
"./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js"
|
|
120
|
+
},
|
|
121
|
+
"//sampleConfiguration": {
|
|
122
|
+
"productName": "AnomalyDetectorRest",
|
|
123
|
+
"productSlugs": [
|
|
124
|
+
"azure"
|
|
125
|
+
],
|
|
126
|
+
"disableDocsMs": true,
|
|
127
|
+
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure-rest/ai-anomaly-detector?view=azure-node-preview"
|
|
128
|
+
}
|
|
129
|
+
}
|