@venulog/phasing-engine-schemas 0.7.6-alpha.0 → 0.7.6
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/dist/camera.d.ts +219 -0
- package/dist/camera.js +227 -0
- package/dist/enums/accessEventType.d.ts +8 -0
- package/dist/enums/accessEventType.js +17 -0
- package/dist/enums/cameraTrigger.d.ts +7 -0
- package/dist/enums/cameraTrigger.js +15 -0
- package/dist/enums/index.d.ts +5 -0
- package/dist/enums/index.js +5 -0
- package/dist/enums/positionSource.d.ts +7 -0
- package/dist/enums/positionSource.js +15 -0
- package/dist/enums/simulationMode.d.ts +11 -0
- package/dist/enums/simulationMode.js +20 -0
- package/dist/enums/vehicleState.d.ts +13 -0
- package/dist/enums/vehicleState.js +37 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/parkingAreaAccess.d.ts +400 -0
- package/dist/parkingAreaAccess.js +466 -0
- package/dist/parkingAreaLayer.d.ts +354 -0
- package/dist/parkingAreaLayer.js +385 -0
- package/dist/parkingBooking.d.ts +24 -23
- package/dist/parkingBooking.js +5 -1
- package/dist/simulation.d.ts +171 -0
- package/dist/simulation.js +231 -0
- package/dist/vehiclePosition.d.ts +216 -0
- package/dist/vehiclePosition.js +237 -0
- package/package.json +21 -1
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { z } from './zod.js';
|
|
2
|
+
import { PositionSource } from './enums/positionSource.js';
|
|
3
|
+
import { VehicleState } from './enums/vehicleState.js';
|
|
4
|
+
import { VehicleType } from './enums/vehicleType.js';
|
|
5
|
+
import { createSuccessResponseSchema } from './common.js';
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Enums as Zod schemas
|
|
8
|
+
// ============================================================================
|
|
9
|
+
export const positionSourceSchema = z.enum([
|
|
10
|
+
PositionSource.GPS,
|
|
11
|
+
PositionSource.SIMULATED,
|
|
12
|
+
PositionSource.INFERRED,
|
|
13
|
+
PositionSource.MANUAL
|
|
14
|
+
]);
|
|
15
|
+
export const vehicleStateSchema = z.enum([
|
|
16
|
+
VehicleState.BOOKED,
|
|
17
|
+
VehicleState.APPROACHING,
|
|
18
|
+
VehicleState.AT_GATE,
|
|
19
|
+
VehicleState.ENTERING,
|
|
20
|
+
VehicleState.PARKED,
|
|
21
|
+
VehicleState.DEPARTING,
|
|
22
|
+
VehicleState.AT_EXIT,
|
|
23
|
+
VehicleState.EXITED,
|
|
24
|
+
VehicleState.HISTORICAL
|
|
25
|
+
]);
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// Site Plan Position Schema (0-100% coordinates)
|
|
28
|
+
// ============================================================================
|
|
29
|
+
export const sitePlanPositionSchema = z
|
|
30
|
+
.object({
|
|
31
|
+
x: z.number().min(0).max(100).openapi({
|
|
32
|
+
description: 'X coordinate on site plan (0-100%)',
|
|
33
|
+
example: 45.5
|
|
34
|
+
}),
|
|
35
|
+
y: z.number().min(0).max(100).openapi({
|
|
36
|
+
description: 'Y coordinate on site plan (0-100%)',
|
|
37
|
+
example: 32.8
|
|
38
|
+
}),
|
|
39
|
+
heading: z.number().min(0).max(360).optional().openapi({
|
|
40
|
+
description: 'Direction of travel in degrees (0-360)',
|
|
41
|
+
example: 90
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
.openapi('SitePlanPosition');
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// GPS Coordinates Schema
|
|
47
|
+
// ============================================================================
|
|
48
|
+
export const gpsCoordinatesSchema = z
|
|
49
|
+
.object({
|
|
50
|
+
latitude: z.number().min(-90).max(90).openapi({
|
|
51
|
+
description: 'Latitude coordinate',
|
|
52
|
+
example: 48.8566
|
|
53
|
+
}),
|
|
54
|
+
longitude: z.number().min(-180).max(180).openapi({
|
|
55
|
+
description: 'Longitude coordinate',
|
|
56
|
+
example: 2.3522
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
.openapi('GpsCoordinates');
|
|
60
|
+
// ============================================================================
|
|
61
|
+
// Report Position Request (from Mobile App)
|
|
62
|
+
// ============================================================================
|
|
63
|
+
export const reportPositionBodySchema = z
|
|
64
|
+
.object({
|
|
65
|
+
booking_id: z.number().int().positive().openapi({
|
|
66
|
+
description: 'ID of the parking booking',
|
|
67
|
+
example: 123
|
|
68
|
+
}),
|
|
69
|
+
access_token: z.string().min(1).openapi({
|
|
70
|
+
description: 'JWT access token from booking',
|
|
71
|
+
example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
|
|
72
|
+
}),
|
|
73
|
+
latitude: z.number().min(-90).max(90).openapi({
|
|
74
|
+
description: 'GPS latitude',
|
|
75
|
+
example: 48.8566
|
|
76
|
+
}),
|
|
77
|
+
longitude: z.number().min(-180).max(180).openapi({
|
|
78
|
+
description: 'GPS longitude',
|
|
79
|
+
example: 2.3522
|
|
80
|
+
}),
|
|
81
|
+
heading: z.number().min(0).max(360).optional().openapi({
|
|
82
|
+
description: 'Direction of travel in degrees',
|
|
83
|
+
example: 90
|
|
84
|
+
}),
|
|
85
|
+
speed_kmh: z.number().min(0).max(200).optional().openapi({
|
|
86
|
+
description: 'Speed in km/h',
|
|
87
|
+
example: 15
|
|
88
|
+
}),
|
|
89
|
+
accuracy_meters: z.number().min(0).optional().openapi({
|
|
90
|
+
description: 'GPS accuracy in meters',
|
|
91
|
+
example: 5.2
|
|
92
|
+
}),
|
|
93
|
+
timestamp: z.string().datetime().optional().openapi({
|
|
94
|
+
description: 'ISO 8601 timestamp of the position reading',
|
|
95
|
+
example: '2026-01-04T12:34:56Z'
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
.openapi('ReportPositionBody');
|
|
99
|
+
// ============================================================================
|
|
100
|
+
// Report Position Response
|
|
101
|
+
// ============================================================================
|
|
102
|
+
export const reportPositionDataSchema = z
|
|
103
|
+
.object({
|
|
104
|
+
position_id: z.string().uuid().openapi({
|
|
105
|
+
description: 'UUID of the created position record',
|
|
106
|
+
example: '550e8400-e29b-41d4-a716-446655440000'
|
|
107
|
+
}),
|
|
108
|
+
received_at: z.string().datetime().openapi({
|
|
109
|
+
description: 'Server timestamp when position was received',
|
|
110
|
+
example: '2026-01-04T12:34:56Z'
|
|
111
|
+
}),
|
|
112
|
+
site_plan_position: sitePlanPositionSchema.optional().openapi({
|
|
113
|
+
description: 'Converted position on site plan (if within venue bounds)'
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
.openapi('ReportPositionData');
|
|
117
|
+
export const reportPositionResponseSchema = createSuccessResponseSchema(reportPositionDataSchema, 'ReportPositionResponse', 'Position report result');
|
|
118
|
+
// ============================================================================
|
|
119
|
+
// Vehicle Position (for Command Center display)
|
|
120
|
+
// ============================================================================
|
|
121
|
+
export const vehiclePositionSchema = z
|
|
122
|
+
.object({
|
|
123
|
+
booking_id: z.number().int().positive().openapi({
|
|
124
|
+
description: 'ID of the parking booking',
|
|
125
|
+
example: 123
|
|
126
|
+
}),
|
|
127
|
+
license_plate: z.string().openapi({
|
|
128
|
+
description: 'Vehicle license plate',
|
|
129
|
+
example: 'AB-123-CD'
|
|
130
|
+
}),
|
|
131
|
+
vehicle_type: z.enum([VehicleType.PL, VehicleType.VUL, VehicleType.VL]).openapi({
|
|
132
|
+
description: 'Type of vehicle',
|
|
133
|
+
example: 'PL'
|
|
134
|
+
}),
|
|
135
|
+
company_name: z.string().openapi({
|
|
136
|
+
description: 'Company name',
|
|
137
|
+
example: 'ACME Transport'
|
|
138
|
+
}),
|
|
139
|
+
stand_number: z.string().optional().openapi({
|
|
140
|
+
description: 'Exhibition stand number',
|
|
141
|
+
example: 'H4-23'
|
|
142
|
+
}),
|
|
143
|
+
state: vehicleStateSchema.openapi({
|
|
144
|
+
description: 'Current vehicle state',
|
|
145
|
+
example: 'parked'
|
|
146
|
+
}),
|
|
147
|
+
position: sitePlanPositionSchema.openapi({
|
|
148
|
+
description: 'Position on site plan'
|
|
149
|
+
}),
|
|
150
|
+
speed_kmh: z.number().min(0).optional().openapi({
|
|
151
|
+
description: 'Current speed in km/h',
|
|
152
|
+
example: 0
|
|
153
|
+
}),
|
|
154
|
+
parking_area_id: z.number().int().positive().optional().openapi({
|
|
155
|
+
description: 'ID of assigned parking area',
|
|
156
|
+
example: 5
|
|
157
|
+
}),
|
|
158
|
+
parking_area_name: z.string().optional().openapi({
|
|
159
|
+
description: 'Name of assigned parking area',
|
|
160
|
+
example: 'Zone A'
|
|
161
|
+
}),
|
|
162
|
+
entry_time: z.string().datetime().nullable().openapi({
|
|
163
|
+
description: 'Time vehicle entered venue',
|
|
164
|
+
example: '2026-01-04T10:30:00Z'
|
|
165
|
+
}),
|
|
166
|
+
last_updated: z.string().datetime().openapi({
|
|
167
|
+
description: 'Last position update timestamp',
|
|
168
|
+
example: '2026-01-04T12:34:56Z'
|
|
169
|
+
}),
|
|
170
|
+
source: positionSourceSchema.openapi({
|
|
171
|
+
description: 'How the position was obtained',
|
|
172
|
+
example: 'gps'
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
.openapi('VehiclePosition');
|
|
176
|
+
// ============================================================================
|
|
177
|
+
// Get Vehicle Positions Query
|
|
178
|
+
// ============================================================================
|
|
179
|
+
export const getVehiclePositionsQuerySchema = z
|
|
180
|
+
.object({
|
|
181
|
+
since: z.string().datetime().optional().openapi({
|
|
182
|
+
description: 'Only return positions updated after this time',
|
|
183
|
+
example: '2026-01-04T12:00:00Z'
|
|
184
|
+
}),
|
|
185
|
+
include_historical: z
|
|
186
|
+
.string()
|
|
187
|
+
.optional()
|
|
188
|
+
.default('false')
|
|
189
|
+
.transform((val) => val === 'true')
|
|
190
|
+
.openapi({
|
|
191
|
+
description: 'Include recently exited vehicles',
|
|
192
|
+
example: 'false'
|
|
193
|
+
}),
|
|
194
|
+
state: vehicleStateSchema.optional().openapi({
|
|
195
|
+
description: 'Filter by vehicle state',
|
|
196
|
+
example: 'parked'
|
|
197
|
+
})
|
|
198
|
+
})
|
|
199
|
+
.openapi('GetVehiclePositionsQuery');
|
|
200
|
+
// ============================================================================
|
|
201
|
+
// Get Vehicle Positions Response
|
|
202
|
+
// ============================================================================
|
|
203
|
+
export const vehiclePositionsDataSchema = z
|
|
204
|
+
.object({
|
|
205
|
+
event_id: z.number().int().positive().openapi({
|
|
206
|
+
description: 'Event ID',
|
|
207
|
+
example: 1
|
|
208
|
+
}),
|
|
209
|
+
positions: z.array(vehiclePositionSchema).openapi({
|
|
210
|
+
description: 'List of vehicle positions'
|
|
211
|
+
}),
|
|
212
|
+
total_count: z.number().int().min(0).openapi({
|
|
213
|
+
description: 'Total number of positions returned',
|
|
214
|
+
example: 15
|
|
215
|
+
}),
|
|
216
|
+
timestamp: z.string().datetime().openapi({
|
|
217
|
+
description: 'Server timestamp',
|
|
218
|
+
example: '2026-01-04T12:34:56Z'
|
|
219
|
+
})
|
|
220
|
+
})
|
|
221
|
+
.openapi('VehiclePositionsData');
|
|
222
|
+
export const getVehiclePositionsResponseSchema = createSuccessResponseSchema(vehiclePositionsDataSchema, 'GetVehiclePositionsResponse', 'Vehicle positions for an event');
|
|
223
|
+
// ============================================================================
|
|
224
|
+
// Path Parameters
|
|
225
|
+
// ============================================================================
|
|
226
|
+
export const eventIdParamsSchema = z
|
|
227
|
+
.object({
|
|
228
|
+
eventId: z
|
|
229
|
+
.string()
|
|
230
|
+
.transform((val) => parseInt(val, 10))
|
|
231
|
+
.pipe(z.number().int().positive())
|
|
232
|
+
.openapi({
|
|
233
|
+
description: 'Event ID',
|
|
234
|
+
example: '1'
|
|
235
|
+
})
|
|
236
|
+
})
|
|
237
|
+
.openapi('EventIdParams');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venulog/phasing-engine-schemas",
|
|
3
|
-
"version": "0.7.6
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "Shared schemas and types for Phasing Engine API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,6 +34,14 @@
|
|
|
34
34
|
"types": "./dist/parkingArea.d.ts",
|
|
35
35
|
"import": "./dist/parkingArea.js"
|
|
36
36
|
},
|
|
37
|
+
"./parkingAreaLayer": {
|
|
38
|
+
"types": "./dist/parkingAreaLayer.d.ts",
|
|
39
|
+
"import": "./dist/parkingAreaLayer.js"
|
|
40
|
+
},
|
|
41
|
+
"./parkingAreaAccess": {
|
|
42
|
+
"types": "./dist/parkingAreaAccess.d.ts",
|
|
43
|
+
"import": "./dist/parkingAreaAccess.js"
|
|
44
|
+
},
|
|
37
45
|
"./enums": {
|
|
38
46
|
"types": "./dist/enums/index.d.ts",
|
|
39
47
|
"import": "./dist/enums/index.js"
|
|
@@ -41,6 +49,18 @@
|
|
|
41
49
|
"./accessToken": {
|
|
42
50
|
"types": "./dist/accessToken.d.ts",
|
|
43
51
|
"import": "./dist/accessToken.js"
|
|
52
|
+
},
|
|
53
|
+
"./vehiclePosition": {
|
|
54
|
+
"types": "./dist/vehiclePosition.d.ts",
|
|
55
|
+
"import": "./dist/vehiclePosition.js"
|
|
56
|
+
},
|
|
57
|
+
"./camera": {
|
|
58
|
+
"types": "./dist/camera.d.ts",
|
|
59
|
+
"import": "./dist/camera.js"
|
|
60
|
+
},
|
|
61
|
+
"./simulation": {
|
|
62
|
+
"types": "./dist/simulation.d.ts",
|
|
63
|
+
"import": "./dist/simulation.js"
|
|
44
64
|
}
|
|
45
65
|
},
|
|
46
66
|
"files": [
|