@fatehan/tsrp 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,14 @@
1
- import { DashboardIndividualRequest, DashboardIndividualResponse, RouteReviewRequest, RouteReviewResponse, TripPerformanceRequest, TripPerformanceResponse, TripReportRequest, TripReportResponse } from "./fatehan/reports/report";
1
+ import { DashboardIndividualRequest, DashboardIndividualResponse, LogRequest, LogResponse, RouteReviewRequest, RouteReviewResponse, RouteStopRequest, RouteStopResponse, TripPerformanceRequest, TripPerformanceResponse, TripReportRequest, TripReportResponse } from "./fatehan/reports/report";
2
2
  export declare class ReportService {
3
3
  private readonly url;
4
4
  private readonly namespace;
5
5
  private readonly headers;
6
6
  constructor(url: string, authorization?: string, organizationId?: string);
7
+ RouteStopReport(request: RouteStopRequest): Promise<RouteStopResponse>;
7
8
  TripPerformanceReport(request: TripPerformanceRequest): Promise<TripPerformanceResponse>;
8
9
  TripReport(request: TripReportRequest): Promise<TripReportResponse>;
9
10
  RouteReviewReport(request: RouteReviewRequest): Promise<RouteReviewResponse>;
10
11
  DashboardIndividual(request: DashboardIndividualRequest): Promise<DashboardIndividualResponse>;
12
+ LogReport(request: LogRequest): Promise<LogResponse>;
11
13
  }
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,0BAA0B,EAC1B,2BAA2B,EAC3B,kBAAkB,EAAE,mBAAmB,EACvC,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EACrB,MAAM,0BAA0B,CAAC;AAElC,qBAAa,aAAa;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA8C;IACxE,OAAO,CAAC,QAAQ,CAAC,OAAO,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AO,EAAE,0BAA0B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAgB9F,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;CAe9D"}
package/dist/index.js CHANGED
@@ -17,6 +17,21 @@ class ReportService {
17
17
  this.headers["Organization-Id"] = organizationId;
18
18
  }
19
19
  }
20
+ RouteStopReport(request) {
21
+ return new Promise(async (resolve, reject) => {
22
+ const response = await fetch(`${this.url}/${this.namespace}/RouteStopReport`, {
23
+ method: "POST",
24
+ headers: this.headers,
25
+ body: report_1.RouteStopRequest.encode(request).finish(),
26
+ });
27
+ if (response.ok) {
28
+ resolve(report_1.RouteStopResponse.decode(new Uint8Array(await response.arrayBuffer())));
29
+ }
30
+ else {
31
+ reject(await response.text());
32
+ }
33
+ });
34
+ }
20
35
  TripPerformanceReport(request) {
21
36
  return new Promise(async (resolve, reject) => {
22
37
  const response = await fetch(`${this.url}/${this.namespace}/TripPerformanceReport`, {
@@ -77,5 +92,20 @@ class ReportService {
77
92
  }
78
93
  });
79
94
  }
95
+ LogReport(request) {
96
+ return new Promise(async (resolve, reject) => {
97
+ const response = await fetch(`${this.url}/${this.namespace}/LogReport`, {
98
+ method: "POST",
99
+ headers: this.headers,
100
+ body: report_1.LogRequest.encode(request).finish(),
101
+ });
102
+ if (response.ok) {
103
+ resolve(report_1.LogResponse.decode(new Uint8Array(await response.arrayBuffer())));
104
+ }
105
+ else {
106
+ reject(await response.text());
107
+ }
108
+ });
109
+ }
80
110
  }
81
111
  exports.ReportService = ReportService;
@@ -10,11 +10,12 @@ const report_1 = require("./fatehan/reports/report");
10
10
  let c = new index_1.ReportService(url, token, organization);
11
11
  (0, vitest_1.it)('TripPerformanceReport', async () => {
12
12
  let res = await c.TripPerformanceReport({
13
+ hourly: false,
13
14
  groupByDevice: true,
14
- groupByDatetime: report_1.TripPerformanceRequest_GroupBy.Day,
15
15
  deviceId: [118709, 117989, 118710, 115351, 115972, 115248, 114845],
16
16
  startedAt: new Date("2025-04-01 00:00:00"),
17
- finishedAt: new Date("2025-04-22 00:00:00")
17
+ finishedAt: new Date("2025-04-22 00:00:00"),
18
+ groupByDatetime: report_1.TripPerformanceRequest_GroupBy.All
18
19
  });
19
20
  console.log("TripPerformanceReport", res.records);
20
21
  });
@@ -33,7 +34,7 @@ const report_1 = require("./fatehan/reports/report");
33
34
  finishedAt: new Date("2025-04-22 00:00:00"),
34
35
  includeTrip: true,
35
36
  source: report_1.Source.CASSANDRA,
36
- stopType: report_1.RouteReviewRequest_StopType.IGNITION
37
+ stopType: report_1.StopCalculateIo.IGNITION
37
38
  });
38
39
  console.log("RouteReviewReport", res.records);
39
40
  });
@@ -45,4 +46,15 @@ const report_1 = require("./fatehan/reports/report");
45
46
  });
46
47
  console.log("DashboardReport", res);
47
48
  });
49
+ (0, vitest_1.it)('LogReport', async () => {
50
+ let res = await c.LogReport({
51
+ deviceId: 124251414,
52
+ startedAt: new Date("2025-05-19 00:00:00"),
53
+ finishedAt: new Date("2025-05-220 00:00:00"),
54
+ limit: 50,
55
+ page: 1,
56
+ sort: -1,
57
+ });
58
+ console.log("LogReport", res);
59
+ });
48
60
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fatehan/tsrp",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "fatehan main models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,11 +27,11 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/google-protobuf": "^3.15.12",
30
- "@types/node": "^22.15.18",
30
+ "@types/node": "^22.15.21",
31
31
  "ts-node": "^10.9.2",
32
32
  "ts-proto": "^2.7.0",
33
33
  "typescript": "^5.8.3",
34
- "vitest": "^3.1.3"
34
+ "vitest": "^3.1.4"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@bufbuild/protobuf": "^2.4.0",