@pactosigna/schemas 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-A3X6VKYK.js +141 -0
- package/dist/cli.js +1545 -0
- package/dist/document-type-patterns-JuAGFi_j.d.ts +64 -0
- package/dist/document-type-patterns.d.ts +1 -0
- package/dist/document-type-patterns.js +14 -0
- package/dist/index.d.ts +459 -223
- package/dist/index.js +968 -468
- package/package.json +11 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// src/document-type-patterns.ts
|
|
2
|
+
var FOLDER_RULES = {
|
|
3
|
+
// Product (ISO 13485 §7.3)
|
|
4
|
+
"docs/product": {
|
|
5
|
+
prefixes: ["PDP-", "IU-"],
|
|
6
|
+
type: ["product_development_plan", "intended_use"]
|
|
7
|
+
},
|
|
8
|
+
"docs/product/requirements": { prefixes: ["PRS-"], type: "requirement", category: "product" },
|
|
9
|
+
"docs/product/user-needs": { prefixes: ["UN-"], type: "user_need" },
|
|
10
|
+
// Software requirements (moved under software discipline)
|
|
11
|
+
"docs/software/requirements": { prefixes: ["SRS-"], type: "requirement", category: "software" },
|
|
12
|
+
// Design (IEC 62304 — under software discipline)
|
|
13
|
+
"docs/software/architecture": { prefixes: ["HLD-", "SAD-", "DEV-PLAN-"], type: "architecture" },
|
|
14
|
+
"docs/software/design": { prefixes: ["SDD-", "DDD-"], type: "detailed_design" },
|
|
15
|
+
// Test (protocols + reports)
|
|
16
|
+
"docs/test/protocols": { prefixes: ["TP-"], type: "test_protocol" },
|
|
17
|
+
"docs/test/reports": { prefixes: ["TR-"], type: "test_report" },
|
|
18
|
+
// Risk management — ISO 14971 (umbrella)
|
|
19
|
+
"docs/risk/plans": { prefixes: ["RMP-"], type: "risk_management_plan" },
|
|
20
|
+
"docs/risk/situations": { prefixes: ["HS-"], type: "hazardous_situation" },
|
|
21
|
+
"docs/risk/harms": { prefixes: ["HARM-"], type: "harm" },
|
|
22
|
+
"docs/risk/hazard-categories": { prefixes: ["HC-"], type: "hazard_category" },
|
|
23
|
+
// Software lifecycle — IEC 62304
|
|
24
|
+
"docs/software/plans": {
|
|
25
|
+
prefixes: ["DEV-PLAN-", "MAINT-PLAN-", "SDP-", "STP-"],
|
|
26
|
+
type: [
|
|
27
|
+
"software_development_plan",
|
|
28
|
+
"software_maintenance_plan",
|
|
29
|
+
"software_development_plan",
|
|
30
|
+
"software_test_plan"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"docs/software/risks": {
|
|
34
|
+
prefixes: ["HAZ-SW-", "RISK-SW-"],
|
|
35
|
+
type: ["haz_soe_software", "software_risk"]
|
|
36
|
+
},
|
|
37
|
+
"docs/software/soup": { prefixes: ["SOUP-"], type: "soup_register" },
|
|
38
|
+
// Problem resolution — IEC 62304 §9
|
|
39
|
+
"docs/software/anomalies": { prefixes: ["ANOM-"], type: "anomaly" },
|
|
40
|
+
// Cybersecurity — IEC 81001-5-1
|
|
41
|
+
"docs/cybersecurity/plans": { prefixes: ["CSPLAN-"], type: "cybersecurity_plan" },
|
|
42
|
+
"docs/cybersecurity/risks": {
|
|
43
|
+
prefixes: ["HAZ-SEC-", "RISK-SEC-"],
|
|
44
|
+
type: ["haz_soe_security", "security_risk"]
|
|
45
|
+
},
|
|
46
|
+
"docs/cybersecurity/sbom": { prefixes: ["SBOM-"], type: "sbom" },
|
|
47
|
+
// Usability engineering — IEC 62366
|
|
48
|
+
"docs/usability": { prefixes: ["UEP-"], type: "usability_plan" },
|
|
49
|
+
"docs/usability/use-specifications": { prefixes: ["US-"], type: "use_specification" },
|
|
50
|
+
"docs/usability/task-analyses": { prefixes: ["TA-"], type: "task_analysis" },
|
|
51
|
+
"docs/usability/evaluations": {
|
|
52
|
+
prefixes: ["UE-", "SE-"],
|
|
53
|
+
type: ["usability_evaluation", "summative_evaluation"]
|
|
54
|
+
},
|
|
55
|
+
"docs/usability/risks": { prefixes: ["RISK-US-"], type: "usability_risk" },
|
|
56
|
+
// Clinical — MDR / FDA
|
|
57
|
+
"docs/clinical": {
|
|
58
|
+
prefixes: ["CEP-", "CER-"],
|
|
59
|
+
type: ["clinical_evaluation_plan", "clinical_evaluation_report"]
|
|
60
|
+
},
|
|
61
|
+
// Post-market surveillance — MDR Art. 83
|
|
62
|
+
"docs/post-market": { prefixes: ["PMS-"], type: "post_market_surveillance_plan" },
|
|
63
|
+
"docs/post-market/feedback": { prefixes: ["PMF-"], type: "post_market_feedback" },
|
|
64
|
+
// Change management — ISO 13485 §7.3.5
|
|
65
|
+
"docs/change/drm": { prefixes: ["DRM-"], type: "design_review" },
|
|
66
|
+
"docs/change/release-plans": { prefixes: ["RP-"], type: "release_plan" },
|
|
67
|
+
"docs/change/release-notes": { prefixes: ["RN-"], type: "release_notes" },
|
|
68
|
+
// Labeling — MDR Annex I
|
|
69
|
+
"docs/labeling": { prefixes: ["LBL-"], type: "labeling" },
|
|
70
|
+
// QMS documents
|
|
71
|
+
"docs/policies": { prefixes: ["POL-"], type: "policy" },
|
|
72
|
+
"docs/sops": { prefixes: ["SOP-"], type: "sop" },
|
|
73
|
+
"docs/work-instructions": { prefixes: ["WI-"], type: "work_instruction" },
|
|
74
|
+
// Internal audit management (ISO 13485 §8.2.2)
|
|
75
|
+
"docs/audits/schedules": { prefixes: ["AUD-SCH-"], type: "audit_schedule" },
|
|
76
|
+
"docs/audits/reports": { prefixes: ["AUD-RPT-"], type: "audit_report" },
|
|
77
|
+
// Management review (ISO 13485 §5.6)
|
|
78
|
+
"docs/management-reviews": { prefixes: ["MR-"], type: "management_review" },
|
|
79
|
+
// Supplier management (ISO 13485 §7.4)
|
|
80
|
+
"docs/suppliers": { prefixes: ["SUP-"], type: "supplier" }
|
|
81
|
+
};
|
|
82
|
+
var JSON_SBOM_FOLDERS = ["docs/cybersecurity/sbom"];
|
|
83
|
+
var NON_REGULATED_FOLDERS = ["docs/compliance", "docs/user-guide", "docs/legal"];
|
|
84
|
+
function normalizePath(path) {
|
|
85
|
+
return path.toLowerCase().replace(/\\/g, "/");
|
|
86
|
+
}
|
|
87
|
+
function extractFolder(filePath) {
|
|
88
|
+
const normalized = normalizePath(filePath);
|
|
89
|
+
const parts = normalized.split("/");
|
|
90
|
+
parts.pop();
|
|
91
|
+
return parts.join("/");
|
|
92
|
+
}
|
|
93
|
+
function findFolderRule(filePath) {
|
|
94
|
+
const folder = extractFolder(filePath);
|
|
95
|
+
if (FOLDER_RULES[folder]) {
|
|
96
|
+
return { rule: FOLDER_RULES[folder], folder };
|
|
97
|
+
}
|
|
98
|
+
const parts = folder.split("/");
|
|
99
|
+
while (parts.length > 0) {
|
|
100
|
+
const partial = parts.join("/");
|
|
101
|
+
if (FOLDER_RULES[partial]) {
|
|
102
|
+
return { rule: FOLDER_RULES[partial], folder: partial };
|
|
103
|
+
}
|
|
104
|
+
parts.pop();
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
function inferDocumentType(filePath, documentId) {
|
|
109
|
+
const match = findFolderRule(filePath);
|
|
110
|
+
if (!match) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
const { rule } = match;
|
|
114
|
+
if (typeof rule.type === "string") {
|
|
115
|
+
return {
|
|
116
|
+
docType: rule.type,
|
|
117
|
+
category: rule.category
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const prefixIndex = rule.prefixes.findIndex(
|
|
121
|
+
(prefix) => documentId.toUpperCase().startsWith(prefix.toUpperCase())
|
|
122
|
+
);
|
|
123
|
+
if (prefixIndex === -1) {
|
|
124
|
+
return {
|
|
125
|
+
docType: rule.type[0],
|
|
126
|
+
category: rule.category
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
docType: rule.type[prefixIndex],
|
|
131
|
+
category: rule.category
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export {
|
|
136
|
+
FOLDER_RULES,
|
|
137
|
+
JSON_SBOM_FOLDERS,
|
|
138
|
+
NON_REGULATED_FOLDERS,
|
|
139
|
+
findFolderRule,
|
|
140
|
+
inferDocumentType
|
|
141
|
+
};
|