evo360-types 1.3.326 → 1.3.328
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-integrations/zod-schemas.d.ts +755 -0
- package/dist/apps/evo-integrations/zod-schemas.js +117 -0
- package/dist/apps/evo-integrations/zod-schemas.ts +130 -0
- package/dist/apps/evo-med/calendar/zod-schemas.d.ts +792 -0
- package/dist/apps/evo-med/calendar/zod-schemas.js +2 -0
- package/dist/apps/evo-med/calendar/zod-schemas.ts +2 -0
- package/dist/apps/evo-tenant/zod-schemas.d.ts +3 -3
- package/dist/apps/evo-tenant/zod-schemas.js +1 -1
- package/dist/apps/evo-tenant/zod-schemas.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.ts +2 -0
- package/dist/types/evo-integrations/fb_collections.d.ts +5 -0
- package/dist/types/evo-integrations/fb_collections.js +14 -0
- package/dist/types/evo-integrations/fb_collections.ts +13 -0
- package/dist/types/evo-integrations/index.d.ts +133 -0
- package/dist/types/evo-integrations/index.js +71 -0
- package/dist/types/evo-integrations/index.ts +232 -0
- package/dist/types/evo-med/calendar/index.d.ts +2 -0
- package/dist/types/evo-med/calendar/index.ts +3 -0
- package/dist/types/evo-tenant/index.d.ts +1 -1
- package/dist/types/evo-tenant/index.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.zMedCalendarIntegrationSchema = exports.zSyncConfigSchema = exports.zSyncWindowConfigSchema = exports.zSyncRunEventSchema = exports.zSyncRunEventErrorSchema = exports.zSyncStateSchema = exports.zSyncedHashesSchema = exports.zCoveredWindowSchema = exports.zSyncWindowTypeSchema = exports.zIntegrationsCredentialSchema = exports.zIntegrationsAdapterDocSchema = exports.zCapabilityNameSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const zod_schemas_1 = require("../shared/zod-schemas");
|
|
6
|
+
// ----- Capability name (mantém sincronizado com CapabilityName em types/evo-integrations/index.ts)
|
|
7
|
+
exports.zCapabilityNameSchema = zod_1.z.enum([
|
|
8
|
+
"appointment.get",
|
|
9
|
+
"appointment.list",
|
|
10
|
+
"appointment.create",
|
|
11
|
+
"appointment.update",
|
|
12
|
+
"appointment.cancel",
|
|
13
|
+
"appointment.confirm",
|
|
14
|
+
"appointment.reschedule",
|
|
15
|
+
"patient.get",
|
|
16
|
+
"patient.list",
|
|
17
|
+
"patient.create",
|
|
18
|
+
"patient.update",
|
|
19
|
+
"patient.document.upload",
|
|
20
|
+
"payment.update",
|
|
21
|
+
"sync.appointments",
|
|
22
|
+
]);
|
|
23
|
+
// ----- Adapter doc (platform-level, Nexus-managed)
|
|
24
|
+
exports.zIntegrationsAdapterDocSchema = zod_schemas_1.zFireDocSchema.extend({
|
|
25
|
+
name: zod_1.z.string().min(1).max(100),
|
|
26
|
+
description: zod_1.z.string().max(500).optional(),
|
|
27
|
+
category: zod_1.z.enum(["clinic-agenda", "prontuario", "misc"]),
|
|
28
|
+
status: zod_1.z.enum(["active", "disabled", "beta"]),
|
|
29
|
+
adapter_version: zod_1.z.string().min(1).max(20),
|
|
30
|
+
default_workflow_urls: zod_1.z
|
|
31
|
+
.record(exports.zCapabilityNameSchema, zod_1.z.string().url())
|
|
32
|
+
.default({}),
|
|
33
|
+
supported_capabilities: zod_1.z.array(exports.zCapabilityNameSchema),
|
|
34
|
+
auth_schema_version: zod_1.z.number().int().optional(),
|
|
35
|
+
});
|
|
36
|
+
// ----- Credential (tenant-level metadata; raw secret no Google SM)
|
|
37
|
+
exports.zIntegrationsCredentialSchema = zod_schemas_1.zFireDocSchema.extend({
|
|
38
|
+
adapter_id: zod_1.z.string().min(1).max(100),
|
|
39
|
+
name: zod_1.z.string().min(1).max(100),
|
|
40
|
+
secret_ref: zod_1.z.string().min(1).max(500),
|
|
41
|
+
config: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
42
|
+
status: zod_1.z.enum(["active", "paused", "revoked"]).default("active"),
|
|
43
|
+
last_used_at: zod_1.z.coerce.date().nullable().optional(),
|
|
44
|
+
});
|
|
45
|
+
// ----- Sync state (1 doc per calendar)
|
|
46
|
+
exports.zSyncWindowTypeSchema = zod_1.z.enum([
|
|
47
|
+
"hot",
|
|
48
|
+
"warm",
|
|
49
|
+
"recent_reconcile",
|
|
50
|
+
"cold",
|
|
51
|
+
]);
|
|
52
|
+
exports.zCoveredWindowSchema = zod_1.z.object({
|
|
53
|
+
start: zod_1.z.coerce.date(),
|
|
54
|
+
end: zod_1.z.coerce.date(),
|
|
55
|
+
});
|
|
56
|
+
exports.zSyncedHashesSchema = zod_1.z.object({
|
|
57
|
+
patients: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).default({}),
|
|
58
|
+
appointments: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).default({}),
|
|
59
|
+
});
|
|
60
|
+
exports.zSyncStateSchema = zod_schemas_1.zFireDocSchema.extend({
|
|
61
|
+
calendar_id: zod_1.z.string().min(1).max(100),
|
|
62
|
+
last_sync_at: zod_1.z.coerce.date().nullable().optional(),
|
|
63
|
+
last_window_type: exports.zSyncWindowTypeSchema.optional(),
|
|
64
|
+
last_synced_hashes: exports.zSyncedHashesSchema,
|
|
65
|
+
last_coveredWindow: exports.zCoveredWindowSchema.nullable().optional(),
|
|
66
|
+
});
|
|
67
|
+
// ----- Sync run event (PubSub → BigQuery)
|
|
68
|
+
exports.zSyncRunEventErrorSchema = zod_1.z.object({
|
|
69
|
+
code: zod_1.z.string().optional(),
|
|
70
|
+
message: zod_1.z.string(),
|
|
71
|
+
details: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
72
|
+
});
|
|
73
|
+
exports.zSyncRunEventSchema = zod_1.z.object({
|
|
74
|
+
run_id: zod_1.z.string().min(1),
|
|
75
|
+
tenant: zod_1.z.string().min(1),
|
|
76
|
+
calendar_id: zod_1.z.string().min(1),
|
|
77
|
+
adapter_id: zod_1.z.string().min(1),
|
|
78
|
+
window_type: exports.zSyncWindowTypeSchema,
|
|
79
|
+
started_at: zod_1.z.coerce.date(),
|
|
80
|
+
finished_at: zod_1.z.coerce.date(),
|
|
81
|
+
status: zod_1.z.enum(["success", "partial", "error"]),
|
|
82
|
+
patients_upserted: zod_1.z.number().int().default(0),
|
|
83
|
+
appointments_upserted: zod_1.z.number().int().default(0),
|
|
84
|
+
appointments_skipped: zod_1.z.number().int().default(0),
|
|
85
|
+
deletions_detected: zod_1.z.number().int().default(0),
|
|
86
|
+
coveredWindow_start: zod_1.z.coerce.date().optional(),
|
|
87
|
+
coveredWindow_end: zod_1.z.coerce.date().optional(),
|
|
88
|
+
duration_ms: zod_1.z.number().int().default(0),
|
|
89
|
+
firestore_reads: zod_1.z.number().int().default(0),
|
|
90
|
+
firestore_writes: zod_1.z.number().int().default(0),
|
|
91
|
+
n8n_calls: zod_1.z.number().int().default(0),
|
|
92
|
+
errors: zod_1.z.array(exports.zSyncRunEventErrorSchema).optional(),
|
|
93
|
+
});
|
|
94
|
+
// ----- Calendar integration config (inline no calendar doc)
|
|
95
|
+
exports.zSyncWindowConfigSchema = zod_1.z.object({
|
|
96
|
+
enabled: zod_1.z.boolean().default(false),
|
|
97
|
+
cadence_minutes: zod_1.z.number().int().min(1),
|
|
98
|
+
window_days: zod_1.z.object({
|
|
99
|
+
past: zod_1.z.number().int().min(0),
|
|
100
|
+
future: zod_1.z.number().int().min(0),
|
|
101
|
+
}),
|
|
102
|
+
});
|
|
103
|
+
exports.zSyncConfigSchema = zod_1.z.object({
|
|
104
|
+
hot: exports.zSyncWindowConfigSchema.optional(),
|
|
105
|
+
warm: exports.zSyncWindowConfigSchema.optional(),
|
|
106
|
+
recent_reconcile: exports.zSyncWindowConfigSchema.optional(),
|
|
107
|
+
cold: exports.zSyncWindowConfigSchema.optional(),
|
|
108
|
+
});
|
|
109
|
+
exports.zMedCalendarIntegrationSchema = zod_1.z.object({
|
|
110
|
+
adapter_id: zod_1.z.string().min(1),
|
|
111
|
+
credentials_id: zod_1.z.string().min(1),
|
|
112
|
+
patient_prefix: zod_1.z.string().max(30).optional(),
|
|
113
|
+
sync_config: exports.zSyncConfigSchema,
|
|
114
|
+
workflow_overrides: zod_1.z
|
|
115
|
+
.record(exports.zCapabilityNameSchema, zod_1.z.string().url())
|
|
116
|
+
.optional(),
|
|
117
|
+
});
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { zFireDocSchema } from "../shared/zod-schemas";
|
|
3
|
+
|
|
4
|
+
// ----- Capability name (mantém sincronizado com CapabilityName em types/evo-integrations/index.ts)
|
|
5
|
+
export const zCapabilityNameSchema = z.enum([
|
|
6
|
+
"appointment.get",
|
|
7
|
+
"appointment.list",
|
|
8
|
+
"appointment.create",
|
|
9
|
+
"appointment.update",
|
|
10
|
+
"appointment.cancel",
|
|
11
|
+
"appointment.confirm",
|
|
12
|
+
"appointment.reschedule",
|
|
13
|
+
"patient.get",
|
|
14
|
+
"patient.list",
|
|
15
|
+
"patient.create",
|
|
16
|
+
"patient.update",
|
|
17
|
+
"patient.document.upload",
|
|
18
|
+
"payment.update",
|
|
19
|
+
"sync.appointments",
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
// ----- Adapter doc (platform-level, Nexus-managed)
|
|
23
|
+
export const zIntegrationsAdapterDocSchema = zFireDocSchema.extend({
|
|
24
|
+
name: z.string().min(1).max(100),
|
|
25
|
+
description: z.string().max(500).optional(),
|
|
26
|
+
category: z.enum(["clinic-agenda", "prontuario", "misc"]),
|
|
27
|
+
status: z.enum(["active", "disabled", "beta"]),
|
|
28
|
+
adapter_version: z.string().min(1).max(20),
|
|
29
|
+
default_workflow_urls: z
|
|
30
|
+
.record(zCapabilityNameSchema, z.string().url())
|
|
31
|
+
.default({}),
|
|
32
|
+
supported_capabilities: z.array(zCapabilityNameSchema),
|
|
33
|
+
auth_schema_version: z.number().int().optional(),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export type IIntegrationsAdapterDocZ = z.infer<
|
|
37
|
+
typeof zIntegrationsAdapterDocSchema
|
|
38
|
+
>;
|
|
39
|
+
|
|
40
|
+
// ----- Credential (tenant-level metadata; raw secret no Google SM)
|
|
41
|
+
export const zIntegrationsCredentialSchema = zFireDocSchema.extend({
|
|
42
|
+
adapter_id: z.string().min(1).max(100),
|
|
43
|
+
name: z.string().min(1).max(100),
|
|
44
|
+
secret_ref: z.string().min(1).max(500),
|
|
45
|
+
config: z.record(z.string(), z.any()).optional(),
|
|
46
|
+
status: z.enum(["active", "paused", "revoked"]).default("active"),
|
|
47
|
+
last_used_at: z.coerce.date().nullable().optional(),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// ----- Sync state (1 doc per calendar)
|
|
51
|
+
export const zSyncWindowTypeSchema = z.enum([
|
|
52
|
+
"hot",
|
|
53
|
+
"warm",
|
|
54
|
+
"recent_reconcile",
|
|
55
|
+
"cold",
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
export const zCoveredWindowSchema = z.object({
|
|
59
|
+
start: z.coerce.date(),
|
|
60
|
+
end: z.coerce.date(),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export const zSyncedHashesSchema = z.object({
|
|
64
|
+
patients: z.record(z.string(), z.string()).default({}),
|
|
65
|
+
appointments: z.record(z.string(), z.string()).default({}),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const zSyncStateSchema = zFireDocSchema.extend({
|
|
69
|
+
calendar_id: z.string().min(1).max(100),
|
|
70
|
+
last_sync_at: z.coerce.date().nullable().optional(),
|
|
71
|
+
last_window_type: zSyncWindowTypeSchema.optional(),
|
|
72
|
+
last_synced_hashes: zSyncedHashesSchema,
|
|
73
|
+
last_coveredWindow: zCoveredWindowSchema.nullable().optional(),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// ----- Sync run event (PubSub → BigQuery)
|
|
77
|
+
export const zSyncRunEventErrorSchema = z.object({
|
|
78
|
+
code: z.string().optional(),
|
|
79
|
+
message: z.string(),
|
|
80
|
+
details: z.record(z.string(), z.any()).optional(),
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const zSyncRunEventSchema = z.object({
|
|
84
|
+
run_id: z.string().min(1),
|
|
85
|
+
tenant: z.string().min(1),
|
|
86
|
+
calendar_id: z.string().min(1),
|
|
87
|
+
adapter_id: z.string().min(1),
|
|
88
|
+
window_type: zSyncWindowTypeSchema,
|
|
89
|
+
started_at: z.coerce.date(),
|
|
90
|
+
finished_at: z.coerce.date(),
|
|
91
|
+
status: z.enum(["success", "partial", "error"]),
|
|
92
|
+
patients_upserted: z.number().int().default(0),
|
|
93
|
+
appointments_upserted: z.number().int().default(0),
|
|
94
|
+
appointments_skipped: z.number().int().default(0),
|
|
95
|
+
deletions_detected: z.number().int().default(0),
|
|
96
|
+
coveredWindow_start: z.coerce.date().optional(),
|
|
97
|
+
coveredWindow_end: z.coerce.date().optional(),
|
|
98
|
+
duration_ms: z.number().int().default(0),
|
|
99
|
+
firestore_reads: z.number().int().default(0),
|
|
100
|
+
firestore_writes: z.number().int().default(0),
|
|
101
|
+
n8n_calls: z.number().int().default(0),
|
|
102
|
+
errors: z.array(zSyncRunEventErrorSchema).optional(),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// ----- Calendar integration config (inline no calendar doc)
|
|
106
|
+
export const zSyncWindowConfigSchema = z.object({
|
|
107
|
+
enabled: z.boolean().default(false),
|
|
108
|
+
cadence_minutes: z.number().int().min(1),
|
|
109
|
+
window_days: z.object({
|
|
110
|
+
past: z.number().int().min(0),
|
|
111
|
+
future: z.number().int().min(0),
|
|
112
|
+
}),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export const zSyncConfigSchema = z.object({
|
|
116
|
+
hot: zSyncWindowConfigSchema.optional(),
|
|
117
|
+
warm: zSyncWindowConfigSchema.optional(),
|
|
118
|
+
recent_reconcile: zSyncWindowConfigSchema.optional(),
|
|
119
|
+
cold: zSyncWindowConfigSchema.optional(),
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
export const zMedCalendarIntegrationSchema = z.object({
|
|
123
|
+
adapter_id: z.string().min(1),
|
|
124
|
+
credentials_id: z.string().min(1),
|
|
125
|
+
patient_prefix: z.string().max(30).optional(),
|
|
126
|
+
sync_config: zSyncConfigSchema,
|
|
127
|
+
workflow_overrides: z
|
|
128
|
+
.record(zCapabilityNameSchema, z.string().url())
|
|
129
|
+
.optional(),
|
|
130
|
+
});
|