@zapier/zapier-sdk 0.68.0 → 0.69.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 (35) hide show
  1. package/AGENTS.md +321 -0
  2. package/CHANGELOG.md +15 -0
  3. package/CLAUDE.md +3 -319
  4. package/README.md +17 -17
  5. package/dist/api/client.d.ts.map +1 -1
  6. package/dist/api/client.js +108 -3
  7. package/dist/api/error-classification.d.ts +12 -0
  8. package/dist/api/error-classification.d.ts.map +1 -0
  9. package/dist/api/error-classification.js +18 -0
  10. package/dist/api/index.d.ts +2 -0
  11. package/dist/api/index.d.ts.map +1 -1
  12. package/dist/api/index.js +3 -0
  13. package/dist/api/sse-parser.d.ts +17 -0
  14. package/dist/api/sse-parser.d.ts.map +1 -0
  15. package/dist/api/sse-parser.js +67 -0
  16. package/dist/api/types.d.ts +16 -0
  17. package/dist/api/types.d.ts.map +1 -1
  18. package/dist/experimental.cjs +356 -67
  19. package/dist/experimental.d.mts +2 -2
  20. package/dist/experimental.mjs +356 -67
  21. package/dist/{index-oRnHsPn5.d.mts → index-DC31DAP2.d.mts} +20 -1
  22. package/dist/{index-oRnHsPn5.d.ts → index-DC31DAP2.d.ts} +20 -1
  23. package/dist/index.cjs +131 -7
  24. package/dist/index.d.mts +1 -1
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.mjs +131 -7
  28. package/dist/plugins/triggers/drainTriggerInbox/schemas.js +2 -2
  29. package/dist/plugins/triggers/watchTriggerInbox/index.d.ts +31 -6
  30. package/dist/plugins/triggers/watchTriggerInbox/index.d.ts.map +1 -1
  31. package/dist/plugins/triggers/watchTriggerInbox/index.js +272 -65
  32. package/dist/plugins/triggers/watchTriggerInbox/sse.d.ts +30 -0
  33. package/dist/plugins/triggers/watchTriggerInbox/sse.d.ts.map +1 -0
  34. package/dist/plugins/triggers/watchTriggerInbox/sse.js +38 -0
  35. package/package.json +2 -1
package/README.md CHANGED
@@ -3220,23 +3220,23 @@ const result = await zapier.updateTriggerInbox({
3220
3220
 
3221
3221
  #### `watchTriggerInbox` 🧪 _experimental_
3222
3222
 
3223
- Continuously consume a trigger inbox: drain currently-available messages via onMessage, then poll with backoff for new arrivals, until aborted. Resolves cleanly on signal abort or ZapierAbortDrainSignal from a handler; rejects on fatal SDK errors or fail-fast handler errors.
3224
-
3225
- **Parameters:**
3226
-
3227
- | Name | Type | Required | Default | Possible Values | Description |
3228
- | ----------------------------- | ---------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3229
- | `options` | `object` | ✅ | — | — | |
3230
- | ​ ↳ `inbox` | `string` | ✅ | — | — | Trigger inbox identifier — UUID or name. Non-UUID values are resolved by name via the inbox list endpoint. |
3231
- | ​ ↳ `onMessage` | `function` | ❌ | — | — | Per-message handler. Resolves to ack; rejects to release-or-leave per `releaseOnError`. Throw `ZapierReleaseTriggerMessageSignal` to release explicitly, or `ZapierAbortDrainSignal` to stop after the current batch. |
3232
- | ​ ↳ `concurrency` | `number` | ❌ | — | — | Per-message handler workers running in parallel. Defaults to `leaseLimit`, or 1 if neither is set. |
3233
- | ​ ↳ `leaseLimit` | `number` | ❌ | — | — | Per-lease HTTP batch size. Defaults to `concurrency`, or 1 if neither is set. |
3234
- | ​ ↳ `leaseSeconds` | `number` | ❌ | — | — | Seconds until the lease expires; messages return to available if not acked. API default is 300 (5 minutes). |
3235
- | ​ ↳ `releaseOnError` | `boolean` | ❌ | — | — | If true, errors release the message when the drain finishes. If false (default), errors leave it leased until the lease timeout. `ZapierReleaseTriggerMessageSignal` always releases regardless. |
3236
- | ​ ↳ `continueOnError` | `boolean` | ❌ | — | — | If false (default, fail-fast), the first handler error rejects and stops the drain. If true, handler errors are observed via `onError` and the drain continues. SDK-level errors (lease / ack / release) reject regardless. |
3237
- | ​ ↳ `onError` | `function` | ❌ | — | — | Per-message error observer for `continueOnError: true`. Called with the failure and the message; control-flow signals are filtered out. Throws from `onError` are swallowed. |
3238
- | ​ ↳ `signal` | `any` | ❌ | — | — | Abort signal. Aborting cancels in-flight HTTP, releases unprocessed messages, and resolves cleanly. Errors during shutdown still reject. |
3239
- | ​ ↳ `maxDrainIntervalSeconds` | `number` | ❌ | — | — | Maximum seconds between empty-inbox poll attempts (default: 60). Caps the back-off cadence. |
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; rejects on fatal SDK errors or fail-fast handler errors. 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.
3224
+
3225
+ **Parameters:**
3226
+
3227
+ | Name | Type | Required | Default | Possible Values | Description |
3228
+ | ----------------------------- | ---------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
3229
+ | `options` | `object` | ✅ | — | — | |
3230
+ | ​ ↳ `inbox` | `string` | ✅ | — | — | Trigger inbox identifier — UUID or name. Non-UUID values are resolved by name via the inbox list endpoint. |
3231
+ | ​ ↳ `onMessage` | `function` | ❌ | — | — | Per-message handler. Resolves to ack; rejects to release-or-leave per `releaseOnError`. Throw `ZapierReleaseTriggerMessageSignal` to release explicitly, or `ZapierAbortDrainSignal` to stop after the current batch. |
3232
+ | ​ ↳ `concurrency` | `number` | ❌ | — | — | Per-message handler workers running in parallel. Defaults to `leaseLimit`, or 1 if neither is set. |
3233
+ | ​ ↳ `leaseLimit` | `number` | ❌ | — | — | Per-lease HTTP batch size. Defaults to `concurrency`, or 1 if neither is set. |
3234
+ | ​ ↳ `leaseSeconds` | `number` | ❌ | — | — | Seconds until the lease expires; messages return to available if not acked. API default is 300 (5 minutes). |
3235
+ | ​ ↳ `releaseOnError` | `boolean` | ❌ | — | — | If true, errors release the message when the drain finishes. If false (default), errors leave it leased until the lease timeout. `ZapierReleaseTriggerMessageSignal` always releases regardless. |
3236
+ | ​ ↳ `continueOnError` | `boolean` | ❌ | — | — | If false (default, fail-fast), the first handler error rejects and stops the drain. If true, handler errors are observed via `onError` and the drain continues. SDK-level errors (lease / ack / release) reject regardless. |
3237
+ | ​ ↳ `onError` | `function` | ❌ | — | — | Per-message error observer for `continueOnError: true`. Called with the failure and the message; control-flow signals are filtered out. Throws from `onError` are swallowed. |
3238
+ | ​ ↳ `signal` | `any` | ❌ | — | — | Abort signal. Aborting cancels in-flight HTTP, releases unprocessed messages, and resolves cleanly. Errors during shutdown still reject. |
3239
+ | ​ ↳ `maxDrainIntervalSeconds` | `number` | ❌ | — | — | Maximum seconds between safety drain attempts (default: 300). The watcher subscribes to SSE notifications for near-real-time wake-ups; this interval is the backstop that guarantees forward progress if SSE events are missed or the connection drops undetected. |
3240
3240
 
3241
3241
  **Returns:** `Promise<void>`
3242
3242
 
@@ -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,EAGjB,MAAM,SAAS,CAAC;AA8qCjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,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;AA+yCjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,CAAC"}
@@ -12,6 +12,8 @@ import { resolveAuthToken, invalidateCredentialsToken, isCliLoginAvailable, } fr
12
12
  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
+ import { isAbortError } from "../utils/abort-utils";
16
+ import { createSseParserStream } from "./sse-parser";
15
17
  import { ZapierApiError, ZapierApprovalError, ZapierAuthenticationError, ZapierConfigurationError, ZapierTimeoutError, ZapierValidationError, ZapierResourceNotFoundError, ZapierRateLimitError, } from "../types/errors";
16
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";
17
19
  import { SDK_VERSION } from "../sdk-version";
@@ -345,6 +347,18 @@ class ZapierApiClient {
345
347
  // (see the `break` above). Every other terminal outcome throws inline.
346
348
  throw new ZapierApprovalError(`Exceeded maximum approval retries (${maxRetries}) for ${path}`, { status: "max_retries_exceeded" });
347
349
  };
350
+ /**
351
+ * Streaming counterpart to `fetch`. Opens a Server-Sent Events connection
352
+ * through the same pipeline (auth, base URL, 429 retry, approval flow,
353
+ * concurrency) and yields parsed `{ data }` frames. On a non-ok response it
354
+ * throws the same `ZapierError` subclasses as the JSON path — callers
355
+ * classify errors off `statusCode` instead of hand-rolling the mapping.
356
+ *
357
+ * The concurrency permit is released when the underlying `fetch` resolves
358
+ * (headers received), not when the body finishes, so a long-lived stream
359
+ * never pins a slot — see `withSemaphore`.
360
+ */
361
+ this.fetchStream = (path, init) => this.streamSse(path, init);
348
362
  this.get = async (path, options = {}) => {
349
363
  return this.fetchJson("GET", path, undefined, options);
350
364
  };
@@ -431,11 +445,23 @@ class ZapierApiClient {
431
445
  }
432
446
  // Helper to handle responses
433
447
  async handleResponse(params) {
434
- const { response, customErrorHandler, resource, wasMissingAuthToken, requiredScopes, } = params;
435
- const { data: responseData } = await this.parseResult(response);
436
- if (response.ok) {
448
+ const { data: responseData } = await this.parseResult(params.response);
449
+ if (params.response.ok) {
437
450
  return responseData;
438
451
  }
452
+ // Returns Promise<never> (every branch throws); returning it satisfies
453
+ // this method's type without an unreachable fall-through.
454
+ return this.throwForErrorResponse({ ...params, responseData });
455
+ }
456
+ /**
457
+ * Maps a non-ok response to the appropriate ZapierError subclass and throws.
458
+ * Takes the already-parsed body so a streaming caller (`fetchStream`) gets
459
+ * the exact same status→error classification as the JSON path without
460
+ * re-reading — or reading on the success path, which would consume the
461
+ * stream — the response body.
462
+ */
463
+ async throwForErrorResponse(params) {
464
+ const { response, responseData, customErrorHandler, resource, wasMissingAuthToken, requiredScopes, } = params;
439
465
  const errorInfo = {
440
466
  status: response.status,
441
467
  statusText: response.statusText,
@@ -736,6 +762,85 @@ class ZapierApiClient {
736
762
  }
737
763
  return result;
738
764
  }
765
+ // The generator body for `fetchStream`. Kept as a prototype method (not an
766
+ // arrow class field, which can't be a generator) and exposed through the
767
+ // bound `fetchStream` arrow above for parity with the other client methods.
768
+ async *streamSse(path, init) {
769
+ const { onOpen, headers: initHeaders, ...fetchInit } = init ?? {};
770
+ const signal = fetchInit.signal;
771
+ if (signal?.aborted)
772
+ return;
773
+ // Mirror fetchJson: when auth was required but no token resolved, a 401/403
774
+ // should surface the "Authentication required" message rather than a bare
775
+ // auth error.
776
+ const wasMissingAuthToken = fetchInit.authRequired === true &&
777
+ (await this.getAuthToken({
778
+ requiredScopes: fetchInit.requiredScopes,
779
+ })) == null;
780
+ const headers = new Headers(initHeaders);
781
+ if (!headers.has("Accept"))
782
+ headers.set("Accept", "text/event-stream");
783
+ let response;
784
+ try {
785
+ response = await this.fetch(path, {
786
+ ...fetchInit,
787
+ method: fetchInit.method ?? "GET",
788
+ headers,
789
+ });
790
+ }
791
+ catch (err) {
792
+ // Aborts unwind quietly; everything else (including a ZapierApprovalError
793
+ // from a policy-denied stream) propagates so the caller can classify it.
794
+ if (signal?.aborted || isAbortError(err))
795
+ return;
796
+ throw err;
797
+ }
798
+ if (!response.ok) {
799
+ // Parse the error body only on this non-ok branch — reading it on the ok
800
+ // path would consume the stream. Map it exactly like the JSON path does.
801
+ const { data } = await this.parseResult(response);
802
+ await this.throwForErrorResponse({
803
+ response,
804
+ responseData: data,
805
+ wasMissingAuthToken,
806
+ requiredScopes: fetchInit.requiredScopes,
807
+ });
808
+ }
809
+ if (!response.body)
810
+ return;
811
+ const reader = response.body
812
+ .pipeThrough(new TextDecoderStream())
813
+ .pipeThrough(createSseParserStream())
814
+ .getReader();
815
+ // Cancelling the reader resolves any pending read() with {done: true},
816
+ // which unblocks the loop below on abort.
817
+ const onAbort = () => {
818
+ reader.cancel().catch(() => { });
819
+ };
820
+ try {
821
+ // Connection is live; fire onOpen before the first read so the caller can
822
+ // run any catch-up work. Inside the try so a throwing onOpen is still
823
+ // followed by the finally's cancel() — the socket never leaks. Reached
824
+ // only after the ok + body checks, so it never fires on a non-ok response
825
+ // or an empty body.
826
+ onOpen?.();
827
+ signal?.addEventListener("abort", onAbort, { once: true });
828
+ while (!signal?.aborted) {
829
+ const { done, value } = await reader.read();
830
+ if (done || signal?.aborted)
831
+ return;
832
+ yield value;
833
+ }
834
+ }
835
+ finally {
836
+ signal?.removeEventListener("abort", onAbort);
837
+ // cancel() (not just releaseLock) so the underlying HTTP connection
838
+ // closes on every unwind path — abort, clean end, throw, throwing onOpen,
839
+ // or the consumer calling .return(). A leaked socket would outlive the
840
+ // stream.
841
+ await reader.cancel().catch(() => { });
842
+ }
843
+ }
739
844
  /**
740
845
  * Run a single approval round: create the approval, open the URL (poll mode)
741
846
  * or throw (throw mode), poll until resolved, and emit events. Throws on
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Classifies an HTTP error by status code. A 4xx is permanent for now
3
+ * (auth/permission/bad request); 5xx and network errors are transient. We read
4
+ * `statusCode` off any `ZapierError`, not just `ZapierApiError`: a policy denial
5
+ * escapes `api.fetch` as a `ZapierApprovalError` (a sibling subclass) carrying a
6
+ * 403, and it must be treated as permanent too. 429 stays transient —
7
+ * `api.fetch` already backed off and retried it upstream, so a
8
+ * `ZapierRateLimitError` (also a `ZapierError`) that escapes should be retried
9
+ * on the normal cadence rather than treated as permanent.
10
+ */
11
+ export declare function isPermanentHttpError(err: unknown): boolean;
12
+ //# sourceMappingURL=error-classification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-classification.d.ts","sourceRoot":"","sources":["../../src/api/error-classification.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAQ1D"}
@@ -0,0 +1,18 @@
1
+ import { ZapierError } from "../types/errors";
2
+ /**
3
+ * Classifies an HTTP error by status code. A 4xx is permanent for now
4
+ * (auth/permission/bad request); 5xx and network errors are transient. We read
5
+ * `statusCode` off any `ZapierError`, not just `ZapierApiError`: a policy denial
6
+ * escapes `api.fetch` as a `ZapierApprovalError` (a sibling subclass) carrying a
7
+ * 403, and it must be treated as permanent too. 429 stays transient —
8
+ * `api.fetch` already backed off and retried it upstream, so a
9
+ * `ZapierRateLimitError` (also a `ZapierError`) that escapes should be retried
10
+ * on the normal cadence rather than treated as permanent.
11
+ */
12
+ export function isPermanentHttpError(err) {
13
+ const statusCode = err instanceof ZapierError ? err.statusCode : undefined;
14
+ return (statusCode !== undefined &&
15
+ statusCode >= 400 &&
16
+ statusCode < 500 &&
17
+ statusCode !== 429);
18
+ }
@@ -8,10 +8,12 @@
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
12
  export { isJwt, getAuthorizationHeader, extractUserIdsFromJwt } from "./auth";
12
13
  export { createDebugLogger, createDebugFetch } from "./debug";
13
14
  export { pollUntilComplete } from "./polling";
14
15
  export { createZapierApi } from "./client";
16
+ export { isPermanentHttpError } from "./error-classification";
15
17
  export declare function generateRequestId(): string;
16
18
  /**
17
19
  * Utility function to get or create an API client for standalone functions
@@ -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;AAIxD,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;AAM3C,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"}
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/C,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;AAI3C,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/index.js CHANGED
@@ -14,6 +14,9 @@ export { createDebugLogger, createDebugFetch } from "./debug";
14
14
  export { pollUntilComplete } from "./polling";
15
15
  // Re-export the main client factory
16
16
  export { createZapierApi } from "./client";
17
+ // Re-export HTTP error classification (SDK-internal: not surfaced at the
18
+ // package root, which cherry-picks named exports from this module).
19
+ export { isPermanentHttpError } from "./error-classification";
17
20
  // Import for local use
18
21
  import { createZapierApi } from "./client";
19
22
  // Utility Functions
@@ -0,0 +1,17 @@
1
+ export interface SseMessage {
2
+ data: string;
3
+ }
4
+ /**
5
+ * Minimal Server-Sent Events frame parser as a TransformStream that turns
6
+ * decoded text chunks into `{ data }` messages.
7
+ *
8
+ * We only surface the `data` field because that's all the SDK's SSE
9
+ * consumers read. Following the WHATWG event-stream parsing rules we still
10
+ * recognize field names so `event:`, `id:`, `retry:` lines and `:` comment
11
+ * heartbeats never leak into the data payload. Consecutive `data:` lines in
12
+ * one event are joined with "\n"; an event is dispatched on a blank line; an
13
+ * event with no data is not emitted. An unterminated trailing event at stream
14
+ * end is dropped (matching browser `EventSource` semantics).
15
+ */
16
+ export declare function createSseParserStream(): TransformStream<string, SseMessage>;
17
+ //# sourceMappingURL=sse-parser.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Minimal Server-Sent Events frame parser as a TransformStream that turns
3
+ * decoded text chunks into `{ data }` messages.
4
+ *
5
+ * We only surface the `data` field because that's all the SDK's SSE
6
+ * consumers read. Following the WHATWG event-stream parsing rules we still
7
+ * recognize field names so `event:`, `id:`, `retry:` lines and `:` comment
8
+ * heartbeats never leak into the data payload. Consecutive `data:` lines in
9
+ * one event are joined with "\n"; an event is dispatched on a blank line; an
10
+ * event with no data is not emitted. An unterminated trailing event at stream
11
+ * end is dropped (matching browser `EventSource` semantics).
12
+ */
13
+ export function createSseParserStream() {
14
+ let buffer = "";
15
+ let data = "";
16
+ let hasData = false;
17
+ function processLine(line, controller) {
18
+ if (line === "") {
19
+ if (hasData) {
20
+ controller.enqueue({
21
+ data: data.endsWith("\n") ? data.slice(0, -1) : data,
22
+ });
23
+ }
24
+ data = "";
25
+ hasData = false;
26
+ return;
27
+ }
28
+ if (line.startsWith(":"))
29
+ return; // comment / heartbeat
30
+ const colon = line.indexOf(":");
31
+ const field = colon === -1 ? line : line.slice(0, colon);
32
+ let value = colon === -1 ? "" : line.slice(colon + 1);
33
+ if (value.startsWith(" "))
34
+ value = value.slice(1);
35
+ if (field === "data") {
36
+ data += value + "\n";
37
+ hasData = true;
38
+ }
39
+ // event / id / retry / unknown fields are intentionally ignored.
40
+ }
41
+ return new TransformStream({
42
+ transform(chunk, controller) {
43
+ buffer += chunk;
44
+ const newline = /\r\n|\r|\n/g;
45
+ let start = 0;
46
+ let match;
47
+ while ((match = newline.exec(buffer)) !== null) {
48
+ // A lone trailing "\r" may be the first half of a "\r\n" split across
49
+ // the next chunk — defer it rather than treat it as a terminator.
50
+ if (match[0] === "\r" && match.index === buffer.length - 1)
51
+ break;
52
+ processLine(buffer.slice(start, match.index), controller);
53
+ start = match.index + match[0].length;
54
+ }
55
+ buffer = buffer.slice(start);
56
+ },
57
+ flush(controller) {
58
+ // A lone trailing "\r" was deferred in `transform` in case it was the
59
+ // first half of a "\r\n" split across chunks. At stream end it can only
60
+ // be a CR line terminator, so resolve the line it terminates now. Any
61
+ // other leftover is an unterminated event and is dropped.
62
+ if (buffer.endsWith("\r")) {
63
+ processLine(buffer.slice(0, -1), controller);
64
+ }
65
+ },
66
+ });
67
+ }
@@ -14,6 +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
18
  import type { z } from "zod";
18
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";
19
20
  export interface ApiClientOptions {
@@ -86,6 +87,13 @@ export interface ApiClientOptions {
86
87
  */
87
88
  cache?: ZapierCache;
88
89
  }
90
+ export interface FetchStreamInit extends RequestInit {
91
+ searchParams?: Record<string, string>;
92
+ authRequired?: boolean;
93
+ requiredScopes?: string[];
94
+ approvalContext?: () => RequestContext;
95
+ onOpen?: () => void;
96
+ }
89
97
  export interface ApiClient {
90
98
  get: <T = unknown>(path: string, options?: RequestOptions) => Promise<T>;
91
99
  post: <T = unknown>(path: string, data?: unknown, options?: RequestOptions) => Promise<T>;
@@ -98,6 +106,14 @@ export interface ApiClient {
98
106
  authRequired?: boolean;
99
107
  approvalContext?: () => RequestContext;
100
108
  }) => Promise<Response>;
109
+ /**
110
+ * Opens a streaming (Server-Sent Events) request and yields parsed
111
+ * `{ data }` frames. Runs the same pipeline as `fetch` (auth, base URL,
112
+ * 429 retry, approval, concurrency) and throws the same `ZapierError`
113
+ * subclasses on a non-ok response. `onOpen` fires once the connection is
114
+ * live (response ok, body present) and before the first frame.
115
+ */
116
+ fetchStream: (path: string, init?: FetchStreamInit) => AsyncGenerator<SseMessage>;
101
117
  }
102
118
  export interface RequestOptions {
103
119
  headers?: Record<string, string>;
@@ -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,yB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