@ddd-ts-kit/kernel 0.96.0 → 0.98.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.
|
@@ -13,6 +13,8 @@ export interface PersonalFields<Row, Table = unknown> {
|
|
|
13
13
|
readonly files: readonly (keyof Row & string)[];
|
|
14
14
|
/** How long the rows keep it, counted from a date column: past that, the purge erases them as `erasure` says. Absent: kept until the person asks. */
|
|
15
15
|
readonly retention?: Retention<Row>;
|
|
16
|
+
/** The key of the configuration that gives the retention, when the project reads it at run time: the register names it. Never with `retention`. */
|
|
17
|
+
readonly configuredRetention?: string;
|
|
16
18
|
}
|
|
17
19
|
export interface PersonalFieldsOptions<Row> {
|
|
18
20
|
readonly subject: keyof Row & string;
|
|
@@ -20,6 +22,12 @@ export interface PersonalFieldsOptions<Row> {
|
|
|
20
22
|
readonly erasure: ErasureMode;
|
|
21
23
|
readonly files?: readonly (keyof Row & string)[];
|
|
22
24
|
readonly retention?: Retention<Row>;
|
|
25
|
+
/**
|
|
26
|
+
* For a retention the project reads from configuration and purges by itself: the name of the
|
|
27
|
+
* variable or key (`'RETENTION_PERIODS'`). The generated register then says "configured by" it,
|
|
28
|
+
* instead of "until erased". The kit's own purge runs only from a literal `retention`.
|
|
29
|
+
*/
|
|
30
|
+
readonly configuredRetention?: string;
|
|
23
31
|
}
|
|
24
32
|
/**
|
|
25
33
|
* Declares, next to the mapper of a table, which of its columns are personal and whose they are:
|
|
@@ -30,5 +38,5 @@ export interface PersonalFieldsOptions<Row> {
|
|
|
30
38
|
* personal, since an identifier that is personal data (an email) cannot name a data subject, and a
|
|
31
39
|
* retention that is not one positive unit or that runs from a personal column.
|
|
32
40
|
*/
|
|
33
|
-
export declare function personalFields<Row, Table = unknown>(table: Table, { subject, fields, erasure, files, retention }: PersonalFieldsOptions<Row>): PersonalFields<Row, Table>;
|
|
41
|
+
export declare function personalFields<Row, Table = unknown>(table: Table, { subject, fields, erasure, files, retention, configuredRetention }: PersonalFieldsOptions<Row>): PersonalFields<Row, Table>;
|
|
34
42
|
//# sourceMappingURL=personal-fields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personal-fields.d.ts","sourceRoot":"","sources":["../../../src/application/personal-data/personal-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,mHAAmH;AACnH,MAAM,WAAW,cAAc,CAAC,GAAG,EAAE,KAAK,GAAG,OAAO;IAClD,0GAA0G;IAC1G,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,+GAA+G;IAC/G,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC;IACrC,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;IACjD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,6IAA6I;IAC7I,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;IAChD,qJAAqJ;IACrJ,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"personal-fields.d.ts","sourceRoot":"","sources":["../../../src/application/personal-data/personal-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,mHAAmH;AACnH,MAAM,WAAW,cAAc,CAAC,GAAG,EAAE,KAAK,GAAG,OAAO;IAClD,0GAA0G;IAC1G,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,+GAA+G;IAC/G,QAAQ,CAAC,OAAO,EA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
|
|
|
9
9
|
* personal, since an identifier that is personal data (an email) cannot name a data subject, and a
|
|
10
10
|
* retention that is not one positive unit or that runs from a personal column.
|
|
11
11
|
*/
|
|
12
|
-
export function personalFields(table, { subject, fields, erasure, files = [], retention }) {
|
|
12
|
+
export function personalFields(table, { subject, fields, erasure, files = [], retention, configuredRetention }) {
|
|
13
13
|
const personal = [...fields, ...files];
|
|
14
14
|
if (fields.length === 0) {
|
|
15
15
|
throw new InvalidPersonalFieldsError('names no personal field');
|
|
@@ -23,6 +23,20 @@ export function personalFields(table, { subject, fields, erasure, files = [], re
|
|
|
23
23
|
if (retention !== undefined) {
|
|
24
24
|
assertRetention(retention, personal);
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
assertConfiguredRetention(configuredRetention, retention);
|
|
27
|
+
return {
|
|
28
|
+
table,
|
|
29
|
+
subject,
|
|
30
|
+
fields,
|
|
31
|
+
erasure,
|
|
32
|
+
files,
|
|
33
|
+
...(retention === undefined ? {} : { retention }),
|
|
34
|
+
...(configuredRetention === undefined ? {} : { configuredRetention }),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function assertConfiguredRetention(configuredRetention, retention) {
|
|
38
|
+
if (configuredRetention !== undefined && (retention !== undefined || configuredRetention.trim() === '')) {
|
|
39
|
+
throw new InvalidPersonalFieldsError('gives a retention and a configuration key for it: a literal retention, or the key of the configuration, not both and not empty');
|
|
40
|
+
}
|
|
27
41
|
}
|
|
28
42
|
//# sourceMappingURL=personal-fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personal-fields.js","sourceRoot":"","sources":["../../../src/application/personal-data/personal-fields.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"personal-fields.js","sourceRoot":"","sources":["../../../src/application/personal-data/personal-fields.ts"],"names":[],"m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yB,CAAC,mBAAuC,EAAE,SAAkB;IAC5F,IAAI,mBAAmB,KAAK,SAAS,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,mBAAmB,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACxG,MAAM,IAAI,0BAA0B,CAClC,gIAAgI,CACjI,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts-kit/kernel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.98.0",
|
|
4
4
|
"description": "Framework-agnostic Domain-Driven Design (DDD) building blocks for TypeScript: aggregates, entities, value objects, domain events, CQRS command and query buses, unit of work and application ports, with an in-memory event bus.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ddd",
|