@tgoliveira/outpost 1.2.1 → 2.0.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.
Files changed (79) hide show
  1. package/AGENTS.md +172 -18
  2. package/README.md +17 -12
  3. package/dist/adapters/drizzle/index.cjs +194 -15
  4. package/dist/adapters/drizzle/index.cjs.map +1 -1
  5. package/dist/adapters/drizzle/index.d.cts +124 -7
  6. package/dist/adapters/drizzle/index.d.ts +124 -7
  7. package/dist/adapters/drizzle/index.js +194 -15
  8. package/dist/adapters/drizzle/index.js.map +1 -1
  9. package/dist/adapters/index.cjs +148 -38
  10. package/dist/adapters/index.cjs.map +1 -1
  11. package/dist/adapters/index.d.cts +21 -13
  12. package/dist/adapters/index.d.ts +21 -13
  13. package/dist/adapters/index.js +149 -39
  14. package/dist/adapters/index.js.map +1 -1
  15. package/dist/admin/index.cjs +10 -3
  16. package/dist/admin/index.cjs.map +1 -1
  17. package/dist/admin/index.d.cts +7 -7
  18. package/dist/admin/index.d.ts +7 -7
  19. package/dist/admin/index.js +10 -3
  20. package/dist/admin/index.js.map +1 -1
  21. package/dist/{fake-BY6t7UXb.d.cts → fake-B6OIEdod.d.ts} +6 -4
  22. package/dist/{fake-en-oOdg0.d.ts → fake-CpQc9p0N.d.cts} +6 -4
  23. package/dist/http/index.cjs.map +1 -1
  24. package/dist/http/index.d.cts +6 -6
  25. package/dist/http/index.d.ts +6 -6
  26. package/dist/http/index.js.map +1 -1
  27. package/dist/{index-c6caPsUG.d.ts → index-B4F7euCt.d.cts} +53 -21
  28. package/dist/{index-BO0GiZmP.d.cts → index-Cn1YsmGe.d.ts} +53 -21
  29. package/dist/index.cjs +509 -146
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +17 -15
  32. package/dist/index.d.ts +17 -15
  33. package/dist/index.js +509 -148
  34. package/dist/index.js.map +1 -1
  35. package/dist/modules/ui/index.cjs +38 -21
  36. package/dist/modules/ui/index.cjs.map +1 -1
  37. package/dist/modules/ui/index.js +38 -21
  38. package/dist/modules/ui/index.js.map +1 -1
  39. package/dist/modules/ui/pages/admin/admin-config-page.cjs +39 -20
  40. package/dist/modules/ui/pages/admin/admin-config-page.cjs.map +1 -1
  41. package/dist/modules/ui/pages/admin/admin-config-page.d.cts +23 -1
  42. package/dist/modules/ui/pages/admin/admin-config-page.d.ts +23 -1
  43. package/dist/modules/ui/pages/admin/admin-config-page.js +38 -20
  44. package/dist/modules/ui/pages/admin/admin-config-page.js.map +1 -1
  45. package/dist/modules/ui/pages/admin/admin-panel-page.cjs +1 -1
  46. package/dist/modules/ui/pages/admin/admin-panel-page.js +1 -1
  47. package/dist/modules/ui/pages/index.cjs +38 -21
  48. package/dist/modules/ui/pages/index.cjs.map +1 -1
  49. package/dist/modules/ui/pages/index.js +38 -21
  50. package/dist/modules/ui/pages/index.js.map +1 -1
  51. package/dist/{outpost-client-BItbgqIo.d.ts → outpost-client-BX3SsOFb.d.ts} +50 -21
  52. package/dist/{outpost-client-BlVf4gjo.d.cts → outpost-client-DhQgZY16.d.cts} +50 -21
  53. package/dist/react/index.cjs +38 -21
  54. package/dist/react/index.cjs.map +1 -1
  55. package/dist/react/index.js +38 -21
  56. package/dist/react/index.js.map +1 -1
  57. package/dist/repositories-DJYu4nGV.d.ts +322 -0
  58. package/dist/repositories-sMN6RHZJ.d.cts +322 -0
  59. package/dist/{services-CfTEsetF.d.ts → services-DZwZjDn_.d.cts} +9 -3
  60. package/dist/{services-CQINhAGo.d.cts → services-PoM2bxjP.d.ts} +9 -3
  61. package/dist/{template-DxI_p2Ny.d.cts → template-Dl1_ciRo.d.ts} +24 -4
  62. package/dist/{template-CREUq7bB.d.ts → template-Dny_7Ymi.d.cts} +24 -4
  63. package/dist/testing/index.cjs +200 -15
  64. package/dist/testing/index.cjs.map +1 -1
  65. package/dist/testing/index.d.cts +26 -7
  66. package/dist/testing/index.d.ts +26 -7
  67. package/dist/testing/index.js +200 -15
  68. package/dist/testing/index.js.map +1 -1
  69. package/dist/{webhook-kp6CiXk-.d.cts → webhook-B158Vi6p.d.cts} +20 -4
  70. package/dist/{webhook-kp6CiXk-.d.ts → webhook-B158Vi6p.d.ts} +20 -4
  71. package/dist/workers/index.cjs +471 -85
  72. package/dist/workers/index.cjs.map +1 -1
  73. package/dist/workers/index.d.cts +5 -5
  74. package/dist/workers/index.d.ts +5 -5
  75. package/dist/workers/index.js +471 -85
  76. package/dist/workers/index.js.map +1 -1
  77. package/package.json +6 -3
  78. package/dist/repositories-CHIOFGn3.d.cts +0 -182
  79. package/dist/repositories-WyhvxzyY.d.ts +0 -182
package/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
- import { E as Encryptor, C as ConfigOverrides, R as RateLimitConfig, T as TemplateRenderer, M as MxResolver } from './template-DxI_p2Ny.cjs';
2
- export { A as AttachmentPolicy, a as AttachmentSpec, D as DEFAULT_ATTACHMENT_POLICY, b as DEFAULT_DOMAIN_VALIDATION, c as DEFAULT_RETENTION, d as DEFAULT_RETRY, e as DEFAULT_SANITIZE_LIMITS, f as DomainValidationConfig, g as MxCache, h as RateBudget, i as RecipientHasher, j as RenderedTemplate, k as ResolvedConfig, l as RetentionPolicy, m as RetryConfig, S as SanitizeLimits, n as assertBodyWithinLimits, o as assertNoHeaderInjection, p as backoffMs, q as extractDomain, r as isExhausted, s as nextAttemptAt, t as purgeCutoff, u as resolveConfig, v as sanitizeHeaders, w as sanitizeRecipient, x as sanitizeSubject, y as stripDangerousHtml, z as validateAttachment, B as validateRecipient, F as validateSyntax } from './template-DxI_p2Ny.cjs';
3
- import { O as Outpost } from './outpost-client-BlVf4gjo.cjs';
4
- export { A as AuthContext, a as Authenticate, C as CreatedApiKey, E as EnqueueInput, b as EnqueueMessage, c as EnqueueResult, G as GetMessage, I as IngestWebhook, d as IngestWebhookResult, L as ListMessages, M as ManageApiKey, e as ManageSuppression, f as MessageView, R as ReplayMessage, g as generateApiKeySecret, h as hashApiKey, t as toView } from './outpost-client-BlVf4gjo.cjs';
5
- import { O as OutboxRepository, S as SuppressionRepository, A as AuditRepository, a as ApiKeyRepository, W as WebhookEventRepository } from './repositories-CHIOFGn3.cjs';
6
- export { b as API_SCOPES, c as ApiKey, d as ApiScope, e as AuditEvent, f as AuditEventType, L as ListMessagesQuery, M as MessageStatePatch, N as NewApiKey, g as NewAuditEvent, h as NewMessage, i as SUPPRESSION_REASONS, j as SuppressionEntry, k as SuppressionReason, l as hasScope, m as isKeyActive } from './repositories-CHIOFGn3.cjs';
7
- import { E as EmailProvider, T as Telemetry, L as Logger, C as Clock, I as IdGenerator, a as RateLimiter } from './services-CQINhAGo.cjs';
8
- export { b as LogLevel, P as ProviderReceipt, c as RateLimitScope, R as RawWebhook } from './services-CQINhAGo.cjs';
9
- export { D as DispatchableMessage, L as LIFECYCLE_STATES, a as LifecycleState, M as Message, b as MessageBody, S as Sealed, T as TERMINAL_STATES, W as WebhookEvent, c as WebhookEventType, d as canTransition, i as isTerminal, s as shouldSuppressOn, w as webhookToState } from './webhook-kp6CiXk-.cjs';
10
- export { C as CoreDeps, D as DispatchMessage, a as DispatchOutcome, P as PurgeReport, b as PurgeRetention } from './index-BO0GiZmP.cjs';
1
+ import { E as Encryptor, C as ConfigOverrides, R as RateLimitConfig, T as TemplateRenderer, M as MxResolver } from './template-Dny_7Ymi.cjs';
2
+ export { A as AttachmentPolicy, a as AttachmentSpec, D as DEFAULT_ATTACHMENT_POLICY, b as DEFAULT_DOMAIN_VALIDATION, c as DEFAULT_RETENTION, d as DEFAULT_RETRY, e as DEFAULT_SANITIZE_LIMITS, f as DomainValidationConfig, g as MxCache, h as RateBudget, i as RecipientHasher, j as RenderedTemplate, k as ResolvedConfig, l as RetentionPolicy, m as RetryConfig, S as SanitizeLimits, n as SealColumn, o as SealContext, p as assertBodyWithinLimits, q as assertNoHeaderInjection, r as backoffMs, s as extractDomain, t as isExhausted, u as nextAttemptAt, v as normalizeBatchPauseMs, w as purgeCutoff, x as resolveConfig, y as sanitizeHeaders, z as sanitizeRecipient, B as sanitizeSubject, F as stripDangerousHtml, G as validateAttachment, H as validateRecipient, I as validateSyntax, J as waitForBatchPause } from './template-Dny_7Ymi.cjs';
3
+ import { O as Outpost } from './outpost-client-DhQgZY16.cjs';
4
+ export { A as AuthContext, a as Authenticate, C as CreatedApiKey, E as EnqueueInput, b as EnqueueMessage, c as EnqueueResult, G as GetMessage, I as IngestWebhook, d as IngestWebhookResult, L as ListMessages, M as ManageApiKey, e as ManageSuppression, f as MessageView, R as ReplayMessage, g as generateApiKeySecret, h as hashApiKey, t as toView } from './outpost-client-DhQgZY16.cjs';
5
+ import { O as OutboxRepository, S as SuppressionRepository, A as AuditRepository, a as ApiKeyRepository, W as WebhookEventRepository } from './repositories-sMN6RHZJ.cjs';
6
+ export { b as API_SCOPES, c as ApiKey, d as ApiScope, e as AuditEvent, f as AuditEventType, E as EnqueueAuditWrite, g as EnqueueWriteResult, L as ListMessagesQuery, M as MessageStatePatch, N as NewApiKey, h as NewAuditEvent, i as NewMessage, j as SUPPRESSION_REASONS, k as SendingClaim, l as StoredWebhookEvent, m as SuppressionEntry, n as SuppressionReason, o as WebhookDisposition, p as WebhookIdentityQuery, q as WebhookRecordMeta, r as hasScope, s as isKeyActive } from './repositories-sMN6RHZJ.cjs';
7
+ import { E as EmailProvider, T as Telemetry, L as Logger, C as Clock, I as IdGenerator, a as RateLimiter } from './services-DZwZjDn_.cjs';
8
+ export { b as LogLevel, P as ProviderReceipt, c as RateLimitScope, R as RawWebhook } from './services-DZwZjDn_.cjs';
9
+ export { D as DispatchableMessage, L as LIFECYCLE_STATES, a as LifecycleState, M as Message, b as MessageBody, S as Sealed, T as TERMINAL_STATES, W as WebhookEvent, c as WebhookEventType, d as canTransition, i as isTerminal, s as shouldSuppressOn, w as webhookToState } from './webhook-B158Vi6p.cjs';
10
+ export { C as CoreDeps, D as DispatchMessage, a as DispatchOutcome, P as PurgeReport, b as PurgeRetention } from './index-B4F7euCt.cjs';
11
11
 
12
12
  /**
13
13
  * Encryption posture (TDR §5.4). Pick one:
@@ -54,7 +54,8 @@ interface OutpostOptions extends ConfigOverrides {
54
54
  /**
55
55
  * Key for the deterministic recipient HMAC (TDR §5.4). REQUIRED — it backs
56
56
  * suppression matching and recipient-keyed lookups even when encryption is
57
- * off. Must be ≥16 bytes of entropy and live OUTSIDE the database.
57
+ * off. The constructor requires at least 16 bytes and does not measure
58
+ * entropy. Keep the key outside the database.
58
59
  */
59
60
  recipientHmacKey: string | Buffer;
60
61
  /** Encryption-at-rest posture. Defaults to `{ mode: "none" }`. */
@@ -127,9 +128,10 @@ declare class WebhookVerificationError extends OutpostError {
127
128
  constructor(message?: string);
128
129
  }
129
130
  /**
130
- * Raised by `EmailProvider` implementations. The `errorClass` drives retry:
131
- * `transient` errors go back to the queue with backoff; `permanent` errors go
132
- * straight to `failed` and the Dead Letter Queue.
131
+ * Raised by `EmailProvider` implementations. Classification uses the stored
132
+ * pair, not one field alone: `errorClass === "transient"` with
133
+ * `code === "provider_transient"`, or `errorClass === "permanent"` with
134
+ * `code === "provider_permanent"`.
133
135
  */
134
136
  declare class ProviderError extends OutpostError {
135
137
  readonly errorClass: ErrorClass;
@@ -147,7 +149,7 @@ declare class ProviderError extends OutpostError {
147
149
  cause?: unknown;
148
150
  }): ProviderError;
149
151
  }
150
- /** Returns true when an unknown thrown value should be treated as retryable. */
152
+ /** True only when `errorClass === "transient"` and `code === "provider_transient"`. */
151
153
  declare function isTransient(err: unknown): boolean;
152
154
 
153
155
  export { ApiKeyRepository, AuditRepository, Clock, ConfigOverrides, EmailProvider, type EncryptionOptions, Encryptor, type ErrorClass, ForbiddenError, IdGenerator, InvalidStateTransitionError, Logger, MxResolver, NotFoundError, OutboxRepository, Outpost, OutpostError, type OutpostOptions, ProviderError, RateLimitConfig, RateLimiter, SuppressionRepository, Telemetry, TemplateRenderer, UnauthorizedError, ValidationError, WebhookEventRepository, WebhookVerificationError, createOutpost, isTransient };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { E as Encryptor, C as ConfigOverrides, R as RateLimitConfig, T as TemplateRenderer, M as MxResolver } from './template-CREUq7bB.js';
2
- export { A as AttachmentPolicy, a as AttachmentSpec, D as DEFAULT_ATTACHMENT_POLICY, b as DEFAULT_DOMAIN_VALIDATION, c as DEFAULT_RETENTION, d as DEFAULT_RETRY, e as DEFAULT_SANITIZE_LIMITS, f as DomainValidationConfig, g as MxCache, h as RateBudget, i as RecipientHasher, j as RenderedTemplate, k as ResolvedConfig, l as RetentionPolicy, m as RetryConfig, S as SanitizeLimits, n as assertBodyWithinLimits, o as assertNoHeaderInjection, p as backoffMs, q as extractDomain, r as isExhausted, s as nextAttemptAt, t as purgeCutoff, u as resolveConfig, v as sanitizeHeaders, w as sanitizeRecipient, x as sanitizeSubject, y as stripDangerousHtml, z as validateAttachment, B as validateRecipient, F as validateSyntax } from './template-CREUq7bB.js';
3
- import { O as Outpost } from './outpost-client-BItbgqIo.js';
4
- export { A as AuthContext, a as Authenticate, C as CreatedApiKey, E as EnqueueInput, b as EnqueueMessage, c as EnqueueResult, G as GetMessage, I as IngestWebhook, d as IngestWebhookResult, L as ListMessages, M as ManageApiKey, e as ManageSuppression, f as MessageView, R as ReplayMessage, g as generateApiKeySecret, h as hashApiKey, t as toView } from './outpost-client-BItbgqIo.js';
5
- import { O as OutboxRepository, S as SuppressionRepository, A as AuditRepository, a as ApiKeyRepository, W as WebhookEventRepository } from './repositories-WyhvxzyY.js';
6
- export { b as API_SCOPES, c as ApiKey, d as ApiScope, e as AuditEvent, f as AuditEventType, L as ListMessagesQuery, M as MessageStatePatch, N as NewApiKey, g as NewAuditEvent, h as NewMessage, i as SUPPRESSION_REASONS, j as SuppressionEntry, k as SuppressionReason, l as hasScope, m as isKeyActive } from './repositories-WyhvxzyY.js';
7
- import { E as EmailProvider, T as Telemetry, L as Logger, C as Clock, I as IdGenerator, a as RateLimiter } from './services-CfTEsetF.js';
8
- export { b as LogLevel, P as ProviderReceipt, c as RateLimitScope, R as RawWebhook } from './services-CfTEsetF.js';
9
- export { D as DispatchableMessage, L as LIFECYCLE_STATES, a as LifecycleState, M as Message, b as MessageBody, S as Sealed, T as TERMINAL_STATES, W as WebhookEvent, c as WebhookEventType, d as canTransition, i as isTerminal, s as shouldSuppressOn, w as webhookToState } from './webhook-kp6CiXk-.js';
10
- export { C as CoreDeps, D as DispatchMessage, a as DispatchOutcome, P as PurgeReport, b as PurgeRetention } from './index-c6caPsUG.js';
1
+ import { E as Encryptor, C as ConfigOverrides, R as RateLimitConfig, T as TemplateRenderer, M as MxResolver } from './template-Dl1_ciRo.js';
2
+ export { A as AttachmentPolicy, a as AttachmentSpec, D as DEFAULT_ATTACHMENT_POLICY, b as DEFAULT_DOMAIN_VALIDATION, c as DEFAULT_RETENTION, d as DEFAULT_RETRY, e as DEFAULT_SANITIZE_LIMITS, f as DomainValidationConfig, g as MxCache, h as RateBudget, i as RecipientHasher, j as RenderedTemplate, k as ResolvedConfig, l as RetentionPolicy, m as RetryConfig, S as SanitizeLimits, n as SealColumn, o as SealContext, p as assertBodyWithinLimits, q as assertNoHeaderInjection, r as backoffMs, s as extractDomain, t as isExhausted, u as nextAttemptAt, v as normalizeBatchPauseMs, w as purgeCutoff, x as resolveConfig, y as sanitizeHeaders, z as sanitizeRecipient, B as sanitizeSubject, F as stripDangerousHtml, G as validateAttachment, H as validateRecipient, I as validateSyntax, J as waitForBatchPause } from './template-Dl1_ciRo.js';
3
+ import { O as Outpost } from './outpost-client-BX3SsOFb.js';
4
+ export { A as AuthContext, a as Authenticate, C as CreatedApiKey, E as EnqueueInput, b as EnqueueMessage, c as EnqueueResult, G as GetMessage, I as IngestWebhook, d as IngestWebhookResult, L as ListMessages, M as ManageApiKey, e as ManageSuppression, f as MessageView, R as ReplayMessage, g as generateApiKeySecret, h as hashApiKey, t as toView } from './outpost-client-BX3SsOFb.js';
5
+ import { O as OutboxRepository, S as SuppressionRepository, A as AuditRepository, a as ApiKeyRepository, W as WebhookEventRepository } from './repositories-DJYu4nGV.js';
6
+ export { b as API_SCOPES, c as ApiKey, d as ApiScope, e as AuditEvent, f as AuditEventType, E as EnqueueAuditWrite, g as EnqueueWriteResult, L as ListMessagesQuery, M as MessageStatePatch, N as NewApiKey, h as NewAuditEvent, i as NewMessage, j as SUPPRESSION_REASONS, k as SendingClaim, l as StoredWebhookEvent, m as SuppressionEntry, n as SuppressionReason, o as WebhookDisposition, p as WebhookIdentityQuery, q as WebhookRecordMeta, r as hasScope, s as isKeyActive } from './repositories-DJYu4nGV.js';
7
+ import { E as EmailProvider, T as Telemetry, L as Logger, C as Clock, I as IdGenerator, a as RateLimiter } from './services-PoM2bxjP.js';
8
+ export { b as LogLevel, P as ProviderReceipt, c as RateLimitScope, R as RawWebhook } from './services-PoM2bxjP.js';
9
+ export { D as DispatchableMessage, L as LIFECYCLE_STATES, a as LifecycleState, M as Message, b as MessageBody, S as Sealed, T as TERMINAL_STATES, W as WebhookEvent, c as WebhookEventType, d as canTransition, i as isTerminal, s as shouldSuppressOn, w as webhookToState } from './webhook-B158Vi6p.js';
10
+ export { C as CoreDeps, D as DispatchMessage, a as DispatchOutcome, P as PurgeReport, b as PurgeRetention } from './index-Cn1YsmGe.js';
11
11
 
12
12
  /**
13
13
  * Encryption posture (TDR §5.4). Pick one:
@@ -54,7 +54,8 @@ interface OutpostOptions extends ConfigOverrides {
54
54
  /**
55
55
  * Key for the deterministic recipient HMAC (TDR §5.4). REQUIRED — it backs
56
56
  * suppression matching and recipient-keyed lookups even when encryption is
57
- * off. Must be ≥16 bytes of entropy and live OUTSIDE the database.
57
+ * off. The constructor requires at least 16 bytes and does not measure
58
+ * entropy. Keep the key outside the database.
58
59
  */
59
60
  recipientHmacKey: string | Buffer;
60
61
  /** Encryption-at-rest posture. Defaults to `{ mode: "none" }`. */
@@ -127,9 +128,10 @@ declare class WebhookVerificationError extends OutpostError {
127
128
  constructor(message?: string);
128
129
  }
129
130
  /**
130
- * Raised by `EmailProvider` implementations. The `errorClass` drives retry:
131
- * `transient` errors go back to the queue with backoff; `permanent` errors go
132
- * straight to `failed` and the Dead Letter Queue.
131
+ * Raised by `EmailProvider` implementations. Classification uses the stored
132
+ * pair, not one field alone: `errorClass === "transient"` with
133
+ * `code === "provider_transient"`, or `errorClass === "permanent"` with
134
+ * `code === "provider_permanent"`.
133
135
  */
134
136
  declare class ProviderError extends OutpostError {
135
137
  readonly errorClass: ErrorClass;
@@ -147,7 +149,7 @@ declare class ProviderError extends OutpostError {
147
149
  cause?: unknown;
148
150
  }): ProviderError;
149
151
  }
150
- /** Returns true when an unknown thrown value should be treated as retryable. */
152
+ /** True only when `errorClass === "transient"` and `code === "provider_transient"`. */
151
153
  declare function isTransient(err: unknown): boolean;
152
154
 
153
155
  export { ApiKeyRepository, AuditRepository, Clock, ConfigOverrides, EmailProvider, type EncryptionOptions, Encryptor, type ErrorClass, ForbiddenError, IdGenerator, InvalidStateTransitionError, Logger, MxResolver, NotFoundError, OutboxRepository, Outpost, OutpostError, type OutpostOptions, ProviderError, RateLimitConfig, RateLimiter, SuppressionRepository, Telemetry, TemplateRenderer, UnauthorizedError, ValidationError, WebhookEventRepository, WebhookVerificationError, createOutpost, isTransient };