@venulog/phasing-engine-schemas 0.2.0-alpha.1 → 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 +67 -67
- package/dist/enums/phaseSlotScheduleType.d.ts +4 -0
- package/dist/enums/phaseSlotScheduleType.js +5 -0
- package/dist/event.d.ts +18 -0
- package/dist/event.js +40 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/phaseBooking.d.ts +260 -426
- package/dist/phaseBooking.js +302 -434
- package/dist/phaseSlot.d.ts +60 -57
- package/dist/phaseSlot.js +187 -55
- package/package.json +67 -63
- package/dist/enums/slotStatus.d.ts +0 -5
- package/dist/enums/slotStatus.js +0 -6
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
|
+
```
|
package/dist/event.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Query parameters for getting event by code
|
|
4
|
+
*/
|
|
5
|
+
export declare const getEventByCodeQuerySchema: z.ZodObject<{
|
|
6
|
+
event_code: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type GetEventByCodeQuery = z.infer<typeof getEventByCodeQuerySchema>;
|
|
9
|
+
/**
|
|
10
|
+
* Response schema for event information
|
|
11
|
+
*/
|
|
12
|
+
export declare const eventInfoResponseSchema: z.ZodObject<{
|
|
13
|
+
event_id: z.ZodNumber;
|
|
14
|
+
event_code: z.ZodString;
|
|
15
|
+
event_name: z.ZodString;
|
|
16
|
+
venue_name: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type EventInfoResponse = z.infer<typeof eventInfoResponseSchema>;
|
package/dist/event.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
|
|
3
|
+
extendZodWithOpenApi(z);
|
|
4
|
+
/**
|
|
5
|
+
* Query parameters for getting event by code
|
|
6
|
+
*/
|
|
7
|
+
export const getEventByCodeQuerySchema = z
|
|
8
|
+
.object({
|
|
9
|
+
event_code: z
|
|
10
|
+
.string()
|
|
11
|
+
.min(1, 'Event code is required')
|
|
12
|
+
.describe('The unique code identifying the event')
|
|
13
|
+
.openapi({ example: 'COEC2025' })
|
|
14
|
+
})
|
|
15
|
+
.openapi('GetEventByCodeQuery');
|
|
16
|
+
/**
|
|
17
|
+
* Response schema for event information
|
|
18
|
+
*/
|
|
19
|
+
export const eventInfoResponseSchema = z
|
|
20
|
+
.object({
|
|
21
|
+
event_id: z
|
|
22
|
+
.number()
|
|
23
|
+
.int()
|
|
24
|
+
.positive()
|
|
25
|
+
.describe('The unique identifier of the event')
|
|
26
|
+
.openapi({ example: 1 }),
|
|
27
|
+
event_code: z
|
|
28
|
+
.string()
|
|
29
|
+
.describe('The unique code of the event')
|
|
30
|
+
.openapi({ example: 'COEC2025' }),
|
|
31
|
+
event_name: z
|
|
32
|
+
.string()
|
|
33
|
+
.describe('The name of the event')
|
|
34
|
+
.openapi({ example: 'Convention of Events and Conferences 2025' }),
|
|
35
|
+
venue_name: z
|
|
36
|
+
.string()
|
|
37
|
+
.describe('The name of the venue where the event takes place')
|
|
38
|
+
.openapi({ example: 'Paris Expo Porte de Versailles' })
|
|
39
|
+
})
|
|
40
|
+
.openapi('EventInfoResponse');
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './pagination.js';
|
|
|
3
3
|
export * from './auth.js';
|
|
4
4
|
export * from './phaseBooking.js';
|
|
5
5
|
export * from './phaseSlot.js';
|
|
6
|
+
export * from './event.js';
|
|
6
7
|
export * from './enums/bookingStatus.js';
|
|
7
|
-
export * from './enums/
|
|
8
|
+
export * from './enums/phaseSlotScheduleType.js';
|
|
8
9
|
export { z } from './zod.js';
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,9 @@ export * from './pagination.js';
|
|
|
4
4
|
export * from './auth.js';
|
|
5
5
|
export * from './phaseBooking.js';
|
|
6
6
|
export * from './phaseSlot.js';
|
|
7
|
+
export * from './event.js';
|
|
7
8
|
// Enum exports
|
|
8
9
|
export * from './enums/bookingStatus.js';
|
|
9
|
-
export * from './enums/
|
|
10
|
+
export * from './enums/phaseSlotScheduleType.js';
|
|
10
11
|
// Zod re-export for convenience
|
|
11
12
|
export { z } from './zod.js';
|