smartletter 1.1.0 → 1.2.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/README.md +38 -0
- package/dist/index.cjs +21 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2273 -984
- package/dist/index.d.mts +2273 -984
- package/dist/index.mjs +21 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -97,6 +97,44 @@ const event = smartletter.webhooks.verify({
|
|
|
97
97
|
});
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
## Changelog
|
|
101
|
+
|
|
102
|
+
### 1.2.0
|
|
103
|
+
|
|
104
|
+
**Breaking changes.** Two fields of the API's answers are renamed to snake_case, like every other field. There is no alias: the old name is gone.
|
|
105
|
+
|
|
106
|
+
- `body.blocks[].blockId` is now `block_id` in every newsletter returned with its body (`newsletters.get`, `newsletters.create`, `newsletters.update`, `newsletters.duplicate`…). Read `block.block_id`.
|
|
107
|
+
- `POST /agent-tasks/{id}/complete` answers `{ newsletter_id, scheduled_for, review }` instead of `{ newsletterId, scheduledFor, review }` (the MCP tool `agent_tasks.complete` too). This route is not in the SDK: update the scripts that call it.
|
|
108
|
+
|
|
109
|
+
Other API changes:
|
|
110
|
+
|
|
111
|
+
- `newsletters.list`: the `status` filter takes `cancelled` and `held`. `failed` is no longer in the type (no newsletter ever has it); the API still accepts it and returns an empty list.
|
|
112
|
+
- `pause_reason` may be `gmail_spam_rate` (paused after too many spam reports at Gmail). It was already sent; the type now lists it.
|
|
113
|
+
- `newsletters.test` returns `variants`: the number of emails sent (one per A/B variant, 1 without a test).
|
|
114
|
+
- `segments.domain.remove` returns `id` (the newsletter's id), like every deletion.
|
|
115
|
+
- `sequences.unenroll` returns the enrollment's real status: `exited` when the contact was taken out, `completed` or `exited` unchanged when the run was already over.
|
|
116
|
+
- `topics.list` returns `has_more: true` when the newsletter has more than 200 topics (it returns the newest 200).
|
|
117
|
+
- `threads.list` and `sequences.enrollments` take the standard pagination: `limit`, `after` and `before`. `threads.list` used to refuse `before`; `sequences.enrollments` ignored `after` and `before` (its `limit` still defaults to 100).
|
|
118
|
+
- `contacts.create` documents its `200` answer: an address already there returns the existing contact with `existed: true`, unchanged.
|
|
119
|
+
|
|
120
|
+
Response types now come from the API's response schemas, which are checked against what the API really answers. They no longer come from the documentation examples. The runtime is unchanged. Only the types are more exact:
|
|
121
|
+
|
|
122
|
+
- `object`, statuses and event names are literal types, for example `"list"`, `"sent"` or `"email.delivered"`, instead of `string`.
|
|
123
|
+
- Fields the examples left out are now typed, and so are the fields they showed as `null` or `[]` (until now `unknown`).
|
|
124
|
+
- 125 fields that can be `null` are now `T | null`. Under `strictNullChecks`, handle the `null` case.
|
|
125
|
+
- Fields that were in an example but never in a response are gone:
|
|
126
|
+
- `body` in the `newsletters.list` items;
|
|
127
|
+
- the spam fields on sent and draft inbox messages;
|
|
128
|
+
- `reasons.invalid` in `contacts.import`.
|
|
129
|
+
- Shapes that vary are unions. Narrow on `direction` (inbox messages), `body.format` (newsletters), the step and trigger `type` (sequences), or `deleted` (`sequences.remove`).
|
|
130
|
+
- Dictionaries whose keys you choose are `Record<string, …>`: `custom_fields`, `metadata`, `properties` and filter `rules`.
|
|
131
|
+
- Free-form objects are `Record<string, unknown>` too: the condition step's `rule` and the items of its `yes` and `no` branches (sequences), and the webhook `payload.data` (`webhooks.test`, `webhooks.deliveries`, `webhooks.retryDelivery`).
|
|
132
|
+
- `links.x` in `segments.archive.get` and `segments.archive.update` is optional: it is missing when no X link is set.
|
|
133
|
+
- Webhook `events` (`webhooks.list`, `webhooks.get`) is a union of event names, such as `"email.delivered"`, instead of `string[]`.
|
|
134
|
+
- `messages.send` returns the message sent (`status: "sent"`), or `{ object, email_id, status }` when the email was queued but its record could not be saved. `threads.reply` returns the same, or the saved draft (`status: "draft"`) with `draft: true`.
|
|
135
|
+
|
|
136
|
+
Answers may gain fields in a later version. The types stay open for reading: a field the API adds does not break your code. Lists of values (statuses, event names) may grow too, so keep a default branch when you switch on one.
|
|
137
|
+
|
|
100
138
|
## License
|
|
101
139
|
|
|
102
140
|
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -81,7 +81,7 @@ var Client = class {
|
|
|
81
81
|
}
|
|
82
82
|
this.key = resolved;
|
|
83
83
|
this.baseUrl = (options.baseUrl || env("SMARTLETTER_BASE_URL") || DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
84
|
-
this.userAgent = options.userAgent ?? `smartletter-node/${"1.
|
|
84
|
+
this.userAgent = options.userAgent ?? `smartletter-node/${"1.2.0"}`;
|
|
85
85
|
}
|
|
86
86
|
async call(op, args, options = {}) {
|
|
87
87
|
const headers = new Headers(options.headers);
|
|
@@ -2111,14 +2111,20 @@ var OPERATIONS = {
|
|
|
2111
2111
|
method: "GET",
|
|
2112
2112
|
path: "/sequences/{id}/enrollments",
|
|
2113
2113
|
pathParams: ["id"],
|
|
2114
|
-
paginated:
|
|
2114
|
+
paginated: true,
|
|
2115
2115
|
idempotent: false,
|
|
2116
2116
|
query: {
|
|
2117
|
-
status: {
|
|
2118
|
-
wire: "status"
|
|
2119
|
-
},
|
|
2120
2117
|
limit: {
|
|
2121
2118
|
wire: "limit"
|
|
2119
|
+
},
|
|
2120
|
+
after: {
|
|
2121
|
+
wire: "after"
|
|
2122
|
+
},
|
|
2123
|
+
before: {
|
|
2124
|
+
wire: "before"
|
|
2125
|
+
},
|
|
2126
|
+
status: {
|
|
2127
|
+
wire: "status"
|
|
2122
2128
|
}
|
|
2123
2129
|
}
|
|
2124
2130
|
},
|
|
@@ -2375,9 +2381,18 @@ var OPERATIONS = {
|
|
|
2375
2381
|
method: "GET",
|
|
2376
2382
|
path: "/threads",
|
|
2377
2383
|
pathParams: [],
|
|
2378
|
-
paginated:
|
|
2384
|
+
paginated: true,
|
|
2379
2385
|
idempotent: false,
|
|
2380
2386
|
query: {
|
|
2387
|
+
limit: {
|
|
2388
|
+
wire: "limit"
|
|
2389
|
+
},
|
|
2390
|
+
after: {
|
|
2391
|
+
wire: "after"
|
|
2392
|
+
},
|
|
2393
|
+
before: {
|
|
2394
|
+
wire: "before"
|
|
2395
|
+
},
|
|
2381
2396
|
inboxId: {
|
|
2382
2397
|
wire: "inbox_id"
|
|
2383
2398
|
},
|
|
@@ -2395,12 +2410,6 @@ var OPERATIONS = {
|
|
|
2395
2410
|
},
|
|
2396
2411
|
unread: {
|
|
2397
2412
|
wire: "unread"
|
|
2398
|
-
},
|
|
2399
|
-
limit: {
|
|
2400
|
-
wire: "limit"
|
|
2401
|
-
},
|
|
2402
|
-
after: {
|
|
2403
|
-
wire: "after"
|
|
2404
2413
|
}
|
|
2405
2414
|
}
|
|
2406
2415
|
},
|