@zapier/zapier-sdk 0.33.2 → 0.33.4

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,17 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.33.4
4
+
5
+ ### Patch Changes
6
+
7
+ - d9e0f1d: Fix user properties being overwritten by context merge in telemetry events
8
+
9
+ ## 0.33.3
10
+
11
+ ### Patch Changes
12
+
13
+ - f676852: Suppress resolver method calls from emitting telemetry events
14
+
3
15
  ## 0.33.2
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -5513,7 +5513,7 @@ function getCpuTime() {
5513
5513
  }
5514
5514
 
5515
5515
  // src/plugins/eventEmission/builders.ts
5516
- var SDK_VERSION = "0.33.2";
5516
+ var SDK_VERSION = "0.33.4";
5517
5517
  function createBaseEvent(context = {}) {
5518
5518
  return {
5519
5519
  event_id: generateEventId(),
@@ -5648,13 +5648,22 @@ async function emitWithTimeout(transport, subject, event) {
5648
5648
  } catch {
5649
5649
  }
5650
5650
  }
5651
+ function mergeUserContext(event, userContext) {
5652
+ const merged = { ...event };
5653
+ for (const [key, value] of Object.entries(userContext)) {
5654
+ if (merged[key] == null) {
5655
+ merged[key] = value;
5656
+ }
5657
+ }
5658
+ return merged;
5659
+ }
5651
5660
  async function silentEmit(transport, subject, event, userContextPromise) {
5652
5661
  try {
5653
5662
  let enrichedEvent = event;
5654
5663
  if (userContextPromise) {
5655
5664
  try {
5656
5665
  const userContext = await userContextPromise;
5657
- enrichedEvent = Object.assign({}, event, userContext);
5666
+ enrichedEvent = mergeUserContext(event, userContext);
5658
5667
  } catch {
5659
5668
  }
5660
5669
  }
@@ -5771,7 +5780,7 @@ var eventEmissionPlugin = ({ context }) => {
5771
5780
  };
5772
5781
  try {
5773
5782
  const userContext = await getUserContext;
5774
- return { ...baseEvent, ...userContext };
5783
+ return mergeUserContext(baseEvent, userContext);
5775
5784
  } catch {
5776
5785
  return baseEvent;
5777
5786
  }
@@ -5824,7 +5833,7 @@ var eventEmissionPlugin = ({ context }) => {
5824
5833
  });
5825
5834
  try {
5826
5835
  const userContext = await getUserContext;
5827
- errorEvent = { ...errorEvent, ...userContext };
5836
+ errorEvent = mergeUserContext(errorEvent, userContext);
5828
5837
  } catch {
5829
5838
  }
5830
5839
  await emitWithTimeout(
@@ -5852,7 +5861,7 @@ var eventEmissionPlugin = ({ context }) => {
5852
5861
  });
5853
5862
  try {
5854
5863
  const userContext = await getUserContext;
5855
- errorEvent = { ...errorEvent, ...userContext };
5864
+ errorEvent = mergeUserContext(errorEvent, userContext);
5856
5865
  } catch {
5857
5866
  }
5858
5867
  await emitWithTimeout(
@@ -5874,7 +5883,7 @@ var eventEmissionPlugin = ({ context }) => {
5874
5883
  });
5875
5884
  try {
5876
5885
  const userContext = await getUserContext;
5877
- signalEvent = { ...signalEvent, ...userContext };
5886
+ signalEvent = mergeUserContext(signalEvent, userContext);
5878
5887
  } catch {
5879
5888
  }
5880
5889
  await emitWithTimeout(
@@ -5908,7 +5917,7 @@ var eventEmissionPlugin = ({ context }) => {
5908
5917
  });
5909
5918
  try {
5910
5919
  const userContext = await getUserContext;
5911
- exitEvent = { ...exitEvent, ...userContext };
5920
+ exitEvent = mergeUserContext(exitEvent, userContext);
5912
5921
  } catch {
5913
5922
  }
5914
5923
  await emitWithTimeout(
@@ -6145,5 +6154,6 @@ exports.resolveAuthToken = resolveAuthToken;
6145
6154
  exports.resolveCredentials = resolveCredentials;
6146
6155
  exports.resolveCredentialsFromEnv = resolveCredentialsFromEnv;
6147
6156
  exports.runActionPlugin = runActionPlugin;
6157
+ exports.runWithTelemetryContext = runWithTelemetryContext;
6148
6158
  exports.toSnakeCase = toSnakeCase;
6149
6159
  exports.toTitleCase = toTitleCase;
package/dist/index.d.mts CHANGED
@@ -2443,6 +2443,8 @@ interface TelemetryCallbacks {
2443
2443
  */
2444
2444
  declare function createFunction<TOptions, TResult, TSchemaOptions extends TOptions = TOptions>(coreFn: (options: TOptions) => Promise<TResult>, schema?: z.ZodSchema<TSchemaOptions>, telemetry?: TelemetryCallbacks): (options?: TOptions) => Promise<TResult>;
2445
2445
 
2446
+ declare function runWithTelemetryContext<T>(fn: () => T): T;
2447
+
2446
2448
  /**
2447
2449
  * String utility functions for the Zapier SDK
2448
2450
  */
@@ -2967,4 +2969,4 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk
2967
2969
  }>;
2968
2970
  declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
2969
2971
 
2970
- 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 FunctionDeprecation, 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_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, 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 };
2972
+ 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 FunctionDeprecation, 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_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, 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, runWithTelemetryContext, toSnakeCase, toTitleCase };
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export type { Action, App, Need, Field, Choice, ActionExecutionResult, ActionFie
26
26
  export { isPositional, PositionalMetadata } from "./utils/schema-utils";
27
27
  export { createFunction } from "./utils/function-utils";
28
28
  export type { FormattedItem, FormatMetadata, Resolver, StaticResolver, DynamicResolver, FieldsResolver, } from "./utils/schema-utils";
29
+ export { runWithTelemetryContext } from "./utils/telemetry-context";
29
30
  export { toSnakeCase, toTitleCase } from "./utils/string-utils";
30
31
  export { batch } from "./utils/batch-utils";
31
32
  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,MAAM,sCAAsC,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cA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AE,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.js CHANGED
@@ -25,6 +25,8 @@ export * from "./plugins/api";
25
25
  // Export schema utilities for CLI
26
26
  export { isPositional } from "./utils/schema-utils";
27
27
  export { createFunction } from "./utils/function-utils";
28
+ // Export telemetry utilities for CLI
29
+ export { runWithTelemetryContext } from "./utils/telemetry-context";
28
30
  // Export string utilities
29
31
  export { toSnakeCase, toTitleCase } from "./utils/string-utils";
30
32
  // Export batch utilities
package/dist/index.mjs CHANGED
@@ -5491,7 +5491,7 @@ function getCpuTime() {
5491
5491
  }
5492
5492
 
5493
5493
  // src/plugins/eventEmission/builders.ts
5494
- var SDK_VERSION = "0.33.2";
5494
+ var SDK_VERSION = "0.33.4";
5495
5495
  function createBaseEvent(context = {}) {
5496
5496
  return {
5497
5497
  event_id: generateEventId(),
@@ -5626,13 +5626,22 @@ async function emitWithTimeout(transport, subject, event) {
5626
5626
  } catch {
5627
5627
  }
5628
5628
  }
5629
+ function mergeUserContext(event, userContext) {
5630
+ const merged = { ...event };
5631
+ for (const [key, value] of Object.entries(userContext)) {
5632
+ if (merged[key] == null) {
5633
+ merged[key] = value;
5634
+ }
5635
+ }
5636
+ return merged;
5637
+ }
5629
5638
  async function silentEmit(transport, subject, event, userContextPromise) {
5630
5639
  try {
5631
5640
  let enrichedEvent = event;
5632
5641
  if (userContextPromise) {
5633
5642
  try {
5634
5643
  const userContext = await userContextPromise;
5635
- enrichedEvent = Object.assign({}, event, userContext);
5644
+ enrichedEvent = mergeUserContext(event, userContext);
5636
5645
  } catch {
5637
5646
  }
5638
5647
  }
@@ -5749,7 +5758,7 @@ var eventEmissionPlugin = ({ context }) => {
5749
5758
  };
5750
5759
  try {
5751
5760
  const userContext = await getUserContext;
5752
- return { ...baseEvent, ...userContext };
5761
+ return mergeUserContext(baseEvent, userContext);
5753
5762
  } catch {
5754
5763
  return baseEvent;
5755
5764
  }
@@ -5802,7 +5811,7 @@ var eventEmissionPlugin = ({ context }) => {
5802
5811
  });
5803
5812
  try {
5804
5813
  const userContext = await getUserContext;
5805
- errorEvent = { ...errorEvent, ...userContext };
5814
+ errorEvent = mergeUserContext(errorEvent, userContext);
5806
5815
  } catch {
5807
5816
  }
5808
5817
  await emitWithTimeout(
@@ -5830,7 +5839,7 @@ var eventEmissionPlugin = ({ context }) => {
5830
5839
  });
5831
5840
  try {
5832
5841
  const userContext = await getUserContext;
5833
- errorEvent = { ...errorEvent, ...userContext };
5842
+ errorEvent = mergeUserContext(errorEvent, userContext);
5834
5843
  } catch {
5835
5844
  }
5836
5845
  await emitWithTimeout(
@@ -5852,7 +5861,7 @@ var eventEmissionPlugin = ({ context }) => {
5852
5861
  });
5853
5862
  try {
5854
5863
  const userContext = await getUserContext;
5855
- signalEvent = { ...signalEvent, ...userContext };
5864
+ signalEvent = mergeUserContext(signalEvent, userContext);
5856
5865
  } catch {
5857
5866
  }
5858
5867
  await emitWithTimeout(
@@ -5886,7 +5895,7 @@ var eventEmissionPlugin = ({ context }) => {
5886
5895
  });
5887
5896
  try {
5888
5897
  const userContext = await getUserContext;
5889
- exitEvent = { ...exitEvent, ...userContext };
5898
+ exitEvent = mergeUserContext(exitEvent, userContext);
5890
5899
  } catch {
5891
5900
  }
5892
5901
  await emitWithTimeout(
@@ -6009,4 +6018,4 @@ var BaseSdkOptionsSchema = z.object({
6009
6018
  // Use credentials instead
6010
6019
  });
6011
6020
 
6012
- export { ActionKeyPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, ClientCredentialsObjectSchema, ConnectionIdPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DebugPropertySchema, InputsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, 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 };
6021
+ export { ActionKeyPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, ClientCredentialsObjectSchema, ConnectionIdPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DebugPropertySchema, InputsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, 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, runWithTelemetryContext, toSnakeCase, toTitleCase };
@@ -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,CAAC;CACrC;AAGD,MAAM,WAAW,o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f,eAAe,EACf,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,cAAc,SAAS,CAAC"}
@@ -55,13 +55,22 @@ async function emitWithTimeout(transport, subject, event) {
55
55
  // Silently ignore telemetry failures
56
56
  }
57
57
  }
58
+ function mergeUserContext(event, userContext) {
59
+ const merged = { ...event };
60
+ for (const [key, value] of Object.entries(userContext)) {
61
+ if (merged[key] == null) {
62
+ merged[key] = value;
63
+ }
64
+ }
65
+ return merged;
66
+ }
58
67
  async function silentEmit(transport, subject, event, userContextPromise) {
59
68
  try {
60
69
  let enrichedEvent = event;
61
70
  if (userContextPromise) {
62
71
  try {
63
72
  const userContext = await userContextPromise;
64
- enrichedEvent = Object.assign({}, event, userContext);
73
+ enrichedEvent = mergeUserContext(event, userContext);
65
74
  }
66
75
  catch {
67
76
  // If user context promise fails, continue with original event
@@ -189,7 +198,7 @@ export const eventEmissionPlugin = ({ context }) => {
189
198
  // Enrich with user context if available
190
199
  try {
191
200
  const userContext = await getUserContext;
192
- return { ...baseEvent, ...userContext };
201
+ return mergeUserContext(baseEvent, userContext);
193
202
  }
194
203
  catch {
195
204
  // Return base event if user context fails
@@ -240,7 +249,7 @@ export const eventEmissionPlugin = ({ context }) => {
240
249
  // Enrich with user context if available
241
250
  try {
242
251
  const userContext = await getUserContext;
243
- errorEvent = { ...errorEvent, ...userContext };
252
+ errorEvent = mergeUserContext(errorEvent, userContext);
244
253
  }
245
254
  catch {
246
255
  // Continue with original event if user context fails
@@ -272,7 +281,7 @@ export const eventEmissionPlugin = ({ context }) => {
272
281
  // Enrich with user context if available
273
282
  try {
274
283
  const userContext = await getUserContext;
275
- errorEvent = { ...errorEvent, ...userContext };
284
+ errorEvent = mergeUserContext(errorEvent, userContext);
276
285
  }
277
286
  catch {
278
287
  // Continue with original event if user context fails
@@ -294,7 +303,7 @@ export const eventEmissionPlugin = ({ context }) => {
294
303
  // Enrich with user context if available
295
304
  try {
296
305
  const userContext = await getUserContext;
297
- signalEvent = { ...signalEvent, ...userContext };
306
+ signalEvent = mergeUserContext(signalEvent, userContext);
298
307
  }
299
308
  catch {
300
309
  // Continue with original event if user context fails
@@ -331,7 +340,7 @@ export const eventEmissionPlugin = ({ context }) => {
331
340
  });
332
341
  try {
333
342
  const userContext = await getUserContext;
334
- exitEvent = { ...exitEvent, ...userContext };
343
+ exitEvent = mergeUserContext(exitEvent, userContext);
335
344
  }
336
345
  catch {
337
346
  // Continue with original event if user context fails
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.33.2",
3
+ "version": "0.33.4",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",