@zapier/zapier-sdk 0.40.2 → 0.40.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +3 -3
  3. package/dist/api/polling.js +3 -4
  4. package/dist/auth.d.ts.map +1 -1
  5. package/dist/auth.js +14 -7
  6. package/dist/constants.d.ts.map +1 -1
  7. package/dist/constants.js +2 -2
  8. package/dist/credentials.d.ts.map +1 -1
  9. package/dist/credentials.js +21 -19
  10. package/dist/index.cjs +105 -101
  11. package/dist/index.d.mts +3 -0
  12. package/dist/index.mjs +105 -81
  13. package/dist/plugins/capabilities/index.d.ts.map +1 -1
  14. package/dist/plugins/capabilities/index.js +1 -3
  15. package/dist/plugins/eventEmission/builders.d.ts.map +1 -1
  16. package/dist/plugins/eventEmission/builders.js +4 -4
  17. package/dist/plugins/eventEmission/index.d.ts.map +1 -1
  18. package/dist/plugins/eventEmission/index.js +11 -11
  19. package/dist/plugins/eventEmission/utils.d.ts.map +1 -1
  20. package/dist/plugins/eventEmission/utils.js +43 -36
  21. package/dist/plugins/findFirstConnection/schemas.d.ts +1 -0
  22. package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -1
  23. package/dist/plugins/findUniqueConnection/schemas.d.ts +1 -0
  24. package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -1
  25. package/dist/plugins/listConnections/index.d.ts.map +1 -1
  26. package/dist/plugins/listConnections/index.js +5 -0
  27. package/dist/plugins/listConnections/schemas.d.ts +1 -0
  28. package/dist/plugins/listConnections/schemas.d.ts.map +1 -1
  29. package/dist/plugins/listConnections/schemas.js +13 -2
  30. package/dist/utils/batch-utils.d.ts.map +1 -1
  31. package/dist/utils/batch-utils.js +5 -6
  32. package/dist/utils/url-utils.js +2 -2
  33. package/package.json +6 -2
package/dist/index.cjs CHANGED
@@ -4,28 +4,6 @@ var zod = require('zod');
4
4
  var apps = require('@zapier/zapier-sdk-core/v0/schemas/apps');
5
5
  var connections = require('@zapier/zapier-sdk-core/v0/schemas/connections');
6
6
  var clientCredentials = require('@zapier/zapier-sdk-core/v0/schemas/client-credentials');
7
- var promises = require('timers/promises');
8
- var os = require('os');
9
-
10
- function _interopNamespace(e) {
11
- if (e && e.__esModule) return e;
12
- var n = Object.create(null);
13
- if (e) {
14
- Object.keys(e).forEach(function (k) {
15
- if (k !== 'default') {
16
- var d = Object.getOwnPropertyDescriptor(e, k);
17
- Object.defineProperty(n, k, d.get ? d : {
18
- enumerable: true,
19
- get: function () { return e[k]; }
20
- });
21
- }
22
- });
23
- }
24
- n.default = e;
25
- return Object.freeze(n);
26
- }
27
-
28
- var os__namespace = /*#__PURE__*/_interopNamespace(os);
29
7
 
30
8
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
31
9
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
@@ -62,12 +40,12 @@ function isPositional(schema) {
62
40
  }
63
41
 
64
42
  // src/constants.ts
65
- var ZAPIER_BASE_URL = process.env.ZAPIER_BASE_URL || "https://zapier.com";
43
+ var ZAPIER_BASE_URL = globalThis.process?.env?.ZAPIER_BASE_URL || "https://zapier.com";
66
44
  var MAX_PAGE_LIMIT = 1e4;
67
45
  var DEFAULT_PAGE_SIZE = 100;
68
46
  var DEFAULT_ACTION_TIMEOUT_MS = 18e4;
69
47
  function parseIntEnvVar(name) {
70
- const value = process.env[name];
48
+ const value = globalThis.process?.env?.[name];
71
49
  if (value === void 0) return void 0;
72
50
  const parsed = parseInt(value, 10);
73
51
  if (isNaN(parsed)) {
@@ -3215,8 +3193,14 @@ var ListConnectionsQuerySchema = connections.ListConnectionsQuerySchema.omit({
3215
3193
  includeShared: zod.z.boolean().optional().describe(
3216
3194
  "Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections."
3217
3195
  ),
3218
- // camelCase isExpired
3219
- isExpired: zod.z.boolean().optional().describe("Filter by expired status"),
3196
+ /** @deprecated Use `expired` instead */
3197
+ isExpired: zod.z.boolean().optional().describe("Filter by expired status").meta({
3198
+ deprecated: true,
3199
+ deprecationMessage: "Use --expired instead to show only expired connections."
3200
+ }),
3201
+ expired: zod.z.boolean().optional().describe(
3202
+ "Show only expired connections (default: only non-expired connections are returned)"
3203
+ ),
3220
3204
  // Override pageSize to make optional
3221
3205
  pageSize: zod.z.number().min(1).optional().describe("Number of connections per page"),
3222
3206
  // SDK specific property for pagination/iterable helpers
@@ -3309,6 +3293,8 @@ var listConnectionsPlugin = ({ context }) => {
3309
3293
  }
3310
3294
  if (options.isExpired !== void 0) {
3311
3295
  searchParams.is_expired = options.isExpired.toString();
3296
+ } else {
3297
+ searchParams.is_expired = (options.expired ?? false).toString();
3312
3298
  }
3313
3299
  if (options.cursor) {
3314
3300
  searchParams.offset = options.cursor;
@@ -5000,7 +4986,7 @@ async function pollUntilComplete(options) {
5000
4986
  let attempts = 0;
5001
4987
  let errorCount = 0;
5002
4988
  if (initialDelay > 0) {
5003
- await promises.setTimeout(initialDelay);
4989
+ await sleep(initialDelay);
5004
4990
  }
5005
4991
  while (true) {
5006
4992
  const elapsedTime = Date.now() - startTime;
@@ -5015,7 +5001,7 @@ async function pollUntilComplete(options) {
5015
5001
  if (attempts > 0) {
5016
5002
  const interval = getPollingInterval(elapsedTime);
5017
5003
  const waitTime = calculateErrorBackoffMs(interval, errorCount);
5018
- await promises.setTimeout(waitTime);
5004
+ await sleep(waitTime);
5019
5005
  }
5020
5006
  attempts++;
5021
5007
  try {
@@ -5127,8 +5113,8 @@ function getTrackingBaseUrl({
5127
5113
  if (trackingBaseUrl) {
5128
5114
  return trackingBaseUrl;
5129
5115
  }
5130
- if (process.env.ZAPIER_TRACKING_BASE_URL) {
5131
- return process.env.ZAPIER_TRACKING_BASE_URL;
5116
+ if (globalThis.process?.env?.ZAPIER_TRACKING_BASE_URL) {
5117
+ return globalThis.process?.env?.ZAPIER_TRACKING_BASE_URL;
5132
5118
  }
5133
5119
  if (baseUrl) {
5134
5120
  const zapierBaseUrl = getZapierBaseUrl(baseUrl);
@@ -5149,9 +5135,9 @@ function deriveAuthBaseUrl(sdkBaseUrl) {
5149
5135
  }
5150
5136
  function normalizeCredentialsObject(obj, sdkBaseUrl) {
5151
5137
  const merged = {
5152
- clientSecret: process.env.ZAPIER_CREDENTIALS_CLIENT_SECRET,
5153
- baseUrl: process.env.ZAPIER_CREDENTIALS_BASE_URL,
5154
- scope: process.env.ZAPIER_CREDENTIALS_SCOPE,
5138
+ clientSecret: globalThis.process?.env?.ZAPIER_CREDENTIALS_CLIENT_SECRET,
5139
+ baseUrl: globalThis.process?.env?.ZAPIER_CREDENTIALS_BASE_URL,
5140
+ scope: globalThis.process?.env?.ZAPIER_CREDENTIALS_SCOPE,
5155
5141
  ...obj
5156
5142
  };
5157
5143
  const resolvedBaseUrl = merged.baseUrl || deriveAuthBaseUrl(sdkBaseUrl);
@@ -5172,47 +5158,47 @@ function normalizeCredentialsObject(obj, sdkBaseUrl) {
5172
5158
  };
5173
5159
  }
5174
5160
  function resolveCredentialsFromEnv(sdkBaseUrl) {
5175
- if (process.env.ZAPIER_CREDENTIALS) {
5176
- return process.env.ZAPIER_CREDENTIALS;
5161
+ if (globalThis.process?.env?.ZAPIER_CREDENTIALS) {
5162
+ return globalThis.process?.env?.ZAPIER_CREDENTIALS;
5177
5163
  }
5178
- if (process.env.ZAPIER_CREDENTIALS_CLIENT_ID) {
5179
- const resolvedBaseUrl = process.env.ZAPIER_CREDENTIALS_BASE_URL || deriveAuthBaseUrl(sdkBaseUrl);
5180
- if (process.env.ZAPIER_CREDENTIALS_CLIENT_SECRET) {
5164
+ if (globalThis.process?.env?.ZAPIER_CREDENTIALS_CLIENT_ID) {
5165
+ const resolvedBaseUrl = globalThis.process?.env?.ZAPIER_CREDENTIALS_BASE_URL || deriveAuthBaseUrl(sdkBaseUrl);
5166
+ if (globalThis.process?.env?.ZAPIER_CREDENTIALS_CLIENT_SECRET) {
5181
5167
  return {
5182
5168
  type: "client_credentials",
5183
- clientId: process.env.ZAPIER_CREDENTIALS_CLIENT_ID,
5184
- clientSecret: process.env.ZAPIER_CREDENTIALS_CLIENT_SECRET,
5169
+ clientId: globalThis.process?.env?.ZAPIER_CREDENTIALS_CLIENT_ID,
5170
+ clientSecret: globalThis.process?.env?.ZAPIER_CREDENTIALS_CLIENT_SECRET,
5185
5171
  baseUrl: resolvedBaseUrl,
5186
- scope: process.env.ZAPIER_CREDENTIALS_SCOPE
5172
+ scope: globalThis.process?.env?.ZAPIER_CREDENTIALS_SCOPE
5187
5173
  };
5188
5174
  } else {
5189
5175
  return {
5190
5176
  type: "pkce",
5191
- clientId: process.env.ZAPIER_CREDENTIALS_CLIENT_ID,
5177
+ clientId: globalThis.process?.env?.ZAPIER_CREDENTIALS_CLIENT_ID,
5192
5178
  baseUrl: resolvedBaseUrl,
5193
- scope: process.env.ZAPIER_CREDENTIALS_SCOPE
5179
+ scope: globalThis.process?.env?.ZAPIER_CREDENTIALS_SCOPE
5194
5180
  };
5195
5181
  }
5196
5182
  }
5197
- if (process.env.ZAPIER_TOKEN) {
5183
+ if (globalThis.process?.env?.ZAPIER_TOKEN) {
5198
5184
  logDeprecation(
5199
5185
  "ZAPIER_TOKEN is deprecated. Use ZAPIER_CREDENTIALS instead."
5200
5186
  );
5201
- return process.env.ZAPIER_TOKEN;
5187
+ return globalThis.process?.env?.ZAPIER_TOKEN;
5202
5188
  }
5203
- if (process.env.ZAPIER_AUTH_CLIENT_ID) {
5189
+ if (globalThis.process?.env?.ZAPIER_AUTH_CLIENT_ID) {
5204
5190
  logDeprecation(
5205
5191
  "ZAPIER_AUTH_CLIENT_ID is deprecated. Use ZAPIER_CREDENTIALS_CLIENT_ID instead."
5206
5192
  );
5207
- if (process.env.ZAPIER_AUTH_BASE_URL) {
5193
+ if (globalThis.process?.env?.ZAPIER_AUTH_BASE_URL) {
5208
5194
  logDeprecation(
5209
5195
  "ZAPIER_AUTH_BASE_URL is deprecated. Use ZAPIER_CREDENTIALS_BASE_URL instead."
5210
5196
  );
5211
5197
  }
5212
- const resolvedBaseUrl = process.env.ZAPIER_AUTH_BASE_URL || deriveAuthBaseUrl(sdkBaseUrl);
5198
+ const resolvedBaseUrl = globalThis.process?.env?.ZAPIER_AUTH_BASE_URL || deriveAuthBaseUrl(sdkBaseUrl);
5213
5199
  return {
5214
5200
  type: "pkce",
5215
- clientId: process.env.ZAPIER_AUTH_CLIENT_ID,
5201
+ clientId: globalThis.process?.env?.ZAPIER_AUTH_CLIENT_ID,
5216
5202
  baseUrl: resolvedBaseUrl
5217
5203
  };
5218
5204
  }
@@ -5384,17 +5370,23 @@ async function getCliLogin() {
5384
5370
  return cachedCliLogin || void 0;
5385
5371
  }
5386
5372
  try {
5387
- cachedCliLogin = await import('@zapier/zapier-sdk-cli/login');
5388
- return cachedCliLogin;
5373
+ const mod = await import('@zapier/zapier-sdk-cli/login');
5374
+ if (typeof mod.getToken === "function") {
5375
+ cachedCliLogin = mod;
5376
+ return cachedCliLogin;
5377
+ }
5389
5378
  } catch {
5390
5379
  }
5391
5380
  try {
5392
- cachedCliLogin = await import('@zapier/zapier-sdk-cli-login');
5393
- return cachedCliLogin;
5381
+ const mod = await import('@zapier/zapier-sdk-cli-login');
5382
+ if (typeof mod.getToken === "function") {
5383
+ cachedCliLogin = mod;
5384
+ return cachedCliLogin;
5385
+ }
5394
5386
  } catch {
5395
- cachedCliLogin = false;
5396
- return void 0;
5397
5387
  }
5388
+ cachedCliLogin = false;
5389
+ return void 0;
5398
5390
  }
5399
5391
  function injectCliLogin(module) {
5400
5392
  cachedCliLogin = module;
@@ -5922,6 +5914,8 @@ var apiPlugin = (params) => {
5922
5914
  }
5923
5915
  };
5924
5916
  };
5917
+
5918
+ // src/utils/batch-utils.ts
5925
5919
  var DEFAULT_CONCURRENCY = 10;
5926
5920
  var BATCH_START_DELAY_MS = 25;
5927
5921
  var DEFAULT_BATCH_TIMEOUT_MS = 18e4;
@@ -5957,7 +5951,7 @@ async function batch(tasks, options = {}) {
5957
5951
  try {
5958
5952
  let result;
5959
5953
  if (taskTimeoutMs !== void 0) {
5960
- const timeoutPromise = promises.setTimeout(taskTimeoutMs).then(() => {
5954
+ const timeoutPromise = sleep(taskTimeoutMs).then(() => {
5961
5955
  throw new ZapierTimeoutError(
5962
5956
  `Task timed out after ${taskTimeoutMs}ms`
5963
5957
  );
@@ -5972,7 +5966,7 @@ async function batch(tasks, options = {}) {
5972
5966
  const isTimeout = error instanceof ZapierTimeoutError;
5973
5967
  if (retry && !isTimeout && newErrorCount < MAX_CONSECUTIVE_ERRORS) {
5974
5968
  const waitTime = calculateErrorBackoffMs(1e3, newErrorCount);
5975
- await promises.setTimeout(waitTime);
5969
+ await sleep(waitTime);
5976
5970
  taskQueue.push({
5977
5971
  index,
5978
5972
  task,
@@ -5995,7 +5989,7 @@ async function batch(tasks, options = {}) {
5995
5989
  if (!taskState) break;
5996
5990
  await executeTask(taskState);
5997
5991
  if (taskQueue.length > 0 && batchDelay > 0) {
5998
- await promises.setTimeout(batchDelay);
5992
+ await sleep(batchDelay);
5999
5993
  }
6000
5994
  }
6001
5995
  }
@@ -6004,7 +5998,7 @@ async function batch(tasks, options = {}) {
6004
5998
  for (let i = 0; i < workerCount; i++) {
6005
5999
  workers.push(worker());
6006
6000
  if (i < workerCount - 1 && batchDelay > 0) {
6007
- await promises.setTimeout(batchDelay / 10);
6001
+ await sleep(batchDelay / 10);
6008
6002
  }
6009
6003
  }
6010
6004
  await Promise.all(workers);
@@ -6058,8 +6052,7 @@ var GATED_FLAGS = [
6058
6052
  "canDeleteTables"
6059
6053
  ];
6060
6054
  function isEnabledByEnv(key) {
6061
- if (typeof process === "undefined") return void 0;
6062
- const value = process.env[toEnvVar(key)];
6055
+ const value = globalThis.process?.env?.[toEnvVar(key)];
6063
6056
  if (value === void 0) return void 0;
6064
6057
  if (value === "true" || value === "1") return true;
6065
6058
  if (value === "false" || value === "0") return false;
@@ -7857,6 +7850,14 @@ function createTransport(config) {
7857
7850
  return createNoopTransport();
7858
7851
  }
7859
7852
  }
7853
+
7854
+ // src/plugins/eventEmission/utils.ts
7855
+ var osModule = null;
7856
+ try {
7857
+ osModule = __require("os");
7858
+ } catch {
7859
+ osModule = null;
7860
+ }
7860
7861
  function generateEventId() {
7861
7862
  return crypto.randomUUID();
7862
7863
  }
@@ -7864,65 +7865,65 @@ function getCurrentTimestamp() {
7864
7865
  return Date.now();
7865
7866
  }
7866
7867
  function getReleaseId() {
7867
- return process?.env?.SDK_RELEASE_ID || "development";
7868
+ return globalThis.process?.env?.SDK_RELEASE_ID || "development";
7868
7869
  }
7869
7870
  function getOsInfo() {
7871
+ if (!osModule) {
7872
+ return { platform: null, release: null, architecture: null };
7873
+ }
7870
7874
  try {
7871
7875
  return {
7872
- platform: os__namespace.platform() || null,
7873
- release: os__namespace.release() || null,
7874
- architecture: os__namespace.arch() || null
7876
+ platform: osModule.platform() || null,
7877
+ release: osModule.release() || null,
7878
+ architecture: osModule.arch() || null
7875
7879
  };
7876
7880
  } catch {
7877
- return {
7878
- platform: null,
7879
- release: null,
7880
- architecture: null
7881
- };
7881
+ return { platform: null, release: null, architecture: null };
7882
7882
  }
7883
7883
  }
7884
7884
  function getPlatformVersions() {
7885
7885
  const versions = {};
7886
- if (typeof process?.versions === "object") {
7887
- for (const [key, value] of Object.entries(process.versions)) {
7886
+ if (typeof globalThis.process?.versions === "object") {
7887
+ for (const [key, value] of Object.entries(globalThis.process.versions)) {
7888
7888
  versions[key] = value || null;
7889
7889
  }
7890
7890
  }
7891
7891
  return versions;
7892
7892
  }
7893
7893
  function isCi() {
7894
- return !!(process?.env?.CI || process?.env?.CONTINUOUS_INTEGRATION || process?.env?.GITHUB_ACTIONS || process?.env?.JENKINS_URL || process?.env?.GITLAB_CI || process?.env?.CIRCLECI || process?.env?.TRAVIS || process?.env?.BUILDKITE || process?.env?.DRONE || process?.env?.BITBUCKET_PIPELINES_UUID);
7894
+ return !!(globalThis.process?.env?.CI || globalThis.process?.env?.CONTINUOUS_INTEGRATION || globalThis.process?.env?.GITHUB_ACTIONS || globalThis.process?.env?.JENKINS_URL || globalThis.process?.env?.GITLAB_CI || globalThis.process?.env?.CIRCLECI || globalThis.process?.env?.TRAVIS || globalThis.process?.env?.BUILDKITE || globalThis.process?.env?.DRONE || globalThis.process?.env?.BITBUCKET_PIPELINES_UUID);
7895
7895
  }
7896
7896
  function getCiPlatform() {
7897
- if (process?.env?.GITHUB_ACTIONS) return "github-actions";
7898
- if (process?.env?.JENKINS_URL) return "jenkins";
7899
- if (process?.env?.GITLAB_CI) return "gitlab-ci";
7900
- if (process?.env?.CIRCLECI) return "circleci";
7901
- if (process?.env?.TRAVIS) return "travis";
7902
- if (process?.env?.BUILDKITE) return "buildkite";
7903
- if (process?.env?.DRONE) return "drone";
7904
- if (process?.env?.BITBUCKET_PIPELINES_UUID) return "bitbucket-pipelines";
7905
- if (process?.env?.CI || process?.env?.CONTINUOUS_INTEGRATION)
7897
+ if (globalThis.process?.env?.GITHUB_ACTIONS) return "github-actions";
7898
+ if (globalThis.process?.env?.JENKINS_URL) return "jenkins";
7899
+ if (globalThis.process?.env?.GITLAB_CI) return "gitlab-ci";
7900
+ if (globalThis.process?.env?.CIRCLECI) return "circleci";
7901
+ if (globalThis.process?.env?.TRAVIS) return "travis";
7902
+ if (globalThis.process?.env?.BUILDKITE) return "buildkite";
7903
+ if (globalThis.process?.env?.DRONE) return "drone";
7904
+ if (globalThis.process?.env?.BITBUCKET_PIPELINES_UUID)
7905
+ return "bitbucket-pipelines";
7906
+ if (globalThis.process?.env?.CI || globalThis.process?.env?.CONTINUOUS_INTEGRATION)
7906
7907
  return "unknown-ci";
7907
7908
  return null;
7908
7909
  }
7909
7910
  function getMemoryUsage() {
7910
- if (process?.memoryUsage) {
7911
- const usage = process.memoryUsage();
7911
+ if (globalThis.process?.memoryUsage) {
7912
+ const usage = globalThis.process.memoryUsage();
7912
7913
  return usage.rss || null;
7913
7914
  }
7914
7915
  return null;
7915
7916
  }
7916
7917
  function getCpuTime() {
7917
- if (process?.cpuUsage) {
7918
- const usage = process.cpuUsage();
7918
+ if (globalThis.process?.cpuUsage) {
7919
+ const usage = globalThis.process.cpuUsage();
7919
7920
  return Math.round((usage.user + usage.system) / 1e3);
7920
7921
  }
7921
7922
  return null;
7922
7923
  }
7923
7924
 
7924
7925
  // src/plugins/eventEmission/builders.ts
7925
- var SDK_VERSION = "0.40.2";
7926
+ var SDK_VERSION = globalThis.process?.env?.SDK_VERSION || "unknown";
7926
7927
  function createBaseEvent(context = {}) {
7927
7928
  return {
7928
7929
  event_id: generateEventId(),
@@ -7963,12 +7964,12 @@ function buildApplicationLifecycleEvent(data, context = {}) {
7963
7964
  os_release: osInfo.release,
7964
7965
  os_architecture: osInfo.architecture,
7965
7966
  platform_versions: platformVersions,
7966
- environment: context.environment ?? (process.env.NODE_ENV || null),
7967
+ environment: context.environment ?? (globalThis.process?.env?.NODE_ENV || null),
7967
7968
  is_ci_environment: isCi(),
7968
7969
  ci_platform: getCiPlatform(),
7969
7970
  session_id: null,
7970
7971
  metadata: null,
7971
- process_argv: process.argv || null,
7972
+ process_argv: globalThis.process?.argv || null,
7972
7973
  ...data,
7973
7974
  sdk_version: SDK_VERSION
7974
7975
  };
@@ -7982,7 +7983,7 @@ function buildErrorEventWithContext(data, context = {}) {
7982
7983
  selected_api: context.selected_api,
7983
7984
  app_id: context.app_id,
7984
7985
  app_version_id: context.app_version_id,
7985
- environment: context.environment ?? (process.env.NODE_ENV || null),
7986
+ environment: context.environment ?? (globalThis.process?.env?.NODE_ENV || null),
7986
7987
  execution_time_before_error_ms: executionTime,
7987
7988
  ...data,
7988
7989
  sdk_version: SDK_VERSION
@@ -8035,7 +8036,10 @@ function removeExistingListeners() {
8035
8036
  for (const event of events) {
8036
8037
  const listener = registeredListeners[event];
8037
8038
  if (listener) {
8038
- process.removeListener(event, listener);
8039
+ globalThis.process?.removeListener(
8040
+ event,
8041
+ listener
8042
+ );
8039
8043
  }
8040
8044
  }
8041
8045
  registeredListeners = {};
@@ -8081,14 +8085,14 @@ async function silentEmit(transport, subject, event, userContextPromise) {
8081
8085
  }
8082
8086
  }
8083
8087
  function getTransportConfig(options) {
8084
- const envTransport = process?.env?.ZAPIER_SDK_TELEMETRY_TRANSPORT;
8088
+ const envTransport = globalThis.process?.env?.ZAPIER_SDK_TELEMETRY_TRANSPORT;
8085
8089
  if (envTransport === "noop" || envTransport === "disabled") {
8086
8090
  return { type: "noop" };
8087
8091
  }
8088
8092
  if (envTransport === "console") {
8089
8093
  return { type: "console" };
8090
8094
  }
8091
- const endpoint = process?.env?.ZAPIER_SDK_TELEMETRY_ENDPOINT || `${getTrackingBaseUrl({
8095
+ const endpoint = globalThis.process?.env?.ZAPIER_SDK_TELEMETRY_ENDPOINT || `${getTrackingBaseUrl({
8092
8096
  trackingBaseUrl: options?.trackingBaseUrl,
8093
8097
  baseUrl: options?.baseUrl
8094
8098
  })}/api/v4/tracking/event/`;
@@ -8107,7 +8111,7 @@ var eventEmissionPlugin = ({ context }) => {
8107
8111
  callContext: context.options.eventEmission?.callContext,
8108
8112
  transport: (
8109
8113
  // If env var is set, use it (defaultTransport will be from env)
8110
- process?.env?.ZAPIER_SDK_TELEMETRY_TRANSPORT ? defaultTransport : (
8114
+ globalThis.process?.env?.ZAPIER_SDK_TELEMETRY_TRANSPORT ? defaultTransport : (
8111
8115
  // Otherwise, use option transport or default
8112
8116
  context.options.eventEmission?.transport ?? defaultTransport
8113
8117
  )
@@ -8206,7 +8210,7 @@ var eventEmissionPlugin = ({ context }) => {
8206
8210
  getUserContext
8207
8211
  )
8208
8212
  );
8209
- if (typeof process?.on === "function") {
8213
+ if (typeof globalThis.process?.on === "function") {
8210
8214
  removeExistingListeners();
8211
8215
  const exitHandler = (code) => {
8212
8216
  if (closed) return;
@@ -8229,7 +8233,7 @@ var eventEmissionPlugin = ({ context }) => {
8229
8233
  );
8230
8234
  };
8231
8235
  registeredListeners.exit = exitHandler;
8232
- process.on("exit", exitHandler);
8236
+ globalThis.process.on("exit", exitHandler);
8233
8237
  const uncaughtExceptionHandler = async (error) => {
8234
8238
  let errorEvent = buildErrorEventWithContext({
8235
8239
  error_message: error.message || "Unknown error",
@@ -8252,7 +8256,7 @@ var eventEmissionPlugin = ({ context }) => {
8252
8256
  );
8253
8257
  };
8254
8258
  registeredListeners.uncaughtException = uncaughtExceptionHandler;
8255
- process.on("uncaughtException", uncaughtExceptionHandler);
8259
+ globalThis.process.on("uncaughtException", uncaughtExceptionHandler);
8256
8260
  const unhandledRejectionHandler = async (reason, promise) => {
8257
8261
  const errorMessage = reason instanceof Error ? reason.message : typeof reason === "string" ? reason : "Unhandled promise rejection";
8258
8262
  const errorStack = reason instanceof Error ? reason.stack : null;
@@ -8280,7 +8284,7 @@ var eventEmissionPlugin = ({ context }) => {
8280
8284
  );
8281
8285
  };
8282
8286
  registeredListeners.unhandledRejection = unhandledRejectionHandler;
8283
- process.on("unhandledRejection", unhandledRejectionHandler);
8287
+ globalThis.process.on("unhandledRejection", unhandledRejectionHandler);
8284
8288
  const handleSignal = async (signal) => {
8285
8289
  shutdownStartTime = Date.now();
8286
8290
  const uptime = Date.now() - startupTime;
@@ -8301,14 +8305,14 @@ var eventEmissionPlugin = ({ context }) => {
8301
8305
  signalEvent
8302
8306
  );
8303
8307
  const exitCode = signal === "SIGINT" ? 130 : 143;
8304
- process.exit(exitCode);
8308
+ globalThis.process.exit(exitCode);
8305
8309
  };
8306
8310
  const sigintHandler = () => handleSignal("SIGINT");
8307
8311
  const sigtermHandler = () => handleSignal("SIGTERM");
8308
8312
  registeredListeners.SIGINT = sigintHandler;
8309
8313
  registeredListeners.SIGTERM = sigtermHandler;
8310
- process.on("SIGINT", sigintHandler);
8311
- process.on("SIGTERM", sigtermHandler);
8314
+ globalThis.process.on("SIGINT", sigintHandler);
8315
+ globalThis.process.on("SIGTERM", sigtermHandler);
8312
8316
  }
8313
8317
  }
8314
8318
  const close = async (exitCode) => {
package/dist/index.d.mts CHANGED
@@ -1362,6 +1362,7 @@ declare const FindFirstConnectionSchema: z.ZodObject<{
1362
1362
  accountId: z.ZodOptional<z.ZodString>;
1363
1363
  includeShared: z.ZodOptional<z.ZodBoolean>;
1364
1364
  isExpired: z.ZodOptional<z.ZodBoolean>;
1365
+ expired: z.ZodOptional<z.ZodBoolean>;
1365
1366
  }, z.core.$strip>;
1366
1367
  type FindFirstConnectionOptions = z.infer<typeof FindFirstConnectionSchema>;
1367
1368
 
@@ -1379,6 +1380,7 @@ declare const FindUniqueConnectionSchema: z.ZodObject<{
1379
1380
  accountId: z.ZodOptional<z.ZodString>;
1380
1381
  includeShared: z.ZodOptional<z.ZodBoolean>;
1381
1382
  isExpired: z.ZodOptional<z.ZodBoolean>;
1383
+ expired: z.ZodOptional<z.ZodBoolean>;
1382
1384
  }, z.core.$strip>;
1383
1385
  type FindUniqueConnectionOptions = z.infer<typeof FindUniqueConnectionSchema>;
1384
1386
 
@@ -1951,6 +1953,7 @@ declare const ListConnectionsQuerySchema: z.ZodObject<{
1951
1953
  accountId: z.ZodOptional<z.ZodString>;
1952
1954
  includeShared: z.ZodOptional<z.ZodBoolean>;
1953
1955
  isExpired: z.ZodOptional<z.ZodBoolean>;
1956
+ expired: z.ZodOptional<z.ZodBoolean>;
1954
1957
  pageSize: z.ZodOptional<z.ZodNumber>;
1955
1958
  maxItems: z.ZodOptional<z.ZodNumber>;
1956
1959
  cursor: z.ZodOptional<z.ZodString>;