@azure-rest/ai-anomaly-detector 1.0.0-beta.1 → 1.0.0-beta.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.
Files changed (170) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +4 -4
  3. package/README.md +272 -17
  4. package/dist/browser/anomalyDetectorRest.d.ts +13 -0
  5. package/dist/browser/anomalyDetectorRest.d.ts.map +1 -0
  6. package/{dist-esm/src → dist/browser}/anomalyDetectorRest.js +13 -8
  7. package/dist/browser/anomalyDetectorRest.js.map +1 -0
  8. package/dist/browser/clientDefinitions.d.ts +95 -0
  9. package/dist/browser/clientDefinitions.d.ts.map +1 -0
  10. package/dist/browser/clientDefinitions.js +4 -0
  11. package/dist/browser/clientDefinitions.js.map +1 -0
  12. package/dist/browser/index.d.ts +11 -0
  13. package/dist/browser/index.d.ts.map +1 -0
  14. package/dist/browser/index.js +13 -0
  15. package/dist/browser/index.js.map +1 -0
  16. package/dist/browser/isUnexpected.d.ts +12 -0
  17. package/dist/browser/isUnexpected.d.ts.map +1 -0
  18. package/{dist-esm/src → dist/browser}/isUnexpected.js +5 -6
  19. package/dist/browser/isUnexpected.js.map +1 -0
  20. package/dist/browser/models.d.ts +252 -0
  21. package/dist/browser/models.d.ts.map +1 -0
  22. package/dist/browser/models.js +4 -0
  23. package/{dist-esm/src → dist/browser}/models.js.map +1 -1
  24. package/dist/browser/outputModels.d.ts +367 -0
  25. package/dist/browser/outputModels.d.ts.map +1 -0
  26. package/dist/browser/outputModels.js +4 -0
  27. package/{dist-esm/src → dist/browser}/outputModels.js.map +1 -1
  28. package/dist/browser/package.json +3 -0
  29. package/dist/browser/paginateHelper.d.ts +47 -0
  30. package/dist/browser/paginateHelper.d.ts.map +1 -0
  31. package/{dist-esm/src → dist/browser}/paginateHelper.js +2 -2
  32. package/dist/browser/paginateHelper.js.map +1 -0
  33. package/dist/browser/parameters.d.ts +46 -0
  34. package/dist/browser/parameters.d.ts.map +1 -0
  35. package/dist/browser/parameters.js +4 -0
  36. package/dist/browser/parameters.js.map +1 -0
  37. package/dist/browser/responses.d.ts +155 -0
  38. package/dist/browser/responses.d.ts.map +1 -0
  39. package/dist/browser/responses.js +4 -0
  40. package/dist/browser/responses.js.map +1 -0
  41. package/dist/commonjs/anomalyDetectorRest.d.ts +13 -0
  42. package/dist/commonjs/anomalyDetectorRest.d.ts.map +1 -0
  43. package/dist/commonjs/anomalyDetectorRest.js +34 -0
  44. package/dist/commonjs/anomalyDetectorRest.js.map +1 -0
  45. package/dist/commonjs/clientDefinitions.d.ts +95 -0
  46. package/dist/commonjs/clientDefinitions.d.ts.map +1 -0
  47. package/dist/commonjs/clientDefinitions.js +5 -0
  48. package/dist/commonjs/clientDefinitions.js.map +1 -0
  49. package/dist/commonjs/index.d.ts +11 -0
  50. package/dist/commonjs/index.d.ts.map +1 -0
  51. package/dist/commonjs/index.js +16 -0
  52. package/dist/commonjs/index.js.map +1 -0
  53. package/dist/commonjs/isUnexpected.d.ts +12 -0
  54. package/dist/commonjs/isUnexpected.d.ts.map +1 -0
  55. package/dist/commonjs/isUnexpected.js +81 -0
  56. package/dist/commonjs/isUnexpected.js.map +1 -0
  57. package/dist/commonjs/models.d.ts +252 -0
  58. package/dist/commonjs/models.d.ts.map +1 -0
  59. package/dist/commonjs/models.js +5 -0
  60. package/dist/commonjs/models.js.map +1 -0
  61. package/dist/commonjs/outputModels.d.ts +367 -0
  62. package/dist/commonjs/outputModels.d.ts.map +1 -0
  63. package/dist/commonjs/outputModels.js +5 -0
  64. package/dist/commonjs/outputModels.js.map +1 -0
  65. package/dist/commonjs/package.json +3 -0
  66. package/dist/commonjs/paginateHelper.d.ts +47 -0
  67. package/dist/commonjs/paginateHelper.d.ts.map +1 -0
  68. package/dist/commonjs/paginateHelper.js +106 -0
  69. package/dist/commonjs/paginateHelper.js.map +1 -0
  70. package/dist/commonjs/parameters.d.ts +46 -0
  71. package/dist/commonjs/parameters.d.ts.map +1 -0
  72. package/dist/commonjs/parameters.js +5 -0
  73. package/dist/commonjs/parameters.js.map +1 -0
  74. package/dist/commonjs/responses.d.ts +155 -0
  75. package/dist/commonjs/responses.d.ts.map +1 -0
  76. package/dist/commonjs/responses.js +5 -0
  77. package/dist/commonjs/responses.js.map +1 -0
  78. package/dist/commonjs/tsdoc-metadata.json +11 -0
  79. package/dist/esm/anomalyDetectorRest.d.ts +13 -0
  80. package/dist/esm/anomalyDetectorRest.d.ts.map +1 -0
  81. package/dist/esm/anomalyDetectorRest.js +31 -0
  82. package/dist/esm/anomalyDetectorRest.js.map +1 -0
  83. package/dist/esm/clientDefinitions.d.ts +95 -0
  84. package/dist/esm/clientDefinitions.d.ts.map +1 -0
  85. package/dist/esm/clientDefinitions.js +4 -0
  86. package/dist/esm/clientDefinitions.js.map +1 -0
  87. package/dist/esm/index.d.ts +11 -0
  88. package/dist/esm/index.d.ts.map +1 -0
  89. package/dist/esm/index.js +13 -0
  90. package/dist/esm/index.js.map +1 -0
  91. package/dist/esm/isUnexpected.d.ts +12 -0
  92. package/dist/esm/isUnexpected.d.ts.map +1 -0
  93. package/dist/esm/isUnexpected.js +78 -0
  94. package/dist/esm/isUnexpected.js.map +1 -0
  95. package/dist/esm/models.d.ts +252 -0
  96. package/dist/esm/models.d.ts.map +1 -0
  97. package/dist/esm/models.js +4 -0
  98. package/dist/esm/models.js.map +1 -0
  99. package/dist/esm/outputModels.d.ts +367 -0
  100. package/dist/esm/outputModels.d.ts.map +1 -0
  101. package/dist/esm/outputModels.js +4 -0
  102. package/dist/esm/outputModels.js.map +1 -0
  103. package/dist/esm/package.json +3 -0
  104. package/dist/esm/paginateHelper.d.ts +47 -0
  105. package/dist/esm/paginateHelper.d.ts.map +1 -0
  106. package/dist/esm/paginateHelper.js +103 -0
  107. package/dist/esm/paginateHelper.js.map +1 -0
  108. package/dist/esm/parameters.d.ts +46 -0
  109. package/dist/esm/parameters.d.ts.map +1 -0
  110. package/dist/esm/parameters.js +4 -0
  111. package/dist/esm/parameters.js.map +1 -0
  112. package/dist/esm/responses.d.ts +155 -0
  113. package/dist/esm/responses.d.ts.map +1 -0
  114. package/dist/esm/responses.js +4 -0
  115. package/dist/esm/responses.js.map +1 -0
  116. package/dist/react-native/anomalyDetectorRest.d.ts +13 -0
  117. package/dist/react-native/anomalyDetectorRest.d.ts.map +1 -0
  118. package/dist/react-native/anomalyDetectorRest.js +31 -0
  119. package/dist/react-native/anomalyDetectorRest.js.map +1 -0
  120. package/dist/react-native/clientDefinitions.d.ts +95 -0
  121. package/dist/react-native/clientDefinitions.d.ts.map +1 -0
  122. package/dist/react-native/clientDefinitions.js +4 -0
  123. package/dist/react-native/clientDefinitions.js.map +1 -0
  124. package/dist/react-native/index.d.ts +11 -0
  125. package/dist/react-native/index.d.ts.map +1 -0
  126. package/dist/react-native/index.js +13 -0
  127. package/dist/react-native/index.js.map +1 -0
  128. package/dist/react-native/isUnexpected.d.ts +12 -0
  129. package/dist/react-native/isUnexpected.d.ts.map +1 -0
  130. package/dist/react-native/isUnexpected.js +78 -0
  131. package/dist/react-native/isUnexpected.js.map +1 -0
  132. package/dist/react-native/models.d.ts +252 -0
  133. package/dist/react-native/models.d.ts.map +1 -0
  134. package/dist/react-native/models.js +4 -0
  135. package/dist/react-native/models.js.map +1 -0
  136. package/dist/react-native/outputModels.d.ts +367 -0
  137. package/dist/react-native/outputModels.d.ts.map +1 -0
  138. package/dist/react-native/outputModels.js +4 -0
  139. package/dist/react-native/outputModels.js.map +1 -0
  140. package/dist/react-native/package.json +3 -0
  141. package/dist/react-native/paginateHelper.d.ts +47 -0
  142. package/dist/react-native/paginateHelper.d.ts.map +1 -0
  143. package/dist/react-native/paginateHelper.js +103 -0
  144. package/dist/react-native/paginateHelper.js.map +1 -0
  145. package/dist/react-native/parameters.d.ts +46 -0
  146. package/dist/react-native/parameters.d.ts.map +1 -0
  147. package/dist/react-native/parameters.js +4 -0
  148. package/dist/react-native/parameters.js.map +1 -0
  149. package/dist/react-native/responses.d.ts +155 -0
  150. package/dist/react-native/responses.d.ts.map +1 -0
  151. package/dist/react-native/responses.js +4 -0
  152. package/dist/react-native/responses.js.map +1 -0
  153. package/package.json +86 -80
  154. package/review/{ai-anomaly-detector.api.md → ai-anomaly-detector-node.api.md} +9 -9
  155. package/dist/index.js +0 -216
  156. package/dist/index.js.map +0 -1
  157. package/dist-esm/src/anomalyDetectorRest.js.map +0 -1
  158. package/dist-esm/src/clientDefinitions.js +0 -4
  159. package/dist-esm/src/clientDefinitions.js.map +0 -1
  160. package/dist-esm/src/index.js +0 -13
  161. package/dist-esm/src/index.js.map +0 -1
  162. package/dist-esm/src/isUnexpected.js.map +0 -1
  163. package/dist-esm/src/models.js +0 -4
  164. package/dist-esm/src/outputModels.js +0 -4
  165. package/dist-esm/src/paginateHelper.js.map +0 -1
  166. package/dist-esm/src/parameters.js +0 -4
  167. package/dist-esm/src/parameters.js.map +0 -1
  168. package/dist-esm/src/responses.js +0 -4
  169. package/dist-esm/src/responses.js.map +0 -1
  170. package/types/ai-anomaly-detector.d.ts +0 -1086
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Release History
2
+
3
+ ## 1.0.0-beta.2 (Unreleased)
4
+
5
+ ### Features Added
6
+
7
+ ### Breaking Changes
8
+
9
+ ### Bugs Fixed
10
+
11
+ ### Other Changes
12
+
13
+ ## 1.0.0-beta.1 (2022-11-08)
14
+
15
+ - First release of package, see README.md for details.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ Copyright (c) Microsoft Corporation.
2
2
 
3
- Copyright (c) 2022 Microsoft
3
+ MIT License
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -12,10 +12,10 @@ furnished to do so, subject to the following conditions:
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
14
14
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,25 +1,16 @@
1
1
  # Azure AnomalyDetectorRest REST client library for JavaScript
2
2
 
3
- AnomalyDetector Rest Client
3
+ [Anomaly Detector](https://learn.microsoft.com/azure/cognitive-services/Anomaly-Detector/overview) is an AI service with a set of APIs, which enables you to monitor and detect anomalies in your time series data with little machine learning (ML) knowledge, either batch validation or real-time inference.
4
4
 
5
- **Please rely heavily on our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library**
6
-
7
- Key links:
8
-
9
- - [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/anomalydetector/ai-anomaly-detector-rest)
10
- - [Package (NPM)](https://www.npmjs.com/package/@azure-rest/ai-anomaly-detector)
11
- - [API reference documentation](https://docs.microsoft.com/javascript/api/@azure-rest/ai-anomaly-detector?view=azure-node-preview)
12
- - [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/anomalydetector/ai-anomaly-detector-rest/samples)
5
+ Please refer to our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library.
13
6
 
14
7
  ## Getting started
15
8
 
16
- ### Currently supported environments
17
-
18
- - LTS versions of Node.js
19
-
20
9
  ### Prerequisites
21
10
 
22
- - You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package.
11
+ - LTS versions of Node.js
12
+ - You need an [Azure subscription][azure_sub] to use this package.
13
+ - An existing Cognitive Services Anomaly Detector instance.
23
14
 
24
15
  ### Install the `@azure-rest/ai-anomaly-detector` package
25
16
 
@@ -29,13 +20,17 @@ Install the Azure AnomalyDetectorRest REST client REST client library for JavaSc
29
20
  npm install @azure-rest/ai-anomaly-detector
30
21
  ```
31
22
 
23
+ | SDK version | Supported API version of service |
24
+ | ------------ | -------------------------------- |
25
+ | 1.0.0-beta.1 | 1.1 |
26
+
32
27
  ### Create and authenticate a `AnomalyDetectorRestClient`
33
28
 
34
29
  To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token),
35
30
  provide an instance of the desired credential type obtained from the
36
31
  [@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.
37
32
 
38
- To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity)
33
+ To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity)
39
34
 
40
35
  After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use.
41
36
  As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential)
@@ -44,16 +39,276 @@ can be used to authenticate the client.
44
39
  Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
45
40
  AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
46
41
 
42
+ ## Key concepts
43
+
44
+ With the Anomaly Detector, you can either detect anomalies in one variable using **Univariate Anomaly Detection**, or detect anomalies in multiple variables with **Multivariate Anomaly Detection**.
45
+
46
+ | Feature | Description |
47
+ | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
48
+ | Univariate Anomaly Detection | Detect anomalies in one variable, like revenue, cost, etc. The model was selected automatically based on your data pattern. |
49
+ | Multivariate Anomaly Detection | Detect anomalies in multiple variables with correlations, which are usually gathered from equipment or other complex system. The underlying model used is Graph attention network. |
50
+
51
+ ### Univariate Anomaly Detection
52
+
53
+ The Univariate Anomaly Detection API enables you to monitor and detect abnormalities in your time series data without having to know machine learning. The algorithms adapt by automatically identifying and applying the best-fitting models to your data, regardless of industry, scenario, or data volume. Using your time series data, the API determines boundaries for anomaly detection, expected values, and which data points are anomalies.
54
+
55
+ Using the Anomaly Detector doesn't require any prior experience in machine learning, and the REST API enables you to easily integrate the service into your applications and processes.
56
+
57
+ With the Univariate Anomaly Detection, you can automatically detect anomalies throughout your time series data, or as they occur in real-time.
58
+
59
+ | Feature | Description |
60
+ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | Streaming detection | Detect anomalies in your streaming data by using previously seen data points to determine if your latest one is an anomaly. This operation generates a model using the data points you send, and determines if the target point is an anomaly. By calling the API with each new data point you generate, you can monitor your data as it's created. |
62
+ | Batch detection | Use your time series to detect any anomalies that might exist throughout your data. This operation generates a model using your entire time series data, with each point analyzed with the same model. |
63
+ | Change points detection | Use your time series to detect any trend change points that exist in your data. This operation generates a model using your entire time series data, with each point analyzed with the same model. |
64
+
65
+ ### Multivariate Anomaly Detection
66
+
67
+ The **Multivariate Anomaly Detection** APIs further enable developers by easily integrating advanced AI for detecting anomalies from groups of metrics, without the need for machine learning knowledge or labeled data. Dependencies and inter-correlations between up to 300 different signals are now automatically counted as key factors. This new capability helps you to proactively protect your complex systems such as software applications, servers, factory machines, spacecraft, or even your business, from failures.
68
+
69
+ With the Multivariate Anomaly Detection, you can automatically detect anomalies throughout your time series data, or as they occur in real-time. There are three processes to use Multivariate Anomaly Detection.
70
+
71
+ - **Training**: Use Train Model API to create and train a model, then use Get Model Status API to get the status and model metadata.
72
+ - **Inference**:
73
+ - Use Async Inference API to trigger an asynchronous inference process and use Get Inference results API to get detection results on a batch of data.
74
+ - You could also use Sync Inference API to trigger a detection on one timestamp every time.
75
+ - **Other operations**: List Model API and Delete Model API are supported in Multivariate Anomaly Detection model for model management.
76
+
77
+ ### Thread safety
78
+
79
+ We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads.
80
+
81
+ ## Examples
82
+
83
+ The following section provides several code snippets covering some of the most common Anomaly Detector service tasks, including:
84
+
85
+ - [Univariate Anomaly Detection - Batch detection](#batch-detection)
86
+ - [Univariate Anomaly Detection - Streaming detection](#streaming-detection)
87
+ - [Univariate Anomaly Detection - Detect change points](#detect-change-points)
88
+ - [Multivariate Anomaly Detection](#multivariate-anomaly-detection-sample)
89
+
90
+ ### Batch detection
91
+
92
+ ```ts snippet:batch_detection
93
+ import AnomalyDetector, {
94
+ TimeSeriesPoint,
95
+ DetectUnivariateEntireSeriesParameters,
96
+ isUnexpected,
97
+ } from "@azure-rest/ai-anomaly-detector";
98
+ import { readFileSync } from "node:fs";
99
+ import { parse } from "csv-parse/sync";
100
+ import { AzureKeyCredential } from "@azure/core-auth";
101
+
102
+ const apiKey = process.env["ANOMALY_DETECTOR_API_KEY"] || "";
103
+ const endpoint = process.env["ANOMALY_DETECTOR_ENDPOINT"] || "";
104
+ const timeSeriesDataPath = "./samples-dev/example-data/request-data.csv";
105
+
106
+ function read_series_from_file(path: string): Array<TimeSeriesPoint> {
107
+ const result = Array<TimeSeriesPoint>();
108
+ const input = readFileSync(path).toString();
109
+ const parsed = parse(input, { skip_empty_lines: true });
110
+ parsed.forEach(function (e: Array<string>) {
111
+ result.push({ timestamp: new Date(e[0]), value: Number(e[1]) });
112
+ });
113
+ return result;
114
+ }
115
+
116
+ // create client
117
+ const credential = new AzureKeyCredential(apiKey);
118
+ const client = AnomalyDetector(endpoint, credential);
119
+
120
+ // construct request
121
+ const options: DetectUnivariateEntireSeriesParameters = {
122
+ body: {
123
+ granularity: "daily",
124
+ imputeMode: "auto",
125
+ maxAnomalyRatio: 0.25,
126
+ sensitivity: 95,
127
+ series: read_series_from_file(timeSeriesDataPath),
128
+ },
129
+ headers: { "Content-Type": "application/json" },
130
+ };
131
+
132
+ // get last detect result
133
+ const result = await client.path("/timeseries/entire/detect").post(options);
134
+ if (isUnexpected(result)) {
135
+ throw result;
136
+ }
137
+
138
+ if (result.body.isAnomaly) {
139
+ result.body.isAnomaly.forEach(function (anomaly, index) {
140
+ if (anomaly === true) {
141
+ console.log(index);
142
+ }
143
+ });
144
+ } else {
145
+ console.log("There is no anomaly detected from the series.");
146
+ }
147
+ ```
148
+
149
+ ### Streaming Detection
150
+
151
+ ```ts snippet:streaming_detection
152
+ import AnomalyDetector, {
153
+ TimeSeriesPoint,
154
+ DetectUnivariateLastPointParameters,
155
+ isUnexpected,
156
+ } from "@azure-rest/ai-anomaly-detector";
157
+ import { readFileSync } from "node:fs";
158
+ import { parse } from "csv-parse/sync";
159
+ import { AzureKeyCredential } from "@azure/core-auth";
160
+
161
+ const apiKey = process.env["ANOMALY_DETECTOR_API_KEY"] || "";
162
+ const endpoint = process.env["ANOMALY_DETECTOR_ENDPOINT"] || "";
163
+ const timeSeriesDataPath = "./samples-dev/example-data/request-data.csv";
164
+
165
+ function read_series_from_file(path: string): Array<TimeSeriesPoint> {
166
+ const result = Array<TimeSeriesPoint>();
167
+ const input = readFileSync(path).toString();
168
+ const parsed = parse(input, { skip_empty_lines: true });
169
+ parsed.forEach(function (e: Array<string>) {
170
+ result.push({ timestamp: new Date(e[0]), value: Number(e[1]) });
171
+ });
172
+ return result;
173
+ }
174
+
175
+ // create client
176
+ const credential = new AzureKeyCredential(apiKey);
177
+ const client = AnomalyDetector(endpoint, credential);
178
+
179
+ // construct request
180
+ const options: DetectUnivariateLastPointParameters = {
181
+ body: {
182
+ granularity: "daily",
183
+ imputeFixedValue: 800,
184
+ imputeMode: "fixed",
185
+ maxAnomalyRatio: 0.25,
186
+ sensitivity: 95,
187
+ series: read_series_from_file(timeSeriesDataPath),
188
+ },
189
+ headers: { "Content-Type": "application/json" },
190
+ };
191
+
192
+ // get last detect result
193
+ const result = await client.path("/timeseries/last/detect").post(options);
194
+ if (isUnexpected(result)) {
195
+ throw result;
196
+ }
197
+
198
+ if (result.body.isAnomaly) {
199
+ console.log("The latest point is detected as anomaly.");
200
+ } else {
201
+ console.log("The latest point is not detected as anomaly.");
202
+ }
203
+ ```
204
+
205
+ ### Detect change points
206
+
207
+ ```ts snippet:detect_change_points
208
+ import AnomalyDetector, {
209
+ TimeSeriesPoint,
210
+ DetectUnivariateChangePointParameters,
211
+ isUnexpected,
212
+ } from "@azure-rest/ai-anomaly-detector";
213
+ import { readFileSync } from "node:fs";
214
+ import { parse } from "csv-parse/sync";
215
+ import { AzureKeyCredential } from "@azure/core-auth";
216
+
217
+ const apiKey = process.env["ANOMALY_DETECTOR_API_KEY"] || "";
218
+ const endpoint = process.env["ANOMALY_DETECTOR_ENDPOINT"] || "";
219
+ const timeSeriesDataPath = "./samples-dev/example-data/request-data.csv";
220
+
221
+ function read_series_from_file(path: string): Array<TimeSeriesPoint> {
222
+ const result = Array<TimeSeriesPoint>();
223
+ const input = readFileSync(path).toString();
224
+ const parsed = parse(input, { skip_empty_lines: true });
225
+ parsed.forEach(function (e: Array<string>) {
226
+ result.push({ timestamp: new Date(e[0]), value: Number(e[1]) });
227
+ });
228
+ return result;
229
+ }
230
+
231
+ const credential = new AzureKeyCredential(apiKey);
232
+ const client = AnomalyDetector(endpoint, credential);
233
+ const options: DetectUnivariateChangePointParameters = {
234
+ body: {
235
+ granularity: "daily",
236
+ series: read_series_from_file(timeSeriesDataPath),
237
+ },
238
+ headers: { "Content-Type": "application/json" },
239
+ };
240
+ const result = await client.path("/timeseries/changepoint/detect").post(options);
241
+ if (isUnexpected(result)) {
242
+ throw result;
243
+ }
244
+
245
+ if (result.body.isChangePoint === undefined) throw new Error("Empty isChangePoint");
246
+ if (
247
+ result.body.isChangePoint.some(function (changePoint) {
248
+ return changePoint === true;
249
+ })
250
+ ) {
251
+ console.log("Change points were detected from the series at index:");
252
+ result.body.isChangePoint.forEach(function (changePoint, index) {
253
+ if (changePoint === true) console.log(index);
254
+ });
255
+ } else {
256
+ console.log("There is no change point detected from the series.");
257
+ }
258
+ ```
259
+
260
+ ### Multivariate Anomaly Detection Sample
261
+
262
+ To see how to use Anomaly Detector library to conduct Multivariate Anomaly Detection, see this [sample](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/anomalydetector/ai-anomaly-detector-rest/samples/v1-beta/typescript/src/sample_multivariate_detection.ts).
263
+
47
264
  ## Troubleshooting
48
265
 
266
+ ### General
267
+
49
268
  ### Logging
50
269
 
51
270
  Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
52
271
 
53
- ```javascript
54
- const { setLogLevel } = require("@azure/logger");
272
+ ```ts snippet:SetLogLevel
273
+ import { setLogLevel } from "@azure/logger";
55
274
 
56
275
  setLogLevel("info");
57
276
  ```
58
277
 
59
278
  For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
279
+
280
+ ## Next steps
281
+
282
+ These code samples show common scenario operations with the Azure Anomaly Detector library. More samples can be found under the [samples](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/samples/) directory.
283
+
284
+ - Univariate Anomaly Detection - Batch Detection: [sample_detect_entire_series_anomaly.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/anomalydetector/ai-anomaly-detector-rest/samples/v1-beta/typescript/src/sample_detect_entire_series_anomaly.ts)
285
+
286
+ - Univariate Anomaly Detection - Streaming Detection: [ample_detect_last_point_anomaly.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/anomalydetector/ai-anomaly-detector-rest/samples/v1-beta/typescript/src/sample_detect_last_point_anomaly.ts)
287
+
288
+ - Univariate Anomaly Detection - Change Point Detection: [sample_detect_change_point.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/anomalydetector/ai-anomaly-detector-rest/samples/v1-beta/typescript/src/sample_detect_change_point.ts)
289
+
290
+ - Multivariate Anomaly Detection: [sample_multivariate_detection.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/anomalydetector/ai-anomaly-detector-rest/samples/v1-beta/typescript/src/sample_multivariate_detection.ts)
291
+
292
+ ### Additional documentation
293
+
294
+ For more extensive documentation on Azure Anomaly Detector, see the [Anomaly Detector documentation](https://learn.microsoft.com/azure/cognitive-services/anomaly-detector/overview) on learn.microsoft.com.
295
+
296
+ ## Contributing
297
+
298
+ This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].
299
+
300
+ When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
301
+
302
+ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.
303
+
304
+ <!-- LINKS -->
305
+
306
+ [cla]: https://cla.microsoft.com
307
+ [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
308
+ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
309
+ [coc_contact]: mailto:opencode@microsoft.com
310
+
311
+ - [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/anomalydetector/ai-anomaly-detector-rest)
312
+ - [Package (NPM)](https://www.npmjs.com/package/@azure-rest/ai-anomaly-detector)
313
+ - [API reference documentation](https://learn.microsoft.com/javascript/api/@azure-rest/ai-anomaly-detector?view=azure-node-preview)
314
+ - [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/anomalydetector/ai-anomaly-detector-rest/samples)
@@ -0,0 +1,13 @@
1
+ import type { ClientOptions } from "@azure-rest/core-client";
2
+ import type { KeyCredential } from "@azure/core-auth";
3
+ import type { AnomalyDetectorRestClient } from "./clientDefinitions.js";
4
+ export interface AnomalyDetectorRestClientOptions extends ClientOptions {
5
+ ApiVersion?: string;
6
+ }
7
+ /**
8
+ * Initialize a new instance of the class AnomalyDetectorRestClient class.
9
+ * @param Endpoint type: string
10
+ * @param credentials type: KeyCredential
11
+ */
12
+ export default function createClient(Endpoint: string, credentials: KeyCredential, options?: AnomalyDetectorRestClientOptions): AnomalyDetectorRestClient;
13
+ //# sourceMappingURL=anomalyDetectorRest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anomalyDetectorRest.d.ts","sourceRoot":"","sources":["../../src/anomalyDetectorRest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAExE,MAAM,WAAW,gCAAiC,SAAQ,aAAa;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,aAAa,EAC1B,OAAO,GAAE,gCAAqC,GAC7C,yBAAyB,CA0B3B"}
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  import { getClient } from "@azure-rest/core-client";
4
4
  /**
5
5
  * Initialize a new instance of the class AnomalyDetectorRestClient class.
@@ -7,19 +7,24 @@ import { getClient } from "@azure-rest/core-client";
7
7
  * @param credentials type: KeyCredential
8
8
  */
9
9
  export default function createClient(Endpoint, credentials, options = {}) {
10
- var _a, _b;
11
- const ApiVersion = (_a = options.ApiVersion) !== null && _a !== void 0 ? _a : "v1.1";
12
- const baseUrl = (_b = options.baseUrl) !== null && _b !== void 0 ? _b : `${Endpoint}/anomalydetector/${ApiVersion}`;
13
- options = Object.assign(Object.assign({}, options), { credentials: {
10
+ const ApiVersion = options.ApiVersion ?? "v1.1";
11
+ const baseUrl = options.baseUrl ?? `${Endpoint}/anomalydetector/${ApiVersion}`;
12
+ options = {
13
+ ...options,
14
+ credentials: {
14
15
  apiKeyHeaderName: "Ocp-Apim-Subscription-Key",
15
- } });
16
+ },
17
+ };
16
18
  const userAgentInfo = `azsdk-js-ai-anomaly-detector-rest/1.0.0-beta.1`;
17
19
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
18
20
  ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
19
21
  : `${userAgentInfo}`;
20
- options = Object.assign(Object.assign({}, options), { userAgentOptions: {
22
+ options = {
23
+ ...options,
24
+ userAgentOptions: {
21
25
  userAgentPrefix,
22
- } });
26
+ },
27
+ };
23
28
  const client = getClient(baseUrl, credentials, options);
24
29
  return client;
25
30
  }
@@ -0,0 +1 @@
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,OAAO,CAAC,UAAU,IAAI,MAAM,CAAC;IAChD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,GAAG,QAAQ,oBAAoB,UAAU,EAAE,CAAC;IAE/E,OAAO,GAAG;QACR,GAAG,OAAO;QACV,WAAW,EAAE;YACX,gBAAgB,EAAE,2BAA2B;SAC9C;KACF,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,GAAG;QACR,GAAG,OAAO;QACV,gBAAgB,EAAE;YAChB,eAAe;SAChB;KACF,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.js\";\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"]}
@@ -0,0 +1,95 @@
1
+ import type { DetectUnivariateEntireSeriesParameters, DetectUnivariateLastPointParameters, DetectUnivariateChangePointParameters, GetMultivariateBatchDetectionResultParameters, TrainMultivariateModelParameters, ListMultivariateModelsParameters, DeleteMultivariateModelParameters, GetMultivariateModelParameters, DetectMultivariateBatchAnomalyParameters, DetectMultivariateLastAnomalyParameters } from "./parameters.js";
2
+ import type { DetectUnivariateEntireSeries200Response, DetectUnivariateEntireSeriesDefaultResponse, DetectUnivariateLastPoint200Response, DetectUnivariateLastPointDefaultResponse, DetectUnivariateChangePoint200Response, DetectUnivariateChangePointDefaultResponse, GetMultivariateBatchDetectionResult200Response, GetMultivariateBatchDetectionResultDefaultResponse, TrainMultivariateModel201Response, TrainMultivariateModelDefaultResponse, ListMultivariateModels200Response, ListMultivariateModelsDefaultResponse, DeleteMultivariateModel204Response, DeleteMultivariateModelDefaultResponse, GetMultivariateModel200Response, GetMultivariateModelDefaultResponse, DetectMultivariateBatchAnomaly202Response, DetectMultivariateBatchAnomalyDefaultResponse, DetectMultivariateLastAnomaly200Response, DetectMultivariateLastAnomalyDefaultResponse } from "./responses.js";
3
+ import type { Client, StreamableMethod } from "@azure-rest/core-client";
4
+ export interface DetectUnivariateEntireSeries {
5
+ /**
6
+ * This operation generates a model with an entire series, each point is detected
7
+ * with the same model. With this method, points before and after a certain point
8
+ * are used to determine whether it is an anomaly. The entire detection can give
9
+ * user an overall status of the time series.
10
+ */
11
+ post(options: DetectUnivariateEntireSeriesParameters): StreamableMethod<DetectUnivariateEntireSeries200Response | DetectUnivariateEntireSeriesDefaultResponse>;
12
+ }
13
+ export interface DetectUnivariateLastPoint {
14
+ /**
15
+ * This operation generates a model using the points that you sent into the API,
16
+ * and based on all data to determine whether the last point is anomalous.
17
+ */
18
+ post(options: DetectUnivariateLastPointParameters): StreamableMethod<DetectUnivariateLastPoint200Response | DetectUnivariateLastPointDefaultResponse>;
19
+ }
20
+ export interface DetectUnivariateChangePoint {
21
+ /** Evaluate change point score of every series point */
22
+ post(options: DetectUnivariateChangePointParameters): StreamableMethod<DetectUnivariateChangePoint200Response | DetectUnivariateChangePointDefaultResponse>;
23
+ }
24
+ export interface GetMultivariateBatchDetectionResult {
25
+ /**
26
+ * For asynchronous inference, get multivariate anomaly detection result based on
27
+ * resultId returned by the BatchDetectAnomaly api.
28
+ */
29
+ get(options?: GetMultivariateBatchDetectionResultParameters): StreamableMethod<GetMultivariateBatchDetectionResult200Response | GetMultivariateBatchDetectionResultDefaultResponse>;
30
+ }
31
+ export interface TrainMultivariateModel {
32
+ /**
33
+ * Create and train a multivariate anomaly detection model. The request must
34
+ * include a source parameter to indicate an externally accessible Azure blob
35
+ * storage URI.There are two types of data input: An URI pointed to an Azure blob
36
+ * storage folder which contains multiple CSV files, and each CSV file contains
37
+ * two columns, timestamp and variable. Another type of input is an URI pointed to
38
+ * a CSV file in Azure blob storage, which contains all the variables and a
39
+ * timestamp column.
40
+ */
41
+ post(options: TrainMultivariateModelParameters): StreamableMethod<TrainMultivariateModel201Response | TrainMultivariateModelDefaultResponse>;
42
+ /** List models of a resource. */
43
+ get(options?: ListMultivariateModelsParameters): StreamableMethod<ListMultivariateModels200Response | ListMultivariateModelsDefaultResponse>;
44
+ }
45
+ export interface DeleteMultivariateModel {
46
+ /** Delete an existing multivariate model according to the modelId */
47
+ delete(options?: DeleteMultivariateModelParameters): StreamableMethod<DeleteMultivariateModel204Response | DeleteMultivariateModelDefaultResponse>;
48
+ /**
49
+ * Get detailed information of multivariate model, including the training status
50
+ * and variables used in the model.
51
+ */
52
+ get(options?: GetMultivariateModelParameters): StreamableMethod<GetMultivariateModel200Response | GetMultivariateModelDefaultResponse>;
53
+ }
54
+ export interface DetectMultivariateBatchAnomaly {
55
+ /**
56
+ * Submit multivariate anomaly detection task with the modelId of trained model
57
+ * and inference data, the input schema should be the same with the training
58
+ * request. The request will complete asynchronously and return a resultId to
59
+ * query the detection result.The request should be a source link to indicate an
60
+ * externally accessible Azure storage Uri, either pointed to an Azure blob
61
+ * storage folder, or pointed to a CSV file in Azure blob storage.
62
+ */
63
+ post(options: DetectMultivariateBatchAnomalyParameters): StreamableMethod<DetectMultivariateBatchAnomaly202Response | DetectMultivariateBatchAnomalyDefaultResponse>;
64
+ }
65
+ export interface DetectMultivariateLastAnomaly {
66
+ /**
67
+ * Submit multivariate anomaly detection task with the modelId of trained model
68
+ * and inference data, and the inference data should be put into request body in a
69
+ * JSON format. The request will complete synchronously and return the detection
70
+ * immediately in the response body.
71
+ */
72
+ post(options: DetectMultivariateLastAnomalyParameters): StreamableMethod<DetectMultivariateLastAnomaly200Response | DetectMultivariateLastAnomalyDefaultResponse>;
73
+ }
74
+ export interface Routes {
75
+ /** Resource for '/timeseries/entire/detect' has methods for the following verbs: post */
76
+ (path: "/timeseries/entire/detect"): DetectUnivariateEntireSeries;
77
+ /** Resource for '/timeseries/last/detect' has methods for the following verbs: post */
78
+ (path: "/timeseries/last/detect"): DetectUnivariateLastPoint;
79
+ /** Resource for '/timeseries/changepoint/detect' has methods for the following verbs: post */
80
+ (path: "/timeseries/changepoint/detect"): DetectUnivariateChangePoint;
81
+ /** Resource for '/multivariate/detect-batch/\{resultId\}' has methods for the following verbs: get */
82
+ (path: "/multivariate/detect-batch/{resultId}", resultId: string): GetMultivariateBatchDetectionResult;
83
+ /** Resource for '/multivariate/models' has methods for the following verbs: post, get */
84
+ (path: "/multivariate/models"): TrainMultivariateModel;
85
+ /** Resource for '/multivariate/models/\{modelId\}' has methods for the following verbs: delete, get */
86
+ (path: "/multivariate/models/{modelId}", modelId: string): DeleteMultivariateModel;
87
+ /** Resource for '/multivariate/models/\{modelId\}:detect-batch' has methods for the following verbs: post */
88
+ (path: "/multivariate/models/{modelId}:detect-batch", modelId: string): DetectMultivariateBatchAnomaly;
89
+ /** Resource for '/multivariate/models/\{modelId\}:detect-last' has methods for the following verbs: post */
90
+ (path: "/multivariate/models/{modelId}:detect-last", modelId: string): DetectMultivariateLastAnomaly;
91
+ }
92
+ export type AnomalyDetectorRestClient = Client & {
93
+ path: Routes;
94
+ };
95
+ //# sourceMappingURL=clientDefinitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientDefinitions.d.ts","sourceRoot":"","sources":["../../src/clientDefinitions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,sCAAsC,EACtC,mCAAmC,EACnC,qCAAqC,EACrC,6CAA6C,EAC7C,gCAAgC,EAChC,gCAAgC,EAChC,iCAAiC,EACjC,8BAA8B,EAC9B,wCAAwC,EACxC,uCAAuC,EACxC,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,uCAAuC,EACvC,2CAA2C,EAC3C,oCAAoC,EACpC,wCAAwC,EACxC,sCAAsC,EACtC,0CAA0C,EAC1C,8CAA8C,EAC9C,kDAAkD,EAClD,iCAAiC,EACjC,qCAAqC,EACrC,iCAAiC,EACjC,qCAAqC,EACrC,kCAAkC,EAClC,sCAAsC,EACtC,+BAA+B,EAC/B,mCAAmC,EACnC,yCAAyC,EACzC,6CAA6C,EAC7C,wCAAwC,EACxC,4CAA4C,EAC7C,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAExE,MAAM,WAAW,4BAA4B;IAC3C;;;;;OAKG;IACH,IAAI,CACF,OAAO,EAAE,sCAAsC,GAC9C,gBAAgB,CACjB,uCAAuC,GAAG,2CAA2C,CACtF,CAAC;CACH;AAED,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,IAAI,CACF,OAAO,EAAE,mCAAmC,GAC3C,gBAAgB,CACjB,oCAAoC,GAAG,wCAAwC,CAChF,CAAC;CACH;AAED,MAAM,WAAW,2BAA2B;IAC1C,wDAAwD;IACxD,IAAI,CACF,OAAO,EAAE,qCAAqC,GAC7C,gBAAgB,CACjB,sCAAsC,GAAG,0CAA0C,CACpF,CAAC;CACH;AAED,MAAM,WAAW,mCAAmC;IAClD;;;OAGG;IACH,GAAG,CACD,OAAO,CAAC,EAAE,6CAA6C,GACtD,gBAAgB,CACf,8CAA8C,GAC9C,kDAAkD,CACrD,CAAC;CACH;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;OAQG;IACH,IAAI,CACF,OAAO,EAAE,gCAAgC,GACxC,gBAAgB,CAAC,iCAAiC,GAAG,qCAAqC,CAAC,CAAC;IAC/F,iCAAiC;IACjC,GAAG,CACD,OAAO,CAAC,EAAE,gCAAgC,GACzC,gBAAgB,CAAC,iCAAiC,GAAG,qCAAqC,CAAC,CAAC;CAChG;AAED,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,MAAM,CACJ,OAAO,CAAC,EAAE,iCAAiC,GAC1C,gBAAgB,CAAC,kCAAkC,GAAG,sCAAsC,CAAC,CAAC;IACjG;;;OAGG;IACH,GAAG,CACD,OAAO,CAAC,EAAE,8BAA8B,GACvC,gBAAgB,CAAC,+BAA+B,GAAG,mCAAmC,CAAC,CAAC;CAC5F;AAED,MAAM,WAAW,8BAA8B;IAC7C;;;;;;;OAOG;IACH,IAAI,CACF,OAAO,EAAE,wCAAwC,GAChD,gBAAgB,CACjB,yCAAyC,GAAG,6CAA6C,CAC1F,CAAC;CACH;AAED,MAAM,WAAW,6BAA6B;IAC5C;;;;;OAKG;IACH,IAAI,CACF,OAAO,EAAE,uCAAuC,GAC/C,gBAAgB,CACjB,wCAAwC,GAAG,4CAA4C,CACxF,CAAC;CACH;AAED,MAAM,WAAW,MAAM;IACrB,yFAAyF;IACzF,CAAC,IAAI,EAAE,2BAA2B,GAAG,4BAA4B,CAAC;IAClE,uFAAuF;IACvF,CAAC,IAAI,EAAE,yBAAyB,GAAG,yBAAyB,CAAC;IAC7D,8FAA8F;IAC9F,CAAC,IAAI,EAAE,gCAAgC,GAAG,2BAA2B,CAAC;IACtE,sGAAsG;IACtG,CACE,IAAI,EAAE,uCAAuC,EAC7C,QAAQ,EAAE,MAAM,GACf,mCAAmC,CAAC;IACvC,yFAAyF;IACzF,CAAC,IAAI,EAAE,sBAAsB,GAAG,sBAAsB,CAAC;IACvD,uGAAuG;IACvG,CAAC,IAAI,EAAE,gCAAgC,EAAE,OAAO,EAAE,MAAM,GAAG,uBAAuB,CAAC;IACnF,6GAA6G;IAC7G,CACE,IAAI,EAAE,6CAA6C,EACnD,OAAO,EAAE,MAAM,GACd,8BAA8B,CAAC;IAClC,4GAA4G;IAC5G,CACE,IAAI,EAAE,4CAA4C,EAClD,OAAO,EAAE,MAAM,GACd,6BAA6B,CAAC;CAClC;AAED,MAAM,MAAM,yBAAyB,GAAG,MAAM,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ export {};
4
+ //# sourceMappingURL=clientDefinitions.js.map
@@ -0,0 +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 type {\n DetectUnivariateEntireSeriesParameters,\n DetectUnivariateLastPointParameters,\n DetectUnivariateChangePointParameters,\n GetMultivariateBatchDetectionResultParameters,\n TrainMultivariateModelParameters,\n ListMultivariateModelsParameters,\n DeleteMultivariateModelParameters,\n GetMultivariateModelParameters,\n DetectMultivariateBatchAnomalyParameters,\n DetectMultivariateLastAnomalyParameters,\n} from \"./parameters.js\";\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.js\";\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"]}
@@ -0,0 +1,11 @@
1
+ import AnomalyDetectorRest from "./anomalyDetectorRest.js";
2
+ export * from "./anomalyDetectorRest.js";
3
+ export * from "./parameters.js";
4
+ export * from "./responses.js";
5
+ export * from "./clientDefinitions.js";
6
+ export * from "./isUnexpected.js";
7
+ export * from "./models.js";
8
+ export * from "./outputModels.js";
9
+ export * from "./paginateHelper.js";
10
+ export default AnomalyDetectorRest;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAE3D,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AAEpC,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,13 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import AnomalyDetectorRest from "./anomalyDetectorRest.js";
4
+ export * from "./anomalyDetectorRest.js";
5
+ export * from "./parameters.js";
6
+ export * from "./responses.js";
7
+ export * from "./clientDefinitions.js";
8
+ export * from "./isUnexpected.js";
9
+ export * from "./models.js";
10
+ export * from "./outputModels.js";
11
+ export * from "./paginateHelper.js";
12
+ export default AnomalyDetectorRest;
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAE3D,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AAEpC,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport AnomalyDetectorRest from \"./anomalyDetectorRest.js\";\n\nexport * from \"./anomalyDetectorRest.js\";\nexport * from \"./parameters.js\";\nexport * from \"./responses.js\";\nexport * from \"./clientDefinitions.js\";\nexport * from \"./isUnexpected.js\";\nexport * from \"./models.js\";\nexport * from \"./outputModels.js\";\nexport * from \"./paginateHelper.js\";\n\nexport default AnomalyDetectorRest;\n"]}
@@ -0,0 +1,12 @@
1
+ import type { DetectUnivariateEntireSeries200Response, DetectUnivariateEntireSeriesDefaultResponse, DetectUnivariateLastPoint200Response, DetectUnivariateLastPointDefaultResponse, DetectUnivariateChangePoint200Response, DetectUnivariateChangePointDefaultResponse, GetMultivariateBatchDetectionResult200Response, GetMultivariateBatchDetectionResultDefaultResponse, TrainMultivariateModel201Response, TrainMultivariateModelDefaultResponse, ListMultivariateModels200Response, ListMultivariateModelsDefaultResponse, DeleteMultivariateModel204Response, DeleteMultivariateModelDefaultResponse, GetMultivariateModel200Response, GetMultivariateModelDefaultResponse, DetectMultivariateBatchAnomaly202Response, DetectMultivariateBatchAnomalyDefaultResponse, DetectMultivariateLastAnomaly200Response, DetectMultivariateLastAnomalyDefaultResponse } from "./responses.js";
2
+ export declare function isUnexpected(response: DetectUnivariateEntireSeries200Response | DetectUnivariateEntireSeriesDefaultResponse): response is DetectUnivariateEntireSeriesDefaultResponse;
3
+ export declare function isUnexpected(response: DetectUnivariateLastPoint200Response | DetectUnivariateLastPointDefaultResponse): response is DetectUnivariateLastPointDefaultResponse;
4
+ export declare function isUnexpected(response: DetectUnivariateChangePoint200Response | DetectUnivariateChangePointDefaultResponse): response is DetectUnivariateChangePointDefaultResponse;
5
+ export declare function isUnexpected(response: GetMultivariateBatchDetectionResult200Response | GetMultivariateBatchDetectionResultDefaultResponse): response is GetMultivariateBatchDetectionResultDefaultResponse;
6
+ export declare function isUnexpected(response: TrainMultivariateModel201Response | TrainMultivariateModelDefaultResponse): response is TrainMultivariateModelDefaultResponse;
7
+ export declare function isUnexpected(response: ListMultivariateModels200Response | ListMultivariateModelsDefaultResponse): response is ListMultivariateModelsDefaultResponse;
8
+ export declare function isUnexpected(response: DeleteMultivariateModel204Response | DeleteMultivariateModelDefaultResponse): response is DeleteMultivariateModelDefaultResponse;
9
+ export declare function isUnexpected(response: GetMultivariateModel200Response | GetMultivariateModelDefaultResponse): response is GetMultivariateModelDefaultResponse;
10
+ export declare function isUnexpected(response: DetectMultivariateBatchAnomaly202Response | DetectMultivariateBatchAnomalyDefaultResponse): response is DetectMultivariateBatchAnomalyDefaultResponse;
11
+ export declare function isUnexpected(response: DetectMultivariateLastAnomaly200Response | DetectMultivariateLastAnomalyDefaultResponse): response is DetectMultivariateLastAnomalyDefaultResponse;
12
+ //# sourceMappingURL=isUnexpected.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isUnexpected.d.ts","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uCAAuC,EACvC,2CAA2C,EAC3C,oCAAoC,EACpC,wCAAwC,EACxC,sCAAsC,EACtC,0CAA0C,EAC1C,8CAA8C,EAC9C,kDAAkD,EAClD,iCAAiC,EACjC,qCAAqC,EACrC,iCAAiC,EACjC,qCAAqC,EACrC,kCAAkC,EAClC,sCAAsC,EACtC,+BAA+B,EAC/B,mCAAmC,EACnC,yCAAyC,EACzC,6CAA6C,EAC7C,wCAAwC,EACxC,4CAA4C,EAC7C,MAAM,gBAAgB,CAAC;AAexB,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,uCAAuC,GAAG,2CAA2C,GAC9F,QAAQ,IAAI,2CAA2C,CAAC;AAC3D,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,oCAAoC,GAAG,wCAAwC,GACxF,QAAQ,IAAI,wCAAwC,CAAC;AACxD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,sCAAsC,GAAG,0CAA0C,GAC5F,QAAQ,IAAI,0CAA0C,CAAC;AAC1D,wBAAgB,YAAY,CAC1B,QAAQ,EACJ,8CAA8C,GAC9C,kDAAkD,GACrD,QAAQ,IAAI,kDAAkD,CAAC;AAClE,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,iCAAiC,GAAG,qCAAqC,GAClF,QAAQ,IAAI,qCAAqC,CAAC;AACrD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,iCAAiC,GAAG,qCAAqC,GAClF,QAAQ,IAAI,qCAAqC,CAAC;AACrD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,kCAAkC,GAAG,sCAAsC,GACpF,QAAQ,IAAI,sCAAsC,CAAC;AACtD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,+BAA+B,GAAG,mCAAmC,GAC9E,QAAQ,IAAI,mCAAmC,CAAC;AACnD,wBAAgB,YAAY,CAC1B,QAAQ,EACJ,yCAAyC,GACzC,6CAA6C,GAChD,QAAQ,IAAI,6CAA6C,CAAC;AAC7D,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,wCAAwC,GAAG,4CAA4C,GAChG,QAAQ,IAAI,4CAA4C,CAAC"}