evo360-types 1.3.260 → 1.3.262

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.
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.zNotificationLogSchema = exports.zNotificationAttemptSchema = exports.zNotificationMessageSchema = exports.zNotificationErrorSchema = exports.zNotificationProviderMetaSchema = exports.zNotificationTemplateRefSchema = exports.zNotificationChannelRefSchema = exports.zNotificationRecipientSchema = exports.zNotificationLogLevelSchema = exports.zNotificationRecipientKindSchema = exports.zNotificationAttemptStatusSchema = exports.zNotificationMessageStatusSchema = exports.zNotificationChannelTypeSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const zod_schemas_1 = require("../shared/zod-schemas");
6
+ const zod_schemas_2 = require("../evo-task/zod-schemas");
7
+ // ---- Primitives ----
8
+ exports.zNotificationChannelTypeSchema = zod_1.z.enum([
9
+ "whatsapp",
10
+ "email",
11
+ "sms",
12
+ "push",
13
+ ]);
14
+ exports.zNotificationMessageStatusSchema = zod_1.z.enum([
15
+ "queued",
16
+ "processing",
17
+ "sent",
18
+ "delivered",
19
+ "failed",
20
+ "cancelled",
21
+ "suppressed",
22
+ ]);
23
+ exports.zNotificationAttemptStatusSchema = zod_1.z.enum([
24
+ "success",
25
+ "retry",
26
+ "error",
27
+ ]);
28
+ exports.zNotificationRecipientKindSchema = zod_1.z.enum([
29
+ "patient",
30
+ "professional",
31
+ "preconfigured",
32
+ "raw",
33
+ ]);
34
+ exports.zNotificationLogLevelSchema = zod_1.z.enum([
35
+ "debug",
36
+ "info",
37
+ "warn",
38
+ "error",
39
+ ]);
40
+ // ---- Sub-schemas ----
41
+ exports.zNotificationRecipientSchema = zod_1.z
42
+ .object({
43
+ kind: exports.zNotificationRecipientKindSchema,
44
+ id: zod_1.z.string().optional(),
45
+ ref: zod_1.z.any().optional(),
46
+ address: zod_1.z.string().optional(),
47
+ display_name: zod_1.z.string().optional(),
48
+ })
49
+ .passthrough();
50
+ exports.zNotificationChannelRefSchema = zod_1.z
51
+ .object({
52
+ type: exports.zNotificationChannelTypeSchema,
53
+ channel_id: zod_1.z.string(),
54
+ sender_id: zod_1.z.string().optional(),
55
+ })
56
+ .passthrough();
57
+ exports.zNotificationTemplateRefSchema = zod_1.z
58
+ .object({
59
+ template_id: zod_1.z.string(),
60
+ locale: zod_1.z.string().optional(),
61
+ version: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]).optional(),
62
+ })
63
+ .passthrough();
64
+ exports.zNotificationProviderMetaSchema = zod_1.z
65
+ .object({
66
+ name: zod_1.z.string().optional(),
67
+ message_id: zod_1.z.string().optional(),
68
+ status: zod_1.z.string().optional(),
69
+ raw: zod_1.z.record(zod_1.z.unknown()).optional(),
70
+ })
71
+ .passthrough();
72
+ exports.zNotificationErrorSchema = zod_1.z
73
+ .object({
74
+ message: zod_1.z.string(),
75
+ code: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
76
+ details: zod_1.z.record(zod_1.z.unknown()).optional(),
77
+ })
78
+ .passthrough();
79
+ // ---- Main document schemas ----
80
+ exports.zNotificationMessageSchema = zod_schemas_1.zFireDocSchema
81
+ .extend({
82
+ tenant: zod_1.z.string(),
83
+ task_id: zod_1.z.string().optional(),
84
+ routine_id: zod_1.z.string().optional(),
85
+ routine_version: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]).optional(),
86
+ classification: zod_1.z.string().optional(),
87
+ importance: zod_1.z.number().min(0).max(100).optional(),
88
+ channel: exports.zNotificationChannelRefSchema,
89
+ template: exports.zNotificationTemplateRefSchema.optional(),
90
+ recipient: exports.zNotificationRecipientSchema,
91
+ variables: zod_1.z.record(zod_1.z.unknown()).optional(),
92
+ status: exports.zNotificationMessageStatusSchema,
93
+ queued_at: zod_1.z.coerce.date(),
94
+ processing_started_at: zod_1.z.coerce.date().optional(),
95
+ sent_at: zod_1.z.coerce.date().optional(),
96
+ delivered_at: zod_1.z.coerce.date().optional(),
97
+ completed_at: zod_1.z.coerce.date().optional(),
98
+ provider: exports.zNotificationProviderMetaSchema.optional(),
99
+ error: exports.zNotificationErrorSchema.optional(),
100
+ dedup_key: zod_1.z.string().optional(),
101
+ dedup_group_key: zod_1.z.string().optional(),
102
+ date_bucket: zod_1.z.string().optional(),
103
+ externalLinks: zod_1.z.array(zod_schemas_2.zExternalLinkSchema).optional(),
104
+ externalLinkKeys: zod_1.z.array(zod_1.z.string()).optional(),
105
+ })
106
+ .passthrough();
107
+ exports.zNotificationAttemptSchema = zod_schemas_1.zFireDocSchema
108
+ .extend({
109
+ message_id: zod_1.z.string(),
110
+ task_id: zod_1.z.string().optional(),
111
+ attempt: zod_1.z.number(),
112
+ status: exports.zNotificationAttemptStatusSchema,
113
+ requested_at: zod_1.z.coerce.date(),
114
+ started_at: zod_1.z.coerce.date().optional(),
115
+ finished_at: zod_1.z.coerce.date().optional(),
116
+ provider: exports.zNotificationProviderMetaSchema.optional(),
117
+ error: exports.zNotificationErrorSchema.optional(),
118
+ request_summary: zod_1.z.record(zod_1.z.unknown()).optional(),
119
+ response_summary: zod_1.z.record(zod_1.z.unknown()).optional(),
120
+ })
121
+ .passthrough();
122
+ exports.zNotificationLogSchema = zod_schemas_1.zFireDocSchema
123
+ .extend({
124
+ message_id: zod_1.z.string(),
125
+ level: exports.zNotificationLogLevelSchema,
126
+ message: zod_1.z.string(),
127
+ data: zod_1.z.record(zod_1.z.unknown()).optional(),
128
+ at: zod_1.z.coerce.date(),
129
+ })
130
+ .passthrough();
@@ -0,0 +1,143 @@
1
+ import { z } from "zod";
2
+ import { zFireDocSchema } from "../shared/zod-schemas";
3
+ import { zExternalLinkSchema } from "../evo-task/zod-schemas";
4
+
5
+ // ---- Primitives ----
6
+
7
+ export const zNotificationChannelTypeSchema = z.enum([
8
+ "whatsapp",
9
+ "email",
10
+ "sms",
11
+ "push",
12
+ ]);
13
+
14
+ export const zNotificationMessageStatusSchema = z.enum([
15
+ "queued",
16
+ "processing",
17
+ "sent",
18
+ "delivered",
19
+ "failed",
20
+ "cancelled",
21
+ "suppressed",
22
+ ]);
23
+
24
+ export const zNotificationAttemptStatusSchema = z.enum([
25
+ "success",
26
+ "retry",
27
+ "error",
28
+ ]);
29
+
30
+ export const zNotificationRecipientKindSchema = z.enum([
31
+ "patient",
32
+ "professional",
33
+ "preconfigured",
34
+ "raw",
35
+ ]);
36
+
37
+ export const zNotificationLogLevelSchema = z.enum([
38
+ "debug",
39
+ "info",
40
+ "warn",
41
+ "error",
42
+ ]);
43
+
44
+ // ---- Sub-schemas ----
45
+
46
+ export const zNotificationRecipientSchema = z
47
+ .object({
48
+ kind: zNotificationRecipientKindSchema,
49
+ id: z.string().optional(),
50
+ ref: z.any().optional(),
51
+ address: z.string().optional(),
52
+ display_name: z.string().optional(),
53
+ })
54
+ .passthrough();
55
+
56
+ export const zNotificationChannelRefSchema = z
57
+ .object({
58
+ type: zNotificationChannelTypeSchema,
59
+ channel_id: z.string(),
60
+ sender_id: z.string().optional(),
61
+ })
62
+ .passthrough();
63
+
64
+ export const zNotificationTemplateRefSchema = z
65
+ .object({
66
+ template_id: z.string(),
67
+ locale: z.string().optional(),
68
+ version: z.union([z.number(), z.string()]).optional(),
69
+ })
70
+ .passthrough();
71
+
72
+ export const zNotificationProviderMetaSchema = z
73
+ .object({
74
+ name: z.string().optional(),
75
+ message_id: z.string().optional(),
76
+ status: z.string().optional(),
77
+ raw: z.record(z.unknown()).optional(),
78
+ })
79
+ .passthrough();
80
+
81
+ export const zNotificationErrorSchema = z
82
+ .object({
83
+ message: z.string(),
84
+ code: z.union([z.string(), z.number()]).optional(),
85
+ details: z.record(z.unknown()).optional(),
86
+ })
87
+ .passthrough();
88
+
89
+ // ---- Main document schemas ----
90
+
91
+ export const zNotificationMessageSchema = zFireDocSchema
92
+ .extend({
93
+ tenant: z.string(),
94
+ task_id: z.string().optional(),
95
+ routine_id: z.string().optional(),
96
+ routine_version: z.union([z.number(), z.string()]).optional(),
97
+ classification: z.string().optional(),
98
+ importance: z.number().min(0).max(100).optional(),
99
+ channel: zNotificationChannelRefSchema,
100
+ template: zNotificationTemplateRefSchema.optional(),
101
+ recipient: zNotificationRecipientSchema,
102
+ variables: z.record(z.unknown()).optional(),
103
+ status: zNotificationMessageStatusSchema,
104
+ queued_at: z.coerce.date(),
105
+ processing_started_at: z.coerce.date().optional(),
106
+ sent_at: z.coerce.date().optional(),
107
+ delivered_at: z.coerce.date().optional(),
108
+ completed_at: z.coerce.date().optional(),
109
+ provider: zNotificationProviderMetaSchema.optional(),
110
+ error: zNotificationErrorSchema.optional(),
111
+ dedup_key: z.string().optional(),
112
+ dedup_group_key: z.string().optional(),
113
+ date_bucket: z.string().optional(),
114
+ externalLinks: z.array(zExternalLinkSchema).optional(),
115
+ externalLinkKeys: z.array(z.string()).optional(),
116
+ })
117
+ .passthrough();
118
+
119
+ export const zNotificationAttemptSchema = zFireDocSchema
120
+ .extend({
121
+ message_id: z.string(),
122
+ task_id: z.string().optional(),
123
+ attempt: z.number(),
124
+ status: zNotificationAttemptStatusSchema,
125
+ requested_at: z.coerce.date(),
126
+ started_at: z.coerce.date().optional(),
127
+ finished_at: z.coerce.date().optional(),
128
+ provider: zNotificationProviderMetaSchema.optional(),
129
+ error: zNotificationErrorSchema.optional(),
130
+ request_summary: z.record(z.unknown()).optional(),
131
+ response_summary: z.record(z.unknown()).optional(),
132
+ })
133
+ .passthrough();
134
+
135
+ export const zNotificationLogSchema = zFireDocSchema
136
+ .extend({
137
+ message_id: z.string(),
138
+ level: zNotificationLogLevelSchema,
139
+ message: z.string(),
140
+ data: z.record(z.unknown()).optional(),
141
+ at: z.coerce.date(),
142
+ })
143
+ .passthrough();
package/dist/index.js CHANGED
@@ -36,6 +36,8 @@ __exportStar(require("./types/evo-task"), exports);
36
36
  __exportStar(require("./types/evo-survey"), exports);
37
37
  __exportStar(require("./types/evo-finops"), exports);
38
38
  __exportStar(require("./types/evo-notif-user"), exports);
39
+ __exportStar(require("./types/evo-notifications"), exports);
40
+ __exportStar(require("./types/evo-task-runner"), exports);
39
41
  // zod schemas
40
42
  __exportStar(require("./apps/shared/zod-schemas"), exports);
41
43
  __exportStar(require("./apps/evo-core/zod-schemas"), exports);
@@ -59,3 +61,4 @@ __exportStar(require("./apps/evo-task/zod-schemas"), exports);
59
61
  __exportStar(require("./apps/evo-survey/zod-schemas"), exports);
60
62
  __exportStar(require("./apps/evo-finops/zod-schemas"), exports);
61
63
  __exportStar(require("./apps/evo-notif-user/zod-schemas"), exports);
64
+ __exportStar(require("./apps/evo-notifications/zod-schemas"), exports);
package/dist/index.ts CHANGED
@@ -20,6 +20,8 @@ export * from "./types/evo-task";
20
20
  export * from "./types/evo-survey";
21
21
  export * from "./types/evo-finops";
22
22
  export * from "./types/evo-notif-user";
23
+ export * from "./types/evo-notifications";
24
+ export * from "./types/evo-task-runner";
23
25
 
24
26
  // zod schemas
25
27
  export * from "./apps/shared/zod-schemas";
@@ -44,3 +46,4 @@ export * from "./apps/evo-task/zod-schemas";
44
46
  export * from "./apps/evo-survey/zod-schemas";
45
47
  export * from "./apps/evo-finops/zod-schemas";
46
48
  export * from "./apps/evo-notif-user/zod-schemas";
49
+ export * from "./apps/evo-notifications/zod-schemas";
@@ -1,4 +1,4 @@
1
- import type { FirestoreDocumentReference, IFireDoc } from "../shared";
1
+ import type { FirestoreDocumentReference, IFireDoc, IExternalLink } from "../shared";
2
2
  export declare const EvoNotificationsPermissions: {
3
3
  readonly List: "evo_notifications_read";
4
4
  readonly Get: "evo_notifications_read";
@@ -126,6 +126,8 @@ export interface INotificationMessage extends IFireDoc {
126
126
  dedup_key?: string;
127
127
  dedup_group_key?: string;
128
128
  date_bucket?: string;
129
+ externalLinks?: IExternalLink[];
130
+ externalLinkKeys?: string[];
129
131
  [key: string]: unknown;
130
132
  }
131
133
  export interface INotificationAttempt extends IFireDoc {
@@ -1,4 +1,4 @@
1
- import type { FirestoreDocumentReference, IFireDoc } from "../shared";
1
+ import type { FirestoreDocumentReference, IFireDoc, IExternalLink } from "../shared";
2
2
 
3
3
  // Permissões para as notificações
4
4
  export const EvoNotificationsPermissions = {
@@ -238,6 +238,10 @@ export interface INotificationMessage extends IFireDoc {
238
238
  // Indexing helpers (optional)
239
239
  date_bucket?: string; // e.g., YYYY-MM-DD (tenant timezone)
240
240
 
241
+ // External links (cross-module references, e.g., patient, appointment)
242
+ externalLinks?: IExternalLink[];
243
+ externalLinkKeys?: string[]; // derived: ["type:id", ...] for Firestore array-contains queries
244
+
241
245
  [key: string]: unknown;
242
246
  }
243
247
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.260",
3
+ "version": "1.3.262",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",