@updraft-solutions/mcrit-sdk 0.3.0 → 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-S632QB2N.cjs → chunk-RC2BBT6H.cjs} +88 -14
- package/dist/{chunk-4A2CDUAO.js → chunk-WQLDSZNN.js} +87 -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 +9 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -2
- package/dist/{models-DOcMz5Pd.d.cts → models-Bc5BKYuI.d.cts} +6826 -5789
- package/dist/{models-DOcMz5Pd.d.ts → models-Bc5BKYuI.d.ts} +6826 -5789
- 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 +2 -1
- package/src/format/index.ts +51 -5
- package/src/schemas/common.ts +4 -0
- package/src/schemas/models.ts +96 -17
- package/src/types/models.ts +4 -0
package/src/schemas/models.ts
CHANGED
|
@@ -160,6 +160,21 @@ export const airplaneSchema = BaseModel.extend({
|
|
|
160
160
|
shared_companies: z
|
|
161
161
|
.array(z.object({ id: z.number(), name: z.string() }))
|
|
162
162
|
.optional(),
|
|
163
|
+
is_simulator: z.boolean().optional(),
|
|
164
|
+
category: z.string().nullable().optional(),
|
|
165
|
+
averageFuelConsumption: z.string().nullable().optional(),
|
|
166
|
+
weightUnitString: z.string().optional(),
|
|
167
|
+
fuelUnitString: z.string().optional(),
|
|
168
|
+
isoCountryCodeFromRegistration: z.string().optional(),
|
|
169
|
+
registrationWithoutSpecialChars: z.string().nullable().optional(),
|
|
170
|
+
equipmentCodes: z.array(z.string()).nullable().optional(),
|
|
171
|
+
compliance_required: z.boolean().optional(),
|
|
172
|
+
show_on_website: z.boolean().optional(),
|
|
173
|
+
is_public: z.boolean().optional(),
|
|
174
|
+
company_timezone: z.string().optional(),
|
|
175
|
+
defaultFlightType: z.string().optional(),
|
|
176
|
+
defaultFlightRule: z.string().optional(),
|
|
177
|
+
status: z.string().optional(),
|
|
163
178
|
can: z.object({
|
|
164
179
|
view: zNullableBool,
|
|
165
180
|
update: zNullableBool,
|
|
@@ -250,11 +265,19 @@ export const userQualificationSchema = z.object({
|
|
|
250
265
|
});
|
|
251
266
|
|
|
252
267
|
export const airportSchema = z.object({
|
|
253
|
-
|
|
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(),
|
|
254
273
|
id: z.number(),
|
|
255
274
|
ident: z.string(),
|
|
256
275
|
name: z.string(),
|
|
257
|
-
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(),
|
|
258
281
|
});
|
|
259
282
|
|
|
260
283
|
export const recurringFlightSchema = z.object({
|
|
@@ -372,6 +395,26 @@ export const availSchema = z.object({
|
|
|
372
395
|
.optional(),
|
|
373
396
|
});
|
|
374
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
|
+
|
|
375
418
|
export const bookingSchema = BaseModel.extend({
|
|
376
419
|
type: z.literal("booking"),
|
|
377
420
|
ifr: z.boolean().default(false),
|
|
@@ -388,6 +431,15 @@ export const bookingSchema = BaseModel.extend({
|
|
|
388
431
|
destination_airport_id: z.number().optional(),
|
|
389
432
|
departure_airport: airportSchema.optional(),
|
|
390
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(),
|
|
391
443
|
next_booking_id: z.number().nullable().optional(),
|
|
392
444
|
previous_booking_id: z.number().nullable().optional(),
|
|
393
445
|
maintenance: z.number().optional(),
|
|
@@ -782,6 +834,24 @@ export const expenseSchema = z.object({
|
|
|
782
834
|
.optional(),
|
|
783
835
|
});
|
|
784
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
|
+
|
|
785
855
|
export const courseSchema = z.object({
|
|
786
856
|
type: z.literal("course"),
|
|
787
857
|
id: z.number(),
|
|
@@ -798,15 +868,25 @@ export const courseSchema = z.object({
|
|
|
798
868
|
aircraft_required: z.boolean().default(false),
|
|
799
869
|
qualification_id: z.number().nullable().optional(),
|
|
800
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(),
|
|
801
885
|
created_at: z.string(),
|
|
802
886
|
updated_at: z.string(),
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
delete: zNullableBool,
|
|
807
|
-
enroll: zNullableBool,
|
|
808
|
-
})
|
|
809
|
-
.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(),
|
|
810
890
|
});
|
|
811
891
|
|
|
812
892
|
/**
|
|
@@ -839,20 +919,19 @@ export const courseEnrollmentSchema = z.object({
|
|
|
839
919
|
comments: z.string().nullable().optional(),
|
|
840
920
|
initial_payment_generated: z.boolean().optional(),
|
|
841
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(),
|
|
842
926
|
metrics: courseEnrollmentMetricsSchema.optional(),
|
|
843
927
|
created_at: z.string(),
|
|
844
928
|
updated_at: z.string(),
|
|
845
929
|
course: courseSchema.optional(),
|
|
846
930
|
membership: membershipSchema.optional(),
|
|
847
931
|
mentor: userSchema.optional(),
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
update: zNullableBool,
|
|
852
|
-
delete: zNullableBool,
|
|
853
|
-
complete: zNullableBool,
|
|
854
|
-
})
|
|
855
|
-
.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(),
|
|
856
935
|
});
|
|
857
936
|
|
|
858
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
|