@zapier/zapier-sdk 0.69.3 → 0.70.1
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 +27 -0
- package/README.md +12 -1
- 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 +152 -50
- package/dist/experimental.d.mts +12 -12
- package/dist/experimental.d.ts +10 -10
- package/dist/experimental.mjs +152 -50
- package/dist/{index-DuFFW71E.d.mts → index-DjLMJ3w8.d.mts} +36 -4
- package/dist/{index-DuFFW71E.d.ts → index-DjLMJ3w8.d.ts} +36 -4
- 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/cancelDurableRun/index.d.ts +1 -1
- package/dist/plugins/codeSubstrate/cancelDurableRun/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/cancelDurableRun/index.js +2 -1
- package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/createWorkflow/index.js +2 -1
- package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/deleteWorkflow/index.js +2 -1
- package/dist/plugins/codeSubstrate/deleteWorkflow/schemas.d.ts +4 -0
- package/dist/plugins/codeSubstrate/deleteWorkflow/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/deleteWorkflow/schemas.js +7 -0
- package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/disableWorkflow/index.js +2 -1
- package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/enableWorkflow/index.js +2 -1
- package/dist/plugins/codeSubstrate/getDurableRun/index.d.ts +5 -5
- package/dist/plugins/codeSubstrate/getDurableRun/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/getDurableRun/index.js +2 -1
- package/dist/plugins/codeSubstrate/getDurableRun/schemas.d.ts +24 -24
- package/dist/plugins/codeSubstrate/getDurableRun/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/getDurableRun/schemas.js +4 -9
- package/dist/plugins/codeSubstrate/listDurableRuns/index.d.ts +1 -1
- package/dist/plugins/codeSubstrate/listDurableRuns/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/listDurableRuns/index.js +6 -2
- package/dist/plugins/codeSubstrate/listDurableRuns/schemas.d.ts +6 -6
- package/dist/plugins/codeSubstrate/listDurableRuns/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/listDurableRuns/schemas.js +2 -3
- package/dist/plugins/codeSubstrate/runDurable/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/runDurable/index.js +3 -2
- package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/updateWorkflow/index.js +2 -1
- 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,32 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.70.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- eb30657: Restore Schema.parse() on code-substrate workflow and durable-run response handlers. Opens RunStatus, ExecutionStatus, OperationType, and OperationStatus enums so future server-side values do not break parsing. Reinstates DeleteWorkflowResponseSchema and wires outputSchema on cancelDurableRun and deleteWorkflow.
|
|
8
|
+
|
|
9
|
+
## 0.70.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 8f20472: `watchTriggerInbox` now retries transient drain failures (5xx, 429,
|
|
14
|
+
network blips) indefinitely with bounded backoff instead of rejecting
|
|
15
|
+
on the first error; it still rejects immediately on fail-fast handler
|
|
16
|
+
errors, `initialization_failure`, and permanent HTTP errors. When those
|
|
17
|
+
retries persist long enough to saturate the backoff, it warns once on
|
|
18
|
+
stderr (re-armed on recovery) so a stalled watch isn't silent.
|
|
19
|
+
|
|
20
|
+
New `ApiClient.fetchJsonStream` (with the `JsonSseMessage` type): like
|
|
21
|
+
`fetchStream` but JSON-parses each frame, surfacing a malformed frame
|
|
22
|
+
as `{ parsed: false, data: null, raw }` instead of throwing, so one
|
|
23
|
+
bad frame can't kill a long-lived stream. A non-ok response still
|
|
24
|
+
throws the shared `ZapierError` subclasses before the first frame.
|
|
25
|
+
|
|
26
|
+
Fixed: a fail-fast handler that throws a falsy value (`throw
|
|
27
|
+
undefined`) is no longer silently swallowed, and a handler-thrown
|
|
28
|
+
AbortError now rejects the watch instead of resolving it cleanly.
|
|
29
|
+
|
|
3
30
|
## 0.69.3
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1116,6 +1116,12 @@ Cancel a run-once durable run in initialized or started status. Returns 409 if t
|
|
|
1116
1116
|
|
|
1117
1117
|
**Returns:** `Promise<DurableRunItem>`
|
|
1118
1118
|
|
|
1119
|
+
| Name | Type | Required | Possible Values | Description |
|
|
1120
|
+
| ------------ | -------- | -------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1121
|
+
| `data` | `object` | ✅ | — | |
|
|
1122
|
+
| ↳ `id` | `string` | ✅ | — | Run ID that was targeted |
|
|
1123
|
+
| ↳ `status` | `string` | ✅ | `cancelled` | Always `cancelled` on a successful call. Synthesized client-side — the backend returns 204; callers needing the run's full state should follow up with getDurableRun. |
|
|
1124
|
+
|
|
1119
1125
|
**Example:**
|
|
1120
1126
|
|
|
1121
1127
|
```typescript
|
|
@@ -1172,6 +1178,11 @@ Delete a durable workflow. Throws `ZapierNotFoundError` if the workflow doesn't
|
|
|
1172
1178
|
|
|
1173
1179
|
**Returns:** `Promise<{ success: boolean }>`
|
|
1174
1180
|
|
|
1181
|
+
| Name | Type | Required | Possible Values | Description |
|
|
1182
|
+
| -------- | -------- | -------- | --------------- | ------------------------------------------ |
|
|
1183
|
+
| `data` | `object` | ✅ | — | |
|
|
1184
|
+
| ↳ `id` | `string` | ✅ | — | Workflow ID that was targeted for deletion |
|
|
1185
|
+
|
|
1175
1186
|
**Example:**
|
|
1176
1187
|
|
|
1177
1188
|
```typescript
|
|
@@ -3230,7 +3241,7 @@ const result = await zapier.updateTriggerInbox({
|
|
|
3230
3241
|
|
|
3231
3242
|
#### `watchTriggerInbox` 🧪 _experimental_
|
|
3232
3243
|
|
|
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
|
|
3244
|
+
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.
|
|
3234
3245
|
|
|
3235
3246
|
**Parameters:**
|
|
3236
3247
|
|
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,EA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.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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AE;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",
|