@kernhq/module-hr 0.16.0 → 0.17.1

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.
Files changed (49) hide show
  1. package/dist/contract/index.d.ts +1 -0
  2. package/dist/contract/index.d.ts.map +1 -1
  3. package/dist/contract/index.js +1 -0
  4. package/dist/contract/index.js.map +1 -1
  5. package/dist/contract/models.d.ts +1 -0
  6. package/dist/contract/models.d.ts.map +1 -1
  7. package/dist/contract/models.js +15 -0
  8. package/dist/contract/models.js.map +1 -1
  9. package/dist/contract/permissions.d.ts +8 -0
  10. package/dist/contract/permissions.d.ts.map +1 -1
  11. package/dist/contract/permissions.js +20 -0
  12. package/dist/contract/permissions.js.map +1 -1
  13. package/dist/contract/privacy.d.ts +860 -0
  14. package/dist/contract/privacy.d.ts.map +1 -0
  15. package/dist/contract/privacy.js +412 -0
  16. package/dist/contract/privacy.js.map +1 -0
  17. package/dist/contract/router.d.ts +815 -0
  18. package/dist/contract/router.d.ts.map +1 -1
  19. package/dist/contract/router.js +105 -0
  20. package/dist/contract/router.js.map +1 -1
  21. package/dist/server/router.d.ts +876 -0
  22. package/dist/server/router.d.ts.map +1 -1
  23. package/dist/server/router.js +312 -2
  24. package/dist/server/router.js.map +1 -1
  25. package/dist/server/schema.d.ts +397 -1
  26. package/dist/server/schema.d.ts.map +1 -1
  27. package/dist/server/schema.js +109 -0
  28. package/dist/server/schema.js.map +1 -1
  29. package/dist/server/services/audit.d.ts +249 -0
  30. package/dist/server/services/audit.d.ts.map +1 -0
  31. package/dist/server/services/audit.js +230 -0
  32. package/dist/server/services/audit.js.map +1 -0
  33. package/dist/server/services/people.d.ts +53 -1
  34. package/dist/server/services/people.d.ts.map +1 -1
  35. package/dist/server/services/people.js +74 -1
  36. package/dist/server/services/people.js.map +1 -1
  37. package/dist/server/services/privacy.d.ts +514 -0
  38. package/dist/server/services/privacy.d.ts.map +1 -0
  39. package/dist/server/services/privacy.js +972 -0
  40. package/dist/server/services/privacy.js.map +1 -0
  41. package/migrations/0011_privacy.sql +77 -0
  42. package/migrations/meta/0011_snapshot.json +4450 -0
  43. package/migrations/meta/_journal.json +7 -0
  44. package/package.json +1 -1
  45. package/src/contract/index.ts +1 -0
  46. package/src/contract/models.ts +15 -0
  47. package/src/contract/permissions.ts +22 -0
  48. package/src/contract/privacy.ts +452 -0
  49. package/src/contract/router.ts +121 -0
@@ -1233,6 +1233,100 @@ export declare const people: import("drizzle-orm/pg-core").PgTableWithColumns<{
1233
1233
  }, {}, {
1234
1234
  $type: Record<string, unknown>;
1235
1235
  }>;
1236
+ erasedAt: import("drizzle-orm/pg-core").PgColumn<{
1237
+ name: string;
1238
+ tableName: "people";
1239
+ dataType: "date";
1240
+ columnType: "PgTimestamp";
1241
+ data: Date;
1242
+ driverParam: string;
1243
+ notNull: false;
1244
+ hasDefault: false;
1245
+ isPrimaryKey: false;
1246
+ isAutoincrement: false;
1247
+ hasRuntimeDefault: false;
1248
+ enumValues: undefined;
1249
+ baseColumn: never;
1250
+ identity: undefined;
1251
+ generated: undefined;
1252
+ }, {}, {}>;
1253
+ erasedBy: import("drizzle-orm/pg-core").PgColumn<{
1254
+ name: "erased_by";
1255
+ tableName: "people";
1256
+ dataType: "string";
1257
+ columnType: "PgUUID";
1258
+ data: string;
1259
+ driverParam: string;
1260
+ notNull: false;
1261
+ hasDefault: false;
1262
+ isPrimaryKey: false;
1263
+ isAutoincrement: false;
1264
+ hasRuntimeDefault: false;
1265
+ enumValues: undefined;
1266
+ baseColumn: never;
1267
+ identity: undefined;
1268
+ generated: undefined;
1269
+ }, {}, {}>;
1270
+ erasureReason: import("drizzle-orm/pg-core").PgColumn<{
1271
+ name: "erasure_reason";
1272
+ tableName: "people";
1273
+ dataType: "string";
1274
+ columnType: "PgText";
1275
+ data: string;
1276
+ driverParam: string;
1277
+ notNull: false;
1278
+ hasDefault: false;
1279
+ isPrimaryKey: false;
1280
+ isAutoincrement: false;
1281
+ hasRuntimeDefault: false;
1282
+ enumValues: [string, ...string[]];
1283
+ baseColumn: never;
1284
+ identity: undefined;
1285
+ generated: undefined;
1286
+ }, {}, {}>;
1287
+ erasedFileIds: import("drizzle-orm/pg-core").PgColumn<{
1288
+ name: "erased_file_ids";
1289
+ tableName: "people";
1290
+ dataType: "array";
1291
+ columnType: "PgArray";
1292
+ data: string[];
1293
+ driverParam: string | string[];
1294
+ notNull: false;
1295
+ hasDefault: false;
1296
+ isPrimaryKey: false;
1297
+ isAutoincrement: false;
1298
+ hasRuntimeDefault: false;
1299
+ enumValues: undefined;
1300
+ baseColumn: import("drizzle-orm").Column<{
1301
+ name: "erased_file_ids";
1302
+ tableName: "people";
1303
+ dataType: "string";
1304
+ columnType: "PgUUID";
1305
+ data: string;
1306
+ driverParam: string;
1307
+ notNull: false;
1308
+ hasDefault: false;
1309
+ isPrimaryKey: false;
1310
+ isAutoincrement: false;
1311
+ hasRuntimeDefault: false;
1312
+ enumValues: undefined;
1313
+ baseColumn: never;
1314
+ identity: undefined;
1315
+ generated: undefined;
1316
+ }, {}, {}>;
1317
+ identity: undefined;
1318
+ generated: undefined;
1319
+ }, {}, {
1320
+ baseBuilder: import("drizzle-orm/pg-core").PgColumnBuilder<{
1321
+ name: "erased_file_ids";
1322
+ dataType: "string";
1323
+ columnType: "PgUUID";
1324
+ data: string;
1325
+ driverParam: string;
1326
+ enumValues: undefined;
1327
+ }, {}, {}, import("drizzle-orm").ColumnBuilderExtraConfig>;
1328
+ size: undefined;
1329
+ }>;
1236
1330
  createdAt: import("drizzle-orm/pg-core").PgColumn<{
1237
1331
  name: string;
1238
1332
  tableName: "people";
@@ -2003,6 +2097,210 @@ export declare const personHistory: import("drizzle-orm/pg-core").PgTableWithCol
2003
2097
  };
2004
2098
  dialect: "pg";
2005
2099
  }>;
2100
+ /**
2101
+ * Who looked at somebody's identity number, birth date or bank details.
2102
+ *
2103
+ * `people_sensitive` is the one table in this module where the *read* is the event worth recording:
2104
+ * `hr.person.view_sensitive` is granted to nobody by default, and a subject-access request that
2105
+ * cannot answer "who has seen my data" is not a complete answer. Every other table is audited by
2106
+ * `person_history`, which records changes — a change to a national identity number is interesting,
2107
+ * and so is a colleague opening it and changing nothing.
2108
+ *
2109
+ * Append-only, like `person_history` and the ledger: a row here is evidence, and evidence that can
2110
+ * be edited is not evidence. One row per read of one person's record rather than per field — a
2111
+ * screen that opens twenty people writes twenty rows, not eighty, and `fields` says what was on
2112
+ * screen so a narrower read is still distinguishable from a full one.
2113
+ *
2114
+ * `actor_user_id` is the account, not the person: the reader may be an administrator with no
2115
+ * employee record at all, and the question a subject asks is about accounts. `actor_person_id` is
2116
+ * kept beside it when there is one, so the log reads as names without a join through core.
2117
+ */
2118
+ export declare const sensitiveAccessLog: import("drizzle-orm/pg-core").PgTableWithColumns<{
2119
+ name: "sensitive_access_log";
2120
+ schema: string;
2121
+ columns: {
2122
+ id: import("drizzle-orm/pg-core").PgColumn<{
2123
+ name: "id";
2124
+ tableName: "sensitive_access_log";
2125
+ dataType: "string";
2126
+ columnType: "PgUUID";
2127
+ data: string;
2128
+ driverParam: string;
2129
+ notNull: true;
2130
+ hasDefault: true;
2131
+ isPrimaryKey: true;
2132
+ isAutoincrement: false;
2133
+ hasRuntimeDefault: false;
2134
+ enumValues: undefined;
2135
+ baseColumn: never;
2136
+ identity: undefined;
2137
+ generated: undefined;
2138
+ }, {}, {}>;
2139
+ workspaceId: import("drizzle-orm/pg-core").PgColumn<{
2140
+ name: "workspace_id";
2141
+ tableName: "sensitive_access_log";
2142
+ dataType: "string";
2143
+ columnType: "PgUUID";
2144
+ data: string;
2145
+ driverParam: string;
2146
+ notNull: true;
2147
+ hasDefault: false;
2148
+ isPrimaryKey: false;
2149
+ isAutoincrement: false;
2150
+ hasRuntimeDefault: false;
2151
+ enumValues: undefined;
2152
+ baseColumn: never;
2153
+ identity: undefined;
2154
+ generated: undefined;
2155
+ }, {}, {}>;
2156
+ personId: import("drizzle-orm/pg-core").PgColumn<{
2157
+ name: "person_id";
2158
+ tableName: "sensitive_access_log";
2159
+ dataType: "string";
2160
+ columnType: "PgUUID";
2161
+ data: string;
2162
+ driverParam: string;
2163
+ notNull: true;
2164
+ hasDefault: false;
2165
+ isPrimaryKey: false;
2166
+ isAutoincrement: false;
2167
+ hasRuntimeDefault: false;
2168
+ enumValues: undefined;
2169
+ baseColumn: never;
2170
+ identity: undefined;
2171
+ generated: undefined;
2172
+ }, {}, {}>;
2173
+ actorUserId: import("drizzle-orm/pg-core").PgColumn<{
2174
+ name: "actor_user_id";
2175
+ tableName: "sensitive_access_log";
2176
+ dataType: "string";
2177
+ columnType: "PgUUID";
2178
+ data: string;
2179
+ driverParam: string;
2180
+ notNull: true;
2181
+ hasDefault: false;
2182
+ isPrimaryKey: false;
2183
+ isAutoincrement: false;
2184
+ hasRuntimeDefault: false;
2185
+ enumValues: undefined;
2186
+ baseColumn: never;
2187
+ identity: undefined;
2188
+ generated: undefined;
2189
+ }, {}, {}>;
2190
+ actorPersonId: import("drizzle-orm/pg-core").PgColumn<{
2191
+ name: "actor_person_id";
2192
+ tableName: "sensitive_access_log";
2193
+ dataType: "string";
2194
+ columnType: "PgUUID";
2195
+ data: string;
2196
+ driverParam: string;
2197
+ notNull: false;
2198
+ hasDefault: false;
2199
+ isPrimaryKey: false;
2200
+ isAutoincrement: false;
2201
+ hasRuntimeDefault: false;
2202
+ enumValues: undefined;
2203
+ baseColumn: never;
2204
+ identity: undefined;
2205
+ generated: undefined;
2206
+ }, {}, {}>;
2207
+ fields: import("drizzle-orm/pg-core").PgColumn<{
2208
+ name: "fields";
2209
+ tableName: "sensitive_access_log";
2210
+ dataType: "array";
2211
+ columnType: "PgArray";
2212
+ data: string[];
2213
+ driverParam: string | string[];
2214
+ notNull: true;
2215
+ hasDefault: false;
2216
+ isPrimaryKey: false;
2217
+ isAutoincrement: false;
2218
+ hasRuntimeDefault: false;
2219
+ enumValues: [string, ...string[]];
2220
+ baseColumn: import("drizzle-orm").Column<{
2221
+ name: "fields";
2222
+ tableName: "sensitive_access_log";
2223
+ dataType: "string";
2224
+ columnType: "PgText";
2225
+ data: string;
2226
+ driverParam: string;
2227
+ notNull: false;
2228
+ hasDefault: false;
2229
+ isPrimaryKey: false;
2230
+ isAutoincrement: false;
2231
+ hasRuntimeDefault: false;
2232
+ enumValues: [string, ...string[]];
2233
+ baseColumn: never;
2234
+ identity: undefined;
2235
+ generated: undefined;
2236
+ }, {}, {}>;
2237
+ identity: undefined;
2238
+ generated: undefined;
2239
+ }, {}, {
2240
+ baseBuilder: import("drizzle-orm/pg-core").PgColumnBuilder<{
2241
+ name: "fields";
2242
+ dataType: "string";
2243
+ columnType: "PgText";
2244
+ data: string;
2245
+ enumValues: [string, ...string[]];
2246
+ driverParam: string;
2247
+ }, {}, {}, import("drizzle-orm").ColumnBuilderExtraConfig>;
2248
+ size: undefined;
2249
+ }>;
2250
+ purpose: import("drizzle-orm/pg-core").PgColumn<{
2251
+ name: "purpose";
2252
+ tableName: "sensitive_access_log";
2253
+ dataType: "string";
2254
+ columnType: "PgText";
2255
+ data: string;
2256
+ driverParam: string;
2257
+ notNull: false;
2258
+ hasDefault: false;
2259
+ isPrimaryKey: false;
2260
+ isAutoincrement: false;
2261
+ hasRuntimeDefault: false;
2262
+ enumValues: [string, ...string[]];
2263
+ baseColumn: never;
2264
+ identity: undefined;
2265
+ generated: undefined;
2266
+ }, {}, {}>;
2267
+ via: import("drizzle-orm/pg-core").PgColumn<{
2268
+ name: "via";
2269
+ tableName: "sensitive_access_log";
2270
+ dataType: "string";
2271
+ columnType: "PgText";
2272
+ data: string;
2273
+ driverParam: string;
2274
+ notNull: true;
2275
+ hasDefault: false;
2276
+ isPrimaryKey: false;
2277
+ isAutoincrement: false;
2278
+ hasRuntimeDefault: false;
2279
+ enumValues: [string, ...string[]];
2280
+ baseColumn: never;
2281
+ identity: undefined;
2282
+ generated: undefined;
2283
+ }, {}, {}>;
2284
+ at: import("drizzle-orm/pg-core").PgColumn<{
2285
+ name: string;
2286
+ tableName: "sensitive_access_log";
2287
+ dataType: "date";
2288
+ columnType: "PgTimestamp";
2289
+ data: Date;
2290
+ driverParam: string;
2291
+ notNull: true;
2292
+ hasDefault: true;
2293
+ isPrimaryKey: false;
2294
+ isAutoincrement: false;
2295
+ hasRuntimeDefault: false;
2296
+ enumValues: undefined;
2297
+ baseColumn: never;
2298
+ identity: undefined;
2299
+ generated: undefined;
2300
+ }, {}, {}>;
2301
+ };
2302
+ dialect: "pg";
2303
+ }>;
2006
2304
  export declare const personDocuments: import("drizzle-orm/pg-core").PgTableWithColumns<{
2007
2305
  name: "person_documents";
2008
2306
  schema: string;
@@ -6915,6 +7213,104 @@ export declare const periods: import("drizzle-orm/pg-core").PgTableWithColumns<{
6915
7213
  };
6916
7214
  dialect: "pg";
6917
7215
  }>;
7216
+ /**
7217
+ * How long this workspace keeps each class of personal data. One row per workspace.
7218
+ *
7219
+ * **A table rather than a key in module settings, and the reason is mechanical rather than
7220
+ * aesthetic.** `core.settings.setModule` merges a write over what is stored and then parses the
7221
+ * result against the module's declared zod schema — and a zod object strips what it does not
7222
+ * declare. A retention key living beside `country` and `employeeNumberPrefix` in `HrSettings` would
7223
+ * therefore be deleted by the next unrelated settings write, silently, from a screen that never
7224
+ * mentions retention. That is the same trap `$capabilities` needed a reserved key to escape.
7225
+ * Extending `HrSettings` itself is the other honest route; it is a change to a shape shared with the
7226
+ * client, and this keeps the numbers somewhere nothing else can drop them.
7227
+ *
7228
+ * `workspace_id` is the primary key, so "one row per workspace" is the database's promise and not a
7229
+ * convention a second code path can break. The horizons are a jsonb `config` validated by
7230
+ * `HrRetention` on both sides: the honest end state is per legal entity — a Dutch entity and a
7231
+ * Turkish one have different obligations, which is why `periods` is already per entity — and that
7232
+ * move is then an added nullable column rather than a new table.
7233
+ *
7234
+ * Every horizon is null until somebody sets one, and null means "keep indefinitely". No number in
7235
+ * here ships with a value: "seven years" is a fact about one country and one document class.
7236
+ */
7237
+ export declare const retentionSettings: import("drizzle-orm/pg-core").PgTableWithColumns<{
7238
+ name: "retention_settings";
7239
+ schema: string;
7240
+ columns: {
7241
+ workspaceId: import("drizzle-orm/pg-core").PgColumn<{
7242
+ name: "workspace_id";
7243
+ tableName: "retention_settings";
7244
+ dataType: "string";
7245
+ columnType: "PgUUID";
7246
+ data: string;
7247
+ driverParam: string;
7248
+ notNull: true;
7249
+ hasDefault: false;
7250
+ isPrimaryKey: true;
7251
+ isAutoincrement: false;
7252
+ hasRuntimeDefault: false;
7253
+ enumValues: undefined;
7254
+ baseColumn: never;
7255
+ identity: undefined;
7256
+ generated: undefined;
7257
+ }, {}, {}>;
7258
+ config: import("drizzle-orm/pg-core").PgColumn<{
7259
+ name: "config";
7260
+ tableName: "retention_settings";
7261
+ dataType: "json";
7262
+ columnType: "PgJsonb";
7263
+ data: Record<string, number | null>;
7264
+ driverParam: unknown;
7265
+ notNull: true;
7266
+ hasDefault: true;
7267
+ isPrimaryKey: false;
7268
+ isAutoincrement: false;
7269
+ hasRuntimeDefault: false;
7270
+ enumValues: undefined;
7271
+ baseColumn: never;
7272
+ identity: undefined;
7273
+ generated: undefined;
7274
+ }, {}, {
7275
+ $type: Record<string, number | null>;
7276
+ }>;
7277
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
7278
+ name: string;
7279
+ tableName: "retention_settings";
7280
+ dataType: "date";
7281
+ columnType: "PgTimestamp";
7282
+ data: Date;
7283
+ driverParam: string;
7284
+ notNull: true;
7285
+ hasDefault: true;
7286
+ isPrimaryKey: false;
7287
+ isAutoincrement: false;
7288
+ hasRuntimeDefault: false;
7289
+ enumValues: undefined;
7290
+ baseColumn: never;
7291
+ identity: undefined;
7292
+ generated: undefined;
7293
+ }, {}, {}>;
7294
+ updatedBy: import("drizzle-orm/pg-core").PgColumn<{
7295
+ name: "updated_by";
7296
+ tableName: "retention_settings";
7297
+ dataType: "string";
7298
+ columnType: "PgUUID";
7299
+ data: string;
7300
+ driverParam: string;
7301
+ notNull: false;
7302
+ hasDefault: false;
7303
+ isPrimaryKey: false;
7304
+ isAutoincrement: false;
7305
+ hasRuntimeDefault: false;
7306
+ enumValues: undefined;
7307
+ baseColumn: never;
7308
+ identity: undefined;
7309
+ generated: undefined;
7310
+ }, {}, {}>;
7311
+ };
7312
+ dialect: "pg";
7313
+ }>;
6918
7314
  /** Every tenant table, so the RLS migration is checked against one list rather than memory. */
6919
- export declare const TENANT_TABLES: readonly ["legal_entities", "offices", "cost_centers", "org_units", "positions", "people", "people_sensitive", "employments", "office_assignments", "person_history", "person_documents", "custom_field_defs", "calendars", "calendar_days", "leave_types", "leave_ledger", "leave_balance_cursor", "leave_requests", "leave_request_days", "approval_chains", "approval_requests", "approval_steps", "approval_decisions", "delegations", "schedules", "schedule_assignments", "punches", "attendance_days", "regularizations", "policies", "policy_assignments", "periods"];
7315
+ export declare const TENANT_TABLES: readonly ["legal_entities", "offices", "cost_centers", "org_units", "positions", "people", "people_sensitive", "employments", "office_assignments", "person_history", "sensitive_access_log", "person_documents", "custom_field_defs", "calendars", "calendar_days", "leave_types", "leave_ledger", "leave_balance_cursor", "leave_requests", "leave_request_days", "approval_chains", "approval_requests", "approval_steps", "approval_decisions", "delegations", "schedules", "schedule_assignments", "punches", "attendance_days", "regularizations", "policies", "policy_assignments", "periods", "retention_settings"];
6920
7316
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/server/schema.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,gDAAqB,CAAA;AAcxC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAezB,CAAA;AAED,eAAO,MAAM,OAAO;;;;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F,eAAO,MAAM,aAAa,6lBAmChB,CAAA"}
@@ -144,6 +144,29 @@ export const people = schema.table('people', {
144
144
  /** Overrides the primary office's zone for somebody who genuinely works elsewhere. */
145
145
  timezone: text('timezone'),
146
146
  custom: jsonb('custom').$type().notNull().default(sql `'{}'::jsonb`),
147
+ /**
148
+ * The erasure tombstone.
149
+ *
150
+ * Deliberately **not** a member of `status`. `status` carries the employment lifecycle —
151
+ * onboarding, active, on leave, offboarding, terminated — and overloading it with `erased` makes
152
+ * "was she still employed when this was approved" unanswerable, which is the question a payroll
153
+ * audit asks. It would also be a *constructing* break on a shared contract: adding a member to
154
+ * `PersonStatus` keeps every stored row parsing and stops every site that builds one compiling.
155
+ * A separate nullable timestamp says the same thing and costs nothing.
156
+ */
157
+ erasedAt: ts('erased_at'),
158
+ erasedBy: uuid('erased_by'),
159
+ erasureReason: text('erasure_reason'),
160
+ /**
161
+ * File objects an erasure had to leave in core's storage.
162
+ *
163
+ * `core.files.get` is the only file procedure a module can reach — there is no `files.delete` —
164
+ * so clearing `photo_file_id` and `leave_requests.document_file_id` removes the *pointer* and
165
+ * orphans the object. Recording the ids here is what keeps that finishable: without them the
166
+ * bytes stay in the bucket with nothing left that knows they were hers. `person_documents` rows
167
+ * are kept instead of being nulled, so their files need no entry here.
168
+ */
169
+ erasedFileIds: uuid('erased_file_ids').array(),
147
170
  createdAt: created(),
148
171
  updatedAt: updated(),
149
172
  }, (t) => [
@@ -230,6 +253,60 @@ export const personHistory = schema.table('person_history', {
230
253
  actorId: uuid('actor_id'),
231
254
  source: text('source').notNull().default('app'),
232
255
  }, (t) => [index('hr_person_history_idx').on(t.workspaceId, t.personId, t.at)]);
256
+ /**
257
+ * Who looked at somebody's identity number, birth date or bank details.
258
+ *
259
+ * `people_sensitive` is the one table in this module where the *read* is the event worth recording:
260
+ * `hr.person.view_sensitive` is granted to nobody by default, and a subject-access request that
261
+ * cannot answer "who has seen my data" is not a complete answer. Every other table is audited by
262
+ * `person_history`, which records changes — a change to a national identity number is interesting,
263
+ * and so is a colleague opening it and changing nothing.
264
+ *
265
+ * Append-only, like `person_history` and the ledger: a row here is evidence, and evidence that can
266
+ * be edited is not evidence. One row per read of one person's record rather than per field — a
267
+ * screen that opens twenty people writes twenty rows, not eighty, and `fields` says what was on
268
+ * screen so a narrower read is still distinguishable from a full one.
269
+ *
270
+ * `actor_user_id` is the account, not the person: the reader may be an administrator with no
271
+ * employee record at all, and the question a subject asks is about accounts. `actor_person_id` is
272
+ * kept beside it when there is one, so the log reads as names without a join through core.
273
+ */
274
+ export const sensitiveAccessLog = schema.table('sensitive_access_log', {
275
+ id: id(),
276
+ workspaceId: ws(),
277
+ /** Whose record was read. */
278
+ personId: uuid('person_id').notNull(),
279
+ actorUserId: uuid('actor_user_id').notNull(),
280
+ actorPersonId: uuid('actor_person_id'),
281
+ /** Which fields the read returned, so a narrow read is not filed as a full one. */
282
+ fields: text('fields').array().notNull(),
283
+ /** Why, where a caller offered a reason. Never invented on the caller's behalf. */
284
+ purpose: text('purpose'),
285
+ /**
286
+ * How it was reached: `ui`, `api` or `export`, and nothing else that is producible today.
287
+ *
288
+ * Not `mcp`: core's MCP proxy forwards a plain bearer token, so an assistant's read arrives here
289
+ * as an ordinary `kind: 'user'` principal and is indistinguishable from a person at a keyboard.
290
+ * Recording it as its own channel would be a claim the code cannot support. Not `service`
291
+ * either: a service principal always has a null `userId`, and a reader nobody can be named for
292
+ * is refused before a row is written — an audit row whose actor is "the system" answers the
293
+ * subject's question with a shrug.
294
+ */
295
+ via: text('via').notNull(),
296
+ at: created(),
297
+ }, (t) => [
298
+ // Both reads this table exists to answer: what was seen of one person (a subject-access
299
+ // request), and what one account has been looking at (an investigation). Newest first in both,
300
+ // because nobody asks these questions oldest-first.
301
+ // `t.at.desc()`, never `desc(t.at)`. The second is the *query* helper: drizzle records it in the
302
+ // snapshot as a SQL expression — `("created_at" desc)` — rather than as a column with a sort
303
+ // direction, and Postgres will not build an index on that. `check-snapshot-drift` catches it by
304
+ // asking Postgres to build what the snapshot describes, which is the only reason it is visible
305
+ // at all: the emitted `CREATE INDEX` is valid either way, so the migration applies and only the
306
+ // snapshot is wrong. `hr_approval_requests_requester_idx` below is the spelling to copy.
307
+ index('hr_sens_access_subject_idx').on(t.workspaceId, t.personId, t.at.desc()),
308
+ index('hr_sens_access_actor_idx').on(t.workspaceId, t.actorUserId, t.at.desc()),
309
+ ]);
233
310
  export const personDocuments = schema.table('person_documents', {
234
311
  id: id(),
235
312
  workspaceId: ws(),
@@ -807,6 +884,36 @@ export const periods = schema.table('periods', {
807
884
  note: text('note'),
808
885
  createdAt: created(),
809
886
  }, (t) => [index('hr_periods_idx').on(t.workspaceId, t.kind, t.startsOn)]);
887
+ // =====================================================================================
888
+ // privacy
889
+ // =====================================================================================
890
+ /**
891
+ * How long this workspace keeps each class of personal data. One row per workspace.
892
+ *
893
+ * **A table rather than a key in module settings, and the reason is mechanical rather than
894
+ * aesthetic.** `core.settings.setModule` merges a write over what is stored and then parses the
895
+ * result against the module's declared zod schema — and a zod object strips what it does not
896
+ * declare. A retention key living beside `country` and `employeeNumberPrefix` in `HrSettings` would
897
+ * therefore be deleted by the next unrelated settings write, silently, from a screen that never
898
+ * mentions retention. That is the same trap `$capabilities` needed a reserved key to escape.
899
+ * Extending `HrSettings` itself is the other honest route; it is a change to a shape shared with the
900
+ * client, and this keeps the numbers somewhere nothing else can drop them.
901
+ *
902
+ * `workspace_id` is the primary key, so "one row per workspace" is the database's promise and not a
903
+ * convention a second code path can break. The horizons are a jsonb `config` validated by
904
+ * `HrRetention` on both sides: the honest end state is per legal entity — a Dutch entity and a
905
+ * Turkish one have different obligations, which is why `periods` is already per entity — and that
906
+ * move is then an added nullable column rather than a new table.
907
+ *
908
+ * Every horizon is null until somebody sets one, and null means "keep indefinitely". No number in
909
+ * here ships with a value: "seven years" is a fact about one country and one document class.
910
+ */
911
+ export const retentionSettings = schema.table('retention_settings', {
912
+ workspaceId: uuid('workspace_id').primaryKey(),
913
+ config: jsonb('config').$type().notNull().default(sql `'{}'::jsonb`),
914
+ updatedAt: updated(),
915
+ updatedBy: uuid('updated_by'),
916
+ });
810
917
  /** Every tenant table, so the RLS migration is checked against one list rather than memory. */
811
918
  export const TENANT_TABLES = [
812
919
  'legal_entities',
@@ -819,6 +926,7 @@ export const TENANT_TABLES = [
819
926
  'employments',
820
927
  'office_assignments',
821
928
  'person_history',
929
+ 'sensitive_access_log',
822
930
  'person_documents',
823
931
  'custom_field_defs',
824
932
  'calendars',
@@ -841,5 +949,6 @@ export const TENANT_TABLES = [
841
949
  'policies',
842
950
  'policy_assignments',
843
951
  'periods',
952
+ 'retention_settings',
844
953
  ];
845
954
  //# sourceMappingURL=schema.js.map