@xemahq/biome-database-nest 6.0.1 → 7.1.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/README.md +36 -0
- package/dist/bin/xema-org-erasure-graph.d.ts +3 -0
- package/dist/bin/xema-org-erasure-graph.d.ts.map +1 -0
- package/dist/bin/xema-org-erasure-graph.js +10 -0
- package/dist/bin/xema-org-erasure-graph.js.map +1 -0
- package/dist/index.d.ts +12 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/biome-migrations.d.ts.map +1 -1
- package/dist/lib/biome-migrations.js.map +1 -1
- package/dist/lib/nest/org-erasure.module.d.ts +1 -2
- package/dist/lib/nest/org-erasure.module.d.ts.map +1 -1
- package/dist/lib/nest/org-erasure.module.js +8 -10
- package/dist/lib/nest/org-erasure.module.js.map +1 -1
- package/dist/lib/nest/prisma-service-factory.d.ts +8 -2
- package/dist/lib/nest/prisma-service-factory.d.ts.map +1 -1
- package/dist/lib/nest/prisma-service-factory.js +18 -20
- package/dist/lib/nest/prisma-service-factory.js.map +1 -1
- package/dist/lib/org-erasure-coverage/build-org-erasure-graph.d.ts +4 -0
- package/dist/lib/org-erasure-coverage/build-org-erasure-graph.d.ts.map +1 -0
- package/dist/lib/org-erasure-coverage/build-org-erasure-graph.js +37 -0
- package/dist/lib/org-erasure-coverage/build-org-erasure-graph.js.map +1 -0
- package/dist/lib/org-erasure-coverage/check-org-erasure-graph.d.ts +4 -0
- package/dist/lib/org-erasure-coverage/check-org-erasure-graph.d.ts.map +1 -0
- package/dist/lib/org-erasure-coverage/check-org-erasure-graph.js +40 -0
- package/dist/lib/org-erasure-coverage/check-org-erasure-graph.js.map +1 -0
- package/dist/lib/org-erasure-coverage/classify-org-erasure-coverage.d.ts +5 -0
- package/dist/lib/org-erasure-coverage/classify-org-erasure-coverage.d.ts.map +1 -0
- package/dist/lib/org-erasure-coverage/classify-org-erasure-coverage.js +94 -0
- package/dist/lib/org-erasure-coverage/classify-org-erasure-coverage.js.map +1 -0
- package/dist/lib/org-erasure-coverage/generate-org-erasure-graph.d.ts +15 -0
- package/dist/lib/org-erasure-coverage/generate-org-erasure-graph.d.ts.map +1 -0
- package/dist/lib/org-erasure-coverage/generate-org-erasure-graph.js +19 -0
- package/dist/lib/org-erasure-coverage/generate-org-erasure-graph.js.map +1 -0
- package/dist/lib/org-erasure-coverage/org-erasure-coverage-errors.d.ts +22 -0
- package/dist/lib/org-erasure-coverage/org-erasure-coverage-errors.d.ts.map +1 -0
- package/dist/lib/org-erasure-coverage/org-erasure-coverage-errors.js +53 -0
- package/dist/lib/org-erasure-coverage/org-erasure-coverage-errors.js.map +1 -0
- package/dist/lib/org-erasure-coverage/org-erasure-coverage-options.d.ts +12 -0
- package/dist/lib/org-erasure-coverage/org-erasure-coverage-options.d.ts.map +1 -0
- package/dist/lib/org-erasure-coverage/org-erasure-coverage-options.js +3 -0
- package/dist/lib/org-erasure-coverage/org-erasure-coverage-options.js.map +1 -0
- package/dist/lib/org-erasure-coverage/org-erasure-coverage.d.ts +11 -0
- package/dist/lib/org-erasure-coverage/org-erasure-coverage.d.ts.map +1 -0
- package/dist/lib/org-erasure-coverage/org-erasure-coverage.js +3 -0
- package/dist/lib/org-erasure-coverage/org-erasure-coverage.js.map +1 -0
- package/dist/lib/org-erasure-coverage/org-erasure-disposition.d.ts +11 -0
- package/dist/lib/org-erasure-coverage/org-erasure-disposition.d.ts.map +1 -0
- package/dist/lib/org-erasure-coverage/org-erasure-disposition.js +10 -0
- package/dist/lib/org-erasure-coverage/org-erasure-disposition.js.map +1 -0
- package/dist/lib/org-erasure-coverage/org-erasure-dmmf.d.ts +14 -0
- package/dist/lib/org-erasure-coverage/org-erasure-dmmf.d.ts.map +1 -0
- package/dist/lib/org-erasure-coverage/org-erasure-dmmf.js +3 -0
- package/dist/lib/org-erasure-coverage/org-erasure-dmmf.js.map +1 -0
- package/dist/lib/org-erasure-coverage/org-erasure-graph.d.ts +12 -0
- package/dist/lib/org-erasure-coverage/org-erasure-graph.d.ts.map +1 -0
- package/dist/lib/org-erasure-coverage/org-erasure-graph.js +3 -0
- package/dist/lib/org-erasure-coverage/org-erasure-graph.js.map +1 -0
- package/dist/lib/org-erasure-coverage/render-org-erasure-graph-module.d.ts +7 -0
- package/dist/lib/org-erasure-coverage/render-org-erasure-graph-module.d.ts.map +1 -0
- package/dist/lib/org-erasure-coverage/render-org-erasure-graph-module.js +13 -0
- package/dist/lib/org-erasure-coverage/render-org-erasure-graph-module.js.map +1 -0
- package/dist/lib/org-erasure-coverage/resolve-org-erasure-api.d.ts +12 -0
- package/dist/lib/org-erasure-coverage/resolve-org-erasure-api.d.ts.map +1 -0
- package/dist/lib/org-erasure-coverage/resolve-org-erasure-api.js +33 -0
- package/dist/lib/org-erasure-coverage/resolve-org-erasure-api.js.map +1 -0
- package/dist/lib/sdk-owned-errors.d.ts.map +1 -1
- package/dist/lib/sdk-owned-errors.js +3 -1
- package/dist/lib/sdk-owned-errors.js.map +1 -1
- package/dist/lib/sdk-owned-migration-set.d.ts +8 -0
- package/dist/lib/sdk-owned-migration-set.d.ts.map +1 -1
- package/dist/lib/sdk-owned-migration-set.js +27 -0
- package/dist/lib/sdk-owned-migration-set.js.map +1 -1
- package/dist/lib/sdk-owned-migrations.d.ts.map +1 -1
- package/dist/lib/sdk-owned-migrations.js +8 -5
- package/dist/lib/sdk-owned-migrations.js.map +1 -1
- package/dist/lib/sdk-owned-prior-creators.d.ts +5 -0
- package/dist/lib/sdk-owned-prior-creators.d.ts.map +1 -0
- package/dist/lib/sdk-owned-prior-creators.js +71 -0
- package/dist/lib/sdk-owned-prior-creators.js.map +1 -0
- package/dist/lib/tenant-isolation/tenant-isolation.extension.d.ts +4 -0
- package/dist/lib/tenant-isolation/tenant-isolation.extension.d.ts.map +1 -1
- package/dist/lib/tenant-isolation/tenant-isolation.extension.js +12 -5
- package/dist/lib/tenant-isolation/tenant-isolation.extension.js.map +1 -1
- package/dist/lib/tenant-isolation/unscoped-models.d.ts +0 -2
- package/dist/lib/tenant-isolation/unscoped-models.d.ts.map +1 -1
- package/dist/lib/tenant-isolation/unscoped-models.js +0 -3
- package/dist/lib/tenant-isolation/unscoped-models.js.map +1 -1
- package/package.json +9 -5
- package/xema-peer-facts.json +6 -6
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classifyOrgErasureCoverage = classifyOrgErasureCoverage;
|
|
4
|
+
const check_org_erasure_graph_1 = require("./check-org-erasure-graph");
|
|
5
|
+
const org_erasure_coverage_errors_1 = require("./org-erasure-coverage-errors");
|
|
6
|
+
const org_erasure_disposition_1 = require("./org-erasure-disposition");
|
|
7
|
+
const org_erasure_1 = require("../tenant-isolation/org-erasure");
|
|
8
|
+
const tenant_isolation_extension_1 = require("../tenant-isolation/tenant-isolation.extension");
|
|
9
|
+
const DISPOSITIONS = Object.values(org_erasure_disposition_1.OrgErasureDisposition);
|
|
10
|
+
function findReachable(graph, swept) {
|
|
11
|
+
const reachable = {};
|
|
12
|
+
const names = Object.keys(graph.models).sort();
|
|
13
|
+
let changed = true;
|
|
14
|
+
while (changed) {
|
|
15
|
+
changed = false;
|
|
16
|
+
for (const name of names) {
|
|
17
|
+
if (swept.has(name) || name in reachable) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const edge = graph.models[name].cascadeParents.find((e) => swept.has(e.parentModel) || e.parentModel in reachable);
|
|
21
|
+
if (edge !== undefined) {
|
|
22
|
+
reachable[name] = edge.parentModel;
|
|
23
|
+
changed = true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return reachable;
|
|
28
|
+
}
|
|
29
|
+
function classifyOrgErasureCoverage(runtime, options) {
|
|
30
|
+
(0, check_org_erasure_graph_1.assertOrgErasureGraphMatchesRuntime)(options.graph, runtime);
|
|
31
|
+
const modelNames = Object.keys(runtime).sort();
|
|
32
|
+
const sweep = options.sweep === undefined
|
|
33
|
+
? undefined
|
|
34
|
+
: {
|
|
35
|
+
orgField: options.sweep.orgField ?? tenant_isolation_extension_1.DEFAULT_ORG_FIELD,
|
|
36
|
+
exemptModels: options.sweep.exemptModels ?? [],
|
|
37
|
+
};
|
|
38
|
+
const unknownExemptModels = sweep === undefined
|
|
39
|
+
? []
|
|
40
|
+
: [...(0, tenant_isolation_extension_1.findUnknownModels)(runtime, sweep.exemptModels)].sort();
|
|
41
|
+
const swept = sweep === undefined
|
|
42
|
+
? new Set()
|
|
43
|
+
: (0, tenant_isolation_extension_1.selectOrgScopedModels)(runtime, sweep.orgField, sweep.exemptModels);
|
|
44
|
+
if (sweep !== undefined && swept.size === 0) {
|
|
45
|
+
throw new org_erasure_1.OrgErasureMatchesNothingError(sweep.orgField, modelNames, sweep.exemptModels);
|
|
46
|
+
}
|
|
47
|
+
const reachable = findReachable(options.graph, swept);
|
|
48
|
+
const declarations = options.declarations ?? {};
|
|
49
|
+
const unknownDeclarations = [];
|
|
50
|
+
const blankReasons = [];
|
|
51
|
+
const invalidDispositions = [];
|
|
52
|
+
const declaredButErased = [];
|
|
53
|
+
const declared = {};
|
|
54
|
+
for (const [name, declaration] of Object.entries(declarations).sort(([a], [b]) => (a < b ? -1 : 1))) {
|
|
55
|
+
if (!(name in runtime)) {
|
|
56
|
+
unknownDeclarations.push(name);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (declaration.reason.trim().length === 0) {
|
|
60
|
+
blankReasons.push(name);
|
|
61
|
+
}
|
|
62
|
+
if (!DISPOSITIONS.includes(declaration.disposition)) {
|
|
63
|
+
invalidDispositions.push(name);
|
|
64
|
+
}
|
|
65
|
+
if (swept.has(name) || name in reachable) {
|
|
66
|
+
declaredButErased.push(name);
|
|
67
|
+
}
|
|
68
|
+
declared[name] = declaration;
|
|
69
|
+
}
|
|
70
|
+
const unaccounted = modelNames.filter((name) => !swept.has(name) && !(name in reachable) && !(name in declared));
|
|
71
|
+
if (unaccounted.length +
|
|
72
|
+
unknownDeclarations.length +
|
|
73
|
+
blankReasons.length +
|
|
74
|
+
invalidDispositions.length +
|
|
75
|
+
declaredButErased.length +
|
|
76
|
+
unknownExemptModels.length >
|
|
77
|
+
0) {
|
|
78
|
+
throw new org_erasure_coverage_errors_1.OrgErasureCoverageError({
|
|
79
|
+
unaccounted,
|
|
80
|
+
unknownDeclarations,
|
|
81
|
+
blankReasons,
|
|
82
|
+
invalidDispositions,
|
|
83
|
+
declaredButErased,
|
|
84
|
+
unknownExemptModels,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
sweep,
|
|
89
|
+
swept: [...swept].sort(),
|
|
90
|
+
reachable,
|
|
91
|
+
declared,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=classify-org-erasure-coverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify-org-erasure-coverage.js","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/classify-org-erasure-coverage.ts"],"names":[],"mappings":";;AAoDA,gEAsFC;AA1ID,uEAAgF;AAChF,+EAAwE;AACxE,uEAAkE;AAClE,iEAAgF;AAChF,+FAKwD;AAOxD,MAAM,YAAY,GAAsB,MAAM,CAAC,MAAM,CAAC,+CAAqB,CAAC,CAAC;AAO7E,SAAS,aAAa,CACpB,KAAsB,EACtB,KAA0B;IAE1B,MAAM,SAAS,GAA2B,EAAE,CAAC;IAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,OAAO,OAAO,EAAE,CAAC;QACf,OAAO,GAAG,KAAK,CAAC;QAChB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,KAAK,CAAC,GAAG,C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CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,SAAS,EAAE,CAAC;YACzC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC;IAC/B,CAAC;IAED,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CACnC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,QAAQ,CAAC,CAC1E,CAAC;IAEF,IACE,WAAW,CAAC,MAAM;QAChB,mBAAmB,CAAC,MAAM;QAC1B,YAAY,CAAC,MAAM;QACnB,mBAAmB,CAAC,MAAM;QAC1B,iBAAiB,CAAC,MAAM;QACxB,mBAAmB,CAAC,MAAM;QAC5B,CAAC,EACD,CAAC;QACD,MAAM,IAAI,qDAAuB,CAAC;YAChC,WAAW;YACX,mBAAmB;YACnB,YAAY;YACZ,mBAAmB;YACnB,iBAAiB;YACjB,mBAAmB;SACpB,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,KAAK;QACL,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE;QACxB,SAAS;QACT,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { OrgErasureDmmfModel } from './org-erasure-dmmf';
|
|
2
|
+
export interface OrgErasureGraphGeneratorOptions {
|
|
3
|
+
readonly generator: {
|
|
4
|
+
readonly output: {
|
|
5
|
+
readonly value: string | null;
|
|
6
|
+
} | null;
|
|
7
|
+
};
|
|
8
|
+
readonly dmmf: {
|
|
9
|
+
readonly datamodel: {
|
|
10
|
+
readonly models: readonly OrgErasureDmmfModel[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare function generateOrgErasureGraph(options: OrgErasureGraphGeneratorOptions): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=generate-org-erasure-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-org-erasure-graph.d.ts","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/generate-org-erasure-graph.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAiB9D,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,SAAS,EAAE;QAClB,QAAQ,CAAC,MAAM,EAAE;YAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,GAAG,IAAI,CAAC;KAC3D,CAAC;IACF,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,SAAS,EAAE;YAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAA;SAAE,CAAC;KACzE,CAAC;CACH;AAGD,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,IAAI,CAAC,CAcf"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateOrgErasureGraph = generateOrgErasureGraph;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const build_org_erasure_graph_1 = require("./build-org-erasure-graph");
|
|
7
|
+
const render_org_erasure_graph_module_1 = require("./render-org-erasure-graph-module");
|
|
8
|
+
async function generateOrgErasureGraph(options) {
|
|
9
|
+
const output = options.generator.output?.value;
|
|
10
|
+
if (output === null || output === undefined || output === '') {
|
|
11
|
+
throw new Error('[xema-org-erasure-graph] the generator block must set `output`, e.g. ' +
|
|
12
|
+
'output = "../node_modules/.prisma/<service>-org-erasure-graph".');
|
|
13
|
+
}
|
|
14
|
+
const { js, dts } = (0, render_org_erasure_graph_module_1.renderOrgErasureGraphModule)((0, build_org_erasure_graph_1.buildOrgErasureGraph)(options.dmmf.datamodel.models));
|
|
15
|
+
await (0, promises_1.mkdir)(output, { recursive: true });
|
|
16
|
+
await (0, promises_1.writeFile)((0, node_path_1.join)(output, 'index.js'), js);
|
|
17
|
+
await (0, promises_1.writeFile)((0, node_path_1.join)(output, 'index.d.ts'), dts);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=generate-org-erasure-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-org-erasure-graph.js","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/generate-org-erasure-graph.ts"],"names":[],"mappings":";;AAiCA,0DAgBC;AAjDD,+CAAoD;AACpD,yCAAiC;AAEjC,uEAAiE;AACjE,uFAAgF;AA6BzE,KAAK,UAAU,uBAAuB,CAC3C,OAAwC;IAExC,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC;IAC/C,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;QAC7D,MAAM,IAAI,KAAK,CACb,uEAAuE;YACrE,iEAAiE,CACpE,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,IAAA,6DAA2B,EAC7C,IAAA,8CAAoB,EAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CACpD,CAAC;IACF,MAAM,IAAA,gBAAK,EAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzC,MAAM,IAAA,oBAAS,EAAC,IAAA,gBAAI,EAAC,MAAM,EAAE,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,MAAM,IAAA,oBAAS,EAAC,IAAA,gBAAI,EAAC,MAAM,EAAE,YAAY,CAAC,EAAE,GAAG,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare class OrgErasureGraphMismatchError extends Error {
|
|
2
|
+
readonly problems: readonly string[];
|
|
3
|
+
constructor(problems: readonly string[]);
|
|
4
|
+
}
|
|
5
|
+
export interface OrgErasureCoverageProblems {
|
|
6
|
+
readonly unaccounted: readonly string[];
|
|
7
|
+
readonly unknownDeclarations: readonly string[];
|
|
8
|
+
readonly blankReasons: readonly string[];
|
|
9
|
+
readonly invalidDispositions: readonly string[];
|
|
10
|
+
readonly declaredButErased: readonly string[];
|
|
11
|
+
readonly unknownExemptModels: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
export declare class OrgErasureCoverageError extends Error implements OrgErasureCoverageProblems {
|
|
14
|
+
readonly unaccounted: readonly string[];
|
|
15
|
+
readonly unknownDeclarations: readonly string[];
|
|
16
|
+
readonly blankReasons: readonly string[];
|
|
17
|
+
readonly invalidDispositions: readonly string[];
|
|
18
|
+
readonly declaredButErased: readonly string[];
|
|
19
|
+
readonly unknownExemptModels: readonly string[];
|
|
20
|
+
constructor(problems: OrgErasureCoverageProblems);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=org-erasure-coverage-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-erasure-coverage-errors.d.ts","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/org-erasure-coverage-errors.ts"],"names":[],"mappings":"AAAA,qBAAa,4BAA6B,SAAQ,KAAK;IACzC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE;gBAA3B,QAAQ,EAAE,SAAS,MAAM,EAAE;CAUjD;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;CACjD;AAYD,qBAAa,uBACX,SAAQ,KACR,YAAW,0BAA0B;IAErC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;gBAEpC,QAAQ,EAAE,0BAA0B;CAuCjD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrgErasureCoverageError = exports.OrgErasureGraphMismatchError = void 0;
|
|
4
|
+
class OrgErasureGraphMismatchError extends Error {
|
|
5
|
+
problems;
|
|
6
|
+
constructor(problems) {
|
|
7
|
+
super('[org-erasure] REFUSING TO START - the org-erasure graph does not match ' +
|
|
8
|
+
'the Prisma client. Run `prisma generate` with the ' +
|
|
9
|
+
'`xema-org-erasure-graph` generator so the graph is rebuilt from the ' +
|
|
10
|
+
'current schema:\n' +
|
|
11
|
+
problems.map((p) => ` - ${p}`).join('\n'));
|
|
12
|
+
this.problems = problems;
|
|
13
|
+
this.name = 'OrgErasureGraphMismatchError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.OrgErasureGraphMismatchError = OrgErasureGraphMismatchError;
|
|
17
|
+
function section(title, names) {
|
|
18
|
+
return names.length === 0
|
|
19
|
+
? []
|
|
20
|
+
: [` ${title} (${names.length}):`, ` ${names.join(', ')}`];
|
|
21
|
+
}
|
|
22
|
+
class OrgErasureCoverageError extends Error {
|
|
23
|
+
unaccounted;
|
|
24
|
+
unknownDeclarations;
|
|
25
|
+
blankReasons;
|
|
26
|
+
invalidDispositions;
|
|
27
|
+
declaredButErased;
|
|
28
|
+
unknownExemptModels;
|
|
29
|
+
constructor(problems) {
|
|
30
|
+
super([
|
|
31
|
+
'[org-erasure] REFUSING TO START - personal data could be silently ' +
|
|
32
|
+
'left unerased.',
|
|
33
|
+
...section('models neither swept by the org-data erasure, cascade-deleted from a swept model, nor declared', problems.unaccounted),
|
|
34
|
+
...section('orgErasure.declarations name models that do not exist', problems.unknownDeclarations),
|
|
35
|
+
...section('declarations with a blank reason', problems.blankReasons),
|
|
36
|
+
...section('declarations with a disposition outside OrgErasureDisposition', problems.invalidDispositions),
|
|
37
|
+
...section('declared models that ARE erased (swept or cascade-deleted); remove the declaration', problems.declaredButErased),
|
|
38
|
+
...section('orgErasure.sweep.exemptModels name models that do not exist', problems.unknownExemptModels),
|
|
39
|
+
' Fix: declare each unaccounted model in orgErasure.declarations:',
|
|
40
|
+
" { Foo: { disposition: OrgErasureDisposition.NotPersonalData, reason: '...' } }",
|
|
41
|
+
' (NotPersonalData | Retained | ErasedByServiceEraser), or give it the org column / a required ON DELETE CASCADE relation to a swept model.',
|
|
42
|
+
].join('\n'));
|
|
43
|
+
this.name = 'OrgErasureCoverageError';
|
|
44
|
+
this.unaccounted = problems.unaccounted;
|
|
45
|
+
this.unknownDeclarations = problems.unknownDeclarations;
|
|
46
|
+
this.blankReasons = problems.blankReasons;
|
|
47
|
+
this.invalidDispositions = problems.invalidDispositions;
|
|
48
|
+
this.declaredButErased = problems.declaredButErased;
|
|
49
|
+
this.unknownExemptModels = problems.unknownExemptModels;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.OrgErasureCoverageError = OrgErasureCoverageError;
|
|
53
|
+
//# sourceMappingURL=org-erasure-coverage-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-erasure-coverage-errors.js","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/org-erasure-coverage-errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,4BAA6B,SAAQ,KAAK;IAChC;IAArB,YAAqB,QAA2B;QAC9C,KAAK,CACH,yEAAyE;YACvE,oDAAoD;YACpD,sEAAsE;YACtE,mBAAmB;YACnB,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAC7C,CAAC;QAPiB,aAAQ,GAAR,QAAQ,CAAmB;QAQ9C,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;IAC7C,CAAC;CACF;AAXD,oEAWC;AAWD,SAAS,OAAO,CAAC,KAAa,EAAE,KAAwB;IACtD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;QACvB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,CAAC,MAAM,IAAI,EAAE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnE,CAAC;AAMD,MAAa,uBACX,SAAQ,KAAK;IAGJ,WAAW,CAAoB;IAC/B,mBAAmB,CAAoB;IACvC,YAAY,CAAoB;IAChC,mBAAmB,CAAoB;IACvC,iBAAiB,CAAoB;IACrC,mBAAmB,CAAoB;IAEhD,YAAY,QAAoC;QAC9C,KAAK,CACH;YACE,oEAAoE;gBAClE,gBAAgB;YAClB,GAAG,OAAO,CACR,gGAAgG,EAChG,QAAQ,CAAC,WAAW,CACrB;YACD,GAAG,OAAO,CACR,uDAAuD,EACvD,QAAQ,CAAC,mBAAmB,CAC7B;YACD,GAAG,OAAO,CAAC,kCAAkC,EAAE,QAAQ,CAAC,YAAY,CAAC;YACrE,GAAG,OAAO,CACR,+DAA+D,EAC/D,QAAQ,CAAC,mBAAmB,CAC7B;YACD,GAAG,OAAO,CACR,oFAAoF,EACpF,QAAQ,CAAC,iBAAiB,CAC3B;YACD,GAAG,OAAO,CACR,6DAA6D,EAC7D,QAAQ,CAAC,mBAAmB,CAC7B;YACD,mEAAmE;YACnE,oFAAoF;YACpF,6IAA6I;SAC9I,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QACxC,IAAI,CAAC,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;QACxD,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;QAC1C,IAAI,CAAC,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;QACxD,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC;QACpD,IAAI,CAAC,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;IAC1D,CAAC;CACF;AAlDD,0DAkDC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OrgErasureDeclarations } from './org-erasure-disposition';
|
|
2
|
+
import type { OrgErasureGraph } from './org-erasure-graph';
|
|
3
|
+
export interface OrgErasureSweep {
|
|
4
|
+
readonly orgField?: string;
|
|
5
|
+
readonly exemptModels?: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
export interface OrgErasureCoverageOptions {
|
|
8
|
+
readonly graph: OrgErasureGraph;
|
|
9
|
+
readonly sweep?: OrgErasureSweep;
|
|
10
|
+
readonly declarations?: OrgErasureDeclarations;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=org-erasure-coverage-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-erasure-coverage-options.d.ts","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/org-erasure-coverage-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,WAAW,eAAe;IAE9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAK3B,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAOD,MAAM,WAAW,yBAAyB;IAExC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAEhC,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,YAAY,CAAC,EAAE,sBAAsB,CAAC;CAChD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-erasure-coverage-options.js","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/org-erasure-coverage-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OrgErasureDeclaration } from './org-erasure-disposition';
|
|
2
|
+
export interface OrgErasureCoverage {
|
|
3
|
+
readonly sweep: {
|
|
4
|
+
readonly orgField: string;
|
|
5
|
+
readonly exemptModels: readonly string[];
|
|
6
|
+
} | undefined;
|
|
7
|
+
readonly swept: readonly string[];
|
|
8
|
+
readonly reachable: Readonly<Record<string, string>>;
|
|
9
|
+
readonly declared: Readonly<Record<string, OrgErasureDeclaration>>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=org-erasure-coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-erasure-coverage.d.ts","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/org-erasure-coverage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EACV;QACE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;KAC1C,GACD,SAAS,CAAC;IAEd,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAElC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;CACpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-erasure-coverage.js","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/org-erasure-coverage.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum OrgErasureDisposition {
|
|
2
|
+
NotPersonalData = "not-personal-data",
|
|
3
|
+
Retained = "retained",
|
|
4
|
+
ErasedByServiceEraser = "erased-by-service-eraser"
|
|
5
|
+
}
|
|
6
|
+
export interface OrgErasureDeclaration {
|
|
7
|
+
readonly disposition: OrgErasureDisposition;
|
|
8
|
+
readonly reason: string;
|
|
9
|
+
}
|
|
10
|
+
export type OrgErasureDeclarations = Readonly<Record<string, OrgErasureDeclaration>>;
|
|
11
|
+
//# sourceMappingURL=org-erasure-disposition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-erasure-disposition.d.ts","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/org-erasure-disposition.ts"],"names":[],"mappings":"AAKA,oBAAY,qBAAqB;IAE/B,eAAe,sBAAsB;IAErC,QAAQ,aAAa;IAErB,qBAAqB,6BAA6B;CACnD;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAC;IAE5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAGD,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAC3C,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CACtC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrgErasureDisposition = void 0;
|
|
4
|
+
var OrgErasureDisposition;
|
|
5
|
+
(function (OrgErasureDisposition) {
|
|
6
|
+
OrgErasureDisposition["NotPersonalData"] = "not-personal-data";
|
|
7
|
+
OrgErasureDisposition["Retained"] = "retained";
|
|
8
|
+
OrgErasureDisposition["ErasedByServiceEraser"] = "erased-by-service-eraser";
|
|
9
|
+
})(OrgErasureDisposition || (exports.OrgErasureDisposition = OrgErasureDisposition = {}));
|
|
10
|
+
//# sourceMappingURL=org-erasure-disposition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-erasure-disposition.js","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/org-erasure-disposition.ts"],"names":[],"mappings":";;;AAKA,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAE/B,8DAAqC,CAAA;IAErC,8CAAqB,CAAA;IAErB,2EAAkD,CAAA;AACpD,CAAC,EAPW,qBAAqB,qCAArB,qBAAqB,QAOhC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface OrgErasureDmmfField {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly kind: string;
|
|
4
|
+
readonly isList: boolean;
|
|
5
|
+
readonly isRequired: boolean;
|
|
6
|
+
readonly type: string;
|
|
7
|
+
readonly relationFromFields?: readonly string[];
|
|
8
|
+
readonly relationOnDelete?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface OrgErasureDmmfModel {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly fields: readonly OrgErasureDmmfField[];
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=org-erasure-dmmf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-erasure-dmmf.d.ts","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/org-erasure-dmmf.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC;CACjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-erasure-dmmf.js","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/org-erasure-dmmf.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface OrgErasureCascadeEdge {
|
|
2
|
+
readonly relationField: string;
|
|
3
|
+
readonly parentModel: string;
|
|
4
|
+
}
|
|
5
|
+
export interface OrgErasureGraphModel {
|
|
6
|
+
readonly fields: readonly string[];
|
|
7
|
+
readonly cascadeParents: readonly OrgErasureCascadeEdge[];
|
|
8
|
+
}
|
|
9
|
+
export interface OrgErasureGraph {
|
|
10
|
+
readonly models: Readonly<Record<string, OrgErasureGraphModel>>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=org-erasure-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-erasure-graph.d.ts","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/org-erasure-graph.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IAEnC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAEnC,QAAQ,CAAC,cAAc,EAAE,SAAS,qBAAqB,EAAE,CAAC;CAC3D;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;CACjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-erasure-graph.js","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/org-erasure-graph.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OrgErasureGraph } from './org-erasure-graph';
|
|
2
|
+
export interface RenderedOrgErasureGraphModule {
|
|
3
|
+
readonly js: string;
|
|
4
|
+
readonly dts: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function renderOrgErasureGraphModule(graph: OrgErasureGraph): RenderedOrgErasureGraphModule;
|
|
7
|
+
//# sourceMappingURL=render-org-erasure-graph-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-org-erasure-graph-module.d.ts","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/render-org-erasure-graph-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,WAAW,6BAA6B;IAE5C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAGD,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,eAAe,GACrB,6BAA6B,CAU/B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderOrgErasureGraphModule = renderOrgErasureGraphModule;
|
|
4
|
+
function renderOrgErasureGraphModule(graph) {
|
|
5
|
+
return {
|
|
6
|
+
js: '"use strict";\n' +
|
|
7
|
+
'Object.defineProperty(exports, "__esModule", { value: true });\n' +
|
|
8
|
+
`exports.orgErasureGraph = ${JSON.stringify(graph, null, 2)};\n`,
|
|
9
|
+
dts: "import type { OrgErasureGraph } from '@xemahq/biome-database-nest';\n" +
|
|
10
|
+
'export declare const orgErasureGraph: OrgErasureGraph;\n',
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=render-org-erasure-graph-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-org-erasure-graph-module.js","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/render-org-erasure-graph-module.ts"],"names":[],"mappings":";;AAUA,kEAYC;AAZD,SAAgB,2BAA2B,CACzC,KAAsB;IAEtB,OAAO;QACL,EAAE,EACA,iBAAiB;YACjB,kEAAkE;YAClE,6BAA6B,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK;QAClE,GAAG,EACD,uEAAuE;YACvE,0DAA0D;KAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OrgErasureCoverage } from './org-erasure-coverage';
|
|
2
|
+
import type { OrgErasureCoverageOptions } from './org-erasure-coverage-options';
|
|
3
|
+
import type { OrgErasureReport } from '@xemahq/org-erasure-nest';
|
|
4
|
+
export interface OrgErasureApi {
|
|
5
|
+
readonly orgErasureCoverage: OrgErasureCoverage;
|
|
6
|
+
eraseOrg(orgId: string): Promise<OrgErasureReport>;
|
|
7
|
+
}
|
|
8
|
+
export interface OrgErasureCoverageLogger {
|
|
9
|
+
log(message: string): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function resolveOrgErasureApi(raw: unknown, options: OrgErasureCoverageOptions, logger: OrgErasureCoverageLogger): OrgErasureApi;
|
|
12
|
+
//# sourceMappingURL=resolve-org-erasure-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-org-erasure-api.d.ts","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/resolve-org-erasure-api.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAEhD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAMD,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,yBAAyB,EAClC,MAAM,EAAE,wBAAwB,GAC/B,aAAa,CA+Bf"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveOrgErasureApi = resolveOrgErasureApi;
|
|
4
|
+
const classify_org_erasure_coverage_1 = require("./classify-org-erasure-coverage");
|
|
5
|
+
const org_erasure_1 = require("../tenant-isolation/org-erasure");
|
|
6
|
+
const tenant_isolation_extension_1 = require("../tenant-isolation/tenant-isolation.extension");
|
|
7
|
+
function resolveOrgErasureApi(raw, options, logger) {
|
|
8
|
+
const coverage = (0, classify_org_erasure_coverage_1.classifyOrgErasureCoverage)((0, tenant_isolation_extension_1.readRuntimeModels)(raw), options);
|
|
9
|
+
const byDisposition = {};
|
|
10
|
+
for (const { disposition } of Object.values(coverage.declared)) {
|
|
11
|
+
byDisposition[disposition] = (byDisposition[disposition] ?? 0) + 1;
|
|
12
|
+
}
|
|
13
|
+
logger.log(`[org-erasure] coverage proven: ${coverage.swept.length} swept, ` +
|
|
14
|
+
`${Object.keys(coverage.reachable).length} cascade-reachable, ` +
|
|
15
|
+
`${Object.keys(coverage.declared).length} declared` +
|
|
16
|
+
(Object.keys(byDisposition).length > 0
|
|
17
|
+
? ` (${Object.entries(byDisposition)
|
|
18
|
+
.sort(([a], [b]) => (a < b ? -1 : 1))
|
|
19
|
+
.map(([d, n]) => `${d}: ${n}`)
|
|
20
|
+
.join(', ')})`
|
|
21
|
+
: ''));
|
|
22
|
+
return {
|
|
23
|
+
orgErasureCoverage: coverage,
|
|
24
|
+
eraseOrg: async (orgId) => {
|
|
25
|
+
if (coverage.sweep === undefined) {
|
|
26
|
+
throw new Error('[org-erasure] this Prisma service declares no orgErasure.sweep, so it ' +
|
|
27
|
+
'is not an org-erasure participant and cannot erase an org.');
|
|
28
|
+
}
|
|
29
|
+
return await (0, org_erasure_1.eraseOrgData)(raw, orgId, coverage.sweep);
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=resolve-org-erasure-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-org-erasure-api.js","sourceRoot":"","sources":["../../../src/lib/org-erasure-coverage/resolve-org-erasure-api.ts"],"names":[],"mappings":";;AAuBA,oDAmCC;AA1DD,mFAA6E;AAC7E,iEAA+D;AAC/D,+FAAmF;AAqBnF,SAAgB,oBAAoB,CAClC,GAAY,EACZ,OAAkC,EAClC,MAAgC;IAEhC,MAAM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;gBACjC,MAAM,IAAI,KAAK,CACb,wEAAwE;oBACtE,4DAA4D,CAC/D,CAAC;YACJ,CAAC;YACD,OAAO,MAAM,IAAA,0BAAY,EAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;QACxD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-owned-errors.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-owned-errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk-owned-errors.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-owned-errors.ts"],"names":[],"mappings":"AAWA,qBAAa,mCAAoC,SAAQ,KAAK;aAI1C,KAAK,EAAE,MAAM;aACb,KAAK,EAAE,MAAM;IAJ/B,SAAgB,IAAI,0CAA0C;gBAG5C,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM;CAWhC;AAOD,qBAAa,qCAAsC,SAAQ,KAAK;aAG3B,YAAY,EAAE,SAAS,MAAM,EAAE;IAFlE,SAAgB,IAAI,2CAA2C;gBAE5B,YAAY,EAAE,SAAS,MAAM,EAAE;CAQnE;AAOD,qBAAa,6BAA8B,SAAQ,KAAK;aAGnB,WAAW,EAAE,MAAM;IAFtD,SAAgB,IAAI,iCAAiC;gBAElB,WAAW,EAAE,MAAM;CAOvD;AAQD,qBAAa,yCAA0C,SAAQ,KAAK;aAIhD,SAAS,EAAE,MAAM;aACjB,KAAK,EAAE,MAAM;aACb,KAAK,EAAE,MAAM;IAL/B,SAAgB,IAAI,+CAA+C;gBAGjD,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM;CAShC"}
|
|
@@ -9,7 +9,9 @@ class SdkOwnedTableNotCreatedByOwnerError extends Error {
|
|
|
9
9
|
constructor(table, owner) {
|
|
10
10
|
super(`[biome-database] SDK_OWNED_TABLE_NOT_CREATED_BY_OWNER: table "${table}" is owned by the SDK "${owner}", ` +
|
|
11
11
|
`it already exists in this schema, and the ledger has no record of "${owner}" creating it. ` +
|
|
12
|
-
`Only "${owner}" creates "${table}"; a table created by anything else is refused, not adopted
|
|
12
|
+
`Only "${owner}" creates "${table}"; a table created by anything else is refused, not adopted, ` +
|
|
13
|
+
`unless "${owner}" declares its creator as a prior creator that this schema's Prisma history records as applied with the declared checksum, ` +
|
|
14
|
+
`and every table that migration creates is present. ${RESET_REMEDY}`);
|
|
13
15
|
this.table = table;
|
|
14
16
|
this.owner = owner;
|
|
15
17
|
this.name = 'SdkOwnedTableNotCreatedByOwnerError';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-owned-errors.js","sourceRoot":"","sources":["../../src/lib/sdk-owned-errors.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAChB,sIAAsI,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk-owned-errors.js","sourceRoot":"","sources":["../../src/lib/sdk-owned-errors.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAChB,sIAAsI,CAAC;AAUzI,MAAa,mCAAoC,SAAQ,KAAK;IAI1C;IACA;IAJF,IAAI,GAAG,sCAAsC,CAAC;IAE9D,YACkB,KAAa,EACb,KAAa;QAE7B,KAAK,CACH,iEAAiE,KAAK,0BAA0B,KAAK,KAAK;YACxG,sEAAsE,KAAK,iBAAiB;YAC5F,SAAS,KAAK,cAAc,KAAK,+DAA+D;YAChG,WAAW,KAAK,6HAA6H;YAC7I,sDAAsD,YAAY,EAAE,CACvE,CAAC;QATc,UAAK,GAAL,KAAK,CAAQ;QACb,UAAK,GAAL,KAAK,CAAQ;QAS7B,IAAI,CAAC,IAAI,GAAG,qCAAqC,CAAC;IACpD,CAAC;CACF;AAhBD,kFAgBC;AAOD,MAAa,qCAAsC,SAAQ,KAAK;IAG3B;IAFnB,IAAI,GAAG,uCAAuC,CAAC;IAE/D,YAAmC,YAA+B;QAChE,KAAK,CACH,4HAA4H;YAC1H,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,sGAAsG;YAChI,+IAA+I,CAClJ,CAAC;QAL+B,iBAAY,GAAZ,YAAY,CAAmB;QAMhE,IAAI,CAAC,IAAI,GAAG,uCAAuC,CAAC;IACtD,CAAC;CACF;AAXD,sFAWC;AAOD,MAAa,6BAA8B,SAAQ,KAAK;IAGnB;IAFnB,IAAI,GAAG,6BAA6B,CAAC;IAErD,YAAmC,WAAmB;QACpD,KAAK,CACH,kDAAkD,WAAW,yEAAyE;YACpI,gDAAgD,YAAY,EAAE,CACjE,CAAC;QAJ+B,gBAAW,GAAX,WAAW,CAAQ;QAKpD,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAC9C,CAAC;CACF;AAVD,sEAUC;AAQD,MAAa,yCAA0C,SAAQ,KAAK;IAIhD;IACA;IACA;IALF,IAAI,GAAG,2CAA2C,CAAC;IAEnE,YACkB,SAAiB,EACjB,KAAa,EACb,KAAa;QAE7B,KAAK,CACH,iFAAiF,SAAS,yBAAyB,KAAK,KAAK;YAC3H,kBAAkB,KAAK,wGAAwG;YAC/H,iFAAiF,CACpF,CAAC;QARc,cAAS,GAAT,SAAS,CAAQ;QACjB,UAAK,GAAL,KAAK,CAAQ;QACb,UAAK,GAAL,KAAK,CAAQ;QAO7B,IAAI,CAAC,IAAI,GAAG,2CAA2C,CAAC;IAC1D,CAAC;CACF;AAfD,8FAeC"}
|
|
@@ -4,10 +4,18 @@ export interface SdkOwnedMigration {
|
|
|
4
4
|
readonly sql: string;
|
|
5
5
|
readonly creates: readonly string[];
|
|
6
6
|
}
|
|
7
|
+
export interface SdkOwnedTablePriorCreator {
|
|
8
|
+
readonly table: string;
|
|
9
|
+
readonly serviceMigration: string;
|
|
10
|
+
readonly sha256: string;
|
|
11
|
+
readonly standsInFor: string;
|
|
12
|
+
readonly createdShape: OwnedTableShape;
|
|
13
|
+
}
|
|
7
14
|
export interface SdkOwnedMigrationSet {
|
|
8
15
|
readonly owner: string;
|
|
9
16
|
readonly migrations: readonly SdkOwnedMigration[];
|
|
10
17
|
readonly tables: readonly OwnedTableShape[];
|
|
18
|
+
readonly priorCreators?: readonly SdkOwnedTablePriorCreator[];
|
|
11
19
|
}
|
|
12
20
|
export declare class SdkOwnedMigrationSetInvalidError extends Error {
|
|
13
21
|
readonly code = "SDK_OWNED_MIGRATION_SET_INVALID";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-owned-migration-set.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-owned-migration-set.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk-owned-migration-set.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-owned-migration-set.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAiB3D,MAAM,WAAW,iBAAiB;IAEhC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAeD,MAAM,WAAW,yBAAyB;IAExC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAKlC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;CACxC;AAQD,MAAM,WAAW,oBAAoB;IAEnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAElD,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IAE5C,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,yBAAyB,EAAE,CAAC;CAC/D;AAGD,qBAAa,gCAAiC,SAAQ,KAAK;IACzD,SAAgB,IAAI,qCAAqC;gBAEtC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAMjD;AAGD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1E;AAQD,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,oBAAoB,GACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIxB;AA4GD,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,SAAS,oBAAoB,EAAE,GACpC,IAAI,CAoBN"}
|
|
@@ -9,6 +9,8 @@ const OWNER_PATTERN = /^[a-z][a-z0-9-]{0,63}$/u;
|
|
|
9
9
|
const VERSION_PATTERN = /^[0-9]{4}-[a-z0-9][a-z0-9-]{0,48}$/u;
|
|
10
10
|
const TABLE_PATTERN = /^[a-z][a-z0-9_]{0,62}$/u;
|
|
11
11
|
const IF_NOT_EXISTS_PATTERN = /\bIF\s+NOT\s+EXISTS\b/iu;
|
|
12
|
+
const SERVICE_MIGRATION_PATTERN = /^[0-9]{14}_[a-z0-9_]{1,200}$/u;
|
|
13
|
+
const SHA256_HEX_PATTERN = /^[a-f0-9]{64}$/u;
|
|
12
14
|
class SdkOwnedMigrationSetInvalidError extends Error {
|
|
13
15
|
code = 'SDK_OWNED_MIGRATION_SET_INVALID';
|
|
14
16
|
constructor(owner, detail) {
|
|
@@ -59,6 +61,31 @@ function assertSet(set) {
|
|
|
59
61
|
if (undeclared !== undefined) {
|
|
60
62
|
throw new SdkOwnedMigrationSetInvalidError(set.owner, `creates "${undeclared}" without declaring its shape`);
|
|
61
63
|
}
|
|
64
|
+
assertPriorCreators(set);
|
|
65
|
+
}
|
|
66
|
+
function assertPriorCreators(set) {
|
|
67
|
+
const seen = new Set();
|
|
68
|
+
for (const prior of set.priorCreators ?? []) {
|
|
69
|
+
const label = `prior creator "${prior.serviceMigration}" of "${prior.table}"`;
|
|
70
|
+
if (!SERVICE_MIGRATION_PATTERN.test(prior.serviceMigration)) {
|
|
71
|
+
throw new SdkOwnedMigrationSetInvalidError(set.owner, `declares a ${label} that is not a Prisma migration directory name`);
|
|
72
|
+
}
|
|
73
|
+
if (!SHA256_HEX_PATTERN.test(prior.sha256)) {
|
|
74
|
+
throw new SdkOwnedMigrationSetInvalidError(set.owner, `declares a ${label} whose sha256 is not 64 lowercase hex characters`);
|
|
75
|
+
}
|
|
76
|
+
const stoodInFor = set.migrations.find((migration) => migration.version === prior.standsInFor);
|
|
77
|
+
if (stoodInFor === undefined || !stoodInFor.creates.includes(prior.table)) {
|
|
78
|
+
throw new SdkOwnedMigrationSetInvalidError(set.owner, `declares a ${label} standing in for "${prior.standsInFor}", which is not its migration that creates "${prior.table}"`);
|
|
79
|
+
}
|
|
80
|
+
if (prior.createdShape.name !== prior.table) {
|
|
81
|
+
throw new SdkOwnedMigrationSetInvalidError(set.owner, `declares a ${label} whose createdShape names "${prior.createdShape.name}"`);
|
|
82
|
+
}
|
|
83
|
+
const key = `${prior.table}/${prior.serviceMigration}`;
|
|
84
|
+
if (seen.has(key)) {
|
|
85
|
+
throw new SdkOwnedMigrationSetInvalidError(set.owner, `declares the ${label} twice`);
|
|
86
|
+
}
|
|
87
|
+
seen.add(key);
|
|
88
|
+
}
|
|
62
89
|
}
|
|
63
90
|
function assertSdkOwnedMigrationSets(sets) {
|
|
64
91
|
const ownerOfTable = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-owned-migration-set.js","sourceRoot":"","sources":["../../src/lib/sdk-owned-migration-set.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sdk-owned-migration-set.js","sourceRoot":"","sources":["../../src/lib/sdk-owned-migration-set.ts"],"names":[],"mappings":";;;AAqFA,kDAEC;AAQD,4DAMC;AA4GD,kEAsBC;AAvOD,+CAAuC;AAIvC,MAAM,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,MAAM,IAAI,gCAAgC,CAAC,GAAG,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QAC3E,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACtB,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,MAAM,IAAI,gCAAgC,CACxC,GAAG,CAAC,KAAK,EACT,WAAW,KAAK,CAAC,IAAI,aAAa,KAAK,QAAQ,CAChD,CAAC;YACJ,CAAC;YACD,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-owned-migrations.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-owned-migrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,yBAAyB,EAC/B,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk-owned-migrations.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-owned-migrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,yBAAyB,EAC/B,MAAM,eAAe,CAAC;AAWvB,OAAO,EAGL,KAAK,oBAAoB,EAE1B,MAAM,2BAA2B,CAAC;AAkBnC,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,oBAAoB,EAAE,GACpC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAQrB;AA+CD,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,SAAS,oBAAoB,EAAE,GACpC,OAAO,CAAC,IAAI,CAAC,CAyCf"}
|