@zapier/zapier-sdk 0.51.0 → 0.53.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.
- package/CHANGELOG.md +16 -0
- package/README.md +58 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +84 -7
- package/dist/api/concurrency.d.ts +28 -0
- package/dist/api/concurrency.d.ts.map +1 -0
- package/dist/api/concurrency.js +90 -0
- package/dist/api/types.d.ts +6 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/constants.d.ts +16 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +29 -0
- package/dist/experimental.cjs +261 -18
- package/dist/experimental.d.mts +56 -28
- package/dist/experimental.d.ts +28 -0
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +2 -0
- package/dist/experimental.mjs +258 -19
- package/dist/{index-C52BjTXh.d.mts → index-D2HKNk0N.d.mts} +44 -1
- package/dist/{index-C52BjTXh.d.ts → index-D2HKNk0N.d.ts} +44 -1
- package/dist/index.cjs +215 -6
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +212 -7
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/api/index.js +3 -2
- package/dist/plugins/triggers/ackTriggerInboxMessages/index.d.ts.map +1 -1
- package/dist/plugins/triggers/ackTriggerInboxMessages/index.js +2 -1
- package/dist/plugins/triggers/createTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/createTriggerInbox/index.js +1 -4
- package/dist/plugins/triggers/ensureTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/ensureTriggerInbox/index.js +1 -4
- package/dist/plugins/triggers/leaseTriggerInboxMessages/index.d.ts.map +1 -1
- package/dist/plugins/triggers/leaseTriggerInboxMessages/index.js +5 -1
- package/dist/plugins/triggers/listTriggers/index.d.ts +70 -0
- package/dist/plugins/triggers/listTriggers/index.d.ts.map +1 -0
- package/dist/plugins/triggers/listTriggers/index.js +25 -0
- package/dist/plugins/triggers/listTriggers/schemas.d.ts +11 -0
- package/dist/plugins/triggers/listTriggers/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/listTriggers/schemas.js +18 -0
- package/dist/plugins/triggers/releaseTriggerInboxMessages/index.d.ts.map +1 -1
- package/dist/plugins/triggers/releaseTriggerInboxMessages/index.js +2 -1
- package/dist/resolvers/index.d.ts +1 -0
- package/dist/resolvers/index.d.ts.map +1 -1
- package/dist/resolvers/index.js +1 -0
- package/dist/resolvers/triggerMessages.d.ts +6 -0
- package/dist/resolvers/triggerMessages.d.ts.map +1 -0
- package/dist/resolvers/triggerMessages.js +22 -0
- package/dist/types/sdk.d.ts +1 -0
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdk.js +25 -0
- package/package.json +1 -1
package/dist/experimental.cjs
CHANGED
|
@@ -150,6 +150,21 @@ 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
|
+
var MAX_CONCURRENCY_LIMIT = 1e4;
|
|
154
|
+
function parseConcurrencyEnvVar(name) {
|
|
155
|
+
const value = globalThis.process?.env?.[name];
|
|
156
|
+
if (!value) return void 0;
|
|
157
|
+
if (value === "Infinity") return Infinity;
|
|
158
|
+
if (/^[1-9]\d*$/.test(value)) {
|
|
159
|
+
const parsed = parseInt(value, 10);
|
|
160
|
+
if (parsed <= MAX_CONCURRENCY_LIMIT) return parsed;
|
|
161
|
+
}
|
|
162
|
+
console.warn(
|
|
163
|
+
`[zapier-sdk] Invalid value for ${name}: "${value}" (expected positive integer 1-${MAX_CONCURRENCY_LIMIT} or "Infinity")`
|
|
164
|
+
);
|
|
165
|
+
return void 0;
|
|
166
|
+
}
|
|
167
|
+
var ZAPIER_MAX_CONCURRENT_REQUESTS = parseConcurrencyEnvVar("ZAPIER_MAX_CONCURRENT_REQUESTS") ?? 200;
|
|
153
168
|
function getZapierApprovalMode() {
|
|
154
169
|
const value = globalThis.process?.env?.ZAPIER_APPROVAL_MODE;
|
|
155
170
|
if (value === "disabled" || value === "poll" || value === "throw")
|
|
@@ -2177,6 +2192,83 @@ async function pollUntilComplete(options) {
|
|
|
2177
2192
|
}
|
|
2178
2193
|
}
|
|
2179
2194
|
}
|
|
2195
|
+
|
|
2196
|
+
// src/api/concurrency.ts
|
|
2197
|
+
var NO_OP_RELEASE = () => {
|
|
2198
|
+
};
|
|
2199
|
+
var NO_OP_SEMAPHORE = {
|
|
2200
|
+
acquire: async () => NO_OP_RELEASE,
|
|
2201
|
+
tryAcquire: () => NO_OP_RELEASE
|
|
2202
|
+
};
|
|
2203
|
+
function createSemaphore(maxPermits) {
|
|
2204
|
+
if (maxPermits === Infinity) {
|
|
2205
|
+
return NO_OP_SEMAPHORE;
|
|
2206
|
+
}
|
|
2207
|
+
if (!Number.isInteger(maxPermits) || maxPermits <= 0) {
|
|
2208
|
+
throw new Error(
|
|
2209
|
+
`maxPermits must be a positive integer or Infinity, got: ${maxPermits}`
|
|
2210
|
+
);
|
|
2211
|
+
}
|
|
2212
|
+
let permits = maxPermits;
|
|
2213
|
+
const waiters = [];
|
|
2214
|
+
const release = () => {
|
|
2215
|
+
const next = waiters.shift();
|
|
2216
|
+
if (next) {
|
|
2217
|
+
next.grant();
|
|
2218
|
+
} else {
|
|
2219
|
+
permits++;
|
|
2220
|
+
}
|
|
2221
|
+
};
|
|
2222
|
+
const makeReleaseOnce = () => {
|
|
2223
|
+
let released = false;
|
|
2224
|
+
return () => {
|
|
2225
|
+
if (released) return;
|
|
2226
|
+
released = true;
|
|
2227
|
+
release();
|
|
2228
|
+
};
|
|
2229
|
+
};
|
|
2230
|
+
return {
|
|
2231
|
+
tryAcquire() {
|
|
2232
|
+
if (permits > 0) {
|
|
2233
|
+
permits--;
|
|
2234
|
+
return makeReleaseOnce();
|
|
2235
|
+
}
|
|
2236
|
+
return null;
|
|
2237
|
+
},
|
|
2238
|
+
async acquire(signal) {
|
|
2239
|
+
if (signal?.aborted) {
|
|
2240
|
+
throw signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
2241
|
+
}
|
|
2242
|
+
if (permits > 0) {
|
|
2243
|
+
permits--;
|
|
2244
|
+
return makeReleaseOnce();
|
|
2245
|
+
}
|
|
2246
|
+
return new Promise((resolve2, reject) => {
|
|
2247
|
+
const onAbort = () => {
|
|
2248
|
+
const idx = waiters.indexOf(waiter);
|
|
2249
|
+
if (idx !== -1) {
|
|
2250
|
+
waiters.splice(idx, 1);
|
|
2251
|
+
waiter.cancel(
|
|
2252
|
+
signal?.reason ?? new DOMException("Aborted", "AbortError")
|
|
2253
|
+
);
|
|
2254
|
+
}
|
|
2255
|
+
};
|
|
2256
|
+
const waiter = {
|
|
2257
|
+
grant: () => {
|
|
2258
|
+
signal?.removeEventListener("abort", onAbort);
|
|
2259
|
+
resolve2(makeReleaseOnce());
|
|
2260
|
+
},
|
|
2261
|
+
cancel: (reason) => {
|
|
2262
|
+
signal?.removeEventListener("abort", onAbort);
|
|
2263
|
+
reject(reason);
|
|
2264
|
+
}
|
|
2265
|
+
};
|
|
2266
|
+
signal?.addEventListener("abort", onAbort);
|
|
2267
|
+
waiters.push(waiter);
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
};
|
|
2271
|
+
}
|
|
2180
2272
|
var ClientCredentialsObjectSchema = zod.z.object({
|
|
2181
2273
|
type: zod.z.enum(["client_credentials"]).optional().meta({ internal: true }),
|
|
2182
2274
|
clientId: zod.z.string().describe("OAuth client ID for authentication.").meta({ valueHint: "id" }),
|
|
@@ -2771,7 +2863,7 @@ async function invalidateCredentialsToken(options) {
|
|
|
2771
2863
|
}
|
|
2772
2864
|
|
|
2773
2865
|
// src/sdk-version.ts
|
|
2774
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
2866
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.53.0" : void 0) || "unknown";
|
|
2775
2867
|
|
|
2776
2868
|
// src/utils/open-url.ts
|
|
2777
2869
|
var nodePrefix = "node:";
|
|
@@ -2981,9 +3073,61 @@ var ZapierApiClient = class {
|
|
|
2981
3073
|
await sleep(delayMs, init?.signal ?? void 0);
|
|
2982
3074
|
}
|
|
2983
3075
|
};
|
|
3076
|
+
/**
|
|
3077
|
+
* Wrap an outbound HTTP call with the concurrency semaphore. Used by both
|
|
3078
|
+
* `rawFetch` (path-based) and the approval-poll path (absolute URL); each
|
|
3079
|
+
* caller acquires per-attempt, so 429 retry sleep is held but the gap
|
|
3080
|
+
* between approval polls and the human-approval wait are not.
|
|
3081
|
+
*
|
|
3082
|
+
* The release is registered in a finally that wraps the entire post-
|
|
3083
|
+
* acquire flow — including the `wait_end` event emission — so a throwing
|
|
3084
|
+
* `onEvent` handler can never leak a permit.
|
|
3085
|
+
*
|
|
3086
|
+
* Slot lifetime is intentionally tied to "fetch resolves" (headers
|
|
3087
|
+
* received), NOT to "response body fully consumed". WHATWG `fetch()`
|
|
3088
|
+
* resolves once headers are in; the body is still streaming. We rely on
|
|
3089
|
+
* that boundary so streaming responses (SSE, long-running chunked reads)
|
|
3090
|
+
* don't pin a permit for the lifetime of the stream — a single SSE
|
|
3091
|
+
* consumer would otherwise hold one of N slots for as long as the
|
|
3092
|
+
* connection stays open. Do not move the release into a path that awaits
|
|
3093
|
+
* body consumption (e.g. `parseResult` / `response.text()`); doing so
|
|
3094
|
+
* would silently break streaming consumers without failing any of the
|
|
3095
|
+
* short-request tests.
|
|
3096
|
+
*/
|
|
3097
|
+
this.withSemaphore = async (context, fn) => {
|
|
3098
|
+
const fastRelease = this.semaphore.tryAcquire();
|
|
3099
|
+
let waitStart = null;
|
|
3100
|
+
let release = fastRelease;
|
|
3101
|
+
if (release === null) {
|
|
3102
|
+
waitStart = Date.now();
|
|
3103
|
+
this.emitEvent("api:concurrency_wait_start", {
|
|
3104
|
+
url: context.url,
|
|
3105
|
+
method: context.method
|
|
3106
|
+
});
|
|
3107
|
+
release = await this.semaphore.acquire(context.signal ?? void 0);
|
|
3108
|
+
}
|
|
3109
|
+
const acquiredRelease = release;
|
|
3110
|
+
try {
|
|
3111
|
+
if (waitStart !== null) {
|
|
3112
|
+
this.emitEvent("api:concurrency_wait_end", {
|
|
3113
|
+
url: context.url,
|
|
3114
|
+
method: context.method,
|
|
3115
|
+
waitedMs: Date.now() - waitStart
|
|
3116
|
+
});
|
|
3117
|
+
}
|
|
3118
|
+
return await fn();
|
|
3119
|
+
} finally {
|
|
3120
|
+
acquiredRelease();
|
|
3121
|
+
}
|
|
3122
|
+
};
|
|
2984
3123
|
/**
|
|
2985
3124
|
* Perform a request with auth, header merging, and rate-limit (429) retries.
|
|
2986
3125
|
* Does NOT handle 403 approval_required — that's routed by `fetch`.
|
|
3126
|
+
*
|
|
3127
|
+
* Concurrency: a semaphore slot is held across the entire call, including
|
|
3128
|
+
* the 429 retry sleep inside `rawFetchUrl`. That keeps backpressure
|
|
3129
|
+
* coherent — when the server is rate-limiting us, we don't dump more
|
|
3130
|
+
* parallelism into the queue.
|
|
2987
3131
|
*/
|
|
2988
3132
|
this.rawFetch = async (path, init) => {
|
|
2989
3133
|
if (!path.startsWith("/")) {
|
|
@@ -2992,7 +3136,10 @@ var ZapierApiClient = class {
|
|
|
2992
3136
|
);
|
|
2993
3137
|
}
|
|
2994
3138
|
const { url, pathConfig: pathConfig2 } = this.buildUrl(path, init?.searchParams);
|
|
2995
|
-
return this.
|
|
3139
|
+
return this.withSemaphore(
|
|
3140
|
+
{ url, method: init?.method ?? "GET", signal: init?.signal },
|
|
3141
|
+
() => this.rawFetchUrl(url, init, pathConfig2)
|
|
3142
|
+
);
|
|
2996
3143
|
};
|
|
2997
3144
|
/**
|
|
2998
3145
|
* Approval-aware HTTP fetch.
|
|
@@ -3100,6 +3247,15 @@ var ZapierApiClient = class {
|
|
|
3100
3247
|
};
|
|
3101
3248
|
this.maxNetworkRetries = options.maxNetworkRetries ?? ZAPIER_MAX_NETWORK_RETRIES;
|
|
3102
3249
|
this.maxNetworkRetryDelayMs = options.maxNetworkRetryDelayMs ?? ZAPIER_MAX_NETWORK_RETRY_DELAY_MS;
|
|
3250
|
+
const requested = options.maxConcurrentRequests;
|
|
3251
|
+
const limit = requested === void 0 || Number.isNaN(requested) ? ZAPIER_MAX_CONCURRENT_REQUESTS : requested;
|
|
3252
|
+
if (limit !== Infinity && (!Number.isInteger(limit) || limit < 1 || limit > MAX_CONCURRENCY_LIMIT)) {
|
|
3253
|
+
throw new ZapierConfigurationError(
|
|
3254
|
+
`Invalid maxConcurrentRequests: ${limit} (expected positive integer 1-${MAX_CONCURRENCY_LIMIT} or Infinity)`,
|
|
3255
|
+
{ configType: "maxConcurrentRequests" }
|
|
3256
|
+
);
|
|
3257
|
+
}
|
|
3258
|
+
this.semaphore = createSemaphore(limit);
|
|
3103
3259
|
}
|
|
3104
3260
|
// Emit an event if onEvent handler is configured
|
|
3105
3261
|
emitEvent(type, payload) {
|
|
@@ -3477,10 +3633,16 @@ var ZapierApiClient = class {
|
|
|
3477
3633
|
// poll_url is an absolute URL supplied by the server, so we use
|
|
3478
3634
|
// rawFetchUrl directly (skipping path resolution) but still share
|
|
3479
3635
|
// auth + interactive-header + 429-retry with the rest of the SDK.
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3636
|
+
// Each individual poll request goes through the concurrency
|
|
3637
|
+
// semaphore — but we deliberately do not hold a slot across the
|
|
3638
|
+
// sleep between polls or across the human-approval wait.
|
|
3639
|
+
fetchPoll: () => this.withSemaphore(
|
|
3640
|
+
{ url: approval.poll_url, method: "GET" },
|
|
3641
|
+
() => this.rawFetchUrl(approval.poll_url, {
|
|
3642
|
+
method: "GET",
|
|
3643
|
+
headers: { Accept: "application/json" }
|
|
3644
|
+
})
|
|
3645
|
+
),
|
|
3484
3646
|
timeoutMs,
|
|
3485
3647
|
isPending: (body2) => {
|
|
3486
3648
|
const parsed = PollApprovalResponseSchema.safeParse(body2);
|
|
@@ -3582,6 +3744,7 @@ var apiPlugin = definePlugin(
|
|
|
3582
3744
|
debug = false,
|
|
3583
3745
|
maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES,
|
|
3584
3746
|
maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS,
|
|
3747
|
+
maxConcurrentRequests = ZAPIER_MAX_CONCURRENT_REQUESTS,
|
|
3585
3748
|
approvalTimeoutMs,
|
|
3586
3749
|
maxApprovalRetries,
|
|
3587
3750
|
approvalMode,
|
|
@@ -3596,6 +3759,7 @@ var apiPlugin = definePlugin(
|
|
|
3596
3759
|
onEvent,
|
|
3597
3760
|
maxNetworkRetries,
|
|
3598
3761
|
maxNetworkRetryDelayMs,
|
|
3762
|
+
maxConcurrentRequests,
|
|
3599
3763
|
approvalTimeoutMs,
|
|
3600
3764
|
maxApprovalRetries,
|
|
3601
3765
|
approvalMode,
|
|
@@ -4058,6 +4222,29 @@ var triggerInboxResolver = {
|
|
|
4058
4222
|
}))
|
|
4059
4223
|
})
|
|
4060
4224
|
};
|
|
4225
|
+
|
|
4226
|
+
// src/resolvers/triggerMessages.ts
|
|
4227
|
+
var triggerMessagesResolver = {
|
|
4228
|
+
type: "dynamic",
|
|
4229
|
+
depends: ["inbox"],
|
|
4230
|
+
fetch: async (sdk, params) => toIterable(
|
|
4231
|
+
sdk.listTriggerInboxMessages({
|
|
4232
|
+
inbox: params.inbox
|
|
4233
|
+
})
|
|
4234
|
+
),
|
|
4235
|
+
prompt: (messages) => ({
|
|
4236
|
+
type: "checkbox",
|
|
4237
|
+
name: "messages",
|
|
4238
|
+
message: "Select messages:",
|
|
4239
|
+
// Only leased messages are eligible to ack or release. Acked messages
|
|
4240
|
+
// are gone from the inbox already; available/quarantined ones can't be
|
|
4241
|
+
// operated on by these methods.
|
|
4242
|
+
choices: messages.filter((message) => message.status === "leased").map((message) => ({
|
|
4243
|
+
name: `${message.id} (${message.status}, lease_count: ${message.message_attributes.lease_count})`,
|
|
4244
|
+
value: message.id
|
|
4245
|
+
}))
|
|
4246
|
+
})
|
|
4247
|
+
};
|
|
4061
4248
|
function formatFieldValue(v) {
|
|
4062
4249
|
if (v == null) return "";
|
|
4063
4250
|
if (typeof v === "object") {
|
|
@@ -8851,15 +9038,13 @@ var createTriggerInboxPlugin = definePlugin(
|
|
|
8851
9038
|
subscription: {
|
|
8852
9039
|
app_key: selectedApi,
|
|
8853
9040
|
action_key: actionKey,
|
|
8854
|
-
inputs
|
|
9041
|
+
inputs,
|
|
9042
|
+
connection_id: resolvedConnectionId ?? null
|
|
8855
9043
|
}
|
|
8856
9044
|
};
|
|
8857
9045
|
if (notificationUrl !== void 0) {
|
|
8858
9046
|
requestBody.notification_url = notificationUrl;
|
|
8859
9047
|
}
|
|
8860
|
-
if (resolvedConnectionId !== void 0 && resolvedConnectionId !== null) {
|
|
8861
|
-
requestBody.subscription.connection_id = resolvedConnectionId;
|
|
8862
|
-
}
|
|
8863
9048
|
const rawResponse = await api.post(
|
|
8864
9049
|
"/trigger-inbox/api/v1/inboxes",
|
|
8865
9050
|
requestBody,
|
|
@@ -8940,15 +9125,13 @@ var ensureTriggerInboxPlugin = definePlugin(
|
|
|
8940
9125
|
subscription: {
|
|
8941
9126
|
app_key: selectedApi,
|
|
8942
9127
|
action_key: actionKey,
|
|
8943
|
-
inputs
|
|
9128
|
+
inputs,
|
|
9129
|
+
connection_id: resolvedConnectionId ?? null
|
|
8944
9130
|
}
|
|
8945
9131
|
};
|
|
8946
9132
|
if (notificationUrl !== void 0) {
|
|
8947
9133
|
requestBody.notification_url = notificationUrl;
|
|
8948
9134
|
}
|
|
8949
|
-
if (resolvedConnectionId !== void 0 && resolvedConnectionId !== null) {
|
|
8950
|
-
requestBody.subscription.connection_id = resolvedConnectionId;
|
|
8951
|
-
}
|
|
8952
9135
|
const rawResponse = await api.post(
|
|
8953
9136
|
"/trigger-inbox/api/v1/inboxes",
|
|
8954
9137
|
requestBody,
|
|
@@ -9409,7 +9592,11 @@ var leaseTriggerInboxMessagesPlugin = definePlugin(
|
|
|
9409
9592
|
itemType: "TriggerInboxLease",
|
|
9410
9593
|
inputSchema: LeaseTriggerInboxMessagesSchema,
|
|
9411
9594
|
outputSchema: LeaseTriggerInboxMessagesItemSchema,
|
|
9412
|
-
resolvers: {
|
|
9595
|
+
resolvers: {
|
|
9596
|
+
inbox: triggerInboxResolver,
|
|
9597
|
+
leaseLimit: { type: "static", inputType: "text" },
|
|
9598
|
+
leaseSeconds: { type: "static", inputType: "text" }
|
|
9599
|
+
},
|
|
9413
9600
|
handler: async ({ sdk: sdk2, options }) => {
|
|
9414
9601
|
const { inbox, leaseLimit, leaseSeconds, signal } = options;
|
|
9415
9602
|
const inboxId = await resolveTriggerInboxId({
|
|
@@ -9473,7 +9660,8 @@ var ackTriggerInboxMessagesPlugin = definePlugin(
|
|
|
9473
9660
|
// No way to look up a lease — leases are short-lived, only the
|
|
9474
9661
|
// most recent leaseTriggerInboxMessages caller knows the ID.
|
|
9475
9662
|
// Static resolver prompts for free-text input.
|
|
9476
|
-
lease: { type: "static", inputType: "text" }
|
|
9663
|
+
lease: { type: "static", inputType: "text" },
|
|
9664
|
+
messages: triggerMessagesResolver
|
|
9477
9665
|
},
|
|
9478
9666
|
handler: async ({ sdk: sdk2, options }) => {
|
|
9479
9667
|
const { inbox, lease, messages } = options;
|
|
@@ -9524,7 +9712,8 @@ var releaseTriggerInboxMessagesPlugin = definePlugin(
|
|
|
9524
9712
|
// No way to look up a lease — leases are short-lived, only the
|
|
9525
9713
|
// most recent leaseTriggerInboxMessages caller knows the ID.
|
|
9526
9714
|
// Static resolver prompts for free-text input.
|
|
9527
|
-
lease: { type: "static", inputType: "text" }
|
|
9715
|
+
lease: { type: "static", inputType: "text" },
|
|
9716
|
+
messages: triggerMessagesResolver
|
|
9528
9717
|
},
|
|
9529
9718
|
handler: async ({ sdk: sdk2, options }) => {
|
|
9530
9719
|
const { inbox, lease, messages } = options;
|
|
@@ -10061,6 +10250,38 @@ var watchTriggerInboxPlugin = definePlugin(
|
|
|
10061
10250
|
};
|
|
10062
10251
|
}
|
|
10063
10252
|
);
|
|
10253
|
+
var ListTriggersSchema = zod.z.object({
|
|
10254
|
+
app: AppPropertySchema.describe(
|
|
10255
|
+
"App key of triggers to list (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
10256
|
+
),
|
|
10257
|
+
pageSize: zod.z.number().min(1).optional().describe("Number of triggers per page"),
|
|
10258
|
+
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
10259
|
+
cursor: zod.z.string().optional().describe("Cursor to start from")
|
|
10260
|
+
}).describe("List all triggers for a specific app");
|
|
10261
|
+
|
|
10262
|
+
// src/plugins/triggers/listTriggers/index.ts
|
|
10263
|
+
var listTriggersPlugin = definePlugin(
|
|
10264
|
+
(sdk) => createPaginatedPluginMethod(sdk, {
|
|
10265
|
+
...triggersDefaults,
|
|
10266
|
+
name: "listTriggers",
|
|
10267
|
+
type: "list",
|
|
10268
|
+
itemType: "Action",
|
|
10269
|
+
inputSchema: ListTriggersSchema,
|
|
10270
|
+
outputSchema: ActionItemSchema,
|
|
10271
|
+
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
10272
|
+
resolvers: { app: appKeyResolver },
|
|
10273
|
+
handler: async ({
|
|
10274
|
+
sdk: sdk2,
|
|
10275
|
+
options
|
|
10276
|
+
}) => {
|
|
10277
|
+
const result = await sdk2.listActions({
|
|
10278
|
+
...options,
|
|
10279
|
+
actionType: "read"
|
|
10280
|
+
});
|
|
10281
|
+
return { data: result.data, nextCursor: result.nextCursor };
|
|
10282
|
+
}
|
|
10283
|
+
})
|
|
10284
|
+
);
|
|
10064
10285
|
var ListTriggerInputFieldsSchema = zod.z.object({
|
|
10065
10286
|
app: AppPropertySchema,
|
|
10066
10287
|
action: ActionPropertySchema,
|
|
@@ -10301,6 +10522,24 @@ var BaseSdkOptionsSchema = zod.z.object({
|
|
|
10301
10522
|
* Default is 60000 (60 seconds).
|
|
10302
10523
|
*/
|
|
10303
10524
|
maxNetworkRetryDelayMs: zod.z.number().optional().describe("Max delay in ms to wait for retry (default: 60000).").meta({ valueHint: "ms" }),
|
|
10525
|
+
/**
|
|
10526
|
+
* Maximum number of concurrent in-flight HTTP requests per client.
|
|
10527
|
+
* Requests beyond this limit queue in FIFO order until a slot frees.
|
|
10528
|
+
* Pass `Infinity` to disable. Default: 200.
|
|
10529
|
+
*
|
|
10530
|
+
* The description and meta are duplicated across the outer wrapper and
|
|
10531
|
+
* the inner numeric branch because the SDK and CLI doc generators walk
|
|
10532
|
+
* the schema differently — the SDK reader looks at wrappers only, while
|
|
10533
|
+
* the CLI reader recurses into union branches.
|
|
10534
|
+
*/
|
|
10535
|
+
maxConcurrentRequests: zod.z.union([
|
|
10536
|
+
zod.z.number().int().min(1).max(MAX_CONCURRENCY_LIMIT).describe(
|
|
10537
|
+
`Max concurrent in-flight HTTP requests (default: 200, max: ${MAX_CONCURRENCY_LIMIT}).`
|
|
10538
|
+
).meta({ valueHint: "count" }),
|
|
10539
|
+
zod.z.literal(Infinity)
|
|
10540
|
+
]).optional().describe(
|
|
10541
|
+
`Max concurrent in-flight HTTP requests (default: 200, max: ${MAX_CONCURRENCY_LIMIT}).`
|
|
10542
|
+
).meta({ valueHint: "count" }),
|
|
10304
10543
|
approvalTimeoutMs: zod.z.number().optional().describe("Timeout in ms for approval polling. Default: 600000 (10 min).").meta({ valueHint: "ms" }),
|
|
10305
10544
|
maxApprovalRetries: zod.z.number().optional().describe(
|
|
10306
10545
|
"Maximum number of sequential approval rounds per request (one per gating policy) before giving up. Default: 2."
|
|
@@ -10334,7 +10573,7 @@ var registryPlugin = definePlugin((_sdk) => {
|
|
|
10334
10573
|
|
|
10335
10574
|
// src/experimental.ts
|
|
10336
10575
|
function createZapierSdk2(options = {}) {
|
|
10337
|
-
return createSdk().addPlugin(createOptionsPlugin(options)).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(capabilitiesPlugin).addPlugin(connectionsPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listActionInputFieldsPlugin).addPlugin(getActionInputFieldsSchemaPlugin).addPlugin(listActionInputFieldChoicesPlugin).addPlugin(listInputFieldsDeprecatedPlugin).addPlugin(getInputFieldsSchemaDeprecatedPlugin).addPlugin(listInputFieldChoicesDeprecatedPlugin).addPlugin(runActionPlugin).addPlugin(listConnectionsPlugin).addPlugin(getConnectionPlugin).addPlugin(findFirstConnectionPlugin).addPlugin(findUniqueConnectionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(listClientCredentialsPlugin).addPlugin(createClientCredentialsPlugin).addPlugin(deleteClientCredentialsPlugin).addPlugin(fetchPlugin).addPlugin(requestPlugin).addPlugin(createTriggerInboxPlugin).addPlugin(ensureTriggerInboxPlugin).addPlugin(listTriggerInboxesPlugin).addPlugin(getTriggerInboxPlugin).addPlugin(updateTriggerInboxPlugin).addPlugin(deleteTriggerInboxPlugin).addPlugin(pauseTriggerInboxPlugin).addPlugin(resumeTriggerInboxPlugin).addPlugin(listTriggerInboxMessagesPlugin).addPlugin(leaseTriggerInboxMessagesPlugin).addPlugin(ackTriggerInboxMessagesPlugin).addPlugin(releaseTriggerInboxMessagesPlugin).addPlugin(drainTriggerInboxPlugin).addPlugin(watchTriggerInboxPlugin).addPlugin(listTriggerInputFieldsPlugin).addPlugin(listTriggerInputFieldChoicesPlugin).addPlugin(getTriggerInputFieldsSchemaPlugin).addPlugin(listTablesPlugin).addPlugin(getTablePlugin).addPlugin(deleteTablePlugin).addPlugin(createTablePlugin).addPlugin(listTableFieldsPlugin).addPlugin(createTableFieldsPlugin).addPlugin(deleteTableFieldsPlugin).addPlugin(getTableRecordPlugin).addPlugin(listTableRecordsPlugin).addPlugin(createTableRecordsPlugin).addPlugin(deleteTableRecordsPlugin).addPlugin(updateTableRecordsPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
10576
|
+
return createSdk().addPlugin(createOptionsPlugin(options)).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(capabilitiesPlugin).addPlugin(connectionsPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listActionInputFieldsPlugin).addPlugin(getActionInputFieldsSchemaPlugin).addPlugin(listActionInputFieldChoicesPlugin).addPlugin(listInputFieldsDeprecatedPlugin).addPlugin(getInputFieldsSchemaDeprecatedPlugin).addPlugin(listInputFieldChoicesDeprecatedPlugin).addPlugin(runActionPlugin).addPlugin(listConnectionsPlugin).addPlugin(getConnectionPlugin).addPlugin(findFirstConnectionPlugin).addPlugin(findUniqueConnectionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(listClientCredentialsPlugin).addPlugin(createClientCredentialsPlugin).addPlugin(deleteClientCredentialsPlugin).addPlugin(fetchPlugin).addPlugin(requestPlugin).addPlugin(createTriggerInboxPlugin).addPlugin(ensureTriggerInboxPlugin).addPlugin(listTriggerInboxesPlugin).addPlugin(getTriggerInboxPlugin).addPlugin(updateTriggerInboxPlugin).addPlugin(deleteTriggerInboxPlugin).addPlugin(pauseTriggerInboxPlugin).addPlugin(resumeTriggerInboxPlugin).addPlugin(listTriggerInboxMessagesPlugin).addPlugin(leaseTriggerInboxMessagesPlugin).addPlugin(ackTriggerInboxMessagesPlugin).addPlugin(releaseTriggerInboxMessagesPlugin).addPlugin(drainTriggerInboxPlugin).addPlugin(watchTriggerInboxPlugin).addPlugin(listTriggersPlugin).addPlugin(listTriggerInputFieldsPlugin).addPlugin(listTriggerInputFieldChoicesPlugin).addPlugin(getTriggerInputFieldsSchemaPlugin).addPlugin(listTablesPlugin).addPlugin(getTablePlugin).addPlugin(deleteTablePlugin).addPlugin(createTablePlugin).addPlugin(listTableFieldsPlugin).addPlugin(createTableFieldsPlugin).addPlugin(deleteTableFieldsPlugin).addPlugin(getTableRecordPlugin).addPlugin(listTableRecordsPlugin).addPlugin(createTableRecordsPlugin).addPlugin(deleteTableRecordsPlugin).addPlugin(updateTableRecordsPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
10338
10577
|
}
|
|
10339
10578
|
|
|
10340
10579
|
exports.ActionKeyPropertySchema = ActionKeyPropertySchema;
|
|
@@ -10370,6 +10609,7 @@ exports.LeaseLimitPropertySchema = LeaseLimitPropertySchema;
|
|
|
10370
10609
|
exports.LeasePropertySchema = LeasePropertySchema;
|
|
10371
10610
|
exports.LeaseSecondsPropertySchema = LeaseSecondsPropertySchema;
|
|
10372
10611
|
exports.LimitPropertySchema = LimitPropertySchema;
|
|
10612
|
+
exports.MAX_CONCURRENCY_LIMIT = MAX_CONCURRENCY_LIMIT;
|
|
10373
10613
|
exports.MAX_PAGE_LIMIT = MAX_PAGE_LIMIT;
|
|
10374
10614
|
exports.OffsetPropertySchema = OffsetPropertySchema;
|
|
10375
10615
|
exports.OutputPropertySchema = OutputPropertySchema;
|
|
@@ -10385,6 +10625,7 @@ exports.TablesPropertySchema = TablesPropertySchema;
|
|
|
10385
10625
|
exports.TriggerInboxNamePropertySchema = TriggerInboxNamePropertySchema;
|
|
10386
10626
|
exports.TriggerInboxPropertySchema = TriggerInboxPropertySchema;
|
|
10387
10627
|
exports.ZAPIER_BASE_URL = ZAPIER_BASE_URL;
|
|
10628
|
+
exports.ZAPIER_MAX_CONCURRENT_REQUESTS = ZAPIER_MAX_CONCURRENT_REQUESTS;
|
|
10388
10629
|
exports.ZAPIER_MAX_NETWORK_RETRIES = ZAPIER_MAX_NETWORK_RETRIES;
|
|
10389
10630
|
exports.ZAPIER_MAX_NETWORK_RETRY_DELAY_MS = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS;
|
|
10390
10631
|
exports.ZapierAbortDrainSignal = ZapierAbortDrainSignal;
|
|
@@ -10496,6 +10737,7 @@ exports.listTableRecordsPlugin = listTableRecordsPlugin;
|
|
|
10496
10737
|
exports.listTablesPlugin = listTablesPlugin;
|
|
10497
10738
|
exports.logDeprecation = logDeprecation;
|
|
10498
10739
|
exports.manifestPlugin = manifestPlugin;
|
|
10740
|
+
exports.parseConcurrencyEnvVar = parseConcurrencyEnvVar;
|
|
10499
10741
|
exports.readManifestFromFile = readManifestFromFile;
|
|
10500
10742
|
exports.registryPlugin = registryPlugin;
|
|
10501
10743
|
exports.requestPlugin = requestPlugin;
|
|
@@ -10518,4 +10760,5 @@ exports.tableUpdateRecordsResolver = tableUpdateRecordsResolver;
|
|
|
10518
10760
|
exports.toSnakeCase = toSnakeCase;
|
|
10519
10761
|
exports.toTitleCase = toTitleCase;
|
|
10520
10762
|
exports.triggerInboxResolver = triggerInboxResolver;
|
|
10763
|
+
exports.triggerMessagesResolver = triggerMessagesResolver;
|
|
10521
10764
|
exports.updateTableRecordsPlugin = updateTableRecordsPlugin;
|