@updraft-solutions/mcrit-sdk 0.17.0 → 0.18.2
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-RKSVNZQ7.cjs → chunk-CY7AQXVQ.cjs} +55 -22
- package/dist/{chunk-Q2UPZUCE.js → chunk-SEJODI3S.js} +55 -22
- package/dist/{conversation-CJlHvwCn.d.cts → conversation-CTsrnpb0.d.cts} +33209 -19433
- package/dist/{conversation-CJlHvwCn.d.ts → conversation-CTsrnpb0.d.ts} +33209 -19433
- package/dist/index.cjs +10 -10
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +59 -59
- package/dist/schemas/index.cjs +2 -2
- package/dist/schemas/index.d.cts +196 -196
- package/dist/schemas/index.d.ts +196 -196
- package/dist/schemas/index.js +1 -1
- package/dist/types/index.d.cts +7 -2
- package/dist/types/index.d.ts +7 -2
- package/package.json +1 -1
- package/src/schemas/common.ts +7 -0
- package/src/schemas/conversation.spec.ts +1 -0
- package/src/schemas/conversation.ts +2 -0
- package/src/schemas/models.ts +53 -22
- package/src/types/roles.ts +6 -1
package/dist/schemas/index.js
CHANGED
package/dist/types/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { aE as activitySchema, aF as addressSchema, aG as aircraftPositionSchema, aH as aircraftRatingSchema, aM as airplaneSchema, aL as airplanePermissionSchema, aN as airplaneShareInviteSchema, aO as airportSchema, aP as alertSchema, aQ as allowedDocumentTypeSchema, aR as approachTypeSchema, aS as availSchema, aT as baseMembershipSchema, aV as bookingSchema, aX as commentSchema, aZ as companySchema, bb as courseSchema, b9 as courseEnrollmentSchema, ba as courseFeeSchema, aJ as airplaneIssueSeverityEnum, bh as documentSchema, bd as documentComplianceStatus, be as documentRequirement, bf as documentRequirementGroup, bg as documentRequirementGroupAssignment, bi as documentShareSchema, bj as documentType, bl as eventSchema, bn as expenseSchema, bm as expenseItemSchema, bo as extendedAirplaneSchema, c8 as feeSchema, c7 as feeCategoryOptionsSchema, c9 as flightLogSchema, ce as flightRequestSchema, ca as flightRequestAvailabilitySchema, cb as flightRequestBusyIntervalSchema, cc as flightRequestResponseSchema, cd as flightRequestResponseStatusSchema, cf as flightRequestSeatSchema, cg as flightRequestStatusSchema, ch as flightRequestWindowSchema, cp as invoiceSchema, cr as landingSchema, cq as landingFeeSchema, ct as maintenanceEventSchema, cs as maintenanceEventEstimationSchema, cu as maintenanceStatusSchema, cv as mediaCollection, cy as membershipSchema, cz as membershipSignupSchema, cB as postSchema, cC as postSubjectSchema, cE as prePaidPackageSchema, cF as priceSchema, cG as qualificationSchema, cH as recurringFlightSchema, cI as roleSchema, cJ as runwaySchema, cK as scheduledFlightSchema, cL as settingSchema, cM as specialFlightSchema, cT as tagSchema, cU as teachingPermissionSchema, cV as ticketSchema, d3 as userSchema, d1 as userAircraftRatingSchema, d2 as userQualificationSchema, d4 as waypointSchema, aI as airplaneIssueSchema, aK as airplaneIssueStatusEnum, B as BaseModel$1, b7 as courseCheckSyllabusSchema, b8 as courseEnrollmentMetricsSchema, cw as mediaSchema, n as FormSubmission, bp as fboAcceptanceAxisSchema, bq as fboAcceptanceStatusSchema, bt as fboActivitySchema, br as fboActivityCauserSchema, bs as fboActivityChangesSchema, by as fboCompanySchema, bv as fboCompanyGrantSchema, bu as fboCompanyGrantInputSchema, bw as fboCompanyMemberSchema, bx as fboCompanyProfileSchema, bB as fboDecisionSchema, bz as fboDecisionAxisSchema, bA as fboDecisionInputSchema, bD as fboDutySchema, bC as fboDutyAffectedSchema, bE as fboDutySeriesResponseSchema, bH as fboFlightSchema, bG as fboFlightDocumentSchema, bI as fboFlightStatusSchema, bJ as fboFlightTypeSchema, bL as fboGrantAbilitySchema, bK as fboGrantAbilityOptionSchema, bM as fboGrantCompanyRefSchema, bN as fboGroundServicesSchema, bO as fboLandingsSummarySchema, bP as fboMaterialiseResultSchema, bQ as fboMetaSchema, bR as fboNextDutySchema, bS as fboOccupationSchema, bT as fboOperationsSchema, bU as fboPersonSchema, bV as fboPobSchema, bW as fboRecurrenceSchema, bX as fboRecurrenceTypeSchema, bY as fboRecurringFlightSchema, bZ as fboRoleSchema, b$ as fboStatisticsSchema, c0 as fboSystemRoleSchema, c1 as fboTrafficLayerInputSchema, c2 as fboTrafficRowSchema, c4 as fboTrafficSourceSchema, c5 as fboVisibilitySchema, c6 as fboWeeklyLandingSchema, b5 as conversationSchema, a$ as conversationKindSchema, b0 as conversationMessageSchema, b1 as conversationMessageSentEventSchema, b2 as conversationParticipantSchema, b3 as conversationReadEventSchema, b4 as conversationRecipientSchema, b6 as conversationUnreadSummarySchema } from '../conversation-
|
|
2
|
+
import { aE as activitySchema, aF as addressSchema, aG as aircraftPositionSchema, aH as aircraftRatingSchema, aM as airplaneSchema, aL as airplanePermissionSchema, aN as airplaneShareInviteSchema, aO as airportSchema, aP as alertSchema, aQ as allowedDocumentTypeSchema, aR as approachTypeSchema, aS as availSchema, aT as baseMembershipSchema, aV as bookingSchema, aX as commentSchema, aZ as companySchema, bb as courseSchema, b9 as courseEnrollmentSchema, ba as courseFeeSchema, aJ as airplaneIssueSeverityEnum, bh as documentSchema, bd as documentComplianceStatus, be as documentRequirement, bf as documentRequirementGroup, bg as documentRequirementGroupAssignment, bi as documentShareSchema, bj as documentType, bl as eventSchema, bn as expenseSchema, bm as expenseItemSchema, bo as extendedAirplaneSchema, c8 as feeSchema, c7 as feeCategoryOptionsSchema, c9 as flightLogSchema, ce as flightRequestSchema, ca as flightRequestAvailabilitySchema, cb as flightRequestBusyIntervalSchema, cc as flightRequestResponseSchema, cd as flightRequestResponseStatusSchema, cf as flightRequestSeatSchema, cg as flightRequestStatusSchema, ch as flightRequestWindowSchema, cp as invoiceSchema, cr as landingSchema, cq as landingFeeSchema, ct as maintenanceEventSchema, cs as maintenanceEventEstimationSchema, cu as maintenanceStatusSchema, cv as mediaCollection, cy as membershipSchema, cz as membershipSignupSchema, cB as postSchema, cC as postSubjectSchema, cE as prePaidPackageSchema, cF as priceSchema, cG as qualificationSchema, cH as recurringFlightSchema, cI as roleSchema, cJ as runwaySchema, cK as scheduledFlightSchema, cL as settingSchema, cM as specialFlightSchema, cT as tagSchema, cU as teachingPermissionSchema, cV as ticketSchema, d3 as userSchema, d1 as userAircraftRatingSchema, d2 as userQualificationSchema, d4 as waypointSchema, aI as airplaneIssueSchema, aK as airplaneIssueStatusEnum, B as BaseModel$1, b7 as courseCheckSyllabusSchema, b8 as courseEnrollmentMetricsSchema, cw as mediaSchema, n as FormSubmission, bp as fboAcceptanceAxisSchema, bq as fboAcceptanceStatusSchema, bt as fboActivitySchema, br as fboActivityCauserSchema, bs as fboActivityChangesSchema, by as fboCompanySchema, bv as fboCompanyGrantSchema, bu as fboCompanyGrantInputSchema, bw as fboCompanyMemberSchema, bx as fboCompanyProfileSchema, bB as fboDecisionSchema, bz as fboDecisionAxisSchema, bA as fboDecisionInputSchema, bD as fboDutySchema, bC as fboDutyAffectedSchema, bE as fboDutySeriesResponseSchema, bH as fboFlightSchema, bG as fboFlightDocumentSchema, bI as fboFlightStatusSchema, bJ as fboFlightTypeSchema, bL as fboGrantAbilitySchema, bK as fboGrantAbilityOptionSchema, bM as fboGrantCompanyRefSchema, bN as fboGroundServicesSchema, bO as fboLandingsSummarySchema, bP as fboMaterialiseResultSchema, bQ as fboMetaSchema, bR as fboNextDutySchema, bS as fboOccupationSchema, bT as fboOperationsSchema, bU as fboPersonSchema, bV as fboPobSchema, bW as fboRecurrenceSchema, bX as fboRecurrenceTypeSchema, bY as fboRecurringFlightSchema, bZ as fboRoleSchema, b$ as fboStatisticsSchema, c0 as fboSystemRoleSchema, c1 as fboTrafficLayerInputSchema, c2 as fboTrafficRowSchema, c4 as fboTrafficSourceSchema, c5 as fboVisibilitySchema, c6 as fboWeeklyLandingSchema, b5 as conversationSchema, a$ as conversationKindSchema, b0 as conversationMessageSchema, b1 as conversationMessageSentEventSchema, b2 as conversationParticipantSchema, b3 as conversationReadEventSchema, b4 as conversationRecipientSchema, b6 as conversationUnreadSummarySchema } from '../conversation-CTsrnpb0.cjs';
|
|
3
3
|
|
|
4
4
|
type BaseModel = z.infer<typeof BaseModel$1>;
|
|
5
5
|
type User = z.infer<typeof userSchema>;
|
|
@@ -340,7 +340,12 @@ interface RoleListItem {
|
|
|
340
340
|
is_system: boolean;
|
|
341
341
|
has_duties: boolean;
|
|
342
342
|
company_id: number | null;
|
|
343
|
-
|
|
343
|
+
/**
|
|
344
|
+
* How many permissions the role carries. Only callers allowed to manage
|
|
345
|
+
* roles at the company receive it; every other member gets the role's
|
|
346
|
+
* public face (id, name, description, flags, company) without it.
|
|
347
|
+
*/
|
|
348
|
+
permissions_count?: number;
|
|
344
349
|
/**
|
|
345
350
|
* Which domain the role belongs to. FBO roles come only from the FBO role
|
|
346
351
|
* listing, non-FBO (system + company custom) roles only from the company
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { aE as activitySchema, aF as addressSchema, aG as aircraftPositionSchema, aH as aircraftRatingSchema, aM as airplaneSchema, aL as airplanePermissionSchema, aN as airplaneShareInviteSchema, aO as airportSchema, aP as alertSchema, aQ as allowedDocumentTypeSchema, aR as approachTypeSchema, aS as availSchema, aT as baseMembershipSchema, aV as bookingSchema, aX as commentSchema, aZ as companySchema, bb as courseSchema, b9 as courseEnrollmentSchema, ba as courseFeeSchema, aJ as airplaneIssueSeverityEnum, bh as documentSchema, bd as documentComplianceStatus, be as documentRequirement, bf as documentRequirementGroup, bg as documentRequirementGroupAssignment, bi as documentShareSchema, bj as documentType, bl as eventSchema, bn as expenseSchema, bm as expenseItemSchema, bo as extendedAirplaneSchema, c8 as feeSchema, c7 as feeCategoryOptionsSchema, c9 as flightLogSchema, ce as flightRequestSchema, ca as flightRequestAvailabilitySchema, cb as flightRequestBusyIntervalSchema, cc as flightRequestResponseSchema, cd as flightRequestResponseStatusSchema, cf as flightRequestSeatSchema, cg as flightRequestStatusSchema, ch as flightRequestWindowSchema, cp as invoiceSchema, cr as landingSchema, cq as landingFeeSchema, ct as maintenanceEventSchema, cs as maintenanceEventEstimationSchema, cu as maintenanceStatusSchema, cv as mediaCollection, cy as membershipSchema, cz as membershipSignupSchema, cB as postSchema, cC as postSubjectSchema, cE as prePaidPackageSchema, cF as priceSchema, cG as qualificationSchema, cH as recurringFlightSchema, cI as roleSchema, cJ as runwaySchema, cK as scheduledFlightSchema, cL as settingSchema, cM as specialFlightSchema, cT as tagSchema, cU as teachingPermissionSchema, cV as ticketSchema, d3 as userSchema, d1 as userAircraftRatingSchema, d2 as userQualificationSchema, d4 as waypointSchema, aI as airplaneIssueSchema, aK as airplaneIssueStatusEnum, B as BaseModel$1, b7 as courseCheckSyllabusSchema, b8 as courseEnrollmentMetricsSchema, cw as mediaSchema, n as FormSubmission, bp as fboAcceptanceAxisSchema, bq as fboAcceptanceStatusSchema, bt as fboActivitySchema, br as fboActivityCauserSchema, bs as fboActivityChangesSchema, by as fboCompanySchema, bv as fboCompanyGrantSchema, bu as fboCompanyGrantInputSchema, bw as fboCompanyMemberSchema, bx as fboCompanyProfileSchema, bB as fboDecisionSchema, bz as fboDecisionAxisSchema, bA as fboDecisionInputSchema, bD as fboDutySchema, bC as fboDutyAffectedSchema, bE as fboDutySeriesResponseSchema, bH as fboFlightSchema, bG as fboFlightDocumentSchema, bI as fboFlightStatusSchema, bJ as fboFlightTypeSchema, bL as fboGrantAbilitySchema, bK as fboGrantAbilityOptionSchema, bM as fboGrantCompanyRefSchema, bN as fboGroundServicesSchema, bO as fboLandingsSummarySchema, bP as fboMaterialiseResultSchema, bQ as fboMetaSchema, bR as fboNextDutySchema, bS as fboOccupationSchema, bT as fboOperationsSchema, bU as fboPersonSchema, bV as fboPobSchema, bW as fboRecurrenceSchema, bX as fboRecurrenceTypeSchema, bY as fboRecurringFlightSchema, bZ as fboRoleSchema, b$ as fboStatisticsSchema, c0 as fboSystemRoleSchema, c1 as fboTrafficLayerInputSchema, c2 as fboTrafficRowSchema, c4 as fboTrafficSourceSchema, c5 as fboVisibilitySchema, c6 as fboWeeklyLandingSchema, b5 as conversationSchema, a$ as conversationKindSchema, b0 as conversationMessageSchema, b1 as conversationMessageSentEventSchema, b2 as conversationParticipantSchema, b3 as conversationReadEventSchema, b4 as conversationRecipientSchema, b6 as conversationUnreadSummarySchema } from '../conversation-
|
|
2
|
+
import { aE as activitySchema, aF as addressSchema, aG as aircraftPositionSchema, aH as aircraftRatingSchema, aM as airplaneSchema, aL as airplanePermissionSchema, aN as airplaneShareInviteSchema, aO as airportSchema, aP as alertSchema, aQ as allowedDocumentTypeSchema, aR as approachTypeSchema, aS as availSchema, aT as baseMembershipSchema, aV as bookingSchema, aX as commentSchema, aZ as companySchema, bb as courseSchema, b9 as courseEnrollmentSchema, ba as courseFeeSchema, aJ as airplaneIssueSeverityEnum, bh as documentSchema, bd as documentComplianceStatus, be as documentRequirement, bf as documentRequirementGroup, bg as documentRequirementGroupAssignment, bi as documentShareSchema, bj as documentType, bl as eventSchema, bn as expenseSchema, bm as expenseItemSchema, bo as extendedAirplaneSchema, c8 as feeSchema, c7 as feeCategoryOptionsSchema, c9 as flightLogSchema, ce as flightRequestSchema, ca as flightRequestAvailabilitySchema, cb as flightRequestBusyIntervalSchema, cc as flightRequestResponseSchema, cd as flightRequestResponseStatusSchema, cf as flightRequestSeatSchema, cg as flightRequestStatusSchema, ch as flightRequestWindowSchema, cp as invoiceSchema, cr as landingSchema, cq as landingFeeSchema, ct as maintenanceEventSchema, cs as maintenanceEventEstimationSchema, cu as maintenanceStatusSchema, cv as mediaCollection, cy as membershipSchema, cz as membershipSignupSchema, cB as postSchema, cC as postSubjectSchema, cE as prePaidPackageSchema, cF as priceSchema, cG as qualificationSchema, cH as recurringFlightSchema, cI as roleSchema, cJ as runwaySchema, cK as scheduledFlightSchema, cL as settingSchema, cM as specialFlightSchema, cT as tagSchema, cU as teachingPermissionSchema, cV as ticketSchema, d3 as userSchema, d1 as userAircraftRatingSchema, d2 as userQualificationSchema, d4 as waypointSchema, aI as airplaneIssueSchema, aK as airplaneIssueStatusEnum, B as BaseModel$1, b7 as courseCheckSyllabusSchema, b8 as courseEnrollmentMetricsSchema, cw as mediaSchema, n as FormSubmission, bp as fboAcceptanceAxisSchema, bq as fboAcceptanceStatusSchema, bt as fboActivitySchema, br as fboActivityCauserSchema, bs as fboActivityChangesSchema, by as fboCompanySchema, bv as fboCompanyGrantSchema, bu as fboCompanyGrantInputSchema, bw as fboCompanyMemberSchema, bx as fboCompanyProfileSchema, bB as fboDecisionSchema, bz as fboDecisionAxisSchema, bA as fboDecisionInputSchema, bD as fboDutySchema, bC as fboDutyAffectedSchema, bE as fboDutySeriesResponseSchema, bH as fboFlightSchema, bG as fboFlightDocumentSchema, bI as fboFlightStatusSchema, bJ as fboFlightTypeSchema, bL as fboGrantAbilitySchema, bK as fboGrantAbilityOptionSchema, bM as fboGrantCompanyRefSchema, bN as fboGroundServicesSchema, bO as fboLandingsSummarySchema, bP as fboMaterialiseResultSchema, bQ as fboMetaSchema, bR as fboNextDutySchema, bS as fboOccupationSchema, bT as fboOperationsSchema, bU as fboPersonSchema, bV as fboPobSchema, bW as fboRecurrenceSchema, bX as fboRecurrenceTypeSchema, bY as fboRecurringFlightSchema, bZ as fboRoleSchema, b$ as fboStatisticsSchema, c0 as fboSystemRoleSchema, c1 as fboTrafficLayerInputSchema, c2 as fboTrafficRowSchema, c4 as fboTrafficSourceSchema, c5 as fboVisibilitySchema, c6 as fboWeeklyLandingSchema, b5 as conversationSchema, a$ as conversationKindSchema, b0 as conversationMessageSchema, b1 as conversationMessageSentEventSchema, b2 as conversationParticipantSchema, b3 as conversationReadEventSchema, b4 as conversationRecipientSchema, b6 as conversationUnreadSummarySchema } from '../conversation-CTsrnpb0.js';
|
|
3
3
|
|
|
4
4
|
type BaseModel = z.infer<typeof BaseModel$1>;
|
|
5
5
|
type User = z.infer<typeof userSchema>;
|
|
@@ -340,7 +340,12 @@ interface RoleListItem {
|
|
|
340
340
|
is_system: boolean;
|
|
341
341
|
has_duties: boolean;
|
|
342
342
|
company_id: number | null;
|
|
343
|
-
|
|
343
|
+
/**
|
|
344
|
+
* How many permissions the role carries. Only callers allowed to manage
|
|
345
|
+
* roles at the company receive it; every other member gets the role's
|
|
346
|
+
* public face (id, name, description, flags, company) without it.
|
|
347
|
+
*/
|
|
348
|
+
permissions_count?: number;
|
|
344
349
|
/**
|
|
345
350
|
* Which domain the role belongs to. FBO roles come only from the FBO role
|
|
346
351
|
* listing, non-FBO (system + company custom) roles only from the company
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@updraft-solutions/mcrit-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.2",
|
|
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/schemas/common.ts
CHANGED
|
@@ -168,4 +168,11 @@ export const companySchema = z.object({
|
|
|
168
168
|
.optional(),
|
|
169
169
|
icao: z.string().nullable().optional(),
|
|
170
170
|
distance_in_km: z.number().optional(),
|
|
171
|
+
// Tax details: `tax_number` only reaches users who may view company
|
|
172
|
+
// details (like `vat`); the VAT-exemption fields + `vat_exemption_codes`
|
|
173
|
+
// come from the super-admin AdminCompanyResource.
|
|
174
|
+
tax_number: z.string().nullable().optional(),
|
|
175
|
+
vat_exemption_code: z.string().nullable().optional(),
|
|
176
|
+
vat_exemption_text: z.string().nullable().optional(),
|
|
177
|
+
vat_exemption_codes: z.array(z.string()).optional(),
|
|
171
178
|
});
|
|
@@ -114,6 +114,7 @@ describe("conversation schemas", () => {
|
|
|
114
114
|
it("parses a recipient and an unread summary row", () => {
|
|
115
115
|
expect(conversationRecipientSchema.parse({ type: "conversation_recipient", membership_id: 21, user_id: 6, name: "Ben Muster" }).name).toBe("Ben Muster");
|
|
116
116
|
expect(conversationUnreadSummarySchema.parse({ company_id: 7, unread_conversations: 2 }).unread_conversations).toBe(2);
|
|
117
|
+
expect(conversationUnreadSummarySchema.parse({ company_id: 7, unread_conversations: 2, can_create: false }).can_create).toBe(false);
|
|
117
118
|
});
|
|
118
119
|
|
|
119
120
|
it("parses both realtime events", () => {
|
|
@@ -56,6 +56,8 @@ export const conversationRecipientSchema = z.object({
|
|
|
56
56
|
export const conversationUnreadSummarySchema = z.object({
|
|
57
57
|
company_id: z.number(),
|
|
58
58
|
unread_conversations: z.number(),
|
|
59
|
+
/** Whether the viewer may start a conversation at this company. */
|
|
60
|
+
can_create: z.boolean().optional(),
|
|
59
61
|
});
|
|
60
62
|
|
|
61
63
|
/** Realtime events carry ids only; the text is fetched through the API. */
|
package/src/schemas/models.ts
CHANGED
|
@@ -1530,28 +1530,6 @@ export const specialFlightSchema = z.object({
|
|
|
1530
1530
|
updated_at: z.string(),
|
|
1531
1531
|
});
|
|
1532
1532
|
|
|
1533
|
-
export const prePaidPackageSchema = z.object({
|
|
1534
|
-
type: z.literal("prePaidPackage"),
|
|
1535
|
-
id: z.number(),
|
|
1536
|
-
company_id: z.number(),
|
|
1537
|
-
company: companySchema.optional(),
|
|
1538
|
-
name: z.string(),
|
|
1539
|
-
description: z.string().nullable().optional(),
|
|
1540
|
-
balance: zMoneyObject,
|
|
1541
|
-
initial_amount: zMoneyObject,
|
|
1542
|
-
discount_percentage: z.number().nullable().optional(),
|
|
1543
|
-
valid_until: z.string().nullable().optional(),
|
|
1544
|
-
created_at: z.string(),
|
|
1545
|
-
updated_at: z.string(),
|
|
1546
|
-
can: z
|
|
1547
|
-
.object({
|
|
1548
|
-
update: zNullableBool,
|
|
1549
|
-
delete: zNullableBool,
|
|
1550
|
-
assign: zNullableBool,
|
|
1551
|
-
})
|
|
1552
|
-
.optional(),
|
|
1553
|
-
});
|
|
1554
|
-
|
|
1555
1533
|
// A billing line-item (flight charge, landing fee, membership fee, refund,
|
|
1556
1534
|
// …) attached to a flight log / booking / membership via the polymorphic
|
|
1557
1535
|
// (model_type, model_id) pair, and to an invoice once released. NOT a
|
|
@@ -1638,6 +1616,59 @@ export const expenseItemSchema = z.object({
|
|
|
1638
1616
|
is_snapshot: z.boolean().optional(),
|
|
1639
1617
|
});
|
|
1640
1618
|
|
|
1619
|
+
// Rebuilt field-by-field against PrePaidPackageResource (the previous shape —
|
|
1620
|
+
// name/balance/initial_amount/valid_until — was never sent by the API).
|
|
1621
|
+
// Accounting-internal keys (refund_reason/refund_reference/refundedBy) only
|
|
1622
|
+
// reach users with `prePaidPackage.view`; relations only when eager-loaded.
|
|
1623
|
+
export const prePaidPackageSchema = z.object({
|
|
1624
|
+
type: z.literal("prePaidPackage"),
|
|
1625
|
+
id: z.number(),
|
|
1626
|
+
membership_id: z.number(),
|
|
1627
|
+
membership: membershipIdentitySchema.optional(),
|
|
1628
|
+
invoice_id: z.number().nullable(),
|
|
1629
|
+
company_id: z.number(),
|
|
1630
|
+
billable: z.boolean(),
|
|
1631
|
+
billing_profile_id: z.number().nullable(),
|
|
1632
|
+
billingProfile: billingProfileSchema.optional(),
|
|
1633
|
+
allowed_billing_profile_ids: z.array(z.number()).optional(),
|
|
1634
|
+
allowedBillingProfiles: z.array(billingProfileSchema).optional(),
|
|
1635
|
+
covers_school_flights: z.boolean(),
|
|
1636
|
+
allowed_course_enrollment_ids: z.array(z.number()).optional(),
|
|
1637
|
+
allowedCourseEnrollments: z
|
|
1638
|
+
.array(
|
|
1639
|
+
z.object({
|
|
1640
|
+
id: z.number(),
|
|
1641
|
+
course_id: z.number(),
|
|
1642
|
+
course_name: z.string().nullable().optional(),
|
|
1643
|
+
}),
|
|
1644
|
+
)
|
|
1645
|
+
.optional(),
|
|
1646
|
+
flightLogs: z.array(flightLogSchema).optional(),
|
|
1647
|
+
expenseItems: z.array(expenseItemSchema).optional(),
|
|
1648
|
+
assignedExpenseItems: z.array(expenseItemSchema).optional(),
|
|
1649
|
+
prePaidPackageAssignments: z.array(prePaidPackageAssignmentSchema).optional(),
|
|
1650
|
+
remarks: z.string().nullable(),
|
|
1651
|
+
// Two-decimal amount, serialised as a string ("120.00").
|
|
1652
|
+
total: z.union([z.string(), z.number()]),
|
|
1653
|
+
remaining_gross_value: zMoneyObject,
|
|
1654
|
+
initial_gross_value: zMoneyObject,
|
|
1655
|
+
approved_applications: z.array(z.string()),
|
|
1656
|
+
usage: z.number(),
|
|
1657
|
+
valid_from: z.string().nullable(),
|
|
1658
|
+
expires_at: z.string().nullable(),
|
|
1659
|
+
created_at: z.string(),
|
|
1660
|
+
refunded_at: z.string().nullable(),
|
|
1661
|
+
refunded_gross_value: zMoneyObject.nullable(),
|
|
1662
|
+
refund_gross_total: zMoneyObject.nullable(),
|
|
1663
|
+
refund_reason: z.string().nullable().optional(),
|
|
1664
|
+
refund_reference: z.string().nullable().optional(),
|
|
1665
|
+
refundedBy: z
|
|
1666
|
+
.object({ id: z.number(), name: z.string() })
|
|
1667
|
+
.nullable()
|
|
1668
|
+
.optional(),
|
|
1669
|
+
can: z.record(z.string(), z.boolean().nullable()).optional(),
|
|
1670
|
+
});
|
|
1671
|
+
|
|
1641
1672
|
export const waypointSchema = z.object({
|
|
1642
1673
|
type: z.literal("waypoint"),
|
|
1643
1674
|
id: z.number(),
|
package/src/types/roles.ts
CHANGED
|
@@ -7,7 +7,12 @@ export interface RoleListItem {
|
|
|
7
7
|
is_system: boolean;
|
|
8
8
|
has_duties: boolean;
|
|
9
9
|
company_id: number | null;
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* How many permissions the role carries. Only callers allowed to manage
|
|
12
|
+
* roles at the company receive it; every other member gets the role's
|
|
13
|
+
* public face (id, name, description, flags, company) without it.
|
|
14
|
+
*/
|
|
15
|
+
permissions_count?: number;
|
|
11
16
|
/**
|
|
12
17
|
* Which domain the role belongs to. FBO roles come only from the FBO role
|
|
13
18
|
* listing, non-FBO (system + company custom) roles only from the company
|