@pactosigna/schemas 0.1.1 → 0.1.2
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/document-type-patterns-JuAGFi_j.d.ts +64 -0
- package/dist/document-type-patterns.d.ts +1 -59
- package/dist/index.d.ts +1803 -3
- package/dist/index.js +1348 -177
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6,148 +6,1320 @@ import {
|
|
|
6
6
|
inferDocumentType
|
|
7
7
|
} from "./chunk-A3X6VKYK.js";
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
9
|
+
// ../shared/dist/schemas/index.js
|
|
10
|
+
import { z as z24 } from "zod";
|
|
11
|
+
|
|
12
|
+
// ../shared/dist/schemas/common-enums.js
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
var RegulatoryFrameworkSchema = z.enum([
|
|
15
|
+
"ISO_13485",
|
|
16
|
+
"IEC_62304",
|
|
17
|
+
"FDA_21_CFR_820",
|
|
18
|
+
"QMSR",
|
|
19
|
+
"EU_MDR",
|
|
20
|
+
"ISO_14971",
|
|
21
|
+
"AI_ACT"
|
|
22
|
+
]);
|
|
23
|
+
var SafetyClassSchema = z.enum(["A", "B", "C"]);
|
|
24
|
+
var DocumentTypeSchema = z.enum([
|
|
25
|
+
"user_need",
|
|
26
|
+
"requirement",
|
|
27
|
+
"architecture",
|
|
28
|
+
"detailed_design",
|
|
29
|
+
"test_protocol",
|
|
30
|
+
"test_report",
|
|
31
|
+
"sop",
|
|
32
|
+
"work_instruction",
|
|
33
|
+
"policy",
|
|
34
|
+
"usability_risk",
|
|
35
|
+
"software_risk",
|
|
36
|
+
"security_risk",
|
|
37
|
+
// Risk document types
|
|
38
|
+
"haz_soe_software",
|
|
39
|
+
"haz_soe_security",
|
|
40
|
+
"hazardous_situation",
|
|
41
|
+
"harm",
|
|
42
|
+
"hazard_category",
|
|
43
|
+
// Usability engineering (IEC 62366)
|
|
44
|
+
"usability_plan",
|
|
45
|
+
"use_specification",
|
|
46
|
+
"task_analysis",
|
|
47
|
+
"usability_evaluation",
|
|
48
|
+
"summative_evaluation",
|
|
49
|
+
// Risk management (ISO 14971)
|
|
50
|
+
"risk_management_plan",
|
|
51
|
+
// Software lifecycle (IEC 62304)
|
|
52
|
+
"software_development_plan",
|
|
53
|
+
"software_maintenance_plan",
|
|
54
|
+
"soup_register",
|
|
55
|
+
// Problem resolution (IEC 62304 §9)
|
|
56
|
+
"anomaly",
|
|
57
|
+
// Cybersecurity (IEC 81001-5-1)
|
|
58
|
+
"cybersecurity_plan",
|
|
59
|
+
"sbom",
|
|
60
|
+
// Clinical (MDR / FDA)
|
|
61
|
+
"clinical_evaluation_plan",
|
|
62
|
+
"clinical_evaluation_report",
|
|
63
|
+
// Post-market surveillance (MDR Art. 83)
|
|
64
|
+
"post_market_surveillance_plan",
|
|
65
|
+
"post_market_feedback",
|
|
66
|
+
// Labeling (MDR Annex I)
|
|
67
|
+
"labeling",
|
|
68
|
+
// Product (ISO 13485 §7.3)
|
|
69
|
+
"product_development_plan",
|
|
70
|
+
"intended_use",
|
|
71
|
+
// Release management (IEC 62304 §5.7)
|
|
72
|
+
"release_plan",
|
|
73
|
+
// Change management (ISO 13485 §7.3.5)
|
|
74
|
+
"design_review",
|
|
75
|
+
"release_notes",
|
|
76
|
+
// Supplier management (ISO 13485 §7.4)
|
|
77
|
+
"supplier",
|
|
78
|
+
// Internal audit management (ISO 13485 §8.2.2)
|
|
79
|
+
"audit_schedule",
|
|
80
|
+
"audit_report",
|
|
81
|
+
// Management review (ISO 13485 §5.6)
|
|
82
|
+
"management_review",
|
|
83
|
+
// Software test plan (IEC 62304 §5.7)
|
|
84
|
+
"software_test_plan"
|
|
85
|
+
]);
|
|
86
|
+
var DocumentStatusSchema = z.enum([
|
|
87
|
+
"draft",
|
|
88
|
+
"in_review",
|
|
89
|
+
"approved",
|
|
90
|
+
"obsolete",
|
|
91
|
+
"example"
|
|
92
|
+
]);
|
|
93
|
+
var LinkTypeSchema = z.enum([
|
|
94
|
+
"derives_from",
|
|
95
|
+
"implements",
|
|
96
|
+
"verified_by",
|
|
97
|
+
"mitigates",
|
|
98
|
+
"parent_of",
|
|
99
|
+
"related_to",
|
|
100
|
+
// New risk link types
|
|
101
|
+
"leads_to",
|
|
102
|
+
"results_in",
|
|
103
|
+
"analyzes"
|
|
104
|
+
]);
|
|
105
|
+
var AcceptabilityStatusSchema = z.enum(["acceptable", "review_required", "unacceptable"]);
|
|
106
|
+
var DepartmentRoleSchema = z.enum(["manager", "member"]);
|
|
107
|
+
|
|
108
|
+
// ../shared/dist/schemas/risk.js
|
|
109
|
+
import { z as z2 } from "zod";
|
|
110
|
+
var RiskDocumentStatusSchema = z2.enum([
|
|
111
|
+
"draft",
|
|
112
|
+
"in_review",
|
|
113
|
+
"approved",
|
|
114
|
+
"effective",
|
|
115
|
+
"archived",
|
|
116
|
+
"example"
|
|
117
|
+
]);
|
|
118
|
+
var MitigationTargetSchema = z2.enum([
|
|
119
|
+
"sequence_probability",
|
|
120
|
+
"harm_probability",
|
|
121
|
+
"severity"
|
|
122
|
+
]);
|
|
123
|
+
var RiskGapCodeSchema = z2.enum([
|
|
124
|
+
"hazard_no_situation",
|
|
125
|
+
"situation_no_harm",
|
|
126
|
+
"hazard_not_analyzed",
|
|
127
|
+
"missing_mitigation",
|
|
128
|
+
"broken_mitigation_link",
|
|
129
|
+
"control_not_approved",
|
|
130
|
+
"missing_risk_benefit",
|
|
131
|
+
"risk_missing_safety_chain",
|
|
132
|
+
"risk_broken_safety_chain",
|
|
133
|
+
"wrong_probability_dimension",
|
|
134
|
+
"missing_frontmatter",
|
|
135
|
+
"requirement_no_architecture",
|
|
136
|
+
"architecture_no_segregation",
|
|
137
|
+
"architecture_no_parent",
|
|
138
|
+
"haz_missing_category",
|
|
139
|
+
"haz_invalid_category",
|
|
140
|
+
"category_not_approved"
|
|
141
|
+
]);
|
|
142
|
+
var RiskGapSeveritySchema = z2.enum(["error", "warning"]);
|
|
143
|
+
var MitigationSchema = z2.object({
|
|
144
|
+
control: z2.string().min(1),
|
|
145
|
+
reduces: MitigationTargetSchema,
|
|
146
|
+
for_harm: z2.string().optional()
|
|
147
|
+
});
|
|
148
|
+
var HarmAssessmentSchema = z2.object({
|
|
149
|
+
harm: z2.string().min(1),
|
|
150
|
+
inherent_probability: z2.number().int().min(1).max(5).optional(),
|
|
151
|
+
inherent_exploitability: z2.number().int().min(1).max(5).optional(),
|
|
152
|
+
residual_probability: z2.number().int().min(1).max(5).optional(),
|
|
153
|
+
residual_exploitability: z2.number().int().min(1).max(5).optional(),
|
|
154
|
+
residual_severity_override: z2.number().int().min(1).max(5).optional()
|
|
155
|
+
});
|
|
156
|
+
var RiskEntryFrontmatterSchema = z2.object({
|
|
157
|
+
type: z2.enum(["software_risk", "usability_risk", "security_risk"]),
|
|
158
|
+
id: z2.string().min(1),
|
|
159
|
+
title: z2.string().min(1),
|
|
160
|
+
status: RiskDocumentStatusSchema,
|
|
161
|
+
analyzes: z2.string().min(1),
|
|
162
|
+
hazardous_situation: z2.string().min(1),
|
|
163
|
+
harm_assessments: z2.array(HarmAssessmentSchema).min(1),
|
|
164
|
+
mitigations: z2.array(MitigationSchema).optional(),
|
|
165
|
+
cvss_score: z2.number().min(0).max(10).optional(),
|
|
166
|
+
cvss_vector: z2.string().regex(/^CVSS:3\.[01]\/AV:[NALP]\/AC:[LH]\/PR:[NLH]\/UI:[NR]\/S:[UC]\/C:[NLH]\/I:[NLH]\/A:[NLH]$/).optional()
|
|
167
|
+
}).refine((data) => {
|
|
168
|
+
if (data.type === "security_risk") {
|
|
169
|
+
return data.harm_assessments.every((ha) => ha.inherent_exploitability != null);
|
|
170
|
+
}
|
|
171
|
+
return data.harm_assessments.every((ha) => ha.inherent_probability != null);
|
|
172
|
+
}, {
|
|
173
|
+
message: "Security risks must use inherent_exploitability; software/usability risks must use inherent_probability"
|
|
174
|
+
});
|
|
175
|
+
var HazardFrontmatterSchema = z2.object({
|
|
176
|
+
type: z2.enum(["haz_soe_software", "haz_soe_security"]),
|
|
177
|
+
id: z2.string().min(1),
|
|
178
|
+
title: z2.string().min(1),
|
|
179
|
+
status: RiskDocumentStatusSchema,
|
|
180
|
+
leads_to: z2.array(z2.string()).optional(),
|
|
181
|
+
// sFMEA fields
|
|
182
|
+
failure_mode: z2.string().optional(),
|
|
183
|
+
cause: z2.string().optional(),
|
|
184
|
+
detection_method: z2.string().optional(),
|
|
185
|
+
// STRIDE fields
|
|
186
|
+
threat_category: z2.string().optional(),
|
|
187
|
+
attack_vector: z2.string().optional(),
|
|
188
|
+
// Hazard category reference (HC-xxx)
|
|
189
|
+
hazard_category: z2.string().optional()
|
|
190
|
+
});
|
|
191
|
+
var HazardCategoryFrontmatterSchema = z2.object({
|
|
192
|
+
type: z2.literal("hazard_category"),
|
|
193
|
+
id: z2.string().min(1),
|
|
194
|
+
title: z2.string().min(1),
|
|
195
|
+
status: RiskDocumentStatusSchema,
|
|
196
|
+
source: z2.string().optional()
|
|
197
|
+
});
|
|
198
|
+
var HazardousSituationFrontmatterSchema = z2.object({
|
|
199
|
+
type: z2.literal("hazardous_situation"),
|
|
200
|
+
id: z2.string().min(1),
|
|
201
|
+
title: z2.string().min(1),
|
|
202
|
+
status: RiskDocumentStatusSchema,
|
|
203
|
+
results_in: z2.array(z2.string()).optional()
|
|
204
|
+
});
|
|
205
|
+
var HarmFrontmatterSchema = z2.object({
|
|
206
|
+
type: z2.literal("harm"),
|
|
207
|
+
id: z2.string().min(1),
|
|
208
|
+
title: z2.string().min(1),
|
|
209
|
+
status: RiskDocumentStatusSchema,
|
|
210
|
+
severity: z2.number().int().min(1).max(5),
|
|
211
|
+
category: z2.string().optional()
|
|
212
|
+
});
|
|
213
|
+
var RiskMatrixConfigSchema = z2.object({
|
|
214
|
+
version: z2.number(),
|
|
215
|
+
labels: z2.object({
|
|
216
|
+
severity: z2.array(z2.string()).length(5),
|
|
217
|
+
probability: z2.array(z2.string()).length(5),
|
|
218
|
+
exploitability: z2.array(z2.string()).length(5).optional()
|
|
219
|
+
}),
|
|
220
|
+
acceptability: z2.object({
|
|
221
|
+
unacceptable: z2.array(z2.tuple([z2.number(), z2.number()])),
|
|
222
|
+
review_required: z2.array(z2.tuple([z2.number(), z2.number()])).optional()
|
|
223
|
+
}),
|
|
224
|
+
overrides: z2.record(z2.object({
|
|
225
|
+
unacceptable: z2.array(z2.tuple([z2.number(), z2.number()])),
|
|
226
|
+
review_required: z2.array(z2.tuple([z2.number(), z2.number()])).optional()
|
|
227
|
+
})).optional()
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// ../shared/dist/schemas/usability.js
|
|
231
|
+
import { z as z3 } from "zod";
|
|
232
|
+
var UsabilityPlanFrontmatterSchema = z3.object({
|
|
233
|
+
type: z3.literal("usability_plan"),
|
|
234
|
+
id: z3.string().min(1),
|
|
235
|
+
title: z3.string().min(1),
|
|
236
|
+
status: RiskDocumentStatusSchema,
|
|
237
|
+
author: z3.string().optional(),
|
|
238
|
+
reviewers: z3.array(z3.string()).optional(),
|
|
239
|
+
approvers: z3.array(z3.string()).optional()
|
|
240
|
+
});
|
|
241
|
+
var UseSpecificationFrontmatterSchema = z3.object({
|
|
242
|
+
type: z3.literal("use_specification"),
|
|
243
|
+
id: z3.string().min(1),
|
|
244
|
+
title: z3.string().min(1),
|
|
245
|
+
status: RiskDocumentStatusSchema,
|
|
246
|
+
user_group: z3.string().min(1),
|
|
247
|
+
author: z3.string().optional(),
|
|
248
|
+
reviewers: z3.array(z3.string()).optional(),
|
|
249
|
+
approvers: z3.array(z3.string()).optional()
|
|
250
|
+
});
|
|
251
|
+
var TaskAnalysisFrontmatterSchema = z3.object({
|
|
252
|
+
type: z3.literal("task_analysis"),
|
|
253
|
+
id: z3.string().min(1),
|
|
254
|
+
title: z3.string().min(1),
|
|
255
|
+
status: RiskDocumentStatusSchema,
|
|
256
|
+
user_group: z3.string().min(1),
|
|
257
|
+
critical_task: z3.boolean(),
|
|
258
|
+
author: z3.string().optional(),
|
|
259
|
+
reviewers: z3.array(z3.string()).optional(),
|
|
260
|
+
approvers: z3.array(z3.string()).optional()
|
|
261
|
+
});
|
|
262
|
+
var UsabilityEvaluationFrontmatterSchema = z3.object({
|
|
263
|
+
type: z3.literal("usability_evaluation"),
|
|
264
|
+
id: z3.string().min(1),
|
|
265
|
+
title: z3.string().min(1),
|
|
266
|
+
status: RiskDocumentStatusSchema,
|
|
267
|
+
result: z3.enum(["pass", "fail", "pass_with_findings"]).optional(),
|
|
268
|
+
author: z3.string().optional(),
|
|
269
|
+
reviewers: z3.array(z3.string()).optional(),
|
|
270
|
+
approvers: z3.array(z3.string()).optional()
|
|
271
|
+
});
|
|
272
|
+
var SummativeEvaluationFrontmatterSchema = z3.object({
|
|
273
|
+
type: z3.literal("summative_evaluation"),
|
|
274
|
+
id: z3.string().min(1),
|
|
275
|
+
title: z3.string().min(1),
|
|
276
|
+
status: RiskDocumentStatusSchema,
|
|
277
|
+
result: z3.enum(["pass", "fail", "pass_with_findings"]).optional(),
|
|
278
|
+
author: z3.string().optional(),
|
|
279
|
+
reviewers: z3.array(z3.string()).optional(),
|
|
280
|
+
approvers: z3.array(z3.string()).optional()
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
// ../shared/dist/schemas/risk-management-plan.js
|
|
284
|
+
import { z as z4 } from "zod";
|
|
285
|
+
var RiskManagementPlanFrontmatterSchema = z4.object({
|
|
286
|
+
type: z4.literal("risk_management_plan"),
|
|
287
|
+
id: z4.string().min(1),
|
|
288
|
+
title: z4.string().min(1),
|
|
289
|
+
status: RiskDocumentStatusSchema,
|
|
290
|
+
author: z4.string().optional(),
|
|
291
|
+
reviewers: z4.array(z4.string()).optional(),
|
|
292
|
+
approvers: z4.array(z4.string()).optional()
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// ../shared/dist/schemas/software-lifecycle.js
|
|
296
|
+
import { z as z5 } from "zod";
|
|
297
|
+
var SoftwareDevelopmentPlanFrontmatterSchema = z5.object({
|
|
298
|
+
type: z5.literal("software_development_plan"),
|
|
299
|
+
id: z5.string().min(1),
|
|
300
|
+
title: z5.string().min(1),
|
|
301
|
+
status: RiskDocumentStatusSchema,
|
|
302
|
+
author: z5.string().optional(),
|
|
303
|
+
reviewers: z5.array(z5.string()).optional(),
|
|
304
|
+
approvers: z5.array(z5.string()).optional()
|
|
305
|
+
});
|
|
306
|
+
var SoftwareMaintenancePlanFrontmatterSchema = z5.object({
|
|
307
|
+
type: z5.literal("software_maintenance_plan"),
|
|
308
|
+
id: z5.string().min(1),
|
|
309
|
+
title: z5.string().min(1),
|
|
310
|
+
status: RiskDocumentStatusSchema,
|
|
311
|
+
author: z5.string().optional(),
|
|
312
|
+
reviewers: z5.array(z5.string()).optional(),
|
|
313
|
+
approvers: z5.array(z5.string()).optional()
|
|
314
|
+
});
|
|
315
|
+
var SoupRegisterFrontmatterSchema = z5.object({
|
|
316
|
+
type: z5.literal("soup_register"),
|
|
317
|
+
id: z5.string().min(1),
|
|
318
|
+
title: z5.string().min(1),
|
|
319
|
+
status: RiskDocumentStatusSchema,
|
|
320
|
+
author: z5.string().optional(),
|
|
321
|
+
reviewers: z5.array(z5.string()).optional(),
|
|
322
|
+
approvers: z5.array(z5.string()).optional()
|
|
323
|
+
});
|
|
324
|
+
var SoftwareTestPlanFrontmatterSchema = z5.object({
|
|
325
|
+
type: z5.literal("software_test_plan"),
|
|
326
|
+
id: z5.string().min(1),
|
|
327
|
+
title: z5.string().min(1),
|
|
328
|
+
status: RiskDocumentStatusSchema,
|
|
329
|
+
author: z5.string().optional(),
|
|
330
|
+
reviewers: z5.array(z5.string()).optional(),
|
|
331
|
+
approvers: z5.array(z5.string()).optional()
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
// ../shared/dist/schemas/architecture.js
|
|
335
|
+
import { z as z6 } from "zod";
|
|
336
|
+
var SoftwareItemTypeSchema = z6.enum(["system", "subsystem", "component", "unit"]);
|
|
337
|
+
var SegregationSchema = z6.object({
|
|
338
|
+
mechanism: z6.string().min(1),
|
|
339
|
+
rationale: z6.string().min(1)
|
|
340
|
+
});
|
|
341
|
+
var ArchitectureFrontmatterSchema = z6.object({
|
|
342
|
+
id: z6.string().min(1),
|
|
343
|
+
title: z6.string().min(1),
|
|
344
|
+
type: z6.literal("architecture"),
|
|
345
|
+
status: RiskDocumentStatusSchema,
|
|
346
|
+
software_item_type: SoftwareItemTypeSchema.optional(),
|
|
347
|
+
parent_item: z6.string().optional(),
|
|
348
|
+
safety_class: z6.enum(["A", "B", "C"]).optional(),
|
|
349
|
+
segregation: SegregationSchema.optional(),
|
|
350
|
+
author: z6.string().optional(),
|
|
351
|
+
reviewers: z6.array(z6.string()).optional(),
|
|
352
|
+
approvers: z6.array(z6.string()).optional()
|
|
353
|
+
});
|
|
354
|
+
var DetailedDesignFrontmatterSchema = z6.object({
|
|
355
|
+
id: z6.string().min(1),
|
|
356
|
+
title: z6.string().min(1),
|
|
357
|
+
type: z6.literal("detailed_design"),
|
|
358
|
+
status: RiskDocumentStatusSchema,
|
|
359
|
+
software_item_type: SoftwareItemTypeSchema.optional(),
|
|
360
|
+
parent_item: z6.string().optional(),
|
|
361
|
+
safety_class: z6.enum(["A", "B", "C"]).optional(),
|
|
362
|
+
segregation: SegregationSchema.optional(),
|
|
363
|
+
author: z6.string().optional(),
|
|
364
|
+
reviewers: z6.array(z6.string()).optional(),
|
|
365
|
+
approvers: z6.array(z6.string()).optional()
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
// ../shared/dist/schemas/anomaly.js
|
|
369
|
+
import { z as z7 } from "zod";
|
|
370
|
+
var AnomalyCategorySchema = z7.enum([
|
|
371
|
+
"bug",
|
|
372
|
+
"security_vulnerability",
|
|
373
|
+
"regression",
|
|
374
|
+
"performance"
|
|
375
|
+
]);
|
|
376
|
+
var AnomalySeveritySchema = z7.enum(["critical", "major", "minor"]);
|
|
377
|
+
var AnomalyDispositionSchema = z7.enum([
|
|
378
|
+
"open",
|
|
379
|
+
"investigating",
|
|
380
|
+
"resolved",
|
|
381
|
+
"deferred",
|
|
382
|
+
"will_not_fix"
|
|
383
|
+
]);
|
|
384
|
+
var AnomalyFrontmatterSchema = z7.object({
|
|
385
|
+
type: z7.literal("anomaly"),
|
|
386
|
+
id: z7.string().min(1),
|
|
387
|
+
title: z7.string().min(1),
|
|
388
|
+
status: RiskDocumentStatusSchema,
|
|
389
|
+
category: AnomalyCategorySchema,
|
|
390
|
+
severity: AnomalySeveritySchema,
|
|
391
|
+
disposition: AnomalyDispositionSchema,
|
|
392
|
+
affected_version: z7.string().optional(),
|
|
393
|
+
author: z7.string().optional(),
|
|
394
|
+
reviewers: z7.array(z7.string()).optional(),
|
|
395
|
+
approvers: z7.array(z7.string()).optional()
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// ../shared/dist/schemas/cybersecurity.js
|
|
399
|
+
import { z as z8 } from "zod";
|
|
400
|
+
var CybersecurityPlanFrontmatterSchema = z8.object({
|
|
401
|
+
type: z8.literal("cybersecurity_plan"),
|
|
402
|
+
id: z8.string().min(1),
|
|
403
|
+
title: z8.string().min(1),
|
|
404
|
+
status: RiskDocumentStatusSchema,
|
|
405
|
+
author: z8.string().optional(),
|
|
406
|
+
reviewers: z8.array(z8.string()).optional(),
|
|
407
|
+
approvers: z8.array(z8.string()).optional()
|
|
408
|
+
});
|
|
409
|
+
var SbomFrontmatterSchema = z8.object({
|
|
410
|
+
type: z8.literal("sbom"),
|
|
411
|
+
id: z8.string().min(1),
|
|
412
|
+
title: z8.string().min(1),
|
|
413
|
+
status: RiskDocumentStatusSchema,
|
|
414
|
+
author: z8.string().optional(),
|
|
415
|
+
reviewers: z8.array(z8.string()).optional(),
|
|
416
|
+
approvers: z8.array(z8.string()).optional()
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
// ../shared/dist/schemas/clinical.js
|
|
420
|
+
import { z as z9 } from "zod";
|
|
421
|
+
var ClinicalEvaluationPlanFrontmatterSchema = z9.object({
|
|
422
|
+
type: z9.literal("clinical_evaluation_plan"),
|
|
423
|
+
id: z9.string().min(1),
|
|
424
|
+
title: z9.string().min(1),
|
|
425
|
+
status: RiskDocumentStatusSchema,
|
|
426
|
+
author: z9.string().optional(),
|
|
427
|
+
reviewers: z9.array(z9.string()).optional(),
|
|
428
|
+
approvers: z9.array(z9.string()).optional()
|
|
429
|
+
});
|
|
430
|
+
var ClinicalEvaluationReportFrontmatterSchema = z9.object({
|
|
431
|
+
type: z9.literal("clinical_evaluation_report"),
|
|
432
|
+
id: z9.string().min(1),
|
|
433
|
+
title: z9.string().min(1),
|
|
434
|
+
status: RiskDocumentStatusSchema,
|
|
435
|
+
author: z9.string().optional(),
|
|
436
|
+
reviewers: z9.array(z9.string()).optional(),
|
|
437
|
+
approvers: z9.array(z9.string()).optional()
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
// ../shared/dist/schemas/post-market.js
|
|
441
|
+
import { z as z10 } from "zod";
|
|
442
|
+
var PostMarketSurveillancePlanFrontmatterSchema = z10.object({
|
|
443
|
+
type: z10.literal("post_market_surveillance_plan"),
|
|
444
|
+
id: z10.string().min(1),
|
|
445
|
+
title: z10.string().min(1),
|
|
446
|
+
status: RiskDocumentStatusSchema,
|
|
447
|
+
author: z10.string().optional(),
|
|
448
|
+
reviewers: z10.array(z10.string()).optional(),
|
|
449
|
+
approvers: z10.array(z10.string()).optional()
|
|
450
|
+
});
|
|
451
|
+
var PostMarketFeedbackCategorySchema = z10.enum([
|
|
452
|
+
"complaint",
|
|
453
|
+
"field_observation",
|
|
454
|
+
"clinical_followup",
|
|
455
|
+
"trend_report"
|
|
456
|
+
]);
|
|
457
|
+
var PostMarketFeedbackSeveritySchema = z10.enum(["low", "medium", "high", "critical"]);
|
|
458
|
+
var PostMarketFeedbackFrontmatterSchema = z10.object({
|
|
459
|
+
type: z10.literal("post_market_feedback"),
|
|
460
|
+
id: z10.string().min(1),
|
|
461
|
+
title: z10.string().min(1),
|
|
462
|
+
status: RiskDocumentStatusSchema,
|
|
463
|
+
category: PostMarketFeedbackCategorySchema,
|
|
464
|
+
severity: PostMarketFeedbackSeveritySchema,
|
|
465
|
+
device: z10.string().optional(),
|
|
466
|
+
reporting_period: z10.string().optional(),
|
|
467
|
+
author: z10.string().optional(),
|
|
468
|
+
reviewers: z10.array(z10.string()).optional(),
|
|
469
|
+
approvers: z10.array(z10.string()).optional()
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
// ../shared/dist/schemas/labeling.js
|
|
473
|
+
import { z as z11 } from "zod";
|
|
474
|
+
var LabelingFrontmatterSchema = z11.object({
|
|
475
|
+
type: z11.literal("labeling"),
|
|
476
|
+
id: z11.string().min(1),
|
|
477
|
+
title: z11.string().min(1),
|
|
478
|
+
status: RiskDocumentStatusSchema,
|
|
479
|
+
label_type: z11.enum(["ifu", "product_label", "packaging_label"]).optional(),
|
|
480
|
+
author: z11.string().optional(),
|
|
481
|
+
reviewers: z11.array(z11.string()).optional(),
|
|
482
|
+
approvers: z11.array(z11.string()).optional()
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
// ../shared/dist/schemas/product.js
|
|
486
|
+
import { z as z12 } from "zod";
|
|
487
|
+
var ProductDevelopmentPlanFrontmatterSchema = z12.object({
|
|
488
|
+
type: z12.literal("product_development_plan"),
|
|
489
|
+
id: z12.string().min(1),
|
|
490
|
+
title: z12.string().min(1),
|
|
491
|
+
status: RiskDocumentStatusSchema,
|
|
492
|
+
author: z12.string().optional(),
|
|
493
|
+
reviewers: z12.array(z12.string()).optional(),
|
|
494
|
+
approvers: z12.array(z12.string()).optional()
|
|
495
|
+
});
|
|
496
|
+
var IntendedUseFrontmatterSchema = z12.object({
|
|
497
|
+
type: z12.literal("intended_use"),
|
|
498
|
+
id: z12.string().min(1),
|
|
499
|
+
title: z12.string().min(1),
|
|
500
|
+
status: RiskDocumentStatusSchema,
|
|
501
|
+
author: z12.string().optional(),
|
|
502
|
+
reviewers: z12.array(z12.string()).optional(),
|
|
503
|
+
approvers: z12.array(z12.string()).optional()
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
// ../shared/dist/schemas/user-need.js
|
|
507
|
+
import { z as z13 } from "zod";
|
|
508
|
+
var UserNeedPrioritySchema = z13.enum(["must_have", "should_have", "nice_to_have"]);
|
|
509
|
+
var UserNeedFrontmatterSchema = z13.object({
|
|
510
|
+
id: z13.string().min(1),
|
|
511
|
+
title: z13.string().min(1),
|
|
512
|
+
status: RiskDocumentStatusSchema,
|
|
513
|
+
/** Validated if present — ensures frontmatter doesn't misidentify the document type */
|
|
514
|
+
type: z13.literal("user_need").optional(),
|
|
515
|
+
/** The user role or stakeholder (e.g., "Quality Manager", "Developer") */
|
|
516
|
+
stakeholder: z13.string().optional(),
|
|
517
|
+
/** MoSCoW priority classification */
|
|
518
|
+
priority: UserNeedPrioritySchema.optional(),
|
|
519
|
+
/** Where this need originated (e.g., "ISO 13485 §7.3", "user interview") */
|
|
520
|
+
source: z13.string().optional(),
|
|
521
|
+
/** IDs of product requirements derived from this need */
|
|
522
|
+
derives: z13.array(z13.string()).optional(),
|
|
523
|
+
author: z13.string().optional(),
|
|
524
|
+
reviewers: z13.array(z13.string()).optional(),
|
|
525
|
+
approvers: z13.array(z13.string()).optional()
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
// ../shared/dist/schemas/requirement.js
|
|
529
|
+
import { z as z14 } from "zod";
|
|
530
|
+
var RequirementTypeSchema = z14.enum([
|
|
531
|
+
"functional",
|
|
532
|
+
"interface",
|
|
533
|
+
"performance",
|
|
534
|
+
"security",
|
|
535
|
+
"usability",
|
|
536
|
+
"safety",
|
|
537
|
+
"regulatory"
|
|
538
|
+
]);
|
|
539
|
+
var RequirementFormatSchema = z14.enum(["standard", "user_story"]);
|
|
540
|
+
var RequirementFulfillmentTypeSchema = z14.enum([
|
|
541
|
+
"software",
|
|
542
|
+
"labeling",
|
|
543
|
+
"clinical",
|
|
544
|
+
"usability",
|
|
545
|
+
"regulatory_doc",
|
|
546
|
+
"process"
|
|
547
|
+
]);
|
|
548
|
+
var RequirementFrontmatterSchema = z14.object({
|
|
549
|
+
id: z14.string().min(1),
|
|
550
|
+
title: z14.string().min(1),
|
|
551
|
+
status: RiskDocumentStatusSchema,
|
|
552
|
+
/** IEC 62304 §5.2.2 — requirement classification (required for SRS, optional for PRS) */
|
|
553
|
+
req_type: RequirementTypeSchema.optional(),
|
|
554
|
+
/** Authoring convention — controls which required sections are checked */
|
|
555
|
+
format: RequirementFormatSchema.optional(),
|
|
556
|
+
/** ISO 13485 §7.3.3 — how this PRS design input is fulfilled (PRS only, defaults to 'software') */
|
|
557
|
+
fulfillment_type: RequirementFulfillmentTypeSchema.optional(),
|
|
558
|
+
author: z14.string().optional(),
|
|
559
|
+
reviewers: z14.array(z14.string()).optional(),
|
|
560
|
+
approvers: z14.array(z14.string()).optional(),
|
|
561
|
+
/** Upstream traceability — IDs of documents this requirement traces from (e.g., UN for PRS, PRS for SRS) */
|
|
562
|
+
traces_from: z14.array(z14.string()).optional(),
|
|
563
|
+
/** Downstream traceability — IDs of documents this requirement traces to (e.g., SRS for PRS) */
|
|
564
|
+
traces_to: z14.array(z14.string()).optional()
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
// ../shared/dist/schemas/test-documents.js
|
|
568
|
+
import { z as z15 } from "zod";
|
|
569
|
+
var TestProtocolFrontmatterSchema = z15.object({
|
|
570
|
+
type: z15.literal("test_protocol"),
|
|
571
|
+
id: z15.string().min(1),
|
|
572
|
+
title: z15.string().min(1),
|
|
573
|
+
status: RiskDocumentStatusSchema,
|
|
574
|
+
author: z15.string().optional(),
|
|
575
|
+
reviewers: z15.array(z15.string()).optional(),
|
|
576
|
+
approvers: z15.array(z15.string()).optional()
|
|
577
|
+
});
|
|
578
|
+
var TestPhaseSchema = z15.enum(["verification", "production"]);
|
|
579
|
+
var TestReportFrontmatterSchema = z15.object({
|
|
580
|
+
type: z15.literal("test_report"),
|
|
581
|
+
id: z15.string().min(1),
|
|
582
|
+
title: z15.string().min(1),
|
|
583
|
+
status: RiskDocumentStatusSchema,
|
|
584
|
+
author: z15.string().optional(),
|
|
585
|
+
reviewers: z15.array(z15.string()).optional(),
|
|
586
|
+
approvers: z15.array(z15.string()).optional(),
|
|
587
|
+
release_version: z15.string().optional(),
|
|
588
|
+
test_phase: TestPhaseSchema.optional()
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
// ../shared/dist/schemas/repo-config.js
|
|
592
|
+
import { z as z16 } from "zod";
|
|
593
|
+
var ReleaseReviewConfigSchema = z16.object({
|
|
594
|
+
required_departments: z16.array(z16.string().min(1)).min(1),
|
|
595
|
+
final_approver: z16.string().min(1)
|
|
596
|
+
});
|
|
597
|
+
var RepoConfigSchema = z16.object({
|
|
598
|
+
device: z16.object({
|
|
599
|
+
name: z16.string().min(1),
|
|
600
|
+
safety_class: z16.enum(["A", "B", "C"]),
|
|
601
|
+
classification: z16.object({
|
|
602
|
+
eu: z16.string().optional(),
|
|
603
|
+
us: z16.string().optional()
|
|
604
|
+
}).optional(),
|
|
605
|
+
udi_device_identifier: z16.string().optional()
|
|
606
|
+
}),
|
|
607
|
+
release_review: ReleaseReviewConfigSchema.optional()
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
// ../shared/dist/schemas/qms-device.js
|
|
611
|
+
import { z as z17 } from "zod";
|
|
612
|
+
var OwnerTypeSchema = z17.enum(["qms", "device"]);
|
|
613
|
+
var DocumentSnapshotSchema = z17.object({
|
|
614
|
+
documentId: z17.string(),
|
|
615
|
+
commitSha: z17.string(),
|
|
616
|
+
documentPath: z17.string(),
|
|
617
|
+
documentTitle: z17.string(),
|
|
618
|
+
documentType: z17.string(),
|
|
619
|
+
previousReleasedCommitSha: z17.string().optional(),
|
|
620
|
+
changeType: z17.enum(["added", "modified", "unchanged"]),
|
|
621
|
+
changeDescription: z17.string().optional()
|
|
622
|
+
});
|
|
623
|
+
var QmsDocumentTypeSchema = z17.enum([
|
|
624
|
+
"sop",
|
|
625
|
+
"policy",
|
|
626
|
+
"work_instruction",
|
|
627
|
+
"supplier",
|
|
628
|
+
"audit_schedule",
|
|
629
|
+
"audit_report",
|
|
630
|
+
"management_review"
|
|
631
|
+
]);
|
|
632
|
+
var DeviceDocumentTypeSchema = z17.enum([
|
|
633
|
+
"user_need",
|
|
634
|
+
"requirement",
|
|
635
|
+
"architecture",
|
|
636
|
+
"detailed_design",
|
|
637
|
+
"test_protocol",
|
|
638
|
+
"test_report",
|
|
639
|
+
"usability_risk",
|
|
640
|
+
"software_risk",
|
|
641
|
+
"security_risk",
|
|
642
|
+
"hazardous_situation",
|
|
643
|
+
"harm",
|
|
644
|
+
"haz_soe_software",
|
|
645
|
+
"haz_soe_security",
|
|
646
|
+
"hazard_category",
|
|
647
|
+
// Usability engineering (IEC 62366)
|
|
648
|
+
"usability_plan",
|
|
649
|
+
"use_specification",
|
|
650
|
+
"task_analysis",
|
|
651
|
+
"usability_evaluation",
|
|
652
|
+
"summative_evaluation",
|
|
653
|
+
// Risk management (ISO 14971)
|
|
654
|
+
"risk_management_plan",
|
|
655
|
+
// Software lifecycle (IEC 62304)
|
|
656
|
+
"software_development_plan",
|
|
657
|
+
"software_maintenance_plan",
|
|
658
|
+
"soup_register",
|
|
659
|
+
// Problem resolution (IEC 62304 §9)
|
|
660
|
+
"anomaly",
|
|
661
|
+
// Cybersecurity (IEC 81001-5-1)
|
|
662
|
+
"cybersecurity_plan",
|
|
663
|
+
"sbom",
|
|
664
|
+
// Clinical (MDR / FDA)
|
|
665
|
+
"clinical_evaluation_plan",
|
|
666
|
+
"clinical_evaluation_report",
|
|
667
|
+
// Post-market surveillance (MDR Art. 83)
|
|
668
|
+
"post_market_surveillance_plan",
|
|
669
|
+
"post_market_feedback",
|
|
670
|
+
// Labeling (MDR Annex I)
|
|
671
|
+
"labeling",
|
|
672
|
+
// Product (ISO 13485 §7.3)
|
|
673
|
+
"product_development_plan",
|
|
674
|
+
"intended_use",
|
|
675
|
+
// Release management (IEC 62304 §5.7)
|
|
676
|
+
"release_plan",
|
|
677
|
+
// Change management (ISO 13485 §7.3.5)
|
|
678
|
+
"design_review",
|
|
679
|
+
"release_notes",
|
|
680
|
+
// Software test plan (IEC 62304 §5.7)
|
|
681
|
+
"software_test_plan"
|
|
682
|
+
]);
|
|
683
|
+
|
|
684
|
+
// ../shared/dist/schemas/change-management.js
|
|
685
|
+
import { z as z18 } from "zod";
|
|
686
|
+
var ReleasePlanFrontmatterSchema = z18.object({
|
|
687
|
+
id: z18.string().min(1),
|
|
688
|
+
title: z18.string().min(1),
|
|
689
|
+
type: z18.literal("release_plan").optional(),
|
|
690
|
+
status: z18.string().optional(),
|
|
691
|
+
author: z18.string().optional(),
|
|
692
|
+
reviewers: z18.array(z18.string()).optional(),
|
|
693
|
+
approvers: z18.array(z18.string()).optional(),
|
|
694
|
+
version: z18.string().optional(),
|
|
695
|
+
target_date: z18.string().optional()
|
|
696
|
+
});
|
|
697
|
+
var SuspectedLinkDispositionSchema = z18.enum(["included_in_release", "not_impacted"]);
|
|
698
|
+
var SuspectedLinkNeighborSchema = z18.object({
|
|
699
|
+
document: z18.string().min(1),
|
|
700
|
+
direction: z18.enum(["upstream", "downstream"]),
|
|
701
|
+
disposition: SuspectedLinkDispositionSchema,
|
|
702
|
+
/** Required when disposition is 'not_impacted' */
|
|
703
|
+
rationale: z18.string().min(1).optional()
|
|
704
|
+
});
|
|
705
|
+
var SuspectedLinkGroupSchema = z18.object({
|
|
706
|
+
triggered_by: z18.string().min(1),
|
|
707
|
+
neighbors: z18.array(SuspectedLinkNeighborSchema).min(1)
|
|
708
|
+
});
|
|
709
|
+
var DesignReviewFrontmatterSchema = z18.object({
|
|
710
|
+
id: z18.string().min(1),
|
|
711
|
+
title: z18.string().min(1),
|
|
712
|
+
type: z18.literal("design_review").optional(),
|
|
713
|
+
status: z18.string().optional(),
|
|
714
|
+
author: z18.string().optional(),
|
|
715
|
+
reviewers: z18.array(z18.string()).optional(),
|
|
716
|
+
approvers: z18.array(z18.string()).optional(),
|
|
717
|
+
/** Optional link to a Release Plan document (e.g. "RP-001") */
|
|
718
|
+
release_plan: z18.string().optional(),
|
|
719
|
+
/** Acknowledged suspected links — one-up/one-down neighbor analysis */
|
|
720
|
+
suspected_links: z18.array(SuspectedLinkGroupSchema).optional()
|
|
721
|
+
});
|
|
722
|
+
var ReleaseNotesAudienceSchema = z18.enum(["customer", "technical"]);
|
|
723
|
+
var ReleaseNotesFrontmatterSchema = z18.object({
|
|
724
|
+
id: z18.string().min(1),
|
|
725
|
+
title: z18.string().min(1),
|
|
726
|
+
type: z18.literal("release_notes").optional(),
|
|
727
|
+
status: RiskDocumentStatusSchema,
|
|
728
|
+
author: z18.string().optional(),
|
|
729
|
+
reviewers: z18.array(z18.string()).optional(),
|
|
730
|
+
approvers: z18.array(z18.string()).optional(),
|
|
731
|
+
audience: ReleaseNotesAudienceSchema,
|
|
732
|
+
release_version: z18.string().min(1)
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
// ../shared/dist/schemas/retention-policy.js
|
|
736
|
+
import { z as z19 } from "zod";
|
|
737
|
+
var RetentionPolicySchema = z19.object({
|
|
738
|
+
/** Default retention period in years for all record types */
|
|
739
|
+
defaultPeriodYears: z19.number().int().min(1).max(30).default(10),
|
|
740
|
+
/**
|
|
741
|
+
* Optional per-record-type overrides (e.g., { "release": 15, "signature": 20 }).
|
|
742
|
+
* Keys are record type identifiers; values are retention periods in years.
|
|
743
|
+
*/
|
|
744
|
+
byRecordType: z19.record(z19.string(), z19.number().int().min(1).max(30)).optional()
|
|
745
|
+
});
|
|
746
|
+
function isWithinRetentionPeriod(createdAt, retentionYears, now = /* @__PURE__ */ new Date()) {
|
|
747
|
+
const retentionEnd = new Date(createdAt);
|
|
748
|
+
retentionEnd.setFullYear(retentionEnd.getFullYear() + retentionYears);
|
|
749
|
+
return now < retentionEnd;
|
|
750
|
+
}
|
|
751
|
+
function getEffectiveRetentionYears(policy, recordType) {
|
|
752
|
+
const DEFAULT_RETENTION_YEARS = 10;
|
|
753
|
+
if (!policy) {
|
|
754
|
+
return DEFAULT_RETENTION_YEARS;
|
|
755
|
+
}
|
|
756
|
+
return policy.byRecordType?.[recordType] ?? policy.defaultPeriodYears;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
// ../shared/dist/schemas/audit.js
|
|
760
|
+
import { z as z20 } from "zod";
|
|
761
|
+
var AuditFindingClassificationSchema = z20.enum(["observation", "minor_nc", "major_nc"]);
|
|
762
|
+
var AuditStatusSchema = z20.enum(["planned", "in_progress", "completed", "cancelled"]);
|
|
763
|
+
var PlannedAuditEntrySchema = z20.object({
|
|
764
|
+
audit_id: z20.string().min(1),
|
|
765
|
+
process_area: z20.string().min(1),
|
|
766
|
+
clause: z20.string().optional(),
|
|
767
|
+
planned_date: z20.string().min(1),
|
|
768
|
+
auditor: z20.string().min(1),
|
|
769
|
+
status: AuditStatusSchema
|
|
770
|
+
});
|
|
771
|
+
var AuditScheduleFrontmatterSchema = z20.object({
|
|
772
|
+
id: z20.string().min(1),
|
|
773
|
+
title: z20.string().min(1),
|
|
774
|
+
type: z20.literal("audit_schedule").optional(),
|
|
775
|
+
status: z20.string().optional(),
|
|
776
|
+
author: z20.string().optional(),
|
|
777
|
+
reviewers: z20.array(z20.string()).optional(),
|
|
778
|
+
approvers: z20.array(z20.string()).optional(),
|
|
779
|
+
cycle_year: z20.number().int().min(2e3).max(2100),
|
|
780
|
+
audits: z20.array(PlannedAuditEntrySchema).min(1)
|
|
781
|
+
});
|
|
782
|
+
var AuditFindingSchema = z20.object({
|
|
783
|
+
finding_id: z20.string().min(1),
|
|
784
|
+
classification: AuditFindingClassificationSchema,
|
|
785
|
+
description: z20.string().min(1),
|
|
786
|
+
capa_id: z20.string().optional()
|
|
787
|
+
});
|
|
788
|
+
var AuditReportFrontmatterSchema = z20.object({
|
|
789
|
+
id: z20.string().min(1),
|
|
790
|
+
title: z20.string().min(1),
|
|
791
|
+
type: z20.literal("audit_report").optional(),
|
|
792
|
+
status: z20.string().optional(),
|
|
793
|
+
author: z20.string().optional(),
|
|
794
|
+
reviewers: z20.array(z20.string()).optional(),
|
|
795
|
+
approvers: z20.array(z20.string()).optional(),
|
|
796
|
+
audit_date: z20.string().min(1),
|
|
797
|
+
audit_id: z20.string().optional(),
|
|
798
|
+
process_area: z20.string().min(1),
|
|
799
|
+
clause: z20.string().optional(),
|
|
800
|
+
auditor: z20.string().min(1),
|
|
801
|
+
findings: z20.array(AuditFindingSchema),
|
|
802
|
+
findings_major: z20.number().int().min(0).optional(),
|
|
803
|
+
findings_minor: z20.number().int().min(0).optional(),
|
|
804
|
+
findings_observations: z20.number().int().min(0).optional()
|
|
805
|
+
});
|
|
806
|
+
|
|
807
|
+
// ../shared/dist/schemas/management-review.js
|
|
808
|
+
import { z as z21 } from "zod";
|
|
809
|
+
var ManagementReviewAttendeeSchema = z21.object({
|
|
810
|
+
name: z21.string().min(1),
|
|
811
|
+
role: z21.string().min(1)
|
|
812
|
+
});
|
|
813
|
+
var ManagementReviewFrontmatterSchema = z21.object({
|
|
814
|
+
id: z21.string().min(1),
|
|
815
|
+
title: z21.string().min(1),
|
|
816
|
+
type: z21.literal("management_review").optional(),
|
|
817
|
+
version: z21.string().optional(),
|
|
818
|
+
status: z21.enum(["draft", "scheduled", "completed"]).optional(),
|
|
819
|
+
review_date: z21.string().min(1),
|
|
820
|
+
review_period: z21.object({
|
|
821
|
+
from: z21.string().min(1),
|
|
822
|
+
to: z21.string().min(1)
|
|
823
|
+
}),
|
|
824
|
+
attendees: z21.array(ManagementReviewAttendeeSchema).min(1),
|
|
825
|
+
data_snapshot_date: z21.string().optional(),
|
|
826
|
+
next_review_date: z21.string().optional()
|
|
827
|
+
});
|
|
828
|
+
|
|
829
|
+
// ../shared/dist/schemas/frameworks.js
|
|
830
|
+
import { z as z22 } from "zod";
|
|
831
|
+
var FrameworkScopeSchema = z22.enum(["qms", "device", "both"]);
|
|
832
|
+
var MappingRelationshipSchema = z22.enum(["equivalent", "partial", "related", "supersedes"]);
|
|
833
|
+
var FrameworkDefinitionSeedSchema = z22.object({
|
|
834
|
+
id: RegulatoryFrameworkSchema,
|
|
835
|
+
name: z22.string().min(1),
|
|
836
|
+
version: z22.string().min(1),
|
|
837
|
+
scope: FrameworkScopeSchema,
|
|
838
|
+
url: z22.string().url().nullable(),
|
|
839
|
+
active: z22.boolean().default(true)
|
|
840
|
+
});
|
|
841
|
+
var ClauseBase = z22.object({
|
|
842
|
+
clauseNumber: z22.string().min(1),
|
|
843
|
+
title: z22.string().min(1)
|
|
844
|
+
});
|
|
845
|
+
function buildClauseSchema(remainingDepth) {
|
|
846
|
+
if (remainingDepth <= 0) {
|
|
847
|
+
return ClauseBase.strict();
|
|
848
|
+
}
|
|
849
|
+
return ClauseBase.extend({
|
|
850
|
+
children: z22.array(z22.lazy(() => buildClauseSchema(remainingDepth - 1))).optional()
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
var FrameworkClauseSeedSchema = buildClauseSchema(5);
|
|
854
|
+
var FrameworkMappingSeedSchema = z22.object({
|
|
855
|
+
sourceClause: z22.string().min(1),
|
|
856
|
+
targetFramework: RegulatoryFrameworkSchema,
|
|
857
|
+
targetClause: z22.string().min(1),
|
|
858
|
+
relationship: MappingRelationshipSchema,
|
|
859
|
+
notes: z22.string().nullable().default(null)
|
|
860
|
+
});
|
|
861
|
+
var MappingFileSeedSchema = z22.object({
|
|
862
|
+
sourceFramework: RegulatoryFrameworkSchema,
|
|
863
|
+
mappings: z22.array(FrameworkMappingSeedSchema)
|
|
864
|
+
});
|
|
865
|
+
var EvidenceSourceSchema = z22.enum(["documents", "training_records"]);
|
|
866
|
+
var EvidenceRuleConditionsSeedSchema = z22.object({
|
|
867
|
+
evidenceSource: EvidenceSourceSchema.optional(),
|
|
868
|
+
documentType: DocumentTypeSchema.optional(),
|
|
869
|
+
linkType: LinkTypeSchema.optional(),
|
|
870
|
+
status: z22.string().optional(),
|
|
871
|
+
minCount: z22.number().int().positive().optional()
|
|
872
|
+
});
|
|
873
|
+
var EvidenceRuleSeedSchema = z22.object({
|
|
874
|
+
clauseId: z22.string().min(1),
|
|
875
|
+
description: z22.string().min(1),
|
|
876
|
+
conditions: EvidenceRuleConditionsSeedSchema,
|
|
877
|
+
weight: z22.number().min(0).max(1)
|
|
878
|
+
});
|
|
879
|
+
var EvidenceRulesFileSeedSchema = z22.object({
|
|
880
|
+
frameworkId: RegulatoryFrameworkSchema,
|
|
881
|
+
rules: z22.array(EvidenceRuleSeedSchema)
|
|
882
|
+
});
|
|
883
|
+
var FrameworkFileSeedSchema = FrameworkDefinitionSeedSchema.extend({
|
|
884
|
+
clauses: z22.array(FrameworkClauseSeedSchema)
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
// ../shared/dist/schemas/legal.js
|
|
888
|
+
import { z as z23 } from "zod";
|
|
889
|
+
var LegalDocumentTypeSchema = z23.enum(["tos", "privacy-policy", "billing-terms"]);
|
|
890
|
+
var LegalDocumentVersionSchema = z23.string().regex(/^\d{4}-\d{2}-\d{2}$/, {
|
|
891
|
+
message: "Version must be in YYYY-MM-DD format"
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
// ../shared/dist/schemas/index.js
|
|
895
|
+
var GateOverrideCategorySchema = z24.enum([
|
|
896
|
+
"unverified_requirements",
|
|
897
|
+
"unanalyzed_requirements",
|
|
898
|
+
"error_risk_gaps",
|
|
899
|
+
"missing_risk_management_plan_reference",
|
|
900
|
+
"missing_plan_risk_management",
|
|
901
|
+
"missing_plan_software_development",
|
|
902
|
+
"missing_plan_cybersecurity",
|
|
903
|
+
"missing_plan_usability",
|
|
904
|
+
"missing_plan_clinical_evaluation",
|
|
905
|
+
"missing_plan_post_market_surveillance",
|
|
906
|
+
"missing_artifact_soup_register",
|
|
907
|
+
"missing_artifact_sbom",
|
|
908
|
+
"missing_artifact_summative_evaluation",
|
|
909
|
+
"missing_deployment_references",
|
|
910
|
+
"missing_smoke_test_evidence"
|
|
911
|
+
]);
|
|
912
|
+
var MemberRoleSchema = z24.enum(["admin", "member"]);
|
|
913
|
+
var MemberStatusSchema = z24.enum(["active", "suspended", "removed"]);
|
|
914
|
+
var EmailAddressSchema = z24.object({
|
|
915
|
+
value: z24.string().email(),
|
|
916
|
+
verified: z24.boolean()
|
|
917
|
+
});
|
|
918
|
+
var ReviewerRuleSchema = z24.object({
|
|
919
|
+
documentType: DocumentTypeSchema,
|
|
920
|
+
requiredDepartments: z24.array(z24.string()),
|
|
921
|
+
finalApproverDepartment: z24.string()
|
|
922
|
+
});
|
|
923
|
+
var SyncStatusSchema = z24.enum(["active", "paused", "error"]);
|
|
924
|
+
var AuditActionSchema = z24.enum([
|
|
925
|
+
// Organization
|
|
926
|
+
"organization.created",
|
|
927
|
+
"organization.settings_updated",
|
|
928
|
+
"organization.checklist_template_updated",
|
|
929
|
+
// Members
|
|
930
|
+
"member.invited",
|
|
931
|
+
"member.invite_declined",
|
|
932
|
+
"member.joined",
|
|
933
|
+
"member.role_changed",
|
|
934
|
+
"member.removed",
|
|
935
|
+
"member.password_reset_forced",
|
|
936
|
+
// Repositories
|
|
937
|
+
"repository.connected",
|
|
938
|
+
"repository.disconnected",
|
|
939
|
+
"repository.sync_triggered",
|
|
940
|
+
"repository.updated",
|
|
941
|
+
"repository.assigned",
|
|
942
|
+
"repository.unassigned",
|
|
943
|
+
// Documents
|
|
944
|
+
"document.synced",
|
|
945
|
+
"document.removed",
|
|
946
|
+
"document.viewed",
|
|
947
|
+
// Releases
|
|
948
|
+
"release.created",
|
|
949
|
+
"release.updated",
|
|
950
|
+
"release.deleted",
|
|
951
|
+
"release.withdrawn",
|
|
952
|
+
"release.submitted_for_review",
|
|
953
|
+
"release.signature_added",
|
|
954
|
+
"release.approved",
|
|
955
|
+
"release.published",
|
|
956
|
+
"release.checklist_updated",
|
|
957
|
+
"release.signing_obligations_rederived",
|
|
958
|
+
"release.gate_override_added",
|
|
959
|
+
"release.gate_override_removed",
|
|
960
|
+
"release.gate_override_invalidated",
|
|
961
|
+
"release.viewed",
|
|
962
|
+
// Signatures
|
|
963
|
+
"signature.created",
|
|
964
|
+
"signature.attempt_failed",
|
|
965
|
+
"signature.lockout_triggered",
|
|
966
|
+
// Signing Requests
|
|
967
|
+
"signing_request.created",
|
|
968
|
+
"signing_request.sent",
|
|
969
|
+
"signing_request.viewed",
|
|
970
|
+
"signing_request.signed",
|
|
971
|
+
"signing_request.declined",
|
|
972
|
+
"signing_request.cancelled",
|
|
973
|
+
"signing_request.expired",
|
|
974
|
+
"signing_request.reminded",
|
|
975
|
+
"signing_request.document_accessed",
|
|
976
|
+
// Training
|
|
977
|
+
"training.assigned",
|
|
978
|
+
"training.completed",
|
|
979
|
+
"training.started",
|
|
980
|
+
"training.settings_updated",
|
|
981
|
+
"training.quiz_submitted",
|
|
982
|
+
"training.quiz_passed",
|
|
983
|
+
"training.quiz_failed",
|
|
984
|
+
"training.overdue_notified",
|
|
985
|
+
"training.acknowledged",
|
|
986
|
+
"training.signature_added",
|
|
987
|
+
"training.instructor_signoff",
|
|
988
|
+
"training.task_created",
|
|
989
|
+
"training.viewed",
|
|
990
|
+
// QMS
|
|
991
|
+
"qms.created",
|
|
992
|
+
"qms.updated",
|
|
993
|
+
"qms.deleted",
|
|
994
|
+
// Devices
|
|
995
|
+
"device.created",
|
|
996
|
+
"device.updated",
|
|
997
|
+
"device.deleted",
|
|
998
|
+
// DCOs
|
|
999
|
+
"dco.created",
|
|
1000
|
+
"dco.updated",
|
|
1001
|
+
"dco.deleted",
|
|
1002
|
+
"dco.submitted",
|
|
1003
|
+
"dco.obligation_fulfilled",
|
|
1004
|
+
"dco.approved",
|
|
1005
|
+
"dco.effective",
|
|
1006
|
+
// Design Reviews
|
|
1007
|
+
"design_review.created",
|
|
1008
|
+
"design_review.updated",
|
|
1009
|
+
"design_review.deleted",
|
|
1010
|
+
"design_review.submitted",
|
|
1011
|
+
"design_review.signature_added",
|
|
1012
|
+
"design_review.signed",
|
|
1013
|
+
"design_review.cancelled",
|
|
1014
|
+
// CAPAs
|
|
1015
|
+
"capa.created",
|
|
1016
|
+
"capa.updated",
|
|
1017
|
+
"capa.deleted",
|
|
1018
|
+
"capa.investigation_started",
|
|
1019
|
+
"capa.implementation_started",
|
|
1020
|
+
"capa.verification_started",
|
|
1021
|
+
"capa.closed",
|
|
1022
|
+
"capa.cancelled",
|
|
1023
|
+
"capa.action_added",
|
|
1024
|
+
"capa.action_updated",
|
|
1025
|
+
"capa.action_removed",
|
|
1026
|
+
// Complaints
|
|
1027
|
+
"complaint.created",
|
|
1028
|
+
"complaint.updated",
|
|
1029
|
+
"complaint.deleted",
|
|
1030
|
+
"complaint.investigation_started",
|
|
1031
|
+
"complaint.resolved",
|
|
1032
|
+
"complaint.closed",
|
|
1033
|
+
"complaint.cancelled",
|
|
1034
|
+
"complaint.escalated_to_capa",
|
|
1035
|
+
// Nonconformances
|
|
1036
|
+
"nc.created",
|
|
1037
|
+
"nc.updated",
|
|
1038
|
+
"nc.deleted",
|
|
1039
|
+
"nc.investigation_started",
|
|
1040
|
+
"nc.disposition_set",
|
|
1041
|
+
"nc.concession_approved",
|
|
1042
|
+
"nc.closed",
|
|
1043
|
+
"nc.cancelled",
|
|
1044
|
+
"nc.escalated_to_capa",
|
|
1045
|
+
// Actions
|
|
1046
|
+
"action.created",
|
|
1047
|
+
"action.updated",
|
|
1048
|
+
"action.completed",
|
|
1049
|
+
"action.cancelled",
|
|
1050
|
+
"action.deleted",
|
|
1051
|
+
// Legal
|
|
1052
|
+
"billing_terms.accepted",
|
|
1053
|
+
"legal_document.accepted",
|
|
1054
|
+
// Billing
|
|
1055
|
+
"billing.checkout_created",
|
|
1056
|
+
"billing.portal_accessed",
|
|
1057
|
+
"billing.subscription_activated",
|
|
1058
|
+
"billing.subscription_updated",
|
|
1059
|
+
"billing.subscription_canceled",
|
|
1060
|
+
// API Keys
|
|
1061
|
+
"api_key.created",
|
|
1062
|
+
"api_key.revoked",
|
|
1063
|
+
// Risk Management
|
|
1064
|
+
"risk.viewed",
|
|
1065
|
+
// Compliance
|
|
1066
|
+
"compliance_package.requested",
|
|
1067
|
+
"compliance_package.downloaded",
|
|
1068
|
+
"validation_package.downloaded",
|
|
1069
|
+
// ERSD
|
|
1070
|
+
"ersd.created",
|
|
1071
|
+
"ersd.auto_seeded",
|
|
1072
|
+
// Quality Objectives
|
|
1073
|
+
"quality_objective.created",
|
|
1074
|
+
"quality_objective.updated",
|
|
1075
|
+
"quality_objective.value_recorded",
|
|
1076
|
+
"quality_objective.deactivated",
|
|
1077
|
+
// Quality Reviews
|
|
1078
|
+
"quality_review.created",
|
|
1079
|
+
"quality_review.updated",
|
|
1080
|
+
"quality_review.started",
|
|
1081
|
+
"quality_review.completed",
|
|
1082
|
+
"quality_review.cancelled",
|
|
1083
|
+
// Review Types
|
|
1084
|
+
"review_type.created",
|
|
1085
|
+
"review_type.updated",
|
|
1086
|
+
// Audit
|
|
1087
|
+
"audit_log.exported"
|
|
1088
|
+
]);
|
|
1089
|
+
var ResourceTypeSchema = z24.enum([
|
|
1090
|
+
"organization",
|
|
1091
|
+
"member",
|
|
1092
|
+
"invite",
|
|
1093
|
+
"repository",
|
|
1094
|
+
"document",
|
|
1095
|
+
"release",
|
|
1096
|
+
"signature",
|
|
1097
|
+
"training",
|
|
1098
|
+
"training_task",
|
|
1099
|
+
"training_settings",
|
|
1100
|
+
"qms",
|
|
1101
|
+
"device",
|
|
1102
|
+
"dco",
|
|
1103
|
+
"design_review",
|
|
1104
|
+
"signing_request",
|
|
1105
|
+
"capa",
|
|
1106
|
+
"complaint",
|
|
1107
|
+
"nonconformance",
|
|
1108
|
+
"action",
|
|
1109
|
+
"legal_acceptance",
|
|
1110
|
+
"subscription",
|
|
1111
|
+
"api_key",
|
|
1112
|
+
"compliance_package",
|
|
1113
|
+
"validation_package",
|
|
1114
|
+
"ersd",
|
|
1115
|
+
"qualityObjective",
|
|
1116
|
+
"qualityReview",
|
|
1117
|
+
"reviewType",
|
|
1118
|
+
"audit_log",
|
|
1119
|
+
"risk_matrix"
|
|
1120
|
+
]);
|
|
1121
|
+
var ReleaseTypeSchema = z24.enum(["qms", "device", "combined"]);
|
|
1122
|
+
var ReleaseStatusSchema = z24.enum(["draft", "in_review", "approved", "published"]);
|
|
1123
|
+
var SignatureTypeSchema = z24.enum(["author", "dept_reviewer", "final_approver", "trainee"]);
|
|
1124
|
+
var ChangeTypeSchema = z24.enum(["added", "modified", "deleted"]);
|
|
1125
|
+
var SigningRequestStatusSchema = z24.enum([
|
|
1126
|
+
"sent",
|
|
1127
|
+
"partially_signed",
|
|
1128
|
+
"completed",
|
|
1129
|
+
"expired",
|
|
1130
|
+
"cancelled"
|
|
1131
|
+
]);
|
|
1132
|
+
var SignerStatusSchema = z24.enum(["pending", "viewed", "signed", "declined"]);
|
|
1133
|
+
var FieldTypeSchema = z24.enum(["signature", "initials", "date"]);
|
|
1134
|
+
|
|
1135
|
+
// ../shared/dist/constants/risk-matrix.js
|
|
1136
|
+
var RISK_DOCUMENT_TYPES = [
|
|
1137
|
+
"software_risk",
|
|
1138
|
+
"usability_risk",
|
|
1139
|
+
"security_risk"
|
|
1140
|
+
];
|
|
1141
|
+
var HAZARD_DOCUMENT_TYPES = ["haz_soe_software", "haz_soe_security"];
|
|
1142
|
+
var ALL_RISK_RELATED_DOCUMENT_TYPES = [
|
|
1143
|
+
...RISK_DOCUMENT_TYPES,
|
|
1144
|
+
...HAZARD_DOCUMENT_TYPES,
|
|
1145
|
+
"hazardous_situation",
|
|
1146
|
+
"harm"
|
|
1147
|
+
];
|
|
1148
|
+
|
|
1149
|
+
// ../shared/dist/constants/document-types.js
|
|
1150
|
+
var QMS_DOCUMENT_TYPES = [
|
|
1151
|
+
"sop",
|
|
1152
|
+
"policy",
|
|
1153
|
+
"work_instruction",
|
|
1154
|
+
"supplier",
|
|
1155
|
+
// Internal audit management (ISO 13485 §8.2.2)
|
|
1156
|
+
"audit_schedule",
|
|
1157
|
+
"audit_report",
|
|
1158
|
+
// Management review (ISO 13485 §5.6)
|
|
1159
|
+
"management_review"
|
|
1160
|
+
];
|
|
1161
|
+
var DEVICE_DOCUMENT_TYPES = [
|
|
1162
|
+
"user_need",
|
|
1163
|
+
"requirement",
|
|
1164
|
+
"architecture",
|
|
1165
|
+
"detailed_design",
|
|
1166
|
+
"test_protocol",
|
|
1167
|
+
"test_report",
|
|
1168
|
+
"usability_risk",
|
|
1169
|
+
"software_risk",
|
|
1170
|
+
"security_risk",
|
|
1171
|
+
"hazardous_situation",
|
|
1172
|
+
"harm",
|
|
1173
|
+
"haz_soe_software",
|
|
1174
|
+
"haz_soe_security",
|
|
1175
|
+
"hazard_category",
|
|
1176
|
+
// Usability engineering (IEC 62366)
|
|
1177
|
+
"usability_plan",
|
|
1178
|
+
"use_specification",
|
|
1179
|
+
"task_analysis",
|
|
1180
|
+
"usability_evaluation",
|
|
1181
|
+
"summative_evaluation",
|
|
1182
|
+
// Risk management (ISO 14971)
|
|
1183
|
+
"risk_management_plan",
|
|
1184
|
+
// Software lifecycle (IEC 62304)
|
|
1185
|
+
"software_development_plan",
|
|
1186
|
+
"software_maintenance_plan",
|
|
1187
|
+
"soup_register",
|
|
1188
|
+
// Problem resolution (IEC 62304 §9)
|
|
1189
|
+
"anomaly",
|
|
1190
|
+
// Cybersecurity (IEC 81001-5-1)
|
|
1191
|
+
"cybersecurity_plan",
|
|
1192
|
+
"sbom",
|
|
1193
|
+
// Clinical (MDR / FDA)
|
|
1194
|
+
"clinical_evaluation_plan",
|
|
1195
|
+
"clinical_evaluation_report",
|
|
1196
|
+
// Post-market surveillance (MDR Art. 83)
|
|
1197
|
+
"post_market_surveillance_plan",
|
|
1198
|
+
"post_market_feedback",
|
|
1199
|
+
// Labeling (MDR Annex I)
|
|
1200
|
+
"labeling",
|
|
1201
|
+
// Product (ISO 13485 §7.3)
|
|
1202
|
+
"product_development_plan",
|
|
1203
|
+
"intended_use",
|
|
1204
|
+
// Release management (IEC 62304 §5.7)
|
|
1205
|
+
"release_plan",
|
|
1206
|
+
// Change management (ISO 13485 §7.3.5)
|
|
1207
|
+
"design_review",
|
|
1208
|
+
"release_notes",
|
|
1209
|
+
// Software test plan (IEC 62304 §5.7)
|
|
1210
|
+
"software_test_plan"
|
|
1211
|
+
];
|
|
1212
|
+
var CHANGE_DOCUMENT_TYPES = ["design_review", "release_plan"];
|
|
1213
|
+
function isChangeDocumentType(type) {
|
|
1214
|
+
return CHANGE_DOCUMENT_TYPES.includes(type);
|
|
1215
|
+
}
|
|
1216
|
+
function isQmsDocumentType(type) {
|
|
1217
|
+
return QMS_DOCUMENT_TYPES.includes(type);
|
|
1218
|
+
}
|
|
1219
|
+
function isDeviceDocumentType(type) {
|
|
1220
|
+
return DEVICE_DOCUMENT_TYPES.includes(type);
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
// ../shared/dist/constants/index.js
|
|
1224
|
+
var DOCUMENT_TYPES = {
|
|
1225
|
+
user_need: "User Need",
|
|
1226
|
+
requirement: "Requirement",
|
|
1227
|
+
architecture: "Architecture",
|
|
1228
|
+
detailed_design: "Detailed Design",
|
|
1229
|
+
test_protocol: "Test Protocol",
|
|
1230
|
+
test_report: "Test Report",
|
|
1231
|
+
sop: "SOP",
|
|
1232
|
+
work_instruction: "Work Instruction",
|
|
1233
|
+
policy: "Policy",
|
|
1234
|
+
usability_risk: "Usability Risk",
|
|
1235
|
+
software_risk: "Software Risk",
|
|
1236
|
+
security_risk: "Security Risk",
|
|
1237
|
+
// Risk document types
|
|
1238
|
+
haz_soe_software: "Hazard (Software)",
|
|
1239
|
+
haz_soe_security: "Hazard (Security)",
|
|
1240
|
+
hazardous_situation: "Hazardous Situation",
|
|
1241
|
+
harm: "Harm",
|
|
1242
|
+
hazard_category: "Hazard Category",
|
|
1243
|
+
// Usability engineering (IEC 62366)
|
|
1244
|
+
usability_plan: "Usability Plan",
|
|
1245
|
+
use_specification: "Use Specification",
|
|
1246
|
+
task_analysis: "Task Analysis",
|
|
1247
|
+
usability_evaluation: "Usability Evaluation",
|
|
1248
|
+
summative_evaluation: "Summative Evaluation",
|
|
1249
|
+
// Risk management (ISO 14971)
|
|
1250
|
+
risk_management_plan: "Risk Management Plan",
|
|
1251
|
+
// Software lifecycle (IEC 62304)
|
|
1252
|
+
software_development_plan: "Software Development Plan",
|
|
1253
|
+
software_maintenance_plan: "Software Maintenance Plan",
|
|
1254
|
+
soup_register: "SOUP Register",
|
|
1255
|
+
// Problem resolution (IEC 62304 §9)
|
|
1256
|
+
anomaly: "Anomaly",
|
|
1257
|
+
// Cybersecurity (IEC 81001-5-1)
|
|
1258
|
+
cybersecurity_plan: "Cybersecurity Plan",
|
|
1259
|
+
sbom: "SBOM",
|
|
1260
|
+
// Clinical (MDR / FDA)
|
|
1261
|
+
clinical_evaluation_plan: "Clinical Evaluation Plan",
|
|
1262
|
+
clinical_evaluation_report: "Clinical Evaluation Report",
|
|
1263
|
+
// Post-market surveillance (MDR Art. 83)
|
|
1264
|
+
post_market_surveillance_plan: "Post-Market Surveillance Plan",
|
|
1265
|
+
post_market_feedback: "Post-Market Feedback",
|
|
1266
|
+
// Labeling (MDR Annex I)
|
|
1267
|
+
labeling: "Labeling",
|
|
1268
|
+
// Product (ISO 13485 §7.3)
|
|
1269
|
+
product_development_plan: "Product Development Plan",
|
|
1270
|
+
intended_use: "Intended Use",
|
|
1271
|
+
// Release management (IEC 62304 §5.7)
|
|
1272
|
+
release_plan: "Release Plan",
|
|
1273
|
+
// Change management (ISO 13485 §7.3.5)
|
|
1274
|
+
design_review: "Design Review",
|
|
1275
|
+
release_notes: "Release Notes",
|
|
1276
|
+
// Supplier management (ISO 13485 §7.4)
|
|
1277
|
+
supplier: "Supplier",
|
|
1278
|
+
// Internal audit management (ISO 13485 §8.2.2)
|
|
1279
|
+
audit_schedule: "Audit Schedule",
|
|
1280
|
+
audit_report: "Audit Report",
|
|
1281
|
+
// Management review (ISO 13485 §5.6)
|
|
1282
|
+
management_review: "Management Review",
|
|
1283
|
+
// Software test plan (IEC 62304 §5.7)
|
|
1284
|
+
software_test_plan: "Software Test Plan"
|
|
1285
|
+
};
|
|
1286
|
+
var LINK_TYPES = {
|
|
1287
|
+
derives_from: "Derives From",
|
|
1288
|
+
implements: "Implements",
|
|
1289
|
+
verified_by: "Verified By",
|
|
1290
|
+
mitigates: "Mitigates",
|
|
1291
|
+
parent_of: "Parent Of",
|
|
1292
|
+
related_to: "Related To",
|
|
1293
|
+
// New risk link types
|
|
1294
|
+
leads_to: "Leads To",
|
|
1295
|
+
results_in: "Results In",
|
|
1296
|
+
analyzes: "Analyzes"
|
|
1297
|
+
};
|
|
1298
|
+
var REQUIRED_SECTIONS = {
|
|
1299
|
+
user_need: ["Purpose", "Stakeholder", "User Needs"],
|
|
1300
|
+
architecture: ["Purpose"],
|
|
1301
|
+
release_plan: ["Scope", "Applicable Plans", "Release-Specific Criteria", "Known Anomalies"],
|
|
1302
|
+
design_review: ["Review Scope", "Attendees", "Findings", "Actions", "Conclusion"],
|
|
1303
|
+
release_notes: ["Changes", "Known Issues"],
|
|
1304
|
+
audit_schedule: ["Scope", "Audit Criteria"],
|
|
1305
|
+
audit_report: ["Scope", "Methodology", "Findings", "Conclusion"],
|
|
1306
|
+
management_review: ["Review Inputs", "Review Outputs", "Action Items", "Decisions"],
|
|
1307
|
+
hazard_category: ["Description", "Examples", "Applicable Standards"]
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1310
|
+
// ../shared/dist/validators/permissions.js
|
|
1311
|
+
import { z as z25 } from "zod";
|
|
1312
|
+
var MemberPermissionsSchema = z25.object({
|
|
1313
|
+
canSign: z25.boolean(),
|
|
1314
|
+
canApprove: z25.boolean(),
|
|
1315
|
+
canCreateRelease: z25.boolean(),
|
|
1316
|
+
canPublishRelease: z25.boolean(),
|
|
1317
|
+
canManageMembers: z25.boolean(),
|
|
1318
|
+
canViewAuditLog: z25.boolean(),
|
|
1319
|
+
canExport: z25.boolean()
|
|
1320
|
+
});
|
|
112
1321
|
|
|
113
1322
|
// src/schema-map.ts
|
|
114
|
-
import {
|
|
115
|
-
AnomalyFrontmatterSchema,
|
|
116
|
-
AuditReportFrontmatterSchema,
|
|
117
|
-
AuditScheduleFrontmatterSchema,
|
|
118
|
-
ClinicalEvaluationPlanFrontmatterSchema,
|
|
119
|
-
ClinicalEvaluationReportFrontmatterSchema,
|
|
120
|
-
CybersecurityPlanFrontmatterSchema,
|
|
121
|
-
DesignReviewFrontmatterSchema,
|
|
122
|
-
HarmFrontmatterSchema,
|
|
123
|
-
HazardCategoryFrontmatterSchema,
|
|
124
|
-
HazardFrontmatterSchema,
|
|
125
|
-
HazardousSituationFrontmatterSchema,
|
|
126
|
-
IntendedUseFrontmatterSchema,
|
|
127
|
-
LabelingFrontmatterSchema,
|
|
128
|
-
ManagementReviewFrontmatterSchema,
|
|
129
|
-
PostMarketFeedbackFrontmatterSchema,
|
|
130
|
-
PostMarketSurveillancePlanFrontmatterSchema,
|
|
131
|
-
ProductDevelopmentPlanFrontmatterSchema,
|
|
132
|
-
ReleasePlanFrontmatterSchema,
|
|
133
|
-
ReleaseNotesFrontmatterSchema,
|
|
134
|
-
RequirementFrontmatterSchema,
|
|
135
|
-
RiskEntryFrontmatterSchema,
|
|
136
|
-
RiskManagementPlanFrontmatterSchema,
|
|
137
|
-
SbomFrontmatterSchema,
|
|
138
|
-
SoftwareDevelopmentPlanFrontmatterSchema,
|
|
139
|
-
SoftwareMaintenancePlanFrontmatterSchema,
|
|
140
|
-
SoftwareTestPlanFrontmatterSchema,
|
|
141
|
-
SoupRegisterFrontmatterSchema,
|
|
142
|
-
SummativeEvaluationFrontmatterSchema,
|
|
143
|
-
TaskAnalysisFrontmatterSchema,
|
|
144
|
-
TestProtocolFrontmatterSchema,
|
|
145
|
-
TestReportFrontmatterSchema,
|
|
146
|
-
UsabilityEvaluationFrontmatterSchema,
|
|
147
|
-
UsabilityPlanFrontmatterSchema,
|
|
148
|
-
UseSpecificationFrontmatterSchema,
|
|
149
|
-
UserNeedFrontmatterSchema
|
|
150
|
-
} from "@pactosigna/shared";
|
|
151
1323
|
var SCHEMA_MAP = {
|
|
152
1324
|
// Risk entries
|
|
153
1325
|
software_risk: RiskEntryFrontmatterSchema,
|
|
@@ -211,7 +1383,6 @@ function getSchemaForDocumentType(type) {
|
|
|
211
1383
|
|
|
212
1384
|
// src/validate-document.ts
|
|
213
1385
|
import matter from "gray-matter";
|
|
214
|
-
import { REQUIRED_SECTIONS } from "@pactosigna/shared";
|
|
215
1386
|
function validateDocument(content, filePath) {
|
|
216
1387
|
const errors = [];
|
|
217
1388
|
const warnings = [];
|
|
@@ -399,78 +1570,78 @@ export {
|
|
|
399
1570
|
AcceptabilityStatusSchema,
|
|
400
1571
|
AnomalyCategorySchema,
|
|
401
1572
|
AnomalyDispositionSchema,
|
|
402
|
-
|
|
1573
|
+
AnomalyFrontmatterSchema,
|
|
403
1574
|
AnomalySeveritySchema,
|
|
404
1575
|
AuditFindingClassificationSchema,
|
|
405
1576
|
AuditFindingSchema,
|
|
406
|
-
|
|
407
|
-
|
|
1577
|
+
AuditReportFrontmatterSchema,
|
|
1578
|
+
AuditScheduleFrontmatterSchema,
|
|
408
1579
|
AuditStatusSchema,
|
|
409
1580
|
CHANGE_DOCUMENT_TYPES,
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
1581
|
+
ClinicalEvaluationPlanFrontmatterSchema,
|
|
1582
|
+
ClinicalEvaluationReportFrontmatterSchema,
|
|
1583
|
+
CybersecurityPlanFrontmatterSchema,
|
|
413
1584
|
DEVICE_DOCUMENT_TYPES,
|
|
414
1585
|
DOCUMENT_TYPES,
|
|
415
|
-
|
|
1586
|
+
DesignReviewFrontmatterSchema,
|
|
416
1587
|
DocumentStatusSchema,
|
|
417
1588
|
DocumentTypeSchema,
|
|
418
1589
|
FOLDER_RULES,
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
1590
|
+
HarmFrontmatterSchema,
|
|
1591
|
+
HazardCategoryFrontmatterSchema,
|
|
1592
|
+
HazardFrontmatterSchema,
|
|
1593
|
+
HazardousSituationFrontmatterSchema,
|
|
1594
|
+
IntendedUseFrontmatterSchema,
|
|
424
1595
|
JSON_SBOM_FOLDERS,
|
|
425
1596
|
LINK_TYPES,
|
|
426
|
-
|
|
1597
|
+
LabelingFrontmatterSchema,
|
|
427
1598
|
LinkTypeSchema,
|
|
428
1599
|
ManagementReviewAttendeeSchema,
|
|
429
|
-
|
|
1600
|
+
ManagementReviewFrontmatterSchema,
|
|
430
1601
|
MitigationSchema,
|
|
431
1602
|
MitigationTargetSchema,
|
|
432
1603
|
NON_REGULATED_FOLDERS,
|
|
433
1604
|
PlannedAuditEntrySchema,
|
|
434
1605
|
PostMarketFeedbackCategorySchema,
|
|
435
|
-
|
|
1606
|
+
PostMarketFeedbackFrontmatterSchema,
|
|
436
1607
|
PostMarketFeedbackSeveritySchema,
|
|
437
|
-
|
|
438
|
-
|
|
1608
|
+
PostMarketSurveillancePlanFrontmatterSchema,
|
|
1609
|
+
ProductDevelopmentPlanFrontmatterSchema,
|
|
439
1610
|
QMS_DOCUMENT_TYPES,
|
|
440
|
-
|
|
1611
|
+
REQUIRED_SECTIONS,
|
|
441
1612
|
RegulatoryFrameworkSchema,
|
|
442
1613
|
ReleaseNotesAudienceSchema,
|
|
443
|
-
|
|
444
|
-
|
|
1614
|
+
ReleaseNotesFrontmatterSchema,
|
|
1615
|
+
ReleasePlanFrontmatterSchema,
|
|
445
1616
|
ReleaseReviewConfigSchema,
|
|
446
1617
|
RepoConfigSchema,
|
|
447
1618
|
RequirementFormatSchema,
|
|
448
|
-
|
|
1619
|
+
RequirementFrontmatterSchema,
|
|
449
1620
|
RequirementFulfillmentTypeSchema,
|
|
450
1621
|
RequirementTypeSchema,
|
|
451
1622
|
RetentionPolicySchema,
|
|
452
1623
|
RiskDocumentStatusSchema,
|
|
453
|
-
|
|
1624
|
+
RiskEntryFrontmatterSchema,
|
|
454
1625
|
RiskGapCodeSchema,
|
|
455
1626
|
RiskGapSeveritySchema,
|
|
456
|
-
|
|
1627
|
+
RiskManagementPlanFrontmatterSchema,
|
|
457
1628
|
RiskMatrixConfigSchema,
|
|
458
1629
|
SCHEMA_MAP,
|
|
459
1630
|
SafetyClassSchema,
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
1631
|
+
SbomFrontmatterSchema,
|
|
1632
|
+
SoftwareDevelopmentPlanFrontmatterSchema,
|
|
1633
|
+
SoftwareMaintenancePlanFrontmatterSchema,
|
|
1634
|
+
SoftwareTestPlanFrontmatterSchema,
|
|
1635
|
+
SoupRegisterFrontmatterSchema,
|
|
1636
|
+
SummativeEvaluationFrontmatterSchema,
|
|
1637
|
+
TaskAnalysisFrontmatterSchema,
|
|
467
1638
|
TestPhaseSchema,
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
1639
|
+
TestProtocolFrontmatterSchema,
|
|
1640
|
+
TestReportFrontmatterSchema,
|
|
1641
|
+
UsabilityEvaluationFrontmatterSchema,
|
|
1642
|
+
UsabilityPlanFrontmatterSchema,
|
|
1643
|
+
UseSpecificationFrontmatterSchema,
|
|
1644
|
+
UserNeedFrontmatterSchema,
|
|
474
1645
|
UserNeedPrioritySchema,
|
|
475
1646
|
findFolderRule,
|
|
476
1647
|
getEffectiveRetentionYears,
|