@zapier/zapier-sdk 0.41.0 → 0.41.2

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.41.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 3cf1a98: Fix connection resolution for no-auth apps
8
+
9
+ ## 0.41.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 53c165a: `formatErrorMessage` now renders `ZapierRateLimitError` details (limit used, time until retry, retry count) instead of just the bare "Rate limited" message. CLI, MCP, and any consumer using `formatErrorMessage` now surface which rate-limit window tripped and how long until it resets.
14
+
3
15
  ## 0.41.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -1208,18 +1208,18 @@ List records in a table with optional filtering and sorting
1208
1208
 
1209
1209
  **Parameters:**
1210
1210
 
1211
- | Name | Type | Required | Default | Possible Values | Description |
1212
- | ------------- | -------- | -------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
1213
- | `options` | `object` | ✅ | — | — | |
1214
- | ↳ `table` | `string` | ✅ | — | — | The unique identifier of the table |
1215
- | ↳ `filters` | `array` | ❌ | — | — | Filter conditions for the query |
1216
- | ↳ `sort` | `object` | ❌ | — | — | Sort records by a field |
1217
- | ↳ `fieldKey` | `string` | ✅ | — | — | The field key to sort by |
1218
- | ↳ `direction` | `string` | ❌ | `"asc"` | — | Sort direction |
1219
- | ↳ `pageSize` | `number` | ❌ | — | — | Number of records per page (max 1000) |
1220
- | ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
1221
- | ↳ `cursor` | `string` | ❌ | — | — | Cursor to start from |
1222
- | ↳ `keyMode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
1211
+ | Name | Type | Required | Default | Possible Values | Description |
1212
+ | ---------------- | -------- | -------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
1213
+ | `options` | `object` | ✅ | — | — | |
1214
+ | ↳ `table` | `string` | ✅ | — | — | The unique identifier of the table |
1215
+ | ↳ `filters` | `array` | ❌ | — | — | Filter conditions for the query |
1216
+ | ↳ `sort` | `object` | ❌ | — | — | Sort records by a field |
1217
+ |    ↳ `fieldKey` | `string` | ✅ | — | — | The field key to sort by |
1218
+ |    ↳ `direction` | `string` | ❌ | `"asc"` | — | Sort direction |
1219
+ | ↳ `pageSize` | `number` | ❌ | — | — | Number of records per page (max 1000) |
1220
+ | ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
1221
+ | ↳ `cursor` | `string` | ❌ | — | — | Cursor to start from |
1222
+ | ↳ `keyMode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
1223
1223
 
1224
1224
  **Returns:** `Promise<PaginatedResult<RecordItem>>`
1225
1225
 
package/dist/index.cjs CHANGED
@@ -270,12 +270,42 @@ ${context.join(", ")}`;
270
270
  if (error instanceof ZapierBundleError && error.buildErrors && error.buildErrors.length > 0) {
271
271
  message += "\n\nBuild errors:\n" + error.buildErrors.map((err) => ` \u2022 ${err}`).join("\n");
272
272
  }
273
+ if (error instanceof ZapierRateLimitError) {
274
+ const { limit, remaining, retryAfterMs } = error.rateLimit;
275
+ const parts = [];
276
+ if (limit !== void 0) {
277
+ const used = remaining !== void 0 ? limit - remaining : limit;
278
+ parts.push(`${used}/${limit} used`);
279
+ }
280
+ if (retryAfterMs !== void 0 && retryAfterMs > 0) {
281
+ parts.push(`retry in ${formatDuration(retryAfterMs)}`);
282
+ }
283
+ if (error.retries > 0) {
284
+ parts.push(
285
+ `after ${error.retries} retr${error.retries === 1 ? "y" : "ies"}`
286
+ );
287
+ }
288
+ if (parts.length > 0) {
289
+ message += `
290
+ ${parts.join(", ")}`;
291
+ }
292
+ }
273
293
  if (error.statusCode && !message.includes(`${error.statusCode}`)) {
274
294
  message += `
275
295
  HTTP Status: ${error.statusCode}`;
276
296
  }
277
297
  return message;
278
298
  }
299
+ function formatDuration(ms) {
300
+ const seconds = Math.round(ms / 1e3);
301
+ if (seconds < 60) return `${seconds}s`;
302
+ const minutes = Math.round(seconds / 60);
303
+ if (minutes < 60) return `${minutes}m`;
304
+ const hours = Math.round(minutes / 60);
305
+ if (hours < 24) return `${hours}h`;
306
+ const days = Math.round(hours / 24);
307
+ return `${days}d`;
308
+ }
279
309
  var ActionExecutionInputSchema = zod.z.object({
280
310
  inputs: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
281
311
  /** @deprecated Use `connection` instead. */
@@ -1940,7 +1970,7 @@ var connectionIdResolver = {
1940
1970
  try {
1941
1971
  const app = await sdk.getApp({ app: params.app });
1942
1972
  if (!app.data.auth_type) {
1943
- return { resolvedValue: null };
1973
+ return { resolvedValue: void 0 };
1944
1974
  }
1945
1975
  } catch {
1946
1976
  }
package/dist/index.mjs CHANGED
@@ -268,12 +268,42 @@ ${context.join(", ")}`;
268
268
  if (error instanceof ZapierBundleError && error.buildErrors && error.buildErrors.length > 0) {
269
269
  message += "\n\nBuild errors:\n" + error.buildErrors.map((err) => ` \u2022 ${err}`).join("\n");
270
270
  }
271
+ if (error instanceof ZapierRateLimitError) {
272
+ const { limit, remaining, retryAfterMs } = error.rateLimit;
273
+ const parts = [];
274
+ if (limit !== void 0) {
275
+ const used = remaining !== void 0 ? limit - remaining : limit;
276
+ parts.push(`${used}/${limit} used`);
277
+ }
278
+ if (retryAfterMs !== void 0 && retryAfterMs > 0) {
279
+ parts.push(`retry in ${formatDuration(retryAfterMs)}`);
280
+ }
281
+ if (error.retries > 0) {
282
+ parts.push(
283
+ `after ${error.retries} retr${error.retries === 1 ? "y" : "ies"}`
284
+ );
285
+ }
286
+ if (parts.length > 0) {
287
+ message += `
288
+ ${parts.join(", ")}`;
289
+ }
290
+ }
271
291
  if (error.statusCode && !message.includes(`${error.statusCode}`)) {
272
292
  message += `
273
293
  HTTP Status: ${error.statusCode}`;
274
294
  }
275
295
  return message;
276
296
  }
297
+ function formatDuration(ms) {
298
+ const seconds = Math.round(ms / 1e3);
299
+ if (seconds < 60) return `${seconds}s`;
300
+ const minutes = Math.round(seconds / 60);
301
+ if (minutes < 60) return `${minutes}m`;
302
+ const hours = Math.round(minutes / 60);
303
+ if (hours < 24) return `${hours}h`;
304
+ const days = Math.round(hours / 24);
305
+ return `${days}d`;
306
+ }
277
307
  var ActionExecutionInputSchema = z.object({
278
308
  inputs: z.record(z.string(), z.unknown()).optional(),
279
309
  /** @deprecated Use `connection` instead. */
@@ -1938,7 +1968,7 @@ var connectionIdResolver = {
1938
1968
  try {
1939
1969
  const app = await sdk.getApp({ app: params.app });
1940
1970
  if (!app.data.auth_type) {
1941
- return { resolvedValue: null };
1971
+ return { resolvedValue: void 0 };
1942
1972
  }
1943
1973
  } catch {
1944
1974
  }
@@ -30,7 +30,7 @@ export const connectionIdResolver = {
30
30
  try {
31
31
  const app = await sdk.getApp({ app: params.app });
32
32
  if (!app.data.auth_type) {
33
- return { resolvedValue: null };
33
+ return { resolvedValue: undefined };
34
34
  }
35
35
  }
36
36
  catch {
@@ -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,E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AAE,WAAW,GAAG,MAAM,CAkF7D"}
@@ -213,9 +213,39 @@ export function formatErrorMessage(error) {
213
213
  "\n\nBuild errors:\n" +
214
214
  error.buildErrors.map((err) => ` • ${err}`).join("\n");
215
215
  }
216
+ if (error instanceof ZapierRateLimitError) {
217
+ const { limit, remaining, retryAfterMs } = error.rateLimit;
218
+ const parts = [];
219
+ if (limit !== undefined) {
220
+ const used = remaining !== undefined ? limit - remaining : limit;
221
+ parts.push(`${used}/${limit} used`);
222
+ }
223
+ if (retryAfterMs !== undefined && retryAfterMs > 0) {
224
+ parts.push(`retry in ${formatDuration(retryAfterMs)}`);
225
+ }
226
+ if (error.retries > 0) {
227
+ parts.push(`after ${error.retries} retr${error.retries === 1 ? "y" : "ies"}`);
228
+ }
229
+ if (parts.length > 0) {
230
+ message += `\n${parts.join(", ")}`;
231
+ }
232
+ }
216
233
  // Add status code if available and not already obvious from the message
217
234
  if (error.statusCode && !message.includes(`${error.statusCode}`)) {
218
235
  message += `\nHTTP Status: ${error.statusCode}`;
219
236
  }
220
237
  return message;
221
238
  }
239
+ function formatDuration(ms) {
240
+ const seconds = Math.round(ms / 1000);
241
+ if (seconds < 60)
242
+ return `${seconds}s`;
243
+ const minutes = Math.round(seconds / 60);
244
+ if (minutes < 60)
245
+ return `${minutes}m`;
246
+ const hours = Math.round(minutes / 60);
247
+ if (hours < 24)
248
+ return `${hours}h`;
249
+ const days = Math.round(hours / 24);
250
+ return `${days}d`;
251
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.41.0",
3
+ "version": "0.41.2",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",