@venulog/phasing-engine-schemas 0.2.0-alpha.2 → 0.2.1

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/README.md CHANGED
@@ -1,67 +1,67 @@
1
- # @venulog/phasing-engine-schemas
2
-
3
- Shared schemas and types for Phasing Engine API. Provides Zod validation schemas, TypeScript types, and OpenAPI documentation support.
4
-
5
- ## Installation
6
-
7
- This package is designed to be used as a local workspace package:
8
-
9
- ```bash
10
- npm install @venulog/phasing-engine-schemas
11
- ```
12
-
13
- ## Usage
14
-
15
- ```typescript
16
- import {
17
- phaseBookingSchema,
18
- PhaseBooking,
19
- BookingStatus,
20
- SlotStatus
21
- } from '@venulog/phasing-engine-schemas';
22
-
23
- // Use schemas for validation
24
- const booking = phaseBookingSchema.parse(data);
25
-
26
- // Use types for type safety
27
- const createBooking = (booking: PhaseBooking) => {
28
- // ...
29
- };
30
-
31
- // Use enums for status values
32
- if (booking.status === BookingStatus.CONFIRMED) {
33
- // ...
34
- }
35
- ```
36
-
37
- ## Available Exports
38
-
39
- ### Schemas
40
-
41
- - `auth` - Authentication related schemas
42
- - `common` - Base response schemas and factory functions
43
- - `pagination` - Pagination and sorting schemas
44
- - `phaseBooking` - Phase booking operation schemas
45
- - `phaseSlot` - Phase slot management schemas
46
-
47
- ### Enums
48
-
49
- - `BookingStatus` - Booking status values
50
- - `SlotStatus` - Slot status values
51
-
52
- ### Types
53
-
54
- All schemas export corresponding TypeScript types using Zod's `z.infer<>`.
55
-
56
- ## Development
57
-
58
- ```bash
59
- # Build the package
60
- npm run build
61
-
62
- # Watch mode for development
63
- npm run dev
64
-
65
- # Clean build artifacts
66
- npm run clean
67
- ```
1
+ # @venulog/phasing-engine-schemas
2
+
3
+ Shared schemas and types for Phasing Engine API. Provides Zod validation schemas, TypeScript types, and OpenAPI documentation support.
4
+
5
+ ## Installation
6
+
7
+ This package is designed to be used as a local workspace package:
8
+
9
+ ```bash
10
+ npm install @venulog/phasing-engine-schemas
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```typescript
16
+ import {
17
+ phaseBookingSchema,
18
+ PhaseBooking,
19
+ BookingStatus,
20
+ SlotStatus
21
+ } from '@venulog/phasing-engine-schemas';
22
+
23
+ // Use schemas for validation
24
+ const booking = phaseBookingSchema.parse(data);
25
+
26
+ // Use types for type safety
27
+ const createBooking = (booking: PhaseBooking) => {
28
+ // ...
29
+ };
30
+
31
+ // Use enums for status values
32
+ if (booking.status === BookingStatus.CONFIRMED) {
33
+ // ...
34
+ }
35
+ ```
36
+
37
+ ## Available Exports
38
+
39
+ ### Schemas
40
+
41
+ - `auth` - Authentication related schemas
42
+ - `common` - Base response schemas and factory functions
43
+ - `pagination` - Pagination and sorting schemas
44
+ - `phaseBooking` - Phase booking operation schemas
45
+ - `phaseSlot` - Phase slot management schemas
46
+
47
+ ### Enums
48
+
49
+ - `BookingStatus` - Booking status values
50
+ - `SlotStatus` - Slot status values
51
+
52
+ ### Types
53
+
54
+ All schemas export corresponding TypeScript types using Zod's `z.infer<>`.
55
+
56
+ ## Development
57
+
58
+ ```bash
59
+ # Build the package
60
+ npm run build
61
+
62
+ # Watch mode for development
63
+ npm run dev
64
+
65
+ # Clean build artifacts
66
+ npm run clean
67
+ ```
@@ -75,11 +75,27 @@ export declare const phaseBookingSchema: z.ZodObject<{
75
75
  updated_at: z.ZodString;
76
76
  created_by: z.ZodNullable<z.ZodString>;
77
77
  updated_by: z.ZodNullable<z.ZodString>;
78
- vehicle: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
78
+ booking_date: z.ZodNullable<z.ZodString>;
79
+ start_time: z.ZodNullable<z.ZodString>;
80
+ end_time: z.ZodNullable<z.ZodString>;
79
81
  company: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
80
- booking_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
81
- start_time: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
- end_time: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
+ vehicle: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
83
+ phase_slot_schedule: z.ZodOptional<z.ZodObject<{
84
+ id: z.ZodNumber;
85
+ date: z.ZodString;
86
+ start_time: z.ZodString;
87
+ end_time: z.ZodString;
88
+ duration: z.ZodNumber;
89
+ phase_slot_id: z.ZodNumber;
90
+ phase_slot_schedule_type: z.ZodEnum<{
91
+ assembly: PhaseSlotScheduleType.ASSEMBLY;
92
+ dismantling: PhaseSlotScheduleType.DISMANTLING;
93
+ }>;
94
+ created_at: z.ZodString;
95
+ updated_at: z.ZodString;
96
+ created_by: z.ZodNullable<z.ZodUUID>;
97
+ updated_by: z.ZodNullable<z.ZodUUID>;
98
+ }, z.core.$strip>>;
83
99
  }, z.core.$strip>;
84
100
  export declare const companyDetailsSchema: z.ZodObject<{
85
101
  company_role: z.ZodString;
@@ -207,11 +223,27 @@ export declare const eventBookingsDataSchema: z.ZodObject<{
207
223
  updated_at: z.ZodString;
208
224
  created_by: z.ZodNullable<z.ZodString>;
209
225
  updated_by: z.ZodNullable<z.ZodString>;
210
- vehicle: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
226
+ booking_date: z.ZodNullable<z.ZodString>;
227
+ start_time: z.ZodNullable<z.ZodString>;
228
+ end_time: z.ZodNullable<z.ZodString>;
211
229
  company: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
212
- booking_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
213
- start_time: z.ZodOptional<z.ZodNullable<z.ZodString>>;
214
- end_time: z.ZodOptional<z.ZodNullable<z.ZodString>>;
230
+ vehicle: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
231
+ phase_slot_schedule: z.ZodOptional<z.ZodObject<{
232
+ id: z.ZodNumber;
233
+ date: z.ZodString;
234
+ start_time: z.ZodString;
235
+ end_time: z.ZodString;
236
+ duration: z.ZodNumber;
237
+ phase_slot_id: z.ZodNumber;
238
+ phase_slot_schedule_type: z.ZodEnum<{
239
+ assembly: PhaseSlotScheduleType.ASSEMBLY;
240
+ dismantling: PhaseSlotScheduleType.DISMANTLING;
241
+ }>;
242
+ created_at: z.ZodString;
243
+ updated_at: z.ZodString;
244
+ created_by: z.ZodNullable<z.ZodUUID>;
245
+ updated_by: z.ZodNullable<z.ZodUUID>;
246
+ }, z.core.$strip>>;
215
247
  }, z.core.$strip>>;
216
248
  total_count: z.ZodNumber;
217
249
  }, z.core.$strip>;
@@ -230,11 +262,27 @@ export declare const eventBookingsResponseSchema: z.ZodObject<{
230
262
  updated_at: z.ZodString;
231
263
  created_by: z.ZodNullable<z.ZodString>;
232
264
  updated_by: z.ZodNullable<z.ZodString>;
233
- vehicle: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
265
+ booking_date: z.ZodNullable<z.ZodString>;
266
+ start_time: z.ZodNullable<z.ZodString>;
267
+ end_time: z.ZodNullable<z.ZodString>;
234
268
  company: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
235
- booking_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
236
- start_time: z.ZodOptional<z.ZodNullable<z.ZodString>>;
237
- end_time: z.ZodOptional<z.ZodNullable<z.ZodString>>;
269
+ vehicle: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
270
+ phase_slot_schedule: z.ZodOptional<z.ZodObject<{
271
+ id: z.ZodNumber;
272
+ date: z.ZodString;
273
+ start_time: z.ZodString;
274
+ end_time: z.ZodString;
275
+ duration: z.ZodNumber;
276
+ phase_slot_id: z.ZodNumber;
277
+ phase_slot_schedule_type: z.ZodEnum<{
278
+ assembly: PhaseSlotScheduleType.ASSEMBLY;
279
+ dismantling: PhaseSlotScheduleType.DISMANTLING;
280
+ }>;
281
+ created_at: z.ZodString;
282
+ updated_at: z.ZodString;
283
+ created_by: z.ZodNullable<z.ZodUUID>;
284
+ updated_by: z.ZodNullable<z.ZodUUID>;
285
+ }, z.core.$strip>>;
238
286
  }, z.core.$strip>>;
239
287
  total_count: z.ZodNumber;
240
288
  }, z.core.$strip>;
@@ -270,7 +318,7 @@ export declare const confirmBookingResponseSchema: z.ZodObject<{
270
318
  data: z.ZodObject<{
271
319
  booking_id: z.ZodNumber;
272
320
  booking_status: z.ZodEnum<typeof BookingStatus>;
273
- slot_id: z.ZodNumber;
321
+ schedule_id: z.ZodNumber;
274
322
  confirmed_at: z.ZodString;
275
323
  confirmed_by: z.ZodNullable<z.ZodString>;
276
324
  }, z.core.$strip>;
@@ -283,7 +331,7 @@ export declare const refuseBookingDataSchema: z.ZodObject<{
283
331
  booking_status: z.ZodEnum<{
284
332
  refused: BookingStatus.REFUSED;
285
333
  }>;
286
- slot_id: z.ZodNumber;
334
+ schedule_id: z.ZodNumber;
287
335
  refused_at: z.ZodString;
288
336
  refused_by: z.ZodNullable<z.ZodString>;
289
337
  }, z.core.$strip>;
@@ -295,7 +343,7 @@ export declare const refuseBookingResponseSchema: z.ZodObject<{
295
343
  booking_status: z.ZodEnum<{
296
344
  refused: BookingStatus.REFUSED;
297
345
  }>;
298
- slot_id: z.ZodNumber;
346
+ schedule_id: z.ZodNumber;
299
347
  refused_at: z.ZodString;
300
348
  refused_by: z.ZodNullable<z.ZodString>;
301
349
  }, z.core.$strip>;
@@ -136,11 +136,13 @@ export const phaseBookingSchema = z.object({
136
136
  updated_at: z.string(),
137
137
  created_by: z.string().nullable(),
138
138
  updated_by: z.string().nullable(),
139
- vehicle: z.record(z.string(), z.unknown()).nullable().optional(),
139
+ booking_date: z.string().nullable(),
140
+ start_time: z.string().nullable(),
141
+ end_time: z.string().nullable(),
140
142
  company: z.record(z.string(), z.unknown()).nullable().optional(),
141
- booking_date: z.string().nullable().optional(),
142
- start_time: z.string().nullable().optional(),
143
- end_time: z.string().nullable().optional()
143
+ vehicle: z.record(z.string(), z.unknown()).nullable().optional(),
144
+ // Include the schedule details
145
+ phase_slot_schedule: phaseSlotScheduleSchema.optional()
144
146
  });
145
147
  export const companyDetailsSchema = z
146
148
  .object({
@@ -344,14 +346,17 @@ export const confirmBookingParamsSchema = z.object({
344
346
  message: 'Booking ID must be a positive integer'
345
347
  })
346
348
  });
347
- // Response schema
349
+ // Updated confirm booking response to include schedule_id instead of slot_id
348
350
  export const confirmBookingResponseSchema = z.object({
349
351
  success: z.boolean(),
350
352
  message: z.string(),
351
353
  data: z.object({
352
354
  booking_id: z.number(),
353
355
  booking_status: z.enum(BookingStatus),
354
- slot_id: z.number(),
356
+ schedule_id: z.number().openapi({
357
+ description: 'ID of the phase slot schedule',
358
+ example: 456
359
+ }),
355
360
  confirmed_at: z.string(),
356
361
  confirmed_by: z.string().nullable()
357
362
  })
@@ -370,7 +375,7 @@ export const refuseBookingParamsSchema = z
370
375
  })
371
376
  })
372
377
  .openapi('RefuseBookingParams');
373
- // Response data schema for refuse endpoint
378
+ // Updated refuse booking response to include schedule_id instead of slot_id
374
379
  export const refuseBookingDataSchema = z
375
380
  .object({
376
381
  booking_id: z.number().openapi({
@@ -381,9 +386,9 @@ export const refuseBookingDataSchema = z
381
386
  description: 'New status of the booking',
382
387
  example: BookingStatus.REFUSED
383
388
  }),
384
- slot_id: z.number().openapi({
385
- description: 'ID of the associated phase slot',
386
- example: 10
389
+ schedule_id: z.number().openapi({
390
+ description: 'ID of the associated phase slot schedule',
391
+ example: 456
387
392
  }),
388
393
  refused_at: z.string().openapi({
389
394
  description: 'ISO 8601 timestamp when the booking was refused',
@@ -395,7 +400,6 @@ export const refuseBookingDataSchema = z
395
400
  })
396
401
  })
397
402
  .openapi('RefuseBookingData');
398
- // Response schema for refuse endpoint
399
403
  export const refuseBookingResponseSchema = createMessageDataResponseSchema(refuseBookingDataSchema, 'RefuseBookingResponse', 'Phase booking refused successfully', 'Details of the refused booking');
400
404
  // ------------------------------
401
405
  // Create Phase Slots schemas
package/package.json CHANGED
@@ -1,67 +1,67 @@
1
- {
2
- "name": "@venulog/phasing-engine-schemas",
3
- "version": "0.2.0-alpha.2",
4
- "description": "Shared schemas and types for Phasing Engine API",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
12
- },
13
- "./auth": {
14
- "types": "./dist/auth.d.ts",
15
- "import": "./dist/auth.js"
16
- },
17
- "./common": {
18
- "types": "./dist/common.d.ts",
19
- "import": "./dist/common.js"
20
- },
21
- "./pagination": {
22
- "types": "./dist/pagination.d.ts",
23
- "import": "./dist/pagination.js"
24
- },
25
- "./phaseBooking": {
26
- "types": "./dist/phaseBooking.d.ts",
27
- "import": "./dist/phaseBooking.js"
28
- },
29
- "./phaseSlot": {
30
- "types": "./dist/phaseSlot.d.ts",
31
- "import": "./dist/phaseSlot.js"
32
- },
33
- "./event": {
34
- "types": "./dist/event.d.ts",
35
- "import": "./dist/event.js"
36
- }
37
- },
38
- "files": [
39
- "dist"
40
- ],
41
- "scripts": {
42
- "build": "npm run clean && tsc",
43
- "dev": "tsc --watch",
44
- "clean": "rm -rf dist",
45
- "prepublishOnly": "npm run build"
46
- },
47
- "keywords": [
48
- "schemas",
49
- "validation",
50
- "types",
51
- "zod",
52
- "phasing-engine"
53
- ],
54
- "license": "MIT",
55
- "dependencies": {
56
- "@asteasolutions/zod-to-openapi": "^8.1.0",
57
- "zod": "^4.1.13"
58
- },
59
- "devDependencies": {
60
- "typescript": "^5.6.3"
61
- },
62
- "repository": {
63
- "type": "git",
64
- "url": "git+https://github.com/manaty/phasing_engine.git",
65
- "directory": "packages/phasing-schemas"
66
- }
67
- }
1
+ {
2
+ "name": "@venulog/phasing-engine-schemas",
3
+ "version": "0.2.1",
4
+ "description": "Shared schemas and types for Phasing Engine API",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./auth": {
14
+ "types": "./dist/auth.d.ts",
15
+ "import": "./dist/auth.js"
16
+ },
17
+ "./common": {
18
+ "types": "./dist/common.d.ts",
19
+ "import": "./dist/common.js"
20
+ },
21
+ "./pagination": {
22
+ "types": "./dist/pagination.d.ts",
23
+ "import": "./dist/pagination.js"
24
+ },
25
+ "./phaseBooking": {
26
+ "types": "./dist/phaseBooking.d.ts",
27
+ "import": "./dist/phaseBooking.js"
28
+ },
29
+ "./phaseSlot": {
30
+ "types": "./dist/phaseSlot.d.ts",
31
+ "import": "./dist/phaseSlot.js"
32
+ },
33
+ "./event": {
34
+ "types": "./dist/event.d.ts",
35
+ "import": "./dist/event.js"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist"
40
+ ],
41
+ "scripts": {
42
+ "build": "npm run clean && tsc",
43
+ "dev": "tsc --watch",
44
+ "clean": "rm -rf dist",
45
+ "prepublishOnly": "npm run build"
46
+ },
47
+ "keywords": [
48
+ "schemas",
49
+ "validation",
50
+ "types",
51
+ "zod",
52
+ "phasing-engine"
53
+ ],
54
+ "license": "MIT",
55
+ "dependencies": {
56
+ "@asteasolutions/zod-to-openapi": "^8.1.0",
57
+ "zod": "^4.1.13"
58
+ },
59
+ "devDependencies": {
60
+ "typescript": "^5.6.3"
61
+ },
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "git+https://github.com/manaty/phasing_engine.git",
65
+ "directory": "packages/phasing-schemas"
66
+ }
67
+ }