@updraft-solutions/mcrit-sdk 0.5.0 → 0.7.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/dist/{chunk-YCIXOVEC.js → chunk-VNEXO6QQ.js} +194 -81
- package/dist/{chunk-AKLFMP7G.cjs → chunk-Y26FRSPZ.cjs} +195 -82
- package/dist/courses/index.d.cts +2 -2
- package/dist/courses/index.d.ts +2 -2
- package/dist/index.cjs +12 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +24 -16
- package/dist/schemas/index.cjs +10 -2
- package/dist/schemas/index.d.cts +33 -33
- package/dist/schemas/index.d.ts +33 -33
- package/dist/schemas/index.js +9 -1
- package/dist/training-BibD4HsC.d.cts +103080 -0
- package/dist/training-BibD4HsC.d.ts +103080 -0
- package/dist/types/index.d.cts +5 -2
- package/dist/types/index.d.ts +5 -2
- package/package.json +1 -1
- package/src/courses/index.ts +2 -2
- package/src/index.ts +3 -0
- package/src/schemas/common.ts +36 -5
- package/src/schemas/form-template.ts +3 -0
- package/src/schemas/models.ts +165 -82
- package/src/schemas/training.ts +30 -0
- package/src/types/models.ts +3 -0
- package/dist/training-Der1DPU-.d.cts +0 -53405
- package/dist/training-Der1DPU-.d.ts +0 -53405
package/dist/types/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { aB as activitySchema, aC as addressSchema, aD as aircraftPositionSchema, aE as aircraftRatingSchema, aJ as airplaneSchema, aI as airplanePermissionSchema, aK as airplaneShareInviteSchema, aL as airportSchema, aM as alertSchema, aN as allowedDocumentTypeSchema, aO as approachTypeSchema, aP as availSchema, aQ as baseMembershipSchema, aR as bookingSchema, aT as commentSchema, aU as companySchema, a_ as courseSchema, aY as courseEnrollmentSchema, aZ as courseFeeSchema, aG as airplaneIssueSeverityEnum, b4 as documentSchema, b0 as documentComplianceStatus, b1 as documentRequirement, b2 as documentRequirementGroup, b3 as documentRequirementGroupAssignment, b5 as documentShareSchema, b6 as documentType, b8 as eventSchema, ba as expenseSchema, b9 as expenseItemSchema, bb as extendedAirplaneSchema, bd as feeSchema, bc as feeCategoryOptionsSchema, be as flightLogSchema, bl as invoiceSchema, bn as landingSchema, bm as landingFeeSchema, bp as maintenanceEventSchema, bo as maintenanceEventEstimationSchema, bq as maintenanceStatusSchema, br as mediaCollection, bt as membershipSchema, bu as membershipSignupSchema, bv as postSchema, bw as prePaidPackageSchema, bx as priceSchema, by as qualificationSchema, bz as recurringFlightSchema, bA as roleSchema, bB as runwaySchema, bC as scheduledFlightSchema, bD as settingSchema, bE as specialFlightSchema, bL as tagSchema, bM as ticketSchema, bW as userSchema, bU as userAircraftRatingSchema, bV as userQualificationSchema, bX as waypointSchema, aF as airplaneIssueSchema, aH as airplaneIssueStatusEnum, B as BaseModel$1, aW as courseCheckSyllabusSchema, aX as courseEnrollmentMetricsSchema, bs as mediaSchema, l as FormSubmission } from '../training-BibD4HsC.cjs';
|
|
3
3
|
|
|
4
4
|
type BaseModel = z.infer<typeof BaseModel$1>;
|
|
5
5
|
type User = z.infer<typeof userSchema>;
|
|
@@ -27,6 +27,9 @@ type Price = z.infer<typeof priceSchema>;
|
|
|
27
27
|
type MaintenanceEvent = z.infer<typeof maintenanceEventSchema>;
|
|
28
28
|
type MaintenanceStatus = z.infer<typeof maintenanceStatusSchema>;
|
|
29
29
|
type MaintenanceEventEstimation = z.infer<typeof maintenanceEventEstimationSchema>;
|
|
30
|
+
type Activity = z.infer<typeof activitySchema>;
|
|
31
|
+
type MembershipSignup = z.infer<typeof membershipSignupSchema>;
|
|
32
|
+
type AircraftPosition = z.infer<typeof aircraftPositionSchema>;
|
|
30
33
|
type Avail = z.infer<typeof availSchema>;
|
|
31
34
|
type Alert = z.infer<typeof alertSchema>;
|
|
32
35
|
type Booking = z.infer<typeof bookingSchema>;
|
|
@@ -416,4 +419,4 @@ interface LandingFeeInvoiceApplyResult {
|
|
|
416
419
|
issues: string[];
|
|
417
420
|
}
|
|
418
421
|
|
|
419
|
-
export type { Address, AiSuggestedMilestone, AiSuggestion, AiSuggestionStatus, AircraftBlock, AircraftBlockReason, AircraftRating, Airplane, AirplaneIssue, AirplaneIssueSeverity, AirplaneIssueStatus, AirplanePermission, AirplaneShareInvite, Airport, Alert, AllowedDocumentType, ApiResponse, ApproachType, Avail, BackgroundTask, BackgroundTaskStatus, BaseMembership, BaseModel, Booking, Comment, Company, ComplianceData, ComplianceGroup, ComplianceGroupSource, ComplianceRequirement, ComplianceRequirementGroup, ComplianceResponse, ComplianceSummary, Course, CourseCheckSyllabus, CourseDescriptionSuggestionPayload, CourseEnrollment, CourseEnrollmentMetrics, CourseFee, CreateAirplaneIssueInput, CreateCommentInput, CreatePostInput, DataWrappedResponse, DeferAirplaneIssueInput, DiscardedRow, Document, DocumentComplianceStatus, DocumentRequirement, DocumentRequirementGroup, DocumentRequirementGroupAssignment, DocumentShare, DocumentType, Event, Expense, ExpenseItem, ExtendedAirplane, Fee, FeeCategoryOptions, FlightLog, GroupedPermissions, Invoice, Landing, LandingFee, LandingFeeImportResult, LandingFeeInvoiceApplyPayload, LandingFeeInvoiceApplyResult, LandingFeeInvoicePreview, LandingFeeInvoicePreviewRow, LandingFeeTemplateParams, LogbookFlightLogPayload, LogbookStageResult, LogbookSuggestion, LogbookSuggestionMeta, MaintenanceEvent, MaintenanceEventEstimation, MaintenanceStatus, Media, MediaCollection, Membership, PaginatedResponse, PermissionItem, Post, PrePaidPackage, Price, Qualification, RecurringFlight, ResolveAirplaneIssueInput, Resource, Role, RoleDetail, RoleListItem, Runway, ScheduledFlight, Setting, SpecialFlight, Tag, Ticket, ToggleFavoriteResponse, UpdateAirplaneIssueInput, UpdateCommentInput, UpdatePostInput, User, UserAircraftRating, UserQualification, Waypoint };
|
|
422
|
+
export type { Activity, Address, AiSuggestedMilestone, AiSuggestion, AiSuggestionStatus, AircraftBlock, AircraftBlockReason, AircraftPosition, AircraftRating, Airplane, AirplaneIssue, AirplaneIssueSeverity, AirplaneIssueStatus, AirplanePermission, AirplaneShareInvite, Airport, Alert, AllowedDocumentType, ApiResponse, ApproachType, Avail, BackgroundTask, BackgroundTaskStatus, BaseMembership, BaseModel, Booking, Comment, Company, ComplianceData, ComplianceGroup, ComplianceGroupSource, ComplianceRequirement, ComplianceRequirementGroup, ComplianceResponse, ComplianceSummary, Course, CourseCheckSyllabus, CourseDescriptionSuggestionPayload, CourseEnrollment, CourseEnrollmentMetrics, CourseFee, CreateAirplaneIssueInput, CreateCommentInput, CreatePostInput, DataWrappedResponse, DeferAirplaneIssueInput, DiscardedRow, Document, DocumentComplianceStatus, DocumentRequirement, DocumentRequirementGroup, DocumentRequirementGroupAssignment, DocumentShare, DocumentType, Event, Expense, ExpenseItem, ExtendedAirplane, Fee, FeeCategoryOptions, FlightLog, GroupedPermissions, Invoice, Landing, LandingFee, LandingFeeImportResult, LandingFeeInvoiceApplyPayload, LandingFeeInvoiceApplyResult, LandingFeeInvoicePreview, LandingFeeInvoicePreviewRow, LandingFeeTemplateParams, LogbookFlightLogPayload, LogbookStageResult, LogbookSuggestion, LogbookSuggestionMeta, MaintenanceEvent, MaintenanceEventEstimation, MaintenanceStatus, Media, MediaCollection, Membership, MembershipSignup, PaginatedResponse, PermissionItem, Post, PrePaidPackage, Price, Qualification, RecurringFlight, ResolveAirplaneIssueInput, Resource, Role, RoleDetail, RoleListItem, Runway, ScheduledFlight, Setting, SpecialFlight, Tag, Ticket, ToggleFavoriteResponse, UpdateAirplaneIssueInput, UpdateCommentInput, UpdatePostInput, User, UserAircraftRating, UserQualification, Waypoint };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { aB as activitySchema, aC as addressSchema, aD as aircraftPositionSchema, aE as aircraftRatingSchema, aJ as airplaneSchema, aI as airplanePermissionSchema, aK as airplaneShareInviteSchema, aL as airportSchema, aM as alertSchema, aN as allowedDocumentTypeSchema, aO as approachTypeSchema, aP as availSchema, aQ as baseMembershipSchema, aR as bookingSchema, aT as commentSchema, aU as companySchema, a_ as courseSchema, aY as courseEnrollmentSchema, aZ as courseFeeSchema, aG as airplaneIssueSeverityEnum, b4 as documentSchema, b0 as documentComplianceStatus, b1 as documentRequirement, b2 as documentRequirementGroup, b3 as documentRequirementGroupAssignment, b5 as documentShareSchema, b6 as documentType, b8 as eventSchema, ba as expenseSchema, b9 as expenseItemSchema, bb as extendedAirplaneSchema, bd as feeSchema, bc as feeCategoryOptionsSchema, be as flightLogSchema, bl as invoiceSchema, bn as landingSchema, bm as landingFeeSchema, bp as maintenanceEventSchema, bo as maintenanceEventEstimationSchema, bq as maintenanceStatusSchema, br as mediaCollection, bt as membershipSchema, bu as membershipSignupSchema, bv as postSchema, bw as prePaidPackageSchema, bx as priceSchema, by as qualificationSchema, bz as recurringFlightSchema, bA as roleSchema, bB as runwaySchema, bC as scheduledFlightSchema, bD as settingSchema, bE as specialFlightSchema, bL as tagSchema, bM as ticketSchema, bW as userSchema, bU as userAircraftRatingSchema, bV as userQualificationSchema, bX as waypointSchema, aF as airplaneIssueSchema, aH as airplaneIssueStatusEnum, B as BaseModel$1, aW as courseCheckSyllabusSchema, aX as courseEnrollmentMetricsSchema, bs as mediaSchema, l as FormSubmission } from '../training-BibD4HsC.js';
|
|
3
3
|
|
|
4
4
|
type BaseModel = z.infer<typeof BaseModel$1>;
|
|
5
5
|
type User = z.infer<typeof userSchema>;
|
|
@@ -27,6 +27,9 @@ type Price = z.infer<typeof priceSchema>;
|
|
|
27
27
|
type MaintenanceEvent = z.infer<typeof maintenanceEventSchema>;
|
|
28
28
|
type MaintenanceStatus = z.infer<typeof maintenanceStatusSchema>;
|
|
29
29
|
type MaintenanceEventEstimation = z.infer<typeof maintenanceEventEstimationSchema>;
|
|
30
|
+
type Activity = z.infer<typeof activitySchema>;
|
|
31
|
+
type MembershipSignup = z.infer<typeof membershipSignupSchema>;
|
|
32
|
+
type AircraftPosition = z.infer<typeof aircraftPositionSchema>;
|
|
30
33
|
type Avail = z.infer<typeof availSchema>;
|
|
31
34
|
type Alert = z.infer<typeof alertSchema>;
|
|
32
35
|
type Booking = z.infer<typeof bookingSchema>;
|
|
@@ -416,4 +419,4 @@ interface LandingFeeInvoiceApplyResult {
|
|
|
416
419
|
issues: string[];
|
|
417
420
|
}
|
|
418
421
|
|
|
419
|
-
export type { Address, AiSuggestedMilestone, AiSuggestion, AiSuggestionStatus, AircraftBlock, AircraftBlockReason, AircraftRating, Airplane, AirplaneIssue, AirplaneIssueSeverity, AirplaneIssueStatus, AirplanePermission, AirplaneShareInvite, Airport, Alert, AllowedDocumentType, ApiResponse, ApproachType, Avail, BackgroundTask, BackgroundTaskStatus, BaseMembership, BaseModel, Booking, Comment, Company, ComplianceData, ComplianceGroup, ComplianceGroupSource, ComplianceRequirement, ComplianceRequirementGroup, ComplianceResponse, ComplianceSummary, Course, CourseCheckSyllabus, CourseDescriptionSuggestionPayload, CourseEnrollment, CourseEnrollmentMetrics, CourseFee, CreateAirplaneIssueInput, CreateCommentInput, CreatePostInput, DataWrappedResponse, DeferAirplaneIssueInput, DiscardedRow, Document, DocumentComplianceStatus, DocumentRequirement, DocumentRequirementGroup, DocumentRequirementGroupAssignment, DocumentShare, DocumentType, Event, Expense, ExpenseItem, ExtendedAirplane, Fee, FeeCategoryOptions, FlightLog, GroupedPermissions, Invoice, Landing, LandingFee, LandingFeeImportResult, LandingFeeInvoiceApplyPayload, LandingFeeInvoiceApplyResult, LandingFeeInvoicePreview, LandingFeeInvoicePreviewRow, LandingFeeTemplateParams, LogbookFlightLogPayload, LogbookStageResult, LogbookSuggestion, LogbookSuggestionMeta, MaintenanceEvent, MaintenanceEventEstimation, MaintenanceStatus, Media, MediaCollection, Membership, PaginatedResponse, PermissionItem, Post, PrePaidPackage, Price, Qualification, RecurringFlight, ResolveAirplaneIssueInput, Resource, Role, RoleDetail, RoleListItem, Runway, ScheduledFlight, Setting, SpecialFlight, Tag, Ticket, ToggleFavoriteResponse, UpdateAirplaneIssueInput, UpdateCommentInput, UpdatePostInput, User, UserAircraftRating, UserQualification, Waypoint };
|
|
422
|
+
export type { Activity, Address, AiSuggestedMilestone, AiSuggestion, AiSuggestionStatus, AircraftBlock, AircraftBlockReason, AircraftPosition, AircraftRating, Airplane, AirplaneIssue, AirplaneIssueSeverity, AirplaneIssueStatus, AirplanePermission, AirplaneShareInvite, Airport, Alert, AllowedDocumentType, ApiResponse, ApproachType, Avail, BackgroundTask, BackgroundTaskStatus, BaseMembership, BaseModel, Booking, Comment, Company, ComplianceData, ComplianceGroup, ComplianceGroupSource, ComplianceRequirement, ComplianceRequirementGroup, ComplianceResponse, ComplianceSummary, Course, CourseCheckSyllabus, CourseDescriptionSuggestionPayload, CourseEnrollment, CourseEnrollmentMetrics, CourseFee, CreateAirplaneIssueInput, CreateCommentInput, CreatePostInput, DataWrappedResponse, DeferAirplaneIssueInput, DiscardedRow, Document, DocumentComplianceStatus, DocumentRequirement, DocumentRequirementGroup, DocumentRequirementGroupAssignment, DocumentShare, DocumentType, Event, Expense, ExpenseItem, ExtendedAirplane, Fee, FeeCategoryOptions, FlightLog, GroupedPermissions, Invoice, Landing, LandingFee, LandingFeeImportResult, LandingFeeInvoiceApplyPayload, LandingFeeInvoiceApplyResult, LandingFeeInvoicePreview, LandingFeeInvoicePreviewRow, LandingFeeTemplateParams, LogbookFlightLogPayload, LogbookStageResult, LogbookSuggestion, LogbookSuggestionMeta, MaintenanceEvent, MaintenanceEventEstimation, MaintenanceStatus, Media, MediaCollection, Membership, MembershipSignup, PaginatedResponse, PermissionItem, Post, PrePaidPackage, Price, Qualification, RecurringFlight, ResolveAirplaneIssueInput, Resource, Role, RoleDetail, RoleListItem, Runway, ScheduledFlight, Setting, SpecialFlight, Tag, Ticket, ToggleFavoriteResponse, UpdateAirplaneIssueInput, UpdateCommentInput, UpdatePostInput, User, UserAircraftRating, UserQualification, Waypoint };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@updraft-solutions/mcrit-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Shared TypeScript types, Zod schemas, and pure helpers for the MCRIT aviation fleet management platform",
|
|
5
5
|
"homepage": "https://github.com/updraft-solutions/mcrit-sdk#readme",
|
|
6
6
|
"bugs": {
|
package/src/courses/index.ts
CHANGED
|
@@ -20,12 +20,12 @@ export interface CourseFeeLike extends FeeLike {
|
|
|
20
20
|
count?: number;
|
|
21
21
|
variant?: string | null;
|
|
22
22
|
is_optional?: boolean;
|
|
23
|
-
sort_order?: number;
|
|
23
|
+
sort_order?: number | null;
|
|
24
24
|
};
|
|
25
25
|
count?: number;
|
|
26
26
|
variant?: string | null;
|
|
27
27
|
is_optional?: boolean;
|
|
28
|
-
sort_order?: number;
|
|
28
|
+
sort_order?: number | null;
|
|
29
29
|
fee?: FeeLike;
|
|
30
30
|
}
|
|
31
31
|
|
package/src/index.ts
CHANGED
package/src/schemas/common.ts
CHANGED
|
@@ -3,10 +3,13 @@ import { z } from "zod";
|
|
|
3
3
|
// Shared helpers
|
|
4
4
|
export const zNullableBool = z.boolean().nullable().optional();
|
|
5
5
|
export const zNetGross = z.enum(["net", "gross"]).optional();
|
|
6
|
+
// Mirrors backend ContactData (all members null|string|Optional).
|
|
6
7
|
export const zContactDTO = z.object({
|
|
7
|
-
name: z.string().optional(),
|
|
8
|
-
email: z.string().
|
|
9
|
-
phone: z.string().optional(),
|
|
8
|
+
name: z.string().nullable().optional(),
|
|
9
|
+
email: z.string().nullable().optional(),
|
|
10
|
+
phone: z.string().nullable().optional(),
|
|
11
|
+
company: z.string().nullable().optional(),
|
|
12
|
+
fax: z.string().nullable().optional(),
|
|
10
13
|
});
|
|
11
14
|
export const zPhpMoneyObject = z.object({
|
|
12
15
|
amount: z.number(),
|
|
@@ -87,8 +90,19 @@ export const userSchema = z.object({
|
|
|
87
90
|
type: z.literal("user"),
|
|
88
91
|
id: z.number(),
|
|
89
92
|
name: z.string(),
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
firstname: z.string().nullable().optional(),
|
|
94
|
+
lastname: z.string().nullable().optional(),
|
|
95
|
+
// email/mobile are gate-guarded server-side (viewMail/viewMobile) and come
|
|
96
|
+
// back null when denied.
|
|
97
|
+
email: z.string().nullable().optional(),
|
|
98
|
+
mobile: z.string().nullable().optional(),
|
|
99
|
+
// UserResource media envelope (avatar/header, present when loaded).
|
|
100
|
+
media: z
|
|
101
|
+
.object({
|
|
102
|
+
avatar: mediaSchema.nullable().optional(),
|
|
103
|
+
header: mediaSchema.nullable().optional(),
|
|
104
|
+
})
|
|
105
|
+
.optional(),
|
|
92
106
|
// Present only on the authenticated-user payload while an admin
|
|
93
107
|
// impersonation session is active.
|
|
94
108
|
impersonation: impersonationStateSchema.optional(),
|
|
@@ -110,4 +124,21 @@ export const companySchema = z.object({
|
|
|
110
124
|
// e.g. "ai.logbook_import"). Serialized by CompanyResource alongside
|
|
111
125
|
// `permissions[]`; slim payloads may omit it.
|
|
112
126
|
entitlements: z.array(z.string()).optional(),
|
|
127
|
+
// BaseCompanyResource extras: cached-minified home airport + the
|
|
128
|
+
// distance computed on radius-filtered public listings.
|
|
129
|
+
airport_id: z.number().nullable().optional(),
|
|
130
|
+
airport: z
|
|
131
|
+
.object({
|
|
132
|
+
id: z.number(),
|
|
133
|
+
ident: z.string(),
|
|
134
|
+
name: z.string(),
|
|
135
|
+
municipality: z.string().nullable().optional(),
|
|
136
|
+
iso_country: z.string().nullable().optional(),
|
|
137
|
+
latitude_deg: z.number().nullable().optional(),
|
|
138
|
+
longitude_deg: z.number().nullable().optional(),
|
|
139
|
+
})
|
|
140
|
+
.nullable()
|
|
141
|
+
.optional(),
|
|
142
|
+
icao: z.string().nullable().optional(),
|
|
143
|
+
distance_in_km: z.number().optional(),
|
|
113
144
|
});
|
|
@@ -179,6 +179,9 @@ export const SignatureSchema = z.object({
|
|
|
179
179
|
status: z.enum(["pending", "signed", "revoked"]),
|
|
180
180
|
required_signer_membership_id: z.number().nullable(),
|
|
181
181
|
required_signer_name: z.string().nullable().optional(),
|
|
182
|
+
// Group designation: any member holding this permission at the template's
|
|
183
|
+
// company may sign (e.g. "formSubmission.signAsCompany").
|
|
184
|
+
required_signer_permission: z.string().nullable().optional(),
|
|
182
185
|
signed_by_user_id: z.number().nullable(),
|
|
183
186
|
signed_by_membership_id: z.number().nullable(),
|
|
184
187
|
signed_by_name: z.string().nullable().optional(),
|
package/src/schemas/models.ts
CHANGED
|
@@ -109,7 +109,7 @@ export const feeSchema = BaseModel.extend({
|
|
|
109
109
|
.nullable()
|
|
110
110
|
.optional(),
|
|
111
111
|
payment_per: z.string().nullable().optional(),
|
|
112
|
-
can: z.record(z.string(),
|
|
112
|
+
can: z.record(z.string(), z.boolean().nullable()).optional(),
|
|
113
113
|
course_count: z.number().optional(),
|
|
114
114
|
// feeables-pivot fields, present when the fee is serialized through an
|
|
115
115
|
// attachment (course/enrollment listings).
|
|
@@ -202,14 +202,51 @@ export const airplaneSchema = BaseModel.extend({
|
|
|
202
202
|
defaultFlightType: z.string().optional(),
|
|
203
203
|
defaultFlightRule: z.string().optional(),
|
|
204
204
|
status: z.string().optional(),
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
205
|
+
// Physical/capability facts — serialized by BaseAirplaneResource on EVERY
|
|
206
|
+
// airplane payload (not just the extended show shape).
|
|
207
|
+
minimumCrewCount: z.number().optional(),
|
|
208
|
+
classRating: z.string().nullable().optional(),
|
|
209
|
+
typeRating: z.string().nullable().optional(),
|
|
210
|
+
VFR: z.boolean().optional(),
|
|
211
|
+
VFRNight: z.boolean().optional(),
|
|
212
|
+
IFR: z.boolean().optional(),
|
|
213
|
+
IFRKnownIcing: z.boolean().optional(),
|
|
214
|
+
power: z.string().optional(),
|
|
215
|
+
fuel_type: z.string().optional(),
|
|
216
|
+
oil_min: z.string().optional(),
|
|
217
|
+
oil_max: z.string().optional(),
|
|
218
|
+
oil_type_winter: z.string().optional(),
|
|
219
|
+
oil_type_summer: z.string().optional(),
|
|
220
|
+
empty_weight: z.string().optional(),
|
|
221
|
+
max_takeoff_mass: z.string().optional(),
|
|
222
|
+
max_speed: z.string().optional(),
|
|
223
|
+
max_range: z.string().optional(),
|
|
224
|
+
equipment: z.array(equipmentSchema).optional(),
|
|
225
|
+
has_pre_paid_package: z.boolean().optional(),
|
|
226
|
+
logging_required_from: z.string().optional(),
|
|
227
|
+
fee_id: z.number().nullable().optional(),
|
|
228
|
+
booking_fee_id: z.number().nullable().optional(),
|
|
229
|
+
homebase: z
|
|
230
|
+
.object({
|
|
231
|
+
id: z.number(),
|
|
232
|
+
ident: z.string().optional(),
|
|
233
|
+
name: z.string().optional(),
|
|
234
|
+
})
|
|
235
|
+
.nullable()
|
|
236
|
+
.optional(),
|
|
237
|
+
// Loose record on purpose: gates are policy-reflected server-side and
|
|
238
|
+
// grow over time — same convention as companySchema.
|
|
239
|
+
can: z.record(z.string(), z.boolean().nullable()).optional(),
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Latest ADS-B position of the physical aircraft (eager-loaded relation on
|
|
244
|
+
* the company fleet-map payloads).
|
|
245
|
+
*/
|
|
246
|
+
export const aircraftPositionSchema = z.object({
|
|
247
|
+
lat: z.number().nullable().optional(),
|
|
248
|
+
lon: z.number().nullable().optional(),
|
|
249
|
+
timestamp: z.union([z.string(), z.number()]).nullable().optional(),
|
|
213
250
|
});
|
|
214
251
|
|
|
215
252
|
export const airplaneShareInviteSchema = z.object({
|
|
@@ -350,32 +387,8 @@ export const maintenanceStatusSchema = z.object({
|
|
|
350
387
|
.optional(),
|
|
351
388
|
});
|
|
352
389
|
|
|
390
|
+
// AirplaneResource extras on top of the base shape (show payloads, fleet map).
|
|
353
391
|
export const extendedAirplaneSchema = airplaneSchema.extend({
|
|
354
|
-
manufacturer: z.string().optional(),
|
|
355
|
-
capacity: z.number().optional(),
|
|
356
|
-
description: z.string().optional(),
|
|
357
|
-
homebase_id: z.number().optional(),
|
|
358
|
-
ato: z.boolean().optional(),
|
|
359
|
-
year_of_construction: z.string().optional(),
|
|
360
|
-
span: z.string().optional(),
|
|
361
|
-
height: z.string().optional(),
|
|
362
|
-
length: z.string().optional(),
|
|
363
|
-
empty_weight: z.string().optional(),
|
|
364
|
-
max_takeoff_mass: z.string().optional(),
|
|
365
|
-
max_speed: z.string().optional(),
|
|
366
|
-
max_range: z.string().optional(),
|
|
367
|
-
power: z.string().optional(),
|
|
368
|
-
fuel_type: z.string().optional(),
|
|
369
|
-
oil_min: z.string().optional(),
|
|
370
|
-
oil_max: z.string().optional(),
|
|
371
|
-
oil_type_winter: z.string().optional(),
|
|
372
|
-
oil_type_summer: z.string().optional(),
|
|
373
|
-
minimumCrewCount: z.number().optional(),
|
|
374
|
-
VFR: z.boolean().optional(),
|
|
375
|
-
VFRNight: z.boolean().optional(),
|
|
376
|
-
IFR: z.boolean().optional(),
|
|
377
|
-
IFRKnownIcing: z.boolean().optional(),
|
|
378
|
-
equipment: z.array(equipmentSchema).optional(),
|
|
379
392
|
contact: contactAttributeSchema.optional(),
|
|
380
393
|
hints: z
|
|
381
394
|
.object({
|
|
@@ -386,26 +399,16 @@ export const extendedAirplaneSchema = airplaneSchema.extend({
|
|
|
386
399
|
.optional(),
|
|
387
400
|
})
|
|
388
401
|
.optional(),
|
|
389
|
-
has_pre_paid_package: z.boolean().optional(),
|
|
390
|
-
fee_id: z.number().optional(),
|
|
391
|
-
booking_fee_id: z.number().optional(),
|
|
392
|
-
logging_required_from: z.string().optional(),
|
|
393
402
|
foreflight_profile_url: z.string().optional(),
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
403
|
+
company: companySchema.optional(),
|
|
404
|
+
latestPosition: aircraftPositionSchema.nullable().optional(),
|
|
405
|
+
total_flight_time_minutes: z.number().nullable().optional(),
|
|
406
|
+
elapsed_time: z.number().nullable().optional(),
|
|
407
|
+
remaining_time: z.number().nullable().optional(),
|
|
408
|
+
completed_at: z.string().nullable().optional(),
|
|
409
|
+
flight_log_enabled: z.boolean().optional(),
|
|
410
|
+
latest_maintenance_event: maintenanceEventSchema.nullable().optional(),
|
|
402
411
|
master_media: mediaCollection.optional(),
|
|
403
|
-
can: z
|
|
404
|
-
.object({
|
|
405
|
-
update: zNullableBool,
|
|
406
|
-
viewMaintenanceEvents: zNullableBool,
|
|
407
|
-
})
|
|
408
|
-
.optional(),
|
|
409
412
|
});
|
|
410
413
|
|
|
411
414
|
export const availSchema = z.object({
|
|
@@ -442,6 +445,26 @@ export const bookingWaypointSchema = z.object({
|
|
|
442
445
|
.optional(),
|
|
443
446
|
});
|
|
444
447
|
|
|
448
|
+
/**
|
|
449
|
+
* Spatie activity-log row (ActivityResource) — audit trail entries loaded on
|
|
450
|
+
* booking/invoice/event show payloads (`activities` relation).
|
|
451
|
+
*/
|
|
452
|
+
export const activitySchema = z.object({
|
|
453
|
+
id: z.number(),
|
|
454
|
+
log_name: z.string().nullable().optional(),
|
|
455
|
+
description: z.string().optional(),
|
|
456
|
+
event: z.string().nullable().optional(),
|
|
457
|
+
subject_type: z.string().nullable().optional(),
|
|
458
|
+
subject_id: z.number().nullable().optional(),
|
|
459
|
+
causer_type: z.string().nullable().optional(),
|
|
460
|
+
causer_id: z.number().nullable().optional(),
|
|
461
|
+
causer: userSchema.nullable().optional(),
|
|
462
|
+
properties: z.record(z.string(), z.unknown()).optional(),
|
|
463
|
+
batch_uuid: z.string().nullable().optional(),
|
|
464
|
+
created_at: z.string().optional(),
|
|
465
|
+
updated_at: z.string().optional(),
|
|
466
|
+
});
|
|
467
|
+
|
|
445
468
|
export const bookingSchema = BaseModel.extend({
|
|
446
469
|
type: z.literal("booking"),
|
|
447
470
|
ifr: z.boolean().default(false),
|
|
@@ -494,11 +517,17 @@ export const bookingSchema = BaseModel.extend({
|
|
|
494
517
|
.optional(),
|
|
495
518
|
contact: zContactDTO.optional(),
|
|
496
519
|
remarks: z.string().optional(),
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
520
|
+
ac_call: z.string().nullable().optional(),
|
|
521
|
+
ac_type: z.string().nullable().optional(),
|
|
522
|
+
// Audit trail (BookingResource `activities`, present when eager-loaded).
|
|
523
|
+
activities: z.array(activitySchema).optional(),
|
|
524
|
+
// Present when eager-loaded (BookingResource conditional appends). Lazy:
|
|
525
|
+
// both schemas are declared later in this file; there is no true cycle.
|
|
526
|
+
flight_logs: z.array(z.lazy(() => flightLogSchema)).optional(),
|
|
527
|
+
expense_items: z.array(z.lazy(() => expenseItemSchema)).optional(),
|
|
528
|
+
// Loose record on purpose: gates are policy-reflected server-side and
|
|
529
|
+
// grow over time — same convention as companySchema.
|
|
530
|
+
can: z.record(z.string(), z.boolean().nullable()).optional(),
|
|
502
531
|
});
|
|
503
532
|
|
|
504
533
|
export const alertSchema = z.object({
|
|
@@ -711,6 +740,9 @@ export const flightLogSchema = z.object({
|
|
|
711
740
|
id: z.number(),
|
|
712
741
|
airplane_id: z.number(),
|
|
713
742
|
airplane: airplaneSchema.optional(),
|
|
743
|
+
// Present when eager-loaded (FlightLogResource, camelCase key). Lazy:
|
|
744
|
+
// expenseItemSchema is declared later in this file; there is no true cycle.
|
|
745
|
+
expenseItems: z.array(z.lazy(() => expenseItemSchema)).optional(),
|
|
714
746
|
ac_type: z.string().nullable().optional(),
|
|
715
747
|
ac_reg: z.string().nullable().optional(),
|
|
716
748
|
ac_call: z.string().nullable().optional(),
|
|
@@ -799,16 +831,30 @@ export const invoiceSchema = z.object({
|
|
|
799
831
|
issuer_city: z.string().nullable().optional(),
|
|
800
832
|
issuer_zip: z.string().nullable().optional(),
|
|
801
833
|
issuer_state: z.string().nullable().optional(),
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
834
|
+
issuer_bank_name: z.string().nullable().optional(),
|
|
835
|
+
issuer_bic: z.string().nullable().optional(),
|
|
836
|
+
issuer_iban: z.string().nullable().optional(),
|
|
837
|
+
issuer_email: z.string().nullable().optional(),
|
|
838
|
+
issuer_phone: z.string().nullable().optional(),
|
|
839
|
+
issuer_vat_id: z.string().nullable().optional(),
|
|
840
|
+
issuer_register_court: z.string().nullable().optional(),
|
|
841
|
+
issuer_register_number: z.string().nullable().optional(),
|
|
842
|
+
gross_total: zPhpMoneyObject.nullable().optional(),
|
|
843
|
+
net_total: zPhpMoneyObject.nullable().optional(),
|
|
844
|
+
// InvoiceResource media envelope: only the generated PDF.
|
|
845
|
+
media: z
|
|
805
846
|
.object({
|
|
806
|
-
|
|
807
|
-
delete: zNullableBool,
|
|
808
|
-
release: zNullableBool,
|
|
809
|
-
view: zNullableBool,
|
|
847
|
+
pdf: mediaSchema.nullable().optional(),
|
|
810
848
|
})
|
|
811
849
|
.optional(),
|
|
850
|
+
pdf: z.string().nullable().optional(),
|
|
851
|
+
// Audit trail (InvoiceResource `activities`, present when eager-loaded).
|
|
852
|
+
activities: z.array(activitySchema).optional(),
|
|
853
|
+
created_at: z.string(),
|
|
854
|
+
updated_at: z.string(),
|
|
855
|
+
// Loose record on purpose: gates are policy-reflected server-side and
|
|
856
|
+
// grow over time — same convention as companySchema.
|
|
857
|
+
can: z.record(z.string(), z.boolean().nullable()).optional(),
|
|
812
858
|
});
|
|
813
859
|
|
|
814
860
|
export const scheduledFlightSchema = z.object({
|
|
@@ -900,11 +946,19 @@ export const courseSchema = z.object({
|
|
|
900
946
|
// Present only when the backend eager-loaded `checkSyllabi`.
|
|
901
947
|
check_syllabi: z.array(courseCheckSyllabusSchema).optional(),
|
|
902
948
|
tags: z.array(tagSchema).optional(),
|
|
949
|
+
// Attached fees (feeables pivot) + fees derived from them, when loaded.
|
|
950
|
+
fees: z.array(courseFeeSchema).optional(),
|
|
951
|
+
derived_fees: z.array(feeSchema).optional(),
|
|
952
|
+
fees_count: z.number().optional(),
|
|
953
|
+
is_public: z.boolean().optional(),
|
|
954
|
+
kind: z.string().optional(),
|
|
955
|
+
version: z.number().optional(),
|
|
956
|
+
media: mediaCollection,
|
|
903
957
|
created_at: z.string(),
|
|
904
958
|
updated_at: z.string(),
|
|
905
959
|
// Loose record on purpose: gates are policy-reflected server-side and
|
|
906
960
|
// grow over time (useAssistant, …) — same convention as companySchema.
|
|
907
|
-
can: z.record(z.string(),
|
|
961
|
+
can: z.record(z.string(), z.boolean().nullable()).optional(),
|
|
908
962
|
});
|
|
909
963
|
|
|
910
964
|
/**
|
|
@@ -947,11 +1001,44 @@ export const courseEnrollmentSchema = z.object({
|
|
|
947
1001
|
course: courseSchema.optional(),
|
|
948
1002
|
membership: membershipSchema.optional(),
|
|
949
1003
|
mentor: userSchema.optional(),
|
|
1004
|
+
// Present when eager-loaded (BaseCourseEnrollmentResource). Lazy: both
|
|
1005
|
+
// schemas are declared later in this file; there is no true cycle.
|
|
1006
|
+
expense_items: z.array(z.lazy(() => expenseItemSchema)).optional(),
|
|
1007
|
+
bookings: z.array(bookingSchema).optional(),
|
|
950
1008
|
// Loose record on purpose: gates are policy-reflected server-side and
|
|
951
1009
|
// grow over time (updateTraining, manageInitialPayment, …).
|
|
952
|
-
can: z.record(z.string(),
|
|
1010
|
+
can: z.record(z.string(), z.boolean().nullable()).optional(),
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
/**
|
|
1014
|
+
* Attendee row on an event (MembershipSignupResource — `event.signups`,
|
|
1015
|
+
* present when the relation is eager-loaded).
|
|
1016
|
+
*/
|
|
1017
|
+
export const membershipSignupSchema = z.object({
|
|
1018
|
+
id: z.number(),
|
|
1019
|
+
membership_id: z.number(),
|
|
1020
|
+
created_at: z.string().optional(),
|
|
1021
|
+
membership: z
|
|
1022
|
+
.object({
|
|
1023
|
+
id: z.number(),
|
|
1024
|
+
user_id: z.number().nullable().optional(),
|
|
1025
|
+
name: z.string(),
|
|
1026
|
+
user: z
|
|
1027
|
+
.object({
|
|
1028
|
+
name: z.string(),
|
|
1029
|
+
firstname: z.string().nullable().optional(),
|
|
1030
|
+
lastname: z.string().nullable().optional(),
|
|
1031
|
+
email: z.string().nullable().optional(),
|
|
1032
|
+
})
|
|
1033
|
+
.nullable()
|
|
1034
|
+
.optional(),
|
|
1035
|
+
})
|
|
1036
|
+
.nullable()
|
|
1037
|
+
.optional(),
|
|
953
1038
|
});
|
|
954
1039
|
|
|
1040
|
+
// Mirrors EventResource — company events with signups, media, and a contact
|
|
1041
|
+
// block; times render in the company timezone (UTC fallback).
|
|
955
1042
|
export const eventSchema = z.object({
|
|
956
1043
|
type: z.literal("event"),
|
|
957
1044
|
id: z.number(),
|
|
@@ -959,22 +1046,18 @@ export const eventSchema = z.object({
|
|
|
959
1046
|
company: companySchema.optional(),
|
|
960
1047
|
title: z.string(),
|
|
961
1048
|
description: z.string().nullable().optional(),
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
delete: zNullableBool,
|
|
975
|
-
attend: zNullableBool,
|
|
976
|
-
})
|
|
977
|
-
.optional(),
|
|
1049
|
+
media: mediaCollection,
|
|
1050
|
+
signups: z.array(membershipSignupSchema).optional(),
|
|
1051
|
+
signups_count: z.number().optional(),
|
|
1052
|
+
is_public: z.boolean(),
|
|
1053
|
+
contact: zContactDTO.nullable().optional(),
|
|
1054
|
+
start: z.string(),
|
|
1055
|
+
end: z.string().nullable().optional(),
|
|
1056
|
+
registrationDeadline: z.string().nullable().optional(),
|
|
1057
|
+
registrationIsBinding: z.boolean(),
|
|
1058
|
+
// Loose record on purpose: gates are policy-reflected server-side and
|
|
1059
|
+
// grow over time — same convention as companySchema.
|
|
1060
|
+
can: z.record(z.string(), z.boolean().nullable()).optional(),
|
|
978
1061
|
});
|
|
979
1062
|
|
|
980
1063
|
export const addressSchema = z.object({
|
package/src/schemas/training.ts
CHANGED
|
@@ -323,6 +323,7 @@ export const TrainingRecordStatusEnum = z.enum([
|
|
|
323
323
|
"draft",
|
|
324
324
|
"awaiting_signatures",
|
|
325
325
|
"signed",
|
|
326
|
+
"invalidated",
|
|
326
327
|
]);
|
|
327
328
|
export type TrainingRecordStatus = z.infer<typeof TrainingRecordStatusEnum>;
|
|
328
329
|
|
|
@@ -432,6 +433,27 @@ export const trainingRecordSchema = z.object({
|
|
|
432
433
|
repeat_next_flight: z.string().nullable().optional(),
|
|
433
434
|
entries: z.array(trainingRecordEntrySchema),
|
|
434
435
|
signatures: z.array(trainingSignatureSchema),
|
|
436
|
+
sequence: z.number().default(1),
|
|
437
|
+
supersedes_id: z.number().nullable().optional(),
|
|
438
|
+
invalidated_at: z.string().nullable().optional(),
|
|
439
|
+
invalidated_by: z
|
|
440
|
+
.object({ id: z.number(), name: z.string().nullable() })
|
|
441
|
+
.nullable()
|
|
442
|
+
.optional(),
|
|
443
|
+
invalidation_reason: z.string().nullable().optional(),
|
|
444
|
+
has_archived_pdf: z.boolean().optional(),
|
|
445
|
+
booking: z
|
|
446
|
+
.object({
|
|
447
|
+
id: z.number(),
|
|
448
|
+
etdZ: z.string().nullable(),
|
|
449
|
+
airplane_registration: z.string().nullable(),
|
|
450
|
+
})
|
|
451
|
+
.nullable()
|
|
452
|
+
.optional(),
|
|
453
|
+
instructor: z
|
|
454
|
+
.object({ id: z.number(), name: z.string().nullable() })
|
|
455
|
+
.nullable()
|
|
456
|
+
.optional(),
|
|
435
457
|
created_at: z.string().optional(),
|
|
436
458
|
updated_at: z.string().optional(),
|
|
437
459
|
});
|
|
@@ -455,6 +477,14 @@ export type UpsertTrainingRecordForm = z.infer<
|
|
|
455
477
|
typeof UpsertTrainingRecordFormSchema
|
|
456
478
|
>;
|
|
457
479
|
|
|
480
|
+
export const invalidateTrainingRecordResponseSchema = z.object({
|
|
481
|
+
record: trainingRecordSchema,
|
|
482
|
+
replacement: trainingRecordSchema.nullable(),
|
|
483
|
+
});
|
|
484
|
+
export type InvalidateTrainingRecordResponse = z.infer<
|
|
485
|
+
typeof invalidateTrainingRecordResponseSchema
|
|
486
|
+
>;
|
|
487
|
+
|
|
458
488
|
// ── Training template packs (syllabus templates) ──
|
|
459
489
|
|
|
460
490
|
export const trainingTemplatePackSchema = z.object({
|
package/src/types/models.ts
CHANGED
|
@@ -62,6 +62,9 @@ export type MaintenanceEventEstimation = z.infer<
|
|
|
62
62
|
>;
|
|
63
63
|
|
|
64
64
|
// Booking types
|
|
65
|
+
export type Activity = z.infer<typeof ModelSchemas.activitySchema>;
|
|
66
|
+
export type MembershipSignup = z.infer<typeof ModelSchemas.membershipSignupSchema>;
|
|
67
|
+
export type AircraftPosition = z.infer<typeof ModelSchemas.aircraftPositionSchema>;
|
|
65
68
|
export type Avail = z.infer<typeof ModelSchemas.availSchema>;
|
|
66
69
|
export type Alert = z.infer<typeof ModelSchemas.alertSchema>;
|
|
67
70
|
export type Booking = z.infer<typeof ModelSchemas.bookingSchema>;
|