@pactosigna/schemas 0.1.5 → 0.1.7

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/cli.js CHANGED
@@ -7,10 +7,10 @@ import fs from "fs";
7
7
  // src/validate-document.ts
8
8
  import matter from "gray-matter";
9
9
 
10
- // ../shared/dist/schemas/index.js
11
- import { z as z24 } from "zod";
10
+ // ../contracts/dist/commonSchemas.js
11
+ import { z as z2 } from "zod";
12
12
 
13
- // ../shared/dist/schemas/common-enums.js
13
+ // ../contracts/dist/domain-schemas/common-enums.js
14
14
  import { z } from "zod";
15
15
  var RegulatoryFrameworkSchema = z.enum([
16
16
  "ISO_13485",
@@ -106,9 +106,224 @@ var LinkTypeSchema = z.enum([
106
106
  var AcceptabilityStatusSchema = z.enum(["acceptable", "review_required", "unacceptable"]);
107
107
  var DepartmentRoleSchema = z.enum(["manager", "member"]);
108
108
 
109
- // ../shared/dist/schemas/risk.js
110
- import { z as z2 } from "zod";
111
- var RiskDocumentStatusSchema = z2.enum([
109
+ // ../contracts/dist/commonSchemas.js
110
+ var ErrorResponseSchema = z2.object({
111
+ error: z2.string(),
112
+ code: z2.string().optional(),
113
+ details: z2.record(z2.unknown()).optional()
114
+ });
115
+ var PaginationParamsSchema = z2.object({
116
+ limit: z2.coerce.number().min(1).max(100).optional().default(50),
117
+ offset: z2.coerce.number().min(0).optional().default(0)
118
+ });
119
+
120
+ // ../contracts/dist/identity/requests.js
121
+ import { z as z3 } from "zod";
122
+ var RegulatoryFrameworkSchema2 = z3.enum([
123
+ "ISO_13485",
124
+ "IEC_62304",
125
+ "FDA_21_CFR_820",
126
+ "QMSR",
127
+ "EU_MDR",
128
+ "ISO_14971",
129
+ "AI_ACT"
130
+ ]);
131
+ var RoleSchema = z3.enum(["admin", "member", "auditor"]);
132
+ var DepartmentRoleSchema2 = z3.enum(["manager", "member"]);
133
+ var AuditorTypeSchema = z3.enum(["internal", "external"]);
134
+ var ReviewerRuleSchema = z3.object({
135
+ documentType: z3.string(),
136
+ requiredDepartments: z3.array(z3.string()),
137
+ finalApproverDepartment: z3.string()
138
+ });
139
+ var CreateOrganizationRequestSchema = z3.object({
140
+ name: z3.string().min(3).max(100),
141
+ frameworks: z3.array(RegulatoryFrameworkSchema2).min(1),
142
+ department: z3.string().min(1)
143
+ });
144
+ var ChecklistTemplateItemSchema = z3.object({
145
+ id: z3.string().min(1),
146
+ label: z3.string().min(1).max(500),
147
+ sortOrder: z3.number().int().nonnegative()
148
+ });
149
+ var UpdateOrganizationSettingsRequestSchema = z3.object({
150
+ name: z3.string().min(1).optional(),
151
+ frameworks: z3.array(RegulatoryFrameworkSchema2).optional(),
152
+ departments: z3.array(z3.string()).optional(),
153
+ reviewerRules: z3.array(ReviewerRuleSchema).optional(),
154
+ releaseChecklistTemplate: z3.array(ChecklistTemplateItemSchema).max(30).optional()
155
+ });
156
+ var UpdateMemberRequestSchema = z3.object({
157
+ department: z3.string().optional(),
158
+ role: RoleSchema.optional(),
159
+ departmentRole: DepartmentRoleSchema2.optional()
160
+ });
161
+ var InviteUserRequestSchema = z3.object({
162
+ email: z3.string().email(),
163
+ department: z3.string().min(1),
164
+ role: RoleSchema,
165
+ departmentRole: DepartmentRoleSchema2.optional(),
166
+ auditorType: AuditorTypeSchema.optional(),
167
+ accessExpiresAt: z3.string().datetime().optional()
168
+ }).superRefine((data, ctx) => {
169
+ if (data.role === "auditor" && !data.auditorType) {
170
+ ctx.addIssue({
171
+ code: z3.ZodIssueCode.custom,
172
+ message: "auditorType is required when role is auditor",
173
+ path: ["auditorType"]
174
+ });
175
+ }
176
+ if (data.role !== "auditor" && data.auditorType) {
177
+ ctx.addIssue({
178
+ code: z3.ZodIssueCode.custom,
179
+ message: "auditorType is only valid for auditor role",
180
+ path: ["auditorType"]
181
+ });
182
+ }
183
+ if (data.role !== "auditor" && data.accessExpiresAt) {
184
+ ctx.addIssue({
185
+ code: z3.ZodIssueCode.custom,
186
+ message: "accessExpiresAt is only valid for auditor role",
187
+ path: ["accessExpiresAt"]
188
+ });
189
+ }
190
+ });
191
+ var AcceptInviteRequestSchema = z3.object({
192
+ token: z3.string().min(1)
193
+ });
194
+ var UpdateProfileRequestSchema = z3.object({
195
+ displayName: z3.string().min(1).max(100).optional()
196
+ });
197
+ var OrgIdParamSchema = z3.object({
198
+ orgId: z3.string().min(1)
199
+ });
200
+ var MemberIdParamSchema = z3.object({
201
+ orgId: z3.string().min(1),
202
+ memberId: z3.string().min(1)
203
+ });
204
+ var InviteIdParamSchema = z3.object({
205
+ orgId: z3.string().min(1),
206
+ inviteId: z3.string().min(1)
207
+ });
208
+
209
+ // ../contracts/dist/identity/responses.js
210
+ import { z as z5 } from "zod";
211
+
212
+ // ../contracts/dist/billing/responses.js
213
+ import { z as z4 } from "zod";
214
+ var SubscriptionStatusSchema = z4.enum([
215
+ "active",
216
+ "trialing",
217
+ "past_due",
218
+ "canceled",
219
+ "incomplete"
220
+ ]);
221
+ var SubscriptionResponseSchema = z4.object({
222
+ status: SubscriptionStatusSchema,
223
+ currentPeriodEnd: z4.string(),
224
+ cancelAtPeriodEnd: z4.boolean()
225
+ });
226
+ var CreateCheckoutSessionResponseSchema = z4.object({
227
+ checkoutUrl: z4.string().url()
228
+ });
229
+ var CreatePortalSessionResponseSchema = z4.object({
230
+ portalUrl: z4.string().url()
231
+ });
232
+
233
+ // ../contracts/dist/identity/responses.js
234
+ var MemberStatusSchema = z5.enum(["active", "suspended", "removed"]);
235
+ var InviteStatusSchema = z5.enum(["pending", "accepted", "expired", "revoked"]);
236
+ var MemberResponseSchema = z5.object({
237
+ id: z5.string(),
238
+ email: z5.string().email(),
239
+ emailVerified: z5.boolean(),
240
+ displayName: z5.string(),
241
+ department: z5.string(),
242
+ departmentRole: DepartmentRoleSchema2.optional(),
243
+ role: RoleSchema,
244
+ auditorType: AuditorTypeSchema.optional(),
245
+ accessExpiresAt: z5.string().optional(),
246
+ // ISO date (for external auditors)
247
+ status: MemberStatusSchema,
248
+ joinedAt: z5.string()
249
+ // ISO date
250
+ });
251
+ var InviteResponseSchema = z5.object({
252
+ id: z5.string(),
253
+ email: z5.string().email(),
254
+ department: z5.string(),
255
+ role: RoleSchema,
256
+ status: InviteStatusSchema,
257
+ expiresAt: z5.string(),
258
+ // ISO date
259
+ createdAt: z5.string()
260
+ // ISO date
261
+ });
262
+ var OrganizationResponseSchema = z5.object({
263
+ id: z5.string(),
264
+ name: z5.string(),
265
+ role: RoleSchema,
266
+ department: z5.string(),
267
+ gitHubAppInstallationId: z5.number().optional(),
268
+ gitHubOrgName: z5.string().optional(),
269
+ subscription: SubscriptionResponseSchema.optional()
270
+ });
271
+ var OrganizationSettingsResponseSchema = z5.object({
272
+ frameworks: z5.array(z5.string()),
273
+ departments: z5.array(z5.string()),
274
+ defaultSafetyClass: SafetyClassSchema,
275
+ reviewerRules: z5.array(ReviewerRuleSchema),
276
+ releaseChecklistTemplate: z5.array(ChecklistTemplateItemSchema).optional()
277
+ });
278
+ var CreateOrganizationResponseSchema = z5.object({
279
+ organizationId: z5.string()
280
+ });
281
+ var GetOrganizationsResponseSchema = z5.object({
282
+ organizations: z5.array(OrganizationResponseSchema)
283
+ });
284
+ var GetMembersResponseSchema = z5.object({
285
+ members: z5.array(MemberResponseSchema)
286
+ });
287
+ var GetInvitesResponseSchema = z5.object({
288
+ invites: z5.array(InviteResponseSchema)
289
+ });
290
+ var AcceptInviteResponseSchema = z5.object({
291
+ organizationId: z5.string(),
292
+ organizationName: z5.string()
293
+ });
294
+ var PendingInviteResponseSchema = z5.object({
295
+ id: z5.string(),
296
+ organizationId: z5.string(),
297
+ organizationName: z5.string(),
298
+ invitedByName: z5.string(),
299
+ role: RoleSchema,
300
+ department: z5.string(),
301
+ createdAt: z5.string(),
302
+ expiresAt: z5.string()
303
+ });
304
+ var GetPendingInvitesResponseSchema = z5.object({
305
+ invites: z5.array(PendingInviteResponseSchema)
306
+ });
307
+ var SuccessResponseSchema = z5.object({
308
+ success: z5.boolean()
309
+ });
310
+ var ValidateInviteResponseSchema = z5.object({
311
+ organizationName: z5.string(),
312
+ status: InviteStatusSchema
313
+ });
314
+ var CreateInviteResponseSchema = z5.object({
315
+ inviteId: z5.string()
316
+ });
317
+
318
+ // ../contracts/dist/identity/legal-requests.js
319
+ import { z as z29 } from "zod";
320
+
321
+ // ../contracts/dist/domain-schemas/index.js
322
+ import { z as z28 } from "zod";
323
+
324
+ // ../contracts/dist/domain-schemas/risk.js
325
+ import { z as z6 } from "zod";
326
+ var RiskDocumentStatusSchema = z6.enum([
112
327
  "draft",
113
328
  "in_review",
114
329
  "approved",
@@ -116,12 +331,12 @@ var RiskDocumentStatusSchema = z2.enum([
116
331
  "archived",
117
332
  "example"
118
333
  ]);
119
- var MitigationTargetSchema = z2.enum([
334
+ var MitigationTargetSchema = z6.enum([
120
335
  "sequence_probability",
121
336
  "harm_probability",
122
337
  "severity"
123
338
  ]);
124
- var RiskGapCodeSchema = z2.enum([
339
+ var RiskGapCodeSchema = z6.enum([
125
340
  "hazard_no_situation",
126
341
  "situation_no_harm",
127
342
  "hazard_not_analyzed",
@@ -140,31 +355,31 @@ var RiskGapCodeSchema = z2.enum([
140
355
  "haz_invalid_category",
141
356
  "category_not_approved"
142
357
  ]);
143
- var RiskGapSeveritySchema = z2.enum(["error", "warning"]);
144
- var MitigationSchema = z2.object({
145
- control: z2.string().min(1),
358
+ var RiskGapSeveritySchema = z6.enum(["error", "warning"]);
359
+ var MitigationSchema = z6.object({
360
+ control: z6.string().min(1),
146
361
  reduces: MitigationTargetSchema,
147
- for_harm: z2.string().optional()
148
- });
149
- var HarmAssessmentSchema = z2.object({
150
- harm: z2.string().min(1),
151
- inherent_probability: z2.number().int().min(1).max(5).optional(),
152
- inherent_exploitability: z2.number().int().min(1).max(5).optional(),
153
- residual_probability: z2.number().int().min(1).max(5).optional(),
154
- residual_exploitability: z2.number().int().min(1).max(5).optional(),
155
- residual_severity_override: z2.number().int().min(1).max(5).optional()
156
- });
157
- var RiskEntryFrontmatterSchema = z2.object({
158
- type: z2.enum(["software_risk", "usability_risk", "security_risk"]),
159
- id: z2.string().min(1),
160
- title: z2.string().min(1),
362
+ for_harm: z6.string().optional()
363
+ });
364
+ var HarmAssessmentSchema = z6.object({
365
+ harm: z6.string().min(1),
366
+ inherent_probability: z6.number().int().min(1).max(5).optional(),
367
+ inherent_exploitability: z6.number().int().min(1).max(5).optional(),
368
+ residual_probability: z6.number().int().min(1).max(5).optional(),
369
+ residual_exploitability: z6.number().int().min(1).max(5).optional(),
370
+ residual_severity_override: z6.number().int().min(1).max(5).optional()
371
+ });
372
+ var RiskEntryFrontmatterSchema = z6.object({
373
+ type: z6.enum(["software_risk", "usability_risk", "security_risk"]),
374
+ id: z6.string().min(1),
375
+ title: z6.string().min(1),
161
376
  status: RiskDocumentStatusSchema,
162
- analyzes: z2.string().min(1),
163
- hazardous_situation: z2.string().min(1),
164
- harm_assessments: z2.array(HarmAssessmentSchema).min(1),
165
- mitigations: z2.array(MitigationSchema).optional(),
166
- cvss_score: z2.number().min(0).max(10).optional(),
167
- 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()
377
+ analyzes: z6.string().min(1),
378
+ hazardous_situation: z6.string().min(1),
379
+ harm_assessments: z6.array(HarmAssessmentSchema).min(1),
380
+ mitigations: z6.array(MitigationSchema).optional(),
381
+ cvss_score: z6.number().min(0).max(10).optional(),
382
+ cvss_vector: z6.string().regex(/^CVSS:3\.[01]\/AV:[NALP]\/AC:[LH]\/PR:[NLH]\/UI:[NR]\/S:[UC]\/C:[NLH]\/I:[NLH]\/A:[NLH]$/).optional()
168
383
  }).refine((data) => {
169
384
  if (data.type === "security_risk") {
170
385
  return data.harm_assessments.every((ha) => ha.inherent_exploitability != null);
@@ -173,242 +388,118 @@ var RiskEntryFrontmatterSchema = z2.object({
173
388
  }, {
174
389
  message: "Security risks must use inherent_exploitability; software/usability risks must use inherent_probability"
175
390
  });
176
- var HazardFrontmatterSchema = z2.object({
177
- type: z2.enum(["haz_soe_software", "haz_soe_security"]),
178
- id: z2.string().min(1),
179
- title: z2.string().min(1),
391
+ var HazardFrontmatterSchema = z6.object({
392
+ type: z6.enum(["haz_soe_software", "haz_soe_security"]),
393
+ id: z6.string().min(1),
394
+ title: z6.string().min(1),
180
395
  status: RiskDocumentStatusSchema,
181
- leads_to: z2.array(z2.string()).optional(),
396
+ leads_to: z6.array(z6.string()).optional(),
182
397
  // sFMEA fields
183
- failure_mode: z2.string().optional(),
184
- cause: z2.string().optional(),
185
- detection_method: z2.string().optional(),
398
+ failure_mode: z6.string().optional(),
399
+ cause: z6.string().optional(),
400
+ detection_method: z6.string().optional(),
186
401
  // STRIDE fields
187
- threat_category: z2.string().optional(),
188
- attack_vector: z2.string().optional(),
402
+ threat_category: z6.string().optional(),
403
+ attack_vector: z6.string().optional(),
189
404
  // Hazard category reference (HC-xxx)
190
- hazard_category: z2.string().optional()
405
+ hazard_category: z6.string().optional()
191
406
  });
192
- var HazardCategoryFrontmatterSchema = z2.object({
193
- type: z2.literal("hazard_category"),
194
- id: z2.string().min(1),
195
- title: z2.string().min(1),
407
+ var HazardCategoryFrontmatterSchema = z6.object({
408
+ type: z6.literal("hazard_category"),
409
+ id: z6.string().min(1),
410
+ title: z6.string().min(1),
196
411
  status: RiskDocumentStatusSchema,
197
- source: z2.string().optional()
412
+ source: z6.string().optional()
198
413
  });
199
- var HazardousSituationFrontmatterSchema = z2.object({
200
- type: z2.literal("hazardous_situation"),
201
- id: z2.string().min(1),
202
- title: z2.string().min(1),
414
+ var HazardousSituationFrontmatterSchema = z6.object({
415
+ type: z6.literal("hazardous_situation"),
416
+ id: z6.string().min(1),
417
+ title: z6.string().min(1),
203
418
  status: RiskDocumentStatusSchema,
204
- results_in: z2.array(z2.string()).optional()
419
+ results_in: z6.array(z6.string()).optional()
205
420
  });
206
- var HarmFrontmatterSchema = z2.object({
207
- type: z2.literal("harm"),
208
- id: z2.string().min(1),
209
- title: z2.string().min(1),
421
+ var HarmFrontmatterSchema = z6.object({
422
+ type: z6.literal("harm"),
423
+ id: z6.string().min(1),
424
+ title: z6.string().min(1),
210
425
  status: RiskDocumentStatusSchema,
211
- severity: z2.number().int().min(1).max(5),
212
- category: z2.string().optional()
213
- });
214
- var RiskMatrixConfigSchema = z2.object({
215
- version: z2.number(),
216
- labels: z2.object({
217
- severity: z2.array(z2.string()).length(5),
218
- probability: z2.array(z2.string()).length(5),
219
- exploitability: z2.array(z2.string()).length(5).optional()
426
+ severity: z6.number().int().min(1).max(5),
427
+ category: z6.string().optional()
428
+ });
429
+ var RiskMatrixConfigSchema = z6.object({
430
+ version: z6.number(),
431
+ labels: z6.object({
432
+ severity: z6.array(z6.string()).length(5),
433
+ probability: z6.array(z6.string()).length(5),
434
+ exploitability: z6.array(z6.string()).length(5).optional()
220
435
  }),
221
- acceptability: z2.object({
222
- unacceptable: z2.array(z2.tuple([z2.number(), z2.number()])),
223
- review_required: z2.array(z2.tuple([z2.number(), z2.number()])).optional()
436
+ acceptability: z6.object({
437
+ unacceptable: z6.array(z6.tuple([z6.number(), z6.number()])),
438
+ review_required: z6.array(z6.tuple([z6.number(), z6.number()])).optional()
224
439
  }),
225
- overrides: z2.record(z2.object({
226
- unacceptable: z2.array(z2.tuple([z2.number(), z2.number()])),
227
- review_required: z2.array(z2.tuple([z2.number(), z2.number()])).optional()
440
+ overrides: z6.record(z6.object({
441
+ unacceptable: z6.array(z6.tuple([z6.number(), z6.number()])),
442
+ review_required: z6.array(z6.tuple([z6.number(), z6.number()])).optional()
228
443
  })).optional()
229
444
  });
230
445
 
231
- // ../shared/dist/schemas/usability.js
232
- import { z as z3 } from "zod";
233
- var UsabilityPlanFrontmatterSchema = z3.object({
234
- type: z3.literal("usability_plan"),
235
- id: z3.string().min(1),
236
- title: z3.string().min(1),
237
- status: RiskDocumentStatusSchema,
238
- author: z3.string().optional(),
239
- reviewers: z3.array(z3.string()).optional(),
240
- approvers: z3.array(z3.string()).optional()
241
- });
242
- var UseSpecificationFrontmatterSchema = z3.object({
243
- type: z3.literal("use_specification"),
244
- id: z3.string().min(1),
245
- title: z3.string().min(1),
246
- status: RiskDocumentStatusSchema,
247
- user_group: z3.string().min(1),
248
- author: z3.string().optional(),
249
- reviewers: z3.array(z3.string()).optional(),
250
- approvers: z3.array(z3.string()).optional()
251
- });
252
- var TaskAnalysisFrontmatterSchema = z3.object({
253
- type: z3.literal("task_analysis"),
254
- id: z3.string().min(1),
255
- title: z3.string().min(1),
256
- status: RiskDocumentStatusSchema,
257
- user_group: z3.string().min(1),
258
- critical_task: z3.boolean(),
259
- author: z3.string().optional(),
260
- reviewers: z3.array(z3.string()).optional(),
261
- approvers: z3.array(z3.string()).optional()
262
- });
263
- var UsabilityEvaluationFrontmatterSchema = z3.object({
264
- type: z3.literal("usability_evaluation"),
265
- id: z3.string().min(1),
266
- title: z3.string().min(1),
267
- status: RiskDocumentStatusSchema,
268
- result: z3.enum(["pass", "fail", "pass_with_findings"]).optional(),
269
- author: z3.string().optional(),
270
- reviewers: z3.array(z3.string()).optional(),
271
- approvers: z3.array(z3.string()).optional()
272
- });
273
- var SummativeEvaluationFrontmatterSchema = z3.object({
274
- type: z3.literal("summative_evaluation"),
275
- id: z3.string().min(1),
276
- title: z3.string().min(1),
277
- status: RiskDocumentStatusSchema,
278
- result: z3.enum(["pass", "fail", "pass_with_findings"]).optional(),
279
- author: z3.string().optional(),
280
- reviewers: z3.array(z3.string()).optional(),
281
- approvers: z3.array(z3.string()).optional()
282
- });
283
-
284
- // ../shared/dist/schemas/risk-management-plan.js
285
- import { z as z4 } from "zod";
286
- var RiskManagementPlanFrontmatterSchema = z4.object({
287
- type: z4.literal("risk_management_plan"),
288
- id: z4.string().min(1),
289
- title: z4.string().min(1),
446
+ // ../contracts/dist/domain-schemas/usability.js
447
+ import { z as z7 } from "zod";
448
+ var UsabilityPlanFrontmatterSchema = z7.object({
449
+ type: z7.literal("usability_plan"),
450
+ id: z7.string().min(1),
451
+ title: z7.string().min(1),
290
452
  status: RiskDocumentStatusSchema,
291
- author: z4.string().optional(),
292
- reviewers: z4.array(z4.string()).optional(),
293
- approvers: z4.array(z4.string()).optional()
453
+ author: z7.string().optional(),
454
+ reviewers: z7.array(z7.string()).optional(),
455
+ approvers: z7.array(z7.string()).optional()
294
456
  });
295
-
296
- // ../shared/dist/schemas/software-lifecycle.js
297
- import { z as z5 } from "zod";
298
- var SoftwareDevelopmentPlanFrontmatterSchema = z5.object({
299
- type: z5.literal("software_development_plan"),
300
- id: z5.string().min(1),
301
- title: z5.string().min(1),
302
- status: RiskDocumentStatusSchema,
303
- author: z5.string().optional(),
304
- reviewers: z5.array(z5.string()).optional(),
305
- approvers: z5.array(z5.string()).optional()
306
- });
307
- var SoftwareMaintenancePlanFrontmatterSchema = z5.object({
308
- type: z5.literal("software_maintenance_plan"),
309
- id: z5.string().min(1),
310
- title: z5.string().min(1),
311
- status: RiskDocumentStatusSchema,
312
- author: z5.string().optional(),
313
- reviewers: z5.array(z5.string()).optional(),
314
- approvers: z5.array(z5.string()).optional()
315
- });
316
- var SoupRegisterFrontmatterSchema = z5.object({
317
- type: z5.literal("soup_register"),
318
- id: z5.string().min(1),
319
- title: z5.string().min(1),
320
- status: RiskDocumentStatusSchema,
321
- author: z5.string().optional(),
322
- reviewers: z5.array(z5.string()).optional(),
323
- approvers: z5.array(z5.string()).optional()
324
- });
325
- var SoftwareTestPlanFrontmatterSchema = z5.object({
326
- type: z5.literal("software_test_plan"),
327
- id: z5.string().min(1),
328
- title: z5.string().min(1),
457
+ var UseSpecificationFrontmatterSchema = z7.object({
458
+ type: z7.literal("use_specification"),
459
+ id: z7.string().min(1),
460
+ title: z7.string().min(1),
329
461
  status: RiskDocumentStatusSchema,
330
- author: z5.string().optional(),
331
- reviewers: z5.array(z5.string()).optional(),
332
- approvers: z5.array(z5.string()).optional()
333
- });
334
-
335
- // ../shared/dist/schemas/architecture.js
336
- import { z as z6 } from "zod";
337
- var SoftwareItemTypeSchema = z6.enum(["system", "subsystem", "component", "unit"]);
338
- var SegregationSchema = z6.object({
339
- mechanism: z6.string().min(1),
340
- rationale: z6.string().min(1)
462
+ user_group: z7.string().min(1),
463
+ author: z7.string().optional(),
464
+ reviewers: z7.array(z7.string()).optional(),
465
+ approvers: z7.array(z7.string()).optional()
341
466
  });
342
- var ArchitectureFrontmatterSchema = z6.object({
343
- id: z6.string().min(1),
344
- title: z6.string().min(1),
345
- type: z6.literal("architecture"),
467
+ var TaskAnalysisFrontmatterSchema = z7.object({
468
+ type: z7.literal("task_analysis"),
469
+ id: z7.string().min(1),
470
+ title: z7.string().min(1),
346
471
  status: RiskDocumentStatusSchema,
347
- software_item_type: SoftwareItemTypeSchema.optional(),
348
- parent_item: z6.string().optional(),
349
- safety_class: z6.enum(["A", "B", "C"]).optional(),
350
- segregation: SegregationSchema.optional(),
351
- author: z6.string().optional(),
352
- reviewers: z6.array(z6.string()).optional(),
353
- approvers: z6.array(z6.string()).optional()
472
+ user_group: z7.string().min(1),
473
+ critical_task: z7.boolean(),
474
+ author: z7.string().optional(),
475
+ reviewers: z7.array(z7.string()).optional(),
476
+ approvers: z7.array(z7.string()).optional()
354
477
  });
355
- var DetailedDesignFrontmatterSchema = z6.object({
356
- id: z6.string().min(1),
357
- title: z6.string().min(1),
358
- type: z6.literal("detailed_design"),
478
+ var UsabilityEvaluationFrontmatterSchema = z7.object({
479
+ type: z7.literal("usability_evaluation"),
480
+ id: z7.string().min(1),
481
+ title: z7.string().min(1),
359
482
  status: RiskDocumentStatusSchema,
360
- software_item_type: SoftwareItemTypeSchema.optional(),
361
- parent_item: z6.string().optional(),
362
- safety_class: z6.enum(["A", "B", "C"]).optional(),
363
- segregation: SegregationSchema.optional(),
364
- author: z6.string().optional(),
365
- reviewers: z6.array(z6.string()).optional(),
366
- approvers: z6.array(z6.string()).optional()
483
+ result: z7.enum(["pass", "fail", "pass_with_findings"]).optional(),
484
+ author: z7.string().optional(),
485
+ reviewers: z7.array(z7.string()).optional(),
486
+ approvers: z7.array(z7.string()).optional()
367
487
  });
368
-
369
- // ../shared/dist/schemas/anomaly.js
370
- import { z as z7 } from "zod";
371
- var AnomalyCategorySchema = z7.enum([
372
- "bug",
373
- "security_vulnerability",
374
- "regression",
375
- "performance"
376
- ]);
377
- var AnomalySeveritySchema = z7.enum(["critical", "major", "minor"]);
378
- var AnomalyDispositionSchema = z7.enum([
379
- "open",
380
- "investigating",
381
- "resolved",
382
- "deferred",
383
- "will_not_fix"
384
- ]);
385
- var AnomalyFrontmatterSchema = z7.object({
386
- type: z7.literal("anomaly"),
488
+ var SummativeEvaluationFrontmatterSchema = z7.object({
489
+ type: z7.literal("summative_evaluation"),
387
490
  id: z7.string().min(1),
388
491
  title: z7.string().min(1),
389
492
  status: RiskDocumentStatusSchema,
390
- category: AnomalyCategorySchema,
391
- severity: AnomalySeveritySchema,
392
- disposition: AnomalyDispositionSchema,
393
- affected_version: z7.string().optional(),
493
+ result: z7.enum(["pass", "fail", "pass_with_findings"]).optional(),
394
494
  author: z7.string().optional(),
395
495
  reviewers: z7.array(z7.string()).optional(),
396
496
  approvers: z7.array(z7.string()).optional()
397
497
  });
398
498
 
399
- // ../shared/dist/schemas/cybersecurity.js
499
+ // ../contracts/dist/domain-schemas/risk-management-plan.js
400
500
  import { z as z8 } from "zod";
401
- var CybersecurityPlanFrontmatterSchema = z8.object({
402
- type: z8.literal("cybersecurity_plan"),
403
- id: z8.string().min(1),
404
- title: z8.string().min(1),
405
- status: RiskDocumentStatusSchema,
406
- author: z8.string().optional(),
407
- reviewers: z8.array(z8.string()).optional(),
408
- approvers: z8.array(z8.string()).optional()
409
- });
410
- var SbomFrontmatterSchema = z8.object({
411
- type: z8.literal("sbom"),
501
+ var RiskManagementPlanFrontmatterSchema = z8.object({
502
+ type: z8.literal("risk_management_plan"),
412
503
  id: z8.string().min(1),
413
504
  title: z8.string().min(1),
414
505
  status: RiskDocumentStatusSchema,
@@ -417,10 +508,28 @@ var SbomFrontmatterSchema = z8.object({
417
508
  approvers: z8.array(z8.string()).optional()
418
509
  });
419
510
 
420
- // ../shared/dist/schemas/clinical.js
511
+ // ../contracts/dist/domain-schemas/software-lifecycle.js
421
512
  import { z as z9 } from "zod";
422
- var ClinicalEvaluationPlanFrontmatterSchema = z9.object({
423
- type: z9.literal("clinical_evaluation_plan"),
513
+ var SoftwareDevelopmentPlanFrontmatterSchema = z9.object({
514
+ type: z9.literal("software_development_plan"),
515
+ id: z9.string().min(1),
516
+ title: z9.string().min(1),
517
+ status: RiskDocumentStatusSchema,
518
+ author: z9.string().optional(),
519
+ reviewers: z9.array(z9.string()).optional(),
520
+ approvers: z9.array(z9.string()).optional()
521
+ });
522
+ var SoftwareMaintenancePlanFrontmatterSchema = z9.object({
523
+ type: z9.literal("software_maintenance_plan"),
524
+ id: z9.string().min(1),
525
+ title: z9.string().min(1),
526
+ status: RiskDocumentStatusSchema,
527
+ author: z9.string().optional(),
528
+ reviewers: z9.array(z9.string()).optional(),
529
+ approvers: z9.array(z9.string()).optional()
530
+ });
531
+ var SoupRegisterFrontmatterSchema = z9.object({
532
+ type: z9.literal("soup_register"),
424
533
  id: z9.string().min(1),
425
534
  title: z9.string().min(1),
426
535
  status: RiskDocumentStatusSchema,
@@ -428,8 +537,8 @@ var ClinicalEvaluationPlanFrontmatterSchema = z9.object({
428
537
  reviewers: z9.array(z9.string()).optional(),
429
538
  approvers: z9.array(z9.string()).optional()
430
539
  });
431
- var ClinicalEvaluationReportFrontmatterSchema = z9.object({
432
- type: z9.literal("clinical_evaluation_report"),
540
+ var SoftwareTestPlanFrontmatterSchema = z9.object({
541
+ type: z9.literal("software_test_plan"),
433
542
  id: z9.string().min(1),
434
543
  title: z9.string().min(1),
435
544
  status: RiskDocumentStatusSchema,
@@ -438,55 +547,74 @@ var ClinicalEvaluationReportFrontmatterSchema = z9.object({
438
547
  approvers: z9.array(z9.string()).optional()
439
548
  });
440
549
 
441
- // ../shared/dist/schemas/post-market.js
550
+ // ../contracts/dist/domain-schemas/architecture.js
442
551
  import { z as z10 } from "zod";
443
- var PostMarketSurveillancePlanFrontmatterSchema = z10.object({
444
- type: z10.literal("post_market_surveillance_plan"),
552
+ var SoftwareItemTypeSchema = z10.enum(["system", "subsystem", "component", "unit"]);
553
+ var SegregationSchema = z10.object({
554
+ mechanism: z10.string().min(1),
555
+ rationale: z10.string().min(1)
556
+ });
557
+ var ArchitectureFrontmatterSchema = z10.object({
445
558
  id: z10.string().min(1),
446
559
  title: z10.string().min(1),
560
+ type: z10.literal("architecture"),
447
561
  status: RiskDocumentStatusSchema,
562
+ software_item_type: SoftwareItemTypeSchema.optional(),
563
+ parent_item: z10.string().optional(),
564
+ safety_class: z10.enum(["A", "B", "C"]).optional(),
565
+ segregation: SegregationSchema.optional(),
448
566
  author: z10.string().optional(),
449
567
  reviewers: z10.array(z10.string()).optional(),
450
568
  approvers: z10.array(z10.string()).optional()
451
569
  });
452
- var PostMarketFeedbackCategorySchema = z10.enum([
453
- "complaint",
454
- "field_observation",
455
- "clinical_followup",
456
- "trend_report"
457
- ]);
458
- var PostMarketFeedbackSeveritySchema = z10.enum(["low", "medium", "high", "critical"]);
459
- var PostMarketFeedbackFrontmatterSchema = z10.object({
460
- type: z10.literal("post_market_feedback"),
570
+ var DetailedDesignFrontmatterSchema = z10.object({
461
571
  id: z10.string().min(1),
462
572
  title: z10.string().min(1),
573
+ type: z10.literal("detailed_design"),
463
574
  status: RiskDocumentStatusSchema,
464
- category: PostMarketFeedbackCategorySchema,
465
- severity: PostMarketFeedbackSeveritySchema,
466
- device: z10.string().optional(),
467
- reporting_period: z10.string().optional(),
575
+ software_item_type: SoftwareItemTypeSchema.optional(),
576
+ parent_item: z10.string().optional(),
577
+ safety_class: z10.enum(["A", "B", "C"]).optional(),
578
+ segregation: SegregationSchema.optional(),
468
579
  author: z10.string().optional(),
469
580
  reviewers: z10.array(z10.string()).optional(),
470
581
  approvers: z10.array(z10.string()).optional()
471
582
  });
472
583
 
473
- // ../shared/dist/schemas/labeling.js
584
+ // ../contracts/dist/domain-schemas/anomaly.js
474
585
  import { z as z11 } from "zod";
475
- var LabelingFrontmatterSchema = z11.object({
476
- type: z11.literal("labeling"),
586
+ var AnomalyCategorySchema = z11.enum([
587
+ "bug",
588
+ "security_vulnerability",
589
+ "regression",
590
+ "performance"
591
+ ]);
592
+ var AnomalySeveritySchema = z11.enum(["critical", "major", "minor"]);
593
+ var AnomalyDispositionSchema = z11.enum([
594
+ "open",
595
+ "investigating",
596
+ "resolved",
597
+ "deferred",
598
+ "will_not_fix"
599
+ ]);
600
+ var AnomalyFrontmatterSchema = z11.object({
601
+ type: z11.literal("anomaly"),
477
602
  id: z11.string().min(1),
478
603
  title: z11.string().min(1),
479
604
  status: RiskDocumentStatusSchema,
480
- label_type: z11.enum(["ifu", "product_label", "packaging_label"]).optional(),
605
+ category: AnomalyCategorySchema,
606
+ severity: AnomalySeveritySchema,
607
+ disposition: AnomalyDispositionSchema,
608
+ affected_version: z11.string().optional(),
481
609
  author: z11.string().optional(),
482
610
  reviewers: z11.array(z11.string()).optional(),
483
611
  approvers: z11.array(z11.string()).optional()
484
612
  });
485
613
 
486
- // ../shared/dist/schemas/product.js
614
+ // ../contracts/dist/domain-schemas/cybersecurity.js
487
615
  import { z as z12 } from "zod";
488
- var ProductDevelopmentPlanFrontmatterSchema = z12.object({
489
- type: z12.literal("product_development_plan"),
616
+ var CybersecurityPlanFrontmatterSchema = z12.object({
617
+ type: z12.literal("cybersecurity_plan"),
490
618
  id: z12.string().min(1),
491
619
  title: z12.string().min(1),
492
620
  status: RiskDocumentStatusSchema,
@@ -494,8 +622,8 @@ var ProductDevelopmentPlanFrontmatterSchema = z12.object({
494
622
  reviewers: z12.array(z12.string()).optional(),
495
623
  approvers: z12.array(z12.string()).optional()
496
624
  });
497
- var IntendedUseFrontmatterSchema = z12.object({
498
- type: z12.literal("intended_use"),
625
+ var SbomFrontmatterSchema = z12.object({
626
+ type: z12.literal("sbom"),
499
627
  id: z12.string().min(1),
500
628
  title: z12.string().min(1),
501
629
  status: RiskDocumentStatusSchema,
@@ -504,31 +632,118 @@ var IntendedUseFrontmatterSchema = z12.object({
504
632
  approvers: z12.array(z12.string()).optional()
505
633
  });
506
634
 
507
- // ../shared/dist/schemas/user-need.js
635
+ // ../contracts/dist/domain-schemas/clinical.js
508
636
  import { z as z13 } from "zod";
509
- var UserNeedPrioritySchema = z13.enum(["must_have", "should_have", "nice_to_have"]);
510
- var UserNeedFrontmatterSchema = z13.object({
637
+ var ClinicalEvaluationPlanFrontmatterSchema = z13.object({
638
+ type: z13.literal("clinical_evaluation_plan"),
639
+ id: z13.string().min(1),
640
+ title: z13.string().min(1),
641
+ status: RiskDocumentStatusSchema,
642
+ author: z13.string().optional(),
643
+ reviewers: z13.array(z13.string()).optional(),
644
+ approvers: z13.array(z13.string()).optional()
645
+ });
646
+ var ClinicalEvaluationReportFrontmatterSchema = z13.object({
647
+ type: z13.literal("clinical_evaluation_report"),
511
648
  id: z13.string().min(1),
512
649
  title: z13.string().min(1),
513
650
  status: RiskDocumentStatusSchema,
651
+ author: z13.string().optional(),
652
+ reviewers: z13.array(z13.string()).optional(),
653
+ approvers: z13.array(z13.string()).optional()
654
+ });
655
+
656
+ // ../contracts/dist/domain-schemas/post-market.js
657
+ import { z as z14 } from "zod";
658
+ var PostMarketSurveillancePlanFrontmatterSchema = z14.object({
659
+ type: z14.literal("post_market_surveillance_plan"),
660
+ id: z14.string().min(1),
661
+ title: z14.string().min(1),
662
+ status: RiskDocumentStatusSchema,
663
+ author: z14.string().optional(),
664
+ reviewers: z14.array(z14.string()).optional(),
665
+ approvers: z14.array(z14.string()).optional()
666
+ });
667
+ var PostMarketFeedbackCategorySchema = z14.enum([
668
+ "complaint",
669
+ "field_observation",
670
+ "clinical_followup",
671
+ "trend_report"
672
+ ]);
673
+ var PostMarketFeedbackSeveritySchema = z14.enum(["low", "medium", "high", "critical"]);
674
+ var PostMarketFeedbackFrontmatterSchema = z14.object({
675
+ type: z14.literal("post_market_feedback"),
676
+ id: z14.string().min(1),
677
+ title: z14.string().min(1),
678
+ status: RiskDocumentStatusSchema,
679
+ category: PostMarketFeedbackCategorySchema,
680
+ severity: PostMarketFeedbackSeveritySchema,
681
+ device: z14.string().optional(),
682
+ reporting_period: z14.string().optional(),
683
+ author: z14.string().optional(),
684
+ reviewers: z14.array(z14.string()).optional(),
685
+ approvers: z14.array(z14.string()).optional()
686
+ });
687
+
688
+ // ../contracts/dist/domain-schemas/labeling.js
689
+ import { z as z15 } from "zod";
690
+ var LabelingFrontmatterSchema = z15.object({
691
+ type: z15.literal("labeling"),
692
+ id: z15.string().min(1),
693
+ title: z15.string().min(1),
694
+ status: RiskDocumentStatusSchema,
695
+ label_type: z15.enum(["ifu", "product_label", "packaging_label"]).optional(),
696
+ author: z15.string().optional(),
697
+ reviewers: z15.array(z15.string()).optional(),
698
+ approvers: z15.array(z15.string()).optional()
699
+ });
700
+
701
+ // ../contracts/dist/domain-schemas/product.js
702
+ import { z as z16 } from "zod";
703
+ var ProductDevelopmentPlanFrontmatterSchema = z16.object({
704
+ type: z16.literal("product_development_plan"),
705
+ id: z16.string().min(1),
706
+ title: z16.string().min(1),
707
+ status: RiskDocumentStatusSchema,
708
+ author: z16.string().optional(),
709
+ reviewers: z16.array(z16.string()).optional(),
710
+ approvers: z16.array(z16.string()).optional()
711
+ });
712
+ var IntendedUseFrontmatterSchema = z16.object({
713
+ type: z16.literal("intended_use"),
714
+ id: z16.string().min(1),
715
+ title: z16.string().min(1),
716
+ status: RiskDocumentStatusSchema,
717
+ author: z16.string().optional(),
718
+ reviewers: z16.array(z16.string()).optional(),
719
+ approvers: z16.array(z16.string()).optional()
720
+ });
721
+
722
+ // ../contracts/dist/domain-schemas/user-need.js
723
+ import { z as z17 } from "zod";
724
+ var UserNeedPrioritySchema = z17.enum(["must_have", "should_have", "nice_to_have"]);
725
+ var UserNeedFrontmatterSchema = z17.object({
726
+ id: z17.string().min(1),
727
+ title: z17.string().min(1),
728
+ status: RiskDocumentStatusSchema,
514
729
  /** Validated if present — ensures frontmatter doesn't misidentify the document type */
515
- type: z13.literal("user_need").optional(),
730
+ type: z17.literal("user_need").optional(),
516
731
  /** The user role or stakeholder (e.g., "Quality Manager", "Developer") */
517
- stakeholder: z13.string().optional(),
732
+ stakeholder: z17.string().optional(),
518
733
  /** MoSCoW priority classification */
519
734
  priority: UserNeedPrioritySchema.optional(),
520
735
  /** Where this need originated (e.g., "ISO 13485 §7.3", "user interview") */
521
- source: z13.string().optional(),
736
+ source: z17.string().optional(),
522
737
  /** IDs of product requirements derived from this need */
523
- derives: z13.array(z13.string()).optional(),
524
- author: z13.string().optional(),
525
- reviewers: z13.array(z13.string()).optional(),
526
- approvers: z13.array(z13.string()).optional()
738
+ derives: z17.array(z17.string()).optional(),
739
+ author: z17.string().optional(),
740
+ reviewers: z17.array(z17.string()).optional(),
741
+ approvers: z17.array(z17.string()).optional()
527
742
  });
528
743
 
529
- // ../shared/dist/schemas/requirement.js
530
- import { z as z14 } from "zod";
531
- var RequirementTypeSchema = z14.enum([
744
+ // ../contracts/dist/domain-schemas/requirement.js
745
+ import { z as z18 } from "zod";
746
+ var RequirementTypeSchema = z18.enum([
532
747
  "functional",
533
748
  "interface",
534
749
  "performance",
@@ -537,8 +752,8 @@ var RequirementTypeSchema = z14.enum([
537
752
  "safety",
538
753
  "regulatory"
539
754
  ]);
540
- var RequirementFormatSchema = z14.enum(["standard", "user_story"]);
541
- var RequirementFulfillmentTypeSchema = z14.enum([
755
+ var RequirementFormatSchema = z18.enum(["standard", "user_story"]);
756
+ var RequirementFulfillmentTypeSchema = z18.enum([
542
757
  "software",
543
758
  "labeling",
544
759
  "clinical",
@@ -546,9 +761,9 @@ var RequirementFulfillmentTypeSchema = z14.enum([
546
761
  "regulatory_doc",
547
762
  "process"
548
763
  ]);
549
- var RequirementFrontmatterSchema = z14.object({
550
- id: z14.string().min(1),
551
- title: z14.string().min(1),
764
+ var RequirementFrontmatterSchema = z18.object({
765
+ id: z18.string().min(1),
766
+ title: z18.string().min(1),
552
767
  status: RiskDocumentStatusSchema,
553
768
  /** IEC 62304 §5.2.2 — requirement classification (required for SRS, optional for PRS) */
554
769
  req_type: RequirementTypeSchema.optional(),
@@ -556,72 +771,72 @@ var RequirementFrontmatterSchema = z14.object({
556
771
  format: RequirementFormatSchema.optional(),
557
772
  /** ISO 13485 §7.3.3 — how this PRS design input is fulfilled (PRS only, defaults to 'software') */
558
773
  fulfillment_type: RequirementFulfillmentTypeSchema.optional(),
559
- author: z14.string().optional(),
560
- reviewers: z14.array(z14.string()).optional(),
561
- approvers: z14.array(z14.string()).optional(),
774
+ author: z18.string().optional(),
775
+ reviewers: z18.array(z18.string()).optional(),
776
+ approvers: z18.array(z18.string()).optional(),
562
777
  /** Upstream traceability — IDs of documents this requirement traces from (e.g., UN for PRS, PRS for SRS) */
563
- traces_from: z14.array(z14.string()).optional(),
778
+ traces_from: z18.array(z18.string()).optional(),
564
779
  /** Downstream traceability — IDs of documents this requirement traces to (e.g., SRS for PRS) */
565
- traces_to: z14.array(z14.string()).optional()
780
+ traces_to: z18.array(z18.string()).optional()
566
781
  });
567
782
 
568
- // ../shared/dist/schemas/test-documents.js
569
- import { z as z15 } from "zod";
570
- var TestProtocolFrontmatterSchema = z15.object({
571
- type: z15.literal("test_protocol"),
572
- id: z15.string().min(1),
573
- title: z15.string().min(1),
783
+ // ../contracts/dist/domain-schemas/test-documents.js
784
+ import { z as z19 } from "zod";
785
+ var TestProtocolFrontmatterSchema = z19.object({
786
+ type: z19.literal("test_protocol"),
787
+ id: z19.string().min(1),
788
+ title: z19.string().min(1),
574
789
  status: RiskDocumentStatusSchema,
575
- author: z15.string().optional(),
576
- reviewers: z15.array(z15.string()).optional(),
577
- approvers: z15.array(z15.string()).optional()
790
+ author: z19.string().optional(),
791
+ reviewers: z19.array(z19.string()).optional(),
792
+ approvers: z19.array(z19.string()).optional()
578
793
  });
579
- var TestPhaseSchema = z15.enum(["verification", "production"]);
580
- var TestReportFrontmatterSchema = z15.object({
581
- type: z15.literal("test_report"),
582
- id: z15.string().min(1),
583
- title: z15.string().min(1),
794
+ var TestPhaseSchema = z19.enum(["verification", "production"]);
795
+ var TestReportFrontmatterSchema = z19.object({
796
+ type: z19.literal("test_report"),
797
+ id: z19.string().min(1),
798
+ title: z19.string().min(1),
584
799
  status: RiskDocumentStatusSchema,
585
- author: z15.string().optional(),
586
- reviewers: z15.array(z15.string()).optional(),
587
- approvers: z15.array(z15.string()).optional(),
588
- release_version: z15.string().optional(),
800
+ author: z19.string().optional(),
801
+ reviewers: z19.array(z19.string()).optional(),
802
+ approvers: z19.array(z19.string()).optional(),
803
+ release_version: z19.string().optional(),
589
804
  test_phase: TestPhaseSchema.optional()
590
805
  });
591
806
 
592
- // ../shared/dist/schemas/repo-config.js
593
- import { z as z16 } from "zod";
594
- var ReleaseReviewConfigSchema = z16.object({
595
- required_departments: z16.array(z16.string().min(1)).min(1),
596
- final_approver: z16.string().min(1)
597
- });
598
- var RepoConfigSchema = z16.object({
599
- device: z16.object({
600
- name: z16.string().min(1),
601
- safety_class: z16.enum(["A", "B", "C"]),
602
- classification: z16.object({
603
- eu: z16.string().optional(),
604
- us: z16.string().optional()
807
+ // ../contracts/dist/domain-schemas/repo-config.js
808
+ import { z as z20 } from "zod";
809
+ var ReleaseReviewConfigSchema = z20.object({
810
+ required_departments: z20.array(z20.string().min(1)).min(1),
811
+ final_approver: z20.string().min(1)
812
+ });
813
+ var RepoConfigSchema = z20.object({
814
+ device: z20.object({
815
+ name: z20.string().min(1),
816
+ safety_class: z20.enum(["A", "B", "C"]),
817
+ classification: z20.object({
818
+ eu: z20.string().optional(),
819
+ us: z20.string().optional()
605
820
  }).optional(),
606
- udi_device_identifier: z16.string().optional()
821
+ udi_device_identifier: z20.string().optional()
607
822
  }),
608
823
  release_review: ReleaseReviewConfigSchema.optional()
609
824
  });
610
825
 
611
- // ../shared/dist/schemas/qms-device.js
612
- import { z as z17 } from "zod";
613
- var OwnerTypeSchema = z17.enum(["qms", "device"]);
614
- var DocumentSnapshotSchema = z17.object({
615
- documentId: z17.string(),
616
- commitSha: z17.string(),
617
- documentPath: z17.string(),
618
- documentTitle: z17.string(),
619
- documentType: z17.string(),
620
- previousReleasedCommitSha: z17.string().optional(),
621
- changeType: z17.enum(["added", "modified", "unchanged"]),
622
- changeDescription: z17.string().optional()
623
- });
624
- var QmsDocumentTypeSchema = z17.enum([
826
+ // ../contracts/dist/domain-schemas/qms-device.js
827
+ import { z as z21 } from "zod";
828
+ var OwnerTypeSchema = z21.enum(["qms", "device"]);
829
+ var DocumentSnapshotSchema = z21.object({
830
+ documentId: z21.string(),
831
+ commitSha: z21.string(),
832
+ documentPath: z21.string(),
833
+ documentTitle: z21.string(),
834
+ documentType: z21.string(),
835
+ previousReleasedCommitSha: z21.string().optional(),
836
+ changeType: z21.enum(["added", "modified", "unchanged"]),
837
+ changeDescription: z21.string().optional()
838
+ });
839
+ var QmsDocumentTypeSchema = z21.enum([
625
840
  "sop",
626
841
  "policy",
627
842
  "work_instruction",
@@ -630,7 +845,7 @@ var QmsDocumentTypeSchema = z17.enum([
630
845
  "audit_report",
631
846
  "management_review"
632
847
  ]);
633
- var DeviceDocumentTypeSchema = z17.enum([
848
+ var DeviceDocumentTypeSchema = z21.enum([
634
849
  "user_need",
635
850
  "requirement",
636
851
  "architecture",
@@ -682,206 +897,207 @@ var DeviceDocumentTypeSchema = z17.enum([
682
897
  "software_test_plan"
683
898
  ]);
684
899
 
685
- // ../shared/dist/schemas/change-management.js
686
- import { z as z18 } from "zod";
687
- var ReleasePlanFrontmatterSchema = z18.object({
688
- id: z18.string().min(1),
689
- title: z18.string().min(1),
690
- type: z18.literal("release_plan").optional(),
691
- status: z18.string().optional(),
692
- author: z18.string().optional(),
693
- reviewers: z18.array(z18.string()).optional(),
694
- approvers: z18.array(z18.string()).optional(),
695
- version: z18.string().optional(),
696
- target_date: z18.string().optional()
900
+ // ../contracts/dist/domain-schemas/change-management.js
901
+ import { z as z22 } from "zod";
902
+ var ReleasePlanFrontmatterSchema = z22.object({
903
+ id: z22.string().min(1),
904
+ title: z22.string().min(1),
905
+ type: z22.literal("release_plan").optional(),
906
+ status: z22.string().optional(),
907
+ author: z22.string().optional(),
908
+ reviewers: z22.array(z22.string()).optional(),
909
+ approvers: z22.array(z22.string()).optional(),
910
+ version: z22.string().optional(),
911
+ target_date: z22.string().optional(),
912
+ applicable_plans: z22.array(z22.string()).optional()
697
913
  });
698
- var SuspectedLinkDispositionSchema = z18.enum(["included_in_release", "not_impacted"]);
699
- var SuspectedLinkNeighborSchema = z18.object({
700
- document: z18.string().min(1),
701
- direction: z18.enum(["upstream", "downstream"]),
914
+ var SuspectedLinkDispositionSchema = z22.enum(["included_in_release", "not_impacted"]);
915
+ var SuspectedLinkNeighborSchema = z22.object({
916
+ document: z22.string().min(1),
917
+ direction: z22.enum(["upstream", "downstream"]),
702
918
  disposition: SuspectedLinkDispositionSchema,
703
919
  /** Required when disposition is 'not_impacted' */
704
- rationale: z18.string().min(1).optional()
920
+ rationale: z22.string().min(1).optional()
705
921
  });
706
- var SuspectedLinkGroupSchema = z18.object({
707
- triggered_by: z18.string().min(1),
708
- neighbors: z18.array(SuspectedLinkNeighborSchema).min(1)
922
+ var SuspectedLinkGroupSchema = z22.object({
923
+ triggered_by: z22.string().min(1),
924
+ neighbors: z22.array(SuspectedLinkNeighborSchema).min(1)
709
925
  });
710
- var DesignReviewFrontmatterSchema = z18.object({
711
- id: z18.string().min(1),
712
- title: z18.string().min(1),
713
- type: z18.literal("design_review").optional(),
714
- status: z18.string().optional(),
715
- author: z18.string().optional(),
716
- reviewers: z18.array(z18.string()).optional(),
717
- approvers: z18.array(z18.string()).optional(),
926
+ var DesignReviewFrontmatterSchema = z22.object({
927
+ id: z22.string().min(1),
928
+ title: z22.string().min(1),
929
+ type: z22.literal("design_review").optional(),
930
+ status: z22.string().optional(),
931
+ author: z22.string().optional(),
932
+ reviewers: z22.array(z22.string()).optional(),
933
+ approvers: z22.array(z22.string()).optional(),
718
934
  /** Optional link to a Release Plan document (e.g. "RP-001") */
719
- release_plan: z18.string().optional(),
935
+ release_plan: z22.string().optional(),
720
936
  /** Acknowledged suspected links — one-up/one-down neighbor analysis */
721
- suspected_links: z18.array(SuspectedLinkGroupSchema).optional()
937
+ suspected_links: z22.array(SuspectedLinkGroupSchema).optional()
722
938
  });
723
- var ReleaseNotesAudienceSchema = z18.enum(["customer", "technical"]);
724
- var ReleaseNotesFrontmatterSchema = z18.object({
725
- id: z18.string().min(1),
726
- title: z18.string().min(1),
727
- type: z18.literal("release_notes").optional(),
939
+ var ReleaseNotesAudienceSchema = z22.enum(["customer", "technical"]);
940
+ var ReleaseNotesFrontmatterSchema = z22.object({
941
+ id: z22.string().min(1),
942
+ title: z22.string().min(1),
943
+ type: z22.literal("release_notes").optional(),
728
944
  status: RiskDocumentStatusSchema,
729
- author: z18.string().optional(),
730
- reviewers: z18.array(z18.string()).optional(),
731
- approvers: z18.array(z18.string()).optional(),
945
+ author: z22.string().optional(),
946
+ reviewers: z22.array(z22.string()).optional(),
947
+ approvers: z22.array(z22.string()).optional(),
732
948
  audience: ReleaseNotesAudienceSchema,
733
- release_version: z18.string().min(1)
949
+ release_version: z22.string().min(1)
734
950
  });
735
951
 
736
- // ../shared/dist/schemas/retention-policy.js
737
- import { z as z19 } from "zod";
738
- var RetentionPolicySchema = z19.object({
952
+ // ../contracts/dist/domain-schemas/retention-policy.js
953
+ import { z as z23 } from "zod";
954
+ var RetentionPolicySchema = z23.object({
739
955
  /** Default retention period in years for all record types */
740
- defaultPeriodYears: z19.number().int().min(1).max(30).default(10),
956
+ defaultPeriodYears: z23.number().int().min(1).max(30).default(10),
741
957
  /**
742
958
  * Optional per-record-type overrides (e.g., { "release": 15, "signature": 20 }).
743
959
  * Keys are record type identifiers; values are retention periods in years.
744
960
  */
745
- byRecordType: z19.record(z19.string(), z19.number().int().min(1).max(30)).optional()
961
+ byRecordType: z23.record(z23.string(), z23.number().int().min(1).max(30)).optional()
746
962
  });
747
963
 
748
- // ../shared/dist/schemas/audit.js
749
- import { z as z20 } from "zod";
750
- var AuditFindingClassificationSchema = z20.enum(["observation", "minor_nc", "major_nc"]);
751
- var AuditStatusSchema = z20.enum(["planned", "in_progress", "completed", "cancelled"]);
752
- var PlannedAuditEntrySchema = z20.object({
753
- audit_id: z20.string().min(1),
754
- process_area: z20.string().min(1),
755
- clause: z20.string().optional(),
756
- planned_date: z20.string().min(1),
757
- auditor: z20.string().min(1),
964
+ // ../contracts/dist/domain-schemas/audit.js
965
+ import { z as z24 } from "zod";
966
+ var AuditFindingClassificationSchema = z24.enum(["observation", "minor_nc", "major_nc"]);
967
+ var AuditStatusSchema = z24.enum(["planned", "in_progress", "completed", "cancelled"]);
968
+ var PlannedAuditEntrySchema = z24.object({
969
+ audit_id: z24.string().min(1),
970
+ process_area: z24.string().min(1),
971
+ clause: z24.string().optional(),
972
+ planned_date: z24.string().min(1),
973
+ auditor: z24.string().min(1),
758
974
  status: AuditStatusSchema
759
975
  });
760
- var AuditScheduleFrontmatterSchema = z20.object({
761
- id: z20.string().min(1),
762
- title: z20.string().min(1),
763
- type: z20.literal("audit_schedule").optional(),
764
- status: z20.string().optional(),
765
- author: z20.string().optional(),
766
- reviewers: z20.array(z20.string()).optional(),
767
- approvers: z20.array(z20.string()).optional(),
768
- cycle_year: z20.number().int().min(2e3).max(2100),
769
- audits: z20.array(PlannedAuditEntrySchema).min(1)
770
- });
771
- var AuditFindingSchema = z20.object({
772
- finding_id: z20.string().min(1),
976
+ var AuditScheduleFrontmatterSchema = z24.object({
977
+ id: z24.string().min(1),
978
+ title: z24.string().min(1),
979
+ type: z24.literal("audit_schedule").optional(),
980
+ status: z24.string().optional(),
981
+ author: z24.string().optional(),
982
+ reviewers: z24.array(z24.string()).optional(),
983
+ approvers: z24.array(z24.string()).optional(),
984
+ cycle_year: z24.number().int().min(2e3).max(2100),
985
+ audits: z24.array(PlannedAuditEntrySchema).min(1)
986
+ });
987
+ var AuditFindingSchema = z24.object({
988
+ finding_id: z24.string().min(1),
773
989
  classification: AuditFindingClassificationSchema,
774
- description: z20.string().min(1),
775
- capa_id: z20.string().optional()
776
- });
777
- var AuditReportFrontmatterSchema = z20.object({
778
- id: z20.string().min(1),
779
- title: z20.string().min(1),
780
- type: z20.literal("audit_report").optional(),
781
- status: z20.string().optional(),
782
- author: z20.string().optional(),
783
- reviewers: z20.array(z20.string()).optional(),
784
- approvers: z20.array(z20.string()).optional(),
785
- audit_date: z20.string().min(1),
786
- audit_id: z20.string().optional(),
787
- process_area: z20.string().min(1),
788
- clause: z20.string().optional(),
789
- auditor: z20.string().min(1),
790
- findings: z20.array(AuditFindingSchema),
791
- findings_major: z20.number().int().min(0).optional(),
792
- findings_minor: z20.number().int().min(0).optional(),
793
- findings_observations: z20.number().int().min(0).optional()
794
- });
795
-
796
- // ../shared/dist/schemas/management-review.js
797
- import { z as z21 } from "zod";
798
- var ManagementReviewAttendeeSchema = z21.object({
799
- name: z21.string().min(1),
800
- role: z21.string().min(1)
801
- });
802
- var ManagementReviewFrontmatterSchema = z21.object({
803
- id: z21.string().min(1),
804
- title: z21.string().min(1),
805
- type: z21.literal("management_review").optional(),
806
- version: z21.string().optional(),
807
- status: z21.enum(["draft", "scheduled", "completed"]).optional(),
808
- review_date: z21.string().min(1),
809
- review_period: z21.object({
810
- from: z21.string().min(1),
811
- to: z21.string().min(1)
990
+ description: z24.string().min(1),
991
+ capa_id: z24.string().optional()
992
+ });
993
+ var AuditReportFrontmatterSchema = z24.object({
994
+ id: z24.string().min(1),
995
+ title: z24.string().min(1),
996
+ type: z24.literal("audit_report").optional(),
997
+ status: z24.string().optional(),
998
+ author: z24.string().optional(),
999
+ reviewers: z24.array(z24.string()).optional(),
1000
+ approvers: z24.array(z24.string()).optional(),
1001
+ audit_date: z24.string().min(1),
1002
+ audit_id: z24.string().optional(),
1003
+ process_area: z24.string().min(1),
1004
+ clause: z24.string().optional(),
1005
+ auditor: z24.string().min(1),
1006
+ findings: z24.array(AuditFindingSchema),
1007
+ findings_major: z24.number().int().min(0).optional(),
1008
+ findings_minor: z24.number().int().min(0).optional(),
1009
+ findings_observations: z24.number().int().min(0).optional()
1010
+ });
1011
+
1012
+ // ../contracts/dist/domain-schemas/management-review.js
1013
+ import { z as z25 } from "zod";
1014
+ var ManagementReviewAttendeeSchema = z25.object({
1015
+ name: z25.string().min(1),
1016
+ role: z25.string().min(1)
1017
+ });
1018
+ var ManagementReviewFrontmatterSchema = z25.object({
1019
+ id: z25.string().min(1),
1020
+ title: z25.string().min(1),
1021
+ type: z25.literal("management_review").optional(),
1022
+ version: z25.string().optional(),
1023
+ status: z25.enum(["draft", "scheduled", "completed"]).optional(),
1024
+ review_date: z25.string().min(1),
1025
+ review_period: z25.object({
1026
+ from: z25.string().min(1),
1027
+ to: z25.string().min(1)
812
1028
  }),
813
- attendees: z21.array(ManagementReviewAttendeeSchema).min(1),
814
- data_snapshot_date: z21.string().optional(),
815
- next_review_date: z21.string().optional()
1029
+ attendees: z25.array(ManagementReviewAttendeeSchema).min(1),
1030
+ data_snapshot_date: z25.string().optional(),
1031
+ next_review_date: z25.string().optional()
816
1032
  });
817
1033
 
818
- // ../shared/dist/schemas/frameworks.js
819
- import { z as z22 } from "zod";
820
- var FrameworkScopeSchema = z22.enum(["qms", "device", "both"]);
821
- var MappingRelationshipSchema = z22.enum(["equivalent", "partial", "related", "supersedes"]);
822
- var FrameworkDefinitionSeedSchema = z22.object({
1034
+ // ../contracts/dist/domain-schemas/frameworks.js
1035
+ import { z as z26 } from "zod";
1036
+ var FrameworkScopeSchema = z26.enum(["qms", "device", "both"]);
1037
+ var MappingRelationshipSchema = z26.enum(["equivalent", "partial", "related", "supersedes"]);
1038
+ var FrameworkDefinitionSeedSchema = z26.object({
823
1039
  id: RegulatoryFrameworkSchema,
824
- name: z22.string().min(1),
825
- version: z22.string().min(1),
1040
+ name: z26.string().min(1),
1041
+ version: z26.string().min(1),
826
1042
  scope: FrameworkScopeSchema,
827
- url: z22.string().url().nullable(),
828
- active: z22.boolean().default(true)
1043
+ url: z26.string().url().nullable(),
1044
+ active: z26.boolean().default(true)
829
1045
  });
830
- var ClauseBase = z22.object({
831
- clauseNumber: z22.string().min(1),
832
- title: z22.string().min(1)
1046
+ var ClauseBase = z26.object({
1047
+ clauseNumber: z26.string().min(1),
1048
+ title: z26.string().min(1)
833
1049
  });
834
1050
  function buildClauseSchema(remainingDepth) {
835
1051
  if (remainingDepth <= 0) {
836
1052
  return ClauseBase.strict();
837
1053
  }
838
1054
  return ClauseBase.extend({
839
- children: z22.array(z22.lazy(() => buildClauseSchema(remainingDepth - 1))).optional()
1055
+ children: z26.array(z26.lazy(() => buildClauseSchema(remainingDepth - 1))).optional()
840
1056
  });
841
1057
  }
842
1058
  var FrameworkClauseSeedSchema = buildClauseSchema(5);
843
- var FrameworkMappingSeedSchema = z22.object({
844
- sourceClause: z22.string().min(1),
1059
+ var FrameworkMappingSeedSchema = z26.object({
1060
+ sourceClause: z26.string().min(1),
845
1061
  targetFramework: RegulatoryFrameworkSchema,
846
- targetClause: z22.string().min(1),
1062
+ targetClause: z26.string().min(1),
847
1063
  relationship: MappingRelationshipSchema,
848
- notes: z22.string().nullable().default(null)
1064
+ notes: z26.string().nullable().default(null)
849
1065
  });
850
- var MappingFileSeedSchema = z22.object({
1066
+ var MappingFileSeedSchema = z26.object({
851
1067
  sourceFramework: RegulatoryFrameworkSchema,
852
- mappings: z22.array(FrameworkMappingSeedSchema)
1068
+ mappings: z26.array(FrameworkMappingSeedSchema)
853
1069
  });
854
- var EvidenceSourceSchema = z22.enum(["documents", "training_records"]);
855
- var EvidenceRuleConditionsSeedSchema = z22.object({
1070
+ var EvidenceSourceSchema = z26.enum(["documents", "training_records"]);
1071
+ var EvidenceRuleConditionsSeedSchema = z26.object({
856
1072
  evidenceSource: EvidenceSourceSchema.optional(),
857
1073
  documentType: DocumentTypeSchema.optional(),
858
1074
  linkType: LinkTypeSchema.optional(),
859
- status: z22.string().optional(),
860
- minCount: z22.number().int().positive().optional()
1075
+ status: z26.string().optional(),
1076
+ minCount: z26.number().int().positive().optional()
861
1077
  });
862
- var EvidenceRuleSeedSchema = z22.object({
863
- clauseId: z22.string().min(1),
864
- description: z22.string().min(1),
1078
+ var EvidenceRuleSeedSchema = z26.object({
1079
+ clauseId: z26.string().min(1),
1080
+ description: z26.string().min(1),
865
1081
  conditions: EvidenceRuleConditionsSeedSchema,
866
- weight: z22.number().min(0).max(1)
1082
+ weight: z26.number().min(0).max(1)
867
1083
  });
868
- var EvidenceRulesFileSeedSchema = z22.object({
1084
+ var EvidenceRulesFileSeedSchema = z26.object({
869
1085
  frameworkId: RegulatoryFrameworkSchema,
870
- rules: z22.array(EvidenceRuleSeedSchema)
1086
+ rules: z26.array(EvidenceRuleSeedSchema)
871
1087
  });
872
1088
  var FrameworkFileSeedSchema = FrameworkDefinitionSeedSchema.extend({
873
- clauses: z22.array(FrameworkClauseSeedSchema)
1089
+ clauses: z26.array(FrameworkClauseSeedSchema)
874
1090
  });
875
1091
 
876
- // ../shared/dist/schemas/legal.js
877
- import { z as z23 } from "zod";
878
- var LegalDocumentTypeSchema = z23.enum(["tos", "privacy-policy", "billing-terms"]);
879
- var LegalDocumentVersionSchema = z23.string().regex(/^\d{4}-\d{2}-\d{2}$/, {
1092
+ // ../contracts/dist/domain-schemas/legal.js
1093
+ import { z as z27 } from "zod";
1094
+ var LegalDocumentTypeSchema = z27.enum(["tos", "privacy-policy", "billing-terms"]);
1095
+ var LegalDocumentVersionSchema = z27.string().regex(/^\d{4}-\d{2}-\d{2}$/, {
880
1096
  message: "Version must be in YYYY-MM-DD format"
881
1097
  });
882
1098
 
883
- // ../shared/dist/schemas/index.js
884
- var GateOverrideCategorySchema = z24.enum([
1099
+ // ../contracts/dist/domain-schemas/index.js
1100
+ var GateOverrideCategorySchema = z28.enum([
885
1101
  "unverified_requirements",
886
1102
  "unanalyzed_requirements",
887
1103
  "error_risk_gaps",
@@ -898,19 +1114,19 @@ var GateOverrideCategorySchema = z24.enum([
898
1114
  "missing_deployment_references",
899
1115
  "missing_smoke_test_evidence"
900
1116
  ]);
901
- var MemberRoleSchema = z24.enum(["admin", "member"]);
902
- var MemberStatusSchema = z24.enum(["active", "suspended", "removed"]);
903
- var EmailAddressSchema = z24.object({
904
- value: z24.string().email(),
905
- verified: z24.boolean()
1117
+ var MemberRoleSchema = z28.enum(["admin", "member"]);
1118
+ var MemberStatusSchema2 = z28.enum(["active", "suspended", "removed"]);
1119
+ var EmailAddressSchema = z28.object({
1120
+ value: z28.string().email(),
1121
+ verified: z28.boolean()
906
1122
  });
907
- var ReviewerRuleSchema = z24.object({
1123
+ var ReviewerRuleSchema2 = z28.object({
908
1124
  documentType: DocumentTypeSchema,
909
- requiredDepartments: z24.array(z24.string()),
910
- finalApproverDepartment: z24.string()
1125
+ requiredDepartments: z28.array(z28.string()),
1126
+ finalApproverDepartment: z28.string()
911
1127
  });
912
- var SyncStatusSchema = z24.enum(["active", "paused", "error"]);
913
- var AuditActionSchema = z24.enum([
1128
+ var SyncStatusSchema = z28.enum(["active", "paused", "error"]);
1129
+ var AuditActionSchema = z28.enum([
914
1130
  // Organization
915
1131
  "organization.created",
916
1132
  "organization.settings_updated",
@@ -1075,7 +1291,7 @@ var AuditActionSchema = z24.enum([
1075
1291
  // Audit
1076
1292
  "audit_log.exported"
1077
1293
  ]);
1078
- var ResourceTypeSchema = z24.enum([
1294
+ var ResourceTypeSchema = z28.enum([
1079
1295
  "organization",
1080
1296
  "member",
1081
1297
  "invite",
@@ -1107,57 +1323,2908 @@ var ResourceTypeSchema = z24.enum([
1107
1323
  "audit_log",
1108
1324
  "risk_matrix"
1109
1325
  ]);
1110
- var ReleaseTypeSchema = z24.enum(["qms", "device", "combined"]);
1111
- var ReleaseStatusSchema = z24.enum(["draft", "in_review", "approved", "published"]);
1112
- var SignatureTypeSchema = z24.enum(["author", "dept_reviewer", "final_approver", "trainee"]);
1113
- var ChangeTypeSchema = z24.enum(["added", "modified", "deleted"]);
1114
- var SigningRequestStatusSchema = z24.enum([
1326
+ var ReleaseTypeSchema = z28.enum(["qms", "device", "combined"]);
1327
+ var ReleaseStatusSchema = z28.enum(["draft", "in_review", "approved", "published"]);
1328
+ var SignatureTypeSchema = z28.enum(["author", "dept_reviewer", "final_approver", "trainee"]);
1329
+ var ChangeTypeSchema = z28.enum(["added", "modified", "deleted"]);
1330
+ var SigningRequestStatusSchema = z28.enum([
1115
1331
  "sent",
1116
1332
  "partially_signed",
1117
1333
  "completed",
1118
1334
  "expired",
1119
1335
  "cancelled"
1120
1336
  ]);
1121
- var SignerStatusSchema = z24.enum(["pending", "viewed", "signed", "declined"]);
1122
- var FieldTypeSchema = z24.enum(["signature", "initials", "date"]);
1337
+ var SignerStatusSchema = z28.enum(["pending", "viewed", "signed", "declined"]);
1338
+ var FieldTypeSchema = z28.enum(["signature", "initials", "date"]);
1123
1339
 
1124
- // ../shared/dist/constants/risk-matrix.js
1125
- var RISK_DOCUMENT_TYPES = [
1340
+ // ../contracts/dist/identity/legal-requests.js
1341
+ var LegalAcceptRequestSchema = z29.object({
1342
+ documentType: LegalDocumentTypeSchema,
1343
+ documentVersion: LegalDocumentVersionSchema,
1344
+ organizationId: z29.string().optional()
1345
+ }).superRefine((data, ctx) => {
1346
+ if (data.documentType === "billing-terms" && !data.organizationId) {
1347
+ ctx.addIssue({
1348
+ code: z29.ZodIssueCode.custom,
1349
+ message: "organizationId is required for billing-terms",
1350
+ path: ["organizationId"]
1351
+ });
1352
+ }
1353
+ });
1354
+ var LegalHistoryQuerySchema = z29.object({
1355
+ pageToken: z29.string().optional(),
1356
+ limit: z29.coerce.number().min(1).max(100).default(20)
1357
+ });
1358
+
1359
+ // ../contracts/dist/identity/legal-responses.js
1360
+ import { z as z30 } from "zod";
1361
+ var LegalAcceptResponseSchema = z30.object({
1362
+ acceptanceId: z30.string(),
1363
+ acceptedAt: z30.string()
1364
+ });
1365
+ var DocumentStatusSchema2 = z30.object({
1366
+ accepted: z30.boolean(),
1367
+ acceptedVersion: z30.string().optional(),
1368
+ currentVersion: z30.string()
1369
+ });
1370
+ var LegalStatusResponseSchema = z30.object({
1371
+ tos: DocumentStatusSchema2,
1372
+ privacyPolicy: DocumentStatusSchema2,
1373
+ billingTerms: z30.record(z30.string(), DocumentStatusSchema2)
1374
+ });
1375
+ var LegalHistoryResponseSchema = z30.object({
1376
+ acceptances: z30.array(z30.object({
1377
+ id: z30.string(),
1378
+ documentType: LegalDocumentTypeSchema,
1379
+ documentVersion: z30.string(),
1380
+ organizationId: z30.string().optional(),
1381
+ acceptedAt: z30.string()
1382
+ })),
1383
+ nextPageToken: z30.string().optional()
1384
+ });
1385
+
1386
+ // ../contracts/dist/repositories/requests.js
1387
+ import { z as z31 } from "zod";
1388
+ var RepositoryTypeSchema = z31.enum(["qms", "device"]);
1389
+ var SyncStatusSchema2 = z31.enum(["active", "paused", "error"]);
1390
+ var ConnectRepositoryRequestSchema = z31.object({
1391
+ organizationId: z31.string().min(1),
1392
+ gitHubRepoFullName: z31.string().min(1),
1393
+ gitHubRepoId: z31.number().int().positive()
1394
+ });
1395
+ var RepositoryIdParamSchema = z31.object({
1396
+ repositoryId: z31.string().min(1)
1397
+ });
1398
+ var OrgRepositoryParamSchema = z31.object({
1399
+ orgId: z31.string().min(1),
1400
+ repositoryId: z31.string().min(1)
1401
+ });
1402
+ var OrgIdQuerySchema = z31.object({
1403
+ organizationId: z31.string().min(1)
1404
+ });
1405
+ var OwnerTypeSchema2 = z31.enum(["qms", "device"]);
1406
+ var AssignRepositoryRequestSchema = z31.object({
1407
+ ownerType: OwnerTypeSchema2,
1408
+ ownerId: z31.string().min(1)
1409
+ });
1410
+ var TriggerSyncRequestSchema = z31.object({
1411
+ organizationId: z31.string().min(1)
1412
+ });
1413
+ var SyncEventParamSchema = z31.object({
1414
+ repositoryId: z31.string().min(1),
1415
+ syncEventId: z31.string().min(1)
1416
+ });
1417
+
1418
+ // ../contracts/dist/repositories/responses.js
1419
+ import { z as z32 } from "zod";
1420
+ var DocumentCountsSchema = z32.record(z32.string(), z32.number());
1421
+ var LinkCountsSchema = z32.record(z32.string(), z32.number());
1422
+ var RepositorySnapshotSchema = z32.object({
1423
+ documentCounts: DocumentCountsSchema,
1424
+ linkCounts: LinkCountsSchema,
1425
+ totalDocuments: z32.number(),
1426
+ totalLinks: z32.number()
1427
+ });
1428
+ var BaseFieldsSchema = z32.object({
1429
+ id: z32.string(),
1430
+ organizationId: z32.string(),
1431
+ ownerType: z32.enum(["qms", "device"]).nullable(),
1432
+ ownerId: z32.string().nullable(),
1433
+ gitHubRepoFullName: z32.string(),
1434
+ gitHubRepoId: z32.number(),
1435
+ syncStatus: SyncStatusSchema2,
1436
+ lastSyncedAt: z32.string().optional(),
1437
+ // ISO date
1438
+ lastSyncCommitSha: z32.string().optional(),
1439
+ connectedAt: z32.string(),
1440
+ // ISO date
1441
+ connectedBy: z32.string(),
1442
+ snapshot: RepositorySnapshotSchema.optional()
1443
+ });
1444
+ var UnassignedRepositoryResponseSchema = BaseFieldsSchema.extend({
1445
+ type: z32.literal("unassigned")
1446
+ });
1447
+ var QmsRepositoryResponseSchema = BaseFieldsSchema.extend({
1448
+ type: z32.literal("qms")
1449
+ });
1450
+ var DeviceRepositoryResponseSchema = BaseFieldsSchema.extend({
1451
+ type: z32.literal("device"),
1452
+ deviceName: z32.string(),
1453
+ safetyClass: SafetyClassSchema,
1454
+ configManaged: z32.boolean().optional()
1455
+ });
1456
+ var RepositoryResponseSchema = z32.discriminatedUnion("type", [
1457
+ UnassignedRepositoryResponseSchema,
1458
+ QmsRepositoryResponseSchema,
1459
+ DeviceRepositoryResponseSchema
1460
+ ]);
1461
+ var BaseRepositoryResponseSchema = BaseFieldsSchema.extend({
1462
+ type: z32.enum(["unassigned", "qms", "device"])
1463
+ });
1464
+ var GitHubRepositoryResponseSchema = z32.object({
1465
+ id: z32.number(),
1466
+ fullName: z32.string(),
1467
+ name: z32.string(),
1468
+ private: z32.boolean(),
1469
+ defaultBranch: z32.string()
1470
+ });
1471
+ var ConnectRepositoryResponseSchema = z32.object({
1472
+ repositoryId: z32.string()
1473
+ });
1474
+ var GetRepositoriesResponseSchema = z32.object({
1475
+ repositories: z32.array(RepositoryResponseSchema)
1476
+ });
1477
+ var ListGitHubReposResponseSchema = z32.object({
1478
+ repositories: z32.array(GitHubRepositoryResponseSchema)
1479
+ });
1480
+ var TriggerSyncResponseSchema = z32.object({
1481
+ syncEventId: z32.string()
1482
+ });
1483
+ var SyncEventStatusSchema = z32.enum([
1484
+ "pending",
1485
+ "in_progress",
1486
+ "completed",
1487
+ "completed_with_errors",
1488
+ "failed"
1489
+ ]);
1490
+ var SyncTriggerSchema = z32.enum(["manual", "webhook", "scheduled"]);
1491
+ var SyncEventResultSchema = z32.object({
1492
+ documentsCreated: z32.number(),
1493
+ documentsUpdated: z32.number(),
1494
+ documentsRemoved: z32.number(),
1495
+ linksCreated: z32.number(),
1496
+ linksRemoved: z32.number(),
1497
+ errors: z32.array(z32.string()),
1498
+ commitSha: z32.string(),
1499
+ repoConfig: z32.object({
1500
+ device: z32.object({
1501
+ name: z32.string(),
1502
+ safety_class: z32.enum(["A", "B", "C"]),
1503
+ classification: z32.object({
1504
+ eu: z32.string().optional(),
1505
+ us: z32.string().optional()
1506
+ }).optional()
1507
+ })
1508
+ }).optional()
1509
+ });
1510
+ var SyncEventResponseSchema = z32.object({
1511
+ id: z32.string(),
1512
+ status: SyncEventStatusSchema,
1513
+ trigger: SyncTriggerSchema,
1514
+ createdAt: z32.string(),
1515
+ // ISO date
1516
+ createdBy: z32.string(),
1517
+ startedAt: z32.string().optional(),
1518
+ completedAt: z32.string().optional(),
1519
+ error: z32.string().optional(),
1520
+ result: SyncEventResultSchema.optional()
1521
+ });
1522
+ var GetSyncEventResponseSchema = z32.object({
1523
+ syncEvent: SyncEventResponseSchema
1524
+ });
1525
+
1526
+ // ../contracts/dist/risks/requests.js
1527
+ import { z as z33 } from "zod";
1528
+ var RiskTypeSchema = z33.enum(["software_risk", "usability_risk", "security_risk"]);
1529
+ var GetRiskMatrixQuerySchema = z33.object({
1530
+ organizationId: z33.string().min(1),
1531
+ repositoryId: z33.string().optional(),
1532
+ type: RiskTypeSchema.optional()
1533
+ });
1534
+ var GetRiskGapsQuerySchema = z33.object({
1535
+ organizationId: z33.string().min(1),
1536
+ repositoryId: z33.string().optional(),
1537
+ type: RiskTypeSchema.optional()
1538
+ });
1539
+ var GetRiskListQuerySchema = z33.object({
1540
+ organizationId: z33.string().min(1),
1541
+ repositoryId: z33.string().optional(),
1542
+ type: RiskTypeSchema.optional(),
1543
+ limit: z33.coerce.number().min(1).max(100).optional().default(50)
1544
+ });
1545
+
1546
+ // ../contracts/dist/risks/responses.js
1547
+ import { z as z34 } from "zod";
1548
+ var RiskValueSchema = z34.number().int().min(1).max(5);
1549
+ var RiskDocumentTypeSchema = z34.enum([
1126
1550
  "software_risk",
1127
1551
  "usability_risk",
1128
- "security_risk"
1129
- ];
1130
- var HAZARD_DOCUMENT_TYPES = ["haz_soe_software", "haz_soe_security"];
1131
- var ALL_RISK_RELATED_DOCUMENT_TYPES = [
1132
- ...RISK_DOCUMENT_TYPES,
1133
- ...HAZARD_DOCUMENT_TYPES,
1552
+ "security_risk",
1553
+ "haz_soe_software",
1554
+ "haz_soe_security",
1134
1555
  "hazardous_situation",
1135
- "harm"
1556
+ "harm",
1557
+ "hazard_category"
1558
+ ]);
1559
+ var HarmAssessmentEntrySchema = z34.object({
1560
+ harm: z34.string(),
1561
+ harmTitle: z34.string().optional(),
1562
+ harmSeverity: RiskValueSchema,
1563
+ inherentProbability: RiskValueSchema,
1564
+ residualProbability: RiskValueSchema,
1565
+ residualSeverityOverride: RiskValueSchema.optional(),
1566
+ residualSeverity: RiskValueSchema,
1567
+ inherentAcceptability: AcceptabilityStatusSchema,
1568
+ residualAcceptability: AcceptabilityStatusSchema
1569
+ });
1570
+ var RiskEntrySchema = z34.object({
1571
+ id: z34.string(),
1572
+ type: RiskDocumentTypeSchema,
1573
+ harmAssessments: z34.array(HarmAssessmentEntrySchema),
1574
+ worstInherentSeverity: RiskValueSchema.optional(),
1575
+ worstInherentProbability: RiskValueSchema.optional(),
1576
+ worstResidualSeverity: RiskValueSchema.optional(),
1577
+ worstResidualProbability: RiskValueSchema.optional(),
1578
+ worstAcceptability: AcceptabilityStatusSchema.optional(),
1579
+ cvssScore: z34.number().min(0).max(10).optional(),
1580
+ cvssVector: z34.string().optional()
1581
+ });
1582
+ var RiskMatrixResponseSchema = z34.object({
1583
+ inherent: z34.array(z34.array(z34.number())),
1584
+ residual: z34.array(z34.array(z34.number())),
1585
+ acceptability: z34.array(z34.array(AcceptabilityStatusSchema)),
1586
+ summary: z34.object({
1587
+ total: z34.number(),
1588
+ acceptable: z34.number(),
1589
+ reviewRequired: z34.number(),
1590
+ unacceptable: z34.number()
1591
+ }),
1592
+ labels: z34.object({
1593
+ severity: z34.array(z34.string()),
1594
+ probability: z34.array(z34.string())
1595
+ })
1596
+ });
1597
+ var RiskGapSchema = z34.object({
1598
+ code: z34.string(),
1599
+ severity: z34.enum(["error", "warning"]),
1600
+ documentId: z34.string(),
1601
+ documentTitle: z34.string(),
1602
+ message: z34.string(),
1603
+ repositoryId: z34.string().optional(),
1604
+ repositoryName: z34.string().optional()
1605
+ });
1606
+ var RiskGapsResponseSchema = z34.object({
1607
+ gaps: z34.array(RiskGapSchema),
1608
+ byType: z34.record(z34.array(RiskGapSchema))
1609
+ });
1610
+ var RiskListItemSchema = z34.object({
1611
+ id: z34.string(),
1612
+ documentId: z34.string(),
1613
+ title: z34.string(),
1614
+ type: RiskDocumentTypeSchema,
1615
+ harmAssessmentCount: z34.number().int().min(0),
1616
+ worstInherentSeverity: RiskValueSchema.optional(),
1617
+ worstInherentProbability: RiskValueSchema.optional(),
1618
+ worstResidualSeverity: RiskValueSchema.optional(),
1619
+ worstResidualProbability: RiskValueSchema.optional(),
1620
+ worstAcceptability: AcceptabilityStatusSchema.optional(),
1621
+ mitigationsCount: z34.number().int().min(0),
1622
+ hasRiskBenefit: z34.boolean(),
1623
+ cvssScore: z34.number().min(0).max(10).optional(),
1624
+ cvssVector: z34.string().optional()
1625
+ });
1626
+ var RiskListResponseSchema = z34.object({
1627
+ risks: z34.array(RiskListItemSchema),
1628
+ total: z34.number()
1629
+ });
1630
+
1631
+ // ../contracts/dist/documents/requests.js
1632
+ import { z as z35 } from "zod";
1633
+ var DocumentSourceTypeSchema = z35.enum([
1634
+ "markdown",
1635
+ "pdf"
1636
+ ]);
1637
+ var ChangeTypeSchema2 = z35.enum(["added", "modified", "removed"]);
1638
+ var GetDocumentsQuerySchema = z35.object({
1639
+ organizationId: z35.string().min(1),
1640
+ repositoryId: z35.string().min(1).optional(),
1641
+ docType: DocumentTypeSchema.optional(),
1642
+ status: DocumentStatusSchema.optional(),
1643
+ searchQuery: z35.string().optional(),
1644
+ limit: z35.coerce.number().int().positive().max(200).default(50),
1645
+ offset: z35.coerce.number().int().nonnegative().default(0)
1646
+ });
1647
+ var GetDocumentQuerySchema = z35.object({
1648
+ organizationId: z35.string().min(1),
1649
+ includeChangelog: z35.string().transform((v) => v === "true").pipe(z35.boolean()).default("false")
1650
+ });
1651
+ var GetDocumentContentQuerySchema = z35.object({
1652
+ organizationId: z35.string().min(1),
1653
+ commitSha: z35.string().min(1).optional()
1654
+ });
1655
+ var GetTraceabilityMatrixQuerySchema = z35.object({
1656
+ organizationId: z35.string().min(1),
1657
+ repositoryId: z35.string().min(1).optional(),
1658
+ sourceType: DocumentTypeSchema,
1659
+ targetType: DocumentTypeSchema,
1660
+ linkType: LinkTypeSchema,
1661
+ statusFilter: z35.string().transform((v) => v.split(",").filter(Boolean)).pipe(z35.array(DocumentStatusSchema)).optional()
1662
+ });
1663
+ var GetGapsQuerySchema = z35.object({
1664
+ organizationId: z35.string().min(1),
1665
+ repositoryId: z35.string().min(1).optional(),
1666
+ docTypes: z35.string().transform((v) => v.split(",").filter(Boolean)).pipe(z35.array(DocumentTypeSchema)).optional()
1667
+ });
1668
+ var GetDeviceTraceabilityMatrixQuerySchema = z35.object({
1669
+ sourceType: DocumentTypeSchema,
1670
+ targetType: DocumentTypeSchema,
1671
+ linkType: LinkTypeSchema,
1672
+ statusFilter: z35.string().transform((v) => v.split(",").filter(Boolean)).pipe(z35.array(DocumentStatusSchema)).optional()
1673
+ });
1674
+ var GetDeviceGapsQuerySchema = z35.object({
1675
+ docTypes: z35.string().transform((v) => v.split(",").filter(Boolean)).pipe(z35.array(DocumentTypeSchema)).optional()
1676
+ });
1677
+ var DocumentIdParamSchema = z35.object({
1678
+ documentId: z35.string().min(1)
1679
+ });
1680
+
1681
+ // ../contracts/dist/documents/responses.js
1682
+ import { z as z36 } from "zod";
1683
+ var ChangelogEntryResponseSchema = z36.object({
1684
+ id: z36.string(),
1685
+ changeType: ChangeTypeSchema2,
1686
+ commitSha: z36.string(),
1687
+ previousCommitSha: z36.string().optional(),
1688
+ changedBy: z36.string().optional(),
1689
+ changedByEmail: z36.string().optional(),
1690
+ changedAt: z36.string(),
1691
+ // ISO datetime
1692
+ pullRequestNumber: z36.number().optional(),
1693
+ pullRequestTitle: z36.string().optional(),
1694
+ releaseId: z36.string().optional(),
1695
+ releaseName: z36.string().optional(),
1696
+ changeSummary: z36.string().optional()
1697
+ });
1698
+ var LinkResponseSchema = z36.object({
1699
+ id: z36.string(),
1700
+ sourceDocumentId: z36.string(),
1701
+ targetDocumentId: z36.string(),
1702
+ linkType: LinkTypeSchema,
1703
+ sourceDocPath: z36.string(),
1704
+ targetDocPath: z36.string(),
1705
+ sourceRepositoryId: z36.string(),
1706
+ targetRepositoryId: z36.string().optional(),
1707
+ rationale: z36.string().optional()
1708
+ });
1709
+ var DocumentSummaryResponseSchema = z36.object({
1710
+ id: z36.string(),
1711
+ documentId: z36.string(),
1712
+ title: z36.string(),
1713
+ docType: DocumentTypeSchema,
1714
+ status: DocumentStatusSchema,
1715
+ sourceType: DocumentSourceTypeSchema,
1716
+ path: z36.string(),
1717
+ repositoryId: z36.string(),
1718
+ repositoryName: z36.string(),
1719
+ repositoryType: z36.enum(["qms", "device"]),
1720
+ lastSyncedAt: z36.string(),
1721
+ // ISO datetime
1722
+ metadata: z36.record(z36.string(), z36.unknown()).optional()
1723
+ });
1724
+ var DocumentDetailResponseSchema = DocumentSummaryResponseSchema.extend({
1725
+ metadata: z36.record(z36.string(), z36.unknown()),
1726
+ currentCommitSha: z36.string(),
1727
+ sourcePath: z36.string().nullable(),
1728
+ changelog: z36.array(ChangelogEntryResponseSchema).optional(),
1729
+ incomingLinks: z36.array(LinkResponseSchema).optional(),
1730
+ outgoingLinks: z36.array(LinkResponseSchema).optional()
1731
+ });
1732
+ var DocumentContentResponseSchema = z36.object({
1733
+ content: z36.string(),
1734
+ commitSha: z36.string(),
1735
+ path: z36.string(),
1736
+ githubUrl: z36.string()
1737
+ });
1738
+ var GetDocumentsResponseSchema = z36.object({
1739
+ documents: z36.array(DocumentSummaryResponseSchema),
1740
+ total: z36.number(),
1741
+ limit: z36.number(),
1742
+ offset: z36.number()
1743
+ });
1744
+ var TraceabilityRowSchema = z36.object({
1745
+ sourceId: z36.string(),
1746
+ sourceDocumentId: z36.string(),
1747
+ sourceTitle: z36.string(),
1748
+ sourcePath: z36.string(),
1749
+ linked: z36.boolean(),
1750
+ targetIds: z36.array(z36.string()),
1751
+ targetDocumentIds: z36.array(z36.string()),
1752
+ targetTitles: z36.array(z36.string())
1753
+ });
1754
+ var TraceabilityMatrixResponseSchema = z36.object({
1755
+ sourceType: DocumentTypeSchema,
1756
+ targetType: DocumentTypeSchema,
1757
+ linkType: LinkTypeSchema,
1758
+ coveragePercent: z36.number(),
1759
+ totalSources: z36.number(),
1760
+ coveredSources: z36.number(),
1761
+ rows: z36.array(TraceabilityRowSchema)
1762
+ });
1763
+ var GapItemSchema = z36.object({
1764
+ documentId: z36.string(),
1765
+ documentTitle: z36.string(),
1766
+ documentPath: z36.string(),
1767
+ docType: DocumentTypeSchema,
1768
+ missingLinkType: LinkTypeSchema,
1769
+ expectedTargetType: DocumentTypeSchema
1770
+ });
1771
+ var GapsResponseSchema = z36.object({
1772
+ totalGaps: z36.number(),
1773
+ gaps: z36.array(GapItemSchema)
1774
+ });
1775
+ var ComponentResponseSchema = z36.object({
1776
+ id: z36.string(),
1777
+ componentName: z36.string(),
1778
+ version: z36.string(),
1779
+ license: z36.string().optional(),
1780
+ safetyRiskClass: z36.string().optional(),
1781
+ purpose: z36.string().optional(),
1782
+ verification: z36.string().optional(),
1783
+ cveStatus: z36.string().optional(),
1784
+ category: z36.string().optional(),
1785
+ supplierId: z36.string().optional(),
1786
+ sourceFormat: z36.enum(["markdown_table", "cyclonedx", "spdx"]),
1787
+ purl: z36.string().optional()
1788
+ });
1789
+ var GetComponentsResponseSchema = z36.array(ComponentResponseSchema);
1790
+
1791
+ // ../contracts/dist/documents/signoff.js
1792
+ import { z as z37 } from "zod";
1793
+ var DocumentSignoffObligationSchema = z37.object({
1794
+ obligationId: z37.string(),
1795
+ role: z37.enum(["author", "reviewer", "approver"]),
1796
+ department: z37.string(),
1797
+ status: z37.enum(["pending", "fulfilled"]),
1798
+ fulfilledByUserId: z37.string().optional(),
1799
+ fulfilledByUserEmail: z37.string().optional(),
1800
+ fulfilledByUserDisplayName: z37.string().optional(),
1801
+ fulfilledAt: z37.string().optional(),
1802
+ signatureId: z37.string().optional()
1803
+ });
1804
+ var DocumentSignoffStatusResponseSchema = z37.object({
1805
+ documentId: z37.string(),
1806
+ commitSha: z37.string(),
1807
+ obligations: z37.array(DocumentSignoffObligationSchema),
1808
+ progress: z37.object({
1809
+ total: z37.number(),
1810
+ fulfilled: z37.number(),
1811
+ isComplete: z37.boolean()
1812
+ })
1813
+ });
1814
+ var DocumentExportResponseSchema = z37.object({
1815
+ message: z37.string()
1816
+ });
1817
+
1818
+ // ../contracts/dist/documents/compiled.js
1819
+ import { z as z38 } from "zod";
1820
+ var CompiledDocumentPresetSchema = z38.enum(["srs", "prs", "dmr", "risk"]);
1821
+ var CompiledDocumentQuerySchema = z38.object({
1822
+ organizationId: z38.string().min(1),
1823
+ repositoryId: z38.string().min(1).optional(),
1824
+ docType: DocumentTypeSchema.optional(),
1825
+ category: z38.string().optional(),
1826
+ status: DocumentStatusSchema.optional(),
1827
+ preset: CompiledDocumentPresetSchema.optional()
1828
+ }).refine((data) => data.preset || data.docType, {
1829
+ message: "Either preset or docType must be provided"
1830
+ });
1831
+ var CompiledTableOfContentsEntrySchema = z38.object({
1832
+ documentId: z38.string(),
1833
+ title: z38.string(),
1834
+ anchor: z38.string()
1835
+ });
1836
+ var CompiledDocumentItemSchema = z38.object({
1837
+ documentId: z38.string(),
1838
+ title: z38.string(),
1839
+ docType: DocumentTypeSchema,
1840
+ status: DocumentStatusSchema,
1841
+ path: z38.string(),
1842
+ content: z38.string(),
1843
+ anchor: z38.string()
1844
+ });
1845
+ var CompiledDocumentResponseSchema = z38.object({
1846
+ title: z38.string(),
1847
+ generatedAt: z38.string(),
1848
+ documentCount: z38.number(),
1849
+ tableOfContents: z38.array(CompiledTableOfContentsEntrySchema),
1850
+ documents: z38.array(CompiledDocumentItemSchema)
1851
+ });
1852
+
1853
+ // ../contracts/dist/releases/requests.js
1854
+ import { z as z39 } from "zod";
1855
+ var ReleaseTypeSchema2 = z39.enum(["qms", "device"]);
1856
+ var ReleaseStatusSchema2 = z39.enum(["draft", "in_review", "approved", "published"]);
1857
+ var SignatureTypeSchema2 = z39.enum([
1858
+ "author",
1859
+ "reviewer",
1860
+ "approver",
1861
+ "dept_reviewer",
1862
+ "final_approver",
1863
+ "trainee",
1864
+ "trainer"
1865
+ ]);
1866
+ var ReleaseChangeTypeSchema = z39.enum(["added", "modified", "removed"]);
1867
+ var ListReleasesQuerySchema = z39.object({
1868
+ organizationId: z39.string().min(1),
1869
+ status: ReleaseStatusSchema2.optional(),
1870
+ type: ReleaseTypeSchema2.optional(),
1871
+ deviceId: z39.string().optional(),
1872
+ limit: z39.coerce.number().int().positive().max(100).default(50),
1873
+ offset: z39.coerce.number().int().nonnegative().default(0)
1874
+ });
1875
+ var GetReleaseQuerySchema = z39.object({
1876
+ organizationId: z39.string().min(1),
1877
+ includeSignatures: z39.string().transform((v) => v === "true").pipe(z39.boolean()).default("false"),
1878
+ includeSnapshot: z39.string().transform((v) => v === "true").pipe(z39.boolean()).default("false")
1879
+ });
1880
+ var GetSignaturesQuerySchema = z39.object({
1881
+ organizationId: z39.string().min(1)
1882
+ });
1883
+ var GetChangedDocumentsQuerySchema = z39.object({
1884
+ organizationId: z39.string().min(1),
1885
+ type: ReleaseTypeSchema2,
1886
+ deviceId: z39.string().optional()
1887
+ });
1888
+ var ReleaseIdParamSchema = z39.object({
1889
+ releaseId: z39.string().min(1)
1890
+ });
1891
+ var DHRMarketEntrySchema = z39.object({
1892
+ country: z39.string().min(1),
1893
+ clinicalEvaluation: z39.boolean()
1894
+ });
1895
+ var DHRTestEvidenceEntrySchema = z39.object({
1896
+ label: z39.string().min(1),
1897
+ url: z39.string().url()
1898
+ });
1899
+ var DHRMetadataSchema = z39.object({
1900
+ markets: z39.array(DHRMarketEntrySchema).default([]),
1901
+ udi: z39.string().nullable().default(null),
1902
+ automatedTestEvidence: z39.array(DHRTestEvidenceEntrySchema).default([])
1903
+ });
1904
+ var DeploymentReferenceTypeSchema = z39.enum([
1905
+ "artifact",
1906
+ "pipeline",
1907
+ "deployment",
1908
+ "other"
1909
+ ]);
1910
+ var DeploymentReferenceSchema = z39.object({
1911
+ label: z39.string().min(1).max(200),
1912
+ url: z39.string().url(),
1913
+ type: DeploymentReferenceTypeSchema
1914
+ });
1915
+ var CreateReleaseRequestSchema = z39.object({
1916
+ organizationId: z39.string().min(1),
1917
+ name: z39.string().min(1).max(200),
1918
+ description: z39.string().max(2e3).optional(),
1919
+ type: ReleaseTypeSchema2,
1920
+ deviceId: z39.string().optional(),
1921
+ releasePlanDocumentId: z39.string().min(1).optional(),
1922
+ designReviewId: z39.string().min(1).optional(),
1923
+ releaseNotesDocumentId: z39.string().min(1).optional(),
1924
+ deviationNotes: z39.string().max(5e3).optional(),
1925
+ dhr: DHRMetadataSchema.optional(),
1926
+ reason: z39.string().max(500).optional()
1927
+ }).strict();
1928
+ var UpdateReleaseRequestSchema = z39.object({
1929
+ organizationId: z39.string().min(1),
1930
+ name: z39.string().min(1).max(200).optional(),
1931
+ description: z39.string().max(2e3).optional(),
1932
+ releasePlanDocumentId: z39.string().min(1).nullable().optional(),
1933
+ designReviewId: z39.string().min(1).nullable().optional(),
1934
+ releaseNotesDocumentId: z39.string().min(1).nullable().optional(),
1935
+ deviationNotes: z39.string().max(5e3).optional(),
1936
+ dhr: DHRMetadataSchema.nullable().optional(),
1937
+ deploymentReferences: z39.array(DeploymentReferenceSchema).optional(),
1938
+ smokeTestEvidence: z39.array(DHRTestEvidenceEntrySchema).optional(),
1939
+ reason: z39.string().max(500).optional()
1940
+ }).strict();
1941
+ var AddSignatureRequestSchema = z39.object({
1942
+ organizationId: z39.string().min(1),
1943
+ obligationId: z39.string().min(1),
1944
+ meaning: z39.string().min(1).max(500),
1945
+ /** Fresh Firebase ID token for per-signature re-authentication (Part 11 §11.200) */
1946
+ idToken: z39.string().min(1).optional(),
1947
+ /** Part 11: ID of the ERSD version the signer accepted */
1948
+ ersdDisclosureId: z39.string().min(1),
1949
+ /** Part 11: ISO date string when the signer accepted the ERSD */
1950
+ ersdAcceptedAt: z39.string().datetime()
1951
+ }).strict();
1952
+ var SubmitReleaseRequestSchema = z39.object({
1953
+ organizationId: z39.string().min(1),
1954
+ reason: z39.string().max(500).optional()
1955
+ });
1956
+ var WithdrawReleaseRequestSchema = z39.object({
1957
+ organizationId: z39.string().min(1),
1958
+ reason: z39.string().max(500).optional()
1959
+ });
1960
+ var PublishReleaseRequestSchema = z39.object({
1961
+ organizationId: z39.string().min(1),
1962
+ reason: z39.string().max(500).optional()
1963
+ });
1964
+ var DeleteReleaseQuerySchema = z39.object({
1965
+ organizationId: z39.string().min(1)
1966
+ });
1967
+ var UpdateChecklistItemParamSchema = z39.object({
1968
+ releaseId: z39.string().min(1),
1969
+ templateItemId: z39.string().min(1)
1970
+ });
1971
+ var UpdateChecklistItemRequestSchema = z39.object({
1972
+ organizationId: z39.string().min(1),
1973
+ checked: z39.boolean(),
1974
+ evidence: z39.string().max(2e3).optional()
1975
+ }).strict();
1976
+ var GateOverrideCategoryParamSchema = z39.object({
1977
+ releaseId: z39.string().min(1),
1978
+ category: GateOverrideCategorySchema
1979
+ });
1980
+ var AddGateOverrideRequestSchema = z39.object({
1981
+ organizationId: z39.string().min(1),
1982
+ category: GateOverrideCategorySchema,
1983
+ justification: z39.string().min(20).max(2e3)
1984
+ }).strict();
1985
+ var RemoveGateOverrideQuerySchema = z39.object({
1986
+ organizationId: z39.string().min(1)
1987
+ });
1988
+
1989
+ // ../contracts/dist/releases/responses.js
1990
+ import { z as z40 } from "zod";
1991
+ var ReleaseChangeResponseSchema = z40.object({
1992
+ repositoryId: z40.string(),
1993
+ documentId: z40.string(),
1994
+ documentPath: z40.string(),
1995
+ documentTitle: z40.string(),
1996
+ documentType: z40.string(),
1997
+ commitSha: z40.string(),
1998
+ changeType: ReleaseChangeTypeSchema
1999
+ });
2000
+ var SignatureResponseSchema = z40.object({
2001
+ id: z40.string(),
2002
+ releaseId: z40.string(),
2003
+ obligationId: z40.string(),
2004
+ userId: z40.string(),
2005
+ userEmail: z40.string(),
2006
+ userDisplayName: z40.string(),
2007
+ userDepartment: z40.string(),
2008
+ signatureType: SignatureTypeSchema2,
2009
+ meaning: z40.string(),
2010
+ timestamp: z40.string(),
2011
+ // ISO datetime
2012
+ signedCommitShas: z40.array(z40.string())
2013
+ });
2014
+ var SigningObligationRoleSchema = z40.enum(["author", "reviewer", "approver"]);
2015
+ var SigningObligationStatusSchema = z40.enum(["pending", "fulfilled"]);
2016
+ var SigningObligationResponseSchema = z40.object({
2017
+ obligationId: z40.string(),
2018
+ role: SigningObligationRoleSchema,
2019
+ department: z40.string(),
2020
+ documentIds: z40.array(z40.string()),
2021
+ status: SigningObligationStatusSchema,
2022
+ fulfilledBySignatureId: z40.string().optional(),
2023
+ fulfilledAt: z40.string().optional()
2024
+ });
2025
+ var SigningObligationsSummarySchema = z40.object({
2026
+ total: z40.number(),
2027
+ fulfilled: z40.number(),
2028
+ pending: z40.number()
2029
+ });
2030
+ var SnapshotLinkSchema = z40.object({
2031
+ sourceDocumentId: z40.string(),
2032
+ targetDocumentId: z40.string(),
2033
+ linkType: z40.string()
2034
+ });
2035
+ var RiskMatrixCellSchema = z40.object({
2036
+ count: z40.number(),
2037
+ acceptability: z40.enum(["acceptable", "review_required", "unacceptable"])
2038
+ });
2039
+ var SnapshotGapSchema = z40.object({
2040
+ code: z40.string(),
2041
+ severity: z40.enum(["error", "warning"]),
2042
+ documentId: z40.string(),
2043
+ documentTitle: z40.string(),
2044
+ message: z40.string()
2045
+ });
2046
+ var SnapshotTraceabilityChainEntrySchema = z40.object({
2047
+ hazardId: z40.string(),
2048
+ hazardTitle: z40.string(),
2049
+ situationId: z40.string(),
2050
+ situationTitle: z40.string(),
2051
+ harmId: z40.string(),
2052
+ harmTitle: z40.string(),
2053
+ riskId: z40.string(),
2054
+ riskTitle: z40.string(),
2055
+ riskType: z40.string(),
2056
+ inherentSeverity: z40.number(),
2057
+ inherentProbability: z40.number(),
2058
+ residualSeverity: z40.number(),
2059
+ residualProbability: z40.number(),
2060
+ acceptability: z40.string(),
2061
+ controls: z40.array(z40.string()),
2062
+ cvssScore: z40.number().optional(),
2063
+ cvssVector: z40.string().optional()
2064
+ });
2065
+ var SnapshotPlanReferenceSchema = z40.object({
2066
+ documentId: z40.string(),
2067
+ title: z40.string(),
2068
+ commitSha: z40.string(),
2069
+ safetyClass: z40.string(),
2070
+ postProductionReference: z40.string().optional()
2071
+ });
2072
+ var ComponentSnapshotEntryResponseSchema = z40.object({
2073
+ componentName: z40.string(),
2074
+ version: z40.string(),
2075
+ license: z40.string().optional(),
2076
+ safetyRiskClass: z40.string().optional(),
2077
+ sourceFormat: z40.enum(["markdown_table", "cyclonedx", "spdx"])
2078
+ });
2079
+ var ReleaseSnapshotResponseSchema = z40.object({
2080
+ traceabilityLinks: z40.array(SnapshotLinkSchema),
2081
+ traceabilityCoverage: z40.number(),
2082
+ riskMatrix: z40.object({
2083
+ inherent: z40.array(z40.array(z40.number())),
2084
+ residual: z40.array(z40.array(z40.number())),
2085
+ acceptability: z40.array(z40.array(z40.enum(["acceptable", "review_required", "unacceptable"]))),
2086
+ summary: z40.object({
2087
+ total: z40.number(),
2088
+ acceptable: z40.number(),
2089
+ reviewRequired: z40.number(),
2090
+ unacceptable: z40.number()
2091
+ })
2092
+ }),
2093
+ gaps: z40.array(SnapshotGapSchema),
2094
+ gapsSummary: z40.object({
2095
+ errorCount: z40.number(),
2096
+ warningCount: z40.number()
2097
+ }),
2098
+ riskTraceabilityChain: z40.array(SnapshotTraceabilityChainEntrySchema).optional(),
2099
+ riskManagementPlan: SnapshotPlanReferenceSchema.optional(),
2100
+ componentSnapshots: z40.record(z40.array(ComponentSnapshotEntryResponseSchema)).optional()
2101
+ });
2102
+ var DHRMarketEntryResponseSchema = z40.object({
2103
+ country: z40.string(),
2104
+ clinicalEvaluation: z40.boolean()
2105
+ });
2106
+ var DHRTestEvidenceEntryResponseSchema = z40.object({
2107
+ label: z40.string(),
2108
+ url: z40.string()
2109
+ });
2110
+ var DHRMetadataResponseSchema = z40.object({
2111
+ markets: z40.array(DHRMarketEntryResponseSchema),
2112
+ udi: z40.string().nullable(),
2113
+ automatedTestEvidence: z40.array(DHRTestEvidenceEntryResponseSchema)
2114
+ });
2115
+ var DeploymentReferenceResponseSchema = z40.object({
2116
+ label: z40.string(),
2117
+ url: z40.string(),
2118
+ type: z40.string()
2119
+ });
2120
+ var GateOverrideResponseSchema = z40.object({
2121
+ category: z40.string(),
2122
+ justification: z40.string(),
2123
+ gapDocumentIds: z40.array(z40.string()),
2124
+ gapCount: z40.number(),
2125
+ createdBy: z40.string(),
2126
+ createdByEmail: z40.string(),
2127
+ createdByDepartment: z40.string(),
2128
+ createdAt: z40.string()
2129
+ });
2130
+ var ReleaseChecklistItemResponseSchema = z40.object({
2131
+ templateItemId: z40.string(),
2132
+ label: z40.string(),
2133
+ checked: z40.boolean(),
2134
+ evidence: z40.string().optional(),
2135
+ updatedBy: z40.string().optional(),
2136
+ updatedAt: z40.string().optional()
2137
+ });
2138
+ var ReleaseDocumentManifestEntrySchema = z40.object({
2139
+ documentId: z40.string(),
2140
+ title: z40.string(),
2141
+ type: z40.string(),
2142
+ path: z40.string(),
2143
+ commitSha: z40.string()
2144
+ });
2145
+ var ReleaseSummaryResponseSchema = z40.object({
2146
+ id: z40.string(),
2147
+ name: z40.string(),
2148
+ description: z40.string().optional(),
2149
+ type: ReleaseTypeSchema2,
2150
+ deviceId: z40.string().optional(),
2151
+ status: ReleaseStatusSchema2,
2152
+ changesCount: z40.number(),
2153
+ signaturesCount: z40.number(),
2154
+ obligationsSummary: SigningObligationsSummarySchema,
2155
+ createdBy: z40.string(),
2156
+ createdAt: z40.string(),
2157
+ // ISO datetime
2158
+ submittedForReviewAt: z40.string().optional(),
2159
+ approvedAt: z40.string().optional(),
2160
+ publishedAt: z40.string().optional(),
2161
+ obligationsDerivedAt: z40.string().optional(),
2162
+ obligationsDerivationVersion: z40.number().optional(),
2163
+ obligationsInputHash: z40.string().optional(),
2164
+ releasePlanDocumentId: z40.string().optional(),
2165
+ designReviewId: z40.string().optional(),
2166
+ releaseNotesDocumentId: z40.string().optional(),
2167
+ deviationNotes: z40.string().optional(),
2168
+ dhr: DHRMetadataResponseSchema.optional(),
2169
+ version: z40.string().optional()
2170
+ });
2171
+ var ReleaseDetailResponseSchema = ReleaseSummaryResponseSchema.extend({
2172
+ changes: z40.array(ReleaseChangeResponseSchema),
2173
+ signingObligations: z40.array(SigningObligationResponseSchema),
2174
+ signatures: z40.array(SignatureResponseSchema).optional(),
2175
+ snapshot: ReleaseSnapshotResponseSchema.optional(),
2176
+ checklist: z40.array(ReleaseChecklistItemResponseSchema).optional(),
2177
+ releaseCommitSha: z40.string().optional(),
2178
+ previousReleaseId: z40.string().optional(),
2179
+ previousReleaseCommitSha: z40.string().optional(),
2180
+ deploymentReferences: z40.array(DeploymentReferenceResponseSchema).optional(),
2181
+ smokeTestEvidence: z40.array(z40.object({ label: z40.string(), url: z40.string() })).optional(),
2182
+ gateOverrides: z40.array(GateOverrideResponseSchema).default([]),
2183
+ documentManifest: z40.array(ReleaseDocumentManifestEntrySchema).optional()
2184
+ });
2185
+ var ListReleasesResponseSchema = z40.object({
2186
+ releases: z40.array(ReleaseSummaryResponseSchema),
2187
+ total: z40.number(),
2188
+ limit: z40.number(),
2189
+ offset: z40.number()
2190
+ });
2191
+ var GetSignaturesResponseSchema = z40.object({
2192
+ signatures: z40.array(SignatureResponseSchema)
2193
+ });
2194
+ var ChangedDocumentResponseSchema = z40.object({
2195
+ documentId: z40.string(),
2196
+ repositoryId: z40.string(),
2197
+ documentPath: z40.string(),
2198
+ documentTitle: z40.string(),
2199
+ documentType: z40.string(),
2200
+ currentCommitSha: z40.string(),
2201
+ previousCommitSha: z40.string().optional(),
2202
+ changeType: ReleaseChangeTypeSchema
2203
+ });
2204
+ var GetChangedDocumentsResponseSchema = z40.object({
2205
+ changes: z40.array(ChangedDocumentResponseSchema),
2206
+ previousReleaseId: z40.string().optional(),
2207
+ previousReleaseName: z40.string().optional()
2208
+ });
2209
+ var CreateReleaseResponseSchema = z40.object({
2210
+ id: z40.string(),
2211
+ release: ReleaseDetailResponseSchema
2212
+ });
2213
+ var ReleaseStatusChangeResponseSchema = z40.object({
2214
+ success: z40.boolean(),
2215
+ release: ReleaseDetailResponseSchema
2216
+ });
2217
+ var AddSignatureResponseSchema = z40.object({
2218
+ signature: SignatureResponseSchema,
2219
+ releaseStatus: ReleaseStatusSchema2,
2220
+ isAutoApproved: z40.boolean()
2221
+ });
2222
+
2223
+ // ../contracts/dist/releases/comparison.js
2224
+ import { z as z41 } from "zod";
2225
+ var ComparisonChangeTypeSchema = z41.enum(["added", "modified", "removed", "unchanged"]);
2226
+ var GetReleaseComparisonQuerySchema = z41.object({
2227
+ organizationId: z41.string().min(1),
2228
+ baseReleaseId: z41.string().min(1).optional()
2229
+ });
2230
+ var ComparisonReleaseInfoSchema = z41.object({
2231
+ id: z41.string(),
2232
+ name: z41.string(),
2233
+ publishedAt: z41.string().nullable()
2234
+ });
2235
+ var ComparisonCommitRefSchema = z41.object({
2236
+ commitSha: z41.string()
2237
+ });
2238
+ var ReleaseComparisonChangeSchema = z41.object({
2239
+ documentId: z41.string(),
2240
+ documentTitle: z41.string(),
2241
+ documentType: z41.string(),
2242
+ documentPath: z41.string(),
2243
+ changeType: ComparisonChangeTypeSchema,
2244
+ target: ComparisonCommitRefSchema.nullable(),
2245
+ base: ComparisonCommitRefSchema.nullable()
2246
+ });
2247
+ var ComparisonSummarySchema = z41.object({
2248
+ added: z41.number(),
2249
+ modified: z41.number(),
2250
+ removed: z41.number(),
2251
+ unchanged: z41.number()
2252
+ });
2253
+ var BaselineOptionSchema = z41.object({
2254
+ id: z41.string(),
2255
+ name: z41.string(),
2256
+ publishedAt: z41.string()
2257
+ });
2258
+ var ReleaseComparisonResponseSchema = z41.object({
2259
+ targetRelease: ComparisonReleaseInfoSchema,
2260
+ baseRelease: ComparisonReleaseInfoSchema.nullable(),
2261
+ changes: z41.array(ReleaseComparisonChangeSchema),
2262
+ summary: ComparisonSummarySchema,
2263
+ fallback: z41.boolean(),
2264
+ baselineOptions: z41.array(BaselineOptionSchema)
2265
+ });
2266
+
2267
+ // ../contracts/dist/qms/requests.js
2268
+ import { z as z42 } from "zod";
2269
+ var CreateQmsRequestSchema = z42.object({
2270
+ organizationId: z42.string().min(1),
2271
+ repositoryId: z42.string().min(1),
2272
+ name: z42.string().min(1).max(100)
2273
+ });
2274
+ var UpdateQmsRequestSchema = z42.object({
2275
+ name: z42.string().min(1).max(100).optional()
2276
+ });
2277
+ var QmsIdParamSchema = z42.object({
2278
+ orgId: z42.string().min(1),
2279
+ qmsId: z42.string().min(1)
2280
+ });
2281
+
2282
+ // ../contracts/dist/qms/responses.js
2283
+ import { z as z43 } from "zod";
2284
+ var QmsResponseSchema = z43.object({
2285
+ id: z43.string(),
2286
+ organizationId: z43.string(),
2287
+ repositoryId: z43.string(),
2288
+ name: z43.string(),
2289
+ createdAt: z43.string(),
2290
+ createdBy: z43.string()
2291
+ });
2292
+
2293
+ // ../contracts/dist/devices/requests.js
2294
+ import { z as z44 } from "zod";
2295
+ var CreateDeviceRequestSchema = z44.object({
2296
+ organizationId: z44.string().min(1),
2297
+ repositoryId: z44.string().min(1),
2298
+ name: z44.string().min(1).max(100),
2299
+ safetyClass: SafetyClassSchema
2300
+ });
2301
+ var UpdateDeviceRequestSchema = z44.object({
2302
+ name: z44.string().min(1).max(100).optional(),
2303
+ safetyClass: SafetyClassSchema.optional()
2304
+ });
2305
+ var DeviceIdParamSchema = z44.object({
2306
+ orgId: z44.string().min(1),
2307
+ deviceId: z44.string().min(1)
2308
+ });
2309
+ var DeviceListQuerySchema = z44.object({
2310
+ organizationId: z44.string().min(1)
2311
+ });
2312
+
2313
+ // ../contracts/dist/devices/responses.js
2314
+ import { z as z45 } from "zod";
2315
+ var DeviceResponseSchema = z45.object({
2316
+ id: z45.string(),
2317
+ organizationId: z45.string(),
2318
+ repositoryId: z45.string(),
2319
+ name: z45.string(),
2320
+ safetyClass: SafetyClassSchema,
2321
+ createdAt: z45.string(),
2322
+ createdBy: z45.string()
2323
+ });
2324
+
2325
+ // ../contracts/dist/dco/requests.js
2326
+ import { z as z46 } from "zod";
2327
+ var DCODocumentChangeTypeSchema = z46.enum(["new", "revision", "obsolete"]);
2328
+ var DCOStatusSchema = z46.enum(["draft", "pending_signatures", "approved", "effective"]);
2329
+ var DCOScopeSchema = z46.enum(["release", "documents", "maintenance"]);
2330
+ var DCODocumentEntrySchema = z46.object({
2331
+ documentId: z46.string().min(1),
2332
+ repositoryId: z46.string().min(1),
2333
+ commitSha: z46.string().min(1),
2334
+ changeType: DCODocumentChangeTypeSchema,
2335
+ changeDescription: z46.string().min(1).max(2e3)
2336
+ });
2337
+ var CreateDCORequestSchema = z46.object({
2338
+ title: z46.string().min(1).max(200),
2339
+ description: z46.string().min(1).max(5e3),
2340
+ scope: DCOScopeSchema,
2341
+ effectiveDate: z46.string().datetime(),
2342
+ documents: z46.array(DCODocumentEntrySchema).min(1),
2343
+ /** Required when scope='release' */
2344
+ releaseId: z46.string().min(1).optional()
2345
+ }).superRefine((data, ctx) => {
2346
+ if (data.scope === "release" && !data.releaseId) {
2347
+ ctx.addIssue({
2348
+ code: z46.ZodIssueCode.custom,
2349
+ message: 'releaseId is required when scope is "release"',
2350
+ path: ["releaseId"]
2351
+ });
2352
+ }
2353
+ });
2354
+ var UpdateDCORequestSchema = z46.object({
2355
+ title: z46.string().min(1).max(200).optional(),
2356
+ description: z46.string().min(1).max(5e3).optional(),
2357
+ effectiveDate: z46.string().datetime().optional(),
2358
+ documents: z46.array(DCODocumentEntrySchema).min(1).optional()
2359
+ });
2360
+ var SubmitDCORequestSchema = z46.object({
2361
+ departments: z46.array(z46.string().min(1)).min(1, "At least one department must be specified")
2362
+ });
2363
+ var FulfillDCOObligationRequestSchema = z46.object({
2364
+ obligationId: z46.string().min(1),
2365
+ meaning: z46.string().min(1).max(500),
2366
+ /** Fresh ID token from re-authentication (Part 11 §11.200 compliance) */
2367
+ idToken: z46.string().min(1),
2368
+ /** Part 11: ID of the ERSD version the signer accepted */
2369
+ ersdDisclosureId: z46.string().min(1),
2370
+ /** Part 11: ISO date string when the signer accepted the ERSD */
2371
+ ersdAcceptedAt: z46.string().datetime()
2372
+ });
2373
+ var DCOIdParamSchema = z46.object({
2374
+ orgId: z46.string().min(1),
2375
+ qmsId: z46.string().min(1),
2376
+ dcoId: z46.string().min(1)
2377
+ });
2378
+ var QmsDCOParamSchema = z46.object({
2379
+ orgId: z46.string().min(1),
2380
+ qmsId: z46.string().min(1)
2381
+ });
2382
+ var DCOListQuerySchema = PaginationParamsSchema.extend({
2383
+ status: DCOStatusSchema.optional(),
2384
+ scope: DCOScopeSchema.optional()
2385
+ });
2386
+
2387
+ // ../contracts/dist/dco/responses.js
2388
+ import { z as z47 } from "zod";
2389
+ var RevisionAssignmentSchema = z47.object({
2390
+ documentId: z47.string(),
2391
+ revisionNumber: z47.number()
2392
+ });
2393
+ var DCOSigningObligationSchema = z47.object({
2394
+ obligationId: z47.string(),
2395
+ department: z47.string(),
2396
+ status: z47.enum(["pending", "fulfilled"]),
2397
+ meaning: z47.string().optional(),
2398
+ fulfilledBySignatureId: z47.string().optional(),
2399
+ fulfilledAt: z47.string().optional()
2400
+ });
2401
+ var DCOResponseSchema = z47.object({
2402
+ id: z47.string(),
2403
+ organizationId: z47.string(),
2404
+ qmsId: z47.string(),
2405
+ dcoNumber: z47.string(),
2406
+ title: z47.string(),
2407
+ description: z47.string(),
2408
+ scope: DCOScopeSchema,
2409
+ releaseId: z47.string().optional(),
2410
+ documents: z47.array(DCODocumentEntrySchema),
2411
+ status: DCOStatusSchema,
2412
+ effectiveDate: z47.string(),
2413
+ createdAt: z47.string(),
2414
+ createdBy: z47.string(),
2415
+ approvedAt: z47.string().optional(),
2416
+ effectiveAt: z47.string().optional(),
2417
+ revisionAssignments: z47.array(RevisionAssignmentSchema),
2418
+ signingObligations: z47.array(DCOSigningObligationSchema)
2419
+ });
2420
+ var DCOListResponseSchema = z47.object({
2421
+ items: z47.array(DCOResponseSchema),
2422
+ total: z47.number(),
2423
+ limit: z47.number(),
2424
+ offset: z47.number()
2425
+ });
2426
+ var DocumentRevisionResponseSchema = z47.object({
2427
+ id: z47.string(),
2428
+ revisionNumber: z47.number(),
2429
+ dcoId: z47.string(),
2430
+ dcoNumber: z47.string(),
2431
+ releaseId: z47.string().optional(),
2432
+ releaseName: z47.string().optional(),
2433
+ commitSha: z47.string(),
2434
+ changeType: DCODocumentChangeTypeSchema,
2435
+ changeDescription: z47.string(),
2436
+ effectiveAt: z47.string(),
2437
+ effectiveBy: z47.string()
2438
+ });
2439
+ var RequestDCOExportResponseSchema = z47.object({
2440
+ message: z47.string(),
2441
+ estimatedMinutes: z47.number()
2442
+ });
2443
+
2444
+ // ../contracts/dist/capas/requests.js
2445
+ import { z as z48 } from "zod";
2446
+
2447
+ // ../contracts/dist/domain-types/capa.js
2448
+ var CAPA_STATUSES = [
2449
+ "open",
2450
+ "investigation",
2451
+ "implementation",
2452
+ "verification",
2453
+ "closed",
2454
+ "cancelled"
1136
2455
  ];
2456
+ var CAPA_CLASSIFICATIONS = ["corrective", "preventive"];
2457
+ var CAPA_PRIORITIES = ["low", "medium", "high", "critical"];
2458
+ var CAPA_SOURCE_TYPES = [
2459
+ "nonconformance",
2460
+ "complaint",
2461
+ "audit_finding",
2462
+ "observation",
2463
+ "other"
2464
+ ];
2465
+ var CAPA_ACTION_STATUSES = ["pending", "in_progress", "completed"];
1137
2466
 
1138
- // ../shared/dist/constants/index.js
1139
- var REQUIRED_SECTIONS = {
1140
- user_need: ["Purpose", "Stakeholder", "User Needs"],
1141
- architecture: ["Purpose"],
1142
- release_plan: ["Scope", "Applicable Plans", "Release-Specific Criteria", "Known Anomalies"],
1143
- design_review: ["Review Scope", "Attendees", "Findings", "Actions", "Conclusion"],
1144
- release_notes: ["Changes", "Known Issues"],
1145
- audit_schedule: ["Scope", "Audit Criteria"],
1146
- audit_report: ["Scope", "Methodology", "Findings", "Conclusion"],
1147
- management_review: ["Review Inputs", "Review Outputs", "Action Items", "Decisions"],
1148
- hazard_category: ["Description", "Examples", "Applicable Standards"]
1149
- };
2467
+ // ../contracts/dist/capas/requests.js
2468
+ var CapaStatusSchema = z48.enum(CAPA_STATUSES);
2469
+ var CapaClassificationSchema = z48.enum(CAPA_CLASSIFICATIONS);
2470
+ var CapaPrioritySchema = z48.enum(CAPA_PRIORITIES);
2471
+ var CapaSourceTypeSchema = z48.enum(CAPA_SOURCE_TYPES);
2472
+ var CapaActionStatusSchema = z48.enum(CAPA_ACTION_STATUSES);
2473
+ var QmsCapaParamSchema = z48.object({
2474
+ orgId: z48.string().min(1),
2475
+ qmsId: z48.string().min(1)
2476
+ });
2477
+ var CapaIdParamSchema = z48.object({
2478
+ orgId: z48.string().min(1),
2479
+ qmsId: z48.string().min(1),
2480
+ capaId: z48.string().min(1)
2481
+ });
2482
+ var CapaActionIdParamSchema = z48.object({
2483
+ orgId: z48.string().min(1),
2484
+ qmsId: z48.string().min(1),
2485
+ capaId: z48.string().min(1),
2486
+ actionId: z48.string().min(1)
2487
+ });
2488
+ var CreateCapaRequestSchema = z48.object({
2489
+ classification: CapaClassificationSchema,
2490
+ priority: CapaPrioritySchema,
2491
+ title: z48.string().min(1).max(200),
2492
+ description: z48.string().min(1).max(5e3),
2493
+ sourceType: CapaSourceTypeSchema,
2494
+ sourceDescription: z48.string().min(1).max(2e3),
2495
+ sourceId: z48.string().max(200).optional(),
2496
+ dueDate: z48.string().datetime().optional(),
2497
+ affectedDocumentIds: z48.array(z48.string().min(1)).default([]),
2498
+ affectedDeviceIds: z48.array(z48.string().min(1)).default([])
2499
+ });
2500
+ var UpdateCapaRequestSchema = z48.object({
2501
+ title: z48.string().min(1).max(200).optional(),
2502
+ description: z48.string().min(1).max(5e3).optional(),
2503
+ priority: CapaPrioritySchema.optional(),
2504
+ rootCauseDescription: z48.string().max(5e3).optional(),
2505
+ verificationDescription: z48.string().max(5e3).optional(),
2506
+ affectedDocumentIds: z48.array(z48.string().min(1)).optional(),
2507
+ affectedDeviceIds: z48.array(z48.string().min(1)).optional(),
2508
+ dueDate: z48.string().datetime().nullable().optional()
2509
+ });
2510
+ var CloseCapaRequestSchema = z48.object({
2511
+ signatureId: z48.string().min(1)
2512
+ });
2513
+ var AddCapaActionRequestSchema = z48.object({
2514
+ description: z48.string().min(1).max(2e3),
2515
+ assigneeId: z48.string().min(1),
2516
+ dueDate: z48.string().datetime(),
2517
+ notes: z48.string().max(2e3).optional()
2518
+ });
2519
+ var UpdateCapaActionRequestSchema = z48.object({
2520
+ description: z48.string().min(1).max(2e3).optional(),
2521
+ assigneeId: z48.string().min(1).optional(),
2522
+ dueDate: z48.string().datetime().optional(),
2523
+ status: CapaActionStatusSchema.optional(),
2524
+ notes: z48.string().max(2e3).optional()
2525
+ });
2526
+ var CapaListQuerySchema = PaginationParamsSchema.extend({
2527
+ status: CapaStatusSchema.optional(),
2528
+ classification: CapaClassificationSchema.optional(),
2529
+ priority: CapaPrioritySchema.optional()
2530
+ });
1150
2531
 
1151
- // ../shared/dist/validators/permissions.js
1152
- import { z as z25 } from "zod";
1153
- var MemberPermissionsSchema = z25.object({
1154
- canSign: z25.boolean(),
1155
- canApprove: z25.boolean(),
1156
- canCreateRelease: z25.boolean(),
1157
- canPublishRelease: z25.boolean(),
1158
- canManageMembers: z25.boolean(),
1159
- canViewAuditLog: z25.boolean(),
1160
- canExport: z25.boolean()
2532
+ // ../contracts/dist/capas/responses.js
2533
+ import { z as z49 } from "zod";
2534
+ var CapaActionResponseSchema = z49.object({
2535
+ id: z49.string(),
2536
+ description: z49.string(),
2537
+ assigneeId: z49.string(),
2538
+ assigneeEmail: z49.string(),
2539
+ dueDate: z49.string(),
2540
+ status: CapaActionStatusSchema,
2541
+ completedAt: z49.string().optional(),
2542
+ notes: z49.string().optional()
2543
+ });
2544
+ var CapaResponseSchema = z49.object({
2545
+ id: z49.string(),
2546
+ qmsId: z49.string(),
2547
+ organizationId: z49.string(),
2548
+ capaNumber: z49.string(),
2549
+ classification: CapaClassificationSchema,
2550
+ priority: CapaPrioritySchema,
2551
+ title: z49.string(),
2552
+ description: z49.string(),
2553
+ sourceType: CapaSourceTypeSchema,
2554
+ sourceId: z49.string().optional(),
2555
+ sourceDescription: z49.string(),
2556
+ rootCauseDescription: z49.string().optional(),
2557
+ verificationDescription: z49.string().optional(),
2558
+ affectedDocumentIds: z49.array(z49.string()),
2559
+ affectedDeviceIds: z49.array(z49.string()),
2560
+ actions: z49.array(CapaActionResponseSchema),
2561
+ status: CapaStatusSchema,
2562
+ createdAt: z49.string(),
2563
+ createdBy: z49.string(),
2564
+ investigationStartedAt: z49.string().optional(),
2565
+ implementationStartedAt: z49.string().optional(),
2566
+ verificationStartedAt: z49.string().optional(),
2567
+ closedAt: z49.string().optional(),
2568
+ closedBy: z49.string().optional(),
2569
+ cancelledAt: z49.string().optional(),
2570
+ cancelledBy: z49.string().optional(),
2571
+ dueDate: z49.string().optional()
2572
+ });
2573
+ var CapaListResponseSchema = z49.object({
2574
+ items: z49.array(CapaResponseSchema),
2575
+ total: z49.number(),
2576
+ limit: z49.number(),
2577
+ offset: z49.number()
2578
+ });
2579
+
2580
+ // ../contracts/dist/complaints/requests.js
2581
+ import { z as z50 } from "zod";
2582
+
2583
+ // ../contracts/dist/domain-types/complaint.js
2584
+ var COMPLAINT_STATUSES = [
2585
+ "open",
2586
+ "investigating",
2587
+ "resolved",
2588
+ "closed",
2589
+ "cancelled"
2590
+ ];
2591
+ var COMPLAINT_SEVERITIES = ["low", "medium", "high", "critical"];
2592
+ var COMPLAINT_CATEGORIES = [
2593
+ "quality",
2594
+ "safety",
2595
+ "performance",
2596
+ "usability",
2597
+ "other"
2598
+ ];
2599
+ var COMPLAINT_SOURCES = ["customer", "internal", "regulatory", "distributor"];
2600
+
2601
+ // ../contracts/dist/complaints/requests.js
2602
+ var ComplaintStatusSchema = z50.enum(COMPLAINT_STATUSES);
2603
+ var ComplaintSeveritySchema = z50.enum(COMPLAINT_SEVERITIES);
2604
+ var ComplaintCategorySchema = z50.enum(COMPLAINT_CATEGORIES);
2605
+ var ComplaintSourceSchema = z50.enum(COMPLAINT_SOURCES);
2606
+ var QmsComplaintParamSchema = z50.object({
2607
+ orgId: z50.string().min(1),
2608
+ qmsId: z50.string().min(1)
2609
+ });
2610
+ var ComplaintIdParamSchema = z50.object({
2611
+ orgId: z50.string().min(1),
2612
+ qmsId: z50.string().min(1),
2613
+ complaintId: z50.string().min(1)
2614
+ });
2615
+ var ComplainantSchema = z50.object({
2616
+ name: z50.string().min(1).max(200),
2617
+ email: z50.string().email().optional(),
2618
+ phone: z50.string().max(50).optional(),
2619
+ organization: z50.string().max(200).optional()
2620
+ });
2621
+ var CreateComplaintRequestSchema = z50.object({
2622
+ title: z50.string().min(1).max(200),
2623
+ description: z50.string().min(1).max(5e3),
2624
+ severity: ComplaintSeveritySchema,
2625
+ category: ComplaintCategorySchema,
2626
+ source: ComplaintSourceSchema,
2627
+ receivedDate: z50.string().datetime(),
2628
+ complainant: ComplainantSchema,
2629
+ reportable: z50.boolean(),
2630
+ reportabilityJustification: z50.string().max(5e3).optional(),
2631
+ affectedDeviceIds: z50.array(z50.string().min(1)).default([]),
2632
+ affectedDocumentIds: z50.array(z50.string().min(1)).default([]),
2633
+ assigneeId: z50.string().min(1).optional(),
2634
+ dueDate: z50.string().datetime().optional()
2635
+ });
2636
+ var UpdateComplaintRequestSchema = z50.object({
2637
+ title: z50.string().min(1).max(200).optional(),
2638
+ description: z50.string().min(1).max(5e3).optional(),
2639
+ severity: ComplaintSeveritySchema.optional(),
2640
+ category: ComplaintCategorySchema.optional(),
2641
+ source: ComplaintSourceSchema.optional(),
2642
+ reportable: z50.boolean().optional(),
2643
+ reportabilityJustification: z50.string().max(5e3).optional(),
2644
+ investigationSummary: z50.string().max(5e3).optional(),
2645
+ rootCauseDescription: z50.string().max(5e3).optional(),
2646
+ resolutionDescription: z50.string().max(5e3).optional(),
2647
+ affectedDeviceIds: z50.array(z50.string().min(1)).optional(),
2648
+ affectedDocumentIds: z50.array(z50.string().min(1)).optional(),
2649
+ assigneeId: z50.string().min(1).nullable().optional(),
2650
+ dueDate: z50.string().datetime().nullable().optional()
2651
+ });
2652
+ var ResolveComplaintRequestSchema = z50.object({
2653
+ resolutionDescription: z50.string().min(1).max(5e3)
2654
+ });
2655
+ var CloseComplaintRequestSchema = z50.object({
2656
+ signatureId: z50.string().min(1)
2657
+ });
2658
+ var CancelComplaintRequestSchema = z50.object({
2659
+ reason: z50.string().min(1).max(5e3)
2660
+ });
2661
+ var ComplaintListQuerySchema = PaginationParamsSchema.extend({
2662
+ status: ComplaintStatusSchema.optional(),
2663
+ severity: ComplaintSeveritySchema.optional(),
2664
+ category: ComplaintCategorySchema.optional(),
2665
+ source: ComplaintSourceSchema.optional()
2666
+ });
2667
+
2668
+ // ../contracts/dist/complaints/responses.js
2669
+ import { z as z51 } from "zod";
2670
+ var ComplaintResponseSchema = z51.object({
2671
+ id: z51.string(),
2672
+ qmsId: z51.string(),
2673
+ organizationId: z51.string(),
2674
+ complaintNumber: z51.string(),
2675
+ title: z51.string(),
2676
+ description: z51.string(),
2677
+ status: ComplaintStatusSchema,
2678
+ severity: ComplaintSeveritySchema,
2679
+ category: ComplaintCategorySchema,
2680
+ source: ComplaintSourceSchema,
2681
+ receivedDate: z51.string(),
2682
+ complainant: ComplainantSchema,
2683
+ reportable: z51.boolean(),
2684
+ reportabilityJustification: z51.string().optional(),
2685
+ investigationSummary: z51.string().optional(),
2686
+ rootCauseDescription: z51.string().optional(),
2687
+ resolutionDescription: z51.string().optional(),
2688
+ affectedDeviceIds: z51.array(z51.string()),
2689
+ affectedDocumentIds: z51.array(z51.string()),
2690
+ linkedCapaId: z51.string().optional(),
2691
+ assigneeId: z51.string().optional(),
2692
+ assigneeEmail: z51.string().optional(),
2693
+ dueDate: z51.string().optional(),
2694
+ createdAt: z51.string(),
2695
+ createdBy: z51.string(),
2696
+ investigationStartedAt: z51.string().optional(),
2697
+ resolvedAt: z51.string().optional(),
2698
+ resolvedBy: z51.string().optional(),
2699
+ closedAt: z51.string().optional(),
2700
+ closedBy: z51.string().optional(),
2701
+ cancellationReason: z51.string().optional(),
2702
+ cancelledAt: z51.string().optional(),
2703
+ cancelledBy: z51.string().optional()
2704
+ });
2705
+ var ComplaintListResponseSchema = z51.object({
2706
+ items: z51.array(ComplaintResponseSchema),
2707
+ total: z51.number(),
2708
+ limit: z51.number(),
2709
+ offset: z51.number()
2710
+ });
2711
+ var EscalateToCapaResponseSchema = z51.object({
2712
+ capaId: z51.string()
2713
+ });
2714
+
2715
+ // ../contracts/dist/nonconformances/requests.js
2716
+ import { z as z52 } from "zod";
2717
+
2718
+ // ../contracts/dist/domain-types/nonconformance.js
2719
+ var NC_STATUSES = [
2720
+ "reported",
2721
+ "investigation",
2722
+ "disposition",
2723
+ "closed",
2724
+ "cancelled"
2725
+ ];
2726
+ var NC_SEVERITIES = ["minor", "major", "critical"];
2727
+ var NC_DISPOSITIONS = [
2728
+ "use_as_is",
2729
+ "rework",
2730
+ "scrap",
2731
+ "return_to_supplier",
2732
+ "concession"
2733
+ ];
2734
+ var NC_SOURCE_TYPES = [
2735
+ "product",
2736
+ "process",
2737
+ "supplier",
2738
+ "audit_finding",
2739
+ "complaint",
2740
+ "other"
2741
+ ];
2742
+
2743
+ // ../contracts/dist/nonconformances/requests.js
2744
+ var NcStatusSchema = z52.enum(NC_STATUSES);
2745
+ var NcSeveritySchema = z52.enum(NC_SEVERITIES);
2746
+ var NcDispositionSchema = z52.enum(NC_DISPOSITIONS);
2747
+ var NcSourceTypeSchema = z52.enum(NC_SOURCE_TYPES);
2748
+ var QmsNcParamSchema = z52.object({
2749
+ orgId: z52.string().min(1),
2750
+ qmsId: z52.string().min(1)
2751
+ });
2752
+ var NcIdParamSchema = z52.object({
2753
+ orgId: z52.string().min(1),
2754
+ qmsId: z52.string().min(1),
2755
+ ncId: z52.string().min(1)
2756
+ });
2757
+ var CreateNcRequestSchema = z52.object({
2758
+ severity: NcSeveritySchema,
2759
+ sourceType: NcSourceTypeSchema,
2760
+ title: z52.string().min(1).max(200),
2761
+ description: z52.string().min(1).max(5e3),
2762
+ dueDate: z52.string().datetime().optional(),
2763
+ affectedDocumentIds: z52.array(z52.string().min(1)).default([]),
2764
+ affectedDeviceIds: z52.array(z52.string().min(1)).default([])
2765
+ });
2766
+ var UpdateNcRequestSchema = z52.object({
2767
+ title: z52.string().min(1).max(200).optional(),
2768
+ description: z52.string().min(1).max(5e3).optional(),
2769
+ severity: NcSeveritySchema.optional(),
2770
+ investigationDescription: z52.string().max(5e3).optional(),
2771
+ affectedDocumentIds: z52.array(z52.string().min(1)).optional(),
2772
+ affectedDeviceIds: z52.array(z52.string().min(1)).optional(),
2773
+ dueDate: z52.string().datetime().nullable().optional()
2774
+ });
2775
+ var SetDispositionRequestSchema = z52.object({
2776
+ disposition: NcDispositionSchema,
2777
+ justification: z52.string().min(1).max(5e3)
2778
+ });
2779
+ var ApproveConcessionRequestSchema = z52.object({
2780
+ signatureId: z52.string().min(1)
2781
+ });
2782
+ var NcListQuerySchema = PaginationParamsSchema.extend({
2783
+ status: NcStatusSchema.optional(),
2784
+ severity: NcSeveritySchema.optional(),
2785
+ sourceType: NcSourceTypeSchema.optional()
2786
+ });
2787
+
2788
+ // ../contracts/dist/nonconformances/responses.js
2789
+ import { z as z53 } from "zod";
2790
+ var NcResponseSchema = z53.object({
2791
+ id: z53.string(),
2792
+ qmsId: z53.string(),
2793
+ organizationId: z53.string(),
2794
+ ncNumber: z53.string(),
2795
+ severity: NcSeveritySchema,
2796
+ sourceType: NcSourceTypeSchema,
2797
+ title: z53.string(),
2798
+ description: z53.string(),
2799
+ investigationDescription: z53.string().optional(),
2800
+ disposition: NcDispositionSchema.optional(),
2801
+ dispositionJustification: z53.string().optional(),
2802
+ concessionSignatureId: z53.string().optional(),
2803
+ affectedDocumentIds: z53.array(z53.string()),
2804
+ affectedDeviceIds: z53.array(z53.string()),
2805
+ linkedCapaId: z53.string().optional(),
2806
+ status: NcStatusSchema,
2807
+ createdAt: z53.string(),
2808
+ createdBy: z53.string(),
2809
+ investigationStartedAt: z53.string().optional(),
2810
+ investigationStartedBy: z53.string().optional(),
2811
+ dispositionSetAt: z53.string().optional(),
2812
+ dispositionSetBy: z53.string().optional(),
2813
+ closedAt: z53.string().optional(),
2814
+ closedBy: z53.string().optional(),
2815
+ cancelledAt: z53.string().optional(),
2816
+ cancelledBy: z53.string().optional(),
2817
+ dueDate: z53.string().optional()
2818
+ });
2819
+ var NcListResponseSchema = z53.object({
2820
+ items: z53.array(NcResponseSchema),
2821
+ total: z53.number(),
2822
+ limit: z53.number(),
2823
+ offset: z53.number()
2824
+ });
2825
+
2826
+ // ../contracts/dist/signatures/requests.js
2827
+ import { z as z54 } from "zod";
2828
+ var DocumentSignatureTypeSchema = z54.enum([
2829
+ "author",
2830
+ "reviewer",
2831
+ "approver",
2832
+ "dept_reviewer",
2833
+ "final_approver",
2834
+ "trainee",
2835
+ "trainer"
2836
+ ]);
2837
+ var SignatureCaptureContextSchema = z54.discriminatedUnion("type", [
2838
+ z54.object({
2839
+ type: z54.literal("release"),
2840
+ id: z54.string().min(1)
2841
+ }),
2842
+ z54.object({
2843
+ type: z54.literal("design_review"),
2844
+ id: z54.string().min(1)
2845
+ }),
2846
+ z54.object({
2847
+ type: z54.literal("dco"),
2848
+ id: z54.string().min(1)
2849
+ }),
2850
+ z54.object({
2851
+ type: z54.literal("document_signoff"),
2852
+ id: z54.string().min(1)
2853
+ }),
2854
+ z54.object({
2855
+ type: z54.literal("nonconformance"),
2856
+ id: z54.string().min(1)
2857
+ }),
2858
+ z54.object({
2859
+ type: z54.literal("complaint"),
2860
+ id: z54.string().min(1)
2861
+ }),
2862
+ z54.object({
2863
+ type: z54.literal("training_completion"),
2864
+ id: z54.string().min(1)
2865
+ }),
2866
+ z54.object({
2867
+ type: z54.literal("training_signoff"),
2868
+ id: z54.string().min(1)
2869
+ })
2870
+ ]);
2871
+ var CreateDocumentSignatureRequestSchema = z54.object({
2872
+ signatureType: DocumentSignatureTypeSchema,
2873
+ meaning: z54.string().min(1).max(500),
2874
+ capturedDuring: SignatureCaptureContextSchema,
2875
+ reason: z54.string().max(500).optional(),
2876
+ /** Fresh Firebase ID token for per-signature re-authentication (Part 11 §11.200) */
2877
+ idToken: z54.string().min(1).optional(),
2878
+ /** Part 11: ID of the ERSD version the signer accepted */
2879
+ ersdDisclosureId: z54.string().min(1),
2880
+ /** Part 11: ISO date string when the signer accepted the ERSD */
2881
+ ersdAcceptedAt: z54.string().datetime()
2882
+ });
2883
+ var SignatureDocumentCommitParamSchema = z54.object({
2884
+ orgId: z54.string().min(1),
2885
+ docId: z54.string().min(1),
2886
+ commitSha: z54.string().min(1)
2887
+ });
2888
+ var SignatureDocumentIdParamSchema = z54.object({
2889
+ orgId: z54.string().min(1),
2890
+ docId: z54.string().min(1)
2891
+ });
2892
+
2893
+ // ../contracts/dist/signatures/responses.js
2894
+ import { z as z55 } from "zod";
2895
+ var DocumentSignatureResponseSchema = z55.object({
2896
+ id: z55.string(),
2897
+ organizationId: z55.string(),
2898
+ documentId: z55.string(),
2899
+ commitSha: z55.string(),
2900
+ userId: z55.string(),
2901
+ userEmail: z55.string(),
2902
+ userDisplayName: z55.string(),
2903
+ userDepartment: z55.string(),
2904
+ signatureType: DocumentSignatureTypeSchema,
2905
+ meaning: z55.string(),
2906
+ contentHash: z55.string().optional(),
2907
+ timestamp: z55.string(),
2908
+ capturedDuring: SignatureCaptureContextSchema
2909
+ });
2910
+ var DocumentSignaturesListResponseSchema = z55.object({
2911
+ signatures: z55.array(DocumentSignatureResponseSchema)
2912
+ });
2913
+ var DocumentSignatureHistoryItemSchema = z55.object({
2914
+ commitSha: z55.string(),
2915
+ signatures: z55.array(DocumentSignatureResponseSchema)
2916
+ });
2917
+ var DocumentSignatureHistoryResponseSchema = z55.object({
2918
+ documentId: z55.string(),
2919
+ history: z55.array(DocumentSignatureHistoryItemSchema)
2920
+ });
2921
+ var CreateDocumentSignatureResponseSchema = z55.object({
2922
+ signatureId: z55.string()
2923
+ });
2924
+
2925
+ // ../contracts/dist/github/webhooks.js
2926
+ import { z as z56 } from "zod";
2927
+ var GitHubCommitAuthorSchema = z56.object({
2928
+ email: z56.string(),
2929
+ name: z56.string()
2930
+ });
2931
+ var GitHubPushCommitSchema = z56.object({
2932
+ id: z56.string(),
2933
+ message: z56.string(),
2934
+ author: GitHubCommitAuthorSchema,
2935
+ added: z56.array(z56.string()),
2936
+ modified: z56.array(z56.string()),
2937
+ removed: z56.array(z56.string())
2938
+ });
2939
+ var GitHubWebhookRepositorySchema = z56.object({
2940
+ id: z56.number(),
2941
+ full_name: z56.string()
2942
+ });
2943
+ var GitHubInstallationSchema = z56.object({
2944
+ id: z56.number()
2945
+ });
2946
+ var GitHubAccountSchema = z56.object({
2947
+ login: z56.string(),
2948
+ type: z56.string()
2949
+ });
2950
+ var GitHubPushEventSchema = z56.object({
2951
+ ref: z56.string(),
2952
+ before: z56.string(),
2953
+ after: z56.string(),
2954
+ repository: GitHubWebhookRepositorySchema,
2955
+ installation: GitHubInstallationSchema.optional(),
2956
+ commits: z56.array(GitHubPushCommitSchema)
2957
+ });
2958
+ var GitHubInstallationEventSchema = z56.object({
2959
+ action: z56.enum(["created", "deleted", "suspend", "unsuspend"]),
2960
+ installation: z56.object({
2961
+ id: z56.number(),
2962
+ account: GitHubAccountSchema
2963
+ }),
2964
+ repositories: z56.array(z56.object({
2965
+ id: z56.number(),
2966
+ full_name: z56.string()
2967
+ })).optional()
2968
+ });
2969
+ var GitHubInstallationRepositoriesEventSchema = z56.object({
2970
+ action: z56.enum(["added", "removed"]),
2971
+ installation: z56.object({
2972
+ id: z56.number(),
2973
+ account: GitHubAccountSchema
2974
+ }),
2975
+ repositories_added: z56.array(z56.object({
2976
+ id: z56.number(),
2977
+ full_name: z56.string()
2978
+ })),
2979
+ repositories_removed: z56.array(z56.object({
2980
+ id: z56.number(),
2981
+ full_name: z56.string()
2982
+ }))
2983
+ });
2984
+ var GitHubWebhookHeadersSchema = z56.object({
2985
+ "x-github-event": z56.string(),
2986
+ "x-github-delivery": z56.string(),
2987
+ "x-hub-signature-256": z56.string().optional()
2988
+ });
2989
+
2990
+ // ../contracts/dist/github/requests.js
2991
+ import { z as z57 } from "zod";
2992
+ var CompleteGitHubInstallationRequestSchema = z57.object({
2993
+ organizationId: z57.string().min(1),
2994
+ installationId: z57.number().int().positive()
2995
+ });
2996
+ var ListGitHubRepositoriesRequestSchema = z57.object({
2997
+ organizationId: z57.string().min(1)
2998
+ });
2999
+
3000
+ // ../contracts/dist/github/responses.js
3001
+ import { z as z58 } from "zod";
3002
+ var GitHubInstallationRepoSchema = z58.object({
3003
+ id: z58.number(),
3004
+ full_name: z58.string(),
3005
+ name: z58.string(),
3006
+ owner: z58.string(),
3007
+ default_branch: z58.string()
3008
+ });
3009
+ var ListGitHubRepositoriesResponseSchema = z58.object({
3010
+ repositories: z58.array(GitHubInstallationRepoSchema),
3011
+ installed: z58.boolean(),
3012
+ gitHubOrgName: z58.string().optional()
3013
+ });
3014
+ var CompleteGitHubInstallationResponseSchema = z58.object({
3015
+ success: z58.boolean()
3016
+ });
3017
+
3018
+ // ../contracts/dist/training/requests.js
3019
+ import { z as z59 } from "zod";
3020
+ var TrainingTypeSchema = z59.enum(["quiz", "acknowledge", "instructor_led"]);
3021
+ var TrainingStatusSchema = z59.enum(["pending", "in_progress", "completed", "overdue"]);
3022
+ var TrainingOrgParamSchema = z59.object({
3023
+ orgId: z59.string().min(1)
3024
+ });
3025
+ var TrainingTaskParamSchema = z59.object({
3026
+ orgId: z59.string().min(1),
3027
+ taskId: z59.string().min(1)
3028
+ });
3029
+ var MyTrainingQuerySchema = z59.object({
3030
+ status: TrainingStatusSchema.optional(),
3031
+ documentId: z59.string().optional()
3032
+ });
3033
+ var TrainingDashboardQuerySchema = z59.object({
3034
+ status: TrainingStatusSchema.optional(),
3035
+ memberId: z59.string().optional(),
3036
+ documentId: z59.string().optional()
3037
+ });
3038
+ var StartTrainingRequestSchema = z59.object({});
3039
+ var SubmitQuizRequestSchema = z59.object({
3040
+ sessionId: z59.string().min(1),
3041
+ answers: z59.record(z59.string(), z59.union([z59.number(), z59.array(z59.number()), z59.boolean()]))
3042
+ });
3043
+ var AcknowledgeTrainingRequestSchema = z59.object({
3044
+ meaning: z59.string().min(1).max(500)
3045
+ });
3046
+ var BatchSignoffRequestSchema = z59.object({
3047
+ taskIds: z59.array(z59.string().min(1)).min(1),
3048
+ evidenceUrl: z59.string().url(),
3049
+ evidenceHash: z59.string().min(1),
3050
+ meaning: z59.string().min(1).max(500)
3051
+ });
3052
+ var QuizOptionSchema = z59.object({
3053
+ text: z59.string().min(1),
3054
+ correct: z59.boolean().optional(),
3055
+ explanation: z59.string().optional()
3056
+ });
3057
+ var QuizQuestionSchema = z59.object({
3058
+ type: z59.enum(["single-choice", "multi-choice", "true-false"]),
3059
+ text: z59.string().min(1),
3060
+ options: z59.array(QuizOptionSchema).optional(),
3061
+ correct: z59.boolean().optional(),
3062
+ explanation: z59.string().optional()
3063
+ });
3064
+ var QuizDefinitionSchema = z59.object({
3065
+ passingScore: z59.number().min(0).max(100).optional(),
3066
+ questions: z59.array(QuizQuestionSchema).min(1)
3067
+ });
3068
+ var CreateTrainingTaskRequestSchema = z59.object({
3069
+ memberId: z59.string().min(1),
3070
+ documentId: z59.string().min(1),
3071
+ documentVersion: z59.string().min(1),
3072
+ trainingType: TrainingTypeSchema,
3073
+ dueDays: z59.number().int().positive().optional(),
3074
+ /** Required for quiz-type training. Stored server-side for scoring. */
3075
+ quizDefinition: QuizDefinitionSchema.optional()
3076
+ });
3077
+ var UpdateTrainingSettingsRequestSchema = z59.object({
3078
+ defaultDueDays: z59.number().int().positive().optional(),
3079
+ passingScorePercent: z59.number().int().min(0).max(100).optional()
3080
+ });
3081
+ var BulkAssignTrainingRequestSchema = z59.object({
3082
+ department: z59.string().min(1),
3083
+ documentId: z59.string().min(1),
3084
+ documentVersion: z59.string().min(1),
3085
+ trainingType: TrainingTypeSchema,
3086
+ dueDays: z59.number().int().positive().optional()
3087
+ });
3088
+
3089
+ // ../contracts/dist/training/responses.js
3090
+ import { z as z60 } from "zod";
3091
+ var TrainingTaskResponseSchema = z60.object({
3092
+ id: z60.string(),
3093
+ organizationId: z60.string(),
3094
+ memberId: z60.string(),
3095
+ memberName: z60.string(),
3096
+ memberEmail: z60.string(),
3097
+ documentId: z60.string(),
3098
+ documentTitle: z60.string(),
3099
+ documentVersion: z60.string(),
3100
+ trainingType: TrainingTypeSchema,
3101
+ status: TrainingStatusSchema,
3102
+ dueDate: z60.string(),
3103
+ createdAt: z60.string(),
3104
+ startedAt: z60.string().optional(),
3105
+ completedAt: z60.string().optional(),
3106
+ quizScore: z60.number().optional(),
3107
+ signatureId: z60.string().optional(),
3108
+ evidenceUrl: z60.string().optional()
3109
+ });
3110
+ var QuizOptionResponseSchema = z60.object({
3111
+ text: z60.string()
3112
+ });
3113
+ var QuizQuestionTypeSchema = z60.enum(["single_choice", "multiple_choice", "true_false"]);
3114
+ var QuizQuestionResponseSchema = z60.object({
3115
+ type: QuizQuestionTypeSchema,
3116
+ text: z60.string(),
3117
+ options: z60.array(QuizOptionResponseSchema).optional()
3118
+ });
3119
+ var QuizSessionResponseSchema = z60.object({
3120
+ sessionId: z60.string(),
3121
+ questions: z60.array(QuizQuestionResponseSchema),
3122
+ questionCount: z60.number(),
3123
+ passingScore: z60.number(),
3124
+ savedAnswers: z60.record(z60.string(), z60.union([z60.number(), z60.array(z60.number()), z60.boolean()])).optional()
3125
+ });
3126
+ var QuizResultResponseSchema = z60.object({
3127
+ passed: z60.boolean(),
3128
+ score: z60.number(),
3129
+ passingScore: z60.number(),
3130
+ correctCount: z60.number(),
3131
+ totalCount: z60.number(),
3132
+ explanations: z60.record(z60.string(), z60.string()),
3133
+ signatureRequired: z60.boolean()
3134
+ });
3135
+ var TrainingStatsResponseSchema = z60.object({
3136
+ pending: z60.number(),
3137
+ inProgress: z60.number(),
3138
+ completed: z60.number(),
3139
+ overdue: z60.number(),
3140
+ completionRate: z60.number()
3141
+ });
3142
+ var TrainingDashboardResponseSchema = z60.object({
3143
+ stats: TrainingStatsResponseSchema,
3144
+ tasks: z60.array(TrainingTaskResponseSchema)
3145
+ });
3146
+ var TrainingSettingsResponseSchema = z60.object({
3147
+ defaultDueDays: z60.number(),
3148
+ passingScorePercent: z60.number()
3149
+ });
3150
+ var BulkAssignTrainingResponseSchema = z60.object({
3151
+ createdCount: z60.number(),
3152
+ skippedCount: z60.number(),
3153
+ memberNames: z60.array(z60.string())
3154
+ });
3155
+ var SigningEligibilityResponseSchema = z60.object({
3156
+ eligible: z60.boolean(),
3157
+ hasIncompleteTraining: z60.boolean()
3158
+ });
3159
+
3160
+ // ../contracts/dist/signing-requests/requests.js
3161
+ import { z as z61 } from "zod";
3162
+ var SigningFieldSchema = z61.object({
3163
+ id: z61.string().min(1),
3164
+ type: FieldTypeSchema,
3165
+ assignedSignerEmail: z61.string().email(),
3166
+ /** 1-based page index within the PDF document. */
3167
+ page: z61.number().int().positive(),
3168
+ /** Field left edge as a percentage of the page width (0–100). */
3169
+ x: z61.number().min(0).max(100),
3170
+ /** Field top edge as a percentage of the page height (0–100). */
3171
+ y: z61.number().min(0).max(100),
3172
+ /** Field width as a percentage of the page width (0–100). */
3173
+ width: z61.number().min(0).max(100),
3174
+ /** Field height as a percentage of the page height (0–100). */
3175
+ height: z61.number().min(0).max(100)
3176
+ });
3177
+ var SigningDocumentInputSchema = z61.object({
3178
+ fileName: z61.string().min(1),
3179
+ storagePath: z61.string().startsWith("signing-uploads/"),
3180
+ fileHash: z61.string().min(1),
3181
+ pageCount: z61.number().int().positive(),
3182
+ fields: z61.array(SigningFieldSchema).min(1)
3183
+ });
3184
+ var SignerInputSchema = z61.object({
3185
+ name: z61.string().min(1).max(200),
3186
+ email: z61.string().email(),
3187
+ meaning: z61.string().min(1).max(500)
3188
+ });
3189
+ var SigningRequestIdParamSchema = z61.object({
3190
+ signingRequestId: z61.string().min(1)
3191
+ });
3192
+ var ListSigningRequestsQuerySchema = z61.object({
3193
+ organizationId: z61.string().min(1),
3194
+ status: SigningRequestStatusSchema.optional(),
3195
+ limit: z61.coerce.number().int().positive().max(100).default(50),
3196
+ offset: z61.coerce.number().int().nonnegative().default(0)
3197
+ });
3198
+ var GetSigningRequestQuerySchema = z61.object({
3199
+ organizationId: z61.string().min(1)
3200
+ });
3201
+ var CreateSigningRequestSchema = z61.object({
3202
+ organizationId: z61.string().min(1),
3203
+ title: z61.string().min(1).max(200),
3204
+ description: z61.string().max(2e3).optional(),
3205
+ meaning: z61.string().min(1).max(500),
3206
+ expiresAt: z61.string().datetime(),
3207
+ signingDocuments: z61.array(SigningDocumentInputSchema).min(1),
3208
+ signers: z61.array(SignerInputSchema).min(1)
3209
+ });
3210
+ var CancelSigningRequestSchema = z61.object({
3211
+ organizationId: z61.string().min(1)
3212
+ });
3213
+ var RemindSignersSchema = z61.object({
3214
+ organizationId: z61.string().min(1)
3215
+ });
3216
+ var GetSigningCeremonyParamSchema = z61.object({
3217
+ token: z61.string().min(1)
3218
+ });
3219
+ var RequestVerificationCodeSchema = z61.object({
3220
+ token: z61.string().min(1)
3221
+ });
3222
+ var CompleteSigningCeremonySchema = z61.object({
3223
+ token: z61.string().min(1),
3224
+ verificationCode: z61.string().length(6),
3225
+ signatureImagePath: z61.string().startsWith("data:"),
3226
+ initialsImagePath: z61.string().startsWith("data:").optional(),
3227
+ fieldValues: z61.array(z61.object({
3228
+ fieldId: z61.string().min(1),
3229
+ type: FieldTypeSchema,
3230
+ value: z61.string().min(1).refine((v) => v.startsWith("data:") || /^\d{4}-\d{2}-\d{2}/.test(v), {
3231
+ message: "Value must be a data URL or a date string"
3232
+ })
3233
+ })).min(1),
3234
+ /** Part 11: ID of the ERSD version the signer accepted — required, 400 if missing */
3235
+ ersdDisclosureId: z61.string().min(1),
3236
+ /** Part 11: ISO timestamp when the signer accepted the ERSD — required, 400 if missing */
3237
+ ersdAcceptedAt: z61.string().datetime()
3238
+ });
3239
+
3240
+ // ../contracts/dist/signing-requests/responses.js
3241
+ import { z as z62 } from "zod";
3242
+ var SigningFieldResponseSchema = z62.object({
3243
+ id: z62.string(),
3244
+ type: FieldTypeSchema,
3245
+ assignedSignerEmail: z62.string(),
3246
+ page: z62.number(),
3247
+ x: z62.number(),
3248
+ y: z62.number(),
3249
+ width: z62.number(),
3250
+ height: z62.number()
3251
+ });
3252
+ var SigningDocumentResponseSchema = z62.object({
3253
+ fileName: z62.string(),
3254
+ storagePath: z62.string(),
3255
+ fileHash: z62.string(),
3256
+ pageCount: z62.number(),
3257
+ uploadedAt: z62.string(),
3258
+ fields: z62.array(SigningFieldResponseSchema)
3259
+ });
3260
+ var SignerResponseSchema = z62.object({
3261
+ name: z62.string(),
3262
+ email: z62.string(),
3263
+ meaning: z62.string(),
3264
+ status: SignerStatusSchema,
3265
+ signedAt: z62.string().optional()
3266
+ });
3267
+ var SigningAuditEntryResponseSchema = z62.object({
3268
+ id: z62.string(),
3269
+ eventType: z62.string(),
3270
+ actor: z62.string(),
3271
+ timestamp: z62.string(),
3272
+ details: z62.record(z62.unknown()).optional()
3273
+ });
3274
+ var SigningRequestSummaryResponseSchema = z62.object({
3275
+ id: z62.string(),
3276
+ title: z62.string(),
3277
+ status: SigningRequestStatusSchema,
3278
+ meaning: z62.string(),
3279
+ signerCount: z62.number(),
3280
+ signedCount: z62.number(),
3281
+ createdAt: z62.string(),
3282
+ expiresAt: z62.string()
3283
+ });
3284
+ var SigningRequestDetailResponseSchema = SigningRequestSummaryResponseSchema.extend({
3285
+ description: z62.string().optional(),
3286
+ createdBy: z62.string(),
3287
+ createdByEmail: z62.string(),
3288
+ signingDocuments: z62.array(SigningDocumentResponseSchema),
3289
+ signers: z62.array(SignerResponseSchema),
3290
+ auditTrail: z62.array(SigningAuditEntryResponseSchema)
3291
+ });
3292
+ var ListSigningRequestsResponseSchema = z62.object({
3293
+ signingRequests: z62.array(SigningRequestSummaryResponseSchema),
3294
+ total: z62.number()
3295
+ });
3296
+ var CeremonyDocumentResponseSchema = SigningDocumentResponseSchema.omit({
3297
+ storagePath: true
3298
+ });
3299
+ var CeremonyERSDResponseSchema = z62.object({
3300
+ id: z62.string(),
3301
+ content: z62.string(),
3302
+ version: z62.string()
3303
+ });
3304
+ var SigningCeremonyResponseSchema = z62.object({
3305
+ organizationName: z62.string(),
3306
+ title: z62.string(),
3307
+ description: z62.string().optional(),
3308
+ meaning: z62.string(),
3309
+ signerName: z62.string(),
3310
+ signerEmail: z62.string(),
3311
+ status: z62.enum(["ready", "already_signed", "expired", "cancelled"]),
3312
+ signingDocuments: z62.array(CeremonyDocumentResponseSchema),
3313
+ /** Only fields assigned to this signer */
3314
+ fields: z62.array(SigningFieldResponseSchema),
3315
+ /** Part 11: Electronic Record and Signature Disclosure — must be accepted before signing */
3316
+ ersd: CeremonyERSDResponseSchema
3317
+ });
3318
+ var DownloadSignedPdfResponseSchema = z62.object({
3319
+ downloadUrl: z62.string().url()
3320
+ });
3321
+
3322
+ // ../contracts/dist/notifications/requests.js
3323
+ import { z as z63 } from "zod";
3324
+ var NotificationTypeSchema = z63.enum([
3325
+ "training_assigned",
3326
+ "training_overdue",
3327
+ "release_submitted_for_review",
3328
+ "release_published",
3329
+ "signature_requested",
3330
+ "capa_overdue",
3331
+ "nc_overdue",
3332
+ "complaint_overdue",
3333
+ "action_overdue",
3334
+ "objective_threshold_breach",
3335
+ "review_due_soon",
3336
+ "review_auto_drafted",
3337
+ "review_overdue"
3338
+ ]);
3339
+ var NotificationOrgParamSchema = z63.object({
3340
+ orgId: z63.string().min(1)
3341
+ });
3342
+ var NotificationIdParamSchema = z63.object({
3343
+ orgId: z63.string().min(1),
3344
+ notificationId: z63.string().min(1)
3345
+ });
3346
+ var NotificationQuerySchema = z63.object({
3347
+ unreadOnly: z63.enum(["true", "false"]).optional(),
3348
+ type: NotificationTypeSchema.optional(),
3349
+ limit: z63.coerce.number().int().positive().max(100).optional()
3350
+ });
3351
+
3352
+ // ../contracts/dist/notifications/responses.js
3353
+ import { z as z64 } from "zod";
3354
+ var NotificationResponseSchema = z64.object({
3355
+ id: z64.string(),
3356
+ type: NotificationTypeSchema,
3357
+ title: z64.string(),
3358
+ body: z64.string(),
3359
+ resourceType: z64.string(),
3360
+ resourceId: z64.string(),
3361
+ deepLink: z64.string(),
3362
+ read: z64.boolean(),
3363
+ createdAt: z64.string()
3364
+ });
3365
+ var NotificationListResponseSchema = z64.object({
3366
+ notifications: z64.array(NotificationResponseSchema),
3367
+ unreadCount: z64.number()
3368
+ });
3369
+
3370
+ // ../contracts/dist/billing/requests.js
3371
+ import { z as z65 } from "zod";
3372
+ var CreateCheckoutSessionRequestSchema = z65.object({
3373
+ organizationId: z65.string().min(1)
3374
+ });
3375
+ var CreatePortalSessionRequestSchema = z65.object({
3376
+ organizationId: z65.string().min(1)
3377
+ });
3378
+
3379
+ // ../contracts/dist/quality-metrics/responses.js
3380
+ import { z as z66 } from "zod";
3381
+ var MonthlyCountSchema = z66.object({
3382
+ month: z66.string(),
3383
+ // 'YYYY-MM'
3384
+ opened: z66.number(),
3385
+ closed: z66.number()
3386
+ });
3387
+ var CapaMetricsSchema = z66.object({
3388
+ total: z66.number(),
3389
+ byStatus: z66.record(z66.string(), z66.number()),
3390
+ overdue: z66.number(),
3391
+ avgCycleTimeDays: z66.number().nullable(),
3392
+ trend: z66.array(MonthlyCountSchema)
3393
+ });
3394
+ var NcMetricsSchema = z66.object({
3395
+ total: z66.number(),
3396
+ byStatus: z66.record(z66.string(), z66.number()),
3397
+ bySeverity: z66.record(z66.string(), z66.number()),
3398
+ overdue: z66.number(),
3399
+ avgCycleTimeDays: z66.number().nullable(),
3400
+ trend: z66.array(MonthlyCountSchema)
3401
+ });
3402
+ var ComplaintMetricsSchema = z66.object({
3403
+ total: z66.number(),
3404
+ byStatus: z66.record(z66.string(), z66.number()),
3405
+ bySeverity: z66.record(z66.string(), z66.number()),
3406
+ overdue: z66.number(),
3407
+ reportableCount: z66.number(),
3408
+ avgCycleTimeDays: z66.number().nullable(),
3409
+ trend: z66.array(MonthlyCountSchema)
3410
+ });
3411
+ var TrainingMetricsSchema = z66.object({
3412
+ totalTasks: z66.number(),
3413
+ complianceRate: z66.number(),
3414
+ // 0-100
3415
+ byStatus: z66.record(z66.string(), z66.number()),
3416
+ overdue: z66.number()
3417
+ });
3418
+ var ReleaseMetricsSchema = z66.object({
3419
+ total: z66.number(),
3420
+ byStatus: z66.record(z66.string(), z66.number()),
3421
+ avgCycleTimeDays: z66.number().nullable()
3422
+ });
3423
+ var AuditMetricsSchema = z66.object({
3424
+ totalSchedules: z66.number(),
3425
+ totalReports: z66.number(),
3426
+ findingsMajor: z66.number(),
3427
+ findingsMinor: z66.number(),
3428
+ findingsObservations: z66.number()
3429
+ });
3430
+ var QualityMetricsResponseSchema = z66.object({
3431
+ generatedAt: z66.string(),
3432
+ period: z66.object({
3433
+ from: z66.string(),
3434
+ to: z66.string()
3435
+ }),
3436
+ capas: CapaMetricsSchema,
3437
+ nonconformances: NcMetricsSchema,
3438
+ complaints: ComplaintMetricsSchema,
3439
+ training: TrainingMetricsSchema,
3440
+ releases: ReleaseMetricsSchema,
3441
+ audits: AuditMetricsSchema
3442
+ });
3443
+ var QualityMetricsQuerySchema = z66.object({
3444
+ period: z66.enum(["30d", "90d", "365d"]).optional().default("90d")
3445
+ });
3446
+
3447
+ // ../contracts/dist/api-keys/requests.js
3448
+ import { z as z67 } from "zod";
3449
+ var ApiKeyOrgParamSchema = z67.object({
3450
+ orgId: z67.string().min(1)
3451
+ });
3452
+ var ApiKeyIdParamSchema = z67.object({
3453
+ orgId: z67.string().min(1),
3454
+ apiKeyId: z67.string().min(1)
3455
+ });
3456
+ var CreateApiKeyRequestSchema = z67.object({
3457
+ name: z67.string().min(1).max(100)
3458
+ });
3459
+
3460
+ // ../contracts/dist/api-keys/responses.js
3461
+ import { z as z68 } from "zod";
3462
+ var ApiKeyResponseSchema = z68.object({
3463
+ id: z68.string(),
3464
+ name: z68.string(),
3465
+ prefix: z68.string(),
3466
+ createdAt: z68.string(),
3467
+ lastUsedAt: z68.string().nullable(),
3468
+ createdBy: z68.string(),
3469
+ createdByEmail: z68.string()
3470
+ });
3471
+ var CreateApiKeyResponseSchema = z68.object({
3472
+ id: z68.string(),
3473
+ name: z68.string(),
3474
+ key: z68.string(),
3475
+ prefix: z68.string(),
3476
+ createdAt: z68.string()
3477
+ });
3478
+ var ApiKeyListResponseSchema = z68.object({
3479
+ keys: z68.array(ApiKeyResponseSchema)
3480
+ });
3481
+
3482
+ // ../contracts/dist/compliance/requests.js
3483
+ import { z as z69 } from "zod";
3484
+ var CompliancePackageStatusEnum = z69.enum([
3485
+ "pending",
3486
+ "in_progress",
3487
+ "completed",
3488
+ "failed"
3489
+ ]);
3490
+ var CompliancePackageSectionEnum = z69.enum([
3491
+ "system_description",
3492
+ "electronic_signatures",
3493
+ "audit_trails",
3494
+ "access_controls",
3495
+ "change_control",
3496
+ "dhr_attestation",
3497
+ "compiled_documents"
3498
+ ]);
3499
+ var ComplianceOrgParamSchema = z69.object({
3500
+ orgId: z69.string().min(1)
3501
+ });
3502
+ var CompliancePackageParamSchema = z69.object({
3503
+ orgId: z69.string().min(1),
3504
+ packageId: z69.string().min(1)
3505
+ });
3506
+ var GenerateCompliancePackageRequestSchema = z69.object({
3507
+ /** Safety class determines which sections and depth of evidence to include */
3508
+ safetyClass: SafetyClassSchema,
3509
+ /** Sections to include; defaults to all if omitted */
3510
+ sections: z69.array(CompliancePackageSectionEnum).min(1).optional(),
3511
+ /** Optional date range filter for audit trail entries */
3512
+ auditTrailFrom: z69.string().datetime().optional(),
3513
+ auditTrailTo: z69.string().datetime().optional(),
3514
+ /** Optional release ID to scope signatures and change control to a specific release */
3515
+ releaseId: z69.string().optional()
3516
+ });
3517
+
3518
+ // ../contracts/dist/compliance/responses.js
3519
+ import { z as z70 } from "zod";
3520
+ var CompliancePackageResponseSchema = z70.object({
3521
+ id: z70.string(),
3522
+ organizationId: z70.string(),
3523
+ status: CompliancePackageStatusEnum,
3524
+ safetyClass: SafetyClassSchema,
3525
+ sections: z70.array(CompliancePackageSectionEnum),
3526
+ /** Requesting member info */
3527
+ requestedById: z70.string(),
3528
+ requestedByName: z70.string(),
3529
+ requestedAt: z70.string(),
3530
+ /** Completion timestamps */
3531
+ completedAt: z70.string().optional(),
3532
+ /** Expiry for the download URL */
3533
+ downloadExpiresAt: z70.string().optional(),
3534
+ /** Error message — only present when status is 'failed' */
3535
+ errorMessage: z70.string().optional(),
3536
+ /** Optional scoping filters used during generation */
3537
+ releaseId: z70.string().optional(),
3538
+ auditTrailFrom: z70.string().optional(),
3539
+ auditTrailTo: z70.string().optional()
3540
+ });
3541
+ var CompliancePackageListResponseSchema = z70.object({
3542
+ packages: z70.array(CompliancePackageResponseSchema)
3543
+ });
3544
+ var ValidationPackageResponseSchema = z70.object({
3545
+ downloadUrl: z70.string().url(),
3546
+ version: z70.string(),
3547
+ lastUpdated: z70.string()
3548
+ });
3549
+
3550
+ // ../contracts/dist/compliance/readiness.js
3551
+ import { z as z71 } from "zod";
3552
+ var ReadinessSeveritySchema = z71.enum(["error", "warning", "info"]);
3553
+ var ReadinessItemSchema = z71.object({
3554
+ severity: ReadinessSeveritySchema,
3555
+ message: z71.string(),
3556
+ documentId: z71.string().optional(),
3557
+ releaseId: z71.string().optional(),
3558
+ action: z71.string()
3559
+ });
3560
+ var ReadinessDimensionSchema = z71.object({
3561
+ name: z71.string(),
3562
+ score: z71.number().min(0).max(100),
3563
+ weight: z71.number().min(0).max(1),
3564
+ details: z71.string(),
3565
+ items: z71.array(ReadinessItemSchema)
3566
+ });
3567
+ var ComplianceReadinessResponseSchema = z71.object({
3568
+ overallScore: z71.number().min(0).max(100),
3569
+ calculatedAt: z71.string(),
3570
+ dimensions: z71.array(ReadinessDimensionSchema)
3571
+ });
3572
+
3573
+ // ../contracts/dist/actions/requests.js
3574
+ import { z as z72 } from "zod";
3575
+
3576
+ // ../contracts/dist/domain-types/action.js
3577
+ var ACTION_STATUSES = ["open", "in_progress", "completed", "cancelled"];
3578
+ var ACTION_PRIORITIES = ["low", "medium", "high", "critical"];
3579
+ var ACTION_SOURCE_TYPES = [
3580
+ "capa",
3581
+ "nonconformance",
3582
+ "complaint",
3583
+ "management_review",
3584
+ "custom_review",
3585
+ "audit_finding",
3586
+ "quality_objective"
3587
+ ];
3588
+
3589
+ // ../contracts/dist/actions/requests.js
3590
+ var ActionSourceSchema = z72.object({
3591
+ type: z72.enum(ACTION_SOURCE_TYPES),
3592
+ id: z72.string().min(1),
3593
+ displayNumber: z72.string().optional()
3594
+ });
3595
+ var CreateActionRequestSchema = z72.object({
3596
+ title: z72.string().min(1).max(200),
3597
+ description: z72.string().min(1).max(5e3),
3598
+ source: ActionSourceSchema,
3599
+ assigneeDepartment: z72.string().min(1),
3600
+ assigneeDepartmentRole: z72.enum(["manager", "member"]),
3601
+ assigneeId: z72.string().optional(),
3602
+ priority: z72.enum(ACTION_PRIORITIES),
3603
+ dueDate: z72.string().datetime()
3604
+ });
3605
+ var UpdateActionRequestSchema = z72.object({
3606
+ title: z72.string().min(1).max(200).optional(),
3607
+ description: z72.string().min(1).max(5e3).optional(),
3608
+ assigneeDepartment: z72.string().min(1).optional(),
3609
+ assigneeDepartmentRole: z72.enum(["manager", "member"]).optional(),
3610
+ assigneeId: z72.string().nullable().optional(),
3611
+ priority: z72.enum(ACTION_PRIORITIES).optional(),
3612
+ dueDate: z72.string().datetime().optional(),
3613
+ notes: z72.string().max(5e3).optional()
3614
+ });
3615
+ var ListActionsQuerySchema = z72.object({
3616
+ sourceType: z72.enum(ACTION_SOURCE_TYPES).optional(),
3617
+ sourceId: z72.string().optional(),
3618
+ status: z72.enum(ACTION_STATUSES).optional(),
3619
+ assigneeDepartment: z72.string().optional(),
3620
+ priority: z72.enum(ACTION_PRIORITIES).optional(),
3621
+ page: z72.coerce.number().int().positive().default(1),
3622
+ limit: z72.coerce.number().int().positive().max(100).default(20)
3623
+ });
3624
+ var CompleteActionRequestSchema = z72.object({
3625
+ notes: z72.string().max(5e3).optional()
3626
+ });
3627
+ var QmsActionParamSchema = z72.object({
3628
+ orgId: z72.string().min(1),
3629
+ qmsId: z72.string().min(1)
3630
+ });
3631
+ var ActionIdParamSchema = z72.object({
3632
+ orgId: z72.string().min(1),
3633
+ qmsId: z72.string().min(1),
3634
+ actionId: z72.string().min(1)
3635
+ });
3636
+
3637
+ // ../contracts/dist/actions/responses.js
3638
+ import { z as z73 } from "zod";
3639
+ var ActionResponseSchema = z73.object({
3640
+ id: z73.string(),
3641
+ actionNumber: z73.string(),
3642
+ title: z73.string(),
3643
+ description: z73.string(),
3644
+ source: z73.object({
3645
+ type: z73.enum(ACTION_SOURCE_TYPES),
3646
+ id: z73.string(),
3647
+ displayNumber: z73.string().optional()
3648
+ }),
3649
+ assigneeDepartment: z73.string(),
3650
+ assigneeDepartmentRole: z73.enum(["manager", "member"]),
3651
+ assigneeId: z73.string().nullable(),
3652
+ priority: z73.enum(ACTION_PRIORITIES),
3653
+ dueDate: z73.string(),
3654
+ status: z73.enum(ACTION_STATUSES),
3655
+ isOverdue: z73.boolean(),
3656
+ completedAt: z73.string().nullable(),
3657
+ completedBy: z73.string().nullable(),
3658
+ notes: z73.string().nullable(),
3659
+ createdAt: z73.string(),
3660
+ createdBy: z73.string(),
3661
+ updatedAt: z73.string()
3662
+ });
3663
+ var ListActionsResponseSchema = z73.object({
3664
+ items: z73.array(ActionResponseSchema),
3665
+ total: z73.number(),
3666
+ page: z73.number(),
3667
+ limit: z73.number(),
3668
+ hasMore: z73.boolean()
3669
+ });
3670
+
3671
+ // ../contracts/dist/quality-objectives/requests.js
3672
+ import { z as z74 } from "zod";
3673
+
3674
+ // ../contracts/dist/domain-types/quality-objective.js
3675
+ var OBJECTIVE_TYPES = ["auto", "manual"];
3676
+ var OBJECTIVE_STATUSES = ["on_track", "at_risk", "off_target", "not_started"];
3677
+ var OBJECTIVE_DIRECTIONS = ["above", "below"];
3678
+ var OBJECTIVE_CADENCES = ["monthly", "quarterly", "annual"];
3679
+ var AUTO_METRIC_SOURCES = [
3680
+ "capa.avgCycleTimeDays",
3681
+ "capa.overdueCount",
3682
+ "capa.openCount",
3683
+ "nonconformance.avgCycleTimeDays",
3684
+ "nonconformance.overdueCount",
3685
+ "nonconformance.openCount",
3686
+ "complaint.avgCycleTimeDays",
3687
+ "complaint.overdueCount",
3688
+ "complaint.reportableCount",
3689
+ "training.complianceRate",
3690
+ "training.overdueCount",
3691
+ "release.avgCycleTimeDays",
3692
+ "audit.findingsMajor",
3693
+ "audit.findingsMinor"
3694
+ ];
3695
+
3696
+ // ../contracts/dist/quality-objectives/requests.js
3697
+ var AlertRecipientSchema = z74.object({
3698
+ department: z74.string().min(1),
3699
+ departmentRole: z74.enum(["manager", "member"])
3700
+ });
3701
+ var CreateQualityObjectiveRequestSchema = z74.object({
3702
+ title: z74.string().min(1).max(200),
3703
+ description: z74.string().min(1).max(5e3),
3704
+ type: z74.enum(OBJECTIVE_TYPES),
3705
+ metricSource: z74.enum(AUTO_METRIC_SOURCES).optional(),
3706
+ unit: z74.string().min(1).max(50),
3707
+ target: z74.number(),
3708
+ direction: z74.enum(OBJECTIVE_DIRECTIONS),
3709
+ warningThreshold: z74.number(),
3710
+ ownerDepartment: z74.string().min(1),
3711
+ ownerDepartmentRole: z74.enum(["manager", "member"]),
3712
+ alertRecipients: z74.array(AlertRecipientSchema).default([]),
3713
+ reviewCadence: z74.enum(OBJECTIVE_CADENCES),
3714
+ effectiveDate: z74.string().datetime(),
3715
+ targetDate: z74.string().datetime().optional()
3716
+ });
3717
+ var UpdateQualityObjectiveRequestSchema = z74.object({
3718
+ title: z74.string().min(1).max(200).optional(),
3719
+ description: z74.string().min(1).max(5e3).optional(),
3720
+ unit: z74.string().min(1).max(50).optional(),
3721
+ target: z74.number().optional(),
3722
+ direction: z74.enum(OBJECTIVE_DIRECTIONS).optional(),
3723
+ warningThreshold: z74.number().optional(),
3724
+ ownerDepartment: z74.string().min(1).optional(),
3725
+ ownerDepartmentRole: z74.enum(["manager", "member"]).optional(),
3726
+ alertRecipients: z74.array(AlertRecipientSchema).optional(),
3727
+ reviewCadence: z74.enum(OBJECTIVE_CADENCES).optional(),
3728
+ targetDate: z74.string().datetime().nullable().optional()
3729
+ });
3730
+ var RecordObjectiveValueRequestSchema = z74.object({
3731
+ value: z74.number(),
3732
+ note: z74.string().max(1e3).optional()
3733
+ });
3734
+ var ListQualityObjectivesQuerySchema = z74.object({
3735
+ type: z74.enum(OBJECTIVE_TYPES).optional(),
3736
+ status: z74.enum(OBJECTIVE_STATUSES).optional(),
3737
+ isActive: z74.enum(["true", "false"]).transform((v) => v === "true").optional(),
3738
+ page: z74.coerce.number().int().positive().default(1),
3739
+ limit: z74.coerce.number().int().positive().max(100).default(20)
3740
+ });
3741
+ var QmsObjectiveParamSchema = z74.object({
3742
+ orgId: z74.string().min(1),
3743
+ qmsId: z74.string().min(1)
3744
+ });
3745
+ var ObjectiveIdParamSchema = z74.object({
3746
+ orgId: z74.string().min(1),
3747
+ qmsId: z74.string().min(1),
3748
+ objectiveId: z74.string().min(1)
3749
+ });
3750
+
3751
+ // ../contracts/dist/quality-objectives/responses.js
3752
+ import { z as z75 } from "zod";
3753
+ var QualityObjectiveSnapshotResponseSchema = z75.object({
3754
+ id: z75.string(),
3755
+ value: z75.number(),
3756
+ status: z75.enum(OBJECTIVE_STATUSES),
3757
+ source: z75.enum(["auto", "manual", "review"]),
3758
+ reviewId: z75.string().nullable(),
3759
+ capturedAt: z75.string(),
3760
+ capturedBy: z75.string().nullable()
3761
+ });
3762
+ var QualityObjectiveResponseSchema = z75.object({
3763
+ id: z75.string(),
3764
+ objectiveNumber: z75.string(),
3765
+ title: z75.string(),
3766
+ description: z75.string(),
3767
+ type: z75.enum(OBJECTIVE_TYPES),
3768
+ metricSource: z75.enum(AUTO_METRIC_SOURCES).nullable(),
3769
+ unit: z75.string(),
3770
+ target: z75.number(),
3771
+ direction: z75.enum(OBJECTIVE_DIRECTIONS),
3772
+ warningThreshold: z75.number(),
3773
+ currentValue: z75.number().nullable(),
3774
+ currentValueUpdatedAt: z75.string().nullable(),
3775
+ status: z75.enum(OBJECTIVE_STATUSES),
3776
+ ownerDepartment: z75.string(),
3777
+ ownerDepartmentRole: z75.enum(["manager", "member"]),
3778
+ alertRecipients: z75.array(z75.object({
3779
+ department: z75.string(),
3780
+ departmentRole: z75.enum(["manager", "member"])
3781
+ })),
3782
+ reviewCadence: z75.enum(OBJECTIVE_CADENCES),
3783
+ effectiveDate: z75.string(),
3784
+ targetDate: z75.string().nullable(),
3785
+ isActive: z75.boolean(),
3786
+ createdAt: z75.string(),
3787
+ createdBy: z75.string(),
3788
+ updatedAt: z75.string(),
3789
+ // Optional: included when fetching detail with snapshots
3790
+ recentSnapshots: z75.array(QualityObjectiveSnapshotResponseSchema).optional()
3791
+ });
3792
+ var ListQualityObjectivesResponseSchema = z75.object({
3793
+ items: z75.array(QualityObjectiveResponseSchema),
3794
+ total: z75.number(),
3795
+ page: z75.number(),
3796
+ limit: z75.number(),
3797
+ hasMore: z75.boolean()
3798
+ });
3799
+
3800
+ // ../contracts/dist/review-types/requests.js
3801
+ import { z as z76 } from "zod";
3802
+
3803
+ // ../contracts/dist/domain-types/quality-review.js
3804
+ var REVIEW_STATUSES = [
3805
+ "scheduled",
3806
+ "draft",
3807
+ "in_progress",
3808
+ "completed",
3809
+ "cancelled"
3810
+ ];
3811
+ var REVIEW_CADENCES = ["monthly", "quarterly", "semi_annual", "annual"];
3812
+ var REVIEW_DATA_SOURCES = [
3813
+ "capas",
3814
+ "nonconformances",
3815
+ "complaints",
3816
+ "training",
3817
+ "releases",
3818
+ "audits"
3819
+ ];
3820
+
3821
+ // ../contracts/dist/review-types/requests.js
3822
+ var CreateReviewTypeRequestSchema = z76.object({
3823
+ name: z76.string().min(1).max(200),
3824
+ dataSources: z76.array(z76.enum(REVIEW_DATA_SOURCES)).min(1),
3825
+ requiredSections: z76.array(z76.string().min(1)).default([]),
3826
+ ownerDepartment: z76.string().min(1),
3827
+ ownerDepartmentRole: z76.enum(["manager", "member"]),
3828
+ cadence: z76.enum(REVIEW_CADENCES),
3829
+ advanceNotificationDays: z76.number().int().min(1).max(30).default(7),
3830
+ includeObjectives: z76.boolean().default(false)
3831
+ });
3832
+ var UpdateReviewTypeRequestSchema = z76.object({
3833
+ name: z76.string().min(1).max(200).optional(),
3834
+ dataSources: z76.array(z76.enum(REVIEW_DATA_SOURCES)).min(1).optional(),
3835
+ requiredSections: z76.array(z76.string().min(1)).optional(),
3836
+ ownerDepartment: z76.string().min(1).optional(),
3837
+ ownerDepartmentRole: z76.enum(["manager", "member"]).optional(),
3838
+ cadence: z76.enum(REVIEW_CADENCES).optional(),
3839
+ advanceNotificationDays: z76.number().int().min(1).max(30).optional(),
3840
+ includeObjectives: z76.boolean().optional()
3841
+ });
3842
+ var QmsReviewTypeParamSchema = z76.object({
3843
+ orgId: z76.string().min(1),
3844
+ qmsId: z76.string().min(1)
3845
+ });
3846
+ var ReviewTypeIdParamSchema = z76.object({
3847
+ orgId: z76.string().min(1),
3848
+ qmsId: z76.string().min(1),
3849
+ reviewTypeId: z76.string().min(1)
3850
+ });
3851
+
3852
+ // ../contracts/dist/review-types/responses.js
3853
+ import { z as z77 } from "zod";
3854
+ var ReviewTypeResponseSchema = z77.object({
3855
+ id: z77.string(),
3856
+ name: z77.string(),
3857
+ isBuiltIn: z77.boolean(),
3858
+ dataSources: z77.array(z77.enum(REVIEW_DATA_SOURCES)),
3859
+ requiredSections: z77.array(z77.string()),
3860
+ ownerDepartment: z77.string(),
3861
+ ownerDepartmentRole: z77.enum(["manager", "member"]),
3862
+ cadence: z77.enum(REVIEW_CADENCES),
3863
+ advanceNotificationDays: z77.number(),
3864
+ includeObjectives: z77.boolean(),
3865
+ isActive: z77.boolean(),
3866
+ createdAt: z77.string(),
3867
+ updatedAt: z77.string()
3868
+ });
3869
+ var ListReviewTypesResponseSchema = z77.object({
3870
+ items: z77.array(ReviewTypeResponseSchema)
3871
+ });
3872
+
3873
+ // ../contracts/dist/quality-reviews/requests.js
3874
+ import { z as z78 } from "zod";
3875
+ var CreateQualityReviewRequestSchema = z78.object({
3876
+ reviewTypeId: z78.string().min(1),
3877
+ title: z78.string().min(1).max(200),
3878
+ scheduledDate: z78.string().datetime(),
3879
+ reviewPeriod: z78.object({
3880
+ from: z78.string().datetime(),
3881
+ to: z78.string().datetime()
3882
+ })
3883
+ });
3884
+ var AddDecisionRequestSchema = z78.object({
3885
+ description: z78.string().min(1).max(2e3),
3886
+ decidedBy: z78.string().min(1)
3887
+ });
3888
+ var AddAttendeeRequestSchema = z78.object({
3889
+ memberId: z78.string().min(1),
3890
+ name: z78.string().min(1),
3891
+ department: z78.string().min(1),
3892
+ role: z78.string().min(1)
3893
+ });
3894
+ var UpdateReviewNotesRequestSchema = z78.object({
3895
+ notes: z78.string().max(1e4)
3896
+ });
3897
+ var ListQualityReviewsQuerySchema = z78.object({
3898
+ reviewTypeId: z78.string().optional(),
3899
+ status: z78.enum(REVIEW_STATUSES).optional(),
3900
+ page: z78.coerce.number().int().positive().default(1),
3901
+ limit: z78.coerce.number().int().positive().max(100).default(20)
3902
+ });
3903
+ var QmsReviewParamSchema = z78.object({
3904
+ orgId: z78.string().min(1),
3905
+ qmsId: z78.string().min(1)
3906
+ });
3907
+ var ReviewIdParamSchema = z78.object({
3908
+ orgId: z78.string().min(1),
3909
+ qmsId: z78.string().min(1),
3910
+ reviewId: z78.string().min(1)
3911
+ });
3912
+
3913
+ // ../contracts/dist/quality-reviews/responses.js
3914
+ import { z as z79 } from "zod";
3915
+ var MonthlyTrendSchema = z79.object({
3916
+ month: z79.string(),
3917
+ opened: z79.number(),
3918
+ closed: z79.number()
3919
+ });
3920
+ var ReviewDataSnapshotSchema = z79.object({
3921
+ capas: z79.object({
3922
+ total: z79.number(),
3923
+ open: z79.number(),
3924
+ overdue: z79.number(),
3925
+ avgCycleTimeDays: z79.number().nullable(),
3926
+ trend: z79.array(MonthlyTrendSchema)
3927
+ }).optional(),
3928
+ nonconformances: z79.object({
3929
+ total: z79.number(),
3930
+ open: z79.number(),
3931
+ overdue: z79.number(),
3932
+ avgCycleTimeDays: z79.number().nullable(),
3933
+ bySeverity: z79.record(z79.string(), z79.number()),
3934
+ trend: z79.array(MonthlyTrendSchema)
3935
+ }).optional(),
3936
+ complaints: z79.object({
3937
+ total: z79.number(),
3938
+ open: z79.number(),
3939
+ overdue: z79.number(),
3940
+ reportableCount: z79.number(),
3941
+ trend: z79.array(MonthlyTrendSchema)
3942
+ }).optional(),
3943
+ training: z79.object({
3944
+ totalTasks: z79.number(),
3945
+ complianceRate: z79.number(),
3946
+ overdue: z79.number()
3947
+ }).optional(),
3948
+ releases: z79.object({
3949
+ total: z79.number(),
3950
+ avgCycleTimeDays: z79.number().nullable()
3951
+ }).optional(),
3952
+ audits: z79.object({
3953
+ totalFindings: z79.number(),
3954
+ major: z79.number(),
3955
+ minor: z79.number(),
3956
+ observations: z79.number()
3957
+ }).optional()
3958
+ });
3959
+ var ReviewObjectiveSnapshotSchema = z79.object({
3960
+ objectiveId: z79.string(),
3961
+ title: z79.string(),
3962
+ target: z79.number(),
3963
+ value: z79.number().nullable(),
3964
+ status: z79.string(),
3965
+ direction: z79.string(),
3966
+ unit: z79.string()
3967
+ });
3968
+ var ReviewDecisionSchema = z79.object({
3969
+ description: z79.string(),
3970
+ decidedBy: z79.string()
3971
+ });
3972
+ var ReviewAttendeeSchema = z79.object({
3973
+ memberId: z79.string(),
3974
+ name: z79.string(),
3975
+ department: z79.string(),
3976
+ role: z79.string()
3977
+ });
3978
+ var QualityReviewResponseSchema = z79.object({
3979
+ id: z79.string(),
3980
+ reviewNumber: z79.string(),
3981
+ title: z79.string(),
3982
+ reviewTypeId: z79.string(),
3983
+ reviewTypeName: z79.string(),
3984
+ status: z79.enum(REVIEW_STATUSES),
3985
+ scheduledDate: z79.string(),
3986
+ conductedDate: z79.string().nullable(),
3987
+ reviewPeriod: z79.object({
3988
+ from: z79.string(),
3989
+ to: z79.string()
3990
+ }),
3991
+ ownerDepartment: z79.string(),
3992
+ ownerDepartmentRole: z79.enum(["manager", "member"]),
3993
+ dataSources: z79.array(z79.enum(REVIEW_DATA_SOURCES)),
3994
+ attendees: z79.array(ReviewAttendeeSchema),
3995
+ dataSnapshot: ReviewDataSnapshotSchema,
3996
+ objectiveSnapshots: z79.array(ReviewObjectiveSnapshotSchema),
3997
+ decisions: z79.array(ReviewDecisionSchema),
3998
+ notes: z79.string().nullable(),
3999
+ completedAt: z79.string().nullable(),
4000
+ completedBy: z79.string().nullable(),
4001
+ createdAt: z79.string(),
4002
+ createdBy: z79.string(),
4003
+ updatedAt: z79.string()
4004
+ });
4005
+ var ListQualityReviewsResponseSchema = z79.object({
4006
+ items: z79.array(QualityReviewResponseSchema),
4007
+ total: z79.number(),
4008
+ page: z79.number(),
4009
+ limit: z79.number(),
4010
+ hasMore: z79.boolean()
4011
+ });
4012
+
4013
+ // ../contracts/dist/quality-findings/responses.js
4014
+ import { z as z80 } from "zod";
4015
+ var QUALITY_FINDING_CODES = [
4016
+ "review_overdue",
4017
+ "action_overdue",
4018
+ "objective_off_target",
4019
+ "review_actions_incomplete"
4020
+ ];
4021
+ var QUALITY_FINDING_SEVERITIES = ["error", "warning"];
4022
+ var QualityFindingSchema = z80.object({
4023
+ code: z80.enum(QUALITY_FINDING_CODES),
4024
+ severity: z80.enum(QUALITY_FINDING_SEVERITIES),
4025
+ entityId: z80.string(),
4026
+ entityTitle: z80.string(),
4027
+ message: z80.string(),
4028
+ metadata: z80.record(z80.unknown()).optional()
4029
+ });
4030
+ var QualityFindingsResponseSchema = z80.object({
4031
+ findings: z80.array(QualityFindingSchema),
4032
+ summary: z80.object({
4033
+ errorCount: z80.number(),
4034
+ warningCount: z80.number(),
4035
+ overdueActions: z80.number(),
4036
+ overdueReviews: z80.number(),
4037
+ offTargetObjectives: z80.number(),
4038
+ incompleteReviewActions: z80.number()
4039
+ })
4040
+ });
4041
+
4042
+ // ../contracts/dist/frameworks/requests.js
4043
+ import { z as z81 } from "zod";
4044
+ var GetFrameworksQuerySchema = z81.object({
4045
+ scope: FrameworkScopeSchema.optional()
4046
+ });
4047
+ var GetFrameworkParamsSchema = z81.object({
4048
+ frameworkId: RegulatoryFrameworkSchema
4049
+ });
4050
+ var GetClauseMappingsParamsSchema = z81.object({
4051
+ frameworkId: RegulatoryFrameworkSchema,
4052
+ clauseId: z81.string().min(1)
4053
+ });
4054
+ var GetCrosswalkQuerySchema = z81.object({
4055
+ targetFrameworkId: RegulatoryFrameworkSchema
4056
+ });
4057
+ var GetQmsComplianceParamsSchema = z81.object({
4058
+ orgId: z81.string().min(1)
4059
+ });
4060
+ var GetQmsComplianceQuerySchema = z81.object({
4061
+ repositoryId: z81.string().min(1)
4062
+ });
4063
+ var GetDeviceComplianceParamsSchema = z81.object({
4064
+ orgId: z81.string().min(1),
4065
+ deviceId: z81.string().min(1)
4066
+ });
4067
+ var GetDeviceFrameworkComplianceParamsSchema = z81.object({
4068
+ orgId: z81.string().min(1),
4069
+ deviceId: z81.string().min(1),
4070
+ frameworkId: RegulatoryFrameworkSchema
4071
+ });
4072
+
4073
+ // ../contracts/dist/frameworks/responses.js
4074
+ import { z as z82 } from "zod";
4075
+ var FrameworkSummarySchema = z82.object({
4076
+ id: RegulatoryFrameworkSchema,
4077
+ name: z82.string(),
4078
+ version: z82.string(),
4079
+ scope: FrameworkScopeSchema,
4080
+ url: z82.string().nullable(),
4081
+ active: z82.boolean(),
4082
+ clauseCount: z82.number().int().nonnegative()
4083
+ });
4084
+ var FrameworksListResponseSchema = z82.object({
4085
+ frameworks: z82.array(FrameworkSummarySchema)
4086
+ });
4087
+ var ClauseNodeSchema = z82.lazy(() => z82.object({
4088
+ id: z82.string(),
4089
+ frameworkId: RegulatoryFrameworkSchema,
4090
+ clauseNumber: z82.string(),
4091
+ title: z82.string(),
4092
+ parentClauseId: z82.string().nullable(),
4093
+ depth: z82.number().int().nonnegative(),
4094
+ sortOrder: z82.number().int().nonnegative(),
4095
+ children: z82.array(ClauseNodeSchema)
4096
+ }));
4097
+ var FrameworkDetailResponseSchema = z82.object({
4098
+ id: RegulatoryFrameworkSchema,
4099
+ name: z82.string(),
4100
+ version: z82.string(),
4101
+ scope: FrameworkScopeSchema,
4102
+ url: z82.string().nullable(),
4103
+ active: z82.boolean(),
4104
+ clauses: z82.array(ClauseNodeSchema)
4105
+ });
4106
+ var ClauseMappingSchema = z82.object({
4107
+ clauseId: z82.string(),
4108
+ mappedFrameworkId: RegulatoryFrameworkSchema,
4109
+ mappedFrameworkName: z82.string(),
4110
+ mappedClauseId: z82.string(),
4111
+ mappedClauseTitle: z82.string(),
4112
+ relationship: MappingRelationshipSchema,
4113
+ notes: z82.string().nullable()
4114
+ });
4115
+ var ClauseMappingsResponseSchema = z82.object({
4116
+ clauseId: z82.string(),
4117
+ frameworkId: RegulatoryFrameworkSchema,
4118
+ mappings: z82.array(ClauseMappingSchema)
4119
+ });
4120
+ var CrosswalkResponseSchema = z82.object({
4121
+ sourceFrameworkId: RegulatoryFrameworkSchema,
4122
+ targetFrameworkId: RegulatoryFrameworkSchema,
4123
+ mappings: z82.array(ClauseMappingSchema)
4124
+ });
4125
+ var FrameworkCoverageSchema = z82.object({
4126
+ frameworkId: RegulatoryFrameworkSchema,
4127
+ frameworkName: z82.string(),
4128
+ totalClauses: z82.number().int().nonnegative(),
4129
+ coveredClauses: z82.number().int().nonnegative(),
4130
+ coveragePercent: z82.number().min(0).max(100),
4131
+ scope: FrameworkScopeSchema
4132
+ });
4133
+ var ComplianceSummaryResponseSchema = z82.object({
4134
+ organizationId: z82.string(),
4135
+ frameworks: z82.array(FrameworkCoverageSchema),
4136
+ overallCoveragePercent: z82.number().min(0).max(100)
4137
+ });
4138
+ var EvidenceItemSchema = z82.object({
4139
+ documentId: z82.string(),
4140
+ documentTitle: z82.string(),
4141
+ /** Document type. Optional — omitted for non-document evidence (e.g. training records). */
4142
+ docType: DocumentTypeSchema.optional(),
4143
+ linkType: LinkTypeSchema.optional(),
4144
+ status: z82.string()
4145
+ });
4146
+ var ClauseComplianceSchema = z82.object({
4147
+ clauseId: z82.string(),
4148
+ clauseNumber: z82.string(),
4149
+ clauseTitle: z82.string(),
4150
+ covered: z82.boolean(),
4151
+ /** Compliance score 0..1 based on weighted evidence rules */
4152
+ score: z82.number().min(0).max(1),
4153
+ evidence: z82.array(EvidenceItemSchema)
4154
+ });
4155
+ var FrameworkComplianceResponseSchema = z82.object({
4156
+ frameworkId: RegulatoryFrameworkSchema,
4157
+ frameworkName: z82.string(),
4158
+ totalClauses: z82.number().int().nonnegative(),
4159
+ coveredClauses: z82.number().int().nonnegative(),
4160
+ coveragePercent: z82.number().min(0).max(100),
4161
+ clauses: z82.array(ClauseComplianceSchema)
4162
+ });
4163
+
4164
+ // ../contracts/dist/frameworks/evidence.js
4165
+ import { z as z83 } from "zod";
4166
+ var ClauseEvidenceStatusSchema = z83.enum(["covered", "partial", "missing"]);
4167
+ var ClauseEvidenceItemSchema = z83.object({
4168
+ type: z83.string(),
4169
+ label: z83.string(),
4170
+ count: z83.number().int().nonnegative(),
4171
+ status: ClauseEvidenceStatusSchema
4172
+ });
4173
+ var ClauseEvidenceNodeSchema = z83.object({
4174
+ clauseId: z83.string(),
4175
+ clauseNumber: z83.string(),
4176
+ clauseTitle: z83.string(),
4177
+ status: ClauseEvidenceStatusSchema,
4178
+ evidenceCount: z83.number().int().nonnegative(),
4179
+ evidence: z83.array(ClauseEvidenceItemSchema)
4180
+ });
4181
+ var FrameworkEvidenceResponseSchema = z83.object({
4182
+ frameworkId: RegulatoryFrameworkSchema,
4183
+ frameworkName: z83.string(),
4184
+ totalClauses: z83.number().int().nonnegative(),
4185
+ coveredClauses: z83.number().int().nonnegative(),
4186
+ partialClauses: z83.number().int().nonnegative(),
4187
+ missingClauses: z83.number().int().nonnegative(),
4188
+ clauses: z83.array(ClauseEvidenceNodeSchema)
4189
+ });
4190
+
4191
+ // ../contracts/dist/domain-constants/risk-matrix.js
4192
+ var RISK_DOCUMENT_TYPES = [
4193
+ "software_risk",
4194
+ "usability_risk",
4195
+ "security_risk"
4196
+ ];
4197
+ var HAZARD_DOCUMENT_TYPES = ["haz_soe_software", "haz_soe_security"];
4198
+ var ALL_RISK_RELATED_DOCUMENT_TYPES = [
4199
+ ...RISK_DOCUMENT_TYPES,
4200
+ ...HAZARD_DOCUMENT_TYPES,
4201
+ "hazardous_situation",
4202
+ "harm"
4203
+ ];
4204
+
4205
+ // ../contracts/dist/domain-constants/index.js
4206
+ var REQUIRED_SECTIONS = {
4207
+ user_need: ["Purpose", "Stakeholder", "User Needs"],
4208
+ architecture: ["Purpose"],
4209
+ release_plan: ["Scope", "Applicable Plans", "Release-Specific Criteria", "Known Anomalies"],
4210
+ design_review: ["Review Scope", "Attendees", "Findings", "Actions", "Conclusion"],
4211
+ release_notes: ["Changes", "Known Issues"],
4212
+ audit_schedule: ["Scope", "Audit Criteria"],
4213
+ audit_report: ["Scope", "Methodology", "Findings", "Conclusion"],
4214
+ management_review: ["Review Inputs", "Review Outputs", "Action Items", "Decisions"],
4215
+ hazard_category: ["Description", "Examples", "Applicable Standards"]
4216
+ };
4217
+
4218
+ // ../contracts/dist/domain-validators/permissions.js
4219
+ import { z as z84 } from "zod";
4220
+ var MemberPermissionsSchema = z84.object({
4221
+ canSign: z84.boolean(),
4222
+ canApprove: z84.boolean(),
4223
+ canCreateRelease: z84.boolean(),
4224
+ canPublishRelease: z84.boolean(),
4225
+ canManageMembers: z84.boolean(),
4226
+ canViewAuditLog: z84.boolean(),
4227
+ canExport: z84.boolean()
1161
4228
  });
1162
4229
 
1163
4230
  // src/schema-map.ts