@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
@@ -2058,6 +2058,10 @@ interface ZapierCache {
2058
2058
  */
2059
2059
  declare function createMemoryCache(): ZapierCache;
2060
2060
 
2061
+ interface SseMessage {
2062
+ data: string;
2063
+ }
2064
+
2061
2065
  declare const NeedSchema: z.ZodObject<{
2062
2066
  key: z.ZodString;
2063
2067
  alters_custom_fields: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
@@ -2397,6 +2401,13 @@ interface ApiClientOptions {
2397
2401
  */
2398
2402
  cache?: ZapierCache;
2399
2403
  }
2404
+ interface FetchStreamInit extends RequestInit {
2405
+ searchParams?: Record<string, string>;
2406
+ authRequired?: boolean;
2407
+ requiredScopes?: string[];
2408
+ approvalContext?: () => RequestContext;
2409
+ onOpen?: () => void;
2410
+ }
2400
2411
  interface ApiClient {
2401
2412
  get: <T = unknown>(path: string, options?: RequestOptions) => Promise<T>;
2402
2413
  post: <T = unknown>(path: string, data?: unknown, options?: RequestOptions) => Promise<T>;
@@ -2409,6 +2420,14 @@ interface ApiClient {
2409
2420
  authRequired?: boolean;
2410
2421
  approvalContext?: () => RequestContext;
2411
2422
  }) => Promise<Response>;
2423
+ /**
2424
+ * Opens a streaming (Server-Sent Events) request and yields parsed
2425
+ * `{ data }` frames. Runs the same pipeline as `fetch` (auth, base URL,
2426
+ * 429 retry, approval, concurrency) and throws the same `ZapierError`
2427
+ * subclasses on a non-ok response. `onOpen` fires once the connection is
2428
+ * live (response ok, body present) and before the first frame.
2429
+ */
2430
+ fetchStream: (path: string, init?: FetchStreamInit) => AsyncGenerator<SseMessage>;
2412
2431
  }
2413
2432
  interface RequestOptions {
2414
2433
  headers?: Record<string, string>;
@@ -15194,4 +15213,4 @@ declare const registryPlugin: (sdk: {
15194
15213
  };
15195
15214
  }) => {};
15196
15215
 
15197
- export { createFunction as $, type ApiClient as A, type BaseSdkOptions as B, type CoreOptions as C, type DrainTriggerInboxOptions as D, type EventEmissionContext as E, type FieldsetItem as F, type GetAuthenticationPluginProvides as G, type Choice as H, type ActionExecutionResult as I, type ActionField as J, type ActionFieldChoice as K, type LeasedTriggerMessageItem as L, type MethodHooks as M, type Need as N, type OutputFormatter as O, type PluginStack as P, type NeedsRequest as Q, type ResolvedAppLocator as R, type NeedsResponse as S, type TriggerMessageStatus as T, type UpdateManifestEntryOptions as U, type Connection as V, type WatchTriggerInboxOptions as W, type ConnectionsResponse as X, type UserProfile as Y, type ZapierSdkOptions as Z, isPositional as _, type PluginMeta as a, AuthenticationIdPropertySchema as a$, createPluginStack as a0, createCorePlugin as a1, addPlugin as a2, type FormattedItem as a3, type Resolver as a4, type ArrayResolver as a5, type ResolverMetadata as a6, type StaticResolver as a7, type DynamicListResolver as a8, type DynamicSearchResolver as a9, definePlugin as aA, createPluginMethod as aB, createPaginatedPluginMethod as aC, composePlugins as aD, type ActionItem as aE, type ActionTypeItem as aF, registryPlugin as aG, type RequestOptions as aH, type PollOptions as aI, createZapierApi as aJ, getOrCreateApiClient as aK, type AppItem as aL, type ConnectionItem as aM, type ActionItem$1 as aN, type InputFieldItem as aO, type InfoFieldItem as aP, type RootFieldItem as aQ, type UserProfileItem as aR, type SdkPage as aS, type PaginatedSdkFunction as aT, AppKeyPropertySchema as aU, AppPropertySchema as aV, ActionTypePropertySchema as aW, ActionKeyPropertySchema as aX, ActionPropertySchema as aY, InputFieldPropertySchema as aZ, ConnectionIdPropertySchema as a_, type FieldsResolver as aa, runInMethodScope as ab, runWithTelemetryContext as ac, toSnakeCase as ad, toTitleCase as ae, batch as af, type BatchOptions as ag, buildCapabilityMessage as ah, logDeprecation as ai, resetDeprecationWarnings as aj, RelayRequestSchema as ak, RelayFetchSchema as al, createZapierSdkWithoutRegistry as am, createSdk as an, createOptionsPlugin as ao, createZapierCoreStack as ap, type FunctionRegistryEntry as aq, type FunctionDeprecation as ar, BaseSdkOptionsSchema as as, isCoreError as at, getCoreErrorCode as au, getCoreErrorCause as av, CORE_ERROR_SYMBOL as aw, CoreErrorCode as ax, type Plugin as ay, type PluginProvides as az, type Manifest as b, type RateLimitInfo as b$, ConnectionPropertySchema as b0, InputsPropertySchema as b1, LimitPropertySchema as b2, OffsetPropertySchema as b3, OutputPropertySchema as b4, DebugPropertySchema as b5, ParamsPropertySchema as b6, ActionTimeoutMsPropertySchema as b7, TablePropertySchema as b8, RecordPropertySchema as b9, type TableProperty as bA, type RecordProperty as bB, type RecordsProperty as bC, type FieldsProperty as bD, type AppsProperty as bE, type TablesProperty as bF, type ConnectionsProperty as bG, type TriggerInboxProperty as bH, type TriggerInboxNameProperty as bI, type LeaseProperty as bJ, type LeaseSecondsProperty as bK, type LeaseLimitProperty as bL, type ErrorOptions as bM, ZapierError as bN, ZapierValidationError as bO, ZapierUnknownError as bP, ZapierAuthenticationError as bQ, zapierAdaptError as bR, ZapierApiError as bS, ZapierAppNotFoundError as bT, ZapierNotFoundError as bU, ZapierResourceNotFoundError as bV, ZapierConfigurationError as bW, ZapierBundleError as bX, ZapierTimeoutError as bY, ZapierActionError as bZ, ZapierConflictError as b_, RecordsPropertySchema as ba, FieldsPropertySchema as bb, AppsPropertySchema as bc, TablesPropertySchema as bd, ConnectionsPropertySchema as be, TriggerInboxPropertySchema as bf, TriggerInboxNamePropertySchema as bg, LeasePropertySchema as bh, LeaseSecondsPropertySchema as bi, LeaseLimitPropertySchema as bj, type AppKeyProperty as bk, type AppProperty as bl, type ActionTypeProperty as bm, type ActionKeyProperty as bn, type ActionProperty as bo, type InputFieldProperty as bp, type ConnectionIdProperty as bq, type ConnectionProperty as br, type AuthenticationIdProperty as bs, type InputsProperty as bt, type LimitProperty as bu, type OffsetProperty as bv, type OutputProperty as bw, type DebugProperty as bx, type ParamsProperty as by, type ActionTimeoutMsProperty as bz, type UpdateManifestEntryResult as c, inputsResolver as c$, ZapierRateLimitError as c0, type ApprovalStatus as c1, ZapierApprovalError as c2, ZapierRelayError as c3, formatErrorMessage as c4, type ApiError as c5, ZapierSignal as c6, appsPlugin as c7, type AppsPluginProvides as c8, type ActionExecutionOptions as c9, type GetConnectionPluginProvides as cA, findFirstConnectionPlugin as cB, type FindFirstConnectionPluginProvides as cC, findUniqueConnectionPlugin as cD, type FindUniqueConnectionPluginProvides as cE, CONTEXT_CACHE_TTL_MS as cF, CONTEXT_CACHE_MAX_SIZE as cG, runActionPlugin as cH, type RunActionPluginProvides as cI, requestPlugin as cJ, type RequestPluginProvides as cK, type ManifestPluginOptions as cL, getPreferredManifestEntryKey as cM, manifestPlugin as cN, type ManifestPluginProvides as cO, DEFAULT_CONFIG_PATH as cP, type ManifestEntry as cQ, getProfilePlugin as cR, type GetProfilePluginProvides as cS, type ApiPluginOptions as cT, apiPlugin as cU, type ApiPluginProvides as cV, appKeyResolver as cW, actionTypeResolver as cX, actionKeyResolver as cY, connectionIdResolver as cZ, connectionIdGenericResolver as c_, type AppFactoryInput as ca, fetchPlugin as cb, type FetchPluginProvides as cc, listAppsPlugin as cd, type ListAppsPluginProvides as ce, listActionsPlugin as cf, type ListActionsPluginProvides as cg, listActionInputFieldsPlugin as ch, type ListActionInputFieldsPluginProvides as ci, listActionInputFieldChoicesPlugin as cj, type ListActionInputFieldChoicesPluginProvides as ck, getActionInputFieldsSchemaPlugin as cl, type GetActionInputFieldsSchemaPluginProvides as cm, listConnectionsPlugin as cn, type ListConnectionsPluginProvides as co, listClientCredentialsPlugin as cp, type ListClientCredentialsPluginProvides as cq, createClientCredentialsPlugin as cr, type CreateClientCredentialsPluginProvides as cs, deleteClientCredentialsPlugin as ct, type DeleteClientCredentialsPluginProvides as cu, getAppPlugin as cv, type GetAppPluginProvides as cw, getActionPlugin as cx, type GetActionPluginProvides as cy, getConnectionPlugin as cz, type AddActionEntryOptions as d, connectionsPlugin as d$, inputsAllOptionalResolver as d0, inputFieldKeyResolver as d1, clientCredentialsNameResolver as d2, clientIdResolver as d3, tableIdResolver as d4, triggerInboxResolver as d5, workflowIdResolver as d6, durableRunIdResolver as d7, workflowVersionIdResolver as d8, workflowRunIdResolver as d9, type LoadingEvent as dA, type EventCallback as dB, type Credentials as dC, type ResolvedCredentials as dD, type CredentialsObject as dE, type ClientCredentialsObject as dF, type PkceCredentialsObject as dG, isClientCredentials as dH, isPkceCredentials as dI, isCredentialsObject as dJ, isCredentialsFunction as dK, type ResolveCredentialsOptions as dL, resolveCredentialsFromEnv as dM, resolveCredentials as dN, getBaseUrlFromCredentials as dO, getClientIdFromCredentials as dP, ClientCredentialsObjectSchema as dQ, PkceCredentialsObjectSchema as dR, CredentialsObjectSchema as dS, ResolvedCredentialsSchema as dT, CredentialsFunctionSchema as dU, type CredentialsFunction as dV, CredentialsSchema as dW, ConnectionEntrySchema as dX, type ConnectionEntry as dY, ConnectionsMapSchema as dZ, type ConnectionsMap as d_, triggerMessagesResolver as da, tableRecordIdResolver as db, tableRecordIdsResolver as dc, tableFieldIdsResolver as dd, tableNameResolver as de, tableFieldsResolver as df, tableRecordsResolver as dg, tableUpdateRecordsResolver as dh, tableFiltersResolver as di, tableSortResolver as dj, type ResolveAuthTokenOptions as dk, clearTokenCache as dl, invalidateCachedToken as dm, injectCliLogin as dn, isCliLoginAvailable as dp, getTokenFromCliLogin as dq, resolveAuthToken as dr, invalidateCredentialsToken as ds, type ZapierCache as dt, type ZapierCacheEntry as du, type ZapierCacheSetOptions as dv, createMemoryCache as dw, type SdkEvent as dx, type AuthEvent as dy, type ApiEvent as dz, type AddActionEntryResult as e, createZapierSdk as e$, type ConnectionsPluginProvides as e0, ZAPIER_BASE_URL as e1, getZapierSdkService as e2, MAX_PAGE_LIMIT as e3, DEFAULT_PAGE_SIZE as e4, DEFAULT_ACTION_TIMEOUT_MS as e5, ZAPIER_MAX_NETWORK_RETRIES as e6, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS as e7, MAX_CONCURRENCY_LIMIT as e8, parseConcurrencyEnvVar as e9, type DeleteTableRecordsPluginProvides as eA, updateTableRecordsPlugin as eB, type UpdateTableRecordsPluginProvides as eC, cleanupEventListeners as eD, type EventEmissionConfig as eE, eventEmissionPlugin as eF, type EventEmissionProvides as eG, type EventContext as eH, type ApplicationLifecycleEventData as eI, type EnhancedErrorEventData as eJ, type MethodCalledEventData as eK, buildApplicationLifecycleEvent as eL, buildErrorEventWithContext as eM, buildErrorEvent as eN, createBaseEvent as eO, buildMethodCalledEvent as eP, type BaseEvent as eQ, type MethodCalledEvent as eR, generateEventId as eS, getCurrentTimestamp as eT, getReleaseId as eU, getOsInfo as eV, getPlatformVersions as eW, isCi as eX, getCiPlatform as eY, getMemoryUsage as eZ, getCpuTime as e_, ZAPIER_MAX_CONCURRENT_REQUESTS as ea, getZapierApprovalMode as eb, getZapierDefaultApprovalMode as ec, DEFAULT_APPROVAL_TIMEOUT_MS as ed, DEFAULT_MAX_APPROVAL_RETRIES as ee, listTablesPlugin as ef, type ListTablesPluginProvides as eg, getTablePlugin as eh, type GetTablePluginProvides as ei, createTablePlugin as ej, type CreateTablePluginProvides as ek, deleteTablePlugin as el, type DeleteTablePluginProvides as em, listTableFieldsPlugin as en, type ListTableFieldsPluginProvides as eo, createTableFieldsPlugin as ep, type CreateTableFieldsPluginProvides as eq, deleteTableFieldsPlugin as er, type DeleteTableFieldsPluginProvides as es, getTableRecordPlugin as et, type GetTableRecordPluginProvides as eu, listTableRecordsPlugin as ev, type ListTableRecordsPluginProvides as ew, createTableRecordsPlugin as ex, type CreateTableRecordsPluginProvides as ey, deleteTableRecordsPlugin as ez, type ActionEntry as f, createZapierSdkStack as f0, type ZapierSdk as f1, findManifestEntry as g, type CapabilitiesContext as h, type PaginatedSdkResult as i, type PositionalMetadata as j, type ZapierFetchInitOptions as k, type DynamicResolver as l, type ActionProxy as m, type ZapierSdkApps as n, type WithAddPlugin as o, ZapierAbortDrainSignal as p, ZapierReleaseTriggerMessageSignal as q, readManifestFromFile as r, type DrainTriggerInboxCallback as s, type DrainTriggerInboxErrorObserver as t, type ListAuthenticationsPluginProvides as u, type FindFirstAuthenticationPluginProvides as v, type FindUniqueAuthenticationPluginProvides as w, type Action as x, type App as y, type Field as z };
15216
+ export { createFunction as $, type ApiClient as A, type BaseSdkOptions as B, type CoreOptions as C, type DrainTriggerInboxOptions as D, type EventEmissionContext as E, type FieldsetItem as F, type GetAuthenticationPluginProvides as G, type Choice as H, type ActionExecutionResult as I, type ActionField as J, type ActionFieldChoice as K, type LeasedTriggerMessageItem as L, type MethodHooks as M, type Need as N, type OutputFormatter as O, type PluginStack as P, type NeedsRequest as Q, type ResolvedAppLocator as R, type NeedsResponse as S, type TriggerMessageStatus as T, type UpdateManifestEntryOptions as U, type Connection as V, type WatchTriggerInboxOptions as W, type ConnectionsResponse as X, type UserProfile as Y, type ZapierSdkOptions as Z, isPositional as _, type PluginMeta as a, ConnectionIdPropertySchema as a$, createPluginStack as a0, createCorePlugin as a1, addPlugin as a2, type FormattedItem as a3, type Resolver as a4, type ArrayResolver as a5, type ResolverMetadata as a6, type StaticResolver as a7, type DynamicListResolver as a8, type DynamicSearchResolver as a9, definePlugin as aA, createPluginMethod as aB, createPaginatedPluginMethod as aC, composePlugins as aD, type ActionItem as aE, type ActionTypeItem as aF, registryPlugin as aG, type RequestOptions as aH, type PollOptions as aI, createZapierApi as aJ, getOrCreateApiClient as aK, type SseMessage as aL, type AppItem as aM, type ConnectionItem as aN, type ActionItem$1 as aO, type InputFieldItem as aP, type InfoFieldItem as aQ, type RootFieldItem as aR, type UserProfileItem as aS, type SdkPage as aT, type PaginatedSdkFunction as aU, AppKeyPropertySchema as aV, AppPropertySchema as aW, ActionTypePropertySchema as aX, ActionKeyPropertySchema as aY, ActionPropertySchema as aZ, InputFieldPropertySchema as a_, type FieldsResolver as aa, runInMethodScope as ab, runWithTelemetryContext as ac, toSnakeCase as ad, toTitleCase as ae, batch as af, type BatchOptions as ag, buildCapabilityMessage as ah, logDeprecation as ai, resetDeprecationWarnings as aj, RelayRequestSchema as ak, RelayFetchSchema as al, createZapierSdkWithoutRegistry as am, createSdk as an, createOptionsPlugin as ao, createZapierCoreStack as ap, type FunctionRegistryEntry as aq, type FunctionDeprecation as ar, BaseSdkOptionsSchema as as, isCoreError as at, getCoreErrorCode as au, getCoreErrorCause as av, CORE_ERROR_SYMBOL as aw, CoreErrorCode as ax, type Plugin as ay, type PluginProvides as az, type Manifest as b, ZapierConflictError as b$, AuthenticationIdPropertySchema as b0, ConnectionPropertySchema as b1, InputsPropertySchema as b2, LimitPropertySchema as b3, OffsetPropertySchema as b4, OutputPropertySchema as b5, DebugPropertySchema as b6, ParamsPropertySchema as b7, ActionTimeoutMsPropertySchema as b8, TablePropertySchema as b9, type ActionTimeoutMsProperty as bA, type TableProperty as bB, type RecordProperty as bC, type RecordsProperty as bD, type FieldsProperty as bE, type AppsProperty as bF, type TablesProperty as bG, type ConnectionsProperty as bH, type TriggerInboxProperty as bI, type TriggerInboxNameProperty as bJ, type LeaseProperty as bK, type LeaseSecondsProperty as bL, type LeaseLimitProperty as bM, type ErrorOptions as bN, ZapierError as bO, ZapierValidationError as bP, ZapierUnknownError as bQ, ZapierAuthenticationError as bR, zapierAdaptError as bS, ZapierApiError as bT, ZapierAppNotFoundError as bU, ZapierNotFoundError as bV, ZapierResourceNotFoundError as bW, ZapierConfigurationError as bX, ZapierBundleError as bY, ZapierTimeoutError as bZ, ZapierActionError as b_, RecordPropertySchema as ba, RecordsPropertySchema as bb, FieldsPropertySchema as bc, AppsPropertySchema as bd, TablesPropertySchema as be, ConnectionsPropertySchema as bf, TriggerInboxPropertySchema as bg, TriggerInboxNamePropertySchema as bh, LeasePropertySchema as bi, LeaseSecondsPropertySchema as bj, LeaseLimitPropertySchema as bk, type AppKeyProperty as bl, type AppProperty as bm, type ActionTypeProperty as bn, type ActionKeyProperty as bo, type ActionProperty as bp, type InputFieldProperty as bq, type ConnectionIdProperty as br, type ConnectionProperty as bs, type AuthenticationIdProperty as bt, type InputsProperty as bu, type LimitProperty as bv, type OffsetProperty as bw, type OutputProperty as bx, type DebugProperty as by, type ParamsProperty as bz, type UpdateManifestEntryResult as c, connectionIdGenericResolver as c$, type RateLimitInfo as c0, ZapierRateLimitError as c1, type ApprovalStatus as c2, ZapierApprovalError as c3, ZapierRelayError as c4, formatErrorMessage as c5, type ApiError as c6, ZapierSignal as c7, appsPlugin as c8, type AppsPluginProvides as c9, getConnectionPlugin as cA, type GetConnectionPluginProvides as cB, findFirstConnectionPlugin as cC, type FindFirstConnectionPluginProvides as cD, findUniqueConnectionPlugin as cE, type FindUniqueConnectionPluginProvides as cF, CONTEXT_CACHE_TTL_MS as cG, CONTEXT_CACHE_MAX_SIZE as cH, runActionPlugin as cI, type RunActionPluginProvides as cJ, requestPlugin as cK, type RequestPluginProvides as cL, type ManifestPluginOptions as cM, getPreferredManifestEntryKey as cN, manifestPlugin as cO, type ManifestPluginProvides as cP, DEFAULT_CONFIG_PATH as cQ, type ManifestEntry as cR, getProfilePlugin as cS, type GetProfilePluginProvides as cT, type ApiPluginOptions as cU, apiPlugin as cV, type ApiPluginProvides as cW, appKeyResolver as cX, actionTypeResolver as cY, actionKeyResolver as cZ, connectionIdResolver as c_, type ActionExecutionOptions as ca, type AppFactoryInput as cb, fetchPlugin as cc, type FetchPluginProvides as cd, listAppsPlugin as ce, type ListAppsPluginProvides as cf, listActionsPlugin as cg, type ListActionsPluginProvides as ch, listActionInputFieldsPlugin as ci, type ListActionInputFieldsPluginProvides as cj, listActionInputFieldChoicesPlugin as ck, type ListActionInputFieldChoicesPluginProvides as cl, getActionInputFieldsSchemaPlugin as cm, type GetActionInputFieldsSchemaPluginProvides as cn, listConnectionsPlugin as co, type ListConnectionsPluginProvides as cp, listClientCredentialsPlugin as cq, type ListClientCredentialsPluginProvides as cr, createClientCredentialsPlugin as cs, type CreateClientCredentialsPluginProvides as ct, deleteClientCredentialsPlugin as cu, type DeleteClientCredentialsPluginProvides as cv, getAppPlugin as cw, type GetAppPluginProvides as cx, getActionPlugin as cy, type GetActionPluginProvides as cz, type AddActionEntryOptions as d, type ConnectionsMap as d$, inputsResolver as d0, inputsAllOptionalResolver as d1, inputFieldKeyResolver as d2, clientCredentialsNameResolver as d3, clientIdResolver as d4, tableIdResolver as d5, triggerInboxResolver as d6, workflowIdResolver as d7, durableRunIdResolver as d8, workflowVersionIdResolver as d9, type ApiEvent as dA, type LoadingEvent as dB, type EventCallback as dC, type Credentials as dD, type ResolvedCredentials as dE, type CredentialsObject as dF, type ClientCredentialsObject as dG, type PkceCredentialsObject as dH, isClientCredentials as dI, isPkceCredentials as dJ, isCredentialsObject as dK, isCredentialsFunction as dL, type ResolveCredentialsOptions as dM, resolveCredentialsFromEnv as dN, resolveCredentials as dO, getBaseUrlFromCredentials as dP, getClientIdFromCredentials as dQ, ClientCredentialsObjectSchema as dR, PkceCredentialsObjectSchema as dS, CredentialsObjectSchema as dT, ResolvedCredentialsSchema as dU, CredentialsFunctionSchema as dV, type CredentialsFunction as dW, CredentialsSchema as dX, ConnectionEntrySchema as dY, type ConnectionEntry as dZ, ConnectionsMapSchema as d_, workflowRunIdResolver as da, triggerMessagesResolver as db, tableRecordIdResolver as dc, tableRecordIdsResolver as dd, tableFieldIdsResolver as de, tableNameResolver as df, tableFieldsResolver as dg, tableRecordsResolver as dh, tableUpdateRecordsResolver as di, tableFiltersResolver as dj, tableSortResolver as dk, type ResolveAuthTokenOptions as dl, clearTokenCache as dm, invalidateCachedToken as dn, injectCliLogin as dp, isCliLoginAvailable as dq, getTokenFromCliLogin as dr, resolveAuthToken as ds, invalidateCredentialsToken as dt, type ZapierCache as du, type ZapierCacheEntry as dv, type ZapierCacheSetOptions as dw, createMemoryCache as dx, type SdkEvent as dy, type AuthEvent as dz, type AddActionEntryResult as e, getCpuTime as e$, connectionsPlugin as e0, type ConnectionsPluginProvides as e1, ZAPIER_BASE_URL as e2, getZapierSdkService as e3, MAX_PAGE_LIMIT as e4, DEFAULT_PAGE_SIZE as e5, DEFAULT_ACTION_TIMEOUT_MS as e6, ZAPIER_MAX_NETWORK_RETRIES as e7, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS as e8, MAX_CONCURRENCY_LIMIT as e9, deleteTableRecordsPlugin as eA, type DeleteTableRecordsPluginProvides as eB, updateTableRecordsPlugin as eC, type UpdateTableRecordsPluginProvides as eD, cleanupEventListeners as eE, type EventEmissionConfig as eF, eventEmissionPlugin as eG, type EventEmissionProvides as eH, type EventContext as eI, type ApplicationLifecycleEventData as eJ, type EnhancedErrorEventData as eK, type MethodCalledEventData as eL, buildApplicationLifecycleEvent as eM, buildErrorEventWithContext as eN, buildErrorEvent as eO, createBaseEvent as eP, buildMethodCalledEvent as eQ, type BaseEvent as eR, type MethodCalledEvent as eS, generateEventId as eT, getCurrentTimestamp as eU, getReleaseId as eV, getOsInfo as eW, getPlatformVersions as eX, isCi as eY, getCiPlatform as eZ, getMemoryUsage as e_, parseConcurrencyEnvVar as ea, ZAPIER_MAX_CONCURRENT_REQUESTS as eb, getZapierApprovalMode as ec, getZapierDefaultApprovalMode as ed, DEFAULT_APPROVAL_TIMEOUT_MS as ee, DEFAULT_MAX_APPROVAL_RETRIES as ef, listTablesPlugin as eg, type ListTablesPluginProvides as eh, getTablePlugin as ei, type GetTablePluginProvides as ej, createTablePlugin as ek, type CreateTablePluginProvides as el, deleteTablePlugin as em, type DeleteTablePluginProvides as en, listTableFieldsPlugin as eo, type ListTableFieldsPluginProvides as ep, createTableFieldsPlugin as eq, type CreateTableFieldsPluginProvides as er, deleteTableFieldsPlugin as es, type DeleteTableFieldsPluginProvides as et, getTableRecordPlugin as eu, type GetTableRecordPluginProvides as ev, listTableRecordsPlugin as ew, type ListTableRecordsPluginProvides as ex, createTableRecordsPlugin as ey, type CreateTableRecordsPluginProvides as ez, type ActionEntry as f, createZapierSdk as f0, createZapierSdkStack as f1, type ZapierSdk as f2, findManifestEntry as g, type CapabilitiesContext as h, type PaginatedSdkResult as i, type PositionalMetadata as j, type ZapierFetchInitOptions as k, type DynamicResolver as l, type ActionProxy as m, type ZapierSdkApps as n, type WithAddPlugin as o, ZapierAbortDrainSignal as p, ZapierReleaseTriggerMessageSignal as q, readManifestFromFile as r, type DrainTriggerInboxCallback as s, type DrainTriggerInboxErrorObserver as t, type ListAuthenticationsPluginProvides as u, type FindFirstAuthenticationPluginProvides as v, type FindUniqueAuthenticationPluginProvides as w, type Action as x, type App as y, type Field as z };
package/dist/index.cjs CHANGED
@@ -1430,10 +1430,10 @@ TriggerInboxCommandBaseSchema.extend({
1430
1430
  );
1431
1431
  TriggerInboxCommandBaseSchema.extend({
1432
1432
  maxDrainIntervalSeconds: zod.z.number().int().min(1).optional().describe(
1433
- "Maximum seconds between empty-inbox poll attempts (default: 60). Caps the back-off cadence."
1433
+ "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."
1434
1434
  )
1435
1435
  }).describe(
1436
- "Continuously consume a trigger inbox: drain currently-available messages, then poll with backoff for new arrivals, until aborted. Stop via the `signal` AbortSignal or by throwing `ZapierAbortDrainSignal` from a handler. Resolves cleanly on abort; rejects on a fatal error or a fail-fast handler error."
1436
+ "Continuously consume a trigger inbox: drain currently-available messages, then subscribe to SSE notifications for new arrivals, until aborted. Stop via the `signal` AbortSignal or by throwing `ZapierAbortDrainSignal` from a handler. Resolves cleanly on abort; rejects on a fatal error or a fail-fast handler error."
1437
1437
  );
1438
1438
  var ActionExecutionInputSchema = zod.z.object({
1439
1439
  inputs: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
@@ -6717,8 +6717,55 @@ async function invalidateCredentialsToken(options) {
6717
6717
  }
6718
6718
  }
6719
6719
 
6720
+ // src/api/sse-parser.ts
6721
+ function createSseParserStream() {
6722
+ let buffer = "";
6723
+ let data = "";
6724
+ let hasData = false;
6725
+ function processLine(line, controller) {
6726
+ if (line === "") {
6727
+ if (hasData) {
6728
+ controller.enqueue({
6729
+ data: data.endsWith("\n") ? data.slice(0, -1) : data
6730
+ });
6731
+ }
6732
+ data = "";
6733
+ hasData = false;
6734
+ return;
6735
+ }
6736
+ if (line.startsWith(":")) return;
6737
+ const colon = line.indexOf(":");
6738
+ const field = colon === -1 ? line : line.slice(0, colon);
6739
+ let value = colon === -1 ? "" : line.slice(colon + 1);
6740
+ if (value.startsWith(" ")) value = value.slice(1);
6741
+ if (field === "data") {
6742
+ data += value + "\n";
6743
+ hasData = true;
6744
+ }
6745
+ }
6746
+ return new TransformStream({
6747
+ transform(chunk, controller) {
6748
+ buffer += chunk;
6749
+ const newline = /\r\n|\r|\n/g;
6750
+ let start = 0;
6751
+ let match;
6752
+ while ((match = newline.exec(buffer)) !== null) {
6753
+ if (match[0] === "\r" && match.index === buffer.length - 1) break;
6754
+ processLine(buffer.slice(start, match.index), controller);
6755
+ start = match.index + match[0].length;
6756
+ }
6757
+ buffer = buffer.slice(start);
6758
+ },
6759
+ flush(controller) {
6760
+ if (buffer.endsWith("\r")) {
6761
+ processLine(buffer.slice(0, -1), controller);
6762
+ }
6763
+ }
6764
+ });
6765
+ }
6766
+
6720
6767
  // src/sdk-version.ts
6721
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.68.0" : void 0) || "unknown";
6768
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.69.0" : void 0) || "unknown";
6722
6769
 
6723
6770
  // src/utils/open-url.ts
6724
6771
  var nodePrefix = "node:";
@@ -7081,6 +7128,18 @@ var ZapierApiClient = class {
7081
7128
  { status: "max_retries_exceeded" }
7082
7129
  );
7083
7130
  };
7131
+ /**
7132
+ * Streaming counterpart to `fetch`. Opens a Server-Sent Events connection
7133
+ * through the same pipeline (auth, base URL, 429 retry, approval flow,
7134
+ * concurrency) and yields parsed `{ data }` frames. On a non-ok response it
7135
+ * throws the same `ZapierError` subclasses as the JSON path — callers
7136
+ * classify errors off `statusCode` instead of hand-rolling the mapping.
7137
+ *
7138
+ * The concurrency permit is released when the underlying `fetch` resolves
7139
+ * (headers received), not when the body finishes, so a long-lived stream
7140
+ * never pins a slot — see `withSemaphore`.
7141
+ */
7142
+ this.fetchStream = (path, init) => this.streamSse(path, init);
7084
7143
  this.get = async (path, options = {}) => {
7085
7144
  return this.fetchJson("GET", path, void 0, options);
7086
7145
  };
@@ -7155,17 +7214,30 @@ var ZapierApiClient = class {
7155
7214
  }
7156
7215
  // Helper to handle responses
7157
7216
  async handleResponse(params) {
7217
+ const { data: responseData } = await this.parseResult(
7218
+ params.response
7219
+ );
7220
+ if (params.response.ok) {
7221
+ return responseData;
7222
+ }
7223
+ return this.throwForErrorResponse({ ...params, responseData });
7224
+ }
7225
+ /**
7226
+ * Maps a non-ok response to the appropriate ZapierError subclass and throws.
7227
+ * Takes the already-parsed body so a streaming caller (`fetchStream`) gets
7228
+ * the exact same status→error classification as the JSON path without
7229
+ * re-reading — or reading on the success path, which would consume the
7230
+ * stream — the response body.
7231
+ */
7232
+ async throwForErrorResponse(params) {
7158
7233
  const {
7159
7234
  response,
7235
+ responseData,
7160
7236
  customErrorHandler,
7161
7237
  resource,
7162
7238
  wasMissingAuthToken,
7163
7239
  requiredScopes
7164
7240
  } = params;
7165
- const { data: responseData } = await this.parseResult(response);
7166
- if (response.ok) {
7167
- return responseData;
7168
- }
7169
7241
  const errorInfo = {
7170
7242
  status: response.status,
7171
7243
  statusText: response.statusText,
@@ -7402,6 +7474,58 @@ var ZapierApiClient = class {
7402
7474
  }
7403
7475
  return result;
7404
7476
  }
7477
+ // The generator body for `fetchStream`. Kept as a prototype method (not an
7478
+ // arrow class field, which can't be a generator) and exposed through the
7479
+ // bound `fetchStream` arrow above for parity with the other client methods.
7480
+ async *streamSse(path, init) {
7481
+ const { onOpen, headers: initHeaders, ...fetchInit } = init ?? {};
7482
+ const signal = fetchInit.signal;
7483
+ if (signal?.aborted) return;
7484
+ const wasMissingAuthToken = fetchInit.authRequired === true && await this.getAuthToken({
7485
+ requiredScopes: fetchInit.requiredScopes
7486
+ }) == null;
7487
+ const headers = new Headers(initHeaders);
7488
+ if (!headers.has("Accept")) headers.set("Accept", "text/event-stream");
7489
+ let response;
7490
+ try {
7491
+ response = await this.fetch(path, {
7492
+ ...fetchInit,
7493
+ method: fetchInit.method ?? "GET",
7494
+ headers
7495
+ });
7496
+ } catch (err) {
7497
+ if (signal?.aborted || isAbortError(err)) return;
7498
+ throw err;
7499
+ }
7500
+ if (!response.ok) {
7501
+ const { data } = await this.parseResult(response);
7502
+ await this.throwForErrorResponse({
7503
+ response,
7504
+ responseData: data,
7505
+ wasMissingAuthToken,
7506
+ requiredScopes: fetchInit.requiredScopes
7507
+ });
7508
+ }
7509
+ if (!response.body) return;
7510
+ const reader = response.body.pipeThrough(new TextDecoderStream()).pipeThrough(createSseParserStream()).getReader();
7511
+ const onAbort = () => {
7512
+ reader.cancel().catch(() => {
7513
+ });
7514
+ };
7515
+ try {
7516
+ onOpen?.();
7517
+ signal?.addEventListener("abort", onAbort, { once: true });
7518
+ while (!signal?.aborted) {
7519
+ const { done, value } = await reader.read();
7520
+ if (done || signal?.aborted) return;
7521
+ yield value;
7522
+ }
7523
+ } finally {
7524
+ signal?.removeEventListener("abort", onAbort);
7525
+ await reader.cancel().catch(() => {
7526
+ });
7527
+ }
7528
+ }
7405
7529
  /**
7406
7530
  * Run a single approval round: create the approval, open the URL (poll mode)
7407
7531
  * or throw (throw mode), poll until resolved, and emit events. Throws on
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { x as Action, f as ActionEntry, c9 as ActionExecutionOptions, I as ActionExecutionResult, J as ActionField, K as ActionFieldChoice, aN as ActionItem, bn as ActionKeyProperty, aX as ActionKeyPropertySchema, bo as ActionProperty, aY as ActionPropertySchema, aE as ActionResolverItem, bz as ActionTimeoutMsProperty, b7 as ActionTimeoutMsPropertySchema, aF as ActionTypeItem, bm as ActionTypeProperty, aW as ActionTypePropertySchema, d as AddActionEntryOptions, e as AddActionEntryResult, A as ApiClient, c5 as ApiError, dz as ApiEvent, cT as ApiPluginOptions, cV as ApiPluginProvides, y as App, ca as AppFactoryInput, aL as AppItem, bk as AppKeyProperty, aU as AppKeyPropertySchema, bl as AppProperty, aV as AppPropertySchema, eI as ApplicationLifecycleEventData, c1 as ApprovalStatus, c8 as AppsPluginProvides, bE as AppsProperty, bc as AppsPropertySchema, a5 as ArrayResolver, dy as AuthEvent, bs as AuthenticationIdProperty, a$ as AuthenticationIdPropertySchema, eQ as BaseEvent, as as BaseSdkOptionsSchema, ag as BatchOptions, cG as CONTEXT_CACHE_MAX_SIZE, cF as CONTEXT_CACHE_TTL_MS, aw as CORE_ERROR_SYMBOL, H as Choice, dF as ClientCredentialsObject, dQ as ClientCredentialsObjectSchema, V as Connection, dY as ConnectionEntry, dX as ConnectionEntrySchema, bq as ConnectionIdProperty, a_ as ConnectionIdPropertySchema, aM as ConnectionItem, br as ConnectionProperty, b0 as ConnectionPropertySchema, d_ as ConnectionsMap, dZ as ConnectionsMapSchema, e0 as ConnectionsPluginProvides, bG as ConnectionsProperty, be as ConnectionsPropertySchema, X as ConnectionsResponse, ax as CoreErrorCode, cs as CreateClientCredentialsPluginProvides, eq as CreateTableFieldsPluginProvides, ek as CreateTablePluginProvides, ey as CreateTableRecordsPluginProvides, dC as Credentials, dV as CredentialsFunction, dU as CredentialsFunctionSchema, dE as CredentialsObject, dS as CredentialsObjectSchema, dW as CredentialsSchema, e5 as DEFAULT_ACTION_TIMEOUT_MS, ed as DEFAULT_APPROVAL_TIMEOUT_MS, cP as DEFAULT_CONFIG_PATH, ee as DEFAULT_MAX_APPROVAL_RETRIES, e4 as DEFAULT_PAGE_SIZE, bx as DebugProperty, b5 as DebugPropertySchema, cu as DeleteClientCredentialsPluginProvides, es as DeleteTableFieldsPluginProvides, em as DeleteTablePluginProvides, eA as DeleteTableRecordsPluginProvides, s as DrainTriggerInboxCallback, t as DrainTriggerInboxErrorObserver, D as DrainTriggerInboxOptions, a8 as DynamicListResolver, l as DynamicResolver, a9 as DynamicSearchResolver, eJ as EnhancedErrorEventData, bM as ErrorOptions, dB as EventCallback, eH as EventContext, eE as EventEmissionConfig, E as EventEmissionContext, eG as EventEmissionProvides, cc as FetchPluginProvides, z as Field, bD as FieldsProperty, bb as FieldsPropertySchema, aa as FieldsResolver, F as FieldsetItem, v as FindFirstAuthenticationPluginProvides, cC as FindFirstConnectionPluginProvides, w as FindUniqueAuthenticationPluginProvides, cE as FindUniqueConnectionPluginProvides, a3 as FormattedItem, ar as FunctionDeprecation, aq as FunctionRegistryEntry, cm as GetActionInputFieldsSchemaPluginProvides, cy as GetActionPluginProvides, cw as GetAppPluginProvides, G as GetAuthenticationPluginProvides, cA as GetConnectionPluginProvides, cS as GetProfilePluginProvides, ei as GetTablePluginProvides, eu as GetTableRecordPluginProvides, aP as InfoFieldItem, aO as InputFieldItem, bp as InputFieldProperty, aZ as InputFieldPropertySchema, bt as InputsProperty, b1 as InputsPropertySchema, bL as LeaseLimitProperty, bj as LeaseLimitPropertySchema, bJ as LeaseProperty, bh as LeasePropertySchema, bK as LeaseSecondsProperty, bi as LeaseSecondsPropertySchema, L as LeasedTriggerMessageItem, bu as LimitProperty, b2 as LimitPropertySchema, ck as ListActionInputFieldChoicesPluginProvides, ci as ListActionInputFieldsPluginProvides, cg as ListActionsPluginProvides, ce as ListAppsPluginProvides, u as ListAuthenticationsPluginProvides, cq as ListClientCredentialsPluginProvides, co as ListConnectionsPluginProvides, eo as ListTableFieldsPluginProvides, ew as ListTableRecordsPluginProvides, eg as ListTablesPluginProvides, dA as LoadingEvent, e8 as MAX_CONCURRENCY_LIMIT, e3 as MAX_PAGE_LIMIT, b as Manifest, cQ as ManifestEntry, cL as ManifestPluginOptions, cO as ManifestPluginProvides, eR as MethodCalledEvent, eK as MethodCalledEventData, N as Need, Q as NeedsRequest, S as NeedsResponse, bv as OffsetProperty, b3 as OffsetPropertySchema, O as OutputFormatter, bw as OutputProperty, b4 as OutputPropertySchema, aT as PaginatedSdkFunction, i as PaginatedSdkResult, by as ParamsProperty, b6 as ParamsPropertySchema, dG as PkceCredentialsObject, dR as PkceCredentialsObjectSchema, ay as Plugin, a as PluginMeta, az as PluginProvides, aI as PollOptions, j as PositionalMetadata, b$ as RateLimitInfo, bB as RecordProperty, b9 as RecordPropertySchema, bC as RecordsProperty, ba as RecordsPropertySchema, al as RelayFetchSchema, ak as RelayRequestSchema, aH as RequestOptions, cK as RequestPluginProvides, dk as ResolveAuthTokenOptions, dL as ResolveCredentialsOptions, R as ResolvedAppLocator, dD as ResolvedCredentials, dT as ResolvedCredentialsSchema, a4 as Resolver, a6 as ResolverMetadata, aQ as RootFieldItem, cI as RunActionPluginProvides, dx as SdkEvent, aS as SdkPage, a7 as StaticResolver, bA as TableProperty, b8 as TablePropertySchema, bF as TablesProperty, bd as TablesPropertySchema, bI as TriggerInboxNameProperty, bg as TriggerInboxNamePropertySchema, bH as TriggerInboxProperty, bf as TriggerInboxPropertySchema, T as TriggerMessageStatus, U as UpdateManifestEntryOptions, c as UpdateManifestEntryResult, eC as UpdateTableRecordsPluginProvides, Y as UserProfile, aR as UserProfileItem, W as WatchTriggerInboxOptions, o as WithAddPlugin, e1 as ZAPIER_BASE_URL, ea as ZAPIER_MAX_CONCURRENT_REQUESTS, e6 as ZAPIER_MAX_NETWORK_RETRIES, e7 as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, p as ZapierAbortDrainSignal, bZ as ZapierActionError, bS as ZapierApiError, bT as ZapierAppNotFoundError, c2 as ZapierApprovalError, bQ as ZapierAuthenticationError, bX as ZapierBundleError, dt as ZapierCache, du as ZapierCacheEntry, dv as ZapierCacheSetOptions, bW as ZapierConfigurationError, b_ as ZapierConflictError, bN as ZapierError, k as ZapierFetchInitOptions, bU as ZapierNotFoundError, c0 as ZapierRateLimitError, c3 as ZapierRelayError, q as ZapierReleaseTriggerMessageSignal, bV as ZapierResourceNotFoundError, f1 as ZapierSdk, n as ZapierSdkApps, Z as ZapierSdkOptions, c6 as ZapierSignal, bY as ZapierTimeoutError, bP as ZapierUnknownError, bO as ZapierValidationError, cY as actionKeyResolver, cX as actionTypeResolver, a2 as addPlugin, cU as apiPlugin, cW as appKeyResolver, c7 as appsPlugin, c_ as authenticationIdGenericResolver, cZ as authenticationIdResolver, af as batch, eL as buildApplicationLifecycleEvent, ah as buildCapabilityMessage, eN as buildErrorEvent, eM as buildErrorEventWithContext, eP as buildMethodCalledEvent, eD as cleanupEventListeners, dl as clearTokenCache, d2 as clientCredentialsNameResolver, d3 as clientIdResolver, aD as composePlugins, c_ as connectionIdGenericResolver, cZ as connectionIdResolver, d$ as connectionsPlugin, eO as createBaseEvent, cr as createClientCredentialsPlugin, a1 as createCorePlugin, $ as createFunction, dw as createMemoryCache, ao as createOptionsPlugin, aC as createPaginatedPluginMethod, aB as createPluginMethod, a0 as createPluginStack, an as createSdk, ep as createTableFieldsPlugin, ej as createTablePlugin, ex as createTableRecordsPlugin, aJ as createZapierApi, ap as createZapierCoreStack, e$ as createZapierSdk, f0 as createZapierSdkStack, am as createZapierSdkWithoutRegistry, aA as definePlugin, ct as deleteClientCredentialsPlugin, er as deleteTableFieldsPlugin, el as deleteTablePlugin, ez as deleteTableRecordsPlugin, d7 as durableRunIdResolver, eF as eventEmissionPlugin, cb as fetchPlugin, cB as findFirstConnectionPlugin, g as findManifestEntry, cD as findUniqueConnectionPlugin, c4 as formatErrorMessage, eS as generateEventId, cl as getActionInputFieldsSchemaPlugin, cx as getActionPlugin, cv as getAppPlugin, dO as getBaseUrlFromCredentials, eY as getCiPlatform, dP as getClientIdFromCredentials, cz as getConnectionPlugin, av as getCoreErrorCause, au as getCoreErrorCode, e_ as getCpuTime, eT as getCurrentTimestamp, eZ as getMemoryUsage, aK as getOrCreateApiClient, eV as getOsInfo, eW as getPlatformVersions, cM as getPreferredManifestEntryKey, cR as getProfilePlugin, eU as getReleaseId, eh as getTablePlugin, et as getTableRecordPlugin, dq as getTokenFromCliLogin, eb as getZapierApprovalMode, ec as getZapierDefaultApprovalMode, e2 as getZapierSdkService, dn as injectCliLogin, d1 as inputFieldKeyResolver, d0 as inputsAllOptionalResolver, c$ as inputsResolver, dm as invalidateCachedToken, ds as invalidateCredentialsToken, eX as isCi, dp as isCliLoginAvailable, dH as isClientCredentials, at as isCoreError, dK as isCredentialsFunction, dJ as isCredentialsObject, dI as isPkceCredentials, _ as isPositional, cj as listActionInputFieldChoicesPlugin, ch as listActionInputFieldsPlugin, cf as listActionsPlugin, cd as listAppsPlugin, cp as listClientCredentialsPlugin, cn as listConnectionsPlugin, en as listTableFieldsPlugin, ev as listTableRecordsPlugin, ef as listTablesPlugin, ai as logDeprecation, cN as manifestPlugin, e9 as parseConcurrencyEnvVar, r as readManifestFromFile, aG as registryPlugin, cJ as requestPlugin, aj as resetDeprecationWarnings, dr as resolveAuthToken, dN as resolveCredentials, dM as resolveCredentialsFromEnv, cH as runActionPlugin, ab as runInMethodScope, ac as runWithTelemetryContext, dd as tableFieldIdsResolver, df as tableFieldsResolver, di as tableFiltersResolver, d4 as tableIdResolver, de as tableNameResolver, db as tableRecordIdResolver, dc as tableRecordIdsResolver, dg as tableRecordsResolver, dj as tableSortResolver, dh as tableUpdateRecordsResolver, ad as toSnakeCase, ae as toTitleCase, d5 as triggerInboxResolver, da as triggerMessagesResolver, eB as updateTableRecordsPlugin, d6 as workflowIdResolver, d9 as workflowRunIdResolver, d8 as workflowVersionIdResolver, bR as zapierAdaptError } from './index-oRnHsPn5.mjs';
1
+ export { x as Action, f as ActionEntry, ca as ActionExecutionOptions, I as ActionExecutionResult, J as ActionField, K as ActionFieldChoice, aO as ActionItem, bo as ActionKeyProperty, aY as ActionKeyPropertySchema, bp as ActionProperty, aZ as ActionPropertySchema, aE as ActionResolverItem, bA as ActionTimeoutMsProperty, b8 as ActionTimeoutMsPropertySchema, aF as ActionTypeItem, bn as ActionTypeProperty, aX as ActionTypePropertySchema, d as AddActionEntryOptions, e as AddActionEntryResult, A as ApiClient, c6 as ApiError, dA as ApiEvent, cU as ApiPluginOptions, cW as ApiPluginProvides, y as App, cb as AppFactoryInput, aM as AppItem, bl as AppKeyProperty, aV as AppKeyPropertySchema, bm as AppProperty, aW as AppPropertySchema, eJ as ApplicationLifecycleEventData, c2 as ApprovalStatus, c9 as AppsPluginProvides, bF as AppsProperty, bd as AppsPropertySchema, a5 as ArrayResolver, dz as AuthEvent, bt as AuthenticationIdProperty, b0 as AuthenticationIdPropertySchema, eR as BaseEvent, as as BaseSdkOptionsSchema, ag as BatchOptions, cH as CONTEXT_CACHE_MAX_SIZE, cG as CONTEXT_CACHE_TTL_MS, aw as CORE_ERROR_SYMBOL, H as Choice, dG as ClientCredentialsObject, dR as ClientCredentialsObjectSchema, V as Connection, dZ as ConnectionEntry, dY as ConnectionEntrySchema, br as ConnectionIdProperty, a$ as ConnectionIdPropertySchema, aN as ConnectionItem, bs as ConnectionProperty, b1 as ConnectionPropertySchema, d$ as ConnectionsMap, d_ as ConnectionsMapSchema, e1 as ConnectionsPluginProvides, bH as ConnectionsProperty, bf as ConnectionsPropertySchema, X as ConnectionsResponse, ax as CoreErrorCode, ct as CreateClientCredentialsPluginProvides, er as CreateTableFieldsPluginProvides, el as CreateTablePluginProvides, ez as CreateTableRecordsPluginProvides, dD as Credentials, dW as CredentialsFunction, dV as CredentialsFunctionSchema, dF as CredentialsObject, dT as CredentialsObjectSchema, dX as CredentialsSchema, e6 as DEFAULT_ACTION_TIMEOUT_MS, ee as DEFAULT_APPROVAL_TIMEOUT_MS, cQ as DEFAULT_CONFIG_PATH, ef as DEFAULT_MAX_APPROVAL_RETRIES, e5 as DEFAULT_PAGE_SIZE, by as DebugProperty, b6 as DebugPropertySchema, cv as DeleteClientCredentialsPluginProvides, et as DeleteTableFieldsPluginProvides, en as DeleteTablePluginProvides, eB as DeleteTableRecordsPluginProvides, s as DrainTriggerInboxCallback, t as DrainTriggerInboxErrorObserver, D as DrainTriggerInboxOptions, a8 as DynamicListResolver, l as DynamicResolver, a9 as DynamicSearchResolver, eK as EnhancedErrorEventData, bN as ErrorOptions, dC as EventCallback, eI as EventContext, eF as EventEmissionConfig, E as EventEmissionContext, eH as EventEmissionProvides, cd as FetchPluginProvides, z as Field, bE as FieldsProperty, bc as FieldsPropertySchema, aa as FieldsResolver, F as FieldsetItem, v as FindFirstAuthenticationPluginProvides, cD as FindFirstConnectionPluginProvides, w as FindUniqueAuthenticationPluginProvides, cF as FindUniqueConnectionPluginProvides, a3 as FormattedItem, ar as FunctionDeprecation, aq as FunctionRegistryEntry, cn as GetActionInputFieldsSchemaPluginProvides, cz as GetActionPluginProvides, cx as GetAppPluginProvides, G as GetAuthenticationPluginProvides, cB as GetConnectionPluginProvides, cT as GetProfilePluginProvides, ej as GetTablePluginProvides, ev as GetTableRecordPluginProvides, aQ as InfoFieldItem, aP as InputFieldItem, bq as InputFieldProperty, a_ as InputFieldPropertySchema, bu as InputsProperty, b2 as InputsPropertySchema, bM as LeaseLimitProperty, bk as LeaseLimitPropertySchema, bK as LeaseProperty, bi as LeasePropertySchema, bL as LeaseSecondsProperty, bj as LeaseSecondsPropertySchema, L as LeasedTriggerMessageItem, bv as LimitProperty, b3 as LimitPropertySchema, cl as ListActionInputFieldChoicesPluginProvides, cj as ListActionInputFieldsPluginProvides, ch as ListActionsPluginProvides, cf as ListAppsPluginProvides, u as ListAuthenticationsPluginProvides, cr as ListClientCredentialsPluginProvides, cp as ListConnectionsPluginProvides, ep as ListTableFieldsPluginProvides, ex as ListTableRecordsPluginProvides, eh as ListTablesPluginProvides, dB as LoadingEvent, e9 as MAX_CONCURRENCY_LIMIT, e4 as MAX_PAGE_LIMIT, b as Manifest, cR as ManifestEntry, cM as ManifestPluginOptions, cP as ManifestPluginProvides, eS as MethodCalledEvent, eL as MethodCalledEventData, N as Need, Q as NeedsRequest, S as NeedsResponse, bw as OffsetProperty, b4 as OffsetPropertySchema, O as OutputFormatter, bx as OutputProperty, b5 as OutputPropertySchema, aU as PaginatedSdkFunction, i as PaginatedSdkResult, bz as ParamsProperty, b7 as ParamsPropertySchema, dH as PkceCredentialsObject, dS as PkceCredentialsObjectSchema, ay as Plugin, a as PluginMeta, az as PluginProvides, aI as PollOptions, j as PositionalMetadata, c0 as RateLimitInfo, bC as RecordProperty, ba as RecordPropertySchema, bD as RecordsProperty, bb as RecordsPropertySchema, al as RelayFetchSchema, ak as RelayRequestSchema, aH as RequestOptions, cL as RequestPluginProvides, dl as ResolveAuthTokenOptions, dM as ResolveCredentialsOptions, R as ResolvedAppLocator, dE as ResolvedCredentials, dU as ResolvedCredentialsSchema, a4 as Resolver, a6 as ResolverMetadata, aR as RootFieldItem, cJ as RunActionPluginProvides, dy as SdkEvent, aT as SdkPage, aL as SseMessage, a7 as StaticResolver, bB as TableProperty, b9 as TablePropertySchema, bG as TablesProperty, be as TablesPropertySchema, bJ as TriggerInboxNameProperty, bh as TriggerInboxNamePropertySchema, bI as TriggerInboxProperty, bg as TriggerInboxPropertySchema, T as TriggerMessageStatus, U as UpdateManifestEntryOptions, c as UpdateManifestEntryResult, eD as UpdateTableRecordsPluginProvides, Y as UserProfile, aS as UserProfileItem, W as WatchTriggerInboxOptions, o as WithAddPlugin, e2 as ZAPIER_BASE_URL, eb as ZAPIER_MAX_CONCURRENT_REQUESTS, e7 as ZAPIER_MAX_NETWORK_RETRIES, e8 as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, p as ZapierAbortDrainSignal, b_ as ZapierActionError, bT as ZapierApiError, bU as ZapierAppNotFoundError, c3 as ZapierApprovalError, bR as ZapierAuthenticationError, bY as ZapierBundleError, du as ZapierCache, dv as ZapierCacheEntry, dw as ZapierCacheSetOptions, bX as ZapierConfigurationError, b$ as ZapierConflictError, bO as ZapierError, k as ZapierFetchInitOptions, bV as ZapierNotFoundError, c1 as ZapierRateLimitError, c4 as ZapierRelayError, q as ZapierReleaseTriggerMessageSignal, bW as ZapierResourceNotFoundError, f2 as ZapierSdk, n as ZapierSdkApps, Z as ZapierSdkOptions, c7 as ZapierSignal, bZ as ZapierTimeoutError, bQ as ZapierUnknownError, bP as ZapierValidationError, cZ as actionKeyResolver, cY as actionTypeResolver, a2 as addPlugin, cV as apiPlugin, cX as appKeyResolver, c8 as appsPlugin, c$ as authenticationIdGenericResolver, c_ as authenticationIdResolver, af as batch, eM as buildApplicationLifecycleEvent, ah as buildCapabilityMessage, eO as buildErrorEvent, eN as buildErrorEventWithContext, eQ as buildMethodCalledEvent, eE as cleanupEventListeners, dm as clearTokenCache, d3 as clientCredentialsNameResolver, d4 as clientIdResolver, aD as composePlugins, c$ as connectionIdGenericResolver, c_ as connectionIdResolver, e0 as connectionsPlugin, eP as createBaseEvent, cs as createClientCredentialsPlugin, a1 as createCorePlugin, $ as createFunction, dx as createMemoryCache, ao as createOptionsPlugin, aC as createPaginatedPluginMethod, aB as createPluginMethod, a0 as createPluginStack, an as createSdk, eq as createTableFieldsPlugin, ek as createTablePlugin, ey as createTableRecordsPlugin, aJ as createZapierApi, ap as createZapierCoreStack, f0 as createZapierSdk, f1 as createZapierSdkStack, am as createZapierSdkWithoutRegistry, aA as definePlugin, cu as deleteClientCredentialsPlugin, es as deleteTableFieldsPlugin, em as deleteTablePlugin, eA as deleteTableRecordsPlugin, d8 as durableRunIdResolver, eG as eventEmissionPlugin, cc as fetchPlugin, cC as findFirstConnectionPlugin, g as findManifestEntry, cE as findUniqueConnectionPlugin, c5 as formatErrorMessage, eT as generateEventId, cm as getActionInputFieldsSchemaPlugin, cy as getActionPlugin, cw as getAppPlugin, dP as getBaseUrlFromCredentials, eZ as getCiPlatform, dQ as getClientIdFromCredentials, cA as getConnectionPlugin, av as getCoreErrorCause, au as getCoreErrorCode, e$ as getCpuTime, eU as getCurrentTimestamp, e_ as getMemoryUsage, aK as getOrCreateApiClient, eW as getOsInfo, eX as getPlatformVersions, cN as getPreferredManifestEntryKey, cS as getProfilePlugin, eV as getReleaseId, ei as getTablePlugin, eu as getTableRecordPlugin, dr as getTokenFromCliLogin, ec as getZapierApprovalMode, ed as getZapierDefaultApprovalMode, e3 as getZapierSdkService, dp as injectCliLogin, d2 as inputFieldKeyResolver, d1 as inputsAllOptionalResolver, d0 as inputsResolver, dn as invalidateCachedToken, dt as invalidateCredentialsToken, eY as isCi, dq as isCliLoginAvailable, dI as isClientCredentials, at as isCoreError, dL as isCredentialsFunction, dK as isCredentialsObject, dJ as isPkceCredentials, _ as isPositional, ck as listActionInputFieldChoicesPlugin, ci as listActionInputFieldsPlugin, cg as listActionsPlugin, ce as listAppsPlugin, cq as listClientCredentialsPlugin, co as listConnectionsPlugin, eo as listTableFieldsPlugin, ew as listTableRecordsPlugin, eg as listTablesPlugin, ai as logDeprecation, cO as manifestPlugin, ea as parseConcurrencyEnvVar, r as readManifestFromFile, aG as registryPlugin, cK as requestPlugin, aj as resetDeprecationWarnings, ds as resolveAuthToken, dO as resolveCredentials, dN as resolveCredentialsFromEnv, cI as runActionPlugin, ab as runInMethodScope, ac as runWithTelemetryContext, de as tableFieldIdsResolver, dg as tableFieldsResolver, dj as tableFiltersResolver, d5 as tableIdResolver, df as tableNameResolver, dc as tableRecordIdResolver, dd as tableRecordIdsResolver, dh as tableRecordsResolver, dk as tableSortResolver, di as tableUpdateRecordsResolver, ad as toSnakeCase, ae as toTitleCase, d6 as triggerInboxResolver, db as triggerMessagesResolver, eC as updateTableRecordsPlugin, d7 as workflowIdResolver, da as workflowRunIdResolver, d9 as workflowVersionIdResolver, bS as zapierAdaptError } from './index-DC31DAP2.mjs';
2
2
  import 'zod';
3
3
  import 'zod/v4/core';
4
4
  import '@zapier/zapier-sdk-core/v0/schemas/connections';
package/dist/index.d.ts CHANGED
@@ -72,6 +72,7 @@ export type { ResolvedAppLocator } from "./utils/domain-utils";
72
72
  export { registryPlugin } from "./plugins/registry";
73
73
  export type { ApiClient, RequestOptions, PollOptions } from "./api/types";
74
74
  export { createZapierApi, getOrCreateApiClient } from "./api";
75
+ export type { SseMessage } from "./api";
75
76
  export type { ZapierSdk } from "./sdk";
76
77
  export * from "./plugins/eventEmission";
77
78
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,c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AAoB,EAAE,MAAM,aAAa,CAAC;AASnD,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,MAAM,EACN,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,2BAA2B,EAC3B,cAAc,GACf,MAAM,SAAS,CAAC;AAKjB,YAAY,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC9D,YAAY,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGxC,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,cAAc,yBAAyB,CAAC"}
package/dist/index.mjs CHANGED
@@ -1428,10 +1428,10 @@ TriggerInboxCommandBaseSchema.extend({
1428
1428
  );
1429
1429
  TriggerInboxCommandBaseSchema.extend({
1430
1430
  maxDrainIntervalSeconds: z.number().int().min(1).optional().describe(
1431
- "Maximum seconds between empty-inbox poll attempts (default: 60). Caps the back-off cadence."
1431
+ "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."
1432
1432
  )
1433
1433
  }).describe(
1434
- "Continuously consume a trigger inbox: drain currently-available messages, then poll with backoff for new arrivals, until aborted. Stop via the `signal` AbortSignal or by throwing `ZapierAbortDrainSignal` from a handler. Resolves cleanly on abort; rejects on a fatal error or a fail-fast handler error."
1434
+ "Continuously consume a trigger inbox: drain currently-available messages, then subscribe to SSE notifications for new arrivals, until aborted. Stop via the `signal` AbortSignal or by throwing `ZapierAbortDrainSignal` from a handler. Resolves cleanly on abort; rejects on a fatal error or a fail-fast handler error."
1435
1435
  );
1436
1436
  var ActionExecutionInputSchema = z.object({
1437
1437
  inputs: z.record(z.string(), z.unknown()).optional(),
@@ -6715,8 +6715,55 @@ async function invalidateCredentialsToken(options) {
6715
6715
  }
6716
6716
  }
6717
6717
 
6718
+ // src/api/sse-parser.ts
6719
+ function createSseParserStream() {
6720
+ let buffer = "";
6721
+ let data = "";
6722
+ let hasData = false;
6723
+ function processLine(line, controller) {
6724
+ if (line === "") {
6725
+ if (hasData) {
6726
+ controller.enqueue({
6727
+ data: data.endsWith("\n") ? data.slice(0, -1) : data
6728
+ });
6729
+ }
6730
+ data = "";
6731
+ hasData = false;
6732
+ return;
6733
+ }
6734
+ if (line.startsWith(":")) return;
6735
+ const colon = line.indexOf(":");
6736
+ const field = colon === -1 ? line : line.slice(0, colon);
6737
+ let value = colon === -1 ? "" : line.slice(colon + 1);
6738
+ if (value.startsWith(" ")) value = value.slice(1);
6739
+ if (field === "data") {
6740
+ data += value + "\n";
6741
+ hasData = true;
6742
+ }
6743
+ }
6744
+ return new TransformStream({
6745
+ transform(chunk, controller) {
6746
+ buffer += chunk;
6747
+ const newline = /\r\n|\r|\n/g;
6748
+ let start = 0;
6749
+ let match;
6750
+ while ((match = newline.exec(buffer)) !== null) {
6751
+ if (match[0] === "\r" && match.index === buffer.length - 1) break;
6752
+ processLine(buffer.slice(start, match.index), controller);
6753
+ start = match.index + match[0].length;
6754
+ }
6755
+ buffer = buffer.slice(start);
6756
+ },
6757
+ flush(controller) {
6758
+ if (buffer.endsWith("\r")) {
6759
+ processLine(buffer.slice(0, -1), controller);
6760
+ }
6761
+ }
6762
+ });
6763
+ }
6764
+
6718
6765
  // src/sdk-version.ts
6719
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.68.0" : void 0) || "unknown";
6766
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.69.0" : void 0) || "unknown";
6720
6767
 
6721
6768
  // src/utils/open-url.ts
6722
6769
  var nodePrefix = "node:";
@@ -7079,6 +7126,18 @@ var ZapierApiClient = class {
7079
7126
  { status: "max_retries_exceeded" }
7080
7127
  );
7081
7128
  };
7129
+ /**
7130
+ * Streaming counterpart to `fetch`. Opens a Server-Sent Events connection
7131
+ * through the same pipeline (auth, base URL, 429 retry, approval flow,
7132
+ * concurrency) and yields parsed `{ data }` frames. On a non-ok response it
7133
+ * throws the same `ZapierError` subclasses as the JSON path — callers
7134
+ * classify errors off `statusCode` instead of hand-rolling the mapping.
7135
+ *
7136
+ * The concurrency permit is released when the underlying `fetch` resolves
7137
+ * (headers received), not when the body finishes, so a long-lived stream
7138
+ * never pins a slot — see `withSemaphore`.
7139
+ */
7140
+ this.fetchStream = (path, init) => this.streamSse(path, init);
7082
7141
  this.get = async (path, options = {}) => {
7083
7142
  return this.fetchJson("GET", path, void 0, options);
7084
7143
  };
@@ -7153,17 +7212,30 @@ var ZapierApiClient = class {
7153
7212
  }
7154
7213
  // Helper to handle responses
7155
7214
  async handleResponse(params) {
7215
+ const { data: responseData } = await this.parseResult(
7216
+ params.response
7217
+ );
7218
+ if (params.response.ok) {
7219
+ return responseData;
7220
+ }
7221
+ return this.throwForErrorResponse({ ...params, responseData });
7222
+ }
7223
+ /**
7224
+ * Maps a non-ok response to the appropriate ZapierError subclass and throws.
7225
+ * Takes the already-parsed body so a streaming caller (`fetchStream`) gets
7226
+ * the exact same status→error classification as the JSON path without
7227
+ * re-reading — or reading on the success path, which would consume the
7228
+ * stream — the response body.
7229
+ */
7230
+ async throwForErrorResponse(params) {
7156
7231
  const {
7157
7232
  response,
7233
+ responseData,
7158
7234
  customErrorHandler,
7159
7235
  resource,
7160
7236
  wasMissingAuthToken,
7161
7237
  requiredScopes
7162
7238
  } = params;
7163
- const { data: responseData } = await this.parseResult(response);
7164
- if (response.ok) {
7165
- return responseData;
7166
- }
7167
7239
  const errorInfo = {
7168
7240
  status: response.status,
7169
7241
  statusText: response.statusText,
@@ -7400,6 +7472,58 @@ var ZapierApiClient = class {
7400
7472
  }
7401
7473
  return result;
7402
7474
  }
7475
+ // The generator body for `fetchStream`. Kept as a prototype method (not an
7476
+ // arrow class field, which can't be a generator) and exposed through the
7477
+ // bound `fetchStream` arrow above for parity with the other client methods.
7478
+ async *streamSse(path, init) {
7479
+ const { onOpen, headers: initHeaders, ...fetchInit } = init ?? {};
7480
+ const signal = fetchInit.signal;
7481
+ if (signal?.aborted) return;
7482
+ const wasMissingAuthToken = fetchInit.authRequired === true && await this.getAuthToken({
7483
+ requiredScopes: fetchInit.requiredScopes
7484
+ }) == null;
7485
+ const headers = new Headers(initHeaders);
7486
+ if (!headers.has("Accept")) headers.set("Accept", "text/event-stream");
7487
+ let response;
7488
+ try {
7489
+ response = await this.fetch(path, {
7490
+ ...fetchInit,
7491
+ method: fetchInit.method ?? "GET",
7492
+ headers
7493
+ });
7494
+ } catch (err) {
7495
+ if (signal?.aborted || isAbortError(err)) return;
7496
+ throw err;
7497
+ }
7498
+ if (!response.ok) {
7499
+ const { data } = await this.parseResult(response);
7500
+ await this.throwForErrorResponse({
7501
+ response,
7502
+ responseData: data,
7503
+ wasMissingAuthToken,
7504
+ requiredScopes: fetchInit.requiredScopes
7505
+ });
7506
+ }
7507
+ if (!response.body) return;
7508
+ const reader = response.body.pipeThrough(new TextDecoderStream()).pipeThrough(createSseParserStream()).getReader();
7509
+ const onAbort = () => {
7510
+ reader.cancel().catch(() => {
7511
+ });
7512
+ };
7513
+ try {
7514
+ onOpen?.();
7515
+ signal?.addEventListener("abort", onAbort, { once: true });
7516
+ while (!signal?.aborted) {
7517
+ const { done, value } = await reader.read();
7518
+ if (done || signal?.aborted) return;
7519
+ yield value;
7520
+ }
7521
+ } finally {
7522
+ signal?.removeEventListener("abort", onAbort);
7523
+ await reader.cancel().catch(() => {
7524
+ });
7525
+ }
7526
+ }
7403
7527
  /**
7404
7528
  * Run a single approval round: create the approval, open the URL (poll mode)
7405
7529
  * or throw (throw mode), poll until resolved, and emit events. Throws on
@@ -98,5 +98,5 @@ export const WatchTriggerInboxSchema = TriggerInboxCommandBaseSchema.extend({
98
98
  .int()
99
99
  .min(1)
100
100
  .optional()
101
- .describe("Maximum seconds between empty-inbox poll attempts (default: 60). Caps the back-off cadence."),
102
- }).describe("Continuously consume a trigger inbox: drain currently-available messages, then poll with backoff for new arrivals, until aborted. Stop via the `signal` AbortSignal or by throwing `ZapierAbortDrainSignal` from a handler. Resolves cleanly on abort; rejects on a fatal error or a fail-fast handler error.");
101
+ .describe("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."),
102
+ }).describe("Continuously consume a trigger inbox: drain currently-available messages, then subscribe to SSE notifications for new arrivals, until aborted. Stop via the `signal` AbortSignal or by throwing `ZapierAbortDrainSignal` from a handler. Resolves cleanly on abort; rejects on a fatal error or a fail-fast handler error.");
@@ -1,16 +1,37 @@
1
1
  import { type WatchTriggerInboxOptions } from "../drainTriggerInbox/schemas";
2
+ import type { ApiClient } from "../../../api";
3
+ import type { BaseSdkOptions } from "../../../types/sdk";
4
+ export interface DrainLatch {
5
+ /** Ask for a drain. Coalesces: many requests during one drain → one drain. */
6
+ request(): void;
7
+ /** Resolve once a drain has been requested since the last consume. */
8
+ waitForRequest(): Promise<void>;
9
+ }
10
+ /**
11
+ * Coalescing wake latch between the drain producers (SSE connect, SSE frames,
12
+ * the safety timer, abort) and the single drain consumer. A `request()` that
13
+ * lands while the consumer is mid-drain is not lost: `pending` stays set, so
14
+ * the consumer's next `waitForRequest()` returns immediately and runs one more
15
+ * drain. Mirrors `createWaiter` in drainTriggerInbox/pipeline.ts.
16
+ *
17
+ * Exported for unit testing the coalescing / no-lost-wakeup semantics.
18
+ */
19
+ export declare function createDrainLatch(): DrainLatch;
2
20
  /**
3
21
  * `watchTriggerInbox` is the continuous-consumption variant of
4
22
  * `drainTriggerInbox`. Same options surface, same callback shape;
5
- * the difference is that an empty lease triggers poll-and-wait
6
- * (with backoff) rather than ending the command. Resolves cleanly
7
- * on `signal` abort or when a callback throws
8
- * `ZapierAbortDrainSignal`; rejects on a fatal error or a
9
- * fail-fast handler error (when `continueOnError` is false).
23
+ * the difference is that after draining the inbox, it subscribes to
24
+ * a Server-Sent Events stream to wake on new-message notifications
25
+ * rather than polling. A periodic safety drain fires every
26
+ * `maxDrainIntervalSeconds` seconds (default: 300) to guarantee
27
+ * forward progress if SSE events are missed or the connection drops
28
+ * undetected. Resolves cleanly on `signal` abort or when a callback
29
+ * throws `ZapierAbortDrainSignal`; rejects on a fatal error or a
30
+ * fail-fast handler error.
10
31
  */
11
32
  export declare const watchTriggerInboxPlugin: (sdk: {
12
33
  context: {
13
- api: import("../../..").ApiClient;
34
+ api: ApiClient;
14
35
  resolveCredentials: () => Promise<string | {
15
36
  clientId: string;
16
37
  clientSecret: string;
@@ -109,6 +130,10 @@ export declare const watchTriggerInboxPlugin: (sdk: {
109
130
  releaseTriggerInboxMessages: import("kitcore").PluginMeta<unknown>;
110
131
  };
111
132
  };
133
+ } & {
134
+ context: {
135
+ options: BaseSdkOptions;
136
+ };
112
137
  } & {
113
138
  context: {
114
139
  meta: Record<string, import("kitcore").PluginMeta>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/watchTriggerInbox/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,8BAA8B,CAAC;AAkDtC;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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