@zapier/zapier-sdk 0.32.2 → 0.32.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.32.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 04000f6: Skip connection selection for apps that do not require auth
8
+
3
9
  ## 0.32.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1635,29 +1635,27 @@ var actionKeyResolver = {
1635
1635
  };
1636
1636
 
1637
1637
  // src/resolvers/connectionId.ts
1638
- var connectionIdResolver = {
1639
- type: "dynamic",
1640
- depends: ["appKey"],
1641
- fetch: async (sdk, resolvedParams) => {
1642
- const listOptions = {
1643
- maxItems: 1e3
1644
- };
1645
- if (resolvedParams.appKey) {
1646
- listOptions.appKey = resolvedParams.appKey;
1647
- }
1648
- const myConnections = await sdk.listConnections({
1649
- ...listOptions,
1650
- owner: "me"
1651
- });
1652
- const allConnections = await sdk.listConnections(listOptions);
1653
- const otherConnections = allConnections.data.filter(
1654
- (connection) => !myConnections.data.some(
1655
- (myConnection) => myConnection.id === connection.id
1656
- )
1657
- );
1658
- return [...myConnections.data, ...otherConnections];
1659
- },
1660
- prompt: (connections, params) => ({
1638
+ async function fetchConnections(sdk, resolvedParams) {
1639
+ const listOptions = {
1640
+ maxItems: 1e3
1641
+ };
1642
+ if (resolvedParams.appKey) {
1643
+ listOptions.appKey = resolvedParams.appKey;
1644
+ }
1645
+ const myConnections = await sdk.listConnections({
1646
+ ...listOptions,
1647
+ owner: "me"
1648
+ });
1649
+ const allConnections = await sdk.listConnections(listOptions);
1650
+ const otherConnections = allConnections.data.filter(
1651
+ (connection) => !myConnections.data.some(
1652
+ (myConnection) => myConnection.id === connection.id
1653
+ )
1654
+ );
1655
+ return [...myConnections.data, ...otherConnections];
1656
+ }
1657
+ function promptForConnection(connections, params) {
1658
+ return {
1661
1659
  type: "list",
1662
1660
  name: "connectionId",
1663
1661
  message: params.appKey ? `Select connection for ${params.appKey}:` : "Select connection:",
@@ -1671,11 +1669,30 @@ var connectionIdResolver = {
1671
1669
  value: null
1672
1670
  }
1673
1671
  ]
1674
- })
1672
+ };
1673
+ }
1674
+ var connectionIdResolver = {
1675
+ type: "dynamic",
1676
+ depends: ["appKey"],
1677
+ tryResolveWithoutPrompt: async (sdk, params) => {
1678
+ if (!params.appKey) return null;
1679
+ try {
1680
+ const app = await sdk.getApp({ appKey: params.appKey });
1681
+ if (!app.data.auth_type) {
1682
+ return { resolvedValue: null };
1683
+ }
1684
+ } catch {
1685
+ }
1686
+ return null;
1687
+ },
1688
+ fetch: fetchConnections,
1689
+ prompt: promptForConnection
1675
1690
  };
1676
1691
  var connectionIdGenericResolver = {
1677
- ...connectionIdResolver,
1678
- depends: []
1692
+ type: "dynamic",
1693
+ depends: [],
1694
+ fetch: fetchConnections,
1695
+ prompt: promptForConnection
1679
1696
  };
1680
1697
 
1681
1698
  // src/resolvers/inputs.ts
@@ -5503,7 +5520,7 @@ function getCpuTime() {
5503
5520
 
5504
5521
  // package.json
5505
5522
  var package_default = {
5506
- version: "0.32.2"};
5523
+ version: "0.32.3"};
5507
5524
 
5508
5525
  // src/plugins/eventEmission/builders.ts
5509
5526
  function createBaseEvent(context = {}) {
@@ -5626,7 +5643,6 @@ function removeExistingListeners() {
5626
5643
  var APPLICATION_LIFECYCLE_EVENT_SUBJECT = "platform.sdk.ApplicationLifecycleEvent";
5627
5644
  var ERROR_OCCURRED_EVENT_SUBJECT = "platform.sdk.ErrorOccurredEvent";
5628
5645
  var METHOD_CALLED_EVENT_SUBJECT = "platform.sdk.MethodCalledEvent";
5629
- var transportStates = /* @__PURE__ */ new WeakMap();
5630
5646
  async function emitWithTimeout(transport, subject, event) {
5631
5647
  try {
5632
5648
  await Promise.race([
@@ -5643,11 +5659,6 @@ async function emitWithTimeout(transport, subject, event) {
5643
5659
  }
5644
5660
  async function silentEmit(transport, subject, event, userContextPromise) {
5645
5661
  try {
5646
- let state = transportStates.get(transport);
5647
- if (!state) {
5648
- state = { hasWorked: false, hasLoggedFailure: false };
5649
- transportStates.set(transport, state);
5650
- }
5651
5662
  let enrichedEvent = event;
5652
5663
  if (userContextPromise) {
5653
5664
  try {
@@ -5656,19 +5667,7 @@ async function silentEmit(transport, subject, event, userContextPromise) {
5656
5667
  } catch {
5657
5668
  }
5658
5669
  }
5659
- transport.emit(subject, enrichedEvent).then(() => {
5660
- state.hasWorked = true;
5661
- }).catch((error) => {
5662
- if (!state.hasWorked && !state.hasLoggedFailure) {
5663
- state.hasLoggedFailure = true;
5664
- console.warn(
5665
- `[zapier-sdk] Tracking failed: ${error.message || "Unknown error"}`
5666
- );
5667
- console.warn(
5668
- `[zapier-sdk] Hint: Set trackingBaseUrl parameter or ZAPIER_TRACKING_BASE_URL environment variable if using custom domains`
5669
- );
5670
- }
5671
- });
5670
+ await transport.emit(subject, enrichedEvent);
5672
5671
  } catch {
5673
5672
  }
5674
5673
  }
@@ -5720,6 +5719,18 @@ var eventEmissionPlugin = ({ context }) => {
5720
5719
  const startupTime = Date.now();
5721
5720
  let shutdownStartTime = null;
5722
5721
  let closed = false;
5722
+ const pendingEmissions = /* @__PURE__ */ new Set();
5723
+ function trackEmission(promise) {
5724
+ pendingEmissions.add(promise);
5725
+ promise.finally(() => {
5726
+ pendingEmissions.delete(promise);
5727
+ });
5728
+ }
5729
+ async function flush() {
5730
+ while (pendingEmissions.size > 0) {
5731
+ await Promise.allSettled([...pendingEmissions]);
5732
+ }
5733
+ }
5723
5734
  if (!config.enabled) {
5724
5735
  return {
5725
5736
  context: {
@@ -5740,6 +5751,8 @@ var eventEmissionPlugin = ({ context }) => {
5740
5751
  }),
5741
5752
  emitMethodCalled: () => {
5742
5753
  },
5754
+ flush: async () => {
5755
+ },
5743
5756
  close: async () => {
5744
5757
  }
5745
5758
  }
@@ -5774,11 +5787,13 @@ var eventEmissionPlugin = ({ context }) => {
5774
5787
  const startupEvent = buildApplicationLifecycleEvent({
5775
5788
  lifecycle_event_type: "startup"
5776
5789
  });
5777
- silentEmit(
5778
- transport,
5779
- APPLICATION_LIFECYCLE_EVENT_SUBJECT,
5780
- startupEvent,
5781
- getUserContext
5790
+ trackEmission(
5791
+ silentEmit(
5792
+ transport,
5793
+ APPLICATION_LIFECYCLE_EVENT_SUBJECT,
5794
+ startupEvent,
5795
+ getUserContext
5796
+ )
5782
5797
  );
5783
5798
  if (typeof process?.on === "function") {
5784
5799
  removeExistingListeners();
@@ -5793,11 +5808,13 @@ var eventEmissionPlugin = ({ context }) => {
5793
5808
  is_graceful_shutdown: code === 0,
5794
5809
  shutdown_duration_ms: shutdownDuration
5795
5810
  });
5796
- silentEmit(
5797
- transport,
5798
- APPLICATION_LIFECYCLE_EVENT_SUBJECT,
5799
- exitEvent,
5800
- getUserContext
5811
+ trackEmission(
5812
+ silentEmit(
5813
+ transport,
5814
+ APPLICATION_LIFECYCLE_EVENT_SUBJECT,
5815
+ exitEvent,
5816
+ getUserContext
5817
+ )
5801
5818
  );
5802
5819
  };
5803
5820
  registeredListeners.exit = exitHandler;
@@ -5886,6 +5903,7 @@ var eventEmissionPlugin = ({ context }) => {
5886
5903
  const close = async (exitCode) => {
5887
5904
  if (closed) return;
5888
5905
  closed = true;
5906
+ await flush();
5889
5907
  const uptime = Date.now() - startupTime;
5890
5908
  const shutdownDuration = shutdownStartTime ? Date.now() - shutdownStartTime : null;
5891
5909
  let exitEvent = buildApplicationLifecycleEvent({
@@ -5913,7 +5931,7 @@ var eventEmissionPlugin = ({ context }) => {
5913
5931
  transport,
5914
5932
  config,
5915
5933
  emit: (subject, event) => {
5916
- silentEmit(transport, subject, event, getUserContext);
5934
+ trackEmission(silentEmit(transport, subject, event, getUserContext));
5917
5935
  },
5918
5936
  createBaseEvent: createBaseEventHelper,
5919
5937
  emitMethodCalled: (data) => {
@@ -5921,13 +5939,16 @@ var eventEmissionPlugin = ({ context }) => {
5921
5939
  ...buildMethodCalledEvent(data),
5922
5940
  call_context: config.callContext ?? "sdk"
5923
5941
  };
5924
- silentEmit(
5925
- transport,
5926
- METHOD_CALLED_EVENT_SUBJECT,
5927
- event,
5928
- getUserContext
5942
+ trackEmission(
5943
+ silentEmit(
5944
+ transport,
5945
+ METHOD_CALLED_EVENT_SUBJECT,
5946
+ event,
5947
+ getUserContext
5948
+ )
5929
5949
  );
5930
5950
  },
5951
+ flush,
5931
5952
  close
5932
5953
  }
5933
5954
  }
package/dist/index.d.mts CHANGED
@@ -388,6 +388,7 @@ interface EventEmissionContext {
388
388
  emit<T extends any>(subject: string, event: T): void;
389
389
  createBaseEvent(): Promise<BaseEvent>;
390
390
  emitMethodCalled(data: MethodCalledEventData): void;
391
+ flush(): Promise<void>;
391
392
  close(exitCode?: number): Promise<void>;
392
393
  };
393
394
  }
@@ -2235,6 +2236,20 @@ interface DynamicResolver<TItem = unknown, TParams = Record<string, unknown>> ex
2235
2236
  type: "dynamic";
2236
2237
  fetch: (sdk: ZapierSdk, resolvedParams: TParams) => Promise<TItem[]>;
2237
2238
  prompt: (items: TItem[], params: TParams) => PromptConfig;
2239
+ /**
2240
+ * Optional hook called before fetch/prompt. If it returns a non-null object,
2241
+ * resolvedValue is used directly and fetch/prompt are skipped entirely. Return
2242
+ * null to fall through to the normal resolution flow. Implementations should
2243
+ * catch their own errors and return null on failure rather than throwing, so
2244
+ * that a transient API error does not block the CLI entirely.
2245
+ */
2246
+ tryResolveWithoutPrompt?: (sdk: ZapierSdk, params: TParams) => Promise<{
2247
+ resolvedValue: unknown;
2248
+ } | null>;
2249
+ }
2250
+ interface FieldsResolver<TParams = Record<string, unknown>> extends Resolver {
2251
+ type: "fields";
2252
+ fetch: (sdk: ZapierSdk, resolvedParams: TParams) => Promise<InputFieldItem$1[]>;
2238
2253
  }
2239
2254
  interface PositionalMetadata {
2240
2255
  positionalMeta: {
@@ -2959,4 +2974,4 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk
2959
2974
  }>;
2960
2975
  declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
2961
2976
 
2962
- export { type Action, type ActionEntry, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem$1 as ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionTimeoutMsProperty, ActionTimeoutMsPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type AddActionEntryOptions, type AddActionEntryResult, type ApiError, type ApiEvent, type ApiPluginOptions, type ApiPluginProvides, type App, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type ApplicationLifecycleEventData, type AppsPluginProvides, type AuthEvent, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type BaseEvent, BaseSdkOptionsSchema, type BatchOptions, type Choice, type ClientCredentialsObject, ClientCredentialsObjectSchema, type Connection, type ConnectionIdProperty, ConnectionIdPropertySchema, type ConnectionItem, type ConnectionsResponse, type CreateClientCredentialsPluginProvides, type Credentials, type CredentialsFunction, CredentialsFunctionSchema, type CredentialsObject, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, type DebugProperty, DebugPropertySchema, type DeleteClientCredentialsPluginProvides, type EnhancedErrorEventData, type ErrorOptions, type EventCallback, type EventContext, type EventEmissionContext, type FetchPluginProvides, type Field, type FieldsetItem, type FindFirstAuthenticationPluginProvides, type FindFirstConnectionPluginProvides, type FindUniqueAuthenticationPluginProvides, type FindUniqueConnectionPluginProvides, type FormatMetadata, type FormattedItem, type FunctionOptions, type FunctionRegistryEntry, type GetActionPluginProvides, type GetAppPluginProvides, type GetAuthenticationPluginProvides, type GetConnectionPluginProvides, type GetContextType, type GetProfilePluginProvides, type GetSdkType, type InfoFieldItem, type InputFieldItem, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type ListActionsPluginProvides, type ListAppsPluginProvides, type ListAuthenticationsPluginProvides, type ListClientCredentialsPluginProvides, type ListConnectionsPluginProvides, type ListInputFieldsPluginProvides, type LoadingEvent, MAX_PAGE_LIMIT, type Manifest, type ManifestEntry, type ManifestPluginOptions, type ManifestPluginProvides, type MethodCalledEvent, type MethodCalledEventData, type Need, type NeedsRequest, type NeedsResponse, type OffsetProperty, OffsetPropertySchema, type OutputProperty, OutputPropertySchema, type PaginatedSdkFunction, type ParamsProperty, ParamsPropertySchema, type PkceCredentialsObject, PkceCredentialsObjectSchema, type Plugin, type PluginDependencies, type PluginOptions, type PluginProvides, type PositionalMetadata, type RateLimitInfo, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type ResolveAuthTokenOptions, type ResolveCredentialsOptions, type ResolvedCredentials, ResolvedCredentialsSchema, type RootFieldItem, type RunActionPluginProvides, type Sdk, type SdkEvent, type StaticResolver, type UpdateManifestEntryOptions, type UpdateManifestEntryResult, type UserProfile, type UserProfileItem, ZAPIER_AUTH_BASE_URL, ZAPIER_AUTH_CLIENT_ID, ZAPIER_BASE_URL, ZAPIER_CREDENTIALS, ZAPIER_CREDENTIALS_BASE_URL, ZAPIER_CREDENTIALS_CLIENT_ID, ZAPIER_CREDENTIALS_CLIENT_SECRET, ZAPIER_CREDENTIALS_SCOPE, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZAPIER_TOKEN, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, type ZapierFetchInitOptions, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, type ZapierSdk, type ZapierSdkApps, type ZapierSdkOptions, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, createBaseEvent, createClientCredentialsPlugin, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTokenFromCliLogin, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, toSnakeCase, toTitleCase };
2977
+ export { type Action, type ActionEntry, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem$1 as ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionTimeoutMsProperty, ActionTimeoutMsPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type AddActionEntryOptions, type AddActionEntryResult, type ApiError, type ApiEvent, type ApiPluginOptions, type ApiPluginProvides, type App, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type ApplicationLifecycleEventData, type AppsPluginProvides, type AuthEvent, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type BaseEvent, BaseSdkOptionsSchema, type BatchOptions, type Choice, type ClientCredentialsObject, ClientCredentialsObjectSchema, type Connection, type ConnectionIdProperty, ConnectionIdPropertySchema, type ConnectionItem, type ConnectionsResponse, type CreateClientCredentialsPluginProvides, type Credentials, type CredentialsFunction, CredentialsFunctionSchema, type CredentialsObject, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, type DebugProperty, DebugPropertySchema, type DeleteClientCredentialsPluginProvides, type DynamicResolver, type EnhancedErrorEventData, type ErrorOptions, type EventCallback, type EventContext, type EventEmissionContext, type FetchPluginProvides, type Field, type FieldsResolver, type FieldsetItem, type FindFirstAuthenticationPluginProvides, type FindFirstConnectionPluginProvides, type FindUniqueAuthenticationPluginProvides, type FindUniqueConnectionPluginProvides, type FormatMetadata, type FormattedItem, type FunctionOptions, type FunctionRegistryEntry, type GetActionPluginProvides, type GetAppPluginProvides, type GetAuthenticationPluginProvides, type GetConnectionPluginProvides, type GetContextType, type GetProfilePluginProvides, type GetSdkType, type InfoFieldItem, type InputFieldItem, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type ListActionsPluginProvides, type ListAppsPluginProvides, type ListAuthenticationsPluginProvides, type ListClientCredentialsPluginProvides, type ListConnectionsPluginProvides, type ListInputFieldsPluginProvides, type LoadingEvent, MAX_PAGE_LIMIT, type Manifest, type ManifestEntry, type ManifestPluginOptions, type ManifestPluginProvides, type MethodCalledEvent, type MethodCalledEventData, type Need, type NeedsRequest, type NeedsResponse, type OffsetProperty, OffsetPropertySchema, type OutputProperty, OutputPropertySchema, type PaginatedSdkFunction, type ParamsProperty, ParamsPropertySchema, type PkceCredentialsObject, PkceCredentialsObjectSchema, type Plugin, type PluginDependencies, type PluginOptions, type PluginProvides, type PositionalMetadata, type RateLimitInfo, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type ResolveAuthTokenOptions, type ResolveCredentialsOptions, type ResolvedCredentials, ResolvedCredentialsSchema, type Resolver, type RootFieldItem, type RunActionPluginProvides, type Sdk, type SdkEvent, type StaticResolver, type UpdateManifestEntryOptions, type UpdateManifestEntryResult, type UserProfile, type UserProfileItem, ZAPIER_AUTH_BASE_URL, ZAPIER_AUTH_CLIENT_ID, ZAPIER_BASE_URL, ZAPIER_CREDENTIALS, ZAPIER_CREDENTIALS_BASE_URL, ZAPIER_CREDENTIALS_CLIENT_ID, ZAPIER_CREDENTIALS_CLIENT_SECRET, ZAPIER_CREDENTIALS_SCOPE, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZAPIER_TOKEN, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, type ZapierFetchInitOptions, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, type ZapierSdk, type ZapierSdkApps, type ZapierSdkOptions, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, createBaseEvent, createClientCredentialsPlugin, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTokenFromCliLogin, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, toSnakeCase, toTitleCase };
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ export * from "./plugins/api";
25
25
  export type { Action, App, Need, Field, Choice, ActionExecutionResult, ActionField, ActionFieldChoice, NeedsRequest, NeedsResponse, Connection, ConnectionsResponse, UserProfile, } from "./api/types";
26
26
  export { isPositional, PositionalMetadata } from "./utils/schema-utils";
27
27
  export { createFunction } from "./utils/function-utils";
28
- export type { FormattedItem, FormatMetadata, StaticResolver, } from "./utils/schema-utils";
28
+ export type { FormattedItem, FormatMetadata, Resolver, StaticResolver, DynamicResolver, FieldsResolver, } from "./utils/schema-utils";
29
29
  export { toSnakeCase, toTitleCase } from "./utils/string-utils";
30
30
  export { batch } from "./utils/batch-utils";
31
31
  export type { BatchOptions } from "./utils/batch-utils";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAG/C,YAAY,EACV,iCAAiC,EACjC,+BAA+B,EAC/B,qCAAqC,EACrC,sCAAsC,GACvC,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O,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,IAAI,EACJ,aAAa,EACb,cAAc,EACd,UAAU,EACV,8BAA8B,EAC9B,0BAA0B,EAC1B,eAAe,EACf,eAAe,EACf,sBAAsB,GACvB,MAAM,yBAAyB,CAAC"}
package/dist/index.mjs CHANGED
@@ -1613,29 +1613,27 @@ var actionKeyResolver = {
1613
1613
  };
1614
1614
 
1615
1615
  // src/resolvers/connectionId.ts
1616
- var connectionIdResolver = {
1617
- type: "dynamic",
1618
- depends: ["appKey"],
1619
- fetch: async (sdk, resolvedParams) => {
1620
- const listOptions = {
1621
- maxItems: 1e3
1622
- };
1623
- if (resolvedParams.appKey) {
1624
- listOptions.appKey = resolvedParams.appKey;
1625
- }
1626
- const myConnections = await sdk.listConnections({
1627
- ...listOptions,
1628
- owner: "me"
1629
- });
1630
- const allConnections = await sdk.listConnections(listOptions);
1631
- const otherConnections = allConnections.data.filter(
1632
- (connection) => !myConnections.data.some(
1633
- (myConnection) => myConnection.id === connection.id
1634
- )
1635
- );
1636
- return [...myConnections.data, ...otherConnections];
1637
- },
1638
- prompt: (connections, params) => ({
1616
+ async function fetchConnections(sdk, resolvedParams) {
1617
+ const listOptions = {
1618
+ maxItems: 1e3
1619
+ };
1620
+ if (resolvedParams.appKey) {
1621
+ listOptions.appKey = resolvedParams.appKey;
1622
+ }
1623
+ const myConnections = await sdk.listConnections({
1624
+ ...listOptions,
1625
+ owner: "me"
1626
+ });
1627
+ const allConnections = await sdk.listConnections(listOptions);
1628
+ const otherConnections = allConnections.data.filter(
1629
+ (connection) => !myConnections.data.some(
1630
+ (myConnection) => myConnection.id === connection.id
1631
+ )
1632
+ );
1633
+ return [...myConnections.data, ...otherConnections];
1634
+ }
1635
+ function promptForConnection(connections, params) {
1636
+ return {
1639
1637
  type: "list",
1640
1638
  name: "connectionId",
1641
1639
  message: params.appKey ? `Select connection for ${params.appKey}:` : "Select connection:",
@@ -1649,11 +1647,30 @@ var connectionIdResolver = {
1649
1647
  value: null
1650
1648
  }
1651
1649
  ]
1652
- })
1650
+ };
1651
+ }
1652
+ var connectionIdResolver = {
1653
+ type: "dynamic",
1654
+ depends: ["appKey"],
1655
+ tryResolveWithoutPrompt: async (sdk, params) => {
1656
+ if (!params.appKey) return null;
1657
+ try {
1658
+ const app = await sdk.getApp({ appKey: params.appKey });
1659
+ if (!app.data.auth_type) {
1660
+ return { resolvedValue: null };
1661
+ }
1662
+ } catch {
1663
+ }
1664
+ return null;
1665
+ },
1666
+ fetch: fetchConnections,
1667
+ prompt: promptForConnection
1653
1668
  };
1654
1669
  var connectionIdGenericResolver = {
1655
- ...connectionIdResolver,
1656
- depends: []
1670
+ type: "dynamic",
1671
+ depends: [],
1672
+ fetch: fetchConnections,
1673
+ prompt: promptForConnection
1657
1674
  };
1658
1675
 
1659
1676
  // src/resolvers/inputs.ts
@@ -5481,7 +5498,7 @@ function getCpuTime() {
5481
5498
 
5482
5499
  // package.json
5483
5500
  var package_default = {
5484
- version: "0.32.2"};
5501
+ version: "0.32.3"};
5485
5502
 
5486
5503
  // src/plugins/eventEmission/builders.ts
5487
5504
  function createBaseEvent(context = {}) {
@@ -5604,7 +5621,6 @@ function removeExistingListeners() {
5604
5621
  var APPLICATION_LIFECYCLE_EVENT_SUBJECT = "platform.sdk.ApplicationLifecycleEvent";
5605
5622
  var ERROR_OCCURRED_EVENT_SUBJECT = "platform.sdk.ErrorOccurredEvent";
5606
5623
  var METHOD_CALLED_EVENT_SUBJECT = "platform.sdk.MethodCalledEvent";
5607
- var transportStates = /* @__PURE__ */ new WeakMap();
5608
5624
  async function emitWithTimeout(transport, subject, event) {
5609
5625
  try {
5610
5626
  await Promise.race([
@@ -5621,11 +5637,6 @@ async function emitWithTimeout(transport, subject, event) {
5621
5637
  }
5622
5638
  async function silentEmit(transport, subject, event, userContextPromise) {
5623
5639
  try {
5624
- let state = transportStates.get(transport);
5625
- if (!state) {
5626
- state = { hasWorked: false, hasLoggedFailure: false };
5627
- transportStates.set(transport, state);
5628
- }
5629
5640
  let enrichedEvent = event;
5630
5641
  if (userContextPromise) {
5631
5642
  try {
@@ -5634,19 +5645,7 @@ async function silentEmit(transport, subject, event, userContextPromise) {
5634
5645
  } catch {
5635
5646
  }
5636
5647
  }
5637
- transport.emit(subject, enrichedEvent).then(() => {
5638
- state.hasWorked = true;
5639
- }).catch((error) => {
5640
- if (!state.hasWorked && !state.hasLoggedFailure) {
5641
- state.hasLoggedFailure = true;
5642
- console.warn(
5643
- `[zapier-sdk] Tracking failed: ${error.message || "Unknown error"}`
5644
- );
5645
- console.warn(
5646
- `[zapier-sdk] Hint: Set trackingBaseUrl parameter or ZAPIER_TRACKING_BASE_URL environment variable if using custom domains`
5647
- );
5648
- }
5649
- });
5648
+ await transport.emit(subject, enrichedEvent);
5650
5649
  } catch {
5651
5650
  }
5652
5651
  }
@@ -5698,6 +5697,18 @@ var eventEmissionPlugin = ({ context }) => {
5698
5697
  const startupTime = Date.now();
5699
5698
  let shutdownStartTime = null;
5700
5699
  let closed = false;
5700
+ const pendingEmissions = /* @__PURE__ */ new Set();
5701
+ function trackEmission(promise) {
5702
+ pendingEmissions.add(promise);
5703
+ promise.finally(() => {
5704
+ pendingEmissions.delete(promise);
5705
+ });
5706
+ }
5707
+ async function flush() {
5708
+ while (pendingEmissions.size > 0) {
5709
+ await Promise.allSettled([...pendingEmissions]);
5710
+ }
5711
+ }
5701
5712
  if (!config.enabled) {
5702
5713
  return {
5703
5714
  context: {
@@ -5718,6 +5729,8 @@ var eventEmissionPlugin = ({ context }) => {
5718
5729
  }),
5719
5730
  emitMethodCalled: () => {
5720
5731
  },
5732
+ flush: async () => {
5733
+ },
5721
5734
  close: async () => {
5722
5735
  }
5723
5736
  }
@@ -5752,11 +5765,13 @@ var eventEmissionPlugin = ({ context }) => {
5752
5765
  const startupEvent = buildApplicationLifecycleEvent({
5753
5766
  lifecycle_event_type: "startup"
5754
5767
  });
5755
- silentEmit(
5756
- transport,
5757
- APPLICATION_LIFECYCLE_EVENT_SUBJECT,
5758
- startupEvent,
5759
- getUserContext
5768
+ trackEmission(
5769
+ silentEmit(
5770
+ transport,
5771
+ APPLICATION_LIFECYCLE_EVENT_SUBJECT,
5772
+ startupEvent,
5773
+ getUserContext
5774
+ )
5760
5775
  );
5761
5776
  if (typeof process?.on === "function") {
5762
5777
  removeExistingListeners();
@@ -5771,11 +5786,13 @@ var eventEmissionPlugin = ({ context }) => {
5771
5786
  is_graceful_shutdown: code === 0,
5772
5787
  shutdown_duration_ms: shutdownDuration
5773
5788
  });
5774
- silentEmit(
5775
- transport,
5776
- APPLICATION_LIFECYCLE_EVENT_SUBJECT,
5777
- exitEvent,
5778
- getUserContext
5789
+ trackEmission(
5790
+ silentEmit(
5791
+ transport,
5792
+ APPLICATION_LIFECYCLE_EVENT_SUBJECT,
5793
+ exitEvent,
5794
+ getUserContext
5795
+ )
5779
5796
  );
5780
5797
  };
5781
5798
  registeredListeners.exit = exitHandler;
@@ -5864,6 +5881,7 @@ var eventEmissionPlugin = ({ context }) => {
5864
5881
  const close = async (exitCode) => {
5865
5882
  if (closed) return;
5866
5883
  closed = true;
5884
+ await flush();
5867
5885
  const uptime = Date.now() - startupTime;
5868
5886
  const shutdownDuration = shutdownStartTime ? Date.now() - shutdownStartTime : null;
5869
5887
  let exitEvent = buildApplicationLifecycleEvent({
@@ -5891,7 +5909,7 @@ var eventEmissionPlugin = ({ context }) => {
5891
5909
  transport,
5892
5910
  config,
5893
5911
  emit: (subject, event) => {
5894
- silentEmit(transport, subject, event, getUserContext);
5912
+ trackEmission(silentEmit(transport, subject, event, getUserContext));
5895
5913
  },
5896
5914
  createBaseEvent: createBaseEventHelper,
5897
5915
  emitMethodCalled: (data) => {
@@ -5899,13 +5917,16 @@ var eventEmissionPlugin = ({ context }) => {
5899
5917
  ...buildMethodCalledEvent(data),
5900
5918
  call_context: config.callContext ?? "sdk"
5901
5919
  };
5902
- silentEmit(
5903
- transport,
5904
- METHOD_CALLED_EVENT_SUBJECT,
5905
- event,
5906
- getUserContext
5920
+ trackEmission(
5921
+ silentEmit(
5922
+ transport,
5923
+ METHOD_CALLED_EVENT_SUBJECT,
5924
+ event,
5925
+ getUserContext
5926
+ )
5907
5927
  );
5908
5928
  },
5929
+ flush,
5909
5930
  close
5910
5931
  }
5911
5932
  }
@@ -25,6 +25,7 @@ export interface EventEmissionContext {
25
25
  emit<T extends any>(subject: string, event: T): void;
26
26
  createBaseEvent(): Promise<BaseEvent>;
27
27
  emitMethodCalled(data: MethodCalledEventData): void;
28
+ flush(): Promise<void>;
28
29
  close(exitCode?: number): Promise<void>;
29
30
  };
30
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAWnE,OAAO,KAAK,EAAgB,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAsCnE;;;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,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sB,GACvB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,cAAc,SAAS,CAAC"}
@@ -39,8 +39,6 @@ export function cleanupEventListeners() {
39
39
  const APPLICATION_LIFECYCLE_EVENT_SUBJECT = "platform.sdk.ApplicationLifecycleEvent";
40
40
  const ERROR_OCCURRED_EVENT_SUBJECT = "platform.sdk.ErrorOccurredEvent";
41
41
  const METHOD_CALLED_EVENT_SUBJECT = "platform.sdk.MethodCalledEvent";
42
- // Track transport success/failure so we only log failure once.
43
- const transportStates = new WeakMap();
44
42
  async function emitWithTimeout(transport, subject, event) {
45
43
  try {
46
44
  await Promise.race([
@@ -57,42 +55,19 @@ async function emitWithTimeout(transport, subject, event) {
57
55
  // Silently ignore telemetry failures
58
56
  }
59
57
  }
60
- // Silent emission wrapper with smart first-failure logging
61
58
  async function silentEmit(transport, subject, event, userContextPromise) {
62
59
  try {
63
- // Get or initialize state for this transport
64
- let state = transportStates.get(transport);
65
- if (!state) {
66
- state = { hasWorked: false, hasLoggedFailure: false };
67
- transportStates.set(transport, state);
68
- }
69
- // Resolve user context and merge into event
70
60
  let enrichedEvent = event;
71
61
  if (userContextPromise) {
72
62
  try {
73
63
  const userContext = await userContextPromise;
74
- // Use Object.assign to safely merge user context into event
75
64
  enrichedEvent = Object.assign({}, event, userContext);
76
65
  }
77
66
  catch {
78
67
  // If user context promise fails, continue with original event
79
68
  }
80
69
  }
81
- // Fire and forget - don't await the transport
82
- transport
83
- .emit(subject, enrichedEvent)
84
- .then(() => {
85
- // Mark as working if any emit succeeds
86
- state.hasWorked = true;
87
- })
88
- .catch((error) => {
89
- // Only log if we haven't seen it work and haven't logged yet
90
- if (!state.hasWorked && !state.hasLoggedFailure) {
91
- state.hasLoggedFailure = true;
92
- console.warn(`[zapier-sdk] Tracking failed: ${error.message || "Unknown error"}`);
93
- console.warn(`[zapier-sdk] Hint: Set trackingBaseUrl parameter or ZAPIER_TRACKING_BASE_URL environment variable if using custom domains`);
94
- }
95
- });
70
+ await transport.emit(subject, enrichedEvent);
96
71
  }
97
72
  catch {
98
73
  // Silently ignore all errors
@@ -152,6 +127,18 @@ export const eventEmissionPlugin = ({ context }) => {
152
127
  const startupTime = Date.now();
153
128
  let shutdownStartTime = null;
154
129
  let closed = false;
130
+ const pendingEmissions = new Set();
131
+ function trackEmission(promise) {
132
+ pendingEmissions.add(promise);
133
+ promise.finally(() => {
134
+ pendingEmissions.delete(promise);
135
+ });
136
+ }
137
+ async function flush() {
138
+ while (pendingEmissions.size > 0) {
139
+ await Promise.allSettled([...pendingEmissions]);
140
+ }
141
+ }
155
142
  // If disabled, return noop implementations
156
143
  if (!config.enabled) {
157
144
  return {
@@ -171,6 +158,7 @@ export const eventEmissionPlugin = ({ context }) => {
171
158
  correlation_id: null,
172
159
  }),
173
160
  emitMethodCalled: () => { },
161
+ flush: async () => { },
174
162
  close: async () => { },
175
163
  },
176
164
  },
@@ -212,7 +200,7 @@ export const eventEmissionPlugin = ({ context }) => {
212
200
  const startupEvent = buildApplicationLifecycleEvent({
213
201
  lifecycle_event_type: "startup",
214
202
  });
215
- silentEmit(transport, APPLICATION_LIFECYCLE_EVENT_SUBJECT, startupEvent, getUserContext);
203
+ trackEmission(silentEmit(transport, APPLICATION_LIFECYCLE_EVENT_SUBJECT, startupEvent, getUserContext));
216
204
  // Register process event handlers (Node.js only)
217
205
  if (typeof process?.on === "function") {
218
206
  // Remove any existing listeners from previous SDK instances to prevent memory leaks
@@ -232,7 +220,7 @@ export const eventEmissionPlugin = ({ context }) => {
232
220
  is_graceful_shutdown: code === 0,
233
221
  shutdown_duration_ms: shutdownDuration,
234
222
  });
235
- silentEmit(transport, APPLICATION_LIFECYCLE_EVENT_SUBJECT, exitEvent, getUserContext);
223
+ trackEmission(silentEmit(transport, APPLICATION_LIFECYCLE_EVENT_SUBJECT, exitEvent, getUserContext));
236
224
  };
237
225
  registeredListeners.exit = exitHandler;
238
226
  process.on("exit", exitHandler);
@@ -327,6 +315,7 @@ export const eventEmissionPlugin = ({ context }) => {
327
315
  if (closed)
328
316
  return;
329
317
  closed = true;
318
+ await flush();
330
319
  const uptime = Date.now() - startupTime;
331
320
  const shutdownDuration = shutdownStartTime
332
321
  ? Date.now() - shutdownStartTime
@@ -354,7 +343,7 @@ export const eventEmissionPlugin = ({ context }) => {
354
343
  transport,
355
344
  config,
356
345
  emit: (subject, event) => {
357
- silentEmit(transport, subject, event, getUserContext);
346
+ trackEmission(silentEmit(transport, subject, event, getUserContext));
358
347
  },
359
348
  createBaseEvent: createBaseEventHelper,
360
349
  emitMethodCalled: (data) => {
@@ -362,8 +351,9 @@ export const eventEmissionPlugin = ({ context }) => {
362
351
  ...buildMethodCalledEvent(data),
363
352
  call_context: config.callContext ?? "sdk",
364
353
  };
365
- silentEmit(transport, METHOD_CALLED_EVENT_SUBJECT, event, getUserContext);
354
+ trackEmission(silentEmit(transport, METHOD_CALLED_EVENT_SUBJECT, event, getUserContext));
366
355
  },
356
+ flush,
367
357
  close,
368
358
  },
369
359
  },
@@ -71,8 +71,7 @@ describe("eventEmissionPlugin", () => {
71
71
  },
72
72
  },
73
73
  });
74
- // Ensure getUserContext has resolved (startup event also awaits it)
75
- await plugin.context.eventEmission.createBaseEvent();
74
+ await plugin.context.eventEmission.flush();
76
75
  // Clear startup event calls so we only assert on our test event
77
76
  mockTransport.emit.mockClear();
78
77
  const testEvent = {
@@ -81,8 +80,7 @@ describe("eventEmissionPlugin", () => {
81
80
  };
82
81
  const testSubject = "test.event.TestEvent";
83
82
  plugin.context.eventEmission.emit(testSubject, testEvent);
84
- // Give async emission time to complete
85
- await new Promise((resolve) => setTimeout(resolve, 50));
83
+ await plugin.context.eventEmission.flush();
86
84
  // The event will be enriched with user context (null values)
87
85
  expect(mockTransport.emit).toHaveBeenCalledWith(testSubject, {
88
86
  ...testEvent,
@@ -132,116 +130,16 @@ describe("eventEmissionPlugin", () => {
132
130
  },
133
131
  },
134
132
  });
133
+ await plugin.context.eventEmission.flush();
135
134
  // Should not throw even if transport fails
136
135
  expect(() => {
137
136
  plugin.context.eventEmission.emit("test.event.TestEvent", {
138
137
  test_event: "data",
139
138
  });
140
139
  }).not.toThrow();
141
- // Give async emission time to complete
142
- await new Promise((resolve) => setTimeout(resolve, 10));
140
+ await plugin.context.eventEmission.flush();
143
141
  expect(failingTransport.emit).toHaveBeenCalled();
144
142
  });
145
- it("should log tracking failure only on first occurrence", async () => {
146
- // Mock console.warn to track logging calls
147
- const mockConsoleWarn = vi
148
- .spyOn(console, "warn")
149
- .mockImplementation(() => { });
150
- // Mock transport to throw error
151
- const failingTransport = {
152
- emit: vi.fn().mockRejectedValue(new Error("Network error")),
153
- close: vi.fn().mockResolvedValue(undefined),
154
- };
155
- vi.mocked(createTransport).mockReturnValueOnce(failingTransport);
156
- const plugin = eventEmissionPlugin({
157
- sdk: {},
158
- context: {
159
- meta: {},
160
- options: {
161
- eventEmission: {
162
- enabled: true,
163
- transport: {
164
- type: "http",
165
- endpoint: "https://example.com",
166
- },
167
- },
168
- },
169
- },
170
- });
171
- // First event should trigger logging
172
- plugin.context.eventEmission.emit("test.event.FirstEvent", {
173
- data: "first",
174
- });
175
- await new Promise((resolve) => setTimeout(resolve, 10));
176
- // Verify logging occurred
177
- const initialLogCount = mockConsoleWarn.mock.calls.length;
178
- expect(initialLogCount).toBeGreaterThan(0);
179
- // Second and third events should not trigger additional logging
180
- plugin.context.eventEmission.emit("test.event.SecondEvent", {
181
- data: "second",
182
- });
183
- plugin.context.eventEmission.emit("test.event.ThirdEvent", {
184
- data: "third",
185
- });
186
- await new Promise((resolve) => setTimeout(resolve, 10));
187
- // Verify no additional logging occurred
188
- expect(mockConsoleWarn).toHaveBeenCalledTimes(initialLogCount);
189
- mockConsoleWarn.mockRestore();
190
- });
191
- it("should not log failures after a successful emit", async () => {
192
- // Mock console.warn to track logging calls
193
- const mockConsoleWarn = vi
194
- .spyOn(console, "warn")
195
- .mockImplementation(() => { });
196
- // Mock transport that succeeds first, then fails
197
- let callCount = 0;
198
- const mixedTransport = {
199
- emit: vi.fn().mockImplementation(() => {
200
- callCount++;
201
- if (callCount === 1) {
202
- return Promise.resolve(); // First call succeeds
203
- }
204
- else {
205
- return Promise.reject(new Error("Network error")); // Subsequent calls fail
206
- }
207
- }),
208
- close: vi.fn().mockResolvedValue(undefined),
209
- };
210
- vi.mocked(createTransport).mockReturnValueOnce(mixedTransport);
211
- const plugin = eventEmissionPlugin({
212
- sdk: {},
213
- context: {
214
- meta: {},
215
- options: {
216
- eventEmission: {
217
- enabled: true,
218
- transport: {
219
- type: "http",
220
- endpoint: "https://example.com",
221
- },
222
- },
223
- },
224
- },
225
- });
226
- // First emit should succeed
227
- plugin.context.eventEmission.emit("test.event.SuccessfulEvent", {
228
- data: "success",
229
- });
230
- // Give time for success to be recorded
231
- await new Promise((resolve) => setTimeout(resolve, 10));
232
- // Subsequent emits should fail but not log
233
- plugin.context.eventEmission.emit("test.event.FailingEvent1", {
234
- data: "fail1",
235
- });
236
- plugin.context.eventEmission.emit("test.event.FailingEvent2", {
237
- data: "fail2",
238
- });
239
- // Give async emissions time to complete
240
- await new Promise((resolve) => setTimeout(resolve, 20));
241
- // Should not have logged any warnings because tracking worked initially
242
- expect(mockConsoleWarn).toHaveBeenCalledTimes(0);
243
- mockConsoleWarn.mockRestore();
244
- });
245
143
  it("should merge options with defaults", () => {
246
144
  // Override env var to ensure proper transport is used
247
145
  vi.stubEnv("ZAPIER_SDK_TELEMETRY_TRANSPORT", undefined);
@@ -611,7 +509,7 @@ describe("emitMethodCalled call_context", () => {
611
509
  success_flag: true,
612
510
  argument_count: 0,
613
511
  });
614
- await new Promise((resolve) => setTimeout(resolve, 50));
512
+ await plugin.context.eventEmission.flush();
615
513
  expect(mockTransport.emit).toHaveBeenCalledWith("platform.sdk.MethodCalledEvent", expect.objectContaining({ call_context: "sdk" }));
616
514
  });
617
515
  it("should set call_context to 'cli' when callContext is 'cli'", async () => {
@@ -634,7 +532,7 @@ describe("emitMethodCalled call_context", () => {
634
532
  success_flag: true,
635
533
  argument_count: 0,
636
534
  });
637
- await new Promise((resolve) => setTimeout(resolve, 50));
535
+ await plugin.context.eventEmission.flush();
638
536
  expect(mockTransport.emit).toHaveBeenCalledWith("platform.sdk.MethodCalledEvent", expect.objectContaining({ call_context: "cli" }));
639
537
  });
640
538
  it("should set call_context to 'mcp' when callContext is 'mcp'", async () => {
@@ -657,7 +555,7 @@ describe("emitMethodCalled call_context", () => {
657
555
  success_flag: true,
658
556
  argument_count: 0,
659
557
  });
660
- await new Promise((resolve) => setTimeout(resolve, 50));
558
+ await plugin.context.eventEmission.flush();
661
559
  expect(mockTransport.emit).toHaveBeenCalledWith("platform.sdk.MethodCalledEvent", expect.objectContaining({ call_context: "mcp" }));
662
560
  });
663
561
  });
@@ -437,6 +437,7 @@ describe("request plugin", () => {
437
437
  emit: () => { },
438
438
  createBaseEvent: (() => ({})),
439
439
  emitMethodCalled: emitSpy,
440
+ flush: async () => { },
440
441
  close: async () => { },
441
442
  },
442
443
  },
@@ -1 +1 @@
1
- {"version":3,"file":"connectionId.d.ts","sourceRoot":"","sources":["../../src/resolvers/connectionId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,KAAK,oBAAoB,GAAG,eAAe,CACzC,cAAc,EACd;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CACpB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,oBA4ClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,oBAGzC,CAAC"}
1
+ {"version":3,"file":"connectionId.d.ts","sourceRoot":"","sources":["../../src/resolvers/connectionId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,KAAK,oBAAoB,GAAG,eAAe,CACzC,cAAc,EACd;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CACpB,CAAC;AAoDF,eAAO,MAAM,oBAAoB,EAAE,oBAiBlC,CAAC;AAIF,eAAO,MAAM,2BAA2B,EAAE,oBAKzC,CAAC"}
@@ -1,23 +1,20 @@
1
- export const connectionIdResolver = {
2
- type: "dynamic",
3
- depends: ["appKey"],
4
- fetch: async (sdk, resolvedParams) => {
5
- const listOptions = {
6
- maxItems: 1000,
7
- };
8
- if (resolvedParams.appKey) {
9
- listOptions.appKey = resolvedParams.appKey;
10
- }
11
- const myConnections = await sdk.listConnections({
12
- ...listOptions,
13
- owner: "me",
14
- });
15
- const allConnections = await sdk.listConnections(listOptions);
16
- // Filter out myConnections from allConnections
17
- const otherConnections = allConnections.data.filter((connection) => !myConnections.data.some((myConnection) => myConnection.id === connection.id));
18
- return [...myConnections.data, ...otherConnections];
19
- },
20
- prompt: (connections, params) => ({
1
+ async function fetchConnections(sdk, resolvedParams) {
2
+ const listOptions = {
3
+ maxItems: 1000,
4
+ };
5
+ if (resolvedParams.appKey) {
6
+ listOptions.appKey = resolvedParams.appKey;
7
+ }
8
+ const myConnections = await sdk.listConnections({
9
+ ...listOptions,
10
+ owner: "me",
11
+ });
12
+ const allConnections = await sdk.listConnections(listOptions);
13
+ const otherConnections = allConnections.data.filter((connection) => !myConnections.data.some((myConnection) => myConnection.id === connection.id));
14
+ return [...myConnections.data, ...otherConnections];
15
+ }
16
+ function promptForConnection(connections, params) {
17
+ return {
21
18
  type: "list",
22
19
  name: "connectionId",
23
20
  message: params.appKey
@@ -33,10 +30,33 @@ export const connectionIdResolver = {
33
30
  value: null,
34
31
  },
35
32
  ],
36
- }),
33
+ };
34
+ }
35
+ export const connectionIdResolver = {
36
+ type: "dynamic",
37
+ depends: ["appKey"],
38
+ tryResolveWithoutPrompt: async (sdk, params) => {
39
+ if (!params.appKey)
40
+ return null;
41
+ try {
42
+ const app = await sdk.getApp({ appKey: params.appKey });
43
+ if (!app.data.auth_type) {
44
+ return { resolvedValue: null };
45
+ }
46
+ }
47
+ catch {
48
+ // If we can't determine auth type, fall through to normal connection prompt
49
+ }
50
+ return null;
51
+ },
52
+ fetch: fetchConnections,
53
+ prompt: promptForConnection,
37
54
  };
38
- // Generic version without appKey dependency
55
+ // Generic version without appKey dependency. tryResolveWithoutPrompt is intentionally
56
+ // absent: without appKey we cannot look up auth_type to determine if auth is required.
39
57
  export const connectionIdGenericResolver = {
40
- ...connectionIdResolver,
58
+ type: "dynamic",
41
59
  depends: [],
60
+ fetch: fetchConnections,
61
+ prompt: promptForConnection,
42
62
  };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=connectionId.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectionId.test.d.ts","sourceRoot":"","sources":["../../src/resolvers/connectionId.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,61 @@
1
+ import { describe, it, expect, vi, beforeAll } from "vitest";
2
+ import { connectionIdResolver } from "./connectionId";
3
+ describe("connectionIdResolver.tryResolveWithoutPrompt", () => {
4
+ let tryResolveWithoutPrompt;
5
+ beforeAll(() => {
6
+ if (!connectionIdResolver.tryResolveWithoutPrompt) {
7
+ throw new Error("connectionIdResolver.tryResolveWithoutPrompt is not defined");
8
+ }
9
+ tryResolveWithoutPrompt = connectionIdResolver.tryResolveWithoutPrompt;
10
+ });
11
+ it("returns null when no appKey is provided, deferring to the normal prompt", async () => {
12
+ const result = await tryResolveWithoutPrompt({}, {});
13
+ expect(result).toBeNull();
14
+ });
15
+ it("returns { resolvedValue: null } when the app has no auth_type, skipping the connection prompt", async () => {
16
+ const mockSdk = {
17
+ getApp: vi.fn().mockResolvedValue({ data: { auth_type: null } }),
18
+ };
19
+ const result = await tryResolveWithoutPrompt(mockSdk, {
20
+ appKey: "web-search-by-zapier",
21
+ });
22
+ expect(mockSdk.getApp).toHaveBeenCalledWith({
23
+ appKey: "web-search-by-zapier",
24
+ });
25
+ expect(result).toEqual({ resolvedValue: null });
26
+ });
27
+ it("returns { resolvedValue: null } when auth_type is absent from the app data", async () => {
28
+ const mockSdk = {
29
+ getApp: vi.fn().mockResolvedValue({ data: {} }),
30
+ };
31
+ const result = await tryResolveWithoutPrompt(mockSdk, {
32
+ appKey: "web-search-by-zapier",
33
+ });
34
+ expect(result).toEqual({ resolvedValue: null });
35
+ });
36
+ it("returns { resolvedValue: null } when auth_type is an empty string", async () => {
37
+ const mockSdk = {
38
+ getApp: vi.fn().mockResolvedValue({ data: { auth_type: "" } }),
39
+ };
40
+ const result = await tryResolveWithoutPrompt(mockSdk, {
41
+ appKey: "formatter",
42
+ });
43
+ expect(result).toEqual({ resolvedValue: null });
44
+ });
45
+ it("returns null for an app with auth_type set, allowing the connection picker to appear", async () => {
46
+ const mockSdk = {
47
+ getApp: vi.fn().mockResolvedValue({ data: { auth_type: "oauth" } }),
48
+ };
49
+ const result = await tryResolveWithoutPrompt(mockSdk, { appKey: "slack" });
50
+ expect(result).toBeNull();
51
+ });
52
+ it("returns null when getApp throws, falling back gracefully to the normal connection prompt", async () => {
53
+ const mockSdk = {
54
+ getApp: vi.fn().mockRejectedValue(new Error("App not found")),
55
+ };
56
+ const result = await tryResolveWithoutPrompt(mockSdk, {
57
+ appKey: "unknown-app",
58
+ });
59
+ expect(result).toBeNull();
60
+ });
61
+ });
@@ -47,6 +47,16 @@ export interface DynamicResolver<TItem = unknown, TParams = Record<string, unkno
47
47
  type: "dynamic";
48
48
  fetch: (sdk: ZapierSdk, resolvedParams: TParams) => Promise<TItem[]>;
49
49
  prompt: (items: TItem[], params: TParams) => PromptConfig;
50
+ /**
51
+ * Optional hook called before fetch/prompt. If it returns a non-null object,
52
+ * resolvedValue is used directly and fetch/prompt are skipped entirely. Return
53
+ * null to fall through to the normal resolution flow. Implementations should
54
+ * catch their own errors and return null on failure rather than throwing, so
55
+ * that a transient API error does not block the CLI entirely.
56
+ */
57
+ tryResolveWithoutPrompt?: (sdk: ZapierSdk, params: TParams) => Promise<{
58
+ resolvedValue: unknown;
59
+ } | null>;
50
60
  }
51
61
  export interface FieldsResolver<TParams = Record<string, unknown>> extends Resolver {
52
62
  type: "fields";
@@ -1 +1 @@
1
- {"version":3,"file":"schema-utils.d.ts","sourceRoot":"","sources":["../../src/utils/schema-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMvD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;KAC5D,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,cAAc,CAAC,KAAK,GAAG,OAAO;IAC7C,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,aAAa,CAAC;CACxC;AAGD,wBAAgB,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAC/C,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GACrC,CAAC,CAQH;AAGD,wBAAgB,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,GAAG,SAAS,CAE7E;AAGD,wBAAgB,gBAAgB,CAAC,CAAC,SA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AAC,CAWxB;AAMD,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE;QACd,UAAU,EAAE,IAAI,CAAC;KAClB,CAAC;CACH;AAGD,wBAAgB,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAChD,MAAM,EAAE,CAAC,GACR,CAAC,GAAG;IACL,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,kBAAkB,CAAC;CACtC,CAQA;AAWD,wBAAgB,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,OAAO,CAqBvD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.32.2",
3
+ "version": "0.32.3",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",