@cowliss/sdk 0.20.0 → 0.21.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/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@
4
4
 
5
5
  What changed in each version of `@cowliss/sdk` after 0.16.0, newest first. Earlier versions are listed on [npm](https://www.npmjs.com/package/@cowliss/sdk?activeTab=versions).
6
6
 
7
+ ## 0.21.0 (2026-10-02)
8
+
9
+ ### Features
10
+
11
+ - Plan constants, plan_limit, meta warnings and root-domain helper
12
+ - **Emails:** Test sends with `test: true` and reserved test addresses
13
+
7
14
  ## 0.20.0 (2026-10-02)
8
15
 
9
16
  ### Features
package/dist/index.d.ts CHANGED
@@ -106,6 +106,12 @@ export declare class Cow {
106
106
  *
107
107
  * Addressed to `{ email }` that no profile in the app holds yet, the send
108
108
  * creates that profile first, as `identify` would.
109
+ *
110
+ * `test: true` asks "would this exact send work?": every check runs and
111
+ * refuses as it would, and the answer carries `status` (`would_send` or
112
+ * the skip) and `rendered`, but nothing is sent or created. An address at
113
+ * `test.cowliss.com` is the other half: a real send whose outcome the
114
+ * address picks (`delivered@`, `bounced@`, `complained@`, `suppressed@`).
109
115
  */
110
116
  emails: {
111
117
  send: ({ idempotencyKey, ...input }: WithDefaultSource<SendEmailInput> & {
package/dist/index.js CHANGED
@@ -128,6 +128,12 @@ export class Cow {
128
128
  *
129
129
  * Addressed to `{ email }` that no profile in the app holds yet, the send
130
130
  * creates that profile first, as `identify` would.
131
+ *
132
+ * `test: true` asks "would this exact send work?": every check runs and
133
+ * refuses as it would, and the answer carries `status` (`would_send` or
134
+ * the skip) and `rendered`, but nothing is sent or created. An address at
135
+ * `test.cowliss.com` is the other half: a real send whose outcome the
136
+ * address picks (`delivered@`, `bounced@`, `complained@`, `suppressed@`).
131
137
  */
132
138
  emails = {
133
139
  send: ({ idempotencyKey, ...input }) => this.#watch(async () => this.#post("/v1/emails", { data: { ...input, sourceId: this.#sourceFor(input) } }, idempotencyKey ?? crypto.randomUUID())),
package/dist/types.d.ts CHANGED
@@ -13,8 +13,13 @@
13
13
  * typecheck here rather than at a customer's call site.
14
14
  */
15
15
  /** The API's error-code enum, as the SDK surfaces it on `CowError.code`. */
16
- export type ErrorCode = "malformed_request" | "invalid_key" | "forbidden" | "not_found" | "conflict" | "payload_too_large" | "validation_failed" | "trait_validation_failed" | "event_denied" | "trait_denied" | "over_quota" | "rate_limited" | "dependency_unavailable" | "internal" | "journey_fuel_exceeded" | "journey_timeout" | "journey_memory_exceeded" | "journey_error" | "journey_output_invalid" | "journey_nondeterministic" | "push_invalid" | "version_not_ready" | "version_outdated" | "source_inactive" | "artifact_too_large";
16
+ export type ErrorCode = "malformed_request" | "invalid_key" | "forbidden" | "not_found" | "conflict" | "payload_too_large" | "validation_failed" | "trait_validation_failed" | "event_denied" | "trait_denied" | "over_quota" | "rate_limited" | "dependency_unavailable" | "internal" | "journey_fuel_exceeded" | "journey_timeout" | "journey_memory_exceeded" | "journey_error" | "journey_output_invalid" | "journey_nondeterministic" | "push_invalid" | "version_not_ready" | "version_outdated" | "source_inactive" | "artifact_too_large" | "plan_limit";
17
17
  export type IdentifierKind = "anonymousId" | "userId" | "clerkId" | "email";
18
+ /**
19
+ * What became of a send: handed over and how it settled, a check that
20
+ * skipped it, or (for a test send) the dry-run twin of either.
21
+ */
22
+ export type DeliveryStatus = "sent" | "delivered" | "bounced" | "complained" | "failed" | "skipped_disabled" | "skipped_paused" | "skipped_suppressed" | "skipped_quota" | "skipped_unknown_purpose" | "skipped_frequency_cap" | "skipped_consent" | "skipped_domain" | "skipped_ssrf" | "would_send" | "would_skip_disabled" | "would_skip_paused" | "would_skip_suppressed" | "would_skip_quota" | "would_skip_unknown_purpose" | "would_skip_frequency_cap" | "would_skip_consent" | "would_skip_domain" | "would_skip_ssrf";
18
23
  /**
19
24
  * The named identifiers a call carries, at least one. Cowliss generates the
20
25
  * profile id and resolves the map to it; a call carrying two identifiers is
@@ -156,10 +161,26 @@ export type SendEmailInput = {
156
161
  key: string;
157
162
  props?: Record<string, unknown>;
158
163
  };
164
+ /**
165
+ * A dry run: every check the real send makes and the same refusals, one
166
+ * delivery row with the outcome, and nothing sent, no profile created, no
167
+ * idempotency key spent and no credit used.
168
+ */
169
+ test?: boolean;
159
170
  };
160
171
  export type SendEmailResult = {
161
172
  /** The delivery this send left behind: the row in Deliveries. */
162
173
  deliveryId: string;
174
+ /** `sent`, or the skip a check recorded; on a test, `would_send` or `would_skip_*`. */
175
+ status: DeliveryStatus;
176
+ /** A test send only: `to` named an `email` nobody holds, which the send would create. */
177
+ wouldCreateProfile?: boolean;
178
+ /** A test send only: the message the real send would carry. */
179
+ rendered?: {
180
+ subject: string;
181
+ html: string;
182
+ text: string;
183
+ };
163
184
  };
164
185
  /** A template key and the props a send would pass it. */
165
186
  export type PreviewEmailInput = {
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.20.0";
1
+ export declare const SDK_VERSION = "0.21.0";
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/version.ts from package.json. Do not edit.
2
- export const SDK_VERSION = "0.20.0";
2
+ export const SDK_VERSION = "0.21.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowliss/sdk",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {