evo360-types 1.3.570 → 1.3.574
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/apps/evo-crm/lead/zod-schemas.d.ts +9 -9
- package/dist/apps/evo-csq/zod-schemas.d.ts +12 -12
- package/dist/apps/evo-finops/zod-schemas.d.ts +18 -18
- package/dist/apps/evo-med/dic/zod-schemas.d.ts +2 -2
- package/dist/apps/evo-med/people/zod-schemas.d.ts +45 -45
- package/dist/apps/evo-notifications/quick-reply-action/zod-schemas.d.ts +3 -0
- package/dist/apps/evo-notifications/quick-reply-action/zod-schemas.js +3 -0
- package/dist/apps/evo-notifications/quick-reply-action/zod-schemas.ts +3 -0
- package/dist/apps/evo-notifications/zod-schemas.d.ts +69 -39
- package/dist/apps/evo-task/zod-schemas.d.ts +69 -69
- package/dist/apps/evo-task/zod-schemas.js +8 -0
- package/dist/apps/evo-task/zod-schemas.ts +8 -0
- package/dist/apps/evo-telemedicine/zod-schemas.d.ts +1445 -0
- package/dist/apps/evo-telemedicine/zod-schemas.js +641 -0
- package/dist/apps/evo-telemedicine/zod-schemas.ts +723 -0
- package/dist/apps/evo-tenant/zod-schemas.d.ts +94 -0
- package/dist/apps/evo-tenant/zod-schemas.js +29 -1
- package/dist/apps/evo-tenant/zod-schemas.ts +32 -1
- package/dist/apps/hub-automation/zod-schemas.d.ts +172 -172
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.ts +2 -0
- package/dist/types/evo-med/calendar/index.d.ts +6 -0
- package/dist/types/evo-med/calendar/index.js +6 -0
- package/dist/types/evo-med/calendar/index.ts +6 -0
- package/dist/types/evo-notifications/index.d.ts +13 -0
- package/dist/types/evo-notifications/index.js +6 -0
- package/dist/types/evo-notifications/index.ts +13 -0
- package/dist/types/evo-task/index.d.ts +1 -0
- package/dist/types/evo-task/index.js +8 -0
- package/dist/types/evo-task/index.ts +8 -0
- package/dist/types/evo-telemedicine/fb_collections.d.ts +16 -0
- package/dist/types/evo-telemedicine/fb_collections.js +38 -0
- package/dist/types/evo-telemedicine/fb_collections.ts +37 -0
- package/dist/types/evo-telemedicine/index.d.ts +890 -0
- package/dist/types/evo-telemedicine/index.js +361 -0
- package/dist/types/evo-telemedicine/index.ts +1046 -0
- package/dist/types/evo-tenant/index.d.ts +45 -0
- package/dist/types/evo-tenant/index.js +20 -1
- package/dist/types/evo-tenant/index.ts +65 -0
- package/dist/types/shared/external-links.d.ts +6 -0
- package/dist/types/shared/external-links.js +6 -0
- package/dist/types/shared/external-links.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.zEndCommandSchema = exports.zAccessRevokeCommandSchema = exports.zAccessSendCommandSchema = exports.zReassignHostCommandSchema = exports.zWaitingPolicyCommandSchema = exports.zTelemedicineGrantIndexSchema = exports.zTelemedicineTranscriptionConfigSchema = exports.zTelemedicineRolloutSchema = exports.zTelemedicineLegalTextSchema = exports.zTelemedicineEntitlementAuditSchema = exports.zTelemedicineAppointmentIndexSchema = exports.zTeleconsultationAccessGrantSchema = exports.zTeleconsultationWebhookEventSchema = exports.zTeleconsultationEventSchema = exports.zTeleconsultationArtifactSchema = exports.zTeleconsultationConsentSchema = exports.zTeleconsultationConsentEvidenceSchema = exports.zTeleconsultationParticipantSchema = exports.zTeleconsultationSchema = exports.zTeleconsultationEventActorSchema = exports.zTeleconsultationEntitlementSnapshotSchema = exports.zTeleconsultationEndedBySchema = exports.zTeleconsultationEventMetadataSchema = exports.zTelemedicineErrorCodeSchema = exports.zEntitlementAuditActionSchema = exports.zTranscriptionProviderSchema = exports.zLegalTextStatusSchema = exports.zWebhookEventStatusSchema = exports.zTeleconsultationEventTypeSchema = exports.zTeleconsultationEventSourceSchema = exports.zTeleconsultationEventActorTypeSchema = exports.zEndedByTypeSchema = exports.zAccessSendChannelKindSchema = exports.zAccessGrantStateSchema = exports.zAccessGrantKindSchema = exports.zArtifactStatusSchema = exports.zArtifactTypeSchema = exports.zConsentActorTypeSchema = exports.zConsentDecisionSchema = exports.zConsentSubjectSchema = exports.zTranscriptionStatusSchema = exports.zRecordingStatusSchema = exports.zIdentityLevelSchema = exports.zPresenceStateSchema = exports.zParticipantStateSchema = exports.zParticipantRoleSchema = exports.zTeleconsultationProviderSchema = exports.zTeleconsultationModeSchema = exports.zWaitingPolicySchema = exports.zTeleconsultationStatusSchema = void 0;
|
|
4
|
+
exports.zTelemetryCommandSchema = exports.zRecordingStopCommandSchema = exports.zRecordingConsentCommandSchema = exports.zRecordingRequestCommandSchema = exports.zRejectCommandSchema = exports.zAdmitCommandSchema = exports.zPresenceCommandSchema = exports.zConsentCommandSchema = exports.zIdentityVerifyCommandSchema = exports.zExchangeCommandSchema = void 0;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const zod_schemas_1 = require("../shared/zod-schemas");
|
|
7
|
+
const zod_schemas_2 = require("../evo-tenant/zod-schemas");
|
|
8
|
+
// ======================================================
|
|
9
|
+
// evo-telemedicine (feat-160) — zod schemas
|
|
10
|
+
//
|
|
11
|
+
// Espelhos À MÃO dos enums/interfaces em types/evo-telemedicine/index.ts (o
|
|
12
|
+
// repo não gera um lado a partir do outro). Ao acrescentar um valor no `*Enum`
|
|
13
|
+
// TS, acrescente aqui — e vice-versa. Doc schemas usam `.passthrough()` para
|
|
14
|
+
// tolerar campos aditivos sem republish; command schemas são ESTRITOS (fronteira
|
|
15
|
+
// HTTP) e nunca aceitam `tenant` no body.
|
|
16
|
+
// ======================================================
|
|
17
|
+
// ----- Enums ----------------------------------------------------------------
|
|
18
|
+
/** Espelha `TeleconsultationStatusEnum`. */
|
|
19
|
+
exports.zTeleconsultationStatusSchema = zod_1.z.enum([
|
|
20
|
+
"scheduled",
|
|
21
|
+
"open",
|
|
22
|
+
"live",
|
|
23
|
+
"reconnecting",
|
|
24
|
+
"ending",
|
|
25
|
+
"ended",
|
|
26
|
+
"cancelled",
|
|
27
|
+
"expired",
|
|
28
|
+
]);
|
|
29
|
+
/** Espelha `WaitingPolicyEnum`. */
|
|
30
|
+
exports.zWaitingPolicySchema = zod_1.z.enum([
|
|
31
|
+
"manual_admit",
|
|
32
|
+
"auto_when_doctor_present",
|
|
33
|
+
]);
|
|
34
|
+
/** Espelha `TeleconsultationModeEnum`. */
|
|
35
|
+
exports.zTeleconsultationModeSchema = zod_1.z.enum([
|
|
36
|
+
"audio_video",
|
|
37
|
+
"audio_only_allowed",
|
|
38
|
+
]);
|
|
39
|
+
/** Espelha `TeleconsultationProviderEnum`. */
|
|
40
|
+
exports.zTeleconsultationProviderSchema = zod_1.z.enum(["realtimekit"]);
|
|
41
|
+
/** Espelha `ParticipantRoleEnum`. */
|
|
42
|
+
exports.zParticipantRoleSchema = zod_1.z.enum(["doctor", "patient"]);
|
|
43
|
+
/** Espelha `ParticipantStateEnum`. */
|
|
44
|
+
exports.zParticipantStateSchema = zod_1.z.enum([
|
|
45
|
+
"invited",
|
|
46
|
+
"verified",
|
|
47
|
+
"waiting",
|
|
48
|
+
"connected",
|
|
49
|
+
"disconnected",
|
|
50
|
+
"left",
|
|
51
|
+
]);
|
|
52
|
+
/** Espelha `PresenceStateEnum` (subconjunto reportável pelo cliente). */
|
|
53
|
+
exports.zPresenceStateSchema = zod_1.z.enum([
|
|
54
|
+
"waiting",
|
|
55
|
+
"connected",
|
|
56
|
+
"disconnected",
|
|
57
|
+
"left",
|
|
58
|
+
]);
|
|
59
|
+
/** Espelha `IdentityLevelEnum`. */
|
|
60
|
+
exports.zIdentityLevelSchema = zod_1.z.enum(["none", "weak", "strong"]);
|
|
61
|
+
/** Espelha `RecordingStatusEnum`. */
|
|
62
|
+
exports.zRecordingStatusSchema = zod_1.z.enum([
|
|
63
|
+
"idle",
|
|
64
|
+
"consent_pending",
|
|
65
|
+
"recording",
|
|
66
|
+
"stopping",
|
|
67
|
+
"failed",
|
|
68
|
+
]);
|
|
69
|
+
/** Espelha `TranscriptionStatusEnum`. */
|
|
70
|
+
exports.zTranscriptionStatusSchema = zod_1.z.enum([
|
|
71
|
+
"not_requested",
|
|
72
|
+
"queued",
|
|
73
|
+
"processing",
|
|
74
|
+
"ready",
|
|
75
|
+
"failed",
|
|
76
|
+
"deleted",
|
|
77
|
+
]);
|
|
78
|
+
/** Espelha `ConsentSubjectEnum`. */
|
|
79
|
+
exports.zConsentSubjectSchema = zod_1.z.enum([
|
|
80
|
+
"terms",
|
|
81
|
+
"privacy",
|
|
82
|
+
"recording",
|
|
83
|
+
"transcription",
|
|
84
|
+
]);
|
|
85
|
+
/** Espelha `ConsentDecisionEnum`. */
|
|
86
|
+
exports.zConsentDecisionSchema = zod_1.z.enum([
|
|
87
|
+
"accepted",
|
|
88
|
+
"declined",
|
|
89
|
+
"withdrawn",
|
|
90
|
+
]);
|
|
91
|
+
/** Espelha `ConsentActorTypeEnum`. */
|
|
92
|
+
exports.zConsentActorTypeSchema = zod_1.z.enum(["patient", "doctor"]);
|
|
93
|
+
/** Espelha `ArtifactTypeEnum`. */
|
|
94
|
+
exports.zArtifactTypeSchema = zod_1.z.enum([
|
|
95
|
+
"recording_audio_video",
|
|
96
|
+
"recording_audio",
|
|
97
|
+
"transcript",
|
|
98
|
+
]);
|
|
99
|
+
/** Espelha `ArtifactStatusEnum`. */
|
|
100
|
+
exports.zArtifactStatusSchema = zod_1.z.enum([
|
|
101
|
+
"pending",
|
|
102
|
+
"processing",
|
|
103
|
+
"ready",
|
|
104
|
+
"failed",
|
|
105
|
+
"deleting",
|
|
106
|
+
"deleted",
|
|
107
|
+
]);
|
|
108
|
+
/** Espelha `AccessGrantKindEnum`. */
|
|
109
|
+
exports.zAccessGrantKindSchema = zod_1.z.enum([
|
|
110
|
+
"qr_capability",
|
|
111
|
+
"launch_code",
|
|
112
|
+
"browser_session",
|
|
113
|
+
]);
|
|
114
|
+
/** Espelha `AccessGrantStateEnum`. */
|
|
115
|
+
exports.zAccessGrantStateSchema = zod_1.z.enum([
|
|
116
|
+
"active",
|
|
117
|
+
"consumed",
|
|
118
|
+
"blocked",
|
|
119
|
+
"revoked",
|
|
120
|
+
"expired",
|
|
121
|
+
]);
|
|
122
|
+
/** Espelha `AccessSendChannelKindEnum`. */
|
|
123
|
+
exports.zAccessSendChannelKindSchema = zod_1.z.enum([
|
|
124
|
+
"whatsapp",
|
|
125
|
+
"email",
|
|
126
|
+
"manual",
|
|
127
|
+
]);
|
|
128
|
+
/** Espelha `EndedByTypeEnum`. */
|
|
129
|
+
exports.zEndedByTypeSchema = zod_1.z.enum(["user", "system"]);
|
|
130
|
+
/** Espelha `TeleconsultationEventActorTypeEnum`. */
|
|
131
|
+
exports.zTeleconsultationEventActorTypeSchema = zod_1.z.enum([
|
|
132
|
+
"user",
|
|
133
|
+
"patient",
|
|
134
|
+
"system",
|
|
135
|
+
"provider",
|
|
136
|
+
]);
|
|
137
|
+
/** Espelha `TeleconsultationEventSourceEnum`. */
|
|
138
|
+
exports.zTeleconsultationEventSourceSchema = zod_1.z.enum([
|
|
139
|
+
"api",
|
|
140
|
+
"webhook",
|
|
141
|
+
"appointment_reconciler",
|
|
142
|
+
"retention_job",
|
|
143
|
+
"sweep",
|
|
144
|
+
]);
|
|
145
|
+
/** Espelha `TeleconsultationEventTypeEnum`. ADITIVO: eventos já gravados dependem desta lista. */
|
|
146
|
+
exports.zTeleconsultationEventTypeSchema = zod_1.z.enum([
|
|
147
|
+
"teleconsultation.created",
|
|
148
|
+
"teleconsultation.rescheduled",
|
|
149
|
+
"teleconsultation.cancelled",
|
|
150
|
+
"teleconsultation.expired",
|
|
151
|
+
"teleconsultation.diverged",
|
|
152
|
+
"access.created",
|
|
153
|
+
"access.revoked",
|
|
154
|
+
"access.exchanged",
|
|
155
|
+
"access.verification_failed",
|
|
156
|
+
"access.blocked",
|
|
157
|
+
"host.claimed",
|
|
158
|
+
"host.reassigned",
|
|
159
|
+
"waiting_policy.changed",
|
|
160
|
+
"doctor.prepared",
|
|
161
|
+
"doctor.joined",
|
|
162
|
+
"doctor.disconnected",
|
|
163
|
+
"doctor.rejoined",
|
|
164
|
+
"doctor.left",
|
|
165
|
+
"patient.verified",
|
|
166
|
+
"patient.waiting",
|
|
167
|
+
"patient.admitted",
|
|
168
|
+
"patient.rejected",
|
|
169
|
+
"patient.joined",
|
|
170
|
+
"patient.disconnected",
|
|
171
|
+
"patient.rejoined",
|
|
172
|
+
"patient.left",
|
|
173
|
+
"recording.consent_requested",
|
|
174
|
+
"recording.consent_accepted",
|
|
175
|
+
"recording.consent_declined",
|
|
176
|
+
"recording.consent_withdrawn",
|
|
177
|
+
"recording.started",
|
|
178
|
+
"recording.stopped",
|
|
179
|
+
"recording.failed",
|
|
180
|
+
"transcription.queued",
|
|
181
|
+
"transcription.ready",
|
|
182
|
+
"transcription.failed",
|
|
183
|
+
"transcription.deleted",
|
|
184
|
+
"consultation.started",
|
|
185
|
+
"consultation.reconnecting",
|
|
186
|
+
"consultation.ended",
|
|
187
|
+
"artifact.accessed",
|
|
188
|
+
"artifact.deleted",
|
|
189
|
+
"entitlement.denied",
|
|
190
|
+
"rollout.denied",
|
|
191
|
+
"permission.denied",
|
|
192
|
+
"webhook.observed",
|
|
193
|
+
]);
|
|
194
|
+
/** Espelha `WebhookEventStatusEnum`. */
|
|
195
|
+
exports.zWebhookEventStatusSchema = zod_1.z.enum([
|
|
196
|
+
"pending",
|
|
197
|
+
"claimed",
|
|
198
|
+
"completed",
|
|
199
|
+
"failed",
|
|
200
|
+
]);
|
|
201
|
+
/** Espelha `LegalTextStatusEnum`. */
|
|
202
|
+
exports.zLegalTextStatusSchema = zod_1.z.enum(["draft", "published", "retired"]);
|
|
203
|
+
/** Espelha `TranscriptionProviderEnum`. */
|
|
204
|
+
exports.zTranscriptionProviderSchema = zod_1.z.enum(["none", "realtimekit"]);
|
|
205
|
+
/** Espelha `EntitlementAuditActionEnum`. */
|
|
206
|
+
exports.zEntitlementAuditActionSchema = zod_1.z.enum(["set", "override", "revoke"]);
|
|
207
|
+
/** Espelha `TelemedicineErrorCode`. */
|
|
208
|
+
exports.zTelemedicineErrorCodeSchema = zod_1.z.enum([
|
|
209
|
+
"TENANT_MODULE_DISABLED",
|
|
210
|
+
"ROLLOUT_DISABLED",
|
|
211
|
+
"EMERGENCY_KILL",
|
|
212
|
+
"PERMISSION_DENIED",
|
|
213
|
+
"CAPABILITY_DISABLED",
|
|
214
|
+
"NOT_FOUND",
|
|
215
|
+
"ACCESS_WINDOW_CLOSED",
|
|
216
|
+
"HOST_CLAIMED_BY_OTHER",
|
|
217
|
+
"HOST_REQUIRED",
|
|
218
|
+
"CONSENT_REQUIRED",
|
|
219
|
+
"IDENTITY_REQUIRED",
|
|
220
|
+
"IDENTITY_VERIFICATION_FAILED",
|
|
221
|
+
"GRANT_BLOCKED",
|
|
222
|
+
"GRANT_INVALID",
|
|
223
|
+
"SESSION_INVALID",
|
|
224
|
+
"TELECONSULTATION_TERMINAL",
|
|
225
|
+
"INVALID_TRANSITION",
|
|
226
|
+
"VERSION_CONFLICT",
|
|
227
|
+
"WAITING_POLICY_LOCKED",
|
|
228
|
+
"RECORDING_ACTIVE",
|
|
229
|
+
"RECORDING_FAILED",
|
|
230
|
+
"TRANSCRIPTION_GATE_CLOSED",
|
|
231
|
+
"ARTIFACT_NOT_READY",
|
|
232
|
+
"PROVIDER_ERROR",
|
|
233
|
+
"RATE_LIMITED",
|
|
234
|
+
"VALIDATION_ERROR",
|
|
235
|
+
]);
|
|
236
|
+
// ----- Value objects ----------------------------------------------------------
|
|
237
|
+
const zDate = zod_schemas_1.zFirestoreDateSchema;
|
|
238
|
+
const zDateNullable = zod_schemas_1.zFirestoreDateSchema.nullable().optional();
|
|
239
|
+
/** Metadata allowlisted (sem PII/conteúdo médico): só primitivos. */
|
|
240
|
+
exports.zTeleconsultationEventMetadataSchema = zod_1.z.record(zod_1.z.string().min(1).max(60), zod_1.z.union([zod_1.z.string().max(500), zod_1.z.number(), zod_1.z.boolean()]));
|
|
241
|
+
exports.zTeleconsultationEndedBySchema = zod_1.z
|
|
242
|
+
.object({
|
|
243
|
+
type: exports.zEndedByTypeSchema,
|
|
244
|
+
id: zod_1.z.string().optional(),
|
|
245
|
+
reason: zod_1.z.string().min(1).max(120),
|
|
246
|
+
})
|
|
247
|
+
.passthrough();
|
|
248
|
+
exports.zTeleconsultationEntitlementSnapshotSchema = zod_1.z
|
|
249
|
+
.object({
|
|
250
|
+
version: zod_1.z.number().int().min(0),
|
|
251
|
+
capabilities: zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.boolean(), zod_1.z.number(), zod_1.z.string()])),
|
|
252
|
+
})
|
|
253
|
+
.passthrough();
|
|
254
|
+
exports.zTeleconsultationEventActorSchema = zod_1.z
|
|
255
|
+
.object({
|
|
256
|
+
type: exports.zTeleconsultationEventActorTypeSchema,
|
|
257
|
+
id: zod_1.z.string().optional(),
|
|
258
|
+
})
|
|
259
|
+
.passthrough();
|
|
260
|
+
// ----- Documentos (por tenant) -------------------------------------------------
|
|
261
|
+
/** Espelha `ITeleconsultation`. */
|
|
262
|
+
exports.zTeleconsultationSchema = zod_schemas_1.zFireDocSchema
|
|
263
|
+
.extend({
|
|
264
|
+
calendar_id: zod_1.z.string().min(1),
|
|
265
|
+
appointment_id: zod_1.z.string().min(1),
|
|
266
|
+
patient_id: zod_1.z.string().min(1),
|
|
267
|
+
scheduled_professional_id: zod_1.z.string().optional(),
|
|
268
|
+
claimed_host_user_id: zod_1.z.string().optional(),
|
|
269
|
+
claimed_host_at: zDateNullable,
|
|
270
|
+
mode: exports.zTeleconsultationModeSchema,
|
|
271
|
+
status: exports.zTeleconsultationStatusSchema,
|
|
272
|
+
waiting_policy: exports.zWaitingPolicySchema,
|
|
273
|
+
scheduled_start_at: zDate,
|
|
274
|
+
scheduled_end_at: zDate,
|
|
275
|
+
doctor_access_from: zDate,
|
|
276
|
+
patient_access_from: zDate,
|
|
277
|
+
unused_expires_at: zDate,
|
|
278
|
+
reconnect_until: zDateNullable,
|
|
279
|
+
started_at: zDateNullable,
|
|
280
|
+
ended_at: zDateNullable,
|
|
281
|
+
ended_by: exports.zTeleconsultationEndedBySchema.nullable().optional(),
|
|
282
|
+
provider: exports.zTeleconsultationProviderSchema,
|
|
283
|
+
provider_meeting_id: zod_1.z.string().optional(),
|
|
284
|
+
active_provider_session_id: zod_1.z.string().optional(),
|
|
285
|
+
recording_status: exports.zRecordingStatusSchema,
|
|
286
|
+
transcription_status: exports.zTranscriptionStatusSchema,
|
|
287
|
+
entitlement_snapshot: exports.zTeleconsultationEntitlementSnapshotSchema,
|
|
288
|
+
generation: zod_1.z.number().int().min(0),
|
|
289
|
+
reschedule_count: zod_1.z.number().int().min(0).optional(),
|
|
290
|
+
last_reconciled_appointment_version: zod_1.z
|
|
291
|
+
.union([zod_1.z.number(), zod_1.z.string()])
|
|
292
|
+
.nullable()
|
|
293
|
+
.optional(),
|
|
294
|
+
last_reconciled_at: zDateNullable,
|
|
295
|
+
version: zod_1.z.number().int().min(0),
|
|
296
|
+
})
|
|
297
|
+
.passthrough();
|
|
298
|
+
/** Espelha `ITeleconsultationParticipant`. */
|
|
299
|
+
exports.zTeleconsultationParticipantSchema = zod_schemas_1.zFireDocSchema
|
|
300
|
+
.extend({
|
|
301
|
+
teleconsultation_id: zod_1.z.string().min(1),
|
|
302
|
+
role: exports.zParticipantRoleSchema,
|
|
303
|
+
actor_user_id: zod_1.z.string().optional(),
|
|
304
|
+
patient_id: zod_1.z.string().optional(),
|
|
305
|
+
provider_participant_id: zod_1.z.string().optional(),
|
|
306
|
+
opaque_custom_participant_id: zod_1.z.string().min(1),
|
|
307
|
+
state: exports.zParticipantStateSchema,
|
|
308
|
+
identity_level: exports.zIdentityLevelSchema.optional(),
|
|
309
|
+
admitted_at: zDateNullable,
|
|
310
|
+
connected_at: zDateNullable,
|
|
311
|
+
last_seen_at: zDateNullable,
|
|
312
|
+
disconnected_at: zDateNullable,
|
|
313
|
+
reconnect_count: zod_1.z.number().int().min(0),
|
|
314
|
+
})
|
|
315
|
+
.passthrough();
|
|
316
|
+
exports.zTeleconsultationConsentEvidenceSchema = zod_1.z
|
|
317
|
+
.object({
|
|
318
|
+
ui_locale: zod_1.z.string().min(2).max(10),
|
|
319
|
+
session_id_hash: zod_1.z.string().min(1),
|
|
320
|
+
})
|
|
321
|
+
.passthrough();
|
|
322
|
+
/** Espelha `ITeleconsultationConsent`. */
|
|
323
|
+
exports.zTeleconsultationConsentSchema = zod_schemas_1.zFireDocSchema
|
|
324
|
+
.extend({
|
|
325
|
+
teleconsultation_id: zod_1.z.string().min(1),
|
|
326
|
+
subject: exports.zConsentSubjectSchema,
|
|
327
|
+
decision: exports.zConsentDecisionSchema,
|
|
328
|
+
terms_version: zod_1.z.string().min(1).max(40),
|
|
329
|
+
terms_content_hash: zod_1.z.string().optional(),
|
|
330
|
+
participant_id: zod_1.z.string().min(1),
|
|
331
|
+
actor_type: exports.zConsentActorTypeSchema,
|
|
332
|
+
occurred_at: zDate,
|
|
333
|
+
correlation_id: zod_1.z.string().min(1),
|
|
334
|
+
recording_request_id: zod_1.z.string().optional(),
|
|
335
|
+
evidence: exports.zTeleconsultationConsentEvidenceSchema,
|
|
336
|
+
})
|
|
337
|
+
.passthrough();
|
|
338
|
+
/** Espelha `ITeleconsultationArtifact`. */
|
|
339
|
+
exports.zTeleconsultationArtifactSchema = zod_schemas_1.zFireDocSchema
|
|
340
|
+
.extend({
|
|
341
|
+
teleconsultation_id: zod_1.z.string().min(1),
|
|
342
|
+
type: exports.zArtifactTypeSchema,
|
|
343
|
+
segment: zod_1.z.number().int().min(1),
|
|
344
|
+
status: exports.zArtifactStatusSchema,
|
|
345
|
+
provider_artifact_id: zod_1.z.string().optional(),
|
|
346
|
+
provider_session_id: zod_1.z.string().optional(),
|
|
347
|
+
recording_request_id: zod_1.z.string().optional(),
|
|
348
|
+
storage_bucket: zod_1.z.string().optional(),
|
|
349
|
+
storage_object: zod_1.z.string().optional(),
|
|
350
|
+
content_type: zod_1.z.string().optional(),
|
|
351
|
+
size_bytes: zod_1.z.number().int().min(0).optional(),
|
|
352
|
+
checksum: zod_1.z.string().optional(),
|
|
353
|
+
started_at: zDateNullable,
|
|
354
|
+
ended_at: zDateNullable,
|
|
355
|
+
expires_at: zDateNullable,
|
|
356
|
+
error_code: zod_1.z.string().optional(),
|
|
357
|
+
})
|
|
358
|
+
.passthrough();
|
|
359
|
+
/** Espelha `ITeleconsultationEvent` (append-only). */
|
|
360
|
+
exports.zTeleconsultationEventSchema = zod_schemas_1.zFireDocSchema
|
|
361
|
+
.extend({
|
|
362
|
+
teleconsultation_id: zod_1.z.string().min(1),
|
|
363
|
+
type: exports.zTeleconsultationEventTypeSchema,
|
|
364
|
+
occurred_at: zDate,
|
|
365
|
+
actor: exports.zTeleconsultationEventActorSchema,
|
|
366
|
+
source: exports.zTeleconsultationEventSourceSchema,
|
|
367
|
+
correlation_id: zod_1.z.string().min(1),
|
|
368
|
+
causation_id: zod_1.z.string().optional(),
|
|
369
|
+
idempotency_key: zod_1.z.string().optional(),
|
|
370
|
+
from_status: zod_1.z.string().optional(),
|
|
371
|
+
to_status: zod_1.z.string().optional(),
|
|
372
|
+
metadata: exports.zTeleconsultationEventMetadataSchema.optional(),
|
|
373
|
+
})
|
|
374
|
+
.passthrough();
|
|
375
|
+
/** Espelha `ITeleconsultationWebhookEvent` (dedup + outbox). */
|
|
376
|
+
exports.zTeleconsultationWebhookEventSchema = zod_schemas_1.zFireDocSchema
|
|
377
|
+
.extend({
|
|
378
|
+
teleconsultation_id: zod_1.z.string().optional(),
|
|
379
|
+
provider: exports.zTeleconsultationProviderSchema,
|
|
380
|
+
provider_event_id: zod_1.z.string().min(1),
|
|
381
|
+
event_type: zod_1.z.string().min(1),
|
|
382
|
+
payload_hash: zod_1.z.string().optional(),
|
|
383
|
+
sanitized_payload: zod_1.z
|
|
384
|
+
.record(zod_1.z.string(), zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean(), zod_1.z.null()]))
|
|
385
|
+
.optional(),
|
|
386
|
+
status: exports.zWebhookEventStatusSchema,
|
|
387
|
+
received_at: zDate,
|
|
388
|
+
claimed_at: zDateNullable,
|
|
389
|
+
claimed_by: zod_1.z.string().optional(),
|
|
390
|
+
lease_until: zDateNullable,
|
|
391
|
+
processed_at: zDateNullable,
|
|
392
|
+
attempt: zod_1.z.number().int().min(0),
|
|
393
|
+
next_attempt_at: zDateNullable,
|
|
394
|
+
result: zod_1.z.string().optional(),
|
|
395
|
+
error_code: zod_1.z.string().optional(),
|
|
396
|
+
correlation_id: zod_1.z.string().min(1),
|
|
397
|
+
expires_at: zDate,
|
|
398
|
+
})
|
|
399
|
+
.passthrough();
|
|
400
|
+
/** Espelha `ITeleconsultationAccessGrant`. `secret_hash` é HMAC — nunca o segredo. */
|
|
401
|
+
exports.zTeleconsultationAccessGrantSchema = zod_schemas_1.zFireDocSchema
|
|
402
|
+
.extend({
|
|
403
|
+
teleconsultation_id: zod_1.z.string().min(1),
|
|
404
|
+
role: exports.zParticipantRoleSchema,
|
|
405
|
+
kind: exports.zAccessGrantKindSchema,
|
|
406
|
+
secret_hash: zod_1.z.string().min(1),
|
|
407
|
+
recipient_ref_hash: zod_1.z.string().optional(),
|
|
408
|
+
actor_user_id: zod_1.z.string().optional(),
|
|
409
|
+
participant_id: zod_1.z.string().optional(),
|
|
410
|
+
state: exports.zAccessGrantStateSchema,
|
|
411
|
+
expires_at: zDate,
|
|
412
|
+
consumed_at: zDateNullable,
|
|
413
|
+
revoked_at: zDateNullable,
|
|
414
|
+
revoked_by: zod_1.z.string().optional(),
|
|
415
|
+
last_used_at: zDateNullable,
|
|
416
|
+
failed_attempts: zod_1.z.number().int().min(0),
|
|
417
|
+
failed_window_started_at: zDateNullable,
|
|
418
|
+
blocked_until: zDateNullable,
|
|
419
|
+
parent_grant_id: zod_1.z.string().optional(),
|
|
420
|
+
channel_kind: exports.zAccessSendChannelKindSchema.optional(),
|
|
421
|
+
quick_reply_action_id: zod_1.z.string().optional(),
|
|
422
|
+
version: zod_1.z.number().int().min(0),
|
|
423
|
+
})
|
|
424
|
+
.passthrough();
|
|
425
|
+
/** Espelha `ITelemedicineAppointmentIndex`. */
|
|
426
|
+
exports.zTelemedicineAppointmentIndexSchema = zod_schemas_1.zFireDocSchema
|
|
427
|
+
.extend({
|
|
428
|
+
calendar_id: zod_1.z.string().min(1),
|
|
429
|
+
appointment_id: zod_1.z.string().min(1),
|
|
430
|
+
active_teleconsultation_id: zod_1.z.string().nullable(),
|
|
431
|
+
generation: zod_1.z.number().int().min(0),
|
|
432
|
+
last_reconciled_appointment_version: zod_1.z
|
|
433
|
+
.union([zod_1.z.number(), zod_1.z.string()])
|
|
434
|
+
.nullable()
|
|
435
|
+
.optional(),
|
|
436
|
+
})
|
|
437
|
+
.passthrough();
|
|
438
|
+
/** Espelha `ITelemedicineEntitlementAudit`. */
|
|
439
|
+
exports.zTelemedicineEntitlementAuditSchema = zod_schemas_1.zFireDocSchema
|
|
440
|
+
.extend({
|
|
441
|
+
module: zod_1.z.string().min(1).max(40),
|
|
442
|
+
action: exports.zEntitlementAuditActionSchema,
|
|
443
|
+
before: zod_schemas_2.zTenantModuleEntitlementSchema.nullable().optional(),
|
|
444
|
+
after: zod_schemas_2.zTenantModuleEntitlementSchema,
|
|
445
|
+
actor: zod_1.z
|
|
446
|
+
.object({
|
|
447
|
+
type: zod_1.z.enum(["user", "system", "script"]),
|
|
448
|
+
id: zod_1.z.string().optional(),
|
|
449
|
+
})
|
|
450
|
+
.passthrough(),
|
|
451
|
+
reason: zod_1.z.string().min(1).max(500),
|
|
452
|
+
occurred_at: zDate,
|
|
453
|
+
correlation_id: zod_1.z.string().optional(),
|
|
454
|
+
})
|
|
455
|
+
.passthrough();
|
|
456
|
+
// ----- Documentos de plataforma -------------------------------------------------
|
|
457
|
+
// Docs globais (`IFireGlobalDoc`): sem `tenant`.
|
|
458
|
+
const zGlobalDocSchema = zod_1.z.object({
|
|
459
|
+
id: zod_1.z.string(),
|
|
460
|
+
ref: zod_1.z.any().optional(),
|
|
461
|
+
model_ver: zod_1.z.number().optional(),
|
|
462
|
+
version: zod_1.z.number().optional(),
|
|
463
|
+
created_at: zDateNullable,
|
|
464
|
+
updated_at: zDateNullable,
|
|
465
|
+
deleted_at: zDateNullable,
|
|
466
|
+
});
|
|
467
|
+
/** Espelha `ITelemedicineLegalText` (standalone: `version` aqui é a versão do texto). */
|
|
468
|
+
exports.zTelemedicineLegalTextSchema = zod_1.z
|
|
469
|
+
.object({
|
|
470
|
+
id: zod_1.z.string(),
|
|
471
|
+
subject: exports.zConsentSubjectSchema,
|
|
472
|
+
locale: zod_1.z.string().min(2).max(10),
|
|
473
|
+
version: zod_1.z.string().min(1).max(40),
|
|
474
|
+
title: zod_1.z.string().min(1).max(200),
|
|
475
|
+
content_html: zod_1.z.string().min(1),
|
|
476
|
+
content_hash: zod_1.z.string().min(1),
|
|
477
|
+
published_at: zDateNullable,
|
|
478
|
+
effective_at: zDateNullable,
|
|
479
|
+
status: exports.zLegalTextStatusSchema,
|
|
480
|
+
placeholders: zod_1.z.array(zod_1.z.string().min(1).max(60)).optional(),
|
|
481
|
+
created_at: zDateNullable,
|
|
482
|
+
updated_at: zDateNullable,
|
|
483
|
+
})
|
|
484
|
+
.passthrough();
|
|
485
|
+
/** Espelha `ITelemedicineRollout`. Ausência do doc = deny. */
|
|
486
|
+
exports.zTelemedicineRolloutSchema = zGlobalDocSchema
|
|
487
|
+
.extend({
|
|
488
|
+
create_enabled: zod_1.z.boolean(),
|
|
489
|
+
join_enabled: zod_1.z.boolean(),
|
|
490
|
+
recording_enabled: zod_1.z.boolean(),
|
|
491
|
+
transcription_enabled: zod_1.z.boolean(),
|
|
492
|
+
emergency_kill: zod_1.z.boolean(),
|
|
493
|
+
updated_at: zDate,
|
|
494
|
+
updated_by: zod_1.z.string().min(1),
|
|
495
|
+
})
|
|
496
|
+
.passthrough();
|
|
497
|
+
/** Espelha `ITelemedicineTranscriptionConfig`. */
|
|
498
|
+
exports.zTelemedicineTranscriptionConfigSchema = zGlobalDocSchema
|
|
499
|
+
.extend({
|
|
500
|
+
provider: exports.zTranscriptionProviderSchema,
|
|
501
|
+
production_gate_approved: zod_1.z.boolean(),
|
|
502
|
+
approved_by: zod_1.z.string().optional(),
|
|
503
|
+
approved_at: zDateNullable,
|
|
504
|
+
})
|
|
505
|
+
.passthrough();
|
|
506
|
+
/** Espelha `ITelemedicineGrantIndex`. */
|
|
507
|
+
exports.zTelemedicineGrantIndexSchema = zGlobalDocSchema
|
|
508
|
+
.extend({
|
|
509
|
+
tenant: zod_1.z.string().min(1),
|
|
510
|
+
teleconsultation_id: zod_1.z.string().min(1),
|
|
511
|
+
grant_id: zod_1.z.string().min(1),
|
|
512
|
+
expires_at: zDate,
|
|
513
|
+
})
|
|
514
|
+
.passthrough();
|
|
515
|
+
// ----- Comandos (request bodies — fronteira HTTP, estritos) --------------------
|
|
516
|
+
const zExpectedVersion = zod_1.z.number().int().min(0).optional();
|
|
517
|
+
const zReason = zod_1.z.string().trim().min(1).max(500);
|
|
518
|
+
/** `PATCH /waiting-policy` — espelha `IWaitingPolicyCommand`. */
|
|
519
|
+
exports.zWaitingPolicyCommandSchema = zod_1.z
|
|
520
|
+
.object({
|
|
521
|
+
waiting_policy: exports.zWaitingPolicySchema,
|
|
522
|
+
expected_version: zExpectedVersion,
|
|
523
|
+
})
|
|
524
|
+
.strict();
|
|
525
|
+
/** `POST /reassign-host` — espelha `IReassignHostCommand` (motivo obrigatório, D22). */
|
|
526
|
+
exports.zReassignHostCommandSchema = zod_1.z
|
|
527
|
+
.object({
|
|
528
|
+
to_user_id: zod_1.z.string().trim().min(1).max(128),
|
|
529
|
+
reason: zReason,
|
|
530
|
+
expected_version: zExpectedVersion,
|
|
531
|
+
})
|
|
532
|
+
.strict();
|
|
533
|
+
/** `POST /access/send` — espelha `IAccessSendCommand`. */
|
|
534
|
+
exports.zAccessSendCommandSchema = zod_1.z
|
|
535
|
+
.object({
|
|
536
|
+
channel_kind: exports.zAccessSendChannelKindSchema,
|
|
537
|
+
resend: zod_1.z.boolean().optional(),
|
|
538
|
+
})
|
|
539
|
+
.strict();
|
|
540
|
+
/** `POST /access/revoke` — espelha `IAccessRevokeCommand`. */
|
|
541
|
+
exports.zAccessRevokeCommandSchema = zod_1.z
|
|
542
|
+
.object({
|
|
543
|
+
grant_id: zod_1.z.string().trim().min(1).max(128).optional(),
|
|
544
|
+
reason: zReason,
|
|
545
|
+
})
|
|
546
|
+
.strict();
|
|
547
|
+
/** `POST /end` — espelha `IEndCommand`. */
|
|
548
|
+
exports.zEndCommandSchema = zod_1.z
|
|
549
|
+
.object({
|
|
550
|
+
reason: zod_1.z.string().trim().min(1).max(120).optional(),
|
|
551
|
+
expected_version: zExpectedVersion,
|
|
552
|
+
})
|
|
553
|
+
.strict();
|
|
554
|
+
/** `POST /api/room/v1/exchange` — espelha `IExchangeCommand` (code base64url de 128 bits = 22 chars). */
|
|
555
|
+
exports.zExchangeCommandSchema = zod_1.z
|
|
556
|
+
.object({
|
|
557
|
+
code: zod_1.z
|
|
558
|
+
.string()
|
|
559
|
+
.trim()
|
|
560
|
+
.min(16)
|
|
561
|
+
.max(128)
|
|
562
|
+
.regex(/^[A-Za-z0-9_-]+$/, "code must be base64url"),
|
|
563
|
+
})
|
|
564
|
+
.strict();
|
|
565
|
+
/** `POST /api/room/v1/identity/verify` — espelha `IIdentityVerifyCommand`. */
|
|
566
|
+
exports.zIdentityVerifyCommandSchema = zod_1.z
|
|
567
|
+
.object({
|
|
568
|
+
display_name: zod_1.z.string().trim().min(2).max(120),
|
|
569
|
+
// Normalizada no cliente para YYYY-MM-DD; o backend normaliza de novo antes
|
|
570
|
+
// da comparação constant-time. Erro de formato NÃO revela qual campo falhou.
|
|
571
|
+
birth_date: zod_1.z
|
|
572
|
+
.string()
|
|
573
|
+
.trim()
|
|
574
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, "birth_date must be YYYY-MM-DD")
|
|
575
|
+
.optional(),
|
|
576
|
+
})
|
|
577
|
+
.strict();
|
|
578
|
+
/** `POST /api/room/v1/consents` — espelha `IConsentCommand` (só `accepted|declined`; retirada é rota de gravação). */
|
|
579
|
+
exports.zConsentCommandSchema = zod_1.z
|
|
580
|
+
.object({
|
|
581
|
+
subject: exports.zConsentSubjectSchema,
|
|
582
|
+
terms_version: zod_1.z.string().trim().min(1).max(40),
|
|
583
|
+
decision: zod_1.z.enum(["accepted", "declined"]),
|
|
584
|
+
})
|
|
585
|
+
.strict();
|
|
586
|
+
/** `POST /api/room/v1/presence` — espelha `IPresenceCommand`. */
|
|
587
|
+
exports.zPresenceCommandSchema = zod_1.z
|
|
588
|
+
.object({
|
|
589
|
+
state: exports.zPresenceStateSchema,
|
|
590
|
+
provider_participant_id: zod_1.z.string().trim().min(1).max(128).optional(),
|
|
591
|
+
})
|
|
592
|
+
.strict();
|
|
593
|
+
/** `POST /api/room/v1/admit` — espelha `IAdmitCommand`. */
|
|
594
|
+
exports.zAdmitCommandSchema = zod_1.z
|
|
595
|
+
.object({
|
|
596
|
+
participant_id: zod_1.z.string().trim().min(1).max(128),
|
|
597
|
+
})
|
|
598
|
+
.strict();
|
|
599
|
+
/** `POST /api/room/v1/reject` — espelha `IRejectCommand`. */
|
|
600
|
+
exports.zRejectCommandSchema = zod_1.z
|
|
601
|
+
.object({
|
|
602
|
+
participant_id: zod_1.z.string().trim().min(1).max(128),
|
|
603
|
+
reason: zod_1.z.string().trim().min(1).max(120).optional(),
|
|
604
|
+
})
|
|
605
|
+
.strict();
|
|
606
|
+
/** `POST /api/room/v1/recording/request` — espelha `IRecordingRequestCommand`. */
|
|
607
|
+
exports.zRecordingRequestCommandSchema = zod_1.z
|
|
608
|
+
.object({
|
|
609
|
+
recording_request_id: zod_1.z.string().trim().min(8).max(128),
|
|
610
|
+
})
|
|
611
|
+
.strict();
|
|
612
|
+
/** `POST /api/room/v1/recording/accept|decline|withdraw` — espelha `IRecordingConsentCommand`. */
|
|
613
|
+
exports.zRecordingConsentCommandSchema = zod_1.z
|
|
614
|
+
.object({
|
|
615
|
+
recording_request_id: zod_1.z.string().trim().min(8).max(128),
|
|
616
|
+
terms_version: zod_1.z.string().trim().min(1).max(40),
|
|
617
|
+
})
|
|
618
|
+
.strict();
|
|
619
|
+
/** `POST /api/room/v1/recording/stop` — espelha `IRecordingStopCommand`. */
|
|
620
|
+
exports.zRecordingStopCommandSchema = zod_1.z
|
|
621
|
+
.object({
|
|
622
|
+
recording_request_id: zod_1.z.string().trim().min(8).max(128).optional(),
|
|
623
|
+
})
|
|
624
|
+
.strict();
|
|
625
|
+
/** `POST /api/room/v1/telemetry` — espelha `ITelemetryCommand`; nomes allowlisted no backend. */
|
|
626
|
+
exports.zTelemetryCommandSchema = zod_1.z
|
|
627
|
+
.object({
|
|
628
|
+
events: zod_1.z
|
|
629
|
+
.array(zod_1.z
|
|
630
|
+
.object({
|
|
631
|
+
name: zod_1.z.string().trim().min(1).max(60),
|
|
632
|
+
at: zod_1.z.string().datetime({ offset: true }),
|
|
633
|
+
attrs: zod_1.z
|
|
634
|
+
.record(zod_1.z.string().min(1).max(40), zod_1.z.union([zod_1.z.string().max(200), zod_1.z.number(), zod_1.z.boolean()]))
|
|
635
|
+
.optional(),
|
|
636
|
+
})
|
|
637
|
+
.strict())
|
|
638
|
+
.min(1)
|
|
639
|
+
.max(50),
|
|
640
|
+
})
|
|
641
|
+
.strict();
|