@c8y/client 1021.13.3 → 1021.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/src/core/Paging.d.ts +4 -0
- package/lib/cjs/src/core/Paging.d.ts.map +1 -1
- package/lib/cjs/src/core/Paging.js +1 -0
- package/lib/cjs/src/core/Paging.js.map +1 -1
- package/lib/cjs/src/measurement/IMeasurementFilter.d.ts +57 -0
- package/lib/cjs/src/measurement/IMeasurementFilter.d.ts.map +1 -0
- package/lib/cjs/src/measurement/IMeasurementFilter.js +3 -0
- package/lib/cjs/src/measurement/IMeasurementFilter.js.map +1 -0
- package/lib/cjs/src/measurement/ISeriesFilter.d.ts +8 -0
- package/lib/cjs/src/measurement/ISeriesFilter.d.ts.map +1 -1
- package/lib/cjs/src/measurement/MeasurementService.d.ts +37 -2
- package/lib/cjs/src/measurement/MeasurementService.d.ts.map +1 -1
- package/lib/cjs/src/measurement/MeasurementService.js +35 -0
- package/lib/cjs/src/measurement/MeasurementService.js.map +1 -1
- package/lib/cjs/src/measurement/index.d.ts +1 -0
- package/lib/cjs/src/measurement/index.d.ts.map +1 -1
- package/lib/cjs/src/measurement/index.js +1 -0
- package/lib/cjs/src/measurement/index.js.map +1 -1
- package/lib/esm2015/src/core/Paging.d.ts +4 -0
- package/lib/esm2015/src/core/Paging.d.ts.map +1 -1
- package/lib/esm2015/src/core/Paging.js +1 -0
- package/lib/esm2015/src/core/Paging.js.map +1 -1
- package/lib/esm2015/src/measurement/IMeasurementFilter.d.ts +57 -0
- package/lib/esm2015/src/measurement/IMeasurementFilter.d.ts.map +1 -0
- package/lib/esm2015/src/measurement/IMeasurementFilter.js +2 -0
- package/lib/esm2015/src/measurement/IMeasurementFilter.js.map +1 -0
- package/lib/esm2015/src/measurement/ISeriesFilter.d.ts +8 -0
- package/lib/esm2015/src/measurement/ISeriesFilter.d.ts.map +1 -1
- package/lib/esm2015/src/measurement/MeasurementService.d.ts +37 -2
- package/lib/esm2015/src/measurement/MeasurementService.d.ts.map +1 -1
- package/lib/esm2015/src/measurement/MeasurementService.js +37 -0
- package/lib/esm2015/src/measurement/MeasurementService.js.map +1 -1
- package/lib/esm2015/src/measurement/index.d.ts +1 -0
- package/lib/esm2015/src/measurement/index.d.ts.map +1 -1
- package/lib/esm2015/src/measurement/index.js +1 -0
- package/lib/esm2015/src/measurement/index.js.map +1 -1
- package/lib/src/core/Paging.d.ts +4 -0
- package/lib/src/core/Paging.d.ts.map +1 -1
- package/lib/src/measurement/IMeasurementFilter.d.ts +57 -0
- package/lib/src/measurement/IMeasurementFilter.d.ts.map +1 -0
- package/lib/src/measurement/ISeriesFilter.d.ts +8 -0
- package/lib/src/measurement/ISeriesFilter.d.ts.map +1 -1
- package/lib/src/measurement/MeasurementService.d.ts +37 -2
- package/lib/src/measurement/MeasurementService.d.ts.map +1 -1
- package/lib/src/measurement/index.d.ts +1 -0
- package/lib/src/measurement/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -32,6 +32,10 @@ export declare class Paging<TData> {
|
|
|
32
32
|
* given page size.
|
|
33
33
|
*/
|
|
34
34
|
totalPages: number;
|
|
35
|
+
/**
|
|
36
|
+
* Holds the number of total elements for the given request.
|
|
37
|
+
*/
|
|
38
|
+
totalElements: number;
|
|
35
39
|
private service;
|
|
36
40
|
private filter;
|
|
37
41
|
constructor(service: Service<TData>, statistics: any, filter: object);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paging.d.ts","sourceRoot":"","sources":["../../../../src/core/Paging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;GAOG;AACH,qBAAa,MAAM,CAAC,KAAK;IACvB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Paging.d.ts","sourceRoot":"","sources":["../../../../src/core/Paging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;GAOG;AACH,qBAAa,MAAM,CAAC,KAAK;IACvB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,MAAM,CAAS;gBAEX,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM;IAWpE;;;OAGG;IACG,IAAI,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI5D;;;OAGG;IACG,IAAI,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI5D;;;;;OAKG;IACG,IAAI,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI5D;;;;OAIG;IACG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI1E,OAAO,CAAC,SAAS;CAGlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paging.js","sourceRoot":"","sources":["../../../../src/core/Paging.ts"],"names":[],"mappings":";;;AAGA;;;;;;;GAOG;AACH,MAAa,MAAM;
|
|
1
|
+
{"version":3,"file":"Paging.js","sourceRoot":"","sources":["../../../../src/core/Paging.ts"],"names":[],"mappings":";;;AAGA;;;;;;;GAOG;AACH,MAAa,MAAM;IAgCjB,YAAY,OAAuB,EAAE,UAAe,EAAE,MAAc;QAClE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;IAChD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,SAAiB,EAAE;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,SAAiB,EAAE;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,SAAiB,EAAE;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,SAAiB,EAAE;QAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IACjD,CAAC;IAEO,SAAS,CAAC,MAAc,EAAE,IAAY;QAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;CACF;AAjFD,wBAiFC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This interface specifies all fragments which can be used
|
|
3
|
+
* to filter for specific measurement.
|
|
4
|
+
*/
|
|
5
|
+
export interface IMeasurementFilter {
|
|
6
|
+
/**
|
|
7
|
+
* The current page of the paginated results.
|
|
8
|
+
*/
|
|
9
|
+
currentPage?: number;
|
|
10
|
+
/**
|
|
11
|
+
* The managed object ID which the measurement is associated to.
|
|
12
|
+
*/
|
|
13
|
+
source?: number | string;
|
|
14
|
+
/**
|
|
15
|
+
* From which date the measurements should be gathered
|
|
16
|
+
*/
|
|
17
|
+
dateFrom?: string | Date;
|
|
18
|
+
/**
|
|
19
|
+
* To which date the measurements should be gathered
|
|
20
|
+
*/
|
|
21
|
+
dateTo?: string | Date;
|
|
22
|
+
/**
|
|
23
|
+
* Indicates how many entries of the collection shall be returned.
|
|
24
|
+
* The upper limit for one page is 2000 objects.
|
|
25
|
+
*/
|
|
26
|
+
pageSize?: number;
|
|
27
|
+
/**
|
|
28
|
+
* If you are using a range query (that is, at least one of the dateFrom or dateTo parameters is included in the request),
|
|
29
|
+
* then setting revert=true will sort the results by the newest measurements first.
|
|
30
|
+
* By default, the results are sorted by the oldest measurements first.
|
|
31
|
+
*/
|
|
32
|
+
revert?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The type of measurement to search for.
|
|
35
|
+
*/
|
|
36
|
+
type?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The specific series to search for.
|
|
39
|
+
*/
|
|
40
|
+
valueFragmentSeries?: string;
|
|
41
|
+
/**
|
|
42
|
+
* When set to true, the returned result will contain in the statistics object the total number of elements.
|
|
43
|
+
* Only applicable to range queries.
|
|
44
|
+
*/
|
|
45
|
+
valueFragmentType?: string;
|
|
46
|
+
/**
|
|
47
|
+
* When set to true, the returned result will contain in the statistics object the total number of pages.
|
|
48
|
+
* Only applicable to range queries.
|
|
49
|
+
*/
|
|
50
|
+
withTotalPages?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* When set to true, the returned result will contain in the statistics object the total number of elements.
|
|
53
|
+
* Only applicable to range queries.
|
|
54
|
+
*/
|
|
55
|
+
withTotalElements?: boolean;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=IMeasurementFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMeasurementFilter.d.ts","sourceRoot":"","sources":["../../../../src/measurement/IMeasurementFilter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMeasurementFilter.js","sourceRoot":"","sources":["../../../../src/measurement/IMeasurementFilter.ts"],"names":[],"mappings":""}
|
|
@@ -34,5 +34,13 @@ export interface ISeriesFilter {
|
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
series?: string | string[];
|
|
37
|
+
/**
|
|
38
|
+
* If you are using a range query (that is, at least one of the dateFrom or dateTo parameters is included in the request),
|
|
39
|
+
* then setting revert=true will sort the results by the newest measurements first.
|
|
40
|
+
* By default, the results are sorted by the oldest measurements first.
|
|
41
|
+
*
|
|
42
|
+
* Note: it will not sort a measurements by a date, but by the order of the measurements in the response.
|
|
43
|
+
*/
|
|
44
|
+
revert?: boolean;
|
|
37
45
|
}
|
|
38
46
|
//# sourceMappingURL=ISeriesFilter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ISeriesFilter.d.ts","sourceRoot":"","sources":["../../../../src/measurement/ISeriesFilter.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ISeriesFilter.d.ts","sourceRoot":"","sources":["../../../../src/measurement/ISeriesFilter.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IFetchResponse, IIdentified, IResult, Service } from '../core';
|
|
2
2
|
import { IMeasurement, IMeasurementCreate } from './IMeasurement';
|
|
3
|
-
import {
|
|
3
|
+
import { IMeasurementFilter } from './IMeasurementFilter';
|
|
4
4
|
import { ISeries } from './ISeries';
|
|
5
|
+
import { ISeriesFilter } from './ISeriesFilter';
|
|
5
6
|
/**
|
|
6
7
|
* This class allows for managing measurements.
|
|
7
8
|
*/
|
|
@@ -116,6 +117,40 @@ export declare class MeasurementService extends Service<IMeasurement> {
|
|
|
116
117
|
* ```
|
|
117
118
|
*/
|
|
118
119
|
listSeries(params: ISeriesFilter): Promise<IResult<ISeries>>;
|
|
120
|
+
/**
|
|
121
|
+
* Retrieves the measurement file based on the provided filter parameters and headers, but only if the response is 200.
|
|
122
|
+
* If the response is 202, the file is processed in the background and the file is sent by email.
|
|
123
|
+
*
|
|
124
|
+
* **Example**
|
|
125
|
+
* ```typescript
|
|
126
|
+
*
|
|
127
|
+
* const filter: IFetchResponse = {
|
|
128
|
+
* dateFrom: "2024-08-11T12:13:00+02:00"
|
|
129
|
+
* dateTo: "2024-08-12T12:15:00+02:00"
|
|
130
|
+
* source: "32666427"
|
|
131
|
+
* valueFragmentSeries: "accelerationX"
|
|
132
|
+
* valueFragmentType: "c8y_Acceleration"
|
|
133
|
+
* };
|
|
134
|
+
*
|
|
135
|
+
* const headers = {
|
|
136
|
+
* accept: 'text/csv'
|
|
137
|
+
* }
|
|
138
|
+
*
|
|
139
|
+
* (async () => {
|
|
140
|
+
* const response = await measurementService.getMeasurementsFile(filter, headers);
|
|
141
|
+
* if (response.status === 200) {
|
|
142
|
+
* const blob = await response.blob();
|
|
143
|
+
* }
|
|
144
|
+
* })();
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @param filter Object containing filters for querying measurements.
|
|
148
|
+
* @param headers The headers for the request.
|
|
149
|
+
* @returns A promise that resolves to the fetch response.
|
|
150
|
+
*/
|
|
151
|
+
getMeasurementsFile(params: IMeasurementFilter, headers: {
|
|
152
|
+
accept: string;
|
|
153
|
+
}): Promise<IFetchResponse>;
|
|
119
154
|
protected onBeforeCreate(entity: Partial<IMeasurementCreate>): Partial<IMeasurementCreate>;
|
|
120
155
|
}
|
|
121
156
|
//# sourceMappingURL=MeasurementService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeasurementService.d.ts","sourceRoot":"","sources":["../../../../src/measurement/MeasurementService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"MeasurementService.d.ts","sourceRoot":"","sources":["../../../../src/measurement/MeasurementService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,OAAO,CAAC,YAAY,CAAC;IAC3D,SAAS,CAAC,OAAO,SAAiB;IAClC,SAAS,CAAC,OAAO,SAAkB;IACnC,SAAS,CAAC,YAAY,SAAkB;IACxC,SAAS,CAAC,OAAO,SAAqB;IAEtC;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW;IAItD;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAIhD;;;;;;;;;;;;;;;;;;;OAmBG;IACG,IAAI,CAAC,MAAM,GAAE,MAAW;IAI9B;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW;IAItD;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAOlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACG,mBAAmB,CACvB,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAC1B,OAAO,CAAC,cAAc,CAAC;IAK1B,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC;CAkB7D"}
|
|
@@ -132,6 +132,41 @@ class MeasurementService extends core_1.Service {
|
|
|
132
132
|
const data = await res.json();
|
|
133
133
|
return { res, data };
|
|
134
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Retrieves the measurement file based on the provided filter parameters and headers, but only if the response is 200.
|
|
137
|
+
* If the response is 202, the file is processed in the background and the file is sent by email.
|
|
138
|
+
*
|
|
139
|
+
* **Example**
|
|
140
|
+
* ```typescript
|
|
141
|
+
*
|
|
142
|
+
* const filter: IFetchResponse = {
|
|
143
|
+
* dateFrom: "2024-08-11T12:13:00+02:00"
|
|
144
|
+
* dateTo: "2024-08-12T12:15:00+02:00"
|
|
145
|
+
* source: "32666427"
|
|
146
|
+
* valueFragmentSeries: "accelerationX"
|
|
147
|
+
* valueFragmentType: "c8y_Acceleration"
|
|
148
|
+
* };
|
|
149
|
+
*
|
|
150
|
+
* const headers = {
|
|
151
|
+
* accept: 'text/csv'
|
|
152
|
+
* }
|
|
153
|
+
*
|
|
154
|
+
* (async () => {
|
|
155
|
+
* const response = await measurementService.getMeasurementsFile(filter, headers);
|
|
156
|
+
* if (response.status === 200) {
|
|
157
|
+
* const blob = await response.blob();
|
|
158
|
+
* }
|
|
159
|
+
* })();
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* @param filter Object containing filters for querying measurements.
|
|
163
|
+
* @param headers The headers for the request.
|
|
164
|
+
* @returns A promise that resolves to the fetch response.
|
|
165
|
+
*/
|
|
166
|
+
async getMeasurementsFile(params, headers) {
|
|
167
|
+
const url = `${this.baseUrl}/${this.listUrl}/`;
|
|
168
|
+
return await this.client.fetch(url, { params, headers });
|
|
169
|
+
}
|
|
135
170
|
onBeforeCreate(entity) {
|
|
136
171
|
if (!entity.time) {
|
|
137
172
|
entity.time = new Date().toISOString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeasurementService.js","sourceRoot":"","sources":["../../../../src/measurement/MeasurementService.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"MeasurementService.js","sourceRoot":"","sources":["../../../../src/measurement/MeasurementService.ts"],"names":[],"mappings":";;;AAAA,kCAAwE;AAMxE;;GAEG;AACH,MAAa,kBAAmB,SAAQ,cAAqB;IAA7D;;QACY,YAAO,GAAG,aAAa,CAAC;QACxB,YAAO,GAAG,cAAc,CAAC;QACzB,iBAAY,GAAG,cAAc,CAAC;QAC9B,YAAO,GAAG,iBAAiB,CAAC;IAuLxC,CAAC;IArLC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,MAAM,CAAC,UAAyC;QACpD,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,MAAM,CAAC,MAAmC;QAC9C,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,IAAI,CAAC,SAAiB,EAAE;QAC5B,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,MAAM,CAAC,UAAyC;QACpD,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,UAAU,CAAC,MAAqB;QACpC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,SAAS,CAAC;QACrD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACrD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC9B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,KAAK,CAAC,mBAAmB,CACvB,MAA0B,EAC1B,OAA2B;QAE3B,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC;QAC/C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAC3D,CAAC;IAES,cAAc,CAAC,MAAmC;QAC1D,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAClC,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;YAC5B,OAAO,MAAM,CAAC,QAAQ,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBACnB,MAAM,CAAC,MAAM,GAAG;oBACd,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC;iBACrB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA3LD,gDA2LC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/measurement/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/measurement/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./MeasurementService"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./IMeasurement"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./IMeasurementFilter"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./ISeries"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./ISeriesFilter"), exports);
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/measurement/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,yDAA+B;AAC/B,oDAA0B;AAC1B,0DAAgC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/measurement/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,yDAA+B;AAC/B,+DAAqC;AACrC,oDAA0B;AAC1B,0DAAgC"}
|
|
@@ -32,6 +32,10 @@ export declare class Paging<TData> {
|
|
|
32
32
|
* given page size.
|
|
33
33
|
*/
|
|
34
34
|
totalPages: number;
|
|
35
|
+
/**
|
|
36
|
+
* Holds the number of total elements for the given request.
|
|
37
|
+
*/
|
|
38
|
+
totalElements: number;
|
|
35
39
|
private service;
|
|
36
40
|
private filter;
|
|
37
41
|
constructor(service: Service<TData>, statistics: any, filter: object);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paging.d.ts","sourceRoot":"","sources":["../../../../src/core/Paging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;GAOG;AACH,qBAAa,MAAM,CAAC,KAAK;IACvB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Paging.d.ts","sourceRoot":"","sources":["../../../../src/core/Paging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;GAOG;AACH,qBAAa,MAAM,CAAC,KAAK;IACvB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,MAAM,CAAS;gBAEX,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM;IAWpE;;;OAGG;IACG,IAAI,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI5D;;;OAGG;IACG,IAAI,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI5D;;;;;OAKG;IACG,IAAI,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI5D;;;;OAIG;IACG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI1E,OAAO,CAAC,SAAS;CAGlB"}
|
|
@@ -16,6 +16,7 @@ export class Paging {
|
|
|
16
16
|
this.prevPage = statistics.prevPage;
|
|
17
17
|
this.pageSize = statistics.pageSize;
|
|
18
18
|
this.totalPages = statistics.totalPages;
|
|
19
|
+
this.totalElements = statistics.totalElements;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Gets the next page of available data from the server.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paging.js","sourceRoot":"","sources":["../../../../src/core/Paging.ts"],"names":[],"mappings":";AAGA;;;;;;;GAOG;AACH,MAAM,OAAO,MAAM;
|
|
1
|
+
{"version":3,"file":"Paging.js","sourceRoot":"","sources":["../../../../src/core/Paging.ts"],"names":[],"mappings":";AAGA;;;;;;;GAOG;AACH,MAAM,OAAO,MAAM;IAgCjB,YAAY,OAAuB,EAAE,UAAe,EAAE,MAAc;QAClE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;IAChD,CAAC;IAED;;;OAGG;IACG,IAAI;6DAAC,SAAiB,EAAE;YAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1D,CAAC;KAAA;IAED;;;OAGG;IACG,IAAI;6DAAC,SAAiB,EAAE;YAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1D,CAAC;KAAA;IAED;;;;;OAKG;IACG,IAAI;6DAAC,SAAiB,EAAE;YAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;KAAA;IAED;;;;OAIG;IACG,IAAI;6DAAC,IAAY,EAAE,SAAiB,EAAE;YAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QACjD,CAAC;KAAA;IAEO,SAAS,CAAC,MAAc,EAAE,IAAY;QAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;CACF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This interface specifies all fragments which can be used
|
|
3
|
+
* to filter for specific measurement.
|
|
4
|
+
*/
|
|
5
|
+
export interface IMeasurementFilter {
|
|
6
|
+
/**
|
|
7
|
+
* The current page of the paginated results.
|
|
8
|
+
*/
|
|
9
|
+
currentPage?: number;
|
|
10
|
+
/**
|
|
11
|
+
* The managed object ID which the measurement is associated to.
|
|
12
|
+
*/
|
|
13
|
+
source?: number | string;
|
|
14
|
+
/**
|
|
15
|
+
* From which date the measurements should be gathered
|
|
16
|
+
*/
|
|
17
|
+
dateFrom?: string | Date;
|
|
18
|
+
/**
|
|
19
|
+
* To which date the measurements should be gathered
|
|
20
|
+
*/
|
|
21
|
+
dateTo?: string | Date;
|
|
22
|
+
/**
|
|
23
|
+
* Indicates how many entries of the collection shall be returned.
|
|
24
|
+
* The upper limit for one page is 2000 objects.
|
|
25
|
+
*/
|
|
26
|
+
pageSize?: number;
|
|
27
|
+
/**
|
|
28
|
+
* If you are using a range query (that is, at least one of the dateFrom or dateTo parameters is included in the request),
|
|
29
|
+
* then setting revert=true will sort the results by the newest measurements first.
|
|
30
|
+
* By default, the results are sorted by the oldest measurements first.
|
|
31
|
+
*/
|
|
32
|
+
revert?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The type of measurement to search for.
|
|
35
|
+
*/
|
|
36
|
+
type?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The specific series to search for.
|
|
39
|
+
*/
|
|
40
|
+
valueFragmentSeries?: string;
|
|
41
|
+
/**
|
|
42
|
+
* When set to true, the returned result will contain in the statistics object the total number of elements.
|
|
43
|
+
* Only applicable to range queries.
|
|
44
|
+
*/
|
|
45
|
+
valueFragmentType?: string;
|
|
46
|
+
/**
|
|
47
|
+
* When set to true, the returned result will contain in the statistics object the total number of pages.
|
|
48
|
+
* Only applicable to range queries.
|
|
49
|
+
*/
|
|
50
|
+
withTotalPages?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* When set to true, the returned result will contain in the statistics object the total number of elements.
|
|
53
|
+
* Only applicable to range queries.
|
|
54
|
+
*/
|
|
55
|
+
withTotalElements?: boolean;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=IMeasurementFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMeasurementFilter.d.ts","sourceRoot":"","sources":["../../../../src/measurement/IMeasurementFilter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMeasurementFilter.js","sourceRoot":"","sources":["../../../../src/measurement/IMeasurementFilter.ts"],"names":[],"mappings":""}
|
|
@@ -34,5 +34,13 @@ export interface ISeriesFilter {
|
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
series?: string | string[];
|
|
37
|
+
/**
|
|
38
|
+
* If you are using a range query (that is, at least one of the dateFrom or dateTo parameters is included in the request),
|
|
39
|
+
* then setting revert=true will sort the results by the newest measurements first.
|
|
40
|
+
* By default, the results are sorted by the oldest measurements first.
|
|
41
|
+
*
|
|
42
|
+
* Note: it will not sort a measurements by a date, but by the order of the measurements in the response.
|
|
43
|
+
*/
|
|
44
|
+
revert?: boolean;
|
|
37
45
|
}
|
|
38
46
|
//# sourceMappingURL=ISeriesFilter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ISeriesFilter.d.ts","sourceRoot":"","sources":["../../../../src/measurement/ISeriesFilter.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ISeriesFilter.d.ts","sourceRoot":"","sources":["../../../../src/measurement/ISeriesFilter.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IFetchResponse, IIdentified, IResult, Service } from '../core';
|
|
2
2
|
import { IMeasurement, IMeasurementCreate } from './IMeasurement';
|
|
3
|
-
import {
|
|
3
|
+
import { IMeasurementFilter } from './IMeasurementFilter';
|
|
4
4
|
import { ISeries } from './ISeries';
|
|
5
|
+
import { ISeriesFilter } from './ISeriesFilter';
|
|
5
6
|
/**
|
|
6
7
|
* This class allows for managing measurements.
|
|
7
8
|
*/
|
|
@@ -116,6 +117,40 @@ export declare class MeasurementService extends Service<IMeasurement> {
|
|
|
116
117
|
* ```
|
|
117
118
|
*/
|
|
118
119
|
listSeries(params: ISeriesFilter): Promise<IResult<ISeries>>;
|
|
120
|
+
/**
|
|
121
|
+
* Retrieves the measurement file based on the provided filter parameters and headers, but only if the response is 200.
|
|
122
|
+
* If the response is 202, the file is processed in the background and the file is sent by email.
|
|
123
|
+
*
|
|
124
|
+
* **Example**
|
|
125
|
+
* ```typescript
|
|
126
|
+
*
|
|
127
|
+
* const filter: IFetchResponse = {
|
|
128
|
+
* dateFrom: "2024-08-11T12:13:00+02:00"
|
|
129
|
+
* dateTo: "2024-08-12T12:15:00+02:00"
|
|
130
|
+
* source: "32666427"
|
|
131
|
+
* valueFragmentSeries: "accelerationX"
|
|
132
|
+
* valueFragmentType: "c8y_Acceleration"
|
|
133
|
+
* };
|
|
134
|
+
*
|
|
135
|
+
* const headers = {
|
|
136
|
+
* accept: 'text/csv'
|
|
137
|
+
* }
|
|
138
|
+
*
|
|
139
|
+
* (async () => {
|
|
140
|
+
* const response = await measurementService.getMeasurementsFile(filter, headers);
|
|
141
|
+
* if (response.status === 200) {
|
|
142
|
+
* const blob = await response.blob();
|
|
143
|
+
* }
|
|
144
|
+
* })();
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @param filter Object containing filters for querying measurements.
|
|
148
|
+
* @param headers The headers for the request.
|
|
149
|
+
* @returns A promise that resolves to the fetch response.
|
|
150
|
+
*/
|
|
151
|
+
getMeasurementsFile(params: IMeasurementFilter, headers: {
|
|
152
|
+
accept: string;
|
|
153
|
+
}): Promise<IFetchResponse>;
|
|
119
154
|
protected onBeforeCreate(entity: Partial<IMeasurementCreate>): Partial<IMeasurementCreate>;
|
|
120
155
|
}
|
|
121
156
|
//# sourceMappingURL=MeasurementService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeasurementService.d.ts","sourceRoot":"","sources":["../../../../src/measurement/MeasurementService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"MeasurementService.d.ts","sourceRoot":"","sources":["../../../../src/measurement/MeasurementService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,OAAO,CAAC,YAAY,CAAC;IAC3D,SAAS,CAAC,OAAO,SAAiB;IAClC,SAAS,CAAC,OAAO,SAAkB;IACnC,SAAS,CAAC,YAAY,SAAkB;IACxC,SAAS,CAAC,OAAO,SAAqB;IAEtC;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW;IAItD;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAIhD;;;;;;;;;;;;;;;;;;;OAmBG;IACG,IAAI,CAAC,MAAM,GAAE,MAAW;IAI9B;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW;IAItD;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAOlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACG,mBAAmB,CACvB,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAC1B,OAAO,CAAC,cAAc,CAAC;IAK1B,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC;CAkB7D"}
|
|
@@ -152,6 +152,43 @@ export class MeasurementService extends Service {
|
|
|
152
152
|
return { res, data };
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Retrieves the measurement file based on the provided filter parameters and headers, but only if the response is 200.
|
|
157
|
+
* If the response is 202, the file is processed in the background and the file is sent by email.
|
|
158
|
+
*
|
|
159
|
+
* **Example**
|
|
160
|
+
* ```typescript
|
|
161
|
+
*
|
|
162
|
+
* const filter: IFetchResponse = {
|
|
163
|
+
* dateFrom: "2024-08-11T12:13:00+02:00"
|
|
164
|
+
* dateTo: "2024-08-12T12:15:00+02:00"
|
|
165
|
+
* source: "32666427"
|
|
166
|
+
* valueFragmentSeries: "accelerationX"
|
|
167
|
+
* valueFragmentType: "c8y_Acceleration"
|
|
168
|
+
* };
|
|
169
|
+
*
|
|
170
|
+
* const headers = {
|
|
171
|
+
* accept: 'text/csv'
|
|
172
|
+
* }
|
|
173
|
+
*
|
|
174
|
+
* (async () => {
|
|
175
|
+
* const response = await measurementService.getMeasurementsFile(filter, headers);
|
|
176
|
+
* if (response.status === 200) {
|
|
177
|
+
* const blob = await response.blob();
|
|
178
|
+
* }
|
|
179
|
+
* })();
|
|
180
|
+
* ```
|
|
181
|
+
*
|
|
182
|
+
* @param filter Object containing filters for querying measurements.
|
|
183
|
+
* @param headers The headers for the request.
|
|
184
|
+
* @returns A promise that resolves to the fetch response.
|
|
185
|
+
*/
|
|
186
|
+
getMeasurementsFile(params, headers) {
|
|
187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
+
const url = `${this.baseUrl}/${this.listUrl}/`;
|
|
189
|
+
return yield this.client.fetch(url, { params, headers });
|
|
190
|
+
});
|
|
191
|
+
}
|
|
155
192
|
onBeforeCreate(entity) {
|
|
156
193
|
if (!entity.time) {
|
|
157
194
|
entity.time = new Date().toISOString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeasurementService.js","sourceRoot":"","sources":["../../../../src/measurement/MeasurementService.ts"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MeasurementService.js","sourceRoot":"","sources":["../../../../src/measurement/MeasurementService.ts"],"names":[],"mappings":";AAAA,OAAO,EAAwC,OAAO,EAAE,MAAM,SAAS,CAAC;AAMxE;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,OAAqB;IAA7D;;QACY,YAAO,GAAG,aAAa,CAAC;QACxB,YAAO,GAAG,cAAc,CAAC;QACzB,iBAAY,GAAG,cAAc,CAAC;QAC9B,YAAO,GAAG,iBAAiB,CAAC;IAuLxC,CAAC;IArLC;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,UAAyC;;;;;YACpD,OAAO,OAAM,MAAM,YAAC,UAAU,EAAE;QAClC,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,MAAmC;;;;;YAC9C,OAAO,OAAM,MAAM,YAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;QACnD,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACG,IAAI;;;;6DAAC,SAAiB,EAAE;YAC5B,OAAO,OAAM,IAAI,YAAC,MAAM,EAAE;QAC5B,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,UAAyC;;;;;YACpD,OAAO,OAAM,MAAM,YAAC,UAAU,EAAE;QAClC,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,UAAU,CAAC,MAAqB;;YACpC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,SAAS,CAAC;YACrD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;YACrD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;QACvB,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACG,mBAAmB,CACvB,MAA0B,EAC1B,OAA2B;;YAE3B,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC;YAC/C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;QAC3D,CAAC;KAAA;IAES,cAAc,CAAC,MAAmC;QAC1D,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAClC,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;YAC5B,OAAO,MAAM,CAAC,QAAQ,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBACnB,MAAM,CAAC,MAAM,GAAG;oBACd,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC;iBACrB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/measurement/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/measurement/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/measurement/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/measurement/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
package/lib/src/core/Paging.d.ts
CHANGED
|
@@ -32,6 +32,10 @@ export declare class Paging<TData> {
|
|
|
32
32
|
* given page size.
|
|
33
33
|
*/
|
|
34
34
|
totalPages: number;
|
|
35
|
+
/**
|
|
36
|
+
* Holds the number of total elements for the given request.
|
|
37
|
+
*/
|
|
38
|
+
totalElements: number;
|
|
35
39
|
private service;
|
|
36
40
|
private filter;
|
|
37
41
|
constructor(service: Service<TData>, statistics: any, filter: object);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paging.d.ts","sourceRoot":"","sources":["../../../src/core/Paging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;GAOG;AACH,qBAAa,MAAM,CAAC,KAAK;IACvB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Paging.d.ts","sourceRoot":"","sources":["../../../src/core/Paging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;GAOG;AACH,qBAAa,MAAM,CAAC,KAAK;IACvB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,MAAM,CAAS;gBAEX,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM;IAWpE;;;OAGG;IACG,IAAI,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI5D;;;OAGG;IACG,IAAI,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI5D;;;;;OAKG;IACG,IAAI,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI5D;;;;OAIG;IACG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI1E,OAAO,CAAC,SAAS;CAGlB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This interface specifies all fragments which can be used
|
|
3
|
+
* to filter for specific measurement.
|
|
4
|
+
*/
|
|
5
|
+
export interface IMeasurementFilter {
|
|
6
|
+
/**
|
|
7
|
+
* The current page of the paginated results.
|
|
8
|
+
*/
|
|
9
|
+
currentPage?: number;
|
|
10
|
+
/**
|
|
11
|
+
* The managed object ID which the measurement is associated to.
|
|
12
|
+
*/
|
|
13
|
+
source?: number | string;
|
|
14
|
+
/**
|
|
15
|
+
* From which date the measurements should be gathered
|
|
16
|
+
*/
|
|
17
|
+
dateFrom?: string | Date;
|
|
18
|
+
/**
|
|
19
|
+
* To which date the measurements should be gathered
|
|
20
|
+
*/
|
|
21
|
+
dateTo?: string | Date;
|
|
22
|
+
/**
|
|
23
|
+
* Indicates how many entries of the collection shall be returned.
|
|
24
|
+
* The upper limit for one page is 2000 objects.
|
|
25
|
+
*/
|
|
26
|
+
pageSize?: number;
|
|
27
|
+
/**
|
|
28
|
+
* If you are using a range query (that is, at least one of the dateFrom or dateTo parameters is included in the request),
|
|
29
|
+
* then setting revert=true will sort the results by the newest measurements first.
|
|
30
|
+
* By default, the results are sorted by the oldest measurements first.
|
|
31
|
+
*/
|
|
32
|
+
revert?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The type of measurement to search for.
|
|
35
|
+
*/
|
|
36
|
+
type?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The specific series to search for.
|
|
39
|
+
*/
|
|
40
|
+
valueFragmentSeries?: string;
|
|
41
|
+
/**
|
|
42
|
+
* When set to true, the returned result will contain in the statistics object the total number of elements.
|
|
43
|
+
* Only applicable to range queries.
|
|
44
|
+
*/
|
|
45
|
+
valueFragmentType?: string;
|
|
46
|
+
/**
|
|
47
|
+
* When set to true, the returned result will contain in the statistics object the total number of pages.
|
|
48
|
+
* Only applicable to range queries.
|
|
49
|
+
*/
|
|
50
|
+
withTotalPages?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* When set to true, the returned result will contain in the statistics object the total number of elements.
|
|
53
|
+
* Only applicable to range queries.
|
|
54
|
+
*/
|
|
55
|
+
withTotalElements?: boolean;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=IMeasurementFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMeasurementFilter.d.ts","sourceRoot":"","sources":["../../../src/measurement/IMeasurementFilter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B"}
|
|
@@ -34,5 +34,13 @@ export interface ISeriesFilter {
|
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
series?: string | string[];
|
|
37
|
+
/**
|
|
38
|
+
* If you are using a range query (that is, at least one of the dateFrom or dateTo parameters is included in the request),
|
|
39
|
+
* then setting revert=true will sort the results by the newest measurements first.
|
|
40
|
+
* By default, the results are sorted by the oldest measurements first.
|
|
41
|
+
*
|
|
42
|
+
* Note: it will not sort a measurements by a date, but by the order of the measurements in the response.
|
|
43
|
+
*/
|
|
44
|
+
revert?: boolean;
|
|
37
45
|
}
|
|
38
46
|
//# sourceMappingURL=ISeriesFilter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ISeriesFilter.d.ts","sourceRoot":"","sources":["../../../src/measurement/ISeriesFilter.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ISeriesFilter.d.ts","sourceRoot":"","sources":["../../../src/measurement/ISeriesFilter.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IFetchResponse, IIdentified, IResult, Service } from '../core';
|
|
2
2
|
import { IMeasurement, IMeasurementCreate } from './IMeasurement';
|
|
3
|
-
import {
|
|
3
|
+
import { IMeasurementFilter } from './IMeasurementFilter';
|
|
4
4
|
import { ISeries } from './ISeries';
|
|
5
|
+
import { ISeriesFilter } from './ISeriesFilter';
|
|
5
6
|
/**
|
|
6
7
|
* This class allows for managing measurements.
|
|
7
8
|
*/
|
|
@@ -116,6 +117,40 @@ export declare class MeasurementService extends Service<IMeasurement> {
|
|
|
116
117
|
* ```
|
|
117
118
|
*/
|
|
118
119
|
listSeries(params: ISeriesFilter): Promise<IResult<ISeries>>;
|
|
120
|
+
/**
|
|
121
|
+
* Retrieves the measurement file based on the provided filter parameters and headers, but only if the response is 200.
|
|
122
|
+
* If the response is 202, the file is processed in the background and the file is sent by email.
|
|
123
|
+
*
|
|
124
|
+
* **Example**
|
|
125
|
+
* ```typescript
|
|
126
|
+
*
|
|
127
|
+
* const filter: IFetchResponse = {
|
|
128
|
+
* dateFrom: "2024-08-11T12:13:00+02:00"
|
|
129
|
+
* dateTo: "2024-08-12T12:15:00+02:00"
|
|
130
|
+
* source: "32666427"
|
|
131
|
+
* valueFragmentSeries: "accelerationX"
|
|
132
|
+
* valueFragmentType: "c8y_Acceleration"
|
|
133
|
+
* };
|
|
134
|
+
*
|
|
135
|
+
* const headers = {
|
|
136
|
+
* accept: 'text/csv'
|
|
137
|
+
* }
|
|
138
|
+
*
|
|
139
|
+
* (async () => {
|
|
140
|
+
* const response = await measurementService.getMeasurementsFile(filter, headers);
|
|
141
|
+
* if (response.status === 200) {
|
|
142
|
+
* const blob = await response.blob();
|
|
143
|
+
* }
|
|
144
|
+
* })();
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @param filter Object containing filters for querying measurements.
|
|
148
|
+
* @param headers The headers for the request.
|
|
149
|
+
* @returns A promise that resolves to the fetch response.
|
|
150
|
+
*/
|
|
151
|
+
getMeasurementsFile(params: IMeasurementFilter, headers: {
|
|
152
|
+
accept: string;
|
|
153
|
+
}): Promise<IFetchResponse>;
|
|
119
154
|
protected onBeforeCreate(entity: Partial<IMeasurementCreate>): Partial<IMeasurementCreate>;
|
|
120
155
|
}
|
|
121
156
|
//# sourceMappingURL=MeasurementService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeasurementService.d.ts","sourceRoot":"","sources":["../../../src/measurement/MeasurementService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"MeasurementService.d.ts","sourceRoot":"","sources":["../../../src/measurement/MeasurementService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,OAAO,CAAC,YAAY,CAAC;IAC3D,SAAS,CAAC,OAAO,SAAiB;IAClC,SAAS,CAAC,OAAO,SAAkB;IACnC,SAAS,CAAC,YAAY,SAAkB;IACxC,SAAS,CAAC,OAAO,SAAqB;IAEtC;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW;IAItD;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAIhD;;;;;;;;;;;;;;;;;;;OAmBG;IACG,IAAI,CAAC,MAAM,GAAE,MAAW;IAI9B;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW;IAItD;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAOlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACG,mBAAmB,CACvB,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAC1B,OAAO,CAAC,cAAc,CAAC;IAK1B,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC;CAkB7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/measurement/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/measurement/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
package/package.json
CHANGED