@cosmicdrift/kumiko-bundled-features 0.404.0 → 0.405.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/dist/auth-email-password/mail-notifications.d.ts +3 -3
- package/dist/auth-email-password/mail-notifications.js +10 -34
- package/dist/auth-email-password/web/auth-gate.js +4 -0
- package/dist/auth-email-password/web/default-topbar-actions.d.ts +6 -1
- package/dist/auth-email-password/web/default-topbar-actions.js +2 -2
- package/dist/auth-email-password/web/index.d.ts +2 -0
- package/dist/auth-email-password/web/index.js +1 -0
- package/dist/auth-email-password/web/invite-accept-screen.js +6 -41
- package/dist/auth-email-password/web/tenant-label.d.ts +2 -0
- package/dist/auth-email-password/web/tenant-label.js +10 -0
- package/dist/auth-email-password/web/tenant-menu-items.js +2 -7
- package/dist/auth-email-password/web/tenant-switcher.js +5 -12
- package/dist/auth-email-password/web/use-redirect-authed-from-login.d.ts +7 -0
- package/dist/auth-email-password/web/use-redirect-authed-from-login.js +30 -0
- package/dist/auth-foundation/feature.js +8 -21
- package/dist/auth-mfa/handlers/reencrypt.job.js +7 -15
- package/dist/auth-mfa/hmac-token-codec.d.ts +6 -1
- package/dist/auth-mfa/hmac-token-codec.js +8 -10
- package/dist/auth-mfa/mfa-challenge-token.js +2 -8
- package/dist/auth-mfa/mfa-preauth-setup-token.js +2 -8
- package/dist/auth-mfa/mfa-setup-token.d.ts +2 -8
- package/dist/auth-mfa/mfa-setup-token.js +8 -45
- package/dist/billing-foundation/consumer-protection/termination-revoke.js +3 -11
- package/dist/billing-foundation/feature.js +1 -5
- package/dist/billing-foundation/handlers/process-event.write.js +2 -6
- package/dist/billing-foundation/handlers/process-payment-event.write.js +2 -6
- package/dist/billing-foundation/index.d.ts +2 -0
- package/dist/billing-foundation/index.js +2 -0
- package/dist/billing-foundation/projection.js +12 -21
- package/dist/billing-foundation/provider-event-seen.d.ts +5 -0
- package/dist/billing-foundation/provider-event-seen.js +7 -0
- package/dist/billing-foundation/provider-shared.d.ts +11 -0
- package/dist/billing-foundation/provider-shared.js +44 -0
- package/dist/billing-foundation/tenant-destroy-hook.js +5 -4
- package/dist/channel-email/feature.js +1 -1
- package/dist/config/handlers/reencrypt.job.js +7 -15
- package/dist/delivery/delivery-service.js +2 -8
- package/dist/file-derivatives/feature.js +9 -21
- package/dist/file-foundation/feature.js +2 -6
- package/dist/files-tenant-data/hooks.js +1 -6
- package/dist/folders/feature.js +2 -9
- package/dist/folders/web/folder-manager.js +7 -26
- package/dist/folders/web/folder-section.js +5 -24
- package/dist/form-draft/handlers/save.write.d.ts +9 -0
- package/dist/form-draft/handlers/save.write.js +3 -7
- package/dist/inbound-mail-foundation/feature.js +2 -6
- package/dist/inbound-mail-foundation/handlers/thread-rollup.js +1 -0
- package/dist/inbound-mail-foundation/oauth-state.js +5 -13
- package/dist/inbound-mail-foundation/tenant-destroy-hook.d.ts +1 -1
- package/dist/inbound-mail-foundation/tenant-destroy-hook.js +3 -18
- package/dist/jobs/handlers/tenant-failures.query.js +1 -15
- package/dist/jobs/handlers/tenant-runs.query.js +1 -14
- package/dist/jobs/job-run-logger.js +19 -23
- package/dist/jobs/parse-subject.d.ts +1 -0
- package/dist/jobs/parse-subject.js +15 -0
- package/dist/ledger/feature.js +2 -8
- package/dist/mail-foundation/feature.js +3 -7
- package/dist/managed-pages/render-page-body.js +4 -12
- package/dist/notes-history/feature.js +2 -9
- package/dist/personal-access-tokens/handlers/list.query.js +1 -9
- package/dist/personal-access-tokens/hash.js +2 -2
- package/dist/personal-access-tokens/parse-scope-names.d.ts +1 -0
- package/dist/personal-access-tokens/parse-scope-names.js +10 -0
- package/dist/personal-access-tokens/resolver.js +1 -9
- package/dist/renderer-foundation/feature.js +3 -14
- package/dist/secrets/handlers/rotate.job.js +7 -18
- package/dist/shared/collect-extension-options.d.ts +4 -0
- package/dist/shared/collect-extension-options.js +8 -0
- package/dist/shared/hmac-signature.d.ts +2 -0
- package/dist/shared/hmac-signature.js +10 -0
- package/dist/shared/index.d.ts +6 -0
- package/dist/shared/index.js +6 -0
- package/dist/shared/is-unique-constraint-failure.d.ts +2 -0
- package/dist/shared/is-unique-constraint-failure.js +7 -0
- package/dist/shared/mail-locale-templates.d.ts +12 -0
- package/dist/shared/mail-locale-templates.js +36 -0
- package/dist/shared/resolve-feature-access.d.ts +7 -0
- package/dist/shared/resolve-feature-access.js +8 -0
- package/dist/shared/signed-token.js +4 -14
- package/dist/shared/single-use-token-store.js +2 -2
- package/dist/shared/stream-tenant-derived-state.js +1 -5
- package/dist/shared/tenant-db-cache.d.ts +3 -0
- package/dist/shared/tenant-db-cache.js +14 -0
- package/dist/shared/web/status-banner.d.ts +15 -0
- package/dist/shared/web/status-banner.js +13 -0
- package/dist/shared/web/use-dispatched-writes.d.ts +8 -0
- package/dist/shared/web/use-dispatched-writes.js +29 -0
- package/dist/subscription-paddle/feature.js +2 -15
- package/dist/subscription-paddle/price-methods.d.ts +2 -5
- package/dist/subscription-paddle/price-methods.js +5 -26
- package/dist/subscription-paddle/runtime.d.ts +1 -1
- package/dist/subscription-paddle/runtime.js +3 -16
- package/dist/subscription-stripe/feature.js +2 -17
- package/dist/subscription-stripe/plugin-methods.d.ts +2 -5
- package/dist/subscription-stripe/plugin-methods.js +3 -18
- package/dist/subscription-stripe/runtime.js +3 -19
- package/dist/tags/feature.js +2 -9
- package/dist/tags/web/tag-manager.js +5 -24
- package/dist/tags/web/tag-section.js +3 -12
- package/dist/template-resolver/document-sanitizer.js +3 -2
- package/dist/template-resolver/handlers/tenant-overrides.query.js +3 -9
- package/dist/template-resolver/web/collection-entry-create-form.js +1 -0
- package/dist/tenant/handlers/decrypt-member-users.d.ts +10 -0
- package/dist/tenant/handlers/decrypt-member-users.js +17 -0
- package/dist/tenant/handlers/members.query.js +2 -17
- package/dist/tenant/handlers/team-list.query.js +4 -17
- package/dist/tenant-lifecycle/archive-and-delete-tenant-rows.d.ts +5 -0
- package/dist/tenant-lifecycle/archive-and-delete-tenant-rows.js +20 -0
- package/dist/tenant-lifecycle/index.d.ts +1 -0
- package/dist/tenant-lifecycle/index.js +1 -0
- package/dist/tier-engine/feature.js +1 -1
- package/dist/user-data-rights/build-hook-db.d.ts +11 -0
- package/dist/user-data-rights/build-hook-db.js +22 -0
- package/dist/user-data-rights/handlers/request-export.write.js +2 -12
- package/dist/user-data-rights/mail-notifications.d.ts +3 -3
- package/dist/user-data-rights/mail-notifications.js +10 -34
- package/dist/user-data-rights/run-forget-cleanup.d.ts +1 -1
- package/dist/user-data-rights/run-forget-cleanup.js +2 -21
- package/dist/user-data-rights/run-user-export.d.ts +1 -1
- package/dist/user-data-rights/run-user-export.js +2 -21
- package/dist/user-data-rights/token-helpers.js +2 -14
- package/dist/user-data-rights/web/privacy-center-screen.js +1 -11
- package/dist/user-data-rights/web/public-deletion-gate.js +1 -0
- package/dist/user-profile/web/profile-screen.js +1 -11
- package/package.json +35 -35
- package/src/auth-email-password/changes.json +6 -0
- package/src/auth-mfa/changes.json +6 -0
- package/src/billing-foundation/changes.json +6 -0
- package/src/documents/changes.json +8 -0
- package/src/shared/changes.json +6 -0
- package/src/tenant-lifecycle/changes.json +6 -0
|
@@ -11,8 +11,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
// - extension: a screen-schema section with
|
|
12
12
|
// component: { react: { __component: TAGS_SECTION_EXTENSION_NAME } }
|
|
13
13
|
// (RenderEdit passes { entityName, entityId }).
|
|
14
|
-
import {
|
|
14
|
+
import { usePrimitives, useQuery, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
15
15
|
import { useState } from "react";
|
|
16
|
+
import { useDispatchedWrites } from "../../shared/web/use-dispatched-writes.js";
|
|
16
17
|
import { TagsHandlers, TagsQueries } from "./constants.js";
|
|
17
18
|
import { TagChip } from "./tag-chip.js";
|
|
18
19
|
import { TagPicker } from "./tag-picker.js";
|
|
@@ -28,7 +29,6 @@ export function tagSelectionDelta(prev, next) {
|
|
|
28
29
|
export function TagSection({ entityName, entityId, }) {
|
|
29
30
|
const { Banner, Button, Text } = usePrimitives();
|
|
30
31
|
const t = useTranslation();
|
|
31
|
-
const dispatcher = useDispatcher();
|
|
32
32
|
const enabled = entityId !== null;
|
|
33
33
|
const catalog = useQuery(TagsQueries.tagList, {}, { enabled });
|
|
34
34
|
// entityType server-side, not just entityId: it collapses the parent-ref
|
|
@@ -40,8 +40,7 @@ export function TagSection({ entityName, entityId, }) {
|
|
|
40
40
|
],
|
|
41
41
|
}, { enabled });
|
|
42
42
|
const [pickerOpen, setPickerOpen] = useState(false);
|
|
43
|
-
const
|
|
44
|
-
const [errorKey, setErrorKey] = useState(null);
|
|
43
|
+
const { busy, setBusy, errorKey, setErrorKey, writeOk } = useDispatchedWrites();
|
|
45
44
|
if (entityId === null) {
|
|
46
45
|
return (_jsx(Banner, { variant: "info", testId: "tags-section-create-mode", children: _jsx(Text, { children: t("tags.section.createMode") }) }));
|
|
47
46
|
}
|
|
@@ -58,14 +57,6 @@ export function TagSection({ entityName, entityId, }) {
|
|
|
58
57
|
const refetch = async () => {
|
|
59
58
|
await Promise.all([catalog.refetch(), assignments.refetch()]);
|
|
60
59
|
};
|
|
61
|
-
const writeOk = async (type, payload) => {
|
|
62
|
-
const result = await dispatcher.write(type, payload);
|
|
63
|
-
if (!result.isSuccess) {
|
|
64
|
-
setErrorKey(result.error.i18nKey);
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
};
|
|
69
60
|
const onPicked = (next) => {
|
|
70
61
|
const { added, removed } = tagSelectionDelta(assignedIds, next);
|
|
71
62
|
if (added.length === 0 && removed.length === 0)
|
|
@@ -131,8 +131,9 @@ export function withParsedDocument(html, read) {
|
|
|
131
131
|
return read(parsed.body);
|
|
132
132
|
}
|
|
133
133
|
finally {
|
|
134
|
-
window.
|
|
135
|
-
window.happyDOM.
|
|
134
|
+
// The window is never reused, so this sync API need not await the teardown promises.
|
|
135
|
+
void window.happyDOM.abort();
|
|
136
|
+
void window.happyDOM.close();
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
function scanDocumentHtml(html) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { defineQueryHandler, MAX_LIST_LIMIT, SYSTEM_TENANT_ID, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
+
import { chunk } from "@cosmicdrift/kumiko-framework/utils";
|
|
3
4
|
import * as z from "zod";
|
|
4
5
|
import { TenantQueries } from "../../tenant/index.js";
|
|
5
6
|
import { templateResourcesTable } from "../table.js";
|
|
@@ -10,18 +11,11 @@ import { loadEnabledTenantIds, pickBestRowPerTenant, TENANT_OVERRIDES_REASON, }
|
|
|
10
11
|
const directorySchema = z.object({
|
|
11
12
|
rows: z.array(z.object({ id: z.string(), label: z.string() })),
|
|
12
13
|
});
|
|
13
|
-
function chunksOf(items, size) {
|
|
14
|
-
const chunks = [];
|
|
15
|
-
for (let start = 0; start < items.length; start += size) {
|
|
16
|
-
chunks.push(items.slice(start, start + size));
|
|
17
|
-
}
|
|
18
|
-
return chunks;
|
|
19
|
-
}
|
|
20
14
|
// Looks up only the ids the overrides need, so labels never depend on the directory's default cap.
|
|
21
15
|
async function labelsFor(ctx, queryName, ids) {
|
|
22
16
|
const labels = new Map();
|
|
23
|
-
for (const
|
|
24
|
-
const raw = await ctx.dispatch.query(queryName, { ids:
|
|
17
|
+
for (const idChunk of chunk([...ids], MAX_LIST_LIMIT)) {
|
|
18
|
+
const raw = await ctx.dispatch.query(queryName, { ids: idChunk });
|
|
25
19
|
for (const row of directorySchema.parse(raw).rows)
|
|
26
20
|
labels.set(row.id, row.label);
|
|
27
21
|
}
|
|
@@ -11,6 +11,7 @@ const SLUG_INVALID_ISSUE = {
|
|
|
11
11
|
// `tenantId` is the plugin's SystemAdmin tenant, the one the collection tree lists, so a new entry
|
|
12
12
|
// lands where the tree looks. Same rule as the tree: per-user collections stay on the session tenant.
|
|
13
13
|
export function createCollectionEntryCreateForm(tenantId) {
|
|
14
|
+
// biome-ignore lint/correctness/noComponentHookFactories: setup-time factory, called once per templateResolverClient(); the resolver slot only passes target/onClose, so tenantId is bound here
|
|
14
15
|
return function BoundCollectionEntryCreateForm(props) {
|
|
15
16
|
return _jsx(CollectionEntryCreateForm, { ...props, tenantId: tenantId });
|
|
16
17
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type MemberUserRow = {
|
|
2
|
+
readonly id: unknown;
|
|
3
|
+
readonly email?: unknown;
|
|
4
|
+
readonly displayName?: unknown;
|
|
5
|
+
};
|
|
6
|
+
export declare const KMS_POOL_CONCURRENCY = 4;
|
|
7
|
+
export declare function decryptMemberUsers(users: readonly MemberUserRow[], reason: string): Promise<Map<string, {
|
|
8
|
+
readonly email: string | null;
|
|
9
|
+
readonly displayName: string | null;
|
|
10
|
+
}>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { decryptStoredPii, mapWithConcurrency } from "../../shared/index.js";
|
|
2
|
+
// Bounded, not Promise.all/sequential: each decrypt hits the KMS adapter's
|
|
3
|
+
// own small dedicated pool (PgKmsAdapter default max: 4). Promise.all fires
|
|
4
|
+
// one call per user unbounded and exhausts the pool once membership counts
|
|
5
|
+
// exceed a handful, surfacing as "the connection was closed"; a strict
|
|
6
|
+
// sequential loop caps concurrency at 1 and leaves 3 pool slots idle.
|
|
7
|
+
export const KMS_POOL_CONCURRENCY = 4;
|
|
8
|
+
export async function decryptMemberUsers(users, reason) {
|
|
9
|
+
const decrypted = await mapWithConcurrency(users, KMS_POOL_CONCURRENCY, async (user) => {
|
|
10
|
+
const email = typeof user.email === "string" ? await decryptStoredPii(user.email, "email", reason) : null;
|
|
11
|
+
const displayName = typeof user.displayName === "string"
|
|
12
|
+
? await decryptStoredPii(user.displayName, "displayName", reason)
|
|
13
|
+
: null;
|
|
14
|
+
return { userId: String(user.id), email, displayName };
|
|
15
|
+
});
|
|
16
|
+
return new Map(decrypted.map((d) => [d.userId, d]));
|
|
17
|
+
}
|
|
@@ -3,15 +3,9 @@ import { access, defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine
|
|
|
3
3
|
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
4
|
import { parseRoles } from "@cosmicdrift/kumiko-framework/utils";
|
|
5
5
|
import * as z from "zod";
|
|
6
|
-
import { decryptStoredPii, mapWithConcurrency } from "../../shared/index.js";
|
|
7
6
|
import { userTable } from "../../user/index.js";
|
|
8
7
|
import { tenantMembershipsTable } from "../membership-table.js";
|
|
9
|
-
|
|
10
|
-
// own small dedicated pool (PgKmsAdapter default max: 4). Promise.all fires
|
|
11
|
-
// one call per user unbounded and exhausts the pool once membership counts
|
|
12
|
-
// exceed a handful, surfacing as "the connection was closed"; a strict
|
|
13
|
-
// sequential loop caps concurrency at 1 and leaves 3 pool slots idle.
|
|
14
|
-
const KMS_POOL_CONCURRENCY = 4;
|
|
8
|
+
import { decryptMemberUsers } from "./decrypt-member-users.js";
|
|
15
9
|
export const membersQuery = defineQueryHandler({
|
|
16
10
|
name: "members",
|
|
17
11
|
schema: z.object({
|
|
@@ -37,16 +31,7 @@ export const membersQuery = defineQueryHandler({
|
|
|
37
31
|
const userIds = [...new Set(rows.map((row) => row["userId"]))];
|
|
38
32
|
const users = userIds.length > 0 ? await selectMany(db, userTable, { id: userIds }) : [];
|
|
39
33
|
const userById = new Map(users.map((u) => [String(u.id), u]));
|
|
40
|
-
const
|
|
41
|
-
const email = typeof user.email === "string"
|
|
42
|
-
? await decryptStoredPii(user.email, "email", "tenant:members")
|
|
43
|
-
: null;
|
|
44
|
-
const displayName = typeof user.displayName === "string"
|
|
45
|
-
? await decryptStoredPii(user.displayName, "displayName", "tenant:members")
|
|
46
|
-
: null;
|
|
47
|
-
return { userId: String(user.id), email, displayName };
|
|
48
|
-
});
|
|
49
|
-
const decryptedByUserId = new Map(decrypted.map((d) => [d.userId, d]));
|
|
34
|
+
const decryptedByUserId = await decryptMemberUsers(users, "tenant:members");
|
|
50
35
|
return rows.map((row) => {
|
|
51
36
|
const user = userById.get(String(row["userId"]));
|
|
52
37
|
const decrypted = user ? decryptedByUserId.get(String(user.id)) : undefined;
|
|
@@ -10,7 +10,7 @@ import { decryptStoredPii, mapWithConcurrency } from "../../shared/index.js";
|
|
|
10
10
|
import { userTable } from "../../user/index.js";
|
|
11
11
|
import { INVITATION_STATUS, tenantInvitationsTable } from "../invitation-table.js";
|
|
12
12
|
import { tenantMembershipsTable } from "../membership-table.js";
|
|
13
|
-
|
|
13
|
+
import { decryptMemberUsers, KMS_POOL_CONCURRENCY, } from "./decrypt-member-users.js";
|
|
14
14
|
// The /members screen exposes one column per field above under the SAME
|
|
15
15
|
// name — unlike delivery-log there is no display-alias to map, `sort` on
|
|
16
16
|
// the wire already names a TeamRow field directly.
|
|
@@ -86,11 +86,7 @@ export const teamListQuery = definePagedQueryHandler({
|
|
|
86
86
|
const tenantId = query.user.tenantId;
|
|
87
87
|
const membershipRows = await selectMany(db, tenantMembershipsTable, { tenantId });
|
|
88
88
|
const userIds = [...new Set(membershipRows.map((row) => String(row["userId"])))];
|
|
89
|
-
const users = userIds.length > 0
|
|
90
|
-
? await selectMany(db, userTable, {
|
|
91
|
-
id: userIds,
|
|
92
|
-
})
|
|
93
|
-
: [];
|
|
89
|
+
const users = userIds.length > 0 ? await selectMany(db, userTable, { id: userIds }) : [];
|
|
94
90
|
const lastSeenByUserId = new Map();
|
|
95
91
|
if (userIds.length > 0) {
|
|
96
92
|
try {
|
|
@@ -115,19 +111,10 @@ export const teamListQuery = definePagedQueryHandler({
|
|
|
115
111
|
}
|
|
116
112
|
}
|
|
117
113
|
// Bounded, not Promise.all/sequential-per-item: shares the KMS
|
|
118
|
-
// adapter's small dedicated pool (max 4, see
|
|
114
|
+
// adapter's small dedicated pool (max 4, see decrypt-member-users.ts) with the
|
|
119
115
|
// invitations decrypt below — the two passes run one after the other
|
|
120
116
|
// (await, not Promise.all), so combined concurrency never exceeds 4.
|
|
121
|
-
const
|
|
122
|
-
const email = typeof user.email === "string"
|
|
123
|
-
? await decryptStoredPii(user.email, "email", "tenant:team-list")
|
|
124
|
-
: null;
|
|
125
|
-
const displayName = typeof user.displayName === "string"
|
|
126
|
-
? await decryptStoredPii(user.displayName, "displayName", "tenant:team-list")
|
|
127
|
-
: null;
|
|
128
|
-
return { userId: String(user.id), email, displayName };
|
|
129
|
-
});
|
|
130
|
-
const decryptedByUserId = new Map(decryptedUsers.map((d) => [d.userId, d]));
|
|
117
|
+
const decryptedByUserId = await decryptMemberUsers(users, "tenant:team-list");
|
|
131
118
|
const memberRows = membershipRows.map((row) => {
|
|
132
119
|
const userId = String(row["userId"]);
|
|
133
120
|
const decrypted = decryptedByUserId.get(userId);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { EntityTableMeta } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import { type TenantDataHookCtx } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
+
export declare const TENANT_DESTROY_ARCHIVED_BY = "tenant-lifecycle:destroy";
|
|
4
|
+
export declare const TENANT_DESTROY_ARCHIVE_REASON = "tenant_destroy";
|
|
5
|
+
export declare function archiveAndDeleteTenantRows(ctx: TenantDataHookCtx, table: EntityTableMeta, aggregateType: string, escapeHatchReason: string): Promise<readonly string[]>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { declareEscapeHatch } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { archiveStream } from "@cosmicdrift/kumiko-framework/event-store";
|
|
3
|
+
export const TENANT_DESTROY_ARCHIVED_BY = "tenant-lifecycle:destroy";
|
|
4
|
+
export const TENANT_DESTROY_ARCHIVE_REASON = "tenant_destroy";
|
|
5
|
+
// Archiving first means a later projection rebuild cannot resurrect the deleted rows.
|
|
6
|
+
export async function archiveAndDeleteTenantRows(ctx, table, aggregateType, escapeHatchReason) {
|
|
7
|
+
declareEscapeHatch({ reason: escapeHatchReason });
|
|
8
|
+
const rows = await ctx.db.selectMany(table, { tenantId: ctx.tenantId });
|
|
9
|
+
for (const row of rows) {
|
|
10
|
+
await archiveStream(ctx.db.unsafeRaw(), {
|
|
11
|
+
tenantId: ctx.tenantId,
|
|
12
|
+
aggregateId: row.id,
|
|
13
|
+
aggregateType,
|
|
14
|
+
archivedBy: TENANT_DESTROY_ARCHIVED_BY,
|
|
15
|
+
reason: TENANT_DESTROY_ARCHIVE_REASON,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
await ctx.db.deleteMany(table, { tenantId: ctx.tenantId });
|
|
19
|
+
return rows.map((row) => row.id);
|
|
20
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { archiveAndDeleteTenantRows, TENANT_DESTROY_ARCHIVE_REASON, TENANT_DESTROY_ARCHIVED_BY, } from "./archive-and-delete-tenant-rows.ts";
|
|
1
2
|
export { TENANT_DESTRUCTION_STAGES, TENANT_LIFECYCLE_FEATURE, TenantLifecycleHandlers, } from "./constants.ts";
|
|
2
3
|
export { createTenantLifecycleFeature } from "./feature.ts";
|
|
3
4
|
export { resolveTenantLifecycleGate } from "./run-tenant-destroy.ts";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { archiveAndDeleteTenantRows, TENANT_DESTROY_ARCHIVE_REASON, TENANT_DESTROY_ARCHIVED_BY, } from "./archive-and-delete-tenant-rows.js";
|
|
1
2
|
export { TENANT_DESTRUCTION_STAGES, TENANT_LIFECYCLE_FEATURE, TenantLifecycleHandlers, } from "./constants.js";
|
|
2
3
|
export { createTenantLifecycleFeature } from "./feature.js";
|
|
3
4
|
export { resolveTenantLifecycleGate } from "./run-tenant-destroy.js";
|
|
@@ -380,7 +380,7 @@ export function createTierEngineFeature(opts = {}) {
|
|
|
380
380
|
// point AND registers itself as the default plugin. Other features could
|
|
381
381
|
// register there later (e.g. a future toggle-only resolver), but only one
|
|
382
382
|
// plugin wins — see the "single-plugin" comment on findTierResolverUsage.
|
|
383
|
-
r.extendsRegistrar(TENANT_TIER_RESOLVER_EXT, {
|
|
383
|
+
r.extendsRegistrar(TENANT_TIER_RESOLVER_EXT, {});
|
|
384
384
|
// Plugin-registration: framework's runDevApp/runProdApp picks this up
|
|
385
385
|
// post-stack-setup, calls build(deps), wires effectiveFeatures.
|
|
386
386
|
const plugin = {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type DbRunner } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import { type EscapeHatchAuditSink, type TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
+
import { type Logger } from "@cosmicdrift/kumiko-framework/logging";
|
|
4
|
+
export declare function buildHookDb(db: DbRunner, tenantId: TenantId, entry: {
|
|
5
|
+
readonly entityName: string;
|
|
6
|
+
readonly escapeHatchReason: string | undefined;
|
|
7
|
+
}, args: {
|
|
8
|
+
readonly escapeHatchAuditSink?: EscapeHatchAuditSink;
|
|
9
|
+
readonly escapeHatchAuditLog?: Logger;
|
|
10
|
+
readonly actor?: string;
|
|
11
|
+
}): import("@cosmicdrift/kumiko-types/tenant-db-types").TenantDb;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createTenantDb } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import { EXT_USER_DATA, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
+
import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
|
|
4
|
+
import { createEscapeHatchReporter, UNATTRIBUTED_ACTOR, } from "@cosmicdrift/kumiko-framework/pipeline";
|
|
5
|
+
export function buildHookDb(db, tenantId, entry, args) {
|
|
6
|
+
const report = createEscapeHatchReporter({
|
|
7
|
+
handler: `${EXT_USER_DATA}:${entry.entityName}`,
|
|
8
|
+
tenantId,
|
|
9
|
+
actor: args.actor ?? UNATTRIBUTED_ACTOR,
|
|
10
|
+
sink: args.escapeHatchAuditSink,
|
|
11
|
+
log: args.escapeHatchAuditLog ?? createFallbackLogger("user-data-rights"),
|
|
12
|
+
});
|
|
13
|
+
return createTenantDb({
|
|
14
|
+
db,
|
|
15
|
+
tenantId,
|
|
16
|
+
mode: "tenant",
|
|
17
|
+
grants: {
|
|
18
|
+
unsafeRaw: entry.escapeHatchReason !== undefined ? { reason: entry.escapeHatchReason } : undefined,
|
|
19
|
+
report,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -24,22 +24,12 @@ import { createEventStoreExecutor, fetchOne } from "@cosmicdrift/kumiko-framewor
|
|
|
24
24
|
import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
25
25
|
import { getTemporal } from "@cosmicdrift/kumiko-framework/time";
|
|
26
26
|
import * as z from "zod";
|
|
27
|
+
import { isUniqueConstraintFailure } from "../../shared/index.js";
|
|
27
28
|
import { ACTIVE_JOB_CONSTRAINT, EXPORT_JOB_STATUS, exportJobEntity, exportJobsTable, } from "../schema/export-job.js";
|
|
28
29
|
const crud = createEventStoreExecutor(exportJobsTable, exportJobEntity, {
|
|
29
30
|
entityName: "export-job",
|
|
30
31
|
});
|
|
31
32
|
const REQUEST_EXPORT_REASON = "export jobs are keyed by userId across all of the user's tenant memberships, not the caller's current tenant";
|
|
32
|
-
/**
|
|
33
|
-
* `createEventStoreExecutor.create` catches 23505 internally and returns
|
|
34
|
-
* `WriteFailure(UniqueViolationError)` rather than throwing. Check the
|
|
35
|
-
* failure code and constraintName to distinguish the app-side and race
|
|
36
|
-
* paths; propagate other failures (validation, version conflicts, ...)
|
|
37
|
-
* unchanged.
|
|
38
|
-
*/
|
|
39
|
-
function isActiveJobConflict(failure) {
|
|
40
|
-
const error = failure.error; // @cast-boundary error-details
|
|
41
|
-
return (error.code === "unique_violation" && error.details?.constraintName === ACTIVE_JOB_CONSTRAINT);
|
|
42
|
-
}
|
|
43
33
|
export const requestExportWrite = defineWriteHandler({
|
|
44
34
|
name: "request-export",
|
|
45
35
|
schema: z.object({}),
|
|
@@ -89,7 +79,7 @@ export const requestExportWrite = defineWriteHandler({
|
|
|
89
79
|
// crud.create, causing UniqueViolationError for our constraint. Re-fetch
|
|
90
80
|
// and return the existing job with isExisting=true. Propagate other
|
|
91
81
|
// failures (validation, version conflicts, ...) unchanged.
|
|
92
|
-
if (
|
|
82
|
+
if (isUniqueConstraintFailure(result, ACTIVE_JOB_CONSTRAINT)) {
|
|
93
83
|
const winner = await findActiveJob(exportJobRunner, userId);
|
|
94
84
|
if (!winner) {
|
|
95
85
|
// This should be impossible: a constraint violation without an existing
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FeatureRegistrar, type
|
|
1
|
+
import { type FeatureRegistrar, type TemplateVariables } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
declare const ALL_GDPR_MAIL_KINDS: readonly ["exportReady", "exportFailed", "deletionRequested", "deletionExecuted"];
|
|
3
3
|
export type GdprMailKind = (typeof ALL_GDPR_MAIL_KINDS)[number];
|
|
4
4
|
export declare const GDPR_MAIL_KINDS: Readonly<Record<GdprMailKind, {
|
|
@@ -6,8 +6,8 @@ export declare const GDPR_MAIL_KINDS: Readonly<Record<GdprMailKind, {
|
|
|
6
6
|
readonly translationKey: string;
|
|
7
7
|
}>>;
|
|
8
8
|
export declare const GdprMailNotificationTypes: Readonly<Record<GdprMailKind, string>>;
|
|
9
|
-
export declare
|
|
9
|
+
export declare const gdprMailTemplateLocale: (notificationType: string, requestedLocale: string) => string;
|
|
10
10
|
export declare const GDPR_MAIL_VARIABLES: Readonly<Record<GdprMailKind, TemplateVariables>>;
|
|
11
|
-
export declare
|
|
11
|
+
export declare const gdprMailLocalizedTemplate: (kind: "deletionExecuted" | "deletionRequested" | "exportFailed" | "exportReady") => () => import("@cosmicdrift/kumiko-types/config").NotificationLocalizedTemplate;
|
|
12
12
|
export declare function registerGdprMails(r: FeatureRegistrar): void;
|
|
13
13
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { QnTypes, qn, templateVariable, } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
-
import {
|
|
2
|
+
import { mailT } from "@cosmicdrift/kumiko-framework/i18n";
|
|
3
3
|
import { escapeHtml } from "@cosmicdrift/kumiko-renderer/headless";
|
|
4
|
-
import { mailParagraph } from "../shared/index.js";
|
|
4
|
+
import { createMailLocaleTemplates, mailParagraph } from "../shared/index.js";
|
|
5
5
|
import { USER_DATA_RIGHTS_FEATURE } from "./web/constants.js";
|
|
6
6
|
const ALL_GDPR_MAIL_KINDS = [
|
|
7
7
|
"exportReady",
|
|
@@ -27,15 +27,13 @@ function gdprMailType(kind) {
|
|
|
27
27
|
function subjectKey(kind) {
|
|
28
28
|
return `gdpr.mail.${GDPR_MAIL_KINDS[kind].translationKey}.subject`;
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return key !== undefined && hasMailTranslationKey(locale, key) ? locale : "en";
|
|
38
|
-
}
|
|
30
|
+
const mailLocaleTemplates = createMailLocaleTemplates({
|
|
31
|
+
kinds: ALL_GDPR_MAIL_KINDS,
|
|
32
|
+
notificationTypes: GdprMailNotificationTypes,
|
|
33
|
+
subjectKey,
|
|
34
|
+
bodyFor: (kind, locale) => mailBody(kind, locale),
|
|
35
|
+
});
|
|
36
|
+
export const gdprMailTemplateLocale = mailLocaleTemplates.templateLocale;
|
|
39
37
|
const appName = () => templateVariable.text({ required: true });
|
|
40
38
|
export const GDPR_MAIL_VARIABLES = {
|
|
41
39
|
exportReady: {
|
|
@@ -85,29 +83,7 @@ function mailBody(kind, locale) {
|
|
|
85
83
|
return [greeting(locale), paragraph(kind, locale, "intro")].join("");
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
|
-
|
|
89
|
-
// registered its mail translations. English always ships; another locale only
|
|
90
|
-
// gets a template when it has its own subject, so a missing translation never
|
|
91
|
-
// silently becomes an English mail in that locale's slot.
|
|
92
|
-
export function gdprMailLocalizedTemplate(kind) {
|
|
93
|
-
const kindSubjectKey = subjectKey(kind);
|
|
94
|
-
return () => {
|
|
95
|
-
const locales = [
|
|
96
|
-
"en",
|
|
97
|
-
...listMailLocales().filter((locale) => locale !== "en" && hasMailTranslationKey(locale, kindSubjectKey)),
|
|
98
|
-
];
|
|
99
|
-
return Object.fromEntries(locales.map((locale) => [
|
|
100
|
-
locale,
|
|
101
|
-
{
|
|
102
|
-
body: mailBody(kind, locale),
|
|
103
|
-
meta: {
|
|
104
|
-
subject: mailT(locale, kindSubjectKey, { app: "{{appName}}" }),
|
|
105
|
-
category: "transactional",
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
]));
|
|
109
|
-
};
|
|
110
|
-
}
|
|
86
|
+
export const gdprMailLocalizedTemplate = mailLocaleTemplates.localizedTemplate;
|
|
111
87
|
export function registerGdprMails(r) {
|
|
112
88
|
for (const kind of ALL_GDPR_MAIL_KINDS) {
|
|
113
89
|
r.notification(GDPR_MAIL_KINDS[kind].name, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Logger } from "@cosmicdrift/kumiko-framework/logging";
|
|
2
2
|
import { type KmsAdapter } from "@cosmicdrift/kumiko-framework/crypto";
|
|
3
3
|
import { type DbRunner } from "@cosmicdrift/kumiko-framework/db";
|
|
4
4
|
import { type EscapeHatchAuditSink, type Registry, type TenantId, type TenantUserModel, type UserDataDeleteStrategy, type UserDataStorageProvider } from "@cosmicdrift/kumiko-framework/engine";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
|
|
2
1
|
// Forget-cleanup runner — pure-function pipeline.
|
|
3
2
|
//
|
|
4
3
|
// After the grace period, this runner processes users in DeletionRequested
|
|
@@ -28,36 +27,18 @@ import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
|
|
|
28
27
|
// collected and returned for operator visibility, while a user with failed
|
|
29
28
|
// hooks remains in DeletionRequested for automatic retry.
|
|
30
29
|
import { configuredPiiSubjectKms, subjectIdToKey, } from "@cosmicdrift/kumiko-framework/crypto";
|
|
31
|
-
import {
|
|
30
|
+
import { entityEventName, executeRawQuery, fetchOne, nullBlindIndexesForSubject, selectMany, WritePurposes, } from "@cosmicdrift/kumiko-framework/db";
|
|
32
31
|
import { deleteStoredFileAndDerivatives } from "@cosmicdrift/kumiko-framework/derivatives";
|
|
33
32
|
import { EXT_USER_DATA, EXT_USER_DATA_ORDER, extensionUsageEscapeHatchReason, } from "@cosmicdrift/kumiko-framework/engine";
|
|
34
33
|
import { runInSystemRowLevelSecurityScope } from "@cosmicdrift/kumiko-framework/internal/row-level-security";
|
|
35
|
-
import { createEscapeHatchReporter, UNATTRIBUTED_ACTOR, } from "@cosmicdrift/kumiko-framework/pipeline";
|
|
36
34
|
import { purgeSearchDocumentsForSubject, } from "@cosmicdrift/kumiko-framework/search";
|
|
37
35
|
import { resolveRetentionPolicyForTenant, resolveTenantRetentionPreset, } from "../data-retention/index.js";
|
|
38
36
|
import { decryptStoredPii, purgeFilesReachingSubject, runInSubTransaction, } from "../shared/index.js";
|
|
39
37
|
import { tenantMembershipsTable } from "../tenant/index.js";
|
|
40
38
|
import { USER_STATUS, userTable } from "../user/index.js";
|
|
39
|
+
import { buildHookDb } from "./build-hook-db.js";
|
|
41
40
|
import { selectUsersDueForForgetCleanup } from "./db/queries/forget-cleanup.js";
|
|
42
41
|
import { updateUserLifecycle } from "./lib/update-user-lifecycle.js";
|
|
43
|
-
function buildHookDb(db, tenantId, entry, args) {
|
|
44
|
-
const report = createEscapeHatchReporter({
|
|
45
|
-
handler: `${EXT_USER_DATA}:${entry.entityName}`,
|
|
46
|
-
tenantId,
|
|
47
|
-
actor: args.actor ?? UNATTRIBUTED_ACTOR,
|
|
48
|
-
sink: args.escapeHatchAuditSink,
|
|
49
|
-
log: args.escapeHatchAuditLog ?? createFallbackLogger("user-data-rights"),
|
|
50
|
-
});
|
|
51
|
-
return createTenantDb({
|
|
52
|
-
db,
|
|
53
|
-
tenantId,
|
|
54
|
-
mode: "tenant",
|
|
55
|
-
grants: {
|
|
56
|
-
unsafeRaw: entry.escapeHatchReason !== undefined ? { reason: entry.escapeHatchReason } : undefined,
|
|
57
|
-
report,
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
42
|
// EXT_USER_DATA delete-hooks default here; a hook that redacts data keyed on an
|
|
62
43
|
// owner column it doesn't own must register a lower order so it runs BEFORE any
|
|
63
44
|
// hook that nulls that column. See custom-fields wire-user-data-rights.ts.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Logger } from "@cosmicdrift/kumiko-framework/logging";
|
|
2
2
|
import type { DbRunner } from "@cosmicdrift/kumiko-framework/db";
|
|
3
3
|
import { type EscapeHatchAuditSink, type Registry, type TenantId, type UserDataExportSnippet } from "@cosmicdrift/kumiko-framework/engine";
|
|
4
4
|
import type { getTemporal } from "@cosmicdrift/kumiko-framework/time";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
|
|
2
1
|
// User data export pipeline — GDPR Art. 15 (access) +
|
|
3
2
|
// Art. 20 (data portability).
|
|
4
3
|
//
|
|
@@ -20,30 +19,12 @@ import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
|
|
|
20
19
|
// user-data-rights-defaults/hooks/user.userdata-hook explicitly exposes
|
|
21
20
|
// neither passwordHash nor roles (privileged columns).
|
|
22
21
|
import { configuredPiiSubjectKms, decryptPiiFieldValues, isPiiCiphertext, } from "@cosmicdrift/kumiko-framework/crypto";
|
|
23
|
-
import { collectEncryptedFieldNames, configuredEntityFieldEncryption,
|
|
22
|
+
import { collectEncryptedFieldNames, configuredEntityFieldEncryption, decryptEntityFieldValues, selectMany, } from "@cosmicdrift/kumiko-framework/db";
|
|
24
23
|
import { EXT_USER_DATA, extensionUsageEscapeHatchReason, maskWriteOnlyFields, } from "@cosmicdrift/kumiko-framework/engine";
|
|
25
24
|
import { runInSystemRowLevelSecurityScope } from "@cosmicdrift/kumiko-framework/internal/row-level-security";
|
|
26
|
-
import { createEscapeHatchReporter, UNATTRIBUTED_ACTOR, } from "@cosmicdrift/kumiko-framework/pipeline";
|
|
27
25
|
import { tenantMembershipsTable } from "../tenant/index.js";
|
|
26
|
+
import { buildHookDb } from "./build-hook-db.js";
|
|
28
27
|
import { buildFileRefZipPath } from "./zip-path.js";
|
|
29
|
-
function buildHookDb(db, tenantId, entry, args) {
|
|
30
|
-
const report = createEscapeHatchReporter({
|
|
31
|
-
handler: `${EXT_USER_DATA}:${entry.entityName}`,
|
|
32
|
-
tenantId,
|
|
33
|
-
actor: args.actor ?? UNATTRIBUTED_ACTOR,
|
|
34
|
-
sink: args.escapeHatchAuditSink,
|
|
35
|
-
log: args.escapeHatchAuditLog ?? createFallbackLogger("user-data-rights"),
|
|
36
|
-
});
|
|
37
|
-
return createTenantDb({
|
|
38
|
-
db,
|
|
39
|
-
tenantId,
|
|
40
|
-
mode: "tenant",
|
|
41
|
-
grants: {
|
|
42
|
-
unsafeRaw: entry.escapeHatchReason !== undefined ? { reason: entry.escapeHatchReason } : undefined,
|
|
43
|
-
report,
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
28
|
/**
|
|
48
29
|
* Pure function: invokes all EXT_USER_DATA hooks for each tenant
|
|
49
30
|
* membership and collects snippets into a UserExportBundle.
|
|
@@ -13,10 +13,7 @@
|
|
|
13
13
|
// **Multi-use within TTL:** The token is NOT "consumed" on download, so the user
|
|
14
14
|
// can download repeatedly until expiresAt. This matches Google-Takeout (7d) and
|
|
15
15
|
// Facebook-Data-Download (4d).
|
|
16
|
-
|
|
17
|
-
// **Universal Web-Crypto API:** crypto.getRandomValues + crypto.subtle.digest
|
|
18
|
-
// runs identically in Bun, Node 19+, and browsers, avoiding platform-specific
|
|
19
|
-
// imports.
|
|
16
|
+
import { hashOpaqueToken } from "@cosmicdrift/kumiko-framework/crypto";
|
|
20
17
|
/**
|
|
21
18
|
* Generates a new download token. The plain token is sent to the user by email;
|
|
22
19
|
* the hash is stored in the token database row.
|
|
@@ -36,9 +33,7 @@ export async function generateDownloadToken() {
|
|
|
36
33
|
* database (no constant-time comparison, see the header comment).
|
|
37
34
|
*/
|
|
38
35
|
export async function hashDownloadToken(plain) {
|
|
39
|
-
|
|
40
|
-
const digest = await crypto.subtle.digest("SHA-256", encoded);
|
|
41
|
-
return uint8ArrayToHex(new Uint8Array(digest));
|
|
36
|
+
return hashOpaqueToken(plain);
|
|
42
37
|
}
|
|
43
38
|
function uint8ArrayToBase64Url(bytes) {
|
|
44
39
|
// btoa expects a binary string. atob/btoa are universal in Bun, Node, and browsers.
|
|
@@ -48,10 +43,3 @@ function uint8ArrayToBase64Url(bytes) {
|
|
|
48
43
|
}
|
|
49
44
|
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
50
45
|
}
|
|
51
|
-
function uint8ArrayToHex(bytes) {
|
|
52
|
-
let out = "";
|
|
53
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
54
|
-
out += bytes[i].toString(16).padStart(2, "0"); // @cast-boundary dynamic-key
|
|
55
|
-
}
|
|
56
|
-
return out;
|
|
57
|
-
}
|
|
@@ -14,6 +14,7 @@ import { useDispatcher, usePrimitives, useQuery, useTranslation, } from "@cosmic
|
|
|
14
14
|
import { postWithDownload } from "@cosmicdrift/kumiko-renderer/web";
|
|
15
15
|
import { propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
16
16
|
import { useEffect, useState } from "react";
|
|
17
|
+
import { StatusBanner } from "../../shared/web/status-banner.js";
|
|
17
18
|
import { EXPORT_JOB_STATUS, UserDataRightsHandlers, UserDataRightsQueries, } from "./constants.js";
|
|
18
19
|
// The export job runs asynchronously (worker-Lane-Cron, ~1 Min). While it is
|
|
19
20
|
// pending/running, the screen polls its status so the download appears without
|
|
@@ -34,17 +35,6 @@ export function formatDate(iso) {
|
|
|
34
35
|
const tIndex = iso.indexOf("T");
|
|
35
36
|
return tIndex > 0 ? iso.slice(0, tIndex) : iso;
|
|
36
37
|
}
|
|
37
|
-
function StatusBanner({ status }) {
|
|
38
|
-
const t = useTranslation();
|
|
39
|
-
const { Banner } = usePrimitives();
|
|
40
|
-
if (status.kind === "success") {
|
|
41
|
-
return _jsx(Banner, { variant: "info", children: t(status.messageKey) });
|
|
42
|
-
}
|
|
43
|
-
if (status.kind === "error") {
|
|
44
|
-
return _jsx(Banner, { variant: "error", children: t(status.messageKey) });
|
|
45
|
-
}
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
38
|
// Mounted by the renderer's ExtensionSectionMount (already wrapped in
|
|
49
39
|
// <Section title={...} testId="section-extension-...">) — takes no props of
|
|
50
40
|
// its own, ExtensionSectionProps (entityName/entityId/...) are unused since
|
|
@@ -4,6 +4,7 @@ import { RequestAccountDeletionScreen } from "./request-deletion-screen.js";
|
|
|
4
4
|
const centeredShell = (screen) => (_jsx("div", { className: "min-h-screen flex items-center justify-center bg-background px-4", children: screen }));
|
|
5
5
|
export function makePublicDeletionGate(routes) {
|
|
6
6
|
const shell = routes.shell ?? centeredShell;
|
|
7
|
+
// biome-ignore lint/correctness/noComponentHookFactories: setup-time factory, called once per userDataRightsClient(); gates only receive children, so routes are bound here
|
|
7
8
|
function PublicDeletionGate({ children }) {
|
|
8
9
|
const path = window.location.pathname;
|
|
9
10
|
if (path === routes.requestPath)
|
|
@@ -11,6 +11,7 @@ import { propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
|
11
11
|
import { useState } from "react";
|
|
12
12
|
import { AuthHandlers } from "../../auth-email-password/web/constants.js";
|
|
13
13
|
import { requestEmailVerification } from "../../auth-email-password/web/index.js";
|
|
14
|
+
import { StatusBanner } from "../../shared/web/status-banner.js";
|
|
14
15
|
import { UserProfileHandlers } from "./constants.js";
|
|
15
16
|
// Dispatcher failures carry an i18nKey only when the handler sets one —
|
|
16
17
|
// boundary read with a generic fallback.
|
|
@@ -18,17 +19,6 @@ function failureKey(error) {
|
|
|
18
19
|
const key = propertyOf(error, "i18nKey");
|
|
19
20
|
return typeof key === "string" ? key : "profile.errors.generic";
|
|
20
21
|
}
|
|
21
|
-
function StatusBanner({ status }) {
|
|
22
|
-
const t = useTranslation();
|
|
23
|
-
const { Banner } = usePrimitives();
|
|
24
|
-
if (status.kind === "success") {
|
|
25
|
-
return _jsx(Banner, { variant: "info", children: t(status.messageKey) });
|
|
26
|
-
}
|
|
27
|
-
if (status.kind === "error") {
|
|
28
|
-
return _jsx(Banner, { variant: "error", children: t(status.messageKey) });
|
|
29
|
-
}
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
22
|
// Mounted by the renderer's ExtensionSectionMount (already wrapped in
|
|
33
23
|
// <Section title={...} testId="section-extension-...">) — takes no props of
|
|
34
24
|
// its own. Deliberately NOT a <Form>: RenderEdit already renders a host
|