@zapier/zapier-sdk 0.73.1 → 0.74.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.74.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 571f90d: Add zapier-sdk-package-operation header to identify the caller operation
8
+
3
9
  ## 0.73.1
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAIjB,MAAM,SAAS,CAAC;AAokDjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAIjB,MAAM,SAAS,CAAC;AA0kDjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,CAAC"}
@@ -13,6 +13,7 @@ import { getZapierBaseUrl, isLocalhostBaseUrl } from "../utils/url-utils";
13
13
  import { sleep, calculateExponentialBackoffMs } from "../utils/retry-utils";
14
14
  import { isPlainObject } from "../utils/type-guard-utils";
15
15
  import { isAbortError } from "../utils/abort-utils";
16
+ import { getCallerContext } from "../utils/caller-context";
16
17
  import { createSseParserStream, jsonFrames, } from "./sse-parser";
17
18
  import { consumeApprovalReviewStream } from "./approval-review-stream";
18
19
  import { ZapierApiError, ZapierApprovalError, ZapierAuthenticationError, ZapierConfigurationError, ZapierTimeoutError, ZapierValidationError, ZapierResourceNotFoundError, ZapierRateLimitError, } from "../types/errors";
@@ -771,6 +772,10 @@ class ZapierApiClient {
771
772
  headers.set("x-zapier-sdk-package", callerPackage.name);
772
773
  headers.set("zapier-sdk-package-version", callerPackage.version);
773
774
  headers.set("x-zapier-sdk-package-version", callerPackage.version);
775
+ const { packageOperation } = getCallerContext();
776
+ if (packageOperation) {
777
+ headers.set("zapier-sdk-package-operation", packageOperation);
778
+ }
774
779
  }
775
780
  }
776
781
  // Helper to perform HTTP requests with JSON handling
@@ -475,22 +475,34 @@ function createValidator(schema, { adaptError } = {}) {
475
475
  };
476
476
  }
477
477
  var validateOptions = (schema, options, { adaptError } = {}) => parseOrThrow(schema, options, { adaptError });
478
- var scopeStore = null;
479
- try {
480
- scopeStore = new async_hooks.AsyncLocalStorage();
481
- } catch {
478
+ function createAsyncContext() {
479
+ let store = null;
480
+ try {
481
+ store = new async_hooks.AsyncLocalStorage();
482
+ } catch {
483
+ store = null;
484
+ }
485
+ return {
486
+ available: store !== null,
487
+ run(value, fn) {
488
+ return store ? store.run(value, fn) : fn();
489
+ },
490
+ get() {
491
+ return store?.getStore();
492
+ }
493
+ };
482
494
  }
495
+ var scope = createAsyncContext();
483
496
  function getCurrentScope() {
484
- if (!scopeStore) return void 0;
485
- return scopeStore.getStore();
497
+ return scope.get();
486
498
  }
487
499
  function getCurrentDepth() {
488
500
  return getCurrentScope()?.depth ?? 0;
489
501
  }
490
502
  function runInMethodScope(fn) {
491
- if (!scopeStore) return fn();
492
- const currentDepth = scopeStore.getStore()?.depth ?? -1;
493
- return scopeStore.run({ depth: currentDepth + 1 }, fn);
503
+ if (!scope.available) return fn();
504
+ const currentDepth = scope.get()?.depth ?? -1;
505
+ return scope.run({ depth: currentDepth + 1 }, fn);
494
506
  }
495
507
  var runWithTelemetryContext = runInMethodScope;
496
508
  function normalizeError(error, adaptError) {
@@ -2868,10 +2880,10 @@ function mergeScopes(credentialsScope, requiredScopes) {
2868
2880
  return [...scopeSet].sort();
2869
2881
  }
2870
2882
  async function exchangeClientCredentials(options) {
2871
- const { clientId, clientSecret, baseUrl, scope, requiredScopes, onEvent } = options;
2883
+ const { clientId, clientSecret, baseUrl, scope: scope2, requiredScopes, onEvent } = options;
2872
2884
  const fetchFn = options.fetch || globalThis.fetch;
2873
2885
  const tokenUrl = getTokenEndpointUrl(baseUrl);
2874
- const mergedScopes = mergeScopes(scope, requiredScopes);
2886
+ const mergedScopes = mergeScopes(scope2, requiredScopes);
2875
2887
  const scopeString = mergedScopes.join(" ");
2876
2888
  onEvent?.({
2877
2889
  type: "auth_exchanging",
@@ -3136,6 +3148,25 @@ async function invalidateCredentialsToken(options) {
3136
3148
  }
3137
3149
  }
3138
3150
 
3151
+ // src/utils/caller-context.ts
3152
+ var callerContext = createAsyncContext();
3153
+ function runWithCallerContext(context, fn) {
3154
+ let parent;
3155
+ try {
3156
+ parent = callerContext.get() ?? {};
3157
+ } catch {
3158
+ return fn();
3159
+ }
3160
+ return callerContext.run({ ...parent, ...context }, fn);
3161
+ }
3162
+ function getCallerContext() {
3163
+ try {
3164
+ return callerContext.get() ?? {};
3165
+ } catch {
3166
+ return {};
3167
+ }
3168
+ }
3169
+
3139
3170
  // src/api/sse-parser.ts
3140
3171
  async function* jsonFrames(source) {
3141
3172
  for await (const { data } of source) {
@@ -3287,7 +3318,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
3287
3318
  }
3288
3319
 
3289
3320
  // src/sdk-version.ts
3290
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.73.1" : void 0) || "unknown";
3321
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.74.0" : void 0) || "unknown";
3291
3322
 
3292
3323
  // src/utils/open-url.ts
3293
3324
  var nodePrefix = "node:";
@@ -4011,6 +4042,10 @@ var ZapierApiClient = class {
4011
4042
  headers.set("x-zapier-sdk-package", callerPackage.name);
4012
4043
  headers.set("zapier-sdk-package-version", callerPackage.version);
4013
4044
  headers.set("x-zapier-sdk-package-version", callerPackage.version);
4045
+ const { packageOperation } = getCallerContext();
4046
+ if (packageOperation) {
4047
+ headers.set("zapier-sdk-package-operation", packageOperation);
4048
+ }
4014
4049
  }
4015
4050
  }
4016
4051
  // Helper to perform HTTP requests with JSON handling
@@ -6086,10 +6121,10 @@ var actionItemFormatter = {
6086
6121
  // src/plugins/eventEmission/method-metadata.ts
6087
6122
  var SCOPE_KEY = "methodMetadata";
6088
6123
  function setMethodMetadata(metadata) {
6089
- const scope = getCurrentScope();
6090
- if (!scope) return;
6091
- const existing = scope[SCOPE_KEY];
6092
- scope[SCOPE_KEY] = { ...existing, ...metadata };
6124
+ const scope2 = getCurrentScope();
6125
+ if (!scope2) return;
6126
+ const existing = scope2[SCOPE_KEY];
6127
+ scope2[SCOPE_KEY] = { ...existing, ...metadata };
6093
6128
  }
6094
6129
  function getMethodMetadata() {
6095
6130
  return getCurrentScope()?.[SCOPE_KEY];
@@ -13327,6 +13362,7 @@ exports.getActionPlugin = getActionPlugin;
13327
13362
  exports.getAgent = getAgent;
13328
13363
  exports.getAppPlugin = getAppPlugin;
13329
13364
  exports.getBaseUrlFromCredentials = getBaseUrlFromCredentials;
13365
+ exports.getCallerContext = getCallerContext;
13330
13366
  exports.getCiPlatform = getCiPlatform;
13331
13367
  exports.getClientIdFromCredentials = getClientIdFromCredentials;
13332
13368
  exports.getConnectionPlugin = getConnectionPlugin;
@@ -13385,6 +13421,7 @@ exports.resolveCredentials = resolveCredentials;
13385
13421
  exports.resolveCredentialsFromEnv = resolveCredentialsFromEnv;
13386
13422
  exports.runActionPlugin = runActionPlugin;
13387
13423
  exports.runInMethodScope = runInMethodScope;
13424
+ exports.runWithCallerContext = runWithCallerContext;
13388
13425
  exports.runWithTelemetryContext = runWithTelemetryContext;
13389
13426
  exports.tableFieldIdsResolver = tableFieldIdsResolver;
13390
13427
  exports.tableFieldsResolver = tableFieldsResolver;
@@ -1,5 +1,5 @@
1
- import { B as BaseSdkOptions, P as PluginStack, a as PluginMeta, M as MethodHooks, C as CoreOptions, Z as ZapierSdkOptions$1, E as EventEmissionContext, A as ApiClient, b as Manifest, R as ResolvedAppLocator, U as UpdateManifestEntryOptions, c as UpdateManifestEntryResult, d as AddActionEntryOptions, e as AddActionEntryResult, f as ActionEntry, g as findManifestEntry, r as readManifestFromFile, h as CapabilitiesContext, i as PaginatedSdkResult, G as GetConnectionStartUrlItem, W as WaitForNewConnectionItem, j as CreateConnectionItem, F as FieldsetItem, k as PositionalMetadata, O as OutputFormatter, l as ZapierFetchInitOptions, D as DrainTriggerInboxOptions, m as DynamicResolver, n as WatchTriggerInboxOptions, o as ActionProxy, p as ZapierSdkApps, q as WithAddPlugin } from './index-D1O7Pcex.mjs';
2
- export { H as Action, cf as ActionExecutionOptions, Q as ActionExecutionResult, S as ActionField, V as ActionFieldChoice, aT as ActionItem, bt as ActionKeyProperty, b1 as ActionKeyPropertySchema, bu as ActionProperty, b2 as ActionPropertySchema, aH as ActionResolverItem, bF as ActionTimeoutMsProperty, bd as ActionTimeoutMsPropertySchema, aI as ActionTypeItem, bs as ActionTypeProperty, b0 as ActionTypePropertySchema, cb as ApiError, dF as ApiEvent, cZ as ApiPluginOptions, c$ as ApiPluginProvides, I as App, cg as AppFactoryInput, aR as AppItem, bq as AppKeyProperty, a_ as AppKeyPropertySchema, br as AppProperty, a$ as AppPropertySchema, eP as ApplicationLifecycleEventData, c7 as ApprovalStatus, ce as AppsPluginProvides, bK as AppsProperty, bi as AppsPropertySchema, a8 as ArrayResolver, dE as AuthEvent, by as AuthenticationIdProperty, b5 as AuthenticationIdPropertySchema, eX as BaseEvent, av as BaseSdkOptionsSchema, aj as BatchOptions, cM as CONTEXT_CACHE_MAX_SIZE, cL as CONTEXT_CACHE_TTL_MS, az as CORE_ERROR_SYMBOL, K as Choice, dL as ClientCredentialsObject, dW as ClientCredentialsObjectSchema, _ as Connection, e2 as ConnectionEntry, e1 as ConnectionEntrySchema, bw as ConnectionIdProperty, b4 as ConnectionIdPropertySchema, aS as ConnectionItem, bx as ConnectionProperty, b6 as ConnectionPropertySchema, e4 as ConnectionsMap, e3 as ConnectionsMapSchema, e6 as ConnectionsPluginProvides, bM as ConnectionsProperty, bk as ConnectionsPropertySchema, $ as ConnectionsResponse, aA as CoreErrorCode, cy as CreateClientCredentialsPluginProvides, ex as CreateTableFieldsPluginProvides, er as CreateTablePluginProvides, eF as CreateTableRecordsPluginProvides, dI as Credentials, d$ as CredentialsFunction, d_ as CredentialsFunctionSchema, dK as CredentialsObject, dY as CredentialsObjectSchema, e0 as CredentialsSchema, eb as DEFAULT_ACTION_TIMEOUT_MS, ek as DEFAULT_APPROVAL_TIMEOUT_MS, cV as DEFAULT_CONFIG_PATH, el as DEFAULT_MAX_APPROVAL_RETRIES, ea as DEFAULT_PAGE_SIZE, bD as DebugProperty, bb as DebugPropertySchema, cA as DeleteClientCredentialsPluginProvides, ez as DeleteTableFieldsPluginProvides, et as DeleteTablePluginProvides, eH as DeleteTableRecordsPluginProvides, u as DrainTriggerInboxCallback, v as DrainTriggerInboxErrorObserver, ab as DynamicListResolver, ac as DynamicSearchResolver, eQ as EnhancedErrorEventData, bS as ErrorOptions, dH as EventCallback, eO as EventContext, eL as EventEmissionConfig, eN as EventEmissionProvides, ci as FetchPluginProvides, J as Field, bJ as FieldsProperty, bh as FieldsPropertySchema, ad as FieldsResolver, y as FindFirstAuthenticationPluginProvides, cI as FindFirstConnectionPluginProvides, z as FindUniqueAuthenticationPluginProvides, cK as FindUniqueConnectionPluginProvides, a6 as FormattedItem, au as FunctionDeprecation, at as FunctionRegistryEntry, cs as GetActionInputFieldsSchemaPluginProvides, cE as GetActionPluginProvides, cC as GetAppPluginProvides, x as GetAuthenticationPluginProvides, cG as GetConnectionPluginProvides, cY as GetProfilePluginProvides, ep as GetTablePluginProvides, eB as GetTableRecordPluginProvides, aV as InfoFieldItem, aU as InputFieldItem, bv as InputFieldProperty, b3 as InputFieldPropertySchema, bz as InputsProperty, b7 as InputsPropertySchema, aQ as JsonSseMessage, 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, cq as ListActionInputFieldChoicesPluginProvides, co as ListActionInputFieldsPluginProvides, cm as ListActionsPluginProvides, ck as ListAppsPluginProvides, w as ListAuthenticationsPluginProvides, cw as ListClientCredentialsPluginProvides, cu as ListConnectionsPluginProvides, ev as ListTableFieldsPluginProvides, eD as ListTableRecordsPluginProvides, en as ListTablesPluginProvides, dG as LoadingEvent, ee as MAX_CONCURRENCY_LIMIT, e9 as MAX_PAGE_LIMIT, cW as ManifestEntry, cR as ManifestPluginOptions, cU as ManifestPluginProvides, eY as MethodCalledEvent, eR as MethodCalledEventData, N as Need, X as NeedsRequest, Y as NeedsResponse, bB as OffsetProperty, b9 as OffsetPropertySchema, bC as OutputProperty, ba as OutputPropertySchema, aZ as PaginatedSdkFunction, bE as ParamsProperty, bc as ParamsPropertySchema, dM as PkceCredentialsObject, dX as PkceCredentialsObjectSchema, aB as Plugin, aC as PluginProvides, aL as PollOptions, c5 as RateLimitInfo, bH as RecordProperty, bf as RecordPropertySchema, bI as RecordsProperty, bg as RecordsPropertySchema, ao as RelayFetchSchema, an as RelayRequestSchema, aK as RequestOptions, cQ as RequestPluginProvides, dr as ResolveAuthTokenOptions, dR as ResolveCredentialsOptions, dJ as ResolvedCredentials, dZ as ResolvedCredentialsSchema, a7 as Resolver, a9 as ResolverMetadata, aW as RootFieldItem, cO as RunActionPluginProvides, dD as SdkEvent, aY as SdkPage, aP as SseMessage, aa 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, eJ as UpdateTableRecordsPluginProvides, a0 as UserProfile, aX as UserProfileItem, e7 as ZAPIER_BASE_URL, eg as ZAPIER_MAX_CONCURRENT_REQUESTS, ec as ZAPIER_MAX_NETWORK_RETRIES, ed as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, s as ZapierAbortDrainSignal, c3 as ZapierActionError, bY as ZapierApiError, bZ as ZapierAppNotFoundError, c8 as ZapierApprovalError, bW as ZapierAuthenticationError, c1 as ZapierBundleError, dz as ZapierCache, dA as ZapierCacheEntry, dB as ZapierCacheSetOptions, c0 as ZapierConfigurationError, c4 as ZapierConflictError, bT as ZapierError, b_ as ZapierNotFoundError, c6 as ZapierRateLimitError, c9 as ZapierRelayError, t as ZapierReleaseTriggerMessageSignal, b$ as ZapierResourceNotFoundError, cc as ZapierSignal, c2 as ZapierTimeoutError, bV as ZapierUnknownError, bU as ZapierValidationError, d2 as actionKeyResolver, d1 as actionTypeResolver, a5 as addPlugin, c_ as apiPlugin, d0 as appKeyResolver, cd as appsPlugin, d4 as authenticationIdGenericResolver, d3 as authenticationIdResolver, ai as batch, eS as buildApplicationLifecycleEvent, ak as buildCapabilityMessage, eU as buildErrorEvent, eT as buildErrorEventWithContext, eW as buildMethodCalledEvent, eK as cleanupEventListeners, ds as clearTokenCache, d8 as clientCredentialsNameResolver, d9 as clientIdResolver, aG as composePlugins, d4 as connectionIdGenericResolver, d3 as connectionIdResolver, e5 as connectionsPlugin, eV as createBaseEvent, cx as createClientCredentialsPlugin, a4 as createCorePlugin, a2 as createFunction, dC as createMemoryCache, ar as createOptionsPlugin, aF as createPaginatedPluginMethod, aE as createPluginMethod, a3 as createPluginStack, aq as createSdk, ew as createTableFieldsPlugin, eq as createTablePlugin, eE as createTableRecordsPlugin, aM as createZapierApi, as as createZapierCoreStack, ap as createZapierSdkWithoutRegistry, aD as definePlugin, cz as deleteClientCredentialsPlugin, ey as deleteTableFieldsPlugin, es as deleteTablePlugin, eG as deleteTableRecordsPlugin, dd as durableRunIdResolver, eM as eventEmissionPlugin, ch as fetchPlugin, cH as findFirstConnectionPlugin, cJ as findUniqueConnectionPlugin, ca as formatErrorMessage, eZ as generateEventId, cr as getActionInputFieldsSchemaPlugin, cD as getActionPlugin, f7 as getAgent, cB as getAppPlugin, dU as getBaseUrlFromCredentials, f3 as getCiPlatform, dV as getClientIdFromCredentials, cF as getConnectionPlugin, ay as getCoreErrorCause, ax as getCoreErrorCode, f5 as getCpuTime, e_ as getCurrentTimestamp, f4 as getMemoryUsage, aN as getOrCreateApiClient, f0 as getOsInfo, f1 as getPlatformVersions, cS as getPreferredManifestEntryKey, cX as getProfilePlugin, e$ as getReleaseId, eo as getTablePlugin, eA as getTableRecordPlugin, dw as getTokenFromCliLogin, f6 as getTtyContext, eh as getZapierApprovalMode, ej as getZapierDefaultApprovalMode, ei as getZapierOpenAutoModeApprovalsInBrowser, e8 as getZapierSdkService, du as injectCliLogin, d7 as inputFieldKeyResolver, d6 as inputsAllOptionalResolver, d5 as inputsResolver, dt as invalidateCachedToken, dy as invalidateCredentialsToken, f2 as isCi, dv as isCliLoginAvailable, dN as isClientCredentials, aw as isCoreError, dQ as isCredentialsFunction, dP as isCredentialsObject, aO as isPermanentHttpError, dO as isPkceCredentials, a1 as isPositional, cp as listActionInputFieldChoicesPlugin, cn as listActionInputFieldsPlugin, cl as listActionsPlugin, cj as listAppsPlugin, cv as listClientCredentialsPlugin, ct as listConnectionsPlugin, eu as listTableFieldsPlugin, eC as listTableRecordsPlugin, em as listTablesPlugin, al as logDeprecation, cT as manifestPlugin, ef as parseConcurrencyEnvVar, aJ as registryPlugin, cP as requestPlugin, am as resetDeprecationWarnings, dx as resolveAuthToken, dT as resolveCredentials, dS as resolveCredentialsFromEnv, cN as runActionPlugin, ae as runInMethodScope, af as runWithTelemetryContext, dj as tableFieldIdsResolver, dl as tableFieldsResolver, dp as tableFiltersResolver, da as tableIdResolver, dk as tableNameResolver, dh as tableRecordIdResolver, di as tableRecordIdsResolver, dm as tableRecordsResolver, dq as tableSortResolver, dn as tableUpdateRecordsResolver, ag as toSnakeCase, ah as toTitleCase, db as triggerInboxResolver, dg as triggerMessagesResolver, eI as updateTableRecordsPlugin, dc as workflowIdResolver, df as workflowRunIdResolver, de as workflowVersionIdResolver, bX as zapierAdaptError } from './index-D1O7Pcex.mjs';
1
+ import { B as BaseSdkOptions, P as PluginStack, a as PluginMeta, M as MethodHooks, C as CoreOptions, Z as ZapierSdkOptions$1, E as EventEmissionContext, A as ApiClient, b as Manifest, R as ResolvedAppLocator, U as UpdateManifestEntryOptions, c as UpdateManifestEntryResult, d as AddActionEntryOptions, e as AddActionEntryResult, f as ActionEntry, g as findManifestEntry, r as readManifestFromFile, h as CapabilitiesContext, i as PaginatedSdkResult, G as GetConnectionStartUrlItem, W as WaitForNewConnectionItem, j as CreateConnectionItem, F as FieldsetItem, k as PositionalMetadata, O as OutputFormatter, l as ZapierFetchInitOptions, D as DrainTriggerInboxOptions, m as DynamicResolver, n as WatchTriggerInboxOptions, o as ActionProxy, p as ZapierSdkApps, q as WithAddPlugin } from './index-WMit6fkJ.mjs';
2
+ export { H as Action, ci as ActionExecutionOptions, Q as ActionExecutionResult, S as ActionField, V as ActionFieldChoice, aW as ActionItem, bw as ActionKeyProperty, b4 as ActionKeyPropertySchema, bx as ActionProperty, b5 as ActionPropertySchema, aK as ActionResolverItem, bI as ActionTimeoutMsProperty, bg as ActionTimeoutMsPropertySchema, aL as ActionTypeItem, bv as ActionTypeProperty, b3 as ActionTypePropertySchema, ce as ApiError, dI as ApiEvent, d0 as ApiPluginOptions, d2 as ApiPluginProvides, I as App, cj as AppFactoryInput, aU as AppItem, bt as AppKeyProperty, b1 as AppKeyPropertySchema, bu as AppProperty, b2 as AppPropertySchema, eS as ApplicationLifecycleEventData, ca as ApprovalStatus, ch as AppsPluginProvides, bN as AppsProperty, bl as AppsPropertySchema, a8 as ArrayResolver, dH as AuthEvent, bB as AuthenticationIdProperty, b8 as AuthenticationIdPropertySchema, e_ as BaseEvent, ay as BaseSdkOptionsSchema, am as BatchOptions, cP as CONTEXT_CACHE_MAX_SIZE, cO as CONTEXT_CACHE_TTL_MS, aC as CORE_ERROR_SYMBOL, ai as CallerContext, K as Choice, dO as ClientCredentialsObject, dZ as ClientCredentialsObjectSchema, _ as Connection, e5 as ConnectionEntry, e4 as ConnectionEntrySchema, bz as ConnectionIdProperty, b7 as ConnectionIdPropertySchema, aV as ConnectionItem, bA as ConnectionProperty, b9 as ConnectionPropertySchema, e7 as ConnectionsMap, e6 as ConnectionsMapSchema, e9 as ConnectionsPluginProvides, bP as ConnectionsProperty, bn as ConnectionsPropertySchema, $ as ConnectionsResponse, aD as CoreErrorCode, cB as CreateClientCredentialsPluginProvides, eA as CreateTableFieldsPluginProvides, eu as CreateTablePluginProvides, eI as CreateTableRecordsPluginProvides, dL as Credentials, e2 as CredentialsFunction, e1 as CredentialsFunctionSchema, dN as CredentialsObject, d$ as CredentialsObjectSchema, e3 as CredentialsSchema, ee as DEFAULT_ACTION_TIMEOUT_MS, en as DEFAULT_APPROVAL_TIMEOUT_MS, cY as DEFAULT_CONFIG_PATH, eo as DEFAULT_MAX_APPROVAL_RETRIES, ed as DEFAULT_PAGE_SIZE, bG as DebugProperty, be as DebugPropertySchema, cD as DeleteClientCredentialsPluginProvides, eC as DeleteTableFieldsPluginProvides, ew as DeleteTablePluginProvides, eK as DeleteTableRecordsPluginProvides, u as DrainTriggerInboxCallback, v as DrainTriggerInboxErrorObserver, ab as DynamicListResolver, ac as DynamicSearchResolver, eT as EnhancedErrorEventData, bV as ErrorOptions, dK as EventCallback, eR as EventContext, eO as EventEmissionConfig, eQ as EventEmissionProvides, cl as FetchPluginProvides, J as Field, bM as FieldsProperty, bk as FieldsPropertySchema, ad as FieldsResolver, y as FindFirstAuthenticationPluginProvides, cL as FindFirstConnectionPluginProvides, z as FindUniqueAuthenticationPluginProvides, cN as FindUniqueConnectionPluginProvides, a6 as FormattedItem, ax as FunctionDeprecation, aw as FunctionRegistryEntry, cv as GetActionInputFieldsSchemaPluginProvides, cH as GetActionPluginProvides, cF as GetAppPluginProvides, x as GetAuthenticationPluginProvides, cJ as GetConnectionPluginProvides, c$ as GetProfilePluginProvides, es as GetTablePluginProvides, eE as GetTableRecordPluginProvides, aY as InfoFieldItem, aX as InputFieldItem, by as InputFieldProperty, b6 as InputFieldPropertySchema, bC as InputsProperty, ba as InputsPropertySchema, aT as JsonSseMessage, bU as LeaseLimitProperty, bs as LeaseLimitPropertySchema, bS as LeaseProperty, bq as LeasePropertySchema, bT as LeaseSecondsProperty, br as LeaseSecondsPropertySchema, L as LeasedTriggerMessageItem, bD as LimitProperty, bb as LimitPropertySchema, ct as ListActionInputFieldChoicesPluginProvides, cr as ListActionInputFieldsPluginProvides, cp as ListActionsPluginProvides, cn as ListAppsPluginProvides, w as ListAuthenticationsPluginProvides, cz as ListClientCredentialsPluginProvides, cx as ListConnectionsPluginProvides, ey as ListTableFieldsPluginProvides, eG as ListTableRecordsPluginProvides, eq as ListTablesPluginProvides, dJ as LoadingEvent, eh as MAX_CONCURRENCY_LIMIT, ec as MAX_PAGE_LIMIT, cZ as ManifestEntry, cU as ManifestPluginOptions, cX as ManifestPluginProvides, e$ as MethodCalledEvent, eU as MethodCalledEventData, N as Need, X as NeedsRequest, Y as NeedsResponse, bE as OffsetProperty, bc as OffsetPropertySchema, bF as OutputProperty, bd as OutputPropertySchema, b0 as PaginatedSdkFunction, bH as ParamsProperty, bf as ParamsPropertySchema, dP as PkceCredentialsObject, d_ as PkceCredentialsObjectSchema, aE as Plugin, aF as PluginProvides, aO as PollOptions, c8 as RateLimitInfo, bK as RecordProperty, bi as RecordPropertySchema, bL as RecordsProperty, bj as RecordsPropertySchema, ar as RelayFetchSchema, aq as RelayRequestSchema, aN as RequestOptions, cT as RequestPluginProvides, du as ResolveAuthTokenOptions, dU as ResolveCredentialsOptions, dM as ResolvedCredentials, e0 as ResolvedCredentialsSchema, a7 as Resolver, a9 as ResolverMetadata, aZ as RootFieldItem, cR as RunActionPluginProvides, dG as SdkEvent, a$ as SdkPage, aS as SseMessage, aa as StaticResolver, bJ as TableProperty, bh as TablePropertySchema, bO as TablesProperty, bm as TablesPropertySchema, bR as TriggerInboxNameProperty, bp as TriggerInboxNamePropertySchema, bQ as TriggerInboxProperty, bo as TriggerInboxPropertySchema, T as TriggerMessageStatus, eM as UpdateTableRecordsPluginProvides, a0 as UserProfile, a_ as UserProfileItem, ea as ZAPIER_BASE_URL, ej as ZAPIER_MAX_CONCURRENT_REQUESTS, ef as ZAPIER_MAX_NETWORK_RETRIES, eg as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, s as ZapierAbortDrainSignal, c6 as ZapierActionError, b$ as ZapierApiError, c0 as ZapierAppNotFoundError, cb as ZapierApprovalError, bZ as ZapierAuthenticationError, c4 as ZapierBundleError, dC as ZapierCache, dD as ZapierCacheEntry, dE as ZapierCacheSetOptions, c3 as ZapierConfigurationError, c7 as ZapierConflictError, bW as ZapierError, c1 as ZapierNotFoundError, c9 as ZapierRateLimitError, cc as ZapierRelayError, t as ZapierReleaseTriggerMessageSignal, c2 as ZapierResourceNotFoundError, cf as ZapierSignal, c5 as ZapierTimeoutError, bY as ZapierUnknownError, bX as ZapierValidationError, d5 as actionKeyResolver, d4 as actionTypeResolver, a5 as addPlugin, d1 as apiPlugin, d3 as appKeyResolver, cg as appsPlugin, d7 as authenticationIdGenericResolver, d6 as authenticationIdResolver, al as batch, eV as buildApplicationLifecycleEvent, an as buildCapabilityMessage, eX as buildErrorEvent, eW as buildErrorEventWithContext, eZ as buildMethodCalledEvent, eN as cleanupEventListeners, dv as clearTokenCache, db as clientCredentialsNameResolver, dc as clientIdResolver, aJ as composePlugins, d7 as connectionIdGenericResolver, d6 as connectionIdResolver, e8 as connectionsPlugin, eY as createBaseEvent, cA as createClientCredentialsPlugin, a4 as createCorePlugin, a2 as createFunction, dF as createMemoryCache, au as createOptionsPlugin, aI as createPaginatedPluginMethod, aH as createPluginMethod, a3 as createPluginStack, at as createSdk, ez as createTableFieldsPlugin, et as createTablePlugin, eH as createTableRecordsPlugin, aP as createZapierApi, av as createZapierCoreStack, as as createZapierSdkWithoutRegistry, aG as definePlugin, cC as deleteClientCredentialsPlugin, eB as deleteTableFieldsPlugin, ev as deleteTablePlugin, eJ as deleteTableRecordsPlugin, dg as durableRunIdResolver, eP as eventEmissionPlugin, ck as fetchPlugin, cK as findFirstConnectionPlugin, cM as findUniqueConnectionPlugin, cd as formatErrorMessage, f0 as generateEventId, cu as getActionInputFieldsSchemaPlugin, cG as getActionPlugin, fa as getAgent, cE as getAppPlugin, dX as getBaseUrlFromCredentials, ag as getCallerContext, f6 as getCiPlatform, dY as getClientIdFromCredentials, cI as getConnectionPlugin, aB as getCoreErrorCause, aA as getCoreErrorCode, f8 as getCpuTime, f1 as getCurrentTimestamp, f7 as getMemoryUsage, aQ as getOrCreateApiClient, f3 as getOsInfo, f4 as getPlatformVersions, cV as getPreferredManifestEntryKey, c_ as getProfilePlugin, f2 as getReleaseId, er as getTablePlugin, eD as getTableRecordPlugin, dz as getTokenFromCliLogin, f9 as getTtyContext, ek as getZapierApprovalMode, em as getZapierDefaultApprovalMode, el as getZapierOpenAutoModeApprovalsInBrowser, eb as getZapierSdkService, dx as injectCliLogin, da as inputFieldKeyResolver, d9 as inputsAllOptionalResolver, d8 as inputsResolver, dw as invalidateCachedToken, dB as invalidateCredentialsToken, f5 as isCi, dy as isCliLoginAvailable, dQ as isClientCredentials, az as isCoreError, dT as isCredentialsFunction, dS as isCredentialsObject, aR as isPermanentHttpError, dR as isPkceCredentials, a1 as isPositional, cs as listActionInputFieldChoicesPlugin, cq as listActionInputFieldsPlugin, co as listActionsPlugin, cm as listAppsPlugin, cy as listClientCredentialsPlugin, cw as listConnectionsPlugin, ex as listTableFieldsPlugin, eF as listTableRecordsPlugin, ep as listTablesPlugin, ao as logDeprecation, cW as manifestPlugin, ei as parseConcurrencyEnvVar, aM as registryPlugin, cS as requestPlugin, ap as resetDeprecationWarnings, dA as resolveAuthToken, dW as resolveCredentials, dV as resolveCredentialsFromEnv, cQ as runActionPlugin, ae as runInMethodScope, ah as runWithCallerContext, af as runWithTelemetryContext, dm as tableFieldIdsResolver, dp as tableFieldsResolver, ds as tableFiltersResolver, dd as tableIdResolver, dn as tableNameResolver, dk as tableRecordIdResolver, dl as tableRecordIdsResolver, dq as tableRecordsResolver, dt as tableSortResolver, dr as tableUpdateRecordsResolver, aj as toSnakeCase, ak as toTitleCase, de as triggerInboxResolver, dj as triggerMessagesResolver, eL as updateTableRecordsPlugin, df as workflowIdResolver, di as workflowRunIdResolver, dh as workflowVersionIdResolver, b_ as zapierAdaptError } from './index-WMit6fkJ.mjs';
3
3
  import * as zod_v4_core from 'zod/v4/core';
4
4
  import * as zod from 'zod';
5
5
  import '@zapier/zapier-sdk-core/v0/schemas/connections';
@@ -473,22 +473,34 @@ function createValidator(schema, { adaptError } = {}) {
473
473
  };
474
474
  }
475
475
  var validateOptions = (schema, options, { adaptError } = {}) => parseOrThrow(schema, options, { adaptError });
476
- var scopeStore = null;
477
- try {
478
- scopeStore = new AsyncLocalStorage();
479
- } catch {
476
+ function createAsyncContext() {
477
+ let store = null;
478
+ try {
479
+ store = new AsyncLocalStorage();
480
+ } catch {
481
+ store = null;
482
+ }
483
+ return {
484
+ available: store !== null,
485
+ run(value, fn) {
486
+ return store ? store.run(value, fn) : fn();
487
+ },
488
+ get() {
489
+ return store?.getStore();
490
+ }
491
+ };
480
492
  }
493
+ var scope = createAsyncContext();
481
494
  function getCurrentScope() {
482
- if (!scopeStore) return void 0;
483
- return scopeStore.getStore();
495
+ return scope.get();
484
496
  }
485
497
  function getCurrentDepth() {
486
498
  return getCurrentScope()?.depth ?? 0;
487
499
  }
488
500
  function runInMethodScope(fn) {
489
- if (!scopeStore) return fn();
490
- const currentDepth = scopeStore.getStore()?.depth ?? -1;
491
- return scopeStore.run({ depth: currentDepth + 1 }, fn);
501
+ if (!scope.available) return fn();
502
+ const currentDepth = scope.get()?.depth ?? -1;
503
+ return scope.run({ depth: currentDepth + 1 }, fn);
492
504
  }
493
505
  var runWithTelemetryContext = runInMethodScope;
494
506
  function normalizeError(error, adaptError) {
@@ -2866,10 +2878,10 @@ function mergeScopes(credentialsScope, requiredScopes) {
2866
2878
  return [...scopeSet].sort();
2867
2879
  }
2868
2880
  async function exchangeClientCredentials(options) {
2869
- const { clientId, clientSecret, baseUrl, scope, requiredScopes, onEvent } = options;
2881
+ const { clientId, clientSecret, baseUrl, scope: scope2, requiredScopes, onEvent } = options;
2870
2882
  const fetchFn = options.fetch || globalThis.fetch;
2871
2883
  const tokenUrl = getTokenEndpointUrl(baseUrl);
2872
- const mergedScopes = mergeScopes(scope, requiredScopes);
2884
+ const mergedScopes = mergeScopes(scope2, requiredScopes);
2873
2885
  const scopeString = mergedScopes.join(" ");
2874
2886
  onEvent?.({
2875
2887
  type: "auth_exchanging",
@@ -3134,6 +3146,25 @@ async function invalidateCredentialsToken(options) {
3134
3146
  }
3135
3147
  }
3136
3148
 
3149
+ // src/utils/caller-context.ts
3150
+ var callerContext = createAsyncContext();
3151
+ function runWithCallerContext(context, fn) {
3152
+ let parent;
3153
+ try {
3154
+ parent = callerContext.get() ?? {};
3155
+ } catch {
3156
+ return fn();
3157
+ }
3158
+ return callerContext.run({ ...parent, ...context }, fn);
3159
+ }
3160
+ function getCallerContext() {
3161
+ try {
3162
+ return callerContext.get() ?? {};
3163
+ } catch {
3164
+ return {};
3165
+ }
3166
+ }
3167
+
3137
3168
  // src/api/sse-parser.ts
3138
3169
  async function* jsonFrames(source) {
3139
3170
  for await (const { data } of source) {
@@ -3285,7 +3316,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
3285
3316
  }
3286
3317
 
3287
3318
  // src/sdk-version.ts
3288
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.73.1" : void 0) || "unknown";
3319
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.74.0" : void 0) || "unknown";
3289
3320
 
3290
3321
  // src/utils/open-url.ts
3291
3322
  var nodePrefix = "node:";
@@ -4009,6 +4040,10 @@ var ZapierApiClient = class {
4009
4040
  headers.set("x-zapier-sdk-package", callerPackage.name);
4010
4041
  headers.set("zapier-sdk-package-version", callerPackage.version);
4011
4042
  headers.set("x-zapier-sdk-package-version", callerPackage.version);
4043
+ const { packageOperation } = getCallerContext();
4044
+ if (packageOperation) {
4045
+ headers.set("zapier-sdk-package-operation", packageOperation);
4046
+ }
4012
4047
  }
4013
4048
  }
4014
4049
  // Helper to perform HTTP requests with JSON handling
@@ -6084,10 +6119,10 @@ var actionItemFormatter = {
6084
6119
  // src/plugins/eventEmission/method-metadata.ts
6085
6120
  var SCOPE_KEY = "methodMetadata";
6086
6121
  function setMethodMetadata(metadata) {
6087
- const scope = getCurrentScope();
6088
- if (!scope) return;
6089
- const existing = scope[SCOPE_KEY];
6090
- scope[SCOPE_KEY] = { ...existing, ...metadata };
6122
+ const scope2 = getCurrentScope();
6123
+ if (!scope2) return;
6124
+ const existing = scope2[SCOPE_KEY];
6125
+ scope2[SCOPE_KEY] = { ...existing, ...metadata };
6091
6126
  }
6092
6127
  function getMethodMetadata() {
6093
6128
  return getCurrentScope()?.[SCOPE_KEY];
@@ -13194,4 +13229,4 @@ function createZapierSdk2(options = {}) {
13194
13229
  return withDeprecatedAddPlugin(createZapierSdkStack2(options).toSdk());
13195
13230
  }
13196
13231
 
13197
- export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, CORE_ERROR_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreErrorCode, 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_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, 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, addPlugin, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk2 as createZapierSdk, createZapierSdkStack2 as createZapierSdkStack, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreError, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runInMethodScope, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError };
13232
+ export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, CORE_ERROR_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreErrorCode, 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_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, 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, addPlugin, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk2 as createZapierSdk, createZapierSdkStack2 as createZapierSdkStack, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreError, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError };
@@ -7111,6 +7111,27 @@ declare const apiPlugin: (sdk: {
7111
7111
  };
7112
7112
  type ApiPluginProvides = ReturnType<typeof apiPlugin>;
7113
7113
 
7114
+ interface CallerContext {
7115
+ packageOperation?: string;
7116
+ }
7117
+ /**
7118
+ * Run `fn` with the given caller context merged onto any parent context, so
7119
+ * the operation that initiated the call (e.g. a CLI command or MCP tool) stays
7120
+ * observable through every SDK call it makes.
7121
+ *
7122
+ * Caller context is telemetry-only: reading the parent scope is wrapped so a
7123
+ * broken ALS store can never crash the wrapped command. Errors thrown by `fn`
7124
+ * itself are intentionally NOT caught — they propagate.
7125
+ */
7126
+ declare function runWithCallerContext<T>(context: CallerContext, fn: () => T): T;
7127
+ /**
7128
+ * Read the active caller context, or an empty object outside any caller scope.
7129
+ *
7130
+ * Read on the outbound HTTP path to set a telemetry header, so a failure here
7131
+ * must never break the request — it falls back to an empty context.
7132
+ */
7133
+ declare function getCallerContext(): CallerContext;
7134
+
7114
7135
  /**
7115
7136
  * Batch Operation Utilities
7116
7137
  *
@@ -15567,4 +15588,4 @@ declare const registryPlugin: (sdk: {
15567
15588
  };
15568
15589
  }) => {};
15569
15590
 
15570
- export { type ConnectionsResponse 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 GetConnectionStartUrlItem as G, type Action as H, type App as I, type Field as J, type Choice as K, type LeasedTriggerMessageItem as L, type MethodHooks as M, type Need as N, type OutputFormatter as O, type PluginStack as P, type ActionExecutionResult as Q, type ResolvedAppLocator as R, type ActionField as S, type TriggerMessageStatus as T, type UpdateManifestEntryOptions as U, type ActionFieldChoice as V, type WaitForNewConnectionItem as W, type NeedsRequest as X, type NeedsResponse as Y, type ZapierSdkOptions as Z, type Connection as _, type PluginMeta as a, AppPropertySchema as a$, type UserProfile as a0, isPositional as a1, createFunction as a2, createPluginStack as a3, createCorePlugin as a4, addPlugin as a5, type FormattedItem as a6, type Resolver as a7, type ArrayResolver as a8, type ResolverMetadata as a9, CoreErrorCode as aA, type Plugin as aB, type PluginProvides as aC, definePlugin as aD, createPluginMethod as aE, createPaginatedPluginMethod as aF, composePlugins as aG, type ActionItem as aH, type ActionTypeItem as aI, registryPlugin as aJ, type RequestOptions as aK, type PollOptions as aL, createZapierApi as aM, getOrCreateApiClient as aN, isPermanentHttpError as aO, type SseMessage as aP, type JsonSseMessage as aQ, type AppItem as aR, type ConnectionItem as aS, type ActionItem$1 as aT, type InputFieldItem as aU, type InfoFieldItem as aV, type RootFieldItem as aW, type UserProfileItem as aX, type SdkPage as aY, type PaginatedSdkFunction as aZ, AppKeyPropertySchema as a_, type StaticResolver as aa, type DynamicListResolver as ab, type DynamicSearchResolver as ac, type FieldsResolver as ad, runInMethodScope as ae, runWithTelemetryContext as af, toSnakeCase as ag, toTitleCase as ah, batch as ai, type BatchOptions as aj, buildCapabilityMessage as ak, logDeprecation as al, resetDeprecationWarnings as am, RelayRequestSchema as an, RelayFetchSchema as ao, createZapierSdkWithoutRegistry as ap, createSdk as aq, createOptionsPlugin as ar, createZapierCoreStack as as, type FunctionRegistryEntry as at, type FunctionDeprecation as au, BaseSdkOptionsSchema as av, isCoreError as aw, getCoreErrorCode as ax, getCoreErrorCause as ay, CORE_ERROR_SYMBOL as az, type Manifest 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 ErrorOptions as bS, ZapierError as bT, ZapierValidationError as bU, ZapierUnknownError as bV, ZapierAuthenticationError as bW, zapierAdaptError as bX, ZapierApiError as bY, ZapierAppNotFoundError 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 UpdateManifestEntryResult as c, type ApiPluginProvides 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, type DeleteClientCredentialsPluginProvides as cA, getAppPlugin as cB, type GetAppPluginProvides as cC, getActionPlugin as cD, type GetActionPluginProvides as cE, getConnectionPlugin as cF, type GetConnectionPluginProvides as cG, findFirstConnectionPlugin as cH, type FindFirstConnectionPluginProvides as cI, findUniqueConnectionPlugin as cJ, type FindUniqueConnectionPluginProvides as cK, CONTEXT_CACHE_TTL_MS as cL, CONTEXT_CACHE_MAX_SIZE as cM, runActionPlugin as cN, type RunActionPluginProvides as cO, requestPlugin as cP, type RequestPluginProvides as cQ, type ManifestPluginOptions as cR, getPreferredManifestEntryKey as cS, manifestPlugin as cT, type ManifestPluginProvides as cU, DEFAULT_CONFIG_PATH as cV, type ManifestEntry as cW, getProfilePlugin as cX, type GetProfilePluginProvides as cY, type ApiPluginOptions as cZ, apiPlugin as c_, formatErrorMessage as ca, type ApiError as cb, ZapierSignal as cc, appsPlugin as cd, type AppsPluginProvides as ce, type ActionExecutionOptions as cf, type AppFactoryInput as cg, fetchPlugin as ch, type FetchPluginProvides as ci, listAppsPlugin as cj, type ListAppsPluginProvides as ck, listActionsPlugin as cl, type ListActionsPluginProvides as cm, listActionInputFieldsPlugin as cn, type ListActionInputFieldsPluginProvides as co, listActionInputFieldChoicesPlugin as cp, type ListActionInputFieldChoicesPluginProvides as cq, getActionInputFieldsSchemaPlugin as cr, type GetActionInputFieldsSchemaPluginProvides as cs, listConnectionsPlugin as ct, type ListConnectionsPluginProvides as cu, listClientCredentialsPlugin as cv, type ListClientCredentialsPluginProvides as cw, createClientCredentialsPlugin as cx, type CreateClientCredentialsPluginProvides as cy, deleteClientCredentialsPlugin as cz, type AddActionEntryOptions as d, type CredentialsFunction as d$, appKeyResolver as d0, actionTypeResolver as d1, actionKeyResolver as d2, connectionIdResolver as d3, connectionIdGenericResolver as d4, inputsResolver as d5, inputsAllOptionalResolver as d6, inputFieldKeyResolver as d7, clientCredentialsNameResolver as d8, clientIdResolver as d9, type ZapierCacheEntry as dA, type ZapierCacheSetOptions as dB, createMemoryCache as dC, type SdkEvent as dD, type AuthEvent as dE, type ApiEvent as dF, type LoadingEvent as dG, type EventCallback as dH, type Credentials as dI, type ResolvedCredentials as dJ, type CredentialsObject as dK, type ClientCredentialsObject as dL, type PkceCredentialsObject as dM, isClientCredentials as dN, isPkceCredentials as dO, isCredentialsObject as dP, isCredentialsFunction as dQ, type ResolveCredentialsOptions as dR, resolveCredentialsFromEnv as dS, resolveCredentials as dT, getBaseUrlFromCredentials as dU, getClientIdFromCredentials as dV, ClientCredentialsObjectSchema as dW, PkceCredentialsObjectSchema as dX, CredentialsObjectSchema as dY, ResolvedCredentialsSchema as dZ, CredentialsFunctionSchema as d_, tableIdResolver as da, triggerInboxResolver as db, workflowIdResolver as dc, durableRunIdResolver as dd, workflowVersionIdResolver as de, workflowRunIdResolver as df, triggerMessagesResolver as dg, tableRecordIdResolver as dh, tableRecordIdsResolver as di, tableFieldIdsResolver as dj, tableNameResolver as dk, tableFieldsResolver as dl, tableRecordsResolver as dm, tableUpdateRecordsResolver as dn, tableFiltersResolver as dp, tableSortResolver as dq, type ResolveAuthTokenOptions as dr, clearTokenCache as ds, invalidateCachedToken as dt, injectCliLogin as du, isCliLoginAvailable as dv, getTokenFromCliLogin as dw, resolveAuthToken as dx, invalidateCredentialsToken as dy, type ZapierCache as dz, type AddActionEntryResult as e, getReleaseId as e$, CredentialsSchema as e0, ConnectionEntrySchema as e1, type ConnectionEntry as e2, ConnectionsMapSchema as e3, type ConnectionsMap as e4, connectionsPlugin as e5, type ConnectionsPluginProvides as e6, ZAPIER_BASE_URL as e7, getZapierSdkService as e8, MAX_PAGE_LIMIT as e9, getTableRecordPlugin as eA, type GetTableRecordPluginProvides as eB, listTableRecordsPlugin as eC, type ListTableRecordsPluginProvides as eD, createTableRecordsPlugin as eE, type CreateTableRecordsPluginProvides as eF, deleteTableRecordsPlugin as eG, type DeleteTableRecordsPluginProvides as eH, updateTableRecordsPlugin as eI, type UpdateTableRecordsPluginProvides as eJ, cleanupEventListeners as eK, type EventEmissionConfig as eL, eventEmissionPlugin as eM, type EventEmissionProvides as eN, type EventContext as eO, type ApplicationLifecycleEventData as eP, type EnhancedErrorEventData as eQ, type MethodCalledEventData as eR, buildApplicationLifecycleEvent as eS, buildErrorEventWithContext as eT, buildErrorEvent as eU, createBaseEvent as eV, buildMethodCalledEvent as eW, type BaseEvent as eX, type MethodCalledEvent as eY, generateEventId as eZ, getCurrentTimestamp as e_, DEFAULT_PAGE_SIZE as ea, DEFAULT_ACTION_TIMEOUT_MS as eb, ZAPIER_MAX_NETWORK_RETRIES as ec, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS as ed, MAX_CONCURRENCY_LIMIT as ee, parseConcurrencyEnvVar as ef, ZAPIER_MAX_CONCURRENT_REQUESTS as eg, getZapierApprovalMode as eh, getZapierOpenAutoModeApprovalsInBrowser as ei, getZapierDefaultApprovalMode as ej, DEFAULT_APPROVAL_TIMEOUT_MS as ek, DEFAULT_MAX_APPROVAL_RETRIES as el, listTablesPlugin as em, type ListTablesPluginProvides as en, getTablePlugin as eo, type GetTablePluginProvides as ep, createTablePlugin as eq, type CreateTablePluginProvides as er, deleteTablePlugin as es, type DeleteTablePluginProvides as et, listTableFieldsPlugin as eu, type ListTableFieldsPluginProvides as ev, createTableFieldsPlugin as ew, type CreateTableFieldsPluginProvides as ex, deleteTableFieldsPlugin as ey, type DeleteTableFieldsPluginProvides as ez, type ActionEntry as f, getOsInfo as f0, getPlatformVersions as f1, isCi as f2, getCiPlatform as f3, getMemoryUsage as f4, getCpuTime as f5, getTtyContext as f6, getAgent as f7, createZapierSdk as f8, createZapierSdkStack as f9, type ZapierSdk as fa, findManifestEntry as g, type CapabilitiesContext as h, type PaginatedSdkResult as i, type CreateConnectionItem as j, type PositionalMetadata as k, type ZapierFetchInitOptions as l, type DynamicResolver as m, type WatchTriggerInboxOptions as n, type ActionProxy as o, type ZapierSdkApps as p, type WithAddPlugin as q, readManifestFromFile as r, ZapierAbortDrainSignal as s, ZapierReleaseTriggerMessageSignal as t, type DrainTriggerInboxCallback as u, type DrainTriggerInboxErrorObserver as v, type ListAuthenticationsPluginProvides as w, type GetAuthenticationPluginProvides as x, type FindFirstAuthenticationPluginProvides as y, type FindUniqueAuthenticationPluginProvides as z };
15591
+ export { type ConnectionsResponse 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 GetConnectionStartUrlItem as G, type Action as H, type App as I, type Field as J, type Choice as K, type LeasedTriggerMessageItem as L, type MethodHooks as M, type Need as N, type OutputFormatter as O, type PluginStack as P, type ActionExecutionResult as Q, type ResolvedAppLocator as R, type ActionField as S, type TriggerMessageStatus as T, type UpdateManifestEntryOptions as U, type ActionFieldChoice as V, type WaitForNewConnectionItem as W, type NeedsRequest as X, type NeedsResponse as Y, type ZapierSdkOptions as Z, type Connection as _, type PluginMeta as a, type SdkPage as a$, type UserProfile as a0, isPositional as a1, createFunction as a2, createPluginStack as a3, createCorePlugin as a4, addPlugin as a5, type FormattedItem as a6, type Resolver as a7, type ArrayResolver as a8, type ResolverMetadata as a9, getCoreErrorCode as aA, getCoreErrorCause as aB, CORE_ERROR_SYMBOL as aC, CoreErrorCode as aD, type Plugin as aE, type PluginProvides as aF, definePlugin as aG, createPluginMethod as aH, createPaginatedPluginMethod as aI, composePlugins as aJ, type ActionItem as aK, type ActionTypeItem as aL, registryPlugin as aM, type RequestOptions as aN, type PollOptions as aO, createZapierApi as aP, getOrCreateApiClient as aQ, isPermanentHttpError as aR, type SseMessage as aS, type JsonSseMessage as aT, type AppItem as aU, type ConnectionItem as aV, type ActionItem$1 as aW, type InputFieldItem as aX, type InfoFieldItem as aY, type RootFieldItem as aZ, type UserProfileItem as a_, type StaticResolver as aa, type DynamicListResolver as ab, type DynamicSearchResolver as ac, type FieldsResolver as ad, runInMethodScope as ae, runWithTelemetryContext as af, getCallerContext as ag, runWithCallerContext as ah, type CallerContext as ai, toSnakeCase as aj, toTitleCase as ak, batch as al, type BatchOptions as am, buildCapabilityMessage as an, logDeprecation as ao, resetDeprecationWarnings as ap, RelayRequestSchema as aq, RelayFetchSchema as ar, createZapierSdkWithoutRegistry as as, createSdk as at, createOptionsPlugin as au, createZapierCoreStack as av, type FunctionRegistryEntry as aw, type FunctionDeprecation as ax, BaseSdkOptionsSchema as ay, isCoreError as az, type Manifest as b, ZapierApiError as b$, type PaginatedSdkFunction as b0, AppKeyPropertySchema as b1, AppPropertySchema as b2, ActionTypePropertySchema as b3, ActionKeyPropertySchema as b4, ActionPropertySchema as b5, InputFieldPropertySchema as b6, ConnectionIdPropertySchema as b7, AuthenticationIdPropertySchema as b8, ConnectionPropertySchema as b9, type ConnectionProperty as bA, type AuthenticationIdProperty as bB, type InputsProperty as bC, type LimitProperty as bD, type OffsetProperty as bE, type OutputProperty as bF, type DebugProperty as bG, type ParamsProperty as bH, type ActionTimeoutMsProperty as bI, type TableProperty as bJ, type RecordProperty as bK, type RecordsProperty as bL, type FieldsProperty as bM, type AppsProperty as bN, type TablesProperty as bO, type ConnectionsProperty as bP, type TriggerInboxProperty as bQ, type TriggerInboxNameProperty as bR, type LeaseProperty as bS, type LeaseSecondsProperty as bT, type LeaseLimitProperty as bU, type ErrorOptions as bV, ZapierError as bW, ZapierValidationError as bX, ZapierUnknownError as bY, ZapierAuthenticationError as bZ, zapierAdaptError as b_, InputsPropertySchema as ba, LimitPropertySchema as bb, OffsetPropertySchema as bc, OutputPropertySchema as bd, DebugPropertySchema as be, ParamsPropertySchema as bf, ActionTimeoutMsPropertySchema as bg, TablePropertySchema as bh, RecordPropertySchema as bi, RecordsPropertySchema as bj, FieldsPropertySchema as bk, AppsPropertySchema as bl, TablesPropertySchema as bm, ConnectionsPropertySchema as bn, TriggerInboxPropertySchema as bo, TriggerInboxNamePropertySchema as bp, LeasePropertySchema as bq, LeaseSecondsPropertySchema as br, LeaseLimitPropertySchema as bs, type AppKeyProperty as bt, type AppProperty as bu, type ActionTypeProperty as bv, type ActionKeyProperty as bw, type ActionProperty as bx, type InputFieldProperty as by, type ConnectionIdProperty as bz, type UpdateManifestEntryResult as c, type GetProfilePluginProvides as c$, ZapierAppNotFoundError as c0, ZapierNotFoundError as c1, ZapierResourceNotFoundError as c2, ZapierConfigurationError as c3, ZapierBundleError as c4, ZapierTimeoutError as c5, ZapierActionError as c6, ZapierConflictError as c7, type RateLimitInfo as c8, ZapierRateLimitError as c9, createClientCredentialsPlugin as cA, type CreateClientCredentialsPluginProvides as cB, deleteClientCredentialsPlugin as cC, type DeleteClientCredentialsPluginProvides as cD, getAppPlugin as cE, type GetAppPluginProvides as cF, getActionPlugin as cG, type GetActionPluginProvides as cH, getConnectionPlugin as cI, type GetConnectionPluginProvides as cJ, findFirstConnectionPlugin as cK, type FindFirstConnectionPluginProvides as cL, findUniqueConnectionPlugin as cM, type FindUniqueConnectionPluginProvides as cN, CONTEXT_CACHE_TTL_MS as cO, CONTEXT_CACHE_MAX_SIZE as cP, runActionPlugin as cQ, type RunActionPluginProvides as cR, requestPlugin as cS, type RequestPluginProvides as cT, type ManifestPluginOptions as cU, getPreferredManifestEntryKey as cV, manifestPlugin as cW, type ManifestPluginProvides as cX, DEFAULT_CONFIG_PATH as cY, type ManifestEntry as cZ, getProfilePlugin as c_, type ApprovalStatus as ca, ZapierApprovalError as cb, ZapierRelayError as cc, formatErrorMessage as cd, type ApiError as ce, ZapierSignal as cf, appsPlugin as cg, type AppsPluginProvides as ch, type ActionExecutionOptions as ci, type AppFactoryInput as cj, fetchPlugin as ck, type FetchPluginProvides as cl, listAppsPlugin as cm, type ListAppsPluginProvides as cn, listActionsPlugin as co, type ListActionsPluginProvides as cp, listActionInputFieldsPlugin as cq, type ListActionInputFieldsPluginProvides as cr, listActionInputFieldChoicesPlugin as cs, type ListActionInputFieldChoicesPluginProvides as ct, getActionInputFieldsSchemaPlugin as cu, type GetActionInputFieldsSchemaPluginProvides as cv, listConnectionsPlugin as cw, type ListConnectionsPluginProvides as cx, listClientCredentialsPlugin as cy, type ListClientCredentialsPluginProvides as cz, type AddActionEntryOptions as d, CredentialsObjectSchema as d$, type ApiPluginOptions as d0, apiPlugin as d1, type ApiPluginProvides as d2, appKeyResolver as d3, actionTypeResolver as d4, actionKeyResolver as d5, connectionIdResolver as d6, connectionIdGenericResolver as d7, inputsResolver as d8, inputsAllOptionalResolver as d9, resolveAuthToken as dA, invalidateCredentialsToken as dB, type ZapierCache as dC, type ZapierCacheEntry as dD, type ZapierCacheSetOptions as dE, createMemoryCache as dF, type SdkEvent as dG, type AuthEvent as dH, type ApiEvent as dI, type LoadingEvent as dJ, type EventCallback as dK, type Credentials as dL, type ResolvedCredentials as dM, type CredentialsObject as dN, type ClientCredentialsObject as dO, type PkceCredentialsObject as dP, isClientCredentials as dQ, isPkceCredentials as dR, isCredentialsObject as dS, isCredentialsFunction as dT, type ResolveCredentialsOptions as dU, resolveCredentialsFromEnv as dV, resolveCredentials as dW, getBaseUrlFromCredentials as dX, getClientIdFromCredentials as dY, ClientCredentialsObjectSchema as dZ, PkceCredentialsObjectSchema as d_, inputFieldKeyResolver as da, clientCredentialsNameResolver as db, clientIdResolver as dc, tableIdResolver as dd, triggerInboxResolver as de, workflowIdResolver as df, durableRunIdResolver as dg, workflowVersionIdResolver as dh, workflowRunIdResolver as di, triggerMessagesResolver as dj, tableRecordIdResolver as dk, tableRecordIdsResolver as dl, tableFieldIdsResolver as dm, tableNameResolver as dn, tableFieldsResolver as dp, tableRecordsResolver as dq, tableUpdateRecordsResolver as dr, tableFiltersResolver as ds, tableSortResolver as dt, type ResolveAuthTokenOptions as du, clearTokenCache as dv, invalidateCachedToken as dw, injectCliLogin as dx, isCliLoginAvailable as dy, getTokenFromCliLogin as dz, type AddActionEntryResult as e, type MethodCalledEvent as e$, ResolvedCredentialsSchema as e0, CredentialsFunctionSchema as e1, type CredentialsFunction as e2, CredentialsSchema as e3, ConnectionEntrySchema as e4, type ConnectionEntry as e5, ConnectionsMapSchema as e6, type ConnectionsMap as e7, connectionsPlugin as e8, type ConnectionsPluginProvides as e9, type CreateTableFieldsPluginProvides as eA, deleteTableFieldsPlugin as eB, type DeleteTableFieldsPluginProvides as eC, getTableRecordPlugin as eD, type GetTableRecordPluginProvides as eE, listTableRecordsPlugin as eF, type ListTableRecordsPluginProvides as eG, createTableRecordsPlugin as eH, type CreateTableRecordsPluginProvides as eI, deleteTableRecordsPlugin as eJ, type DeleteTableRecordsPluginProvides as eK, updateTableRecordsPlugin as eL, type UpdateTableRecordsPluginProvides as eM, cleanupEventListeners as eN, type EventEmissionConfig as eO, eventEmissionPlugin as eP, type EventEmissionProvides as eQ, type EventContext as eR, type ApplicationLifecycleEventData as eS, type EnhancedErrorEventData as eT, type MethodCalledEventData as eU, buildApplicationLifecycleEvent as eV, buildErrorEventWithContext as eW, buildErrorEvent as eX, createBaseEvent as eY, buildMethodCalledEvent as eZ, type BaseEvent as e_, ZAPIER_BASE_URL as ea, getZapierSdkService as eb, MAX_PAGE_LIMIT as ec, DEFAULT_PAGE_SIZE as ed, DEFAULT_ACTION_TIMEOUT_MS as ee, ZAPIER_MAX_NETWORK_RETRIES as ef, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS as eg, MAX_CONCURRENCY_LIMIT as eh, parseConcurrencyEnvVar as ei, ZAPIER_MAX_CONCURRENT_REQUESTS as ej, getZapierApprovalMode as ek, getZapierOpenAutoModeApprovalsInBrowser as el, getZapierDefaultApprovalMode as em, DEFAULT_APPROVAL_TIMEOUT_MS as en, DEFAULT_MAX_APPROVAL_RETRIES as eo, listTablesPlugin as ep, type ListTablesPluginProvides as eq, getTablePlugin as er, type GetTablePluginProvides as es, createTablePlugin as et, type CreateTablePluginProvides as eu, deleteTablePlugin as ev, type DeleteTablePluginProvides as ew, listTableFieldsPlugin as ex, type ListTableFieldsPluginProvides as ey, createTableFieldsPlugin as ez, type ActionEntry as f, generateEventId as f0, getCurrentTimestamp as f1, getReleaseId as f2, getOsInfo as f3, getPlatformVersions as f4, isCi as f5, getCiPlatform as f6, getMemoryUsage as f7, getCpuTime as f8, getTtyContext as f9, getAgent as fa, createZapierSdk as fb, createZapierSdkStack as fc, type ZapierSdk as fd, findManifestEntry as g, type CapabilitiesContext as h, type PaginatedSdkResult as i, type CreateConnectionItem as j, type PositionalMetadata as k, type ZapierFetchInitOptions as l, type DynamicResolver as m, type WatchTriggerInboxOptions as n, type ActionProxy as o, type ZapierSdkApps as p, type WithAddPlugin as q, readManifestFromFile as r, ZapierAbortDrainSignal as s, ZapierReleaseTriggerMessageSignal as t, type DrainTriggerInboxCallback as u, type DrainTriggerInboxErrorObserver as v, type ListAuthenticationsPluginProvides as w, type GetAuthenticationPluginProvides as x, type FindFirstAuthenticationPluginProvides as y, type FindUniqueAuthenticationPluginProvides as z };
@@ -7111,6 +7111,27 @@ declare const apiPlugin: (sdk: {
7111
7111
  };
7112
7112
  type ApiPluginProvides = ReturnType<typeof apiPlugin>;
7113
7113
 
7114
+ interface CallerContext {
7115
+ packageOperation?: string;
7116
+ }
7117
+ /**
7118
+ * Run `fn` with the given caller context merged onto any parent context, so
7119
+ * the operation that initiated the call (e.g. a CLI command or MCP tool) stays
7120
+ * observable through every SDK call it makes.
7121
+ *
7122
+ * Caller context is telemetry-only: reading the parent scope is wrapped so a
7123
+ * broken ALS store can never crash the wrapped command. Errors thrown by `fn`
7124
+ * itself are intentionally NOT caught — they propagate.
7125
+ */
7126
+ declare function runWithCallerContext<T>(context: CallerContext, fn: () => T): T;
7127
+ /**
7128
+ * Read the active caller context, or an empty object outside any caller scope.
7129
+ *
7130
+ * Read on the outbound HTTP path to set a telemetry header, so a failure here
7131
+ * must never break the request — it falls back to an empty context.
7132
+ */
7133
+ declare function getCallerContext(): CallerContext;
7134
+
7114
7135
  /**
7115
7136
  * Batch Operation Utilities
7116
7137
  *
@@ -15567,4 +15588,4 @@ declare const registryPlugin: (sdk: {
15567
15588
  };
15568
15589
  }) => {};
15569
15590
 
15570
- export { type ConnectionsResponse 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 GetConnectionStartUrlItem as G, type Action as H, type App as I, type Field as J, type Choice as K, type LeasedTriggerMessageItem as L, type MethodHooks as M, type Need as N, type OutputFormatter as O, type PluginStack as P, type ActionExecutionResult as Q, type ResolvedAppLocator as R, type ActionField as S, type TriggerMessageStatus as T, type UpdateManifestEntryOptions as U, type ActionFieldChoice as V, type WaitForNewConnectionItem as W, type NeedsRequest as X, type NeedsResponse as Y, type ZapierSdkOptions as Z, type Connection as _, type PluginMeta as a, AppPropertySchema as a$, type UserProfile as a0, isPositional as a1, createFunction as a2, createPluginStack as a3, createCorePlugin as a4, addPlugin as a5, type FormattedItem as a6, type Resolver as a7, type ArrayResolver as a8, type ResolverMetadata as a9, CoreErrorCode as aA, type Plugin as aB, type PluginProvides as aC, definePlugin as aD, createPluginMethod as aE, createPaginatedPluginMethod as aF, composePlugins as aG, type ActionItem as aH, type ActionTypeItem as aI, registryPlugin as aJ, type RequestOptions as aK, type PollOptions as aL, createZapierApi as aM, getOrCreateApiClient as aN, isPermanentHttpError as aO, type SseMessage as aP, type JsonSseMessage as aQ, type AppItem as aR, type ConnectionItem as aS, type ActionItem$1 as aT, type InputFieldItem as aU, type InfoFieldItem as aV, type RootFieldItem as aW, type UserProfileItem as aX, type SdkPage as aY, type PaginatedSdkFunction as aZ, AppKeyPropertySchema as a_, type StaticResolver as aa, type DynamicListResolver as ab, type DynamicSearchResolver as ac, type FieldsResolver as ad, runInMethodScope as ae, runWithTelemetryContext as af, toSnakeCase as ag, toTitleCase as ah, batch as ai, type BatchOptions as aj, buildCapabilityMessage as ak, logDeprecation as al, resetDeprecationWarnings as am, RelayRequestSchema as an, RelayFetchSchema as ao, createZapierSdkWithoutRegistry as ap, createSdk as aq, createOptionsPlugin as ar, createZapierCoreStack as as, type FunctionRegistryEntry as at, type FunctionDeprecation as au, BaseSdkOptionsSchema as av, isCoreError as aw, getCoreErrorCode as ax, getCoreErrorCause as ay, CORE_ERROR_SYMBOL as az, type Manifest 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 ErrorOptions as bS, ZapierError as bT, ZapierValidationError as bU, ZapierUnknownError as bV, ZapierAuthenticationError as bW, zapierAdaptError as bX, ZapierApiError as bY, ZapierAppNotFoundError 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 UpdateManifestEntryResult as c, type ApiPluginProvides 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, type DeleteClientCredentialsPluginProvides as cA, getAppPlugin as cB, type GetAppPluginProvides as cC, getActionPlugin as cD, type GetActionPluginProvides as cE, getConnectionPlugin as cF, type GetConnectionPluginProvides as cG, findFirstConnectionPlugin as cH, type FindFirstConnectionPluginProvides as cI, findUniqueConnectionPlugin as cJ, type FindUniqueConnectionPluginProvides as cK, CONTEXT_CACHE_TTL_MS as cL, CONTEXT_CACHE_MAX_SIZE as cM, runActionPlugin as cN, type RunActionPluginProvides as cO, requestPlugin as cP, type RequestPluginProvides as cQ, type ManifestPluginOptions as cR, getPreferredManifestEntryKey as cS, manifestPlugin as cT, type ManifestPluginProvides as cU, DEFAULT_CONFIG_PATH as cV, type ManifestEntry as cW, getProfilePlugin as cX, type GetProfilePluginProvides as cY, type ApiPluginOptions as cZ, apiPlugin as c_, formatErrorMessage as ca, type ApiError as cb, ZapierSignal as cc, appsPlugin as cd, type AppsPluginProvides as ce, type ActionExecutionOptions as cf, type AppFactoryInput as cg, fetchPlugin as ch, type FetchPluginProvides as ci, listAppsPlugin as cj, type ListAppsPluginProvides as ck, listActionsPlugin as cl, type ListActionsPluginProvides as cm, listActionInputFieldsPlugin as cn, type ListActionInputFieldsPluginProvides as co, listActionInputFieldChoicesPlugin as cp, type ListActionInputFieldChoicesPluginProvides as cq, getActionInputFieldsSchemaPlugin as cr, type GetActionInputFieldsSchemaPluginProvides as cs, listConnectionsPlugin as ct, type ListConnectionsPluginProvides as cu, listClientCredentialsPlugin as cv, type ListClientCredentialsPluginProvides as cw, createClientCredentialsPlugin as cx, type CreateClientCredentialsPluginProvides as cy, deleteClientCredentialsPlugin as cz, type AddActionEntryOptions as d, type CredentialsFunction as d$, appKeyResolver as d0, actionTypeResolver as d1, actionKeyResolver as d2, connectionIdResolver as d3, connectionIdGenericResolver as d4, inputsResolver as d5, inputsAllOptionalResolver as d6, inputFieldKeyResolver as d7, clientCredentialsNameResolver as d8, clientIdResolver as d9, type ZapierCacheEntry as dA, type ZapierCacheSetOptions as dB, createMemoryCache as dC, type SdkEvent as dD, type AuthEvent as dE, type ApiEvent as dF, type LoadingEvent as dG, type EventCallback as dH, type Credentials as dI, type ResolvedCredentials as dJ, type CredentialsObject as dK, type ClientCredentialsObject as dL, type PkceCredentialsObject as dM, isClientCredentials as dN, isPkceCredentials as dO, isCredentialsObject as dP, isCredentialsFunction as dQ, type ResolveCredentialsOptions as dR, resolveCredentialsFromEnv as dS, resolveCredentials as dT, getBaseUrlFromCredentials as dU, getClientIdFromCredentials as dV, ClientCredentialsObjectSchema as dW, PkceCredentialsObjectSchema as dX, CredentialsObjectSchema as dY, ResolvedCredentialsSchema as dZ, CredentialsFunctionSchema as d_, tableIdResolver as da, triggerInboxResolver as db, workflowIdResolver as dc, durableRunIdResolver as dd, workflowVersionIdResolver as de, workflowRunIdResolver as df, triggerMessagesResolver as dg, tableRecordIdResolver as dh, tableRecordIdsResolver as di, tableFieldIdsResolver as dj, tableNameResolver as dk, tableFieldsResolver as dl, tableRecordsResolver as dm, tableUpdateRecordsResolver as dn, tableFiltersResolver as dp, tableSortResolver as dq, type ResolveAuthTokenOptions as dr, clearTokenCache as ds, invalidateCachedToken as dt, injectCliLogin as du, isCliLoginAvailable as dv, getTokenFromCliLogin as dw, resolveAuthToken as dx, invalidateCredentialsToken as dy, type ZapierCache as dz, type AddActionEntryResult as e, getReleaseId as e$, CredentialsSchema as e0, ConnectionEntrySchema as e1, type ConnectionEntry as e2, ConnectionsMapSchema as e3, type ConnectionsMap as e4, connectionsPlugin as e5, type ConnectionsPluginProvides as e6, ZAPIER_BASE_URL as e7, getZapierSdkService as e8, MAX_PAGE_LIMIT as e9, getTableRecordPlugin as eA, type GetTableRecordPluginProvides as eB, listTableRecordsPlugin as eC, type ListTableRecordsPluginProvides as eD, createTableRecordsPlugin as eE, type CreateTableRecordsPluginProvides as eF, deleteTableRecordsPlugin as eG, type DeleteTableRecordsPluginProvides as eH, updateTableRecordsPlugin as eI, type UpdateTableRecordsPluginProvides as eJ, cleanupEventListeners as eK, type EventEmissionConfig as eL, eventEmissionPlugin as eM, type EventEmissionProvides as eN, type EventContext as eO, type ApplicationLifecycleEventData as eP, type EnhancedErrorEventData as eQ, type MethodCalledEventData as eR, buildApplicationLifecycleEvent as eS, buildErrorEventWithContext as eT, buildErrorEvent as eU, createBaseEvent as eV, buildMethodCalledEvent as eW, type BaseEvent as eX, type MethodCalledEvent as eY, generateEventId as eZ, getCurrentTimestamp as e_, DEFAULT_PAGE_SIZE as ea, DEFAULT_ACTION_TIMEOUT_MS as eb, ZAPIER_MAX_NETWORK_RETRIES as ec, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS as ed, MAX_CONCURRENCY_LIMIT as ee, parseConcurrencyEnvVar as ef, ZAPIER_MAX_CONCURRENT_REQUESTS as eg, getZapierApprovalMode as eh, getZapierOpenAutoModeApprovalsInBrowser as ei, getZapierDefaultApprovalMode as ej, DEFAULT_APPROVAL_TIMEOUT_MS as ek, DEFAULT_MAX_APPROVAL_RETRIES as el, listTablesPlugin as em, type ListTablesPluginProvides as en, getTablePlugin as eo, type GetTablePluginProvides as ep, createTablePlugin as eq, type CreateTablePluginProvides as er, deleteTablePlugin as es, type DeleteTablePluginProvides as et, listTableFieldsPlugin as eu, type ListTableFieldsPluginProvides as ev, createTableFieldsPlugin as ew, type CreateTableFieldsPluginProvides as ex, deleteTableFieldsPlugin as ey, type DeleteTableFieldsPluginProvides as ez, type ActionEntry as f, getOsInfo as f0, getPlatformVersions as f1, isCi as f2, getCiPlatform as f3, getMemoryUsage as f4, getCpuTime as f5, getTtyContext as f6, getAgent as f7, createZapierSdk as f8, createZapierSdkStack as f9, type ZapierSdk as fa, findManifestEntry as g, type CapabilitiesContext as h, type PaginatedSdkResult as i, type CreateConnectionItem as j, type PositionalMetadata as k, type ZapierFetchInitOptions as l, type DynamicResolver as m, type WatchTriggerInboxOptions as n, type ActionProxy as o, type ZapierSdkApps as p, type WithAddPlugin as q, readManifestFromFile as r, ZapierAbortDrainSignal as s, ZapierReleaseTriggerMessageSignal as t, type DrainTriggerInboxCallback as u, type DrainTriggerInboxErrorObserver as v, type ListAuthenticationsPluginProvides as w, type GetAuthenticationPluginProvides as x, type FindFirstAuthenticationPluginProvides as y, type FindUniqueAuthenticationPluginProvides as z };
15591
+ export { type ConnectionsResponse 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 GetConnectionStartUrlItem as G, type Action as H, type App as I, type Field as J, type Choice as K, type LeasedTriggerMessageItem as L, type MethodHooks as M, type Need as N, type OutputFormatter as O, type PluginStack as P, type ActionExecutionResult as Q, type ResolvedAppLocator as R, type ActionField as S, type TriggerMessageStatus as T, type UpdateManifestEntryOptions as U, type ActionFieldChoice as V, type WaitForNewConnectionItem as W, type NeedsRequest as X, type NeedsResponse as Y, type ZapierSdkOptions as Z, type Connection as _, type PluginMeta as a, type SdkPage as a$, type UserProfile as a0, isPositional as a1, createFunction as a2, createPluginStack as a3, createCorePlugin as a4, addPlugin as a5, type FormattedItem as a6, type Resolver as a7, type ArrayResolver as a8, type ResolverMetadata as a9, getCoreErrorCode as aA, getCoreErrorCause as aB, CORE_ERROR_SYMBOL as aC, CoreErrorCode as aD, type Plugin as aE, type PluginProvides as aF, definePlugin as aG, createPluginMethod as aH, createPaginatedPluginMethod as aI, composePlugins as aJ, type ActionItem as aK, type ActionTypeItem as aL, registryPlugin as aM, type RequestOptions as aN, type PollOptions as aO, createZapierApi as aP, getOrCreateApiClient as aQ, isPermanentHttpError as aR, type SseMessage as aS, type JsonSseMessage as aT, type AppItem as aU, type ConnectionItem as aV, type ActionItem$1 as aW, type InputFieldItem as aX, type InfoFieldItem as aY, type RootFieldItem as aZ, type UserProfileItem as a_, type StaticResolver as aa, type DynamicListResolver as ab, type DynamicSearchResolver as ac, type FieldsResolver as ad, runInMethodScope as ae, runWithTelemetryContext as af, getCallerContext as ag, runWithCallerContext as ah, type CallerContext as ai, toSnakeCase as aj, toTitleCase as ak, batch as al, type BatchOptions as am, buildCapabilityMessage as an, logDeprecation as ao, resetDeprecationWarnings as ap, RelayRequestSchema as aq, RelayFetchSchema as ar, createZapierSdkWithoutRegistry as as, createSdk as at, createOptionsPlugin as au, createZapierCoreStack as av, type FunctionRegistryEntry as aw, type FunctionDeprecation as ax, BaseSdkOptionsSchema as ay, isCoreError as az, type Manifest as b, ZapierApiError as b$, type PaginatedSdkFunction as b0, AppKeyPropertySchema as b1, AppPropertySchema as b2, ActionTypePropertySchema as b3, ActionKeyPropertySchema as b4, ActionPropertySchema as b5, InputFieldPropertySchema as b6, ConnectionIdPropertySchema as b7, AuthenticationIdPropertySchema as b8, ConnectionPropertySchema as b9, type ConnectionProperty as bA, type AuthenticationIdProperty as bB, type InputsProperty as bC, type LimitProperty as bD, type OffsetProperty as bE, type OutputProperty as bF, type DebugProperty as bG, type ParamsProperty as bH, type ActionTimeoutMsProperty as bI, type TableProperty as bJ, type RecordProperty as bK, type RecordsProperty as bL, type FieldsProperty as bM, type AppsProperty as bN, type TablesProperty as bO, type ConnectionsProperty as bP, type TriggerInboxProperty as bQ, type TriggerInboxNameProperty as bR, type LeaseProperty as bS, type LeaseSecondsProperty as bT, type LeaseLimitProperty as bU, type ErrorOptions as bV, ZapierError as bW, ZapierValidationError as bX, ZapierUnknownError as bY, ZapierAuthenticationError as bZ, zapierAdaptError as b_, InputsPropertySchema as ba, LimitPropertySchema as bb, OffsetPropertySchema as bc, OutputPropertySchema as bd, DebugPropertySchema as be, ParamsPropertySchema as bf, ActionTimeoutMsPropertySchema as bg, TablePropertySchema as bh, RecordPropertySchema as bi, RecordsPropertySchema as bj, FieldsPropertySchema as bk, AppsPropertySchema as bl, TablesPropertySchema as bm, ConnectionsPropertySchema as bn, TriggerInboxPropertySchema as bo, TriggerInboxNamePropertySchema as bp, LeasePropertySchema as bq, LeaseSecondsPropertySchema as br, LeaseLimitPropertySchema as bs, type AppKeyProperty as bt, type AppProperty as bu, type ActionTypeProperty as bv, type ActionKeyProperty as bw, type ActionProperty as bx, type InputFieldProperty as by, type ConnectionIdProperty as bz, type UpdateManifestEntryResult as c, type GetProfilePluginProvides as c$, ZapierAppNotFoundError as c0, ZapierNotFoundError as c1, ZapierResourceNotFoundError as c2, ZapierConfigurationError as c3, ZapierBundleError as c4, ZapierTimeoutError as c5, ZapierActionError as c6, ZapierConflictError as c7, type RateLimitInfo as c8, ZapierRateLimitError as c9, createClientCredentialsPlugin as cA, type CreateClientCredentialsPluginProvides as cB, deleteClientCredentialsPlugin as cC, type DeleteClientCredentialsPluginProvides as cD, getAppPlugin as cE, type GetAppPluginProvides as cF, getActionPlugin as cG, type GetActionPluginProvides as cH, getConnectionPlugin as cI, type GetConnectionPluginProvides as cJ, findFirstConnectionPlugin as cK, type FindFirstConnectionPluginProvides as cL, findUniqueConnectionPlugin as cM, type FindUniqueConnectionPluginProvides as cN, CONTEXT_CACHE_TTL_MS as cO, CONTEXT_CACHE_MAX_SIZE as cP, runActionPlugin as cQ, type RunActionPluginProvides as cR, requestPlugin as cS, type RequestPluginProvides as cT, type ManifestPluginOptions as cU, getPreferredManifestEntryKey as cV, manifestPlugin as cW, type ManifestPluginProvides as cX, DEFAULT_CONFIG_PATH as cY, type ManifestEntry as cZ, getProfilePlugin as c_, type ApprovalStatus as ca, ZapierApprovalError as cb, ZapierRelayError as cc, formatErrorMessage as cd, type ApiError as ce, ZapierSignal as cf, appsPlugin as cg, type AppsPluginProvides as ch, type ActionExecutionOptions as ci, type AppFactoryInput as cj, fetchPlugin as ck, type FetchPluginProvides as cl, listAppsPlugin as cm, type ListAppsPluginProvides as cn, listActionsPlugin as co, type ListActionsPluginProvides as cp, listActionInputFieldsPlugin as cq, type ListActionInputFieldsPluginProvides as cr, listActionInputFieldChoicesPlugin as cs, type ListActionInputFieldChoicesPluginProvides as ct, getActionInputFieldsSchemaPlugin as cu, type GetActionInputFieldsSchemaPluginProvides as cv, listConnectionsPlugin as cw, type ListConnectionsPluginProvides as cx, listClientCredentialsPlugin as cy, type ListClientCredentialsPluginProvides as cz, type AddActionEntryOptions as d, CredentialsObjectSchema as d$, type ApiPluginOptions as d0, apiPlugin as d1, type ApiPluginProvides as d2, appKeyResolver as d3, actionTypeResolver as d4, actionKeyResolver as d5, connectionIdResolver as d6, connectionIdGenericResolver as d7, inputsResolver as d8, inputsAllOptionalResolver as d9, resolveAuthToken as dA, invalidateCredentialsToken as dB, type ZapierCache as dC, type ZapierCacheEntry as dD, type ZapierCacheSetOptions as dE, createMemoryCache as dF, type SdkEvent as dG, type AuthEvent as dH, type ApiEvent as dI, type LoadingEvent as dJ, type EventCallback as dK, type Credentials as dL, type ResolvedCredentials as dM, type CredentialsObject as dN, type ClientCredentialsObject as dO, type PkceCredentialsObject as dP, isClientCredentials as dQ, isPkceCredentials as dR, isCredentialsObject as dS, isCredentialsFunction as dT, type ResolveCredentialsOptions as dU, resolveCredentialsFromEnv as dV, resolveCredentials as dW, getBaseUrlFromCredentials as dX, getClientIdFromCredentials as dY, ClientCredentialsObjectSchema as dZ, PkceCredentialsObjectSchema as d_, inputFieldKeyResolver as da, clientCredentialsNameResolver as db, clientIdResolver as dc, tableIdResolver as dd, triggerInboxResolver as de, workflowIdResolver as df, durableRunIdResolver as dg, workflowVersionIdResolver as dh, workflowRunIdResolver as di, triggerMessagesResolver as dj, tableRecordIdResolver as dk, tableRecordIdsResolver as dl, tableFieldIdsResolver as dm, tableNameResolver as dn, tableFieldsResolver as dp, tableRecordsResolver as dq, tableUpdateRecordsResolver as dr, tableFiltersResolver as ds, tableSortResolver as dt, type ResolveAuthTokenOptions as du, clearTokenCache as dv, invalidateCachedToken as dw, injectCliLogin as dx, isCliLoginAvailable as dy, getTokenFromCliLogin as dz, type AddActionEntryResult as e, type MethodCalledEvent as e$, ResolvedCredentialsSchema as e0, CredentialsFunctionSchema as e1, type CredentialsFunction as e2, CredentialsSchema as e3, ConnectionEntrySchema as e4, type ConnectionEntry as e5, ConnectionsMapSchema as e6, type ConnectionsMap as e7, connectionsPlugin as e8, type ConnectionsPluginProvides as e9, type CreateTableFieldsPluginProvides as eA, deleteTableFieldsPlugin as eB, type DeleteTableFieldsPluginProvides as eC, getTableRecordPlugin as eD, type GetTableRecordPluginProvides as eE, listTableRecordsPlugin as eF, type ListTableRecordsPluginProvides as eG, createTableRecordsPlugin as eH, type CreateTableRecordsPluginProvides as eI, deleteTableRecordsPlugin as eJ, type DeleteTableRecordsPluginProvides as eK, updateTableRecordsPlugin as eL, type UpdateTableRecordsPluginProvides as eM, cleanupEventListeners as eN, type EventEmissionConfig as eO, eventEmissionPlugin as eP, type EventEmissionProvides as eQ, type EventContext as eR, type ApplicationLifecycleEventData as eS, type EnhancedErrorEventData as eT, type MethodCalledEventData as eU, buildApplicationLifecycleEvent as eV, buildErrorEventWithContext as eW, buildErrorEvent as eX, createBaseEvent as eY, buildMethodCalledEvent as eZ, type BaseEvent as e_, ZAPIER_BASE_URL as ea, getZapierSdkService as eb, MAX_PAGE_LIMIT as ec, DEFAULT_PAGE_SIZE as ed, DEFAULT_ACTION_TIMEOUT_MS as ee, ZAPIER_MAX_NETWORK_RETRIES as ef, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS as eg, MAX_CONCURRENCY_LIMIT as eh, parseConcurrencyEnvVar as ei, ZAPIER_MAX_CONCURRENT_REQUESTS as ej, getZapierApprovalMode as ek, getZapierOpenAutoModeApprovalsInBrowser as el, getZapierDefaultApprovalMode as em, DEFAULT_APPROVAL_TIMEOUT_MS as en, DEFAULT_MAX_APPROVAL_RETRIES as eo, listTablesPlugin as ep, type ListTablesPluginProvides as eq, getTablePlugin as er, type GetTablePluginProvides as es, createTablePlugin as et, type CreateTablePluginProvides as eu, deleteTablePlugin as ev, type DeleteTablePluginProvides as ew, listTableFieldsPlugin as ex, type ListTableFieldsPluginProvides as ey, createTableFieldsPlugin as ez, type ActionEntry as f, generateEventId as f0, getCurrentTimestamp as f1, getReleaseId as f2, getOsInfo as f3, getPlatformVersions as f4, isCi as f5, getCiPlatform as f6, getMemoryUsage as f7, getCpuTime as f8, getTtyContext as f9, getAgent as fa, createZapierSdk as fb, createZapierSdkStack as fc, type ZapierSdk as fd, findManifestEntry as g, type CapabilitiesContext as h, type PaginatedSdkResult as i, type CreateConnectionItem as j, type PositionalMetadata as k, type ZapierFetchInitOptions as l, type DynamicResolver as m, type WatchTriggerInboxOptions as n, type ActionProxy as o, type ZapierSdkApps as p, type WithAddPlugin as q, readManifestFromFile as r, ZapierAbortDrainSignal as s, ZapierReleaseTriggerMessageSignal as t, type DrainTriggerInboxCallback as u, type DrainTriggerInboxErrorObserver as v, type ListAuthenticationsPluginProvides as w, type GetAuthenticationPluginProvides as x, type FindFirstAuthenticationPluginProvides as y, type FindUniqueAuthenticationPluginProvides as z };
package/dist/index.cjs CHANGED
@@ -475,22 +475,34 @@ function createValidator(schema, { adaptError } = {}) {
475
475
  };
476
476
  }
477
477
  var validateOptions = (schema, options, { adaptError } = {}) => parseOrThrow(schema, options, { adaptError });
478
- var scopeStore = null;
479
- try {
480
- scopeStore = new async_hooks.AsyncLocalStorage();
481
- } catch {
478
+ function createAsyncContext() {
479
+ let store = null;
480
+ try {
481
+ store = new async_hooks.AsyncLocalStorage();
482
+ } catch {
483
+ store = null;
484
+ }
485
+ return {
486
+ available: store !== null,
487
+ run(value, fn) {
488
+ return store ? store.run(value, fn) : fn();
489
+ },
490
+ get() {
491
+ return store?.getStore();
492
+ }
493
+ };
482
494
  }
495
+ var scope = createAsyncContext();
483
496
  function getCurrentScope() {
484
- if (!scopeStore) return void 0;
485
- return scopeStore.getStore();
497
+ return scope.get();
486
498
  }
487
499
  function getCurrentDepth() {
488
500
  return getCurrentScope()?.depth ?? 0;
489
501
  }
490
502
  function runInMethodScope(fn) {
491
- if (!scopeStore) return fn();
492
- const currentDepth = scopeStore.getStore()?.depth ?? -1;
493
- return scopeStore.run({ depth: currentDepth + 1 }, fn);
503
+ if (!scope.available) return fn();
504
+ const currentDepth = scope.get()?.depth ?? -1;
505
+ return scope.run({ depth: currentDepth + 1 }, fn);
494
506
  }
495
507
  var runWithTelemetryContext = runInMethodScope;
496
508
  function normalizeError(error, adaptError) {
@@ -3607,10 +3619,10 @@ var tableSortResolver = {
3607
3619
  // src/plugins/eventEmission/method-metadata.ts
3608
3620
  var SCOPE_KEY = "methodMetadata";
3609
3621
  function setMethodMetadata(metadata) {
3610
- const scope = getCurrentScope();
3611
- if (!scope) return;
3612
- const existing = scope[SCOPE_KEY];
3613
- scope[SCOPE_KEY] = { ...existing, ...metadata };
3622
+ const scope2 = getCurrentScope();
3623
+ if (!scope2) return;
3624
+ const existing = scope2[SCOPE_KEY];
3625
+ scope2[SCOPE_KEY] = { ...existing, ...metadata };
3614
3626
  }
3615
3627
  function getMethodMetadata() {
3616
3628
  return getCurrentScope()?.[SCOPE_KEY];
@@ -6461,10 +6473,10 @@ function mergeScopes(credentialsScope, requiredScopes) {
6461
6473
  return [...scopeSet].sort();
6462
6474
  }
6463
6475
  async function exchangeClientCredentials(options) {
6464
- const { clientId, clientSecret, baseUrl, scope, requiredScopes, onEvent } = options;
6476
+ const { clientId, clientSecret, baseUrl, scope: scope2, requiredScopes, onEvent } = options;
6465
6477
  const fetchFn = options.fetch || globalThis.fetch;
6466
6478
  const tokenUrl = getTokenEndpointUrl(baseUrl);
6467
- const mergedScopes = mergeScopes(scope, requiredScopes);
6479
+ const mergedScopes = mergeScopes(scope2, requiredScopes);
6468
6480
  const scopeString = mergedScopes.join(" ");
6469
6481
  onEvent?.({
6470
6482
  type: "auth_exchanging",
@@ -6729,6 +6741,25 @@ async function invalidateCredentialsToken(options) {
6729
6741
  }
6730
6742
  }
6731
6743
 
6744
+ // src/utils/caller-context.ts
6745
+ var callerContext = createAsyncContext();
6746
+ function runWithCallerContext(context, fn) {
6747
+ let parent;
6748
+ try {
6749
+ parent = callerContext.get() ?? {};
6750
+ } catch {
6751
+ return fn();
6752
+ }
6753
+ return callerContext.run({ ...parent, ...context }, fn);
6754
+ }
6755
+ function getCallerContext() {
6756
+ try {
6757
+ return callerContext.get() ?? {};
6758
+ } catch {
6759
+ return {};
6760
+ }
6761
+ }
6762
+
6732
6763
  // src/api/sse-parser.ts
6733
6764
  async function* jsonFrames(source) {
6734
6765
  for await (const { data } of source) {
@@ -6880,7 +6911,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
6880
6911
  }
6881
6912
 
6882
6913
  // src/sdk-version.ts
6883
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.73.1" : void 0) || "unknown";
6914
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.74.0" : void 0) || "unknown";
6884
6915
 
6885
6916
  // src/utils/open-url.ts
6886
6917
  var nodePrefix = "node:";
@@ -7604,6 +7635,10 @@ var ZapierApiClient = class {
7604
7635
  headers.set("x-zapier-sdk-package", callerPackage.name);
7605
7636
  headers.set("zapier-sdk-package-version", callerPackage.version);
7606
7637
  headers.set("x-zapier-sdk-package-version", callerPackage.version);
7638
+ const { packageOperation } = getCallerContext();
7639
+ if (packageOperation) {
7640
+ headers.set("zapier-sdk-package-operation", packageOperation);
7641
+ }
7607
7642
  }
7608
7643
  }
7609
7644
  // Helper to perform HTTP requests with JSON handling
@@ -10409,6 +10444,7 @@ exports.getActionPlugin = getActionPlugin;
10409
10444
  exports.getAgent = getAgent;
10410
10445
  exports.getAppPlugin = getAppPlugin;
10411
10446
  exports.getBaseUrlFromCredentials = getBaseUrlFromCredentials;
10447
+ exports.getCallerContext = getCallerContext;
10412
10448
  exports.getCiPlatform = getCiPlatform;
10413
10449
  exports.getClientIdFromCredentials = getClientIdFromCredentials;
10414
10450
  exports.getConnectionPlugin = getConnectionPlugin;
@@ -10467,6 +10503,7 @@ exports.resolveCredentials = resolveCredentials;
10467
10503
  exports.resolveCredentialsFromEnv = resolveCredentialsFromEnv;
10468
10504
  exports.runActionPlugin = runActionPlugin;
10469
10505
  exports.runInMethodScope = runInMethodScope;
10506
+ exports.runWithCallerContext = runWithCallerContext;
10470
10507
  exports.runWithTelemetryContext = runWithTelemetryContext;
10471
10508
  exports.tableFieldIdsResolver = tableFieldIdsResolver;
10472
10509
  exports.tableFieldsResolver = tableFieldsResolver;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { H as Action, f as ActionEntry, cf as ActionExecutionOptions, Q as ActionExecutionResult, S as ActionField, V as ActionFieldChoice, aT as ActionItem, bt as ActionKeyProperty, b1 as ActionKeyPropertySchema, bu as ActionProperty, b2 as ActionPropertySchema, aH as ActionResolverItem, bF as ActionTimeoutMsProperty, bd as ActionTimeoutMsPropertySchema, aI as ActionTypeItem, bs as ActionTypeProperty, b0 as ActionTypePropertySchema, d as AddActionEntryOptions, e as AddActionEntryResult, A as ApiClient, cb as ApiError, dF as ApiEvent, cZ as ApiPluginOptions, c$ as ApiPluginProvides, I as App, cg as AppFactoryInput, aR as AppItem, bq as AppKeyProperty, a_ as AppKeyPropertySchema, br as AppProperty, a$ as AppPropertySchema, eP as ApplicationLifecycleEventData, c7 as ApprovalStatus, ce as AppsPluginProvides, bK as AppsProperty, bi as AppsPropertySchema, a8 as ArrayResolver, dE as AuthEvent, by as AuthenticationIdProperty, b5 as AuthenticationIdPropertySchema, eX as BaseEvent, av as BaseSdkOptionsSchema, aj as BatchOptions, cM as CONTEXT_CACHE_MAX_SIZE, cL as CONTEXT_CACHE_TTL_MS, az as CORE_ERROR_SYMBOL, K as Choice, dL as ClientCredentialsObject, dW as ClientCredentialsObjectSchema, _ as Connection, e2 as ConnectionEntry, e1 as ConnectionEntrySchema, bw as ConnectionIdProperty, b4 as ConnectionIdPropertySchema, aS as ConnectionItem, bx as ConnectionProperty, b6 as ConnectionPropertySchema, e4 as ConnectionsMap, e3 as ConnectionsMapSchema, e6 as ConnectionsPluginProvides, bM as ConnectionsProperty, bk as ConnectionsPropertySchema, $ as ConnectionsResponse, aA as CoreErrorCode, cy as CreateClientCredentialsPluginProvides, ex as CreateTableFieldsPluginProvides, er as CreateTablePluginProvides, eF as CreateTableRecordsPluginProvides, dI as Credentials, d$ as CredentialsFunction, d_ as CredentialsFunctionSchema, dK as CredentialsObject, dY as CredentialsObjectSchema, e0 as CredentialsSchema, eb as DEFAULT_ACTION_TIMEOUT_MS, ek as DEFAULT_APPROVAL_TIMEOUT_MS, cV as DEFAULT_CONFIG_PATH, el as DEFAULT_MAX_APPROVAL_RETRIES, ea as DEFAULT_PAGE_SIZE, bD as DebugProperty, bb as DebugPropertySchema, cA as DeleteClientCredentialsPluginProvides, ez as DeleteTableFieldsPluginProvides, et as DeleteTablePluginProvides, eH as DeleteTableRecordsPluginProvides, u as DrainTriggerInboxCallback, v as DrainTriggerInboxErrorObserver, D as DrainTriggerInboxOptions, ab as DynamicListResolver, m as DynamicResolver, ac as DynamicSearchResolver, eQ as EnhancedErrorEventData, bS as ErrorOptions, dH as EventCallback, eO as EventContext, eL as EventEmissionConfig, E as EventEmissionContext, eN as EventEmissionProvides, ci as FetchPluginProvides, J as Field, bJ as FieldsProperty, bh as FieldsPropertySchema, ad as FieldsResolver, F as FieldsetItem, y as FindFirstAuthenticationPluginProvides, cI as FindFirstConnectionPluginProvides, z as FindUniqueAuthenticationPluginProvides, cK as FindUniqueConnectionPluginProvides, a6 as FormattedItem, au as FunctionDeprecation, at as FunctionRegistryEntry, cs as GetActionInputFieldsSchemaPluginProvides, cE as GetActionPluginProvides, cC as GetAppPluginProvides, x as GetAuthenticationPluginProvides, cG as GetConnectionPluginProvides, cY as GetProfilePluginProvides, ep as GetTablePluginProvides, eB as GetTableRecordPluginProvides, aV as InfoFieldItem, aU as InputFieldItem, bv as InputFieldProperty, b3 as InputFieldPropertySchema, bz as InputsProperty, b7 as InputsPropertySchema, aQ as JsonSseMessage, 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, cq as ListActionInputFieldChoicesPluginProvides, co as ListActionInputFieldsPluginProvides, cm as ListActionsPluginProvides, ck as ListAppsPluginProvides, w as ListAuthenticationsPluginProvides, cw as ListClientCredentialsPluginProvides, cu as ListConnectionsPluginProvides, ev as ListTableFieldsPluginProvides, eD as ListTableRecordsPluginProvides, en as ListTablesPluginProvides, dG as LoadingEvent, ee as MAX_CONCURRENCY_LIMIT, e9 as MAX_PAGE_LIMIT, b as Manifest, cW as ManifestEntry, cR as ManifestPluginOptions, cU as ManifestPluginProvides, eY as MethodCalledEvent, eR as MethodCalledEventData, N as Need, X as NeedsRequest, Y as NeedsResponse, bB as OffsetProperty, b9 as OffsetPropertySchema, O as OutputFormatter, bC as OutputProperty, ba as OutputPropertySchema, aZ as PaginatedSdkFunction, i as PaginatedSdkResult, bE as ParamsProperty, bc as ParamsPropertySchema, dM as PkceCredentialsObject, dX as PkceCredentialsObjectSchema, aB as Plugin, a as PluginMeta, aC as PluginProvides, aL as PollOptions, k as PositionalMetadata, c5 as RateLimitInfo, bH as RecordProperty, bf as RecordPropertySchema, bI as RecordsProperty, bg as RecordsPropertySchema, ao as RelayFetchSchema, an as RelayRequestSchema, aK as RequestOptions, cQ as RequestPluginProvides, dr as ResolveAuthTokenOptions, dR as ResolveCredentialsOptions, R as ResolvedAppLocator, dJ as ResolvedCredentials, dZ as ResolvedCredentialsSchema, a7 as Resolver, a9 as ResolverMetadata, aW as RootFieldItem, cO as RunActionPluginProvides, dD as SdkEvent, aY as SdkPage, aP as SseMessage, aa 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, c as UpdateManifestEntryResult, eJ as UpdateTableRecordsPluginProvides, a0 as UserProfile, aX as UserProfileItem, n as WatchTriggerInboxOptions, q as WithAddPlugin, e7 as ZAPIER_BASE_URL, eg as ZAPIER_MAX_CONCURRENT_REQUESTS, ec as ZAPIER_MAX_NETWORK_RETRIES, ed as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, s as ZapierAbortDrainSignal, c3 as ZapierActionError, bY as ZapierApiError, bZ as ZapierAppNotFoundError, c8 as ZapierApprovalError, bW as ZapierAuthenticationError, c1 as ZapierBundleError, dz as ZapierCache, dA as ZapierCacheEntry, dB as ZapierCacheSetOptions, c0 as ZapierConfigurationError, c4 as ZapierConflictError, bT as ZapierError, l as ZapierFetchInitOptions, b_ as ZapierNotFoundError, c6 as ZapierRateLimitError, c9 as ZapierRelayError, t as ZapierReleaseTriggerMessageSignal, b$ as ZapierResourceNotFoundError, fa as ZapierSdk, p as ZapierSdkApps, Z as ZapierSdkOptions, cc as ZapierSignal, c2 as ZapierTimeoutError, bV as ZapierUnknownError, bU as ZapierValidationError, d2 as actionKeyResolver, d1 as actionTypeResolver, a5 as addPlugin, c_ as apiPlugin, d0 as appKeyResolver, cd as appsPlugin, d4 as authenticationIdGenericResolver, d3 as authenticationIdResolver, ai as batch, eS as buildApplicationLifecycleEvent, ak as buildCapabilityMessage, eU as buildErrorEvent, eT as buildErrorEventWithContext, eW as buildMethodCalledEvent, eK as cleanupEventListeners, ds as clearTokenCache, d8 as clientCredentialsNameResolver, d9 as clientIdResolver, aG as composePlugins, d4 as connectionIdGenericResolver, d3 as connectionIdResolver, e5 as connectionsPlugin, eV as createBaseEvent, cx as createClientCredentialsPlugin, a4 as createCorePlugin, a2 as createFunction, dC as createMemoryCache, ar as createOptionsPlugin, aF as createPaginatedPluginMethod, aE as createPluginMethod, a3 as createPluginStack, aq as createSdk, ew as createTableFieldsPlugin, eq as createTablePlugin, eE as createTableRecordsPlugin, aM as createZapierApi, as as createZapierCoreStack, f8 as createZapierSdk, f9 as createZapierSdkStack, ap as createZapierSdkWithoutRegistry, aD as definePlugin, cz as deleteClientCredentialsPlugin, ey as deleteTableFieldsPlugin, es as deleteTablePlugin, eG as deleteTableRecordsPlugin, dd as durableRunIdResolver, eM as eventEmissionPlugin, ch as fetchPlugin, cH as findFirstConnectionPlugin, g as findManifestEntry, cJ as findUniqueConnectionPlugin, ca as formatErrorMessage, eZ as generateEventId, cr as getActionInputFieldsSchemaPlugin, cD as getActionPlugin, f7 as getAgent, cB as getAppPlugin, dU as getBaseUrlFromCredentials, f3 as getCiPlatform, dV as getClientIdFromCredentials, cF as getConnectionPlugin, ay as getCoreErrorCause, ax as getCoreErrorCode, f5 as getCpuTime, e_ as getCurrentTimestamp, f4 as getMemoryUsage, aN as getOrCreateApiClient, f0 as getOsInfo, f1 as getPlatformVersions, cS as getPreferredManifestEntryKey, cX as getProfilePlugin, e$ as getReleaseId, eo as getTablePlugin, eA as getTableRecordPlugin, dw as getTokenFromCliLogin, f6 as getTtyContext, eh as getZapierApprovalMode, ej as getZapierDefaultApprovalMode, ei as getZapierOpenAutoModeApprovalsInBrowser, e8 as getZapierSdkService, du as injectCliLogin, d7 as inputFieldKeyResolver, d6 as inputsAllOptionalResolver, d5 as inputsResolver, dt as invalidateCachedToken, dy as invalidateCredentialsToken, f2 as isCi, dv as isCliLoginAvailable, dN as isClientCredentials, aw as isCoreError, dQ as isCredentialsFunction, dP as isCredentialsObject, aO as isPermanentHttpError, dO as isPkceCredentials, a1 as isPositional, cp as listActionInputFieldChoicesPlugin, cn as listActionInputFieldsPlugin, cl as listActionsPlugin, cj as listAppsPlugin, cv as listClientCredentialsPlugin, ct as listConnectionsPlugin, eu as listTableFieldsPlugin, eC as listTableRecordsPlugin, em as listTablesPlugin, al as logDeprecation, cT as manifestPlugin, ef as parseConcurrencyEnvVar, r as readManifestFromFile, aJ as registryPlugin, cP as requestPlugin, am as resetDeprecationWarnings, dx as resolveAuthToken, dT as resolveCredentials, dS as resolveCredentialsFromEnv, cN as runActionPlugin, ae as runInMethodScope, af as runWithTelemetryContext, dj as tableFieldIdsResolver, dl as tableFieldsResolver, dp as tableFiltersResolver, da as tableIdResolver, dk as tableNameResolver, dh as tableRecordIdResolver, di as tableRecordIdsResolver, dm as tableRecordsResolver, dq as tableSortResolver, dn as tableUpdateRecordsResolver, ag as toSnakeCase, ah as toTitleCase, db as triggerInboxResolver, dg as triggerMessagesResolver, eI as updateTableRecordsPlugin, dc as workflowIdResolver, df as workflowRunIdResolver, de as workflowVersionIdResolver, bX as zapierAdaptError } from './index-D1O7Pcex.mjs';
1
+ export { H as Action, f as ActionEntry, ci as ActionExecutionOptions, Q as ActionExecutionResult, S as ActionField, V as ActionFieldChoice, aW as ActionItem, bw as ActionKeyProperty, b4 as ActionKeyPropertySchema, bx as ActionProperty, b5 as ActionPropertySchema, aK as ActionResolverItem, bI as ActionTimeoutMsProperty, bg as ActionTimeoutMsPropertySchema, aL as ActionTypeItem, bv as ActionTypeProperty, b3 as ActionTypePropertySchema, d as AddActionEntryOptions, e as AddActionEntryResult, A as ApiClient, ce as ApiError, dI as ApiEvent, d0 as ApiPluginOptions, d2 as ApiPluginProvides, I as App, cj as AppFactoryInput, aU as AppItem, bt as AppKeyProperty, b1 as AppKeyPropertySchema, bu as AppProperty, b2 as AppPropertySchema, eS as ApplicationLifecycleEventData, ca as ApprovalStatus, ch as AppsPluginProvides, bN as AppsProperty, bl as AppsPropertySchema, a8 as ArrayResolver, dH as AuthEvent, bB as AuthenticationIdProperty, b8 as AuthenticationIdPropertySchema, e_ as BaseEvent, ay as BaseSdkOptionsSchema, am as BatchOptions, cP as CONTEXT_CACHE_MAX_SIZE, cO as CONTEXT_CACHE_TTL_MS, aC as CORE_ERROR_SYMBOL, ai as CallerContext, K as Choice, dO as ClientCredentialsObject, dZ as ClientCredentialsObjectSchema, _ as Connection, e5 as ConnectionEntry, e4 as ConnectionEntrySchema, bz as ConnectionIdProperty, b7 as ConnectionIdPropertySchema, aV as ConnectionItem, bA as ConnectionProperty, b9 as ConnectionPropertySchema, e7 as ConnectionsMap, e6 as ConnectionsMapSchema, e9 as ConnectionsPluginProvides, bP as ConnectionsProperty, bn as ConnectionsPropertySchema, $ as ConnectionsResponse, aD as CoreErrorCode, cB as CreateClientCredentialsPluginProvides, eA as CreateTableFieldsPluginProvides, eu as CreateTablePluginProvides, eI as CreateTableRecordsPluginProvides, dL as Credentials, e2 as CredentialsFunction, e1 as CredentialsFunctionSchema, dN as CredentialsObject, d$ as CredentialsObjectSchema, e3 as CredentialsSchema, ee as DEFAULT_ACTION_TIMEOUT_MS, en as DEFAULT_APPROVAL_TIMEOUT_MS, cY as DEFAULT_CONFIG_PATH, eo as DEFAULT_MAX_APPROVAL_RETRIES, ed as DEFAULT_PAGE_SIZE, bG as DebugProperty, be as DebugPropertySchema, cD as DeleteClientCredentialsPluginProvides, eC as DeleteTableFieldsPluginProvides, ew as DeleteTablePluginProvides, eK as DeleteTableRecordsPluginProvides, u as DrainTriggerInboxCallback, v as DrainTriggerInboxErrorObserver, D as DrainTriggerInboxOptions, ab as DynamicListResolver, m as DynamicResolver, ac as DynamicSearchResolver, eT as EnhancedErrorEventData, bV as ErrorOptions, dK as EventCallback, eR as EventContext, eO as EventEmissionConfig, E as EventEmissionContext, eQ as EventEmissionProvides, cl as FetchPluginProvides, J as Field, bM as FieldsProperty, bk as FieldsPropertySchema, ad as FieldsResolver, F as FieldsetItem, y as FindFirstAuthenticationPluginProvides, cL as FindFirstConnectionPluginProvides, z as FindUniqueAuthenticationPluginProvides, cN as FindUniqueConnectionPluginProvides, a6 as FormattedItem, ax as FunctionDeprecation, aw as FunctionRegistryEntry, cv as GetActionInputFieldsSchemaPluginProvides, cH as GetActionPluginProvides, cF as GetAppPluginProvides, x as GetAuthenticationPluginProvides, cJ as GetConnectionPluginProvides, c$ as GetProfilePluginProvides, es as GetTablePluginProvides, eE as GetTableRecordPluginProvides, aY as InfoFieldItem, aX as InputFieldItem, by as InputFieldProperty, b6 as InputFieldPropertySchema, bC as InputsProperty, ba as InputsPropertySchema, aT as JsonSseMessage, bU as LeaseLimitProperty, bs as LeaseLimitPropertySchema, bS as LeaseProperty, bq as LeasePropertySchema, bT as LeaseSecondsProperty, br as LeaseSecondsPropertySchema, L as LeasedTriggerMessageItem, bD as LimitProperty, bb as LimitPropertySchema, ct as ListActionInputFieldChoicesPluginProvides, cr as ListActionInputFieldsPluginProvides, cp as ListActionsPluginProvides, cn as ListAppsPluginProvides, w as ListAuthenticationsPluginProvides, cz as ListClientCredentialsPluginProvides, cx as ListConnectionsPluginProvides, ey as ListTableFieldsPluginProvides, eG as ListTableRecordsPluginProvides, eq as ListTablesPluginProvides, dJ as LoadingEvent, eh as MAX_CONCURRENCY_LIMIT, ec as MAX_PAGE_LIMIT, b as Manifest, cZ as ManifestEntry, cU as ManifestPluginOptions, cX as ManifestPluginProvides, e$ as MethodCalledEvent, eU as MethodCalledEventData, N as Need, X as NeedsRequest, Y as NeedsResponse, bE as OffsetProperty, bc as OffsetPropertySchema, O as OutputFormatter, bF as OutputProperty, bd as OutputPropertySchema, b0 as PaginatedSdkFunction, i as PaginatedSdkResult, bH as ParamsProperty, bf as ParamsPropertySchema, dP as PkceCredentialsObject, d_ as PkceCredentialsObjectSchema, aE as Plugin, a as PluginMeta, aF as PluginProvides, aO as PollOptions, k as PositionalMetadata, c8 as RateLimitInfo, bK as RecordProperty, bi as RecordPropertySchema, bL as RecordsProperty, bj as RecordsPropertySchema, ar as RelayFetchSchema, aq as RelayRequestSchema, aN as RequestOptions, cT as RequestPluginProvides, du as ResolveAuthTokenOptions, dU as ResolveCredentialsOptions, R as ResolvedAppLocator, dM as ResolvedCredentials, e0 as ResolvedCredentialsSchema, a7 as Resolver, a9 as ResolverMetadata, aZ as RootFieldItem, cR as RunActionPluginProvides, dG as SdkEvent, a$ as SdkPage, aS as SseMessage, aa as StaticResolver, bJ as TableProperty, bh as TablePropertySchema, bO as TablesProperty, bm as TablesPropertySchema, bR as TriggerInboxNameProperty, bp as TriggerInboxNamePropertySchema, bQ as TriggerInboxProperty, bo as TriggerInboxPropertySchema, T as TriggerMessageStatus, U as UpdateManifestEntryOptions, c as UpdateManifestEntryResult, eM as UpdateTableRecordsPluginProvides, a0 as UserProfile, a_ as UserProfileItem, n as WatchTriggerInboxOptions, q as WithAddPlugin, ea as ZAPIER_BASE_URL, ej as ZAPIER_MAX_CONCURRENT_REQUESTS, ef as ZAPIER_MAX_NETWORK_RETRIES, eg as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, s as ZapierAbortDrainSignal, c6 as ZapierActionError, b$ as ZapierApiError, c0 as ZapierAppNotFoundError, cb as ZapierApprovalError, bZ as ZapierAuthenticationError, c4 as ZapierBundleError, dC as ZapierCache, dD as ZapierCacheEntry, dE as ZapierCacheSetOptions, c3 as ZapierConfigurationError, c7 as ZapierConflictError, bW as ZapierError, l as ZapierFetchInitOptions, c1 as ZapierNotFoundError, c9 as ZapierRateLimitError, cc as ZapierRelayError, t as ZapierReleaseTriggerMessageSignal, c2 as ZapierResourceNotFoundError, fd as ZapierSdk, p as ZapierSdkApps, Z as ZapierSdkOptions, cf as ZapierSignal, c5 as ZapierTimeoutError, bY as ZapierUnknownError, bX as ZapierValidationError, d5 as actionKeyResolver, d4 as actionTypeResolver, a5 as addPlugin, d1 as apiPlugin, d3 as appKeyResolver, cg as appsPlugin, d7 as authenticationIdGenericResolver, d6 as authenticationIdResolver, al as batch, eV as buildApplicationLifecycleEvent, an as buildCapabilityMessage, eX as buildErrorEvent, eW as buildErrorEventWithContext, eZ as buildMethodCalledEvent, eN as cleanupEventListeners, dv as clearTokenCache, db as clientCredentialsNameResolver, dc as clientIdResolver, aJ as composePlugins, d7 as connectionIdGenericResolver, d6 as connectionIdResolver, e8 as connectionsPlugin, eY as createBaseEvent, cA as createClientCredentialsPlugin, a4 as createCorePlugin, a2 as createFunction, dF as createMemoryCache, au as createOptionsPlugin, aI as createPaginatedPluginMethod, aH as createPluginMethod, a3 as createPluginStack, at as createSdk, ez as createTableFieldsPlugin, et as createTablePlugin, eH as createTableRecordsPlugin, aP as createZapierApi, av as createZapierCoreStack, fb as createZapierSdk, fc as createZapierSdkStack, as as createZapierSdkWithoutRegistry, aG as definePlugin, cC as deleteClientCredentialsPlugin, eB as deleteTableFieldsPlugin, ev as deleteTablePlugin, eJ as deleteTableRecordsPlugin, dg as durableRunIdResolver, eP as eventEmissionPlugin, ck as fetchPlugin, cK as findFirstConnectionPlugin, g as findManifestEntry, cM as findUniqueConnectionPlugin, cd as formatErrorMessage, f0 as generateEventId, cu as getActionInputFieldsSchemaPlugin, cG as getActionPlugin, fa as getAgent, cE as getAppPlugin, dX as getBaseUrlFromCredentials, ag as getCallerContext, f6 as getCiPlatform, dY as getClientIdFromCredentials, cI as getConnectionPlugin, aB as getCoreErrorCause, aA as getCoreErrorCode, f8 as getCpuTime, f1 as getCurrentTimestamp, f7 as getMemoryUsage, aQ as getOrCreateApiClient, f3 as getOsInfo, f4 as getPlatformVersions, cV as getPreferredManifestEntryKey, c_ as getProfilePlugin, f2 as getReleaseId, er as getTablePlugin, eD as getTableRecordPlugin, dz as getTokenFromCliLogin, f9 as getTtyContext, ek as getZapierApprovalMode, em as getZapierDefaultApprovalMode, el as getZapierOpenAutoModeApprovalsInBrowser, eb as getZapierSdkService, dx as injectCliLogin, da as inputFieldKeyResolver, d9 as inputsAllOptionalResolver, d8 as inputsResolver, dw as invalidateCachedToken, dB as invalidateCredentialsToken, f5 as isCi, dy as isCliLoginAvailable, dQ as isClientCredentials, az as isCoreError, dT as isCredentialsFunction, dS as isCredentialsObject, aR as isPermanentHttpError, dR as isPkceCredentials, a1 as isPositional, cs as listActionInputFieldChoicesPlugin, cq as listActionInputFieldsPlugin, co as listActionsPlugin, cm as listAppsPlugin, cy as listClientCredentialsPlugin, cw as listConnectionsPlugin, ex as listTableFieldsPlugin, eF as listTableRecordsPlugin, ep as listTablesPlugin, ao as logDeprecation, cW as manifestPlugin, ei as parseConcurrencyEnvVar, r as readManifestFromFile, aM as registryPlugin, cS as requestPlugin, ap as resetDeprecationWarnings, dA as resolveAuthToken, dW as resolveCredentials, dV as resolveCredentialsFromEnv, cQ as runActionPlugin, ae as runInMethodScope, ah as runWithCallerContext, af as runWithTelemetryContext, dm as tableFieldIdsResolver, dp as tableFieldsResolver, ds as tableFiltersResolver, dd as tableIdResolver, dn as tableNameResolver, dk as tableRecordIdResolver, dl as tableRecordIdsResolver, dq as tableRecordsResolver, dt as tableSortResolver, dr as tableUpdateRecordsResolver, aj as toSnakeCase, ak as toTitleCase, de as triggerInboxResolver, dj as triggerMessagesResolver, eL as updateTableRecordsPlugin, df as workflowIdResolver, di as workflowRunIdResolver, dh as workflowVersionIdResolver, b_ as zapierAdaptError } from './index-WMit6fkJ.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
@@ -34,6 +34,7 @@ export { createFunction } from "kitcore";
34
34
  export { createPluginStack, createCorePlugin, addPlugin } from "kitcore";
35
35
  export type { FormattedItem, OutputFormatter, Resolver, ArrayResolver, ResolverMetadata, StaticResolver, DynamicResolver, DynamicListResolver, DynamicSearchResolver, FieldsResolver, } from "kitcore";
36
36
  export { runInMethodScope, runWithTelemetryContext } from "kitcore";
37
+ export { getCallerContext, runWithCallerContext, type CallerContext, } from "./utils/caller-context";
37
38
  export { toSnakeCase, toTitleCase } from "kitcore";
38
39
  export { batch } from "./utils/batch-utils";
39
40
  export type { BatchOptions } from "./utils/batch-utils";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ export { createPluginStack, createCorePlugin, addPlugin } from "kitcore";
36
36
  // Export method-scope utilities for CLI; `runWithTelemetryContext` is kept
37
37
  // as a back-compat alias for the previous name.
38
38
  export { runInMethodScope, runWithTelemetryContext } from "kitcore";
39
+ export { getCallerContext, runWithCallerContext, } from "./utils/caller-context";
39
40
  // Export string utilities
40
41
  export { toSnakeCase, toTitleCase } from "kitcore";
41
42
  // Export batch utilities
package/dist/index.mjs CHANGED
@@ -473,22 +473,34 @@ function createValidator(schema, { adaptError } = {}) {
473
473
  };
474
474
  }
475
475
  var validateOptions = (schema, options, { adaptError } = {}) => parseOrThrow(schema, options, { adaptError });
476
- var scopeStore = null;
477
- try {
478
- scopeStore = new AsyncLocalStorage();
479
- } catch {
476
+ function createAsyncContext() {
477
+ let store = null;
478
+ try {
479
+ store = new AsyncLocalStorage();
480
+ } catch {
481
+ store = null;
482
+ }
483
+ return {
484
+ available: store !== null,
485
+ run(value, fn) {
486
+ return store ? store.run(value, fn) : fn();
487
+ },
488
+ get() {
489
+ return store?.getStore();
490
+ }
491
+ };
480
492
  }
493
+ var scope = createAsyncContext();
481
494
  function getCurrentScope() {
482
- if (!scopeStore) return void 0;
483
- return scopeStore.getStore();
495
+ return scope.get();
484
496
  }
485
497
  function getCurrentDepth() {
486
498
  return getCurrentScope()?.depth ?? 0;
487
499
  }
488
500
  function runInMethodScope(fn) {
489
- if (!scopeStore) return fn();
490
- const currentDepth = scopeStore.getStore()?.depth ?? -1;
491
- return scopeStore.run({ depth: currentDepth + 1 }, fn);
501
+ if (!scope.available) return fn();
502
+ const currentDepth = scope.get()?.depth ?? -1;
503
+ return scope.run({ depth: currentDepth + 1 }, fn);
492
504
  }
493
505
  var runWithTelemetryContext = runInMethodScope;
494
506
  function normalizeError(error, adaptError) {
@@ -3605,10 +3617,10 @@ var tableSortResolver = {
3605
3617
  // src/plugins/eventEmission/method-metadata.ts
3606
3618
  var SCOPE_KEY = "methodMetadata";
3607
3619
  function setMethodMetadata(metadata) {
3608
- const scope = getCurrentScope();
3609
- if (!scope) return;
3610
- const existing = scope[SCOPE_KEY];
3611
- scope[SCOPE_KEY] = { ...existing, ...metadata };
3620
+ const scope2 = getCurrentScope();
3621
+ if (!scope2) return;
3622
+ const existing = scope2[SCOPE_KEY];
3623
+ scope2[SCOPE_KEY] = { ...existing, ...metadata };
3612
3624
  }
3613
3625
  function getMethodMetadata() {
3614
3626
  return getCurrentScope()?.[SCOPE_KEY];
@@ -6459,10 +6471,10 @@ function mergeScopes(credentialsScope, requiredScopes) {
6459
6471
  return [...scopeSet].sort();
6460
6472
  }
6461
6473
  async function exchangeClientCredentials(options) {
6462
- const { clientId, clientSecret, baseUrl, scope, requiredScopes, onEvent } = options;
6474
+ const { clientId, clientSecret, baseUrl, scope: scope2, requiredScopes, onEvent } = options;
6463
6475
  const fetchFn = options.fetch || globalThis.fetch;
6464
6476
  const tokenUrl = getTokenEndpointUrl(baseUrl);
6465
- const mergedScopes = mergeScopes(scope, requiredScopes);
6477
+ const mergedScopes = mergeScopes(scope2, requiredScopes);
6466
6478
  const scopeString = mergedScopes.join(" ");
6467
6479
  onEvent?.({
6468
6480
  type: "auth_exchanging",
@@ -6727,6 +6739,25 @@ async function invalidateCredentialsToken(options) {
6727
6739
  }
6728
6740
  }
6729
6741
 
6742
+ // src/utils/caller-context.ts
6743
+ var callerContext = createAsyncContext();
6744
+ function runWithCallerContext(context, fn) {
6745
+ let parent;
6746
+ try {
6747
+ parent = callerContext.get() ?? {};
6748
+ } catch {
6749
+ return fn();
6750
+ }
6751
+ return callerContext.run({ ...parent, ...context }, fn);
6752
+ }
6753
+ function getCallerContext() {
6754
+ try {
6755
+ return callerContext.get() ?? {};
6756
+ } catch {
6757
+ return {};
6758
+ }
6759
+ }
6760
+
6730
6761
  // src/api/sse-parser.ts
6731
6762
  async function* jsonFrames(source) {
6732
6763
  for await (const { data } of source) {
@@ -6878,7 +6909,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
6878
6909
  }
6879
6910
 
6880
6911
  // src/sdk-version.ts
6881
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.73.1" : void 0) || "unknown";
6912
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.74.0" : void 0) || "unknown";
6882
6913
 
6883
6914
  // src/utils/open-url.ts
6884
6915
  var nodePrefix = "node:";
@@ -7602,6 +7633,10 @@ var ZapierApiClient = class {
7602
7633
  headers.set("x-zapier-sdk-package", callerPackage.name);
7603
7634
  headers.set("zapier-sdk-package-version", callerPackage.version);
7604
7635
  headers.set("x-zapier-sdk-package-version", callerPackage.version);
7636
+ const { packageOperation } = getCallerContext();
7637
+ if (packageOperation) {
7638
+ headers.set("zapier-sdk-package-operation", packageOperation);
7639
+ }
7605
7640
  }
7606
7641
  }
7607
7642
  // Helper to perform HTTP requests with JSON handling
@@ -10276,4 +10311,4 @@ var registryPlugin = definePlugin((_sdk) => {
10276
10311
  return {};
10277
10312
  });
10278
10313
 
10279
- export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, CORE_ERROR_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreErrorCode, 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_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, 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, addPlugin, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk, createZapierSdkStack, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreError, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runInMethodScope, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError };
10314
+ export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, CORE_ERROR_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreErrorCode, 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_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, 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, addPlugin, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk, createZapierSdkStack, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreError, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError };
@@ -0,0 +1,21 @@
1
+ export interface CallerContext {
2
+ packageOperation?: string;
3
+ }
4
+ /**
5
+ * Run `fn` with the given caller context merged onto any parent context, so
6
+ * the operation that initiated the call (e.g. a CLI command or MCP tool) stays
7
+ * observable through every SDK call it makes.
8
+ *
9
+ * Caller context is telemetry-only: reading the parent scope is wrapped so a
10
+ * broken ALS store can never crash the wrapped command. Errors thrown by `fn`
11
+ * itself are intentionally NOT caught — they propagate.
12
+ */
13
+ export declare function runWithCallerContext<T>(context: CallerContext, fn: () => T): T;
14
+ /**
15
+ * Read the active caller context, or an empty object outside any caller scope.
16
+ *
17
+ * Read on the outbound HTTP path to set a telemetry header, so a failure here
18
+ * must never break the request — it falls back to an empty context.
19
+ */
20
+ export declare function getCallerContext(): CallerContext;
21
+ //# sourceMappingURL=caller-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caller-context.d.ts","sourceRoot":"","sources":["../../src/utils/caller-context.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,OAAO,EAAE,aAAa,EACtB,EAAE,EAAE,MAAM,CAAC,GACV,CAAC,CAQH;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAMhD"}
@@ -0,0 +1,35 @@
1
+ import { createAsyncContext } from "kitcore";
2
+ const callerContext = createAsyncContext();
3
+ /**
4
+ * Run `fn` with the given caller context merged onto any parent context, so
5
+ * the operation that initiated the call (e.g. a CLI command or MCP tool) stays
6
+ * observable through every SDK call it makes.
7
+ *
8
+ * Caller context is telemetry-only: reading the parent scope is wrapped so a
9
+ * broken ALS store can never crash the wrapped command. Errors thrown by `fn`
10
+ * itself are intentionally NOT caught — they propagate.
11
+ */
12
+ export function runWithCallerContext(context, fn) {
13
+ let parent;
14
+ try {
15
+ parent = callerContext.get() ?? {};
16
+ }
17
+ catch {
18
+ return fn();
19
+ }
20
+ return callerContext.run({ ...parent, ...context }, fn);
21
+ }
22
+ /**
23
+ * Read the active caller context, or an empty object outside any caller scope.
24
+ *
25
+ * Read on the outbound HTTP path to set a telemetry header, so a failure here
26
+ * must never break the request — it falls back to an empty context.
27
+ */
28
+ export function getCallerContext() {
29
+ try {
30
+ return callerContext.get() ?? {};
31
+ }
32
+ catch {
33
+ return {};
34
+ }
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.73.1",
3
+ "version": "0.74.0",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -95,7 +95,7 @@
95
95
  "tsup": "^8.5.0",
96
96
  "typescript": "^5.8.3",
97
97
  "vitest": "^4.1.4",
98
- "kitcore": "0.0.1"
98
+ "kitcore": "0.1.0"
99
99
  },
100
100
  "scripts": {
101
101
  "build": "tsup",