@zapier/zapier-sdk 0.31.3 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 250cb7d: Store CLI login credentials in system keychain.
8
+
9
+ ## 0.31.4
10
+
11
+ ### Patch Changes
12
+
13
+ - 026ae46: Properly capture and type errors from downstream proxy service.
14
+
3
15
  ## 0.31.3
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -4,8 +4,9 @@
4
4
 
5
5
  - [Closed Beta](#closed-beta)
6
6
  - [Documentation](#documentation)
7
- - [Installation](#installation)
8
7
  - [Quick Start](#quick-start)
8
+ - [Installation](#installation)
9
+ - [Walkthrough](#walkthrough)
9
10
  - [Factory](#factory)
10
11
  - [Available Functions](#available-functions)
11
12
  - [Accounts](#accounts)
@@ -50,20 +51,32 @@ While the dust settles, that documentation may be incomplete, and this README ma
50
51
 
51
52
  Agents are sometimes blocked from viewing docs on npm, so you may want to provide them a link to the official docs or copy the docs here into a prompt.
52
53
 
53
- ## Installation
54
+ ## Quick Start
55
+
56
+ _For new projects._
57
+
58
+ The following will create a new project from scratch, set up the SDK and the SDK CLI, and give you a working starter example to get you going:
54
59
 
55
60
  ```bash
56
- # If you're starting a new project:
57
- cd your-project-dir
58
- npm init -y
59
- npx tsc --init
60
- # Also, set `"type": "module"` in your package.json for the code examples below.
61
+ # Create a new Zapier SDK project (scaffolds files, installs deps, and logs you in).
62
+ npx @zapier/zapier-sdk-cli init my-zapier-app
63
+
64
+ # Or skip the interactive prompts and accept all defaults.
65
+ npx @zapier/zapier-sdk-cli init my-zapier-app --skip-prompts
66
+ ```
67
+
68
+ ## Installation
69
+
70
+ _For existing projects._
61
71
 
72
+ If you already have a project and want to start integrating apps through Zapier using the SDK:
73
+
74
+ ```bash
62
75
  npm install @zapier/zapier-sdk
63
76
  npm install -D @zapier/zapier-sdk-cli @types/node typescript
64
77
  ```
65
78
 
66
- ## Quick Start
79
+ ## Walkthrough
67
80
 
68
81
  Assuming you've installed the CLI package into your project (see instructions above), you (or an agent) can start using it right away. This is useful for introspecting actions, connections, etc. that you want to use in code, but you can also use it to directly use integrations.
69
82
 
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AA2oBjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AA4oBjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,CAAC"}
@@ -420,7 +420,8 @@ class ZapierApiClient {
420
420
  // If we know auth is required, and we don't have a token, throw an error
421
421
  // before we even make a request.
422
422
  if (options.authRequired) {
423
- if (headers.get("Authorization") == null && authToken == null) {
423
+ const authHeaderName = pathConfig?.authHeader ?? "Authorization";
424
+ if (headers.get(authHeaderName) == null && authToken == null) {
424
425
  const message = isCliLoginAvailable() === false
425
426
  ? "Authentication required but no credentials available. " +
426
427
  "To use CLI login, install the CLI as a dev dependency " +
@@ -43,8 +43,8 @@ export declare const NeedSchema: z.ZodObject<{
43
43
  string: "string";
44
44
  boolean: "boolean";
45
45
  file: "file";
46
- filter: "filter";
47
46
  integer: "integer";
47
+ filter: "filter";
48
48
  text: "text";
49
49
  datetime: "datetime";
50
50
  decimal: "decimal";
@@ -65,8 +65,8 @@ export declare const ActionPermissionsSchema: z.ZodObject<{
65
65
  export declare const ActionSchema: z.ZodObject<{
66
66
  id: z.ZodOptional<z.ZodString>;
67
67
  type: z.ZodEnum<{
68
- filter: "filter";
69
68
  search: "search";
69
+ filter: "filter";
70
70
  read: "read";
71
71
  read_bulk: "read_bulk";
72
72
  run: "run";
@@ -287,8 +287,8 @@ export declare const NeedsResponseSchema: z.ZodObject<{
287
287
  string: "string";
288
288
  boolean: "boolean";
289
289
  file: "file";
290
- filter: "filter";
291
290
  integer: "integer";
291
+ filter: "filter";
292
292
  text: "text";
293
293
  datetime: "datetime";
294
294
  decimal: "decimal";
@@ -312,8 +312,8 @@ export declare const ImplementationSchema: z.ZodObject<{
312
312
  actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
313
313
  id: z.ZodOptional<z.ZodString>;
314
314
  type: z.ZodEnum<{
315
- filter: "filter";
316
315
  search: "search";
316
+ filter: "filter";
317
317
  read: "read";
318
318
  read_bulk: "read_bulk";
319
319
  run: "run";
@@ -354,8 +354,8 @@ export declare const ImplementationsResponseSchema: z.ZodObject<{
354
354
  actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
355
355
  id: z.ZodOptional<z.ZodString>;
356
356
  type: z.ZodEnum<{
357
- filter: "filter";
358
357
  search: "search";
358
+ filter: "filter";
359
359
  read: "read";
360
360
  read_bulk: "read_bulk";
361
361
  run: "run";
package/dist/auth.d.ts CHANGED
@@ -55,6 +55,12 @@ interface CliLoginOptions {
55
55
  };
56
56
  debug?: boolean;
57
57
  }
58
+ type CliLoginModule = typeof import("@zapier/zapier-sdk-cli-login");
59
+ /**
60
+ * Inject an already-loaded CLI login module so the SDK skips its dynamic import.
61
+ * This guarantees CLI and SDK share the same module instance in the same process.
62
+ */
63
+ export declare function injectCliLogin(module: CliLoginModule): void;
58
64
  /**
59
65
  * Returns whether a CLI login package is available.
60
66
  * `undefined` if no import has been attempted yet, `true` if found, `false` if not.
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;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,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhB"}
package/dist/auth.js CHANGED
@@ -201,6 +201,13 @@ async function getCliLogin() {
201
201
  return undefined;
202
202
  }
203
203
  }
204
+ /**
205
+ * Inject an already-loaded CLI login module so the SDK skips its dynamic import.
206
+ * This guarantees CLI and SDK share the same module instance in the same process.
207
+ */
208
+ export function injectCliLogin(module) {
209
+ cachedCliLogin = module;
210
+ }
204
211
  /**
205
212
  * Returns whether a CLI login package is available.
206
213
  * `undefined` if no import has been attempted yet, `true` if found, `false` if not.
package/dist/index.cjs CHANGED
@@ -214,6 +214,12 @@ var ZapierRateLimitError = class extends ZapierError {
214
214
  this.retries = options.retries ?? 0;
215
215
  }
216
216
  };
217
+ var ZapierRelayError = class extends ZapierError {
218
+ constructor(message, options = {}) {
219
+ super(message, options);
220
+ this.name = "ZapierRelayError";
221
+ }
222
+ };
217
223
  function formatErrorMessage(error) {
218
224
  let message = error.message;
219
225
  if (error.errors && error.errors.length > 0) {
@@ -581,6 +587,12 @@ var fetchPlugin = ({ context }) => {
581
587
  signal: fetchInit.signal,
582
588
  authRequired: true
583
589
  });
590
+ const relayError = result.headers.get("x-relay-error");
591
+ if (relayError) {
592
+ throw new ZapierRelayError(relayError, {
593
+ statusCode: result.status
594
+ });
595
+ }
584
596
  if (!isNested) {
585
597
  context.eventEmission.emitMethodCalled({
586
598
  method_name: "fetch",
@@ -4291,6 +4303,9 @@ async function getCliLogin() {
4291
4303
  return void 0;
4292
4304
  }
4293
4305
  }
4306
+ function injectCliLogin(module) {
4307
+ cachedCliLogin = module;
4308
+ }
4294
4309
  function isCliLoginAvailable() {
4295
4310
  if (cachedCliLogin === void 0) return void 0;
4296
4311
  return cachedCliLogin !== false;
@@ -4722,7 +4737,8 @@ var ZapierApiClient = class {
4722
4737
  headers.set(authHeaderName, getAuthorizationHeader(authToken));
4723
4738
  }
4724
4739
  if (options.authRequired) {
4725
- if (headers.get("Authorization") == null && authToken == null) {
4740
+ const authHeaderName = pathConfig2?.authHeader ?? "Authorization";
4741
+ if (headers.get(authHeaderName) == null && authToken == null) {
4726
4742
  const message = isCliLoginAvailable() === false ? "Authentication required but no credentials available. To use CLI login, install the CLI as a dev dependency (e.g. `npm install -D @zapier/zapier-sdk-cli`) and log in (e.g. `npx zapier-sdk login`). Alternatively, set the ZAPIER_CREDENTIALS environment variable or ZAPIER_CREDENTIALS_CLIENT_ID and ZAPIER_CREDENTIALS_CLIENT_SECRET environment variables." : "Authentication required but no credentials available. Please log in (e.g. `npx zapier-sdk login`) or set the ZAPIER_CREDENTIALS environment variable or ZAPIER_CREDENTIALS_CLIENT_ID and ZAPIER_CREDENTIALS_CLIENT_SECRET environment variables.";
4727
4743
  throw new ZapierAuthenticationError(message);
4728
4744
  }
@@ -5487,7 +5503,7 @@ function getCpuTime() {
5487
5503
 
5488
5504
  // package.json
5489
5505
  var package_default = {
5490
- version: "0.31.3"};
5506
+ version: "0.32.0"};
5491
5507
 
5492
5508
  // src/plugins/eventEmission/builders.ts
5493
5509
  function createBaseEvent(context = {}) {
@@ -6023,6 +6039,7 @@ exports.ZapierConfigurationError = ZapierConfigurationError;
6023
6039
  exports.ZapierError = ZapierError;
6024
6040
  exports.ZapierNotFoundError = ZapierNotFoundError;
6025
6041
  exports.ZapierRateLimitError = ZapierRateLimitError;
6042
+ exports.ZapierRelayError = ZapierRelayError;
6026
6043
  exports.ZapierResourceNotFoundError = ZapierResourceNotFoundError;
6027
6044
  exports.ZapierTimeoutError = ZapierTimeoutError;
6028
6045
  exports.ZapierUnknownError = ZapierUnknownError;
@@ -6072,6 +6089,7 @@ exports.getPreferredManifestEntryKey = getPreferredManifestEntryKey;
6072
6089
  exports.getProfilePlugin = getProfilePlugin;
6073
6090
  exports.getReleaseId = getReleaseId;
6074
6091
  exports.getTokenFromCliLogin = getTokenFromCliLogin;
6092
+ exports.injectCliLogin = injectCliLogin;
6075
6093
  exports.inputFieldKeyResolver = inputFieldKeyResolver;
6076
6094
  exports.inputsAllOptionalResolver = inputsAllOptionalResolver;
6077
6095
  exports.inputsResolver = inputsResolver;
package/dist/index.d.mts CHANGED
@@ -3,6 +3,7 @@ import { z } from 'zod';
3
3
  import { ConnectionSchema, ConnectionsResponseSchema, ConnectionItem as ConnectionItem$2, GetConnectionResponse } from '@zapier/zapier-sdk-core/v0/schemas/connections';
4
4
  import { AppItem as AppItem$1 } from '@zapier/zapier-sdk-core/v0/schemas/apps';
5
5
  import { ClientCredentialsItem as ClientCredentialsItem$1, ClientCredentialsCreatedItem } from '@zapier/zapier-sdk-core/v0/schemas/client-credentials';
6
+ import * as _zapier_zapier_sdk_cli_login from '@zapier/zapier-sdk-cli-login';
6
7
 
7
8
  /**
8
9
  * SDK Event System
@@ -612,6 +613,7 @@ declare const NeedSchema: z.ZodObject<{
612
613
  boolean: "boolean";
613
614
  file: "file";
614
615
  integer: "integer";
616
+ filter: "filter";
615
617
  text: "text";
616
618
  datetime: "datetime";
617
619
  decimal: "decimal";
@@ -619,7 +621,6 @@ declare const NeedSchema: z.ZodObject<{
619
621
  password: "password";
620
622
  dict: "dict";
621
623
  code: "code";
622
- filter: "filter";
623
624
  json: "json";
624
625
  }>>;
625
626
  list: z.ZodOptional<z.ZodBoolean>;
@@ -818,6 +819,7 @@ declare const NeedsResponseSchema: z.ZodObject<{
818
819
  boolean: "boolean";
819
820
  file: "file";
820
821
  integer: "integer";
822
+ filter: "filter";
821
823
  text: "text";
822
824
  datetime: "datetime";
823
825
  decimal: "decimal";
@@ -825,7 +827,6 @@ declare const NeedsResponseSchema: z.ZodObject<{
825
827
  password: "password";
826
828
  dict: "dict";
827
829
  code: "code";
828
- filter: "filter";
829
830
  json: "json";
830
831
  }>>;
831
832
  list: z.ZodOptional<z.ZodBoolean>;
@@ -1215,6 +1216,14 @@ declare class ZapierRateLimitError extends ZapierError {
1215
1216
  retries?: number;
1216
1217
  });
1217
1218
  }
1219
+ /**
1220
+ * Error thrown when Relay itself encounters an error (as opposed to the upstream partner API returning an error).
1221
+ * Indicated by the presence of the X-Relay-Error response header.
1222
+ */
1223
+ declare class ZapierRelayError extends ZapierError {
1224
+ readonly name = "ZapierRelayError";
1225
+ constructor(message: string, options?: ErrorOptions);
1226
+ }
1218
1227
  /**
1219
1228
  * Utility function to format error messages for display
1220
1229
  */
@@ -2570,17 +2579,6 @@ type ClientCredentialsItem = z.infer<typeof ClientCredentialsItemSchema>;
2570
2579
 
2571
2580
  declare const clientIdResolver: DynamicResolver<ClientCredentialsItem, {}>;
2572
2581
 
2573
- /**
2574
- * SDK Authentication Utilities
2575
- *
2576
- * This module provides SDK-level authentication utilities focused
2577
- * on token acquisition. It uses the credentials system for resolution
2578
- * and handles different credential types appropriately.
2579
- *
2580
- * CLI-specific functionality like login/logout is handled by the
2581
- * @zapier/zapier-sdk-cli-login package.
2582
- */
2583
-
2584
2582
  /**
2585
2583
  * Options for resolving auth tokens.
2586
2584
  */
@@ -2623,6 +2621,12 @@ interface CliLoginOptions {
2623
2621
  };
2624
2622
  debug?: boolean;
2625
2623
  }
2624
+ type CliLoginModule = typeof _zapier_zapier_sdk_cli_login;
2625
+ /**
2626
+ * Inject an already-loaded CLI login module so the SDK skips its dynamic import.
2627
+ * This guarantees CLI and SDK share the same module instance in the same process.
2628
+ */
2629
+ declare function injectCliLogin(module: CliLoginModule): void;
2626
2630
  /**
2627
2631
  * Returns whether a CLI login package is available.
2628
2632
  * `undefined` if no import has been attempted yet, `true` if found, `false` if not.
@@ -2954,4 +2958,4 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk
2954
2958
  }>;
2955
2959
  declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
2956
2960
 
2957
- 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, 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, 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 };
2961
+ 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 };
package/dist/index.mjs CHANGED
@@ -192,6 +192,12 @@ var ZapierRateLimitError = class extends ZapierError {
192
192
  this.retries = options.retries ?? 0;
193
193
  }
194
194
  };
195
+ var ZapierRelayError = class extends ZapierError {
196
+ constructor(message, options = {}) {
197
+ super(message, options);
198
+ this.name = "ZapierRelayError";
199
+ }
200
+ };
195
201
  function formatErrorMessage(error) {
196
202
  let message = error.message;
197
203
  if (error.errors && error.errors.length > 0) {
@@ -559,6 +565,12 @@ var fetchPlugin = ({ context }) => {
559
565
  signal: fetchInit.signal,
560
566
  authRequired: true
561
567
  });
568
+ const relayError = result.headers.get("x-relay-error");
569
+ if (relayError) {
570
+ throw new ZapierRelayError(relayError, {
571
+ statusCode: result.status
572
+ });
573
+ }
562
574
  if (!isNested) {
563
575
  context.eventEmission.emitMethodCalled({
564
576
  method_name: "fetch",
@@ -4269,6 +4281,9 @@ async function getCliLogin() {
4269
4281
  return void 0;
4270
4282
  }
4271
4283
  }
4284
+ function injectCliLogin(module) {
4285
+ cachedCliLogin = module;
4286
+ }
4272
4287
  function isCliLoginAvailable() {
4273
4288
  if (cachedCliLogin === void 0) return void 0;
4274
4289
  return cachedCliLogin !== false;
@@ -4700,7 +4715,8 @@ var ZapierApiClient = class {
4700
4715
  headers.set(authHeaderName, getAuthorizationHeader(authToken));
4701
4716
  }
4702
4717
  if (options.authRequired) {
4703
- if (headers.get("Authorization") == null && authToken == null) {
4718
+ const authHeaderName = pathConfig2?.authHeader ?? "Authorization";
4719
+ if (headers.get(authHeaderName) == null && authToken == null) {
4704
4720
  const message = isCliLoginAvailable() === false ? "Authentication required but no credentials available. To use CLI login, install the CLI as a dev dependency (e.g. `npm install -D @zapier/zapier-sdk-cli`) and log in (e.g. `npx zapier-sdk login`). Alternatively, set the ZAPIER_CREDENTIALS environment variable or ZAPIER_CREDENTIALS_CLIENT_ID and ZAPIER_CREDENTIALS_CLIENT_SECRET environment variables." : "Authentication required but no credentials available. Please log in (e.g. `npx zapier-sdk login`) or set the ZAPIER_CREDENTIALS environment variable or ZAPIER_CREDENTIALS_CLIENT_ID and ZAPIER_CREDENTIALS_CLIENT_SECRET environment variables.";
4705
4721
  throw new ZapierAuthenticationError(message);
4706
4722
  }
@@ -5465,7 +5481,7 @@ function getCpuTime() {
5465
5481
 
5466
5482
  // package.json
5467
5483
  var package_default = {
5468
- version: "0.31.3"};
5484
+ version: "0.32.0"};
5469
5485
 
5470
5486
  // src/plugins/eventEmission/builders.ts
5471
5487
  function createBaseEvent(context = {}) {
@@ -5957,4 +5973,4 @@ var BaseSdkOptionsSchema = z.object({
5957
5973
  // Use credentials instead
5958
5974
  });
5959
5975
 
5960
- 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_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, ZapierNotFoundError, ZapierRateLimitError, 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, 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 };
5976
+ 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_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, 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 };
@@ -4,16 +4,19 @@
4
4
  import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
5
5
  import { eventEmissionPlugin, cleanupEventListeners } from "./index";
6
6
  import { createTransport } from "./transport";
7
- // Mock transport for testing
8
- const mockTransport = {
9
- emit: vi.fn().mockResolvedValue(undefined),
10
- close: vi.fn().mockResolvedValue(undefined),
11
- };
7
+ import { clearTokenCache } from "../../auth";
8
+ const { mockTransport, mockGetToken } = vi.hoisted(() => ({
9
+ mockTransport: {
10
+ emit: vi.fn().mockResolvedValue(undefined),
11
+ close: vi.fn().mockResolvedValue(undefined),
12
+ },
13
+ mockGetToken: vi.fn().mockResolvedValue(undefined),
14
+ }));
12
15
  vi.mock("./transport", () => ({
13
16
  createTransport: vi.fn(() => mockTransport),
14
17
  }));
15
- // Mock CLI login package - default to returning null context
16
- const mockGetToken = vi.fn().mockResolvedValue(undefined);
18
+ // Mock both CLI login import paths (SDK tries @zapier/zapier-sdk-cli/login
19
+ // first, then falls back to @zapier/zapier-sdk-cli-login)
17
20
  vi.mock("@zapier/zapier-sdk-cli/login", () => ({
18
21
  getToken: mockGetToken,
19
22
  }));
@@ -23,6 +26,7 @@ vi.mock("@zapier/zapier-sdk-cli-login", () => ({
23
26
  describe("eventEmissionPlugin", () => {
24
27
  beforeEach(() => {
25
28
  vi.clearAllMocks();
29
+ clearTokenCache();
26
30
  // Reset to default behavior - no token available
27
31
  mockGetToken.mockResolvedValue(undefined);
28
32
  });
@@ -67,6 +71,10 @@ describe("eventEmissionPlugin", () => {
67
71
  },
68
72
  },
69
73
  });
74
+ // Ensure getUserContext has resolved (startup event also awaits it)
75
+ await plugin.context.eventEmission.createBaseEvent();
76
+ // Clear startup event calls so we only assert on our test event
77
+ mockTransport.emit.mockClear();
70
78
  const testEvent = {
71
79
  test_data: "example",
72
80
  value: 123,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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AAM,sBAAsB,GAAG,WAAW,GAAG;IACjD,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,2CAA2C;IAC3C,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { ZapierRelayError } from "../../types/errors";
1
2
  import { FetchUrlSchema, FetchInitSchema } from "./schemas";
2
3
  import { coerceToNumericId } from "../../utils/id-utils";
3
4
  import { isPlainObject } from "../../utils/type-guard-utils";
@@ -90,6 +91,12 @@ export const fetchPlugin = ({ context }) => {
90
91
  signal: fetchInit.signal,
91
92
  authRequired: true,
92
93
  });
94
+ const relayError = result.headers.get("x-relay-error");
95
+ if (relayError) {
96
+ throw new ZapierRelayError(relayError, {
97
+ statusCode: result.status,
98
+ });
99
+ }
93
100
  if (!isNested) {
94
101
  context.eventEmission.emitMethodCalled({
95
102
  method_name: "fetch",
@@ -2,6 +2,7 @@ import { describe, it, expect, vi, beforeEach } from "vitest";
2
2
  import { fetchPlugin } from "./index";
3
3
  import { createSdk } from "../../sdk";
4
4
  import { eventEmissionPlugin } from "../eventEmission";
5
+ import { ZapierRelayError } from "../../types/errors";
5
6
  describe("fetch plugin", () => {
6
7
  let mockApiClient;
7
8
  let mockFetch;
@@ -363,6 +364,46 @@ describe("fetch plugin", () => {
363
364
  await expect(sdk.fetch("https://api.example.com/data")).rejects.toThrow("Network error");
364
365
  });
365
366
  });
367
+ describe("relay errors", () => {
368
+ it("should throw ZapierRelayError with the x-relay-error header message", async () => {
369
+ const friendlyMessage = "Ashby does not support direct HTTP requests. Use zapier.apps.{appKey} or zapier.runAction() to use Actions built for this app.";
370
+ mockFetch.mockResolvedValue(new Response("", {
371
+ status: 404,
372
+ headers: { "x-relay-error": friendlyMessage },
373
+ }));
374
+ const sdk = createTestSdk();
375
+ const error = await sdk
376
+ .fetch("https://api.example.com/data")
377
+ .catch((e) => e);
378
+ expect(error).toBeInstanceOf(ZapierRelayError);
379
+ expect(error.message).toBe(friendlyMessage);
380
+ expect(error.statusCode).toBe(404);
381
+ });
382
+ it("should throw ZapierRelayError for non-matching x-relay-error", async () => {
383
+ mockFetch.mockResolvedValue(new Response("", {
384
+ status: 404,
385
+ headers: { "x-relay-error": "Some other relay error" },
386
+ }));
387
+ const sdk = createTestSdk();
388
+ const error = await sdk
389
+ .fetch("https://api.example.com/data")
390
+ .catch((e) => e);
391
+ expect(error).toBeInstanceOf(ZapierRelayError);
392
+ expect(error.message).toBe("Some other relay error");
393
+ });
394
+ it("should throw ZapierRelayError regardless of status code", async () => {
395
+ mockFetch.mockResolvedValue(new Response("", {
396
+ status: 502,
397
+ headers: { "x-relay-error": "upstream timeout" },
398
+ }));
399
+ const sdk = createTestSdk();
400
+ const error = await sdk
401
+ .fetch("https://api.example.com/data")
402
+ .catch((e) => e);
403
+ expect(error).toBeInstanceOf(ZapierRelayError);
404
+ expect(error.statusCode).toBe(502);
405
+ });
406
+ });
366
407
  describe("context and metadata", () => {
367
408
  it("should provide context with meta information", () => {
368
409
  const sdk = createTestSdk();
@@ -6,8 +6,8 @@ export declare const GetActionSchema: z.ZodObject<{
6
6
  _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
7
7
  };
8
8
  actionType: z.ZodEnum<{
9
- filter: "filter";
10
9
  search: "search";
10
+ filter: "filter";
11
11
  read: "read";
12
12
  read_bulk: "read_bulk";
13
13
  run: "run";
@@ -5,8 +5,8 @@ export declare const GetInputFieldsSchemaSchema: z.ZodObject<{
5
5
  _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
6
6
  };
7
7
  actionType: z.ZodEnum<{
8
- filter: "filter";
9
8
  search: "search";
9
+ filter: "filter";
10
10
  read: "read";
11
11
  read_bulk: "read_bulk";
12
12
  run: "run";
@@ -7,8 +7,8 @@ export declare const ListActionsSchema: z.ZodObject<{
7
7
  _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
8
8
  };
9
9
  actionType: z.ZodOptional<z.ZodEnum<{
10
- filter: "filter";
11
10
  search: "search";
11
+ filter: "filter";
12
12
  read: "read";
13
13
  read_bulk: "read_bulk";
14
14
  run: "run";
@@ -13,8 +13,8 @@ export declare const ListInputFieldChoicesSchema: z.ZodObject<{
13
13
  _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
14
14
  };
15
15
  actionType: z.ZodEnum<{
16
- filter: "filter";
17
16
  search: "search";
17
+ filter: "filter";
18
18
  read: "read";
19
19
  read_bulk: "read_bulk";
20
20
  run: "run";
@@ -7,8 +7,8 @@ export declare const ListInputFieldsSchema: z.ZodObject<{
7
7
  _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
8
8
  };
9
9
  actionType: z.ZodEnum<{
10
- filter: "filter";
11
10
  search: "search";
11
+ filter: "filter";
12
12
  read: "read";
13
13
  read_bulk: "read_bulk";
14
14
  run: "run";
@@ -6,8 +6,8 @@ export declare const RunActionSchema: z.ZodObject<{
6
6
  _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
7
7
  };
8
8
  actionType: z.ZodEnum<{
9
- filter: "filter";
10
9
  search: "search";
10
+ filter: "filter";
11
11
  read: "read";
12
12
  read_bulk: "read_bulk";
13
13
  run: "run";
@@ -8,8 +8,8 @@ export declare const ActionItemSchema: z.ZodObject<{
8
8
  app_key: z.ZodString;
9
9
  app_version: z.ZodOptional<z.ZodString>;
10
10
  action_type: z.ZodEnum<{
11
- filter: "filter";
12
11
  search: "search";
12
+ filter: "filter";
13
13
  read: "read";
14
14
  read_bulk: "read_bulk";
15
15
  run: "run";
@@ -161,6 +161,14 @@ export declare class ZapierRateLimitError extends ZapierError {
161
161
  retries?: number;
162
162
  });
163
163
  }
164
+ /**
165
+ * Error thrown when Relay itself encounters an error (as opposed to the upstream partner API returning an error).
166
+ * Indicated by the presence of the X-Relay-Error response header.
167
+ */
168
+ export declare class ZapierRelayError extends ZapierError {
169
+ readonly name = "ZapierRelayError";
170
+ constructor(message: string, options?: ErrorOptions);
171
+ }
164
172
  /**
165
173
  * Utility function to format error messages for display
166
174
  */
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,8BAAsB,WAAY,SAAQ,KAAK;IAC7C,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;gBAEd,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB;CASxD;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C,QAAQ,CAAC,IAAI,oBAAoB;gBAErB,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB;CAGxD;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,WAAW;IACrD,QAAQ,CAAC,IAAI,4BAA4B;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAGrB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAY,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO;CA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rB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAY,GAAG;QACtB,SAAS,CAAC,EAAE,aAAa,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;KACb;CAMT;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,QAAQ,CAAC,IAAI,sBAAsB;gBAEvB,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB;CAGxD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CA8D7D"}
@@ -138,6 +138,16 @@ export class ZapierRateLimitError extends ZapierError {
138
138
  this.retries = options.retries ?? 0;
139
139
  }
140
140
  }
141
+ /**
142
+ * Error thrown when Relay itself encounters an error (as opposed to the upstream partner API returning an error).
143
+ * Indicated by the presence of the X-Relay-Error response header.
144
+ */
145
+ export class ZapierRelayError extends ZapierError {
146
+ constructor(message, options = {}) {
147
+ super(message, options);
148
+ this.name = "ZapierRelayError";
149
+ }
150
+ }
141
151
  /**
142
152
  * Utility function to format error messages for display
143
153
  */
@@ -3,8 +3,8 @@ export declare const AppKeyPropertySchema: z.ZodString & {
3
3
  _def: z.core.$ZodStringDef & import("..").PositionalMetadata;
4
4
  };
5
5
  export declare const ActionTypePropertySchema: z.ZodEnum<{
6
- filter: "filter";
7
6
  search: "search";
7
+ filter: "filter";
8
8
  read: "read";
9
9
  read_bulk: "read_bulk";
10
10
  run: "run";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.31.3",
3
+ "version": "0.32.0",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -45,7 +45,7 @@
45
45
  "tsup": "^8.5.0",
46
46
  "typescript": "^5.8.3",
47
47
  "vitest": "^3.2.3",
48
- "@zapier/zapier-sdk-cli-login": "0.7.0"
48
+ "@zapier/zapier-sdk-cli-login": "0.8.0"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsup",