@zapier/zapier-sdk 0.69.2 → 0.70.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 +34 -0
- package/README.md +33 -23
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +10 -1
- package/dist/api/error-classification.d.ts +7 -0
- package/dist/api/error-classification.d.ts.map +1 -1
- package/dist/api/error-classification.js +15 -2
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/sse-parser.d.ts +34 -0
- package/dist/api/sse-parser.d.ts.map +1 -1
- package/dist/api/sse-parser.js +28 -0
- package/dist/api/types.d.ts +9 -1
- package/dist/api/types.d.ts.map +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +2 -2
- package/dist/experimental.cjs +174 -35
- package/dist/experimental.d.mts +34 -2
- package/dist/experimental.d.ts +32 -0
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.mjs +174 -35
- package/dist/{index-DuFFW71E.d.mts → index-C0bQ5snd.d.mts} +33 -1
- package/dist/{index-DuFFW71E.d.ts → index-C0bQ5snd.d.ts} +33 -1
- package/dist/index.cjs +32 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +32 -5
- package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts +3 -0
- package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/createWorkflow/index.js +3 -0
- package/dist/plugins/codeSubstrate/createWorkflow/schemas.d.ts +3 -0
- package/dist/plugins/codeSubstrate/createWorkflow/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/createWorkflow/schemas.js +11 -0
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +13 -0
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.js +9 -0
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts +13 -0
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.js +52 -0
- package/dist/plugins/triggers/drainTriggerInbox/index.d.ts +4 -2
- package/dist/plugins/triggers/drainTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/drainTriggerInbox/index.js +39 -6
- package/dist/plugins/triggers/watchTriggerInbox/index.d.ts +4 -2
- package/dist/plugins/triggers/watchTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/watchTriggerInbox/index.js +100 -16
- package/dist/plugins/triggers/watchTriggerInbox/sse.d.ts +8 -6
- package/dist/plugins/triggers/watchTriggerInbox/sse.d.ts.map +1 -1
- package/dist/plugins/triggers/watchTriggerInbox/sse.js +11 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.70.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8f20472: `watchTriggerInbox` now retries transient drain failures (5xx, 429,
|
|
8
|
+
network blips) indefinitely with bounded backoff instead of rejecting
|
|
9
|
+
on the first error; it still rejects immediately on fail-fast handler
|
|
10
|
+
errors, `initialization_failure`, and permanent HTTP errors. When those
|
|
11
|
+
retries persist long enough to saturate the backoff, it warns once on
|
|
12
|
+
stderr (re-armed on recovery) so a stalled watch isn't silent.
|
|
13
|
+
|
|
14
|
+
New `ApiClient.fetchJsonStream` (with the `JsonSseMessage` type): like
|
|
15
|
+
`fetchStream` but JSON-parses each frame, surfacing a malformed frame
|
|
16
|
+
as `{ parsed: false, data: null, raw }` instead of throwing, so one
|
|
17
|
+
bad frame can't kill a long-lived stream. A non-ok response still
|
|
18
|
+
throws the shared `ZapierError` subclasses before the first frame.
|
|
19
|
+
|
|
20
|
+
Fixed: a fail-fast handler that throws a falsy value (`throw
|
|
21
|
+
undefined`) is no longer silently swallowed, and a handler-thrown
|
|
22
|
+
AbortError now rejects the watch instead of resolving it cleanly.
|
|
23
|
+
|
|
24
|
+
## 0.69.3
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- c4df375: Restore `connections`, `app_versions`, and `trigger` input fields on the
|
|
29
|
+
experimental `publishWorkflowVersion` plugin. The fields were dropped
|
|
30
|
+
during the port from `@zapier/zapier-sdk-code-substrate`, leaving
|
|
31
|
+
workflows published via the in-tree plugin unable to bind connection
|
|
32
|
+
aliases or wire a trigger. Shape matches the durableworkflowzaps
|
|
33
|
+
backend: connections as `{alias: {connection_id: ...}}`, app_versions as
|
|
34
|
+
`{alias: {implementation_name, version?}}`, and trigger as a nested
|
|
35
|
+
object with `selected_api` + `action` required.
|
|
36
|
+
|
|
3
37
|
## 0.69.2
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1130,23 +1130,26 @@ Create a durable workflow container. Starts disabled with no version; publish a
|
|
|
1130
1130
|
|
|
1131
1131
|
**Parameters:**
|
|
1132
1132
|
|
|
1133
|
-
| Name | Type
|
|
1134
|
-
| ----------------- |
|
|
1135
|
-
| `options` | `object`
|
|
1136
|
-
| ↳ `name` | `string`
|
|
1137
|
-
| ↳ `description` | `string`
|
|
1133
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1134
|
+
| ----------------- | --------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------- |
|
|
1135
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1136
|
+
| ↳ `name` | `string` | ✅ | — | — | Workflow name |
|
|
1137
|
+
| ↳ `description` | `string` | ❌ | — | — | Optional description for the workflow |
|
|
1138
|
+
| ↳ `is_private` | `boolean` | ❌ | — | — | If true, only the creating user can see or manage this workflow. Defaults to false (account-visible). |
|
|
1138
1139
|
|
|
1139
1140
|
**Returns:** `Promise<WorkflowItem>`
|
|
1140
1141
|
|
|
1141
|
-
| Name
|
|
1142
|
-
|
|
|
1143
|
-
| `data`
|
|
1144
|
-
| ↳ `id`
|
|
1145
|
-
| ↳ `name`
|
|
1146
|
-
| ↳ `description`
|
|
1147
|
-
| ↳ `trigger_url`
|
|
1148
|
-
| ↳ `enabled`
|
|
1149
|
-
| ↳ `
|
|
1142
|
+
| Name | Type | Required | Possible Values | Description |
|
|
1143
|
+
| ------------------------ | --------- | -------- | --------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
1144
|
+
| `data` | `object` | ✅ | — | |
|
|
1145
|
+
| ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
|
|
1146
|
+
| ↳ `name` | `string` | ✅ | — | Workflow name |
|
|
1147
|
+
| ↳ `description` | `string` | ✅ | — | Workflow description (null if unset) |
|
|
1148
|
+
| ↳ `trigger_url` | `string` | ✅ | — | Public webhook URL that fires this workflow when POSTed to. Embeds a secret trigger token in the path — treat as sensitive. |
|
|
1149
|
+
| ↳ `enabled` | `boolean` | ✅ | — | Whether the workflow currently accepts triggers. Always false on a new workflow until enabled. |
|
|
1150
|
+
| ↳ `is_private` | `boolean` | ✅ | — | Whether the workflow is private to the creating user. False means account-visible. |
|
|
1151
|
+
| ↳ `created_by_user_id` | `string` | ✅ | — | User ID of the workflow creator (null in legacy data) |
|
|
1152
|
+
| ↳ `created_at` | `string` | ✅ | — | When the workflow was created (ISO-8601) |
|
|
1150
1153
|
|
|
1151
1154
|
**Example:**
|
|
1152
1155
|
|
|
@@ -1615,14 +1618,21 @@ Publish a new version of a durable workflow. Enables the workflow by default.
|
|
|
1615
1618
|
|
|
1616
1619
|
**Parameters:**
|
|
1617
1620
|
|
|
1618
|
-
| Name | Type | Required | Default | Possible Values | Description
|
|
1619
|
-
| ---------------------------- | --------- | -------- | ------- | --------------- |
|
|
1620
|
-
| `options` | `object` | ✅ | — | — |
|
|
1621
|
-
| ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID
|
|
1622
|
-
| ↳ `source_files` | `object` | ✅ | — | — | Source files keyed by filename → contents
|
|
1623
|
-
| ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies
|
|
1624
|
-
| ↳ `zapier_durable_version` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.
|
|
1625
|
-
| ↳ `enabled` | `boolean` | ❌ | — | — | Enable the workflow after publishing. Defaults to true; pass false to publish without enabling.
|
|
1621
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1622
|
+
| ---------------------------- | --------- | -------- | ------- | --------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
1623
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1624
|
+
| ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
|
|
1625
|
+
| ↳ `source_files` | `object` | ✅ | — | — | Source files keyed by filename → contents |
|
|
1626
|
+
| ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies |
|
|
1627
|
+
| ↳ `zapier_durable_version` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted. |
|
|
1628
|
+
| ↳ `enabled` | `boolean` | ❌ | — | — | Enable the workflow after publishing. Defaults to true; pass false to publish without enabling. |
|
|
1629
|
+
| ↳ `connections` | `object` | ❌ | — | — | Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding. |
|
|
1630
|
+
| ↳ `app_versions` | `object` | ❌ | — | — | Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding. |
|
|
1631
|
+
| ↳ `trigger` | `object` | ❌ | — | — | Trigger configuration. When provided, the workflow subscribes to a Zapier trigger; omit for webhook-only workflows. |
|
|
1632
|
+
| ↳ `selected_api` | `string` | ✅ | — | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI') |
|
|
1633
|
+
| ↳ `action` | `string` | ✅ | — | — | Trigger action key (e.g. 'new_row') |
|
|
1634
|
+
| ↳ `authentication_id` | `string` | ❌ | — | — | Connection ID for the trigger source. Omit or pass null for no-auth triggers (e.g. Schedule by Zapier). |
|
|
1635
|
+
| ↳ `params` | `object` | ❌ | — | — | Trigger parameters as a JSON object |
|
|
1626
1636
|
|
|
1627
1637
|
**Returns:** `Promise<WorkflowVersionItem>`
|
|
1628
1638
|
|
|
@@ -3220,7 +3230,7 @@ const result = await zapier.updateTriggerInbox({
|
|
|
3220
3230
|
|
|
3221
3231
|
#### `watchTriggerInbox` 🧪 _experimental_
|
|
3222
3232
|
|
|
3223
|
-
Continuously consume a trigger inbox: drain currently-available messages via onMessage, then subscribe to SSE notifications for new arrivals until aborted. A periodic safety drain runs every maxDrainIntervalSeconds (default: 300) to guarantee forward progress if SSE events are missed. Resolves cleanly on signal abort or ZapierAbortDrainSignal from a handler
|
|
3233
|
+
Continuously consume a trigger inbox: drain currently-available messages via onMessage, then subscribe to SSE notifications for new arrivals until aborted. A periodic safety drain runs every maxDrainIntervalSeconds (default: 300) to guarantee forward progress if SSE events are missed. Resolves cleanly on signal abort or ZapierAbortDrainSignal from a handler. Transient drain failures (5xx, 429, network blips) retry indefinitely with bounded backoff until they succeed or the watch is aborted; it rejects on a fail-fast handler error, an initialization_failure, or a permanent HTTP error. Real-time wake-up health is reported on stderr: a warning when wake-ups pause and the watch falls back to the safety drain, plus (with debug) transient reconnect notices. Persistent drain failures likewise warn once on stderr while bounded-backoff retries continue.
|
|
3224
3234
|
|
|
3225
3235
|
**Parameters:**
|
|
3226
3236
|
|
package/dist/api/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAIjB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAIjB,MAAM,SAAS,CAAC;AAk0CjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,CAAC"}
|
package/dist/api/client.js
CHANGED
|
@@ -13,7 +13,7 @@ import { getZapierBaseUrl, isLocalhostBaseUrl } from "../utils/url-utils";
|
|
|
13
13
|
import { sleep, calculateExponentialBackoffMs } from "../utils/retry-utils";
|
|
14
14
|
import { isPlainObject } from "../utils/type-guard-utils";
|
|
15
15
|
import { isAbortError } from "../utils/abort-utils";
|
|
16
|
-
import { createSseParserStream } from "./sse-parser";
|
|
16
|
+
import { createSseParserStream, jsonFrames, } from "./sse-parser";
|
|
17
17
|
import { ZapierApiError, ZapierApprovalError, ZapierAuthenticationError, ZapierConfigurationError, ZapierTimeoutError, ZapierValidationError, ZapierResourceNotFoundError, ZapierRateLimitError, } from "../types/errors";
|
|
18
18
|
import { MAX_CONCURRENCY_LIMIT, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierSdkService, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_MAX_APPROVAL_RETRIES, } from "../constants";
|
|
19
19
|
import { SDK_VERSION } from "../sdk-version";
|
|
@@ -359,6 +359,15 @@ class ZapierApiClient {
|
|
|
359
359
|
* never pins a slot — see `withSemaphore`.
|
|
360
360
|
*/
|
|
361
361
|
this.fetchStream = (path, init) => this.streamSse(path, init);
|
|
362
|
+
/**
|
|
363
|
+
* Like `fetchStream`, but parses each frame's `data` as JSON. Diverges from
|
|
364
|
+
* `fetchJson` deliberately: that throws on invalid JSON, but a long-lived
|
|
365
|
+
* stream must survive a single malformed frame, so a parse failure is yielded
|
|
366
|
+
* as `{ parsed: false, data: null, raw }` rather than thrown. A non-ok
|
|
367
|
+
* response still throws the shared `ZapierError` (from `fetchStream`, before
|
|
368
|
+
* any frame), so transport / auth failures surface as usual.
|
|
369
|
+
*/
|
|
370
|
+
this.fetchJsonStream = (path, init) => jsonFrames(this.fetchStream(path, init));
|
|
362
371
|
this.get = async (path, options = {}) => {
|
|
363
372
|
return this.fetchJson("GET", path, undefined, options);
|
|
364
373
|
};
|
|
@@ -7,6 +7,13 @@
|
|
|
7
7
|
* `api.fetch` already backed off and retried it upstream, so a
|
|
8
8
|
* `ZapierRateLimitError` (also a `ZapierError`) that escapes should be retried
|
|
9
9
|
* on the normal cadence rather than treated as permanent.
|
|
10
|
+
*
|
|
11
|
+
* A `ZapierAuthenticationError` with no `statusCode` is the one carve-out: the
|
|
12
|
+
* token-exchange / credential-resolution layer throws these for setup problems
|
|
13
|
+
* (token endpoint rejected the credentials, missing keychain secret, no
|
|
14
|
+
* credentials at all) that never self-heal, so they are permanent even without
|
|
15
|
+
* a status. Auth errors that DO carry a status fall through to the rule above,
|
|
16
|
+
* so a 5xx/429 from the token endpoint still retries.
|
|
10
17
|
*/
|
|
11
18
|
export declare function isPermanentHttpError(err: unknown): boolean;
|
|
12
19
|
//# sourceMappingURL=error-classification.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-classification.d.ts","sourceRoot":"","sources":["../../src/api/error-classification.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"error-classification.d.ts","sourceRoot":"","sources":["../../src/api/error-classification.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAe1D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ZapierError } from "../types/errors";
|
|
1
|
+
import { ZapierAuthenticationError, ZapierError } from "../types/errors";
|
|
2
2
|
/**
|
|
3
3
|
* Classifies an HTTP error by status code. A 4xx is permanent for now
|
|
4
4
|
* (auth/permission/bad request); 5xx and network errors are transient. We read
|
|
@@ -8,9 +8,22 @@ import { ZapierError } from "../types/errors";
|
|
|
8
8
|
* `api.fetch` already backed off and retried it upstream, so a
|
|
9
9
|
* `ZapierRateLimitError` (also a `ZapierError`) that escapes should be retried
|
|
10
10
|
* on the normal cadence rather than treated as permanent.
|
|
11
|
+
*
|
|
12
|
+
* A `ZapierAuthenticationError` with no `statusCode` is the one carve-out: the
|
|
13
|
+
* token-exchange / credential-resolution layer throws these for setup problems
|
|
14
|
+
* (token endpoint rejected the credentials, missing keychain secret, no
|
|
15
|
+
* credentials at all) that never self-heal, so they are permanent even without
|
|
16
|
+
* a status. Auth errors that DO carry a status fall through to the rule above,
|
|
17
|
+
* so a 5xx/429 from the token endpoint still retries.
|
|
11
18
|
*/
|
|
12
19
|
export function isPermanentHttpError(err) {
|
|
13
|
-
|
|
20
|
+
if (!(err instanceof ZapierError))
|
|
21
|
+
return false;
|
|
22
|
+
if (err instanceof ZapierAuthenticationError &&
|
|
23
|
+
err.statusCode === undefined) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
const { statusCode } = err;
|
|
14
27
|
return (statusCode !== undefined &&
|
|
15
28
|
statusCode >= 400 &&
|
|
16
29
|
statusCode < 500 &&
|
package/dist/api/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
export type { ApiClient, ApiClientOptions, RequestOptions, PollOptions, DebugLogger, Action, Field, Choice, ActionExecutionResult, ActionField, ActionFieldChoice, NeedsRequest, NeedsResponse, Connection, ConnectionsResponse, Implementation, ImplementationsResponse, } from "./types";
|
|
9
9
|
import type { ApiClient } from "./types";
|
|
10
10
|
import type { Credentials } from "../types/credentials";
|
|
11
|
-
export type { SseMessage } from "./sse-parser";
|
|
11
|
+
export type { SseMessage, JsonSseMessage } from "./sse-parser";
|
|
12
12
|
export { isJwt, getAuthorizationHeader, extractUserIdsFromJwt } from "./auth";
|
|
13
13
|
export { createDebugLogger, createDebugFetch } from "./debug";
|
|
14
14
|
export { pollUntilComplete } from "./polling";
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAEV,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,WAAW,EAEX,MAAM,EACN,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,mBAAmB,EACnB,cAAc,EACd,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKxD,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAEV,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,WAAW,EAEX,MAAM,EACN,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,mBAAmB,EACnB,cAAc,EACd,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKxD,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG/D,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAG9E,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAM9D,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC,GAAG,SAAS,CAsBZ"}
|
package/dist/api/sse-parser.d.ts
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
export interface SseMessage {
|
|
2
2
|
data: string;
|
|
3
3
|
}
|
|
4
|
+
/**
|
|
5
|
+
* A streamed SSE frame after JSON parsing, as yielded by
|
|
6
|
+
* `ApiClient.fetchJsonStream`. Unlike `fetchJson` — which throws on invalid
|
|
7
|
+
* JSON — a long-lived stream must not die on one malformed frame, so a parse
|
|
8
|
+
* failure is reported as `{ parsed: false, data: null, raw }` rather than
|
|
9
|
+
* thrown. Callers skip `parsed: false` frames (and may inspect `raw`) and keep
|
|
10
|
+
* consuming.
|
|
11
|
+
*/
|
|
12
|
+
export type JsonSseMessage<T = unknown> = {
|
|
13
|
+
parsed: true;
|
|
14
|
+
data: T;
|
|
15
|
+
raw: string;
|
|
16
|
+
} | {
|
|
17
|
+
parsed: false;
|
|
18
|
+
data: null;
|
|
19
|
+
raw: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Wraps any SSE frame source, JSON-parsing each frame's `data`. A long-lived
|
|
23
|
+
* stream must not die on one malformed frame, so a parse failure is yielded as
|
|
24
|
+
* `{ parsed: false, data: null, raw }` rather than thrown; callers skip those
|
|
25
|
+
* and keep consuming. The `source` parameter is `AsyncIterable`, not a
|
|
26
|
+
* generator, so this is genuinely source-agnostic — any SSE stream qualifies.
|
|
27
|
+
*
|
|
28
|
+
* Two structural invariants the parse boundary depends on:
|
|
29
|
+
* - The `try` wraps ONLY the per-frame `JSON.parse`, so any error the `source`
|
|
30
|
+
* itself surfaces (a pre-frame throw, a mid-stream `read()` rejection, or
|
|
31
|
+
* whatever a future source throws) propagates rather than being swallowed as
|
|
32
|
+
* a `parsed: false` frame.
|
|
33
|
+
* - The `yield` sits OUTSIDE the `try`, so an exception injected at the
|
|
34
|
+
* suspended yield (`gen.throw()`) propagates and unwinds the `for await`
|
|
35
|
+
* (closing `source`), instead of being caught and re-emitted as `parsed: false`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function jsonFrames<T = unknown>(source: AsyncIterable<SseMessage>): AsyncGenerator<JsonSseMessage<T>>;
|
|
4
38
|
/**
|
|
5
39
|
* Minimal Server-Sent Events frame parser as a TransformStream that turns
|
|
6
40
|
* decoded text chunks into `{ data }` messages.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse-parser.d.ts","sourceRoot":"","sources":["../../src/api/sse-parser.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,CA0D3E"}
|
|
1
|
+
{"version":3,"file":"sse-parser.d.ts","sourceRoot":"","sources":["../../src/api/sse-parser.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,OAAO,IAClC;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/C;;;;;;;;;;;;;;;GAeG;AACH,wBAAuB,UAAU,CAAC,CAAC,GAAG,OAAO,EAC3C,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,GAChC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAUnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,CA0D3E"}
|
package/dist/api/sse-parser.js
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps any SSE frame source, JSON-parsing each frame's `data`. A long-lived
|
|
3
|
+
* stream must not die on one malformed frame, so a parse failure is yielded as
|
|
4
|
+
* `{ parsed: false, data: null, raw }` rather than thrown; callers skip those
|
|
5
|
+
* and keep consuming. The `source` parameter is `AsyncIterable`, not a
|
|
6
|
+
* generator, so this is genuinely source-agnostic — any SSE stream qualifies.
|
|
7
|
+
*
|
|
8
|
+
* Two structural invariants the parse boundary depends on:
|
|
9
|
+
* - The `try` wraps ONLY the per-frame `JSON.parse`, so any error the `source`
|
|
10
|
+
* itself surfaces (a pre-frame throw, a mid-stream `read()` rejection, or
|
|
11
|
+
* whatever a future source throws) propagates rather than being swallowed as
|
|
12
|
+
* a `parsed: false` frame.
|
|
13
|
+
* - The `yield` sits OUTSIDE the `try`, so an exception injected at the
|
|
14
|
+
* suspended yield (`gen.throw()`) propagates and unwinds the `for await`
|
|
15
|
+
* (closing `source`), instead of being caught and re-emitted as `parsed: false`.
|
|
16
|
+
*/
|
|
17
|
+
export async function* jsonFrames(source) {
|
|
18
|
+
for await (const { data } of source) {
|
|
19
|
+
let frame;
|
|
20
|
+
try {
|
|
21
|
+
frame = { parsed: true, data: JSON.parse(data), raw: data };
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
frame = { parsed: false, data: null, raw: data };
|
|
25
|
+
}
|
|
26
|
+
yield frame;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
1
29
|
/**
|
|
2
30
|
* Minimal Server-Sent Events frame parser as a TransformStream that turns
|
|
3
31
|
* decoded text chunks into `{ data }` messages.
|
package/dist/api/types.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import type { SdkEvent } from "../types/events";
|
|
|
14
14
|
import type { Credentials } from "../types/credentials";
|
|
15
15
|
import type { RequestContext } from "@zapier/policy-context";
|
|
16
16
|
import type { ZapierCache } from "../cache";
|
|
17
|
-
import type { SseMessage } from "./sse-parser";
|
|
17
|
+
import type { SseMessage, JsonSseMessage } from "./sse-parser";
|
|
18
18
|
import type { z } from "zod";
|
|
19
19
|
import type { NeedChoicesSchema, NeedSchema, ActionLinksSchema, ActionPermissionsSchema, ActionSchema, ChoiceSchema, FieldSchema, ActionExecutionResultSchema, ActionFieldChoiceSchema, ActionFieldSchema, UserProfileSchema, AppSchema, NeedsRequestSchema, NeedsResponseSchema, ImplementationSchema, ImplementationsResponseSchema, ServiceSchema, ServicesResponseSchema, NeedChoicesRequestSchema, NeedChoicesResponseSchema, NeedChoicesResponseMetaSchema, NeedChoicesResponseLinksSchema } from "./schemas";
|
|
20
20
|
export interface ApiClientOptions {
|
|
@@ -114,6 +114,14 @@ export interface ApiClient {
|
|
|
114
114
|
* live (response ok, body present) and before the first frame.
|
|
115
115
|
*/
|
|
116
116
|
fetchStream: (path: string, init?: FetchStreamInit) => AsyncGenerator<SseMessage>;
|
|
117
|
+
/**
|
|
118
|
+
* Like `fetchStream`, but parses each frame's `data` as JSON, yielding
|
|
119
|
+
* `{ parsed, data, raw }`. Unlike `fetchJson`, a malformed frame is never
|
|
120
|
+
* thrown — it surfaces as `{ parsed: false, data: null, raw }` so one bad
|
|
121
|
+
* frame can't kill a long-lived stream. A non-ok response still throws the
|
|
122
|
+
* shared `ZapierError` subclasses before the first frame.
|
|
123
|
+
*/
|
|
124
|
+
fetchJsonStream: <T = unknown>(path: string, init?: FetchStreamInit) => AsyncGenerator<JsonSseMessage<T>>;
|
|
117
125
|
}
|
|
118
126
|
export interface RequestOptions {
|
|
119
127
|
headers?: Record<string, string>;
|
package/dist/api/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACV,wBAAwB,EACxB,iCAAiC,EAClC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACV,wBAAwB,EACxB,iCAAiC,EAClC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,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0B,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAAC;CACpD,CAAC;AA6BF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAE3D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,GAAG,SAAS,CAGzD;AA2BD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAK7B;AAkED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA4B7B;AAqHD;;;;GAIG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE;IACxD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CAehB"}
|
package/dist/auth.js
CHANGED
|
@@ -178,11 +178,11 @@ async function exchangeClientCredentials(options) {
|
|
|
178
178
|
},
|
|
179
179
|
timestamp: Date.now(),
|
|
180
180
|
});
|
|
181
|
-
throw new
|
|
181
|
+
throw new ZapierAuthenticationError(`Client credentials exchange failed: ${response.status} ${response.statusText}`, { statusCode: response.status });
|
|
182
182
|
}
|
|
183
183
|
const data = await response.json();
|
|
184
184
|
if (!data.access_token) {
|
|
185
|
-
throw new
|
|
185
|
+
throw new ZapierAuthenticationError("Client credentials response missing access_token");
|
|
186
186
|
}
|
|
187
187
|
onEvent?.({
|
|
188
188
|
type: "auth_success",
|