@zapier/zapier-sdk 0.8.1 → 0.8.3
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/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +1 -2
- package/dist/api/polling.d.ts +36 -6
- package/dist/api/polling.d.ts.map +1 -1
- package/dist/api/polling.js +132 -28
- package/dist/api/polling.test.d.ts +2 -0
- package/dist/api/polling.test.d.ts.map +1 -0
- package/dist/api/polling.test.js +318 -0
- package/dist/api/types.d.ts +3 -4
- package/dist/api/types.d.ts.map +1 -1
- package/dist/index.cjs +144 -34
- package/dist/index.d.mts +1 -2
- package/dist/index.mjs +144 -34
- package/dist/plugins/findFirstAuthentication/schemas.d.ts +2 -1
- package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +1 -1
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts +2 -1
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +1 -1
- package/dist/plugins/getAction/schemas.d.ts +2 -1
- package/dist/plugins/getAction/schemas.d.ts.map +1 -1
- package/dist/plugins/getApp/index.d.ts +2 -2
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/schemas.d.ts +1 -1
- package/dist/plugins/getApp/schemas.d.ts.map +1 -1
- package/dist/plugins/getAuthentication/schemas.d.ts +2 -1
- package/dist/plugins/getAuthentication/schemas.d.ts.map +1 -1
- package/dist/plugins/getProfile/schemas.d.ts +1 -1
- package/dist/plugins/getProfile/schemas.d.ts.map +1 -1
- package/dist/plugins/listActions/index.d.ts +2 -2
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/schemas.d.ts +2 -1
- package/dist/plugins/listActions/schemas.d.ts.map +1 -1
- package/dist/plugins/listApps/schemas.d.ts +1 -1
- package/dist/plugins/listApps/schemas.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/index.d.ts +2 -2
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/schemas.d.ts +2 -1
- package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.d.ts +1 -1
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/schemas.d.ts +2 -1
- package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
- package/dist/plugins/lockVersion/index.d.ts +1 -1
- package/dist/plugins/lockVersion/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.d.ts +4 -5
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/schemas.d.ts +1 -1
- package/dist/plugins/manifest/schemas.d.ts.map +1 -1
- package/dist/plugins/registry/index.d.ts +1 -1
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/request/schemas.d.ts +2 -1
- package/dist/plugins/request/schemas.d.ts.map +1 -1
- package/dist/plugins/runAction/index.d.ts +1 -1
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/schemas.d.ts +2 -1
- package/dist/plugins/runAction/schemas.d.ts.map +1 -1
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/types/functions.d.ts +2 -1
- package/dist/types/functions.d.ts.map +1 -1
- package/dist/types/functions.js +0 -3
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +17 -17
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/function-utils.d.ts +1 -1
- package/dist/utils/function-utils.d.ts.map +1 -1
- package/dist/utils/validation.d.ts +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/client.ts +5 -4
- package/src/api/polling.test.ts +405 -0
- package/src/api/polling.ts +224 -44
- package/src/api/types.ts +3 -4
- package/src/plugins/apps/index.ts +1 -1
- package/src/plugins/fetch/index.ts +1 -1
- package/src/plugins/findFirstAuthentication/schemas.ts +10 -4
- package/src/plugins/findUniqueAuthentication/schemas.ts +12 -5
- package/src/plugins/getAction/schemas.ts +14 -6
- package/src/plugins/getApp/index.ts +2 -2
- package/src/plugins/getApp/schemas.ts +1 -1
- package/src/plugins/getAuthentication/schemas.ts +12 -5
- package/src/plugins/getProfile/schemas.ts +1 -1
- package/src/plugins/listActions/index.ts +2 -2
- package/src/plugins/listActions/schemas.ts +8 -3
- package/src/plugins/listApps/schemas.ts +1 -1
- package/src/plugins/listAuthentications/index.ts +2 -2
- package/src/plugins/listAuthentications/schemas.ts +12 -5
- package/src/plugins/listInputFields/index.ts +1 -1
- package/src/plugins/listInputFields/schemas.ts +14 -6
- package/src/plugins/lockVersion/index.ts +1 -1
- package/src/plugins/manifest/index.ts +6 -5
- package/src/plugins/manifest/schemas.ts +1 -1
- package/src/plugins/registry/index.ts +1 -1
- package/src/plugins/request/schemas.ts +8 -3
- package/src/plugins/runAction/index.ts +1 -1
- package/src/plugins/runAction/schemas.ts +10 -4
- package/src/sdk.ts +1 -1
- package/src/types/functions.ts +2 -1
- package/src/types/plugin.ts +1 -1
- package/src/types/sdk.ts +17 -17
- package/src/utils/function-utils.ts +1 -1
- package/src/utils/validation.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var zod = require('zod');
|
|
4
4
|
var fs = require('fs');
|
|
5
5
|
var path = require('path');
|
|
6
|
+
var promises = require('timers/promises');
|
|
6
7
|
|
|
7
8
|
// src/types/properties.ts
|
|
8
9
|
function withFormatter(schema, formatMeta) {
|
|
@@ -2277,52 +2278,162 @@ function createDebugFetch(options) {
|
|
|
2277
2278
|
}
|
|
2278
2279
|
};
|
|
2279
2280
|
}
|
|
2280
|
-
|
|
2281
|
-
|
|
2281
|
+
var DEFAULT_TIMEOUT_MS = 18e4;
|
|
2282
|
+
var DEFAULT_SUCCESS_STATUS = 200;
|
|
2283
|
+
var DEFAULT_PENDING_STATUS = 202;
|
|
2284
|
+
var DEFAULT_INITIAL_DELAY_MS = 50;
|
|
2285
|
+
var DEFAULT_MAX_POLLING_INTERVAL_MS = 1e4;
|
|
2286
|
+
var MAX_CONSECUTIVE_ERRORS = 3;
|
|
2287
|
+
var MAX_TIMEOUT_BUFFER_MS = 1e4;
|
|
2288
|
+
var BASE_ERROR_BACKOFF_MS = 1e3;
|
|
2289
|
+
var JITTER_FACTOR = 0.5;
|
|
2290
|
+
var DEFAULT_POLLING_STAGES = [
|
|
2291
|
+
[125, 125],
|
|
2292
|
+
// Up to 125ms: poll every 125ms
|
|
2293
|
+
[375, 250],
|
|
2294
|
+
// Up to 375ms: poll every 250ms
|
|
2295
|
+
[875, 500],
|
|
2296
|
+
// Up to 875ms: poll every 500ms
|
|
2297
|
+
[1e4, 1e3],
|
|
2298
|
+
// Up to 10s: poll every 1s
|
|
2299
|
+
[3e4, 2500],
|
|
2300
|
+
// Up to 30s: poll every 2.5s
|
|
2301
|
+
[6e4, 5e3]
|
|
2302
|
+
// Up to 60s: poll every 5s
|
|
2303
|
+
];
|
|
2304
|
+
var calculateWaitTime = (baseInterval, errorCount) => {
|
|
2305
|
+
const jitter = Math.random() * JITTER_FACTOR * baseInterval;
|
|
2306
|
+
const errorBackoff = Math.min(
|
|
2307
|
+
BASE_ERROR_BACKOFF_MS * (errorCount / 2),
|
|
2308
|
+
baseInterval * 2
|
|
2309
|
+
// Cap error backoff at 2x the base interval
|
|
2310
|
+
);
|
|
2311
|
+
return Math.floor(baseInterval + jitter + errorBackoff);
|
|
2312
|
+
};
|
|
2313
|
+
var processResponse = async (response, successStatus, pendingStatus, resultExtractor, errorCount) => {
|
|
2314
|
+
if (!response.ok) {
|
|
2315
|
+
return {
|
|
2316
|
+
status: "continue" /* Continue */,
|
|
2317
|
+
// If for some reason the status is pending, we don't want to increment the error count
|
|
2318
|
+
errorCount: response.status === pendingStatus ? errorCount : errorCount + 1
|
|
2319
|
+
};
|
|
2320
|
+
}
|
|
2321
|
+
if (response.status === successStatus) {
|
|
2322
|
+
try {
|
|
2323
|
+
const resultJson = await response.json();
|
|
2324
|
+
return {
|
|
2325
|
+
result: resultExtractor(resultJson),
|
|
2326
|
+
status: "success" /* Success */,
|
|
2327
|
+
errorCount: 0
|
|
2328
|
+
};
|
|
2329
|
+
} catch (error) {
|
|
2330
|
+
throw new ZapierApiError(
|
|
2331
|
+
"Result extractor failed to parse successful response as JSON",
|
|
2332
|
+
{
|
|
2333
|
+
statusCode: response.status,
|
|
2334
|
+
cause: error
|
|
2335
|
+
}
|
|
2336
|
+
);
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
if (response.status !== pendingStatus) {
|
|
2340
|
+
throw new ZapierApiError(
|
|
2341
|
+
`Unexpected response status during polling: ${response.status}`,
|
|
2342
|
+
{
|
|
2343
|
+
statusCode: response.status
|
|
2344
|
+
}
|
|
2345
|
+
);
|
|
2346
|
+
}
|
|
2347
|
+
return {
|
|
2348
|
+
status: "continue" /* Continue */,
|
|
2349
|
+
errorCount: 0
|
|
2350
|
+
};
|
|
2351
|
+
};
|
|
2282
2352
|
async function pollUntilComplete(options) {
|
|
2283
2353
|
const {
|
|
2284
2354
|
fetchPoll,
|
|
2285
|
-
|
|
2286
|
-
initialDelay =
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
pendingStatus = 202,
|
|
2355
|
+
timeoutMs = DEFAULT_TIMEOUT_MS,
|
|
2356
|
+
initialDelay = DEFAULT_INITIAL_DELAY_MS,
|
|
2357
|
+
successStatus = DEFAULT_SUCCESS_STATUS,
|
|
2358
|
+
pendingStatus = DEFAULT_PENDING_STATUS,
|
|
2290
2359
|
resultExtractor = (response) => response
|
|
2291
2360
|
} = options;
|
|
2292
|
-
|
|
2361
|
+
if (timeoutMs <= 0) {
|
|
2362
|
+
throw new ZapierValidationError("Timeout must be greater than 0", {
|
|
2363
|
+
details: { timeoutMs }
|
|
2364
|
+
});
|
|
2365
|
+
}
|
|
2366
|
+
if (initialDelay < 0) {
|
|
2367
|
+
throw new ZapierValidationError("Initial delay must be non-negative", {
|
|
2368
|
+
details: { initialDelay }
|
|
2369
|
+
});
|
|
2370
|
+
}
|
|
2371
|
+
const startTime = Date.now();
|
|
2372
|
+
let attempts = 0;
|
|
2293
2373
|
let errorCount = 0;
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2374
|
+
const pollingStages = [
|
|
2375
|
+
...DEFAULT_POLLING_STAGES,
|
|
2376
|
+
[timeoutMs + MAX_TIMEOUT_BUFFER_MS, DEFAULT_MAX_POLLING_INTERVAL_MS]
|
|
2377
|
+
// Up to timeout + 10s: poll every 10s
|
|
2378
|
+
];
|
|
2379
|
+
if (initialDelay > 0) {
|
|
2380
|
+
await promises.setTimeout(initialDelay);
|
|
2381
|
+
}
|
|
2382
|
+
while (true) {
|
|
2383
|
+
attempts++;
|
|
2384
|
+
const elapsedTime = Date.now() - startTime;
|
|
2385
|
+
const pollingInterval = pollingStages.find(
|
|
2386
|
+
([maxTimeForStage, _interval]) => {
|
|
2387
|
+
return elapsedTime < maxTimeForStage;
|
|
2388
|
+
}
|
|
2389
|
+
);
|
|
2390
|
+
if (!pollingInterval) {
|
|
2391
|
+
throw new ZapierTimeoutError(
|
|
2392
|
+
`Operation timed out after ${Math.floor(elapsedTime / 1e3)}s (${attempts} attempts)`,
|
|
2393
|
+
{
|
|
2394
|
+
attempts
|
|
2395
|
+
}
|
|
2396
|
+
);
|
|
2397
|
+
}
|
|
2398
|
+
if (attempts > 1) {
|
|
2399
|
+
const waitTime = calculateWaitTime(pollingInterval[1], errorCount);
|
|
2400
|
+
await promises.setTimeout(waitTime);
|
|
2401
|
+
}
|
|
2402
|
+
try {
|
|
2403
|
+
const response = await fetchPoll();
|
|
2404
|
+
const {
|
|
2405
|
+
result,
|
|
2406
|
+
errorCount: newErrorCount,
|
|
2407
|
+
status
|
|
2408
|
+
} = await processResponse(
|
|
2409
|
+
response,
|
|
2410
|
+
successStatus,
|
|
2411
|
+
pendingStatus,
|
|
2412
|
+
resultExtractor,
|
|
2413
|
+
errorCount
|
|
2414
|
+
);
|
|
2415
|
+
errorCount = newErrorCount;
|
|
2416
|
+
if (status === "success" /* Success */) {
|
|
2417
|
+
return result;
|
|
2418
|
+
}
|
|
2419
|
+
if (errorCount >= MAX_CONSECUTIVE_ERRORS) {
|
|
2310
2420
|
throw new ZapierApiError(
|
|
2311
2421
|
`Poll request failed: ${response.status} ${response.statusText}`,
|
|
2312
2422
|
{ statusCode: response.status }
|
|
2313
2423
|
);
|
|
2314
2424
|
}
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2425
|
+
} catch (error) {
|
|
2426
|
+
errorCount++;
|
|
2427
|
+
if (errorCount >= MAX_CONSECUTIVE_ERRORS) {
|
|
2428
|
+
throw new ZapierApiError(
|
|
2429
|
+
`Failed to poll after ${errorCount} consecutive errors: ${error instanceof Error ? error.message : String(error)}`,
|
|
2430
|
+
{
|
|
2431
|
+
cause: error
|
|
2432
|
+
}
|
|
2433
|
+
);
|
|
2319
2434
|
}
|
|
2320
2435
|
}
|
|
2321
2436
|
}
|
|
2322
|
-
throw new ZapierTimeoutError(
|
|
2323
|
-
`Operation timed out after ${maxAttempts} attempts`,
|
|
2324
|
-
{ attempts: maxAttempts, maxAttempts }
|
|
2325
|
-
);
|
|
2326
2437
|
}
|
|
2327
2438
|
|
|
2328
2439
|
// src/auth.ts
|
|
@@ -2377,9 +2488,8 @@ var ZapierApiClient = class {
|
|
|
2377
2488
|
searchParams: options.searchParams,
|
|
2378
2489
|
authRequired: options.authRequired
|
|
2379
2490
|
}),
|
|
2380
|
-
maxAttempts: options.maxAttempts,
|
|
2381
2491
|
initialDelay: options.initialDelay,
|
|
2382
|
-
|
|
2492
|
+
timeoutMs: options.timeoutMs,
|
|
2383
2493
|
successStatus: options.successStatus,
|
|
2384
2494
|
pendingStatus: options.pendingStatus,
|
|
2385
2495
|
resultExtractor: options.resultExtractor
|
package/dist/index.d.mts
CHANGED
|
@@ -1841,9 +1841,8 @@ interface RequestOptions {
|
|
|
1841
1841
|
}) => Error | undefined;
|
|
1842
1842
|
}
|
|
1843
1843
|
interface PollOptions extends RequestOptions {
|
|
1844
|
-
maxAttempts?: number;
|
|
1845
1844
|
initialDelay?: number;
|
|
1846
|
-
|
|
1845
|
+
timeoutMs?: number;
|
|
1847
1846
|
successStatus?: number;
|
|
1848
1847
|
pendingStatus?: number;
|
|
1849
1848
|
resultExtractor?: (response: unknown) => unknown;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { readFileSync, existsSync, writeFileSync } from 'fs';
|
|
3
3
|
import { resolve } from 'path';
|
|
4
|
+
import { setTimeout } from 'timers/promises';
|
|
4
5
|
|
|
5
6
|
// src/types/properties.ts
|
|
6
7
|
function withFormatter(schema, formatMeta) {
|
|
@@ -2275,52 +2276,162 @@ function createDebugFetch(options) {
|
|
|
2275
2276
|
}
|
|
2276
2277
|
};
|
|
2277
2278
|
}
|
|
2278
|
-
|
|
2279
|
-
|
|
2279
|
+
var DEFAULT_TIMEOUT_MS = 18e4;
|
|
2280
|
+
var DEFAULT_SUCCESS_STATUS = 200;
|
|
2281
|
+
var DEFAULT_PENDING_STATUS = 202;
|
|
2282
|
+
var DEFAULT_INITIAL_DELAY_MS = 50;
|
|
2283
|
+
var DEFAULT_MAX_POLLING_INTERVAL_MS = 1e4;
|
|
2284
|
+
var MAX_CONSECUTIVE_ERRORS = 3;
|
|
2285
|
+
var MAX_TIMEOUT_BUFFER_MS = 1e4;
|
|
2286
|
+
var BASE_ERROR_BACKOFF_MS = 1e3;
|
|
2287
|
+
var JITTER_FACTOR = 0.5;
|
|
2288
|
+
var DEFAULT_POLLING_STAGES = [
|
|
2289
|
+
[125, 125],
|
|
2290
|
+
// Up to 125ms: poll every 125ms
|
|
2291
|
+
[375, 250],
|
|
2292
|
+
// Up to 375ms: poll every 250ms
|
|
2293
|
+
[875, 500],
|
|
2294
|
+
// Up to 875ms: poll every 500ms
|
|
2295
|
+
[1e4, 1e3],
|
|
2296
|
+
// Up to 10s: poll every 1s
|
|
2297
|
+
[3e4, 2500],
|
|
2298
|
+
// Up to 30s: poll every 2.5s
|
|
2299
|
+
[6e4, 5e3]
|
|
2300
|
+
// Up to 60s: poll every 5s
|
|
2301
|
+
];
|
|
2302
|
+
var calculateWaitTime = (baseInterval, errorCount) => {
|
|
2303
|
+
const jitter = Math.random() * JITTER_FACTOR * baseInterval;
|
|
2304
|
+
const errorBackoff = Math.min(
|
|
2305
|
+
BASE_ERROR_BACKOFF_MS * (errorCount / 2),
|
|
2306
|
+
baseInterval * 2
|
|
2307
|
+
// Cap error backoff at 2x the base interval
|
|
2308
|
+
);
|
|
2309
|
+
return Math.floor(baseInterval + jitter + errorBackoff);
|
|
2310
|
+
};
|
|
2311
|
+
var processResponse = async (response, successStatus, pendingStatus, resultExtractor, errorCount) => {
|
|
2312
|
+
if (!response.ok) {
|
|
2313
|
+
return {
|
|
2314
|
+
status: "continue" /* Continue */,
|
|
2315
|
+
// If for some reason the status is pending, we don't want to increment the error count
|
|
2316
|
+
errorCount: response.status === pendingStatus ? errorCount : errorCount + 1
|
|
2317
|
+
};
|
|
2318
|
+
}
|
|
2319
|
+
if (response.status === successStatus) {
|
|
2320
|
+
try {
|
|
2321
|
+
const resultJson = await response.json();
|
|
2322
|
+
return {
|
|
2323
|
+
result: resultExtractor(resultJson),
|
|
2324
|
+
status: "success" /* Success */,
|
|
2325
|
+
errorCount: 0
|
|
2326
|
+
};
|
|
2327
|
+
} catch (error) {
|
|
2328
|
+
throw new ZapierApiError(
|
|
2329
|
+
"Result extractor failed to parse successful response as JSON",
|
|
2330
|
+
{
|
|
2331
|
+
statusCode: response.status,
|
|
2332
|
+
cause: error
|
|
2333
|
+
}
|
|
2334
|
+
);
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
if (response.status !== pendingStatus) {
|
|
2338
|
+
throw new ZapierApiError(
|
|
2339
|
+
`Unexpected response status during polling: ${response.status}`,
|
|
2340
|
+
{
|
|
2341
|
+
statusCode: response.status
|
|
2342
|
+
}
|
|
2343
|
+
);
|
|
2344
|
+
}
|
|
2345
|
+
return {
|
|
2346
|
+
status: "continue" /* Continue */,
|
|
2347
|
+
errorCount: 0
|
|
2348
|
+
};
|
|
2349
|
+
};
|
|
2280
2350
|
async function pollUntilComplete(options) {
|
|
2281
2351
|
const {
|
|
2282
2352
|
fetchPoll,
|
|
2283
|
-
|
|
2284
|
-
initialDelay =
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
pendingStatus = 202,
|
|
2353
|
+
timeoutMs = DEFAULT_TIMEOUT_MS,
|
|
2354
|
+
initialDelay = DEFAULT_INITIAL_DELAY_MS,
|
|
2355
|
+
successStatus = DEFAULT_SUCCESS_STATUS,
|
|
2356
|
+
pendingStatus = DEFAULT_PENDING_STATUS,
|
|
2288
2357
|
resultExtractor = (response) => response
|
|
2289
2358
|
} = options;
|
|
2290
|
-
|
|
2359
|
+
if (timeoutMs <= 0) {
|
|
2360
|
+
throw new ZapierValidationError("Timeout must be greater than 0", {
|
|
2361
|
+
details: { timeoutMs }
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
if (initialDelay < 0) {
|
|
2365
|
+
throw new ZapierValidationError("Initial delay must be non-negative", {
|
|
2366
|
+
details: { initialDelay }
|
|
2367
|
+
});
|
|
2368
|
+
}
|
|
2369
|
+
const startTime = Date.now();
|
|
2370
|
+
let attempts = 0;
|
|
2291
2371
|
let errorCount = 0;
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2372
|
+
const pollingStages = [
|
|
2373
|
+
...DEFAULT_POLLING_STAGES,
|
|
2374
|
+
[timeoutMs + MAX_TIMEOUT_BUFFER_MS, DEFAULT_MAX_POLLING_INTERVAL_MS]
|
|
2375
|
+
// Up to timeout + 10s: poll every 10s
|
|
2376
|
+
];
|
|
2377
|
+
if (initialDelay > 0) {
|
|
2378
|
+
await setTimeout(initialDelay);
|
|
2379
|
+
}
|
|
2380
|
+
while (true) {
|
|
2381
|
+
attempts++;
|
|
2382
|
+
const elapsedTime = Date.now() - startTime;
|
|
2383
|
+
const pollingInterval = pollingStages.find(
|
|
2384
|
+
([maxTimeForStage, _interval]) => {
|
|
2385
|
+
return elapsedTime < maxTimeForStage;
|
|
2386
|
+
}
|
|
2387
|
+
);
|
|
2388
|
+
if (!pollingInterval) {
|
|
2389
|
+
throw new ZapierTimeoutError(
|
|
2390
|
+
`Operation timed out after ${Math.floor(elapsedTime / 1e3)}s (${attempts} attempts)`,
|
|
2391
|
+
{
|
|
2392
|
+
attempts
|
|
2393
|
+
}
|
|
2394
|
+
);
|
|
2395
|
+
}
|
|
2396
|
+
if (attempts > 1) {
|
|
2397
|
+
const waitTime = calculateWaitTime(pollingInterval[1], errorCount);
|
|
2398
|
+
await setTimeout(waitTime);
|
|
2399
|
+
}
|
|
2400
|
+
try {
|
|
2401
|
+
const response = await fetchPoll();
|
|
2402
|
+
const {
|
|
2403
|
+
result,
|
|
2404
|
+
errorCount: newErrorCount,
|
|
2405
|
+
status
|
|
2406
|
+
} = await processResponse(
|
|
2407
|
+
response,
|
|
2408
|
+
successStatus,
|
|
2409
|
+
pendingStatus,
|
|
2410
|
+
resultExtractor,
|
|
2411
|
+
errorCount
|
|
2412
|
+
);
|
|
2413
|
+
errorCount = newErrorCount;
|
|
2414
|
+
if (status === "success" /* Success */) {
|
|
2415
|
+
return result;
|
|
2416
|
+
}
|
|
2417
|
+
if (errorCount >= MAX_CONSECUTIVE_ERRORS) {
|
|
2308
2418
|
throw new ZapierApiError(
|
|
2309
2419
|
`Poll request failed: ${response.status} ${response.statusText}`,
|
|
2310
2420
|
{ statusCode: response.status }
|
|
2311
2421
|
);
|
|
2312
2422
|
}
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2423
|
+
} catch (error) {
|
|
2424
|
+
errorCount++;
|
|
2425
|
+
if (errorCount >= MAX_CONSECUTIVE_ERRORS) {
|
|
2426
|
+
throw new ZapierApiError(
|
|
2427
|
+
`Failed to poll after ${errorCount} consecutive errors: ${error instanceof Error ? error.message : String(error)}`,
|
|
2428
|
+
{
|
|
2429
|
+
cause: error
|
|
2430
|
+
}
|
|
2431
|
+
);
|
|
2317
2432
|
}
|
|
2318
2433
|
}
|
|
2319
2434
|
}
|
|
2320
|
-
throw new ZapierTimeoutError(
|
|
2321
|
-
`Operation timed out after ${maxAttempts} attempts`,
|
|
2322
|
-
{ attempts: maxAttempts, maxAttempts }
|
|
2323
|
-
);
|
|
2324
2435
|
}
|
|
2325
2436
|
|
|
2326
2437
|
// src/auth.ts
|
|
@@ -2375,9 +2486,8 @@ var ZapierApiClient = class {
|
|
|
2375
2486
|
searchParams: options.searchParams,
|
|
2376
2487
|
authRequired: options.authRequired
|
|
2377
2488
|
}),
|
|
2378
|
-
maxAttempts: options.maxAttempts,
|
|
2379
2489
|
initialDelay: options.initialDelay,
|
|
2380
|
-
|
|
2490
|
+
timeoutMs: options.timeoutMs,
|
|
2381
2491
|
successStatus: options.successStatus,
|
|
2382
2492
|
pendingStatus: options.pendingStatus,
|
|
2383
2493
|
resultExtractor: options.resultExtractor
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AuthenticationItem } from "../../types/domain";
|
|
3
|
+
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
3
4
|
export declare const FindFirstAuthenticationSchema: z.ZodObject<{
|
|
4
5
|
appKey: z.ZodOptional<z.ZodString>;
|
|
5
6
|
search: z.ZodOptional<z.ZodString>;
|
|
@@ -20,7 +21,7 @@ export declare const FindFirstAuthenticationSchema: z.ZodObject<{
|
|
|
20
21
|
owner?: string | undefined;
|
|
21
22
|
}>;
|
|
22
23
|
export type FindFirstAuthenticationOptions = z.infer<typeof FindFirstAuthenticationSchema>;
|
|
23
|
-
export type FindFirstAuthenticationError =
|
|
24
|
+
export type FindFirstAuthenticationError = ZapierAuthenticationError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
|
|
24
25
|
export interface FindFirstAuthenticationSdkFunction {
|
|
25
26
|
findFirstAuthentication: (options?: FindFirstAuthenticationOptions) => Promise<{
|
|
26
27
|
data: AuthenticationItem | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;EAgBwB,CAAC;AAGnE,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,6BAA6B,CACrC,CAAC;AAGF,MAAM,MAAM,4BAA4B,GACpC,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,kCAAkC;IACjD,uBAAuB,EAAE,CACvB,OAAO,CAAC,EAAE,8BAA8B,KACrC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CACnD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AuthenticationItem } from "../../types/domain";
|
|
3
|
+
import type { ZapierAuthenticationError, ZapierApiError, ZapierResourceNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
3
4
|
export declare const FindUniqueAuthenticationSchema: z.ZodObject<{
|
|
4
5
|
appKey: z.ZodOptional<z.ZodString>;
|
|
5
6
|
search: z.ZodOptional<z.ZodString>;
|
|
@@ -20,7 +21,7 @@ export declare const FindUniqueAuthenticationSchema: z.ZodObject<{
|
|
|
20
21
|
owner?: string | undefined;
|
|
21
22
|
}>;
|
|
22
23
|
export type FindUniqueAuthenticationOptions = z.infer<typeof FindUniqueAuthenticationSchema>;
|
|
23
|
-
export type FindUniqueAuthenticationError =
|
|
24
|
+
export type FindUniqueAuthenticationError = ZapierAuthenticationError | ZapierApiError | ZapierResourceNotFoundError | ZapierValidationError | ZapierUnknownError;
|
|
24
25
|
export interface FindUniqueAuthenticationSdkFunction {
|
|
25
26
|
findUniqueAuthentication: (options?: FindUniqueAuthenticationOptions) => Promise<{
|
|
26
27
|
data: AuthenticationItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;EAgBsB,CAAC;AAGlE,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,8BAA8B,CACtC,CAAC;AAGF,MAAM,MAAM,6BAA6B,GACrC,yBAAyB,GACzB,cAAc,GACd,2BAA2B,GAC3B,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,mCAAmC;IAClD,wBAAwB,EAAE,CACxB,OAAO,CAAC,EAAE,+BAA+B,KACtC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;CAC5C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ActionItem } from "../../types/domain";
|
|
3
|
+
import type { ZapierAuthenticationError, ZapierApiError, ZapierAppNotFoundError, ZapierValidationError, ZapierResourceNotFoundError, ZapierUnknownError } from "../../types/errors";
|
|
3
4
|
export declare const GetActionSchema: z.ZodObject<{
|
|
4
5
|
appKey: z.ZodString;
|
|
5
6
|
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
@@ -14,7 +15,7 @@ export declare const GetActionSchema: z.ZodObject<{
|
|
|
14
15
|
actionKey: string;
|
|
15
16
|
}>;
|
|
16
17
|
export type GetActionOptions = z.infer<typeof GetActionSchema>;
|
|
17
|
-
export type GetActionError =
|
|
18
|
+
export type GetActionError = ZapierAuthenticationError | ZapierApiError | ZapierAppNotFoundError | ZapierValidationError | ZapierResourceNotFoundError | ZapierUnknownError;
|
|
18
19
|
export interface GetActionSdkFunction {
|
|
19
20
|
getAction: (options: GetActionOptions) => Promise<{
|
|
20
21
|
data: ActionItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,eAAe;;;;;;;;;;;;EAMmC,CAAC;AAGhE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAG/D,MAAM,MAAM,cAAc,GACtB,yBAAyB,GACzB,cAAc,GACd,sBAAsB,GACtB,qBAAqB,GACrB,2BAA2B,GAC3B,kBAAkB,CAAC;AAGvB,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;CACzE"}
|
|
@@ -3,8 +3,8 @@ import { GetAppSchema } from "./schemas";
|
|
|
3
3
|
import type { GetAppOptions } from "./schemas";
|
|
4
4
|
import type { AppItem } from "../../types/domain";
|
|
5
5
|
import type { GetSdkType } from "../../types/plugin";
|
|
6
|
-
import { GetImplementation } from "../manifest/schemas";
|
|
7
|
-
import { ManifestPluginProvides } from "../manifest";
|
|
6
|
+
import type { GetImplementation } from "../manifest/schemas";
|
|
7
|
+
import type { ManifestPluginProvides } from "../manifest";
|
|
8
8
|
export interface GetAppPluginProvides {
|
|
9
9
|
getApp: (options: GetAppOptions) => Promise<{
|
|
10
10
|
data: AppItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG1D,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC/D,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,WAAW,EAAE,OAAO,YAAY,CAAC;aAClC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAGD,eAAO,MAAM,YAAY,EAAE,MAAM,CAC/B,UAAU,CAAC,sBAAsB,CAAC,EAAE,+DAA+D;AACnG;IAAE,iBAAiB,EAAE,iBAAiB,CAAA;CAAE,EAAE,EAAE;AAC5C,oBAAoB,CA2BrB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AppItem } from "../../types/domain";
|
|
3
|
-
import { ZapierApiError, ZapierAppNotFoundError, ZapierValidationError } from "../../types/errors";
|
|
3
|
+
import type { ZapierApiError, ZapierAppNotFoundError, ZapierValidationError } from "../../types/errors";
|
|
4
4
|
export type GetAppError = ZapierAppNotFoundError | ZapierApiError | ZapierValidationError;
|
|
5
5
|
export declare const GetAppSchema: z.ZodObject<{
|
|
6
6
|
appKey: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAK5B,MAAM,MAAM,WAAW,GACnB,sBAAsB,GACtB,cAAc,GACd,qBAAqB,CAAC;AAG1B,eAAO,MAAM,YAAY;;;;;;EASxB,CAAC;AAGF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAGzD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAChE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AuthenticationItem } from "../../types/domain";
|
|
3
|
+
import type { ZapierAuthenticationError, ZapierResourceNotFoundError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
3
4
|
export declare const GetAuthenticationSchema: z.ZodObject<{
|
|
4
5
|
authenticationId: z.ZodNumber;
|
|
5
6
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -8,7 +9,7 @@ export declare const GetAuthenticationSchema: z.ZodObject<{
|
|
|
8
9
|
authenticationId: number;
|
|
9
10
|
}>;
|
|
10
11
|
export type GetAuthenticationOptions = z.infer<typeof GetAuthenticationSchema>;
|
|
11
|
-
export type GetAuthenticationError =
|
|
12
|
+
export type GetAuthenticationError = ZapierAuthenticationError | ZapierResourceNotFoundError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
|
|
12
13
|
export interface GetAuthenticationSdkFunction {
|
|
13
14
|
getAuthentication: (options: GetAuthenticationOptions) => Promise<{
|
|
14
15
|
data: AuthenticationItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC3B,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,uBAAuB;;;;;;EAQc,CAAC;AAGnD,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAG/E,MAAM,MAAM,sBAAsB,GAC9B,yBAAyB,GACzB,2BAA2B,GAC3B,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,4BAA4B;IAC3C,iBAAiB,EAAE,CACjB,OAAO,EAAE,wBAAwB,KAC9B,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;CAC5C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { FunctionOptions } from "../../types/functions";
|
|
3
3
|
import type { UserProfileItem } from "../../types/domain";
|
|
4
|
-
import { ZapierApiError, ZapierValidationError } from "../../types/errors";
|
|
4
|
+
import type { ZapierApiError, ZapierValidationError } from "../../types/errors";
|
|
5
5
|
export type GetProfileError = ZapierApiError | ZapierValidationError;
|
|
6
6
|
export declare const GetProfileSchema: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
7
7
|
export type GetProfileOptions = z.infer<typeof GetProfileSchema> & FunctionOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGhF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,qBAAqB,CAAC;AAGrE,eAAO,MAAM,gBAAgB,+DAG5B,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GAC9D,eAAe,CAAC;AAGlB,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,CACV,OAAO,CAAC,EAAE,iBAAiB,KACxB,OAAO,CAAC;QAAE,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC,CAAC;CACzC"}
|
|
@@ -2,8 +2,8 @@ import type { Plugin, GetSdkType } from "../../types/plugin";
|
|
|
2
2
|
import type { ApiClient } from "../../api";
|
|
3
3
|
import type { ActionItem } from "../../types/domain";
|
|
4
4
|
import { ListActionsSchema, type ListActionsOptions } from "./schemas";
|
|
5
|
-
import { ManifestPluginProvides } from "../manifest";
|
|
6
|
-
import { GetVersionedImplementationId } from "../manifest/schemas";
|
|
5
|
+
import type { ManifestPluginProvides } from "../manifest";
|
|
6
|
+
import type { GetVersionedImplementationId } from "../manifest/schemas";
|
|
7
7
|
export interface ListActionsPluginProvides {
|
|
8
8
|
listActions: (options?: ListActionsOptions) => Promise<{
|
|
9
9
|
data: ActionItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EAExB,MAAM,WAAW,CAAC;AAMnB,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EAExB,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC;QACrD,IAAI,EAAE,UAAU,EAAE,CAAC;KACpB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC3D,KAAK,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;KACpC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,WAAW,EAAE,OAAO,iBAAiB,CAAC;aACvC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CACpC,UAAU,CAAC,sBAAsB,CAAC,EAAE,yBAAyB;AAC7D;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,EAAE,2DAA2D;AAC9D,yBAAyB,CAkF1B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ActionItem } from "../../types/domain";
|
|
3
3
|
import type { PaginatedSdkFunction } from "../../types/functions";
|
|
4
|
+
import type { ZapierAuthenticationError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
4
5
|
export declare const ListActionsSchema: z.ZodObject<{
|
|
5
6
|
appKey: z.ZodString;
|
|
6
7
|
actionType: z.ZodOptional<z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>>;
|
|
@@ -22,7 +23,7 @@ export interface ListActionsPage {
|
|
|
22
23
|
data: ActionItem[];
|
|
23
24
|
nextCursor?: string;
|
|
24
25
|
}
|
|
25
|
-
export type ListActionsError =
|
|
26
|
+
export type ListActionsError = ZapierAuthenticationError | ZapierValidationError | ZapierUnknownError;
|
|
26
27
|
export interface ListActionsSdkFunction {
|
|
27
28
|
listActions: PaginatedSdkFunction<ListActionsOptions, ActionItem>;
|
|
28
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EACV,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAsB7B,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAGnE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,gBAAgB,GACxB,yBAAyB,GACzB,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,oBAAoB,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;CACnE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AppItem } from "../../types/domain";
|
|
3
3
|
import type { PaginatedSdkFunction } from "../../types/functions";
|
|
4
|
-
import { ZapierApiError, ZapierValidationError } from "../../types/errors";
|
|
4
|
+
import type { ZapierApiError, ZapierValidationError } from "../../types/errors";
|
|
5
5
|
export type ListAppsError = ZapierApiError | ZapierValidationError;
|
|
6
6
|
export interface ListAppsPage {
|
|
7
7
|
data: AppItem[];
|