@fatehan/tsrp 1.3.33 → 1.3.35

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/api.d.ts CHANGED
@@ -5,29 +5,19 @@ export declare class ApiError extends Error {
5
5
  status: number;
6
6
  constructor(status: number, message: string);
7
7
  }
8
- export type ServiceResponse<T> = {
9
- data: T;
10
- error?: undefined;
11
- } | {
12
- data?: undefined;
13
- error: {
14
- status: number;
15
- message: string;
16
- };
17
- };
18
8
  export declare class ApiService {
19
9
  private readonly url;
20
10
  private readonly namespace;
21
11
  private readonly getDynamicHeaders;
22
12
  constructor(url: string, headerProvider: HeaderProvider);
23
13
  private _call;
24
- MeIndex(request: import("./fatehan/services/api").MeRequest): Promise<ServiceResponse<import("./fatehan/services/api").MeResponse>>;
25
- DeviceIndex(request: import("./fatehan/services/api").DeviceRequest): Promise<ServiceResponse<import("./fatehan/services/api").DeviceResponse>>;
26
- DeviceShow(request: import("./fatehan/services/api").DeviceShowRequest): Promise<ServiceResponse<import("./fatehan/services/api").DeviceShowResponse>>;
27
- AreaIndex(request: import("./fatehan/services/api").AreaIndexRequest): Promise<ServiceResponse<import("./fatehan/services/api").AreaIndexResponse>>;
28
- ConfigIndex(request: import("./fatehan/services/api").ConfigRequest): Promise<ServiceResponse<import("./fatehan/services/api").ConfigResponse>>;
29
- UserIndex(request: import("./fatehan/services/api").UserRequest): Promise<ServiceResponse<import("./fatehan/services/api").UserResponse>>;
30
- IoIndex(request: import("./fatehan/services/api").IoRequest): Promise<ServiceResponse<import("./fatehan/services/api").IoResponse>>;
14
+ MeIndex(request: import("./fatehan/services/api").MeRequest): Promise<import("./fatehan/services/api").MeResponse>;
15
+ DeviceIndex(request: import("./fatehan/services/api").DeviceRequest): Promise<import("./fatehan/services/api").DeviceResponse>;
16
+ DeviceShow(request: import("./fatehan/services/api").DeviceShowRequest): Promise<import("./fatehan/services/api").DeviceShowResponse>;
17
+ AreaIndex(request: import("./fatehan/services/api").AreaIndexRequest): Promise<import("./fatehan/services/api").AreaIndexResponse>;
18
+ ConfigIndex(request: import("./fatehan/services/api").ConfigRequest): Promise<import("./fatehan/services/api").ConfigResponse>;
19
+ UserIndex(request: import("./fatehan/services/api").UserRequest): Promise<import("./fatehan/services/api").UserResponse>;
20
+ IoIndex(request: import("./fatehan/services/api").IoRequest): Promise<import("./fatehan/services/api").IoResponse>;
31
21
  IoCast(data: Data): Promise<ShownIo[]>;
32
22
  }
33
23
  //# sourceMappingURL=api.d.ts.map
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAUnD,qBAAa,QAAS,SAAQ,KAAK;IAC1B,MAAM,EAAE,MAAM,CAAC;gBAEV,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI5C;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,IACzB;IACE,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,GACD;IACE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C,CAAC;AAEN,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6C;IACvE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAiB;gBAEvC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc;YAKzC,KAAK;IA+BN,OAAO,CAClB,OAAO,EAAE,OAAO,wBAAwB,EAAE,SAAS,GA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AO,EAAE,MAAM;CAI5C;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6C;IACvE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAiB;gBAEvC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc;YAKzC,KAAK;IA6BN,OAAO,CAClB,OAAO,EAAE,OAAO,wBAAwB,EAAE,SAAS,GAClD,OAAO,CAAC,OAAO,wBAAwB,EAAE,UAAU,CAAC;IAK1C,WAAW,CACtB,OAAO,EAAE,OAAO,wBAAwB,EAAE,aAAa,GACtD,OAAO,CAAC,OAAO,wBAAwB,EAAE,cAAc,CAAC;IAO9C,UAAU,CACrB,OAAO,EAAE,OAAO,wBAAwB,EAAE,iBAAiB,GAC1D,OAAO,CAAC,OAAO,wBAAwB,EAAE,kBAAkB,CAAC;IAYlD,SAAS,CACpB,OAAO,EAAE,OAAO,wBAAwB,EAAE,gBAAgB,GACzD,OAAO,CAAC,OAAO,wBAAwB,EAAE,iBAAiB,CAAC;IAYjD,WAAW,CACtB,OAAO,EAAE,OAAO,wBAAwB,EAAE,aAAa,GACtD,OAAO,CAAC,OAAO,wBAAwB,EAAE,cAAc,CAAC;IAO9C,SAAS,CACpB,OAAO,EAAE,OAAO,wBAAwB,EAAE,WAAW,GACpD,OAAO,CAAC,OAAO,wBAAwB,EAAE,YAAY,CAAC;IAO5C,OAAO,CAClB,OAAO,EAAE,OAAO,wBAAwB,EAAE,SAAS,GAClD,OAAO,CAAC,OAAO,wBAAwB,EAAE,UAAU,CAAC;IA6B1C,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAKpD"}
package/dist/api.js CHANGED
@@ -39,7 +39,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.ApiService = exports.ApiError = void 0;
40
40
  const system_io_1 = require("./store/system.io");
41
41
  const system_io_2 = __importDefault(require("./system.io"));
42
- const api_1 = require("./fatehan/services/api");
43
42
  class ApiError extends Error {
44
43
  constructor(status, message) {
45
44
  super(message);
@@ -75,131 +74,57 @@ class ApiService {
75
74
  }
76
75
  }
77
76
  async MeIndex(request) {
78
- try {
79
- const { MeRequest, MeResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
80
- const data = await this._call("MeIndex", request, MeRequest, MeResponse);
81
- return { data };
82
- }
83
- catch (e) {
84
- if (e instanceof ApiError) {
85
- return { error: { status: e.status, message: e.message } };
86
- }
87
- return { error: { status: 500, message: "Unknown error" } };
88
- }
77
+ const { MeRequest, MeResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
78
+ return this._call("MeIndex", request, MeRequest, MeResponse);
89
79
  }
90
80
  async DeviceIndex(request) {
91
- try {
92
- const { DeviceRequest, DeviceResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
93
- const data = await this._call("DeviceIndex", request, DeviceRequest, DeviceResponse);
94
- return { data };
95
- }
96
- catch (e) {
97
- if (e instanceof ApiError) {
98
- return { error: { status: e.status, message: e.message } };
99
- }
100
- return { error: { status: 500, message: "Unknown error" } };
101
- }
81
+ const { DeviceRequest, DeviceResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
82
+ return this._call("DeviceIndex", request, DeviceRequest, DeviceResponse);
102
83
  }
103
84
  async DeviceShow(request) {
104
- try {
105
- const { DeviceShowRequest, DeviceShowResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
106
- const data = await this._call("DeviceShow", request, DeviceShowRequest, DeviceShowResponse);
107
- return { data };
108
- }
109
- catch (e) {
110
- if (e instanceof ApiError) {
111
- return { error: { status: e.status, message: e.message } };
112
- }
113
- return { error: { status: 500, message: "Unknown error" } };
114
- }
85
+ const { DeviceShowRequest, DeviceShowResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
86
+ return this._call("DeviceShow", request, DeviceShowRequest, DeviceShowResponse);
115
87
  }
116
88
  async AreaIndex(request) {
117
- try {
118
- const { AreaIndexRequest, AreaIndexResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
119
- const data = await this._call("AreaIndex", request, AreaIndexRequest, AreaIndexResponse);
120
- return { data };
121
- }
122
- catch (e) {
123
- if (e instanceof ApiError) {
124
- return { error: { status: e.status, message: e.message } };
125
- }
126
- return { error: { status: 500, message: "Unknown error" } };
127
- }
89
+ const { AreaIndexRequest, AreaIndexResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
90
+ return this._call("AreaIndex", request, AreaIndexRequest, AreaIndexResponse);
128
91
  }
129
92
  async ConfigIndex(request) {
130
- try {
131
- const { ConfigRequest, ConfigResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
132
- const data = await this._call("ConfigIndex", request, ConfigRequest, ConfigResponse);
133
- return { data };
134
- }
135
- catch (e) {
136
- if (e instanceof ApiError) {
137
- return { error: { status: e.status, message: e.message } };
138
- }
139
- return { error: { status: 500, message: "Unknown error" } };
140
- }
93
+ const { ConfigRequest, ConfigResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
94
+ return this._call("ConfigIndex", request, ConfigRequest, ConfigResponse);
141
95
  }
142
96
  async UserIndex(request) {
143
- try {
144
- const { UserRequest, UserResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
145
- const data = await this._call("UserIndex", request, UserRequest, UserResponse);
146
- return { data };
97
+ const { UserRequest, UserResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
98
+ return this._call("UserIndex", request, UserRequest, UserResponse);
99
+ }
100
+ async IoIndex(request) {
101
+ if (request.deviceId != null) {
102
+ const cachedIo = (0, system_io_1.getDeviceIoCache)(request.deviceId.toString());
103
+ if (cachedIo != null && cachedIo != undefined) {
104
+ return { cost: 0, ios: cachedIo, records: cachedIo.length };
105
+ }
147
106
  }
148
- catch (e) {
149
- if (e instanceof ApiError) {
150
- return { error: { status: e.status, message: e.message } };
107
+ else {
108
+ const cachedIo = (0, system_io_1.getSystemIoCache)();
109
+ if (cachedIo != null && cachedIo != undefined) {
110
+ return { cost: 0, ios: cachedIo, records: cachedIo.length };
151
111
  }
152
- return { error: { status: 500, message: "Unknown error" } };
153
112
  }
154
- }
155
- async IoIndex(request) {
156
- try {
113
+ const { IoRequest, IoResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
114
+ const response = await this._call("IoIndex", request, IoRequest, IoResponse);
115
+ if (response.records > 0) {
157
116
  if (request.deviceId != null) {
158
- const cachedIo = (0, system_io_1.getDeviceIoCache)(request.deviceId.toString());
159
- if (cachedIo != null && cachedIo != undefined) {
160
- return {
161
- data: { cost: 0, ios: cachedIo, records: cachedIo.length },
162
- };
163
- }
117
+ (0, system_io_1.setDeviceIoCache)(request.deviceId.toString(), response.ios);
164
118
  }
165
119
  else {
166
- const cachedIo = (0, system_io_1.getSystemIoCache)();
167
- if (cachedIo != null && cachedIo != undefined) {
168
- return {
169
- data: { cost: 0, ios: cachedIo, records: cachedIo.length },
170
- };
171
- }
172
- }
173
- const { IoRequest, IoResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
174
- const response = await this._call("IoIndex", request, IoRequest, IoResponse);
175
- if (response.records > 0) {
176
- if (request.deviceId != null) {
177
- (0, system_io_1.setDeviceIoCache)(request.deviceId.toString(), response.ios);
178
- }
179
- else {
180
- (0, system_io_1.setSystemIoCache)(response.ios);
181
- }
182
- }
183
- return { data: response };
184
- }
185
- catch (e) {
186
- if (e instanceof ApiError) {
187
- return { error: { status: e.status, message: e.message } };
120
+ (0, system_io_1.setSystemIoCache)(response.ios);
188
121
  }
189
- return { error: { status: 500, message: "Unknown error" } };
190
122
  }
123
+ return response;
191
124
  }
192
125
  async IoCast(data) {
193
- var ioData = api_1.IoResponse.create({ ios: [] });
194
- var deviceIo = api_1.IoResponse.create({ ios: [] });
195
- const systemIoResult = await this.IoIndex({});
196
- if (systemIoResult.data) {
197
- ioData = systemIoResult.data;
198
- }
199
- const deviceIoResult = await this.IoIndex({ deviceId: data.deviceId });
200
- if (deviceIoResult.data) {
201
- deviceIo = deviceIoResult.data;
202
- }
126
+ const ioData = await this.IoIndex({});
127
+ const deviceIo = await this.IoIndex({ deviceId: data.deviceId });
203
128
  return (0, system_io_2.default)(ioData.ios, deviceIo.ios, data);
204
129
  }
205
130
  }
package/dist/report.d.ts CHANGED
@@ -3,33 +3,23 @@ export declare class ApiError extends Error {
3
3
  status: number;
4
4
  constructor(status: number, message: string);
5
5
  }
6
- export type ServiceResponse<T> = {
7
- data: T;
8
- error?: undefined;
9
- } | {
10
- data?: undefined;
11
- error: {
12
- status: number;
13
- message: string;
14
- };
15
- };
16
6
  export declare class ReportService {
17
7
  private readonly url;
18
8
  private readonly namespace;
19
9
  private readonly getDynamicHeaders;
20
10
  constructor(url: string, headerProvider: HeaderProvider);
21
11
  private _call;
22
- RouteStopReport(request: import("./fatehan/reports/report").RouteStopRequest): Promise<ServiceResponse<import("./fatehan/reports/report").RouteStopResponse>>;
23
- TripPerformanceReport(request: import("./fatehan/reports/report").TripPerformanceRequest): Promise<ServiceResponse<import("./fatehan/reports/report").TripPerformanceResponse>>;
24
- TripReport(request: import("./fatehan/reports/report").TripReportRequest): Promise<ServiceResponse<import("./fatehan/reports/report").TripReportResponse>>;
25
- RouteReviewReport(request: import("./fatehan/reports/report").RouteReviewRequest): Promise<ServiceResponse<import("./fatehan/reports/report").RouteReviewResponse>>;
26
- DashboardIndividual(request: import("./fatehan/reports/report").DashboardIndividualRequest): Promise<ServiceResponse<import("./fatehan/reports/report").DashboardIndividualResponse>>;
27
- LogReport(request: import("./fatehan/reports/report").LogRequest): Promise<ServiceResponse<import("./fatehan/reports/report").LogResponse>>;
28
- DataReport(request: import("./fatehan/reports/report").DeviceDataRequest): Promise<ServiceResponse<import("./fatehan/reports/report").DeviceDataResponse>>;
29
- AreaSummaryReviewReport(request: import("./fatehan/reports/report").AreaSummaryReviewRequest): Promise<ServiceResponse<import("./fatehan/reports/report").AreaSummaryReviewResponse>>;
30
- WorkCycleReport(request: import("./fatehan/reports/report").WorkCycleRequest): Promise<ServiceResponse<import("./fatehan/reports/report").WorkCycleResponse>>;
31
- CommandHistoryReport(request: import("./fatehan/reports/report").CommandHistoryRequest): Promise<ServiceResponse<import("./fatehan/reports/report").CommandHistoryResponse>>;
32
- WorkflowReport(request: import("./fatehan/reports/report").WorkflowRequest): Promise<ServiceResponse<import("./fatehan/reports/report").WorkflowResponse>>;
12
+ RouteStopReport(request: import("./fatehan/reports/report").RouteStopRequest): Promise<import("./fatehan/reports/report").RouteStopResponse>;
13
+ TripPerformanceReport(request: import("./fatehan/reports/report").TripPerformanceRequest): Promise<import("./fatehan/reports/report").TripPerformanceResponse>;
14
+ TripReport(request: import("./fatehan/reports/report").TripReportRequest): Promise<import("./fatehan/reports/report").TripReportResponse>;
15
+ RouteReviewReport(request: import("./fatehan/reports/report").RouteReviewRequest): Promise<import("./fatehan/reports/report").RouteReviewResponse>;
16
+ DashboardIndividual(request: import("./fatehan/reports/report").DashboardIndividualRequest): Promise<import("./fatehan/reports/report").DashboardIndividualResponse>;
17
+ LogReport(request: import("./fatehan/reports/report").LogRequest): Promise<import("./fatehan/reports/report").LogResponse>;
18
+ DataReport(request: import("./fatehan/reports/report").DeviceDataRequest): Promise<import("./fatehan/reports/report").DeviceDataResponse>;
19
+ AreaSummaryReviewReport(request: import("./fatehan/reports/report").AreaSummaryReviewRequest): Promise<import("./fatehan/reports/report").AreaSummaryReviewResponse>;
20
+ WorkCycleReport(request: import("./fatehan/reports/report").WorkCycleRequest): Promise<import("./fatehan/reports/report").WorkCycleResponse>;
21
+ CommandHistoryReport(request: import("./fatehan/reports/report").CommandHistoryRequest): Promise<import("./fatehan/reports/report").CommandHistoryResponse>;
22
+ WorkflowReport(request: import("./fatehan/reports/report").WorkflowRequest): Promise<import("./fatehan/reports/report").WorkflowResponse>;
33
23
  ChartReport(request: import("./fatehan/reports/report").ChartRequest, responses: (chunk: import("./fatehan/reports/report").ChartResponse) => void, onError: (error: {
34
24
  status: number;
35
25
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC;AAEnC,qBAAa,QAAS,SAAQ,KAAK;IAC1B,MAAM,EAAE,MAAM,CAAC;gBAEV,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI5C;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,IACzB;IACE,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,GACD;IACE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C,CAAC;AAEN,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+C;IACzE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAiB;gBAEvC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc;YAKzC,KAAK;IA+BN,eAAe,CAC1B,OAAO,EAAE,OAAO,0BAA0B,EAAE,gBAAgB,GAC3D,OAAO,CACR,eAAe,CAAC,OAAO,0BAA0B,EAAE,iBAAiB,CAAC,CACtE;IAoBY,qBAAqB,CAChC,OAAO,EAAE,OAAO,0BAA0B,EAAE,sBAAsB,GACjE,OAAO,CACR,eAAe,CAAC,OAAO,0BAA0B,EAAE,uBAAuB,CAAC,CAC5E;IAoBY,UAAU,CACrB,OAAO,EAAE,OAAO,0BAA0B,EAAE,iBAAiB,GAC5D,OAAO,CACR,eAAe,CAAC,OAAO,0BAA0B,EAAE,kBAAkB,CAAC,CACvE;IAoBY,iBAAiB,CAC5B,OAA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B,EAAE,iBAAiB,GAC5D,OAAO,CAAC,OAAO,0BAA0B,EAAE,kBAAkB,CAAC;IAYpD,uBAAuB,CAClC,OAAO,EAAE,OAAO,0BAA0B,EAAE,wBAAwB,GACnE,OAAO,CAAC,OAAO,0BAA0B,EAAE,yBAAyB,CAAC;IAW3D,eAAe,CAC1B,OAAO,EAAE,OAAO,0BAA0B,EAAE,gBAAgB,GAC3D,OAAO,CAAC,OAAO,0BAA0B,EAAE,iBAAiB,CAAC;IAYnD,oBAAoB,CAC/B,OAAO,EAAE,OAAO,0BAA0B,EAAE,qBAAqB,GAChE,OAAO,CAAC,OAAO,0BAA0B,EAAE,sBAAsB,CAAC;IAYxD,cAAc,CACzB,OAAO,EAAE,OAAO,0BAA0B,EAAE,eAAe,GAC1D,OAAO,CAAC,OAAO,0BAA0B,EAAE,gBAAgB,CAAC;IAYlD,WAAW,CACtB,OAAO,EAAE,OAAO,0BAA0B,EAAE,YAAY,EACxD,SAAS,EAAE,CACT,KAAK,EAAE,OAAO,0BAA0B,EAAE,aAAa,KACpD,IAAI,EACT,OAAO,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;CA4DhE"}
package/dist/report.js CHANGED
@@ -69,147 +69,48 @@ class ReportService {
69
69
  }
70
70
  }
71
71
  async RouteStopReport(request) {
72
- try {
73
- const { RouteStopRequest, RouteStopResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
74
- const data = await this._call("RouteStopReport", request, RouteStopRequest, RouteStopResponse);
75
- return { data };
76
- }
77
- catch (e) {
78
- if (e instanceof ApiError) {
79
- return { error: { status: e.status, message: e.message } };
80
- }
81
- return { error: { status: 500, message: "Unknown error" } };
82
- }
72
+ const { RouteStopRequest, RouteStopResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
73
+ return this._call("RouteStopReport", request, RouteStopRequest, RouteStopResponse);
83
74
  }
84
75
  async TripPerformanceReport(request) {
85
- try {
86
- const { TripPerformanceRequest, TripPerformanceResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
87
- const data = await this._call("TripPerformanceReport", request, TripPerformanceRequest, TripPerformanceResponse);
88
- return { data };
89
- }
90
- catch (e) {
91
- if (e instanceof ApiError) {
92
- return { error: { status: e.status, message: e.message } };
93
- }
94
- return { error: { status: 500, message: "Unknown error" } };
95
- }
76
+ const { TripPerformanceRequest, TripPerformanceResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
77
+ return this._call("TripPerformanceReport", request, TripPerformanceRequest, TripPerformanceResponse);
96
78
  }
97
79
  async TripReport(request) {
98
- try {
99
- const { TripReportRequest, TripReportResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
100
- const data = await this._call("TripReport", request, TripReportRequest, TripReportResponse);
101
- return { data };
102
- }
103
- catch (e) {
104
- if (e instanceof ApiError) {
105
- return { error: { status: e.status, message: e.message } };
106
- }
107
- return { error: { status: 500, message: "Unknown error" } };
108
- }
80
+ const { TripReportRequest, TripReportResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
81
+ return this._call("TripReport", request, TripReportRequest, TripReportResponse);
109
82
  }
110
83
  async RouteReviewReport(request) {
111
- try {
112
- const { RouteReviewRequest, RouteReviewResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
113
- const data = await this._call("RouteReviewReport", request, RouteReviewRequest, RouteReviewResponse);
114
- return { data };
115
- }
116
- catch (e) {
117
- if (e instanceof ApiError) {
118
- return { error: { status: e.status, message: e.message } };
119
- }
120
- return { error: { status: 500, message: "Unknown error" } };
121
- }
84
+ const { RouteReviewRequest, RouteReviewResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
85
+ return this._call("RouteReviewReport", request, RouteReviewRequest, RouteReviewResponse);
122
86
  }
123
87
  async DashboardIndividual(request) {
124
- try {
125
- const { DashboardIndividualRequest, DashboardIndividualResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
126
- const data = await this._call("DashboardIndividual", request, DashboardIndividualRequest, DashboardIndividualResponse);
127
- return { data };
128
- }
129
- catch (e) {
130
- if (e instanceof ApiError) {
131
- return { error: { status: e.status, message: e.message } };
132
- }
133
- return { error: { status: 500, message: "Unknown error" } };
134
- }
88
+ const { DashboardIndividualRequest, DashboardIndividualResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
89
+ return this._call("DashboardIndividual", request, DashboardIndividualRequest, DashboardIndividualResponse);
135
90
  }
136
91
  async LogReport(request) {
137
- try {
138
- const { LogRequest, LogResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
139
- const data = await this._call("LogReport", request, LogRequest, LogResponse);
140
- return { data };
141
- }
142
- catch (e) {
143
- if (e instanceof ApiError) {
144
- return { error: { status: e.status, message: e.message } };
145
- }
146
- return { error: { status: 500, message: "Unknown error" } };
147
- }
92
+ const { LogRequest, LogResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
93
+ return this._call("LogReport", request, LogRequest, LogResponse);
148
94
  }
149
95
  async DataReport(request) {
150
- try {
151
- const { DeviceDataRequest, DeviceDataResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
152
- const data = await this._call("DeviceDataReport", request, DeviceDataRequest, DeviceDataResponse);
153
- return { data };
154
- }
155
- catch (e) {
156
- if (e instanceof ApiError) {
157
- return { error: { status: e.status, message: e.message } };
158
- }
159
- return { error: { status: 500, message: "Unknown error" } };
160
- }
96
+ const { DeviceDataRequest, DeviceDataResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
97
+ return this._call("DeviceDataReport", request, DeviceDataRequest, DeviceDataResponse);
161
98
  }
162
99
  async AreaSummaryReviewReport(request) {
163
- try {
164
- const { AreaSummaryReviewRequest, AreaSummaryReviewResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
165
- const data = await this._call("AreaSummaryReviewReport", request, AreaSummaryReviewRequest, AreaSummaryReviewResponse);
166
- return { data };
167
- }
168
- catch (e) {
169
- if (e instanceof ApiError) {
170
- return { error: { status: e.status, message: e.message } };
171
- }
172
- return { error: { status: 500, message: "Unknown error" } };
173
- }
100
+ const { AreaSummaryReviewRequest, AreaSummaryReviewResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
101
+ return this._call("AreaSummaryReviewReport", request, AreaSummaryReviewRequest, AreaSummaryReviewResponse);
174
102
  }
175
103
  async WorkCycleReport(request) {
176
- try {
177
- const { WorkCycleRequest, WorkCycleResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
178
- const data = await this._call("WorkCycleReport", request, WorkCycleRequest, WorkCycleResponse);
179
- return { data };
180
- }
181
- catch (e) {
182
- if (e instanceof ApiError) {
183
- return { error: { status: e.status, message: e.message } };
184
- }
185
- return { error: { status: 500, message: "Unknown error" } };
186
- }
104
+ const { WorkCycleRequest, WorkCycleResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
105
+ return this._call("WorkCycleReport", request, WorkCycleRequest, WorkCycleResponse);
187
106
  }
188
107
  async CommandHistoryReport(request) {
189
- try {
190
- const { CommandHistoryRequest, CommandHistoryResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
191
- const data = await this._call("CommandHistoryReport", request, CommandHistoryRequest, CommandHistoryResponse);
192
- return { data };
193
- }
194
- catch (e) {
195
- if (e instanceof ApiError) {
196
- return { error: { status: e.status, message: e.message } };
197
- }
198
- return { error: { status: 500, message: "Unknown error" } };
199
- }
108
+ const { CommandHistoryRequest, CommandHistoryResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
109
+ return this._call("CommandHistoryReport", request, CommandHistoryRequest, CommandHistoryResponse);
200
110
  }
201
111
  async WorkflowReport(request) {
202
- try {
203
- const { WorkflowRequest, WorkflowResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
204
- const data = await this._call("WorkflowReport", request, WorkflowRequest, WorkflowResponse);
205
- return { data };
206
- }
207
- catch (e) {
208
- if (e instanceof ApiError) {
209
- return { error: { status: e.status, message: e.message } };
210
- }
211
- return { error: { status: 500, message: "Unknown error" } };
212
- }
112
+ const { WorkflowRequest, WorkflowResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/reports/report")));
113
+ return this._call("WorkflowReport", request, WorkflowRequest, WorkflowResponse);
213
114
  }
214
115
  async ChartReport(request, responses, onError) {
215
116
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"system.io.d.ts","sourceRoot":"","sources":["../src/system.io.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,QAAQ,EAET,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAEnD,QAAA,MAAM,YAAY,GAChB,UAAU,QAAQ,EAAE,EACpB,UAAU,QAAQ,EAAE,EACpB,MAAM,IAAI,KACT,OAAO,EA4FT,CAAC;AAuBF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"system.io.d.ts","sourceRoot":"","sources":["../src/system.io.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,QAAQ,EAET,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAEnD,QAAA,MAAM,YAAY,GAChB,UAAU,QAAQ,EAAE,EACpB,UAAU,QAAQ,EAAE,EACpB,MAAM,IAAI,KACT,OAAO,EAoGT,CAAC;AA6BF,eAAe,YAAY,CAAC"}
package/dist/system.io.js CHANGED
@@ -11,6 +11,7 @@ const SystemIoCast = (systemIo, deviceIo, data) => {
11
11
  }
12
12
  const tempSystemIo = [...systemIo, ...deviceIo].sort((a, b) => a.sord - b.sord);
13
13
  tempSystemIo.forEach((io) => {
14
+ var _a;
14
15
  let items = extractVariables(io.formula);
15
16
  let formula = io.formula;
16
17
  let hasIos = true;
@@ -43,7 +44,7 @@ const SystemIoCast = (systemIo, deviceIo, data) => {
43
44
  }
44
45
  }
45
46
  else {
46
- if (newValue.toString().equals(key)) {
47
+ if (newValue.toString().includes(key)) {
47
48
  newValue = io.unknown[key];
48
49
  }
49
50
  }
@@ -58,18 +59,27 @@ const SystemIoCast = (systemIo, deviceIo, data) => {
58
59
  }
59
60
  }
60
61
  else {
61
- if (newValue.toString().equals(item)) {
62
+ if (newValue.toString().includes(item)) {
62
63
  hidden = true;
63
64
  }
64
65
  }
65
66
  });
67
+ if (io.DecimalCount && io.DecimalCount > 0) {
68
+ newValue = Number(newValue).toFixed(io.DecimalCount);
69
+ }
70
+ else if (io.DecimalCount === 0) {
71
+ newValue = Math.round(newValue).toString();
72
+ }
73
+ if (io.SeparatorsCount && io.SeparatorsCount > 0) {
74
+ newValue = Separator(String(newValue), (_a = io.SeparatorsCount) !== null && _a !== void 0 ? _a : 0);
75
+ }
66
76
  if (!hidden) {
67
77
  list.push({
68
78
  name: io.name,
69
79
  style: style,
70
80
  unit: io.unit,
71
81
  description: io.description,
72
- value: newValue,
82
+ value: String(newValue),
73
83
  active: io.active,
74
84
  graphable: io.graphable,
75
85
  sord: io.sord,
@@ -79,6 +89,12 @@ const SystemIoCast = (systemIo, deviceIo, data) => {
79
89
  });
80
90
  return list;
81
91
  };
92
+ function Separator(value, seprator) {
93
+ const [intPart, decimalPart] = value.split(".");
94
+ const regex = new RegExp(`\\B(?=(\\d{${seprator}})+(?!\\d))`, "g");
95
+ const formattedInt = intPart.replace(regex, ",");
96
+ return decimalPart ? `${formattedInt}.${decimalPart}` : formattedInt;
97
+ }
82
98
  function extractVariables(str) {
83
99
  const matches = str.match(/\$(\w+(?:\.\w+)*)/g);
84
100
  if (!matches)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fatehan/tsrp",
3
- "version": "1.3.33",
3
+ "version": "1.3.35",
4
4
  "description": "fatehan main models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",