@zapier/zapier-sdk 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +14 -11
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +17 -15
- package/dist/api/types.d.ts +8 -7
- package/dist/api/types.d.ts.map +1 -1
- package/dist/constants.d.ts +8 -9
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +8 -11
- package/dist/experimental.cjs +18 -24
- package/dist/experimental.d.mts +2 -2
- package/dist/experimental.mjs +19 -24
- package/dist/{index-C2vsvjgN.d.mts → index-BQ2ii0Bs.d.mts} +16 -17
- package/dist/{index-C2vsvjgN.d.ts → index-BQ2ii0Bs.d.ts} +16 -17
- package/dist/index.cjs +18 -24
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +19 -24
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/api/index.js +1 -2
- package/dist/types/errors.d.ts +5 -5
- package/dist/types/sdk.d.ts +2 -2
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdk.js +4 -11
- package/package.json +1 -1
|
@@ -1399,12 +1399,12 @@ declare const BaseSdkOptionsSchema: z.ZodObject<{
|
|
|
1399
1399
|
trackingBaseUrl: z.ZodOptional<z.ZodString>;
|
|
1400
1400
|
maxNetworkRetries: z.ZodOptional<z.ZodNumber>;
|
|
1401
1401
|
maxNetworkRetryDelayMs: z.ZodOptional<z.ZodNumber>;
|
|
1402
|
-
isInteractive: z.ZodOptional<z.ZodBoolean>;
|
|
1403
1402
|
approvalTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
1404
1403
|
maxApprovalRetries: z.ZodOptional<z.ZodNumber>;
|
|
1405
1404
|
approvalMode: z.ZodOptional<z.ZodEnum<{
|
|
1405
|
+
disabled: "disabled";
|
|
1406
1406
|
poll: "poll";
|
|
1407
|
-
|
|
1407
|
+
throw: "throw";
|
|
1408
1408
|
}>>;
|
|
1409
1409
|
manifestPath: z.ZodOptional<z.ZodString>;
|
|
1410
1410
|
manifest: z.ZodOptional<z.ZodCustom<Manifest, Manifest>>;
|
|
@@ -5621,15 +5621,15 @@ declare class ZapierRateLimitError extends ZapierError {
|
|
|
5621
5621
|
* Terminal status of an approval attempt, exposed on `ZapierApprovalError.approvalStatus`.
|
|
5622
5622
|
*
|
|
5623
5623
|
* - `pending`: The approval was created but not yet resolved. Only thrown in
|
|
5624
|
-
* `approvalMode: "
|
|
5624
|
+
* `approvalMode: "throw"` — the caller is expected to surface the approval URL
|
|
5625
5625
|
* to an end user (e.g. an LLM instructing its user to click the link).
|
|
5626
5626
|
* - `denied`: A human explicitly rejected the approval in the UI.
|
|
5627
5627
|
* - `policy_denied`: A policy rule blocked the request before (or instead of)
|
|
5628
5628
|
* creating an approval. Cannot be approved by a human.
|
|
5629
|
-
* - `approval_required`: The backend requested approval, but
|
|
5630
|
-
*
|
|
5631
|
-
*
|
|
5632
|
-
*
|
|
5629
|
+
* - `approval_required`: The backend requested approval, but `approvalMode` is
|
|
5630
|
+
* `"disabled"` (the default) so the SDK did not create an approval. Set
|
|
5631
|
+
* `approvalMode` to `"poll"` or `"throw"` (or the `ZAPIER_APPROVAL_MODE` env
|
|
5632
|
+
* var) to enable the approval flow.
|
|
5633
5633
|
* - `timeout`: Poll mode exceeded `approvalTimeoutMs` without the approval
|
|
5634
5634
|
* being resolved.
|
|
5635
5635
|
* - `max_retries_exceeded`: A single request triggered more sequential approval
|
|
@@ -8642,20 +8642,19 @@ declare const DEFAULT_ACTION_TIMEOUT_MS = 180000;
|
|
|
8642
8642
|
*/
|
|
8643
8643
|
declare const ZAPIER_MAX_NETWORK_RETRIES: number;
|
|
8644
8644
|
declare const ZAPIER_MAX_NETWORK_RETRY_DELAY_MS: number;
|
|
8645
|
-
/**
|
|
8646
|
-
* Whether this session is interactive (user can visit approval URLs).
|
|
8647
|
-
*
|
|
8648
|
-
* Read lazily so tests can set the env var after module import.
|
|
8649
|
-
*/
|
|
8650
|
-
declare function getZapierIsInteractive(): boolean;
|
|
8651
8645
|
/**
|
|
8652
8646
|
* Approval flow behavior from environment variable.
|
|
8653
|
-
* - "
|
|
8654
|
-
*
|
|
8647
|
+
* - "disabled": (default when env var is unset) Throw a ZapierApprovalError on
|
|
8648
|
+
* approval-required responses without creating an approval. Callers must
|
|
8649
|
+
* explicitly opt in to approvals via "poll" or "throw".
|
|
8650
|
+
* - "poll": Create the approval, open the URL in a browser, poll until
|
|
8651
|
+
* resolved, and retry the original request on success.
|
|
8652
|
+
* - "throw": Create the approval and throw a ZapierApprovalError immediately
|
|
8653
|
+
* with the approval URL so the caller can surface it.
|
|
8655
8654
|
*
|
|
8656
8655
|
* Read lazily so tests can set the env var after module import.
|
|
8657
8656
|
*/
|
|
8658
|
-
declare function getZapierApprovalMode(): "poll" | "
|
|
8657
|
+
declare function getZapierApprovalMode(): "disabled" | "poll" | "throw" | undefined;
|
|
8659
8658
|
/**
|
|
8660
8659
|
* Default timeout for approval polling (10 minutes)
|
|
8661
8660
|
*/
|
|
@@ -9536,4 +9535,4 @@ declare const registryPlugin: (sdk: {
|
|
|
9536
9535
|
};
|
|
9537
9536
|
}) => {};
|
|
9538
9537
|
|
|
9539
|
-
export { type Resolver as $, type ApiClient as A, type BaseSdkOptions as B, type CapabilitiesContext as C, type DrainTriggerInboxOptions as D, type EventEmissionContext as E, type FieldsetItem as F, type GetAuthenticationPluginProvides as G, type ActionFieldChoice as H, type NeedsRequest as I, type NeedsResponse as J, type Connection as K, type LeasedTriggerMessageItem as L, type Manifest as M, type Need as N, type ConnectionsResponse as O, type PluginMeta as P, type UserProfile as Q, type ResolvedAppLocator as R, isPositional as S, type TriggerMessageStatus as T, type UpdateManifestEntryOptions as U, createFunction as V, type WithAddPlugin as W, type FormattedItem as X, type FormatMetadata as Y, type ZapierSdkOptions as Z, type OutputFormatter as _, type UpdateManifestEntryResult as a, AppPropertySchema as a$, type ArrayResolver as a0, type ResolverMetadata as a1, type StaticResolver as a2, type FieldsResolver as a3, runWithTelemetryContext as a4, toSnakeCase as a5, toTitleCase as a6, batch as a7, type BatchOptions as a8, buildCapabilityMessage as a9, type EnhancedErrorEventData as aA, type MethodCalledEventData as aB, generateEventId as aC, getCurrentTimestamp as aD, getReleaseId as aE, getOsInfo as aF, getPlatformVersions as aG, isCi as aH, getCiPlatform as aI, getMemoryUsage as aJ, getCpuTime as aK, buildApplicationLifecycleEvent as aL, buildErrorEventWithContext as aM, buildErrorEvent as aN, createBaseEvent as aO, buildMethodCalledEvent as aP, type AppItem as aQ, type ConnectionItem as aR, type ActionItem$1 as aS, type InputFieldItem as aT, type InfoFieldItem as aU, type RootFieldItem as aV, type UserProfileItem as aW, type FunctionOptions as aX, type SdkPage as aY, type PaginatedSdkFunction as aZ, AppKeyPropertySchema as a_, logDeprecation as aa, resetDeprecationWarnings as ab, RelayRequestSchema as ac, RelayFetchSchema as ad, createZapierSdkWithoutRegistry as ae, createSdk as af, createOptionsPlugin as ag, type FunctionRegistryEntry as ah, type FunctionDeprecation as ai, BaseSdkOptionsSchema as aj, type Plugin as ak, type PluginProvides as al, definePlugin as am, createPluginMethod as an, createPaginatedPluginMethod as ao, composePlugins as ap, type ActionItem as aq, type ActionTypeItem as ar, type RequestOptions as as, type PollOptions as at, registryPlugin as au, type BaseEvent as av, type MethodCalledEvent as aw, type EventEmissionProvides as ax, type EventContext as ay, type ApplicationLifecycleEventData as az, type AddActionEntryOptions as b, ZapierResourceNotFoundError as b$, ActionTypePropertySchema as b0, ActionKeyPropertySchema as b1, ActionPropertySchema as b2, InputFieldPropertySchema as b3, ConnectionIdPropertySchema as b4, AuthenticationIdPropertySchema as b5, ConnectionPropertySchema as b6, InputsPropertySchema as b7, LimitPropertySchema as b8, OffsetPropertySchema as b9, type LimitProperty as bA, type OffsetProperty as bB, type OutputProperty as bC, type DebugProperty as bD, type ParamsProperty as bE, type ActionTimeoutMsProperty as bF, type TableProperty as bG, type RecordProperty as bH, type RecordsProperty as bI, type FieldsProperty as bJ, type AppsProperty as bK, type TablesProperty as bL, type ConnectionsProperty as bM, type TriggerInboxProperty as bN, type TriggerInboxNameProperty as bO, type LeaseProperty as bP, type LeaseSecondsProperty as bQ, type LeaseLimitProperty as bR, type ApiError as bS, type ErrorOptions as bT, ZapierError as bU, ZapierApiError as bV, ZapierAppNotFoundError as bW, ZapierValidationError as bX, ZapierUnknownError as bY, ZapierAuthenticationError as bZ, ZapierNotFoundError as b_, OutputPropertySchema as ba, DebugPropertySchema as bb, ParamsPropertySchema as bc, ActionTimeoutMsPropertySchema as bd, TablePropertySchema as be, RecordPropertySchema as bf, RecordsPropertySchema as bg, FieldsPropertySchema as bh, AppsPropertySchema as bi, TablesPropertySchema as bj, ConnectionsPropertySchema as bk, TriggerInboxPropertySchema as bl, TriggerInboxNamePropertySchema as bm, LeasePropertySchema as bn, LeaseSecondsPropertySchema as bo, LeaseLimitPropertySchema as bp, type AppKeyProperty as bq, type AppProperty as br, type ActionTypeProperty as bs, type ActionKeyProperty as bt, type ActionProperty as bu, type InputFieldProperty as bv, type ConnectionIdProperty as bw, type ConnectionProperty as bx, type AuthenticationIdProperty as by, type InputsProperty as bz, type AddActionEntryResult as c, appKeyResolver as c$, ZapierConfigurationError as c0, ZapierBundleError as c1, ZapierTimeoutError as c2, ZapierActionError as c3, ZapierConflictError as c4, type RateLimitInfo as c5, ZapierRateLimitError as c6, type ApprovalStatus as c7, ZapierApprovalError as c8, ZapierRelayError as c9, getAppPlugin as cA, type GetAppPluginProvides as cB, getActionPlugin as cC, type GetActionPluginProvides as cD, getConnectionPlugin as cE, type GetConnectionPluginProvides as cF, findFirstConnectionPlugin as cG, type FindFirstConnectionPluginProvides as cH, findUniqueConnectionPlugin as cI, type FindUniqueConnectionPluginProvides as cJ, CONTEXT_CACHE_TTL_MS as cK, CONTEXT_CACHE_MAX_SIZE as cL, runActionPlugin as cM, type RunActionPluginProvides as cN, requestPlugin as cO, type RequestPluginProvides as cP, type ManifestPluginOptions as cQ, getPreferredManifestEntryKey as cR, manifestPlugin as cS, type ManifestPluginProvides as cT, DEFAULT_CONFIG_PATH as cU, type ManifestEntry as cV, getProfilePlugin as cW, type GetProfilePluginProvides as cX, type ApiPluginOptions as cY, apiPlugin as cZ, type ApiPluginProvides as c_, formatErrorMessage as ca, ZapierSignal as cb, appsPlugin as cc, type AppsPluginProvides as cd, type ActionExecutionOptions as ce, type AppFactoryInput as cf, fetchPlugin as cg, type FetchPluginProvides as ch, listAppsPlugin as ci, type ListAppsPluginProvides as cj, listActionsPlugin as ck, type ListActionsPluginProvides as cl, listActionInputFieldsPlugin as cm, type ListActionInputFieldsPluginProvides as cn, listActionInputFieldChoicesPlugin as co, type ListActionInputFieldChoicesPluginProvides as cp, getActionInputFieldsSchemaPlugin as cq, type GetActionInputFieldsSchemaPluginProvides as cr, listConnectionsPlugin as cs, type ListConnectionsPluginProvides as ct, listClientCredentialsPlugin as cu, type ListClientCredentialsPluginProvides as cv, createClientCredentialsPlugin as cw, type CreateClientCredentialsPluginProvides as cx, deleteClientCredentialsPlugin as cy, type DeleteClientCredentialsPluginProvides as cz, type ActionEntry as d, connectionsPlugin as d$, actionTypeResolver as d0, actionKeyResolver as d1, connectionIdResolver as d2, connectionIdGenericResolver as d3, inputsResolver as d4, inputsAllOptionalResolver as d5, inputFieldKeyResolver as d6, clientCredentialsNameResolver as d7, clientIdResolver as d8, tableIdResolver 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_, triggerInboxResolver 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 PaginatedSdkResult 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, getZapierIsInteractive as e8, getZapierApprovalMode as e9, createZapierSdk as eA, type ZapierSdk as eB, DEFAULT_APPROVAL_TIMEOUT_MS as ea, DEFAULT_MAX_APPROVAL_RETRIES as eb, listTablesPlugin as ec, type ListTablesPluginProvides as ed, getTablePlugin as ee, type GetTablePluginProvides as ef, createTablePlugin as eg, type CreateTablePluginProvides as eh, deleteTablePlugin as ei, type DeleteTablePluginProvides as ej, listTableFieldsPlugin as ek, type ListTableFieldsPluginProvides as el, createTableFieldsPlugin as em, type CreateTableFieldsPluginProvides as en, deleteTableFieldsPlugin as eo, type DeleteTableFieldsPluginProvides as ep, getTableRecordPlugin as eq, type GetTableRecordPluginProvides as er, listTableRecordsPlugin as es, type ListTableRecordsPluginProvides as et, createTableRecordsPlugin as eu, type CreateTableRecordsPluginProvides as ev, deleteTableRecordsPlugin as ew, type DeleteTableRecordsPluginProvides as ex, updateTableRecordsPlugin as ey, type UpdateTableRecordsPluginProvides as ez, findManifestEntry as f, type PositionalMetadata as g, type ZapierFetchInitOptions as h, type DynamicResolver as i, type WatchTriggerInboxOptions as j, type ActionProxy as k, type ZapierSdkApps as l, ZapierAbortDrainSignal as m, ZapierReleaseTriggerMessageSignal as n, type DrainTriggerInboxCallback as o, type DrainTriggerInboxErrorObserver as p, type ListAuthenticationsPluginProvides as q, readManifestFromFile as r, type FindFirstAuthenticationPluginProvides as s, type FindUniqueAuthenticationPluginProvides as t, type Action as u, type App as v, type Field as w, type Choice as x, type ActionExecutionResult as y, type ActionField as z };
|
|
9538
|
+
export { type Resolver as $, type ApiClient as A, type BaseSdkOptions as B, type CapabilitiesContext as C, type DrainTriggerInboxOptions as D, type EventEmissionContext as E, type FieldsetItem as F, type GetAuthenticationPluginProvides as G, type ActionFieldChoice as H, type NeedsRequest as I, type NeedsResponse as J, type Connection as K, type LeasedTriggerMessageItem as L, type Manifest as M, type Need as N, type ConnectionsResponse as O, type PluginMeta as P, type UserProfile as Q, type ResolvedAppLocator as R, isPositional as S, type TriggerMessageStatus as T, type UpdateManifestEntryOptions as U, createFunction as V, type WithAddPlugin as W, type FormattedItem as X, type FormatMetadata as Y, type ZapierSdkOptions as Z, type OutputFormatter as _, type UpdateManifestEntryResult as a, AppPropertySchema as a$, type ArrayResolver as a0, type ResolverMetadata as a1, type StaticResolver as a2, type FieldsResolver as a3, runWithTelemetryContext as a4, toSnakeCase as a5, toTitleCase as a6, batch as a7, type BatchOptions as a8, buildCapabilityMessage as a9, type EnhancedErrorEventData as aA, type MethodCalledEventData as aB, generateEventId as aC, getCurrentTimestamp as aD, getReleaseId as aE, getOsInfo as aF, getPlatformVersions as aG, isCi as aH, getCiPlatform as aI, getMemoryUsage as aJ, getCpuTime as aK, buildApplicationLifecycleEvent as aL, buildErrorEventWithContext as aM, buildErrorEvent as aN, createBaseEvent as aO, buildMethodCalledEvent as aP, type AppItem as aQ, type ConnectionItem as aR, type ActionItem$1 as aS, type InputFieldItem as aT, type InfoFieldItem as aU, type RootFieldItem as aV, type UserProfileItem as aW, type FunctionOptions as aX, type SdkPage as aY, type PaginatedSdkFunction as aZ, AppKeyPropertySchema as a_, logDeprecation as aa, resetDeprecationWarnings as ab, RelayRequestSchema as ac, RelayFetchSchema as ad, createZapierSdkWithoutRegistry as ae, createSdk as af, createOptionsPlugin as ag, type FunctionRegistryEntry as ah, type FunctionDeprecation as ai, BaseSdkOptionsSchema as aj, type Plugin as ak, type PluginProvides as al, definePlugin as am, createPluginMethod as an, createPaginatedPluginMethod as ao, composePlugins as ap, type ActionItem as aq, type ActionTypeItem as ar, type RequestOptions as as, type PollOptions as at, registryPlugin as au, type BaseEvent as av, type MethodCalledEvent as aw, type EventEmissionProvides as ax, type EventContext as ay, type ApplicationLifecycleEventData as az, type AddActionEntryOptions as b, ZapierResourceNotFoundError as b$, ActionTypePropertySchema as b0, ActionKeyPropertySchema as b1, ActionPropertySchema as b2, InputFieldPropertySchema as b3, ConnectionIdPropertySchema as b4, AuthenticationIdPropertySchema as b5, ConnectionPropertySchema as b6, InputsPropertySchema as b7, LimitPropertySchema as b8, OffsetPropertySchema as b9, type LimitProperty as bA, type OffsetProperty as bB, type OutputProperty as bC, type DebugProperty as bD, type ParamsProperty as bE, type ActionTimeoutMsProperty as bF, type TableProperty as bG, type RecordProperty as bH, type RecordsProperty as bI, type FieldsProperty as bJ, type AppsProperty as bK, type TablesProperty as bL, type ConnectionsProperty as bM, type TriggerInboxProperty as bN, type TriggerInboxNameProperty as bO, type LeaseProperty as bP, type LeaseSecondsProperty as bQ, type LeaseLimitProperty as bR, type ApiError as bS, type ErrorOptions as bT, ZapierError as bU, ZapierApiError as bV, ZapierAppNotFoundError as bW, ZapierValidationError as bX, ZapierUnknownError as bY, ZapierAuthenticationError as bZ, ZapierNotFoundError as b_, OutputPropertySchema as ba, DebugPropertySchema as bb, ParamsPropertySchema as bc, ActionTimeoutMsPropertySchema as bd, TablePropertySchema as be, RecordPropertySchema as bf, RecordsPropertySchema as bg, FieldsPropertySchema as bh, AppsPropertySchema as bi, TablesPropertySchema as bj, ConnectionsPropertySchema as bk, TriggerInboxPropertySchema as bl, TriggerInboxNamePropertySchema as bm, LeasePropertySchema as bn, LeaseSecondsPropertySchema as bo, LeaseLimitPropertySchema as bp, type AppKeyProperty as bq, type AppProperty as br, type ActionTypeProperty as bs, type ActionKeyProperty as bt, type ActionProperty as bu, type InputFieldProperty as bv, type ConnectionIdProperty as bw, type ConnectionProperty as bx, type AuthenticationIdProperty as by, type InputsProperty as bz, type AddActionEntryResult as c, appKeyResolver as c$, ZapierConfigurationError as c0, ZapierBundleError as c1, ZapierTimeoutError as c2, ZapierActionError as c3, ZapierConflictError as c4, type RateLimitInfo as c5, ZapierRateLimitError as c6, type ApprovalStatus as c7, ZapierApprovalError as c8, ZapierRelayError as c9, getAppPlugin as cA, type GetAppPluginProvides as cB, getActionPlugin as cC, type GetActionPluginProvides as cD, getConnectionPlugin as cE, type GetConnectionPluginProvides as cF, findFirstConnectionPlugin as cG, type FindFirstConnectionPluginProvides as cH, findUniqueConnectionPlugin as cI, type FindUniqueConnectionPluginProvides as cJ, CONTEXT_CACHE_TTL_MS as cK, CONTEXT_CACHE_MAX_SIZE as cL, runActionPlugin as cM, type RunActionPluginProvides as cN, requestPlugin as cO, type RequestPluginProvides as cP, type ManifestPluginOptions as cQ, getPreferredManifestEntryKey as cR, manifestPlugin as cS, type ManifestPluginProvides as cT, DEFAULT_CONFIG_PATH as cU, type ManifestEntry as cV, getProfilePlugin as cW, type GetProfilePluginProvides as cX, type ApiPluginOptions as cY, apiPlugin as cZ, type ApiPluginProvides as c_, formatErrorMessage as ca, ZapierSignal as cb, appsPlugin as cc, type AppsPluginProvides as cd, type ActionExecutionOptions as ce, type AppFactoryInput as cf, fetchPlugin as cg, type FetchPluginProvides as ch, listAppsPlugin as ci, type ListAppsPluginProvides as cj, listActionsPlugin as ck, type ListActionsPluginProvides as cl, listActionInputFieldsPlugin as cm, type ListActionInputFieldsPluginProvides as cn, listActionInputFieldChoicesPlugin as co, type ListActionInputFieldChoicesPluginProvides as cp, getActionInputFieldsSchemaPlugin as cq, type GetActionInputFieldsSchemaPluginProvides as cr, listConnectionsPlugin as cs, type ListConnectionsPluginProvides as ct, listClientCredentialsPlugin as cu, type ListClientCredentialsPluginProvides as cv, createClientCredentialsPlugin as cw, type CreateClientCredentialsPluginProvides as cx, deleteClientCredentialsPlugin as cy, type DeleteClientCredentialsPluginProvides as cz, type ActionEntry as d, connectionsPlugin as d$, actionTypeResolver as d0, actionKeyResolver as d1, connectionIdResolver as d2, connectionIdGenericResolver as d3, inputsResolver as d4, inputsAllOptionalResolver as d5, inputFieldKeyResolver as d6, clientCredentialsNameResolver as d7, clientIdResolver as d8, tableIdResolver 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_, triggerInboxResolver 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 PaginatedSdkResult 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, getZapierApprovalMode as e8, DEFAULT_APPROVAL_TIMEOUT_MS as e9, type ZapierSdk as eA, DEFAULT_MAX_APPROVAL_RETRIES as ea, listTablesPlugin as eb, type ListTablesPluginProvides as ec, getTablePlugin as ed, type GetTablePluginProvides as ee, createTablePlugin as ef, type CreateTablePluginProvides as eg, deleteTablePlugin as eh, type DeleteTablePluginProvides as ei, listTableFieldsPlugin as ej, type ListTableFieldsPluginProvides as ek, createTableFieldsPlugin as el, type CreateTableFieldsPluginProvides as em, deleteTableFieldsPlugin as en, type DeleteTableFieldsPluginProvides as eo, getTableRecordPlugin as ep, type GetTableRecordPluginProvides as eq, listTableRecordsPlugin as er, type ListTableRecordsPluginProvides as es, createTableRecordsPlugin as et, type CreateTableRecordsPluginProvides as eu, deleteTableRecordsPlugin as ev, type DeleteTableRecordsPluginProvides as ew, updateTableRecordsPlugin as ex, type UpdateTableRecordsPluginProvides as ey, createZapierSdk as ez, findManifestEntry as f, type PositionalMetadata as g, type ZapierFetchInitOptions as h, type DynamicResolver as i, type WatchTriggerInboxOptions as j, type ActionProxy as k, type ZapierSdkApps as l, ZapierAbortDrainSignal as m, ZapierReleaseTriggerMessageSignal as n, type DrainTriggerInboxCallback as o, type DrainTriggerInboxErrorObserver as p, type ListAuthenticationsPluginProvides as q, readManifestFromFile as r, type FindFirstAuthenticationPluginProvides as s, type FindUniqueAuthenticationPluginProvides as t, type Action as u, type App as v, type Field as w, type Choice as x, type ActionExecutionResult as y, type ActionField as z };
|
|
@@ -1399,12 +1399,12 @@ declare const BaseSdkOptionsSchema: z.ZodObject<{
|
|
|
1399
1399
|
trackingBaseUrl: z.ZodOptional<z.ZodString>;
|
|
1400
1400
|
maxNetworkRetries: z.ZodOptional<z.ZodNumber>;
|
|
1401
1401
|
maxNetworkRetryDelayMs: z.ZodOptional<z.ZodNumber>;
|
|
1402
|
-
isInteractive: z.ZodOptional<z.ZodBoolean>;
|
|
1403
1402
|
approvalTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
1404
1403
|
maxApprovalRetries: z.ZodOptional<z.ZodNumber>;
|
|
1405
1404
|
approvalMode: z.ZodOptional<z.ZodEnum<{
|
|
1405
|
+
disabled: "disabled";
|
|
1406
1406
|
poll: "poll";
|
|
1407
|
-
|
|
1407
|
+
throw: "throw";
|
|
1408
1408
|
}>>;
|
|
1409
1409
|
manifestPath: z.ZodOptional<z.ZodString>;
|
|
1410
1410
|
manifest: z.ZodOptional<z.ZodCustom<Manifest, Manifest>>;
|
|
@@ -5621,15 +5621,15 @@ declare class ZapierRateLimitError extends ZapierError {
|
|
|
5621
5621
|
* Terminal status of an approval attempt, exposed on `ZapierApprovalError.approvalStatus`.
|
|
5622
5622
|
*
|
|
5623
5623
|
* - `pending`: The approval was created but not yet resolved. Only thrown in
|
|
5624
|
-
* `approvalMode: "
|
|
5624
|
+
* `approvalMode: "throw"` — the caller is expected to surface the approval URL
|
|
5625
5625
|
* to an end user (e.g. an LLM instructing its user to click the link).
|
|
5626
5626
|
* - `denied`: A human explicitly rejected the approval in the UI.
|
|
5627
5627
|
* - `policy_denied`: A policy rule blocked the request before (or instead of)
|
|
5628
5628
|
* creating an approval. Cannot be approved by a human.
|
|
5629
|
-
* - `approval_required`: The backend requested approval, but
|
|
5630
|
-
*
|
|
5631
|
-
*
|
|
5632
|
-
*
|
|
5629
|
+
* - `approval_required`: The backend requested approval, but `approvalMode` is
|
|
5630
|
+
* `"disabled"` (the default) so the SDK did not create an approval. Set
|
|
5631
|
+
* `approvalMode` to `"poll"` or `"throw"` (or the `ZAPIER_APPROVAL_MODE` env
|
|
5632
|
+
* var) to enable the approval flow.
|
|
5633
5633
|
* - `timeout`: Poll mode exceeded `approvalTimeoutMs` without the approval
|
|
5634
5634
|
* being resolved.
|
|
5635
5635
|
* - `max_retries_exceeded`: A single request triggered more sequential approval
|
|
@@ -8642,20 +8642,19 @@ declare const DEFAULT_ACTION_TIMEOUT_MS = 180000;
|
|
|
8642
8642
|
*/
|
|
8643
8643
|
declare const ZAPIER_MAX_NETWORK_RETRIES: number;
|
|
8644
8644
|
declare const ZAPIER_MAX_NETWORK_RETRY_DELAY_MS: number;
|
|
8645
|
-
/**
|
|
8646
|
-
* Whether this session is interactive (user can visit approval URLs).
|
|
8647
|
-
*
|
|
8648
|
-
* Read lazily so tests can set the env var after module import.
|
|
8649
|
-
*/
|
|
8650
|
-
declare function getZapierIsInteractive(): boolean;
|
|
8651
8645
|
/**
|
|
8652
8646
|
* Approval flow behavior from environment variable.
|
|
8653
|
-
* - "
|
|
8654
|
-
*
|
|
8647
|
+
* - "disabled": (default when env var is unset) Throw a ZapierApprovalError on
|
|
8648
|
+
* approval-required responses without creating an approval. Callers must
|
|
8649
|
+
* explicitly opt in to approvals via "poll" or "throw".
|
|
8650
|
+
* - "poll": Create the approval, open the URL in a browser, poll until
|
|
8651
|
+
* resolved, and retry the original request on success.
|
|
8652
|
+
* - "throw": Create the approval and throw a ZapierApprovalError immediately
|
|
8653
|
+
* with the approval URL so the caller can surface it.
|
|
8655
8654
|
*
|
|
8656
8655
|
* Read lazily so tests can set the env var after module import.
|
|
8657
8656
|
*/
|
|
8658
|
-
declare function getZapierApprovalMode(): "poll" | "
|
|
8657
|
+
declare function getZapierApprovalMode(): "disabled" | "poll" | "throw" | undefined;
|
|
8659
8658
|
/**
|
|
8660
8659
|
* Default timeout for approval polling (10 minutes)
|
|
8661
8660
|
*/
|
|
@@ -9536,4 +9535,4 @@ declare const registryPlugin: (sdk: {
|
|
|
9536
9535
|
};
|
|
9537
9536
|
}) => {};
|
|
9538
9537
|
|
|
9539
|
-
export { type Resolver as $, type ApiClient as A, type BaseSdkOptions as B, type CapabilitiesContext as C, type DrainTriggerInboxOptions as D, type EventEmissionContext as E, type FieldsetItem as F, type GetAuthenticationPluginProvides as G, type ActionFieldChoice as H, type NeedsRequest as I, type NeedsResponse as J, type Connection as K, type LeasedTriggerMessageItem as L, type Manifest as M, type Need as N, type ConnectionsResponse as O, type PluginMeta as P, type UserProfile as Q, type ResolvedAppLocator as R, isPositional as S, type TriggerMessageStatus as T, type UpdateManifestEntryOptions as U, createFunction as V, type WithAddPlugin as W, type FormattedItem as X, type FormatMetadata as Y, type ZapierSdkOptions as Z, type OutputFormatter as _, type UpdateManifestEntryResult as a, AppPropertySchema as a$, type ArrayResolver as a0, type ResolverMetadata as a1, type StaticResolver as a2, type FieldsResolver as a3, runWithTelemetryContext as a4, toSnakeCase as a5, toTitleCase as a6, batch as a7, type BatchOptions as a8, buildCapabilityMessage as a9, type EnhancedErrorEventData as aA, type MethodCalledEventData as aB, generateEventId as aC, getCurrentTimestamp as aD, getReleaseId as aE, getOsInfo as aF, getPlatformVersions as aG, isCi as aH, getCiPlatform as aI, getMemoryUsage as aJ, getCpuTime as aK, buildApplicationLifecycleEvent as aL, buildErrorEventWithContext as aM, buildErrorEvent as aN, createBaseEvent as aO, buildMethodCalledEvent as aP, type AppItem as aQ, type ConnectionItem as aR, type ActionItem$1 as aS, type InputFieldItem as aT, type InfoFieldItem as aU, type RootFieldItem as aV, type UserProfileItem as aW, type FunctionOptions as aX, type SdkPage as aY, type PaginatedSdkFunction as aZ, AppKeyPropertySchema as a_, logDeprecation as aa, resetDeprecationWarnings as ab, RelayRequestSchema as ac, RelayFetchSchema as ad, createZapierSdkWithoutRegistry as ae, createSdk as af, createOptionsPlugin as ag, type FunctionRegistryEntry as ah, type FunctionDeprecation as ai, BaseSdkOptionsSchema as aj, type Plugin as ak, type PluginProvides as al, definePlugin as am, createPluginMethod as an, createPaginatedPluginMethod as ao, composePlugins as ap, type ActionItem as aq, type ActionTypeItem as ar, type RequestOptions as as, type PollOptions as at, registryPlugin as au, type BaseEvent as av, type MethodCalledEvent as aw, type EventEmissionProvides as ax, type EventContext as ay, type ApplicationLifecycleEventData as az, type AddActionEntryOptions as b, ZapierResourceNotFoundError as b$, ActionTypePropertySchema as b0, ActionKeyPropertySchema as b1, ActionPropertySchema as b2, InputFieldPropertySchema as b3, ConnectionIdPropertySchema as b4, AuthenticationIdPropertySchema as b5, ConnectionPropertySchema as b6, InputsPropertySchema as b7, LimitPropertySchema as b8, OffsetPropertySchema as b9, type LimitProperty as bA, type OffsetProperty as bB, type OutputProperty as bC, type DebugProperty as bD, type ParamsProperty as bE, type ActionTimeoutMsProperty as bF, type TableProperty as bG, type RecordProperty as bH, type RecordsProperty as bI, type FieldsProperty as bJ, type AppsProperty as bK, type TablesProperty as bL, type ConnectionsProperty as bM, type TriggerInboxProperty as bN, type TriggerInboxNameProperty as bO, type LeaseProperty as bP, type LeaseSecondsProperty as bQ, type LeaseLimitProperty as bR, type ApiError as bS, type ErrorOptions as bT, ZapierError as bU, ZapierApiError as bV, ZapierAppNotFoundError as bW, ZapierValidationError as bX, ZapierUnknownError as bY, ZapierAuthenticationError as bZ, ZapierNotFoundError as b_, OutputPropertySchema as ba, DebugPropertySchema as bb, ParamsPropertySchema as bc, ActionTimeoutMsPropertySchema as bd, TablePropertySchema as be, RecordPropertySchema as bf, RecordsPropertySchema as bg, FieldsPropertySchema as bh, AppsPropertySchema as bi, TablesPropertySchema as bj, ConnectionsPropertySchema as bk, TriggerInboxPropertySchema as bl, TriggerInboxNamePropertySchema as bm, LeasePropertySchema as bn, LeaseSecondsPropertySchema as bo, LeaseLimitPropertySchema as bp, type AppKeyProperty as bq, type AppProperty as br, type ActionTypeProperty as bs, type ActionKeyProperty as bt, type ActionProperty as bu, type InputFieldProperty as bv, type ConnectionIdProperty as bw, type ConnectionProperty as bx, type AuthenticationIdProperty as by, type InputsProperty as bz, type AddActionEntryResult as c, appKeyResolver as c$, ZapierConfigurationError as c0, ZapierBundleError as c1, ZapierTimeoutError as c2, ZapierActionError as c3, ZapierConflictError as c4, type RateLimitInfo as c5, ZapierRateLimitError as c6, type ApprovalStatus as c7, ZapierApprovalError as c8, ZapierRelayError as c9, getAppPlugin as cA, type GetAppPluginProvides as cB, getActionPlugin as cC, type GetActionPluginProvides as cD, getConnectionPlugin as cE, type GetConnectionPluginProvides as cF, findFirstConnectionPlugin as cG, type FindFirstConnectionPluginProvides as cH, findUniqueConnectionPlugin as cI, type FindUniqueConnectionPluginProvides as cJ, CONTEXT_CACHE_TTL_MS as cK, CONTEXT_CACHE_MAX_SIZE as cL, runActionPlugin as cM, type RunActionPluginProvides as cN, requestPlugin as cO, type RequestPluginProvides as cP, type ManifestPluginOptions as cQ, getPreferredManifestEntryKey as cR, manifestPlugin as cS, type ManifestPluginProvides as cT, DEFAULT_CONFIG_PATH as cU, type ManifestEntry as cV, getProfilePlugin as cW, type GetProfilePluginProvides as cX, type ApiPluginOptions as cY, apiPlugin as cZ, type ApiPluginProvides as c_, formatErrorMessage as ca, ZapierSignal as cb, appsPlugin as cc, type AppsPluginProvides as cd, type ActionExecutionOptions as ce, type AppFactoryInput as cf, fetchPlugin as cg, type FetchPluginProvides as ch, listAppsPlugin as ci, type ListAppsPluginProvides as cj, listActionsPlugin as ck, type ListActionsPluginProvides as cl, listActionInputFieldsPlugin as cm, type ListActionInputFieldsPluginProvides as cn, listActionInputFieldChoicesPlugin as co, type ListActionInputFieldChoicesPluginProvides as cp, getActionInputFieldsSchemaPlugin as cq, type GetActionInputFieldsSchemaPluginProvides as cr, listConnectionsPlugin as cs, type ListConnectionsPluginProvides as ct, listClientCredentialsPlugin as cu, type ListClientCredentialsPluginProvides as cv, createClientCredentialsPlugin as cw, type CreateClientCredentialsPluginProvides as cx, deleteClientCredentialsPlugin as cy, type DeleteClientCredentialsPluginProvides as cz, type ActionEntry as d, connectionsPlugin as d$, actionTypeResolver as d0, actionKeyResolver as d1, connectionIdResolver as d2, connectionIdGenericResolver as d3, inputsResolver as d4, inputsAllOptionalResolver as d5, inputFieldKeyResolver as d6, clientCredentialsNameResolver as d7, clientIdResolver as d8, tableIdResolver 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_, triggerInboxResolver 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 PaginatedSdkResult 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, getZapierIsInteractive as e8, getZapierApprovalMode as e9, createZapierSdk as eA, type ZapierSdk as eB, DEFAULT_APPROVAL_TIMEOUT_MS as ea, DEFAULT_MAX_APPROVAL_RETRIES as eb, listTablesPlugin as ec, type ListTablesPluginProvides as ed, getTablePlugin as ee, type GetTablePluginProvides as ef, createTablePlugin as eg, type CreateTablePluginProvides as eh, deleteTablePlugin as ei, type DeleteTablePluginProvides as ej, listTableFieldsPlugin as ek, type ListTableFieldsPluginProvides as el, createTableFieldsPlugin as em, type CreateTableFieldsPluginProvides as en, deleteTableFieldsPlugin as eo, type DeleteTableFieldsPluginProvides as ep, getTableRecordPlugin as eq, type GetTableRecordPluginProvides as er, listTableRecordsPlugin as es, type ListTableRecordsPluginProvides as et, createTableRecordsPlugin as eu, type CreateTableRecordsPluginProvides as ev, deleteTableRecordsPlugin as ew, type DeleteTableRecordsPluginProvides as ex, updateTableRecordsPlugin as ey, type UpdateTableRecordsPluginProvides as ez, findManifestEntry as f, type PositionalMetadata as g, type ZapierFetchInitOptions as h, type DynamicResolver as i, type WatchTriggerInboxOptions as j, type ActionProxy as k, type ZapierSdkApps as l, ZapierAbortDrainSignal as m, ZapierReleaseTriggerMessageSignal as n, type DrainTriggerInboxCallback as o, type DrainTriggerInboxErrorObserver as p, type ListAuthenticationsPluginProvides as q, readManifestFromFile as r, type FindFirstAuthenticationPluginProvides as s, type FindUniqueAuthenticationPluginProvides as t, type Action as u, type App as v, type Field as w, type Choice as x, type ActionExecutionResult as y, type ActionField as z };
|
|
9538
|
+
export { type Resolver as $, type ApiClient as A, type BaseSdkOptions as B, type CapabilitiesContext as C, type DrainTriggerInboxOptions as D, type EventEmissionContext as E, type FieldsetItem as F, type GetAuthenticationPluginProvides as G, type ActionFieldChoice as H, type NeedsRequest as I, type NeedsResponse as J, type Connection as K, type LeasedTriggerMessageItem as L, type Manifest as M, type Need as N, type ConnectionsResponse as O, type PluginMeta as P, type UserProfile as Q, type ResolvedAppLocator as R, isPositional as S, type TriggerMessageStatus as T, type UpdateManifestEntryOptions as U, createFunction as V, type WithAddPlugin as W, type FormattedItem as X, type FormatMetadata as Y, type ZapierSdkOptions as Z, type OutputFormatter as _, type UpdateManifestEntryResult as a, AppPropertySchema as a$, type ArrayResolver as a0, type ResolverMetadata as a1, type StaticResolver as a2, type FieldsResolver as a3, runWithTelemetryContext as a4, toSnakeCase as a5, toTitleCase as a6, batch as a7, type BatchOptions as a8, buildCapabilityMessage as a9, type EnhancedErrorEventData as aA, type MethodCalledEventData as aB, generateEventId as aC, getCurrentTimestamp as aD, getReleaseId as aE, getOsInfo as aF, getPlatformVersions as aG, isCi as aH, getCiPlatform as aI, getMemoryUsage as aJ, getCpuTime as aK, buildApplicationLifecycleEvent as aL, buildErrorEventWithContext as aM, buildErrorEvent as aN, createBaseEvent as aO, buildMethodCalledEvent as aP, type AppItem as aQ, type ConnectionItem as aR, type ActionItem$1 as aS, type InputFieldItem as aT, type InfoFieldItem as aU, type RootFieldItem as aV, type UserProfileItem as aW, type FunctionOptions as aX, type SdkPage as aY, type PaginatedSdkFunction as aZ, AppKeyPropertySchema as a_, logDeprecation as aa, resetDeprecationWarnings as ab, RelayRequestSchema as ac, RelayFetchSchema as ad, createZapierSdkWithoutRegistry as ae, createSdk as af, createOptionsPlugin as ag, type FunctionRegistryEntry as ah, type FunctionDeprecation as ai, BaseSdkOptionsSchema as aj, type Plugin as ak, type PluginProvides as al, definePlugin as am, createPluginMethod as an, createPaginatedPluginMethod as ao, composePlugins as ap, type ActionItem as aq, type ActionTypeItem as ar, type RequestOptions as as, type PollOptions as at, registryPlugin as au, type BaseEvent as av, type MethodCalledEvent as aw, type EventEmissionProvides as ax, type EventContext as ay, type ApplicationLifecycleEventData as az, type AddActionEntryOptions as b, ZapierResourceNotFoundError as b$, ActionTypePropertySchema as b0, ActionKeyPropertySchema as b1, ActionPropertySchema as b2, InputFieldPropertySchema as b3, ConnectionIdPropertySchema as b4, AuthenticationIdPropertySchema as b5, ConnectionPropertySchema as b6, InputsPropertySchema as b7, LimitPropertySchema as b8, OffsetPropertySchema as b9, type LimitProperty as bA, type OffsetProperty as bB, type OutputProperty as bC, type DebugProperty as bD, type ParamsProperty as bE, type ActionTimeoutMsProperty as bF, type TableProperty as bG, type RecordProperty as bH, type RecordsProperty as bI, type FieldsProperty as bJ, type AppsProperty as bK, type TablesProperty as bL, type ConnectionsProperty as bM, type TriggerInboxProperty as bN, type TriggerInboxNameProperty as bO, type LeaseProperty as bP, type LeaseSecondsProperty as bQ, type LeaseLimitProperty as bR, type ApiError as bS, type ErrorOptions as bT, ZapierError as bU, ZapierApiError as bV, ZapierAppNotFoundError as bW, ZapierValidationError as bX, ZapierUnknownError as bY, ZapierAuthenticationError as bZ, ZapierNotFoundError as b_, OutputPropertySchema as ba, DebugPropertySchema as bb, ParamsPropertySchema as bc, ActionTimeoutMsPropertySchema as bd, TablePropertySchema as be, RecordPropertySchema as bf, RecordsPropertySchema as bg, FieldsPropertySchema as bh, AppsPropertySchema as bi, TablesPropertySchema as bj, ConnectionsPropertySchema as bk, TriggerInboxPropertySchema as bl, TriggerInboxNamePropertySchema as bm, LeasePropertySchema as bn, LeaseSecondsPropertySchema as bo, LeaseLimitPropertySchema as bp, type AppKeyProperty as bq, type AppProperty as br, type ActionTypeProperty as bs, type ActionKeyProperty as bt, type ActionProperty as bu, type InputFieldProperty as bv, type ConnectionIdProperty as bw, type ConnectionProperty as bx, type AuthenticationIdProperty as by, type InputsProperty as bz, type AddActionEntryResult as c, appKeyResolver as c$, ZapierConfigurationError as c0, ZapierBundleError as c1, ZapierTimeoutError as c2, ZapierActionError as c3, ZapierConflictError as c4, type RateLimitInfo as c5, ZapierRateLimitError as c6, type ApprovalStatus as c7, ZapierApprovalError as c8, ZapierRelayError as c9, getAppPlugin as cA, type GetAppPluginProvides as cB, getActionPlugin as cC, type GetActionPluginProvides as cD, getConnectionPlugin as cE, type GetConnectionPluginProvides as cF, findFirstConnectionPlugin as cG, type FindFirstConnectionPluginProvides as cH, findUniqueConnectionPlugin as cI, type FindUniqueConnectionPluginProvides as cJ, CONTEXT_CACHE_TTL_MS as cK, CONTEXT_CACHE_MAX_SIZE as cL, runActionPlugin as cM, type RunActionPluginProvides as cN, requestPlugin as cO, type RequestPluginProvides as cP, type ManifestPluginOptions as cQ, getPreferredManifestEntryKey as cR, manifestPlugin as cS, type ManifestPluginProvides as cT, DEFAULT_CONFIG_PATH as cU, type ManifestEntry as cV, getProfilePlugin as cW, type GetProfilePluginProvides as cX, type ApiPluginOptions as cY, apiPlugin as cZ, type ApiPluginProvides as c_, formatErrorMessage as ca, ZapierSignal as cb, appsPlugin as cc, type AppsPluginProvides as cd, type ActionExecutionOptions as ce, type AppFactoryInput as cf, fetchPlugin as cg, type FetchPluginProvides as ch, listAppsPlugin as ci, type ListAppsPluginProvides as cj, listActionsPlugin as ck, type ListActionsPluginProvides as cl, listActionInputFieldsPlugin as cm, type ListActionInputFieldsPluginProvides as cn, listActionInputFieldChoicesPlugin as co, type ListActionInputFieldChoicesPluginProvides as cp, getActionInputFieldsSchemaPlugin as cq, type GetActionInputFieldsSchemaPluginProvides as cr, listConnectionsPlugin as cs, type ListConnectionsPluginProvides as ct, listClientCredentialsPlugin as cu, type ListClientCredentialsPluginProvides as cv, createClientCredentialsPlugin as cw, type CreateClientCredentialsPluginProvides as cx, deleteClientCredentialsPlugin as cy, type DeleteClientCredentialsPluginProvides as cz, type ActionEntry as d, connectionsPlugin as d$, actionTypeResolver as d0, actionKeyResolver as d1, connectionIdResolver as d2, connectionIdGenericResolver as d3, inputsResolver as d4, inputsAllOptionalResolver as d5, inputFieldKeyResolver as d6, clientCredentialsNameResolver as d7, clientIdResolver as d8, tableIdResolver 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_, triggerInboxResolver 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 PaginatedSdkResult 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, getZapierApprovalMode as e8, DEFAULT_APPROVAL_TIMEOUT_MS as e9, type ZapierSdk as eA, DEFAULT_MAX_APPROVAL_RETRIES as ea, listTablesPlugin as eb, type ListTablesPluginProvides as ec, getTablePlugin as ed, type GetTablePluginProvides as ee, createTablePlugin as ef, type CreateTablePluginProvides as eg, deleteTablePlugin as eh, type DeleteTablePluginProvides as ei, listTableFieldsPlugin as ej, type ListTableFieldsPluginProvides as ek, createTableFieldsPlugin as el, type CreateTableFieldsPluginProvides as em, deleteTableFieldsPlugin as en, type DeleteTableFieldsPluginProvides as eo, getTableRecordPlugin as ep, type GetTableRecordPluginProvides as eq, listTableRecordsPlugin as er, type ListTableRecordsPluginProvides as es, createTableRecordsPlugin as et, type CreateTableRecordsPluginProvides as eu, deleteTableRecordsPlugin as ev, type DeleteTableRecordsPluginProvides as ew, updateTableRecordsPlugin as ex, type UpdateTableRecordsPluginProvides as ey, createZapierSdk as ez, findManifestEntry as f, type PositionalMetadata as g, type ZapierFetchInitOptions as h, type DynamicResolver as i, type WatchTriggerInboxOptions as j, type ActionProxy as k, type ZapierSdkApps as l, ZapierAbortDrainSignal as m, ZapierReleaseTriggerMessageSignal as n, type DrainTriggerInboxCallback as o, type DrainTriggerInboxErrorObserver as p, type ListAuthenticationsPluginProvides as q, readManifestFromFile as r, type FindFirstAuthenticationPluginProvides as s, type FindUniqueAuthenticationPluginProvides as t, type Action as u, type App as v, type Field as w, type Choice as x, type ActionExecutionResult as y, type ActionField as z };
|
package/dist/index.cjs
CHANGED
|
@@ -63,12 +63,10 @@ function parseIntEnvVar(name) {
|
|
|
63
63
|
}
|
|
64
64
|
var ZAPIER_MAX_NETWORK_RETRIES = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRIES") ?? 3;
|
|
65
65
|
var ZAPIER_MAX_NETWORK_RETRY_DELAY_MS = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRY_DELAY_MS") ?? 6e4;
|
|
66
|
-
function getZapierIsInteractive() {
|
|
67
|
-
return globalThis.process?.env?.ZAPIER_IS_INTERACTIVE === "true";
|
|
68
|
-
}
|
|
69
66
|
function getZapierApprovalMode() {
|
|
70
67
|
const value = globalThis.process?.env?.ZAPIER_APPROVAL_MODE;
|
|
71
|
-
if (value === "
|
|
68
|
+
if (value === "disabled" || value === "poll" || value === "throw")
|
|
69
|
+
return value;
|
|
72
70
|
return void 0;
|
|
73
71
|
}
|
|
74
72
|
var DEFAULT_APPROVAL_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
@@ -6060,7 +6058,7 @@ async function invalidateCredentialsToken(options) {
|
|
|
6060
6058
|
}
|
|
6061
6059
|
|
|
6062
6060
|
// src/sdk-version.ts
|
|
6063
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
6061
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.50.0" : void 0) || "unknown";
|
|
6064
6062
|
|
|
6065
6063
|
// src/utils/open-url.ts
|
|
6066
6064
|
var nodePrefix = "node:";
|
|
@@ -6335,10 +6333,10 @@ var ZapierApiClient = class {
|
|
|
6335
6333
|
}
|
|
6336
6334
|
if (errorType !== "approval_required") return response;
|
|
6337
6335
|
if (attempt === maxRetries) break;
|
|
6338
|
-
const
|
|
6339
|
-
if (
|
|
6336
|
+
const mode = this.options.approvalMode ?? getZapierApprovalMode() ?? "disabled";
|
|
6337
|
+
if (mode === "disabled") {
|
|
6340
6338
|
throw new ZapierApprovalError(
|
|
6341
|
-
"
|
|
6339
|
+
"Approvals are disabled. Set approvalMode to 'poll' or 'throw' (or ZAPIER_APPROVAL_MODE) to enable.",
|
|
6342
6340
|
{ status: "approval_required" }
|
|
6343
6341
|
);
|
|
6344
6342
|
}
|
|
@@ -6348,7 +6346,7 @@ var ZapierApiClient = class {
|
|
|
6348
6346
|
{ statusCode: 403 }
|
|
6349
6347
|
);
|
|
6350
6348
|
}
|
|
6351
|
-
await this.runOneApprovalRound(init.approvalContext);
|
|
6349
|
+
await this.runOneApprovalRound(init.approvalContext, mode);
|
|
6352
6350
|
}
|
|
6353
6351
|
throw new ZapierApprovalError(
|
|
6354
6352
|
`Exceeded maximum approval retries (${maxRetries}) for ${path}`,
|
|
@@ -6667,10 +6665,13 @@ var ZapierApiClient = class {
|
|
|
6667
6665
|
}
|
|
6668
6666
|
/**
|
|
6669
6667
|
* Run a single approval round: create the approval, open the URL (poll mode)
|
|
6670
|
-
* or throw (
|
|
6668
|
+
* or throw (throw mode), poll until resolved, and emit events. Throws on
|
|
6671
6669
|
* denied/timeout/unexpected status. Returns on approved.
|
|
6670
|
+
*
|
|
6671
|
+
* Caller is responsible for passing a non-"disabled" mode; this method
|
|
6672
|
+
* unconditionally creates an approval.
|
|
6672
6673
|
*/
|
|
6673
|
-
async runOneApprovalRound(buildContext) {
|
|
6674
|
+
async runOneApprovalRound(buildContext, mode) {
|
|
6674
6675
|
const context = buildContext();
|
|
6675
6676
|
let approvalResponse;
|
|
6676
6677
|
try {
|
|
@@ -6745,8 +6746,7 @@ var ZapierApiClient = class {
|
|
|
6745
6746
|
approvalId: approval.approval_id,
|
|
6746
6747
|
approvalUrl: approval.approval_url
|
|
6747
6748
|
});
|
|
6748
|
-
|
|
6749
|
-
if (approvalMode === "fail") {
|
|
6749
|
+
if (mode === "throw") {
|
|
6750
6750
|
throw new ZapierApprovalError("This request requires approval.", {
|
|
6751
6751
|
approvalId: approval.approval_id,
|
|
6752
6752
|
approvalUrl: approval.approval_url,
|
|
@@ -6845,7 +6845,6 @@ var apiPlugin = definePlugin(
|
|
|
6845
6845
|
debug = false,
|
|
6846
6846
|
maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES,
|
|
6847
6847
|
maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS,
|
|
6848
|
-
isInteractive,
|
|
6849
6848
|
approvalTimeoutMs,
|
|
6850
6849
|
maxApprovalRetries,
|
|
6851
6850
|
approvalMode,
|
|
@@ -6860,7 +6859,6 @@ var apiPlugin = definePlugin(
|
|
|
6860
6859
|
onEvent,
|
|
6861
6860
|
maxNetworkRetries,
|
|
6862
6861
|
maxNetworkRetryDelayMs,
|
|
6863
|
-
isInteractive,
|
|
6864
6862
|
approvalTimeoutMs,
|
|
6865
6863
|
maxApprovalRetries,
|
|
6866
6864
|
approvalMode,
|
|
@@ -8746,16 +8744,13 @@ var BaseSdkOptionsSchema = zod.z.object({
|
|
|
8746
8744
|
* Default is 60000 (60 seconds).
|
|
8747
8745
|
*/
|
|
8748
8746
|
maxNetworkRetryDelayMs: zod.z.number().optional().describe("Max delay in ms to wait for retry (default: 60000).").meta({ valueHint: "ms" }),
|
|
8749
|
-
|
|
8750
|
-
"Whether this session is interactive (user can visit approval URLs). Defaults to ZAPIER_IS_INTERACTIVE env var."
|
|
8751
|
-
).meta({ internal: true }),
|
|
8752
|
-
approvalTimeoutMs: zod.z.number().optional().describe("Timeout in ms for approval polling. Default: 600000 (10 min).").meta({ valueHint: "ms", internal: true }),
|
|
8747
|
+
approvalTimeoutMs: zod.z.number().optional().describe("Timeout in ms for approval polling. Default: 600000 (10 min).").meta({ valueHint: "ms" }),
|
|
8753
8748
|
maxApprovalRetries: zod.z.number().optional().describe(
|
|
8754
8749
|
"Maximum number of sequential approval rounds per request (one per gating policy) before giving up. Default: 2."
|
|
8755
|
-
)
|
|
8756
|
-
approvalMode: zod.z.enum(["poll", "
|
|
8757
|
-
'Approval flow behavior. "poll" opens browser and
|
|
8758
|
-
)
|
|
8750
|
+
),
|
|
8751
|
+
approvalMode: zod.z.enum(["disabled", "poll", "throw"]).optional().describe(
|
|
8752
|
+
'Approval flow behavior. "disabled" (default) throws a ZapierApprovalError on approval-required responses without creating an approval. "poll" creates the approval, opens it in a browser, polls until resolved, and retries the original request. "throw" creates the approval and throws a ZapierApprovalError with the approval URL so the caller can surface it. Defaults to the ZAPIER_APPROVAL_MODE env var, then "disabled".'
|
|
8753
|
+
),
|
|
8759
8754
|
// Internal
|
|
8760
8755
|
manifestPath: zod.z.string().optional().describe("Path to a .zapierrc manifest file for app version locking.").meta({ internal: true }),
|
|
8761
8756
|
manifest: zod.z.custom().optional().describe("Manifest for app version locking.").meta({ internal: true }),
|
|
@@ -8912,7 +8907,6 @@ exports.getTablePlugin = getTablePlugin;
|
|
|
8912
8907
|
exports.getTableRecordPlugin = getTableRecordPlugin;
|
|
8913
8908
|
exports.getTokenFromCliLogin = getTokenFromCliLogin;
|
|
8914
8909
|
exports.getZapierApprovalMode = getZapierApprovalMode;
|
|
8915
|
-
exports.getZapierIsInteractive = getZapierIsInteractive;
|
|
8916
8910
|
exports.getZapierSdkService = getZapierSdkService;
|
|
8917
8911
|
exports.injectCliLogin = injectCliLogin;
|
|
8918
8912
|
exports.inputFieldKeyResolver = inputFieldKeyResolver;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { u as Action, d as ActionEntry, ce as ActionExecutionOptions, y as ActionExecutionResult, z as ActionField, H as ActionFieldChoice, aS as ActionItem, bt as ActionKeyProperty, b1 as ActionKeyPropertySchema, bu as ActionProperty, b2 as ActionPropertySchema, aq as ActionResolverItem, bF as ActionTimeoutMsProperty, bd as ActionTimeoutMsPropertySchema, ar as ActionTypeItem, bs as ActionTypeProperty, b0 as ActionTypePropertySchema, b as AddActionEntryOptions, c as AddActionEntryResult, A as ApiClient, bS as ApiError, dz as ApiEvent, cY as ApiPluginOptions, c_ as ApiPluginProvides, v as App, cf as AppFactoryInput, aQ as AppItem, bq as AppKeyProperty, a_ as AppKeyPropertySchema, br as AppProperty, a$ as AppPropertySchema, az as ApplicationLifecycleEventData, c7 as ApprovalStatus, cd as AppsPluginProvides, bK as AppsProperty, bi as AppsPropertySchema, a0 as ArrayResolver, dy as AuthEvent, by as AuthenticationIdProperty, b5 as AuthenticationIdPropertySchema, av as BaseEvent, aj as BaseSdkOptionsSchema, a8 as BatchOptions, cL as CONTEXT_CACHE_MAX_SIZE, cK as CONTEXT_CACHE_TTL_MS, x as Choice, dF as ClientCredentialsObject, dQ as ClientCredentialsObjectSchema, K as Connection, dY as ConnectionEntry, dX as ConnectionEntrySchema, bw as ConnectionIdProperty, b4 as ConnectionIdPropertySchema, aR as ConnectionItem, bx as ConnectionProperty, b6 as ConnectionPropertySchema, d_ as ConnectionsMap, dZ as ConnectionsMapSchema, e0 as ConnectionsPluginProvides, bM as ConnectionsProperty, bk as ConnectionsPropertySchema, O as ConnectionsResponse, cx as CreateClientCredentialsPluginProvides,
|
|
1
|
+
export { u as Action, d as ActionEntry, ce as ActionExecutionOptions, y as ActionExecutionResult, z as ActionField, H as ActionFieldChoice, aS as ActionItem, bt as ActionKeyProperty, b1 as ActionKeyPropertySchema, bu as ActionProperty, b2 as ActionPropertySchema, aq as ActionResolverItem, bF as ActionTimeoutMsProperty, bd as ActionTimeoutMsPropertySchema, ar as ActionTypeItem, bs as ActionTypeProperty, b0 as ActionTypePropertySchema, b as AddActionEntryOptions, c as AddActionEntryResult, A as ApiClient, bS as ApiError, dz as ApiEvent, cY as ApiPluginOptions, c_ as ApiPluginProvides, v as App, cf as AppFactoryInput, aQ as AppItem, bq as AppKeyProperty, a_ as AppKeyPropertySchema, br as AppProperty, a$ as AppPropertySchema, az as ApplicationLifecycleEventData, c7 as ApprovalStatus, cd as AppsPluginProvides, bK as AppsProperty, bi as AppsPropertySchema, a0 as ArrayResolver, dy as AuthEvent, by as AuthenticationIdProperty, b5 as AuthenticationIdPropertySchema, av as BaseEvent, aj as BaseSdkOptionsSchema, a8 as BatchOptions, cL as CONTEXT_CACHE_MAX_SIZE, cK as CONTEXT_CACHE_TTL_MS, x as Choice, dF as ClientCredentialsObject, dQ as ClientCredentialsObjectSchema, K as Connection, dY as ConnectionEntry, dX as ConnectionEntrySchema, bw as ConnectionIdProperty, b4 as ConnectionIdPropertySchema, aR as ConnectionItem, bx as ConnectionProperty, b6 as ConnectionPropertySchema, d_ as ConnectionsMap, dZ as ConnectionsMapSchema, e0 as ConnectionsPluginProvides, bM as ConnectionsProperty, bk as ConnectionsPropertySchema, O as ConnectionsResponse, cx as CreateClientCredentialsPluginProvides, em as CreateTableFieldsPluginProvides, eg as CreateTablePluginProvides, eu 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, e9 as DEFAULT_APPROVAL_TIMEOUT_MS, cU as DEFAULT_CONFIG_PATH, ea as DEFAULT_MAX_APPROVAL_RETRIES, e4 as DEFAULT_PAGE_SIZE, bD as DebugProperty, bb as DebugPropertySchema, cz as DeleteClientCredentialsPluginProvides, eo as DeleteTableFieldsPluginProvides, ei as DeleteTablePluginProvides, ew as DeleteTableRecordsPluginProvides, o as DrainTriggerInboxCallback, p as DrainTriggerInboxErrorObserver, D as DrainTriggerInboxOptions, i as DynamicResolver, aA as EnhancedErrorEventData, bT as ErrorOptions, dB as EventCallback, ay as EventContext, E as EventEmissionContext, ax as EventEmissionProvides, ch as FetchPluginProvides, w as Field, bJ as FieldsProperty, bh as FieldsPropertySchema, a3 as FieldsResolver, F as FieldsetItem, s as FindFirstAuthenticationPluginProvides, cH as FindFirstConnectionPluginProvides, t as FindUniqueAuthenticationPluginProvides, cJ as FindUniqueConnectionPluginProvides, Y as FormatMetadata, X as FormattedItem, ai as FunctionDeprecation, aX as FunctionOptions, ah as FunctionRegistryEntry, cr as GetActionInputFieldsSchemaPluginProvides, cD as GetActionPluginProvides, cB as GetAppPluginProvides, G as GetAuthenticationPluginProvides, cF as GetConnectionPluginProvides, cX as GetProfilePluginProvides, ee as GetTablePluginProvides, eq as GetTableRecordPluginProvides, aU as InfoFieldItem, aT as InputFieldItem, bv as InputFieldProperty, b3 as InputFieldPropertySchema, bz as InputsProperty, b7 as InputsPropertySchema, bR as LeaseLimitProperty, bp as LeaseLimitPropertySchema, bP as LeaseProperty, bn as LeasePropertySchema, bQ as LeaseSecondsProperty, bo as LeaseSecondsPropertySchema, L as LeasedTriggerMessageItem, bA as LimitProperty, b8 as LimitPropertySchema, cp as ListActionInputFieldChoicesPluginProvides, cn as ListActionInputFieldsPluginProvides, cl as ListActionsPluginProvides, cj as ListAppsPluginProvides, q as ListAuthenticationsPluginProvides, cv as ListClientCredentialsPluginProvides, ct as ListConnectionsPluginProvides, ek as ListTableFieldsPluginProvides, es as ListTableRecordsPluginProvides, ec as ListTablesPluginProvides, dA as LoadingEvent, e3 as MAX_PAGE_LIMIT, M as Manifest, cV as ManifestEntry, cQ as ManifestPluginOptions, cT as ManifestPluginProvides, aw as MethodCalledEvent, aB as MethodCalledEventData, N as Need, I as NeedsRequest, J as NeedsResponse, bB as OffsetProperty, b9 as OffsetPropertySchema, _ as OutputFormatter, bC as OutputProperty, ba as OutputPropertySchema, aZ as PaginatedSdkFunction, e as PaginatedSdkResult, bE as ParamsProperty, bc as ParamsPropertySchema, dG as PkceCredentialsObject, dR as PkceCredentialsObjectSchema, ak as Plugin, P as PluginMeta, al as PluginProvides, at as PollOptions, g as PositionalMetadata, c5 as RateLimitInfo, bH as RecordProperty, bf as RecordPropertySchema, bI as RecordsProperty, bg as RecordsPropertySchema, ad as RelayFetchSchema, ac as RelayRequestSchema, as as RequestOptions, cP as RequestPluginProvides, dk as ResolveAuthTokenOptions, dL as ResolveCredentialsOptions, R as ResolvedAppLocator, dD as ResolvedCredentials, dT as ResolvedCredentialsSchema, $ as Resolver, a1 as ResolverMetadata, aV as RootFieldItem, cN as RunActionPluginProvides, dx as SdkEvent, aY as SdkPage, a2 as StaticResolver, bG as TableProperty, be as TablePropertySchema, bL as TablesProperty, bj as TablesPropertySchema, bO as TriggerInboxNameProperty, bm as TriggerInboxNamePropertySchema, bN as TriggerInboxProperty, bl as TriggerInboxPropertySchema, T as TriggerMessageStatus, U as UpdateManifestEntryOptions, a as UpdateManifestEntryResult, ey as UpdateTableRecordsPluginProvides, Q as UserProfile, aW as UserProfileItem, j as WatchTriggerInboxOptions, W as WithAddPlugin, e1 as ZAPIER_BASE_URL, e6 as ZAPIER_MAX_NETWORK_RETRIES, e7 as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, m as ZapierAbortDrainSignal, c3 as ZapierActionError, bV as ZapierApiError, bW as ZapierAppNotFoundError, c8 as ZapierApprovalError, bZ as ZapierAuthenticationError, c1 as ZapierBundleError, dt as ZapierCache, du as ZapierCacheEntry, dv as ZapierCacheSetOptions, c0 as ZapierConfigurationError, c4 as ZapierConflictError, bU as ZapierError, h as ZapierFetchInitOptions, b_ as ZapierNotFoundError, c6 as ZapierRateLimitError, c9 as ZapierRelayError, n as ZapierReleaseTriggerMessageSignal, b$ as ZapierResourceNotFoundError, eA as ZapierSdk, l as ZapierSdkApps, Z as ZapierSdkOptions, cb as ZapierSignal, c2 as ZapierTimeoutError, bY as ZapierUnknownError, bX as ZapierValidationError, d1 as actionKeyResolver, d0 as actionTypeResolver, cZ as apiPlugin, c$ as appKeyResolver, cc as appsPlugin, d3 as authenticationIdGenericResolver, d2 as authenticationIdResolver, a7 as batch, aL as buildApplicationLifecycleEvent, a9 as buildCapabilityMessage, aN as buildErrorEvent, aM as buildErrorEventWithContext, aP as buildMethodCalledEvent, dl as clearTokenCache, d7 as clientCredentialsNameResolver, d8 as clientIdResolver, ap as composePlugins, d3 as connectionIdGenericResolver, d2 as connectionIdResolver, d$ as connectionsPlugin, aO as createBaseEvent, cw as createClientCredentialsPlugin, V as createFunction, dw as createMemoryCache, ag as createOptionsPlugin, ao as createPaginatedPluginMethod, an as createPluginMethod, af as createSdk, el as createTableFieldsPlugin, ef as createTablePlugin, et as createTableRecordsPlugin, ez as createZapierSdk, ae as createZapierSdkWithoutRegistry, am as definePlugin, cy as deleteClientCredentialsPlugin, en as deleteTableFieldsPlugin, eh as deleteTablePlugin, ev as deleteTableRecordsPlugin, cg as fetchPlugin, cG as findFirstConnectionPlugin, f as findManifestEntry, cI as findUniqueConnectionPlugin, ca as formatErrorMessage, aC as generateEventId, cq as getActionInputFieldsSchemaPlugin, cC as getActionPlugin, cA as getAppPlugin, dO as getBaseUrlFromCredentials, aI as getCiPlatform, dP as getClientIdFromCredentials, cE as getConnectionPlugin, aK as getCpuTime, aD as getCurrentTimestamp, aJ as getMemoryUsage, aF as getOsInfo, aG as getPlatformVersions, cR as getPreferredManifestEntryKey, cW as getProfilePlugin, aE as getReleaseId, ed as getTablePlugin, ep as getTableRecordPlugin, dq as getTokenFromCliLogin, e8 as getZapierApprovalMode, e2 as getZapierSdkService, dn as injectCliLogin, d6 as inputFieldKeyResolver, d5 as inputsAllOptionalResolver, d4 as inputsResolver, dm as invalidateCachedToken, ds as invalidateCredentialsToken, aH as isCi, dp as isCliLoginAvailable, dH as isClientCredentials, dK as isCredentialsFunction, dJ as isCredentialsObject, dI as isPkceCredentials, S as isPositional, co as listActionInputFieldChoicesPlugin, cm as listActionInputFieldsPlugin, ck as listActionsPlugin, ci as listAppsPlugin, cu as listClientCredentialsPlugin, cs as listConnectionsPlugin, ej as listTableFieldsPlugin, er as listTableRecordsPlugin, eb as listTablesPlugin, aa as logDeprecation, cS as manifestPlugin, r as readManifestFromFile, au as registryPlugin, cO as requestPlugin, ab as resetDeprecationWarnings, dr as resolveAuthToken, dN as resolveCredentials, dM as resolveCredentialsFromEnv, cM as runActionPlugin, a4 as runWithTelemetryContext, dd as tableFieldIdsResolver, df as tableFieldsResolver, di as tableFiltersResolver, d9 as tableIdResolver, de as tableNameResolver, db as tableRecordIdResolver, dc as tableRecordIdsResolver, dg as tableRecordsResolver, dj as tableSortResolver, dh as tableUpdateRecordsResolver, a5 as toSnakeCase, a6 as toTitleCase, da as triggerInboxResolver, ex as updateTableRecordsPlugin } from './index-BQ2ii0Bs.mjs';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '@zapier/zapier-sdk-core/v0/schemas/connections';
|
|
4
4
|
import '@zapier/policy-context';
|
package/dist/index.mjs
CHANGED
|
@@ -61,12 +61,10 @@ function parseIntEnvVar(name) {
|
|
|
61
61
|
}
|
|
62
62
|
var ZAPIER_MAX_NETWORK_RETRIES = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRIES") ?? 3;
|
|
63
63
|
var ZAPIER_MAX_NETWORK_RETRY_DELAY_MS = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRY_DELAY_MS") ?? 6e4;
|
|
64
|
-
function getZapierIsInteractive() {
|
|
65
|
-
return globalThis.process?.env?.ZAPIER_IS_INTERACTIVE === "true";
|
|
66
|
-
}
|
|
67
64
|
function getZapierApprovalMode() {
|
|
68
65
|
const value = globalThis.process?.env?.ZAPIER_APPROVAL_MODE;
|
|
69
|
-
if (value === "
|
|
66
|
+
if (value === "disabled" || value === "poll" || value === "throw")
|
|
67
|
+
return value;
|
|
70
68
|
return void 0;
|
|
71
69
|
}
|
|
72
70
|
var DEFAULT_APPROVAL_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
@@ -6058,7 +6056,7 @@ async function invalidateCredentialsToken(options) {
|
|
|
6058
6056
|
}
|
|
6059
6057
|
|
|
6060
6058
|
// src/sdk-version.ts
|
|
6061
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
6059
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.50.0" : void 0) || "unknown";
|
|
6062
6060
|
|
|
6063
6061
|
// src/utils/open-url.ts
|
|
6064
6062
|
var nodePrefix = "node:";
|
|
@@ -6333,10 +6331,10 @@ var ZapierApiClient = class {
|
|
|
6333
6331
|
}
|
|
6334
6332
|
if (errorType !== "approval_required") return response;
|
|
6335
6333
|
if (attempt === maxRetries) break;
|
|
6336
|
-
const
|
|
6337
|
-
if (
|
|
6334
|
+
const mode = this.options.approvalMode ?? getZapierApprovalMode() ?? "disabled";
|
|
6335
|
+
if (mode === "disabled") {
|
|
6338
6336
|
throw new ZapierApprovalError(
|
|
6339
|
-
"
|
|
6337
|
+
"Approvals are disabled. Set approvalMode to 'poll' or 'throw' (or ZAPIER_APPROVAL_MODE) to enable.",
|
|
6340
6338
|
{ status: "approval_required" }
|
|
6341
6339
|
);
|
|
6342
6340
|
}
|
|
@@ -6346,7 +6344,7 @@ var ZapierApiClient = class {
|
|
|
6346
6344
|
{ statusCode: 403 }
|
|
6347
6345
|
);
|
|
6348
6346
|
}
|
|
6349
|
-
await this.runOneApprovalRound(init.approvalContext);
|
|
6347
|
+
await this.runOneApprovalRound(init.approvalContext, mode);
|
|
6350
6348
|
}
|
|
6351
6349
|
throw new ZapierApprovalError(
|
|
6352
6350
|
`Exceeded maximum approval retries (${maxRetries}) for ${path}`,
|
|
@@ -6665,10 +6663,13 @@ var ZapierApiClient = class {
|
|
|
6665
6663
|
}
|
|
6666
6664
|
/**
|
|
6667
6665
|
* Run a single approval round: create the approval, open the URL (poll mode)
|
|
6668
|
-
* or throw (
|
|
6666
|
+
* or throw (throw mode), poll until resolved, and emit events. Throws on
|
|
6669
6667
|
* denied/timeout/unexpected status. Returns on approved.
|
|
6668
|
+
*
|
|
6669
|
+
* Caller is responsible for passing a non-"disabled" mode; this method
|
|
6670
|
+
* unconditionally creates an approval.
|
|
6670
6671
|
*/
|
|
6671
|
-
async runOneApprovalRound(buildContext) {
|
|
6672
|
+
async runOneApprovalRound(buildContext, mode) {
|
|
6672
6673
|
const context = buildContext();
|
|
6673
6674
|
let approvalResponse;
|
|
6674
6675
|
try {
|
|
@@ -6743,8 +6744,7 @@ var ZapierApiClient = class {
|
|
|
6743
6744
|
approvalId: approval.approval_id,
|
|
6744
6745
|
approvalUrl: approval.approval_url
|
|
6745
6746
|
});
|
|
6746
|
-
|
|
6747
|
-
if (approvalMode === "fail") {
|
|
6747
|
+
if (mode === "throw") {
|
|
6748
6748
|
throw new ZapierApprovalError("This request requires approval.", {
|
|
6749
6749
|
approvalId: approval.approval_id,
|
|
6750
6750
|
approvalUrl: approval.approval_url,
|
|
@@ -6843,7 +6843,6 @@ var apiPlugin = definePlugin(
|
|
|
6843
6843
|
debug = false,
|
|
6844
6844
|
maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES,
|
|
6845
6845
|
maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS,
|
|
6846
|
-
isInteractive,
|
|
6847
6846
|
approvalTimeoutMs,
|
|
6848
6847
|
maxApprovalRetries,
|
|
6849
6848
|
approvalMode,
|
|
@@ -6858,7 +6857,6 @@ var apiPlugin = definePlugin(
|
|
|
6858
6857
|
onEvent,
|
|
6859
6858
|
maxNetworkRetries,
|
|
6860
6859
|
maxNetworkRetryDelayMs,
|
|
6861
|
-
isInteractive,
|
|
6862
6860
|
approvalTimeoutMs,
|
|
6863
6861
|
maxApprovalRetries,
|
|
6864
6862
|
approvalMode,
|
|
@@ -8744,16 +8742,13 @@ var BaseSdkOptionsSchema = z.object({
|
|
|
8744
8742
|
* Default is 60000 (60 seconds).
|
|
8745
8743
|
*/
|
|
8746
8744
|
maxNetworkRetryDelayMs: z.number().optional().describe("Max delay in ms to wait for retry (default: 60000).").meta({ valueHint: "ms" }),
|
|
8747
|
-
|
|
8748
|
-
"Whether this session is interactive (user can visit approval URLs). Defaults to ZAPIER_IS_INTERACTIVE env var."
|
|
8749
|
-
).meta({ internal: true }),
|
|
8750
|
-
approvalTimeoutMs: z.number().optional().describe("Timeout in ms for approval polling. Default: 600000 (10 min).").meta({ valueHint: "ms", internal: true }),
|
|
8745
|
+
approvalTimeoutMs: z.number().optional().describe("Timeout in ms for approval polling. Default: 600000 (10 min).").meta({ valueHint: "ms" }),
|
|
8751
8746
|
maxApprovalRetries: z.number().optional().describe(
|
|
8752
8747
|
"Maximum number of sequential approval rounds per request (one per gating policy) before giving up. Default: 2."
|
|
8753
|
-
)
|
|
8754
|
-
approvalMode: z.enum(["poll", "
|
|
8755
|
-
'Approval flow behavior. "poll" opens browser and
|
|
8756
|
-
)
|
|
8748
|
+
),
|
|
8749
|
+
approvalMode: z.enum(["disabled", "poll", "throw"]).optional().describe(
|
|
8750
|
+
'Approval flow behavior. "disabled" (default) throws a ZapierApprovalError on approval-required responses without creating an approval. "poll" creates the approval, opens it in a browser, polls until resolved, and retries the original request. "throw" creates the approval and throws a ZapierApprovalError with the approval URL so the caller can surface it. Defaults to the ZAPIER_APPROVAL_MODE env var, then "disabled".'
|
|
8751
|
+
),
|
|
8757
8752
|
// Internal
|
|
8758
8753
|
manifestPath: z.string().optional().describe("Path to a .zapierrc manifest file for app version locking.").meta({ internal: true }),
|
|
8759
8754
|
manifest: z.custom().optional().describe("Manifest for app version locking.").meta({ internal: true }),
|
|
@@ -8778,4 +8773,4 @@ var registryPlugin = definePlugin((_sdk) => {
|
|
|
8778
8773
|
return {};
|
|
8779
8774
|
});
|
|
8780
8775
|
|
|
8781
|
-
export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode,
|
|
8776
|
+
export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, updateTableRecordsPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAStD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAE3D,eAAO,MAAM,SAAS;aACH;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAStD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAE3D,eAAO,MAAM,SAAS;aACH;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;CA6C7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { resolveCredentials } from "../../credentials";
|
|
|
4
4
|
import { ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, } from "../../constants";
|
|
5
5
|
export const apiPlugin = definePlugin((sdk) => {
|
|
6
6
|
// Extract all options - everything passed to the plugin
|
|
7
|
-
const { fetch: customFetch = globalThis.fetch, baseUrl = ZAPIER_BASE_URL, credentials, token, onEvent, debug = false, maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES, maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS,
|
|
7
|
+
const { fetch: customFetch = globalThis.fetch, baseUrl = ZAPIER_BASE_URL, credentials, token, onEvent, debug = false, maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES, maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, approvalTimeoutMs, maxApprovalRetries, approvalMode, callerPackage, } = sdk.context.options;
|
|
8
8
|
// Create the API client - it will handle token resolution internally
|
|
9
9
|
const api = createZapierApi({
|
|
10
10
|
baseUrl,
|
|
@@ -15,7 +15,6 @@ export const apiPlugin = definePlugin((sdk) => {
|
|
|
15
15
|
onEvent,
|
|
16
16
|
maxNetworkRetries,
|
|
17
17
|
maxNetworkRetryDelayMs,
|
|
18
|
-
isInteractive,
|
|
19
18
|
approvalTimeoutMs,
|
|
20
19
|
maxApprovalRetries,
|
|
21
20
|
approvalMode,
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -194,15 +194,15 @@ export declare class ZapierRateLimitError extends ZapierError {
|
|
|
194
194
|
* Terminal status of an approval attempt, exposed on `ZapierApprovalError.approvalStatus`.
|
|
195
195
|
*
|
|
196
196
|
* - `pending`: The approval was created but not yet resolved. Only thrown in
|
|
197
|
-
* `approvalMode: "
|
|
197
|
+
* `approvalMode: "throw"` — the caller is expected to surface the approval URL
|
|
198
198
|
* to an end user (e.g. an LLM instructing its user to click the link).
|
|
199
199
|
* - `denied`: A human explicitly rejected the approval in the UI.
|
|
200
200
|
* - `policy_denied`: A policy rule blocked the request before (or instead of)
|
|
201
201
|
* creating an approval. Cannot be approved by a human.
|
|
202
|
-
* - `approval_required`: The backend requested approval, but
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
202
|
+
* - `approval_required`: The backend requested approval, but `approvalMode` is
|
|
203
|
+
* `"disabled"` (the default) so the SDK did not create an approval. Set
|
|
204
|
+
* `approvalMode` to `"poll"` or `"throw"` (or the `ZAPIER_APPROVAL_MODE` env
|
|
205
|
+
* var) to enable the approval flow.
|
|
206
206
|
* - `timeout`: Poll mode exceeded `approvalTimeoutMs` without the approval
|
|
207
207
|
* being resolved.
|
|
208
208
|
* - `max_retries_exceeded`: A single request triggered more sequential approval
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -58,12 +58,12 @@ export declare const BaseSdkOptionsSchema: z.ZodObject<{
|
|
|
58
58
|
trackingBaseUrl: z.ZodOptional<z.ZodString>;
|
|
59
59
|
maxNetworkRetries: z.ZodOptional<z.ZodNumber>;
|
|
60
60
|
maxNetworkRetryDelayMs: z.ZodOptional<z.ZodNumber>;
|
|
61
|
-
isInteractive: z.ZodOptional<z.ZodBoolean>;
|
|
62
61
|
approvalTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
63
62
|
maxApprovalRetries: z.ZodOptional<z.ZodNumber>;
|
|
64
63
|
approvalMode: z.ZodOptional<z.ZodEnum<{
|
|
64
|
+
disabled: "disabled";
|
|
65
65
|
poll: "poll";
|
|
66
|
-
|
|
66
|
+
throw: "throw";
|
|
67
67
|
}>>;
|
|
68
68
|
manifestPath: z.ZodOptional<z.ZodString>;
|
|
69
69
|
manifest: z.ZodOptional<z.ZodCustom<Manifest, Manifest>>;
|
package/dist/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/types/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/types/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuEb,MAAM;iBAAW,MAAM;;cAAvB,MAAM;iBAAW,MAAM;;;;;;;iBAiBzC,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGlE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AACjG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC/F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAG7E,MAAM,WAAW,kBACf,SAAQ,gCAAgC,EACtC,wBAAwB,EACxB,8BAA8B,EAC9B,+BAA+B,EAC/B,uBAAuB;CAAG"}
|