@vulog/aima-unavailability 1.2.7 → 1.2.8

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.
@@ -0,0 +1,46 @@
1
+ import { Client } from '@vulog/aima-client';
2
+
3
+ type Unavailability = {
4
+ id: string;
5
+ cronExpression: string;
6
+ duration: number;
7
+ maintenanceTitle: string;
8
+ vehicleId: string;
9
+ };
10
+ type CreateUnavailabilityBody = {
11
+ cronExpression: string;
12
+ duration: number;
13
+ maintenanceTitle: string;
14
+ vehicleId: string;
15
+ };
16
+ type UpdateUnavailabilityBody = CreateUnavailabilityBody;
17
+ type UnavailabilityOptions = {
18
+ from: string;
19
+ to: string;
20
+ page?: number;
21
+ };
22
+
23
+ declare const getUnavailabilitiesByVehicle: (client: Client, vehicleId: string) => Promise<Unavailability[]>;
24
+
25
+ declare const getUnavailabilities: (client: Client, options: UnavailabilityOptions) => Promise<Unavailability[]>;
26
+
27
+ declare const createUnavailability: (client: Client, body: CreateUnavailabilityBody) => Promise<Unavailability>;
28
+
29
+ declare const updateUnavailability: (client: Client, id: string, body: UpdateUnavailabilityBody) => Promise<Unavailability>;
30
+
31
+ declare const deleteUnavailability: (client: Client, id: string) => Promise<void>;
32
+
33
+ /**
34
+ * Generates a Quartz cron expression from a date.
35
+ * Format: second minute hour day month dayOfWeek year
36
+ * Example: "0 0 23 14 8 ? 2018"
37
+ *
38
+ * @param date - The date to convert to cron expression (Date object or ISO string)
39
+ * @param timezone - Optional timezone string (e.g., "Europe/Paris", "America/New_York")
40
+ * If provided, the date will be converted to the specified timezone.
41
+ * If not provided, the date will be used as-is.
42
+ * @returns A cron expression string in Quartz format
43
+ */
44
+ declare const generateCronExpression: (date: Date | string, timezone?: string) => string;
45
+
46
+ export { type CreateUnavailabilityBody, type Unavailability, type UnavailabilityOptions, type UpdateUnavailabilityBody, createUnavailability, deleteUnavailability, generateCronExpression, getUnavailabilities, getUnavailabilitiesByVehicle, updateUnavailability };
@@ -0,0 +1,46 @@
1
+ import { Client } from '@vulog/aima-client';
2
+
3
+ type Unavailability = {
4
+ id: string;
5
+ cronExpression: string;
6
+ duration: number;
7
+ maintenanceTitle: string;
8
+ vehicleId: string;
9
+ };
10
+ type CreateUnavailabilityBody = {
11
+ cronExpression: string;
12
+ duration: number;
13
+ maintenanceTitle: string;
14
+ vehicleId: string;
15
+ };
16
+ type UpdateUnavailabilityBody = CreateUnavailabilityBody;
17
+ type UnavailabilityOptions = {
18
+ from: string;
19
+ to: string;
20
+ page?: number;
21
+ };
22
+
23
+ declare const getUnavailabilitiesByVehicle: (client: Client, vehicleId: string) => Promise<Unavailability[]>;
24
+
25
+ declare const getUnavailabilities: (client: Client, options: UnavailabilityOptions) => Promise<Unavailability[]>;
26
+
27
+ declare const createUnavailability: (client: Client, body: CreateUnavailabilityBody) => Promise<Unavailability>;
28
+
29
+ declare const updateUnavailability: (client: Client, id: string, body: UpdateUnavailabilityBody) => Promise<Unavailability>;
30
+
31
+ declare const deleteUnavailability: (client: Client, id: string) => Promise<void>;
32
+
33
+ /**
34
+ * Generates a Quartz cron expression from a date.
35
+ * Format: second minute hour day month dayOfWeek year
36
+ * Example: "0 0 23 14 8 ? 2018"
37
+ *
38
+ * @param date - The date to convert to cron expression (Date object or ISO string)
39
+ * @param timezone - Optional timezone string (e.g., "Europe/Paris", "America/New_York")
40
+ * If provided, the date will be converted to the specified timezone.
41
+ * If not provided, the date will be used as-is.
42
+ * @returns A cron expression string in Quartz format
43
+ */
44
+ declare const generateCronExpression: (date: Date | string, timezone?: string) => string;
45
+
46
+ export { type CreateUnavailabilityBody, type Unavailability, type UnavailabilityOptions, type UpdateUnavailabilityBody, createUnavailability, deleteUnavailability, generateCronExpression, getUnavailabilities, getUnavailabilitiesByVehicle, updateUnavailability };
package/dist/index.js ADDED
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ createUnavailability: () => createUnavailability,
24
+ deleteUnavailability: () => deleteUnavailability,
25
+ generateCronExpression: () => generateCronExpression,
26
+ getUnavailabilities: () => getUnavailabilities,
27
+ getUnavailabilitiesByVehicle: () => getUnavailabilitiesByVehicle,
28
+ updateUnavailability: () => updateUnavailability
29
+ });
30
+ module.exports = __toCommonJS(index_exports);
31
+
32
+ // src/getUnavailabilitiesByVehicle.ts
33
+ var import_zod = require("zod");
34
+ var schema = import_zod.z.object({
35
+ vehicleId: import_zod.z.string().trim().min(1).uuid()
36
+ });
37
+ var getUnavailabilitiesByVehicle = async (client, vehicleId) => {
38
+ const result = schema.safeParse({ vehicleId });
39
+ if (!result.success) {
40
+ throw new TypeError("Invalid args", {
41
+ cause: result.error.issues
42
+ });
43
+ }
44
+ return client.get(
45
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability/vehicles/${result.data.vehicleId}`
46
+ ).then(({ data }) => data).catch((error) => {
47
+ if (error.formattedError?.status === 404) {
48
+ return [];
49
+ }
50
+ throw error;
51
+ });
52
+ };
53
+
54
+ // src/getUnavailabilities.ts
55
+ var import_zod2 = require("zod");
56
+ var schema2 = import_zod2.z.object({
57
+ from: import_zod2.z.string().datetime({ offset: false, precision: 0 }),
58
+ to: import_zod2.z.string().datetime({ offset: false, precision: 0 }),
59
+ page: import_zod2.z.number().int().nonnegative().default(0)
60
+ });
61
+ var getUnavailabilities = async (client, options) => {
62
+ const result = schema2.safeParse({
63
+ from: options.from,
64
+ to: options.to,
65
+ page: options.page ?? 0
66
+ });
67
+ if (!result.success) {
68
+ throw new TypeError("Invalid args", {
69
+ cause: result.error.issues
70
+ });
71
+ }
72
+ const allUnavailabilities = [];
73
+ let currentPage = result.data.page;
74
+ let hasMorePages = true;
75
+ const MAX_PAGES = 50;
76
+ while (hasMorePages) {
77
+ if (currentPage >= MAX_PAGES) {
78
+ throw new Error(
79
+ `Maximum page limit (${MAX_PAGES}) reached. This might indicate an issue with the pagination or a very large dataset.`
80
+ );
81
+ }
82
+ const queryParams = new URLSearchParams({
83
+ from: result.data.from,
84
+ to: result.data.to,
85
+ page: currentPage.toString()
86
+ });
87
+ const unavailabilities = await client.get(
88
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability/vehicles?${queryParams.toString()}`
89
+ ).then(({ data }) => data).catch((error) => {
90
+ if (error.formattedError?.status === 404) {
91
+ return [];
92
+ }
93
+ throw error;
94
+ });
95
+ allUnavailabilities.push(...unavailabilities);
96
+ hasMorePages = unavailabilities.length > 0;
97
+ currentPage += 1;
98
+ }
99
+ return allUnavailabilities;
100
+ };
101
+
102
+ // src/createUnavailability.ts
103
+ var import_zod3 = require("zod");
104
+ var schema3 = import_zod3.z.object({
105
+ cronExpression: import_zod3.z.string().min(1),
106
+ duration: import_zod3.z.number().int().positive(),
107
+ maintenanceTitle: import_zod3.z.string().min(1),
108
+ vehicleId: import_zod3.z.string().uuid()
109
+ });
110
+ var createUnavailability = async (client, body) => {
111
+ const result = schema3.safeParse(body);
112
+ if (!result.success) {
113
+ throw new TypeError("Invalid args", {
114
+ cause: result.error.issues
115
+ });
116
+ }
117
+ return client.post(
118
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability`,
119
+ {
120
+ cronExpression: result.data.cronExpression,
121
+ duration: result.data.duration,
122
+ maintenanceTitle: result.data.maintenanceTitle,
123
+ vehicleId: result.data.vehicleId
124
+ }
125
+ ).then(({ data }) => data);
126
+ };
127
+
128
+ // src/updateUnavailability.ts
129
+ var import_zod4 = require("zod");
130
+ var schema4 = import_zod4.z.object({
131
+ id: import_zod4.z.string().trim().min(1).uuid(),
132
+ cronExpression: import_zod4.z.string().min(1),
133
+ duration: import_zod4.z.number().int().positive(),
134
+ maintenanceTitle: import_zod4.z.string().min(1),
135
+ vehicleId: import_zod4.z.string().uuid()
136
+ });
137
+ var updateUnavailability = async (client, id, body) => {
138
+ const result = schema4.safeParse({
139
+ id,
140
+ ...body
141
+ });
142
+ if (!result.success) {
143
+ throw new TypeError("Invalid args", {
144
+ cause: result.error.issues
145
+ });
146
+ }
147
+ return client.put(
148
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability/${result.data.id}`,
149
+ {
150
+ cronExpression: result.data.cronExpression,
151
+ duration: result.data.duration,
152
+ maintenanceTitle: result.data.maintenanceTitle,
153
+ vehicleId: result.data.vehicleId
154
+ }
155
+ ).then(({ data }) => data);
156
+ };
157
+
158
+ // src/deleteUnavailability.ts
159
+ var import_zod5 = require("zod");
160
+ var schema5 = import_zod5.z.object({
161
+ id: import_zod5.z.string().trim().min(1).uuid()
162
+ });
163
+ var deleteUnavailability = async (client, id) => {
164
+ const result = schema5.safeParse({ id });
165
+ if (!result.success) {
166
+ throw new TypeError("Invalid args", {
167
+ cause: result.error.issues
168
+ });
169
+ }
170
+ return client.delete(
171
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability/${result.data.id}`
172
+ ).then(() => void 0).catch((error) => {
173
+ if (error.formattedError?.status === 404) {
174
+ return void 0;
175
+ }
176
+ throw error;
177
+ });
178
+ };
179
+
180
+ // src/generateCronExpression.ts
181
+ var generateCronExpression = (date, timezone) => {
182
+ let dateObj;
183
+ if (typeof date === "string") {
184
+ dateObj = new Date(date);
185
+ } else {
186
+ dateObj = new Date(date);
187
+ }
188
+ if (Number.isNaN(dateObj.getTime())) {
189
+ throw new TypeError("Invalid date provided");
190
+ }
191
+ if (timezone) {
192
+ const formatter = new Intl.DateTimeFormat("en-US", {
193
+ timeZone: timezone,
194
+ year: "numeric",
195
+ month: "2-digit",
196
+ day: "2-digit",
197
+ hour: "2-digit",
198
+ minute: "2-digit",
199
+ second: "2-digit",
200
+ hour12: false
201
+ });
202
+ const parts = formatter.formatToParts(dateObj);
203
+ const year2 = parseInt(parts.find((p) => p.type === "year")?.value || "0", 10);
204
+ const month2 = parseInt(parts.find((p) => p.type === "month")?.value || "0", 10);
205
+ const day2 = parseInt(parts.find((p) => p.type === "day")?.value || "0", 10);
206
+ const hour2 = parseInt(parts.find((p) => p.type === "hour")?.value || "0", 10);
207
+ const minute2 = parseInt(parts.find((p) => p.type === "minute")?.value || "0", 10);
208
+ const second2 = parseInt(parts.find((p) => p.type === "second")?.value || "0", 10);
209
+ return `${second2} ${minute2} ${hour2} ${day2} ${month2} ? ${year2}`;
210
+ }
211
+ const year = dateObj.getFullYear();
212
+ const month = dateObj.getMonth() + 1;
213
+ const day = dateObj.getDate();
214
+ const hour = dateObj.getHours();
215
+ const minute = dateObj.getMinutes();
216
+ const second = dateObj.getSeconds();
217
+ return `${second} ${minute} ${hour} ${day} ${month} ? ${year}`;
218
+ };
219
+ // Annotate the CommonJS export names for ESM import in node:
220
+ 0 && (module.exports = {
221
+ createUnavailability,
222
+ deleteUnavailability,
223
+ generateCronExpression,
224
+ getUnavailabilities,
225
+ getUnavailabilitiesByVehicle,
226
+ updateUnavailability
227
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,195 @@
1
+ // src/getUnavailabilitiesByVehicle.ts
2
+ import { z } from "zod";
3
+ var schema = z.object({
4
+ vehicleId: z.string().trim().min(1).uuid()
5
+ });
6
+ var getUnavailabilitiesByVehicle = async (client, vehicleId) => {
7
+ const result = schema.safeParse({ vehicleId });
8
+ if (!result.success) {
9
+ throw new TypeError("Invalid args", {
10
+ cause: result.error.issues
11
+ });
12
+ }
13
+ return client.get(
14
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability/vehicles/${result.data.vehicleId}`
15
+ ).then(({ data }) => data).catch((error) => {
16
+ if (error.formattedError?.status === 404) {
17
+ return [];
18
+ }
19
+ throw error;
20
+ });
21
+ };
22
+
23
+ // src/getUnavailabilities.ts
24
+ import { z as z2 } from "zod";
25
+ var schema2 = z2.object({
26
+ from: z2.string().datetime({ offset: false, precision: 0 }),
27
+ to: z2.string().datetime({ offset: false, precision: 0 }),
28
+ page: z2.number().int().nonnegative().default(0)
29
+ });
30
+ var getUnavailabilities = async (client, options) => {
31
+ const result = schema2.safeParse({
32
+ from: options.from,
33
+ to: options.to,
34
+ page: options.page ?? 0
35
+ });
36
+ if (!result.success) {
37
+ throw new TypeError("Invalid args", {
38
+ cause: result.error.issues
39
+ });
40
+ }
41
+ const allUnavailabilities = [];
42
+ let currentPage = result.data.page;
43
+ let hasMorePages = true;
44
+ const MAX_PAGES = 50;
45
+ while (hasMorePages) {
46
+ if (currentPage >= MAX_PAGES) {
47
+ throw new Error(
48
+ `Maximum page limit (${MAX_PAGES}) reached. This might indicate an issue with the pagination or a very large dataset.`
49
+ );
50
+ }
51
+ const queryParams = new URLSearchParams({
52
+ from: result.data.from,
53
+ to: result.data.to,
54
+ page: currentPage.toString()
55
+ });
56
+ const unavailabilities = await client.get(
57
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability/vehicles?${queryParams.toString()}`
58
+ ).then(({ data }) => data).catch((error) => {
59
+ if (error.formattedError?.status === 404) {
60
+ return [];
61
+ }
62
+ throw error;
63
+ });
64
+ allUnavailabilities.push(...unavailabilities);
65
+ hasMorePages = unavailabilities.length > 0;
66
+ currentPage += 1;
67
+ }
68
+ return allUnavailabilities;
69
+ };
70
+
71
+ // src/createUnavailability.ts
72
+ import { z as z3 } from "zod";
73
+ var schema3 = z3.object({
74
+ cronExpression: z3.string().min(1),
75
+ duration: z3.number().int().positive(),
76
+ maintenanceTitle: z3.string().min(1),
77
+ vehicleId: z3.string().uuid()
78
+ });
79
+ var createUnavailability = async (client, body) => {
80
+ const result = schema3.safeParse(body);
81
+ if (!result.success) {
82
+ throw new TypeError("Invalid args", {
83
+ cause: result.error.issues
84
+ });
85
+ }
86
+ return client.post(
87
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability`,
88
+ {
89
+ cronExpression: result.data.cronExpression,
90
+ duration: result.data.duration,
91
+ maintenanceTitle: result.data.maintenanceTitle,
92
+ vehicleId: result.data.vehicleId
93
+ }
94
+ ).then(({ data }) => data);
95
+ };
96
+
97
+ // src/updateUnavailability.ts
98
+ import { z as z4 } from "zod";
99
+ var schema4 = z4.object({
100
+ id: z4.string().trim().min(1).uuid(),
101
+ cronExpression: z4.string().min(1),
102
+ duration: z4.number().int().positive(),
103
+ maintenanceTitle: z4.string().min(1),
104
+ vehicleId: z4.string().uuid()
105
+ });
106
+ var updateUnavailability = async (client, id, body) => {
107
+ const result = schema4.safeParse({
108
+ id,
109
+ ...body
110
+ });
111
+ if (!result.success) {
112
+ throw new TypeError("Invalid args", {
113
+ cause: result.error.issues
114
+ });
115
+ }
116
+ return client.put(
117
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability/${result.data.id}`,
118
+ {
119
+ cronExpression: result.data.cronExpression,
120
+ duration: result.data.duration,
121
+ maintenanceTitle: result.data.maintenanceTitle,
122
+ vehicleId: result.data.vehicleId
123
+ }
124
+ ).then(({ data }) => data);
125
+ };
126
+
127
+ // src/deleteUnavailability.ts
128
+ import { z as z5 } from "zod";
129
+ var schema5 = z5.object({
130
+ id: z5.string().trim().min(1).uuid()
131
+ });
132
+ var deleteUnavailability = async (client, id) => {
133
+ const result = schema5.safeParse({ id });
134
+ if (!result.success) {
135
+ throw new TypeError("Invalid args", {
136
+ cause: result.error.issues
137
+ });
138
+ }
139
+ return client.delete(
140
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability/${result.data.id}`
141
+ ).then(() => void 0).catch((error) => {
142
+ if (error.formattedError?.status === 404) {
143
+ return void 0;
144
+ }
145
+ throw error;
146
+ });
147
+ };
148
+
149
+ // src/generateCronExpression.ts
150
+ var generateCronExpression = (date, timezone) => {
151
+ let dateObj;
152
+ if (typeof date === "string") {
153
+ dateObj = new Date(date);
154
+ } else {
155
+ dateObj = new Date(date);
156
+ }
157
+ if (Number.isNaN(dateObj.getTime())) {
158
+ throw new TypeError("Invalid date provided");
159
+ }
160
+ if (timezone) {
161
+ const formatter = new Intl.DateTimeFormat("en-US", {
162
+ timeZone: timezone,
163
+ year: "numeric",
164
+ month: "2-digit",
165
+ day: "2-digit",
166
+ hour: "2-digit",
167
+ minute: "2-digit",
168
+ second: "2-digit",
169
+ hour12: false
170
+ });
171
+ const parts = formatter.formatToParts(dateObj);
172
+ const year2 = parseInt(parts.find((p) => p.type === "year")?.value || "0", 10);
173
+ const month2 = parseInt(parts.find((p) => p.type === "month")?.value || "0", 10);
174
+ const day2 = parseInt(parts.find((p) => p.type === "day")?.value || "0", 10);
175
+ const hour2 = parseInt(parts.find((p) => p.type === "hour")?.value || "0", 10);
176
+ const minute2 = parseInt(parts.find((p) => p.type === "minute")?.value || "0", 10);
177
+ const second2 = parseInt(parts.find((p) => p.type === "second")?.value || "0", 10);
178
+ return `${second2} ${minute2} ${hour2} ${day2} ${month2} ? ${year2}`;
179
+ }
180
+ const year = dateObj.getFullYear();
181
+ const month = dateObj.getMonth() + 1;
182
+ const day = dateObj.getDate();
183
+ const hour = dateObj.getHours();
184
+ const minute = dateObj.getMinutes();
185
+ const second = dateObj.getSeconds();
186
+ return `${second} ${minute} ${hour} ${day} ${month} ? ${year}`;
187
+ };
188
+ export {
189
+ createUnavailability,
190
+ deleteUnavailability,
191
+ generateCronExpression,
192
+ getUnavailabilities,
193
+ getUnavailabilitiesByVehicle,
194
+ updateUnavailability
195
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulog/aima-unavailability",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -19,8 +19,8 @@
19
19
  "author": "Vulog",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@vulog/aima-client": "1.2.7",
23
- "@vulog/aima-core": "1.2.7"
22
+ "@vulog/aima-client": "1.2.8",
23
+ "@vulog/aima-core": "1.2.8"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "zod": "^3.25.76"
package/API_SUMMARY.md DELETED
@@ -1,36 +0,0 @@
1
- # Vulog Unavailability API Calls - Summary
2
-
3
- ## Implemented API Endpoints
4
-
5
- ### 1. GET `/boapi/proxy/user/fleets/{fleetId}/scheduledRules/unavailability/vehicles/{vehicleId}`
6
- Lists all unavailability rules for a specific vehicle. Returns array of `Unavailability` objects. Returns empty array on 404.
7
-
8
- ### 2. GET `/boapi/proxy/user/fleets/{fleetId}/scheduledRules/unavailability/vehicles`
9
- Lists unavailability rules with date range filtering and pagination. Query parameters: `from` (ISO date), `to` (ISO date), `page` (number). Automatically iterates through pages until no more results.
10
-
11
- ### 3. POST `/boapi/proxy/user/fleets/{fleetId}/scheduledRules/unavailability`
12
- Creates a new unavailability rule. Request body: `{ cronExpression, duration, maintenanceTitle, vehicleId }`. Returns created `Unavailability` object.
13
-
14
- ### 4. PUT `/boapi/proxy/user/fleets/{fleetId}/scheduledRules/unavailability/{id}`
15
- Updates an existing unavailability rule. Request body same as POST. Returns updated `Unavailability` object.
16
-
17
- ### 5. DELETE `/boapi/proxy/user/fleets/{fleetId}/scheduledRules/unavailability/{id}`
18
- Deletes an unavailability rule by ID. Idempotent - returns successfully if already deleted (404).
19
-
20
- ## Utility Function
21
-
22
- ### `generateCronExpression(date: Date | string, timezone?: string): string`
23
- Generates Quartz cron expression from a date. Supports timezone conversion. Format: `second minute hour day month ? year`.
24
-
25
- ## Type Definitions
26
-
27
- ```typescript
28
- type Unavailability = {
29
- id: string;
30
- cronExpression: string;
31
- duration: number;
32
- maintenanceTitle: string;
33
- vehicleId: string;
34
- };
35
- ```
36
-