vms-nest-prisma-api-document 959.0.0 → 960.0.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.
@@ -803,5 +803,20 @@ declare enum IncidentVisibility {
803
803
  VeryPoor = "VeryPoor",
804
804
  Unknown = "Unknown"
805
805
  }
806
+ declare enum ExecutionStatus {
807
+ REGISTERED = "REGISTERED",
808
+ FIRED = "FIRED",
809
+ RUNNING = "RUNNING",
810
+ SUCCESS = "SUCCESS",
811
+ FAILED = "FAILED"
812
+ }
813
+ declare enum RunType {
814
+ SCHEDULED = "SCHEDULED",
815
+ MANUAL = "MANUAL"
816
+ }
817
+ declare enum APIAuthType {
818
+ API_KEY = "API_KEY",
819
+ BASIC_AUTH = "BASIC_AUTH"
820
+ }
806
821
 
807
- export { AdminRole, AlertSubType, AlertType, ApprovalStatus, BillingStatus, BloodGroup, BooleanType, BusLeg, BusStopType, DeviceStatus, DeviceType, DocumentStatus, DocumentType, DocumentValidityStatus, DoorSensorStatus, DriverType, ExpenseCategory, ExpiryType, FileType, FleetSize, FleetVendorAddressLabel, FuelTankType, GPSFuelApproveStatus, GPSSource, GPSType, GPSVehicleCategory, Gender, GeofencePurposeType, GeofenceStatusType, GeofenceType, HolidayType, IncidentRoadType, IncidentTime, IncidentVisibility, IncidentWeather, InspectionActionStatus, InspectionPriority, InspectionStatus, InspectionType, Is12AM, IssueSeverity, IssueSource, IssueStatus, JobCardStatus, LifeExpiry, LinkStatus, LinkType, LoadChild, LoadChildCount, LoadParents, LoanInterestType, LoginFrom, MenuType, Module, NightDriving, NotificationChannel, NotificationList, NotificationPreference, OdometerSource, OnOff, OrderBy, OverSpeed, PAGING, PaymentMode, PaymentStatus, Priority, PurchaseOrderStatus, PurchaseType, PurchaseVehicleType, RecurrenceInterval, RefillEntrySource, RefillMethod, ReminderSource, ReminderStatus, ReminderTriggerType, ReminderType, ReportChannel, ReportList, ReportType, RequestType, RetreadingMethod, ScheduleStatus, ScheduleType, ServiceStatus, ServiceType, ShareChannel, SimStatus, Status, SteeringType, StockType, StudentLeaveType, TicketStatus, TimeSlot, TrackHistoryLinkStatus, TransportPlanType, TyreStatus, VehicleLifeStatus, VerifyStatus, WheelDriveType, YesNo };
822
+ export { APIAuthType, AdminRole, AlertSubType, AlertType, ApprovalStatus, BillingStatus, BloodGroup, BooleanType, BusLeg, BusStopType, DeviceStatus, DeviceType, DocumentStatus, DocumentType, DocumentValidityStatus, DoorSensorStatus, DriverType, ExecutionStatus, ExpenseCategory, ExpiryType, FileType, FleetSize, FleetVendorAddressLabel, FuelTankType, GPSFuelApproveStatus, GPSSource, GPSType, GPSVehicleCategory, Gender, GeofencePurposeType, GeofenceStatusType, GeofenceType, HolidayType, IncidentRoadType, IncidentTime, IncidentVisibility, IncidentWeather, InspectionActionStatus, InspectionPriority, InspectionStatus, InspectionType, Is12AM, IssueSeverity, IssueSource, IssueStatus, JobCardStatus, LifeExpiry, LinkStatus, LinkType, LoadChild, LoadChildCount, LoadParents, LoanInterestType, LoginFrom, MenuType, Module, NightDriving, NotificationChannel, NotificationList, NotificationPreference, OdometerSource, OnOff, OrderBy, OverSpeed, PAGING, PaymentMode, PaymentStatus, Priority, PurchaseOrderStatus, PurchaseType, PurchaseVehicleType, RecurrenceInterval, RefillEntrySource, RefillMethod, ReminderSource, ReminderStatus, ReminderTriggerType, ReminderType, ReportChannel, ReportList, ReportType, RequestType, RetreadingMethod, RunType, ScheduleStatus, ScheduleType, ServiceStatus, ServiceType, ShareChannel, SimStatus, Status, SteeringType, StockType, StudentLeaveType, TicketStatus, TimeSlot, TrackHistoryLinkStatus, TransportPlanType, TyreStatus, VehicleLifeStatus, VerifyStatus, WheelDriveType, YesNo };
@@ -904,7 +904,26 @@ var IncidentVisibility = /* @__PURE__ */ ((IncidentVisibility2) => {
904
904
  IncidentVisibility2["Unknown"] = "Unknown";
905
905
  return IncidentVisibility2;
906
906
  })(IncidentVisibility || {});
907
+ var ExecutionStatus = /* @__PURE__ */ ((ExecutionStatus2) => {
908
+ ExecutionStatus2["REGISTERED"] = "REGISTERED";
909
+ ExecutionStatus2["FIRED"] = "FIRED";
910
+ ExecutionStatus2["RUNNING"] = "RUNNING";
911
+ ExecutionStatus2["SUCCESS"] = "SUCCESS";
912
+ ExecutionStatus2["FAILED"] = "FAILED";
913
+ return ExecutionStatus2;
914
+ })(ExecutionStatus || {});
915
+ var RunType = /* @__PURE__ */ ((RunType2) => {
916
+ RunType2["SCHEDULED"] = "SCHEDULED";
917
+ RunType2["MANUAL"] = "MANUAL";
918
+ return RunType2;
919
+ })(RunType || {});
920
+ var APIAuthType = /* @__PURE__ */ ((APIAuthType2) => {
921
+ APIAuthType2["API_KEY"] = "API_KEY";
922
+ APIAuthType2["BASIC_AUTH"] = "BASIC_AUTH";
923
+ return APIAuthType2;
924
+ })(APIAuthType || {});
907
925
  export {
926
+ APIAuthType,
908
927
  AdminRole,
909
928
  AlertSubType,
910
929
  AlertType,
@@ -921,6 +940,7 @@ export {
921
940
  DocumentValidityStatus,
922
941
  DoorSensorStatus,
923
942
  DriverType,
943
+ ExecutionStatus,
924
944
  ExpenseCategory,
925
945
  ExpiryType,
926
946
  FileType,
@@ -986,6 +1006,7 @@ export {
986
1006
  ReportType,
987
1007
  RequestType,
988
1008
  RetreadingMethod,
1009
+ RunType,
989
1010
  ScheduleStatus,
990
1011
  ScheduleType,
991
1012
  ServiceStatus,
@@ -22,15 +22,15 @@ declare const UserLoginAnalyticsSchema: z.ZodObject<{
22
22
  }, "strip", z.ZodTypeAny, {
23
23
  user_id: string;
24
24
  organisation_id: string;
25
- login_from: LoginFrom;
26
25
  country_id: string;
26
+ login_from: LoginFrom;
27
27
  os_details: Record<string, any>;
28
28
  ip_details: Record<string, any>;
29
29
  }, {
30
30
  user_id: string;
31
31
  organisation_id: string;
32
- login_from: LoginFrom;
33
32
  country_id: string;
33
+ login_from: LoginFrom;
34
34
  os_details?: Record<string, any> | undefined;
35
35
  ip_details?: Record<string, any> | undefined;
36
36
  }>;
@@ -48,11 +48,11 @@ declare const UserLoginAnalyticsQuerySchema: z.ZodObject<{
48
48
  organisation_ids: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
49
49
  country_ids: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
50
50
  }, "strip", z.ZodTypeAny, {
51
+ login_from: LoginFrom;
51
52
  search: string;
52
53
  paging: PAGING;
53
54
  page_count: number;
54
55
  page_index: number;
55
- login_from: LoginFrom;
56
56
  date_format_id: string;
57
57
  time_zone_id: string;
58
58
  user_ids: string[];
@@ -43,11 +43,11 @@ declare const UserPageAnalyticsQuerySchema: z.ZodObject<{
43
43
  user_ids: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
44
44
  organisation_ids: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
45
45
  }, "strip", z.ZodTypeAny, {
46
+ login_from: LoginFrom;
46
47
  search: string;
47
48
  paging: PAGING;
48
49
  page_count: number;
49
50
  page_index: number;
50
- login_from: LoginFrom;
51
51
  date_format_id: string;
52
52
  time_zone_id: string;
53
53
  user_ids: string[];
@@ -0,0 +1,234 @@
1
+ import { RunType, ExecutionStatus, YesNo, Status, PAGING, LoadParents, LoadChild, LoadChildCount, OrderBy } from '../../core/Enums.js';
2
+ import { FBR, SBR } from '../../core/BaseResponse.js';
3
+ import { z } from 'zod';
4
+
5
+ interface CronJobLog extends Record<string, unknown> {
6
+ cron_job_log_id: string;
7
+ run_type: RunType;
8
+ execution_status: ExecutionStatus;
9
+ start_date_time?: string;
10
+ start_date_time_f?: string;
11
+ end_date_time?: string;
12
+ end_date_time_f?: string;
13
+ error_details?: string;
14
+ success_details?: string;
15
+ cron_job_id: string;
16
+ CronJobList?: CronJobList;
17
+ app_name?: string;
18
+ job_name?: string;
19
+ is_latest_run: YesNo;
20
+ status: Status;
21
+ added_date_time: string;
22
+ modified_date_time: string;
23
+ }
24
+ interface CronJobList extends Record<string, unknown> {
25
+ cron_job_id: string;
26
+ app_name: string;
27
+ job_name: string;
28
+ category_name?: string;
29
+ sub_category_name?: string;
30
+ job_description?: string;
31
+ cron_expression: string;
32
+ cron_expression_description?: string;
33
+ is_enabled: YesNo;
34
+ next_run_date_time?: string;
35
+ next_run_date_time_f?: string;
36
+ run_type: RunType;
37
+ execution_status: ExecutionStatus;
38
+ start_date_time?: string;
39
+ start_date_time_f?: string;
40
+ end_date_time?: string;
41
+ end_date_time_f?: string;
42
+ error_details?: string;
43
+ success_details?: string;
44
+ status: Status;
45
+ added_date_time: string;
46
+ modified_date_time: string;
47
+ CronJobLog?: CronJobLog[];
48
+ _count?: {
49
+ CronJobLog?: number;
50
+ };
51
+ }
52
+ declare const CronMonitorQuerySchema: z.ZodObject<{
53
+ search: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
54
+ status: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof Status>, "many">>>;
55
+ paging: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof PAGING>>>;
56
+ page_count: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
57
+ page_index: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
58
+ load_parents: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof LoadParents>>>;
59
+ load_parents_list: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
60
+ load_child: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof LoadChild>>>;
61
+ load_child_list: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
62
+ load_child_count: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof LoadChildCount>>>;
63
+ load_child_count_list: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
64
+ include_details: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
65
+ where_relations: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
66
+ order_by: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
67
+ name: z.ZodEffects<z.ZodString, string, string>;
68
+ field: z.ZodEffects<z.ZodString, string, string>;
69
+ direction: z.ZodType<OrderBy, z.ZodTypeDef, OrderBy>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ name: string;
72
+ field: string;
73
+ direction: OrderBy;
74
+ }, {
75
+ name: string;
76
+ field: string;
77
+ direction: OrderBy;
78
+ }>, "many">>>;
79
+ include_master_data: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof YesNo>>>;
80
+ date_format_id: z.ZodEffects<z.ZodString, string, string>;
81
+ time_zone_id: z.ZodEffects<z.ZodString, string, string>;
82
+ } & {
83
+ is_enabled: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof YesNo>, "many">>>;
84
+ run_type: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof RunType>, "many">>>;
85
+ execution_status: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof ExecutionStatus>, "many">>>;
86
+ }, "strip", z.ZodTypeAny, {
87
+ is_enabled: YesNo[];
88
+ status: Status[];
89
+ search: string;
90
+ paging: PAGING;
91
+ page_count: number;
92
+ page_index: number;
93
+ load_parents: LoadParents;
94
+ load_parents_list: string[];
95
+ load_child: LoadChild;
96
+ load_child_list: string[];
97
+ load_child_count: LoadChildCount;
98
+ load_child_count_list: string[];
99
+ include_details: Record<string, any>;
100
+ where_relations: Record<string, any>;
101
+ order_by: {
102
+ name: string;
103
+ field: string;
104
+ direction: OrderBy;
105
+ }[];
106
+ include_master_data: YesNo;
107
+ date_format_id: string;
108
+ time_zone_id: string;
109
+ run_type: RunType[];
110
+ execution_status: ExecutionStatus[];
111
+ }, {
112
+ date_format_id: string;
113
+ time_zone_id: string;
114
+ is_enabled?: YesNo[] | undefined;
115
+ status?: Status[] | undefined;
116
+ search?: string | undefined;
117
+ paging?: PAGING | undefined;
118
+ page_count?: unknown;
119
+ page_index?: unknown;
120
+ load_parents?: LoadParents | undefined;
121
+ load_parents_list?: string[] | undefined;
122
+ load_child?: LoadChild | undefined;
123
+ load_child_list?: string[] | undefined;
124
+ load_child_count?: LoadChildCount | undefined;
125
+ load_child_count_list?: string[] | undefined;
126
+ include_details?: Record<string, any> | undefined;
127
+ where_relations?: Record<string, any> | undefined;
128
+ order_by?: {
129
+ name: string;
130
+ field: string;
131
+ direction: OrderBy;
132
+ }[] | undefined;
133
+ include_master_data?: YesNo | undefined;
134
+ run_type?: RunType[] | undefined;
135
+ execution_status?: ExecutionStatus[] | undefined;
136
+ }>;
137
+ type CronMonitorQueryDTO = z.infer<typeof CronMonitorQuerySchema>;
138
+ declare const CronJobLogQuerySchema: z.ZodObject<{
139
+ search: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
140
+ status: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof Status>, "many">>>;
141
+ paging: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof PAGING>>>;
142
+ page_count: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
143
+ page_index: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
144
+ load_parents: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof LoadParents>>>;
145
+ load_parents_list: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
146
+ load_child: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof LoadChild>>>;
147
+ load_child_list: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
148
+ load_child_count: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof LoadChildCount>>>;
149
+ load_child_count_list: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
150
+ include_details: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
151
+ where_relations: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
152
+ order_by: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
153
+ name: z.ZodEffects<z.ZodString, string, string>;
154
+ field: z.ZodEffects<z.ZodString, string, string>;
155
+ direction: z.ZodType<OrderBy, z.ZodTypeDef, OrderBy>;
156
+ }, "strip", z.ZodTypeAny, {
157
+ name: string;
158
+ field: string;
159
+ direction: OrderBy;
160
+ }, {
161
+ name: string;
162
+ field: string;
163
+ direction: OrderBy;
164
+ }>, "many">>>;
165
+ include_master_data: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof YesNo>>>;
166
+ date_format_id: z.ZodEffects<z.ZodString, string, string>;
167
+ time_zone_id: z.ZodEffects<z.ZodString, string, string>;
168
+ } & {
169
+ cron_job_ids: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
170
+ run_type: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof RunType>, "many">>>;
171
+ execution_status: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof ExecutionStatus>, "many">>>;
172
+ is_latest_run: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof YesNo>, "many">>>;
173
+ }, "strip", z.ZodTypeAny, {
174
+ status: Status[];
175
+ search: string;
176
+ paging: PAGING;
177
+ page_count: number;
178
+ page_index: number;
179
+ load_parents: LoadParents;
180
+ load_parents_list: string[];
181
+ load_child: LoadChild;
182
+ load_child_list: string[];
183
+ load_child_count: LoadChildCount;
184
+ load_child_count_list: string[];
185
+ include_details: Record<string, any>;
186
+ where_relations: Record<string, any>;
187
+ order_by: {
188
+ name: string;
189
+ field: string;
190
+ direction: OrderBy;
191
+ }[];
192
+ include_master_data: YesNo;
193
+ date_format_id: string;
194
+ time_zone_id: string;
195
+ run_type: RunType[];
196
+ execution_status: ExecutionStatus[];
197
+ is_latest_run: YesNo[];
198
+ cron_job_ids: string[];
199
+ }, {
200
+ date_format_id: string;
201
+ time_zone_id: string;
202
+ status?: Status[] | undefined;
203
+ search?: string | undefined;
204
+ paging?: PAGING | undefined;
205
+ page_count?: unknown;
206
+ page_index?: unknown;
207
+ load_parents?: LoadParents | undefined;
208
+ load_parents_list?: string[] | undefined;
209
+ load_child?: LoadChild | undefined;
210
+ load_child_list?: string[] | undefined;
211
+ load_child_count?: LoadChildCount | undefined;
212
+ load_child_count_list?: string[] | undefined;
213
+ include_details?: Record<string, any> | undefined;
214
+ where_relations?: Record<string, any> | undefined;
215
+ order_by?: {
216
+ name: string;
217
+ field: string;
218
+ direction: OrderBy;
219
+ }[] | undefined;
220
+ include_master_data?: YesNo | undefined;
221
+ run_type?: RunType[] | undefined;
222
+ execution_status?: ExecutionStatus[] | undefined;
223
+ is_latest_run?: YesNo[] | undefined;
224
+ cron_job_ids?: string[] | undefined;
225
+ }>;
226
+ type CronJobLogQueryDTO = z.infer<typeof CronJobLogQuerySchema>;
227
+ declare const getCronJobMonitor: (data: CronMonitorQueryDTO) => Promise<FBR<CronJobList[]>>;
228
+ declare const getCronJobLog: (data: CronJobLogQueryDTO) => Promise<FBR<CronJobLog[]>>;
229
+ declare const runCronJobNow: (job_name: string) => Promise<SBR>;
230
+ declare const enableCronJob: (job_name: string) => Promise<SBR>;
231
+ declare const disableCronJob: (job_name: string) => Promise<SBR>;
232
+ declare const resetCronJobs: () => Promise<SBR>;
233
+
234
+ export { type CronJobList, type CronJobLog, type CronJobLogQueryDTO, CronJobLogQuerySchema, type CronMonitorQueryDTO, CronMonitorQuerySchema, disableCronJob, enableCronJob, getCronJobLog, getCronJobMonitor, resetCronJobs, runCronJobNow };
@@ -0,0 +1,300 @@
1
+ // src/core/sdk-config.ts
2
+ var KEY = "__vms_axios_instance__";
3
+ var getAxiosInstance = () => {
4
+ const instance = globalThis[KEY];
5
+ if (!instance) {
6
+ throw new Error("\u274C Axios instance not configured. Call setAxiosInstance() first.");
7
+ }
8
+ return instance;
9
+ };
10
+
11
+ // src/core/apiCall.ts
12
+ var apiGet = async (url, params) => {
13
+ const response = await getAxiosInstance().get(url, { params });
14
+ return response.data;
15
+ };
16
+ var apiPost = async (url, data) => {
17
+ const response = await getAxiosInstance().post(url, data);
18
+ return response.data;
19
+ };
20
+
21
+ // src/zod_utils/zod_utils.ts
22
+ import { z } from "zod";
23
+
24
+ // src/core/BaseResponse.ts
25
+ var r_log = (data = {}) => {
26
+ return data;
27
+ };
28
+
29
+ // src/zod_utils/zod_utils.ts
30
+ var handleNullOrUndefined = (value) => typeof value === "string" ? value : "";
31
+ var stringMandatory = (fieldName, min = 1, max = 100) => {
32
+ const schema = z.string().trim().min(min, `${fieldName} must be at least ${min} characters.`).max(max, `${fieldName} must be at most ${max} characters.`).nonempty(`${fieldName} is required.`).transform(handleNullOrUndefined);
33
+ return schema;
34
+ };
35
+ var stringOptional = (fieldName, min = 0, max = 255, defaultValue = "") => {
36
+ const schema = z.string().trim().min(min, `${fieldName} must be at least ${min} characters.`).max(max, `${fieldName} must be at most ${max} characters.`).transform(handleNullOrUndefined).default(defaultValue);
37
+ return schema;
38
+ };
39
+ var stringArrayOptional = (fieldName, min = 0, max = 100, defaultValue = [], unique = false) => {
40
+ const schema = z.array(z.string().trim(), {
41
+ invalid_type_error: `${fieldName} must be an array of strings.`
42
+ }).min(min, `${fieldName} must contain at least ${min} items.`).max(max, `${fieldName} must contain at most ${max} items.`);
43
+ if (unique) {
44
+ schema.refine(
45
+ (arr) => new Set(arr).size === arr.length,
46
+ `${fieldName} must contain unique values.`
47
+ );
48
+ }
49
+ return schema.optional().default(defaultValue);
50
+ };
51
+ var numberOptional = (fieldName, min = 0, max = 1e14, defaultValue = 0) => {
52
+ return z.preprocess(
53
+ (val) => typeof val === "string" && val.trim() !== "" ? Number(val) : val,
54
+ z.number({ invalid_type_error: `${fieldName} must be a number.` }).min(min, `${fieldName} must be at least ${min}.`).max(max, `${fieldName} must be at most ${max}.`).optional().default(defaultValue)
55
+ );
56
+ };
57
+ var enumMandatory = (fieldName, enumType, defaultValue) => {
58
+ return z.union([
59
+ z.nativeEnum(enumType, {
60
+ invalid_type_error: `${fieldName} should be one of the following values: ${Object.values(
61
+ enumType
62
+ ).join(", ")}.`
63
+ }),
64
+ z.string().refine((val) => Object.values(enumType).includes(val), {
65
+ message: `${fieldName} should be one of the following values: ${Object.values(
66
+ enumType
67
+ ).join(", ")}.`
68
+ })
69
+ ]).default(defaultValue).refine((val) => val !== "", {
70
+ message: `Please select ${fieldName}.`
71
+ });
72
+ };
73
+ var enumOptional = (fieldName, enumType, defaultValue) => {
74
+ return z.nativeEnum(enumType, {
75
+ invalid_type_error: `${fieldName} must be an array containing only the following values: ${Object.values(
76
+ enumType
77
+ ).join(", ")}.`
78
+ }).optional().default(() => defaultValue);
79
+ };
80
+ var getAllEnums = (enumType) => {
81
+ return Object.values(enumType);
82
+ };
83
+ var enumArrayOptional = (fieldName, enumType, defaultValue = getAllEnums(enumType), min = 0, max = 100, unique = false) => {
84
+ const schema = z.array(z.nativeEnum(enumType), {
85
+ invalid_type_error: `${fieldName} must be an array containing only the following values: ${Object.values(
86
+ enumType
87
+ ).join(", ")}.`
88
+ }).min(min, `${fieldName} must contain at least ${min} items.`).max(max, `${fieldName} must contain at most ${max} items.`);
89
+ if (unique) {
90
+ schema.refine(
91
+ (arr) => new Set(arr).size === arr.length,
92
+ `${fieldName} must contain unique values.`
93
+ );
94
+ }
95
+ return schema.optional().default(() => defaultValue);
96
+ };
97
+ var dynamicJsonSchema = (fieldName, defaultValue = {}) => z.record(z.any()).optional().default(() => defaultValue);
98
+ var single_select_optional = (fieldName) => {
99
+ r_log(fieldName);
100
+ const schema = z.string().trim().transform(handleNullOrUndefined);
101
+ return schema;
102
+ };
103
+ var multi_select_optional = (fieldName, max = 1e3, defaultValue = []) => {
104
+ const schema = z.array(
105
+ z.string({
106
+ invalid_type_error: `${fieldName} must be an array of strings.`
107
+ })
108
+ ).max(
109
+ max,
110
+ `Please select at most ${max} ${fieldName}${max > 1 ? "s" : ""}.`
111
+ );
112
+ return schema.optional().default(defaultValue);
113
+ };
114
+
115
+ // src/zod_utils/zod_base_schema.ts
116
+ import { z as z2 } from "zod";
117
+
118
+ // src/core/Enums.ts
119
+ var PAGING = /* @__PURE__ */ ((PAGING2) => {
120
+ PAGING2["Yes"] = "Yes";
121
+ PAGING2["No"] = "No";
122
+ return PAGING2;
123
+ })(PAGING || {});
124
+ var LoadParents = /* @__PURE__ */ ((LoadParents2) => {
125
+ LoadParents2["Yes"] = "Yes";
126
+ LoadParents2["No"] = "No";
127
+ LoadParents2["Custom"] = "Custom";
128
+ return LoadParents2;
129
+ })(LoadParents || {});
130
+ var LoadChild = /* @__PURE__ */ ((LoadChild2) => {
131
+ LoadChild2["No"] = "No";
132
+ LoadChild2["Yes"] = "Yes";
133
+ LoadChild2["Count"] = "Count";
134
+ LoadChild2["Custom"] = "Custom";
135
+ LoadChild2["Direct"] = "Direct";
136
+ return LoadChild2;
137
+ })(LoadChild || {});
138
+ var LoadChildCount = /* @__PURE__ */ ((LoadChildCount2) => {
139
+ LoadChildCount2["No"] = "No";
140
+ LoadChildCount2["Yes"] = "Yes";
141
+ LoadChildCount2["Custom"] = "Custom";
142
+ return LoadChildCount2;
143
+ })(LoadChildCount || {});
144
+ var OrderBy = /* @__PURE__ */ ((OrderBy2) => {
145
+ OrderBy2["asc"] = "asc";
146
+ OrderBy2["desc"] = "desc";
147
+ return OrderBy2;
148
+ })(OrderBy || {});
149
+ var LoginFrom = /* @__PURE__ */ ((LoginFrom2) => {
150
+ LoginFrom2["Web"] = "Web";
151
+ LoginFrom2["Android"] = "Android";
152
+ LoginFrom2["IPhone"] = "IPhone";
153
+ LoginFrom2["AndroidPWA"] = "AndroidPWA";
154
+ LoginFrom2["iOSPWA"] = "iOSPWA";
155
+ return LoginFrom2;
156
+ })(LoginFrom || {});
157
+ var Status = /* @__PURE__ */ ((Status3) => {
158
+ Status3["Active"] = "Active";
159
+ Status3["Inactive"] = "Inactive";
160
+ return Status3;
161
+ })(Status || {});
162
+ var FileType = /* @__PURE__ */ ((FileType2) => {
163
+ FileType2["NoFile"] = "NoFile";
164
+ FileType2["Image"] = "Image";
165
+ FileType2["Video"] = "Video";
166
+ FileType2["PDF"] = "PDF";
167
+ FileType2["Excel"] = "Excel";
168
+ return FileType2;
169
+ })(FileType || {});
170
+ var YesNo = /* @__PURE__ */ ((YesNo2) => {
171
+ YesNo2["Yes"] = "Yes";
172
+ YesNo2["No"] = "No";
173
+ return YesNo2;
174
+ })(YesNo || {});
175
+ var ExecutionStatus = /* @__PURE__ */ ((ExecutionStatus2) => {
176
+ ExecutionStatus2["REGISTERED"] = "REGISTERED";
177
+ ExecutionStatus2["FIRED"] = "FIRED";
178
+ ExecutionStatus2["RUNNING"] = "RUNNING";
179
+ ExecutionStatus2["SUCCESS"] = "SUCCESS";
180
+ ExecutionStatus2["FAILED"] = "FAILED";
181
+ return ExecutionStatus2;
182
+ })(ExecutionStatus || {});
183
+ var RunType = /* @__PURE__ */ ((RunType2) => {
184
+ RunType2["SCHEDULED"] = "SCHEDULED";
185
+ RunType2["MANUAL"] = "MANUAL";
186
+ return RunType2;
187
+ })(RunType || {});
188
+
189
+ // src/zod_utils/zod_base_schema.ts
190
+ var OrderBySchema = z2.array(
191
+ z2.object({
192
+ name: stringMandatory("Order Field Name", 0, 255),
193
+ field: stringMandatory("Order Field Name", 0, 255),
194
+ direction: enumMandatory("Order Direction", OrderBy, "asc" /* asc */)
195
+ })
196
+ );
197
+ var BaseFileSchema = z2.object({
198
+ usage_type: stringMandatory("Usage Type", 3, 100),
199
+ file_type: enumMandatory("File Type", FileType, "Image" /* Image */),
200
+ file_url: stringOptional("File URL", 0, 300),
201
+ file_key: stringOptional("File Key", 0, 300),
202
+ file_name: stringOptional("File Name", 0, 300),
203
+ file_description: stringOptional("File Description", 0, 2e3),
204
+ file_size: numberOptional("File Size"),
205
+ file_metadata: dynamicJsonSchema("File Metadata", {}),
206
+ status: enumMandatory("Status", Status, "Active" /* Active */)
207
+ });
208
+ var BaseQuerySchema = z2.object({
209
+ search: stringOptional("Search", 0, 255, ""),
210
+ status: enumArrayOptional("Status", Status, getAllEnums(Status), 0, 10, true),
211
+ paging: enumOptional("Paging", PAGING, "Yes" /* Yes */),
212
+ page_count: numberOptional("Page Count", 0, 1e3, 100),
213
+ page_index: numberOptional("Page Index", 0, 1e3, 0),
214
+ load_parents: enumOptional("Load Parents", LoadParents, "No" /* No */),
215
+ load_parents_list: stringArrayOptional("Load Parents List"),
216
+ load_child: enumOptional("Load Child", LoadChild, "No" /* No */),
217
+ load_child_list: stringArrayOptional("Load Child List"),
218
+ load_child_count: enumOptional(
219
+ "Load Child",
220
+ LoadChildCount,
221
+ "No" /* No */
222
+ ),
223
+ load_child_count_list: stringArrayOptional("Load Child List"),
224
+ include_details: dynamicJsonSchema("Include Details", {}),
225
+ where_relations: dynamicJsonSchema("Where Relations", {}),
226
+ order_by: OrderBySchema.optional().default([]),
227
+ include_master_data: enumOptional("Include Master Data", YesNo, "No" /* No */),
228
+ date_format_id: single_select_optional("MasterMainDateFormat"),
229
+ time_zone_id: single_select_optional("MasterMainTimeZone")
230
+ });
231
+ var FilePresignedUrlSchema = z2.object({
232
+ file_name: stringMandatory("File Name", 1, 255),
233
+ file_type: enumMandatory("File Type", FileType, "Image" /* Image */)
234
+ });
235
+ var MongoBaseQuerySchema = z2.object({
236
+ search: stringOptional("Search", 0, 255, ""),
237
+ paging: enumOptional("Paging", PAGING, "Yes" /* Yes */),
238
+ page_count: numberOptional("Page Count", 0, 1e3, 100),
239
+ page_index: numberOptional("Page Index", 0, 1e3, 0),
240
+ login_from: enumMandatory("Login From", LoginFrom, "Web" /* Web */),
241
+ date_format_id: single_select_optional("MasterMainDateFormat"),
242
+ // ✅ Single-selection -> MasterMainDateFormat
243
+ time_zone_id: single_select_optional("MasterMainTimeZone")
244
+ // ✅ Single-selection -> MasterMainTimeZone
245
+ });
246
+
247
+ // src/services/core/cronjobs.service.ts
248
+ var URL = "cronjobs";
249
+ var ENDPOINTS = {
250
+ // Monitor & Logs APIs
251
+ monitor: `${URL}/monitor`,
252
+ cron_job_log: `${URL}/cron_job_log/search`,
253
+ // Controls
254
+ cron_job_run_now: (job_name) => `${URL}/cron_job_run_now/${job_name}`,
255
+ cron_job_enable: (job_name) => `${URL}/cron_job_enable/${job_name}`,
256
+ cron_job_disable: (job_name) => `${URL}/cron_job_disable/${job_name}`,
257
+ cron_jobs_reset: `${URL}/cron_jobs_reset`
258
+ };
259
+ var CronMonitorQuerySchema = BaseQuerySchema.extend({
260
+ is_enabled: enumArrayOptional("Is Enabled", YesNo),
261
+ run_type: enumArrayOptional("Run Type", RunType),
262
+ execution_status: enumArrayOptional("Execution Status", ExecutionStatus)
263
+ });
264
+ var CronJobLogQuerySchema = BaseQuerySchema.extend({
265
+ // Relations - Parent
266
+ cron_job_ids: multi_select_optional("CronJobList"),
267
+ // Multi-selection -> CronJobList
268
+ // Enums
269
+ run_type: enumArrayOptional("Run Type", RunType),
270
+ execution_status: enumArrayOptional("Execution Status", ExecutionStatus),
271
+ is_latest_run: enumArrayOptional("Is Latest Run", YesNo)
272
+ });
273
+ var getCronJobMonitor = async (data) => {
274
+ return apiPost(ENDPOINTS.monitor, data);
275
+ };
276
+ var getCronJobLog = async (data) => {
277
+ return apiPost(ENDPOINTS.cron_job_log, data);
278
+ };
279
+ var runCronJobNow = async (job_name) => {
280
+ return apiGet(ENDPOINTS.cron_job_run_now(job_name));
281
+ };
282
+ var enableCronJob = async (job_name) => {
283
+ return apiGet(ENDPOINTS.cron_job_enable(job_name));
284
+ };
285
+ var disableCronJob = async (job_name) => {
286
+ return apiGet(ENDPOINTS.cron_job_disable(job_name));
287
+ };
288
+ var resetCronJobs = async () => {
289
+ return apiGet(ENDPOINTS.cron_jobs_reset);
290
+ };
291
+ export {
292
+ CronJobLogQuerySchema,
293
+ CronMonitorQuerySchema,
294
+ disableCronJob,
295
+ enableCronJob,
296
+ getCronJobLog,
297
+ getCronJobMonitor,
298
+ resetCronJobs,
299
+ runCronJobNow
300
+ };