hvp-shared 10.0.0 → 11.0.0

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.
@@ -17,6 +17,27 @@
17
17
  * skip the role filter.
18
18
  */
19
19
  export declare const AUDIENCE_ALL = "all";
20
+ /**
21
+ * Fundamental document nature. Drives lifecycle behavior:
22
+ *
23
+ * - `operational` — living doc that evolves; full lifecycle (draft → current →
24
+ * outdated → withdrawn); has versions; has elaboratedAt/reviewedAt/
25
+ * authorizedAt per version.
26
+ * - `reference` — singleton authoritative artifact; can be replaced by a newer
27
+ * instance (which becomes a separate doc); simpler lifecycle.
28
+ * - `record` — moment-in-time capture of an unrepeatable event; no real
29
+ * lifecycle; just exists.
30
+ *
31
+ * Replaces `Purpose` from earlier design (purpose mixed audience + lifecycle).
32
+ * Migration: operational stays operational; archive → record;
33
+ * external/reference → reference (with type-level adjustments).
34
+ */
35
+ export declare enum Category {
36
+ operational = "operational",
37
+ reference = "reference",
38
+ record = "record"
39
+ }
40
+ export declare const CATEGORY_LABELS: Record<Category, string>;
20
41
  /**
21
42
  * High-level reason a document exists. First axis of the classification
22
43
  * (purpose → type → tags). One purpose per audience:
@@ -63,25 +84,61 @@ export declare enum DocumentType {
63
84
  */
64
85
  control = "control",
65
86
  reference_data = "reference_data",
66
- training_material = "training_material",
67
87
  legal_document = "legal_document",
68
88
  brand_asset = "brand_asset",
89
+ /**
90
+ * Permits, certifications, fiscal certificates issued by external authorities.
91
+ * Singletons replaced when re-issued (e.g. CSF SAT, COFEPRIS, MVR cards).
92
+ * Added with the Category model.
93
+ */
94
+ permit = "permit",
69
95
  meeting_recording = "meeting_recording",
70
96
  historical = "historical",
97
+ /**
98
+ * Specific instance of a class/training session (e.g. "Otitis externa 1
99
+ * con Anahí Fuentes"). Each is its own doc; new courses ≠ new versions.
100
+ * Added with the Category model — replaces `training_material`.
101
+ */
102
+ training_class = "training_class",
103
+ /**
104
+ * One-shot presentation tied to a specific event (anniversaries, public
105
+ * health campaigns). Added with the Category model — covers what
106
+ * `marketing` used to capture for past-event content.
107
+ */
108
+ presentation = "presentation",
109
+ /** @deprecated Renamed to `training_class` in the Category model. */
110
+ training_material = "training_material",
111
+ /** @deprecated One-shot externals → `presentation`; living external → operational/guidance. */
71
112
  marketing = "marketing"
72
113
  }
73
114
  export declare const DOCUMENT_TYPE_LABELS: Record<DocumentType, string>;
115
+ /**
116
+ * Which Category each DocumentType belongs to. Source of truth for category
117
+ * derivation when only `type` is known. Used by migration and validation.
118
+ */
119
+ export declare const TYPE_TO_CATEGORY: Record<DocumentType, Category>;
74
120
  /**
75
121
  * Lifecycle state of the document.
76
122
  *
123
+ * Unified vocabulary across categories. Each category uses a subset:
124
+ * - operational: draft → current → outdated → withdrawn
125
+ * - reference: current → outdated → withdrawn
126
+ * - record: current → withdrawn (rarely outdated)
127
+ *
77
128
  * Per workflow decision (master plan §Decision 3): there are NO automatic
78
- * direct-publish rules per criticality — author chooses to publish directly
79
- * or send to in_review. Reviewer (different person from author) approves.
129
+ * direct-publish rules per criticality — author chooses status directly.
130
+ *
131
+ * `draft` covers the pre-publication phase (was previously split into
132
+ * `draft` + `in_review`; merged for HVP-scale reality).
80
133
  */
81
134
  export declare enum DocumentStatus {
82
135
  draft = "draft",
83
- in_review = "in_review",
84
- published = "published",
136
+ /**
137
+ * Vigente: doc activo y autoritativo (operational), instancia actual
138
+ * (reference) o registro accesible (record). Renamed from `published` in
139
+ * the Category model to share vocabulary across categories.
140
+ */
141
+ current = "current",
85
142
  /**
86
143
  * Vigente pero desfasado: el contenido sigue aplicando, pero hay partes
87
144
  * desactualizadas que conviene revisar. Visible en listas con un warning.
@@ -94,6 +151,10 @@ export declare enum DocumentStatus {
94
151
  * captura mejor la decisión activa que "obsoleto").
95
152
  */
96
153
  withdrawn = "withdrawn",
154
+ /** @deprecated Merged into `draft` in the Category model. */
155
+ in_review = "in_review",
156
+ /** @deprecated Renamed to `current` in the Category model. */
157
+ published = "published",
97
158
  /**
98
159
  * @deprecated Renombrado a `withdrawn` desde 9.3.0. Sigue presente en
99
160
  * el enum durante la ventana de migración para compat de lectura;
@@ -102,14 +163,22 @@ export declare enum DocumentStatus {
102
163
  */
103
164
  obsolete = "obsolete",
104
165
  /**
105
- * Archivado-histórico: preservación de un documento cuya naturaleza es
106
- * registro (grabaciones de reunión, comunicados pasados, etc.). Oculto por
107
- * defecto. Distinto de `withdrawn`: archived es preservación pasiva,
108
- * withdrawn es retiro activo.
166
+ * @deprecated Records ahora usan `current` (existen y son accesibles).
167
+ * Operational/reference no usan este status. Kept for migration window.
109
168
  */
110
169
  archived = "archived"
111
170
  }
112
171
  export declare const DOCUMENT_STATUS_LABELS: Record<DocumentStatus, string>;
172
+ /**
173
+ * Map Category back to legacy Purpose for backwards-compat during migration.
174
+ * Used by mappers/responses that still emit `purpose`.
175
+ */
176
+ export declare const CATEGORY_TO_PURPOSE: Record<Category, Purpose>;
177
+ /**
178
+ * Allowed statuses per category. UI uses this to render the right options
179
+ * in dropdowns. Unified vocabulary, but each category uses a subset.
180
+ */
181
+ export declare const STATUS_BY_CATEGORY: Record<Category, DocumentStatus[]>;
113
182
  /**
114
183
  * How critical the document is. Used for ranking, badge color, and (in SP4)
115
184
  * acknowledgment urgency.
@@ -13,7 +13,7 @@
13
13
  * @see .claude/plans/active/20260427-GH21-documentation-system-redesign.md
14
14
  */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.EXTERNAL_LINK_PROVIDER_LABELS = exports.ExternalLinkProvider = exports.CONTENT_TYPE_LABELS = exports.ContentType = exports.CHANGE_TYPE_LABELS = exports.ChangeType = exports.CRITICALITY_LABELS = exports.Criticality = exports.DOCUMENT_STATUS_LABELS = exports.DocumentStatus = exports.DOCUMENT_TYPE_LABELS = exports.DocumentType = exports.PURPOSE_LABELS = exports.Purpose = exports.AUDIENCE_ALL = void 0;
16
+ exports.EXTERNAL_LINK_PROVIDER_LABELS = exports.ExternalLinkProvider = exports.CONTENT_TYPE_LABELS = exports.ContentType = exports.CHANGE_TYPE_LABELS = exports.ChangeType = exports.CRITICALITY_LABELS = exports.Criticality = exports.STATUS_BY_CATEGORY = exports.CATEGORY_TO_PURPOSE = exports.DOCUMENT_STATUS_LABELS = exports.DocumentStatus = exports.TYPE_TO_CATEGORY = exports.DOCUMENT_TYPE_LABELS = exports.DocumentType = exports.PURPOSE_LABELS = exports.Purpose = exports.CATEGORY_LABELS = exports.Category = exports.AUDIENCE_ALL = void 0;
17
17
  // ─── Audience sentinel ──────────────────────────────────────────────────────
18
18
  /**
19
19
  * Sentinel value for `audience: WebAppRole[]` meaning "visible to everyone".
@@ -21,6 +21,33 @@ exports.EXTERNAL_LINK_PROVIDER_LABELS = exports.ExternalLinkProvider = exports.C
21
21
  * skip the role filter.
22
22
  */
23
23
  exports.AUDIENCE_ALL = "all";
24
+ // ─── Category ───────────────────────────────────────────────────────────────
25
+ /**
26
+ * Fundamental document nature. Drives lifecycle behavior:
27
+ *
28
+ * - `operational` — living doc that evolves; full lifecycle (draft → current →
29
+ * outdated → withdrawn); has versions; has elaboratedAt/reviewedAt/
30
+ * authorizedAt per version.
31
+ * - `reference` — singleton authoritative artifact; can be replaced by a newer
32
+ * instance (which becomes a separate doc); simpler lifecycle.
33
+ * - `record` — moment-in-time capture of an unrepeatable event; no real
34
+ * lifecycle; just exists.
35
+ *
36
+ * Replaces `Purpose` from earlier design (purpose mixed audience + lifecycle).
37
+ * Migration: operational stays operational; archive → record;
38
+ * external/reference → reference (with type-level adjustments).
39
+ */
40
+ var Category;
41
+ (function (Category) {
42
+ Category["operational"] = "operational";
43
+ Category["reference"] = "reference";
44
+ Category["record"] = "record";
45
+ })(Category || (exports.Category = Category = {}));
46
+ exports.CATEGORY_LABELS = {
47
+ [Category.operational]: "Operativo",
48
+ [Category.reference]: "Referencia",
49
+ [Category.record]: "Registro",
50
+ };
24
51
  // ─── Purpose ────────────────────────────────────────────────────────────────
25
52
  /**
26
53
  * High-level reason a document exists. First axis of the classification
@@ -63,7 +90,7 @@ exports.PURPOSE_LABELS = {
63
90
  */
64
91
  var DocumentType;
65
92
  (function (DocumentType) {
66
- // Operational
93
+ // ── operational types (Category.operational) ───────────────────────────
67
94
  DocumentType["protocol"] = "protocol";
68
95
  DocumentType["guidance"] = "guidance";
69
96
  DocumentType["tutorial"] = "tutorial";
@@ -77,15 +104,35 @@ var DocumentType;
77
104
  * (typically static reference like catalogs). Added in 9.2.0.
78
105
  */
79
106
  DocumentType["control"] = "control";
80
- // Resource
107
+ // ── reference types (Category.reference) ───────────────────────────────
81
108
  DocumentType["reference_data"] = "reference_data";
82
- DocumentType["training_material"] = "training_material";
83
109
  DocumentType["legal_document"] = "legal_document";
84
110
  DocumentType["brand_asset"] = "brand_asset";
85
- // Archive
111
+ /**
112
+ * Permits, certifications, fiscal certificates issued by external authorities.
113
+ * Singletons replaced when re-issued (e.g. CSF SAT, COFEPRIS, MVR cards).
114
+ * Added with the Category model.
115
+ */
116
+ DocumentType["permit"] = "permit";
117
+ // ── record types (Category.record) ─────────────────────────────────────
86
118
  DocumentType["meeting_recording"] = "meeting_recording";
87
119
  DocumentType["historical"] = "historical";
88
- // Resource — communication / external content (added in 7.8.0)
120
+ /**
121
+ * Specific instance of a class/training session (e.g. "Otitis externa 1
122
+ * con Anahí Fuentes"). Each is its own doc; new courses ≠ new versions.
123
+ * Added with the Category model — replaces `training_material`.
124
+ */
125
+ DocumentType["training_class"] = "training_class";
126
+ /**
127
+ * One-shot presentation tied to a specific event (anniversaries, public
128
+ * health campaigns). Added with the Category model — covers what
129
+ * `marketing` used to capture for past-event content.
130
+ */
131
+ DocumentType["presentation"] = "presentation";
132
+ // ── deprecated (kept for migration compat) ─────────────────────────────
133
+ /** @deprecated Renamed to `training_class` in the Category model. */
134
+ DocumentType["training_material"] = "training_material";
135
+ /** @deprecated One-shot externals → `presentation`; living external → operational/guidance. */
89
136
  DocumentType["marketing"] = "marketing";
90
137
  })(DocumentType || (exports.DocumentType = DocumentType = {}));
91
138
  exports.DOCUMENT_TYPE_LABELS = {
@@ -97,26 +144,67 @@ exports.DOCUMENT_TYPE_LABELS = {
97
144
  [DocumentType.policy]: "Política",
98
145
  [DocumentType.control]: "Control",
99
146
  [DocumentType.reference_data]: "Datos de referencia",
100
- [DocumentType.training_material]: "Material de capacitación",
101
147
  [DocumentType.legal_document]: "Documento legal",
102
148
  [DocumentType.brand_asset]: "Activo de marca",
149
+ [DocumentType.permit]: "Permiso / certificado",
103
150
  [DocumentType.meeting_recording]: "Grabación de reunión",
104
151
  [DocumentType.historical]: "Histórico",
105
- [DocumentType.marketing]: "Marketing y comunicación externa",
152
+ [DocumentType.training_class]: "Clase de capacitación",
153
+ [DocumentType.presentation]: "Presentación de evento",
154
+ [DocumentType.training_material]: "Material de capacitación (legacy)",
155
+ [DocumentType.marketing]: "Marketing (legacy)",
156
+ };
157
+ /**
158
+ * Which Category each DocumentType belongs to. Source of truth for category
159
+ * derivation when only `type` is known. Used by migration and validation.
160
+ */
161
+ exports.TYPE_TO_CATEGORY = {
162
+ // operational
163
+ [DocumentType.protocol]: Category.operational,
164
+ [DocumentType.guidance]: Category.operational,
165
+ [DocumentType.tutorial]: Category.operational,
166
+ [DocumentType.format]: Category.operational,
167
+ [DocumentType.tool]: Category.operational,
168
+ [DocumentType.policy]: Category.operational,
169
+ [DocumentType.control]: Category.operational,
170
+ // reference
171
+ [DocumentType.reference_data]: Category.reference,
172
+ [DocumentType.legal_document]: Category.reference,
173
+ [DocumentType.brand_asset]: Category.reference,
174
+ [DocumentType.permit]: Category.reference,
175
+ // record
176
+ [DocumentType.meeting_recording]: Category.record,
177
+ [DocumentType.historical]: Category.record,
178
+ [DocumentType.training_class]: Category.record,
179
+ [DocumentType.presentation]: Category.record,
180
+ // deprecated — keep in their old category for migration compat
181
+ [DocumentType.training_material]: Category.record,
182
+ [DocumentType.marketing]: Category.record,
106
183
  };
107
184
  // ─── DocumentStatus ─────────────────────────────────────────────────────────
108
185
  /**
109
186
  * Lifecycle state of the document.
110
187
  *
188
+ * Unified vocabulary across categories. Each category uses a subset:
189
+ * - operational: draft → current → outdated → withdrawn
190
+ * - reference: current → outdated → withdrawn
191
+ * - record: current → withdrawn (rarely outdated)
192
+ *
111
193
  * Per workflow decision (master plan §Decision 3): there are NO automatic
112
- * direct-publish rules per criticality — author chooses to publish directly
113
- * or send to in_review. Reviewer (different person from author) approves.
194
+ * direct-publish rules per criticality — author chooses status directly.
195
+ *
196
+ * `draft` covers the pre-publication phase (was previously split into
197
+ * `draft` + `in_review`; merged for HVP-scale reality).
114
198
  */
115
199
  var DocumentStatus;
116
200
  (function (DocumentStatus) {
117
201
  DocumentStatus["draft"] = "draft";
118
- DocumentStatus["in_review"] = "in_review";
119
- DocumentStatus["published"] = "published";
202
+ /**
203
+ * Vigente: doc activo y autoritativo (operational), instancia actual
204
+ * (reference) o registro accesible (record). Renamed from `published` in
205
+ * the Category model to share vocabulary across categories.
206
+ */
207
+ DocumentStatus["current"] = "current";
120
208
  /**
121
209
  * Vigente pero desfasado: el contenido sigue aplicando, pero hay partes
122
210
  * desactualizadas que conviene revisar. Visible en listas con un warning.
@@ -129,6 +217,11 @@ var DocumentStatus;
129
217
  * captura mejor la decisión activa que "obsoleto").
130
218
  */
131
219
  DocumentStatus["withdrawn"] = "withdrawn";
220
+ // ── deprecated values (kept for migration compat / UI fallback) ────────
221
+ /** @deprecated Merged into `draft` in the Category model. */
222
+ DocumentStatus["in_review"] = "in_review";
223
+ /** @deprecated Renamed to `current` in the Category model. */
224
+ DocumentStatus["published"] = "published";
132
225
  /**
133
226
  * @deprecated Renombrado a `withdrawn` desde 9.3.0. Sigue presente en
134
227
  * el enum durante la ventana de migración para compat de lectura;
@@ -137,22 +230,51 @@ var DocumentStatus;
137
230
  */
138
231
  DocumentStatus["obsolete"] = "obsolete";
139
232
  /**
140
- * Archivado-histórico: preservación de un documento cuya naturaleza es
141
- * registro (grabaciones de reunión, comunicados pasados, etc.). Oculto por
142
- * defecto. Distinto de `withdrawn`: archived es preservación pasiva,
143
- * withdrawn es retiro activo.
233
+ * @deprecated Records ahora usan `current` (existen y son accesibles).
234
+ * Operational/reference no usan este status. Kept for migration window.
144
235
  */
145
236
  DocumentStatus["archived"] = "archived";
146
237
  })(DocumentStatus || (exports.DocumentStatus = DocumentStatus = {}));
147
238
  exports.DOCUMENT_STATUS_LABELS = {
148
239
  [DocumentStatus.draft]: "Borrador",
149
- [DocumentStatus.in_review]: "En revisión",
150
- [DocumentStatus.published]: "Publicado",
151
- [DocumentStatus.outdated]: "Desactualizado",
240
+ [DocumentStatus.current]: "Vigente",
241
+ [DocumentStatus.outdated]: "Desfasado",
152
242
  [DocumentStatus.withdrawn]: "Retirado",
153
- // Deprecated alias — kept for read compat during 9.3.x migration window
154
- [DocumentStatus.obsolete]: "Retirado",
155
- [DocumentStatus.archived]: "Archivado",
243
+ // Deprecated aliases — kept for read compat during migration window
244
+ [DocumentStatus.in_review]: "En revisión (legacy)",
245
+ [DocumentStatus.published]: "Vigente (legacy)",
246
+ [DocumentStatus.obsolete]: "Retirado (legacy)",
247
+ [DocumentStatus.archived]: "Archivado (legacy)",
248
+ };
249
+ /**
250
+ * Map Category back to legacy Purpose for backwards-compat during migration.
251
+ * Used by mappers/responses that still emit `purpose`.
252
+ */
253
+ exports.CATEGORY_TO_PURPOSE = {
254
+ [Category.operational]: Purpose.operational,
255
+ [Category.reference]: Purpose.reference,
256
+ [Category.record]: Purpose.archive, // best legacy mapping
257
+ };
258
+ /**
259
+ * Allowed statuses per category. UI uses this to render the right options
260
+ * in dropdowns. Unified vocabulary, but each category uses a subset.
261
+ */
262
+ exports.STATUS_BY_CATEGORY = {
263
+ [Category.operational]: [
264
+ DocumentStatus.draft,
265
+ DocumentStatus.current,
266
+ DocumentStatus.outdated,
267
+ DocumentStatus.withdrawn,
268
+ ],
269
+ [Category.reference]: [
270
+ DocumentStatus.current,
271
+ DocumentStatus.outdated,
272
+ DocumentStatus.withdrawn,
273
+ ],
274
+ [Category.record]: [
275
+ DocumentStatus.current,
276
+ DocumentStatus.withdrawn,
277
+ ],
156
278
  };
157
279
  // ─── Criticality ────────────────────────────────────────────────────────────
158
280
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "10.0.0",
3
+ "version": "11.0.0",
4
4
  "description": "Shared types and utilities for HVP backend and frontend",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",