@cosmicdrift/kumiko-samples 0.406.0 → 0.410.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/packages/bundled-features/package.json +31 -4
- package/packages/bundled-features/src/account-security/feature.ts +9 -1
- package/packages/bundled-features/src/admin-shell/changes.json +6 -0
- package/packages/bundled-features/src/admin-shell/feature.ts +4 -1
- package/packages/bundled-features/src/agent-tools/agent-manifest.ts +1 -0
- package/packages/bundled-features/src/agent-tools/changes.json +6 -0
- package/packages/bundled-features/src/agent-tools/tool-catalog.ts +1 -0
- package/packages/bundled-features/src/agent-tools/types.ts +4 -0
- package/packages/bundled-features/src/audit/event-classification.ts +1 -0
- package/packages/bundled-features/src/auth-email-password/bootstrap.ts +1 -0
- package/packages/bundled-features/src/auth-email-password/errors.ts +18 -66
- package/packages/bundled-features/src/auth-email-password/handlers/login-options.query.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/self-registration-status.query.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/web/auth-client.ts +30 -64
- package/packages/bundled-features/src/auth-email-password/web/auth-redirect.ts +2 -2
- package/packages/bundled-features/src/auth-email-password/web/confirm-account-unlock-screen.tsx +20 -66
- package/packages/bundled-features/src/auth-email-password/web/index.ts +1 -0
- package/packages/bundled-features/src/auth-email-password/web/read-path-param.ts +8 -0
- package/packages/bundled-features/src/auth-email-password/web/return-path.ts +3 -2
- package/packages/bundled-features/src/auth-email-password/web/token-confirm-screen.tsx +97 -0
- package/packages/bundled-features/src/auth-email-password/web/verify-email-screen.tsx +20 -68
- package/packages/bundled-features/src/auth-foundation/boot-checks.ts +22 -15
- package/packages/bundled-features/src/auth-foundation/boot-rules.ts +33 -0
- package/packages/bundled-features/src/auth-mfa/errors.ts +12 -42
- package/packages/bundled-features/src/auth-mfa/feature-exports.ts +6 -45
- package/packages/bundled-features/src/auth-mfa/feature.ts +8 -19
- package/packages/bundled-features/src/auth-mfa/web/mfa-client.ts +19 -33
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-notify.ts +1 -0
- package/packages/bundled-features/src/billing-foundation/web/plan-price.ts +20 -7
- package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +1 -0
- package/packages/bundled-features/src/channel-in-app/changes.json +7 -0
- package/packages/bundled-features/src/channel-in-app/feature.ts +2 -0
- package/packages/bundled-features/src/channel-in-app/handlers/read-state-by-keys.query.ts +35 -0
- package/packages/bundled-features/src/channel-in-app/in-app-channel.ts +1 -0
- package/packages/bundled-features/src/channel-in-app/tables.ts +5 -1
- package/packages/bundled-features/src/compliance-profiles/handlers/sub-processors.query.ts +4 -1
- package/packages/bundled-features/src/contact/challenge.ts +41 -0
- package/packages/bundled-features/src/contact/changes.json +33 -0
- package/packages/bundled-features/src/contact/client/contact-client-source.ts +203 -0
- package/packages/bundled-features/src/contact/client/contact-website-client.ts +29 -0
- package/packages/bundled-features/src/contact/client/index.ts +9 -0
- package/packages/bundled-features/src/contact/entity.ts +168 -0
- package/packages/bundled-features/src/contact/feature.ts +174 -0
- package/packages/bundled-features/src/contact/handlers/access.ts +17 -0
- package/packages/bundled-features/src/contact/handlers/attempts.ts +76 -0
- package/packages/bundled-features/src/contact/handlers/challenge.query.ts +44 -0
- package/packages/bundled-features/src/contact/handlers/forward-request.write.ts +98 -0
- package/packages/bundled-features/src/contact/handlers/mark-done.write.ts +40 -0
- package/packages/bundled-features/src/contact/handlers/notify-reporter-in-app.write.ts +48 -0
- package/packages/bundled-features/src/contact/handlers/open-count.query.ts +15 -0
- package/packages/bundled-features/src/contact/handlers/open-count.ts +17 -0
- package/packages/bundled-features/src/contact/handlers/replies.query.ts +29 -0
- package/packages/bundled-features/src/contact/handlers/reply.write.ts +197 -0
- package/packages/bundled-features/src/contact/handlers/report.write.ts +126 -0
- package/packages/bundled-features/src/contact/handlers/request-delivery.query.ts +143 -0
- package/packages/bundled-features/src/contact/handlers/request-detail.query.ts +50 -0
- package/packages/bundled-features/src/contact/handlers/request-list.query.ts +14 -0
- package/packages/bundled-features/src/contact/handlers/send-reply-mail.write.ts +124 -0
- package/packages/bundled-features/src/contact/handlers/send-test.write.ts +45 -0
- package/packages/bundled-features/src/contact/handlers/submit.write.ts +194 -0
- package/packages/bundled-features/src/contact/handlers/take-over-uploads.ts +47 -0
- package/packages/bundled-features/src/contact/i18n.ts +192 -0
- package/packages/bundled-features/src/contact/index.ts +29 -0
- package/packages/bundled-features/src/contact/lib.ts +176 -0
- package/packages/bundled-features/src/contact/mail.ts +401 -0
- package/packages/bundled-features/src/contact/options.ts +95 -0
- package/packages/bundled-features/src/contact/panels.ts +28 -0
- package/packages/bundled-features/src/contact/payloads.ts +106 -0
- package/packages/bundled-features/src/contact/pow.ts +22 -0
- package/packages/bundled-features/src/contact/screens.ts +507 -0
- package/packages/bundled-features/src/contact/subject.ts +13 -0
- package/packages/bundled-features/src/contact/user-agent.ts +39 -0
- package/packages/bundled-features/src/contact/user-data-hooks.ts +180 -0
- package/packages/bundled-features/src/contact/web/constants.ts +160 -0
- package/packages/bundled-features/src/contact/web/index.ts +29 -0
- package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +5 -16
- package/packages/bundled-features/src/data-retention/changes.json +6 -0
- package/packages/bundled-features/src/data-retention/feature.ts +16 -2
- package/packages/bundled-features/src/data-retention/index.ts +5 -0
- package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +138 -41
- package/packages/bundled-features/src/data-retention/tenant-destruction-hold.ts +196 -0
- package/packages/bundled-features/src/delivery/address-opt-out.ts +1 -0
- package/packages/bundled-features/src/delivery/changes.json +7 -0
- package/packages/bundled-features/src/delivery/channel-context.ts +2 -0
- package/packages/bundled-features/src/delivery/delivery-service.ts +29 -5
- package/packages/bundled-features/src/delivery/events.ts +2 -0
- package/packages/bundled-features/src/delivery/feature.ts +3 -2
- package/packages/bundled-features/src/delivery/handlers/attempts-by-keys.query.ts +55 -0
- package/packages/bundled-features/src/delivery/handlers/log.query.ts +1 -1
- package/packages/bundled-features/src/delivery/jobs.ts +5 -0
- package/packages/bundled-features/src/delivery/tables.ts +13 -2
- package/packages/bundled-features/src/delivery/types.ts +3 -0
- package/packages/bundled-features/src/delivery/unsubscribe-page.ts +2 -0
- package/packages/bundled-features/src/delivery/web/delivery-channel-cell.tsx +1 -1
- package/packages/bundled-features/src/delivery/web/delivery-error-cell.tsx +1 -1
- package/packages/bundled-features/src/delivery/web/delivery-status-cell.tsx +1 -1
- package/packages/bundled-features/src/delivery/web/delivery-time-cell.tsx +3 -2
- package/packages/bundled-features/src/delivery/web/delivery-type-cell.tsx +1 -1
- package/packages/bundled-features/src/delivery/web/public-names.ts +1 -0
- package/packages/bundled-features/src/document-ingest-foundation/boot-checks.ts +14 -9
- package/packages/bundled-features/src/document-ingest-foundation/boot-rules.ts +22 -0
- package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
- package/packages/bundled-features/src/document-ingest-foundation/events.ts +17 -0
- package/packages/bundled-features/src/document-ingest-foundation/feature.ts +39 -1
- package/packages/bundled-features/src/document-ingest-foundation/index.ts +10 -0
- package/packages/bundled-features/src/document-ingest-foundation/report-ingest-progress.ts +43 -0
- package/packages/bundled-features/src/document-ingest-foundation/tables.ts +43 -0
- package/packages/bundled-features/src/file-derivatives/handlers/public-variant-by-file-ref.query.ts +1 -1
- package/packages/bundled-features/src/file-derivatives/handlers/public-variant.query.ts +1 -1
- package/packages/bundled-features/src/files-tenant-data/changes.json +6 -0
- package/packages/bundled-features/src/files-tenant-data/hooks.ts +4 -1
- package/packages/bundled-features/src/folders/web/folder-manager.tsx +8 -9
- package/packages/bundled-features/src/folders/web/folder-section.tsx +1 -1
- package/packages/bundled-features/src/form-draft-user-data/index.ts +2 -0
- package/packages/bundled-features/src/inbound-mail-foundation/changes.json +13 -0
- package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +2 -0
- package/packages/bundled-features/src/inbound-mail-foundation/events.ts +2 -0
- package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +6 -6
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/attach-message-content.write.ts +7 -0
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/ingest-message.write.ts +6 -0
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/list-messages.query.ts +6 -2
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/message-content.query.ts +3 -0
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/message-content.ts +19 -0
- package/packages/bundled-features/src/inbound-mail-foundation/projection.ts +2 -0
- package/packages/bundled-features/src/inbound-mail-foundation/sanitize-inbound-html.ts +150 -0
- package/packages/bundled-features/src/inbound-mail-foundation/types.ts +1 -0
- package/packages/bundled-features/src/jobs/job-run-logger.ts +24 -25
- package/packages/bundled-features/src/ledger/handlers/reports.query.ts +46 -31
- package/packages/bundled-features/src/ledger/recurring.ts +1 -0
- package/packages/bundled-features/src/managed-pages/handlers/branding.query.ts +1 -1
- package/packages/bundled-features/src/managed-pages/handlers/by-slug.query.ts +1 -1
- package/packages/bundled-features/src/managed-pages/handlers/by-tenant-published.query.ts +1 -1
- package/packages/bundled-features/src/notes-history/web/notes-section.tsx +3 -1
- package/packages/bundled-features/src/personal-access-tokens/feature.ts +9 -17
- package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +2 -7
- package/packages/bundled-features/src/secrets/changes.json +6 -0
- package/packages/bundled-features/src/secrets/handlers/delete.write.ts +8 -4
- package/packages/bundled-features/src/secrets/handlers/list.query.ts +6 -3
- package/packages/bundled-features/src/secrets/handlers/set.write.ts +9 -4
- package/packages/bundled-features/src/secrets/secret-scope.ts +33 -0
- package/packages/bundled-features/src/seo/handlers/seo-config.query.ts +1 -1
- package/packages/bundled-features/src/sessions/changes.json +6 -0
- package/packages/bundled-features/src/sessions/feature.ts +21 -18
- package/packages/bundled-features/src/sessions/handlers/last-activity-probe.query.ts +53 -0
- package/packages/bundled-features/src/sessions/handlers/last-activity-probe.route.ts +39 -0
- package/packages/bundled-features/src/sessions/screens.ts +1 -0
- package/packages/bundled-features/src/sessions/session-callbacks.ts +13 -12
- package/packages/bundled-features/src/sessions/web/i18n.ts +4 -1
- package/packages/bundled-features/src/shared/assert-billing-live.ts +14 -0
- package/packages/bundled-features/src/shared/collect-extension-options.ts +12 -0
- package/packages/bundled-features/src/shared/index.ts +16 -0
- package/packages/bundled-features/src/shared/late-bound-slot.ts +19 -0
- package/packages/bundled-features/src/shared/mail-locale-templates.ts +7 -1
- package/packages/bundled-features/src/shared/price-env-shape.ts +44 -0
- package/packages/bundled-features/src/shared/purge-row-file-refs.ts +1 -1
- package/packages/bundled-features/src/shared/read-feature-export-fn.ts +16 -0
- package/packages/bundled-features/src/shared/signup-handover.ts +3 -4
- package/packages/bundled-features/src/shared/tenant-destruction-hold.ts +49 -0
- package/packages/bundled-features/src/shared/unprocessable.ts +19 -0
- package/packages/bundled-features/src/shared/web/index.ts +3 -0
- package/packages/bundled-features/src/subscription-paddle/checkout-config.query.ts +1 -1
- package/packages/bundled-features/src/subscription-paddle/feature.ts +7 -15
- package/packages/bundled-features/src/subscription-paddle/runtime.ts +4 -7
- package/packages/bundled-features/src/subscription-stripe/feature.ts +7 -15
- package/packages/bundled-features/src/subscription-stripe/runtime.ts +4 -7
- package/packages/bundled-features/src/tags/entity.ts +1 -0
- package/packages/bundled-features/src/tags/web/tag-chip.tsx +14 -0
- package/packages/bundled-features/src/tags/web/tag-filter.tsx +4 -5
- package/packages/bundled-features/src/tags/web/tag-manager.tsx +1 -1
- package/packages/bundled-features/src/tags/web/tag-section.tsx +3 -6
- package/packages/bundled-features/src/tags/web/tags-cell.tsx +4 -5
- package/packages/bundled-features/src/template-resolver/compile-document-body.ts +27 -15
- package/packages/bundled-features/src/template-resolver/handlers/by-slug.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +12 -9
- package/packages/bundled-features/src/template-resolver/handlers/discard-draft.write.ts +1 -0
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +1 -0
- package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +5 -5
- package/packages/bundled-features/src/template-resolver/handlers/toggle-status.write.ts +3 -0
- package/packages/bundled-features/src/template-resolver/linked-resources.ts +11 -6
- package/packages/bundled-features/src/template-resolver/store-template-resource.ts +15 -12
- package/packages/bundled-features/src/template-resolver/web/document-images.ts +6 -6
- package/packages/bundled-features/src/template-resolver/web/document-insert-fields.tsx +41 -36
- package/packages/bundled-features/src/template-resolver/web/document-schema.ts +11 -12
- package/packages/bundled-features/src/template-resolver/web/tiptap-attribute-parse-rule.ts +19 -0
- package/packages/bundled-features/src/tenant/i18n.ts +3 -0
- package/packages/bundled-features/src/tenant/schema/tenant.ts +1 -0
- package/packages/bundled-features/src/tenant/web/member-roles-cell.tsx +1 -1
- package/packages/bundled-features/src/tenant/web/member-status-cell.tsx +1 -1
- package/packages/bundled-features/src/tenant-inactivity/changes.json +8 -0
- package/packages/bundled-features/src/tenant-inactivity/check-inactive-tenants.ts +260 -0
- package/packages/bundled-features/src/tenant-inactivity/constants.ts +12 -0
- package/packages/bundled-features/src/tenant-inactivity/email-templates.ts +24 -0
- package/packages/bundled-features/src/tenant-inactivity/feature.ts +66 -0
- package/packages/bundled-features/src/tenant-inactivity/handlers/inactivity-state.query.ts +49 -0
- package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +59 -0
- package/packages/bundled-features/src/tenant-inactivity/inactivity-plan.ts +187 -0
- package/packages/bundled-features/src/tenant-inactivity/index.ts +5 -0
- package/packages/bundled-features/src/tenant-inactivity/keep-token.ts +44 -0
- package/packages/bundled-features/src/tenant-inactivity/mail-notifications.ts +62 -0
- package/packages/bundled-features/src/tenant-inactivity/options.ts +38 -0
- package/packages/bundled-features/src/tenant-inactivity/remote-activity.ts +32 -0
- package/packages/bundled-features/src/tenant-inactivity/state-store.ts +71 -0
- package/packages/bundled-features/src/tenant-inactivity/state-table.ts +50 -0
- package/packages/bundled-features/src/tenant-lifecycle/boot-checks.ts +8 -6
- package/packages/bundled-features/src/tenant-lifecycle/boot-rules.ts +16 -0
- package/packages/bundled-features/src/tenant-lifecycle/changes.json +18 -0
- package/packages/bundled-features/src/tenant-lifecycle/feature.ts +24 -1
- package/packages/bundled-features/src/tenant-lifecycle/handlers/request-destruction.write.ts +12 -87
- package/packages/bundled-features/src/tenant-lifecycle/index.ts +4 -0
- package/packages/bundled-features/src/tenant-lifecycle/request-tenant-destruction.ts +108 -0
- package/packages/bundled-features/src/tenant-lifecycle/retention-config-destroy-hooks.ts +62 -0
- package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +58 -5
- package/packages/bundled-features/src/tenant-lifecycle/stages.ts +31 -2
- package/packages/bundled-features/src/tenant-lifecycle/testing.ts +1 -1
- package/packages/bundled-features/src/tier-engine/caps-for-tier-from-map.ts +16 -0
- package/packages/bundled-features/src/tier-engine/changes.json +6 -0
- package/packages/bundled-features/src/tier-engine/compose-app.ts +21 -20
- package/packages/bundled-features/src/tier-engine/index.ts +1 -0
- package/packages/bundled-features/src/user-data-rights/feature.ts +2 -0
- package/packages/bundled-features/src/user-data-rights/handlers/confirm-deletion-by-token.write.ts +4 -1
- package/packages/bundled-features/src/user-data-rights/handlers/download-by-token.query.ts +1 -0
- package/packages/bundled-features/src/user-data-rights/handlers/request-deletion-by-email.write.ts +4 -1
- package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +2 -0
- package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -1
- package/packages/bundled-features/src/user-data-rights/zip-path.ts +1 -0
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/config-value.userdata-hook.ts +8 -27
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/delivery-attempt.userdata-hook.ts +11 -8
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/forget-own-rows-delete-hook.ts +42 -0
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/notification-preference.userdata-hook.ts +8 -27
- package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +2 -6
- package/packages/bundled-features/src/user-profile/web/profile-screen.tsx +2 -3
- package/packages/bundled-features/src/waitlist/changes.json +6 -0
- package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +1 -2
- package/samples/apps/styleguide/src/features/widgets/i18n.ts +6 -0
- package/samples/apps/styleguide/src/features/widgets/web/InboxReaderExamples.tsx +158 -0
- package/samples/apps/styleguide/src/features/widgets/web/Widgets.tsx +2 -0
- package/samples/apps/styleguide/src/features/widgets/web/sample-pdf.ts +28 -0
- package/samples/apps/use-all-bundled/feature-manifest.json +113 -2
- package/samples/apps/use-all-bundled/kumiko/migrations/0063_contact.rebuild.json +4 -0
- package/samples/apps/use-all-bundled/package.json +1 -0
- package/samples/apps/use-all-bundled/src/app/client.tsx +3 -0
- package/samples/apps/use-all-bundled/src/app/screens-feature.ts +46 -2
- package/samples/apps/use-all-bundled/src/run-config.ts +23 -1
- package/samples/recipes/anonymous-access/README.md +2 -0
- package/samples/recipes/anonymous-access/src/feature.ts +7 -1
- package/samples/recipes/contact/README.md +52 -0
- package/samples/recipes/contact/package.json +12 -0
- package/samples/recipes/contact/src/feature.ts +27 -0
- package/samples/recipes/delivery-notifications/src/feature.ts +3 -0
- package/samples/recipes/record-detail-layout/src/feature.ts +9 -1
- package/samples/recipes/search/README.md +2 -0
- package/samples/recipes/search/src/feature.ts +27 -2
- package/samples/recipes/secrets-demo/README.md +1 -0
- package/samples/recipes/secrets-demo/src/feature.ts +56 -0
- package/samples/recipes/tenant-inactivity/README.md +21 -0
- package/samples/recipes/tenant-inactivity/package.json +12 -0
|
@@ -31,7 +31,7 @@ export const byTenantQuery = defineQueryHandler({
|
|
|
31
31
|
/** Optional cross-tenant read — SystemAdmin only. Symmetric to by-slug. */
|
|
32
32
|
tenantIdOverride: z.string().min(1).optional(),
|
|
33
33
|
}),
|
|
34
|
-
access: { roles: ["anonymous", "User", "TenantAdmin", "SystemAdmin"] },
|
|
34
|
+
access: { roles: ["anonymous", "User", "TenantAdmin", "SystemAdmin"], anySignedIn: true },
|
|
35
35
|
rateLimit: { per: "ip+handler", limit: 60, windowSeconds: 60 },
|
|
36
36
|
description:
|
|
37
37
|
"Lists every text-block of a tenant with slug, locale, title and body so a public content tree can be rendered in one call; use it for the whole sidebar, and by-slug when only one block is needed.",
|
|
@@ -44,14 +44,17 @@ export const byTenantQuery = defineQueryHandler({
|
|
|
44
44
|
const policy = deliveryPolicyOf(ctx.registry);
|
|
45
45
|
const served = await filterDeliveredTo(ctx.db, policy, query.user, rows);
|
|
46
46
|
return {
|
|
47
|
-
blocks: served.map(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
blocks: served.map(
|
|
48
|
+
// guard:dup-ok block field selection; only the object-literal shape matches other mappers
|
|
49
|
+
(row) => ({
|
|
50
|
+
slug: row.slug,
|
|
51
|
+
locale: row.locale,
|
|
52
|
+
title: row.title,
|
|
53
|
+
content: row.content,
|
|
54
|
+
folder: row.folder,
|
|
55
|
+
modifiedAt: row.modifiedAt,
|
|
56
|
+
}),
|
|
57
|
+
),
|
|
55
58
|
};
|
|
56
59
|
},
|
|
57
60
|
});
|
|
@@ -65,6 +65,7 @@ export function makeDiscardDraftWrite(policy: TemplateEditPolicy) {
|
|
|
65
65
|
"Throws away the open draft of one template resource of the caller's tenant so the editor shows the active version again; the served version is untouched. Refused with no_draft when there is no draft. Outside the templates the app lists in tenantEditable only a SystemAdmin may use it.",
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
|
+
// guard:dup-ok one configured createDiscardDraftHandler instance; only name, scope and description differ
|
|
68
69
|
export function makeDiscardDraftSystemWrite(policy: TemplateEditPolicy) {
|
|
69
70
|
return createDiscardDraftHandler(
|
|
70
71
|
policy,
|
|
@@ -320,6 +320,7 @@ function withUsage(
|
|
|
320
320
|
let usedBy: OverviewUsage[] = [];
|
|
321
321
|
if (draft.kind === "mail" || draft.kind === "mail-layout") {
|
|
322
322
|
usedBy = collectTemplateUsage(registry, draft.slug, draft.kind, effectiveLayouts).map(
|
|
323
|
+
// guard:dup-ok usage field selection; only the object-literal shape matches other mappers
|
|
323
324
|
(entry) => ({
|
|
324
325
|
qualifiedName: entry.qualifiedName,
|
|
325
326
|
feature: entry.feature,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import { UnprocessableError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
3
|
import * as z from "zod";
|
|
4
|
+
import { unprocessable } from "../../shared/index.ts";
|
|
4
5
|
import {
|
|
5
6
|
refuseTemplateEdit,
|
|
6
7
|
type TemplateEditPolicy,
|
|
@@ -20,11 +21,10 @@ const TEST_MAIL_RATE_LIMIT = { limit: 10, windowSeconds: 3600 } as const;
|
|
|
20
21
|
|
|
21
22
|
// Transport errors can carry provider responses or the address, so the client only gets a fixed code.
|
|
22
23
|
function testMailFailed(code: "channel_error" | "not_sent") {
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}),
|
|
24
|
+
return unprocessable(
|
|
25
|
+
TemplateResolverErrors.testMailFailed,
|
|
26
|
+
"templateResolver.errors.testMail.failed",
|
|
27
|
+
{ code },
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -119,6 +119,7 @@ export function makeArchiveWrite(policy: TemplateEditPolicy) {
|
|
|
119
119
|
"Sets one template resource of the caller's tenant to archived so the resolver stops serving it while the row and its content survive; use it to retire a template reversibly instead of deleting it. An open draft stays. Outside the templates the app lists in tenantEditable only a SystemAdmin may use it.",
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
|
+
// guard:dup-ok one configured createStatusUpdateHandler instance; only name, scope, status and description differ
|
|
122
123
|
export function makePublishWrite(policy: TemplateEditPolicy) {
|
|
123
124
|
return createStatusUpdateHandler(
|
|
124
125
|
policy,
|
|
@@ -128,6 +129,7 @@ export function makePublishWrite(policy: TemplateEditPolicy) {
|
|
|
128
129
|
"Sets one template resource of the caller's tenant to active so the resolver starts serving it; use it to release a draft written by upsert-tenant (a draft saved beside an active version replaces it), or to bring an archived template back; a version with unknown placeholders or unused required variables is refused and the served version stays. Outside the templates the app lists in tenantEditable only a SystemAdmin may use it.",
|
|
129
130
|
);
|
|
130
131
|
}
|
|
132
|
+
// guard:dup-ok one configured createStatusUpdateHandler instance; only name, scope, status and description differ
|
|
131
133
|
export function makeArchiveSystemWrite(policy: TemplateEditPolicy) {
|
|
132
134
|
return createStatusUpdateHandler(
|
|
133
135
|
policy,
|
|
@@ -137,6 +139,7 @@ export function makeArchiveSystemWrite(policy: TemplateEditPolicy) {
|
|
|
137
139
|
"Sets one system-default template to archived so the resolver stops serving it to every tenant that has no override; SystemAdmin only, reversible with publish-system.",
|
|
138
140
|
);
|
|
139
141
|
}
|
|
142
|
+
// guard:dup-ok one configured createStatusUpdateHandler instance; only name, scope, status and description differ
|
|
140
143
|
export function makePublishSystemWrite(policy: TemplateEditPolicy) {
|
|
141
144
|
return createStatusUpdateHandler(
|
|
142
145
|
policy,
|
|
@@ -73,20 +73,25 @@ export function imageLinksOf(
|
|
|
73
73
|
return images;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
function entriesOfKind<TEntry extends LinkedResourceEntry>(
|
|
77
77
|
entries: Readonly<Record<string, LinkedResourceEntry>>,
|
|
78
|
-
|
|
78
|
+
isKind: (entry: LinkedResourceEntry) => entry is TEntry,
|
|
79
|
+
): TEntry[] {
|
|
79
80
|
return Object.entries(entries)
|
|
80
81
|
.sort(([a], [b]) => a.localeCompare(b))
|
|
81
|
-
.flatMap(([, entry]) => (
|
|
82
|
+
.flatMap(([, entry]) => (isKind(entry) ? [entry] : []));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function fileAttachmentsOf(
|
|
86
|
+
entries: Readonly<Record<string, LinkedResourceEntry>>,
|
|
87
|
+
): FileAttachmentRef[] {
|
|
88
|
+
return entriesOfKind(entries, isFileAttachmentEntry);
|
|
82
89
|
}
|
|
83
90
|
|
|
84
91
|
export function pdfAttachmentLinksOf(
|
|
85
92
|
entries: Readonly<Record<string, LinkedResourceEntry>>,
|
|
86
93
|
): TemplatePdfAttachmentLink[] {
|
|
87
|
-
return
|
|
88
|
-
.sort(([a], [b]) => a.localeCompare(b))
|
|
89
|
-
.flatMap(([, entry]) => (isPdfAttachmentLink(entry) ? [entry] : []));
|
|
94
|
+
return entriesOfKind(entries, isPdfAttachmentLink);
|
|
90
95
|
}
|
|
91
96
|
|
|
92
97
|
export function attachmentEntriesOf(
|
|
@@ -21,7 +21,11 @@ import {
|
|
|
21
21
|
uploadFileBytesBeforeTransaction,
|
|
22
22
|
} from "@cosmicdrift/kumiko-framework/files";
|
|
23
23
|
import { fileContextForTenant, readFileRefContent } from "../file-foundation/index.ts";
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
extensionForResourceContentType,
|
|
26
|
+
requireForTenant,
|
|
27
|
+
unprocessable,
|
|
28
|
+
} from "../shared/index.ts";
|
|
25
29
|
import {
|
|
26
30
|
DEFAULT_RESOURCE_MAX_BYTES,
|
|
27
31
|
MAX_FILE_ATTACHMENTS_PER_TEMPLATE,
|
|
@@ -303,10 +307,9 @@ function copiedFileName(key: string, entry: LinkedResourceEntry, contentType: st
|
|
|
303
307
|
}
|
|
304
308
|
|
|
305
309
|
function sourceUnreadable(): WriteResult<never> {
|
|
306
|
-
return
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}),
|
|
310
|
+
return unprocessable(
|
|
311
|
+
TemplateResolverErrors.resourceSourceUnreadable,
|
|
312
|
+
"templateResolver.errors.resource.sourceUnreadable",
|
|
310
313
|
);
|
|
311
314
|
}
|
|
312
315
|
|
|
@@ -667,14 +670,14 @@ export type LinkedTemplatePdfAttachment = {
|
|
|
667
670
|
readonly fileName: string;
|
|
668
671
|
};
|
|
669
672
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
673
|
+
const pdfAttachmentInvalid = (code: string): WriteResult<never> =>
|
|
674
|
+
unprocessable(
|
|
675
|
+
TemplateResolverErrors.attachmentInvalid,
|
|
676
|
+
"templateResolver.errors.attachment.invalid",
|
|
677
|
+
{
|
|
678
|
+
code,
|
|
679
|
+
},
|
|
676
680
|
);
|
|
677
|
-
}
|
|
678
681
|
|
|
679
682
|
// Links a PDF that is rendered from a document template at send time into a mail template of the
|
|
680
683
|
// target tenant. Nothing is stored besides the link entry. The caller authorizes tenantId.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// The record's photos: a block bound to an `images` variable whose FileRef ids the
|
|
2
2
|
// app passes at render time. Universal like document-schema.ts.
|
|
3
3
|
import { Node } from "@tiptap/core";
|
|
4
|
+
import { attributeParseRule } from "./tiptap-attribute-parse-rule.ts";
|
|
4
5
|
|
|
5
6
|
export function createDocumentImagesNode(isReferenceName: (value: string) => boolean) {
|
|
6
7
|
return Node.create({
|
|
@@ -12,13 +13,12 @@ export function createDocumentImagesNode(isReferenceName: (value: string) => boo
|
|
|
12
13
|
},
|
|
13
14
|
parseHTML() {
|
|
14
15
|
return [
|
|
15
|
-
{
|
|
16
|
+
attributeParseRule({
|
|
16
17
|
tag: "div[data-images]",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
18
|
+
attribute: "data-images",
|
|
19
|
+
key: "variable",
|
|
20
|
+
isValid: isReferenceName,
|
|
21
|
+
}),
|
|
22
22
|
];
|
|
23
23
|
},
|
|
24
24
|
renderHTML({ node }) {
|
|
@@ -123,26 +123,37 @@ function renderImageFields(m: PanelModel): ReactNode {
|
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
function
|
|
127
|
-
|
|
126
|
+
function renderVariableAndTextFields(
|
|
127
|
+
m: PanelModel,
|
|
128
|
+
fields: {
|
|
129
|
+
readonly variableIdSuffix: string;
|
|
130
|
+
readonly variableLabel: string;
|
|
131
|
+
readonly textIdSuffix: string;
|
|
132
|
+
readonly textLabel: string;
|
|
133
|
+
readonly textName: string;
|
|
134
|
+
readonly textValue: string;
|
|
135
|
+
readonly onTextChange: (value: string) => void;
|
|
136
|
+
},
|
|
137
|
+
): ReactNode {
|
|
138
|
+
const { Field, Input, idPrefix } = m;
|
|
128
139
|
return (
|
|
129
140
|
!m.noVariables && (
|
|
130
141
|
<>
|
|
131
142
|
<NameSelect
|
|
132
|
-
id={`${idPrefix}
|
|
133
|
-
label={
|
|
143
|
+
id={`${idPrefix}-${fields.variableIdSuffix}`}
|
|
144
|
+
label={fields.variableLabel}
|
|
134
145
|
names={m.selectable}
|
|
135
146
|
labels={m.variableLabels}
|
|
136
147
|
value={m.selectedName}
|
|
137
148
|
onChange={m.setChosenName}
|
|
138
149
|
/>
|
|
139
|
-
<Field id={`${idPrefix}
|
|
150
|
+
<Field id={`${idPrefix}-${fields.textIdSuffix}`} label={fields.textLabel}>
|
|
140
151
|
<Input
|
|
141
152
|
kind="text"
|
|
142
|
-
id={`${idPrefix}
|
|
143
|
-
name=
|
|
144
|
-
value={
|
|
145
|
-
onChange={
|
|
153
|
+
id={`${idPrefix}-${fields.textIdSuffix}`}
|
|
154
|
+
name={fields.textName}
|
|
155
|
+
value={fields.textValue}
|
|
156
|
+
onChange={fields.onTextChange}
|
|
146
157
|
/>
|
|
147
158
|
</Field>
|
|
148
159
|
</>
|
|
@@ -150,6 +161,18 @@ function renderButtonFields(m: PanelModel): ReactNode {
|
|
|
150
161
|
);
|
|
151
162
|
}
|
|
152
163
|
|
|
164
|
+
function renderButtonFields(m: PanelModel): ReactNode {
|
|
165
|
+
return renderVariableAndTextFields(m, {
|
|
166
|
+
variableIdSuffix: "target",
|
|
167
|
+
variableLabel: m.t("template-resolver.documentEditor.buttonTarget"),
|
|
168
|
+
textIdSuffix: "text",
|
|
169
|
+
textLabel: m.t("template-resolver.documentEditor.buttonText"),
|
|
170
|
+
textName: "text",
|
|
171
|
+
textValue: m.buttonText,
|
|
172
|
+
onTextChange: m.setButtonText,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
153
176
|
function renderRepeatFields(m: PanelModel): ReactNode {
|
|
154
177
|
return (
|
|
155
178
|
!m.noVariables && (
|
|
@@ -181,33 +204,15 @@ function renderImagesFields(m: PanelModel): ReactNode {
|
|
|
181
204
|
}
|
|
182
205
|
|
|
183
206
|
function renderStepsFields(m: PanelModel): ReactNode {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
value={m.selectedName}
|
|
194
|
-
onChange={m.setChosenName}
|
|
195
|
-
/>
|
|
196
|
-
<Field
|
|
197
|
-
id={`${idPrefix}-steps-list`}
|
|
198
|
-
label={t("template-resolver.documentEditor.stepsList")}
|
|
199
|
-
>
|
|
200
|
-
<Input
|
|
201
|
-
kind="text"
|
|
202
|
-
id={`${idPrefix}-steps-list`}
|
|
203
|
-
name="steps"
|
|
204
|
-
value={m.stepsText}
|
|
205
|
-
onChange={m.setStepsText}
|
|
206
|
-
/>
|
|
207
|
-
</Field>
|
|
208
|
-
</>
|
|
209
|
-
)
|
|
210
|
-
);
|
|
207
|
+
return renderVariableAndTextFields(m, {
|
|
208
|
+
variableIdSuffix: "steps-variable",
|
|
209
|
+
variableLabel: m.t("template-resolver.documentEditor.stepsVariable"),
|
|
210
|
+
textIdSuffix: "steps-list",
|
|
211
|
+
textLabel: m.t("template-resolver.documentEditor.stepsList"),
|
|
212
|
+
textName: "steps",
|
|
213
|
+
textValue: m.stepsText,
|
|
214
|
+
onTextChange: m.setStepsText,
|
|
215
|
+
});
|
|
211
216
|
}
|
|
212
217
|
|
|
213
218
|
export const PANEL_FIELDS: Readonly<Record<PanelKind, (m: PanelModel) => ReactNode>> = {
|
|
@@ -10,6 +10,7 @@ import StarterKit from "@tiptap/starter-kit";
|
|
|
10
10
|
import { createDocumentImagesNode } from "./document-images.ts";
|
|
11
11
|
import { isDocumentReferenceName } from "./document-reference-name.ts";
|
|
12
12
|
import { createDocumentStepsNode } from "./document-steps.ts";
|
|
13
|
+
import { attributeParseRule } from "./tiptap-attribute-parse-rule.ts";
|
|
13
14
|
|
|
14
15
|
const PLACEHOLDER_HREF = /^\{\{(.+)\}\}$/;
|
|
15
16
|
const RESOURCE_KEY = /^[A-Za-z0-9][A-Za-z0-9_.-]*$/;
|
|
@@ -95,13 +96,12 @@ export const DocumentVariable = Node.create({
|
|
|
95
96
|
},
|
|
96
97
|
parseHTML() {
|
|
97
98
|
return [
|
|
98
|
-
{
|
|
99
|
+
attributeParseRule({
|
|
99
100
|
tag: "span[data-variable]",
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
},
|
|
101
|
+
attribute: "data-variable",
|
|
102
|
+
key: "name",
|
|
103
|
+
isValid: isDocumentReferenceName,
|
|
104
|
+
}),
|
|
105
105
|
];
|
|
106
106
|
},
|
|
107
107
|
renderHTML({ node }) {
|
|
@@ -152,15 +152,14 @@ export const DocumentButton = Node.create({
|
|
|
152
152
|
},
|
|
153
153
|
parseHTML() {
|
|
154
154
|
return [
|
|
155
|
-
{
|
|
155
|
+
attributeParseRule({
|
|
156
156
|
tag: "a[data-button]",
|
|
157
|
+
attribute: "href",
|
|
158
|
+
key: "href",
|
|
159
|
+
isValid: isDocumentPlaceholderHref,
|
|
157
160
|
// Must win against the Link mark's `a[href]` rule.
|
|
158
161
|
priority: 1000,
|
|
159
|
-
|
|
160
|
-
const href = element.getAttribute("href");
|
|
161
|
-
return href !== null && isDocumentPlaceholderHref(href) ? { href } : false;
|
|
162
|
-
},
|
|
163
|
-
},
|
|
162
|
+
}),
|
|
164
163
|
];
|
|
165
164
|
},
|
|
166
165
|
renderHTML({ node }) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type AttributeSource = { getAttribute(name: string): string | null };
|
|
2
|
+
|
|
3
|
+
export function attributeParseRule(rule: {
|
|
4
|
+
readonly tag: string;
|
|
5
|
+
readonly attribute: string;
|
|
6
|
+
readonly key: string;
|
|
7
|
+
readonly isValid: (value: string) => boolean;
|
|
8
|
+
readonly priority?: number;
|
|
9
|
+
}) {
|
|
10
|
+
const { tag, attribute, key, isValid, priority } = rule;
|
|
11
|
+
return {
|
|
12
|
+
tag,
|
|
13
|
+
...(priority === undefined ? {} : { priority }),
|
|
14
|
+
getAttrs: (element: AttributeSource): Record<string, string> | false => {
|
|
15
|
+
const value = element.getAttribute(attribute);
|
|
16
|
+
return value !== null && isValid(value) ? { [key]: value } : false;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -52,6 +52,9 @@ export const TENANT_I18N: Readonly<Record<string, LocalizedString>> = {
|
|
|
52
52
|
"tenant:entity:tenant:field:status:option:destroying": {
|
|
53
53
|
en: "Destroying",
|
|
54
54
|
},
|
|
55
|
+
"tenant:entity:tenant:field:status:option:destroyHeld": {
|
|
56
|
+
en: "Destroy held by retention",
|
|
57
|
+
},
|
|
55
58
|
"tenant:entity:tenant:field:status:option:destroyFailed": {
|
|
56
59
|
en: "Destroy failed",
|
|
57
60
|
},
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type ColumnRendererProps, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
6
6
|
import type { ReactNode } from "react";
|
|
7
|
-
import { translateOrRaw } from "../../shared/web/
|
|
7
|
+
import { translateOrRaw } from "../../shared/web/index.ts";
|
|
8
8
|
|
|
9
9
|
export function MemberRolesCell({ row }: ColumnRendererProps): ReactNode {
|
|
10
10
|
const t = useTranslation();
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { type ColumnRendererProps, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
7
7
|
import { StatusBadge, type StatusTone } from "@cosmicdrift/kumiko-renderer/web";
|
|
8
8
|
import type { ReactNode } from "react";
|
|
9
|
-
import { translateOrRaw } from "../../shared/web/
|
|
9
|
+
import { translateOrRaw } from "../../shared/web/index.ts";
|
|
10
10
|
|
|
11
11
|
const STATUS_TONE: Readonly<Record<string, StatusTone>> = {
|
|
12
12
|
active: "ok",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.407.0",
|
|
4
|
+
"type": "improvement",
|
|
5
|
+
"title": "Warn and delete inactive free accounts",
|
|
6
|
+
"detail": "createTenantInactivityFeature({ rule } or { resolveTier, rulesByTier }, keepAccountUrl, keepAccountTokenSecret?, activitySources?) mounts a daily maintenance job that warns the tenant owners by mail before the deadline (rule.warnings, for example 30 and 7 days) and then files the normal tenant-lifecycle deletion request, with the wait period of the compliance profile. A new session, an activity source or the keep-account link in the mail restarts the period; a tier whose rule is null is exempt. The query tenant-inactivity:query:state (optional field tenantIdOverride, only for a SystemAdmin, to read another tenant) shows exempt, lastActivityAt, warningsSent, nextStep and nextStepAt. The feature requires sessions, tenant, tenant-lifecycle and delivery, and erases its state with the tenant data. Mail texts exist in en, de, es, fr and it."
|
|
7
|
+
}
|
|
8
|
+
]
|