@zapier/zapier-sdk 0.87.1 → 0.88.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.
@@ -3855,7 +3855,7 @@ function getZapierSdkService() {
3855
3855
  }
3856
3856
  var MAX_PAGE_LIMIT = 1e4;
3857
3857
  var DEFAULT_PAGE_SIZE = 100;
3858
- var DEFAULT_ACTION_TIMEOUT_MS = 18e4;
3858
+ var DEFAULT_ACTION_TIMEOUT_MILLISECONDS = 18e4;
3859
3859
  function parseIntEnvVar(name) {
3860
3860
  const value = globalThis.process?.env?.[name];
3861
3861
  if (value === void 0) return void 0;
@@ -3869,7 +3869,10 @@ function parseIntEnvVar(name) {
3869
3869
  return parsed;
3870
3870
  }
3871
3871
  var ZAPIER_MAX_NETWORK_RETRIES = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRIES") ?? 3;
3872
- var ZAPIER_MAX_NETWORK_RETRY_DELAY_MS = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRY_DELAY_MS") ?? 6e4;
3872
+ var maxNetworkRetryDelaySecondsEnv = parseIntEnvVar(
3873
+ "ZAPIER_MAX_NETWORK_RETRY_DELAY_SECONDS"
3874
+ );
3875
+ var ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS = (maxNetworkRetryDelaySecondsEnv != null ? maxNetworkRetryDelaySecondsEnv * 1e3 : void 0) ?? parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRY_DELAY_MS") ?? 6e4;
3873
3876
  var MAX_CONCURRENCY_LIMIT = 1e4;
3874
3877
  function parseConcurrencyEnvVar(name) {
3875
3878
  const value = globalThis.process?.env?.[name];
@@ -3900,7 +3903,7 @@ function getZapierDefaultApprovalMode() {
3900
3903
  const isInteractive = !!globalThis.process?.stdin?.isTTY && !!globalThis.process?.stdout?.isTTY;
3901
3904
  return isInteractive ? "poll" : "throw";
3902
3905
  }
3903
- var DEFAULT_APPROVAL_TIMEOUT_MS = 10 * 60 * 1e3;
3906
+ var DEFAULT_APPROVAL_TIMEOUT_MILLISECONDS = 10 * 60 * 1e3;
3904
3907
  var DEFAULT_MAX_APPROVAL_RETRIES = 2;
3905
3908
 
3906
3909
  // src/types/properties.ts
@@ -3942,8 +3945,11 @@ var OffsetPropertySchema = zod.z.number().int().min(0).default(0).describe("Numb
3942
3945
  var OutputPropertySchema = zod.z.string().describe("Output file path");
3943
3946
  var DebugPropertySchema = zod.z.boolean().default(false).describe("Enable debug logging");
3944
3947
  var ParamsPropertySchema = zod.z.record(zod.z.string(), zod.z.unknown()).describe("Additional parameters");
3945
- var ActionTimeoutMsPropertySchema = zod.z.number().min(1e3).optional().describe(
3946
- `Maximum time to wait for action completion in milliseconds (default: ${DEFAULT_ACTION_TIMEOUT_MS})`
3948
+ var ActionTimeoutSecondsPropertySchema = zod.z.number().min(1).optional().describe(
3949
+ `Maximum time to wait for action completion in seconds (default: ${DEFAULT_ACTION_TIMEOUT_MILLISECONDS / 1e3})`
3950
+ );
3951
+ var ActionTimeoutMillisecondsPropertySchema = zod.z.number().min(1e3).optional().describe(
3952
+ `Maximum time to wait for action completion in milliseconds (default: ${DEFAULT_ACTION_TIMEOUT_MILLISECONDS})`
3947
3953
  );
3948
3954
  var TablePropertySchema = withPositional(
3949
3955
  zod.z.string().regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID").describe("The unique identifier of the table")
@@ -4351,11 +4357,18 @@ var ActionExecutionInputSchema = zod.z.object({
4351
4357
  authenticationId: AuthenticationIdPropertySchema.optional().meta({
4352
4358
  deprecated: true
4353
4359
  }),
4354
- timeoutMs: ActionTimeoutMsPropertySchema
4360
+ timeoutSeconds: ActionTimeoutSecondsPropertySchema,
4361
+ /** @deprecated Use `timeoutSeconds` instead. */
4362
+ timeoutMs: ActionTimeoutMillisecondsPropertySchema.meta({
4363
+ deprecated: true
4364
+ })
4355
4365
  }).describe(
4356
4366
  "Execute an action with the given inputs for the bound app, as an alternative to runAction"
4357
4367
  ).meta({
4358
- aliases: { connectionId: "connection", authenticationId: "connection" }
4368
+ aliases: {
4369
+ connectionId: "connection",
4370
+ authenticationId: "connection"
4371
+ }
4359
4372
  });
4360
4373
  var AppFactoryInputSchema = zod.z.object({
4361
4374
  /** @deprecated Use `connection` instead. */
@@ -4533,19 +4546,19 @@ function createDebugFetch(options) {
4533
4546
 
4534
4547
  // src/utils/retry-utils.ts
4535
4548
  var MAX_CONSECUTIVE_ERRORS = 3;
4536
- var BASE_ERROR_BACKOFF_MS = 1e3;
4537
- var BASE_EXPONENTIAL_BACKOFF_MS = 1e3;
4549
+ var BASE_ERROR_BACKOFF_MILLISECONDS = 1e3;
4550
+ var BASE_EXPONENTIAL_BACKOFF_MILLISECONDS = 1e3;
4538
4551
  var JITTER_FACTOR = 0.5;
4539
4552
  function calculateErrorBackoffMs(baseInterval, errorCount) {
4540
4553
  const jitter = Math.random() * JITTER_FACTOR * baseInterval;
4541
4554
  const errorBackoff = Math.min(
4542
- BASE_ERROR_BACKOFF_MS * (errorCount / 2),
4555
+ BASE_ERROR_BACKOFF_MILLISECONDS * (errorCount / 2),
4543
4556
  baseInterval * 2
4544
4557
  // Cap error backoff at 2x the base interval
4545
4558
  );
4546
4559
  return Math.floor(baseInterval + jitter + errorBackoff);
4547
4560
  }
4548
- function calculateExponentialBackoffMs(attempt, baseDelayMs = BASE_EXPONENTIAL_BACKOFF_MS) {
4561
+ function calculateExponentialBackoffMs(attempt, baseDelayMs = BASE_EXPONENTIAL_BACKOFF_MILLISECONDS) {
4549
4562
  const baseDelay = baseDelayMs * Math.pow(2, attempt - 1);
4550
4563
  const jitter = Math.random() * JITTER_FACTOR * baseDelay;
4551
4564
  return Math.floor(baseDelay + jitter);
@@ -4648,11 +4661,11 @@ function combineAbortSignals({
4648
4661
  }
4649
4662
 
4650
4663
  // src/api/polling.ts
4651
- var DEFAULT_TIMEOUT_MS = 18e4;
4664
+ var DEFAULT_TIMEOUT_MILLISECONDS = 18e4;
4652
4665
  var DEFAULT_SUCCESS_STATUS = 200;
4653
4666
  var DEFAULT_PENDING_STATUS = 202;
4654
- var DEFAULT_INITIAL_DELAY_MS = 50;
4655
- var DEFAULT_MAX_POLLING_INTERVAL_MS = 6e4;
4667
+ var DEFAULT_INITIAL_DELAY_MILLISECONDS = 50;
4668
+ var DEFAULT_MAX_POLLING_INTERVAL_MILLISECONDS = 6e4;
4656
4669
  var POLLING_STAGES = [
4657
4670
  [125, 125],
4658
4671
  // Up to 125ms: poll every 125ms
@@ -4668,11 +4681,11 @@ var POLLING_STAGES = [
4668
4681
  // Up to 60s: poll every 5s
4669
4682
  [18e4, 1e4]
4670
4683
  // Up to 3min: poll every 10s
4671
- // Beyond 3min: use DEFAULT_MAX_POLLING_INTERVAL_MS (60s)
4684
+ // Beyond 3min: use DEFAULT_MAX_POLLING_INTERVAL_MILLISECONDS (60s)
4672
4685
  ];
4673
4686
  function getPollingInterval(elapsedMs) {
4674
4687
  const stage = POLLING_STAGES.find(([threshold]) => elapsedMs < threshold);
4675
- return stage ? stage[1] : DEFAULT_MAX_POLLING_INTERVAL_MS;
4688
+ return stage ? stage[1] : DEFAULT_MAX_POLLING_INTERVAL_MILLISECONDS;
4676
4689
  }
4677
4690
  function makeAbortError() {
4678
4691
  if (typeof DOMException !== "undefined") {
@@ -4730,8 +4743,8 @@ var processResponse = async (response, successStatus, pendingStatus, isPending,
4730
4743
  async function pollUntilComplete(options) {
4731
4744
  const {
4732
4745
  fetchPoll,
4733
- timeoutMs = DEFAULT_TIMEOUT_MS,
4734
- initialDelay = DEFAULT_INITIAL_DELAY_MS,
4746
+ timeoutMs = DEFAULT_TIMEOUT_MILLISECONDS,
4747
+ initialDelay = DEFAULT_INITIAL_DELAY_MILLISECONDS,
4735
4748
  successStatus = DEFAULT_SUCCESS_STATUS,
4736
4749
  pendingStatus = DEFAULT_PENDING_STATUS,
4737
4750
  isPending,
@@ -5178,7 +5191,7 @@ function clearTokenCache() {
5178
5191
  cachedCliLogin = void 0;
5179
5192
  cachedDefaultCache = void 0;
5180
5193
  }
5181
- var TOKEN_EXPIRATION_BUFFER_MS = 5 * 60 * 1e3;
5194
+ var TOKEN_EXPIRATION_BUFFER_MILLISECONDS = 5 * 60 * 1e3;
5182
5195
  async function resolveCache(options) {
5183
5196
  if (options.cache) return options.cache;
5184
5197
  if (cachedDefaultCache !== void 0) return cachedDefaultCache;
@@ -5199,7 +5212,7 @@ async function resolveCache(options) {
5199
5212
  }
5200
5213
  function entryIsValid(entry) {
5201
5214
  if (entry.expiresAt === void 0) return true;
5202
- return entry.expiresAt > Date.now() + TOKEN_EXPIRATION_BUFFER_MS;
5215
+ return entry.expiresAt > Date.now() + TOKEN_EXPIRATION_BUFFER_MILLISECONDS;
5203
5216
  }
5204
5217
  async function readCachedToken(cacheKey, cache) {
5205
5218
  const cached = await cache.get(cacheKey);
@@ -5815,7 +5828,7 @@ function parseDeprecationDate(value) {
5815
5828
  }
5816
5829
 
5817
5830
  // src/sdk-version.ts
5818
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.87.1" : void 0) || "unknown";
5831
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.88.0" : void 0) || "unknown";
5819
5832
 
5820
5833
  // src/utils/open-url.ts
5821
5834
  var nodePrefix = "node:";
@@ -5926,7 +5939,7 @@ var PollApprovalResponseSchema = zod.z.object({
5926
5939
  mode: ApprovalModeSchema.optional(),
5927
5940
  reason: zod.z.string().optional()
5928
5941
  });
5929
- var APPROVAL_MAX_POLLING_INTERVAL_MS = 5e3;
5942
+ var APPROVAL_MAX_POLLING_INTERVAL_MILLISECONDS = 5e3;
5930
5943
  function validateSdkPath(path) {
5931
5944
  if (!path.startsWith("/") || path.startsWith("//")) {
5932
5945
  throw new ZapierValidationError(
@@ -6091,7 +6104,7 @@ var ZapierApiClient = class {
6091
6104
  }
6092
6105
  const rateLimitInfo = parseRateLimitHeaders(response);
6093
6106
  const delayMs = rateLimitInfo.retryAfterMs ?? calculateExponentialBackoffMs(retries + 1);
6094
- if (delayMs > this.maxNetworkRetryDelayMs || retries >= this.maxNetworkRetries) {
6107
+ if (delayMs > this.maxNetworkRetryDelayMilliseconds || retries >= this.maxNetworkRetries) {
6095
6108
  throw new ZapierRateLimitError("Rate limited", {
6096
6109
  statusCode: 429,
6097
6110
  rateLimit: rateLimitInfo,
@@ -6348,8 +6361,8 @@ var ZapierApiClient = class {
6348
6361
  authRequired: options.authRequired,
6349
6362
  signal: options.signal
6350
6363
  }),
6351
- initialDelay: options.initialDelay,
6352
- timeoutMs: options.timeoutMs,
6364
+ initialDelay: options.initialDelayMilliseconds ?? options.initialDelay,
6365
+ timeoutMs: options.timeoutMilliseconds ?? options.timeoutMs,
6353
6366
  successStatus: options.successStatus,
6354
6367
  pendingStatus: options.pendingStatus,
6355
6368
  isPending: options.isPending,
@@ -6358,7 +6371,7 @@ var ZapierApiClient = class {
6358
6371
  });
6359
6372
  };
6360
6373
  this.maxNetworkRetries = options.maxNetworkRetries ?? ZAPIER_MAX_NETWORK_RETRIES;
6361
- this.maxNetworkRetryDelayMs = options.maxNetworkRetryDelayMs ?? ZAPIER_MAX_NETWORK_RETRY_DELAY_MS;
6374
+ this.maxNetworkRetryDelayMilliseconds = options.maxNetworkRetryDelayMilliseconds ?? options.maxNetworkRetryDelayMs ?? ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS;
6362
6375
  const requested = options.maxConcurrentRequests;
6363
6376
  const limit = requested === void 0 || Number.isNaN(requested) ? ZAPIER_MAX_CONCURRENT_REQUESTS : requested;
6364
6377
  if (limit !== Infinity && (!Number.isInteger(limit) || limit < 1 || limit > MAX_CONCURRENCY_LIMIT)) {
@@ -6933,7 +6946,7 @@ var ZapierApiClient = class {
6933
6946
  }
6934
6947
  await openApproval(approval.approval_url);
6935
6948
  }
6936
- const timeoutMs = this.options.approvalTimeoutMs ?? DEFAULT_APPROVAL_TIMEOUT_MS;
6949
+ const timeoutMs = this.options.approvalTimeoutMilliseconds ?? this.options.approvalTimeoutMs ?? DEFAULT_APPROVAL_TIMEOUT_MILLISECONDS;
6937
6950
  let streamAbortController;
6938
6951
  let streamPromise;
6939
6952
  let removeStreamAbortListener;
@@ -6973,7 +6986,7 @@ var ZapierApiClient = class {
6973
6986
  })
6974
6987
  ),
6975
6988
  timeoutMs,
6976
- maxPollingIntervalMs: APPROVAL_MAX_POLLING_INTERVAL_MS,
6989
+ maxPollingIntervalMs: APPROVAL_MAX_POLLING_INTERVAL_MILLISECONDS,
6977
6990
  signal,
6978
6991
  isPending: (body2) => {
6979
6992
  const parsed = PollApprovalResponseSchema.safeParse(body2);
@@ -7153,8 +7166,10 @@ var apiPlugin = defineProperty({
7153
7166
  onEvent,
7154
7167
  debug = false,
7155
7168
  maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES,
7156
- maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS,
7169
+ maxNetworkRetryDelaySeconds,
7170
+ maxNetworkRetryDelayMs,
7157
7171
  maxConcurrentRequests = ZAPIER_MAX_CONCURRENT_REQUESTS,
7172
+ approvalTimeoutSeconds,
7158
7173
  approvalTimeoutMs,
7159
7174
  maxApprovalRetries,
7160
7175
  approvalMode,
@@ -7169,9 +7184,9 @@ var apiPlugin = defineProperty({
7169
7184
  fetch: customFetch,
7170
7185
  onEvent,
7171
7186
  maxNetworkRetries,
7172
- maxNetworkRetryDelayMs,
7187
+ maxNetworkRetryDelayMilliseconds: (maxNetworkRetryDelaySeconds != null ? maxNetworkRetryDelaySeconds * 1e3 : maxNetworkRetryDelayMs) ?? ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS,
7173
7188
  maxConcurrentRequests,
7174
- approvalTimeoutMs,
7189
+ approvalTimeoutMilliseconds: approvalTimeoutSeconds != null ? approvalTimeoutSeconds * 1e3 : approvalTimeoutMs,
7175
7190
  maxApprovalRetries,
7176
7191
  approvalMode,
7177
7192
  openAutoModeApprovalsInBrowser,
@@ -7879,9 +7894,13 @@ var FetchInitZapierFieldsSchema = zod.z.object({
7879
7894
  deprecated: true
7880
7895
  }),
7881
7896
  callbackUrl: zod.z.string().optional().describe("URL to send async response to (makes request async)"),
7897
+ maxTimeSeconds: zod.z.number().int().positive().optional().describe(
7898
+ "Maximum seconds to wait for a response. Honored on a best-effort basis; the server may silently enforce a lower ceiling."
7899
+ ),
7900
+ /** @deprecated Use `maxTimeSeconds` instead. */
7882
7901
  maxTime: zod.z.number().int().positive().optional().describe(
7883
7902
  "Maximum seconds to wait for a response. Honored on a best-effort basis; the server may silently enforce a lower ceiling."
7884
- )
7903
+ ).meta({ deprecated: true })
7885
7904
  });
7886
7905
  var FetchInitSchema = zod.z.object({
7887
7906
  method: zod.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]).optional().describe("HTTP method for the request (defaults to GET)"),
@@ -7897,7 +7916,11 @@ var FetchInitSchema = zod.z.object({
7897
7916
  }).extend(FetchInitZapierFieldsSchema.shape).optional().describe(
7898
7917
  "Request options including method, headers, body, and authentication"
7899
7918
  ).meta({
7900
- aliases: { connectionId: "connection", authenticationId: "connection" }
7919
+ aliases: {
7920
+ connectionId: "connection",
7921
+ authenticationId: "connection",
7922
+ maxTime: "maxTimeSeconds"
7923
+ }
7901
7924
  });
7902
7925
  var FetchInputSchema = zod.z.object({
7903
7926
  url: FetchUrlSchema,
@@ -7948,7 +7971,7 @@ function rewrapIfMaxTimeTimeout({
7948
7971
  const reason = abortSignal.reason;
7949
7972
  if (!reason || reason.name !== "TimeoutError") return error;
7950
7973
  return new ZapierTimeoutError(
7951
- `fetch timed out after ${maxTimeSeconds}s (maxTime)`,
7974
+ `fetch timed out after ${maxTimeSeconds}s (maxTimeSeconds)`,
7952
7975
  { cause: error }
7953
7976
  );
7954
7977
  }
@@ -8013,9 +8036,11 @@ var fetchPlugin = defineMethod({
8013
8036
  connection,
8014
8037
  authenticationId,
8015
8038
  callbackUrl,
8039
+ maxTimeSeconds: maxTimeSecondsInput,
8016
8040
  maxTime,
8017
8041
  ...fetchInit
8018
8042
  } = init || {};
8043
+ const maxTimeSeconds = maxTimeSecondsInput ?? maxTime;
8019
8044
  const resolvedConnectionId = await resolveConnectionId({
8020
8045
  connectionId,
8021
8046
  connection,
@@ -8044,13 +8069,13 @@ var fetchPlugin = defineMethod({
8044
8069
  if (callbackUrl) {
8045
8070
  headers["X-Relay-Callback-Url"] = callbackUrl;
8046
8071
  }
8047
- if (maxTime !== void 0) {
8048
- headers["X-Zapier-Sdk-Max-Time"] = String(maxTime);
8072
+ if (maxTimeSeconds !== void 0) {
8073
+ headers["X-Zapier-Sdk-Max-Time"] = String(maxTimeSeconds);
8049
8074
  }
8050
8075
  const upstreamUrl = new URL(url).toString();
8051
8076
  const method = (fetchInit.method ?? "GET").toUpperCase();
8052
8077
  const abortHandle = buildAbortHandle({
8053
- maxTimeSeconds: maxTime,
8078
+ maxTimeSeconds,
8054
8079
  callerSignal: fetchInit.signal
8055
8080
  });
8056
8081
  try {
@@ -8080,7 +8105,7 @@ var fetchPlugin = defineMethod({
8080
8105
  throw rewrapIfMaxTimeTimeout({
8081
8106
  error,
8082
8107
  abortSignal: abortHandle?.signal,
8083
- maxTimeSeconds: maxTime
8108
+ maxTimeSeconds
8084
8109
  });
8085
8110
  } finally {
8086
8111
  abortHandle?.dispose();
@@ -8100,7 +8125,9 @@ var RunActionBaseSchema = zod.z.object({
8100
8125
  inputs: InputsPropertySchema.optional().describe(
8101
8126
  "Input parameters for the action"
8102
8127
  ),
8103
- timeoutMs: ActionTimeoutMsPropertySchema,
8128
+ timeoutSeconds: ActionTimeoutSecondsPropertySchema,
8129
+ /** @deprecated Use `timeoutSeconds` instead. */
8130
+ timeoutMs: ActionTimeoutMillisecondsPropertySchema.meta({ deprecated: true }),
8104
8131
  pageSize: zod.z.number().min(1).optional().describe("Number of results per page"),
8105
8132
  maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages"),
8106
8133
  cursor: zod.z.string().optional().describe("Cursor to start from")
@@ -9854,7 +9881,7 @@ async function executeAction(actionOptions) {
9854
9881
  executionOptions,
9855
9882
  cursor,
9856
9883
  connectionId,
9857
- timeoutMs
9884
+ timeoutMilliseconds
9858
9885
  } = actionOptions;
9859
9886
  const runRequestData = {
9860
9887
  selected_api: selectedApi,
@@ -9890,7 +9917,7 @@ async function executeAction(actionOptions) {
9890
9917
  return await api.poll(`/zapier/api/actions/v1/runs/${runId}`, {
9891
9918
  successStatus: 200,
9892
9919
  pendingStatus: 202,
9893
- timeoutMs: timeoutMs ?? DEFAULT_ACTION_TIMEOUT_MS,
9920
+ timeoutMilliseconds: timeoutMilliseconds ?? DEFAULT_ACTION_TIMEOUT_MILLISECONDS,
9894
9921
  resource: { type: "run", id: runId },
9895
9922
  isPending: (result) => {
9896
9923
  const data = result?.data;
@@ -9899,7 +9926,7 @@ async function executeAction(actionOptions) {
9899
9926
  resultExtractor: (result) => result.data
9900
9927
  });
9901
9928
  }
9902
- var CONTEXT_CACHE_TTL_MS = 6e4;
9929
+ var CONTEXT_CACHE_TTL_MILLISECONDS = 6e4;
9903
9930
  var CONTEXT_CACHE_MAX_SIZE = 500;
9904
9931
  var runActionPlugin = defineMethod({
9905
9932
  name: "runAction",
@@ -9980,7 +10007,7 @@ var runActionPlugin = defineMethod({
9980
10007
  evictIfNeeded();
9981
10008
  cache.set(contextKey, {
9982
10009
  promise: pending,
9983
- expiresAt: Date.now() + CONTEXT_CACHE_TTL_MS
10010
+ expiresAt: Date.now() + CONTEXT_CACHE_TTL_MILLISECONDS
9984
10011
  });
9985
10012
  return pending;
9986
10013
  }
@@ -9997,9 +10024,9 @@ var runActionPlugin = defineMethod({
9997
10024
  connection,
9998
10025
  authenticationId,
9999
10026
  inputs = {},
10000
- cursor,
10001
- timeoutMs
10027
+ cursor
10002
10028
  } = input;
10029
+ const timeoutMilliseconds = input.timeoutSeconds != null ? input.timeoutSeconds * 1e3 : input.timeoutMs;
10003
10030
  const resolvedConnectionId = await resolveConnectionId({
10004
10031
  connectionId,
10005
10032
  connection,
@@ -10027,7 +10054,7 @@ var runActionPlugin = defineMethod({
10027
10054
  executionOptions: { inputs },
10028
10055
  cursor,
10029
10056
  connectionId: resolvedConnectionId,
10030
- timeoutMs
10057
+ timeoutMilliseconds
10031
10058
  });
10032
10059
  if (result.errors && result.errors.length > 0) {
10033
10060
  const errorMessage2 = result.errors.map(
@@ -10084,6 +10111,7 @@ function createActionFunction(appKey, actionType, actionKey, imports, pinnedAuth
10084
10111
  connectionId: providedConnectionId,
10085
10112
  connection: providedConnection,
10086
10113
  authenticationId: providedAuthenticationId,
10114
+ timeoutSeconds,
10087
10115
  timeoutMs
10088
10116
  } = actionOptions;
10089
10117
  const { connectionId, connection } = resolveProxyConnection({
@@ -10100,6 +10128,7 @@ function createActionFunction(appKey, actionType, actionKey, imports, pinnedAuth
10100
10128
  action: actionKey,
10101
10129
  inputs,
10102
10130
  connection: connectionId ?? connection,
10131
+ timeoutSeconds,
10103
10132
  timeoutMs
10104
10133
  });
10105
10134
  };
@@ -11651,12 +11680,18 @@ var WaitForNewConnectionSchema = zod.z.object({
11651
11680
  startedAt: zod.z.number().int().nonnegative().describe(
11652
11681
  "Unix timestamp (seconds). Only connections whose `date` is at or after this value count as 'new'. Prefer the `startedAt` returned by `get-connection-start-url` \u2014 it's server-stamped, so the comparison isn't thrown off by client clock skew. If you mint the timestamp yourself, capture it *before* showing the start URL so a fast OAuth completion isn't missed."
11653
11682
  ),
11683
+ timeoutSeconds: zod.z.number().int().positive().optional().describe("How long to wait before giving up. Default 5 minutes (300)."),
11684
+ /** @deprecated Use `timeoutSeconds` instead. */
11654
11685
  timeoutMs: zod.z.number().int().positive().optional().describe(
11655
11686
  "How long to wait before giving up. Default 5 minutes (300_000)."
11687
+ ).meta({ deprecated: true }),
11688
+ pollIntervalMilliseconds: zod.z.number().int().positive().optional().describe(
11689
+ "Delay before the first poll request, in ms. Default 3 seconds (3_000). Subsequent polling cadence is managed by the SDK's polling primitive (backoff with sane defaults)."
11656
11690
  ),
11691
+ /** @deprecated Use `pollIntervalMilliseconds` instead. */
11657
11692
  pollIntervalMs: zod.z.number().int().positive().optional().describe(
11658
11693
  "Delay before the first poll request, in ms. Default 3 seconds (3_000). Subsequent polling cadence is managed by the SDK's polling primitive (backoff with sane defaults)."
11659
- )
11694
+ ).meta({ deprecated: true })
11660
11695
  }).describe(
11661
11696
  "Wait for a new connection to appear for the given app. Polls `/api/v0/connections` with server-side `ordering=-date` until the most recent matching row's `date` is at or after the started-at timestamp, then returns it. Pair with `get-connection-start-url` \u2014 that mints the URL the user opens, this waits for the resulting connection to land. Errors with a timeout after the configured timeout (default 5 min). Example (JS):\n\n```ts\nconst { data: { url, app, startedAt } } = await zapier.getConnectionStartUrl({ app: 'slack' });\n// show `url` to the user via the channel they're reading from\nconst { data: conn } = await zapier.waitForNewConnection({ app, startedAt });\n```"
11662
11697
  );
@@ -11703,8 +11738,8 @@ var waitForNewConnectionPlugin = defineMethod({
11703
11738
  page_size: "1"
11704
11739
  },
11705
11740
  authRequired: true,
11706
- timeoutMs: input.timeoutMs ?? 3e5,
11707
- initialDelay: input.pollIntervalMs ?? 3e3,
11741
+ timeoutMilliseconds: input.timeoutSeconds != null ? input.timeoutSeconds * 1e3 : input.timeoutMs ?? 3e5,
11742
+ initialDelayMilliseconds: input.pollIntervalMilliseconds ?? input.pollIntervalMs ?? 3e3,
11708
11743
  isPending: (body) => {
11709
11744
  const rows = body.data ?? [];
11710
11745
  const head = rows[0];
@@ -11754,12 +11789,20 @@ var CreateConnectionSchema = zod.z.object({
11754
11789
  browser: zod.z.enum(["auto", "always", "never"]).default("auto").describe(
11755
11790
  "When to auto-open the URL in a browser. `auto` (default) opens in local sessions and skips opening in CI / SSH / headless-Linux. `always` forces the open attempt. `never` skips it. The URL is always printed to stderr regardless \u2014 a failed or skipped open degrades gracefully to copy-paste."
11756
11791
  ),
11792
+ timeoutSeconds: zod.z.number().int().positive().optional().describe(
11793
+ "How long to wait for the user to complete the connection flow before giving up. Default 5 minutes (300)."
11794
+ ),
11795
+ /** @deprecated Use `timeoutSeconds` instead. */
11757
11796
  timeoutMs: zod.z.number().int().positive().optional().describe(
11758
11797
  "How long to wait for the user to complete the connection flow before giving up. Default 5 minutes (300_000)."
11798
+ ).meta({ deprecated: true }),
11799
+ pollIntervalMilliseconds: zod.z.number().int().positive().optional().describe(
11800
+ "Delay before the first poll request, in ms. Default 3 seconds (3_000). Subsequent polling cadence is managed by the SDK's polling primitive (backoff with sane defaults)."
11759
11801
  ),
11802
+ /** @deprecated Use `pollIntervalMilliseconds` instead. */
11760
11803
  pollIntervalMs: zod.z.number().int().positive().optional().describe(
11761
11804
  "Delay before the first poll request, in ms. Default 3 seconds (3_000). Subsequent polling cadence is managed by the SDK's polling primitive (backoff with sane defaults)."
11762
- )
11805
+ ).meta({ deprecated: true })
11763
11806
  }).describe(
11764
11807
  "Create a new app connection, end-to-end. Mints the start URL via `get-connection-start-url`, prints it to stderr, opportunistically opens it in a browser when it looks safe to do so (skipping CI / SSH / headless-Linux by default \u2014 pass `--browser always` to force, `--browser never` to suppress), then polls via `wait-for-new-connection` until the user completes OAuth and the new connection appears. Returns the connection.\n\nThis is the right command for most callers. Reach for the lower-level building blocks when you want either of: (a) hand off the URL and *not* block on completion \u2014 call `get-connection-start-url` alone, no `wait-for-new-connection` needed, or (b) do something custom between minting the URL and waiting \u2014 call `get-connection-start-url`, do your work (email or DM the URL, render a QR code, etc.), then `wait-for-new-connection`."
11765
11808
  );
@@ -11821,8 +11864,9 @@ Open this URL to complete the connection:
11821
11864
  // Server-stamped mint time: measured on the same clock as a connection's
11822
11865
  // `date`, so the freshness check is immune to client/server clock skew.
11823
11866
  startedAt: start2.startedAt,
11867
+ timeoutSeconds: input.timeoutSeconds,
11824
11868
  timeoutMs: input.timeoutMs,
11825
- pollIntervalMs: input.pollIntervalMs
11869
+ pollIntervalMilliseconds: input.pollIntervalMilliseconds ?? input.pollIntervalMs
11826
11870
  });
11827
11871
  return {
11828
11872
  data: CreateConnectionItemSchema.parse({
@@ -13181,9 +13225,9 @@ async function* readInboxEvents({
13181
13225
  }
13182
13226
 
13183
13227
  // src/plugins/triggers/watchTriggerInbox/index.ts
13184
- var SSE_RECONNECT_BACKOFF_MS = [500, 1e3, 2e3, 5e3];
13185
- var DEFAULT_SAFETY_DRAIN_INTERVAL_MS = 3e5;
13186
- var SSE_HEALTHY_CONNECTION_MS = 5e3;
13228
+ var SSE_RECONNECT_BACKOFF_MILLISECONDS = [500, 1e3, 2e3, 5e3];
13229
+ var DEFAULT_SAFETY_DRAIN_INTERVAL_MILLISECONDS = 3e5;
13230
+ var SSE_HEALTHY_CONNECTION_MILLISECONDS = 5e3;
13187
13231
  var ERROR_BACKOFF_CAP = 4;
13188
13232
  function createDrainLatch() {
13189
13233
  let pending = false;
@@ -13241,7 +13285,7 @@ async function drainRunner({
13241
13285
  consecutiveErrors = Math.min(consecutiveErrors + 1, ERROR_BACKOFF_CAP);
13242
13286
  errorAttempts += 1;
13243
13287
  const delay = calculateErrorBackoffMs(
13244
- BASE_ERROR_BACKOFF_MS,
13288
+ BASE_ERROR_BACKOFF_MILLISECONDS,
13245
13289
  consecutiveErrors
13246
13290
  );
13247
13291
  const statusCode = errorStatusCode(error);
@@ -13307,7 +13351,7 @@ async function sseLoop({
13307
13351
  })) {
13308
13352
  drainRequest.request();
13309
13353
  }
13310
- if (connected && Date.now() - connectedAt >= SSE_HEALTHY_CONNECTION_MS) {
13354
+ if (connected && Date.now() - connectedAt >= SSE_HEALTHY_CONNECTION_MILLISECONDS) {
13311
13355
  attempt = 0;
13312
13356
  }
13313
13357
  } catch (err) {
@@ -13331,8 +13375,11 @@ async function sseLoop({
13331
13375
  transientError = err;
13332
13376
  }
13333
13377
  if (signal.aborted) return;
13334
- const delay = SSE_RECONNECT_BACKOFF_MS[Math.min(attempt, SSE_RECONNECT_BACKOFF_MS.length - 1)];
13335
- attempt = Math.min(attempt + 1, SSE_RECONNECT_BACKOFF_MS.length - 1);
13378
+ const delay = SSE_RECONNECT_BACKOFF_MILLISECONDS[Math.min(attempt, SSE_RECONNECT_BACKOFF_MILLISECONDS.length - 1)];
13379
+ attempt = Math.min(
13380
+ attempt + 1,
13381
+ SSE_RECONNECT_BACKOFF_MILLISECONDS.length - 1
13382
+ );
13336
13383
  if (transientError !== void 0 && debug) {
13337
13384
  const statusCode = errorStatusCode(transientError);
13338
13385
  const errorMsg = errorMessage(transientError);
@@ -13389,7 +13436,7 @@ var watchTriggerInboxPlugin = defineMethod({
13389
13436
  const { concurrency, leaseLimit } = resolveConcurrencyAndLease(input);
13390
13437
  const inboxId = await resolveTriggerInboxId({ api, inbox: input.inbox });
13391
13438
  if (input.signal?.aborted) return;
13392
- const safetyDrainMs = input.maxDrainIntervalSeconds !== void 0 ? input.maxDrainIntervalSeconds * 1e3 : DEFAULT_SAFETY_DRAIN_INTERVAL_MS;
13439
+ const safetyDrainMs = input.maxDrainIntervalSeconds !== void 0 ? input.maxDrainIntervalSeconds * 1e3 : DEFAULT_SAFETY_DRAIN_INTERVAL_MILLISECONDS;
13393
13440
  const stop = new AbortController();
13394
13441
  const combined = combineAbortSignals({
13395
13442
  handles: [
@@ -14418,7 +14465,7 @@ var updateTableRecordsPlugin = defineMethod({
14418
14465
 
14419
14466
  // src/plugins/eventEmission/transport.ts
14420
14467
  var DEFAULT_RETRY_ATTEMPTS = 2;
14421
- var DEFAULT_RETRY_DELAY_MS = 300;
14468
+ var DEFAULT_RETRY_DELAY_MILLISECONDS = 300;
14422
14469
  function createHttpTransport(config) {
14423
14470
  const delay = async (ms) => {
14424
14471
  return new Promise((resolve2) => {
@@ -14443,12 +14490,12 @@ function createHttpTransport(config) {
14443
14490
  body: JSON.stringify(payload)
14444
14491
  });
14445
14492
  if (!response.ok && attemptsLeft > 1) {
14446
- await delay(config.retryDelayMs || DEFAULT_RETRY_DELAY_MS);
14493
+ await delay(config.retryDelayMs || DEFAULT_RETRY_DELAY_MILLISECONDS);
14447
14494
  return emitWithRetry(subject, event, attemptsLeft - 1);
14448
14495
  }
14449
14496
  } catch (error) {
14450
14497
  if (attemptsLeft > 1) {
14451
- await delay(config.retryDelayMs || DEFAULT_RETRY_DELAY_MS);
14498
+ await delay(config.retryDelayMs || DEFAULT_RETRY_DELAY_MILLISECONDS);
14452
14499
  return emitWithRetry(subject, event, attemptsLeft - 1);
14453
14500
  }
14454
14501
  throw error;
@@ -14741,7 +14788,7 @@ function makeMethodEndHook(emitMethodCalled) {
14741
14788
  }
14742
14789
 
14743
14790
  // src/plugins/eventEmission/index.ts
14744
- var TELEMETRY_EMIT_TIMEOUT_MS = 300;
14791
+ var TELEMETRY_EMIT_TIMEOUT_MILLISECONDS = 300;
14745
14792
  var registeredListeners = {};
14746
14793
  function removeExistingListeners() {
14747
14794
  const events = [
@@ -14787,7 +14834,7 @@ async function emitWithTimeout(transport, subject, event) {
14787
14834
  await Promise.race([
14788
14835
  transport.emit(subject, event),
14789
14836
  new Promise((resolve2) => {
14790
- const timer = setTimeout(resolve2, TELEMETRY_EMIT_TIMEOUT_MS);
14837
+ const timer = setTimeout(resolve2, TELEMETRY_EMIT_TIMEOUT_MILLISECONDS);
14791
14838
  if (typeof timer.unref === "function") {
14792
14839
  timer.unref();
14793
14840
  }
@@ -15226,14 +15273,14 @@ function createZapierSdk(options = {}) {
15226
15273
 
15227
15274
  // src/utils/batch-utils.ts
15228
15275
  var DEFAULT_CONCURRENCY = 10;
15229
- var BATCH_START_DELAY_MS = 25;
15230
- var DEFAULT_BATCH_TIMEOUT_MS = 18e4;
15276
+ var BATCH_START_DELAY_MILLISECONDS = 25;
15277
+ var DEFAULT_BATCH_TIMEOUT_MILLISECONDS = 18e4;
15231
15278
  async function batch(tasks, options = {}) {
15232
15279
  const {
15233
15280
  concurrency = DEFAULT_CONCURRENCY,
15234
15281
  retry = true,
15235
- batchDelay = BATCH_START_DELAY_MS,
15236
- timeoutMs = DEFAULT_BATCH_TIMEOUT_MS,
15282
+ batchDelay = BATCH_START_DELAY_MILLISECONDS,
15283
+ timeoutMs = DEFAULT_BATCH_TIMEOUT_MILLISECONDS,
15237
15284
  taskTimeoutMs
15238
15285
  } = options;
15239
15286
  if (concurrency <= 0) {
@@ -15326,11 +15373,15 @@ var BaseSdkOptionsSchema = zod.z.object({
15326
15373
  */
15327
15374
  maxNetworkRetries: zod.z.number().optional().describe("Max retries for rate-limited requests (default: 3).").meta({ valueHint: "count" }),
15328
15375
  /**
15329
- * Maximum delay in milliseconds to wait for a rate limit retry.
15376
+ * Maximum delay in seconds to wait for a rate-limit retry.
15330
15377
  * If the server requests a longer delay, the request fails immediately.
15331
- * Default is 60000 (60 seconds).
15378
+ * Default is 60 (60 seconds).
15332
15379
  */
15333
- maxNetworkRetryDelayMs: zod.z.number().optional().describe("Max delay in ms to wait for retry (default: 60000).").meta({ valueHint: "ms" }),
15380
+ maxNetworkRetryDelaySeconds: zod.z.number().optional().describe(
15381
+ "Max delay in seconds to wait for a rate-limit retry (default: 60)."
15382
+ ).meta({ valueHint: "seconds" }),
15383
+ /** @deprecated Use `maxNetworkRetryDelaySeconds` instead. */
15384
+ maxNetworkRetryDelayMs: zod.z.number().optional().describe("Max delay in ms to wait for retry (default: 60000).").meta({ valueHint: "ms", deprecated: true }),
15334
15385
  /**
15335
15386
  * Maximum number of concurrent in-flight HTTP requests per client.
15336
15387
  * Requests beyond this limit queue in FIFO order until a slot frees.
@@ -15349,7 +15400,9 @@ var BaseSdkOptionsSchema = zod.z.object({
15349
15400
  ]).optional().describe(
15350
15401
  `Max concurrent in-flight HTTP requests (default: 200, max: ${MAX_CONCURRENCY_LIMIT}).`
15351
15402
  ).meta({ valueHint: "count" }),
15352
- approvalTimeoutMs: zod.z.number().optional().describe("Timeout in ms for approval polling. Default: 600000 (10 min).").meta({ valueHint: "ms" }),
15403
+ approvalTimeoutSeconds: zod.z.number().optional().describe("Timeout in seconds for approval polling. Default: 600 (10 min).").meta({ valueHint: "seconds" }),
15404
+ /** @deprecated Use `approvalTimeoutSeconds` instead. */
15405
+ approvalTimeoutMs: zod.z.number().optional().describe("Timeout in ms for approval polling. Default: 600000 (10 min).").meta({ valueHint: "ms", deprecated: true }),
15353
15406
  maxApprovalRetries: zod.z.number().optional().describe(
15354
15407
  "Maximum number of sequential approval rounds per request (one per gating policy) before giving up. Default: 2."
15355
15408
  ),
@@ -15386,7 +15439,8 @@ var registryPlugin = (_sdk) => {
15386
15439
  exports.API_ID = API_ID;
15387
15440
  exports.ActionKeyPropertySchema = ActionKeyPropertySchema;
15388
15441
  exports.ActionPropertySchema = ActionPropertySchema;
15389
- exports.ActionTimeoutMsPropertySchema = ActionTimeoutMsPropertySchema;
15442
+ exports.ActionTimeoutMillisecondsPropertySchema = ActionTimeoutMillisecondsPropertySchema;
15443
+ exports.ActionTimeoutSecondsPropertySchema = ActionTimeoutSecondsPropertySchema;
15390
15444
  exports.ActionTypePropertySchema = ActionTypePropertySchema;
15391
15445
  exports.AppKeyPropertySchema = AppKeyPropertySchema;
15392
15446
  exports.AppPropertySchema = AppPropertySchema;
@@ -15397,7 +15451,7 @@ exports.BaseSdkOptionsSchema = BaseSdkOptionsSchema;
15397
15451
  exports.CONNECTIONS_ID = CONNECTIONS_ID;
15398
15452
  exports.CONTEXT = CONTEXT;
15399
15453
  exports.CONTEXT_CACHE_MAX_SIZE = CONTEXT_CACHE_MAX_SIZE;
15400
- exports.CONTEXT_CACHE_TTL_MS = CONTEXT_CACHE_TTL_MS;
15454
+ exports.CONTEXT_CACHE_TTL_MILLISECONDS = CONTEXT_CACHE_TTL_MILLISECONDS;
15401
15455
  exports.CORE_ERROR_SYMBOL = CORE_ERROR_SYMBOL;
15402
15456
  exports.CORE_OPTIONS_ID = CORE_OPTIONS_ID;
15403
15457
  exports.CORE_SIGNAL_SYMBOL = CORE_SIGNAL_SYMBOL;
@@ -15414,8 +15468,8 @@ exports.CoreSignal = CoreSignal;
15414
15468
  exports.CredentialsFunctionSchema = CredentialsFunctionSchema;
15415
15469
  exports.CredentialsObjectSchema = CredentialsObjectSchema;
15416
15470
  exports.CredentialsSchema = CredentialsSchema;
15417
- exports.DEFAULT_ACTION_TIMEOUT_MS = DEFAULT_ACTION_TIMEOUT_MS;
15418
- exports.DEFAULT_APPROVAL_TIMEOUT_MS = DEFAULT_APPROVAL_TIMEOUT_MS;
15471
+ exports.DEFAULT_ACTION_TIMEOUT_MILLISECONDS = DEFAULT_ACTION_TIMEOUT_MILLISECONDS;
15472
+ exports.DEFAULT_APPROVAL_TIMEOUT_MILLISECONDS = DEFAULT_APPROVAL_TIMEOUT_MILLISECONDS;
15419
15473
  exports.DEFAULT_CONFIG_PATH = DEFAULT_CONFIG_PATH;
15420
15474
  exports.DEFAULT_MAX_APPROVAL_RETRIES = DEFAULT_MAX_APPROVAL_RETRIES;
15421
15475
  exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
@@ -15453,7 +15507,7 @@ exports.WatchTriggerInboxSchema = WatchTriggerInboxSchema;
15453
15507
  exports.ZAPIER_BASE_URL = ZAPIER_BASE_URL;
15454
15508
  exports.ZAPIER_MAX_CONCURRENT_REQUESTS = ZAPIER_MAX_CONCURRENT_REQUESTS;
15455
15509
  exports.ZAPIER_MAX_NETWORK_RETRIES = ZAPIER_MAX_NETWORK_RETRIES;
15456
- exports.ZAPIER_MAX_NETWORK_RETRY_DELAY_MS = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS;
15510
+ exports.ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS = ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS;
15457
15511
  exports.ZapierAbortDrainSignal = ZapierAbortDrainSignal;
15458
15512
  exports.ZapierActionError = ZapierActionError;
15459
15513
  exports.ZapierApiError = ZapierApiError;