evo360-types 1.3.768 → 1.3.772

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.
@@ -3039,6 +3039,8 @@ export declare const zAttachmentListQuerySchema: z.ZodEffects<z.ZodObject<{
3039
3039
  tag: z.ZodOptional<z.ZodString>;
3040
3040
  limit: z.ZodOptional<z.ZodNumber>;
3041
3041
  cursor: z.ZodOptional<z.ZodString>;
3042
+ /** F1.2 — lixeira: só removidos da raiz (`deleted_at`), sem cursor. */
3043
+ deleted: z.ZodOptional<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
3042
3044
  }, "strip", z.ZodTypeAny, {
3043
3045
  family?: boolean | undefined;
3044
3046
  patient?: string | undefined;
@@ -3048,6 +3050,7 @@ export declare const zAttachmentListQuerySchema: z.ZodEffects<z.ZodObject<{
3048
3050
  direction?: "inbound" | "outbound" | undefined;
3049
3051
  message_ids?: string[] | undefined;
3050
3052
  subject?: string | undefined;
3053
+ deleted?: boolean | undefined;
3051
3054
  media_kind?: "other" | "image" | "video" | "document" | "audio" | undefined;
3052
3055
  family_depth?: number | undefined;
3053
3056
  source_kind?: "history_import" | "patient_upload" | "appointment_upload" | "chat_message" | "email_message" | "platform_generated" | undefined;
@@ -3062,6 +3065,7 @@ export declare const zAttachmentListQuerySchema: z.ZodEffects<z.ZodObject<{
3062
3065
  direction?: "inbound" | "outbound" | undefined;
3063
3066
  message_ids?: unknown;
3064
3067
  subject?: string | undefined;
3068
+ deleted?: unknown;
3065
3069
  media_kind?: "other" | "image" | "video" | "document" | "audio" | undefined;
3066
3070
  family_depth?: number | undefined;
3067
3071
  source_kind?: "history_import" | "patient_upload" | "appointment_upload" | "chat_message" | "email_message" | "platform_generated" | undefined;
@@ -3076,6 +3080,7 @@ export declare const zAttachmentListQuerySchema: z.ZodEffects<z.ZodObject<{
3076
3080
  direction?: "inbound" | "outbound" | undefined;
3077
3081
  message_ids?: string[] | undefined;
3078
3082
  subject?: string | undefined;
3083
+ deleted?: boolean | undefined;
3079
3084
  media_kind?: "other" | "image" | "video" | "document" | "audio" | undefined;
3080
3085
  family_depth?: number | undefined;
3081
3086
  source_kind?: "history_import" | "patient_upload" | "appointment_upload" | "chat_message" | "email_message" | "platform_generated" | undefined;
@@ -3090,6 +3095,7 @@ export declare const zAttachmentListQuerySchema: z.ZodEffects<z.ZodObject<{
3090
3095
  direction?: "inbound" | "outbound" | undefined;
3091
3096
  message_ids?: unknown;
3092
3097
  subject?: string | undefined;
3098
+ deleted?: unknown;
3093
3099
  media_kind?: "other" | "image" | "video" | "document" | "audio" | undefined;
3094
3100
  family_depth?: number | undefined;
3095
3101
  source_kind?: "history_import" | "patient_upload" | "appointment_upload" | "chat_message" | "email_message" | "platform_generated" | undefined;
@@ -201,6 +201,8 @@ exports.zAttachmentListQuerySchema = zod_1.z
201
201
  tag: zod_1.z.string().min(1).max(50).optional(),
202
202
  limit: zod_1.z.coerce.number().int().min(1).max(evo_docs_1.ATTACHMENT_LIST_MAX_LIMIT).optional(),
203
203
  cursor: zod_1.z.string().min(1).optional(),
204
+ /** F1.2 — lixeira: só removidos da raiz (`deleted_at`), sem cursor. */
205
+ deleted: zQueryBoolean.optional(),
204
206
  })
205
207
  .superRefine((q, ctx) => {
206
208
  const hasSubject = q.subject !== undefined;
@@ -239,6 +239,8 @@ export const zAttachmentListQuerySchema = z
239
239
  tag: z.string().min(1).max(50).optional(),
240
240
  limit: z.coerce.number().int().min(1).max(ATTACHMENT_LIST_MAX_LIMIT).optional(),
241
241
  cursor: z.string().min(1).optional(),
242
+ /** F1.2 — lixeira: só removidos da raiz (`deleted_at`), sem cursor. */
243
+ deleted: zQueryBoolean.optional(),
242
244
  })
243
245
  .superRefine((q, ctx) => {
244
246
  const hasSubject = q.subject !== undefined;
@@ -352,6 +352,31 @@ export declare const zAppointmentRequestedBySchema: z.ZodObject<{
352
352
  display_name: z.ZodNullable<z.ZodString>;
353
353
  source: z.ZodEnum<["ui_omni", "ui_calendar", "hubia", "mcp"]>;
354
354
  }, z.ZodTypeAny, "passthrough">>;
355
+ export declare const zAppointmentCreatedBySchema: z.ZodObject<{
356
+ origin: z.ZodString;
357
+ user_id: z.ZodNullable<z.ZodString>;
358
+ display_name: z.ZodNullable<z.ZodString>;
359
+ client: z.ZodOptional<z.ZodNullable<z.ZodString>>;
360
+ channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
361
+ adapter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
362
+ backfill: z.ZodOptional<z.ZodBoolean>;
363
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
364
+ origin: z.ZodString;
365
+ user_id: z.ZodNullable<z.ZodString>;
366
+ display_name: z.ZodNullable<z.ZodString>;
367
+ client: z.ZodOptional<z.ZodNullable<z.ZodString>>;
368
+ channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
369
+ adapter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
370
+ backfill: z.ZodOptional<z.ZodBoolean>;
371
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
372
+ origin: z.ZodString;
373
+ user_id: z.ZodNullable<z.ZodString>;
374
+ display_name: z.ZodNullable<z.ZodString>;
375
+ client: z.ZodOptional<z.ZodNullable<z.ZodString>>;
376
+ channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
377
+ adapter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
378
+ backfill: z.ZodOptional<z.ZodBoolean>;
379
+ }, z.ZodTypeAny, "passthrough">>;
355
380
  export declare const zAppointmentSchema: z.ZodObject<{
356
381
  id: z.ZodString;
357
382
  ref: z.ZodAny;
@@ -699,6 +724,31 @@ export declare const zAppointmentSchema: z.ZodObject<{
699
724
  display_name: z.ZodNullable<z.ZodString>;
700
725
  source: z.ZodEnum<["ui_omni", "ui_calendar", "hubia", "mcp"]>;
701
726
  }, z.ZodTypeAny, "passthrough">>>>;
727
+ created_by: z.ZodOptional<z.ZodNullable<z.ZodObject<{
728
+ origin: z.ZodString;
729
+ user_id: z.ZodNullable<z.ZodString>;
730
+ display_name: z.ZodNullable<z.ZodString>;
731
+ client: z.ZodOptional<z.ZodNullable<z.ZodString>>;
732
+ channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
733
+ adapter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
734
+ backfill: z.ZodOptional<z.ZodBoolean>;
735
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
736
+ origin: z.ZodString;
737
+ user_id: z.ZodNullable<z.ZodString>;
738
+ display_name: z.ZodNullable<z.ZodString>;
739
+ client: z.ZodOptional<z.ZodNullable<z.ZodString>>;
740
+ channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
741
+ adapter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
742
+ backfill: z.ZodOptional<z.ZodBoolean>;
743
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
744
+ origin: z.ZodString;
745
+ user_id: z.ZodNullable<z.ZodString>;
746
+ display_name: z.ZodNullable<z.ZodString>;
747
+ client: z.ZodOptional<z.ZodNullable<z.ZodString>>;
748
+ channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
749
+ adapter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
750
+ backfill: z.ZodOptional<z.ZodBoolean>;
751
+ }, z.ZodTypeAny, "passthrough">>>>;
702
752
  hubia_proposal_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
703
753
  tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
704
754
  name: z.ZodString;
@@ -1066,6 +1116,31 @@ export declare const zAppointmentSchema: z.ZodObject<{
1066
1116
  display_name: z.ZodNullable<z.ZodString>;
1067
1117
  source: z.ZodEnum<["ui_omni", "ui_calendar", "hubia", "mcp"]>;
1068
1118
  }, z.ZodTypeAny, "passthrough">>>>;
1119
+ created_by: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1120
+ origin: z.ZodString;
1121
+ user_id: z.ZodNullable<z.ZodString>;
1122
+ display_name: z.ZodNullable<z.ZodString>;
1123
+ client: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1124
+ channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1125
+ adapter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1126
+ backfill: z.ZodOptional<z.ZodBoolean>;
1127
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1128
+ origin: z.ZodString;
1129
+ user_id: z.ZodNullable<z.ZodString>;
1130
+ display_name: z.ZodNullable<z.ZodString>;
1131
+ client: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1132
+ channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1133
+ adapter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1134
+ backfill: z.ZodOptional<z.ZodBoolean>;
1135
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1136
+ origin: z.ZodString;
1137
+ user_id: z.ZodNullable<z.ZodString>;
1138
+ display_name: z.ZodNullable<z.ZodString>;
1139
+ client: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1140
+ channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1141
+ adapter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1142
+ backfill: z.ZodOptional<z.ZodBoolean>;
1143
+ }, z.ZodTypeAny, "passthrough">>>>;
1069
1144
  hubia_proposal_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1070
1145
  tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
1071
1146
  name: z.ZodString;
@@ -1433,6 +1508,31 @@ export declare const zAppointmentSchema: z.ZodObject<{
1433
1508
  display_name: z.ZodNullable<z.ZodString>;
1434
1509
  source: z.ZodEnum<["ui_omni", "ui_calendar", "hubia", "mcp"]>;
1435
1510
  }, z.ZodTypeAny, "passthrough">>>>;
1511
+ created_by: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1512
+ origin: z.ZodString;
1513
+ user_id: z.ZodNullable<z.ZodString>;
1514
+ display_name: z.ZodNullable<z.ZodString>;
1515
+ client: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1516
+ channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1517
+ adapter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1518
+ backfill: z.ZodOptional<z.ZodBoolean>;
1519
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1520
+ origin: z.ZodString;
1521
+ user_id: z.ZodNullable<z.ZodString>;
1522
+ display_name: z.ZodNullable<z.ZodString>;
1523
+ client: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1524
+ channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1525
+ adapter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1526
+ backfill: z.ZodOptional<z.ZodBoolean>;
1527
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1528
+ origin: z.ZodString;
1529
+ user_id: z.ZodNullable<z.ZodString>;
1530
+ display_name: z.ZodNullable<z.ZodString>;
1531
+ client: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1532
+ channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1533
+ adapter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1534
+ backfill: z.ZodOptional<z.ZodBoolean>;
1535
+ }, z.ZodTypeAny, "passthrough">>>>;
1436
1536
  hubia_proposal_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1437
1537
  tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
1438
1538
  name: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zPatientAppointmentSchema = exports.zAppointmentSchema = exports.zAppointmentRequestedBySchema = exports.zAppointmentRequestedBySourceSchema = exports.zAppointmentSpecialtySchema = exports.zAppointmentRescheduleSchema = exports.zAppointmentAppointmentSourceSchema = exports.zAppointmentAppointmentRequestTypeSchema = exports.zAppointmentProcedureSchema = exports.zAppointmentPaymentSchema = exports.zAppointmentPaymentInvoiceRefSchema = exports.zAppointmentInsuranceSchema = exports.zAppointmentProfessionalSchema = exports.zAppointmentPatientSchema = exports.zAppointmentAddressSchema = exports.zAppointmentTypeBaseSchema = exports.zAppointmentTelemedicineSchema = exports.zTelemedicineProviderSchema = exports.zAppointmentModeSchema = exports.zAppointmentStatusTypeSchema = exports.zAppointmentPaymentStatusSchema = void 0;
3
+ exports.zPatientAppointmentSchema = exports.zAppointmentSchema = exports.zAppointmentCreatedBySchema = exports.zAppointmentRequestedBySchema = exports.zAppointmentRequestedBySourceSchema = exports.zAppointmentSpecialtySchema = exports.zAppointmentRescheduleSchema = exports.zAppointmentAppointmentSourceSchema = exports.zAppointmentAppointmentRequestTypeSchema = exports.zAppointmentProcedureSchema = exports.zAppointmentPaymentSchema = exports.zAppointmentPaymentInvoiceRefSchema = exports.zAppointmentInsuranceSchema = exports.zAppointmentProfessionalSchema = exports.zAppointmentPatientSchema = exports.zAppointmentAddressSchema = exports.zAppointmentTypeBaseSchema = exports.zAppointmentTelemedicineSchema = exports.zTelemedicineProviderSchema = exports.zAppointmentModeSchema = exports.zAppointmentStatusTypeSchema = exports.zAppointmentPaymentStatusSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const zod_schemas_1 = require("../../shared/zod-schemas");
6
6
  // Enums para validação
@@ -199,6 +199,19 @@ exports.zAppointmentRequestedBySchema = zod_1.z
199
199
  source: exports.zAppointmentRequestedBySourceSchema,
200
200
  })
201
201
  .passthrough();
202
+ // feat-319 F2 — quem criou (origem + usuário). `origin: z.string()` (não enum)
203
+ // + passthrough: parser antigo não reprova doc com origem/campo novo.
204
+ exports.zAppointmentCreatedBySchema = zod_1.z
205
+ .object({
206
+ origin: zod_1.z.string(),
207
+ user_id: zod_1.z.string().nullable(),
208
+ display_name: zod_1.z.string().nullable(),
209
+ client: zod_1.z.string().nullable().optional(),
210
+ channel: zod_1.z.string().nullable().optional(), // native_calendar | external_calendar (aberto)
211
+ adapter: zod_1.z.string().nullable().optional(),
212
+ backfill: zod_1.z.boolean().optional(),
213
+ })
214
+ .passthrough();
202
215
  // Schema principal do Appointment
203
216
  exports.zAppointmentSchema = zod_schemas_1.zFireDocSchema
204
217
  .extend({
@@ -248,6 +261,8 @@ exports.zAppointmentSchema = zod_schemas_1.zFireDocSchema
248
261
  status_external_id: zod_1.z.coerce.string().nullable().optional(),
249
262
  // feat-193 F4 — solicitante. Local (a agenda externa não conhece o campo).
250
263
  requested_by: exports.zAppointmentRequestedBySchema.nullable().optional(),
264
+ // feat-319 F2 — quem criou. Carimbado só pelo servidor no create.
265
+ created_by: exports.zAppointmentCreatedBySchema.nullable().optional(),
251
266
  // feat-271 F2 — proposta da HubIA que originou o agendamento (aceita pela secretária).
252
267
  hubia_proposal_id: zod_1.z.string().nullable().optional(),
253
268
  tags: zod_1.z.array(zod_schemas_1.zTagSchema).nullable().optional(),
@@ -220,6 +220,20 @@ export const zAppointmentRequestedBySchema = z
220
220
  })
221
221
  .passthrough();
222
222
 
223
+ // feat-319 F2 — quem criou (origem + usuário). `origin: z.string()` (não enum)
224
+ // + passthrough: parser antigo não reprova doc com origem/campo novo.
225
+ export const zAppointmentCreatedBySchema = z
226
+ .object({
227
+ origin: z.string(),
228
+ user_id: z.string().nullable(),
229
+ display_name: z.string().nullable(),
230
+ client: z.string().nullable().optional(),
231
+ channel: z.string().nullable().optional(), // native_calendar | external_calendar (aberto)
232
+ adapter: z.string().nullable().optional(),
233
+ backfill: z.boolean().optional(),
234
+ })
235
+ .passthrough();
236
+
223
237
  // Schema principal do Appointment
224
238
  export const zAppointmentSchema = zFireDocSchema
225
239
  .extend({
@@ -275,6 +289,9 @@ export const zAppointmentSchema = zFireDocSchema
275
289
  // feat-193 F4 — solicitante. Local (a agenda externa não conhece o campo).
276
290
  requested_by: zAppointmentRequestedBySchema.nullable().optional(),
277
291
 
292
+ // feat-319 F2 — quem criou. Carimbado só pelo servidor no create.
293
+ created_by: zAppointmentCreatedBySchema.nullable().optional(),
294
+
278
295
  // feat-271 F2 — proposta da HubIA que originou o agendamento (aceita pela secretária).
279
296
  hubia_proposal_id: z.string().nullable().optional(),
280
297
 
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ export * from "./types/evo-med/dic";
16
16
  export * from "./types/evo-med/insurance";
17
17
  export * from "./types/evo-med/people";
18
18
  export * from "./types/evo-med/procedure";
19
+ export * from "./types/evo-med/scoreboard";
19
20
  export * from "./types/evo-tags";
20
21
  export * from "./types/evo-task";
21
22
  export * from "./types/evo-survey";
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ __exportStar(require("./types/evo-med/dic"), exports);
33
33
  __exportStar(require("./types/evo-med/insurance"), exports);
34
34
  __exportStar(require("./types/evo-med/people"), exports);
35
35
  __exportStar(require("./types/evo-med/procedure"), exports);
36
+ __exportStar(require("./types/evo-med/scoreboard"), exports);
36
37
  __exportStar(require("./types/evo-tags"), exports);
37
38
  __exportStar(require("./types/evo-task"), exports);
38
39
  __exportStar(require("./types/evo-survey"), exports);
package/dist/index.ts CHANGED
@@ -17,6 +17,7 @@ export * from "./types/evo-med/dic";
17
17
  export * from "./types/evo-med/insurance";
18
18
  export * from "./types/evo-med/people";
19
19
  export * from "./types/evo-med/procedure";
20
+ export * from "./types/evo-med/scoreboard";
20
21
  export * from "./types/evo-tags";
21
22
  export * from "./types/evo-task";
22
23
  export * from "./types/evo-survey";
@@ -28,6 +28,11 @@ export interface IDomainEventActor {
28
28
  * `quick_reply` — ação de agendamento vinda de CTA do paciente.
29
29
  *
30
30
  * Ausente = ponto não mapeado/evento antigo: nenhum filtro o descarta.
31
+ *
32
+ * feat-319 F2: `origin` é o PONTO DE EMISSÃO, não a ferramenta. Quem criou o
33
+ * agendamento (web_app × app_professional × mcp × sync...) e o usuário vão em
34
+ * `data.created_by` (`IAppointmentCreatedBy`) nos eventos `agendamento.criado`
35
+ * e `agendamento.rascunho_confirmado` — aditivo, esta lista não muda.
31
36
  */
32
37
  export declare const DOMAIN_EVENT_ORIGINS: readonly ["app", "sync", "write_through", "hubia", "automation", "webhook", "quick_reply"];
33
38
  export type DomainEventOrigin = (typeof DOMAIN_EVENT_ORIGINS)[number];
@@ -30,6 +30,11 @@ exports.DOMAIN_EVENT_API_VERSION = "2026-07-20";
30
30
  * `quick_reply` — ação de agendamento vinda de CTA do paciente.
31
31
  *
32
32
  * Ausente = ponto não mapeado/evento antigo: nenhum filtro o descarta.
33
+ *
34
+ * feat-319 F2: `origin` é o PONTO DE EMISSÃO, não a ferramenta. Quem criou o
35
+ * agendamento (web_app × app_professional × mcp × sync...) e o usuário vão em
36
+ * `data.created_by` (`IAppointmentCreatedBy`) nos eventos `agendamento.criado`
37
+ * e `agendamento.rascunho_confirmado` — aditivo, esta lista não muda.
33
38
  */
34
39
  exports.DOMAIN_EVENT_ORIGINS = [
35
40
  "app",
@@ -49,6 +49,11 @@ export interface IDomainEventActor {
49
49
  * `quick_reply` — ação de agendamento vinda de CTA do paciente.
50
50
  *
51
51
  * Ausente = ponto não mapeado/evento antigo: nenhum filtro o descarta.
52
+ *
53
+ * feat-319 F2: `origin` é o PONTO DE EMISSÃO, não a ferramenta. Quem criou o
54
+ * agendamento (web_app × app_professional × mcp × sync...) e o usuário vão em
55
+ * `data.created_by` (`IAppointmentCreatedBy`) nos eventos `agendamento.criado`
56
+ * e `agendamento.rascunho_confirmado` — aditivo, esta lista não muda.
52
57
  */
53
58
  export const DOMAIN_EVENT_ORIGINS = [
54
59
  "app",
@@ -220,6 +220,8 @@ export interface IAttachmentListQuery {
220
220
  limit?: number;
221
221
  /** base64url de `{ o: occurred_at ISO, id }`. */
222
222
  cursor?: string;
223
+ /** F1.2 — lixeira: só os removidos da raiz (`deleted_at`), últimas `limit` remoções, sem cursor. */
224
+ deleted?: boolean;
223
225
  }
224
226
  /** Nó da família que trouxe o item quando ele não tem a key da raiz (rótulo "via …"). */
225
227
  export interface IAttachmentVia {
@@ -303,6 +303,8 @@ export interface IAttachmentListQuery {
303
303
  limit?: number;
304
304
  /** base64url de `{ o: occurred_at ISO, id }`. */
305
305
  cursor?: string;
306
+ /** F1.2 — lixeira: só os removidos da raiz (`deleted_at`), últimas `limit` remoções, sem cursor. */
307
+ deleted?: boolean;
306
308
  }
307
309
 
308
310
  /** Nó da família que trouxe o item quando ele não tem a key da raiz (rótulo "via …"). */
@@ -185,6 +185,43 @@ export interface IAppointmentRequestedBy {
185
185
  display_name: string | null;
186
186
  source: AppointmentRequestedBySource;
187
187
  }
188
+ /**
189
+ * feat-319 F2 — ferramenta que CRIOU o agendamento (carimbo `created_by.origin`).
190
+ * Aberto de propósito (o zod usa `z.string()`): um parser antigo não pode
191
+ * reprovar o doc quando surgir uma origem nova.
192
+ */
193
+ export declare const AppointmentCreatedByOrigin: {
194
+ readonly WebApp: "web_app";
195
+ readonly AppProfessional: "app_professional";
196
+ readonly Mcp: "mcp";
197
+ readonly Sync: "sync";
198
+ readonly Hubia: "hubia";
199
+ readonly Automation: "automation";
200
+ readonly System: "system";
201
+ readonly Unknown: "unknown";
202
+ };
203
+ export type AppointmentCreatedByOrigin = (typeof AppointmentCreatedByOrigin)[keyof typeof AppointmentCreatedByOrigin];
204
+ /**
205
+ * feat-319 F2 — quem criou o agendamento: a ORIGEM (ferramenta) e o USUÁRIO.
206
+ * Carimbado só no servidor, só no create (`AppointmentModel.setProperties`);
207
+ * o valor que vier do cliente é sempre descartado e o update nunca o altera.
208
+ */
209
+ export interface IAppointmentCreatedBy {
210
+ /** ferramenta que criou (ver `AppointmentCreatedByOrigin`). */
211
+ origin: AppointmentCreatedByOrigin | string;
212
+ /** quem criou (users/{id}); null quando não há pessoa (sync, sistema). */
213
+ user_id: string | null;
214
+ /** nome do USUÁRIO (funcionário) no create; nunca paciente. */
215
+ display_name: string | null;
216
+ /** marcador autodeclarado do cliente, formato X-Hub-Client (ex.: 'web-app/1.5.460 (web)'). */
217
+ client?: string | null;
218
+ /** só criação humana pela interface: agenda nativa × agenda externa (Calendar V2). */
219
+ channel?: "native_calendar" | "external_calendar" | null;
220
+ /** só sync: adapter da agenda externa (iclinic, soc, ...). */
221
+ adapter?: string | null;
222
+ /** só sync: janela nunca sincronizada (import/agenda nova) — não é criação do dia. */
223
+ backfill?: boolean;
224
+ }
188
225
  export interface IAppointment extends IFireDoc {
189
226
  startDate: Date;
190
227
  endDate: Date;
@@ -225,6 +262,8 @@ export interface IAppointment extends IFireDoc {
225
262
  draftExpirationMinutes?: number | null;
226
263
  /** feat-193 F4 — solicitante do agendamento. Ver `IAppointmentRequestedBy`. */
227
264
  requested_by?: IAppointmentRequestedBy | null;
265
+ /** feat-319 F2 — quem criou (origem + usuário). Ver `IAppointmentCreatedBy`. */
266
+ created_by?: IAppointmentCreatedBy | null;
228
267
  /** feat-271 F2 — proposta da HubIA (evento `hubia_proposal` na thread) que originou este agendamento. */
229
268
  hubia_proposal_id?: string | null;
230
269
  tags?: ITag[] | null;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppointmentRequestedBySourceEnum = exports.PaymentTypeEnum = exports.TelemedicineProviderEnum = exports.AppointmentModeEnum = exports.AppointmentPaymentStatusEnum = exports.EvoMedAppointmentPermissions = void 0;
3
+ exports.AppointmentCreatedByOrigin = exports.AppointmentRequestedBySourceEnum = exports.PaymentTypeEnum = exports.TelemedicineProviderEnum = exports.AppointmentModeEnum = exports.AppointmentPaymentStatusEnum = exports.EvoMedAppointmentPermissions = void 0;
4
4
  // Permissões para o agendamento
5
5
  exports.EvoMedAppointmentPermissions = {
6
6
  List: "evo_med_appointment_read",
@@ -49,3 +49,18 @@ exports.AppointmentRequestedBySourceEnum = {
49
49
  HubIA: "hubia",
50
50
  Mcp: "mcp",
51
51
  };
52
+ /**
53
+ * feat-319 F2 — ferramenta que CRIOU o agendamento (carimbo `created_by.origin`).
54
+ * Aberto de propósito (o zod usa `z.string()`): um parser antigo não pode
55
+ * reprovar o doc quando surgir uma origem nova.
56
+ */
57
+ exports.AppointmentCreatedByOrigin = {
58
+ WebApp: "web_app",
59
+ AppProfessional: "app_professional",
60
+ Mcp: "mcp",
61
+ Sync: "sync",
62
+ Hubia: "hubia",
63
+ Automation: "automation",
64
+ System: "system",
65
+ Unknown: "unknown",
66
+ };
@@ -249,6 +249,47 @@ export interface IAppointmentRequestedBy {
249
249
  source: AppointmentRequestedBySource;
250
250
  }
251
251
 
252
+ /**
253
+ * feat-319 F2 — ferramenta que CRIOU o agendamento (carimbo `created_by.origin`).
254
+ * Aberto de propósito (o zod usa `z.string()`): um parser antigo não pode
255
+ * reprovar o doc quando surgir uma origem nova.
256
+ */
257
+ export const AppointmentCreatedByOrigin = {
258
+ WebApp: "web_app",
259
+ AppProfessional: "app_professional",
260
+ Mcp: "mcp",
261
+ Sync: "sync",
262
+ Hubia: "hubia",
263
+ Automation: "automation",
264
+ System: "system",
265
+ Unknown: "unknown",
266
+ } as const;
267
+
268
+ export type AppointmentCreatedByOrigin =
269
+ (typeof AppointmentCreatedByOrigin)[keyof typeof AppointmentCreatedByOrigin];
270
+
271
+ /**
272
+ * feat-319 F2 — quem criou o agendamento: a ORIGEM (ferramenta) e o USUÁRIO.
273
+ * Carimbado só no servidor, só no create (`AppointmentModel.setProperties`);
274
+ * o valor que vier do cliente é sempre descartado e o update nunca o altera.
275
+ */
276
+ export interface IAppointmentCreatedBy {
277
+ /** ferramenta que criou (ver `AppointmentCreatedByOrigin`). */
278
+ origin: AppointmentCreatedByOrigin | string;
279
+ /** quem criou (users/{id}); null quando não há pessoa (sync, sistema). */
280
+ user_id: string | null;
281
+ /** nome do USUÁRIO (funcionário) no create; nunca paciente. */
282
+ display_name: string | null;
283
+ /** marcador autodeclarado do cliente, formato X-Hub-Client (ex.: 'web-app/1.5.460 (web)'). */
284
+ client?: string | null;
285
+ /** só criação humana pela interface: agenda nativa × agenda externa (Calendar V2). */
286
+ channel?: "native_calendar" | "external_calendar" | null;
287
+ /** só sync: adapter da agenda externa (iclinic, soc, ...). */
288
+ adapter?: string | null;
289
+ /** só sync: janela nunca sincronizada (import/agenda nova) — não é criação do dia. */
290
+ backfill?: boolean;
291
+ }
292
+
252
293
  export interface IAppointment extends IFireDoc {
253
294
  startDate: Date;
254
295
  endDate: Date;
@@ -293,6 +334,9 @@ export interface IAppointment extends IFireDoc {
293
334
  /** feat-193 F4 — solicitante do agendamento. Ver `IAppointmentRequestedBy`. */
294
335
  requested_by?: IAppointmentRequestedBy | null;
295
336
 
337
+ /** feat-319 F2 — quem criou (origem + usuário). Ver `IAppointmentCreatedBy`. */
338
+ created_by?: IAppointmentCreatedBy | null;
339
+
296
340
  /** feat-271 F2 — proposta da HubIA (evento `hubia_proposal` na thread) que originou este agendamento. */
297
341
  hubia_proposal_id?: string | null;
298
342
 
@@ -25,3 +25,5 @@ export declare const APPOINTMENTS_COLLECTION = "appointments";
25
25
  export declare const DISEASES = "diseases";
26
26
  export declare const ALLERGIES_COLLECTION = "allergies";
27
27
  export declare const CHRONIC_CONDITIONS_COLLECTION = "chronic_conditions";
28
+ export declare const EVO_MED_SCOREBOARD_COLLECTION = "scoreboard";
29
+ export declare const EVO_MED_SCOREBOARD_MARKS_COLLECTION = "scoreboard-marks";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CHRONIC_CONDITIONS_COLLECTION = exports.ALLERGIES_COLLECTION = exports.DISEASES = exports.APPOINTMENTS_COLLECTION = exports.APPOINTMENT_REQUEST_TYPES_COLLECTION = exports.APPOINTMENT_TYPES_COLLECTION = exports.APPOINTMENT_STATUSES_COLLECTION = exports.APPOINTMENT_SOURCES_COLLECTION = exports.APPOINTMENTS = exports.PATIENT_SOURCES_COLLECTION = exports.SOURCES = exports.ATTACHMENT_CATEGORIES_COLLECTION = exports.ATTACHMENT_CATEGORIES = exports.MEDICAL_COUNCILS_COLLECTION = exports.COUNCILS = exports.PROCEDURES_COLLECTION = exports.PROCEDURES_TYPES_COLLECTION = exports.PROCEDURES = exports.SPECIALTIES_COLLECTION = exports.SPECIALTIES_TYPES_COLLECTION = exports.SPECIALTIES = exports.DICS_COLLECTION = exports.CALENDARS_COLLECTION = exports.INSURANCES_COLLECTION = exports.PATIENTS_COLLECTION = exports.PROFESSIONALS_COLLECTION = exports.EVO_MED_APP = void 0;
3
+ exports.EVO_MED_SCOREBOARD_MARKS_COLLECTION = exports.EVO_MED_SCOREBOARD_COLLECTION = exports.CHRONIC_CONDITIONS_COLLECTION = exports.ALLERGIES_COLLECTION = exports.DISEASES = exports.APPOINTMENTS_COLLECTION = exports.APPOINTMENT_REQUEST_TYPES_COLLECTION = exports.APPOINTMENT_TYPES_COLLECTION = exports.APPOINTMENT_STATUSES_COLLECTION = exports.APPOINTMENT_SOURCES_COLLECTION = exports.APPOINTMENTS = exports.PATIENT_SOURCES_COLLECTION = exports.SOURCES = exports.ATTACHMENT_CATEGORIES_COLLECTION = exports.ATTACHMENT_CATEGORIES = exports.MEDICAL_COUNCILS_COLLECTION = exports.COUNCILS = exports.PROCEDURES_COLLECTION = exports.PROCEDURES_TYPES_COLLECTION = exports.PROCEDURES = exports.SPECIALTIES_COLLECTION = exports.SPECIALTIES_TYPES_COLLECTION = exports.SPECIALTIES = exports.DICS_COLLECTION = exports.CALENDARS_COLLECTION = exports.INSURANCES_COLLECTION = exports.PATIENTS_COLLECTION = exports.PROFESSIONALS_COLLECTION = exports.EVO_MED_APP = void 0;
4
4
  //EVO Med Application Doc
5
5
  exports.EVO_MED_APP = "evo-med";
6
6
  //people
@@ -33,3 +33,11 @@ exports.APPOINTMENTS_COLLECTION = "appointments";
33
33
  exports.DISEASES = "diseases";
34
34
  exports.ALLERGIES_COLLECTION = "allergies";
35
35
  exports.CHRONIC_CONDITIONS_COLLECTION = "chronic_conditions";
36
+ // feat-319 F2 — placar do dia de agendamentos (RCW-TV). Sanitizado: sem
37
+ // paciente, sem id de agendamento. Só backend escreve (evomed_scoreboard).
38
+ // Caminho: tenants/{t}/apps/evo-med/scoreboard/{AAAA-MM-DD}
39
+ exports.EVO_MED_SCOREBOARD_COLLECTION = "scoreboard";
40
+ // Marcador de idempotência por agendamento ({calendarId}__{appointmentId}),
41
+ // com TTL em `expires_at`. Nome único (collection group da TTL); sem regra
42
+ // de leitura no cliente.
43
+ exports.EVO_MED_SCOREBOARD_MARKS_COLLECTION = "scoreboard-marks";
@@ -39,3 +39,12 @@ export const APPOINTMENTS_COLLECTION = "appointments";
39
39
  export const DISEASES = "diseases";
40
40
  export const ALLERGIES_COLLECTION = "allergies";
41
41
  export const CHRONIC_CONDITIONS_COLLECTION = "chronic_conditions";
42
+
43
+ // feat-319 F2 — placar do dia de agendamentos (RCW-TV). Sanitizado: sem
44
+ // paciente, sem id de agendamento. Só backend escreve (evomed_scoreboard).
45
+ // Caminho: tenants/{t}/apps/evo-med/scoreboard/{AAAA-MM-DD}
46
+ export const EVO_MED_SCOREBOARD_COLLECTION = "scoreboard";
47
+ // Marcador de idempotência por agendamento ({calendarId}__{appointmentId}),
48
+ // com TTL em `expires_at`. Nome único (collection group da TTL); sem regra
49
+ // de leitura no cliente.
50
+ export const EVO_MED_SCOREBOARD_MARKS_COLLECTION = "scoreboard-marks";
@@ -0,0 +1,53 @@
1
+ /**
2
+ * feat-319 F2 — placar do dia de agendamentos (RCW-TV).
3
+ *
4
+ * Doc: tenants/{t}/apps/evo-med/scoreboard/{AAAA-MM-DD} (dia em
5
+ * America/Sao_Paulo, pelo `occurred_at` do evento). Escrito só pelo
6
+ * consumidor `evomed_scoreboard` (tópico evo-domain-events). Sanitizado:
7
+ * nenhum dado de paciente nem id de agendamento.
8
+ */
9
+ export * from "../fb_collections";
10
+ export declare const EvoMedScoreboardPermissions: {
11
+ readonly Read: "evo_med_scoreboard_read";
12
+ };
13
+ export type EvoMedScoreboardPermissions = (typeof EvoMedScoreboardPermissions)[keyof typeof EvoMedScoreboardPermissions];
14
+ export declare const EVO_MED_SCOREBOARD_TZ = "America/Sao_Paulo";
15
+ export declare const EVO_MED_SCOREBOARD_MODEL_VER = 1;
16
+ /** Última festa do dia (só criação humana pela interface do web-app). */
17
+ export interface IEvoMedScoreboardCelebration {
18
+ seq: number;
19
+ /** Timestamp do Firestore (Date após conversão). */
20
+ at: Date | unknown;
21
+ user_id: string;
22
+ display_name: string | null;
23
+ }
24
+ /** Contagem de festas por usuário (só web_app). */
25
+ export interface IEvoMedScoreboardActor {
26
+ display_name: string | null;
27
+ count: number;
28
+ }
29
+ export interface IEvoMedScoreboardDay {
30
+ /** AAAA-MM-DD em `tz`. */
31
+ day: string;
32
+ tz: string;
33
+ /** agendamentos criados no dia, todas as origens que contam. */
34
+ created_count: number;
35
+ /** por `created_by.origin` (web_app, app_professional, mcp, sync, unknown...). */
36
+ by_source: Record<string, number>;
37
+ /** nº de festas do dia (web_app com usuário). */
38
+ celebration_seq: number;
39
+ last_celebration?: IEvoMedScoreboardCelebration | null;
40
+ /** por user_id, só web_app. */
41
+ by_actor?: Record<string, IEvoMedScoreboardActor>;
42
+ updated_at: Date | unknown;
43
+ model_ver: number;
44
+ }
45
+ /** Marcador de idempotência (scoreboard-marks/{calendarId}__{appointmentId}). */
46
+ export interface IEvoMedScoreboardMark {
47
+ day: string;
48
+ event_id: string;
49
+ event_type: string;
50
+ counted_at: Date | unknown;
51
+ /** TTL nativa (+8 dias, acima da retenção máxima do Pub/Sub). */
52
+ expires_at: Date | unknown;
53
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.EVO_MED_SCOREBOARD_MODEL_VER = exports.EVO_MED_SCOREBOARD_TZ = exports.EvoMedScoreboardPermissions = void 0;
18
+ /**
19
+ * feat-319 F2 — placar do dia de agendamentos (RCW-TV).
20
+ *
21
+ * Doc: tenants/{t}/apps/evo-med/scoreboard/{AAAA-MM-DD} (dia em
22
+ * America/Sao_Paulo, pelo `occurred_at` do evento). Escrito só pelo
23
+ * consumidor `evomed_scoreboard` (tópico evo-domain-events). Sanitizado:
24
+ * nenhum dado de paciente nem id de agendamento.
25
+ */
26
+ __exportStar(require("../fb_collections"), exports);
27
+ // Permissão de leitura do placar (papel rcw_viewer).
28
+ exports.EvoMedScoreboardPermissions = {
29
+ Read: "evo_med_scoreboard_read",
30
+ };
31
+ exports.EVO_MED_SCOREBOARD_TZ = "America/Sao_Paulo";
32
+ exports.EVO_MED_SCOREBOARD_MODEL_VER = 1;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * feat-319 F2 — placar do dia de agendamentos (RCW-TV).
3
+ *
4
+ * Doc: tenants/{t}/apps/evo-med/scoreboard/{AAAA-MM-DD} (dia em
5
+ * America/Sao_Paulo, pelo `occurred_at` do evento). Escrito só pelo
6
+ * consumidor `evomed_scoreboard` (tópico evo-domain-events). Sanitizado:
7
+ * nenhum dado de paciente nem id de agendamento.
8
+ */
9
+ export * from "../fb_collections";
10
+
11
+ // Permissão de leitura do placar (papel rcw_viewer).
12
+ export const EvoMedScoreboardPermissions = {
13
+ Read: "evo_med_scoreboard_read",
14
+ } as const;
15
+
16
+ export type EvoMedScoreboardPermissions =
17
+ (typeof EvoMedScoreboardPermissions)[keyof typeof EvoMedScoreboardPermissions];
18
+
19
+ export const EVO_MED_SCOREBOARD_TZ = "America/Sao_Paulo";
20
+ export const EVO_MED_SCOREBOARD_MODEL_VER = 1;
21
+
22
+ /** Última festa do dia (só criação humana pela interface do web-app). */
23
+ export interface IEvoMedScoreboardCelebration {
24
+ seq: number;
25
+ /** Timestamp do Firestore (Date após conversão). */
26
+ at: Date | unknown;
27
+ user_id: string;
28
+ display_name: string | null;
29
+ }
30
+
31
+ /** Contagem de festas por usuário (só web_app). */
32
+ export interface IEvoMedScoreboardActor {
33
+ display_name: string | null;
34
+ count: number;
35
+ }
36
+
37
+ export interface IEvoMedScoreboardDay {
38
+ /** AAAA-MM-DD em `tz`. */
39
+ day: string;
40
+ tz: string;
41
+ /** agendamentos criados no dia, todas as origens que contam. */
42
+ created_count: number;
43
+ /** por `created_by.origin` (web_app, app_professional, mcp, sync, unknown...). */
44
+ by_source: Record<string, number>;
45
+ /** nº de festas do dia (web_app com usuário). */
46
+ celebration_seq: number;
47
+ last_celebration?: IEvoMedScoreboardCelebration | null;
48
+ /** por user_id, só web_app. */
49
+ by_actor?: Record<string, IEvoMedScoreboardActor>;
50
+ updated_at: Date | unknown;
51
+ model_ver: number;
52
+ }
53
+
54
+ /** Marcador de idempotência (scoreboard-marks/{calendarId}__{appointmentId}). */
55
+ export interface IEvoMedScoreboardMark {
56
+ day: string;
57
+ event_id: string;
58
+ event_type: string;
59
+ counted_at: Date | unknown;
60
+ /** TTL nativa (+8 dias, acima da retenção máxima do Pub/Sub). */
61
+ expires_at: Date | unknown;
62
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.768",
3
+ "version": "1.3.772",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",