@zapier/zapier-sdk 0.49.0 → 0.51.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +15 -12
  3. package/dist/api/auth.d.ts +1 -6
  4. package/dist/api/auth.d.ts.map +1 -1
  5. package/dist/api/auth.js +34 -27
  6. package/dist/api/client.d.ts.map +1 -1
  7. package/dist/api/client.js +20 -17
  8. package/dist/api/index.d.ts +1 -1
  9. package/dist/api/index.d.ts.map +1 -1
  10. package/dist/api/index.js +1 -1
  11. package/dist/api/schemas.d.ts +3 -3
  12. package/dist/api/types.d.ts +8 -7
  13. package/dist/api/types.d.ts.map +1 -1
  14. package/dist/auth.d.ts +13 -2
  15. package/dist/auth.d.ts.map +1 -1
  16. package/dist/auth.js +95 -11
  17. package/dist/constants.d.ts +8 -9
  18. package/dist/constants.d.ts.map +1 -1
  19. package/dist/constants.js +8 -11
  20. package/dist/experimental.cjs +184 -52
  21. package/dist/experimental.d.mts +2 -2
  22. package/dist/experimental.d.ts +26 -26
  23. package/dist/experimental.mjs +183 -52
  24. package/dist/{index-C2vsvjgN.d.mts → index-C52BjTXh.d.mts} +124 -18
  25. package/dist/{index-C2vsvjgN.d.ts → index-C52BjTXh.d.ts} +124 -18
  26. package/dist/index.cjs +184 -52
  27. package/dist/index.d.mts +1 -1
  28. package/dist/index.d.ts +2 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +1 -0
  31. package/dist/index.mjs +183 -52
  32. package/dist/plugins/api/index.d.ts.map +1 -1
  33. package/dist/plugins/api/index.js +1 -2
  34. package/dist/plugins/apps/index.d.ts +2 -2
  35. package/dist/plugins/deprecated/inputFields.d.ts +18 -18
  36. package/dist/plugins/getAction/index.d.ts +6 -6
  37. package/dist/plugins/getAction/schemas.d.ts +4 -4
  38. package/dist/plugins/getActionInputFieldsSchema/index.d.ts +5 -5
  39. package/dist/plugins/getActionInputFieldsSchema/schemas.d.ts +4 -4
  40. package/dist/plugins/listActionInputFieldChoices/index.d.ts +5 -5
  41. package/dist/plugins/listActionInputFieldChoices/schemas.d.ts +4 -4
  42. package/dist/plugins/listActionInputFields/index.d.ts +5 -5
  43. package/dist/plugins/listActionInputFields/schemas.d.ts +4 -4
  44. package/dist/plugins/listActions/index.d.ts +3 -3
  45. package/dist/plugins/listActions/schemas.d.ts +4 -4
  46. package/dist/plugins/runAction/index.d.ts +5 -5
  47. package/dist/plugins/runAction/schemas.d.ts +4 -4
  48. package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.d.ts +2 -2
  49. package/dist/plugins/triggers/listTriggerInputFieldChoices/index.d.ts +2 -2
  50. package/dist/plugins/triggers/listTriggerInputFields/index.d.ts +2 -2
  51. package/dist/schemas/Action.d.ts +1 -1
  52. package/dist/sdk.d.ts +52 -52
  53. package/dist/types/errors.d.ts +5 -5
  54. package/dist/types/properties.d.ts +1 -1
  55. package/dist/types/sdk.d.ts +2 -2
  56. package/dist/types/sdk.d.ts.map +1 -1
  57. package/dist/types/sdk.js +4 -11
  58. package/dist/utils/telemetry.d.ts +11 -0
  59. package/dist/utils/telemetry.d.ts.map +1 -0
  60. package/dist/utils/telemetry.js +19 -0
  61. package/package.json +1 -1
@@ -30,20 +30,19 @@ export declare const DEFAULT_ACTION_TIMEOUT_MS = 180000;
30
30
  */
31
31
  export declare const ZAPIER_MAX_NETWORK_RETRIES: number;
32
32
  export declare const ZAPIER_MAX_NETWORK_RETRY_DELAY_MS: number;
33
- /**
34
- * Whether this session is interactive (user can visit approval URLs).
35
- *
36
- * Read lazily so tests can set the env var after module import.
37
- */
38
- export declare function getZapierIsInteractive(): boolean;
39
33
  /**
40
34
  * Approval flow behavior from environment variable.
41
- * - "poll": (default) Opens the approval URL in a browser and polls until resolved.
42
- * - "fail": Creates the approval and throws immediately with the approval URL.
35
+ * - "disabled": (default when env var is unset) Throw a ZapierApprovalError on
36
+ * approval-required responses without creating an approval. Callers must
37
+ * explicitly opt in to approvals via "poll" or "throw".
38
+ * - "poll": Create the approval, open the URL in a browser, poll until
39
+ * resolved, and retry the original request on success.
40
+ * - "throw": Create the approval and throw a ZapierApprovalError immediately
41
+ * with the approval URL so the caller can surface it.
43
42
  *
44
43
  * Read lazily so tests can set the env var after module import.
45
44
  */
46
- export declare function getZapierApprovalMode(): "poll" | "fail" | undefined;
45
+ export declare function getZapierApprovalMode(): "disabled" | "poll" | "throw" | undefined;
47
46
  /**
48
47
  * Default timeout for approval polling (10 minutes)
49
48
  */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,QACsC,CAAC;AAEnE;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAExD;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,yBAAyB,SAAU,CAAC;AAejD;;GAEG;AACH,eAAO,MAAM,0BAA0B,QACY,CAAC;AACpD,eAAO,MAAM,iCAAiC,QACiB,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,MAAM,GAAG,SAAS,CAInE;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B,QAAiB,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,QACsC,CAAC;AAEnE;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAExD;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,yBAAyB,SAAU,CAAC;AAejD;;GAEG;AACH,eAAO,MAAM,0BAA0B,QACY,CAAC;AACpD,eAAO,MAAM,iCAAiC,QACiB,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,IACjC,UAAU,GACV,MAAM,GACN,OAAO,GACP,SAAS,CAKZ;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B,QAAiB,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAC"}
package/dist/constants.js CHANGED
@@ -43,24 +43,21 @@ function parseIntEnvVar(name) {
43
43
  */
44
44
  export const ZAPIER_MAX_NETWORK_RETRIES = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRIES") ?? 3;
45
45
  export const ZAPIER_MAX_NETWORK_RETRY_DELAY_MS = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRY_DELAY_MS") ?? 60000;
46
- /**
47
- * Whether this session is interactive (user can visit approval URLs).
48
- *
49
- * Read lazily so tests can set the env var after module import.
50
- */
51
- export function getZapierIsInteractive() {
52
- return globalThis.process?.env?.ZAPIER_IS_INTERACTIVE === "true";
53
- }
54
46
  /**
55
47
  * Approval flow behavior from environment variable.
56
- * - "poll": (default) Opens the approval URL in a browser and polls until resolved.
57
- * - "fail": Creates the approval and throws immediately with the approval URL.
48
+ * - "disabled": (default when env var is unset) Throw a ZapierApprovalError on
49
+ * approval-required responses without creating an approval. Callers must
50
+ * explicitly opt in to approvals via "poll" or "throw".
51
+ * - "poll": Create the approval, open the URL in a browser, poll until
52
+ * resolved, and retry the original request on success.
53
+ * - "throw": Create the approval and throw a ZapierApprovalError immediately
54
+ * with the approval URL so the caller can surface it.
58
55
  *
59
56
  * Read lazily so tests can set the env var after module import.
60
57
  */
61
58
  export function getZapierApprovalMode() {
62
59
  const value = globalThis.process?.env?.ZAPIER_APPROVAL_MODE;
63
- if (value === "poll" || value === "fail")
60
+ if (value === "disabled" || value === "poll" || value === "throw")
64
61
  return value;
65
62
  return undefined;
66
63
  }
@@ -150,12 +150,10 @@ function parseIntEnvVar(name) {
150
150
  }
151
151
  var ZAPIER_MAX_NETWORK_RETRIES = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRIES") ?? 3;
152
152
  var ZAPIER_MAX_NETWORK_RETRY_DELAY_MS = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRY_DELAY_MS") ?? 6e4;
153
- function getZapierIsInteractive() {
154
- return globalThis.process?.env?.ZAPIER_IS_INTERACTIVE === "true";
155
- }
156
153
  function getZapierApprovalMode() {
157
154
  const value = globalThis.process?.env?.ZAPIER_APPROVAL_MODE;
158
- if (value === "poll" || value === "fail") return value;
155
+ if (value === "disabled" || value === "poll" || value === "throw")
156
+ return value;
159
157
  return void 0;
160
158
  }
161
159
  var DEFAULT_APPROVAL_TIMEOUT_MS = 10 * 60 * 1e3;
@@ -1838,33 +1836,40 @@ function getAuthorizationHeader(token) {
1838
1836
  }
1839
1837
  return `Bearer ${token}`;
1840
1838
  }
1841
- function extractUserIdsFromJwt(token) {
1839
+ function readJwtPayload(token) {
1842
1840
  const parts = parseJwt(token);
1843
- if (!parts) {
1844
- return { customuser_id: null, account_id: null };
1845
- }
1841
+ if (!parts) return null;
1842
+ let payload;
1846
1843
  try {
1847
- const payload = JSON.parse(
1848
- Buffer.from(parts[1], "base64url").toString("utf-8")
1849
- );
1850
- let actualPayload = payload;
1851
- if (payload.sub_type === "service" && payload.njwt) {
1852
- const nestedParts = payload.njwt.split(".");
1853
- if (nestedParts.length === 3) {
1854
- actualPayload = JSON.parse(
1844
+ payload = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf-8"));
1845
+ } catch {
1846
+ return null;
1847
+ }
1848
+ if (payload["sub_type"] === "service" && typeof payload["njwt"] === "string") {
1849
+ const nestedParts = parseJwt(payload["njwt"]);
1850
+ if (nestedParts) {
1851
+ try {
1852
+ return JSON.parse(
1855
1853
  Buffer.from(nestedParts[1], "base64url").toString("utf-8")
1856
1854
  );
1855
+ } catch {
1857
1856
  }
1858
1857
  }
1859
- const accountId = actualPayload["zap:acc"] != null ? parseInt(String(actualPayload["zap:acc"]), 10) : null;
1860
- const customUserId = actualPayload.sub_type === "customuser" && actualPayload.sub != null ? parseInt(String(actualPayload.sub), 10) : null;
1861
- return {
1862
- customuser_id: customUserId !== null && !isNaN(customUserId) ? customUserId : null,
1863
- account_id: accountId !== null && !isNaN(accountId) ? accountId : null
1864
- };
1865
- } catch {
1858
+ }
1859
+ return payload;
1860
+ }
1861
+ function extractUserIdsFromJwt(token) {
1862
+ const payload = readJwtPayload(token);
1863
+ if (!payload) {
1866
1864
  return { customuser_id: null, account_id: null };
1867
1865
  }
1866
+ const accRaw = payload["zap:acc"];
1867
+ const accountId = accRaw != null ? parseInt(String(accRaw), 10) : null;
1868
+ const customUserId = payload["sub_type"] === "customuser" && payload["sub"] != null ? parseInt(String(payload["sub"]), 10) : null;
1869
+ return {
1870
+ customuser_id: customUserId !== null && !isNaN(customUserId) ? customUserId : null,
1871
+ account_id: accountId !== null && !isNaN(accountId) ? accountId : null
1872
+ };
1868
1873
  }
1869
1874
 
1870
1875
  // src/api/debug.ts
@@ -2213,6 +2218,19 @@ function isCredentialsFunction(credentials) {
2213
2218
  return typeof credentials === "function";
2214
2219
  }
2215
2220
 
2221
+ // src/utils/telemetry.ts
2222
+ var emittedOnce = /* @__PURE__ */ new WeakMap();
2223
+ function emitOnce(onEvent, event) {
2224
+ if (!emittedOnce.has(onEvent)) {
2225
+ emittedOnce.set(onEvent, /* @__PURE__ */ new Set());
2226
+ }
2227
+ const fired = emittedOnce.get(onEvent);
2228
+ if (!fired.has(event.type)) {
2229
+ fired.add(event.type);
2230
+ onEvent(event);
2231
+ }
2232
+ }
2233
+
2216
2234
  // src/utils/url-utils.ts
2217
2235
  function getZapierBaseUrl(baseUrl) {
2218
2236
  if (!baseUrl) {
@@ -2435,8 +2453,10 @@ async function resolveCache(options) {
2435
2453
  if (cliLogin?.createCache) {
2436
2454
  try {
2437
2455
  const cache = cliLogin.createCache();
2438
- cachedDefaultCache = cache;
2439
- return cache;
2456
+ if (cache) {
2457
+ cachedDefaultCache = cache;
2458
+ return cache;
2459
+ }
2440
2460
  } catch {
2441
2461
  }
2442
2462
  }
@@ -2448,6 +2468,11 @@ function entryIsValid(entry) {
2448
2468
  if (entry.expiresAt === void 0) return true;
2449
2469
  return entry.expiresAt > Date.now() + TOKEN_EXPIRATION_BUFFER_MS;
2450
2470
  }
2471
+ async function readCachedToken(cacheKey, cache) {
2472
+ const cached = await cache.get(cacheKey);
2473
+ if (cached && entryIsValid(cached)) return cached.value;
2474
+ return void 0;
2475
+ }
2451
2476
  async function invalidateCachedToken(options) {
2452
2477
  const cacheKey = buildCacheKey(options);
2453
2478
  pendingExchanges.delete(cacheKey);
@@ -2561,11 +2586,76 @@ function isCliLoginAvailable() {
2561
2586
  if (cachedCliLogin === void 0) return void 0;
2562
2587
  return cachedCliLogin !== false;
2563
2588
  }
2589
+ function emitAuthResolved(onEvent, mechanism) {
2590
+ if (onEvent) {
2591
+ emitOnce(onEvent, {
2592
+ type: "auth_resolved",
2593
+ payload: { mechanism },
2594
+ timestamp: Date.now()
2595
+ });
2596
+ }
2597
+ }
2598
+ async function getActiveCredentialsFromCli(baseUrl) {
2599
+ const cliLogin = await getCliLogin();
2600
+ return cliLogin?.getActiveCredentials?.({ baseUrl });
2601
+ }
2602
+ async function getStoredClientCredentialsFromCli(baseUrl) {
2603
+ const cliLogin = await getCliLogin();
2604
+ return cliLogin?.getStoredClientCredentials?.({ baseUrl });
2605
+ }
2564
2606
  async function getTokenFromCliLogin(options) {
2565
2607
  const cliLogin = await getCliLogin();
2566
2608
  if (!cliLogin) return void 0;
2567
2609
  return await cliLogin.getToken(options);
2568
2610
  }
2611
+ async function tryStoredClientCredentialToken(options) {
2612
+ const activeCredential = await getActiveCredentialsFromCli(options.baseUrl);
2613
+ if (!activeCredential) return void 0;
2614
+ const resolvedBaseUrl = activeCredential.baseUrl || options.baseUrl || DEFAULT_AUTH_BASE_URL;
2615
+ const mergedScopes = mergeScopes(
2616
+ activeCredential.scopes.join(" "),
2617
+ options.requiredScopes
2618
+ );
2619
+ const cacheKey = buildCacheKey({
2620
+ clientId: activeCredential.clientId,
2621
+ scopes: mergedScopes,
2622
+ baseUrl: resolvedBaseUrl
2623
+ });
2624
+ const cache = await resolveCache(options);
2625
+ const pending = pendingExchanges.get(cacheKey);
2626
+ if (pending) return pending;
2627
+ const cached = await readCachedToken(cacheKey, cache);
2628
+ if (cached !== void 0) {
2629
+ if (options.debug)
2630
+ console.log(
2631
+ `[auth] Using cached token (clientId: ${activeCredential.clientId})`
2632
+ );
2633
+ emitAuthResolved(options.onEvent, "client_credentials");
2634
+ return cached;
2635
+ }
2636
+ const storedCredential = await getStoredClientCredentialsFromCli(resolvedBaseUrl);
2637
+ if (!storedCredential) {
2638
+ await invalidateCachedToken({
2639
+ clientId: activeCredential.clientId,
2640
+ scopes: activeCredential.scopes,
2641
+ baseUrl: resolvedBaseUrl,
2642
+ cache: options.cache
2643
+ });
2644
+ throw new ZapierAuthenticationError(
2645
+ `Stored client credential is missing its secret (clientId: ${activeCredential.clientId}). Run \`zapier-sdk login\` to recreate it.`
2646
+ );
2647
+ }
2648
+ if (options.debug)
2649
+ console.log(
2650
+ `[auth] Using stored client credential (clientId: ${storedCredential.clientId})`
2651
+ );
2652
+ const token = await resolveAuthTokenFromCredentials(
2653
+ storedCredential,
2654
+ options
2655
+ );
2656
+ emitAuthResolved(options.onEvent, "client_credentials");
2657
+ return token;
2658
+ }
2569
2659
  async function resolveAuthToken(options = {}) {
2570
2660
  const credentials = await resolveCredentials({
2571
2661
  credentials: options.credentials,
@@ -2575,14 +2665,24 @@ async function resolveAuthToken(options = {}) {
2575
2665
  if (credentials !== void 0) {
2576
2666
  return resolveAuthTokenFromCredentials(credentials, options);
2577
2667
  }
2578
- return getTokenFromCliLogin({
2668
+ const storedToken = await tryStoredClientCredentialToken(options);
2669
+ if (storedToken !== void 0) return storedToken;
2670
+ if (options.debug) {
2671
+ console.log("[auth] Using JWT (no stored client credential found)");
2672
+ }
2673
+ const jwtToken = await getTokenFromCliLogin({
2579
2674
  onEvent: options.onEvent,
2580
2675
  fetch: options.fetch,
2581
2676
  debug: options.debug
2582
2677
  });
2678
+ if (jwtToken !== void 0) {
2679
+ emitAuthResolved(options.onEvent, "jwt");
2680
+ }
2681
+ return jwtToken;
2583
2682
  }
2584
2683
  async function resolveAuthTokenFromCredentials(credentials, options) {
2585
2684
  if (typeof credentials === "string") {
2685
+ emitAuthResolved(options.onEvent, "token");
2586
2686
  return credentials;
2587
2687
  }
2588
2688
  if (isClientCredentials(credentials)) {
@@ -2595,15 +2695,25 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
2595
2695
  baseUrl: resolvedBaseUrl
2596
2696
  });
2597
2697
  const cache = await resolveCache(options);
2598
- const cached = await cache.get(cacheKey);
2599
- if (cached && entryIsValid(cached)) {
2600
- return cached.value;
2698
+ const cached = await readCachedToken(cacheKey, cache);
2699
+ if (cached !== void 0) {
2700
+ if (options.debug) {
2701
+ console.log(`[auth] Using cached token (clientId: ${clientId})`);
2702
+ }
2703
+ return cached;
2601
2704
  }
2602
2705
  const pending = pendingExchanges.get(cacheKey);
2603
2706
  if (pending) return pending;
2604
2707
  const runLocked = async () => {
2605
- const recheck = await cache.get(cacheKey);
2606
- if (recheck && entryIsValid(recheck)) return recheck.value;
2708
+ const recheck = await readCachedToken(cacheKey, cache);
2709
+ if (recheck !== void 0) {
2710
+ if (options.debug) {
2711
+ console.log(
2712
+ `[auth] Using cached token (clientId: ${clientId}, locked recheck)`
2713
+ );
2714
+ }
2715
+ return recheck;
2716
+ }
2607
2717
  const { accessToken, expiresIn } = await exchangeClientCredentials({
2608
2718
  clientId: credentials.clientId,
2609
2719
  clientSecret: credentials.clientSecret,
@@ -2661,7 +2771,7 @@ async function invalidateCredentialsToken(options) {
2661
2771
  }
2662
2772
 
2663
2773
  // src/sdk-version.ts
2664
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.49.0" : void 0) || "unknown";
2774
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.51.0" : void 0) || "unknown";
2665
2775
 
2666
2776
  // src/utils/open-url.ts
2667
2777
  var nodePrefix = "node:";
@@ -2936,10 +3046,10 @@ var ZapierApiClient = class {
2936
3046
  }
2937
3047
  if (errorType !== "approval_required") return response;
2938
3048
  if (attempt === maxRetries) break;
2939
- const isInteractive = this.options.isInteractive ?? getZapierIsInteractive();
2940
- if (!isInteractive) {
3049
+ const mode = this.options.approvalMode ?? getZapierApprovalMode() ?? "disabled";
3050
+ if (mode === "disabled") {
2941
3051
  throw new ZapierApprovalError(
2942
- "Approval required but session is not interactive",
3052
+ "Approvals are disabled. Set approvalMode to 'poll' or 'throw' (or ZAPIER_APPROVAL_MODE) to enable.",
2943
3053
  { status: "approval_required" }
2944
3054
  );
2945
3055
  }
@@ -2949,7 +3059,7 @@ var ZapierApiClient = class {
2949
3059
  { statusCode: 403 }
2950
3060
  );
2951
3061
  }
2952
- await this.runOneApprovalRound(init.approvalContext);
3062
+ await this.runOneApprovalRound(init.approvalContext, mode);
2953
3063
  }
2954
3064
  throw new ZapierApprovalError(
2955
3065
  `Exceeded maximum approval retries (${maxRetries}) for ${path}`,
@@ -3242,7 +3352,9 @@ var ZapierApiClient = class {
3242
3352
  if (data && typeof data === "object") {
3243
3353
  headers["Content-Type"] = "application/json";
3244
3354
  }
3245
- const wasMissingAuthToken = options.authRequired && await this.getAuthToken({ requiredScopes: options.requiredScopes }) == null;
3355
+ const wasMissingAuthToken = options.authRequired && await this.getAuthToken({
3356
+ requiredScopes: options.requiredScopes
3357
+ }) == null;
3246
3358
  const response = await this.fetch(path, {
3247
3359
  ...options,
3248
3360
  method,
@@ -3268,10 +3380,13 @@ var ZapierApiClient = class {
3268
3380
  }
3269
3381
  /**
3270
3382
  * Run a single approval round: create the approval, open the URL (poll mode)
3271
- * or throw (fail mode), poll until resolved, and emit events. Throws on
3383
+ * or throw (throw mode), poll until resolved, and emit events. Throws on
3272
3384
  * denied/timeout/unexpected status. Returns on approved.
3385
+ *
3386
+ * Caller is responsible for passing a non-"disabled" mode; this method
3387
+ * unconditionally creates an approval.
3273
3388
  */
3274
- async runOneApprovalRound(buildContext) {
3389
+ async runOneApprovalRound(buildContext, mode) {
3275
3390
  const context = buildContext();
3276
3391
  let approvalResponse;
3277
3392
  try {
@@ -3346,8 +3461,7 @@ var ZapierApiClient = class {
3346
3461
  approvalId: approval.approval_id,
3347
3462
  approvalUrl: approval.approval_url
3348
3463
  });
3349
- const approvalMode = this.options.approvalMode ?? getZapierApprovalMode();
3350
- if (approvalMode === "fail") {
3464
+ if (mode === "throw") {
3351
3465
  throw new ZapierApprovalError("This request requires approval.", {
3352
3466
  approvalId: approval.approval_id,
3353
3467
  approvalUrl: approval.approval_url,
@@ -3434,6 +3548,28 @@ var createZapierApi = (options) => {
3434
3548
  });
3435
3549
  };
3436
3550
 
3551
+ // src/api/index.ts
3552
+ function getOrCreateApiClient(config) {
3553
+ const {
3554
+ baseUrl = ZAPIER_BASE_URL,
3555
+ credentials,
3556
+ token,
3557
+ api: providedApi,
3558
+ debug = false,
3559
+ fetch: customFetch
3560
+ } = config;
3561
+ if (providedApi) {
3562
+ return providedApi;
3563
+ }
3564
+ return createZapierApi({
3565
+ baseUrl,
3566
+ credentials,
3567
+ token,
3568
+ debug,
3569
+ fetch: customFetch
3570
+ });
3571
+ }
3572
+
3437
3573
  // src/plugins/api/index.ts
3438
3574
  var apiPlugin = definePlugin(
3439
3575
  (sdk) => {
@@ -3446,7 +3582,6 @@ var apiPlugin = definePlugin(
3446
3582
  debug = false,
3447
3583
  maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES,
3448
3584
  maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS,
3449
- isInteractive,
3450
3585
  approvalTimeoutMs,
3451
3586
  maxApprovalRetries,
3452
3587
  approvalMode,
@@ -3461,7 +3596,6 @@ var apiPlugin = definePlugin(
3461
3596
  onEvent,
3462
3597
  maxNetworkRetries,
3463
3598
  maxNetworkRetryDelayMs,
3464
- isInteractive,
3465
3599
  approvalTimeoutMs,
3466
3600
  maxApprovalRetries,
3467
3601
  approvalMode,
@@ -10167,16 +10301,13 @@ var BaseSdkOptionsSchema = zod.z.object({
10167
10301
  * Default is 60000 (60 seconds).
10168
10302
  */
10169
10303
  maxNetworkRetryDelayMs: zod.z.number().optional().describe("Max delay in ms to wait for retry (default: 60000).").meta({ valueHint: "ms" }),
10170
- isInteractive: zod.z.boolean().optional().describe(
10171
- "Whether this session is interactive (user can visit approval URLs). Defaults to ZAPIER_IS_INTERACTIVE env var."
10172
- ).meta({ internal: true }),
10173
- approvalTimeoutMs: zod.z.number().optional().describe("Timeout in ms for approval polling. Default: 600000 (10 min).").meta({ valueHint: "ms", internal: true }),
10304
+ approvalTimeoutMs: zod.z.number().optional().describe("Timeout in ms for approval polling. Default: 600000 (10 min).").meta({ valueHint: "ms" }),
10174
10305
  maxApprovalRetries: zod.z.number().optional().describe(
10175
10306
  "Maximum number of sequential approval rounds per request (one per gating policy) before giving up. Default: 2."
10176
- ).meta({ internal: true }),
10177
- approvalMode: zod.z.enum(["poll", "fail"]).optional().describe(
10178
- 'Approval flow behavior. "poll" opens browser and polls (default). "fail" creates the approval and throws immediately with the approval URL.'
10179
- ).meta({ internal: true }),
10307
+ ),
10308
+ approvalMode: zod.z.enum(["disabled", "poll", "throw"]).optional().describe(
10309
+ 'Approval flow behavior. "disabled" (default) throws a ZapierApprovalError on approval-required responses without creating an approval. "poll" creates the approval, opens it in a browser, polls until resolved, and retries the original request. "throw" creates the approval and throws a ZapierApprovalError with the approval URL so the caller can surface it. Defaults to the ZAPIER_APPROVAL_MODE env var, then "disabled".'
10310
+ ),
10180
10311
  // Internal
10181
10312
  manifestPath: zod.z.string().optional().describe("Path to a .zapierrc manifest file for app version locking.").meta({ internal: true }),
10182
10313
  manifest: zod.z.custom().optional().describe("Manifest for app version locking.").meta({ internal: true }),
@@ -10306,6 +10437,7 @@ exports.createSdk = createSdk;
10306
10437
  exports.createTableFieldsPlugin = createTableFieldsPlugin;
10307
10438
  exports.createTablePlugin = createTablePlugin;
10308
10439
  exports.createTableRecordsPlugin = createTableRecordsPlugin;
10440
+ exports.createZapierApi = createZapierApi;
10309
10441
  exports.createZapierSdk = createZapierSdk2;
10310
10442
  exports.createZapierSdkWithoutRegistry = createZapierSdkWithoutRegistry;
10311
10443
  exports.definePlugin = definePlugin;
@@ -10329,6 +10461,7 @@ exports.getConnectionPlugin = getConnectionPlugin;
10329
10461
  exports.getCpuTime = getCpuTime;
10330
10462
  exports.getCurrentTimestamp = getCurrentTimestamp;
10331
10463
  exports.getMemoryUsage = getMemoryUsage;
10464
+ exports.getOrCreateApiClient = getOrCreateApiClient;
10332
10465
  exports.getOsInfo = getOsInfo;
10333
10466
  exports.getPlatformVersions = getPlatformVersions;
10334
10467
  exports.getPreferredManifestEntryKey = getPreferredManifestEntryKey;
@@ -10338,7 +10471,6 @@ exports.getTablePlugin = getTablePlugin;
10338
10471
  exports.getTableRecordPlugin = getTableRecordPlugin;
10339
10472
  exports.getTokenFromCliLogin = getTokenFromCliLogin;
10340
10473
  exports.getZapierApprovalMode = getZapierApprovalMode;
10341
- exports.getZapierIsInteractive = getZapierIsInteractive;
10342
10474
  exports.getZapierSdkService = getZapierSdkService;
10343
10475
  exports.injectCliLogin = injectCliLogin;
10344
10476
  exports.inputFieldKeyResolver = inputFieldKeyResolver;
@@ -1,5 +1,5 @@
1
- import { B as BaseSdkOptions, W as WithAddPlugin, P as PluginMeta, Z as ZapierSdkOptions$1, E as EventEmissionContext, A as ApiClient, M as Manifest, R as ResolvedAppLocator, U as UpdateManifestEntryOptions, a as UpdateManifestEntryResult, b as AddActionEntryOptions, c as AddActionEntryResult, d as ActionEntry, f as findManifestEntry, r as readManifestFromFile, C as CapabilitiesContext, e as PaginatedSdkResult, F as FieldsetItem, g as PositionalMetadata, h as ZapierFetchInitOptions, D as DrainTriggerInboxOptions, i as DynamicResolver, j as WatchTriggerInboxOptions, k as ActionProxy, l as ZapierSdkApps } from './index-C2vsvjgN.mjs';
2
- export { u as Action, ce as ActionExecutionOptions, y as ActionExecutionResult, z as ActionField, H as ActionFieldChoice, aS as ActionItem, bt as ActionKeyProperty, b1 as ActionKeyPropertySchema, bu as ActionProperty, b2 as ActionPropertySchema, aq as ActionResolverItem, bF as ActionTimeoutMsProperty, bd as ActionTimeoutMsPropertySchema, ar as ActionTypeItem, bs as ActionTypeProperty, b0 as ActionTypePropertySchema, bS as ApiError, dz as ApiEvent, cY as ApiPluginOptions, c_ as ApiPluginProvides, v as App, cf as AppFactoryInput, aQ as AppItem, bq as AppKeyProperty, a_ as AppKeyPropertySchema, br as AppProperty, a$ as AppPropertySchema, az as ApplicationLifecycleEventData, c7 as ApprovalStatus, cd as AppsPluginProvides, bK as AppsProperty, bi as AppsPropertySchema, a0 as ArrayResolver, dy as AuthEvent, by as AuthenticationIdProperty, b5 as AuthenticationIdPropertySchema, av as BaseEvent, aj as BaseSdkOptionsSchema, a8 as BatchOptions, cL as CONTEXT_CACHE_MAX_SIZE, cK as CONTEXT_CACHE_TTL_MS, x as Choice, dF as ClientCredentialsObject, dQ as ClientCredentialsObjectSchema, K as Connection, dY as ConnectionEntry, dX as ConnectionEntrySchema, bw as ConnectionIdProperty, b4 as ConnectionIdPropertySchema, aR as ConnectionItem, bx as ConnectionProperty, b6 as ConnectionPropertySchema, d_ as ConnectionsMap, dZ as ConnectionsMapSchema, e0 as ConnectionsPluginProvides, bM as ConnectionsProperty, bk as ConnectionsPropertySchema, O as ConnectionsResponse, cx as CreateClientCredentialsPluginProvides, en as CreateTableFieldsPluginProvides, eh as CreateTablePluginProvides, ev as CreateTableRecordsPluginProvides, dC as Credentials, dV as CredentialsFunction, dU as CredentialsFunctionSchema, dE as CredentialsObject, dS as CredentialsObjectSchema, dW as CredentialsSchema, e5 as DEFAULT_ACTION_TIMEOUT_MS, ea as DEFAULT_APPROVAL_TIMEOUT_MS, cU as DEFAULT_CONFIG_PATH, eb as DEFAULT_MAX_APPROVAL_RETRIES, e4 as DEFAULT_PAGE_SIZE, bD as DebugProperty, bb as DebugPropertySchema, cz as DeleteClientCredentialsPluginProvides, ep as DeleteTableFieldsPluginProvides, ej as DeleteTablePluginProvides, ex as DeleteTableRecordsPluginProvides, o as DrainTriggerInboxCallback, p as DrainTriggerInboxErrorObserver, aA as EnhancedErrorEventData, bT as ErrorOptions, dB as EventCallback, ay as EventContext, ax as EventEmissionProvides, ch as FetchPluginProvides, w as Field, bJ as FieldsProperty, bh as FieldsPropertySchema, a3 as FieldsResolver, s as FindFirstAuthenticationPluginProvides, cH as FindFirstConnectionPluginProvides, t as FindUniqueAuthenticationPluginProvides, cJ as FindUniqueConnectionPluginProvides, Y as FormatMetadata, X as FormattedItem, ai as FunctionDeprecation, aX as FunctionOptions, ah as FunctionRegistryEntry, cr as GetActionInputFieldsSchemaPluginProvides, cD as GetActionPluginProvides, cB as GetAppPluginProvides, G as GetAuthenticationPluginProvides, cF as GetConnectionPluginProvides, cX as GetProfilePluginProvides, ef as GetTablePluginProvides, er as GetTableRecordPluginProvides, aU as InfoFieldItem, aT as InputFieldItem, bv as InputFieldProperty, b3 as InputFieldPropertySchema, bz as InputsProperty, b7 as InputsPropertySchema, bR as LeaseLimitProperty, bp as LeaseLimitPropertySchema, bP as LeaseProperty, bn as LeasePropertySchema, bQ as LeaseSecondsProperty, bo as LeaseSecondsPropertySchema, L as LeasedTriggerMessageItem, bA as LimitProperty, b8 as LimitPropertySchema, cp as ListActionInputFieldChoicesPluginProvides, cn as ListActionInputFieldsPluginProvides, cl as ListActionsPluginProvides, cj as ListAppsPluginProvides, q as ListAuthenticationsPluginProvides, cv as ListClientCredentialsPluginProvides, ct as ListConnectionsPluginProvides, el as ListTableFieldsPluginProvides, et as ListTableRecordsPluginProvides, ed as ListTablesPluginProvides, dA as LoadingEvent, e3 as MAX_PAGE_LIMIT, cV as ManifestEntry, cQ as ManifestPluginOptions, cT as ManifestPluginProvides, aw as MethodCalledEvent, aB as MethodCalledEventData, N as Need, I as NeedsRequest, J as NeedsResponse, bB as OffsetProperty, b9 as OffsetPropertySchema, _ as OutputFormatter, bC as OutputProperty, ba as OutputPropertySchema, aZ as PaginatedSdkFunction, bE as ParamsProperty, bc as ParamsPropertySchema, dG as PkceCredentialsObject, dR as PkceCredentialsObjectSchema, ak as Plugin, al as PluginProvides, at as PollOptions, c5 as RateLimitInfo, bH as RecordProperty, bf as RecordPropertySchema, bI as RecordsProperty, bg as RecordsPropertySchema, ad as RelayFetchSchema, ac as RelayRequestSchema, as as RequestOptions, cP as RequestPluginProvides, dk as ResolveAuthTokenOptions, dL as ResolveCredentialsOptions, dD as ResolvedCredentials, dT as ResolvedCredentialsSchema, $ as Resolver, a1 as ResolverMetadata, aV as RootFieldItem, cN as RunActionPluginProvides, dx as SdkEvent, aY as SdkPage, a2 as StaticResolver, bG as TableProperty, be as TablePropertySchema, bL as TablesProperty, bj as TablesPropertySchema, bO as TriggerInboxNameProperty, bm as TriggerInboxNamePropertySchema, bN as TriggerInboxProperty, bl as TriggerInboxPropertySchema, T as TriggerMessageStatus, ez as UpdateTableRecordsPluginProvides, Q as UserProfile, aW as UserProfileItem, e1 as ZAPIER_BASE_URL, e6 as ZAPIER_MAX_NETWORK_RETRIES, e7 as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, m as ZapierAbortDrainSignal, c3 as ZapierActionError, bV as ZapierApiError, bW as ZapierAppNotFoundError, c8 as ZapierApprovalError, bZ as ZapierAuthenticationError, c1 as ZapierBundleError, dt as ZapierCache, du as ZapierCacheEntry, dv as ZapierCacheSetOptions, c0 as ZapierConfigurationError, c4 as ZapierConflictError, bU as ZapierError, b_ as ZapierNotFoundError, c6 as ZapierRateLimitError, c9 as ZapierRelayError, n as ZapierReleaseTriggerMessageSignal, b$ as ZapierResourceNotFoundError, cb as ZapierSignal, c2 as ZapierTimeoutError, bY as ZapierUnknownError, bX as ZapierValidationError, d1 as actionKeyResolver, d0 as actionTypeResolver, cZ as apiPlugin, c$ as appKeyResolver, cc as appsPlugin, d3 as authenticationIdGenericResolver, d2 as authenticationIdResolver, a7 as batch, aL as buildApplicationLifecycleEvent, a9 as buildCapabilityMessage, aN as buildErrorEvent, aM as buildErrorEventWithContext, aP as buildMethodCalledEvent, dl as clearTokenCache, d7 as clientCredentialsNameResolver, d8 as clientIdResolver, ap as composePlugins, d3 as connectionIdGenericResolver, d2 as connectionIdResolver, d$ as connectionsPlugin, aO as createBaseEvent, cw as createClientCredentialsPlugin, V as createFunction, dw as createMemoryCache, ag as createOptionsPlugin, ao as createPaginatedPluginMethod, an as createPluginMethod, af as createSdk, em as createTableFieldsPlugin, eg as createTablePlugin, eu as createTableRecordsPlugin, ae as createZapierSdkWithoutRegistry, am as definePlugin, cy as deleteClientCredentialsPlugin, eo as deleteTableFieldsPlugin, ei as deleteTablePlugin, ew as deleteTableRecordsPlugin, cg as fetchPlugin, cG as findFirstConnectionPlugin, cI as findUniqueConnectionPlugin, ca as formatErrorMessage, aC as generateEventId, cq as getActionInputFieldsSchemaPlugin, cC as getActionPlugin, cA as getAppPlugin, dO as getBaseUrlFromCredentials, aI as getCiPlatform, dP as getClientIdFromCredentials, cE as getConnectionPlugin, aK as getCpuTime, aD as getCurrentTimestamp, aJ as getMemoryUsage, aF as getOsInfo, aG as getPlatformVersions, cR as getPreferredManifestEntryKey, cW as getProfilePlugin, aE as getReleaseId, ee as getTablePlugin, eq as getTableRecordPlugin, dq as getTokenFromCliLogin, e9 as getZapierApprovalMode, e8 as getZapierIsInteractive, e2 as getZapierSdkService, dn as injectCliLogin, d6 as inputFieldKeyResolver, d5 as inputsAllOptionalResolver, d4 as inputsResolver, dm as invalidateCachedToken, ds as invalidateCredentialsToken, aH as isCi, dp as isCliLoginAvailable, dH as isClientCredentials, dK as isCredentialsFunction, dJ as isCredentialsObject, dI as isPkceCredentials, S as isPositional, co as listActionInputFieldChoicesPlugin, cm as listActionInputFieldsPlugin, ck as listActionsPlugin, ci as listAppsPlugin, cu as listClientCredentialsPlugin, cs as listConnectionsPlugin, ek as listTableFieldsPlugin, es as listTableRecordsPlugin, ec as listTablesPlugin, aa as logDeprecation, cS as manifestPlugin, au as registryPlugin, cO as requestPlugin, ab as resetDeprecationWarnings, dr as resolveAuthToken, dN as resolveCredentials, dM as resolveCredentialsFromEnv, cM as runActionPlugin, a4 as runWithTelemetryContext, dd as tableFieldIdsResolver, df as tableFieldsResolver, di as tableFiltersResolver, d9 as tableIdResolver, de as tableNameResolver, db as tableRecordIdResolver, dc as tableRecordIdsResolver, dg as tableRecordsResolver, dj as tableSortResolver, dh as tableUpdateRecordsResolver, a5 as toSnakeCase, a6 as toTitleCase, da as triggerInboxResolver, ey as updateTableRecordsPlugin } from './index-C2vsvjgN.mjs';
1
+ import { B as BaseSdkOptions, W as WithAddPlugin, P as PluginMeta, Z as ZapierSdkOptions$1, E as EventEmissionContext, A as ApiClient, M as Manifest, R as ResolvedAppLocator, U as UpdateManifestEntryOptions, a as UpdateManifestEntryResult, b as AddActionEntryOptions, c as AddActionEntryResult, d as ActionEntry, f as findManifestEntry, r as readManifestFromFile, C as CapabilitiesContext, e as PaginatedSdkResult, F as FieldsetItem, g as PositionalMetadata, h as ZapierFetchInitOptions, D as DrainTriggerInboxOptions, i as DynamicResolver, j as WatchTriggerInboxOptions, k as ActionProxy, l as ZapierSdkApps } from './index-C52BjTXh.mjs';
2
+ export { u as Action, cg as ActionExecutionOptions, y as ActionExecutionResult, z as ActionField, H as ActionFieldChoice, aU as ActionItem, bv as ActionKeyProperty, b3 as ActionKeyPropertySchema, bw as ActionProperty, b4 as ActionPropertySchema, aq as ActionResolverItem, bH as ActionTimeoutMsProperty, bf as ActionTimeoutMsPropertySchema, ar as ActionTypeItem, bu as ActionTypeProperty, b2 as ActionTypePropertySchema, bU as ApiError, dB as ApiEvent, c_ as ApiPluginOptions, d0 as ApiPluginProvides, v as App, ch as AppFactoryInput, aS as AppItem, bs as AppKeyProperty, b0 as AppKeyPropertySchema, bt as AppProperty, b1 as AppPropertySchema, aB as ApplicationLifecycleEventData, c9 as ApprovalStatus, cf as AppsPluginProvides, bM as AppsProperty, bk as AppsPropertySchema, a0 as ArrayResolver, dA as AuthEvent, bA as AuthenticationIdProperty, b7 as AuthenticationIdPropertySchema, ax as BaseEvent, aj as BaseSdkOptionsSchema, a8 as BatchOptions, cN as CONTEXT_CACHE_MAX_SIZE, cM as CONTEXT_CACHE_TTL_MS, x as Choice, dH as ClientCredentialsObject, dS as ClientCredentialsObjectSchema, K as Connection, d_ as ConnectionEntry, dZ as ConnectionEntrySchema, by as ConnectionIdProperty, b6 as ConnectionIdPropertySchema, aT as ConnectionItem, bz as ConnectionProperty, b8 as ConnectionPropertySchema, e0 as ConnectionsMap, d$ as ConnectionsMapSchema, e2 as ConnectionsPluginProvides, bO as ConnectionsProperty, bm as ConnectionsPropertySchema, O as ConnectionsResponse, cz as CreateClientCredentialsPluginProvides, eo as CreateTableFieldsPluginProvides, ei as CreateTablePluginProvides, ew as CreateTableRecordsPluginProvides, dE as Credentials, dX as CredentialsFunction, dW as CredentialsFunctionSchema, dG as CredentialsObject, dU as CredentialsObjectSchema, dY as CredentialsSchema, e7 as DEFAULT_ACTION_TIMEOUT_MS, eb as DEFAULT_APPROVAL_TIMEOUT_MS, cW as DEFAULT_CONFIG_PATH, ec as DEFAULT_MAX_APPROVAL_RETRIES, e6 as DEFAULT_PAGE_SIZE, bF as DebugProperty, bd as DebugPropertySchema, cB as DeleteClientCredentialsPluginProvides, eq as DeleteTableFieldsPluginProvides, ek as DeleteTablePluginProvides, ey as DeleteTableRecordsPluginProvides, o as DrainTriggerInboxCallback, p as DrainTriggerInboxErrorObserver, aC as EnhancedErrorEventData, bV as ErrorOptions, dD as EventCallback, aA as EventContext, az as EventEmissionProvides, cj as FetchPluginProvides, w as Field, bL as FieldsProperty, bj as FieldsPropertySchema, a3 as FieldsResolver, s as FindFirstAuthenticationPluginProvides, cJ as FindFirstConnectionPluginProvides, t as FindUniqueAuthenticationPluginProvides, cL as FindUniqueConnectionPluginProvides, Y as FormatMetadata, X as FormattedItem, ai as FunctionDeprecation, aZ as FunctionOptions, ah as FunctionRegistryEntry, ct as GetActionInputFieldsSchemaPluginProvides, cF as GetActionPluginProvides, cD as GetAppPluginProvides, G as GetAuthenticationPluginProvides, cH as GetConnectionPluginProvides, cZ as GetProfilePluginProvides, eg as GetTablePluginProvides, es as GetTableRecordPluginProvides, aW as InfoFieldItem, aV as InputFieldItem, bx as InputFieldProperty, b5 as InputFieldPropertySchema, bB as InputsProperty, b9 as InputsPropertySchema, bT as LeaseLimitProperty, br as LeaseLimitPropertySchema, bR as LeaseProperty, bp as LeasePropertySchema, bS as LeaseSecondsProperty, bq as LeaseSecondsPropertySchema, L as LeasedTriggerMessageItem, bC as LimitProperty, ba as LimitPropertySchema, cr as ListActionInputFieldChoicesPluginProvides, cp as ListActionInputFieldsPluginProvides, cn as ListActionsPluginProvides, cl as ListAppsPluginProvides, q as ListAuthenticationsPluginProvides, cx as ListClientCredentialsPluginProvides, cv as ListConnectionsPluginProvides, em as ListTableFieldsPluginProvides, eu as ListTableRecordsPluginProvides, ee as ListTablesPluginProvides, dC as LoadingEvent, e5 as MAX_PAGE_LIMIT, cX as ManifestEntry, cS as ManifestPluginOptions, cV as ManifestPluginProvides, ay as MethodCalledEvent, aD as MethodCalledEventData, N as Need, I as NeedsRequest, J as NeedsResponse, bD as OffsetProperty, bb as OffsetPropertySchema, _ as OutputFormatter, bE as OutputProperty, bc as OutputPropertySchema, a$ as PaginatedSdkFunction, bG as ParamsProperty, be as ParamsPropertySchema, dI as PkceCredentialsObject, dT as PkceCredentialsObjectSchema, ak as Plugin, al as PluginProvides, au as PollOptions, c7 as RateLimitInfo, bJ as RecordProperty, bh as RecordPropertySchema, bK as RecordsProperty, bi as RecordsPropertySchema, ad as RelayFetchSchema, ac as RelayRequestSchema, at as RequestOptions, cR as RequestPluginProvides, dm as ResolveAuthTokenOptions, dN as ResolveCredentialsOptions, dF as ResolvedCredentials, dV as ResolvedCredentialsSchema, $ as Resolver, a1 as ResolverMetadata, aX as RootFieldItem, cP as RunActionPluginProvides, dz as SdkEvent, a_ as SdkPage, a2 as StaticResolver, bI as TableProperty, bg as TablePropertySchema, bN as TablesProperty, bl as TablesPropertySchema, bQ as TriggerInboxNameProperty, bo as TriggerInboxNamePropertySchema, bP as TriggerInboxProperty, bn as TriggerInboxPropertySchema, T as TriggerMessageStatus, eA as UpdateTableRecordsPluginProvides, Q as UserProfile, aY as UserProfileItem, e3 as ZAPIER_BASE_URL, e8 as ZAPIER_MAX_NETWORK_RETRIES, e9 as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, m as ZapierAbortDrainSignal, c5 as ZapierActionError, bX as ZapierApiError, bY as ZapierAppNotFoundError, ca as ZapierApprovalError, b$ as ZapierAuthenticationError, c3 as ZapierBundleError, dv as ZapierCache, dw as ZapierCacheEntry, dx as ZapierCacheSetOptions, c2 as ZapierConfigurationError, c6 as ZapierConflictError, bW as ZapierError, c0 as ZapierNotFoundError, c8 as ZapierRateLimitError, cb as ZapierRelayError, n as ZapierReleaseTriggerMessageSignal, c1 as ZapierResourceNotFoundError, cd as ZapierSignal, c4 as ZapierTimeoutError, b_ as ZapierUnknownError, bZ as ZapierValidationError, d3 as actionKeyResolver, d2 as actionTypeResolver, c$ as apiPlugin, d1 as appKeyResolver, ce as appsPlugin, d5 as authenticationIdGenericResolver, d4 as authenticationIdResolver, a7 as batch, aN as buildApplicationLifecycleEvent, a9 as buildCapabilityMessage, aP as buildErrorEvent, aO as buildErrorEventWithContext, aR as buildMethodCalledEvent, dn as clearTokenCache, d9 as clientCredentialsNameResolver, da as clientIdResolver, ap as composePlugins, d5 as connectionIdGenericResolver, d4 as connectionIdResolver, e1 as connectionsPlugin, aQ as createBaseEvent, cy as createClientCredentialsPlugin, V as createFunction, dy as createMemoryCache, ag as createOptionsPlugin, ao as createPaginatedPluginMethod, an as createPluginMethod, af as createSdk, en as createTableFieldsPlugin, eh as createTablePlugin, ev as createTableRecordsPlugin, av as createZapierApi, ae as createZapierSdkWithoutRegistry, am as definePlugin, cA as deleteClientCredentialsPlugin, ep as deleteTableFieldsPlugin, ej as deleteTablePlugin, ex as deleteTableRecordsPlugin, ci as fetchPlugin, cI as findFirstConnectionPlugin, cK as findUniqueConnectionPlugin, cc as formatErrorMessage, aE as generateEventId, cs as getActionInputFieldsSchemaPlugin, cE as getActionPlugin, cC as getAppPlugin, dQ as getBaseUrlFromCredentials, aK as getCiPlatform, dR as getClientIdFromCredentials, cG as getConnectionPlugin, aM as getCpuTime, aF as getCurrentTimestamp, aL as getMemoryUsage, aw as getOrCreateApiClient, aH as getOsInfo, aI as getPlatformVersions, cT as getPreferredManifestEntryKey, cY as getProfilePlugin, aG as getReleaseId, ef as getTablePlugin, er as getTableRecordPlugin, ds as getTokenFromCliLogin, ea as getZapierApprovalMode, e4 as getZapierSdkService, dq as injectCliLogin, d8 as inputFieldKeyResolver, d7 as inputsAllOptionalResolver, d6 as inputsResolver, dp as invalidateCachedToken, du as invalidateCredentialsToken, aJ as isCi, dr as isCliLoginAvailable, dJ as isClientCredentials, dM as isCredentialsFunction, dL as isCredentialsObject, dK as isPkceCredentials, S as isPositional, cq as listActionInputFieldChoicesPlugin, co as listActionInputFieldsPlugin, cm as listActionsPlugin, ck as listAppsPlugin, cw as listClientCredentialsPlugin, cu as listConnectionsPlugin, el as listTableFieldsPlugin, et as listTableRecordsPlugin, ed as listTablesPlugin, aa as logDeprecation, cU as manifestPlugin, as as registryPlugin, cQ as requestPlugin, ab as resetDeprecationWarnings, dt as resolveAuthToken, dP as resolveCredentials, dO as resolveCredentialsFromEnv, cO as runActionPlugin, a4 as runWithTelemetryContext, df as tableFieldIdsResolver, dh as tableFieldsResolver, dk as tableFiltersResolver, db as tableIdResolver, dg as tableNameResolver, dd as tableRecordIdResolver, de as tableRecordIdsResolver, di as tableRecordsResolver, dl as tableSortResolver, dj as tableUpdateRecordsResolver, a5 as toSnakeCase, a6 as toTitleCase, dc as triggerInboxResolver, ez as updateTableRecordsPlugin } from './index-C52BjTXh.mjs';
3
3
  import * as zod_v4_core from 'zod/v4/core';
4
4
  import * as zod from 'zod';
5
5
  import '@zapier/zapier-sdk-core/v0/schemas/connections';