// Stampwing — synthetic multi-project planning worksheet, reviewed 2026-11-09. // Run: node project-cost-worksheet.mjs (Node.js 22+). No network or email. // Free to use, modify and redistribute, without warranty. import assert from 'node:assert/strict'; // Invented units and prices: NOT a provider quote or a Stampwing plan. // Substitute verified quotes and measured effort. Count billable recipients // according to the provider's rules, including retries that are billed again. function monthlyCost({ accounts, recipients, includedPerAccount, basePerAccount, overagePerThousand, hours, hourlyCost, extras }) { assert.equal(recipients.length, accounts, 'Provide each account allocation'); assert.ok([accounts, includedPerAccount, basePerAccount, overagePerThousand, hours, hourlyCost, extras, ...recipients].every((v) => Number.isFinite(v) && v >= 0)); assert.ok(Number.isInteger(accounts) && accounts > 0); const overage = recipients.reduce((sum, n) => sum + Math.max(0, n - includedPerAccount), 0); return accounts * basePerAccount + overage / 1000 * overagePerThousand + hours * hourlyCost + extras; } const rates = { includedPerAccount: 100000, basePerAccount: 20, overagePerThousand: 1, hourlyCost: 50, extras: 0 }; const shared = monthlyCost({ ...rates, accounts: 1, recipients: [150000], hours: 2 }); const separate = monthlyCost({ ...rates, accounts: 2, recipients: [120000, 30000], hours: 4 }); assert.equal(shared, 170); assert.equal(separate, 260); // Unused allowance on account B does not erase account A's 20k overage. assert.equal(monthlyCost({ ...rates, accounts: 2, recipients: [120000, 30000], hours: 0 }), 60); assert.equal(monthlyCost({ ...rates, accounts: 1, recipients: [100000], hours: 0 }), 20); assert.throws(() => monthlyCost({ ...rates, accounts: 2, recipients: [150000], hours: 0 })); assert.throws(() => monthlyCost({ ...rates, accounts: 1, recipients: [-1], hours: 0 })); console.table([{ scenario: 'One shared account', monthlyUnits: shared }, { scenario: 'Two separate accounts', monthlyUnits: separate }]); console.log('6 assertions passed. Synthetic prices; no provider capability or isolation test.'); console.log('Add domains, retention, support, tenant fees, dedicated pools and incident effort to extras/hours.'); console.log('Record permissions and quota/suspension boundaries separately: a lower estimate cannot satisfy a missing control.');