hvp-shared 13.1.0 → 13.2.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.
@@ -240,3 +240,26 @@ export interface SearchDocumentsQuery {
240
240
  q: string;
241
241
  limit?: number;
242
242
  }
243
+ /**
244
+ * Compliance Matrix Query
245
+ *
246
+ * Filters for the admin/manager `GET /api/documents/acknowledgments/matrix`
247
+ * endpoint. All optional. The endpoint always restricts to docs that
248
+ * `requiresAcknowledgment === true` AND `status === "current"` — those are
249
+ * the only docs an ack is meaningful on.
250
+ *
251
+ * @example GET /api/documents/acknowledgments/matrix?category=operational
252
+ */
253
+ export interface DocumentComplianceMatrixQuery {
254
+ /** Restrict rows to these doc IDs. */
255
+ documentIds?: string[];
256
+ /** Restrict columns to these collaborator IDs. */
257
+ collaboratorIds?: string[];
258
+ /** Filter rows by document category. */
259
+ category?: Category;
260
+ /**
261
+ * Filter rows whose audience includes this role (or `"all"`). Lets admin
262
+ * scope the matrix to docs everyone has to read, or only managers, etc.
263
+ */
264
+ audienceRole?: DocumentAudienceEntry;
265
+ }
@@ -6,6 +6,7 @@
6
6
  * - Use Public → View → Admin inheritance where it adds value.
7
7
  */
8
8
  import { Category, ChangeType, ContentType, Criticality, DocumentStatus, DocumentType, ExternalLinkProvider } from "../../constants/document.enums";
9
+ import { WebAppRole } from "../../constants/collaborator.constants";
9
10
  import { DocumentAudienceEntry } from "./requests";
10
11
  /**
11
12
  * Compact reference to a document's current version, embedded in
@@ -160,3 +161,74 @@ export interface PendingAcknowledgmentResponse {
160
161
  pendingDays: number;
161
162
  isFromOnboarding: boolean;
162
163
  }
164
+ /**
165
+ * Compliance Matrix Cell
166
+ *
167
+ * Per `(document, collaborator)` pair, the read state.
168
+ *
169
+ * - `acked` — collaborator has a valid ack on the doc's current version
170
+ * (covers patch chains; major/minor invalidates).
171
+ * - `pending` — collaborator is in the doc's audience and has NOT acked.
172
+ * - `not_applicable` — collaborator's role is outside the doc's audience.
173
+ */
174
+ export type DocumentComplianceCellStatus = "acked" | "pending" | "not_applicable";
175
+ export interface DocumentComplianceCell {
176
+ collaboratorId: string;
177
+ status: DocumentComplianceCellStatus;
178
+ /** Present when `status === "acked"`. ISO 8601. */
179
+ acknowledgedAt?: string;
180
+ }
181
+ /**
182
+ * Compliance Matrix Collaborator (column header)
183
+ *
184
+ * Compact info needed to render a column header. Order of `collaborators[]`
185
+ * in the response matches order of `cells[]` on each row.
186
+ */
187
+ export interface DocumentComplianceCollaborator {
188
+ id: string;
189
+ col_code: string;
190
+ fullName: string;
191
+ role: WebAppRole;
192
+ }
193
+ /**
194
+ * Compliance Matrix Row (one document)
195
+ */
196
+ export interface DocumentComplianceRow {
197
+ documentId: string;
198
+ documentSlug: string;
199
+ documentTitle: string;
200
+ category: Category;
201
+ criticality: Criticality;
202
+ audience: DocumentAudienceEntry[];
203
+ currentVersionId: string | null;
204
+ /** Semver string of the current version, e.g. "1.2.0". */
205
+ versionNumber: string | null;
206
+ /** Number of collaborators in the matrix that the audience applies to. */
207
+ totalApplicable: number;
208
+ /** Of those, how many have a valid ack on the current version. */
209
+ totalAcked: number;
210
+ /** `totalAcked / totalApplicable * 100`, rounded to 0 decimals. 0 when N/A. */
211
+ pctRead: number;
212
+ /** Index-aligned with the response's `collaborators[]`. */
213
+ cells: DocumentComplianceCell[];
214
+ }
215
+ /**
216
+ * Document Compliance Matrix Response
217
+ *
218
+ * Admin/manager view: matrix of "who has read what". Rows are documents,
219
+ * columns are collaborators.
220
+ *
221
+ * Used for: `GET /api/documents/acknowledgments/matrix`
222
+ */
223
+ export interface DocumentComplianceMatrixResponse {
224
+ collaborators: DocumentComplianceCollaborator[];
225
+ rows: DocumentComplianceRow[];
226
+ /** Total docs in the response (rows.length, surfaced for KPI). */
227
+ totalDocs: number;
228
+ /** Total applicable doc-collaborator pairs across all rows. */
229
+ totalApplicablePairs: number;
230
+ /** Of those, how many are acked. */
231
+ totalAckedPairs: number;
232
+ /** Average of pctRead across rows (or `totalAckedPairs / totalApplicablePairs * 100`). */
233
+ pctReadOverall: number;
234
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "13.1.0",
3
+ "version": "13.2.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",