hvp-shared 11.0.0 → 12.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.
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Document Enums — new document management system (GH#21).
|
|
3
3
|
*
|
|
4
|
-
* Replaces the legacy `documentation.enums.ts` (which keeps serving the legacy
|
|
5
|
-
* `documentations` collection during the 60-day retention window). Do not mix
|
|
6
|
-
* the two — `documentation.*` = legacy, `document.*` = new system.
|
|
7
|
-
*
|
|
8
4
|
* Conventions:
|
|
9
5
|
* - snake_case values per `.claude/rules/enums.md`
|
|
10
6
|
* - `*_LABELS: Record<Enum, string>` Spanish labels alongside each enum
|
|
11
|
-
*
|
|
12
|
-
* @see .claude/plans/active/20260427-GH21-documentation-system-redesign.md
|
|
13
7
|
*/
|
|
14
8
|
/**
|
|
15
9
|
* Sentinel value for `audience: WebAppRole[]` meaning "visible to everyone".
|
|
@@ -27,10 +21,6 @@ export declare const AUDIENCE_ALL = "all";
|
|
|
27
21
|
* instance (which becomes a separate doc); simpler lifecycle.
|
|
28
22
|
* - `record` — moment-in-time capture of an unrepeatable event; no real
|
|
29
23
|
* 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
24
|
*/
|
|
35
25
|
export declare enum Category {
|
|
36
26
|
operational = "operational",
|
|
@@ -39,35 +29,7 @@ export declare enum Category {
|
|
|
39
29
|
}
|
|
40
30
|
export declare const CATEGORY_LABELS: Record<Category, string>;
|
|
41
31
|
/**
|
|
42
|
-
*
|
|
43
|
-
* (purpose → type → tags). One purpose per audience:
|
|
44
|
-
*
|
|
45
|
-
* - `operational` — staff, day-to-day workflow
|
|
46
|
-
* - `reference` — staff, consultation / support material
|
|
47
|
-
* - `external` — public / clients (marketing, communication)
|
|
48
|
-
* - `archive` — historical records preserved deliberately
|
|
49
|
-
*
|
|
50
|
-
* Note: `resource` was the previous name of the catch-all bucket. It is
|
|
51
|
-
* deprecated in favor of two narrower purposes (`reference` + `external`)
|
|
52
|
-
* because mixing internal-staff and external-public content under one
|
|
53
|
-
* purpose led to incoherent search filtering. Kept in the enum for legacy
|
|
54
|
-
* data compatibility (migration script will not produce it for new docs).
|
|
55
|
-
*/
|
|
56
|
-
export declare enum Purpose {
|
|
57
|
-
operational = "operational",
|
|
58
|
-
reference = "reference",
|
|
59
|
-
external = "external",
|
|
60
|
-
archive = "archive",
|
|
61
|
-
/** @deprecated Use `reference` (internal staff) or `external` (clients/public) instead. */
|
|
62
|
-
resource = "resource"
|
|
63
|
-
}
|
|
64
|
-
export declare const PURPOSE_LABELS: Record<Purpose, string>;
|
|
65
|
-
/**
|
|
66
|
-
* Specific kind of document within a purpose. Second axis of classification.
|
|
67
|
-
*
|
|
68
|
-
* Mapping of legacy `DocumentationType` is documented in the migration script
|
|
69
|
-
* (`migrate-documentations-to-documents.ts`). Some values exist purely so
|
|
70
|
-
* legacy docs map cleanly (e.g. `meeting_recording` for `admon` videos).
|
|
32
|
+
* Specific kind of document within a category. Second axis of classification.
|
|
71
33
|
*/
|
|
72
34
|
export declare enum DocumentType {
|
|
73
35
|
protocol = "protocol",
|
|
@@ -80,7 +42,7 @@ export declare enum DocumentType {
|
|
|
80
42
|
* Living registry/tracker. The structure is fixed but the data evolves over
|
|
81
43
|
* time (e.g. monthly income tracker, supplier promotional log). Differs from
|
|
82
44
|
* `format` (a template instance is filled once) and from `reference_data`
|
|
83
|
-
* (typically static reference like catalogs).
|
|
45
|
+
* (typically static reference like catalogs).
|
|
84
46
|
*/
|
|
85
47
|
control = "control",
|
|
86
48
|
reference_data = "reference_data",
|
|
@@ -89,7 +51,6 @@ export declare enum DocumentType {
|
|
|
89
51
|
/**
|
|
90
52
|
* Permits, certifications, fiscal certificates issued by external authorities.
|
|
91
53
|
* Singletons replaced when re-issued (e.g. CSF SAT, COFEPRIS, MVR cards).
|
|
92
|
-
* Added with the Category model.
|
|
93
54
|
*/
|
|
94
55
|
permit = "permit",
|
|
95
56
|
meeting_recording = "meeting_recording",
|
|
@@ -97,24 +58,25 @@ export declare enum DocumentType {
|
|
|
97
58
|
/**
|
|
98
59
|
* Specific instance of a class/training session (e.g. "Otitis externa 1
|
|
99
60
|
* con Anahí Fuentes"). Each is its own doc; new courses ≠ new versions.
|
|
100
|
-
* Added with the Category model — replaces `training_material`.
|
|
101
61
|
*/
|
|
102
62
|
training_class = "training_class",
|
|
103
63
|
/**
|
|
104
64
|
* One-shot presentation tied to a specific event (anniversaries, public
|
|
105
|
-
* health campaigns).
|
|
106
|
-
* `marketing` used to capture for past-event content.
|
|
65
|
+
* health campaigns).
|
|
107
66
|
*/
|
|
108
67
|
presentation = "presentation",
|
|
109
|
-
/**
|
|
110
|
-
|
|
111
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Promotional or marketing content (videos, banners, campaign materials)
|
|
70
|
+
* that captures past-event communication. Different from `presentation`
|
|
71
|
+
* (talk/slide deck) — `marketing` is promotional/external-facing material
|
|
72
|
+
* preserved as historical record.
|
|
73
|
+
*/
|
|
112
74
|
marketing = "marketing"
|
|
113
75
|
}
|
|
114
76
|
export declare const DOCUMENT_TYPE_LABELS: Record<DocumentType, string>;
|
|
115
77
|
/**
|
|
116
78
|
* Which Category each DocumentType belongs to. Source of truth for category
|
|
117
|
-
* derivation when only `type` is known. Used by
|
|
79
|
+
* derivation when only `type` is known. Used by validation and queries.
|
|
118
80
|
*/
|
|
119
81
|
export declare const TYPE_TO_CATEGORY: Record<DocumentType, Category>;
|
|
120
82
|
/**
|
|
@@ -125,18 +87,14 @@ export declare const TYPE_TO_CATEGORY: Record<DocumentType, Category>;
|
|
|
125
87
|
* - reference: current → outdated → withdrawn
|
|
126
88
|
* - record: current → withdrawn (rarely outdated)
|
|
127
89
|
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* `draft` covers the pre-publication phase (was previously split into
|
|
132
|
-
* `draft` + `in_review`; merged for HVP-scale reality).
|
|
90
|
+
* No automatic direct-publish rules per criticality — author chooses status
|
|
91
|
+
* directly.
|
|
133
92
|
*/
|
|
134
93
|
export declare enum DocumentStatus {
|
|
135
94
|
draft = "draft",
|
|
136
95
|
/**
|
|
137
96
|
* Vigente: doc activo y autoritativo (operational), instancia actual
|
|
138
|
-
* (reference) o registro accesible (record).
|
|
139
|
-
* the Category model to share vocabulary across categories.
|
|
97
|
+
* (reference) o registro accesible (record).
|
|
140
98
|
*/
|
|
141
99
|
current = "current",
|
|
142
100
|
/**
|
|
@@ -146,34 +104,11 @@ export declare enum DocumentStatus {
|
|
|
146
104
|
outdated = "outdated",
|
|
147
105
|
/**
|
|
148
106
|
* Retirado: el documento ya no aplica, fue reemplazado o descontinuado.
|
|
149
|
-
* Oculto por defecto en listas.
|
|
150
|
-
* (alineación con ISO/TR 10013 "withdrawn" y con la RAE — "retirado"
|
|
151
|
-
* captura mejor la decisión activa que "obsoleto").
|
|
152
|
-
*/
|
|
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",
|
|
158
|
-
/**
|
|
159
|
-
* @deprecated Renombrado a `withdrawn` desde 9.3.0. Sigue presente en
|
|
160
|
-
* el enum durante la ventana de migración para compat de lectura;
|
|
161
|
-
* removable en una mayor futura cuando la BBDD ya no contenga este
|
|
162
|
-
* valor. La UI lo trata como sinónimo de `withdrawn`.
|
|
163
|
-
*/
|
|
164
|
-
obsolete = "obsolete",
|
|
165
|
-
/**
|
|
166
|
-
* @deprecated Records ahora usan `current` (existen y son accesibles).
|
|
167
|
-
* Operational/reference no usan este status. Kept for migration window.
|
|
107
|
+
* Oculto por defecto en listas. Alineado con ISO/TR 10013 "withdrawn".
|
|
168
108
|
*/
|
|
169
|
-
|
|
109
|
+
withdrawn = "withdrawn"
|
|
170
110
|
}
|
|
171
111
|
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
112
|
/**
|
|
178
113
|
* Allowed statuses per category. UI uses this to render the right options
|
|
179
114
|
* in dropdowns. Unified vocabulary, but each category uses a subset.
|
|
@@ -2,18 +2,12 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Document Enums — new document management system (GH#21).
|
|
4
4
|
*
|
|
5
|
-
* Replaces the legacy `documentation.enums.ts` (which keeps serving the legacy
|
|
6
|
-
* `documentations` collection during the 60-day retention window). Do not mix
|
|
7
|
-
* the two — `documentation.*` = legacy, `document.*` = new system.
|
|
8
|
-
*
|
|
9
5
|
* Conventions:
|
|
10
6
|
* - snake_case values per `.claude/rules/enums.md`
|
|
11
7
|
* - `*_LABELS: Record<Enum, string>` Spanish labels alongside each enum
|
|
12
|
-
*
|
|
13
|
-
* @see .claude/plans/active/20260427-GH21-documentation-system-redesign.md
|
|
14
8
|
*/
|
|
15
9
|
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.STATUS_BY_CATEGORY = exports.
|
|
10
|
+
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.DOCUMENT_STATUS_LABELS = exports.DocumentStatus = exports.TYPE_TO_CATEGORY = exports.DOCUMENT_TYPE_LABELS = exports.DocumentType = exports.CATEGORY_LABELS = exports.Category = exports.AUDIENCE_ALL = void 0;
|
|
17
11
|
// ─── Audience sentinel ──────────────────────────────────────────────────────
|
|
18
12
|
/**
|
|
19
13
|
* Sentinel value for `audience: WebAppRole[]` meaning "visible to everyone".
|
|
@@ -32,10 +26,6 @@ exports.AUDIENCE_ALL = "all";
|
|
|
32
26
|
* instance (which becomes a separate doc); simpler lifecycle.
|
|
33
27
|
* - `record` — moment-in-time capture of an unrepeatable event; no real
|
|
34
28
|
* 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
29
|
*/
|
|
40
30
|
var Category;
|
|
41
31
|
(function (Category) {
|
|
@@ -48,45 +38,9 @@ exports.CATEGORY_LABELS = {
|
|
|
48
38
|
[Category.reference]: "Referencia",
|
|
49
39
|
[Category.record]: "Registro",
|
|
50
40
|
};
|
|
51
|
-
// ─── Purpose ────────────────────────────────────────────────────────────────
|
|
52
|
-
/**
|
|
53
|
-
* High-level reason a document exists. First axis of the classification
|
|
54
|
-
* (purpose → type → tags). One purpose per audience:
|
|
55
|
-
*
|
|
56
|
-
* - `operational` — staff, day-to-day workflow
|
|
57
|
-
* - `reference` — staff, consultation / support material
|
|
58
|
-
* - `external` — public / clients (marketing, communication)
|
|
59
|
-
* - `archive` — historical records preserved deliberately
|
|
60
|
-
*
|
|
61
|
-
* Note: `resource` was the previous name of the catch-all bucket. It is
|
|
62
|
-
* deprecated in favor of two narrower purposes (`reference` + `external`)
|
|
63
|
-
* because mixing internal-staff and external-public content under one
|
|
64
|
-
* purpose led to incoherent search filtering. Kept in the enum for legacy
|
|
65
|
-
* data compatibility (migration script will not produce it for new docs).
|
|
66
|
-
*/
|
|
67
|
-
var Purpose;
|
|
68
|
-
(function (Purpose) {
|
|
69
|
-
Purpose["operational"] = "operational";
|
|
70
|
-
Purpose["reference"] = "reference";
|
|
71
|
-
Purpose["external"] = "external";
|
|
72
|
-
Purpose["archive"] = "archive";
|
|
73
|
-
/** @deprecated Use `reference` (internal staff) or `external` (clients/public) instead. */
|
|
74
|
-
Purpose["resource"] = "resource";
|
|
75
|
-
})(Purpose || (exports.Purpose = Purpose = {}));
|
|
76
|
-
exports.PURPOSE_LABELS = {
|
|
77
|
-
[Purpose.operational]: "Operativo",
|
|
78
|
-
[Purpose.reference]: "Consulta",
|
|
79
|
-
[Purpose.external]: "Externo / comunicación pública",
|
|
80
|
-
[Purpose.archive]: "Archivo",
|
|
81
|
-
[Purpose.resource]: "Recurso (deprecated)",
|
|
82
|
-
};
|
|
83
41
|
// ─── DocumentType ───────────────────────────────────────────────────────────
|
|
84
42
|
/**
|
|
85
|
-
* Specific kind of document within a
|
|
86
|
-
*
|
|
87
|
-
* Mapping of legacy `DocumentationType` is documented in the migration script
|
|
88
|
-
* (`migrate-documentations-to-documents.ts`). Some values exist purely so
|
|
89
|
-
* legacy docs map cleanly (e.g. `meeting_recording` for `admon` videos).
|
|
43
|
+
* Specific kind of document within a category. Second axis of classification.
|
|
90
44
|
*/
|
|
91
45
|
var DocumentType;
|
|
92
46
|
(function (DocumentType) {
|
|
@@ -101,7 +55,7 @@ var DocumentType;
|
|
|
101
55
|
* Living registry/tracker. The structure is fixed but the data evolves over
|
|
102
56
|
* time (e.g. monthly income tracker, supplier promotional log). Differs from
|
|
103
57
|
* `format` (a template instance is filled once) and from `reference_data`
|
|
104
|
-
* (typically static reference like catalogs).
|
|
58
|
+
* (typically static reference like catalogs).
|
|
105
59
|
*/
|
|
106
60
|
DocumentType["control"] = "control";
|
|
107
61
|
// ── reference types (Category.reference) ───────────────────────────────
|
|
@@ -111,7 +65,6 @@ var DocumentType;
|
|
|
111
65
|
/**
|
|
112
66
|
* Permits, certifications, fiscal certificates issued by external authorities.
|
|
113
67
|
* Singletons replaced when re-issued (e.g. CSF SAT, COFEPRIS, MVR cards).
|
|
114
|
-
* Added with the Category model.
|
|
115
68
|
*/
|
|
116
69
|
DocumentType["permit"] = "permit";
|
|
117
70
|
// ── record types (Category.record) ─────────────────────────────────────
|
|
@@ -120,19 +73,19 @@ var DocumentType;
|
|
|
120
73
|
/**
|
|
121
74
|
* Specific instance of a class/training session (e.g. "Otitis externa 1
|
|
122
75
|
* con Anahí Fuentes"). Each is its own doc; new courses ≠ new versions.
|
|
123
|
-
* Added with the Category model — replaces `training_material`.
|
|
124
76
|
*/
|
|
125
77
|
DocumentType["training_class"] = "training_class";
|
|
126
78
|
/**
|
|
127
79
|
* One-shot presentation tied to a specific event (anniversaries, public
|
|
128
|
-
* health campaigns).
|
|
129
|
-
* `marketing` used to capture for past-event content.
|
|
80
|
+
* health campaigns).
|
|
130
81
|
*/
|
|
131
82
|
DocumentType["presentation"] = "presentation";
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Promotional or marketing content (videos, banners, campaign materials)
|
|
85
|
+
* that captures past-event communication. Different from `presentation`
|
|
86
|
+
* (talk/slide deck) — `marketing` is promotional/external-facing material
|
|
87
|
+
* preserved as historical record.
|
|
88
|
+
*/
|
|
136
89
|
DocumentType["marketing"] = "marketing";
|
|
137
90
|
})(DocumentType || (exports.DocumentType = DocumentType = {}));
|
|
138
91
|
exports.DOCUMENT_TYPE_LABELS = {
|
|
@@ -151,12 +104,11 @@ exports.DOCUMENT_TYPE_LABELS = {
|
|
|
151
104
|
[DocumentType.historical]: "Histórico",
|
|
152
105
|
[DocumentType.training_class]: "Clase de capacitación",
|
|
153
106
|
[DocumentType.presentation]: "Presentación de evento",
|
|
154
|
-
[DocumentType.
|
|
155
|
-
[DocumentType.marketing]: "Marketing (legacy)",
|
|
107
|
+
[DocumentType.marketing]: "Marketing",
|
|
156
108
|
};
|
|
157
109
|
/**
|
|
158
110
|
* Which Category each DocumentType belongs to. Source of truth for category
|
|
159
|
-
* derivation when only `type` is known. Used by
|
|
111
|
+
* derivation when only `type` is known. Used by validation and queries.
|
|
160
112
|
*/
|
|
161
113
|
exports.TYPE_TO_CATEGORY = {
|
|
162
114
|
// operational
|
|
@@ -177,8 +129,6 @@ exports.TYPE_TO_CATEGORY = {
|
|
|
177
129
|
[DocumentType.historical]: Category.record,
|
|
178
130
|
[DocumentType.training_class]: Category.record,
|
|
179
131
|
[DocumentType.presentation]: Category.record,
|
|
180
|
-
// deprecated — keep in their old category for migration compat
|
|
181
|
-
[DocumentType.training_material]: Category.record,
|
|
182
132
|
[DocumentType.marketing]: Category.record,
|
|
183
133
|
};
|
|
184
134
|
// ─── DocumentStatus ─────────────────────────────────────────────────────────
|
|
@@ -190,19 +140,15 @@ exports.TYPE_TO_CATEGORY = {
|
|
|
190
140
|
* - reference: current → outdated → withdrawn
|
|
191
141
|
* - record: current → withdrawn (rarely outdated)
|
|
192
142
|
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
* `draft` covers the pre-publication phase (was previously split into
|
|
197
|
-
* `draft` + `in_review`; merged for HVP-scale reality).
|
|
143
|
+
* No automatic direct-publish rules per criticality — author chooses status
|
|
144
|
+
* directly.
|
|
198
145
|
*/
|
|
199
146
|
var DocumentStatus;
|
|
200
147
|
(function (DocumentStatus) {
|
|
201
148
|
DocumentStatus["draft"] = "draft";
|
|
202
149
|
/**
|
|
203
150
|
* Vigente: doc activo y autoritativo (operational), instancia actual
|
|
204
|
-
* (reference) o registro accesible (record).
|
|
205
|
-
* the Category model to share vocabulary across categories.
|
|
151
|
+
* (reference) o registro accesible (record).
|
|
206
152
|
*/
|
|
207
153
|
DocumentStatus["current"] = "current";
|
|
208
154
|
/**
|
|
@@ -212,48 +158,15 @@ var DocumentStatus;
|
|
|
212
158
|
DocumentStatus["outdated"] = "outdated";
|
|
213
159
|
/**
|
|
214
160
|
* Retirado: el documento ya no aplica, fue reemplazado o descontinuado.
|
|
215
|
-
* Oculto por defecto en listas.
|
|
216
|
-
* (alineación con ISO/TR 10013 "withdrawn" y con la RAE — "retirado"
|
|
217
|
-
* captura mejor la decisión activa que "obsoleto").
|
|
161
|
+
* Oculto por defecto en listas. Alineado con ISO/TR 10013 "withdrawn".
|
|
218
162
|
*/
|
|
219
163
|
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";
|
|
225
|
-
/**
|
|
226
|
-
* @deprecated Renombrado a `withdrawn` desde 9.3.0. Sigue presente en
|
|
227
|
-
* el enum durante la ventana de migración para compat de lectura;
|
|
228
|
-
* removable en una mayor futura cuando la BBDD ya no contenga este
|
|
229
|
-
* valor. La UI lo trata como sinónimo de `withdrawn`.
|
|
230
|
-
*/
|
|
231
|
-
DocumentStatus["obsolete"] = "obsolete";
|
|
232
|
-
/**
|
|
233
|
-
* @deprecated Records ahora usan `current` (existen y son accesibles).
|
|
234
|
-
* Operational/reference no usan este status. Kept for migration window.
|
|
235
|
-
*/
|
|
236
|
-
DocumentStatus["archived"] = "archived";
|
|
237
164
|
})(DocumentStatus || (exports.DocumentStatus = DocumentStatus = {}));
|
|
238
165
|
exports.DOCUMENT_STATUS_LABELS = {
|
|
239
166
|
[DocumentStatus.draft]: "Borrador",
|
|
240
167
|
[DocumentStatus.current]: "Vigente",
|
|
241
168
|
[DocumentStatus.outdated]: "Desfasado",
|
|
242
169
|
[DocumentStatus.withdrawn]: "Retirado",
|
|
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
170
|
};
|
|
258
171
|
/**
|
|
259
172
|
* Allowed statuses per category. UI uses this to render the right options
|
|
@@ -6,17 +6,13 @@
|
|
|
6
6
|
* - Date fields are ISO 8601 strings, never `Date` objects.
|
|
7
7
|
* - Update requests are partial; Create requests are complete.
|
|
8
8
|
*/
|
|
9
|
-
import { ChangeType, ContentType, Criticality, DocumentStatus, DocumentType, ExternalLinkProvider
|
|
9
|
+
import { Category, ChangeType, ContentType, Criticality, DocumentStatus, DocumentType, ExternalLinkProvider } from "../../constants/document.enums";
|
|
10
10
|
/**
|
|
11
11
|
* Status values that callers may set via the generic status-change endpoint.
|
|
12
|
-
* `draft
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
export type ChangeableDocumentStatus = DocumentStatus.outdated | DocumentStatus.withdrawn
|
|
18
|
-
/** @deprecated alias of `withdrawn`; kept for compat during 9.3.x window. */
|
|
19
|
-
| DocumentStatus.obsolete | DocumentStatus.published;
|
|
12
|
+
* `draft` is governed by the workflow endpoints (saveDraft / publish), not
|
|
13
|
+
* by the generic status-change endpoint.
|
|
14
|
+
*/
|
|
15
|
+
export type ChangeableDocumentStatus = DocumentStatus.current | DocumentStatus.outdated | DocumentStatus.withdrawn;
|
|
20
16
|
import { WebAppRole } from "../../constants/collaborator.constants";
|
|
21
17
|
/**
|
|
22
18
|
* One element of `audience[]`. Either a role or the `"all"` sentinel.
|
|
@@ -50,11 +46,17 @@ export interface CreateDocumentRequest {
|
|
|
50
46
|
title: string;
|
|
51
47
|
/** Optional — auto-generated from title via slugify if omitted. */
|
|
52
48
|
slug?: string;
|
|
53
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Optional — derived server-side from `type` via `TYPE_TO_CATEGORY`. If
|
|
51
|
+
* provided, must agree with the type's required category or the request
|
|
52
|
+
* is rejected.
|
|
53
|
+
*/
|
|
54
|
+
category?: Category;
|
|
54
55
|
type: DocumentType;
|
|
55
56
|
tags?: string[];
|
|
56
57
|
audience: DocumentAudienceEntry[];
|
|
57
58
|
criticality: Criticality;
|
|
59
|
+
description?: string;
|
|
58
60
|
requiredForOnboarding?: boolean;
|
|
59
61
|
requiresAcknowledgment?: boolean;
|
|
60
62
|
/** ObjectIds (as strings) of related documents. */
|
|
@@ -73,11 +75,13 @@ export interface CreateDocumentRequest {
|
|
|
73
75
|
export interface UpdateDocumentMetadataRequest {
|
|
74
76
|
title?: string;
|
|
75
77
|
slug?: string;
|
|
76
|
-
|
|
78
|
+
/** Server re-derives from `type` if `type` changes; explicit override allowed. */
|
|
79
|
+
category?: Category;
|
|
77
80
|
type?: DocumentType;
|
|
78
81
|
tags?: string[];
|
|
79
82
|
audience?: DocumentAudienceEntry[];
|
|
80
83
|
criticality?: Criticality;
|
|
84
|
+
description?: string;
|
|
81
85
|
requiredForOnboarding?: boolean;
|
|
82
86
|
requiresAcknowledgment?: boolean;
|
|
83
87
|
references?: string[];
|
|
@@ -198,10 +202,10 @@ export type AcknowledgeVersionRequest = Record<string, never>;
|
|
|
198
202
|
* Query string parameters for `GET /api/documents`. All optional. Audience
|
|
199
203
|
* filtering by current user role is implicit (handled server-side).
|
|
200
204
|
*
|
|
201
|
-
* @example GET /api/documents?
|
|
205
|
+
* @example GET /api/documents?category=operational&status=current
|
|
202
206
|
*/
|
|
203
207
|
export interface ListDocumentsQuery {
|
|
204
|
-
|
|
208
|
+
category?: Category;
|
|
205
209
|
type?: DocumentType;
|
|
206
210
|
status?: DocumentStatus;
|
|
207
211
|
criticality?: Criticality;
|
|
@@ -212,16 +216,11 @@ export interface ListDocumentsQuery {
|
|
|
212
216
|
requiredForOnboarding?: boolean;
|
|
213
217
|
requiresAcknowledgment?: boolean;
|
|
214
218
|
/**
|
|
215
|
-
* If true, the response includes `
|
|
216
|
-
* server hides
|
|
217
|
-
*
|
|
218
|
-
*/
|
|
219
|
-
includeObsolete?: boolean;
|
|
220
|
-
/**
|
|
221
|
-
* If true, the response includes `archived` documents. Default: false.
|
|
222
|
-
* Ignored when `status` is set explicitly. Writer-only flag.
|
|
219
|
+
* If true, the response includes `withdrawn` documents. Default: false
|
|
220
|
+
* (server hides them unless explicitly requested). Ignored when `status`
|
|
221
|
+
* is set explicitly. Writer-only flag.
|
|
223
222
|
*/
|
|
224
|
-
|
|
223
|
+
includeWithdrawn?: boolean;
|
|
225
224
|
limit?: number;
|
|
226
225
|
skip?: number;
|
|
227
226
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* - Date fields are ISO 8601 strings (server converts Date → ISO at the mapper layer).
|
|
6
6
|
* - Use Public → View → Admin inheritance where it adds value.
|
|
7
7
|
*/
|
|
8
|
-
import { ChangeType, ContentType, Criticality, DocumentStatus, DocumentType, ExternalLinkProvider
|
|
8
|
+
import { Category, ChangeType, ContentType, Criticality, DocumentStatus, DocumentType, ExternalLinkProvider } from "../../constants/document.enums";
|
|
9
9
|
import { DocumentAudienceEntry } from "./requests";
|
|
10
10
|
/**
|
|
11
11
|
* Compact reference to a document's current version, embedded in
|
|
@@ -28,7 +28,7 @@ export interface PublicDocumentResponse {
|
|
|
28
28
|
id: string;
|
|
29
29
|
slug: string;
|
|
30
30
|
title: string;
|
|
31
|
-
|
|
31
|
+
category: Category;
|
|
32
32
|
type: DocumentType;
|
|
33
33
|
status: DocumentStatus;
|
|
34
34
|
criticality: Criticality;
|
|
@@ -42,6 +42,7 @@ export interface PublicDocumentResponse {
|
|
|
42
42
|
export interface DocumentViewResponse extends PublicDocumentResponse {
|
|
43
43
|
tags: string[];
|
|
44
44
|
audience: DocumentAudienceEntry[];
|
|
45
|
+
description?: string;
|
|
45
46
|
requiredForOnboarding: boolean;
|
|
46
47
|
requiresAcknowledgment: boolean;
|
|
47
48
|
references: string[];
|
|
@@ -73,7 +74,7 @@ export interface DocumentSummaryResponse {
|
|
|
73
74
|
id: string;
|
|
74
75
|
slug: string;
|
|
75
76
|
title: string;
|
|
76
|
-
|
|
77
|
+
category: Category;
|
|
77
78
|
type: DocumentType;
|
|
78
79
|
status: DocumentStatus;
|
|
79
80
|
criticality: Criticality;
|
|
@@ -109,7 +110,7 @@ export interface DocumentVersionResponse {
|
|
|
109
110
|
id: string;
|
|
110
111
|
documentId: string;
|
|
111
112
|
versionNumber: string;
|
|
112
|
-
status: "draft" | "in_review" | "current" | "superseded";
|
|
113
|
+
status: "draft" | "in_review" | "current" | "superseded" | "withdrawn";
|
|
113
114
|
contentType: ContentType;
|
|
114
115
|
markdown: string | null;
|
|
115
116
|
externalLink: {
|