@zapier/zapier-sdk 0.76.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.
package/dist/index.cjs CHANGED
@@ -6402,6 +6402,14 @@ function createMemoryCache() {
6402
6402
 
6403
6403
  // src/auth.ts
6404
6404
  var DEFAULT_AUTH_BASE_URL = "https://zapier.com";
6405
+ var AuthMechanism = /* @__PURE__ */ ((AuthMechanism2) => {
6406
+ AuthMechanism2["ClientCredentials"] = "client_credentials";
6407
+ AuthMechanism2["Jwt"] = "jwt";
6408
+ AuthMechanism2["Token"] = "token";
6409
+ AuthMechanism2["Pkce"] = "pkce";
6410
+ AuthMechanism2["None"] = "none";
6411
+ return AuthMechanism2;
6412
+ })(AuthMechanism || {});
6405
6413
  var pendingExchanges = /* @__PURE__ */ new Map();
6406
6414
  var cachedDefaultCache;
6407
6415
  function buildCacheKey(options) {
@@ -6579,7 +6587,7 @@ async function getTokenFromCliLogin(options) {
6579
6587
  if (!cliLogin) return void 0;
6580
6588
  return await cliLogin.getToken(options);
6581
6589
  }
6582
- async function tryStoredClientCredentialToken(options) {
6590
+ async function tryStoredClientCredentialAuth(options) {
6583
6591
  const activeCredential = await getActiveCredentialsFromCli(options.baseUrl);
6584
6592
  if (!activeCredential) return void 0;
6585
6593
  const resolvedBaseUrl = activeCredential.baseUrl || options.baseUrl || DEFAULT_AUTH_BASE_URL;
@@ -6594,15 +6602,25 @@ async function tryStoredClientCredentialToken(options) {
6594
6602
  });
6595
6603
  const cache = await resolveCache(options);
6596
6604
  const pending = pendingExchanges.get(cacheKey);
6597
- if (pending) return pending;
6605
+ if (pending) {
6606
+ return {
6607
+ token: await pending,
6608
+ mechanism: "client_credentials" /* ClientCredentials */,
6609
+ clientId: activeCredential.clientId
6610
+ };
6611
+ }
6598
6612
  const cached = await readCachedToken(cacheKey, cache);
6599
6613
  if (cached !== void 0) {
6600
6614
  if (options.debug)
6601
6615
  console.error(
6602
6616
  `[auth] Using cached token (clientId: ${activeCredential.clientId})`
6603
6617
  );
6604
- emitAuthResolved(options.onEvent, "client_credentials");
6605
- return cached;
6618
+ emitAuthResolved(options.onEvent, "client_credentials" /* ClientCredentials */);
6619
+ return {
6620
+ token: cached,
6621
+ mechanism: "client_credentials" /* ClientCredentials */,
6622
+ clientId: activeCredential.clientId
6623
+ };
6606
6624
  }
6607
6625
  const storedCredential = await getStoredClientCredentialsFromCli(resolvedBaseUrl);
6608
6626
  if (!storedCredential) {
@@ -6620,24 +6638,25 @@ async function tryStoredClientCredentialToken(options) {
6620
6638
  console.error(
6621
6639
  `[auth] Using stored client credential (clientId: ${storedCredential.clientId})`
6622
6640
  );
6623
- const token = await resolveAuthTokenFromCredentials(
6624
- storedCredential,
6625
- options
6626
- );
6627
- emitAuthResolved(options.onEvent, "client_credentials");
6628
- return token;
6641
+ const auth = await resolveAuthFromCredentials(storedCredential, options);
6642
+ emitAuthResolved(options.onEvent, "client_credentials" /* ClientCredentials */);
6643
+ return {
6644
+ token: auth.token,
6645
+ mechanism: "client_credentials" /* ClientCredentials */,
6646
+ clientId: activeCredential.clientId
6647
+ };
6629
6648
  }
6630
- async function resolveAuthToken(options = {}) {
6649
+ async function resolveAuth(options = {}) {
6631
6650
  const credentials = await resolveCredentials({
6632
6651
  credentials: options.credentials,
6633
6652
  token: options.token,
6634
6653
  baseUrl: options.baseUrl
6635
6654
  });
6636
6655
  if (credentials !== void 0) {
6637
- return resolveAuthTokenFromCredentials(credentials, options);
6656
+ return resolveAuthFromCredentials(credentials, options);
6638
6657
  }
6639
- const storedToken = await tryStoredClientCredentialToken(options);
6640
- if (storedToken !== void 0) return storedToken;
6658
+ const storedAuth = await tryStoredClientCredentialAuth(options);
6659
+ if (storedAuth !== void 0) return storedAuth;
6641
6660
  if (options.debug) {
6642
6661
  console.error("[auth] Using JWT (no stored client credential found)");
6643
6662
  }
@@ -6647,14 +6666,30 @@ async function resolveAuthToken(options = {}) {
6647
6666
  debug: options.debug
6648
6667
  });
6649
6668
  if (jwtToken !== void 0) {
6650
- emitAuthResolved(options.onEvent, "jwt");
6669
+ emitAuthResolved(options.onEvent, "jwt" /* Jwt */);
6670
+ return {
6671
+ token: jwtToken,
6672
+ mechanism: "jwt" /* Jwt */,
6673
+ clientId: null
6674
+ };
6651
6675
  }
6652
- return jwtToken;
6676
+ return {
6677
+ token: void 0,
6678
+ mechanism: "none" /* None */,
6679
+ clientId: null
6680
+ };
6681
+ }
6682
+ async function resolveAuthToken(options = {}) {
6683
+ return (await resolveAuth(options)).token;
6653
6684
  }
6654
- async function resolveAuthTokenFromCredentials(credentials, options) {
6685
+ async function resolveAuthFromCredentials(credentials, options) {
6655
6686
  if (typeof credentials === "string") {
6656
- emitAuthResolved(options.onEvent, "token");
6657
- return credentials;
6687
+ emitAuthResolved(options.onEvent, "token" /* Token */);
6688
+ return {
6689
+ token: credentials,
6690
+ mechanism: "token" /* Token */,
6691
+ clientId: null
6692
+ };
6658
6693
  }
6659
6694
  if (isClientCredentials(credentials)) {
6660
6695
  const { clientId } = credentials;
@@ -6671,10 +6706,20 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
6671
6706
  if (options.debug) {
6672
6707
  console.error(`[auth] Using cached token (clientId: ${clientId})`);
6673
6708
  }
6674
- return cached;
6709
+ return {
6710
+ token: cached,
6711
+ mechanism: "client_credentials" /* ClientCredentials */,
6712
+ clientId: credentials.clientId
6713
+ };
6675
6714
  }
6676
6715
  const pending = pendingExchanges.get(cacheKey);
6677
- if (pending) return pending;
6716
+ if (pending) {
6717
+ return {
6718
+ token: await pending,
6719
+ mechanism: "client_credentials" /* ClientCredentials */,
6720
+ clientId: credentials.clientId
6721
+ };
6722
+ }
6678
6723
  const runLocked = async () => {
6679
6724
  const recheck = await readCachedToken(cacheKey, cache);
6680
6725
  if (recheck !== void 0) {
@@ -6707,7 +6752,11 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
6707
6752
  pendingExchanges.delete(cacheKey);
6708
6753
  });
6709
6754
  pendingExchanges.set(cacheKey, exchangePromise);
6710
- return exchangePromise;
6755
+ return {
6756
+ token: await exchangePromise,
6757
+ mechanism: "client_credentials" /* ClientCredentials */,
6758
+ clientId: credentials.clientId
6759
+ };
6711
6760
  }
6712
6761
  if (isPkceCredentials(credentials)) {
6713
6762
  const storedToken = await getTokenFromCliLogin({
@@ -6717,7 +6766,11 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
6717
6766
  debug: options.debug
6718
6767
  });
6719
6768
  if (storedToken) {
6720
- return storedToken;
6769
+ return {
6770
+ token: storedToken,
6771
+ mechanism: "pkce" /* Pkce */,
6772
+ clientId: null
6773
+ };
6721
6774
  }
6722
6775
  throw new Error(
6723
6776
  "PKCE credentials require interactive login. Please run the 'login' command with the CLI first, or use client_credentials flow."
@@ -6911,7 +6964,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
6911
6964
  }
6912
6965
 
6913
6966
  // src/sdk-version.ts
6914
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.76.0" : void 0) || "unknown";
6967
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.76.1" : void 0) || "unknown";
6915
6968
 
6916
6969
  // src/utils/open-url.ts
6917
6970
  var nodePrefix = "node:";
@@ -9734,6 +9787,8 @@ function createBaseEvent(context = {}) {
9734
9787
  release_id: getReleaseId(),
9735
9788
  customuser_id: context.customuser_id,
9736
9789
  account_id: context.account_id,
9790
+ client_id: context.client_id ?? null,
9791
+ auth_mechanism: context.auth_mechanism ?? null,
9737
9792
  identity_id: context.identity_id,
9738
9793
  visitor_id: context.visitor_id,
9739
9794
  correlation_id: context.correlation_id
@@ -9887,6 +9942,20 @@ function cleanupEventListeners() {
9887
9942
  var APPLICATION_LIFECYCLE_EVENT_SUBJECT = "platform.sdk.ApplicationLifecycleEvent";
9888
9943
  var ERROR_OCCURRED_EVENT_SUBJECT = "platform.sdk.ErrorOccurredEvent";
9889
9944
  var METHOD_CALLED_EVENT_SUBJECT = "platform.sdk.MethodCalledEvent";
9945
+ var NULL_EVENT_CONTEXT = Object.freeze({
9946
+ customuser_id: null,
9947
+ account_id: null,
9948
+ client_id: null,
9949
+ auth_mechanism: null
9950
+ });
9951
+ function buildEventAuthContext(auth) {
9952
+ const userIds = auth.token ? extractUserIdsFromJwt(auth.token) : { customuser_id: null, account_id: null };
9953
+ return {
9954
+ ...userIds,
9955
+ client_id: auth.clientId,
9956
+ auth_mechanism: auth.mechanism
9957
+ };
9958
+ }
9890
9959
  async function emitWithTimeout(transport, subject, event) {
9891
9960
  try {
9892
9961
  await Promise.race([
@@ -9962,16 +10031,11 @@ var eventEmissionPlugin = definePlugin(
9962
10031
  const getUserContext = (async () => {
9963
10032
  if (config.enabled) {
9964
10033
  try {
9965
- const token = await resolveAuthToken({
9966
- ...options
9967
- });
9968
- if (token) {
9969
- return extractUserIdsFromJwt(token);
9970
- }
10034
+ return buildEventAuthContext(await resolveAuth({ ...options }));
9971
10035
  } catch {
9972
10036
  }
9973
10037
  }
9974
- return { customuser_id: null, account_id: null };
10038
+ return NULL_EVENT_CONTEXT;
9975
10039
  })();
9976
10040
  const startupTime = Date.now();
9977
10041
  let shutdownStartTime = null;
@@ -10004,6 +10068,8 @@ var eventEmissionPlugin = definePlugin(
10004
10068
  release_id: getReleaseId(),
10005
10069
  customuser_id: null,
10006
10070
  account_id: null,
10071
+ client_id: null,
10072
+ auth_mechanism: null,
10007
10073
  identity_id: null,
10008
10074
  visitor_id: null,
10009
10075
  correlation_id: null
@@ -10032,6 +10098,8 @@ var eventEmissionPlugin = definePlugin(
10032
10098
  release_id: getReleaseId(),
10033
10099
  customuser_id: null,
10034
10100
  account_id: null,
10101
+ client_id: null,
10102
+ auth_mechanism: null,
10035
10103
  identity_id: null,
10036
10104
  visitor_id: null,
10037
10105
  correlation_id: null
@@ -10320,6 +10388,7 @@ exports.ActionTypePropertySchema = ActionTypePropertySchema;
10320
10388
  exports.AppKeyPropertySchema = AppKeyPropertySchema;
10321
10389
  exports.AppPropertySchema = AppPropertySchema;
10322
10390
  exports.AppsPropertySchema = AppsPropertySchema;
10391
+ exports.AuthMechanism = AuthMechanism;
10323
10392
  exports.AuthenticationIdPropertySchema = AuthenticationIdPropertySchema;
10324
10393
  exports.BaseSdkOptionsSchema = BaseSdkOptionsSchema;
10325
10394
  exports.CONTEXT_CACHE_MAX_SIZE = CONTEXT_CACHE_MAX_SIZE;
@@ -10498,6 +10567,7 @@ exports.readManifestFromFile = readManifestFromFile;
10498
10567
  exports.registryPlugin = registryPlugin;
10499
10568
  exports.requestPlugin = requestPlugin;
10500
10569
  exports.resetDeprecationWarnings = resetDeprecationWarnings2;
10570
+ exports.resolveAuth = resolveAuth;
10501
10571
  exports.resolveAuthToken = resolveAuthToken;
10502
10572
  exports.resolveCredentials = resolveCredentials;
10503
10573
  exports.resolveCredentialsFromEnv = resolveCredentialsFromEnv;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
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-Cq9YBV9i.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, 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, D as DrainTriggerInboxOptions, ab as DynamicListResolver, m as DynamicResolver, ac as DynamicSearchResolver, eW as EnhancedErrorEventData, bV as ErrorOptions, dN as EventCallback, eU as EventContext, eR as EventEmissionConfig, E as EventEmissionContext, eT 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, 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, b as Manifest, 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, O as OutputFormatter, bF as OutputProperty, bd as OutputPropertySchema, b0 as PaginatedSdkFunction, i as PaginatedSdkResult, bH as ParamsProperty, bf as ParamsPropertySchema, dS as PkceCredentialsObject, e1 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, dX as ResolveCredentialsOptions, R as ResolvedAppLocator, 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, U as UpdateManifestEntryOptions, c as UpdateManifestEntryResult, eP as UpdateTableRecordsPluginProvides, a0 as UserProfile, a_ as UserProfileItem, n as WatchTriggerInboxOptions, q as WithAddPlugin, 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, l as ZapierFetchInitOptions, c1 as ZapierNotFoundError, c9 as ZapierRateLimitError, cc as ZapierRelayError, t as ZapierReleaseTriggerMessageSignal, c2 as ZapierResourceNotFoundError, fg 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, 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, fe as createZapierSdk, ff as createZapierSdkStack, 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, g as findManifestEntry, 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, r as readManifestFromFile, 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';
2
2
  import 'zod';
3
3
  import 'zod/v4/core';
4
4
  import '@zapier/zapier-sdk-core/v0/schemas/connections';
package/dist/index.mjs CHANGED
@@ -6400,6 +6400,14 @@ function createMemoryCache() {
6400
6400
 
6401
6401
  // src/auth.ts
6402
6402
  var DEFAULT_AUTH_BASE_URL = "https://zapier.com";
6403
+ var AuthMechanism = /* @__PURE__ */ ((AuthMechanism2) => {
6404
+ AuthMechanism2["ClientCredentials"] = "client_credentials";
6405
+ AuthMechanism2["Jwt"] = "jwt";
6406
+ AuthMechanism2["Token"] = "token";
6407
+ AuthMechanism2["Pkce"] = "pkce";
6408
+ AuthMechanism2["None"] = "none";
6409
+ return AuthMechanism2;
6410
+ })(AuthMechanism || {});
6403
6411
  var pendingExchanges = /* @__PURE__ */ new Map();
6404
6412
  var cachedDefaultCache;
6405
6413
  function buildCacheKey(options) {
@@ -6577,7 +6585,7 @@ async function getTokenFromCliLogin(options) {
6577
6585
  if (!cliLogin) return void 0;
6578
6586
  return await cliLogin.getToken(options);
6579
6587
  }
6580
- async function tryStoredClientCredentialToken(options) {
6588
+ async function tryStoredClientCredentialAuth(options) {
6581
6589
  const activeCredential = await getActiveCredentialsFromCli(options.baseUrl);
6582
6590
  if (!activeCredential) return void 0;
6583
6591
  const resolvedBaseUrl = activeCredential.baseUrl || options.baseUrl || DEFAULT_AUTH_BASE_URL;
@@ -6592,15 +6600,25 @@ async function tryStoredClientCredentialToken(options) {
6592
6600
  });
6593
6601
  const cache = await resolveCache(options);
6594
6602
  const pending = pendingExchanges.get(cacheKey);
6595
- if (pending) return pending;
6603
+ if (pending) {
6604
+ return {
6605
+ token: await pending,
6606
+ mechanism: "client_credentials" /* ClientCredentials */,
6607
+ clientId: activeCredential.clientId
6608
+ };
6609
+ }
6596
6610
  const cached = await readCachedToken(cacheKey, cache);
6597
6611
  if (cached !== void 0) {
6598
6612
  if (options.debug)
6599
6613
  console.error(
6600
6614
  `[auth] Using cached token (clientId: ${activeCredential.clientId})`
6601
6615
  );
6602
- emitAuthResolved(options.onEvent, "client_credentials");
6603
- return cached;
6616
+ emitAuthResolved(options.onEvent, "client_credentials" /* ClientCredentials */);
6617
+ return {
6618
+ token: cached,
6619
+ mechanism: "client_credentials" /* ClientCredentials */,
6620
+ clientId: activeCredential.clientId
6621
+ };
6604
6622
  }
6605
6623
  const storedCredential = await getStoredClientCredentialsFromCli(resolvedBaseUrl);
6606
6624
  if (!storedCredential) {
@@ -6618,24 +6636,25 @@ async function tryStoredClientCredentialToken(options) {
6618
6636
  console.error(
6619
6637
  `[auth] Using stored client credential (clientId: ${storedCredential.clientId})`
6620
6638
  );
6621
- const token = await resolveAuthTokenFromCredentials(
6622
- storedCredential,
6623
- options
6624
- );
6625
- emitAuthResolved(options.onEvent, "client_credentials");
6626
- return token;
6639
+ const auth = await resolveAuthFromCredentials(storedCredential, options);
6640
+ emitAuthResolved(options.onEvent, "client_credentials" /* ClientCredentials */);
6641
+ return {
6642
+ token: auth.token,
6643
+ mechanism: "client_credentials" /* ClientCredentials */,
6644
+ clientId: activeCredential.clientId
6645
+ };
6627
6646
  }
6628
- async function resolveAuthToken(options = {}) {
6647
+ async function resolveAuth(options = {}) {
6629
6648
  const credentials = await resolveCredentials({
6630
6649
  credentials: options.credentials,
6631
6650
  token: options.token,
6632
6651
  baseUrl: options.baseUrl
6633
6652
  });
6634
6653
  if (credentials !== void 0) {
6635
- return resolveAuthTokenFromCredentials(credentials, options);
6654
+ return resolveAuthFromCredentials(credentials, options);
6636
6655
  }
6637
- const storedToken = await tryStoredClientCredentialToken(options);
6638
- if (storedToken !== void 0) return storedToken;
6656
+ const storedAuth = await tryStoredClientCredentialAuth(options);
6657
+ if (storedAuth !== void 0) return storedAuth;
6639
6658
  if (options.debug) {
6640
6659
  console.error("[auth] Using JWT (no stored client credential found)");
6641
6660
  }
@@ -6645,14 +6664,30 @@ async function resolveAuthToken(options = {}) {
6645
6664
  debug: options.debug
6646
6665
  });
6647
6666
  if (jwtToken !== void 0) {
6648
- emitAuthResolved(options.onEvent, "jwt");
6667
+ emitAuthResolved(options.onEvent, "jwt" /* Jwt */);
6668
+ return {
6669
+ token: jwtToken,
6670
+ mechanism: "jwt" /* Jwt */,
6671
+ clientId: null
6672
+ };
6649
6673
  }
6650
- return jwtToken;
6674
+ return {
6675
+ token: void 0,
6676
+ mechanism: "none" /* None */,
6677
+ clientId: null
6678
+ };
6679
+ }
6680
+ async function resolveAuthToken(options = {}) {
6681
+ return (await resolveAuth(options)).token;
6651
6682
  }
6652
- async function resolveAuthTokenFromCredentials(credentials, options) {
6683
+ async function resolveAuthFromCredentials(credentials, options) {
6653
6684
  if (typeof credentials === "string") {
6654
- emitAuthResolved(options.onEvent, "token");
6655
- return credentials;
6685
+ emitAuthResolved(options.onEvent, "token" /* Token */);
6686
+ return {
6687
+ token: credentials,
6688
+ mechanism: "token" /* Token */,
6689
+ clientId: null
6690
+ };
6656
6691
  }
6657
6692
  if (isClientCredentials(credentials)) {
6658
6693
  const { clientId } = credentials;
@@ -6669,10 +6704,20 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
6669
6704
  if (options.debug) {
6670
6705
  console.error(`[auth] Using cached token (clientId: ${clientId})`);
6671
6706
  }
6672
- return cached;
6707
+ return {
6708
+ token: cached,
6709
+ mechanism: "client_credentials" /* ClientCredentials */,
6710
+ clientId: credentials.clientId
6711
+ };
6673
6712
  }
6674
6713
  const pending = pendingExchanges.get(cacheKey);
6675
- if (pending) return pending;
6714
+ if (pending) {
6715
+ return {
6716
+ token: await pending,
6717
+ mechanism: "client_credentials" /* ClientCredentials */,
6718
+ clientId: credentials.clientId
6719
+ };
6720
+ }
6676
6721
  const runLocked = async () => {
6677
6722
  const recheck = await readCachedToken(cacheKey, cache);
6678
6723
  if (recheck !== void 0) {
@@ -6705,7 +6750,11 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
6705
6750
  pendingExchanges.delete(cacheKey);
6706
6751
  });
6707
6752
  pendingExchanges.set(cacheKey, exchangePromise);
6708
- return exchangePromise;
6753
+ return {
6754
+ token: await exchangePromise,
6755
+ mechanism: "client_credentials" /* ClientCredentials */,
6756
+ clientId: credentials.clientId
6757
+ };
6709
6758
  }
6710
6759
  if (isPkceCredentials(credentials)) {
6711
6760
  const storedToken = await getTokenFromCliLogin({
@@ -6715,7 +6764,11 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
6715
6764
  debug: options.debug
6716
6765
  });
6717
6766
  if (storedToken) {
6718
- return storedToken;
6767
+ return {
6768
+ token: storedToken,
6769
+ mechanism: "pkce" /* Pkce */,
6770
+ clientId: null
6771
+ };
6719
6772
  }
6720
6773
  throw new Error(
6721
6774
  "PKCE credentials require interactive login. Please run the 'login' command with the CLI first, or use client_credentials flow."
@@ -6909,7 +6962,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
6909
6962
  }
6910
6963
 
6911
6964
  // src/sdk-version.ts
6912
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.76.0" : void 0) || "unknown";
6965
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.76.1" : void 0) || "unknown";
6913
6966
 
6914
6967
  // src/utils/open-url.ts
6915
6968
  var nodePrefix = "node:";
@@ -9732,6 +9785,8 @@ function createBaseEvent(context = {}) {
9732
9785
  release_id: getReleaseId(),
9733
9786
  customuser_id: context.customuser_id,
9734
9787
  account_id: context.account_id,
9788
+ client_id: context.client_id ?? null,
9789
+ auth_mechanism: context.auth_mechanism ?? null,
9735
9790
  identity_id: context.identity_id,
9736
9791
  visitor_id: context.visitor_id,
9737
9792
  correlation_id: context.correlation_id
@@ -9885,6 +9940,20 @@ function cleanupEventListeners() {
9885
9940
  var APPLICATION_LIFECYCLE_EVENT_SUBJECT = "platform.sdk.ApplicationLifecycleEvent";
9886
9941
  var ERROR_OCCURRED_EVENT_SUBJECT = "platform.sdk.ErrorOccurredEvent";
9887
9942
  var METHOD_CALLED_EVENT_SUBJECT = "platform.sdk.MethodCalledEvent";
9943
+ var NULL_EVENT_CONTEXT = Object.freeze({
9944
+ customuser_id: null,
9945
+ account_id: null,
9946
+ client_id: null,
9947
+ auth_mechanism: null
9948
+ });
9949
+ function buildEventAuthContext(auth) {
9950
+ const userIds = auth.token ? extractUserIdsFromJwt(auth.token) : { customuser_id: null, account_id: null };
9951
+ return {
9952
+ ...userIds,
9953
+ client_id: auth.clientId,
9954
+ auth_mechanism: auth.mechanism
9955
+ };
9956
+ }
9888
9957
  async function emitWithTimeout(transport, subject, event) {
9889
9958
  try {
9890
9959
  await Promise.race([
@@ -9960,16 +10029,11 @@ var eventEmissionPlugin = definePlugin(
9960
10029
  const getUserContext = (async () => {
9961
10030
  if (config.enabled) {
9962
10031
  try {
9963
- const token = await resolveAuthToken({
9964
- ...options
9965
- });
9966
- if (token) {
9967
- return extractUserIdsFromJwt(token);
9968
- }
10032
+ return buildEventAuthContext(await resolveAuth({ ...options }));
9969
10033
  } catch {
9970
10034
  }
9971
10035
  }
9972
- return { customuser_id: null, account_id: null };
10036
+ return NULL_EVENT_CONTEXT;
9973
10037
  })();
9974
10038
  const startupTime = Date.now();
9975
10039
  let shutdownStartTime = null;
@@ -10002,6 +10066,8 @@ var eventEmissionPlugin = definePlugin(
10002
10066
  release_id: getReleaseId(),
10003
10067
  customuser_id: null,
10004
10068
  account_id: null,
10069
+ client_id: null,
10070
+ auth_mechanism: null,
10005
10071
  identity_id: null,
10006
10072
  visitor_id: null,
10007
10073
  correlation_id: null
@@ -10030,6 +10096,8 @@ var eventEmissionPlugin = definePlugin(
10030
10096
  release_id: getReleaseId(),
10031
10097
  customuser_id: null,
10032
10098
  account_id: null,
10099
+ client_id: null,
10100
+ auth_mechanism: null,
10033
10101
  identity_id: null,
10034
10102
  visitor_id: null,
10035
10103
  correlation_id: null
@@ -10311,4 +10379,4 @@ var registryPlugin = definePlugin((_sdk) => {
10311
10379
  return {};
10312
10380
  });
10313
10381
 
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 };
10382
+ 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, 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, 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 };
@@ -1 +1 @@
1
- {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/builders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,SAAS,EACT,iBAAiB,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAkBjB,wBAAgB,eAAe,CAAC,OAAO,GAAE,YAAiB,GAAG,SAAS,CAWrE;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE,YAAiB,GACzB,kBAAkB,CAapB;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,6BAA6B,EACnC,OAAO,GAAE,YAAiB,GACzB,yBAAyB,CA4B3B;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,sBAAsB,EAC5B,OAAO,GAAE,YAAiB,GACzB,kBAAkB,CAmBpB;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,qBAAqB,EAC3B,OAAO,GAAE,YAAiB,GACzB,iBAAiB,CAiCnB"}
1
+ {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/builders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,SAAS,EACT,iBAAiB,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAkBjB,wBAAgB,eAAe,CAAC,OAAO,GAAE,YAAiB,GAAG,SAAS,CAarE;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE,YAAiB,GACzB,kBAAkB,CAapB;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,6BAA6B,EACnC,OAAO,GAAE,YAAiB,GACzB,yBAAyB,CA4B3B;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,sBAAsB,EAC5B,OAAO,GAAE,YAAiB,GACzB,kBAAkB,CAmBpB;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,qBAAqB,EAC3B,OAAO,GAAE,YAAiB,GACzB,iBAAiB,CAiCnB"}
@@ -15,6 +15,8 @@ export function createBaseEvent(context = {}) {
15
15
  release_id: getReleaseId(),
16
16
  customuser_id: context.customuser_id,
17
17
  account_id: context.account_id,
18
+ client_id: context.client_id ?? null,
19
+ auth_mechanism: context.auth_mechanism ?? null,
18
20
  identity_id: context.identity_id,
19
21
  visitor_id: context.visitor_id,
20
22
  correlation_id: context.correlation_id,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAqDnE;;;GAGG;AACH,wBAAgB,qBAAqB,SAEpC;AAGD,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,WAAW,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CACrC;AAGD,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE;QACb,SAAS,EAAE,cAAc,CAAC;QAC1B,MAAM,EAAE,mBAAmB,CAAC;QAE5B,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;QAErD,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;QAEtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QAIvB,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KACzC,CAAC;IACF,KAAK,EAAE;QACL,WAAW,EAAE,WAAW,CAAC;KAC1B,CAAC;CACH;AAyFD,eAAO,MAAM,mBAAmB;aAEnB;QAAE,OAAO,CAAC,EAAE,cAAc,CAAA;KAAE;;;;;;aACxB,oBAAoB;CA6VpC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAG3E,YAAY,EACV,YAAY,EACZ,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,eAAe,EACf,eAAe,EACf,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,SAAS,EACT,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AACtC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAqDnE;;;GAGG;AACH,wBAAgB,qBAAqB,SAEpC;AAGD,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,WAAW,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CACrC;AAGD,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE;QACb,SAAS,EAAE,cAAc,CAAC;QAC1B,MAAM,EAAE,mBAAmB,CAAC;QAE5B,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;QAErD,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;QAEtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QAIvB,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KACzC,CAAC;IACF,KAAK,EAAE;QACL,WAAW,EAAE,WAAW,CAAC;KAC1B,CAAC;CACH;AA0GD,eAAO,MAAM,mBAAmB;aAEnB;QAAE,OAAO,CAAC,EAAE,cAAc,CAAA;KAAE;;;;;;aACxB,oBAAoB;CA2VpC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAG3E,YAAY,EACV,YAAY,EACZ,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,eAAe,EACf,eAAe,EACf,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,SAAS,EACT,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AACtC,cAAc,SAAS,CAAC"}