@zapier/zapier-sdk 0.31.3 → 0.31.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 +6 -0
- package/dist/index.cjs +14 -1
- package/dist/index.d.mts +9 -1
- package/dist/index.mjs +14 -2
- package/dist/plugins/eventEmission/index.test.js +15 -7
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +7 -0
- package/dist/plugins/fetch/index.test.js +41 -0
- package/dist/types/errors.d.ts +8 -0
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +10 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
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",
|
|
@@ -5487,7 +5499,7 @@ function getCpuTime() {
|
|
|
5487
5499
|
|
|
5488
5500
|
// package.json
|
|
5489
5501
|
var package_default = {
|
|
5490
|
-
version: "0.31.
|
|
5502
|
+
version: "0.31.4"};
|
|
5491
5503
|
|
|
5492
5504
|
// src/plugins/eventEmission/builders.ts
|
|
5493
5505
|
function createBaseEvent(context = {}) {
|
|
@@ -6023,6 +6035,7 @@ exports.ZapierConfigurationError = ZapierConfigurationError;
|
|
|
6023
6035
|
exports.ZapierError = ZapierError;
|
|
6024
6036
|
exports.ZapierNotFoundError = ZapierNotFoundError;
|
|
6025
6037
|
exports.ZapierRateLimitError = ZapierRateLimitError;
|
|
6038
|
+
exports.ZapierRelayError = ZapierRelayError;
|
|
6026
6039
|
exports.ZapierResourceNotFoundError = ZapierResourceNotFoundError;
|
|
6027
6040
|
exports.ZapierTimeoutError = ZapierTimeoutError;
|
|
6028
6041
|
exports.ZapierUnknownError = ZapierUnknownError;
|
package/dist/index.d.mts
CHANGED
|
@@ -1215,6 +1215,14 @@ declare class ZapierRateLimitError extends ZapierError {
|
|
|
1215
1215
|
retries?: number;
|
|
1216
1216
|
});
|
|
1217
1217
|
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Error thrown when Relay itself encounters an error (as opposed to the upstream partner API returning an error).
|
|
1220
|
+
* Indicated by the presence of the X-Relay-Error response header.
|
|
1221
|
+
*/
|
|
1222
|
+
declare class ZapierRelayError extends ZapierError {
|
|
1223
|
+
readonly name = "ZapierRelayError";
|
|
1224
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1225
|
+
}
|
|
1218
1226
|
/**
|
|
1219
1227
|
* Utility function to format error messages for display
|
|
1220
1228
|
*/
|
|
@@ -2954,4 +2962,4 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk
|
|
|
2954
2962
|
}>;
|
|
2955
2963
|
declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
|
|
2956
2964
|
|
|
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 };
|
|
2965
|
+
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, 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",
|
|
@@ -5465,7 +5477,7 @@ function getCpuTime() {
|
|
|
5465
5477
|
|
|
5466
5478
|
// package.json
|
|
5467
5479
|
var package_default = {
|
|
5468
|
-
version: "0.31.
|
|
5480
|
+
version: "0.31.4"};
|
|
5469
5481
|
|
|
5470
5482
|
// src/plugins/eventEmission/builders.ts
|
|
5471
5483
|
function createBaseEvent(context = {}) {
|
|
@@ -5957,4 +5969,4 @@ var BaseSdkOptionsSchema = z.object({
|
|
|
5957
5969
|
// Use credentials instead
|
|
5958
5970
|
});
|
|
5959
5971
|
|
|
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 };
|
|
5972
|
+
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, 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
|
-
|
|
8
|
-
const mockTransport = {
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
16
|
-
|
|
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,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO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
|
|
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();
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -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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SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;gBAGrB,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"}
|
package/dist/types/errors.js
CHANGED
|
@@ -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
|
*/
|