dpdp-kit 0.2.0 → 0.4.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.
- package/CHANGELOG.md +90 -0
- package/README.md +240 -17
- package/dist/access.d.ts +111 -0
- package/dist/audit.d.ts +3 -1
- package/dist/breach.d.ts +170 -0
- package/dist/chunk-2ELTZSW3.js +94 -0
- package/dist/chunk-5TVA2TKG.js +37 -0
- package/dist/chunk-HXVP446N.js +1051 -0
- package/dist/chunk-KLMR7S7I.js +438 -0
- package/dist/cli.js +53 -17
- package/dist/config.d.ts +69 -0
- package/dist/data-access.d.ts +6 -2
- package/dist/ddl.d.ts +10 -0
- package/dist/dpdp.d.ts +210 -0
- package/dist/drizzle.d.ts +403 -11
- package/dist/drizzle.js +209 -56
- package/dist/errors.d.ts +1 -1
- package/dist/express.d.ts +17 -1
- package/dist/express.js +10 -2
- package/dist/fastify.d.ts +41 -0
- package/dist/fastify.js +25 -0
- package/dist/guard.d.ts +19 -0
- package/dist/hono.d.ts +16 -1
- package/dist/hono.js +11 -2
- package/dist/index.d.ts +7 -4
- package/dist/index.js +420 -100
- package/dist/mongodb.d.ts +87 -0
- package/dist/mongodb.js +344 -0
- package/dist/nestjs.d.ts +65 -0
- package/dist/nestjs.js +41 -0
- package/dist/postgres.d.ts +45 -0
- package/dist/postgres.js +27 -0
- package/dist/prisma.d.ts +43 -0
- package/dist/prisma.js +281 -0
- package/dist/protect.d.ts +74 -0
- package/dist/protect.js +114 -0
- package/dist/retention.d.ts +1 -1
- package/dist/run-audit.d.ts +13 -1
- package/dist/safeguards.d.ts +23 -0
- package/dist/schedule.d.ts +37 -0
- package/dist/schedule.js +66 -0
- package/dist/schema-check.d.ts +25 -8
- package/dist/store.d.ts +11 -1
- package/package.json +58 -5
- package/dist/chunk-FGZAH2NF.js +0 -16
- package/dist/chunk-KVTUMHXO.js +0 -491
package/dist/data-access.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ErasedValue } from "./config.js";
|
|
1
2
|
/**
|
|
2
3
|
* How dpdp-kit reaches the personal data in your own tables: to show a person what you hold
|
|
3
4
|
* (Section 11) and to carry out erasure (Section 8(7)). Names are as written in the data map
|
|
@@ -6,8 +7,11 @@
|
|
|
6
7
|
export interface DataAccess {
|
|
7
8
|
/** The person's rows, with only the listed columns. */
|
|
8
9
|
read(table: string, subjectColumn: string, subjectId: string, columns: readonly string[]): Promise<Record<string, unknown>[]>;
|
|
9
|
-
/**
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Erase the listed columns in the person's rows: set each to its value in `values`, or to null
|
|
12
|
+
* when it has none (the field's `erase` setting in the config). Returns rows changed.
|
|
13
|
+
*/
|
|
14
|
+
eraseFields(table: string, subjectColumn: string, subjectId: string, columns: readonly string[], values?: Readonly<Record<string, ErasedValue>>): Promise<number>;
|
|
11
15
|
/** Delete the person's rows. Returns rows deleted. */
|
|
12
16
|
deleteRows(table: string, subjectColumn: string, subjectId: string): Promise<number>;
|
|
13
17
|
}
|
package/dist/ddl.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The same table as plain SQL, if you don't use drizzle-kit for migrations. */
|
|
2
|
+
export declare const CONSENT_EVENTS_DDL = "CREATE TABLE IF NOT EXISTS dpdp_consent_events (\n subject_id text NOT NULL,\n seq integer NOT NULL,\n action text NOT NULL CHECK (action IN ('grant', 'withdraw')),\n purposes jsonb NOT NULL,\n notice_version text,\n language text,\n channel text,\n evidence jsonb,\n at timestamptz NOT NULL,\n prev_hash text,\n hash text NOT NULL,\n PRIMARY KEY (subject_id, seq)\n);";
|
|
3
|
+
/** Rights requests and erasure tasks as plain SQL, if you don't use drizzle-kit for migrations. */
|
|
4
|
+
export declare const RECORDS_DDL = "CREATE TABLE IF NOT EXISTS dpdp_requests (\n id text PRIMARY KEY,\n subject_id text NOT NULL,\n type text NOT NULL,\n status text NOT NULL,\n opened_at timestamptz NOT NULL,\n due_at timestamptz NOT NULL,\n closed_at timestamptz,\n details jsonb,\n history jsonb NOT NULL\n);\nCREATE INDEX IF NOT EXISTS dpdp_requests_subject_idx ON dpdp_requests (subject_id);\nCREATE INDEX IF NOT EXISTS dpdp_requests_status_due_idx ON dpdp_requests (status, due_at);\nCREATE TABLE IF NOT EXISTS dpdp_erasure_tasks (\n id text PRIMARY KEY,\n subject_id text NOT NULL,\n reason text NOT NULL,\n kind text NOT NULL,\n table_key text,\n fields jsonb,\n processor text,\n purposes jsonb,\n created_at timestamptz NOT NULL,\n due_at timestamptz NOT NULL,\n status text NOT NULL,\n attempts integer NOT NULL,\n claimed_at timestamptz,\n done_at timestamptz,\n affected integer,\n last_error text,\n note text\n);\nCREATE INDEX IF NOT EXISTS dpdp_erasure_tasks_subject_idx ON dpdp_erasure_tasks (subject_id);\nCREATE INDEX IF NOT EXISTS dpdp_erasure_tasks_status_due_idx ON dpdp_erasure_tasks (status, due_at);";
|
|
5
|
+
/** The access log as plain SQL, if you don't use drizzle-kit for migrations. */
|
|
6
|
+
export declare const ACCESS_LOG_DDL = "CREATE TABLE IF NOT EXISTS dpdp_access_log (\n id text PRIMARY KEY,\n at timestamptz NOT NULL,\n actor text NOT NULL,\n subject_id text NOT NULL,\n action text NOT NULL,\n purpose text NOT NULL,\n fields jsonb,\n out_of_purpose jsonb,\n reason text,\n evidence jsonb\n);\nCREATE INDEX IF NOT EXISTS dpdp_access_log_at_idx ON dpdp_access_log (at);\nCREATE INDEX IF NOT EXISTS dpdp_access_log_subject_idx ON dpdp_access_log (subject_id, at);\nCREATE INDEX IF NOT EXISTS dpdp_access_log_actor_idx ON dpdp_access_log (actor, at);";
|
|
7
|
+
/** The breach tables as plain SQL, if you don't use drizzle-kit for migrations. */
|
|
8
|
+
export declare const BREACH_DDL = "CREATE TABLE IF NOT EXISTS dpdp_breaches (\n id text PRIMARY KEY,\n status text NOT NULL,\n aware_at timestamptz NOT NULL,\n report_due_at timestamptz NOT NULL,\n data jsonb NOT NULL\n);\nCREATE INDEX IF NOT EXISTS dpdp_breaches_status_idx ON dpdp_breaches (status, aware_at);\nCREATE TABLE IF NOT EXISTS dpdp_breach_notices (\n breach_id text NOT NULL,\n subject_id text NOT NULL,\n status text NOT NULL,\n added_at timestamptz NOT NULL,\n sent_at timestamptz,\n channel text,\n PRIMARY KEY (breach_id, subject_id)\n);\nCREATE INDEX IF NOT EXISTS dpdp_breach_notices_status_idx ON dpdp_breach_notices (breach_id, status, added_at);";
|
|
9
|
+
/** Every dpdp-kit table as plain SQL. */
|
|
10
|
+
export declare const DPDP_DDL = "CREATE TABLE IF NOT EXISTS dpdp_consent_events (\n subject_id text NOT NULL,\n seq integer NOT NULL,\n action text NOT NULL CHECK (action IN ('grant', 'withdraw')),\n purposes jsonb NOT NULL,\n notice_version text,\n language text,\n channel text,\n evidence jsonb,\n at timestamptz NOT NULL,\n prev_hash text,\n hash text NOT NULL,\n PRIMARY KEY (subject_id, seq)\n);\nCREATE TABLE IF NOT EXISTS dpdp_requests (\n id text PRIMARY KEY,\n subject_id text NOT NULL,\n type text NOT NULL,\n status text NOT NULL,\n opened_at timestamptz NOT NULL,\n due_at timestamptz NOT NULL,\n closed_at timestamptz,\n details jsonb,\n history jsonb NOT NULL\n);\nCREATE INDEX IF NOT EXISTS dpdp_requests_subject_idx ON dpdp_requests (subject_id);\nCREATE INDEX IF NOT EXISTS dpdp_requests_status_due_idx ON dpdp_requests (status, due_at);\nCREATE TABLE IF NOT EXISTS dpdp_erasure_tasks (\n id text PRIMARY KEY,\n subject_id text NOT NULL,\n reason text NOT NULL,\n kind text NOT NULL,\n table_key text,\n fields jsonb,\n processor text,\n purposes jsonb,\n created_at timestamptz NOT NULL,\n due_at timestamptz NOT NULL,\n status text NOT NULL,\n attempts integer NOT NULL,\n claimed_at timestamptz,\n done_at timestamptz,\n affected integer,\n last_error text,\n note text\n);\nCREATE INDEX IF NOT EXISTS dpdp_erasure_tasks_subject_idx ON dpdp_erasure_tasks (subject_id);\nCREATE INDEX IF NOT EXISTS dpdp_erasure_tasks_status_due_idx ON dpdp_erasure_tasks (status, due_at);\nCREATE TABLE IF NOT EXISTS dpdp_access_log (\n id text PRIMARY KEY,\n at timestamptz NOT NULL,\n actor text NOT NULL,\n subject_id text NOT NULL,\n action text NOT NULL,\n purpose text NOT NULL,\n fields jsonb,\n out_of_purpose jsonb,\n reason text,\n evidence jsonb\n);\nCREATE INDEX IF NOT EXISTS dpdp_access_log_at_idx ON dpdp_access_log (at);\nCREATE INDEX IF NOT EXISTS dpdp_access_log_subject_idx ON dpdp_access_log (subject_id, at);\nCREATE INDEX IF NOT EXISTS dpdp_access_log_actor_idx ON dpdp_access_log (actor, at);\nCREATE TABLE IF NOT EXISTS dpdp_breaches (\n id text PRIMARY KEY,\n status text NOT NULL,\n aware_at timestamptz NOT NULL,\n report_due_at timestamptz NOT NULL,\n data jsonb NOT NULL\n);\nCREATE INDEX IF NOT EXISTS dpdp_breaches_status_idx ON dpdp_breaches (status, aware_at);\nCREATE TABLE IF NOT EXISTS dpdp_breach_notices (\n breach_id text NOT NULL,\n subject_id text NOT NULL,\n status text NOT NULL,\n added_at timestamptz NOT NULL,\n sent_at timestamptz,\n channel text,\n PRIMARY KEY (breach_id, subject_id)\n);\nCREATE INDEX IF NOT EXISTS dpdp_breach_notices_status_idx ON dpdp_breach_notices (breach_id, status, added_at);";
|
package/dist/dpdp.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { type AccessAction, type AccessEntry, type AccessFilter, type AccessReview } from "./access.js";
|
|
2
|
+
import { type Breach, type BreachInput, type BreachNotice, type BoardReport, type BoardReportInput, type BreachStatus, type PersonNotice } from "./breach.js";
|
|
1
3
|
import type { DpdpConfig } from "./config.js";
|
|
2
4
|
import type { DataAccess } from "./data-access.js";
|
|
5
|
+
import { type Duration } from "./duration.js";
|
|
3
6
|
import { type ErasurePlan } from "./erasure.js";
|
|
4
7
|
import { type NoticeLanguage } from "./languages.js";
|
|
5
8
|
import { type ErasureTask, type RequestFilter, type RequestType, type RightsRequest, type TaskFilter } from "./records.js";
|
|
@@ -21,6 +24,97 @@ export type VerifyResult = {
|
|
|
21
24
|
brokenAt: number;
|
|
22
25
|
reason: "hash-mismatch" | "chain-broken" | "seq-gap";
|
|
23
26
|
};
|
|
27
|
+
export interface AccessInput<P extends string> {
|
|
28
|
+
/** Who is accessing the data: a staff user's id, a service or job name. */
|
|
29
|
+
actor: string;
|
|
30
|
+
/** Whose data. Pass `subjectIds` instead for a list or an export. */
|
|
31
|
+
subjectId?: string;
|
|
32
|
+
subjectIds?: readonly string[];
|
|
33
|
+
/** Why: one of your purposes. */
|
|
34
|
+
purpose: P;
|
|
35
|
+
/** Default `"read"`. */
|
|
36
|
+
action?: AccessAction;
|
|
37
|
+
/**
|
|
38
|
+
* What is accessed, as data map keys: `"users.phone"`, or `"users"` / `"users.*"` for every
|
|
39
|
+
* personal field of a table. Fields not held for `purpose` are recorded as `outOfPurpose`.
|
|
40
|
+
*/
|
|
41
|
+
fields?: readonly string[];
|
|
42
|
+
/** Free text, e.g. a support ticket number. */
|
|
43
|
+
reason?: string;
|
|
44
|
+
/** Details of the request, e.g. IP address, user agent, request id. */
|
|
45
|
+
evidence?: Record<string, string>;
|
|
46
|
+
}
|
|
47
|
+
export interface AccessOptions {
|
|
48
|
+
/**
|
|
49
|
+
* What to do when a log entry reads fields that aren't held for its purpose. `"record"` (default)
|
|
50
|
+
* logs it with `outOfPurpose` for `review()` to report; `"throw"` logs it, then throws
|
|
51
|
+
* `DpdpError("out-of-purpose")` so the caller can refuse.
|
|
52
|
+
*/
|
|
53
|
+
outOfPurpose?: "record" | "throw";
|
|
54
|
+
}
|
|
55
|
+
/** What each event carries. Events fire after the change is saved. */
|
|
56
|
+
export interface DpdpEvents {
|
|
57
|
+
"consent.granted": {
|
|
58
|
+
event: ConsentEvent;
|
|
59
|
+
};
|
|
60
|
+
"consent.withdrawn": {
|
|
61
|
+
event: ConsentEvent;
|
|
62
|
+
erasure: ErasurePlan;
|
|
63
|
+
tasks: ErasureTask[];
|
|
64
|
+
};
|
|
65
|
+
"erasure.scheduled": {
|
|
66
|
+
plan: ErasurePlan;
|
|
67
|
+
tasks: ErasureTask[];
|
|
68
|
+
};
|
|
69
|
+
"retention.ran": {
|
|
70
|
+
report: RunReport;
|
|
71
|
+
};
|
|
72
|
+
"rights.opened": {
|
|
73
|
+
request: RightsRequest;
|
|
74
|
+
};
|
|
75
|
+
"rights.closed": {
|
|
76
|
+
request: RightsRequest;
|
|
77
|
+
};
|
|
78
|
+
"access.logged": {
|
|
79
|
+
entries: AccessEntry[];
|
|
80
|
+
};
|
|
81
|
+
"daily.ran": {
|
|
82
|
+
report: DailyReport;
|
|
83
|
+
};
|
|
84
|
+
"breach.opened": {
|
|
85
|
+
breach: Breach;
|
|
86
|
+
};
|
|
87
|
+
"breach.reported": {
|
|
88
|
+
breach: Breach;
|
|
89
|
+
};
|
|
90
|
+
"breach.closed": {
|
|
91
|
+
breach: Breach;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/** What `daily()` did. A part the store can't do (a custom store without the access log) is listed in `skipped`. */
|
|
95
|
+
export interface DailyReport {
|
|
96
|
+
/** When the run started (ISO 8601). */
|
|
97
|
+
at: string;
|
|
98
|
+
/** Erasure tasks carried out by `retention.run()`. */
|
|
99
|
+
retention?: RunReport;
|
|
100
|
+
/** Access log entries older than the retention period, deleted by `access.prune()`. */
|
|
101
|
+
accessPruned?: number;
|
|
102
|
+
/** `access.review()` of the last day. */
|
|
103
|
+
review?: AccessReview;
|
|
104
|
+
/** Open rights requests past their due date. */
|
|
105
|
+
overdueRequests?: RightsRequest[];
|
|
106
|
+
/** Open breaches with their Rule 7 deadlines and what's left to do. */
|
|
107
|
+
breaches?: BreachStatus[];
|
|
108
|
+
skipped: Array<"retention" | "access" | "rights" | "breaches">;
|
|
109
|
+
/** Steps that failed. The other steps still ran. */
|
|
110
|
+
errors: Array<{
|
|
111
|
+
step: "retention" | "rights" | "access-prune" | "access-review" | "breaches";
|
|
112
|
+
message: string;
|
|
113
|
+
error: unknown;
|
|
114
|
+
}>;
|
|
115
|
+
}
|
|
116
|
+
export type DpdpEventName = keyof DpdpEvents;
|
|
117
|
+
export type DpdpListener<E extends DpdpEventName> = (payload: DpdpEvents[E]) => void | Promise<void>;
|
|
24
118
|
export interface DpdpOptions<P extends string> {
|
|
25
119
|
config: DpdpConfig<P>;
|
|
26
120
|
/** `memoryStore()`, `drizzleStore(db)`, or your own. Rights and retention need a full `DpdpStore`. */
|
|
@@ -36,9 +130,41 @@ export interface DpdpOptions<P extends string> {
|
|
|
36
130
|
now?: () => Date;
|
|
37
131
|
/** Attempts when two writes for the same person race. Default 5. */
|
|
38
132
|
maxRetries?: number;
|
|
133
|
+
/** Access log behaviour. See `AccessOptions`. */
|
|
134
|
+
access?: AccessOptions;
|
|
135
|
+
/**
|
|
136
|
+
* Called when an event listener throws or rejects. Listeners never break the operation that
|
|
137
|
+
* fired them. Default: `console.error`.
|
|
138
|
+
*/
|
|
139
|
+
onListenerError?: (error: unknown, event: DpdpEventName) => void;
|
|
39
140
|
}
|
|
40
141
|
export interface Dpdp<P extends string> {
|
|
41
142
|
readonly config: DpdpConfig<P>;
|
|
143
|
+
/**
|
|
144
|
+
* Listen for an event, e.g. to feed your own audit trail, alerts or analytics. Listeners run after
|
|
145
|
+
* the change is saved, don't delay the call that fired them, and can't make it fail. Returns a
|
|
146
|
+
* function that removes the listener.
|
|
147
|
+
*
|
|
148
|
+
* ```ts
|
|
149
|
+
* dpdp.on("consent.withdrawn", ({ event }) => analytics.forget(event.subjectId, event.purposes));
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
on<E extends DpdpEventName>(event: E, listener: DpdpListener<E>): () => void;
|
|
153
|
+
/**
|
|
154
|
+
* The daily upkeep in one call: carry out due erasure (`retention.run()`), prune access logs past
|
|
155
|
+
* their retention (`access.prune()`), review the last day of access (`access.review()`), and list
|
|
156
|
+
* overdue rights requests. Run it once a day: from `startDaily()` in `dpdp-kit/schedule`, node-cron,
|
|
157
|
+
* a BullMQ repeatable job, or your platform's cron. Safe to run from several servers at once.
|
|
158
|
+
*/
|
|
159
|
+
daily(input?: {
|
|
160
|
+
review?: {
|
|
161
|
+
/** Start of the review (ISO 8601). Default: a day before now. Pass the end of the last successful review so no day is missed. */
|
|
162
|
+
from?: string;
|
|
163
|
+
window?: Duration;
|
|
164
|
+
maxSubjects?: number;
|
|
165
|
+
ignoreActors?: readonly string[];
|
|
166
|
+
};
|
|
167
|
+
}): Promise<DailyReport>;
|
|
42
168
|
readonly consent: {
|
|
43
169
|
/** Record that the person agreed to these consent purposes. */
|
|
44
170
|
grant(subjectId: string, purposes: readonly P[], meta?: ConsentMeta): Promise<ConsentEvent>;
|
|
@@ -89,6 +215,90 @@ export interface Dpdp<P extends string> {
|
|
|
89
215
|
/** Mark a `manual` or `failed` task as handled by a person. */
|
|
90
216
|
markDone(taskId: string, note: string): Promise<ErasureTask>;
|
|
91
217
|
};
|
|
218
|
+
readonly access: {
|
|
219
|
+
/**
|
|
220
|
+
* Record that someone accessed a person's personal data, and why (Rule 6(1)(c)). One entry per
|
|
221
|
+
* person. Needs a store that keeps the access log: `memoryStore()`, `drizzleStore(db)`, or your
|
|
222
|
+
* own `AccessLogStore`.
|
|
223
|
+
*/
|
|
224
|
+
log(input: AccessInput<P>): Promise<AccessEntry[]>;
|
|
225
|
+
/** Entries matching the filter, oldest first: for investigating a person, an actor, or a period. */
|
|
226
|
+
list(filter?: AccessFilter): Promise<AccessEntry[]>;
|
|
227
|
+
/**
|
|
228
|
+
* Look for signs of unauthorised access (Rule 6(1)(c)): fields read for a purpose they aren't
|
|
229
|
+
* held for, consent purposes used without consent at the time, and one actor reaching more
|
|
230
|
+
* than `maxSubjects` people (default 100) within `window` (default `"1h"`). Reviews the last day
|
|
231
|
+
* unless `from` / `to` are given. Run it daily.
|
|
232
|
+
*/
|
|
233
|
+
review(input?: {
|
|
234
|
+
from?: string;
|
|
235
|
+
to?: string;
|
|
236
|
+
window?: Duration;
|
|
237
|
+
maxSubjects?: number;
|
|
238
|
+
/** Actors exempt from bulk-access findings, e.g. a nightly export job that reaches everyone. */
|
|
239
|
+
ignoreActors?: readonly string[];
|
|
240
|
+
}): Promise<AccessReview>;
|
|
241
|
+
/**
|
|
242
|
+
* Delete entries older than `config.security.accessLogRetention` (default and minimum one year,
|
|
243
|
+
* Rule 6(1)(e)). Run it with the retention runner.
|
|
244
|
+
*/
|
|
245
|
+
prune(): Promise<{
|
|
246
|
+
deleted: number;
|
|
247
|
+
before: string;
|
|
248
|
+
}>;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Personal data breaches (Section 8(6), Rule 7): record one, find and tell the people affected,
|
|
252
|
+
* and track the Board's deadlines. Needs a store that keeps breaches: `memoryStore()`,
|
|
253
|
+
* `drizzleStore(db)`, or your own `BreachStore`.
|
|
254
|
+
*/
|
|
255
|
+
readonly breach: {
|
|
256
|
+
/** Record a breach. The 72-hour clock for the Board's detailed report starts at `awareAt` (default now). */
|
|
257
|
+
open(input: BreachInput): Promise<Breach>;
|
|
258
|
+
/** Fill in or correct details, e.g. consequences and safety steps once they're known. */
|
|
259
|
+
update(id: string, input: Partial<Omit<BreachInput, "awareAt">>): Promise<Breach>;
|
|
260
|
+
get(id: string): Promise<Breach | undefined>;
|
|
261
|
+
/** Breaches, newest first. */
|
|
262
|
+
list(filter?: {
|
|
263
|
+
status?: Breach["status"];
|
|
264
|
+
}): Promise<Breach[]>;
|
|
265
|
+
/** Deadlines and what's left to do. */
|
|
266
|
+
status(id: string): Promise<BreachStatus>;
|
|
267
|
+
/** Record people affected. People already recorded are left as they are. Returns how many were new. */
|
|
268
|
+
addAffected(id: string, subjectIds: readonly string[]): Promise<number>;
|
|
269
|
+
/**
|
|
270
|
+
* Record as affected everyone in the access log matching the filter, e.g. everyone a compromised
|
|
271
|
+
* account read: `{ actor: "support:ravi", from: "2027-06-01T00:00:00Z" }`. Returns how many were new.
|
|
272
|
+
*/
|
|
273
|
+
addAffectedFromAccessLog(id: string, filter: Omit<AccessFilter, "limit">): Promise<number>;
|
|
274
|
+
/** The notice to send each affected person, Rule 7(1)(a)–(e). `missing` lists parts still to fill in. */
|
|
275
|
+
notice(id: string): Promise<PersonNotice>;
|
|
276
|
+
/** People not yet told, oldest first. */
|
|
277
|
+
pending(id: string, limit?: number): Promise<BreachNotice[]>;
|
|
278
|
+
/** Record that these people were told. Returns how many changed. */
|
|
279
|
+
markNotified(id: string, subjectIds: readonly string[], input?: {
|
|
280
|
+
channel?: string;
|
|
281
|
+
at?: string;
|
|
282
|
+
}): Promise<number>;
|
|
283
|
+
/** Record that you told the Board, without delay (Rule 7(2)(a)). */
|
|
284
|
+
boardNotified(id: string, input?: {
|
|
285
|
+
at?: string;
|
|
286
|
+
}): Promise<Breach>;
|
|
287
|
+
/** Save parts (i)–(v) of the detailed report. */
|
|
288
|
+
updateReport(id: string, parts: BoardReportInput): Promise<Breach>;
|
|
289
|
+
/** The detailed report, Rule 7(2)(b)(i)–(vi). Part (vi) comes from the notice records. */
|
|
290
|
+
boardReport(id: string): Promise<BoardReport>;
|
|
291
|
+
/** Record that you sent the detailed report to the Board. */
|
|
292
|
+
reportSent(id: string, input?: {
|
|
293
|
+
at?: string;
|
|
294
|
+
}): Promise<Breach>;
|
|
295
|
+
/** Record a longer period the Board allowed on your written request (Rule 7(2)(b)). */
|
|
296
|
+
extend(id: string, input: {
|
|
297
|
+
until: string;
|
|
298
|
+
reference: string;
|
|
299
|
+
}): Promise<Breach>;
|
|
300
|
+
close(id: string, note?: string): Promise<Breach>;
|
|
301
|
+
};
|
|
92
302
|
readonly rights: {
|
|
93
303
|
/** Record a request (Sections 11–14). It's due after `config.rights.responseWithin` (default 90 days). */
|
|
94
304
|
open(subjectId: string, type: RequestType, details?: Record<string, unknown>): Promise<RightsRequest>;
|