Release govoplan-campaign v0.1.28: stabilize saving, review and delivery recovery
Module Package Release / publish-packages (push) Successful in 12s

This commit is contained in:
2026-09-08 01:32:26 +02:00
parent 1b32427813
commit c51fc180fb
111 changed files with 6905 additions and 980 deletions
+32 -1
View File
@@ -1,4 +1,4 @@
import { campaignMailProfileReferenceOnly } from "../src/features/campaigns/utils/mailProfileReference";
import { campaignMailProfileListOptions, campaignMailProfileReferenceOnly, campaignMailReferencesUnchanged } from "../src/features/campaigns/utils/mailProfileReference";
function assert(condition: unknown, message: string): void {
if (!condition) throw new Error(message);
@@ -24,3 +24,34 @@ assert((source.server.smtp as Record<string, unknown>).password === "smtp-secret
const withoutProfile = campaignMailProfileReferenceOnly({ server: { smtp: { host: "legacy" } } });
assert(Object.keys(withoutProfile.server as Record<string, unknown>).length === 0, "Legacy settings without a profile must normalize to an empty reference object.");
const campaignChoices = campaignMailProfileListOptions("settings", "campaign-1");
assert(campaignChoices.campaignId === "campaign-1", "Mail settings must load profiles authorized for this campaign.");
assert(!campaignChoices.includeInactive, "Inactive profiles cannot become campaign delivery choices.");
const policyChoices = campaignMailProfileListOptions("policy", "campaign-1");
assert(policyChoices.campaignId === undefined, "Policy management must not restrict its catalogue to the current campaign allowance.");
assert(policyChoices.includeInactive, "Policy management may inspect its authorized inactive catalogue independently of delivery selection.");
const mixedLegacy = campaignMailProfileReferenceOnly({ server: {
mail_profile_id: "profile-1",
smtp_server_id: "server-smtp",
smtp_credential_id: "credential-smtp",
imap_server_id: "server-imap",
imap_credential_id: "credential-imap",
smtp: { password: "never-resubmit" },
imap: { password: "never-resubmit" },
credentials: { password: "never-resubmit" },
inherit_smtp_credentials: true,
inherit_imap_credentials: true
} });
assert(Object.keys(mixedLegacy.server as Record<string, unknown>).length === 5, "Migration must preserve all five stable Mail references and no legacy transport fields.");
assert(!JSON.stringify(mixedLegacy).includes("never-resubmit"), "Migration must not resubmit transport secrets.");
assert(campaignMailReferencesUnchanged(normalized, {
...normalized, attachments: { zip: { archives: [{ method: "aes" }] } }
}), "Unchanged public Mail references allow an independent archive policy repair.");
assert(campaignMailReferencesUnchanged({ server: {} }, { server: {}, template: { text: "Repair" } }), "A legacy version without a selected profile can still save unrelated repairs.");
assert(!campaignMailReferencesUnchanged(normalized, { server: { mail_profile_id: "profile-2" } }), "Selecting another Mail profile requires explicit migration.");
assert(!campaignMailReferencesUnchanged(normalized, { server: {} }), "Removing a Mail reference is not an unchanged save.");
assert(!campaignMailReferencesUnchanged(normalized, { server: { ...server, smtp: {} } }), "Inline transport cannot be submitted as an unrelated repair.");
assert(!campaignMailReferencesUnchanged(mixedLegacy, { server: { ...(mixedLegacy.server as object), smtp_credential_id: "other" } }), "Changing a Mail credential requires explicit migration.");