evo360-types 1.3.409 → 1.3.413

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.
@@ -68,18 +68,47 @@ export interface IAutomationDateWindow {
68
68
  export interface IAutomationAppointmentSelection {
69
69
  target: "appointment";
70
70
  appointment: {
71
- // Empty/omitted = all calendars of the tenant.
71
+ // Empty/omitted = all calendars of the tenant. GUI enforces exactly 1
72
+ // (Q21-A: single-calendar unlocks rich filter-values); calendar_ids[] kept
73
+ // for engine/seed compat (multi-calendar = N routines).
72
74
  calendar_ids?: string[];
73
75
  date_window: IAutomationDateWindow;
74
- // Filters applied in memory over the day window (no server-side status query).
76
+ // Filters applied in memory over the day window (no server-side query).
77
+ // String filters accept the wildcard `*` (case-insensitive glob); without
78
+ // `*` they are exact matches (Q21). Sourced from the appointment embeds
79
+ // (passthrough from the sync, per the Q20-C investigation).
75
80
  status_in?: string[];
76
81
  status_base_in?: string[];
77
82
  appointment_type_not_in?: string[];
83
+ // professional.display_name
84
+ professional_names?: string[];
85
+ // matches if ANY procedures[].name matches
86
+ procedure_names?: string[];
87
+ // insurance.name
88
+ insurance_names?: string[];
89
+ // address.address_name (note: NOT address.Name of the legacy n8n shape)
90
+ address_names?: string[];
91
+ // payment.status — fixed local enum (pending/partial/paid/not_informed)
92
+ payment_status_in?: string[];
78
93
  };
79
94
  }
80
95
 
81
96
  export type IAutomationSelection = IAutomationAppointmentSelection;
82
97
 
98
+ // Distinct filter values for a calendar, built from a limited window of local
99
+ // appointments (GET /routines/filter-values?calendar_id=). Feeds the GUI's
100
+ // selection filters and branch conditions with real, per-calendar suggestions
101
+ // (Q20-C: distinct-local, no adapter capability). Sorted pt-BR, capped per field.
102
+ export interface IAutomationFilterValues {
103
+ professionals: string[];
104
+ procedures: string[];
105
+ insurances: string[];
106
+ addresses: string[];
107
+ statuses: string[];
108
+ status_bases: string[];
109
+ appointment_types: string[];
110
+ }
111
+
83
112
  // ------------------------------------------------------
84
113
  // Fact catalog (F1: appointment domain facts only — Q15: no patient.* facts)
85
114
  // ------------------------------------------------------
@@ -91,9 +120,16 @@ export const AUTOMATION_APPOINTMENT_FACTS = [
91
120
  "appointment.appointment_base_type",
92
121
  // 'telemedicine' | 'in_person'
93
122
  "appointment.appointment_mode",
94
- // Derived from professional.professionalRef.id
123
+ // Derived from professional.professionalRef.id. On external calendars the
124
+ // reliable value is the name (Q21) — professional_id kept for internal.
95
125
  "appointment.professional_id",
96
126
  "appointment.procedure_ids",
127
+ // Embed-sourced names (Q20-C passthrough); reliable across adapters.
128
+ "appointment.professional_name",
129
+ // string[] — matches if ANY procedure name matches.
130
+ "appointment.procedure_names",
131
+ "appointment.insurance_name",
132
+ "appointment.address_name",
97
133
  "appointment.payment_status",
98
134
  "appointment.calendar_id",
99
135
  ] as const;
@@ -151,6 +187,11 @@ export type AutomationOutputType =
151
187
  // - immediate: now (Task Runner picks it up on the next tick)
152
188
  // - send_at_local: HH:mm resolved in the tenant timezone, anchored to the
153
189
  // target date or the run date.
190
+ // - relative_to_appointment: appointment.startDate + offset_minutes (Q20.7).
191
+ // Negative = before the appointment (e.g. -120 = 2h before). The routine
192
+ // runs once (e.g. 6am); each task is scheduled relative to its own target.
193
+ // If the computed time already passed at run time, the materializer clamps
194
+ // it to "now" (with a log).
154
195
  export type IAutomationExecuteAt =
155
196
  | { rule: "immediate" }
156
197
  | {
@@ -158,6 +199,11 @@ export type IAutomationExecuteAt =
158
199
  // "HH:mm" (24h)
159
200
  time: string;
160
201
  base: "target_date" | "run_date";
202
+ }
203
+ | {
204
+ rule: "relative_to_appointment";
205
+ // Signed minutes offset from appointment.startDate (negative = before).
206
+ offset_minutes: number;
161
207
  };
162
208
 
163
209
  export interface IAutomationAutoTaskOutput {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.409",
3
+ "version": "1.3.413",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",