@updraft-solutions/mcrit-sdk 0.3.1 → 0.4.0
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/{chunk-MF7G76QS.cjs → chunk-IVMOR5SW.cjs} +26 -1
- package/dist/{chunk-D5DUVW34.js → chunk-KIMCBEY7.js} +26 -1
- package/dist/{chunk-7QF3OJ45.cjs → chunk-RC2BBT6H.cjs} +73 -14
- package/dist/{chunk-FS5I4MBG.js → chunk-WQLDSZNN.js} +72 -13
- package/dist/format/index.cjs +2 -2
- package/dist/format/index.d.cts +13 -4
- package/dist/format/index.d.ts +13 -4
- package/dist/format/index.js +1 -1
- package/dist/index.cjs +11 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -7
- package/dist/{models-BWmpcfR8.d.cts → models-Bc5BKYuI.d.cts} +6389 -5667
- package/dist/{models-BWmpcfR8.d.ts → models-Bc5BKYuI.d.ts} +6389 -5667
- package/dist/schemas/index.cjs +8 -2
- package/dist/schemas/index.d.cts +55 -55
- package/dist/schemas/index.d.ts +55 -55
- package/dist/schemas/index.js +7 -1
- package/dist/types/index.d.cts +4 -2
- package/dist/types/index.d.ts +4 -2
- package/package.json +1 -1
- package/src/format/index.ts +51 -5
- package/src/schemas/common.ts +4 -0
- package/src/schemas/models.ts +81 -17
- package/src/types/models.ts +4 -0
package/src/schemas/models.ts
CHANGED
|
@@ -265,11 +265,19 @@ export const userQualificationSchema = z.object({
|
|
|
265
265
|
});
|
|
266
266
|
|
|
267
267
|
export const airportSchema = z.object({
|
|
268
|
-
|
|
268
|
+
// Aligned with what AirportResource actually serializes: `type` and
|
|
269
|
+
// `country` are absent on minified payloads (e.g. booking waypoint
|
|
270
|
+
// airports); coordinates + municipality/iso_country ride along on the
|
|
271
|
+
// full shape.
|
|
272
|
+
type: z.literal("airport").optional(),
|
|
269
273
|
id: z.number(),
|
|
270
274
|
ident: z.string(),
|
|
271
275
|
name: z.string(),
|
|
272
|
-
country: z.string(),
|
|
276
|
+
country: z.string().optional(),
|
|
277
|
+
municipality: z.string().nullable().optional(),
|
|
278
|
+
iso_country: z.string().nullable().optional(),
|
|
279
|
+
latitude_deg: z.number().nullable().optional(),
|
|
280
|
+
longitude_deg: z.number().nullable().optional(),
|
|
273
281
|
});
|
|
274
282
|
|
|
275
283
|
export const recurringFlightSchema = z.object({
|
|
@@ -387,6 +395,26 @@ export const availSchema = z.object({
|
|
|
387
395
|
.optional(),
|
|
388
396
|
});
|
|
389
397
|
|
|
398
|
+
// Ordered via-airport on a booking's route (BookingResource `waypoints`).
|
|
399
|
+
// Airports arrive minified (no `type` literal), hence the dedicated shape.
|
|
400
|
+
// Distinct from the nav-fix `waypointSchema` further down — do not merge.
|
|
401
|
+
export const bookingWaypointSchema = z.object({
|
|
402
|
+
sequence: z.number(),
|
|
403
|
+
airport_id: z.number(),
|
|
404
|
+
airport: z
|
|
405
|
+
.object({
|
|
406
|
+
id: z.number(),
|
|
407
|
+
ident: z.string(),
|
|
408
|
+
name: z.string(),
|
|
409
|
+
municipality: z.string().nullable().optional(),
|
|
410
|
+
iso_country: z.string().nullable().optional(),
|
|
411
|
+
latitude_deg: z.number().nullable().optional(),
|
|
412
|
+
longitude_deg: z.number().nullable().optional(),
|
|
413
|
+
})
|
|
414
|
+
.nullable()
|
|
415
|
+
.optional(),
|
|
416
|
+
});
|
|
417
|
+
|
|
390
418
|
export const bookingSchema = BaseModel.extend({
|
|
391
419
|
type: z.literal("booking"),
|
|
392
420
|
ifr: z.boolean().default(false),
|
|
@@ -403,6 +431,15 @@ export const bookingSchema = BaseModel.extend({
|
|
|
403
431
|
destination_airport_id: z.number().optional(),
|
|
404
432
|
departure_airport: airportSchema.optional(),
|
|
405
433
|
destination_airport: airportSchema.optional(),
|
|
434
|
+
waypoints: z.array(bookingWaypointSchema).optional(),
|
|
435
|
+
// Flat, always-present home timezone on BookingResource.
|
|
436
|
+
company_timezone: z.string().nullable().optional(),
|
|
437
|
+
// Slim per-booking training-record status, present when the backend
|
|
438
|
+
// eager-loaded `trainingRecord` (enrollment bookings surfaces).
|
|
439
|
+
training_record_status: z
|
|
440
|
+
.enum(["draft", "awaiting_signatures", "signed"])
|
|
441
|
+
.nullable()
|
|
442
|
+
.optional(),
|
|
406
443
|
next_booking_id: z.number().nullable().optional(),
|
|
407
444
|
previous_booking_id: z.number().nullable().optional(),
|
|
408
445
|
maintenance: z.number().optional(),
|
|
@@ -797,6 +834,24 @@ export const expenseSchema = z.object({
|
|
|
797
834
|
.optional(),
|
|
798
835
|
});
|
|
799
836
|
|
|
837
|
+
// Company-scoped tag (shared pool across taggable models — see
|
|
838
|
+
// m-crit-api docs/features/tags.md).
|
|
839
|
+
export const tagSchema = z.object({
|
|
840
|
+
type: z.literal("tag").optional(),
|
|
841
|
+
id: z.number(),
|
|
842
|
+
name: z.string(),
|
|
843
|
+
color: z.string().nullable().optional(),
|
|
844
|
+
});
|
|
845
|
+
|
|
846
|
+
// Slim attached progress-check sheet (course_check_syllabi pivot),
|
|
847
|
+
// serialized on course show/update payloads.
|
|
848
|
+
export const courseCheckSyllabusSchema = z.object({
|
|
849
|
+
id: z.number(),
|
|
850
|
+
name: z.string(),
|
|
851
|
+
version: z.number(),
|
|
852
|
+
kind: z.enum(["regular", "progress_check"]).default("regular"),
|
|
853
|
+
});
|
|
854
|
+
|
|
800
855
|
export const courseSchema = z.object({
|
|
801
856
|
type: z.literal("course"),
|
|
802
857
|
id: z.number(),
|
|
@@ -813,15 +868,25 @@ export const courseSchema = z.object({
|
|
|
813
868
|
aircraft_required: z.boolean().default(false),
|
|
814
869
|
qualification_id: z.number().nullable().optional(),
|
|
815
870
|
qualification: qualificationSchema.optional(),
|
|
871
|
+
is_archived: z.boolean().optional(),
|
|
872
|
+
archived_at: z.string().nullable().optional(),
|
|
873
|
+
category: z.string().nullable().optional(),
|
|
874
|
+
title: z.string().nullable().optional(),
|
|
875
|
+
subtitle: z.string().nullable().optional(),
|
|
876
|
+
content: z.string().nullable().optional(),
|
|
877
|
+
footer: z.string().nullable().optional(),
|
|
878
|
+
// Syllabus assignment pointers: `syllabus_id` drives the Übersicht,
|
|
879
|
+
// `booking_form_syllabus_id` the per-flight Ausbildungsnachweis.
|
|
880
|
+
syllabus_id: z.number().nullable().optional(),
|
|
881
|
+
booking_form_syllabus_id: z.number().nullable().optional(),
|
|
882
|
+
// Present only when the backend eager-loaded `checkSyllabi`.
|
|
883
|
+
check_syllabi: z.array(courseCheckSyllabusSchema).optional(),
|
|
884
|
+
tags: z.array(tagSchema).optional(),
|
|
816
885
|
created_at: z.string(),
|
|
817
886
|
updated_at: z.string(),
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
delete: zNullableBool,
|
|
822
|
-
enroll: zNullableBool,
|
|
823
|
-
})
|
|
824
|
-
.optional(),
|
|
887
|
+
// Loose record on purpose: gates are policy-reflected server-side and
|
|
888
|
+
// grow over time (useAssistant, …) — same convention as companySchema.
|
|
889
|
+
can: z.record(z.string(), zNullableBool).optional(),
|
|
825
890
|
});
|
|
826
891
|
|
|
827
892
|
/**
|
|
@@ -854,20 +919,19 @@ export const courseEnrollmentSchema = z.object({
|
|
|
854
919
|
comments: z.string().nullable().optional(),
|
|
855
920
|
initial_payment_generated: z.boolean().optional(),
|
|
856
921
|
initial_payment_removable: z.boolean().optional(),
|
|
922
|
+
// Element-driven training progress (see m-crit-api
|
|
923
|
+
// docs/features/training-tracking.md).
|
|
924
|
+
tracked_training_elements_count: z.number().optional(),
|
|
925
|
+
progress_source: z.enum(["training_elements", "milestones"]).optional(),
|
|
857
926
|
metrics: courseEnrollmentMetricsSchema.optional(),
|
|
858
927
|
created_at: z.string(),
|
|
859
928
|
updated_at: z.string(),
|
|
860
929
|
course: courseSchema.optional(),
|
|
861
930
|
membership: membershipSchema.optional(),
|
|
862
931
|
mentor: userSchema.optional(),
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
update: zNullableBool,
|
|
867
|
-
delete: zNullableBool,
|
|
868
|
-
complete: zNullableBool,
|
|
869
|
-
})
|
|
870
|
-
.optional(),
|
|
932
|
+
// Loose record on purpose: gates are policy-reflected server-side and
|
|
933
|
+
// grow over time (updateTraining, manageInitialPayment, …).
|
|
934
|
+
can: z.record(z.string(), zNullableBool).optional(),
|
|
871
935
|
});
|
|
872
936
|
|
|
873
937
|
export const eventSchema = z.object({
|
package/src/types/models.ts
CHANGED
|
@@ -42,6 +42,10 @@ export type RecurringFlight = z.infer<
|
|
|
42
42
|
// Fee types
|
|
43
43
|
export type Fee = z.infer<typeof ModelSchemas.feeSchema>;
|
|
44
44
|
export type CourseFee = z.infer<typeof ModelSchemas.courseFeeSchema>;
|
|
45
|
+
export type Tag = z.infer<typeof ModelSchemas.tagSchema>;
|
|
46
|
+
export type CourseCheckSyllabus = z.infer<
|
|
47
|
+
typeof ModelSchemas.courseCheckSyllabusSchema
|
|
48
|
+
>;
|
|
45
49
|
export type Price = z.infer<typeof ModelSchemas.priceSchema>;
|
|
46
50
|
|
|
47
51
|
// Maintenance types
|