@cosmicdrift/kumiko-bundled-features 0.15.0 → 0.18.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 +1 -1
- package/src/billing-foundation/get-subscription-for-tenant.ts +2 -2
- package/src/cap-counter/__tests__/{cap-counter.integration.ts → cap-counter.integration.test.ts} +14 -3
- package/src/cap-counter/__tests__/enforce-cap.test.ts +8 -4
- package/src/cap-counter/__tests__/{with-cap-enforcement.integration.ts → with-cap-enforcement.integration.test.ts} +14 -3
- package/src/cap-counter/enforce-cap.ts +2 -4
- package/src/cap-counter/handlers/get-counter.query.ts +1 -3
- package/src/cap-counter/handlers/increment.write.ts +1 -2
- package/src/cap-counter/handlers/mark-soft-warned.write.ts +1 -2
- package/src/channel-in-app/in-app-channel.ts +1 -3
- package/src/compliance-profiles/_internal/parse-override.ts +19 -0
- package/src/compliance-profiles/handlers/for-tenant.query.ts +6 -25
- package/src/compliance-profiles/resolve-for-tenant.ts +6 -20
- package/src/custom-fields/__tests__/cross-tenant-field-delete.integration.test.ts +177 -0
- package/src/custom-fields/__tests__/{custom-fields.integration.ts → custom-fields.integration.test.ts} +105 -0
- package/src/custom-fields/db/queries/projection.ts +33 -4
- package/src/custom-fields/db/queries/retention.ts +2 -2
- package/src/custom-fields/db/queries/user-data-rights.ts +6 -3
- package/src/custom-fields/feature.ts +10 -4
- package/src/custom-fields/handlers/delete-system-field.write.ts +5 -1
- package/src/custom-fields/handlers/delete-tenant-field.write.ts +1 -1
- package/src/custom-fields/handlers/set-custom-field.write.ts +33 -17
- package/src/custom-fields/lib/field-access.ts +39 -14
- package/src/custom-fields/lib/value-schema.ts +45 -0
- package/src/custom-fields/run-retention.ts +1 -1
- package/src/custom-fields/wire-for-entity.ts +22 -4
- package/src/custom-fields/wire-user-data-rights.ts +3 -2
- package/src/delivery/delivery-service.ts +1 -1
- package/src/delivery/feature.ts +8 -1
- package/src/delivery/types.ts +2 -2
- package/src/feature-toggles/__tests__/{feature-toggles.integration.ts → feature-toggles.integration.test.ts} +6 -6
- package/src/feature-toggles/handlers/set.write.ts +10 -8
- package/src/jobs/feature.ts +4 -1
- package/src/subscription-stripe/__tests__/{stripe-foundation.integration.ts → stripe-foundation.integration.test.ts} +7 -10
- package/src/tier-engine/__tests__/{resolver.integration.ts → resolver.integration.test.ts} +4 -3
- package/src/user-data-rights/__tests__/{audit-log.integration.ts → audit-log.integration.test.ts} +12 -5
- package/src/user-data-rights/__tests__/{cross-data-matrix.integration.ts → cross-data-matrix.integration.test.ts} +29 -12
- package/src/user-data-rights/__tests__/{download.integration.ts → download.integration.test.ts} +15 -7
- package/src/user-data-rights/__tests__/{export-job-idempotency.integration.ts → export-job-idempotency.integration.test.ts} +13 -11
- package/src/user-data-rights/__tests__/{request-cancel-deletion.integration.ts → request-cancel-deletion.integration.test.ts} +8 -7
- package/src/user-data-rights/__tests__/{request-deletion-callback.integration.ts → request-deletion-callback.integration.test.ts} +8 -5
- package/src/user-data-rights/__tests__/{request-export.integration.ts → request-export.integration.test.ts} +6 -3
- package/src/user-data-rights/__tests__/{restriction-flow.integration.ts → restriction-flow.integration.test.ts} +11 -8
- package/src/user-data-rights/__tests__/{run-export-jobs.integration.ts → run-export-jobs.integration.test.ts} +25 -13
- package/src/user-data-rights/__tests__/{run-forget-cleanup.integration.ts → run-forget-cleanup.integration.test.ts} +6 -3
- package/src/user-data-rights/__tests__/{run-user-export.integration.ts → run-user-export.integration.test.ts} +6 -3
- package/src/user-data-rights/__tests__/{user-data-rights.integration.ts → user-data-rights.integration.test.ts} +3 -1
- package/src/user-data-rights/db/queries/export-jobs.ts +6 -5
- package/src/user-data-rights/db/queries/forget-cleanup.ts +11 -6
- package/src/user-data-rights/handlers/cancel-deletion.write.ts +5 -10
- package/src/user-data-rights/handlers/export-status.query.ts +12 -12
- package/src/user-data-rights/run-export-jobs.ts +2 -5
- package/src/user-data-rights/run-forget-cleanup.ts +0 -1
- package/src/user-data-rights-defaults/__tests__/{user-data-rights-defaults.integration.ts → user-data-rights-defaults.integration.test.ts} +2 -0
- /package/src/__tests__/{es-ops-e2e.integration.ts → es-ops-e2e.integration.test.ts} +0 -0
- /package/src/audit/__tests__/{audit.integration.ts → audit.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{account-lockout-no-redis.integration.ts → account-lockout-no-redis.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{account-lockout.integration.ts → account-lockout.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{auth-claims.integration.ts → auth-claims.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{auth.integration.ts → auth.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{email-verification.integration.ts → email-verification.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{identity-v3-login.integration.ts → identity-v3-login.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{invite-flow.integration.ts → invite-flow.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{multi-roles.integration.ts → multi-roles.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{password-reset.integration.ts → password-reset.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{public-routes-rate-limit.integration.ts → public-routes-rate-limit.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{seed-admin.integration.ts → seed-admin.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{session-callbacks.integration.ts → session-callbacks.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{session-strict-mode.integration.ts → session-strict-mode.integration.test.ts} +0 -0
- /package/src/auth-email-password/__tests__/{signup-flow.integration.ts → signup-flow.integration.test.ts} +0 -0
- /package/src/billing-foundation/__tests__/{billing-foundation.integration.ts → billing-foundation.integration.test.ts} +0 -0
- /package/src/compliance-profiles/__tests__/{compliance-profiles.integration.ts → compliance-profiles.integration.test.ts} +0 -0
- /package/src/compliance-profiles/__tests__/{seeding.integration.ts → seeding.integration.test.ts} +0 -0
- /package/src/config/__tests__/{cascade.integration.ts → cascade.integration.test.ts} +0 -0
- /package/src/config/__tests__/{config.integration.ts → config.integration.test.ts} +0 -0
- /package/src/custom-fields/__tests__/{audit-integration.integration.ts → audit-integration.integration.test.ts} +0 -0
- /package/src/custom-fields/__tests__/{field-access.integration.ts → field-access.integration.test.ts} +0 -0
- /package/src/custom-fields/__tests__/{quota.integration.ts → quota.integration.test.ts} +0 -0
- /package/src/custom-fields/__tests__/{retention.integration.ts → retention.integration.test.ts} +0 -0
- /package/src/custom-fields/__tests__/{user-data-rights.integration.ts → user-data-rights.integration.test.ts} +0 -0
- /package/src/data-retention/__tests__/{data-retention.integration.ts → data-retention.integration.test.ts} +0 -0
- /package/src/data-retention/__tests__/{policy-for.integration.ts → policy-for.integration.test.ts} +0 -0
- /package/src/delivery/__tests__/{delivery-events.integration.ts → delivery-events.integration.test.ts} +0 -0
- /package/src/delivery/__tests__/{delivery.integration.ts → delivery.integration.test.ts} +0 -0
- /package/src/file-foundation/__tests__/{file-foundation.integration.ts → file-foundation.integration.test.ts} +0 -0
- /package/src/files/__tests__/{files.integration.ts → files.integration.test.ts} +0 -0
- /package/src/files-provider-s3/__tests__/{s3-provider.integration.ts → s3-provider.integration.test.ts} +0 -0
- /package/src/jobs/__tests__/{job-system-user.integration.ts → job-system-user.integration.test.ts} +0 -0
- /package/src/jobs/__tests__/{jobs-events.integration.ts → jobs-events.integration.test.ts} +0 -0
- /package/src/jobs/__tests__/{jobs-feature.integration.ts → jobs-feature.integration.test.ts} +0 -0
- /package/src/legal-pages/__tests__/{legal-pages.integration.ts → legal-pages.integration.test.ts} +0 -0
- /package/src/mail-foundation/__tests__/{mail-foundation.integration.ts → mail-foundation.integration.test.ts} +0 -0
- /package/src/rate-limiting/__tests__/{rate-limiting.integration.ts → rate-limiting.integration.test.ts} +0 -0
- /package/src/renderer-foundation/__tests__/{collect-plugins.integration.ts → collect-plugins.integration.test.ts} +0 -0
- /package/src/secrets/__tests__/{rotate.integration.ts → rotate.integration.test.ts} +0 -0
- /package/src/secrets/__tests__/{secrets-events.integration.ts → secrets-events.integration.test.ts} +0 -0
- /package/src/secrets/__tests__/{secrets.integration.ts → secrets.integration.test.ts} +0 -0
- /package/src/sessions/__tests__/{cleanup.integration.ts → cleanup.integration.test.ts} +0 -0
- /package/src/sessions/__tests__/{password-auto-revoke.integration.ts → password-auto-revoke.integration.test.ts} +0 -0
- /package/src/sessions/__tests__/{sessions.integration.ts → sessions.integration.test.ts} +0 -0
- /package/src/subscription-mollie/__tests__/{mollie-foundation.integration.ts → mollie-foundation.integration.test.ts} +0 -0
- /package/src/template-resolver/__tests__/{handlers.integration.ts → handlers.integration.test.ts} +0 -0
- /package/src/template-resolver/__tests__/{template-resolver.integration.ts → template-resolver.integration.test.ts} +0 -0
- /package/src/tenant/__tests__/{multi-tenant.integration.ts → multi-tenant.integration.test.ts} +0 -0
- /package/src/tenant/__tests__/{seed-testing.integration.ts → seed-testing.integration.test.ts} +0 -0
- /package/src/tenant/__tests__/{tenant.integration.ts → tenant.integration.test.ts} +0 -0
- /package/src/text-content/__tests__/{text-content.integration.ts → text-content.integration.test.ts} +0 -0
- /package/src/tier-engine/__tests__/{auto-default-tier.integration.ts → auto-default-tier.integration.test.ts} +0 -0
- /package/src/tier-engine/__tests__/{tier-engine.integration.ts → tier-engine.integration.test.ts} +0 -0
- /package/src/user/__tests__/{seed-testing.integration.ts → seed-testing.integration.test.ts} +0 -0
- /package/src/user/__tests__/{user.integration.ts → user.integration.test.ts} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
2
|
import type { DbConnection } from "@cosmicdrift/kumiko-framework/db";
|
|
3
3
|
import type { TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
4
|
+
import { exportJobsTable } from "../../schema/export-job";
|
|
4
5
|
|
|
5
6
|
export type ExportJobCleanupCandidate = {
|
|
6
7
|
readonly id: string;
|
|
@@ -16,8 +17,8 @@ export async function selectExportJobsForStorageCleanup(
|
|
|
16
17
|
doneStatus: string,
|
|
17
18
|
failedStatus: string,
|
|
18
19
|
): Promise<readonly ExportJobCleanupCandidate[]> {
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
);
|
|
20
|
+
return selectMany<ExportJobCleanupCandidate>(db, exportJobsTable, {
|
|
21
|
+
status: { in: [doneStatus, failedStatus] },
|
|
22
|
+
downloadStorageKey: { ne: null },
|
|
23
|
+
});
|
|
23
24
|
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
2
|
import type { DbConnection } from "@cosmicdrift/kumiko-framework/db";
|
|
3
|
+
import { userTable } from "../../../user";
|
|
3
4
|
|
|
4
5
|
export async function selectUsersDueForForgetCleanup(
|
|
5
6
|
db: DbConnection,
|
|
6
7
|
status: string,
|
|
7
|
-
|
|
8
|
+
gracePeriodEndCutoff: Temporal.Instant | string,
|
|
8
9
|
): Promise<readonly { id: string }[]> {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const cutoff =
|
|
11
|
+
typeof gracePeriodEndCutoff === "string"
|
|
12
|
+
? Temporal.Instant.from(gracePeriodEndCutoff)
|
|
13
|
+
: gracePeriodEndCutoff;
|
|
14
|
+
return selectMany<{ id: string }>(db, userTable, {
|
|
15
|
+
status,
|
|
16
|
+
gracePeriodEnd: { lte: cutoff },
|
|
17
|
+
});
|
|
13
18
|
}
|
|
@@ -23,7 +23,7 @@ export const cancelDeletionWrite = defineWriteHandler({
|
|
|
23
23
|
// ctx.db.raw (kein TenantDb-Wrapper) weil User-Entity tenant-agnostisch
|
|
24
24
|
// ist — siehe request-deletion.write.ts fuer die Begruendung. Cancel
|
|
25
25
|
// muss aus jedem Tenant-Mode den User finden + zuruecksetzen koennen.
|
|
26
|
-
const row = await fetchOne<{ status: string;
|
|
26
|
+
const row = await fetchOne<{ status: string; gracePeriodEnd: Temporal.Instant | null }>(
|
|
27
27
|
ctx.db.raw,
|
|
28
28
|
userTable,
|
|
29
29
|
{ id: event.user.id },
|
|
@@ -37,26 +37,21 @@ export const cancelDeletionWrite = defineWriteHandler({
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
if (row
|
|
40
|
+
if (row.status !== USER_STATUS.DeletionRequested) {
|
|
41
41
|
return writeFailure(
|
|
42
42
|
new UnprocessableError("no_pending_deletion", {
|
|
43
43
|
details: {
|
|
44
44
|
reason: "no_pending_deletion",
|
|
45
|
-
currentStatus: row
|
|
45
|
+
currentStatus: row.status,
|
|
46
46
|
},
|
|
47
47
|
}),
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
// from bun-db boundary) against current server clock.
|
|
53
|
-
const gracePeriodEnd = row["grace_period_end"];
|
|
51
|
+
const gracePeriodEnd = row.gracePeriodEnd;
|
|
54
52
|
const inGrace =
|
|
55
53
|
gracePeriodEnd != null &&
|
|
56
|
-
Temporal.Instant.compare(
|
|
57
|
-
gracePeriodEnd as unknown as Temporal.Instant,
|
|
58
|
-
Temporal.Now.instant(),
|
|
59
|
-
) > 0;
|
|
54
|
+
Temporal.Instant.compare(gracePeriodEnd, Temporal.Now.instant()) > 0;
|
|
60
55
|
|
|
61
56
|
if (!inGrace) {
|
|
62
57
|
return writeFailure(
|
|
@@ -22,11 +22,11 @@ type Instant = InstanceType<ReturnType<typeof getTemporal>["Instant"]>;
|
|
|
22
22
|
type ExportJobRow = {
|
|
23
23
|
readonly id: string;
|
|
24
24
|
readonly status: string;
|
|
25
|
-
readonly
|
|
26
|
-
readonly
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
25
|
+
readonly requestedAt: Instant;
|
|
26
|
+
readonly completedAt: Instant | null;
|
|
27
|
+
readonly expiresAt: Instant | null;
|
|
28
|
+
readonly errorMessage: string | null;
|
|
29
|
+
readonly bytesWritten: number | null;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export const exportStatusQuery = defineQueryHandler({
|
|
@@ -49,13 +49,13 @@ export const exportStatusQuery = defineQueryHandler({
|
|
|
49
49
|
return {
|
|
50
50
|
hasJob: true as const,
|
|
51
51
|
job: {
|
|
52
|
-
id: latest
|
|
53
|
-
status: latest
|
|
54
|
-
requestedAt: latest
|
|
55
|
-
completedAt: latest
|
|
56
|
-
expiresAt: latest
|
|
57
|
-
errorMessage: latest
|
|
58
|
-
bytesWritten: latest
|
|
52
|
+
id: latest.id,
|
|
53
|
+
status: latest.status,
|
|
54
|
+
requestedAt: latest.requestedAt.toString(),
|
|
55
|
+
completedAt: latest.completedAt?.toString() ?? null,
|
|
56
|
+
expiresAt: latest.expiresAt?.toString() ?? null,
|
|
57
|
+
errorMessage: latest.errorMessage,
|
|
58
|
+
bytesWritten: latest.bytesWritten,
|
|
59
59
|
},
|
|
60
60
|
};
|
|
61
61
|
},
|
|
@@ -595,11 +595,8 @@ async function storageCleanupPass(args: {
|
|
|
595
595
|
// → Trade-off zugunsten DSGVO entschieden. Wenn ein Operator forensik
|
|
596
596
|
// braucht, muss er das vor dem Cleanup-Pass capturen (out-of-band).
|
|
597
597
|
//
|
|
598
|
-
// **SQL-Filter:**
|
|
599
|
-
//
|
|
600
|
-
// done-jobs nach 30 Tagen) reduziert das den Worker-Roundtrip drastisch.
|
|
601
|
-
//
|
|
602
|
-
// or() + isNotNull(): no bun-db helper covers this combination — raw SQL.
|
|
598
|
+
// **SQL-Filter:** status IN (done, failed) + downloadStorageKey IS NOT NULL
|
|
599
|
+
// via selectMany (db/queries/export-jobs.ts).
|
|
603
600
|
const candidates = await selectExportJobsForStorageCleanup(
|
|
604
601
|
db,
|
|
605
602
|
EXPORT_JOB_STATUS.Done,
|
|
@@ -112,7 +112,6 @@ export async function runForgetCleanup(
|
|
|
112
112
|
const { db, registry, now, sendDeletionExecutedEmail } = args;
|
|
113
113
|
|
|
114
114
|
// Step 1: Find users with expired grace period.
|
|
115
|
-
// lte with Instant: no bun-db operator covers this — raw SQL.
|
|
116
115
|
const dueUsers = await selectUsersDueForForgetCleanup(
|
|
117
116
|
db,
|
|
118
117
|
USER_STATUS.DeletionRequested,
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
import { createComplianceProfilesFeature } from "../../compliance-profiles";
|
|
21
21
|
import { createDataRetentionFeature } from "../../data-retention";
|
|
22
22
|
import { createFilesFeature } from "../../files";
|
|
23
|
+
import { createSessionsFeature } from "../../sessions";
|
|
23
24
|
import {
|
|
24
25
|
createUserFeature,
|
|
25
26
|
USER_ANONYMIZED_DISPLAY_NAME,
|
|
@@ -39,6 +40,7 @@ const features = [
|
|
|
39
40
|
createFilesFeature(),
|
|
40
41
|
createDataRetentionFeature(),
|
|
41
42
|
createComplianceProfilesFeature(),
|
|
43
|
+
createSessionsFeature(),
|
|
42
44
|
createUserDataRightsFeature(),
|
|
43
45
|
createUserDataRightsDefaultsFeature(),
|
|
44
46
|
];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/compliance-profiles/__tests__/{seeding.integration.ts → seeding.integration.test.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/custom-fields/__tests__/{retention.integration.ts → retention.integration.test.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/data-retention/__tests__/{policy-for.integration.ts → policy-for.integration.test.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/jobs/__tests__/{job-system-user.integration.ts → job-system-user.integration.test.ts}
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/jobs/__tests__/{jobs-feature.integration.ts → jobs-feature.integration.test.ts}
RENAMED
|
File without changes
|
/package/src/legal-pages/__tests__/{legal-pages.integration.ts → legal-pages.integration.test.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/secrets/__tests__/{secrets-events.integration.ts → secrets-events.integration.test.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/template-resolver/__tests__/{handlers.integration.ts → handlers.integration.test.ts}
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/tenant/__tests__/{multi-tenant.integration.ts → multi-tenant.integration.test.ts}
RENAMED
|
File without changes
|
/package/src/tenant/__tests__/{seed-testing.integration.ts → seed-testing.integration.test.ts}
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/text-content/__tests__/{text-content.integration.ts → text-content.integration.test.ts}
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/tier-engine/__tests__/{tier-engine.integration.ts → tier-engine.integration.test.ts}
RENAMED
|
File without changes
|
/package/src/user/__tests__/{seed-testing.integration.ts → seed-testing.integration.test.ts}
RENAMED
|
File without changes
|
|
File without changes
|