evo360-types 1.3.581 → 1.3.583

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.
@@ -123,6 +123,22 @@ export declare const zAutomationDateWindowSchema: z.ZodObject<{
123
123
  offset_mode: "calendar" | "business";
124
124
  }>;
125
125
  export declare const zAutomationTimeOfDaySchema: z.ZodString;
126
+ export declare const zAutomationTimeOfDayRangeSchema: z.ZodEffects<z.ZodObject<{
127
+ start: z.ZodString;
128
+ end: z.ZodString;
129
+ }, "strip", z.ZodTypeAny, {
130
+ start: string;
131
+ end: string;
132
+ }, {
133
+ start: string;
134
+ end: string;
135
+ }>, {
136
+ start: string;
137
+ end: string;
138
+ }, {
139
+ start: string;
140
+ end: string;
141
+ }>;
126
142
  export declare const zAutomationAppointmentModeSchema: z.ZodEnum<["telemedicine", "in_person"]>;
127
143
  export declare const zAutomationAppointmentSelectionSchema: z.ZodObject<{
128
144
  target: z.ZodLiteral<"appointment">;
@@ -588,17 +604,25 @@ export declare const zAutomationSelectionSchema: z.ZodDiscriminatedUnion<"target
588
604
  };
589
605
  target: "patient";
590
606
  }>]>;
591
- export declare const zAutomationOperatorSchema: z.ZodEnum<["eq", "neq", "in", "not_in", "exists", "not_exists", "is_true", "is_false"]>;
592
- export declare const zAutomationConditionSchema: z.ZodObject<{
607
+ export declare const zAutomationOperatorSchema: z.ZodEnum<["eq", "neq", "in", "not_in", "exists", "not_exists", "is_true", "is_false", "between", "not_between"]>;
608
+ export declare const zAutomationConditionSchema: z.ZodEffects<z.ZodObject<{
593
609
  fact: z.ZodString;
594
- operator: z.ZodEnum<["eq", "neq", "in", "not_in", "exists", "not_exists", "is_true", "is_false"]>;
610
+ operator: z.ZodEnum<["eq", "neq", "in", "not_in", "exists", "not_exists", "is_true", "is_false", "between", "not_between"]>;
595
611
  value: z.ZodOptional<z.ZodUnknown>;
596
612
  }, "strip", z.ZodTypeAny, {
597
- operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false";
613
+ operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false" | "between" | "not_between";
614
+ fact: string;
615
+ value?: unknown;
616
+ }, {
617
+ operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false" | "between" | "not_between";
618
+ fact: string;
619
+ value?: unknown;
620
+ }>, {
621
+ operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false" | "between" | "not_between";
598
622
  fact: string;
599
623
  value?: unknown;
600
624
  }, {
601
- operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false";
625
+ operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false" | "between" | "not_between";
602
626
  fact: string;
603
627
  value?: unknown;
604
628
  }>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zAutomationTriggerRequestSchema = exports.zAutomationDryRunRequestSchema = exports.zHubAutomationConfigSchema = exports.zAutomationRoutineUpdateRequestSchema = exports.zAutomationRoutineWriteSchema = exports.zAutomationRoutineSchema = exports.zAutomationBranchModeSchema = exports.zAutomationBranchSchema = exports.zAutomationOutputSchema = exports.zAutomationActionOutputSchema = exports.zAutomationHumanTaskOutputSchema = exports.zAutomationAutoTaskOutputSchema = exports.zAutomationExecuteAtSchema = exports.zAutomationConditionGroupSchema = exports.zAutomationConditionSchema = exports.zAutomationOperatorSchema = exports.zAutomationSelectionSchema = exports.zAutomationPatientSelectionSchema = exports.zAutomationLeadSelectionSchema = exports.zAutomationAppointmentSelectionSchema = exports.zAutomationAppointmentModeSchema = exports.zAutomationTimeOfDaySchema = exports.zAutomationDateWindowSchema = exports.zAutomationDateOffsetModeSchema = exports.zAutomationTriggerSchema = exports.zAutomationEventTriggerSchema = exports.zAutomationWebhookTriggerSchema = exports.zAutomationCronTriggerSchema = void 0;
3
+ exports.zAutomationTriggerRequestSchema = exports.zAutomationDryRunRequestSchema = exports.zHubAutomationConfigSchema = exports.zAutomationRoutineUpdateRequestSchema = exports.zAutomationRoutineWriteSchema = exports.zAutomationRoutineSchema = exports.zAutomationBranchModeSchema = exports.zAutomationBranchSchema = exports.zAutomationOutputSchema = exports.zAutomationActionOutputSchema = exports.zAutomationHumanTaskOutputSchema = exports.zAutomationAutoTaskOutputSchema = exports.zAutomationExecuteAtSchema = exports.zAutomationConditionGroupSchema = exports.zAutomationConditionSchema = exports.zAutomationOperatorSchema = exports.zAutomationSelectionSchema = exports.zAutomationPatientSelectionSchema = exports.zAutomationLeadSelectionSchema = exports.zAutomationAppointmentSelectionSchema = exports.zAutomationAppointmentModeSchema = exports.zAutomationTimeOfDayRangeSchema = exports.zAutomationTimeOfDaySchema = exports.zAutomationDateWindowSchema = exports.zAutomationDateOffsetModeSchema = exports.zAutomationTriggerSchema = exports.zAutomationEventTriggerSchema = exports.zAutomationWebhookTriggerSchema = exports.zAutomationCronTriggerSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const zod_schemas_1 = require("../evo-task/zod-schemas");
6
6
  // ------------------------------------------------------
@@ -45,6 +45,14 @@ exports.zAutomationDateWindowSchema = zod_1.z.object({
45
45
  exports.zAutomationTimeOfDaySchema = zod_1.z
46
46
  .string()
47
47
  .regex(/^([01]\d|2[0-3]):[0-5]\d$/, "expected HH:mm");
48
+ // feat-167: value of the between/not_between branch operators. Kept separate
49
+ // from selection.time_range (inline below), which does not change.
50
+ exports.zAutomationTimeOfDayRangeSchema = zod_1.z
51
+ .object({ start: exports.zAutomationTimeOfDaySchema, end: exports.zAutomationTimeOfDaySchema })
52
+ .refine((r) => r.start !== r.end, {
53
+ message: "start and end must differ",
54
+ path: ["end"],
55
+ });
48
56
  // feat-147: appointment modality (IAppointment.appointmentMode). Fixed enum —
49
57
  // the selection matches it exactly (no wildcard glob).
50
58
  exports.zAutomationAppointmentModeSchema = zod_1.z.enum([
@@ -131,11 +139,29 @@ exports.zAutomationOperatorSchema = zod_1.z.enum([
131
139
  "not_exists",
132
140
  "is_true",
133
141
  "is_false",
142
+ // feat-167
143
+ "between",
144
+ "not_between",
134
145
  ]);
135
- exports.zAutomationConditionSchema = zod_1.z.object({
146
+ // feat-167: between/not_between validate `value` as a time-of-day range. The
147
+ // operator is NOT tied to `appointment.start_time` here (`fact` stays a free
148
+ // string for forward compat); the evaluator returns false on any other fact and
149
+ // the builder only offers these operators for the time fact.
150
+ exports.zAutomationConditionSchema = zod_1.z
151
+ .object({
136
152
  fact: zod_1.z.string().min(1),
137
153
  operator: exports.zAutomationOperatorSchema,
138
154
  value: zod_1.z.unknown().optional(),
155
+ })
156
+ .superRefine((c, ctx) => {
157
+ if (c.operator !== "between" && c.operator !== "not_between")
158
+ return;
159
+ const r = exports.zAutomationTimeOfDayRangeSchema.safeParse(c.value);
160
+ if (!r.success) {
161
+ for (const issue of r.error.issues) {
162
+ ctx.addIssue({ ...issue, path: ["value", ...issue.path] });
163
+ }
164
+ }
139
165
  });
140
166
  exports.zAutomationConditionGroupSchema = zod_1.z.lazy(() => zod_1.z.object({
141
167
  combinator: zod_1.z.enum(["and", "or"]),
@@ -54,6 +54,15 @@ export const zAutomationTimeOfDaySchema = z
54
54
  .string()
55
55
  .regex(/^([01]\d|2[0-3]):[0-5]\d$/, "expected HH:mm");
56
56
 
57
+ // feat-167: value of the between/not_between branch operators. Kept separate
58
+ // from selection.time_range (inline below), which does not change.
59
+ export const zAutomationTimeOfDayRangeSchema = z
60
+ .object({ start: zAutomationTimeOfDaySchema, end: zAutomationTimeOfDaySchema })
61
+ .refine((r) => r.start !== r.end, {
62
+ message: "start and end must differ",
63
+ path: ["end"],
64
+ });
65
+
57
66
  // feat-147: appointment modality (IAppointment.appointmentMode). Fixed enum —
58
67
  // the selection matches it exactly (no wildcard glob).
59
68
  export const zAutomationAppointmentModeSchema = z.enum([
@@ -146,13 +155,30 @@ export const zAutomationOperatorSchema = z.enum([
146
155
  "not_exists",
147
156
  "is_true",
148
157
  "is_false",
158
+ // feat-167
159
+ "between",
160
+ "not_between",
149
161
  ]);
150
162
 
151
- export const zAutomationConditionSchema = z.object({
152
- fact: z.string().min(1),
153
- operator: zAutomationOperatorSchema,
154
- value: z.unknown().optional(),
155
- });
163
+ // feat-167: between/not_between validate `value` as a time-of-day range. The
164
+ // operator is NOT tied to `appointment.start_time` here (`fact` stays a free
165
+ // string for forward compat); the evaluator returns false on any other fact and
166
+ // the builder only offers these operators for the time fact.
167
+ export const zAutomationConditionSchema = z
168
+ .object({
169
+ fact: z.string().min(1),
170
+ operator: zAutomationOperatorSchema,
171
+ value: z.unknown().optional(),
172
+ })
173
+ .superRefine((c, ctx) => {
174
+ if (c.operator !== "between" && c.operator !== "not_between") return;
175
+ const r = zAutomationTimeOfDayRangeSchema.safeParse(c.value);
176
+ if (!r.success) {
177
+ for (const issue of r.error.issues) {
178
+ ctx.addIssue({ ...issue, path: ["value", ...issue.path] });
179
+ }
180
+ }
181
+ });
156
182
 
157
183
  // z.lazy needs an explicit type annotation for the recursive reference.
158
184
  type ZAutomationConditionGroup = {
@@ -84,7 +84,7 @@ export interface IAutomationFilterValues {
84
84
  status_bases: string[];
85
85
  appointment_types: string[];
86
86
  }
87
- export declare const AUTOMATION_APPOINTMENT_FACTS: readonly ["appointment.status", "appointment.status_base", "appointment.appointment_type", "appointment.appointment_base_type", "appointment.appointment_mode", "appointment.professional_id", "appointment.procedure_ids", "appointment.professional_name", "appointment.procedure_names", "appointment.insurance_name", "appointment.address_name", "appointment.payment_status", "appointment.calendar_id"];
87
+ export declare const AUTOMATION_APPOINTMENT_FACTS: readonly ["appointment.status", "appointment.status_base", "appointment.appointment_type", "appointment.appointment_base_type", "appointment.appointment_mode", "appointment.professional_id", "appointment.procedure_ids", "appointment.professional_name", "appointment.procedure_names", "appointment.insurance_name", "appointment.address_name", "appointment.payment_status", "appointment.calendar_id", "appointment.start_time"];
88
88
  export type AutomationAppointmentFact = (typeof AUTOMATION_APPOINTMENT_FACTS)[number];
89
89
  export declare const AUTOMATION_LEAD_FACTS: readonly ["lead.status", "lead.qualification_code", "lead.qualification_name", "lead.qualification_funnel_level", "lead.dist_channel_code", "lead.dist_channel_name", "lead.tags"];
90
90
  export type AutomationLeadFact = (typeof AUTOMATION_LEAD_FACTS)[number];
@@ -100,8 +100,16 @@ export declare const AutomationOperatorEnum: {
100
100
  readonly NotExists: "not_exists";
101
101
  readonly IsTrue: "is_true";
102
102
  readonly IsFalse: "is_false";
103
+ readonly Between: "between";
104
+ readonly NotBetween: "not_between";
103
105
  };
104
106
  export type AutomationOperator = (typeof AutomationOperatorEnum)[keyof typeof AutomationOperatorEnum];
107
+ /** feat-167: value of between/not_between. start <= hh:mm < end; start > end = overnight. */
108
+ export interface IAutomationTimeOfDayRange {
109
+ start: string;
110
+ end: string;
111
+ }
112
+ export declare const AUTOMATION_TIME_RANGE_OPERATORS: readonly ["between", "not_between"];
105
113
  export interface IAutomationCondition {
106
114
  fact: string;
107
115
  operator: AutomationOperator;
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.AutomationRunStatusEnum = exports.AutomationOutputTypeEnum = exports.AutomationOperatorEnum = exports.AUTOMATION_PATIENT_FACTS = exports.AUTOMATION_LEAD_FACTS = exports.AUTOMATION_APPOINTMENT_FACTS = exports.HubAutomationPermissions = void 0;
17
+ exports.AutomationRunStatusEnum = exports.AutomationOutputTypeEnum = exports.AUTOMATION_TIME_RANGE_OPERATORS = exports.AutomationOperatorEnum = exports.AUTOMATION_PATIENT_FACTS = exports.AUTOMATION_LEAD_FACTS = exports.AUTOMATION_APPOINTMENT_FACTS = exports.HubAutomationPermissions = void 0;
18
18
  __exportStar(require("./fb_collections"), exports);
19
19
  // ======================================================
20
20
  // hub-automation
@@ -59,6 +59,9 @@ exports.AUTOMATION_APPOINTMENT_FACTS = [
59
59
  "appointment.address_name",
60
60
  "appointment.payment_status",
61
61
  "appointment.calendar_id",
62
+ // feat-167: "HH:mm" local of startDate in the TENANT timezone (same clock as
63
+ // selection.time_range). Meant for the between/not_between operators.
64
+ "appointment.start_time",
62
65
  ];
63
66
  // feat-085 (F3): lead domain facts (derived from the fields ILead exposes;
64
67
  // resolved from the event-preloaded lead). Mirror of the appointment catalog.
@@ -95,7 +98,11 @@ exports.AutomationOperatorEnum = {
95
98
  NotExists: "not_exists",
96
99
  IsTrue: "is_true",
97
100
  IsFalse: "is_false",
101
+ // feat-167: time-of-day range over appointment.start_time.
102
+ Between: "between",
103
+ NotBetween: "not_between",
98
104
  };
105
+ exports.AUTOMATION_TIME_RANGE_OPERATORS = ["between", "not_between"];
99
106
  // ------------------------------------------------------
100
107
  // Outputs (auto Task | human Task | inline Action)
101
108
  // ------------------------------------------------------
@@ -207,6 +207,9 @@ export const AUTOMATION_APPOINTMENT_FACTS = [
207
207
  "appointment.address_name",
208
208
  "appointment.payment_status",
209
209
  "appointment.calendar_id",
210
+ // feat-167: "HH:mm" local of startDate in the TENANT timezone (same clock as
211
+ // selection.time_range). Meant for the between/not_between operators.
212
+ "appointment.start_time",
210
213
  ] as const;
211
214
 
212
215
  export type AutomationAppointmentFact =
@@ -258,17 +261,29 @@ export const AutomationOperatorEnum = {
258
261
  NotExists: "not_exists",
259
262
  IsTrue: "is_true",
260
263
  IsFalse: "is_false",
264
+ // feat-167: time-of-day range over appointment.start_time.
265
+ Between: "between",
266
+ NotBetween: "not_between",
261
267
  } as const;
262
268
 
263
269
  export type AutomationOperator =
264
270
  (typeof AutomationOperatorEnum)[keyof typeof AutomationOperatorEnum];
265
271
 
272
+ /** feat-167: value of between/not_between. start <= hh:mm < end; start > end = overnight. */
273
+ export interface IAutomationTimeOfDayRange {
274
+ start: string;
275
+ end: string;
276
+ }
277
+
278
+ export const AUTOMATION_TIME_RANGE_OPERATORS = ["between", "not_between"] as const;
279
+
266
280
  export interface IAutomationCondition {
267
281
  // A fact key from the catalog (AutomationFact); kept as string for forward
268
282
  // compatibility with facts added in later slices.
269
283
  fact: string;
270
284
  operator: AutomationOperator;
271
285
  // Not required for unary operators (exists/not_exists/is_true/is_false).
286
+ // between/not_between require an IAutomationTimeOfDayRange (feat-167).
272
287
  value?: unknown;
273
288
  }
274
289
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.581",
3
+ "version": "1.3.583",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",