hvp-shared 7.10.0 → 9.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.
@@ -75,6 +75,22 @@ export declare enum DocumentStatus {
75
75
  draft = "draft",
76
76
  in_review = "in_review",
77
77
  published = "published",
78
+ /**
79
+ * Vigente pero desfasado: el contenido sigue aplicando, pero hay partes
80
+ * desactualizadas que conviene revisar. Visible en listas con un warning.
81
+ */
82
+ outdated = "outdated",
83
+ /**
84
+ * Retirado: el documento ya no aplica, fue reemplazado o descontinuado.
85
+ * Oculto por defecto en listas. ISO 9001 lo llama "obsolete".
86
+ */
87
+ obsolete = "obsolete",
88
+ /**
89
+ * Archivado-histórico: preservación de un documento cuya naturaleza es
90
+ * registro (grabaciones de reunión, comunicados pasados, etc.). Oculto por
91
+ * defecto. Distinto de `obsolete`: archived es preservación pasiva,
92
+ * obsolete es retiro activo.
93
+ */
78
94
  archived = "archived"
79
95
  }
80
96
  export declare const DOCUMENT_STATUS_LABELS: Record<DocumentStatus, string>;
@@ -109,12 +109,30 @@ var DocumentStatus;
109
109
  DocumentStatus["draft"] = "draft";
110
110
  DocumentStatus["in_review"] = "in_review";
111
111
  DocumentStatus["published"] = "published";
112
+ /**
113
+ * Vigente pero desfasado: el contenido sigue aplicando, pero hay partes
114
+ * desactualizadas que conviene revisar. Visible en listas con un warning.
115
+ */
116
+ DocumentStatus["outdated"] = "outdated";
117
+ /**
118
+ * Retirado: el documento ya no aplica, fue reemplazado o descontinuado.
119
+ * Oculto por defecto en listas. ISO 9001 lo llama "obsolete".
120
+ */
121
+ DocumentStatus["obsolete"] = "obsolete";
122
+ /**
123
+ * Archivado-histórico: preservación de un documento cuya naturaleza es
124
+ * registro (grabaciones de reunión, comunicados pasados, etc.). Oculto por
125
+ * defecto. Distinto de `obsolete`: archived es preservación pasiva,
126
+ * obsolete es retiro activo.
127
+ */
112
128
  DocumentStatus["archived"] = "archived";
113
129
  })(DocumentStatus || (exports.DocumentStatus = DocumentStatus = {}));
114
130
  exports.DOCUMENT_STATUS_LABELS = {
115
131
  [DocumentStatus.draft]: "Borrador",
116
132
  [DocumentStatus.in_review]: "En revisión",
117
133
  [DocumentStatus.published]: "Publicado",
134
+ [DocumentStatus.outdated]: "Desactualizado",
135
+ [DocumentStatus.obsolete]: "Obsoleto",
118
136
  [DocumentStatus.archived]: "Archivado",
119
137
  };
120
138
  // ─── Criticality ────────────────────────────────────────────────────────────
@@ -7,6 +7,14 @@
7
7
  * - Update requests are partial; Create requests are complete.
8
8
  */
9
9
  import { ChangeType, ContentType, Criticality, DocumentStatus, DocumentType, ExternalLinkProvider, Purpose } from "../../constants/document.enums";
10
+ /**
11
+ * Status values that callers may set via the generic status-change endpoint.
12
+ * `draft`, `in_review`, `published` follow the existing workflow endpoints
13
+ * (saveDraft / submitForReview / publish); `archived` keeps its `/archive`
14
+ * endpoint for backward compat. The generic endpoint covers the new
15
+ * lifecycle moves added in GH#22 SP2 plus return-to-published.
16
+ */
17
+ export type ChangeableDocumentStatus = DocumentStatus.outdated | DocumentStatus.obsolete | DocumentStatus.published;
10
18
  import { WebAppRole } from "../../constants/collaborator.constants";
11
19
  /**
12
20
  * One element of `audience[]`. Either a role or the `"all"` sentinel.
@@ -121,19 +129,53 @@ export type SubmitForReviewRequest = Record<string, never>;
121
129
  export interface PublishDocumentRequest {
122
130
  /** Required if publishing without prior in_review (audit trail). */
123
131
  changeNotes?: string;
132
+ /** Collaborator id that authored the content. Default: current user. */
133
+ elaboratedBy?: string;
134
+ /** ISO date the content was authored. Default: draft creation date or now. */
135
+ elaboratedAt?: string;
136
+ /** Collaborator id that reviewed/validated the content. Default: null. */
137
+ reviewedBy?: string;
138
+ /** ISO date of review. Default: now (only used when reviewedBy set). */
139
+ reviewedAt?: string;
140
+ /** Collaborator id that authorized the publication. Default: current user. */
141
+ authorizedBy?: string;
142
+ /** ISO date of authorization. Default: now. Used as the version's `authorizedAt`. */
143
+ authorizedAt?: string;
124
144
  }
125
145
  /**
126
146
  * Archive Document Request
127
147
  *
128
- * Marks the document as `archived`. Archived docs are hidden from default
129
- * lists but data is preserved. Restricted to admin for `legal_document` and
130
- * `brand_asset` types.
148
+ * Marks the document as `archived` (historical preservation). Archived docs
149
+ * are hidden from default lists but data is preserved. Restricted to admin
150
+ * for `legal_document` and `brand_asset` types.
151
+ *
152
+ * Use this only for *preservation* (meeting recordings, past events). For
153
+ * "retired / no longer applies" use the generic status endpoint with
154
+ * `obsolete`.
131
155
  *
132
156
  * @example POST /api/documents/:id/archive
133
157
  */
134
158
  export interface ArchiveDocumentRequest {
135
159
  reason?: string;
136
160
  }
161
+ /**
162
+ * Change Status Request
163
+ *
164
+ * Generic lifecycle transition for the new statuses introduced in GH#22 SP2:
165
+ * - `published → outdated` / `outdated → published`
166
+ * - `published → obsolete` / `outdated → obsolete`
167
+ * - `obsolete → published` (admin only — recovery)
168
+ *
169
+ * For `draft` / `in_review` use the existing workflow endpoints. For
170
+ * `archived` use `/archive` and `/unarchive`.
171
+ *
172
+ * @example POST /api/documents/:id/status
173
+ */
174
+ export interface ChangeStatusRequest {
175
+ status: ChangeableDocumentStatus;
176
+ /** Optional explanation, shown in the doc's audit trail. */
177
+ reason?: string;
178
+ }
137
179
  /**
138
180
  * Unarchive Document Request
139
181
  *
@@ -16,7 +16,8 @@ export interface DocumentSummaryVersionRef {
16
16
  versionNumber: string;
17
17
  contentType: ContentType;
18
18
  externalLinkProvider: ExternalLinkProvider | null;
19
- publishedAt: string | null;
19
+ /** Date the version was authorized — i.e. promoted to `current`. */
20
+ authorizedAt: string | null;
20
21
  }
21
22
  /**
22
23
  * Public Document Response
@@ -96,8 +97,15 @@ export interface DocumentSummaryResponse {
96
97
  * Full version row. Returned by the viewer, version history, and
97
98
  * acknowledgment lookups.
98
99
  *
99
- * A version has a single meaningful date `publishedAt` — which is null while
100
- * the version is draft / in_review and set when it transitions to `current`.
100
+ * Three independent business-attribution axes per version (all may be set
101
+ * independently):
102
+ * - elaborated: who wrote the content + when ("Elaboró")
103
+ * - reviewed: who reviewed the content + when ("Revisó")
104
+ * - authorized: who authorized publication + when ("Autorizó / Validó")
105
+ *
106
+ * Versions do NOT carry system audit (`createdBy`, `createdAt`, etc.) because
107
+ * those would duplicate the business fields above. Forensic insertion timestamp
108
+ * remains derivable from the row's ObjectId.
101
109
  */
102
110
  export interface DocumentVersionResponse {
103
111
  id: string;
@@ -112,11 +120,15 @@ export interface DocumentVersionResponse {
112
120
  } | null;
113
121
  changeType: ChangeType;
114
122
  changeNotes: string | null;
115
- /** Set only when the version reached `current` (or was demoted to `superseded`). Null for draft / in_review. */
116
- publishedAt: string | null;
117
- publishedBy: string | null;
118
- /** Author of this version row (typically who started the draft). */
119
- createdBy?: string;
123
+ /** Author of the content. Defaults to the publisher on legacy versions. */
124
+ elaboratedBy: string | null;
125
+ elaboratedAt: string | null;
126
+ /** Reviewer (validó). Optional may stay null when no formal review happened. */
127
+ reviewedBy: string | null;
128
+ reviewedAt: string | null;
129
+ /** Authorizer of the publication (autorizó). Set when the version reaches `current`. */
130
+ authorizedBy: string | null;
131
+ authorizedAt: string | null;
120
132
  }
121
133
  /**
122
134
  * Document Acknowledgment Response
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "7.10.0",
3
+ "version": "9.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",