@twin.org/telemetry-service 0.0.1-next.5 → 0.0.1-next.7

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.
@@ -482,7 +482,6 @@ class TelemetryService {
482
482
  /**
483
483
  * Create a new instance of TelemetryService.
484
484
  * @param options The options for the connector.
485
- * @param options.telemetryConnectorType The type of the telemetry connector to use, defaults to "telemetry".
486
485
  */
487
486
  constructor(options) {
488
487
  this._telemetryConnector = telemetryModels.TelemetryConnectorFactory.get(options?.telemetryConnectorType ?? "telemetry");
@@ -480,7 +480,6 @@ class TelemetryService {
480
480
  /**
481
481
  * Create a new instance of TelemetryService.
482
482
  * @param options The options for the connector.
483
- * @param options.telemetryConnectorType The type of the telemetry connector to use, defaults to "telemetry".
484
483
  */
485
484
  constructor(options) {
486
485
  this._telemetryConnector = TelemetryConnectorFactory.get(options?.telemetryConnectorType ?? "telemetry");
@@ -1,3 +1,4 @@
1
1
  export * from "./telemetryRoutes";
2
2
  export * from "./telemetryService";
3
3
  export * from "./restEntryPoints";
4
+ export * from "./models/ITelemetryServiceConstructorOptions";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The options for the telemetry service constructor.
3
+ */
4
+ export interface ITelemetryServiceConstructorOptions {
5
+ /**
6
+ * The type of the telemetry connector to use.
7
+ * @default telemetry
8
+ */
9
+ telemetryConnectorType?: string;
10
+ }
@@ -1,4 +1,5 @@
1
1
  import { type ITelemetryComponent, type ITelemetryMetric, type ITelemetryMetricValue, type MetricType } from "@twin.org/telemetry-models";
2
+ import type { ITelemetryServiceConstructorOptions } from "./models/ITelemetryServiceConstructorOptions";
2
3
  /**
3
4
  * Service for performing telemetry operations to a connector.
4
5
  */
@@ -14,11 +15,8 @@ export declare class TelemetryService implements ITelemetryComponent {
14
15
  /**
15
16
  * Create a new instance of TelemetryService.
16
17
  * @param options The options for the connector.
17
- * @param options.telemetryConnectorType The type of the telemetry connector to use, defaults to "telemetry".
18
18
  */
19
- constructor(options?: {
20
- telemetryConnectorType?: string;
21
- });
19
+ constructor(options?: ITelemetryServiceConstructorOptions);
22
20
  /**
23
21
  * Create a new metric.
24
22
  * @param metric The metric details.
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/telemetry-service - Changelog
2
2
 
3
- ## v0.0.1-next.5
3
+ ## v0.0.1-next.7
4
4
 
5
5
  - Initial Release
@@ -16,13 +16,11 @@ Create a new instance of TelemetryService.
16
16
 
17
17
  #### Parameters
18
18
 
19
- • **options?**
19
+ ##### options?
20
20
 
21
- The options for the connector.
22
-
23
- • **options.telemetryConnectorType?**: `string`
21
+ [`ITelemetryServiceConstructorOptions`](../interfaces/ITelemetryServiceConstructorOptions.md)
24
22
 
25
- The type of the telemetry connector to use, defaults to "telemetry".
23
+ The options for the connector.
26
24
 
27
25
  #### Returns
28
26
 
@@ -58,7 +56,9 @@ Create a new metric.
58
56
 
59
57
  #### Parameters
60
58
 
61
- • **metric**: `ITelemetryMetric`
59
+ ##### metric
60
+
61
+ `ITelemetryMetric`
62
62
 
63
63
  The metric details.
64
64
 
@@ -76,30 +76,24 @@ Nothing.
76
76
 
77
77
  ### getMetric()
78
78
 
79
- > **getMetric**(`id`): `Promise`\<`object`\>
79
+ > **getMetric**(`id`): `Promise`\<\{ `metric`: `ITelemetryMetric`; `value`: `ITelemetryMetricValue`; \}\>
80
80
 
81
81
  Get the metric details and it's most recent value.
82
82
 
83
83
  #### Parameters
84
84
 
85
- • **id**: `string`
85
+ ##### id
86
+
87
+ `string`
86
88
 
87
89
  The metric id.
88
90
 
89
91
  #### Returns
90
92
 
91
- `Promise`\<`object`\>
93
+ `Promise`\<\{ `metric`: `ITelemetryMetric`; `value`: `ITelemetryMetricValue`; \}\>
92
94
 
93
95
  The metric details and it's most recent value.
94
96
 
95
- ##### metric
96
-
97
- > **metric**: `ITelemetryMetric`
98
-
99
- ##### value
100
-
101
- > **value**: `ITelemetryMetricValue`
102
-
103
97
  #### Implementation of
104
98
 
105
99
  `ITelemetryComponent.getMetric`
@@ -114,7 +108,9 @@ Update metric.
114
108
 
115
109
  #### Parameters
116
110
 
117
- • **metric**: `Omit`\<`ITelemetryMetric`, `"type"`\>
111
+ ##### metric
112
+
113
+ `Omit`\<`ITelemetryMetric`, `"type"`\>
118
114
 
119
115
  The metric details.
120
116
 
@@ -138,15 +134,19 @@ Add a metric value.
138
134
 
139
135
  #### Parameters
140
136
 
141
- • **id**: `string`
137
+ ##### id
138
+
139
+ `string`
142
140
 
143
141
  The id of the metric.
144
142
 
145
- • **value**: `number` \| `"inc"` \| `"dec"`
143
+ ##### value
146
144
 
147
145
  The value for the add operation.
148
146
 
149
- • **customData?**
147
+ `number` | `"inc"` | `"dec"`
148
+
149
+ ##### customData?
150
150
 
151
151
  The custom data for the add operation.
152
152
 
@@ -170,7 +170,9 @@ Remove metric.
170
170
 
171
171
  #### Parameters
172
172
 
173
- • **id**: `string`
173
+ ##### id
174
+
175
+ `string`
174
176
 
175
177
  The id of the metric.
176
178
 
@@ -188,43 +190,37 @@ Nothing.
188
190
 
189
191
  ### query()
190
192
 
191
- > **query**(`type`?, `cursor`?, `pageSize`?): `Promise`\<`object`\>
193
+ > **query**(`type`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: `ITelemetryMetric`[]; `cursor`: `string`; \}\>
192
194
 
193
195
  Query the metrics.
194
196
 
195
197
  #### Parameters
196
198
 
197
- • **type?**: `MetricType`
199
+ ##### type?
200
+
201
+ `MetricType`
198
202
 
199
203
  The type of the metric.
200
204
 
201
- • **cursor?**: `string`
205
+ ##### cursor?
206
+
207
+ `string`
202
208
 
203
209
  The cursor to request the next page of entities.
204
210
 
205
- • **pageSize?**: `number`
211
+ ##### pageSize?
212
+
213
+ `number`
206
214
 
207
215
  The maximum number of entities in a page.
208
216
 
209
217
  #### Returns
210
218
 
211
- `Promise`\<`object`\>
219
+ `Promise`\<\{ `entities`: `ITelemetryMetric`[]; `cursor`: `string`; \}\>
212
220
 
213
221
  All the entities for the storage matching the conditions,
214
222
  and a cursor which can be used to request more entities.
215
223
 
216
- ##### entities
217
-
218
- > **entities**: `ITelemetryMetric`[]
219
-
220
- The metrics.
221
-
222
- ##### cursor?
223
-
224
- > `optional` **cursor**: `string`
225
-
226
- An optional cursor, when defined can be used to call find to get more values.
227
-
228
224
  #### Throws
229
225
 
230
226
  NotImplementedError if the implementation does not support retrieval.
@@ -237,57 +233,49 @@ NotImplementedError if the implementation does not support retrieval.
237
233
 
238
234
  ### queryValues()
239
235
 
240
- > **queryValues**(`id`, `timeStart`?, `timeEnd`?, `cursor`?, `pageSize`?): `Promise`\<`object`\>
236
+ > **queryValues**(`id`, `timeStart`?, `timeEnd`?, `cursor`?, `pageSize`?): `Promise`\<\{ `metric`: `ITelemetryMetric`; `entities`: `ITelemetryMetricValue`[]; `cursor`: `string`; \}\>
241
237
 
242
238
  Query the metric values.
243
239
 
244
240
  #### Parameters
245
241
 
246
- • **id**: `string`
242
+ ##### id
243
+
244
+ `string`
247
245
 
248
246
  The id of the metric.
249
247
 
250
- • **timeStart?**: `number`
248
+ ##### timeStart?
249
+
250
+ `number`
251
251
 
252
252
  The inclusive time as the start of the metric entries.
253
253
 
254
- • **timeEnd?**: `number`
254
+ ##### timeEnd?
255
+
256
+ `number`
255
257
 
256
258
  The inclusive time as the end of the metric entries.
257
259
 
258
- • **cursor?**: `string`
260
+ ##### cursor?
261
+
262
+ `string`
259
263
 
260
264
  The cursor to request the next page of entities.
261
265
 
262
- • **pageSize?**: `number`
266
+ ##### pageSize?
267
+
268
+ `number`
263
269
 
264
270
  The maximum number of entities in a page.
265
271
 
266
272
  #### Returns
267
273
 
268
- `Promise`\<`object`\>
274
+ `Promise`\<\{ `metric`: `ITelemetryMetric`; `entities`: `ITelemetryMetricValue`[]; `cursor`: `string`; \}\>
269
275
 
270
276
  All the entities for the storage matching the conditions,
271
277
  and a cursor which can be used to request more entities.
272
278
 
273
- ##### metric
274
-
275
- > **metric**: `ITelemetryMetric`
276
-
277
- The metric details.
278
-
279
- ##### entities
280
-
281
- > **entities**: `ITelemetryMetricValue`[]
282
-
283
- The values for the metric.
284
-
285
- ##### cursor?
286
-
287
- > `optional` **cursor**: `string`
288
-
289
- An optional cursor, when defined can be used to call find to get more values.
290
-
291
279
  #### Throws
292
280
 
293
281
  NotImplementedError if the implementation does not support retrieval.
@@ -6,11 +6,15 @@ The REST routes for telemetry.
6
6
 
7
7
  ## Parameters
8
8
 
9
- • **baseRouteName**: `string`
9
+ ### baseRouteName
10
+
11
+ `string`
10
12
 
11
13
  Prefix to prepend to the paths.
12
14
 
13
- • **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes stored in the ComponentFactory.
16
20
 
@@ -6,15 +6,21 @@ Add a telemetry metric value.
6
6
 
7
7
  ## Parameters
8
8
 
9
- • **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- • **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- • **request**: `ITelemetryAddMetricValueRequest`
21
+ ### request
22
+
23
+ `ITelemetryAddMetricValueRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -6,15 +6,21 @@ Create a new telemetry metric.
6
6
 
7
7
  ## Parameters
8
8
 
9
- • **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- • **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- • **request**: `ITelemetryCreateMetricRequest`
21
+ ### request
22
+
23
+ `ITelemetryCreateMetricRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -6,15 +6,21 @@ Gets a telemetry metric.
6
6
 
7
7
  ## Parameters
8
8
 
9
- • **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- • **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- • **request**: `ITelemetryGetMetricRequest`
21
+ ### request
22
+
23
+ `ITelemetryGetMetricRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -6,15 +6,21 @@ Get a list of the telemetry metrics.
6
6
 
7
7
  ## Parameters
8
8
 
9
- • **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- • **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- • **request**: `ITelemetryListRequest`
21
+ ### request
22
+
23
+ `ITelemetryListRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -6,15 +6,21 @@ Get a list of the telemetry metric values.
6
6
 
7
7
  ## Parameters
8
8
 
9
- • **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- • **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- • **request**: `ITelemetryValuesListRequest`
21
+ ### request
22
+
23
+ `ITelemetryValuesListRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -6,15 +6,21 @@ Removes a telemetry metric.
6
6
 
7
7
  ## Parameters
8
8
 
9
- • **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- • **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- • **request**: `ITelemetryRemoveMetricRequest`
21
+ ### request
22
+
23
+ `ITelemetryRemoveMetricRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -6,15 +6,21 @@ Updates a telemetry metric.
6
6
 
7
7
  ## Parameters
8
8
 
9
- • **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- • **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- • **request**: `ITelemetryUpdateMetricRequest`
21
+ ### request
22
+
23
+ `ITelemetryUpdateMetricRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -4,6 +4,10 @@
4
4
 
5
5
  - [TelemetryService](classes/TelemetryService.md)
6
6
 
7
+ ## Interfaces
8
+
9
+ - [ITelemetryServiceConstructorOptions](interfaces/ITelemetryServiceConstructorOptions.md)
10
+
7
11
  ## Variables
8
12
 
9
13
  - [restEntryPoints](variables/restEntryPoints.md)
@@ -0,0 +1,17 @@
1
+ # Interface: ITelemetryServiceConstructorOptions
2
+
3
+ The options for the telemetry service constructor.
4
+
5
+ ## Properties
6
+
7
+ ### telemetryConnectorType?
8
+
9
+ > `optional` **telemetryConnectorType**: `string`
10
+
11
+ The type of the telemetry connector to use.
12
+
13
+ #### Default
14
+
15
+ ```ts
16
+ telemetry
17
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/telemetry-service",
3
- "version": "0.0.1-next.5",
3
+ "version": "0.0.1-next.7",
4
4
  "description": "Telemetry contract implementation and REST endpoint definitions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  "@twin.org/core": "next",
19
19
  "@twin.org/entity": "next",
20
20
  "@twin.org/nameof": "next",
21
- "@twin.org/telemetry-models": "0.0.1-next.5",
21
+ "@twin.org/telemetry-models": "0.0.1-next.7",
22
22
  "@twin.org/web": "next"
23
23
  },
24
24
  "main": "./dist/cjs/index.cjs",
@@ -30,7 +30,7 @@
30
30
  "import": "./dist/esm/index.mjs",
31
31
  "types": "./dist/types/index.d.ts"
32
32
  },
33
- "./locales": "./locales"
33
+ "./locales/*.json": "./locales/*.json"
34
34
  },
35
35
  "files": [
36
36
  "dist/cjs",