@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.
- package/CHANGELOG.md +12 -0
- package/README.md +3 -3
- package/dist/api/polling.js +3 -4
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +14 -7
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -2
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +21 -19
- package/dist/index.cjs +105 -101
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +105 -81
- package/dist/plugins/capabilities/index.d.ts.map +1 -1
- package/dist/plugins/capabilities/index.js +1 -3
- package/dist/plugins/eventEmission/builders.d.ts.map +1 -1
- package/dist/plugins/eventEmission/builders.js +4 -4
- package/dist/plugins/eventEmission/index.d.ts.map +1 -1
- package/dist/plugins/eventEmission/index.js +11 -11
- package/dist/plugins/eventEmission/utils.d.ts.map +1 -1
- package/dist/plugins/eventEmission/utils.js +43 -36
- package/dist/plugins/findFirstConnection/schemas.d.ts +1 -0
- package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/schemas.d.ts +1 -0
- package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +5 -0
- package/dist/plugins/listConnections/schemas.d.ts +1 -0
- package/dist/plugins/listConnections/schemas.d.ts.map +1 -1
- package/dist/plugins/listConnections/schemas.js +13 -2
- package/dist/utils/batch-utils.d.ts.map +1 -1
- package/dist/utils/batch-utils.js +5 -6
- package/dist/utils/url-utils.js +2 -2
- package/package.json +6 -2
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
* Simple utility functions for event emission
|
|
3
3
|
* These are pure functions that can be used to populate common event fields
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
// Intentional dynamic require for browser compatibility. The os module is only
|
|
6
|
+
// available in Node; in browser environments this gracefully falls back to nulls.
|
|
7
|
+
let osModule = null;
|
|
8
|
+
try {
|
|
9
|
+
osModule = require("os");
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
osModule = null;
|
|
13
|
+
}
|
|
6
14
|
/**
|
|
7
15
|
* Generate a unique event ID
|
|
8
16
|
*/
|
|
@@ -19,26 +27,24 @@ export function getCurrentTimestamp() {
|
|
|
19
27
|
* Get release ID (git SHA) - in production this would come from build process
|
|
20
28
|
*/
|
|
21
29
|
export function getReleaseId() {
|
|
22
|
-
return process?.env?.SDK_RELEASE_ID || "development";
|
|
30
|
+
return globalThis.process?.env?.SDK_RELEASE_ID || "development";
|
|
23
31
|
}
|
|
24
32
|
/**
|
|
25
33
|
* Get operating system information
|
|
26
34
|
*/
|
|
27
35
|
export function getOsInfo() {
|
|
36
|
+
if (!osModule) {
|
|
37
|
+
return { platform: null, release: null, architecture: null };
|
|
38
|
+
}
|
|
28
39
|
try {
|
|
29
40
|
return {
|
|
30
|
-
platform:
|
|
31
|
-
release:
|
|
32
|
-
architecture:
|
|
41
|
+
platform: osModule.platform() || null,
|
|
42
|
+
release: osModule.release() || null,
|
|
43
|
+
architecture: osModule.arch() || null,
|
|
33
44
|
};
|
|
34
45
|
}
|
|
35
46
|
catch {
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
platform: null,
|
|
39
|
-
release: null,
|
|
40
|
-
architecture: null,
|
|
41
|
-
};
|
|
47
|
+
return { platform: null, release: null, architecture: null };
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
/**
|
|
@@ -46,8 +52,8 @@ export function getOsInfo() {
|
|
|
46
52
|
*/
|
|
47
53
|
export function getPlatformVersions() {
|
|
48
54
|
const versions = {};
|
|
49
|
-
if (typeof process?.versions === "object") {
|
|
50
|
-
for (const [key, value] of Object.entries(process.versions)) {
|
|
55
|
+
if (typeof globalThis.process?.versions === "object") {
|
|
56
|
+
for (const [key, value] of Object.entries(globalThis.process.versions)) {
|
|
51
57
|
versions[key] = value || null;
|
|
52
58
|
}
|
|
53
59
|
}
|
|
@@ -57,38 +63,39 @@ export function getPlatformVersions() {
|
|
|
57
63
|
* Check if running in CI environment
|
|
58
64
|
*/
|
|
59
65
|
export function isCi() {
|
|
60
|
-
return !!(process?.env?.CI ||
|
|
61
|
-
process?.env?.CONTINUOUS_INTEGRATION ||
|
|
62
|
-
process?.env?.GITHUB_ACTIONS ||
|
|
63
|
-
process?.env?.JENKINS_URL ||
|
|
64
|
-
process?.env?.GITLAB_CI ||
|
|
65
|
-
process?.env?.CIRCLECI ||
|
|
66
|
-
process?.env?.TRAVIS ||
|
|
67
|
-
process?.env?.BUILDKITE ||
|
|
68
|
-
process?.env?.DRONE ||
|
|
69
|
-
process?.env?.BITBUCKET_PIPELINES_UUID);
|
|
66
|
+
return !!(globalThis.process?.env?.CI ||
|
|
67
|
+
globalThis.process?.env?.CONTINUOUS_INTEGRATION ||
|
|
68
|
+
globalThis.process?.env?.GITHUB_ACTIONS ||
|
|
69
|
+
globalThis.process?.env?.JENKINS_URL ||
|
|
70
|
+
globalThis.process?.env?.GITLAB_CI ||
|
|
71
|
+
globalThis.process?.env?.CIRCLECI ||
|
|
72
|
+
globalThis.process?.env?.TRAVIS ||
|
|
73
|
+
globalThis.process?.env?.BUILDKITE ||
|
|
74
|
+
globalThis.process?.env?.DRONE ||
|
|
75
|
+
globalThis.process?.env?.BITBUCKET_PIPELINES_UUID);
|
|
70
76
|
}
|
|
71
77
|
/**
|
|
72
78
|
* Get CI platform name if running in CI
|
|
73
79
|
*/
|
|
74
80
|
export function getCiPlatform() {
|
|
75
|
-
if (process?.env?.GITHUB_ACTIONS)
|
|
81
|
+
if (globalThis.process?.env?.GITHUB_ACTIONS)
|
|
76
82
|
return "github-actions";
|
|
77
|
-
if (process?.env?.JENKINS_URL)
|
|
83
|
+
if (globalThis.process?.env?.JENKINS_URL)
|
|
78
84
|
return "jenkins";
|
|
79
|
-
if (process?.env?.GITLAB_CI)
|
|
85
|
+
if (globalThis.process?.env?.GITLAB_CI)
|
|
80
86
|
return "gitlab-ci";
|
|
81
|
-
if (process?.env?.CIRCLECI)
|
|
87
|
+
if (globalThis.process?.env?.CIRCLECI)
|
|
82
88
|
return "circleci";
|
|
83
|
-
if (process?.env?.TRAVIS)
|
|
89
|
+
if (globalThis.process?.env?.TRAVIS)
|
|
84
90
|
return "travis";
|
|
85
|
-
if (process?.env?.BUILDKITE)
|
|
91
|
+
if (globalThis.process?.env?.BUILDKITE)
|
|
86
92
|
return "buildkite";
|
|
87
|
-
if (process?.env?.DRONE)
|
|
93
|
+
if (globalThis.process?.env?.DRONE)
|
|
88
94
|
return "drone";
|
|
89
|
-
if (process?.env?.BITBUCKET_PIPELINES_UUID)
|
|
95
|
+
if (globalThis.process?.env?.BITBUCKET_PIPELINES_UUID)
|
|
90
96
|
return "bitbucket-pipelines";
|
|
91
|
-
if (process?.env?.CI ||
|
|
97
|
+
if (globalThis.process?.env?.CI ||
|
|
98
|
+
globalThis.process?.env?.CONTINUOUS_INTEGRATION)
|
|
92
99
|
return "unknown-ci";
|
|
93
100
|
return null;
|
|
94
101
|
}
|
|
@@ -96,8 +103,8 @@ export function getCiPlatform() {
|
|
|
96
103
|
* Get memory usage in bytes
|
|
97
104
|
*/
|
|
98
105
|
export function getMemoryUsage() {
|
|
99
|
-
if (process?.memoryUsage) {
|
|
100
|
-
const usage = process.memoryUsage();
|
|
106
|
+
if (globalThis.process?.memoryUsage) {
|
|
107
|
+
const usage = globalThis.process.memoryUsage();
|
|
101
108
|
return usage.rss || null; // Resident Set Size
|
|
102
109
|
}
|
|
103
110
|
return null;
|
|
@@ -106,8 +113,8 @@ export function getMemoryUsage() {
|
|
|
106
113
|
* Get CPU time in milliseconds
|
|
107
114
|
*/
|
|
108
115
|
export function getCpuTime() {
|
|
109
|
-
if (process?.cpuUsage) {
|
|
110
|
-
const usage = process.cpuUsage();
|
|
116
|
+
if (globalThis.process?.cpuUsage) {
|
|
117
|
+
const usage = globalThis.process.cpuUsage();
|
|
111
118
|
return Math.round((usage.user + usage.system) / 1000); // Convert to milliseconds
|
|
112
119
|
}
|
|
113
120
|
return null;
|
|
@@ -15,6 +15,7 @@ export declare const FindFirstConnectionSchema: z.ZodObject<{
|
|
|
15
15
|
accountId: z.ZodOptional<z.ZodString>;
|
|
16
16
|
includeShared: z.ZodOptional<z.ZodBoolean>;
|
|
17
17
|
isExpired: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
expired: z.ZodOptional<z.ZodBoolean>;
|
|
18
19
|
}, z.core.$strip>;
|
|
19
20
|
export type FindFirstConnectionOptions = z.infer<typeof FindFirstConnectionSchema>;
|
|
20
21
|
export type FindFirstConnectionError = ZapierAuthenticationError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstConnection/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstConnection/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;iBAOwB,CAAC;AAG/D,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,yBAAyB,CACjC,CAAC;AAGF,MAAM,MAAM,wBAAwB,GAChC,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,8BAA8B;IAC7C,mBAAmB,EAAE,CACnB,OAAO,CAAC,EAAE,0BAA0B,KACjC,OAAO,CAAC;QAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CAC/C"}
|
|
@@ -15,6 +15,7 @@ export declare const FindUniqueConnectionSchema: z.ZodObject<{
|
|
|
15
15
|
accountId: z.ZodOptional<z.ZodString>;
|
|
16
16
|
includeShared: z.ZodOptional<z.ZodBoolean>;
|
|
17
17
|
isExpired: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
expired: z.ZodOptional<z.ZodBoolean>;
|
|
18
19
|
}, z.core.$strip>;
|
|
19
20
|
export type FindUniqueConnectionOptions = z.infer<typeof FindUniqueConnectionSchema>;
|
|
20
21
|
export type FindUniqueConnectionError = ZapierAuthenticationError | ZapierApiError | ZapierResourceNotFoundError | ZapierValidationError | ZapierUnknownError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueConnection/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueConnection/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAA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MAAM,gBAAgB,CAAC;AAEhE,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,CACf,OAAO,CAAC,EAAE,sBAAsB,KAC7B,OAAO,CAAC,mBAAmB,CAAC,GAC/B,aAAa,CAAC,mBAAmB,CAAC,GAAG;QACnC,KAAK,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;KACxC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,eAAe,EAAE;gBACf,WAAW,EAAE,OAAO,0BAA0B,CAAC;aAChD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CACxC,UAAU,CAAC,sBAAsB,CAAC,EAClC;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,GACtB,mBAAmB,GACnB,yBAAyB,CAAC,SAAS,CAAC,EACtC,6BAA6B,CA0I9B,CAAC"}
|
|
@@ -68,9 +68,14 @@ export const listConnectionsPlugin = ({ context }) => {
|
|
|
68
68
|
if (owner) {
|
|
69
69
|
searchParams.owner = owner;
|
|
70
70
|
}
|
|
71
|
+
// isExpired takes priority when explicitly set. Otherwise expired defaults to false,
|
|
72
|
+
// meaning only non-expired connections are returned unless the caller opts in.
|
|
71
73
|
if (options.isExpired !== undefined) {
|
|
72
74
|
searchParams.is_expired = options.isExpired.toString();
|
|
73
75
|
}
|
|
76
|
+
else {
|
|
77
|
+
searchParams.is_expired = (options.expired ?? false).toString();
|
|
78
|
+
}
|
|
74
79
|
if (options.cursor) {
|
|
75
80
|
searchParams.offset = options.cursor;
|
|
76
81
|
}
|
|
@@ -19,6 +19,7 @@ export declare const ListConnectionsQuerySchema: z.ZodObject<{
|
|
|
19
19
|
accountId: z.ZodOptional<z.ZodString>;
|
|
20
20
|
includeShared: z.ZodOptional<z.ZodBoolean>;
|
|
21
21
|
isExpired: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
expired: z.ZodOptional<z.ZodBoolean>;
|
|
22
23
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
23
24
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
24
25
|
cursor: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listConnections/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAErF,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listConnections/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAErF,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;iBAoF0B,CAAC;AAGlE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAGhF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,oBAAoB,GAC5B,yBAAyB,GACzB,cAAc,GACd,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,oBAAoB,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;CAC/E"}
|
|
@@ -43,8 +43,19 @@ export const ListConnectionsQuerySchema = ListConnectionsQueryBase.omit({
|
|
|
43
43
|
.boolean()
|
|
44
44
|
.optional()
|
|
45
45
|
.describe("Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections."),
|
|
46
|
-
|
|
47
|
-
isExpired: z
|
|
46
|
+
/** @deprecated Use `expired` instead */
|
|
47
|
+
isExpired: z
|
|
48
|
+
.boolean()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe("Filter by expired status")
|
|
51
|
+
.meta({
|
|
52
|
+
deprecated: true,
|
|
53
|
+
deprecationMessage: "Use --expired instead to show only expired connections.",
|
|
54
|
+
}),
|
|
55
|
+
expired: z
|
|
56
|
+
.boolean()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe("Show only expired connections (default: only non-expired connections are returned)"),
|
|
48
59
|
// Override pageSize to make optional
|
|
49
60
|
pageSize: z
|
|
50
61
|
.number()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-utils.d.ts","sourceRoot":"","sources":["../../src/utils/batch-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"batch-utils.d.ts","sourceRoot":"","sources":["../../src/utils/batch-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2BH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAC3B,KAAK,EAAE,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EAC3B,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,CAuIpC"}
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* This module provides utilities for executing multiple async operations
|
|
5
5
|
* with concurrency control and retry logic.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import { calculateErrorBackoffMs, MAX_CONSECUTIVE_ERRORS } from "./retry-utils";
|
|
7
|
+
import { sleep, calculateErrorBackoffMs, MAX_CONSECUTIVE_ERRORS, } from "./retry-utils";
|
|
9
8
|
import { ZapierTimeoutError } from "../types/errors";
|
|
10
9
|
/**
|
|
11
10
|
* Default number of concurrent operations
|
|
@@ -88,7 +87,7 @@ export async function batch(tasks, options = {}) {
|
|
|
88
87
|
let result;
|
|
89
88
|
// Apply per-task timeout if specified
|
|
90
89
|
if (taskTimeoutMs !== undefined) {
|
|
91
|
-
const timeoutPromise =
|
|
90
|
+
const timeoutPromise = sleep(taskTimeoutMs).then(() => {
|
|
92
91
|
throw new ZapierTimeoutError(`Task timed out after ${taskTimeoutMs}ms`);
|
|
93
92
|
});
|
|
94
93
|
result = await Promise.race([task(), timeoutPromise]);
|
|
@@ -106,7 +105,7 @@ export async function batch(tasks, options = {}) {
|
|
|
106
105
|
if (retry && !isTimeout && newErrorCount < MAX_CONSECUTIVE_ERRORS) {
|
|
107
106
|
// Calculate backoff delay (base 1000ms with jitter and error scaling)
|
|
108
107
|
const waitTime = calculateErrorBackoffMs(1000, newErrorCount);
|
|
109
|
-
await
|
|
108
|
+
await sleep(waitTime);
|
|
110
109
|
// Re-queue the task with incremented error count
|
|
111
110
|
taskQueue.push({
|
|
112
111
|
index,
|
|
@@ -138,7 +137,7 @@ export async function batch(tasks, options = {}) {
|
|
|
138
137
|
// Small delay to prevent burst patterns within a worker
|
|
139
138
|
// Only delay if there are more tasks to process
|
|
140
139
|
if (taskQueue.length > 0 && batchDelay > 0) {
|
|
141
|
-
await
|
|
140
|
+
await sleep(batchDelay);
|
|
142
141
|
}
|
|
143
142
|
}
|
|
144
143
|
}
|
|
@@ -153,7 +152,7 @@ export async function batch(tasks, options = {}) {
|
|
|
153
152
|
// Add small delay between starting workers to stagger the initial requests
|
|
154
153
|
// Skip delay for last worker
|
|
155
154
|
if (i < workerCount - 1 && batchDelay > 0) {
|
|
156
|
-
await
|
|
155
|
+
await sleep(batchDelay / 10); // 10ms between worker starts
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
158
|
// Wait for all workers to complete
|
package/dist/utils/url-utils.js
CHANGED
|
@@ -43,8 +43,8 @@ export function getTrackingBaseUrl({ trackingBaseUrl, baseUrl, }) {
|
|
|
43
43
|
return trackingBaseUrl;
|
|
44
44
|
}
|
|
45
45
|
// 2. Environment variable override
|
|
46
|
-
if (process
|
|
47
|
-
return process
|
|
46
|
+
if (globalThis.process?.env?.ZAPIER_TRACKING_BASE_URL) {
|
|
47
|
+
return globalThis.process?.env?.ZAPIER_TRACKING_BASE_URL;
|
|
48
48
|
}
|
|
49
49
|
// 3. Try to derive from baseUrl if it's a Zapier domain
|
|
50
50
|
if (baseUrl) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zapier/zapier-sdk",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.4",
|
|
4
4
|
"description": "Complete Zapier SDK - combines all Zapier SDK packages",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
+
"browser": {
|
|
44
|
+
"@zapier/zapier-sdk-cli/login": false,
|
|
45
|
+
"@zapier/zapier-sdk-cli-login": false
|
|
46
|
+
},
|
|
43
47
|
"files": [
|
|
44
48
|
"dist",
|
|
45
49
|
"README.md",
|
|
@@ -72,7 +76,7 @@
|
|
|
72
76
|
"@types/node": "^24.0.1",
|
|
73
77
|
"tsup": "^8.5.0",
|
|
74
78
|
"typescript": "^5.8.3",
|
|
75
|
-
"vitest": "^
|
|
79
|
+
"vitest": "^4.1.4",
|
|
76
80
|
"@zapier/zapier-sdk-cli-login": "0.9.0"
|
|
77
81
|
},
|
|
78
82
|
"scripts": {
|