hvp-shared 10.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".
|
|
@@ -18,35 +12,24 @@
|
|
|
18
12
|
*/
|
|
19
13
|
export declare const AUDIENCE_ALL = "all";
|
|
20
14
|
/**
|
|
21
|
-
*
|
|
22
|
-
* (purpose → type → tags). One purpose per audience:
|
|
23
|
-
*
|
|
24
|
-
* - `operational` — staff, day-to-day workflow
|
|
25
|
-
* - `reference` — staff, consultation / support material
|
|
26
|
-
* - `external` — public / clients (marketing, communication)
|
|
27
|
-
* - `archive` — historical records preserved deliberately
|
|
15
|
+
* Fundamental document nature. Drives lifecycle behavior:
|
|
28
16
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
17
|
+
* - `operational` — living doc that evolves; full lifecycle (draft → current →
|
|
18
|
+
* outdated → withdrawn); has versions; has elaboratedAt/reviewedAt/
|
|
19
|
+
* authorizedAt per version.
|
|
20
|
+
* - `reference` — singleton authoritative artifact; can be replaced by a newer
|
|
21
|
+
* instance (which becomes a separate doc); simpler lifecycle.
|
|
22
|
+
* - `record` — moment-in-time capture of an unrepeatable event; no real
|
|
23
|
+
* lifecycle; just exists.
|
|
34
24
|
*/
|
|
35
|
-
export declare enum
|
|
25
|
+
export declare enum Category {
|
|
36
26
|
operational = "operational",
|
|
37
27
|
reference = "reference",
|
|
38
|
-
|
|
39
|
-
archive = "archive",
|
|
40
|
-
/** @deprecated Use `reference` (internal staff) or `external` (clients/public) instead. */
|
|
41
|
-
resource = "resource"
|
|
28
|
+
record = "record"
|
|
42
29
|
}
|
|
43
|
-
export declare const
|
|
30
|
+
export declare const CATEGORY_LABELS: Record<Category, string>;
|
|
44
31
|
/**
|
|
45
|
-
* Specific kind of document within a
|
|
46
|
-
*
|
|
47
|
-
* Mapping of legacy `DocumentationType` is documented in the migration script
|
|
48
|
-
* (`migrate-documentations-to-documents.ts`). Some values exist purely so
|
|
49
|
-
* legacy docs map cleanly (e.g. `meeting_recording` for `admon` videos).
|
|
32
|
+
* Specific kind of document within a category. Second axis of classification.
|
|
50
33
|
*/
|
|
51
34
|
export declare enum DocumentType {
|
|
52
35
|
protocol = "protocol",
|
|
@@ -59,29 +42,61 @@ export declare enum DocumentType {
|
|
|
59
42
|
* Living registry/tracker. The structure is fixed but the data evolves over
|
|
60
43
|
* time (e.g. monthly income tracker, supplier promotional log). Differs from
|
|
61
44
|
* `format` (a template instance is filled once) and from `reference_data`
|
|
62
|
-
* (typically static reference like catalogs).
|
|
45
|
+
* (typically static reference like catalogs).
|
|
63
46
|
*/
|
|
64
47
|
control = "control",
|
|
65
48
|
reference_data = "reference_data",
|
|
66
|
-
training_material = "training_material",
|
|
67
49
|
legal_document = "legal_document",
|
|
68
50
|
brand_asset = "brand_asset",
|
|
51
|
+
/**
|
|
52
|
+
* Permits, certifications, fiscal certificates issued by external authorities.
|
|
53
|
+
* Singletons replaced when re-issued (e.g. CSF SAT, COFEPRIS, MVR cards).
|
|
54
|
+
*/
|
|
55
|
+
permit = "permit",
|
|
69
56
|
meeting_recording = "meeting_recording",
|
|
70
57
|
historical = "historical",
|
|
58
|
+
/**
|
|
59
|
+
* Specific instance of a class/training session (e.g. "Otitis externa 1
|
|
60
|
+
* con Anahí Fuentes"). Each is its own doc; new courses ≠ new versions.
|
|
61
|
+
*/
|
|
62
|
+
training_class = "training_class",
|
|
63
|
+
/**
|
|
64
|
+
* One-shot presentation tied to a specific event (anniversaries, public
|
|
65
|
+
* health campaigns).
|
|
66
|
+
*/
|
|
67
|
+
presentation = "presentation",
|
|
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
|
+
*/
|
|
71
74
|
marketing = "marketing"
|
|
72
75
|
}
|
|
73
76
|
export declare const DOCUMENT_TYPE_LABELS: Record<DocumentType, string>;
|
|
77
|
+
/**
|
|
78
|
+
* Which Category each DocumentType belongs to. Source of truth for category
|
|
79
|
+
* derivation when only `type` is known. Used by validation and queries.
|
|
80
|
+
*/
|
|
81
|
+
export declare const TYPE_TO_CATEGORY: Record<DocumentType, Category>;
|
|
74
82
|
/**
|
|
75
83
|
* Lifecycle state of the document.
|
|
76
84
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
85
|
+
* Unified vocabulary across categories. Each category uses a subset:
|
|
86
|
+
* - operational: draft → current → outdated → withdrawn
|
|
87
|
+
* - reference: current → outdated → withdrawn
|
|
88
|
+
* - record: current → withdrawn (rarely outdated)
|
|
89
|
+
*
|
|
90
|
+
* No automatic direct-publish rules per criticality — author chooses status
|
|
91
|
+
* directly.
|
|
80
92
|
*/
|
|
81
93
|
export declare enum DocumentStatus {
|
|
82
94
|
draft = "draft",
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Vigente: doc activo y autoritativo (operational), instancia actual
|
|
97
|
+
* (reference) o registro accesible (record).
|
|
98
|
+
*/
|
|
99
|
+
current = "current",
|
|
85
100
|
/**
|
|
86
101
|
* Vigente pero desfasado: el contenido sigue aplicando, pero hay partes
|
|
87
102
|
* desactualizadas que conviene revisar. Visible en listas con un warning.
|
|
@@ -89,27 +104,16 @@ export declare enum DocumentStatus {
|
|
|
89
104
|
outdated = "outdated",
|
|
90
105
|
/**
|
|
91
106
|
* Retirado: el documento ya no aplica, fue reemplazado o descontinuado.
|
|
92
|
-
* Oculto por defecto en listas.
|
|
93
|
-
* (alineación con ISO/TR 10013 "withdrawn" y con la RAE — "retirado"
|
|
94
|
-
* captura mejor la decisión activa que "obsoleto").
|
|
107
|
+
* Oculto por defecto en listas. Alineado con ISO/TR 10013 "withdrawn".
|
|
95
108
|
*/
|
|
96
|
-
withdrawn = "withdrawn"
|
|
97
|
-
/**
|
|
98
|
-
* @deprecated Renombrado a `withdrawn` desde 9.3.0. Sigue presente en
|
|
99
|
-
* el enum durante la ventana de migración para compat de lectura;
|
|
100
|
-
* removable en una mayor futura cuando la BBDD ya no contenga este
|
|
101
|
-
* valor. La UI lo trata como sinónimo de `withdrawn`.
|
|
102
|
-
*/
|
|
103
|
-
obsolete = "obsolete",
|
|
104
|
-
/**
|
|
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.
|
|
109
|
-
*/
|
|
110
|
-
archived = "archived"
|
|
109
|
+
withdrawn = "withdrawn"
|
|
111
110
|
}
|
|
112
111
|
export declare const DOCUMENT_STATUS_LABELS: Record<DocumentStatus, string>;
|
|
112
|
+
/**
|
|
113
|
+
* Allowed statuses per category. UI uses this to render the right options
|
|
114
|
+
* in dropdowns. Unified vocabulary, but each category uses a subset.
|
|
115
|
+
*/
|
|
116
|
+
export declare const STATUS_BY_CATEGORY: Record<Category, DocumentStatus[]>;
|
|
113
117
|
/**
|
|
114
118
|
* How critical the document is. Used for ranking, badge color, and (in SP4)
|
|
115
119
|
* acknowledgment urgency.
|
|
@@ -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.DOCUMENT_STATUS_LABELS = exports.DocumentStatus = exports.DOCUMENT_TYPE_LABELS = exports.DocumentType = 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".
|
|
@@ -21,49 +15,36 @@ exports.EXTERNAL_LINK_PROVIDER_LABELS = exports.ExternalLinkProvider = exports.C
|
|
|
21
15
|
* skip the role filter.
|
|
22
16
|
*/
|
|
23
17
|
exports.AUDIENCE_ALL = "all";
|
|
24
|
-
// ───
|
|
18
|
+
// ─── Category ───────────────────────────────────────────────────────────────
|
|
25
19
|
/**
|
|
26
|
-
*
|
|
27
|
-
* (purpose → type → tags). One purpose per audience:
|
|
20
|
+
* Fundamental document nature. Drives lifecycle behavior:
|
|
28
21
|
*
|
|
29
|
-
* - `operational` —
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* - `
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* because mixing internal-staff and external-public content under one
|
|
37
|
-
* purpose led to incoherent search filtering. Kept in the enum for legacy
|
|
38
|
-
* data compatibility (migration script will not produce it for new docs).
|
|
22
|
+
* - `operational` — living doc that evolves; full lifecycle (draft → current →
|
|
23
|
+
* outdated → withdrawn); has versions; has elaboratedAt/reviewedAt/
|
|
24
|
+
* authorizedAt per version.
|
|
25
|
+
* - `reference` — singleton authoritative artifact; can be replaced by a newer
|
|
26
|
+
* instance (which becomes a separate doc); simpler lifecycle.
|
|
27
|
+
* - `record` — moment-in-time capture of an unrepeatable event; no real
|
|
28
|
+
* lifecycle; just exists.
|
|
39
29
|
*/
|
|
40
|
-
var
|
|
41
|
-
(function (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
[Purpose.operational]: "Operativo",
|
|
51
|
-
[Purpose.reference]: "Consulta",
|
|
52
|
-
[Purpose.external]: "Externo / comunicación pública",
|
|
53
|
-
[Purpose.archive]: "Archivo",
|
|
54
|
-
[Purpose.resource]: "Recurso (deprecated)",
|
|
30
|
+
var Category;
|
|
31
|
+
(function (Category) {
|
|
32
|
+
Category["operational"] = "operational";
|
|
33
|
+
Category["reference"] = "reference";
|
|
34
|
+
Category["record"] = "record";
|
|
35
|
+
})(Category || (exports.Category = Category = {}));
|
|
36
|
+
exports.CATEGORY_LABELS = {
|
|
37
|
+
[Category.operational]: "Operativo",
|
|
38
|
+
[Category.reference]: "Referencia",
|
|
39
|
+
[Category.record]: "Registro",
|
|
55
40
|
};
|
|
56
41
|
// ─── DocumentType ───────────────────────────────────────────────────────────
|
|
57
42
|
/**
|
|
58
|
-
* Specific kind of document within a
|
|
59
|
-
*
|
|
60
|
-
* Mapping of legacy `DocumentationType` is documented in the migration script
|
|
61
|
-
* (`migrate-documentations-to-documents.ts`). Some values exist purely so
|
|
62
|
-
* legacy docs map cleanly (e.g. `meeting_recording` for `admon` videos).
|
|
43
|
+
* Specific kind of document within a category. Second axis of classification.
|
|
63
44
|
*/
|
|
64
45
|
var DocumentType;
|
|
65
46
|
(function (DocumentType) {
|
|
66
|
-
//
|
|
47
|
+
// ── operational types (Category.operational) ───────────────────────────
|
|
67
48
|
DocumentType["protocol"] = "protocol";
|
|
68
49
|
DocumentType["guidance"] = "guidance";
|
|
69
50
|
DocumentType["tutorial"] = "tutorial";
|
|
@@ -74,18 +55,37 @@ var DocumentType;
|
|
|
74
55
|
* Living registry/tracker. The structure is fixed but the data evolves over
|
|
75
56
|
* time (e.g. monthly income tracker, supplier promotional log). Differs from
|
|
76
57
|
* `format` (a template instance is filled once) and from `reference_data`
|
|
77
|
-
* (typically static reference like catalogs).
|
|
58
|
+
* (typically static reference like catalogs).
|
|
78
59
|
*/
|
|
79
60
|
DocumentType["control"] = "control";
|
|
80
|
-
//
|
|
61
|
+
// ── reference types (Category.reference) ───────────────────────────────
|
|
81
62
|
DocumentType["reference_data"] = "reference_data";
|
|
82
|
-
DocumentType["training_material"] = "training_material";
|
|
83
63
|
DocumentType["legal_document"] = "legal_document";
|
|
84
64
|
DocumentType["brand_asset"] = "brand_asset";
|
|
85
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Permits, certifications, fiscal certificates issued by external authorities.
|
|
67
|
+
* Singletons replaced when re-issued (e.g. CSF SAT, COFEPRIS, MVR cards).
|
|
68
|
+
*/
|
|
69
|
+
DocumentType["permit"] = "permit";
|
|
70
|
+
// ── record types (Category.record) ─────────────────────────────────────
|
|
86
71
|
DocumentType["meeting_recording"] = "meeting_recording";
|
|
87
72
|
DocumentType["historical"] = "historical";
|
|
88
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Specific instance of a class/training session (e.g. "Otitis externa 1
|
|
75
|
+
* con Anahí Fuentes"). Each is its own doc; new courses ≠ new versions.
|
|
76
|
+
*/
|
|
77
|
+
DocumentType["training_class"] = "training_class";
|
|
78
|
+
/**
|
|
79
|
+
* One-shot presentation tied to a specific event (anniversaries, public
|
|
80
|
+
* health campaigns).
|
|
81
|
+
*/
|
|
82
|
+
DocumentType["presentation"] = "presentation";
|
|
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
|
+
*/
|
|
89
89
|
DocumentType["marketing"] = "marketing";
|
|
90
90
|
})(DocumentType || (exports.DocumentType = DocumentType = {}));
|
|
91
91
|
exports.DOCUMENT_TYPE_LABELS = {
|
|
@@ -97,26 +97,60 @@ exports.DOCUMENT_TYPE_LABELS = {
|
|
|
97
97
|
[DocumentType.policy]: "Política",
|
|
98
98
|
[DocumentType.control]: "Control",
|
|
99
99
|
[DocumentType.reference_data]: "Datos de referencia",
|
|
100
|
-
[DocumentType.training_material]: "Material de capacitación",
|
|
101
100
|
[DocumentType.legal_document]: "Documento legal",
|
|
102
101
|
[DocumentType.brand_asset]: "Activo de marca",
|
|
102
|
+
[DocumentType.permit]: "Permiso / certificado",
|
|
103
103
|
[DocumentType.meeting_recording]: "Grabación de reunión",
|
|
104
104
|
[DocumentType.historical]: "Histórico",
|
|
105
|
-
[DocumentType.
|
|
105
|
+
[DocumentType.training_class]: "Clase de capacitación",
|
|
106
|
+
[DocumentType.presentation]: "Presentación de evento",
|
|
107
|
+
[DocumentType.marketing]: "Marketing",
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Which Category each DocumentType belongs to. Source of truth for category
|
|
111
|
+
* derivation when only `type` is known. Used by validation and queries.
|
|
112
|
+
*/
|
|
113
|
+
exports.TYPE_TO_CATEGORY = {
|
|
114
|
+
// operational
|
|
115
|
+
[DocumentType.protocol]: Category.operational,
|
|
116
|
+
[DocumentType.guidance]: Category.operational,
|
|
117
|
+
[DocumentType.tutorial]: Category.operational,
|
|
118
|
+
[DocumentType.format]: Category.operational,
|
|
119
|
+
[DocumentType.tool]: Category.operational,
|
|
120
|
+
[DocumentType.policy]: Category.operational,
|
|
121
|
+
[DocumentType.control]: Category.operational,
|
|
122
|
+
// reference
|
|
123
|
+
[DocumentType.reference_data]: Category.reference,
|
|
124
|
+
[DocumentType.legal_document]: Category.reference,
|
|
125
|
+
[DocumentType.brand_asset]: Category.reference,
|
|
126
|
+
[DocumentType.permit]: Category.reference,
|
|
127
|
+
// record
|
|
128
|
+
[DocumentType.meeting_recording]: Category.record,
|
|
129
|
+
[DocumentType.historical]: Category.record,
|
|
130
|
+
[DocumentType.training_class]: Category.record,
|
|
131
|
+
[DocumentType.presentation]: Category.record,
|
|
132
|
+
[DocumentType.marketing]: Category.record,
|
|
106
133
|
};
|
|
107
134
|
// ─── DocumentStatus ─────────────────────────────────────────────────────────
|
|
108
135
|
/**
|
|
109
136
|
* Lifecycle state of the document.
|
|
110
137
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
138
|
+
* Unified vocabulary across categories. Each category uses a subset:
|
|
139
|
+
* - operational: draft → current → outdated → withdrawn
|
|
140
|
+
* - reference: current → outdated → withdrawn
|
|
141
|
+
* - record: current → withdrawn (rarely outdated)
|
|
142
|
+
*
|
|
143
|
+
* No automatic direct-publish rules per criticality — author chooses status
|
|
144
|
+
* directly.
|
|
114
145
|
*/
|
|
115
146
|
var DocumentStatus;
|
|
116
147
|
(function (DocumentStatus) {
|
|
117
148
|
DocumentStatus["draft"] = "draft";
|
|
118
|
-
|
|
119
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Vigente: doc activo y autoritativo (operational), instancia actual
|
|
151
|
+
* (reference) o registro accesible (record).
|
|
152
|
+
*/
|
|
153
|
+
DocumentStatus["current"] = "current";
|
|
120
154
|
/**
|
|
121
155
|
* Vigente pero desfasado: el contenido sigue aplicando, pero hay partes
|
|
122
156
|
* desactualizadas que conviene revisar. Visible en listas con un warning.
|
|
@@ -124,35 +158,36 @@ var DocumentStatus;
|
|
|
124
158
|
DocumentStatus["outdated"] = "outdated";
|
|
125
159
|
/**
|
|
126
160
|
* Retirado: el documento ya no aplica, fue reemplazado o descontinuado.
|
|
127
|
-
* Oculto por defecto en listas.
|
|
128
|
-
* (alineación con ISO/TR 10013 "withdrawn" y con la RAE — "retirado"
|
|
129
|
-
* captura mejor la decisión activa que "obsoleto").
|
|
161
|
+
* Oculto por defecto en listas. Alineado con ISO/TR 10013 "withdrawn".
|
|
130
162
|
*/
|
|
131
163
|
DocumentStatus["withdrawn"] = "withdrawn";
|
|
132
|
-
/**
|
|
133
|
-
* @deprecated Renombrado a `withdrawn` desde 9.3.0. Sigue presente en
|
|
134
|
-
* el enum durante la ventana de migración para compat de lectura;
|
|
135
|
-
* removable en una mayor futura cuando la BBDD ya no contenga este
|
|
136
|
-
* valor. La UI lo trata como sinónimo de `withdrawn`.
|
|
137
|
-
*/
|
|
138
|
-
DocumentStatus["obsolete"] = "obsolete";
|
|
139
|
-
/**
|
|
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.
|
|
144
|
-
*/
|
|
145
|
-
DocumentStatus["archived"] = "archived";
|
|
146
164
|
})(DocumentStatus || (exports.DocumentStatus = DocumentStatus = {}));
|
|
147
165
|
exports.DOCUMENT_STATUS_LABELS = {
|
|
148
166
|
[DocumentStatus.draft]: "Borrador",
|
|
149
|
-
[DocumentStatus.
|
|
150
|
-
[DocumentStatus.
|
|
151
|
-
[DocumentStatus.outdated]: "Desactualizado",
|
|
167
|
+
[DocumentStatus.current]: "Vigente",
|
|
168
|
+
[DocumentStatus.outdated]: "Desfasado",
|
|
152
169
|
[DocumentStatus.withdrawn]: "Retirado",
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Allowed statuses per category. UI uses this to render the right options
|
|
173
|
+
* in dropdowns. Unified vocabulary, but each category uses a subset.
|
|
174
|
+
*/
|
|
175
|
+
exports.STATUS_BY_CATEGORY = {
|
|
176
|
+
[Category.operational]: [
|
|
177
|
+
DocumentStatus.draft,
|
|
178
|
+
DocumentStatus.current,
|
|
179
|
+
DocumentStatus.outdated,
|
|
180
|
+
DocumentStatus.withdrawn,
|
|
181
|
+
],
|
|
182
|
+
[Category.reference]: [
|
|
183
|
+
DocumentStatus.current,
|
|
184
|
+
DocumentStatus.outdated,
|
|
185
|
+
DocumentStatus.withdrawn,
|
|
186
|
+
],
|
|
187
|
+
[Category.record]: [
|
|
188
|
+
DocumentStatus.current,
|
|
189
|
+
DocumentStatus.withdrawn,
|
|
190
|
+
],
|
|
156
191
|
};
|
|
157
192
|
// ─── Criticality ────────────────────────────────────────────────────────────
|
|
158
193
|
/**
|
|
@@ -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: {
|