@ultimat3/jobs 30.2.0 → 30.3.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/package.json +7 -7
- package/src/subject-plan.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/jobs",
|
|
3
|
-
"version": "30.
|
|
3
|
+
"version": "30.3.0",
|
|
4
4
|
"description": "Durable background work: steps, transactional outbox, cron tasks, one driver interface",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"test": "bun test"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@ultimat3/core": "30.
|
|
48
|
-
"@ultimat3/db": "30.
|
|
49
|
-
"@ultimat3/entity": "30.
|
|
50
|
-
"@ultimat3/http": "30.
|
|
51
|
-
"@ultimat3/schema": "30.
|
|
52
|
-
"@ultimat3/time": "30.
|
|
47
|
+
"@ultimat3/core": "30.3.0",
|
|
48
|
+
"@ultimat3/db": "30.3.0",
|
|
49
|
+
"@ultimat3/entity": "30.3.0",
|
|
50
|
+
"@ultimat3/http": "30.3.0",
|
|
51
|
+
"@ultimat3/schema": "30.3.0",
|
|
52
|
+
"@ultimat3/time": "30.3.0"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/src/subject-plan.ts
CHANGED
|
@@ -107,6 +107,9 @@ function inboundEdges(input: SubjectPlanInput, byName: ReadonlyMap<string, Regis
|
|
|
107
107
|
return inbound;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
const isAnonymize = (treatment: SubjectTreatment): boolean =>
|
|
111
|
+
typeof treatment === 'object' && treatment !== null && 'anonymize' in treatment;
|
|
112
|
+
|
|
110
113
|
/** What is wrong with one declared treatment on its own, before any reach is considered. */
|
|
111
114
|
function treatmentProblems(
|
|
112
115
|
subject: string,
|
|
@@ -118,6 +121,11 @@ function treatmentProblems(
|
|
|
118
121
|
new SubjectTreatmentInvalidError({ subject, table, field, reason });
|
|
119
122
|
if (entry === undefined) return [invalid(table, 'names no registered entity')];
|
|
120
123
|
const d = entry.describe();
|
|
124
|
+
// Nothing the app writes reaches a readOnly table: only `retain` can be true of one.
|
|
125
|
+
if (d.readOnly !== undefined && (treatment === 'delete' || isAnonymize(treatment))) {
|
|
126
|
+
const field = treatment === 'delete' ? "'delete'" : 'anonymize';
|
|
127
|
+
return [invalid(field, `is refused: the entity is readOnly (${d.readOnly})`)];
|
|
128
|
+
}
|
|
121
129
|
if (treatment === 'delete') {
|
|
122
130
|
if (d.appendOnly === true) {
|
|
123
131
|
return [invalid("'delete'", 'is refused: the entity is append-only')];
|