@venulog/phasing-engine-schemas 0.13.3-alpha.1 → 0.13.3-alpha.2

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.
@@ -7,3 +7,4 @@ export * from './accessEventType.js';
7
7
  export * from './positionSource.js';
8
8
  export * from './cameraTrigger.js';
9
9
  export * from './simulationMode.js';
10
+ export * from './vehicleAccessAction.js';
@@ -8,3 +8,4 @@ export * from './accessEventType.js';
8
8
  export * from './positionSource.js';
9
9
  export * from './cameraTrigger.js';
10
10
  export * from './simulationMode.js';
11
+ export * from './vehicleAccessAction.js';
@@ -0,0 +1,7 @@
1
+ export declare enum VehicleAccessAction {
2
+ ENTERING_BUFFER = "entering_buffer",// PL vehicle enters Buffer Parking
3
+ EXIT_BUFFER = "exit_buffer",// PL vehicle exits Buffer Parking
4
+ ENTERING_EVENT_SITE = "entering_event_site",// PL vehicle enters the Event Site
5
+ EXIT_EVENT_SITE = "exit_event_site"
6
+ }
7
+ export declare const VEHICLE_ACCESS_ACTION_LABELS: Record<VehicleAccessAction, string>;
@@ -0,0 +1,15 @@
1
+ // Vehicle access action enumeration for PL vehicle tracking
2
+ // Defines the different checkpoint actions for heavy vehicles (PL) during event logistics
3
+ export var VehicleAccessAction;
4
+ (function (VehicleAccessAction) {
5
+ VehicleAccessAction["ENTERING_BUFFER"] = "entering_buffer";
6
+ VehicleAccessAction["EXIT_BUFFER"] = "exit_buffer";
7
+ VehicleAccessAction["ENTERING_EVENT_SITE"] = "entering_event_site";
8
+ VehicleAccessAction["EXIT_EVENT_SITE"] = "exit_event_site"; // PL vehicle exits the Event Site
9
+ })(VehicleAccessAction || (VehicleAccessAction = {}));
10
+ export const VEHICLE_ACCESS_ACTION_LABELS = {
11
+ [VehicleAccessAction.ENTERING_BUFFER]: 'Entering Buffer Parking',
12
+ [VehicleAccessAction.EXIT_BUFFER]: 'Exit Buffer Parking',
13
+ [VehicleAccessAction.ENTERING_EVENT_SITE]: 'Entering Event Site',
14
+ [VehicleAccessAction.EXIT_EVENT_SITE]: 'Exit Event Site'
15
+ };
@@ -3,6 +3,7 @@ import { z } from './zod.js';
3
3
  import { availableTimeSlotV2Schema } from './parkingArea.js';
4
4
  import { UnloadingType } from './enums/unloadingType.js';
5
5
  import { ParkingAreaScheduleType } from './enums/parkingAreaScheduleType.js';
6
+ import { VehicleAccessAction } from './enums/vehicleAccessAction.js';
6
7
  export declare const geometrySchema: z.ZodNullable<z.ZodObject<{
7
8
  type: z.ZodEnum<{
8
9
  Point: "Point";
@@ -240,26 +241,38 @@ export declare const closeEventResponseSchema: z.ZodObject<{
240
241
  reason: z.ZodNullable<z.ZodString>;
241
242
  }, z.core.$strip>;
242
243
  }, z.core.$strip>;
243
- export declare const confirmAccessBodySchema: z.ZodObject<{
244
- event_id: z.ZodNumber;
244
+ export declare const confirmActionBodySchema: z.ZodObject<{
245
+ action: z.ZodEnum<{
246
+ entering_buffer: VehicleAccessAction.ENTERING_BUFFER;
247
+ exit_buffer: VehicleAccessAction.EXIT_BUFFER;
248
+ entering_event_site: VehicleAccessAction.ENTERING_EVENT_SITE;
249
+ exit_event_site: VehicleAccessAction.EXIT_EVENT_SITE;
250
+ }>;
245
251
  plate_number: z.ZodOptional<z.ZodObject<{
246
- url: z.ZodString;
247
- name: z.ZodString;
248
- path: z.ZodString;
249
- size: z.ZodNumber;
250
- type: z.ZodString;
251
- bucket: z.ZodString;
252
+ url: z.ZodURL;
253
+ name: z.ZodOptional<z.ZodString>;
254
+ size: z.ZodOptional<z.ZodNumber>;
255
+ bucket: z.ZodOptional<z.ZodString>;
256
+ type: z.ZodOptional<z.ZodString>;
257
+ path: z.ZodOptional<z.ZodString>;
252
258
  }, z.core.$strip>>;
253
259
  }, z.core.$strip>;
254
- export declare const confirmAccessDataSchema: z.ZodObject<{
260
+ export declare const confirmActionParamsSchema: z.ZodObject<{
255
261
  bookingId: z.ZodCoercedNumber<unknown>;
256
262
  }, z.core.$strip>;
257
- export declare const confirmAccessResponseSchema: z.ZodObject<{
263
+ export declare const confirmActionResponseSchema: z.ZodObject<{
258
264
  success: z.ZodBoolean;
259
265
  message: z.ZodString;
260
266
  data: z.ZodObject<{
261
267
  booking_id: z.ZodNumber;
268
+ action: z.ZodString;
262
269
  scanned_at: z.ZodString;
270
+ scan_record_id: z.ZodNumber;
271
+ available_actions: z.ZodArray<z.ZodString>;
272
+ completed_actions: z.ZodArray<z.ZodObject<{
273
+ action: z.ZodString;
274
+ completed_at: z.ZodString;
275
+ }, z.core.$strip>>;
263
276
  }, z.core.$strip>;
264
277
  }, z.core.$strip>;
265
278
  export declare const checkSlotAvailabilityBodySchema: z.ZodObject<{
@@ -559,6 +572,8 @@ export declare const parkingBookingWithRelationsSchema: z.ZodObject<{
559
572
  is_fast_track_access: z.ZodBoolean;
560
573
  license_plate_image_url: z.ZodNullable<z.ZodString>;
561
574
  applicant_badge_image_url: z.ZodNullable<z.ZodString>;
575
+ buffer_entry_scanned_at: z.ZodNullable<z.ZodString>;
576
+ buffer_exit_scanned_at: z.ZodNullable<z.ZodString>;
562
577
  }, z.core.$strip>;
563
578
  export declare const getParkingBookingDetailsParamsSchema: z.ZodObject<{
564
579
  bookingId: z.ZodCoercedNumber<unknown>;
@@ -622,6 +637,13 @@ export declare const parkingBookingDetailsDataSchema: z.ZodObject<{
622
637
  is_fast_track_access: z.ZodBoolean;
623
638
  license_plate_image_url: z.ZodNullable<z.ZodString>;
624
639
  applicant_badge_image_url: z.ZodNullable<z.ZodString>;
640
+ available_actions: z.ZodArray<z.ZodString>;
641
+ completed_actions: z.ZodArray<z.ZodObject<{
642
+ action: z.ZodString;
643
+ completed_at: z.ZodString;
644
+ }, z.core.$strip>>;
645
+ buffer_entry_scanned_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
646
+ buffer_exit_scanned_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
625
647
  }, z.core.$strip>;
626
648
  export declare const getParkingBookingDetailsResponseSchema: z.ZodObject<{
627
649
  success: z.ZodBoolean;
@@ -684,6 +706,13 @@ export declare const getParkingBookingDetailsResponseSchema: z.ZodObject<{
684
706
  is_fast_track_access: z.ZodBoolean;
685
707
  license_plate_image_url: z.ZodNullable<z.ZodString>;
686
708
  applicant_badge_image_url: z.ZodNullable<z.ZodString>;
709
+ available_actions: z.ZodArray<z.ZodString>;
710
+ completed_actions: z.ZodArray<z.ZodObject<{
711
+ action: z.ZodString;
712
+ completed_at: z.ZodString;
713
+ }, z.core.$strip>>;
714
+ buffer_entry_scanned_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
715
+ buffer_exit_scanned_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
687
716
  }, z.core.$strip>;
688
717
  }, z.core.$strip>;
689
718
  export declare const getParkingBookingDetailsByTokenBodySchema: z.ZodObject<{
@@ -728,6 +757,13 @@ export declare const parkingBookingDetailsByTokenDataSchema: z.ZodObject<{
728
757
  is_fast_track_access: z.ZodBoolean;
729
758
  license_plate_image_url: z.ZodNullable<z.ZodString>;
730
759
  applicant_badge_image_url: z.ZodNullable<z.ZodString>;
760
+ available_actions: z.ZodArray<z.ZodString>;
761
+ completed_actions: z.ZodArray<z.ZodObject<{
762
+ action: z.ZodString;
763
+ completed_at: z.ZodString;
764
+ }, z.core.$strip>>;
765
+ buffer_entry_scanned_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
766
+ buffer_exit_scanned_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
731
767
  company: z.ZodObject<{
732
768
  hall: z.ZodNullable<z.ZodOptional<z.ZodString>>;
733
769
  stand_number: z.ZodOptional<z.ZodString>;
@@ -790,6 +826,13 @@ export declare const getParkingBookingDetailsByTokenResponseSchema: z.ZodObject<
790
826
  is_fast_track_access: z.ZodBoolean;
791
827
  license_plate_image_url: z.ZodNullable<z.ZodString>;
792
828
  applicant_badge_image_url: z.ZodNullable<z.ZodString>;
829
+ available_actions: z.ZodArray<z.ZodString>;
830
+ completed_actions: z.ZodArray<z.ZodObject<{
831
+ action: z.ZodString;
832
+ completed_at: z.ZodString;
833
+ }, z.core.$strip>>;
834
+ buffer_entry_scanned_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
835
+ buffer_exit_scanned_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
793
836
  company: z.ZodObject<{
794
837
  hall: z.ZodNullable<z.ZodOptional<z.ZodString>>;
795
838
  stand_number: z.ZodOptional<z.ZodString>;
@@ -1062,7 +1105,6 @@ export type CloseEventBody = z.infer<typeof closeEventBodySchema>;
1062
1105
  export type CloseEventData = z.infer<typeof closeEventDataSchema>;
1063
1106
  export type CloseEventResponse = z.infer<typeof closeEventResponseSchema>;
1064
1107
  export type EventBookingsResponse = z.infer<typeof eventBookingsResponseSchema>;
1065
- export type ConfirmVehicleAccessData = z.infer<typeof confirmAccessBodySchema>;
1066
1108
  export type ConfirmBookingParams = z.infer<typeof confirmBookingParamsSchema>;
1067
1109
  export type ConfirmBookingResponse = z.infer<typeof confirmBookingResponseSchema>;
1068
1110
  export type CreateBookingBody = z.infer<typeof createParkingBookingBodySchema>;
@@ -1092,6 +1134,6 @@ export type UpdateParkingBookingResponse = z.infer<typeof updateParkingBookingRe
1092
1134
  export type CreateFastTrackBookingBody = z.infer<typeof createFastTrackBookingBodySchema>;
1093
1135
  export type CreateFastTrackBookingData = z.infer<typeof createFastTrackBookingDataSchema>;
1094
1136
  export type CreateFastTrackBookingResponse = z.infer<typeof createFastTrackBookingResponseSchema>;
1095
- export type ConfirmAccessBody = z.infer<typeof confirmAccessBodySchema>;
1096
- export type ConfirmAccessData = z.infer<typeof confirmAccessDataSchema>;
1097
- export type ConfirmAccessResponse = z.infer<typeof confirmAccessResponseSchema>;
1137
+ export type ConfirmActionParams = z.infer<typeof confirmActionParamsSchema>;
1138
+ export type ConfirmActionResponse = z.infer<typeof confirmActionResponseSchema>;
1139
+ export type ConfirmActionBody = z.infer<typeof confirmActionBodySchema>;
@@ -6,6 +6,7 @@ import { z } from './zod.js';
6
6
  import { availableTimeSlotV2Schema, getAvailableSlotsBodyV2Schema } from './parkingArea.js';
7
7
  import { UnloadingType } from './enums/unloadingType.js';
8
8
  import { ParkingAreaScheduleType } from './enums/parkingAreaScheduleType.js';
9
+ import { VehicleAccessAction } from './enums/vehicleAccessAction.js';
9
10
  // PostGIS geometry schema (GeoJSON-like structure)
10
11
  export const geometrySchema = z
11
12
  .object({
@@ -232,53 +233,84 @@ export const closeEventDataSchema = z
232
233
  })
233
234
  .openapi('CloseEventData');
234
235
  export const closeEventResponseSchema = createMessageDataResponseSchema(closeEventDataSchema, 'CloseEventResponse', 'Event phase closed successfully', 'Details of the closed event phase');
235
- export const confirmAccessBodySchema = z.object({
236
- event_id: z.number().openapi({
237
- description: 'ID of the event',
238
- example: 1
236
+ // ------------------------------
237
+ // Confirm Action (PL vehicles only) schemas
238
+ // ------------------------------
239
+ export const confirmActionBodySchema = z
240
+ .object({
241
+ action: z
242
+ .enum([
243
+ VehicleAccessAction.ENTERING_BUFFER,
244
+ VehicleAccessAction.EXIT_BUFFER,
245
+ VehicleAccessAction.ENTERING_EVENT_SITE,
246
+ VehicleAccessAction.EXIT_EVENT_SITE
247
+ ])
248
+ .openapi({
249
+ description: 'Vehicle access action (only for PL vehicles)',
250
+ example: VehicleAccessAction.ENTERING_BUFFER
239
251
  }),
240
- plate_number: z
241
- .object({
242
- url: z.string().openapi({
243
- description: 'Public URL of the plate number',
244
- example: 'https://example.net/xxxx.jpeg'
245
- }),
246
- name: z.string().openapi({
247
- description: 'Name of the plate number file',
248
- example: ''
249
- }),
250
- path: z.string().openapi({
251
- description: 'Path of the plate number',
252
- example: ''
253
- }),
254
- size: z.number().openapi({
255
- description: 'File size of the plate number',
256
- example: ''
257
- }),
258
- type: z.string().openapi({
259
- description: 'File type of the plate number',
260
- example: ''
261
- }),
262
- bucket: z.string().openapi({
263
- description: 'Storage bucket name',
264
- example: 'XXXXX'
265
- })
266
- })
267
- .optional()
268
- });
269
- export const confirmAccessDataSchema = z.object({
252
+ plate_number: documentSchema.optional()
253
+ })
254
+ .openapi('ConfirmActionBody');
255
+ export const confirmActionParamsSchema = z
256
+ .object({
270
257
  bookingId: z.coerce.number().int().positive({
271
258
  message: 'Booking ID must be a positive integer'
272
259
  })
273
- });
274
- export const confirmAccessResponseSchema = z.object({
260
+ })
261
+ .openapi('ConfirmActionParams');
262
+ export const confirmActionResponseSchema = z
263
+ .object({
275
264
  success: z.boolean(),
276
265
  message: z.string(),
277
266
  data: z.object({
278
- booking_id: z.number(),
279
- scanned_at: z.string()
267
+ booking_id: z.number().openapi({
268
+ description: 'ID of the booking',
269
+ example: 123
270
+ }),
271
+ action: z.string().openapi({
272
+ description: 'The action that was recorded',
273
+ example: 'entering_buffer'
274
+ }),
275
+ scanned_at: z.string().openapi({
276
+ description: 'Timestamp when the action was recorded',
277
+ example: '2025-01-30T10:30:00.000Z'
278
+ }),
279
+ scan_record_id: z.number().openapi({
280
+ description: 'ID of the created scan record',
281
+ example: 456
282
+ }),
283
+ available_actions: z.array(z.string()).openapi({
284
+ description: 'List of actions still available for this booking after the current action',
285
+ example: ['exit_buffer', 'entering_event_site', 'exit_event_site']
286
+ }),
287
+ completed_actions: z
288
+ .array(z.object({
289
+ action: z.string().openapi({
290
+ description: 'The completed action',
291
+ example: 'entering_buffer'
292
+ }),
293
+ completed_at: z.string().openapi({
294
+ description: 'Timestamp when the action was completed',
295
+ example: '2025-01-30T10:15:00.000Z'
296
+ })
297
+ }))
298
+ .openapi({
299
+ description: 'List of all vehicle actions that have been completed with timestamps',
300
+ example: [
301
+ {
302
+ action: 'entering_buffer',
303
+ completed_at: '2025-01-30T10:15:00.000Z'
304
+ },
305
+ {
306
+ action: 'entering_event_site',
307
+ completed_at: '2025-01-30T10:30:00.000Z'
308
+ }
309
+ ]
310
+ })
280
311
  })
281
- });
312
+ })
313
+ .openapi('ConfirmActionResponse');
282
314
  // ------------------------------
283
315
  // Check Slot Availability schemas
284
316
  // ------------------------------
@@ -535,7 +567,9 @@ export const parkingBookingWithRelationsSchema = z
535
567
  is_custom_slot: z.boolean(),
536
568
  is_fast_track_access: z.boolean(),
537
569
  license_plate_image_url: z.string().nullable(),
538
- applicant_badge_image_url: z.string().nullable()
570
+ applicant_badge_image_url: z.string().nullable(),
571
+ buffer_entry_scanned_at: z.string().nullable(),
572
+ buffer_exit_scanned_at: z.string().nullable()
539
573
  })
540
574
  .openapi('ParkingBookingWithRelations');
541
575
  // ------------------------------
@@ -683,10 +717,42 @@ export const parkingBookingDetailsDataSchema = z
683
717
  applicant_badge_image_url: z.string().nullable().openapi({
684
718
  description: 'URL of the applicant badge image',
685
719
  example: 'https://example.com/applicant-badge.jpg'
720
+ }),
721
+ available_actions: z.array(z.string()).openapi({
722
+ description: 'List of vehicle actions available for this booking',
723
+ example: ['entering_buffer', 'exit_buffer', 'entering_event_site', 'exit_event_site']
724
+ }),
725
+ completed_actions: z
726
+ .array(z.object({
727
+ action: z.string().openapi({
728
+ description: 'The completed action',
729
+ example: 'entering_buffer'
730
+ }),
731
+ completed_at: z.string().openapi({
732
+ description: 'Timestamp when the action was completed',
733
+ example: '2025-01-30T10:15:00.000Z'
734
+ })
735
+ }))
736
+ .openapi({
737
+ description: 'List of vehicle actions that have been completed with timestamps',
738
+ example: [
739
+ {
740
+ action: 'entering_buffer',
741
+ completed_at: '2025-01-30T10:15:00.000Z'
742
+ }
743
+ ]
744
+ }),
745
+ buffer_entry_scanned_at: z.string().nullable().optional().openapi({
746
+ description: 'Timestamp when buffer entry was scanned',
747
+ example: '2025-12-15T08:05:00.000Z'
748
+ }),
749
+ buffer_exit_scanned_at: z.string().nullable().optional().openapi({
750
+ description: 'Timestamp when buffer exit was scanned',
751
+ example: '2025-12-15T08:25:00.000Z'
686
752
  })
687
753
  })
688
754
  .openapi('ParkingBookingDetailsData');
689
- export const getParkingBookingDetailsResponseSchema = createSuccessResponseSchema(parkingBookingDetailsDataSchema, 'GetParkingBookingDetailsResponse', 'Booking details with access pass information');
755
+ export const getParkingBookingDetailsResponseSchema = createSuccessResponseSchema(parkingBookingDetailsDataSchema, 'GetParkingBookingDetailsResponse', 'Booking details with access pass information and available vehicle actions');
690
756
  // ------------------------------
691
757
  // Get booking details by token schemas
692
758
  // ------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venulog/phasing-engine-schemas",
3
- "version": "0.13.3-alpha.1",
3
+ "version": "0.13.3-alpha.2",
4
4
  "description": "Shared schemas and types for Phasing Engine API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",