EnvelopeFlow.Preferences
0.1.0-alpha.3.1
dotnet add package EnvelopeFlow.Preferences --version 0.1.0-alpha.3.1
NuGet\Install-Package EnvelopeFlow.Preferences -Version 0.1.0-alpha.3.1
<PackageReference Include="EnvelopeFlow.Preferences" Version="0.1.0-alpha.3.1" />
<PackageVersion Include="EnvelopeFlow.Preferences" Version="0.1.0-alpha.3.1" />
<PackageReference Include="EnvelopeFlow.Preferences" />
paket add EnvelopeFlow.Preferences --version 0.1.0-alpha.3.1
#r "nuget: EnvelopeFlow.Preferences, 0.1.0-alpha.3.1"
#:package EnvelopeFlow.Preferences@0.1.0-alpha.3.1
#addin nuget:?package=EnvelopeFlow.Preferences&version=0.1.0-alpha.3.1&prerelease
#tool nuget:?package=EnvelopeFlow.Preferences&version=0.1.0-alpha.3.1&prerelease
EnvelopeFlow.Preferences
Replace IRecipientPolicyStore to use application consent tables. A submission guard must call TryAdmitAsync immediately before provider submission. Its store transaction serializes live policy, frequency reservations, and one-time unsubscribe consumption. The supplied implementation is bounded and ephemeral. Quiet hours are evaluated at the actual local instant: both repeated DST instants are quiet; nonexistent wall times are never evaluated. No contact address or audience membership confers consent.
RecipientPolicy.QuietWindows adds up to 32 weekly windows alongside the original daily QuietHours. Windows combine as a union. QuietDays.Weekdays, Weekend, individual days, and combinations select local start days; a Friday 22:00–07:00 window continues until Saturday 07:00. Equal start/end means the entire selected calendar day, ending at the following midnight. The actual recipient timezone determines weekdays and DST. Overlapping windows delay rich eligibility until every window has ended. Continuous weekly coverage has no finite release.
RecipientPolicy.FrequencyRules adds up to 64 simultaneous rolling caps. A rule with no selectors is global; category or channel selects that dimension; both select their intersection. Every rule matching the submission applies, together with the original global Frequency. Windows remain bounded to 30 days and maxima to 10,000. One atomic reservation records the logical delivery's category/channel and spends one slot in every matching cap; a denial spends none. Replaying a retained delivery cannot change those dimensions and still rechecks live policy. A category cap counts that category across channels; a channel cap counts that channel across categories. Custom stores must preserve these semantics under concurrent clients, policy edits, and shared admission transactions.
var policy = new RecipientPolicy(
quietWindows: [
new(QuietDays.Weekdays, new(22, 0), new(7, 0)),
new(QuietDays.Weekend, new(23, 0), new(9, 0))],
frequencyRules: [
new(new(8, TimeSpan.FromDays(1))),
new(new(2, TimeSpan.FromDays(1)), category: "marketing"),
new(new(3, TimeSpan.FromDays(1)), channel: NotificationChannel.Email)]);
Suppression prevents future admission; it cannot retract submissions already in flight. Frequency reservations occur before provider I/O and conservatively count failed or abandoned attempts. Reusing a delivery ID does not consume another reservation, but always rechecks current suppression and consent. Category/channel explicit denies take precedence over the RequiresConsent=false transactional setting. Signing keys and token retention belong to the host; no HTTP endpoint is installed.
Signed suppression tokens use one 16,384-character creation/consumption bound, including JSON escaping, base64 and signature. The bound accommodates all six maximum-length Unicode identifiers (four scope fields, recipient and category). Oversized untrusted inputs refuse before parsing; full-scope authentication and one-time consumption remain required.
Suppression tokens sign the exact requested UTC expiry in ticks. Every positive lifetime up to seven days remains valid strictly before that instant and expires at it; fractional seconds are neither truncated nor extended. The same exact expiry reaches the store's replay marker and retention checks.
IRecipientPolicyEvaluationStore is an optional side-effect-free preflight for a rich submission decision. It evaluates a coherent current policy/reservation snapshot without creating a recipient, pruning state, changing revisions or reserving a slot. Call TryAdmitAsync again for final live atomic admission immediately before submission; preflight permission is not a reservation or durable scheduling evidence. Repeated allowed/deferred evaluations consume no frequency slots. The existing Boolean admission path retains its current behavior.
For a richer final admission, select optional IRecipientPolicyReservationStore.TryReserveAsync. It serializes the live policy check and reservation atomically and carries finite quiet/frequency floors on denied decisions; only Allowed spends a slot. This avoids canceling finite quiet-hour work merely because the legacy TryAdmitAsync has no quiet-hour retry time. Both final paths reuse a retained scoped delivery reservation and still recheck current consent/suppression. This capability introduces no delivery-store dependency or required member on existing policy stores.
Rich decisions combine quiet-hour and frequency floors and recheck quiet eligibility at a frequency retry instant. After a frequency maximum is reduced, preflight waits until enough retained reservations expire. New frequency rules use the latest required floor across all matching caps on both admission paths. For policies using only the original Frequency, legacy admission retains its oldest-active-reservation retry signal. Permanent suppression/missing consent dominates temporary waits.
For selected process-local shared admission, the TryReserveConditionally overload accepting a TimeProvider samples trusted time after recipient ownership is acquired and supplies that instant to the bounded synchronous commit callback. A false/throwing callback publishes no reservation. Once the callback returns true, its matching reservation is published even if caller cancellation arrives afterward, because the callback may already have committed another owned constraint. The original explicit-time overload retains caller-owned time semantics. Participating stores must use coherent UTC clocks; unrelated injected clocks do not form one eligibility instant.
PolicyEligibility.NextQuietHoursReleaseUtc chooses a safe UTC local-end release, verifies eligibility and returns UTC now when already outside quiet hours. A missing local end advances to the exact end of its DST gap; an ambiguous end selects the earliest future eligible occurrence. Overnight windows use the next applicable local date. Equal start/end on the original daily QuietHours means all-day quiet with no finite release (null), terminal on the optional rich path. A backwards clock jump can create a brief eligible interval before the selected local end; this helper conservatively skips that interval and does not claim the globally earliest possible instant. Gap recovery and weekly date search are bounded, and unrepresentable releases return null rather than creating a retry loop.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- EnvelopeFlow.Core (>= 0.1.0-alpha.3.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on EnvelopeFlow.Preferences:
| Package | Downloads |
|---|---|
|
EnvelopeFlow.Preferences.Stores.Postgres
Durable PostgreSQL consent, frequency reservations and suppression-token consumption. |
|
|
EnvelopeFlow.Throttling
Optional shared provider send budgets and atomic final submission admission. |
|
|
EnvelopeFlow.Integrations.Feedback
Optional trusted provider feedback correlation and idempotent recipient policy integration. |
|
|
EnvelopeFlow.Integrations.Policy
Optional live recipient policy guard and campaign admission bridge. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-alpha.3.1 | 57 | 11/22/2026 |
| 0.1.0-alpha.2.1 | 82 | 11/9/2026 |