@zapier/zapier-sdk 0.75.0 → 0.76.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2809,6 +2809,14 @@ function createMemoryCache() {
2809
2809
 
2810
2810
  // src/auth.ts
2811
2811
  var DEFAULT_AUTH_BASE_URL = "https://zapier.com";
2812
+ var AuthMechanism = /* @__PURE__ */ ((AuthMechanism2) => {
2813
+ AuthMechanism2["ClientCredentials"] = "client_credentials";
2814
+ AuthMechanism2["Jwt"] = "jwt";
2815
+ AuthMechanism2["Token"] = "token";
2816
+ AuthMechanism2["Pkce"] = "pkce";
2817
+ AuthMechanism2["None"] = "none";
2818
+ return AuthMechanism2;
2819
+ })(AuthMechanism || {});
2812
2820
  var pendingExchanges = /* @__PURE__ */ new Map();
2813
2821
  var cachedDefaultCache;
2814
2822
  function buildCacheKey(options) {
@@ -2986,7 +2994,7 @@ async function getTokenFromCliLogin(options) {
2986
2994
  if (!cliLogin) return void 0;
2987
2995
  return await cliLogin.getToken(options);
2988
2996
  }
2989
- async function tryStoredClientCredentialToken(options) {
2997
+ async function tryStoredClientCredentialAuth(options) {
2990
2998
  const activeCredential = await getActiveCredentialsFromCli(options.baseUrl);
2991
2999
  if (!activeCredential) return void 0;
2992
3000
  const resolvedBaseUrl = activeCredential.baseUrl || options.baseUrl || DEFAULT_AUTH_BASE_URL;
@@ -3001,15 +3009,25 @@ async function tryStoredClientCredentialToken(options) {
3001
3009
  });
3002
3010
  const cache = await resolveCache(options);
3003
3011
  const pending = pendingExchanges.get(cacheKey);
3004
- if (pending) return pending;
3012
+ if (pending) {
3013
+ return {
3014
+ token: await pending,
3015
+ mechanism: "client_credentials" /* ClientCredentials */,
3016
+ clientId: activeCredential.clientId
3017
+ };
3018
+ }
3005
3019
  const cached = await readCachedToken(cacheKey, cache);
3006
3020
  if (cached !== void 0) {
3007
3021
  if (options.debug)
3008
3022
  console.error(
3009
3023
  `[auth] Using cached token (clientId: ${activeCredential.clientId})`
3010
3024
  );
3011
- emitAuthResolved(options.onEvent, "client_credentials");
3012
- return cached;
3025
+ emitAuthResolved(options.onEvent, "client_credentials" /* ClientCredentials */);
3026
+ return {
3027
+ token: cached,
3028
+ mechanism: "client_credentials" /* ClientCredentials */,
3029
+ clientId: activeCredential.clientId
3030
+ };
3013
3031
  }
3014
3032
  const storedCredential = await getStoredClientCredentialsFromCli(resolvedBaseUrl);
3015
3033
  if (!storedCredential) {
@@ -3027,24 +3045,25 @@ async function tryStoredClientCredentialToken(options) {
3027
3045
  console.error(
3028
3046
  `[auth] Using stored client credential (clientId: ${storedCredential.clientId})`
3029
3047
  );
3030
- const token = await resolveAuthTokenFromCredentials(
3031
- storedCredential,
3032
- options
3033
- );
3034
- emitAuthResolved(options.onEvent, "client_credentials");
3035
- return token;
3048
+ const auth = await resolveAuthFromCredentials(storedCredential, options);
3049
+ emitAuthResolved(options.onEvent, "client_credentials" /* ClientCredentials */);
3050
+ return {
3051
+ token: auth.token,
3052
+ mechanism: "client_credentials" /* ClientCredentials */,
3053
+ clientId: activeCredential.clientId
3054
+ };
3036
3055
  }
3037
- async function resolveAuthToken(options = {}) {
3056
+ async function resolveAuth(options = {}) {
3038
3057
  const credentials = await resolveCredentials({
3039
3058
  credentials: options.credentials,
3040
3059
  token: options.token,
3041
3060
  baseUrl: options.baseUrl
3042
3061
  });
3043
3062
  if (credentials !== void 0) {
3044
- return resolveAuthTokenFromCredentials(credentials, options);
3063
+ return resolveAuthFromCredentials(credentials, options);
3045
3064
  }
3046
- const storedToken = await tryStoredClientCredentialToken(options);
3047
- if (storedToken !== void 0) return storedToken;
3065
+ const storedAuth = await tryStoredClientCredentialAuth(options);
3066
+ if (storedAuth !== void 0) return storedAuth;
3048
3067
  if (options.debug) {
3049
3068
  console.error("[auth] Using JWT (no stored client credential found)");
3050
3069
  }
@@ -3054,14 +3073,30 @@ async function resolveAuthToken(options = {}) {
3054
3073
  debug: options.debug
3055
3074
  });
3056
3075
  if (jwtToken !== void 0) {
3057
- emitAuthResolved(options.onEvent, "jwt");
3076
+ emitAuthResolved(options.onEvent, "jwt" /* Jwt */);
3077
+ return {
3078
+ token: jwtToken,
3079
+ mechanism: "jwt" /* Jwt */,
3080
+ clientId: null
3081
+ };
3058
3082
  }
3059
- return jwtToken;
3083
+ return {
3084
+ token: void 0,
3085
+ mechanism: "none" /* None */,
3086
+ clientId: null
3087
+ };
3088
+ }
3089
+ async function resolveAuthToken(options = {}) {
3090
+ return (await resolveAuth(options)).token;
3060
3091
  }
3061
- async function resolveAuthTokenFromCredentials(credentials, options) {
3092
+ async function resolveAuthFromCredentials(credentials, options) {
3062
3093
  if (typeof credentials === "string") {
3063
- emitAuthResolved(options.onEvent, "token");
3064
- return credentials;
3094
+ emitAuthResolved(options.onEvent, "token" /* Token */);
3095
+ return {
3096
+ token: credentials,
3097
+ mechanism: "token" /* Token */,
3098
+ clientId: null
3099
+ };
3065
3100
  }
3066
3101
  if (isClientCredentials(credentials)) {
3067
3102
  const { clientId } = credentials;
@@ -3078,10 +3113,20 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
3078
3113
  if (options.debug) {
3079
3114
  console.error(`[auth] Using cached token (clientId: ${clientId})`);
3080
3115
  }
3081
- return cached;
3116
+ return {
3117
+ token: cached,
3118
+ mechanism: "client_credentials" /* ClientCredentials */,
3119
+ clientId: credentials.clientId
3120
+ };
3082
3121
  }
3083
3122
  const pending = pendingExchanges.get(cacheKey);
3084
- if (pending) return pending;
3123
+ if (pending) {
3124
+ return {
3125
+ token: await pending,
3126
+ mechanism: "client_credentials" /* ClientCredentials */,
3127
+ clientId: credentials.clientId
3128
+ };
3129
+ }
3085
3130
  const runLocked = async () => {
3086
3131
  const recheck = await readCachedToken(cacheKey, cache);
3087
3132
  if (recheck !== void 0) {
@@ -3114,7 +3159,11 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
3114
3159
  pendingExchanges.delete(cacheKey);
3115
3160
  });
3116
3161
  pendingExchanges.set(cacheKey, exchangePromise);
3117
- return exchangePromise;
3162
+ return {
3163
+ token: await exchangePromise,
3164
+ mechanism: "client_credentials" /* ClientCredentials */,
3165
+ clientId: credentials.clientId
3166
+ };
3118
3167
  }
3119
3168
  if (isPkceCredentials(credentials)) {
3120
3169
  const storedToken = await getTokenFromCliLogin({
@@ -3124,7 +3173,11 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
3124
3173
  debug: options.debug
3125
3174
  });
3126
3175
  if (storedToken) {
3127
- return storedToken;
3176
+ return {
3177
+ token: storedToken,
3178
+ mechanism: "pkce" /* Pkce */,
3179
+ clientId: null
3180
+ };
3128
3181
  }
3129
3182
  throw new Error(
3130
3183
  "PKCE credentials require interactive login. Please run the 'login' command with the CLI first, or use client_credentials flow."
@@ -3318,7 +3371,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
3318
3371
  }
3319
3372
 
3320
3373
  // src/sdk-version.ts
3321
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.75.0" : void 0) || "unknown";
3374
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.76.1" : void 0) || "unknown";
3322
3375
 
3323
3376
  // src/utils/open-url.ts
3324
3377
  var nodePrefix = "node:";
@@ -9588,6 +9641,8 @@ function createBaseEvent(context = {}) {
9588
9641
  release_id: getReleaseId(),
9589
9642
  customuser_id: context.customuser_id,
9590
9643
  account_id: context.account_id,
9644
+ client_id: context.client_id ?? null,
9645
+ auth_mechanism: context.auth_mechanism ?? null,
9591
9646
  identity_id: context.identity_id,
9592
9647
  visitor_id: context.visitor_id,
9593
9648
  correlation_id: context.correlation_id
@@ -9741,6 +9796,20 @@ function cleanupEventListeners() {
9741
9796
  var APPLICATION_LIFECYCLE_EVENT_SUBJECT = "platform.sdk.ApplicationLifecycleEvent";
9742
9797
  var ERROR_OCCURRED_EVENT_SUBJECT = "platform.sdk.ErrorOccurredEvent";
9743
9798
  var METHOD_CALLED_EVENT_SUBJECT = "platform.sdk.MethodCalledEvent";
9799
+ var NULL_EVENT_CONTEXT = Object.freeze({
9800
+ customuser_id: null,
9801
+ account_id: null,
9802
+ client_id: null,
9803
+ auth_mechanism: null
9804
+ });
9805
+ function buildEventAuthContext(auth) {
9806
+ const userIds = auth.token ? extractUserIdsFromJwt(auth.token) : { customuser_id: null, account_id: null };
9807
+ return {
9808
+ ...userIds,
9809
+ client_id: auth.clientId,
9810
+ auth_mechanism: auth.mechanism
9811
+ };
9812
+ }
9744
9813
  async function emitWithTimeout(transport, subject, event) {
9745
9814
  try {
9746
9815
  await Promise.race([
@@ -9816,16 +9885,11 @@ var eventEmissionPlugin = definePlugin(
9816
9885
  const getUserContext = (async () => {
9817
9886
  if (config.enabled) {
9818
9887
  try {
9819
- const token = await resolveAuthToken({
9820
- ...options
9821
- });
9822
- if (token) {
9823
- return extractUserIdsFromJwt(token);
9824
- }
9888
+ return buildEventAuthContext(await resolveAuth({ ...options }));
9825
9889
  } catch {
9826
9890
  }
9827
9891
  }
9828
- return { customuser_id: null, account_id: null };
9892
+ return NULL_EVENT_CONTEXT;
9829
9893
  })();
9830
9894
  const startupTime = Date.now();
9831
9895
  let shutdownStartTime = null;
@@ -9858,6 +9922,8 @@ var eventEmissionPlugin = definePlugin(
9858
9922
  release_id: getReleaseId(),
9859
9923
  customuser_id: null,
9860
9924
  account_id: null,
9925
+ client_id: null,
9926
+ auth_mechanism: null,
9861
9927
  identity_id: null,
9862
9928
  visitor_id: null,
9863
9929
  correlation_id: null
@@ -9886,6 +9952,8 @@ var eventEmissionPlugin = definePlugin(
9886
9952
  release_id: getReleaseId(),
9887
9953
  customuser_id: null,
9888
9954
  account_id: null,
9955
+ client_id: null,
9956
+ auth_mechanism: null,
9889
9957
  identity_id: null,
9890
9958
  visitor_id: null,
9891
9959
  correlation_id: null
@@ -13259,6 +13327,7 @@ exports.ActionTypePropertySchema = ActionTypePropertySchema;
13259
13327
  exports.AppKeyPropertySchema = AppKeyPropertySchema;
13260
13328
  exports.AppPropertySchema = AppPropertySchema;
13261
13329
  exports.AppsPropertySchema = AppsPropertySchema;
13330
+ exports.AuthMechanism = AuthMechanism;
13262
13331
  exports.AuthenticationIdPropertySchema = AuthenticationIdPropertySchema;
13263
13332
  exports.BaseSdkOptionsSchema = BaseSdkOptionsSchema;
13264
13333
  exports.CONTEXT_CACHE_MAX_SIZE = CONTEXT_CACHE_MAX_SIZE;
@@ -13437,6 +13506,7 @@ exports.readManifestFromFile = readManifestFromFile;
13437
13506
  exports.registryPlugin = registryPlugin;
13438
13507
  exports.requestPlugin = requestPlugin;
13439
13508
  exports.resetDeprecationWarnings = resetDeprecationWarnings2;
13509
+ exports.resolveAuth = resolveAuth;
13440
13510
  exports.resolveAuthToken = resolveAuthToken;
13441
13511
  exports.resolveCredentials = resolveCredentials;
13442
13512
  exports.resolveCredentialsFromEnv = resolveCredentialsFromEnv;
@@ -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-Cq9YBV9i.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-Cq9YBV9i.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-Dlf9DlnJ.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, dL 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, eV as ApplicationLifecycleEventData, ca as ApprovalStatus, ch as AppsPluginProvides, bN as AppsProperty, bl as AppsPropertySchema, a8 as ArrayResolver, dK as AuthEvent, dv as AuthMechanism, bB as AuthenticationIdProperty, b8 as AuthenticationIdPropertySchema, f1 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, dR as ClientCredentialsObject, e0 as ClientCredentialsObjectSchema, _ as Connection, e8 as ConnectionEntry, e7 as ConnectionEntrySchema, bz as ConnectionIdProperty, b7 as ConnectionIdPropertySchema, aV as ConnectionItem, bA as ConnectionProperty, b9 as ConnectionPropertySchema, ea as ConnectionsMap, e9 as ConnectionsMapSchema, ec as ConnectionsPluginProvides, bP as ConnectionsProperty, bn as ConnectionsPropertySchema, $ as ConnectionsResponse, aD as CoreErrorCode, cB as CreateClientCredentialsPluginProvides, eD as CreateTableFieldsPluginProvides, ex as CreateTablePluginProvides, eL as CreateTableRecordsPluginProvides, dO as Credentials, e5 as CredentialsFunction, e4 as CredentialsFunctionSchema, dQ as CredentialsObject, e2 as CredentialsObjectSchema, e6 as CredentialsSchema, eh as DEFAULT_ACTION_TIMEOUT_MS, eq as DEFAULT_APPROVAL_TIMEOUT_MS, cY as DEFAULT_CONFIG_PATH, er as DEFAULT_MAX_APPROVAL_RETRIES, eg as DEFAULT_PAGE_SIZE, bG as DebugProperty, be as DebugPropertySchema, cD as DeleteClientCredentialsPluginProvides, eF as DeleteTableFieldsPluginProvides, ez as DeleteTablePluginProvides, eN as DeleteTableRecordsPluginProvides, u as DrainTriggerInboxCallback, v as DrainTriggerInboxErrorObserver, ab as DynamicListResolver, ac as DynamicSearchResolver, eW as EnhancedErrorEventData, bV as ErrorOptions, dN as EventCallback, eU as EventContext, eR as EventEmissionConfig, eT 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, ev as GetTablePluginProvides, eH 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, eB as ListTableFieldsPluginProvides, eJ as ListTableRecordsPluginProvides, et as ListTablesPluginProvides, dM as LoadingEvent, ek as MAX_CONCURRENCY_LIMIT, ef as MAX_PAGE_LIMIT, cZ as ManifestEntry, cU as ManifestPluginOptions, cX as ManifestPluginProvides, f2 as MethodCalledEvent, eX 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, dS as PkceCredentialsObject, e1 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, dX as ResolveCredentialsOptions, dw as ResolvedAuth, dP as ResolvedCredentials, e3 as ResolvedCredentialsSchema, a7 as Resolver, a9 as ResolverMetadata, aZ as RootFieldItem, cR as RunActionPluginProvides, dJ 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, eP as UpdateTableRecordsPluginProvides, a0 as UserProfile, a_ as UserProfileItem, ed as ZAPIER_BASE_URL, em as ZAPIER_MAX_CONCURRENT_REQUESTS, ei as ZAPIER_MAX_NETWORK_RETRIES, ej 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, dF as ZapierCache, dG as ZapierCacheEntry, dH 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, eY as buildApplicationLifecycleEvent, an as buildCapabilityMessage, e_ as buildErrorEvent, eZ as buildErrorEventWithContext, f0 as buildMethodCalledEvent, eQ as cleanupEventListeners, dx as clearTokenCache, db as clientCredentialsNameResolver, dc as clientIdResolver, aJ as composePlugins, d7 as connectionIdGenericResolver, d6 as connectionIdResolver, eb as connectionsPlugin, e$ as createBaseEvent, cA as createClientCredentialsPlugin, a4 as createCorePlugin, a2 as createFunction, dI as createMemoryCache, au as createOptionsPlugin, aI as createPaginatedPluginMethod, aH as createPluginMethod, a3 as createPluginStack, at as createSdk, eC as createTableFieldsPlugin, ew as createTablePlugin, eK as createTableRecordsPlugin, aP as createZapierApi, av as createZapierCoreStack, as as createZapierSdkWithoutRegistry, aG as definePlugin, cC as deleteClientCredentialsPlugin, eE as deleteTableFieldsPlugin, ey as deleteTablePlugin, eM as deleteTableRecordsPlugin, dg as durableRunIdResolver, eS as eventEmissionPlugin, ck as fetchPlugin, cK as findFirstConnectionPlugin, cM as findUniqueConnectionPlugin, cd as formatErrorMessage, f3 as generateEventId, cu as getActionInputFieldsSchemaPlugin, cG as getActionPlugin, fd as getAgent, cE as getAppPlugin, d_ as getBaseUrlFromCredentials, ag as getCallerContext, f9 as getCiPlatform, d$ as getClientIdFromCredentials, cI as getConnectionPlugin, aB as getCoreErrorCause, aA as getCoreErrorCode, fb as getCpuTime, f4 as getCurrentTimestamp, fa as getMemoryUsage, aQ as getOrCreateApiClient, f6 as getOsInfo, f7 as getPlatformVersions, cV as getPreferredManifestEntryKey, c_ as getProfilePlugin, f5 as getReleaseId, eu as getTablePlugin, eG as getTableRecordPlugin, dB as getTokenFromCliLogin, fc as getTtyContext, en as getZapierApprovalMode, ep as getZapierDefaultApprovalMode, eo as getZapierOpenAutoModeApprovalsInBrowser, ee as getZapierSdkService, dz as injectCliLogin, da as inputFieldKeyResolver, d9 as inputsAllOptionalResolver, d8 as inputsResolver, dy as invalidateCachedToken, dE as invalidateCredentialsToken, f8 as isCi, dA as isCliLoginAvailable, dT as isClientCredentials, az as isCoreError, dW as isCredentialsFunction, dV as isCredentialsObject, aR as isPermanentHttpError, dU as isPkceCredentials, a1 as isPositional, cs as listActionInputFieldChoicesPlugin, cq as listActionInputFieldsPlugin, co as listActionsPlugin, cm as listAppsPlugin, cy as listClientCredentialsPlugin, cw as listConnectionsPlugin, eA as listTableFieldsPlugin, eI as listTableRecordsPlugin, es as listTablesPlugin, ao as logDeprecation, cW as manifestPlugin, el as parseConcurrencyEnvVar, aM as registryPlugin, cS as requestPlugin, ap as resetDeprecationWarnings, dC as resolveAuth, dD as resolveAuthToken, dZ as resolveCredentials, dY 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, eO as updateTableRecordsPlugin, df as workflowIdResolver, di as workflowRunIdResolver, dh as workflowVersionIdResolver, b_ as zapierAdaptError } from './index-Dlf9DlnJ.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';
@@ -2807,6 +2807,14 @@ function createMemoryCache() {
2807
2807
 
2808
2808
  // src/auth.ts
2809
2809
  var DEFAULT_AUTH_BASE_URL = "https://zapier.com";
2810
+ var AuthMechanism = /* @__PURE__ */ ((AuthMechanism2) => {
2811
+ AuthMechanism2["ClientCredentials"] = "client_credentials";
2812
+ AuthMechanism2["Jwt"] = "jwt";
2813
+ AuthMechanism2["Token"] = "token";
2814
+ AuthMechanism2["Pkce"] = "pkce";
2815
+ AuthMechanism2["None"] = "none";
2816
+ return AuthMechanism2;
2817
+ })(AuthMechanism || {});
2810
2818
  var pendingExchanges = /* @__PURE__ */ new Map();
2811
2819
  var cachedDefaultCache;
2812
2820
  function buildCacheKey(options) {
@@ -2984,7 +2992,7 @@ async function getTokenFromCliLogin(options) {
2984
2992
  if (!cliLogin) return void 0;
2985
2993
  return await cliLogin.getToken(options);
2986
2994
  }
2987
- async function tryStoredClientCredentialToken(options) {
2995
+ async function tryStoredClientCredentialAuth(options) {
2988
2996
  const activeCredential = await getActiveCredentialsFromCli(options.baseUrl);
2989
2997
  if (!activeCredential) return void 0;
2990
2998
  const resolvedBaseUrl = activeCredential.baseUrl || options.baseUrl || DEFAULT_AUTH_BASE_URL;
@@ -2999,15 +3007,25 @@ async function tryStoredClientCredentialToken(options) {
2999
3007
  });
3000
3008
  const cache = await resolveCache(options);
3001
3009
  const pending = pendingExchanges.get(cacheKey);
3002
- if (pending) return pending;
3010
+ if (pending) {
3011
+ return {
3012
+ token: await pending,
3013
+ mechanism: "client_credentials" /* ClientCredentials */,
3014
+ clientId: activeCredential.clientId
3015
+ };
3016
+ }
3003
3017
  const cached = await readCachedToken(cacheKey, cache);
3004
3018
  if (cached !== void 0) {
3005
3019
  if (options.debug)
3006
3020
  console.error(
3007
3021
  `[auth] Using cached token (clientId: ${activeCredential.clientId})`
3008
3022
  );
3009
- emitAuthResolved(options.onEvent, "client_credentials");
3010
- return cached;
3023
+ emitAuthResolved(options.onEvent, "client_credentials" /* ClientCredentials */);
3024
+ return {
3025
+ token: cached,
3026
+ mechanism: "client_credentials" /* ClientCredentials */,
3027
+ clientId: activeCredential.clientId
3028
+ };
3011
3029
  }
3012
3030
  const storedCredential = await getStoredClientCredentialsFromCli(resolvedBaseUrl);
3013
3031
  if (!storedCredential) {
@@ -3025,24 +3043,25 @@ async function tryStoredClientCredentialToken(options) {
3025
3043
  console.error(
3026
3044
  `[auth] Using stored client credential (clientId: ${storedCredential.clientId})`
3027
3045
  );
3028
- const token = await resolveAuthTokenFromCredentials(
3029
- storedCredential,
3030
- options
3031
- );
3032
- emitAuthResolved(options.onEvent, "client_credentials");
3033
- return token;
3046
+ const auth = await resolveAuthFromCredentials(storedCredential, options);
3047
+ emitAuthResolved(options.onEvent, "client_credentials" /* ClientCredentials */);
3048
+ return {
3049
+ token: auth.token,
3050
+ mechanism: "client_credentials" /* ClientCredentials */,
3051
+ clientId: activeCredential.clientId
3052
+ };
3034
3053
  }
3035
- async function resolveAuthToken(options = {}) {
3054
+ async function resolveAuth(options = {}) {
3036
3055
  const credentials = await resolveCredentials({
3037
3056
  credentials: options.credentials,
3038
3057
  token: options.token,
3039
3058
  baseUrl: options.baseUrl
3040
3059
  });
3041
3060
  if (credentials !== void 0) {
3042
- return resolveAuthTokenFromCredentials(credentials, options);
3061
+ return resolveAuthFromCredentials(credentials, options);
3043
3062
  }
3044
- const storedToken = await tryStoredClientCredentialToken(options);
3045
- if (storedToken !== void 0) return storedToken;
3063
+ const storedAuth = await tryStoredClientCredentialAuth(options);
3064
+ if (storedAuth !== void 0) return storedAuth;
3046
3065
  if (options.debug) {
3047
3066
  console.error("[auth] Using JWT (no stored client credential found)");
3048
3067
  }
@@ -3052,14 +3071,30 @@ async function resolveAuthToken(options = {}) {
3052
3071
  debug: options.debug
3053
3072
  });
3054
3073
  if (jwtToken !== void 0) {
3055
- emitAuthResolved(options.onEvent, "jwt");
3074
+ emitAuthResolved(options.onEvent, "jwt" /* Jwt */);
3075
+ return {
3076
+ token: jwtToken,
3077
+ mechanism: "jwt" /* Jwt */,
3078
+ clientId: null
3079
+ };
3056
3080
  }
3057
- return jwtToken;
3081
+ return {
3082
+ token: void 0,
3083
+ mechanism: "none" /* None */,
3084
+ clientId: null
3085
+ };
3086
+ }
3087
+ async function resolveAuthToken(options = {}) {
3088
+ return (await resolveAuth(options)).token;
3058
3089
  }
3059
- async function resolveAuthTokenFromCredentials(credentials, options) {
3090
+ async function resolveAuthFromCredentials(credentials, options) {
3060
3091
  if (typeof credentials === "string") {
3061
- emitAuthResolved(options.onEvent, "token");
3062
- return credentials;
3092
+ emitAuthResolved(options.onEvent, "token" /* Token */);
3093
+ return {
3094
+ token: credentials,
3095
+ mechanism: "token" /* Token */,
3096
+ clientId: null
3097
+ };
3063
3098
  }
3064
3099
  if (isClientCredentials(credentials)) {
3065
3100
  const { clientId } = credentials;
@@ -3076,10 +3111,20 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
3076
3111
  if (options.debug) {
3077
3112
  console.error(`[auth] Using cached token (clientId: ${clientId})`);
3078
3113
  }
3079
- return cached;
3114
+ return {
3115
+ token: cached,
3116
+ mechanism: "client_credentials" /* ClientCredentials */,
3117
+ clientId: credentials.clientId
3118
+ };
3080
3119
  }
3081
3120
  const pending = pendingExchanges.get(cacheKey);
3082
- if (pending) return pending;
3121
+ if (pending) {
3122
+ return {
3123
+ token: await pending,
3124
+ mechanism: "client_credentials" /* ClientCredentials */,
3125
+ clientId: credentials.clientId
3126
+ };
3127
+ }
3083
3128
  const runLocked = async () => {
3084
3129
  const recheck = await readCachedToken(cacheKey, cache);
3085
3130
  if (recheck !== void 0) {
@@ -3112,7 +3157,11 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
3112
3157
  pendingExchanges.delete(cacheKey);
3113
3158
  });
3114
3159
  pendingExchanges.set(cacheKey, exchangePromise);
3115
- return exchangePromise;
3160
+ return {
3161
+ token: await exchangePromise,
3162
+ mechanism: "client_credentials" /* ClientCredentials */,
3163
+ clientId: credentials.clientId
3164
+ };
3116
3165
  }
3117
3166
  if (isPkceCredentials(credentials)) {
3118
3167
  const storedToken = await getTokenFromCliLogin({
@@ -3122,7 +3171,11 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
3122
3171
  debug: options.debug
3123
3172
  });
3124
3173
  if (storedToken) {
3125
- return storedToken;
3174
+ return {
3175
+ token: storedToken,
3176
+ mechanism: "pkce" /* Pkce */,
3177
+ clientId: null
3178
+ };
3126
3179
  }
3127
3180
  throw new Error(
3128
3181
  "PKCE credentials require interactive login. Please run the 'login' command with the CLI first, or use client_credentials flow."
@@ -3316,7 +3369,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
3316
3369
  }
3317
3370
 
3318
3371
  // src/sdk-version.ts
3319
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.75.0" : void 0) || "unknown";
3372
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.76.1" : void 0) || "unknown";
3320
3373
 
3321
3374
  // src/utils/open-url.ts
3322
3375
  var nodePrefix = "node:";
@@ -9586,6 +9639,8 @@ function createBaseEvent(context = {}) {
9586
9639
  release_id: getReleaseId(),
9587
9640
  customuser_id: context.customuser_id,
9588
9641
  account_id: context.account_id,
9642
+ client_id: context.client_id ?? null,
9643
+ auth_mechanism: context.auth_mechanism ?? null,
9589
9644
  identity_id: context.identity_id,
9590
9645
  visitor_id: context.visitor_id,
9591
9646
  correlation_id: context.correlation_id
@@ -9739,6 +9794,20 @@ function cleanupEventListeners() {
9739
9794
  var APPLICATION_LIFECYCLE_EVENT_SUBJECT = "platform.sdk.ApplicationLifecycleEvent";
9740
9795
  var ERROR_OCCURRED_EVENT_SUBJECT = "platform.sdk.ErrorOccurredEvent";
9741
9796
  var METHOD_CALLED_EVENT_SUBJECT = "platform.sdk.MethodCalledEvent";
9797
+ var NULL_EVENT_CONTEXT = Object.freeze({
9798
+ customuser_id: null,
9799
+ account_id: null,
9800
+ client_id: null,
9801
+ auth_mechanism: null
9802
+ });
9803
+ function buildEventAuthContext(auth) {
9804
+ const userIds = auth.token ? extractUserIdsFromJwt(auth.token) : { customuser_id: null, account_id: null };
9805
+ return {
9806
+ ...userIds,
9807
+ client_id: auth.clientId,
9808
+ auth_mechanism: auth.mechanism
9809
+ };
9810
+ }
9742
9811
  async function emitWithTimeout(transport, subject, event) {
9743
9812
  try {
9744
9813
  await Promise.race([
@@ -9814,16 +9883,11 @@ var eventEmissionPlugin = definePlugin(
9814
9883
  const getUserContext = (async () => {
9815
9884
  if (config.enabled) {
9816
9885
  try {
9817
- const token = await resolveAuthToken({
9818
- ...options
9819
- });
9820
- if (token) {
9821
- return extractUserIdsFromJwt(token);
9822
- }
9886
+ return buildEventAuthContext(await resolveAuth({ ...options }));
9823
9887
  } catch {
9824
9888
  }
9825
9889
  }
9826
- return { customuser_id: null, account_id: null };
9890
+ return NULL_EVENT_CONTEXT;
9827
9891
  })();
9828
9892
  const startupTime = Date.now();
9829
9893
  let shutdownStartTime = null;
@@ -9856,6 +9920,8 @@ var eventEmissionPlugin = definePlugin(
9856
9920
  release_id: getReleaseId(),
9857
9921
  customuser_id: null,
9858
9922
  account_id: null,
9923
+ client_id: null,
9924
+ auth_mechanism: null,
9859
9925
  identity_id: null,
9860
9926
  visitor_id: null,
9861
9927
  correlation_id: null
@@ -9884,6 +9950,8 @@ var eventEmissionPlugin = definePlugin(
9884
9950
  release_id: getReleaseId(),
9885
9951
  customuser_id: null,
9886
9952
  account_id: null,
9953
+ client_id: null,
9954
+ auth_mechanism: null,
9887
9955
  identity_id: null,
9888
9956
  visitor_id: null,
9889
9957
  correlation_id: null
@@ -13250,4 +13318,4 @@ function createZapierSdk2(options = {}) {
13250
13318
  return withDeprecatedAddPlugin(createZapierSdkStack2(options).toSdk());
13251
13319
  }
13252
13320
 
13253
- 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 };
13321
+ export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, 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, resolveAuth, 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 };