@fatehan/tsrp 1.6.20 → 1.6.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/fatehan/activities/workflow.d.ts +219 -0
  2. package/dist/fatehan/activities/workflow.d.ts.map +1 -0
  3. package/dist/fatehan/activities/workflow.js +1941 -0
  4. package/dist/fatehan/activities/workshift.d.ts +140 -0
  5. package/dist/fatehan/activities/workshift.d.ts.map +1 -0
  6. package/dist/fatehan/activities/workshift.js +1244 -0
  7. package/dist/fatehan/apis/client.d.ts +246 -0
  8. package/dist/fatehan/apis/client.d.ts.map +1 -0
  9. package/dist/fatehan/apis/client.js +2572 -0
  10. package/dist/fatehan/areas/area.d.ts +96 -0
  11. package/dist/fatehan/areas/area.d.ts.map +1 -0
  12. package/dist/fatehan/areas/area.js +761 -0
  13. package/dist/fatehan/devices/devices.d.ts +256 -0
  14. package/dist/fatehan/devices/devices.d.ts.map +1 -0
  15. package/dist/fatehan/devices/devices.js +2730 -0
  16. package/dist/fatehan/devices/maintenance.d.ts +64 -0
  17. package/dist/fatehan/devices/maintenance.d.ts.map +1 -0
  18. package/dist/fatehan/devices/maintenance.js +484 -0
  19. package/dist/fatehan/financial/financial.d.ts +162 -0
  20. package/dist/fatehan/financial/financial.d.ts.map +1 -0
  21. package/dist/fatehan/financial/financial.js +1701 -0
  22. package/dist/fatehan/google/protobuf/descriptor.d.ts +1303 -0
  23. package/dist/fatehan/google/protobuf/descriptor.d.ts.map +1 -0
  24. package/dist/fatehan/google/protobuf/descriptor.js +3467 -0
  25. package/dist/fatehan/google/protobuf/duration.d.ts +99 -0
  26. package/dist/fatehan/google/protobuf/duration.d.ts.map +1 -0
  27. package/dist/fatehan/google/protobuf/duration.js +63 -0
  28. package/dist/fatehan/google/protobuf/field_mask.d.ts +228 -0
  29. package/dist/fatehan/google/protobuf/field_mask.d.ts.map +1 -0
  30. package/dist/fatehan/google/protobuf/field_mask.js +57 -0
  31. package/dist/fatehan/google/protobuf/timestamp.d.ts +129 -0
  32. package/dist/fatehan/google/protobuf/timestamp.d.ts.map +1 -0
  33. package/dist/fatehan/google/protobuf/timestamp.js +63 -0
  34. package/dist/fatehan/identities/authentication.d.ts +164 -0
  35. package/dist/fatehan/identities/authentication.d.ts.map +1 -0
  36. package/dist/fatehan/identities/authentication.js +1291 -0
  37. package/dist/fatehan/identities/identities.d.ts +969 -0
  38. package/dist/fatehan/identities/identities.d.ts.map +1 -0
  39. package/dist/fatehan/identities/identities.js +2993 -0
  40. package/dist/fatehan/models/fusion.d.ts +149 -0
  41. package/dist/fatehan/models/fusion.d.ts.map +1 -0
  42. package/dist/fatehan/models/fusion.js +1531 -0
  43. package/dist/fatehan/models/models.d.ts +162 -0
  44. package/dist/fatehan/models/models.d.ts.map +1 -0
  45. package/dist/fatehan/models/models.js +1486 -0
  46. package/dist/fatehan/notifies/direct.d.ts +85 -0
  47. package/dist/fatehan/notifies/direct.d.ts.map +1 -0
  48. package/dist/fatehan/notifies/direct.js +669 -0
  49. package/dist/fatehan/notifies/notify.d.ts +232 -0
  50. package/dist/fatehan/notifies/notify.d.ts.map +1 -0
  51. package/dist/fatehan/notifies/notify.js +1958 -0
  52. package/dist/fatehan/packets/commands.d.ts +150 -0
  53. package/dist/fatehan/packets/commands.d.ts.map +1 -0
  54. package/dist/fatehan/packets/commands.js +1364 -0
  55. package/dist/fatehan/packets/dataModel.d.ts +1611 -0
  56. package/dist/fatehan/packets/dataModel.d.ts.map +1 -0
  57. package/dist/fatehan/packets/dataModel.js +14961 -0
  58. package/dist/fatehan/packets/dataModule.d.ts +61 -0
  59. package/dist/fatehan/packets/dataModule.d.ts.map +1 -0
  60. package/dist/fatehan/packets/dataModule.js +386 -0
  61. package/dist/fatehan/packets/forge.d.ts +142 -0
  62. package/dist/fatehan/packets/forge.d.ts.map +1 -0
  63. package/dist/fatehan/packets/forge.js +1339 -0
  64. package/dist/fatehan/services/api.d.ts +1222 -0
  65. package/dist/fatehan/services/api.d.ts.map +1 -0
  66. package/dist/fatehan/services/api.js +12689 -0
  67. package/dist/fatehan/services/repositories.d.ts +78 -0
  68. package/dist/fatehan/services/repositories.d.ts.map +1 -0
  69. package/dist/fatehan/services/repositories.js +620 -0
  70. package/dist/fatehan/stream/stream.d.ts +224 -0
  71. package/dist/fatehan/stream/stream.d.ts.map +1 -0
  72. package/dist/fatehan/stream/stream.js +1416 -0
  73. package/dist/fatehan/trips/trip.d.ts +325 -0
  74. package/dist/fatehan/trips/trip.d.ts.map +1 -0
  75. package/dist/fatehan/trips/trip.js +1635 -0
  76. package/dist/fatehan/utils/buf/validate/validate.d.ts +3520 -0
  77. package/dist/fatehan/utils/buf/validate/validate.d.ts.map +1 -0
  78. package/dist/fatehan/utils/buf/validate/validate.js +4248 -0
  79. package/dist/services.d.ts +79 -0
  80. package/dist/services.d.ts.map +1 -0
  81. package/dist/services.js +245 -0
  82. package/dist/store/system.io.d.ts +6 -0
  83. package/dist/store/system.io.d.ts.map +1 -0
  84. package/dist/store/system.io.js +14 -0
  85. package/dist/system.io.d.ts +6 -0
  86. package/dist/system.io.d.ts.map +1 -0
  87. package/dist/system.io.js +208 -0
  88. package/package.json +1 -1
@@ -0,0 +1,79 @@
1
+ import { WorkShift, WorkShiftDestroyRequest, WorkShiftDestroyResponse, WorkShiftIndexRequest, WorkShiftIndexResponse, WorkShiftShowRequest, WorkShiftTemplate, WorkShiftTemplateDestroyRequest, WorkShiftTemplateDestroyResponse, WorkShiftTemplateIndexRequest, WorkShiftTemplateIndexResponse, WorkShiftTemplateShowRequest } from "./fatehan/activities/workshift";
2
+ import { CommandAction } from "./fatehan/devices/devices";
3
+ import { EventTemplate, Event } from "./fatehan/notifies/notify";
4
+ import { Data } from "./fatehan/packets/dataModel";
5
+ import { AreaIndexRequest, AreaIndexResponse, AreaSplitterRequest, AreaSplitterResponse, AreaSummaryReviewRequest, AreaSummaryReviewResponse, AttendanceRequest, AttendanceResponse, AttendanceXRequest, AuthRequest, AuthResponse, ChartRequest, ChartResponse, CommandActionIndexRequest, CommandActionIndexResponse, CommandActionListRequest, CommandActionListResponse, CommandActionShowRequest, CommandHistoryRequest, CommandHistoryResponse, ConfigRequest, ConfigResponse, DailyTrafficRequest, DailyTrafficResponse, DashboardIndividualRequest, DashboardIndividualResponse, DeviceDataRequest, DeviceDataResponse, DeviceRequest, DeviceResponse, DeviceShowRequest, DeviceShowResponse, DriverBehaviorReportRequest, DriverBehaviorReportResponse, EventDestroyRequest, EventDestroyResponse, EventIndexRequest, EventIndexResponse, EventShowRequest, EventTemplateDestroyRequest, EventTemplateDestroyResponse, EventTemplateIndexRequest, EventTemplateIndexResponse, EventTemplateShowRequest, IoRequest, IoResponse, LogRequest, LogResponse, MaintenanceIndexRequest, MaintenanceIndexResponse, MeRequest, MeResponse, NotificationReportRequest, NotificationReportResponse, PrepareSendUserNotificationRequest, PrepareSendUserNotificationResposne, RouteReviewRequest, RouteReviewResponse, RouteStopRequest, RouteStopResponse, SendUserNotificationRequest, SendUserNotificationResponse, ShiftRequest, ShiftResponse, ShiftSummaryRequest, ShiftSummaryResponse, SubscriptionMethodIndexRequest, TrafficRequest, TrafficResponse, TraffixRequest, TraffixResponse, TripPerformanceRequest, TripPerformanceResponse, TripReportRequest, TripReportResponse, TripsRequest, TripsResponse, TripsSummaryRequest, TripsSummaryResponse, UserRequest, UserResponse, WorkCycleRequest, WorkCycleResponse, WorkflowRequest, WorkflowResponse } from "./fatehan/services/api";
6
+ import { SubscriptionRepo } from "./fatehan/services/repositories";
7
+ export type HeaderProvider = () => Promise<HeadersInit> | HeadersInit;
8
+ export declare class ApiError extends Error {
9
+ status: number;
10
+ constructor(status: number, message: string);
11
+ }
12
+ export declare class ApiService {
13
+ private readonly url;
14
+ private readonly namespace;
15
+ private readonly getDynamicHeaders;
16
+ constructor(url: string, headerProvider: HeaderProvider);
17
+ private _call;
18
+ MeIndex(request: MeRequest): Promise<MeResponse>;
19
+ Authentication(request: AuthRequest): Promise<AuthResponse>;
20
+ AreaIndex(request: AreaIndexRequest): Promise<AreaIndexResponse>;
21
+ DeviceIndex(request: DeviceRequest): Promise<DeviceResponse>;
22
+ DeviceShow(request: DeviceShowRequest): Promise<DeviceShowResponse>;
23
+ ConfigIndex(request: ConfigRequest): Promise<ConfigResponse>;
24
+ UserIndex(request: UserRequest): Promise<UserResponse>;
25
+ MaintenanceIndex(request: MaintenanceIndexRequest): Promise<MaintenanceIndexResponse>;
26
+ SubscriptionMethodIndex(request: SubscriptionMethodIndexRequest): Promise<SubscriptionRepo>;
27
+ EventTemplateIndex(request: EventTemplateIndexRequest): Promise<EventTemplateIndexResponse>;
28
+ EventTemplateStore(request: EventTemplate): Promise<EventTemplate>;
29
+ EventTemplateUpdate(request: EventTemplate): Promise<EventTemplate>;
30
+ EventTemplateDestroy(request: EventTemplateDestroyRequest): Promise<EventTemplateDestroyResponse>;
31
+ EventTemplateShow(request: EventTemplateShowRequest): Promise<EventTemplate>;
32
+ EventStore(request: Event): Promise<Event>;
33
+ EventUpdate(request: Event): Promise<Event>;
34
+ EventDestroy(request: EventDestroyRequest): Promise<EventDestroyResponse>;
35
+ EventIndex(request: EventIndexRequest): Promise<EventIndexResponse>;
36
+ EventShow(request: EventShowRequest): Promise<Event>;
37
+ CommandActionIndex(request: CommandActionIndexRequest): Promise<CommandActionIndexResponse>;
38
+ CommandActionShow(request: CommandActionShowRequest): Promise<CommandAction>;
39
+ CommandActionList(request: CommandActionListRequest): Promise<CommandActionListResponse>;
40
+ TraffixReport(request: TraffixRequest): Promise<TraffixResponse>;
41
+ AreaSummaryReviewReport(request: AreaSummaryReviewRequest): Promise<AreaSummaryReviewResponse>;
42
+ AreaSplitterReport(request: AreaSplitterRequest): Promise<AreaSplitterResponse>;
43
+ LogReport(request: LogRequest): Promise<LogResponse>;
44
+ ShiftReport(request: ShiftRequest): Promise<ShiftResponse>;
45
+ TripsReport(request: TripsRequest): Promise<TripsResponse>;
46
+ TrafficReport(request: TrafficRequest): Promise<TrafficResponse>;
47
+ AttendanceReport(request: AttendanceRequest): Promise<AttendanceResponse>;
48
+ AttendanceXReport(request: AttendanceXRequest): Promise<AttendanceResponse>;
49
+ DailyTrafficReport(request: DailyTrafficRequest): Promise<DailyTrafficResponse>;
50
+ TripsSummaryReport(request: TripsSummaryRequest): Promise<TripsSummaryResponse>;
51
+ ShiftSummaryReport(request: ShiftSummaryRequest): Promise<ShiftSummaryResponse>;
52
+ WorkCycleReport(request: WorkCycleRequest): Promise<WorkCycleResponse>;
53
+ TripReport(request: TripReportRequest): Promise<TripReportResponse>;
54
+ DeviceDataReport(request: DeviceDataRequest): Promise<DeviceDataResponse>;
55
+ RouteReviewReport(request: RouteReviewRequest): Promise<RouteReviewResponse>;
56
+ TripPerformanceReport(request: TripPerformanceRequest): Promise<TripPerformanceResponse>;
57
+ DashboardIndividual(request: DashboardIndividualRequest): Promise<DashboardIndividualResponse>;
58
+ RouteStopReport(request: RouteStopRequest): Promise<RouteStopResponse>;
59
+ CommandHistoryReport(request: CommandHistoryRequest): Promise<CommandHistoryResponse>;
60
+ ChartReport(request: ChartRequest): Promise<ChartResponse>;
61
+ WorkflowReport(request: WorkflowRequest): Promise<WorkflowResponse>;
62
+ WorkShiftTemplateIndex(request: WorkShiftTemplateIndexRequest): Promise<WorkShiftTemplateIndexResponse>;
63
+ WorkShiftTemplateShow(request: WorkShiftTemplateShowRequest): Promise<WorkShiftTemplate>;
64
+ WorkShiftTemplateStore(request: WorkShiftTemplate): Promise<WorkShiftTemplate>;
65
+ WorkShiftTemplateUpdate(request: WorkShiftTemplate): Promise<WorkShiftTemplate>;
66
+ WorkShiftTemplateDestroy(request: WorkShiftTemplateDestroyRequest): Promise<WorkShiftTemplateDestroyResponse>;
67
+ WorkShiftIndex(request: WorkShiftIndexRequest): Promise<WorkShiftIndexResponse>;
68
+ WorkShiftShow(request: WorkShiftShowRequest): Promise<WorkShift>;
69
+ WorkShiftStore(request: WorkShift): Promise<WorkShift>;
70
+ WorkShiftUpdate(request: WorkShift): Promise<WorkShift>;
71
+ WorkShiftDestroy(request: WorkShiftDestroyRequest): Promise<WorkShiftDestroyResponse>;
72
+ DriverBehaviorReport(request: DriverBehaviorReportRequest): Promise<DriverBehaviorReportResponse>;
73
+ NotificationReport(request: NotificationReportRequest): Promise<NotificationReportResponse>;
74
+ IoIndex(request: IoRequest): Promise<IoResponse>;
75
+ IoCast(data: Data): Promise<import("./fatehan/devices/devices").ShownIo[]>;
76
+ SendUserNotification(request: SendUserNotificationRequest): Promise<SendUserNotificationResponse>;
77
+ PrepareSendUserNotification(request: PrepareSendUserNotificationRequest): Promise<PrepareSendUserNotificationResposne>;
78
+ }
79
+ //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../src/services.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,+BAA+B,EAC/B,gCAAgC,EAChC,6BAA6B,EAC7B,8BAA8B,EAC9B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB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B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,SAAS,CAAC;IASR,cAAc,CACzB,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,CAAC;IASR,eAAe,CAC1B,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,CAAC;IASR,gBAAgB,CAC3B,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,wBAAwB,CAAC;IASvB,oBAAoB,CAC/B,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,4BAA4B,CAAC;IAS3B,kBAAkB,CAC7B,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,0BAA0B,CAAC;IASzB,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;IA0BvD,MAAM,CAAC,IAAI,EAAE,IAAI;IAMV,oBAAoB,CAC/B,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,4BAA4B,CAAC;IAS3B,2BAA2B,CACtC,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,mCAAmC,CAAC;CAQhD"}
@@ -0,0 +1,245 @@
1
+ import { WorkShift, WorkShiftDestroyRequest, WorkShiftDestroyResponse, WorkShiftIndexRequest, WorkShiftIndexResponse, WorkShiftShowRequest, WorkShiftTemplate, WorkShiftTemplateDestroyRequest, WorkShiftTemplateDestroyResponse, WorkShiftTemplateIndexRequest, WorkShiftTemplateIndexResponse, WorkShiftTemplateShowRequest, } from "./fatehan/activities/workshift";
2
+ import { CommandAction } from "./fatehan/devices/devices";
3
+ import { EventTemplate, Event } from "./fatehan/notifies/notify";
4
+ import { AreaIndexRequest, AreaIndexResponse, AreaSplitterRequest, AreaSplitterResponse, AreaSummaryReviewRequest, AreaSummaryReviewResponse, AttendanceRequest, AttendanceResponse, AttendanceXRequest, AuthRequest, AuthResponse, ChartRequest, ChartResponse, CommandActionIndexRequest, CommandActionIndexResponse, CommandActionListRequest, CommandActionListResponse, CommandActionShowRequest, CommandHistoryRequest, CommandHistoryResponse, ConfigRequest, ConfigResponse, DailyTrafficRequest, DailyTrafficResponse, DashboardIndividualRequest, DashboardIndividualResponse, DeviceDataRequest, DeviceDataResponse, DeviceRequest, DeviceResponse, DeviceShowRequest, DeviceShowResponse, DriverBehaviorReportRequest, DriverBehaviorReportResponse, EventDestroyRequest, EventDestroyResponse, EventIndexRequest, EventIndexResponse, EventShowRequest, EventTemplateDestroyRequest, EventTemplateDestroyResponse, EventTemplateIndexRequest, EventTemplateIndexResponse, EventTemplateShowRequest, IoRequest, IoResponse, LogRequest, LogResponse, MaintenanceIndexRequest, MaintenanceIndexResponse, MeRequest, MeResponse, NotificationReportRequest, NotificationReportResponse, PrepareSendUserNotificationRequest, PrepareSendUserNotificationResposne, RouteReviewRequest, RouteReviewResponse, RouteStopRequest, RouteStopResponse, SendUserNotificationRequest, SendUserNotificationResponse, ShiftRequest, ShiftResponse, ShiftSummaryRequest, ShiftSummaryResponse, SubscriptionMethodIndexRequest, TrafficRequest, TrafficResponse, TraffixRequest, TraffixResponse, TripPerformanceRequest, TripPerformanceResponse, TripReportRequest, TripReportResponse, TripsRequest, TripsResponse, TripsSummaryRequest, TripsSummaryResponse, UserRequest, UserResponse, WorkCycleRequest, WorkCycleResponse, WorkflowRequest, WorkflowResponse, } from "./fatehan/services/api";
5
+ import { SubscriptionRepo } from "./fatehan/services/repositories";
6
+ import { getDeviceIoCache, getSystemIoCache, setDeviceIoCache, setSystemIoCache, } from "./store/system.io";
7
+ import SystemIoCast from "./system.io";
8
+ export class ApiError extends Error {
9
+ status;
10
+ constructor(status, message) {
11
+ super(message);
12
+ this.status = status;
13
+ }
14
+ }
15
+ export class ApiService {
16
+ url;
17
+ namespace = "com.fatehan.services.ApiService";
18
+ getDynamicHeaders;
19
+ constructor(url, headerProvider) {
20
+ this.url = url;
21
+ this.getDynamicHeaders = headerProvider;
22
+ }
23
+ async _call(methodName, request, encoder, decoder) {
24
+ const dynamicHeaders = await this.getDynamicHeaders();
25
+ const headers = {
26
+ "Content-Type": "application/octet-stream",
27
+ Accept: "application/octet-stream",
28
+ ...dynamicHeaders,
29
+ };
30
+ const response = await fetch(`${this.url}/${this.namespace}/${methodName}`, {
31
+ method: "POST",
32
+ headers: headers,
33
+ body: new Uint8Array(encoder.encode(request).finish()),
34
+ });
35
+ if (response.ok) {
36
+ const buffer = await response.arrayBuffer();
37
+ return decoder.decode(new Uint8Array(buffer));
38
+ }
39
+ else {
40
+ const errorText = await response.text();
41
+ throw new ApiError(response.status, errorText || response.statusText);
42
+ }
43
+ }
44
+ async MeIndex(request) {
45
+ return this._call("MeIndex", request, MeRequest, MeResponse);
46
+ }
47
+ async Authentication(request) {
48
+ return this._call("Authentication", request, AuthRequest, AuthResponse);
49
+ }
50
+ async AreaIndex(request) {
51
+ return this._call("AreaIndex", request, AreaIndexRequest, AreaIndexResponse);
52
+ }
53
+ async DeviceIndex(request) {
54
+ return this._call("DeviceIndex", request, DeviceRequest, DeviceResponse);
55
+ }
56
+ async DeviceShow(request) {
57
+ return this._call("DeviceShow", request, DeviceShowRequest, DeviceShowResponse);
58
+ }
59
+ async ConfigIndex(request) {
60
+ return this._call("ConfigIndex", request, ConfigRequest, ConfigResponse);
61
+ }
62
+ async UserIndex(request) {
63
+ return this._call("UserIndex", request, UserRequest, UserResponse);
64
+ }
65
+ async MaintenanceIndex(request) {
66
+ return this._call("MaintenanceIndex", request, MaintenanceIndexRequest, MaintenanceIndexResponse);
67
+ }
68
+ async SubscriptionMethodIndex(request) {
69
+ return this._call("SubscriptionMethodIndex", request, SubscriptionMethodIndexRequest, SubscriptionRepo);
70
+ }
71
+ async EventTemplateIndex(request) {
72
+ return this._call("EventTemplateIndex", request, EventTemplateIndexRequest, EventTemplateIndexResponse);
73
+ }
74
+ async EventTemplateStore(request) {
75
+ return this._call("EventTemplateStore", request, EventTemplate, EventTemplate);
76
+ }
77
+ async EventTemplateUpdate(request) {
78
+ return this._call("EventTemplateUpdate", request, EventTemplate, EventTemplate);
79
+ }
80
+ async EventTemplateDestroy(request) {
81
+ return this._call("EventTemplateDestroy", request, EventTemplateDestroyRequest, EventTemplateDestroyResponse);
82
+ }
83
+ async EventTemplateShow(request) {
84
+ return this._call("EventTemplateShow", request, EventTemplateShowRequest, EventTemplate);
85
+ }
86
+ async EventStore(request) {
87
+ return this._call("EventStore", request, Event, Event);
88
+ }
89
+ async EventUpdate(request) {
90
+ return this._call("EventUpdate", request, Event, Event);
91
+ }
92
+ async EventDestroy(request) {
93
+ return this._call("EventDestroy", request, EventDestroyRequest, EventDestroyResponse);
94
+ }
95
+ async EventIndex(request) {
96
+ return this._call("EventIndex", request, EventIndexRequest, EventIndexResponse);
97
+ }
98
+ async EventShow(request) {
99
+ return this._call("EventShow", request, EventShowRequest, Event);
100
+ }
101
+ async CommandActionIndex(request) {
102
+ return this._call("CommandActionIndex", request, CommandActionIndexRequest, CommandActionIndexResponse);
103
+ }
104
+ async CommandActionShow(request) {
105
+ return this._call("CommandActionShow", request, CommandActionShowRequest, CommandAction);
106
+ }
107
+ async CommandActionList(request) {
108
+ return this._call("CommandActionList", request, CommandActionListRequest, CommandActionListResponse);
109
+ }
110
+ async TraffixReport(request) {
111
+ return this._call("TraffixReport", request, TraffixRequest, TraffixResponse);
112
+ }
113
+ async AreaSummaryReviewReport(request) {
114
+ return this._call("AreaSummaryReviewReport", request, AreaSummaryReviewRequest, AreaSummaryReviewResponse);
115
+ }
116
+ async AreaSplitterReport(request) {
117
+ return this._call("AreaSplitterReport", request, AreaSplitterRequest, AreaSplitterResponse);
118
+ }
119
+ async LogReport(request) {
120
+ return this._call("LogReport", request, LogRequest, LogResponse);
121
+ }
122
+ async ShiftReport(request) {
123
+ return this._call("ShiftReport", request, ShiftRequest, ShiftResponse);
124
+ }
125
+ async TripsReport(request) {
126
+ return this._call("TripsReport", request, TripsRequest, TripsResponse);
127
+ }
128
+ async TrafficReport(request) {
129
+ return this._call("TrafficReport", request, TrafficRequest, TrafficResponse);
130
+ }
131
+ async AttendanceReport(request) {
132
+ return this._call("AttendanceReport", request, AttendanceRequest, AttendanceResponse);
133
+ }
134
+ async AttendanceXReport(request) {
135
+ return this._call("AttendanceXReport", request, AttendanceXRequest, AttendanceResponse);
136
+ }
137
+ async DailyTrafficReport(request) {
138
+ return this._call("DailyTrafficReport", request, DailyTrafficRequest, DailyTrafficResponse);
139
+ }
140
+ async TripsSummaryReport(request) {
141
+ return this._call("TripsSummaryReport", request, TripsSummaryRequest, TripsSummaryResponse);
142
+ }
143
+ async ShiftSummaryReport(request) {
144
+ return this._call("ShiftSummaryReport", request, ShiftSummaryRequest, ShiftSummaryResponse);
145
+ }
146
+ async WorkCycleReport(request) {
147
+ return this._call("WorkCycleReport", request, WorkCycleRequest, WorkCycleResponse);
148
+ }
149
+ async TripReport(request) {
150
+ return this._call("TripReport", request, TripReportRequest, TripReportResponse);
151
+ }
152
+ async DeviceDataReport(request) {
153
+ return this._call("DeviceDataReport", request, DeviceDataRequest, DeviceDataResponse);
154
+ }
155
+ async RouteReviewReport(request) {
156
+ return this._call("RouteReviewReport", request, RouteReviewRequest, RouteReviewResponse);
157
+ }
158
+ async TripPerformanceReport(request) {
159
+ return this._call("TripPerformanceReport", request, TripPerformanceRequest, TripPerformanceResponse);
160
+ }
161
+ async DashboardIndividual(request) {
162
+ return this._call("DashboardIndividual", request, DashboardIndividualRequest, DashboardIndividualResponse);
163
+ }
164
+ async RouteStopReport(request) {
165
+ return this._call("RouteStopReport", request, RouteStopRequest, RouteStopResponse);
166
+ }
167
+ async CommandHistoryReport(request) {
168
+ return this._call("CommandHistoryReport", request, CommandHistoryRequest, CommandHistoryResponse);
169
+ }
170
+ async ChartReport(request) {
171
+ return this._call("ChartReport", request, ChartRequest, ChartResponse);
172
+ }
173
+ async WorkflowReport(request) {
174
+ return this._call("WorkflowReport", request, WorkflowRequest, WorkflowResponse);
175
+ }
176
+ async WorkShiftTemplateIndex(request) {
177
+ return this._call("WorkShiftTemplateIndex", request, WorkShiftTemplateIndexRequest, WorkShiftTemplateIndexResponse);
178
+ }
179
+ async WorkShiftTemplateShow(request) {
180
+ return this._call("WorkShiftTemplateShow", request, WorkShiftTemplateShowRequest, WorkShiftTemplate);
181
+ }
182
+ async WorkShiftTemplateStore(request) {
183
+ return this._call("WorkShiftTemplateStore", request, WorkShiftTemplate, WorkShiftTemplate);
184
+ }
185
+ async WorkShiftTemplateUpdate(request) {
186
+ return this._call("WorkShiftTemplateUpdate", request, WorkShiftTemplate, WorkShiftTemplate);
187
+ }
188
+ async WorkShiftTemplateDestroy(request) {
189
+ return this._call("WorkShiftTemplateDestroy", request, WorkShiftTemplateDestroyRequest, WorkShiftTemplateDestroyResponse);
190
+ }
191
+ async WorkShiftIndex(request) {
192
+ return this._call("WorkShiftIndex", request, WorkShiftIndexRequest, WorkShiftIndexResponse);
193
+ }
194
+ async WorkShiftShow(request) {
195
+ return this._call("WorkShiftShow", request, WorkShiftShowRequest, WorkShift);
196
+ }
197
+ async WorkShiftStore(request) {
198
+ return this._call("WorkShiftStore", request, WorkShift, WorkShift);
199
+ }
200
+ async WorkShiftUpdate(request) {
201
+ return this._call("WorkShiftUpdate", request, WorkShift, WorkShift);
202
+ }
203
+ async WorkShiftDestroy(request) {
204
+ return this._call("WorkShiftDestroy", request, WorkShiftDestroyRequest, WorkShiftDestroyResponse);
205
+ }
206
+ async DriverBehaviorReport(request) {
207
+ return this._call("DriverBehaviorReport", request, DriverBehaviorReportRequest, DriverBehaviorReportResponse);
208
+ }
209
+ async NotificationReport(request) {
210
+ return this._call("NotificationReport", request, NotificationReportRequest, NotificationReportResponse);
211
+ }
212
+ async IoIndex(request) {
213
+ if (request.deviceId != null) {
214
+ const cachedIo = getDeviceIoCache(request.deviceId.toString());
215
+ if (cachedIo != null) {
216
+ return { cost: 0, ios: cachedIo, records: cachedIo.length };
217
+ }
218
+ }
219
+ else {
220
+ const cachedIo = getSystemIoCache();
221
+ if (cachedIo != null) {
222
+ return { cost: 0, ios: cachedIo, records: cachedIo.length };
223
+ }
224
+ }
225
+ const response = await this._call("IoIndex", request, IoRequest, IoResponse);
226
+ if (request.deviceId != null) {
227
+ setDeviceIoCache(request.deviceId.toString(), response.ios);
228
+ }
229
+ else {
230
+ setSystemIoCache(response.ios);
231
+ }
232
+ return response;
233
+ }
234
+ async IoCast(data) {
235
+ const ioData = await this.IoIndex({});
236
+ const deviceIo = await this.IoIndex({ deviceId: data.deviceId });
237
+ return SystemIoCast(ioData.ios, deviceIo.ios, data);
238
+ }
239
+ async SendUserNotification(request) {
240
+ return this._call("SendUserNotification", request, SendUserNotificationRequest, SendUserNotificationResponse);
241
+ }
242
+ async PrepareSendUserNotification(request) {
243
+ return this._call("PrepareSendUserNotification", request, PrepareSendUserNotificationRequest, PrepareSendUserNotificationResposne);
244
+ }
245
+ }
@@ -0,0 +1,6 @@
1
+ import { SystemIo } from "../fatehan/devices/devices";
2
+ export declare function setSystemIoCache(data: SystemIo[]): void;
3
+ export declare function getSystemIoCache(): SystemIo[];
4
+ export declare function getDeviceIoCache(deviceId: string): SystemIo[] | null;
5
+ export declare function setDeviceIoCache(deviceId: string, ios: SystemIo[]): void;
6
+ //# sourceMappingURL=system.io.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.io.d.ts","sourceRoot":"","sources":["../../src/store/system.io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAKtD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAEhD;AAED,wBAAgB,gBAAgB,IAAI,QAAQ,EAAE,CAE7C;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,GAAG,IAAI,CAEpE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,QAEjE"}
@@ -0,0 +1,14 @@
1
+ let ios;
2
+ let deviceIos = {};
3
+ export function setSystemIoCache(data) {
4
+ ios = data;
5
+ }
6
+ export function getSystemIoCache() {
7
+ return ios;
8
+ }
9
+ export function getDeviceIoCache(deviceId) {
10
+ return deviceIos[deviceId] || null;
11
+ }
12
+ export function setDeviceIoCache(deviceId, ios) {
13
+ deviceIos[deviceId] = ios;
14
+ }
@@ -0,0 +1,6 @@
1
+ import { ShownIo, SystemIo } from "./fatehan/devices/devices";
2
+ import { Data } from "./fatehan/packets/dataModel";
3
+ declare const SystemIoCast: (systemIo: SystemIo[], deviceIo: SystemIo[], data: Data) => ShownIo[];
4
+ export declare function evalExpressionSafe(template: string, context: any): number | boolean | string | null;
5
+ export default SystemIoCast;
6
+ //# sourceMappingURL=system.io.d.ts.map
@@ -0,0 +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;AAkGF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,CAgCnG;AACD,eAAe,YAAY,CAAC"}
@@ -0,0 +1,208 @@
1
+ import { SystemIo_SystemIoType, } from "./fatehan/devices/devices";
2
+ const SystemIoCast = (systemIo, deviceIo, data) => {
3
+ let list = [];
4
+ if (systemIo == undefined || systemIo == null) {
5
+ systemIo = [];
6
+ }
7
+ if (deviceIo == undefined || deviceIo == null) {
8
+ deviceIo = [];
9
+ }
10
+ const tempSystemIo = [...systemIo, ...deviceIo].sort((a, b) => a.sord - b.sord);
11
+ tempSystemIo.forEach((io) => {
12
+ const value = evalExpressionSafe(io.formula, data);
13
+ if (value !== null) {
14
+ let style = io.activeStyle;
15
+ if (io.type === SystemIo_SystemIoType.BOOLEAN) {
16
+ style =
17
+ value === "false" || value === false
18
+ ? io.inactiveStyle
19
+ : io.activeStyle;
20
+ }
21
+ let newValue = value;
22
+ if (io.unknown != null) {
23
+ for (const key in io.unknown) {
24
+ let UnkValue = io.unknown[key];
25
+ if (key.toString().toLowerCase().includes("x")) {
26
+ const formula = key.toLowerCase();
27
+ const tempVal = safeEvalFormula(formula, Number(newValue));
28
+ if (tempVal !== null && tempVal) {
29
+ newValue = UnkValue;
30
+ io.unit = "";
31
+ }
32
+ }
33
+ else {
34
+ if (newValue.toString().includes(key)) {
35
+ newValue = UnkValue;
36
+ io.unit = "";
37
+ }
38
+ }
39
+ }
40
+ }
41
+ let hidden = false;
42
+ io.hidden.forEach((item) => {
43
+ const lower = item.toLowerCase();
44
+ if (lower.includes("x")) {
45
+ const formula = lower;
46
+ const ok = safeEvalCondition(formula, Number(newValue));
47
+ if (ok === true) {
48
+ hidden = true;
49
+ }
50
+ }
51
+ else {
52
+ if (String(newValue).includes(item)) {
53
+ hidden = true;
54
+ }
55
+ }
56
+ });
57
+ if (Number(newValue)) {
58
+ if (io.decimalCount && io.decimalCount > 0) {
59
+ newValue = Number(newValue).toFixed(io.decimalCount);
60
+ }
61
+ else if (io.decimalCount === 0) {
62
+ newValue = Math.round(Number(newValue)).toString();
63
+ }
64
+ if (io.separatorsCount && io.separatorsCount > 0) {
65
+ newValue = Separator(String(newValue), io.separatorsCount ?? 0);
66
+ }
67
+ }
68
+ if (!hidden) {
69
+ list.push({
70
+ name: io.name,
71
+ style: style,
72
+ unit: io.unit,
73
+ description: io.description,
74
+ value: String(newValue),
75
+ active: io.active,
76
+ graphable: io.graphable,
77
+ sord: io.sord,
78
+ });
79
+ }
80
+ }
81
+ });
82
+ return list;
83
+ };
84
+ function Separator(value, seprator) {
85
+ const [intPart, decimalPart] = value.split(".");
86
+ const regex = new RegExp(`\\B(?=(\\d{${seprator}})+(?!\\d))`, "g");
87
+ const formattedInt = intPart.replace(regex, ",");
88
+ return decimalPart ? `${formattedInt}.${decimalPart}` : formattedInt;
89
+ }
90
+ function safeEvalFormula(formula, xValue) {
91
+ try {
92
+ const replaced = formula.replace(/x/g, String(xValue));
93
+ if (!/^[0-9+\-*/ ().><=!&|]+$/.test(replaced))
94
+ return null;
95
+ const fn = new Function(`return (${replaced});`);
96
+ const result = fn();
97
+ if (typeof result === "number" && !isNaN(result))
98
+ return result;
99
+ if (typeof result === "boolean")
100
+ return result;
101
+ return null;
102
+ }
103
+ catch {
104
+ return null;
105
+ }
106
+ }
107
+ function safeEvalCondition(formula, xValue) {
108
+ try {
109
+ const replaced = formula.replace(/x/g, String(xValue));
110
+ if (!/^[0-9+\-*/ %().<>=!&|]+$/.test(replaced)) {
111
+ return null;
112
+ }
113
+ const forbiddenPatterns = [/;;/, /process\b/, /constructor\b/, /require\b/, /global\b/];
114
+ if (forbiddenPatterns.some((rx) => rx.test(replaced)))
115
+ return null;
116
+ const fn = new Function(`return (${replaced});`);
117
+ const result = fn();
118
+ if (typeof result === "boolean")
119
+ return result;
120
+ if (typeof result === "number")
121
+ return Boolean(result);
122
+ return null;
123
+ }
124
+ catch {
125
+ return null;
126
+ }
127
+ }
128
+ function isPlainObject(v) {
129
+ return v !== null && typeof v === "object" && !Array.isArray(v) && !(v instanceof Uint8Array);
130
+ }
131
+ function getValueByPathCaseInsensitive(obj, path) {
132
+ if (!path)
133
+ return undefined;
134
+ const parts = path.replace(/\[(\d+)\]/g, '.$1').split('.').filter(Boolean);
135
+ let cur = obj;
136
+ for (const rawPart of parts) {
137
+ if (cur == null)
138
+ return undefined;
139
+ const isIndex = /^\d+$/.test(rawPart);
140
+ if (isIndex) {
141
+ const idx = rawPart;
142
+ if (Array.isArray(cur) || cur instanceof Uint8Array) {
143
+ cur = cur[Number(idx)];
144
+ continue;
145
+ }
146
+ if (typeof cur === "object" && cur !== null && idx in cur) {
147
+ cur = cur[idx];
148
+ continue;
149
+ }
150
+ return undefined;
151
+ }
152
+ // حالت 3: object معمولی (case-insensitive)
153
+ if (isPlainObject(cur)) {
154
+ const lower = rawPart.toLowerCase();
155
+ const foundKey = Object.keys(cur).find(k => k.toLowerCase() === lower);
156
+ if (foundKey !== undefined) {
157
+ cur = cur[foundKey];
158
+ continue;
159
+ }
160
+ else {
161
+ return undefined;
162
+ }
163
+ }
164
+ return undefined;
165
+ }
166
+ return cur;
167
+ }
168
+ export function evalExpressionSafe(template, context) {
169
+ try {
170
+ if (typeof template !== 'string')
171
+ return null;
172
+ const replaced = template.replace(/\$([A-Za-z0-9_.\[\]]+)/gi, (_, expr) => {
173
+ const value = getValueByPathCaseInsensitive(context, expr);
174
+ if (value === undefined || value === null)
175
+ return "null";
176
+ if (typeof value === "number")
177
+ return String(value);
178
+ if (typeof value === "boolean")
179
+ return value ? "true" : "false";
180
+ if (typeof value === "string")
181
+ return JSON.stringify(value);
182
+ if (value instanceof Uint8Array)
183
+ return `[${Array.from(value).join(',')}]`;
184
+ if (Array.isArray(value))
185
+ return `[${value.map(v => (typeof v === "string" ? JSON.stringify(v) : v)).join(',')}]`;
186
+ return "null";
187
+ });
188
+ const cleaned = replaced.replace(/;/g, ' ').replace(/`/g, ' ').replace(/\\/g, ' ').trim();
189
+ if (!/^[0-9+\-*/ ().><=!&|,"'\[\]truefalsenull]*$/i.test(cleaned))
190
+ return null;
191
+ if (cleaned.includes("null") || cleaned.includes("constructor") || cleaned.includes("process") || cleaned.includes("require") || cleaned.includes("global")) {
192
+ return null;
193
+ }
194
+ const fn = new Function(`return (${cleaned});`);
195
+ const result = fn();
196
+ if (typeof result === "number" && !isNaN(result))
197
+ return result;
198
+ if (typeof result === "boolean")
199
+ return result;
200
+ if (typeof result === "string")
201
+ return result;
202
+ return null;
203
+ }
204
+ catch {
205
+ return null;
206
+ }
207
+ }
208
+ export default SystemIoCast;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fatehan/tsrp",
3
- "version": "1.6.20",
3
+ "version": "1.6.22",
4
4
  "description": "fatehan communication protocol",
5
5
  "repository": {
6
6
  "type": "git",