@updraft-solutions/mcrit-sdk 0.16.0 → 0.18.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-7HPJT4VX.cjs → chunk-CY7AQXVQ.cjs} +124 -21
- package/dist/{chunk-4T3JURL3.js → chunk-SEJODI3S.js} +125 -22
- package/dist/{fbo-TbdcUaI9.d.cts → conversation-B-7Wh8pC.d.cts} +15976 -1956
- package/dist/{fbo-TbdcUaI9.d.ts → conversation-B-7Wh8pC.d.ts} +15976 -1956
- package/dist/index.cjs +21 -5
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -5
- package/dist/schemas/index.cjs +18 -2
- package/dist/schemas/index.d.cts +10 -10
- package/dist/schemas/index.d.ts +10 -10
- package/dist/schemas/index.js +17 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +11 -2
- package/dist/types/index.d.ts +11 -2
- package/dist/types/index.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +9 -0
- package/src/schemas/common.ts +7 -0
- package/src/schemas/conversation.spec.ts +128 -0
- package/src/schemas/conversation.ts +76 -0
- package/src/schemas/index.ts +1 -0
- package/src/schemas/models.ts +53 -22
- package/src/types/conversation.ts +11 -0
- package/src/types/index.ts +1 -0
- /package/dist/{chunk-CJHCF4FW.cjs → chunk-EWXSZOUI.cjs} +0 -0
- /package/dist/{chunk-ASPK4M5R.js → chunk-WCQXIIQB.js} +0 -0
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as FormFieldType, u as FormSubmissionStatus, t as FormSubmissionSource } from '../
|
|
2
|
-
export { A as AttachSyllabusElementForm, a as AttachSyllabusElementFormSchema, B as BaseModel, C as CourseCheckSyllabus, b as CreateFormSubmissionInput, c as CreateFormTemplateAssignmentInput, d as CreateFormTemplateInput, e as CreateSyllabusFromTemplateForm, f as CreateSyllabusFromTemplateFormSchema, g as CreateSyllabusFromTemplateResult, E as EnrollmentTrainingElement, h as EnrollmentTrainingStatus, i as EnrollmentTrainingStatusEnum, F as FBO_OPERATING_DAYS, j as FBO_SYSTEM_ROLES, k as FieldLabel, l as FieldLabelSchema, n as FormSubmission, o as FormSubmissionSchema, p as FormSubmissionShare, q as FormSubmissionShareBase, r as FormSubmissionShareBaseSchema, s as FormSubmissionShareSchema, v as FormTemplate, w as FormTemplateAssignment, x as FormTemplateAssignmentSchema, y as FormTemplateSchema, z as FuelUnit, G as GradeHistoryItem, D as GradingScale, H as GradingScaleForm, I as GradingScaleFormSchema, J as GradingScalePoint, K as ImpersonationParticipant, L as ImpersonationState, M as InvalidateTrainingRecordResponse, R as ReorderSyllabusElementItem, N as ReorderSyllabusElementItemSchema, O as RequiredForm, P as RequiredFormSchema, Q as RequiredFormVia, S as RequiredFormViaCrew, T as RequiredFormViaCrewSchema, U as RequiredFormViaSchema, V as ReviewFormSubmissionInput, W as SchemaField, X as SchemaFieldSchema, Y as SchemaSection, Z as SchemaSectionSchema, _ as ShowWhen, $ as ShowWhenSchema, a0 as SignOffTrainingElementForm, a1 as SignOffTrainingElementFormSchema, a2 as Signature, a3 as SignatureSchema, a4 as StoreSyllabusForm, a5 as StoreSyllabusFormSchema, a6 as SubmissionFile, a7 as SubmissionFileSchema, a8 as Syllabus, a9 as SyllabusElement, aa as SyllabusElementMutationResult, ab as SyllabusKind, ac as SyllabusKindEnum, ad as SyllabusRolloutResult, ae as SyllabusRolloutResultItem, af as SyllabusRolloutSkippedItem, ag as TemplateSchema, ah as TemplateSchemaSchema, ai as TrainingElement, aj as TrainingElementForm, ak as TrainingElementFormSchema, al as TrainingElementKind, am as TrainingElementKindEnum, an as TrainingRecord, ao as TrainingRecordEntry, ap as TrainingRecordEntryInput, aq as TrainingRecordResult, ar as TrainingRecordResultEnum, as as TrainingRecordStatus, at as TrainingRecordStatusEnum, au as TrainingSignature, av as TrainingTemplatePack, aw as UpdateFormTemplateInput, ax as UpdateSyllabusElementForm, ay as UpdateSyllabusElementFormSchema, az as UpdateSyllabusForm, aA as UpdateSyllabusFormSchema, aB as UpsertTrainingRecordForm, aC as UpsertTrainingRecordFormSchema, aD as UsedByCourse, aE as activitySchema, aF as addressSchema, aG as aircraftPositionSchema, aH as aircraftRatingSchema, aI as airplaneIssueSchema, aJ as airplaneIssueSeverityEnum, aK as airplaneIssueStatusEnum, aL as airplanePermissionSchema, aM as airplaneSchema, aN as airplaneShareInviteSchema, aO as airportSchema, aP as alertSchema, aQ as allowedDocumentTypeSchema, aR as approachTypeSchema, aS as availSchema, aT as baseMembershipSchema, aU as billingProfileSchema, aV as bookingSchema, aW as bookingWaypointSchema, aX as commentSchema, aY as companyIdentitySchema, aZ as companySchema, a_ as contactAttributeSchema, a$ as
|
|
1
|
+
import { m as FormFieldType, u as FormSubmissionStatus, t as FormSubmissionSource } from '../conversation-B-7Wh8pC.js';
|
|
2
|
+
export { A as AttachSyllabusElementForm, a as AttachSyllabusElementFormSchema, B as BaseModel, C as CourseCheckSyllabus, b as CreateFormSubmissionInput, c as CreateFormTemplateAssignmentInput, d as CreateFormTemplateInput, e as CreateSyllabusFromTemplateForm, f as CreateSyllabusFromTemplateFormSchema, g as CreateSyllabusFromTemplateResult, E as EnrollmentTrainingElement, h as EnrollmentTrainingStatus, i as EnrollmentTrainingStatusEnum, F as FBO_OPERATING_DAYS, j as FBO_SYSTEM_ROLES, k as FieldLabel, l as FieldLabelSchema, n as FormSubmission, o as FormSubmissionSchema, p as FormSubmissionShare, q as FormSubmissionShareBase, r as FormSubmissionShareBaseSchema, s as FormSubmissionShareSchema, v as FormTemplate, w as FormTemplateAssignment, x as FormTemplateAssignmentSchema, y as FormTemplateSchema, z as FuelUnit, G as GradeHistoryItem, D as GradingScale, H as GradingScaleForm, I as GradingScaleFormSchema, J as GradingScalePoint, K as ImpersonationParticipant, L as ImpersonationState, M as InvalidateTrainingRecordResponse, R as ReorderSyllabusElementItem, N as ReorderSyllabusElementItemSchema, O as RequiredForm, P as RequiredFormSchema, Q as RequiredFormVia, S as RequiredFormViaCrew, T as RequiredFormViaCrewSchema, U as RequiredFormViaSchema, V as ReviewFormSubmissionInput, W as SchemaField, X as SchemaFieldSchema, Y as SchemaSection, Z as SchemaSectionSchema, _ as ShowWhen, $ as ShowWhenSchema, a0 as SignOffTrainingElementForm, a1 as SignOffTrainingElementFormSchema, a2 as Signature, a3 as SignatureSchema, a4 as StoreSyllabusForm, a5 as StoreSyllabusFormSchema, a6 as SubmissionFile, a7 as SubmissionFileSchema, a8 as Syllabus, a9 as SyllabusElement, aa as SyllabusElementMutationResult, ab as SyllabusKind, ac as SyllabusKindEnum, ad as SyllabusRolloutResult, ae as SyllabusRolloutResultItem, af as SyllabusRolloutSkippedItem, ag as TemplateSchema, ah as TemplateSchemaSchema, ai as TrainingElement, aj as TrainingElementForm, ak as TrainingElementFormSchema, al as TrainingElementKind, am as TrainingElementKindEnum, an as TrainingRecord, ao as TrainingRecordEntry, ap as TrainingRecordEntryInput, aq as TrainingRecordResult, ar as TrainingRecordResultEnum, as as TrainingRecordStatus, at as TrainingRecordStatusEnum, au as TrainingSignature, av as TrainingTemplatePack, aw as UpdateFormTemplateInput, ax as UpdateSyllabusElementForm, ay as UpdateSyllabusElementFormSchema, az as UpdateSyllabusForm, aA as UpdateSyllabusFormSchema, aB as UpsertTrainingRecordForm, aC as UpsertTrainingRecordFormSchema, aD as UsedByCourse, aE as activitySchema, aF as addressSchema, aG as aircraftPositionSchema, aH as aircraftRatingSchema, aI as airplaneIssueSchema, aJ as airplaneIssueSeverityEnum, aK as airplaneIssueStatusEnum, aL as airplanePermissionSchema, aM as airplaneSchema, aN as airplaneShareInviteSchema, aO as airportSchema, aP as alertSchema, aQ as allowedDocumentTypeSchema, aR as approachTypeSchema, aS as availSchema, aT as baseMembershipSchema, aU as billingProfileSchema, aV as bookingSchema, aW as bookingWaypointSchema, aX as commentSchema, aY as companyIdentitySchema, aZ as companySchema, a_ as contactAttributeSchema, a$ as conversationKindSchema, b0 as conversationMessageSchema, b1 as conversationMessageSentEventSchema, b2 as conversationParticipantSchema, b3 as conversationReadEventSchema, b4 as conversationRecipientSchema, b5 as conversationSchema, b6 as conversationUnreadSummarySchema, b7 as courseCheckSyllabusSchema, b8 as courseEnrollmentMetricsSchema, b9 as courseEnrollmentSchema, ba as courseFeeSchema, bb as courseSchema, bc as createSyllabusFromTemplateResultSchema, bd as documentComplianceStatus, be as documentRequirement, bf as documentRequirementGroup, bg as documentRequirementGroupAssignment, bh as documentSchema, bi as documentShareSchema, bj as documentType, bk as enrollmentTrainingElementSchema, bl as eventSchema, bm as expenseItemSchema, bn as expenseSchema, bo as extendedAirplaneSchema, bp as fboAcceptanceAxisSchema, bq as fboAcceptanceStatusSchema, br as fboActivityCauserSchema, bs as fboActivityChangesSchema, bt as fboActivitySchema, bu as fboCompanyGrantInputSchema, bv as fboCompanyGrantSchema, bw as fboCompanyMemberSchema, bx as fboCompanyProfileSchema, by as fboCompanySchema, bz as fboDecisionAxisSchema, bA as fboDecisionInputSchema, bB as fboDecisionSchema, bC as fboDutyAffectedSchema, bD as fboDutySchema, bE as fboDutySeriesResponseSchema, bF as fboFlightCanSchema, bG as fboFlightDocumentSchema, bH as fboFlightSchema, bI as fboFlightStatusSchema, bJ as fboFlightTypeSchema, bK as fboGrantAbilityOptionSchema, bL as fboGrantAbilitySchema, 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 fboRowCanSchema, b$ as fboStatisticsSchema, c0 as fboSystemRoleSchema, c1 as fboTrafficLayerInputSchema, c2 as fboTrafficRowSchema, c3 as fboTrafficRowTypeSchema, c4 as fboTrafficSourceSchema, c5 as fboVisibilitySchema, c6 as fboWeeklyLandingSchema, c7 as feeCategoryOptionsSchema, c8 as feeSchema, c9 as flightLogSchema, ca as flightRequestAvailabilitySchema, cb as flightRequestBusyIntervalSchema, cc as flightRequestResponseSchema, cd as flightRequestResponseStatusSchema, ce as flightRequestSchema, cf as flightRequestSeatSchema, cg as flightRequestStatusSchema, ch as flightRequestWindowSchema, ci as fuelUnitSchema, cj as gradeHistoryItemSchema, ck as gradingScalePointSchema, cl as gradingScaleSchema, cm as impersonationParticipantSchema, cn as impersonationStateSchema, co as invalidateTrainingRecordResponseSchema, cp as invoiceSchema, cq as landingFeeSchema, cr as landingSchema, cs as maintenanceEventEstimationSchema, ct as maintenanceEventSchema, cu as maintenanceStatusSchema, cv as mediaCollection, cw as mediaSchema, cx as membershipIdentitySchema, cy as membershipSchema, cz as membershipSignupSchema, cA as nestedMembershipSchema, cB as postSchema, cC as postSubjectSchema, cD as prePaidPackageAssignmentSchema, 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, cN as syllabusElementMutationResultSchema, cO as syllabusElementSchema, cP as syllabusRolloutResultItemSchema, cQ as syllabusRolloutResultSchema, cR as syllabusRolloutSkippedItemSchema, cS as syllabusSchema, cT as tagSchema, cU as teachingPermissionSchema, cV as ticketSchema, cW as trainingElementSchema, cX as trainingRecordEntryInputSchema, cY as trainingRecordEntrySchema, cZ as trainingRecordSchema, c_ as trainingSignatureSchema, c$ as trainingTemplatePackSchema, d0 as usedByCourseSchema, d1 as userAircraftRatingSchema, d2 as userQualificationSchema, d3 as userSchema, d4 as waypointSchema, d5 as zContactDTO, d6 as zMoneyObject, d7 as zNetGross, d8 as zNullableBool } from '../conversation-B-7Wh8pC.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
declare enum FaqStatus {
|
|
@@ -3639,13 +3639,13 @@ declare const NewsletterCampaignRecipientSchema: z.ZodObject<{
|
|
|
3639
3639
|
id: number;
|
|
3640
3640
|
user_id: number | null;
|
|
3641
3641
|
newsletter_campaign_id: number;
|
|
3642
|
+
error?: string | null | undefined;
|
|
3642
3643
|
type?: "newsletter_campaign_recipient" | undefined;
|
|
3643
3644
|
user?: {
|
|
3644
3645
|
name: string;
|
|
3645
3646
|
id: number;
|
|
3646
3647
|
email?: string | undefined;
|
|
3647
3648
|
} | null | undefined;
|
|
3648
|
-
error?: string | null | undefined;
|
|
3649
3649
|
message_id?: string | null | undefined;
|
|
3650
3650
|
queued_at?: string | null | undefined;
|
|
3651
3651
|
sent_at?: string | null | undefined;
|
|
@@ -3657,13 +3657,13 @@ declare const NewsletterCampaignRecipientSchema: z.ZodObject<{
|
|
|
3657
3657
|
id: number;
|
|
3658
3658
|
user_id: number | null;
|
|
3659
3659
|
newsletter_campaign_id: number;
|
|
3660
|
+
error?: string | null | undefined;
|
|
3660
3661
|
type?: "newsletter_campaign_recipient" | undefined;
|
|
3661
3662
|
user?: {
|
|
3662
3663
|
name: string;
|
|
3663
3664
|
id: number;
|
|
3664
3665
|
email?: string | undefined;
|
|
3665
3666
|
} | null | undefined;
|
|
3666
|
-
error?: string | null | undefined;
|
|
3667
3667
|
message_id?: string | null | undefined;
|
|
3668
3668
|
queued_at?: string | null | undefined;
|
|
3669
3669
|
sent_at?: string | null | undefined;
|
|
@@ -4646,7 +4646,7 @@ declare const CompanySystemContractsResponseSchema: z.ZodObject<{
|
|
|
4646
4646
|
created_at: z.ZodOptional<z.ZodString>;
|
|
4647
4647
|
updated_at: z.ZodOptional<z.ZodString>;
|
|
4648
4648
|
}, "strip", z.ZodTypeAny, {
|
|
4649
|
-
status: "
|
|
4649
|
+
status: "pending" | "signed" | "revoked";
|
|
4650
4650
|
id: number;
|
|
4651
4651
|
field_key: string;
|
|
4652
4652
|
required_signer_membership_id: number | null;
|
|
@@ -4674,7 +4674,7 @@ declare const CompanySystemContractsResponseSchema: z.ZodObject<{
|
|
|
4674
4674
|
required_signer_permission?: string | null | undefined;
|
|
4675
4675
|
signed_by_name?: string | null | undefined;
|
|
4676
4676
|
}, {
|
|
4677
|
-
status: "
|
|
4677
|
+
status: "pending" | "signed" | "revoked";
|
|
4678
4678
|
id: number;
|
|
4679
4679
|
field_key: string;
|
|
4680
4680
|
required_signer_membership_id: number | null;
|
|
@@ -5301,7 +5301,7 @@ declare const CompanySystemContractsResponseSchema: z.ZodObject<{
|
|
|
5301
5301
|
is_expired: boolean;
|
|
5302
5302
|
expires_at?: string | null | undefined;
|
|
5303
5303
|
signatures?: {
|
|
5304
|
-
status: "
|
|
5304
|
+
status: "pending" | "signed" | "revoked";
|
|
5305
5305
|
id: number;
|
|
5306
5306
|
field_key: string;
|
|
5307
5307
|
required_signer_membership_id: number | null;
|
|
@@ -5495,7 +5495,7 @@ declare const CompanySystemContractsResponseSchema: z.ZodObject<{
|
|
|
5495
5495
|
expires_at?: string | null | undefined;
|
|
5496
5496
|
can?: Record<string, boolean | null> | undefined;
|
|
5497
5497
|
signatures?: {
|
|
5498
|
-
status: "
|
|
5498
|
+
status: "pending" | "signed" | "revoked";
|
|
5499
5499
|
id: number;
|
|
5500
5500
|
field_key: string;
|
|
5501
5501
|
required_signer_membership_id: number | null;
|
|
@@ -5718,7 +5718,7 @@ declare const CompanySystemContractsResponseSchema: z.ZodObject<{
|
|
|
5718
5718
|
is_expired: boolean;
|
|
5719
5719
|
expires_at?: string | null | undefined;
|
|
5720
5720
|
signatures?: {
|
|
5721
|
-
status: "
|
|
5721
|
+
status: "pending" | "signed" | "revoked";
|
|
5722
5722
|
id: number;
|
|
5723
5723
|
field_key: string;
|
|
5724
5724
|
required_signer_membership_id: number | null;
|
|
@@ -5917,7 +5917,7 @@ declare const CompanySystemContractsResponseSchema: z.ZodObject<{
|
|
|
5917
5917
|
expires_at?: string | null | undefined;
|
|
5918
5918
|
can?: Record<string, boolean | null> | undefined;
|
|
5919
5919
|
signatures?: {
|
|
5920
|
-
status: "
|
|
5920
|
+
status: "pending" | "signed" | "revoked";
|
|
5921
5921
|
id: number;
|
|
5922
5922
|
field_key: string;
|
|
5923
5923
|
required_signer_membership_id: number | null;
|
package/dist/schemas/index.js
CHANGED
|
@@ -120,6 +120,14 @@ import {
|
|
|
120
120
|
companyIdentitySchema,
|
|
121
121
|
companySchema,
|
|
122
122
|
contactAttributeSchema,
|
|
123
|
+
conversationKindSchema,
|
|
124
|
+
conversationMessageSchema,
|
|
125
|
+
conversationMessageSentEventSchema,
|
|
126
|
+
conversationParticipantSchema,
|
|
127
|
+
conversationReadEventSchema,
|
|
128
|
+
conversationRecipientSchema,
|
|
129
|
+
conversationSchema,
|
|
130
|
+
conversationUnreadSummarySchema,
|
|
123
131
|
courseCheckSyllabusSchema,
|
|
124
132
|
courseEnrollmentMetricsSchema,
|
|
125
133
|
courseEnrollmentMilestoneSchema,
|
|
@@ -253,7 +261,7 @@ import {
|
|
|
253
261
|
zMoneyObject,
|
|
254
262
|
zNetGross,
|
|
255
263
|
zNullableBool
|
|
256
|
-
} from "../chunk-
|
|
264
|
+
} from "../chunk-SEJODI3S.js";
|
|
257
265
|
export {
|
|
258
266
|
ALLOWED_GEOMETRY_TYPES,
|
|
259
267
|
ALLOWED_NEWSLETTER_VARIABLES,
|
|
@@ -376,6 +384,14 @@ export {
|
|
|
376
384
|
companyIdentitySchema,
|
|
377
385
|
companySchema,
|
|
378
386
|
contactAttributeSchema,
|
|
387
|
+
conversationKindSchema,
|
|
388
|
+
conversationMessageSchema,
|
|
389
|
+
conversationMessageSentEventSchema,
|
|
390
|
+
conversationParticipantSchema,
|
|
391
|
+
conversationReadEventSchema,
|
|
392
|
+
conversationRecipientSchema,
|
|
393
|
+
conversationSchema,
|
|
394
|
+
conversationUnreadSummarySchema,
|
|
379
395
|
courseCheckSyllabusSchema,
|
|
380
396
|
courseEnrollmentMetricsSchema,
|
|
381
397
|
courseEnrollmentMilestoneSchema,
|
package/dist/types/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require('../chunk-
|
|
1
|
+
"use strict";require('../chunk-EWXSZOUI.cjs');
|
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,
|
|
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-B-7Wh8pC.cjs';
|
|
3
3
|
|
|
4
4
|
type BaseModel = z.infer<typeof BaseModel$1>;
|
|
5
5
|
type User = z.infer<typeof userSchema>;
|
|
@@ -632,4 +632,13 @@ type FboCompanyGrantInput = z.infer<typeof fboCompanyGrantInputSchema>;
|
|
|
632
632
|
type FboMeta = z.infer<typeof fboMetaSchema>;
|
|
633
633
|
type FboCompany = z.infer<typeof fboCompanySchema>;
|
|
634
634
|
|
|
635
|
-
|
|
635
|
+
type ConversationKind = z.infer<typeof conversationKindSchema>;
|
|
636
|
+
type ConversationMessage = z.infer<typeof conversationMessageSchema>;
|
|
637
|
+
type ConversationParticipant = z.infer<typeof conversationParticipantSchema>;
|
|
638
|
+
type Conversation = z.infer<typeof conversationSchema>;
|
|
639
|
+
type ConversationRecipient = z.infer<typeof conversationRecipientSchema>;
|
|
640
|
+
type ConversationUnreadSummary = z.infer<typeof conversationUnreadSummarySchema>;
|
|
641
|
+
type ConversationMessageSentEvent = z.infer<typeof conversationMessageSentEventSchema>;
|
|
642
|
+
type ConversationReadEvent = z.infer<typeof conversationReadEventSchema>;
|
|
643
|
+
|
|
644
|
+
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, Conversation, ConversationKind, ConversationMessage, ConversationMessageSentEvent, ConversationParticipant, ConversationReadEvent, ConversationRecipient, ConversationUnreadSummary, Course, CourseCheckSyllabus, CourseDescriptionSuggestionPayload, CourseEnrollment, CourseEnrollmentMetrics, CourseFee, CreateAirplaneIssueInput, CreateCommentInput, CreatePostInput, DataWrappedResponse, DeferAirplaneIssueInput, DiscardedRow, Document, DocumentComplianceStatus, DocumentRequirement, DocumentRequirementGroup, DocumentRequirementGroupAssignment, DocumentShare, DocumentType, Event, Expense, ExpenseItem, ExtendedAirplane, FboAcceptanceAxis, FboAcceptanceStatus, FboActivity, FboActivityCauser, FboActivityChanges, FboCompany, FboCompanyGrant, FboCompanyGrantInput, FboCompanyMember, FboCompanyProfile, FboDecision, FboDecisionAxis, FboDecisionInput, FboDuty, FboDutyAffected, FboDutySeriesResponse, FboFlight, FboFlightDocument, FboFlightStatus, FboFlightType, FboGrantAbility, FboGrantAbilityOption, FboGrantCompanyRef, FboGroundServices, FboLandingsSummary, FboMaterialiseResult, FboMeta, FboNextDuty, FboOccupation, FboOperations, FboPerson, FboPob, FboRecurrence, FboRecurrenceType, FboRecurringFlight, FboRole, FboStatistics, FboSystemRole, FboTrafficLayerInput, FboTrafficRow, FboTrafficSource, FboVisibility, FboWeeklyLanding, Fee, FeeCategoryOptions, FlightLog, FlightRequest, FlightRequestAvailability, FlightRequestBusyInterval, FlightRequestResponse, FlightRequestResponseStatus, FlightRequestSeat, FlightRequestStatus, FlightRequestWindow, GroupedPermissions, Invoice, Landing, LandingFee, LandingFeeImportResult, LandingFeeInvoiceApplyPayload, LandingFeeInvoiceApplyResult, LandingFeeInvoicePreview, LandingFeeInvoicePreviewRow, LandingFeeTemplateParams, LogbookFlightLogPayload, LogbookStageResult, LogbookSuggestion, LogbookSuggestionMeta, MaintenanceEvent, MaintenanceEventEstimation, MaintenanceStatus, Media, MediaCollection, Membership, MembershipSignup, OperatingHourDay, OperatingHourException, OperatingHourExceptionInput, OperatingHourInterval, OperatingHourKind, OperatingHourResolvedDate, OperatingHourSchedule, OperatingHourScheduleInput, OperatingHourStatusEntry, OperatingHourWindow, OperatingHoursMeta, OperatingHoursNextOpenEntry, OperatingHoursNextOpenResponse, OperatingHoursStatusResponse, OperatingStatusValue, PaginatedResponse, PermissionItem, Post, PostSubject, PrePaidPackage, Price, Qualification, RecurringFlight, ResolveAirplaneIssueInput, Resource, Role, RoleDetail, RoleListItem, Runway, ScheduledFlight, Setting, SpecialFlight, Tag, TagSyncEntry, TeachingPermission, Ticket, TimeAnchor, 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 { 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,
|
|
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-B-7Wh8pC.js';
|
|
3
3
|
|
|
4
4
|
type BaseModel = z.infer<typeof BaseModel$1>;
|
|
5
5
|
type User = z.infer<typeof userSchema>;
|
|
@@ -632,4 +632,13 @@ type FboCompanyGrantInput = z.infer<typeof fboCompanyGrantInputSchema>;
|
|
|
632
632
|
type FboMeta = z.infer<typeof fboMetaSchema>;
|
|
633
633
|
type FboCompany = z.infer<typeof fboCompanySchema>;
|
|
634
634
|
|
|
635
|
-
|
|
635
|
+
type ConversationKind = z.infer<typeof conversationKindSchema>;
|
|
636
|
+
type ConversationMessage = z.infer<typeof conversationMessageSchema>;
|
|
637
|
+
type ConversationParticipant = z.infer<typeof conversationParticipantSchema>;
|
|
638
|
+
type Conversation = z.infer<typeof conversationSchema>;
|
|
639
|
+
type ConversationRecipient = z.infer<typeof conversationRecipientSchema>;
|
|
640
|
+
type ConversationUnreadSummary = z.infer<typeof conversationUnreadSummarySchema>;
|
|
641
|
+
type ConversationMessageSentEvent = z.infer<typeof conversationMessageSentEventSchema>;
|
|
642
|
+
type ConversationReadEvent = z.infer<typeof conversationReadEventSchema>;
|
|
643
|
+
|
|
644
|
+
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, Conversation, ConversationKind, ConversationMessage, ConversationMessageSentEvent, ConversationParticipant, ConversationReadEvent, ConversationRecipient, ConversationUnreadSummary, Course, CourseCheckSyllabus, CourseDescriptionSuggestionPayload, CourseEnrollment, CourseEnrollmentMetrics, CourseFee, CreateAirplaneIssueInput, CreateCommentInput, CreatePostInput, DataWrappedResponse, DeferAirplaneIssueInput, DiscardedRow, Document, DocumentComplianceStatus, DocumentRequirement, DocumentRequirementGroup, DocumentRequirementGroupAssignment, DocumentShare, DocumentType, Event, Expense, ExpenseItem, ExtendedAirplane, FboAcceptanceAxis, FboAcceptanceStatus, FboActivity, FboActivityCauser, FboActivityChanges, FboCompany, FboCompanyGrant, FboCompanyGrantInput, FboCompanyMember, FboCompanyProfile, FboDecision, FboDecisionAxis, FboDecisionInput, FboDuty, FboDutyAffected, FboDutySeriesResponse, FboFlight, FboFlightDocument, FboFlightStatus, FboFlightType, FboGrantAbility, FboGrantAbilityOption, FboGrantCompanyRef, FboGroundServices, FboLandingsSummary, FboMaterialiseResult, FboMeta, FboNextDuty, FboOccupation, FboOperations, FboPerson, FboPob, FboRecurrence, FboRecurrenceType, FboRecurringFlight, FboRole, FboStatistics, FboSystemRole, FboTrafficLayerInput, FboTrafficRow, FboTrafficSource, FboVisibility, FboWeeklyLanding, Fee, FeeCategoryOptions, FlightLog, FlightRequest, FlightRequestAvailability, FlightRequestBusyInterval, FlightRequestResponse, FlightRequestResponseStatus, FlightRequestSeat, FlightRequestStatus, FlightRequestWindow, GroupedPermissions, Invoice, Landing, LandingFee, LandingFeeImportResult, LandingFeeInvoiceApplyPayload, LandingFeeInvoiceApplyResult, LandingFeeInvoicePreview, LandingFeeInvoicePreviewRow, LandingFeeTemplateParams, LogbookFlightLogPayload, LogbookStageResult, LogbookSuggestion, LogbookSuggestionMeta, MaintenanceEvent, MaintenanceEventEstimation, MaintenanceStatus, Media, MediaCollection, Membership, MembershipSignup, OperatingHourDay, OperatingHourException, OperatingHourExceptionInput, OperatingHourInterval, OperatingHourKind, OperatingHourResolvedDate, OperatingHourSchedule, OperatingHourScheduleInput, OperatingHourStatusEntry, OperatingHourWindow, OperatingHoursMeta, OperatingHoursNextOpenEntry, OperatingHoursNextOpenResponse, OperatingHoursStatusResponse, OperatingStatusValue, PaginatedResponse, PermissionItem, Post, PostSubject, PrePaidPackage, Price, Qualification, RecurringFlight, ResolveAirplaneIssueInput, Resource, Role, RoleDetail, RoleListItem, Runway, ScheduledFlight, Setting, SpecialFlight, Tag, TagSyncEntry, TeachingPermission, Ticket, TimeAnchor, ToggleFavoriteResponse, UpdateAirplaneIssueInput, UpdateCommentInput, UpdatePostInput, User, UserAircraftRating, UserQualification, Waypoint };
|
package/dist/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-WCQXIIQB.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@updraft-solutions/mcrit-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.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/index.ts
CHANGED
|
@@ -180,6 +180,15 @@ export {
|
|
|
180
180
|
type FboCompanyGrantInput,
|
|
181
181
|
type FboMeta,
|
|
182
182
|
type FboCompany,
|
|
183
|
+
// types/conversation.ts
|
|
184
|
+
type ConversationKind,
|
|
185
|
+
type ConversationMessage,
|
|
186
|
+
type ConversationParticipant,
|
|
187
|
+
type Conversation,
|
|
188
|
+
type ConversationRecipient,
|
|
189
|
+
type ConversationUnreadSummary,
|
|
190
|
+
type ConversationMessageSentEvent,
|
|
191
|
+
type ConversationReadEvent,
|
|
183
192
|
} from "./types/index.js";
|
|
184
193
|
|
|
185
194
|
export * from "./money/index.js";
|
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
|
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
conversationMessageSchema,
|
|
4
|
+
conversationMessageSentEventSchema,
|
|
5
|
+
conversationParticipantSchema,
|
|
6
|
+
conversationReadEventSchema,
|
|
7
|
+
conversationRecipientSchema,
|
|
8
|
+
conversationSchema,
|
|
9
|
+
conversationUnreadSummarySchema,
|
|
10
|
+
} from "./conversation";
|
|
11
|
+
|
|
12
|
+
const message = {
|
|
13
|
+
type: "conversation_message",
|
|
14
|
+
id: 13,
|
|
15
|
+
conversation_id: 11,
|
|
16
|
+
participant_id: 17,
|
|
17
|
+
body: "Hallo",
|
|
18
|
+
client_id: null,
|
|
19
|
+
created_at: "2026-10-01T10:00:00+00:00",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const participant = {
|
|
23
|
+
type: "conversation_participant",
|
|
24
|
+
id: 17,
|
|
25
|
+
membership_id: 20,
|
|
26
|
+
user_id: 5,
|
|
27
|
+
name: "Anna Beispiel",
|
|
28
|
+
is_me: true,
|
|
29
|
+
is_active: true,
|
|
30
|
+
last_read_message_id: 13,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
describe("conversation schemas", () => {
|
|
34
|
+
it("parses a conversation with participants and a last message", () => {
|
|
35
|
+
const parsed = conversationSchema.parse({
|
|
36
|
+
type: "conversation",
|
|
37
|
+
id: 11,
|
|
38
|
+
company_id: 7,
|
|
39
|
+
kind: "direct",
|
|
40
|
+
participants: [participant, { ...participant, id: 18, membership_id: 21, user_id: 6, is_me: false, last_read_message_id: null }],
|
|
41
|
+
last_message: message,
|
|
42
|
+
unread_count: 0,
|
|
43
|
+
last_message_at: "2026-10-01T10:00:00+00:00",
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
expect(parsed.participants).toHaveLength(2);
|
|
47
|
+
expect(parsed.last_message?.body).toBe("Hallo");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("parses an empty conversation", () => {
|
|
51
|
+
const parsed = conversationSchema.parse({
|
|
52
|
+
type: "conversation",
|
|
53
|
+
id: 11,
|
|
54
|
+
company_id: 7,
|
|
55
|
+
kind: "direct",
|
|
56
|
+
participants: [participant],
|
|
57
|
+
last_message: null,
|
|
58
|
+
unread_count: 0,
|
|
59
|
+
last_message_at: null,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
expect(parsed.last_message).toBeNull();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("parses a participant whose membership is gone and whose name is hidden", () => {
|
|
66
|
+
const parsed = conversationParticipantSchema.parse({
|
|
67
|
+
...participant,
|
|
68
|
+
membership_id: null,
|
|
69
|
+
name: null,
|
|
70
|
+
is_me: false,
|
|
71
|
+
is_active: false,
|
|
72
|
+
last_read_message_id: null,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
expect(parsed.membership_id).toBeNull();
|
|
76
|
+
expect(parsed.name).toBeNull();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("rejects an unknown conversation kind", () => {
|
|
80
|
+
expect(() =>
|
|
81
|
+
conversationSchema.parse({
|
|
82
|
+
type: "conversation",
|
|
83
|
+
id: 11,
|
|
84
|
+
company_id: 7,
|
|
85
|
+
kind: "broadcast",
|
|
86
|
+
participants: [],
|
|
87
|
+
last_message: null,
|
|
88
|
+
unread_count: 0,
|
|
89
|
+
last_message_at: null,
|
|
90
|
+
}),
|
|
91
|
+
).toThrow();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("drops contact data that a participant payload should never carry", () => {
|
|
95
|
+
const parsed = conversationParticipantSchema.parse({ ...participant, email: "anna@example.test", mobile: "+49 170 1" });
|
|
96
|
+
|
|
97
|
+
expect(parsed).not.toHaveProperty("email");
|
|
98
|
+
expect(parsed).not.toHaveProperty("mobile");
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("parses a message with a client id", () => {
|
|
102
|
+
const parsed = conversationMessageSchema.parse({ ...message, client_id: "0b6f6a0e-3c1b-4c0e-9d5e-2f0b8f6a1c11" });
|
|
103
|
+
|
|
104
|
+
expect(parsed.client_id).toBe("0b6f6a0e-3c1b-4c0e-9d5e-2f0b8f6a1c11");
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("requires a message timestamp", () => {
|
|
108
|
+
expect(() => conversationMessageSchema.parse({ ...message, created_at: null })).toThrow();
|
|
109
|
+
|
|
110
|
+
const { created_at: _dropped, ...withoutTimestamp } = message;
|
|
111
|
+
expect(() => conversationMessageSchema.parse(withoutTimestamp)).toThrow();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("parses a recipient and an unread summary row", () => {
|
|
115
|
+
expect(conversationRecipientSchema.parse({ type: "conversation_recipient", membership_id: 21, user_id: 6, name: "Ben Muster" }).name).toBe("Ben Muster");
|
|
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);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it("parses both realtime events", () => {
|
|
121
|
+
expect(conversationMessageSentEventSchema.parse({ company_id: 7, conversation_id: 11, message_id: 13, participant_id: 17 }).message_id).toBe(13);
|
|
122
|
+
expect(conversationReadEventSchema.parse({ company_id: 7, conversation_id: 11, participant_id: 17, last_read_message_id: 13 }).last_read_message_id).toBe(13);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("rejects a realtime event that carries no ids", () => {
|
|
126
|
+
expect(() => conversationMessageSentEventSchema.parse({ body: "Hallo" })).toThrow();
|
|
127
|
+
});
|
|
128
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Member messaging: private conversations between members of one company.
|
|
5
|
+
* No payload in this domain carries contact data of a participant.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const conversationKindSchema = z.enum(["direct"]);
|
|
9
|
+
|
|
10
|
+
export const conversationMessageSchema = z.object({
|
|
11
|
+
type: z.literal("conversation_message"),
|
|
12
|
+
id: z.number(),
|
|
13
|
+
conversation_id: z.number(),
|
|
14
|
+
/** The sending participant (not a membership: the participant outlives it). */
|
|
15
|
+
participant_id: z.number(),
|
|
16
|
+
body: z.string(),
|
|
17
|
+
/** Set by the sending client; the same id on a retry returns the stored message. */
|
|
18
|
+
client_id: z.string().nullable(),
|
|
19
|
+
created_at: z.string(),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const conversationParticipantSchema = z.object({
|
|
23
|
+
type: z.literal("conversation_participant"),
|
|
24
|
+
id: z.number(),
|
|
25
|
+
/** Null once the person has left the company. */
|
|
26
|
+
membership_id: z.number().nullable(),
|
|
27
|
+
user_id: z.number(),
|
|
28
|
+
/** Null when the person hides their name from the viewer. */
|
|
29
|
+
name: z.string().nullable(),
|
|
30
|
+
is_me: z.boolean(),
|
|
31
|
+
/** False once the membership is gone or no longer confirmed — sending is rejected. */
|
|
32
|
+
is_active: z.boolean(),
|
|
33
|
+
/** Everything up to this message id is read by this participant. */
|
|
34
|
+
last_read_message_id: z.number().nullable(),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const conversationSchema = z.object({
|
|
38
|
+
type: z.literal("conversation"),
|
|
39
|
+
id: z.number(),
|
|
40
|
+
company_id: z.number(),
|
|
41
|
+
kind: conversationKindSchema,
|
|
42
|
+
participants: z.array(conversationParticipantSchema),
|
|
43
|
+
last_message: conversationMessageSchema.nullable(),
|
|
44
|
+
/** Messages above the viewer's own read pointer. */
|
|
45
|
+
unread_count: z.number(),
|
|
46
|
+
last_message_at: z.string().nullable(),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const conversationRecipientSchema = z.object({
|
|
50
|
+
type: z.literal("conversation_recipient"),
|
|
51
|
+
membership_id: z.number(),
|
|
52
|
+
user_id: z.number(),
|
|
53
|
+
name: z.string(),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const conversationUnreadSummarySchema = z.object({
|
|
57
|
+
company_id: z.number(),
|
|
58
|
+
unread_conversations: z.number(),
|
|
59
|
+
/** Whether the viewer may start a conversation at this company. */
|
|
60
|
+
can_create: z.boolean().optional(),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/** Realtime events carry ids only; the text is fetched through the API. */
|
|
64
|
+
export const conversationMessageSentEventSchema = z.object({
|
|
65
|
+
company_id: z.number(),
|
|
66
|
+
conversation_id: z.number(),
|
|
67
|
+
message_id: z.number(),
|
|
68
|
+
participant_id: z.number(),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export const conversationReadEventSchema = z.object({
|
|
72
|
+
company_id: z.number(),
|
|
73
|
+
conversation_id: z.number(),
|
|
74
|
+
participant_id: z.number(),
|
|
75
|
+
last_read_message_id: z.number(),
|
|
76
|
+
});
|
package/src/schemas/index.ts
CHANGED
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(),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type * as Conversations from "../schemas/conversation";
|
|
3
|
+
|
|
4
|
+
export type ConversationKind = z.infer<typeof Conversations.conversationKindSchema>;
|
|
5
|
+
export type ConversationMessage = z.infer<typeof Conversations.conversationMessageSchema>;
|
|
6
|
+
export type ConversationParticipant = z.infer<typeof Conversations.conversationParticipantSchema>;
|
|
7
|
+
export type Conversation = z.infer<typeof Conversations.conversationSchema>;
|
|
8
|
+
export type ConversationRecipient = z.infer<typeof Conversations.conversationRecipientSchema>;
|
|
9
|
+
export type ConversationUnreadSummary = z.infer<typeof Conversations.conversationUnreadSummarySchema>;
|
|
10
|
+
export type ConversationMessageSentEvent = z.infer<typeof Conversations.conversationMessageSentEventSchema>;
|
|
11
|
+
export type ConversationReadEvent = z.infer<typeof Conversations.conversationReadEventSchema>;
|
package/src/types/index.ts
CHANGED
|
File without changes
|
|
File without changes
|