@zapier/zapier-sdk 0.18.1 → 0.18.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/README.md +17 -17
- package/dist/api/router.d.ts.map +1 -1
- package/dist/api/router.js +1 -7
- package/dist/api/router.test.js +1 -7
- package/dist/api/schemas.d.ts +0 -49
- package/dist/api/schemas.d.ts.map +1 -1
- package/dist/api/schemas.js +0 -28
- package/dist/api/types.d.ts +2 -1
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js +0 -10
- package/dist/index.cjs +38 -301
- package/dist/index.d.mts +114 -207
- package/dist/index.mjs +38 -301
- package/dist/plugins/findFirstAuthentication/index.test.js +2 -2
- package/dist/plugins/findUniqueAuthentication/index.test.js +2 -2
- package/dist/plugins/getAuthentication/index.d.ts +3 -3
- package/dist/plugins/getAuthentication/index.d.ts.map +1 -1
- package/dist/plugins/getAuthentication/index.js +3 -5
- package/dist/plugins/getAuthentication/index.test.js +4 -16
- package/dist/plugins/getAuthentication/schemas.d.ts +2 -4
- package/dist/plugins/getAuthentication/schemas.d.ts.map +1 -1
- package/dist/plugins/getAuthentication/schemas.js +1 -1
- package/dist/plugins/listAuthentications/index.d.ts +4 -10
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/index.js +19 -31
- package/dist/plugins/listAuthentications/index.test.js +347 -127
- package/dist/plugins/listAuthentications/schemas.d.ts +7 -7
- package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/schemas.js +10 -16
- package/dist/schemas/Auth.d.ts +11 -11
- package/dist/schemas/Auth.d.ts.map +1 -1
- package/dist/schemas/Auth.js +2 -12
- package/dist/sdk.d.ts +4 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/temporary-internal-core/index.d.ts +0 -2
- package/dist/temporary-internal-core/index.d.ts.map +1 -1
- package/dist/temporary-internal-core/index.js +0 -2
- package/dist/temporary-internal-core/utils/transformations.d.ts +0 -14
- package/dist/temporary-internal-core/utils/transformations.d.ts.map +1 -1
- package/dist/temporary-internal-core/utils/transformations.js +0 -38
- package/dist/utils/domain-utils.d.ts +2 -15
- package/dist/utils/domain-utils.d.ts.map +1 -1
- package/dist/utils/domain-utils.js +0 -38
- package/dist/utils/function-utils.d.ts +1 -0
- package/dist/utils/function-utils.d.ts.map +1 -1
- package/dist/utils/function-utils.js +15 -3
- package/package.json +2 -1
- package/dist/temporary-internal-core/handlers/getAuthentication.d.ts +0 -94
- package/dist/temporary-internal-core/handlers/getAuthentication.d.ts.map +0 -1
- package/dist/temporary-internal-core/handlers/getAuthentication.js +0 -68
- package/dist/temporary-internal-core/handlers/getAuthentication.test.d.ts +0 -2
- package/dist/temporary-internal-core/handlers/getAuthentication.test.d.ts.map +0 -1
- package/dist/temporary-internal-core/handlers/getAuthentication.test.js +0 -248
- package/dist/temporary-internal-core/schemas/authentications/index.d.ts +0 -150
- package/dist/temporary-internal-core/schemas/authentications/index.d.ts.map +0 -1
- package/dist/temporary-internal-core/schemas/authentications/index.js +0 -97
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var zod = require('zod');
|
|
4
|
+
var authentications = require('@zapier/zapier-sdk-core/v0/schemas/authentications');
|
|
4
5
|
var promises = require('timers/promises');
|
|
5
6
|
var os = require('os');
|
|
6
7
|
|
|
@@ -715,10 +716,16 @@ function createPageFunction(coreFn) {
|
|
|
715
716
|
try {
|
|
716
717
|
const result = await coreFn(options);
|
|
717
718
|
if (result && typeof result === "object" && "data" in result) {
|
|
718
|
-
const
|
|
719
|
+
const paginatedResult = result;
|
|
720
|
+
let nextCursor;
|
|
721
|
+
if (paginatedResult.nextCursor) {
|
|
722
|
+
nextCursor = paginatedResult.nextCursor;
|
|
723
|
+
} else if (paginatedResult.links?.next) {
|
|
724
|
+
nextCursor = extractCursor({ next: paginatedResult.links.next });
|
|
725
|
+
}
|
|
719
726
|
return {
|
|
720
|
-
data: Array.isArray(data) ? data : [data],
|
|
721
|
-
nextCursor
|
|
727
|
+
data: Array.isArray(paginatedResult.data) ? paginatedResult.data : [paginatedResult.data],
|
|
728
|
+
nextCursor
|
|
722
729
|
};
|
|
723
730
|
}
|
|
724
731
|
if (Array.isArray(result)) {
|
|
@@ -1024,34 +1031,6 @@ zod.z.object({
|
|
|
1024
1031
|
format: zod.z.string().optional(),
|
|
1025
1032
|
inputFormat: zod.z.array(zod.z.string()).optional()
|
|
1026
1033
|
});
|
|
1027
|
-
var AuthenticationSchema = zod.z.object({
|
|
1028
|
-
id: zod.z.number(),
|
|
1029
|
-
date: zod.z.string(),
|
|
1030
|
-
lastchanged: zod.z.string().optional(),
|
|
1031
|
-
account_id: zod.z.number(),
|
|
1032
|
-
customuser_id: zod.z.number().optional(),
|
|
1033
|
-
selected_api: zod.z.string(),
|
|
1034
|
-
destination_selected_api: zod.z.string().nullable().optional(),
|
|
1035
|
-
is_invite_only: zod.z.boolean(),
|
|
1036
|
-
is_private: zod.z.boolean(),
|
|
1037
|
-
shared_with_all: zod.z.boolean(),
|
|
1038
|
-
is_stale: zod.z.string().optional(),
|
|
1039
|
-
is_shared: zod.z.string().optional(),
|
|
1040
|
-
marked_stale_at: zod.z.string().nullable().optional(),
|
|
1041
|
-
label: zod.z.string().nullable().optional(),
|
|
1042
|
-
identifier: zod.z.string().nullable().optional(),
|
|
1043
|
-
title: zod.z.string().nullable().optional(),
|
|
1044
|
-
url: zod.z.string().optional(),
|
|
1045
|
-
groups: zod.z.string().optional(),
|
|
1046
|
-
members: zod.z.string().optional(),
|
|
1047
|
-
permissions: zod.z.record(zod.z.string(), zod.z.boolean()).optional()
|
|
1048
|
-
});
|
|
1049
|
-
zod.z.object({
|
|
1050
|
-
count: zod.z.number(),
|
|
1051
|
-
next: zod.z.string().nullable().optional(),
|
|
1052
|
-
previous: zod.z.string().nullable().optional(),
|
|
1053
|
-
results: zod.z.array(AuthenticationSchema)
|
|
1054
|
-
});
|
|
1055
1034
|
zod.z.object({
|
|
1056
1035
|
id: zod.z.number(),
|
|
1057
1036
|
code: zod.z.string(),
|
|
@@ -1442,50 +1421,6 @@ function normalizeImplementationMetaToAppItem(implementationMeta) {
|
|
|
1442
1421
|
version: appVersion
|
|
1443
1422
|
};
|
|
1444
1423
|
}
|
|
1445
|
-
function normalizeAuthenticationItem(auth, options = {}) {
|
|
1446
|
-
let appKey = options.app_key;
|
|
1447
|
-
let appVersion = options.app_version;
|
|
1448
|
-
if (auth.selected_api) {
|
|
1449
|
-
const [extractedAppKey, extractedVersion] = splitVersionedKey(
|
|
1450
|
-
auth.selected_api
|
|
1451
|
-
);
|
|
1452
|
-
if (!appKey) {
|
|
1453
|
-
appKey = extractedAppKey;
|
|
1454
|
-
}
|
|
1455
|
-
if (!appVersion) {
|
|
1456
|
-
appVersion = extractedVersion;
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
const {
|
|
1460
|
-
selected_api: selectedApi,
|
|
1461
|
-
customuser_id: profileId,
|
|
1462
|
-
id,
|
|
1463
|
-
account_id: accountId,
|
|
1464
|
-
...restOfAuth
|
|
1465
|
-
} = auth;
|
|
1466
|
-
return {
|
|
1467
|
-
...restOfAuth,
|
|
1468
|
-
// Pass through all other API response fields except selected_api
|
|
1469
|
-
id: String(id),
|
|
1470
|
-
// Convert to string
|
|
1471
|
-
account_id: String(accountId),
|
|
1472
|
-
// Convert to string
|
|
1473
|
-
implementation_id: selectedApi,
|
|
1474
|
-
// Rename selected_api to implementation_id
|
|
1475
|
-
title: auth.title || auth.label || void 0,
|
|
1476
|
-
// Coerce title from label if missing
|
|
1477
|
-
is_expired: auth.is_stale,
|
|
1478
|
-
// Map is_stale to is_expired
|
|
1479
|
-
expired_at: auth.marked_stale_at,
|
|
1480
|
-
// Map marked_stale_at to expired_at
|
|
1481
|
-
app_key: appKey,
|
|
1482
|
-
// App key from implementations endpoint or parsed from selected_api
|
|
1483
|
-
app_version: appVersion,
|
|
1484
|
-
// Version from selected_api or provided
|
|
1485
|
-
profile_id: profileId != null ? String(profileId) : void 0
|
|
1486
|
-
// Map customuser_id to profile_id, convert to string
|
|
1487
|
-
};
|
|
1488
|
-
}
|
|
1489
1424
|
function normalizeActionItem(action) {
|
|
1490
1425
|
const { name, type, selected_api: selectedApi } = action;
|
|
1491
1426
|
const [appKey, appVersion] = selectedApi ? splitVersionedKey(selectedApi) : ["", void 0];
|
|
@@ -2247,42 +2182,26 @@ var listInputFieldsPlugin = ({ sdk, context }) => {
|
|
|
2247
2182
|
}
|
|
2248
2183
|
};
|
|
2249
2184
|
};
|
|
2250
|
-
var
|
|
2185
|
+
var ListAuthenticationsQuerySchema = authentications.ListAuthenticationsQuerySchema.omit(
|
|
2186
|
+
{
|
|
2187
|
+
offset: true
|
|
2188
|
+
}
|
|
2189
|
+
).extend({
|
|
2190
|
+
// Override appKey with our custom schema (array type, different description)
|
|
2251
2191
|
appKey: AppKeyPropertySchema.optional().describe(
|
|
2252
2192
|
"App key of authentications to list (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
2253
2193
|
),
|
|
2194
|
+
// Override authenticationIds to be an array instead of comma-separated string
|
|
2254
2195
|
authenticationIds: zod.z.array(zod.z.string()).optional().describe("List of authentication IDs to filter by"),
|
|
2255
|
-
|
|
2256
|
-
title: zod.z.string().optional().describe("Filter authentications by exact title match"),
|
|
2257
|
-
accountId: zod.z.string().optional().describe("Filter by account ID"),
|
|
2258
|
-
owner: zod.z.union([zod.z.string(), zod.z.literal("me")]).optional().describe(
|
|
2259
|
-
"Filter by owner, 'me' for your own authentications or a specific user ID"
|
|
2260
|
-
),
|
|
2196
|
+
// Override pageSize to make optional (needs to be fixed in `zapier-sdk-core`)
|
|
2261
2197
|
pageSize: zod.z.number().min(1).optional().describe("Number of authentications per page"),
|
|
2198
|
+
// SDK specific property for pagination/iterator helpers
|
|
2262
2199
|
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
2200
|
+
// SDK specific property for pagination/iterator helpers
|
|
2263
2201
|
cursor: zod.z.string().optional().describe("Cursor to start from")
|
|
2264
2202
|
}).merge(TelemetryMarkerSchema).describe("List available authentications with optional filtering");
|
|
2265
2203
|
var AuthenticationItemSchema = withFormatter(
|
|
2266
|
-
|
|
2267
|
-
{
|
|
2268
|
-
id: zod.z.string(),
|
|
2269
|
-
// Converted from number
|
|
2270
|
-
account_id: zod.z.string(),
|
|
2271
|
-
// Converted from number
|
|
2272
|
-
implementation_id: zod.z.string().optional(),
|
|
2273
|
-
// Renamed from selected_api
|
|
2274
|
-
is_expired: zod.z.string().optional(),
|
|
2275
|
-
// Mapped from is_stale
|
|
2276
|
-
expired_at: zod.z.string().nullable().optional(),
|
|
2277
|
-
// Mapped from marked_stale_at
|
|
2278
|
-
app_key: zod.z.string().optional(),
|
|
2279
|
-
// App key from implementations endpoint
|
|
2280
|
-
app_version: zod.z.string().optional(),
|
|
2281
|
-
// Version extracted from implementation_id
|
|
2282
|
-
profile_id: zod.z.string().optional()
|
|
2283
|
-
// Mapped from customuser_id, converted from number
|
|
2284
|
-
}
|
|
2285
|
-
),
|
|
2204
|
+
authentications.AuthenticationItemSchema,
|
|
2286
2205
|
{
|
|
2287
2206
|
format: (item) => {
|
|
2288
2207
|
const details = [];
|
|
@@ -2315,36 +2234,38 @@ var AuthenticationItemSchema = withFormatter(
|
|
|
2315
2234
|
var listAuthenticationsPlugin = ({ context }) => {
|
|
2316
2235
|
async function listAuthenticationsPage(options) {
|
|
2317
2236
|
const { api, getVersionedImplementationId } = context;
|
|
2318
|
-
const searchParams = {
|
|
2237
|
+
const searchParams = {
|
|
2238
|
+
pageSize: options.pageSize.toString()
|
|
2239
|
+
};
|
|
2319
2240
|
if (options.appKey) {
|
|
2320
2241
|
const implementationId = await getVersionedImplementationId(
|
|
2321
2242
|
options.appKey
|
|
2322
2243
|
);
|
|
2323
2244
|
if (implementationId) {
|
|
2324
2245
|
const [versionlessSelectedApi] = splitVersionedKey(implementationId);
|
|
2325
|
-
searchParams.
|
|
2246
|
+
searchParams.appKey = versionlessSelectedApi;
|
|
2326
2247
|
}
|
|
2327
2248
|
}
|
|
2328
2249
|
if (options.authenticationIds && options.authenticationIds.length > 0) {
|
|
2329
|
-
searchParams.
|
|
2250
|
+
searchParams.authenticationIds = options.authenticationIds.join(",");
|
|
2330
2251
|
}
|
|
2331
2252
|
if (options.search) {
|
|
2332
2253
|
searchParams.search = options.search;
|
|
2333
|
-
}
|
|
2334
|
-
|
|
2254
|
+
}
|
|
2255
|
+
if (options.title) {
|
|
2256
|
+
searchParams.title = options.title;
|
|
2335
2257
|
}
|
|
2336
2258
|
if (options.accountId) {
|
|
2337
|
-
searchParams.
|
|
2259
|
+
searchParams.accountId = options.accountId;
|
|
2338
2260
|
}
|
|
2339
2261
|
if (options.owner) {
|
|
2340
2262
|
searchParams.owner = options.owner;
|
|
2341
2263
|
}
|
|
2342
|
-
searchParams.limit = options.pageSize.toString();
|
|
2343
2264
|
if (options.cursor) {
|
|
2344
2265
|
searchParams.offset = options.cursor;
|
|
2345
2266
|
}
|
|
2346
|
-
const
|
|
2347
|
-
"/
|
|
2267
|
+
const response = await api.get(
|
|
2268
|
+
"/api/v0/authentications",
|
|
2348
2269
|
{
|
|
2349
2270
|
searchParams,
|
|
2350
2271
|
customErrorHandler: ({ status }) => {
|
|
@@ -2365,21 +2286,12 @@ var listAuthenticationsPlugin = ({ context }) => {
|
|
|
2365
2286
|
authRequired: true
|
|
2366
2287
|
}
|
|
2367
2288
|
);
|
|
2368
|
-
|
|
2369
|
-
(auth) => normalizeAuthenticationItem(auth)
|
|
2370
|
-
);
|
|
2371
|
-
if (options.title) {
|
|
2372
|
-
auths = auths.filter((auth) => auth.title === options.title);
|
|
2373
|
-
}
|
|
2374
|
-
return {
|
|
2375
|
-
data: auths,
|
|
2376
|
-
nextCursor: extractCursor(data)
|
|
2377
|
-
};
|
|
2289
|
+
return response;
|
|
2378
2290
|
}
|
|
2379
2291
|
const methodName = stripPageSuffix(listAuthenticationsPage.name);
|
|
2380
2292
|
const listAuthenticationsDefinition = createPaginatedFunction(
|
|
2381
2293
|
listAuthenticationsPage,
|
|
2382
|
-
|
|
2294
|
+
ListAuthenticationsQuerySchema,
|
|
2383
2295
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
2384
2296
|
methodName
|
|
2385
2297
|
);
|
|
@@ -2391,7 +2303,7 @@ var listAuthenticationsPlugin = ({ context }) => {
|
|
|
2391
2303
|
categories: ["authentication"],
|
|
2392
2304
|
type: "list",
|
|
2393
2305
|
itemType: "Authentication",
|
|
2394
|
-
inputSchema:
|
|
2306
|
+
inputSchema: ListAuthenticationsQuerySchema,
|
|
2395
2307
|
outputSchema: AuthenticationItemSchema,
|
|
2396
2308
|
resolvers: {
|
|
2397
2309
|
appKey: appKeyResolver
|
|
@@ -2497,64 +2409,6 @@ var getActionPlugin = ({ sdk, context }) => {
|
|
|
2497
2409
|
}
|
|
2498
2410
|
};
|
|
2499
2411
|
};
|
|
2500
|
-
var AuthenticationSchema2 = zod.z.object({
|
|
2501
|
-
id: zod.z.number(),
|
|
2502
|
-
date: zod.z.string(),
|
|
2503
|
-
lastchanged: zod.z.string().optional(),
|
|
2504
|
-
account_id: zod.z.number(),
|
|
2505
|
-
customuser_id: zod.z.number().optional(),
|
|
2506
|
-
selected_api: zod.z.string(),
|
|
2507
|
-
destination_selected_api: zod.z.string().nullable().optional(),
|
|
2508
|
-
is_invite_only: zod.z.boolean(),
|
|
2509
|
-
is_private: zod.z.boolean(),
|
|
2510
|
-
shared_with_all: zod.z.boolean(),
|
|
2511
|
-
is_stale: zod.z.string().optional(),
|
|
2512
|
-
is_shared: zod.z.string().optional(),
|
|
2513
|
-
marked_stale_at: zod.z.string().nullable().optional(),
|
|
2514
|
-
label: zod.z.string().nullable().optional(),
|
|
2515
|
-
identifier: zod.z.string().nullable().optional(),
|
|
2516
|
-
title: zod.z.string().nullable().optional(),
|
|
2517
|
-
url: zod.z.string().optional(),
|
|
2518
|
-
groups: zod.z.string().optional(),
|
|
2519
|
-
members: zod.z.string().optional(),
|
|
2520
|
-
permissions: zod.z.record(zod.z.string(), zod.z.boolean()).optional()
|
|
2521
|
-
});
|
|
2522
|
-
zod.z.object({
|
|
2523
|
-
count: zod.z.number(),
|
|
2524
|
-
next: zod.z.string().nullable().optional(),
|
|
2525
|
-
previous: zod.z.string().nullable().optional(),
|
|
2526
|
-
results: zod.z.array(AuthenticationSchema2)
|
|
2527
|
-
});
|
|
2528
|
-
var AuthenticationItemSchema2 = AuthenticationSchema2.omit({
|
|
2529
|
-
selected_api: true,
|
|
2530
|
-
customuser_id: true
|
|
2531
|
-
}).extend({
|
|
2532
|
-
// Override numeric IDs with string versions (converted by normalizeAuthenticationItem)
|
|
2533
|
-
id: zod.z.string(),
|
|
2534
|
-
account_id: zod.z.string(),
|
|
2535
|
-
// Renamed fields
|
|
2536
|
-
implementation_id: zod.z.string().optional(),
|
|
2537
|
-
profile_id: zod.z.string().optional(),
|
|
2538
|
-
// Mapped fields (originals preserved in ...restOfAuth)
|
|
2539
|
-
is_expired: zod.z.string().optional(),
|
|
2540
|
-
expired_at: zod.z.string().nullable().optional(),
|
|
2541
|
-
// Computed fields
|
|
2542
|
-
app_key: zod.z.string().optional(),
|
|
2543
|
-
app_version: zod.z.string().optional()
|
|
2544
|
-
});
|
|
2545
|
-
var GetAuthenticationOptionsSchema = zod.z.object({
|
|
2546
|
-
authenticationId: zod.z.union([zod.z.string(), zod.z.number().int().positive()]).describe("Authentication ID to retrieve")
|
|
2547
|
-
}).describe("Get a specific authentication by ID");
|
|
2548
|
-
var GetAuthenticationHandlerRequestSchema = zod.z.object({
|
|
2549
|
-
authenticationId: zod.z.union([zod.z.string(), zod.z.number()]).describe("Authentication ID - string from searchParams or number")
|
|
2550
|
-
}).transform((data) => ({
|
|
2551
|
-
authenticationId: typeof data.authenticationId === "string" ? parseInt(data.authenticationId, 10) : data.authenticationId
|
|
2552
|
-
}));
|
|
2553
|
-
zod.z.object({
|
|
2554
|
-
data: zod.z.lazy(() => AuthenticationItemSchema2)
|
|
2555
|
-
});
|
|
2556
|
-
|
|
2557
|
-
// src/plugins/getAuthentication/index.ts
|
|
2558
2412
|
var getAuthenticationPlugin = ({ context }) => {
|
|
2559
2413
|
async function getAuthentication(options) {
|
|
2560
2414
|
const { api } = context;
|
|
@@ -2564,7 +2418,7 @@ var getAuthenticationPlugin = ({ context }) => {
|
|
|
2564
2418
|
}
|
|
2565
2419
|
const getAuthenticationDefinition = createFunction(
|
|
2566
2420
|
getAuthentication,
|
|
2567
|
-
|
|
2421
|
+
authentications.GetAuthenticationParamSchema,
|
|
2568
2422
|
createTelemetryCallback(
|
|
2569
2423
|
context.eventEmission.emitMethodCalled,
|
|
2570
2424
|
getAuthentication.name
|
|
@@ -2578,7 +2432,7 @@ var getAuthenticationPlugin = ({ context }) => {
|
|
|
2578
2432
|
categories: ["authentication"],
|
|
2579
2433
|
type: "item",
|
|
2580
2434
|
itemType: "Authentication",
|
|
2581
|
-
inputSchema:
|
|
2435
|
+
inputSchema: authentications.GetAuthenticationParamSchema,
|
|
2582
2436
|
outputSchema: AuthenticationItemSchema,
|
|
2583
2437
|
resolvers: {
|
|
2584
2438
|
authenticationId: authenticationIdGenericResolver
|
|
@@ -3876,50 +3730,6 @@ function extractPaginationCursor(response) {
|
|
|
3876
3730
|
return void 0;
|
|
3877
3731
|
}
|
|
3878
3732
|
}
|
|
3879
|
-
function normalizeAuthenticationItem2(auth, options = {}) {
|
|
3880
|
-
let appKey = options.app_key;
|
|
3881
|
-
let appVersion = options.app_version;
|
|
3882
|
-
if (auth.selected_api) {
|
|
3883
|
-
const [extractedAppKey, extractedVersion] = splitVersionedKey2(
|
|
3884
|
-
auth.selected_api
|
|
3885
|
-
);
|
|
3886
|
-
if (!appKey) {
|
|
3887
|
-
appKey = extractedAppKey;
|
|
3888
|
-
}
|
|
3889
|
-
if (!appVersion) {
|
|
3890
|
-
appVersion = extractedVersion;
|
|
3891
|
-
}
|
|
3892
|
-
}
|
|
3893
|
-
const {
|
|
3894
|
-
selected_api: selectedApi,
|
|
3895
|
-
customuser_id: profileId,
|
|
3896
|
-
id,
|
|
3897
|
-
account_id: accountId,
|
|
3898
|
-
...restOfAuth
|
|
3899
|
-
} = auth;
|
|
3900
|
-
return {
|
|
3901
|
-
...restOfAuth,
|
|
3902
|
-
// Pass through all other API response fields except selected_api
|
|
3903
|
-
id: String(id),
|
|
3904
|
-
// Convert to string
|
|
3905
|
-
account_id: String(accountId),
|
|
3906
|
-
// Convert to string
|
|
3907
|
-
implementation_id: selectedApi,
|
|
3908
|
-
// Rename selected_api to implementation_id
|
|
3909
|
-
title: auth.title || auth.label || void 0,
|
|
3910
|
-
// Coerce title from label if missing
|
|
3911
|
-
is_expired: auth.is_stale,
|
|
3912
|
-
// Map is_stale to is_expired
|
|
3913
|
-
expired_at: auth.marked_stale_at,
|
|
3914
|
-
// Map marked_stale_at to expired_at
|
|
3915
|
-
app_key: appKey,
|
|
3916
|
-
// App key from implementations endpoint or parsed from selected_api
|
|
3917
|
-
app_version: appVersion,
|
|
3918
|
-
// Version from selected_api or provided
|
|
3919
|
-
profile_id: profileId != null ? String(profileId) : void 0
|
|
3920
|
-
// Map customuser_id to profile_id, convert to string
|
|
3921
|
-
};
|
|
3922
|
-
}
|
|
3923
3733
|
|
|
3924
3734
|
// src/temporary-internal-core/handlers/listApps.ts
|
|
3925
3735
|
var DEFAULT_PAGE_SIZE = 20;
|
|
@@ -4023,73 +3833,6 @@ var handleListApps = async ({ request, deps }) => {
|
|
|
4023
3833
|
};
|
|
4024
3834
|
};
|
|
4025
3835
|
|
|
4026
|
-
// src/temporary-internal-core/schemas/errors/index.ts
|
|
4027
|
-
var ZapierError2 = class extends Error {
|
|
4028
|
-
constructor(message, options = {}) {
|
|
4029
|
-
super(message);
|
|
4030
|
-
this.statusCode = options.statusCode;
|
|
4031
|
-
this.errors = options.errors;
|
|
4032
|
-
this.cause = options.cause;
|
|
4033
|
-
this.response = options.response;
|
|
4034
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
4035
|
-
}
|
|
4036
|
-
};
|
|
4037
|
-
var ZapierAuthenticationError2 = class extends ZapierError2 {
|
|
4038
|
-
constructor(message, options = {}) {
|
|
4039
|
-
super(message, options);
|
|
4040
|
-
this.name = "ZapierAuthenticationError";
|
|
4041
|
-
}
|
|
4042
|
-
};
|
|
4043
|
-
var ZapierResourceNotFoundError2 = class extends ZapierError2 {
|
|
4044
|
-
constructor(message, options = {}) {
|
|
4045
|
-
super(message, options);
|
|
4046
|
-
this.name = "ZapierResourceNotFoundError";
|
|
4047
|
-
this.resourceType = options.resourceType;
|
|
4048
|
-
this.resourceId = options.resourceId;
|
|
4049
|
-
}
|
|
4050
|
-
};
|
|
4051
|
-
|
|
4052
|
-
// src/temporary-internal-core/handlers/getAuthentication.ts
|
|
4053
|
-
var handleGetAuthentication = async ({ request, deps }) => {
|
|
4054
|
-
const validatedRequest = GetAuthenticationHandlerRequestSchema.parse(request);
|
|
4055
|
-
const { httpClient } = deps;
|
|
4056
|
-
const { authenticationId } = validatedRequest;
|
|
4057
|
-
const authentication = await httpClient.get(
|
|
4058
|
-
`/zapier/api/v4/authentications/${authenticationId}/`,
|
|
4059
|
-
{
|
|
4060
|
-
authRequired: true,
|
|
4061
|
-
customErrorHandler: ({ status }) => {
|
|
4062
|
-
if (status === 401) {
|
|
4063
|
-
return new ZapierAuthenticationError2(
|
|
4064
|
-
`Authentication failed. Your token may not have permission to access authentications or may be expired. (HTTP ${status})`,
|
|
4065
|
-
{ statusCode: status }
|
|
4066
|
-
);
|
|
4067
|
-
}
|
|
4068
|
-
if (status === 403) {
|
|
4069
|
-
return new ZapierAuthenticationError2(
|
|
4070
|
-
`Access forbidden. Your token may not have the required scopes to get authentication ${authenticationId}. (HTTP ${status})`,
|
|
4071
|
-
{ statusCode: status }
|
|
4072
|
-
);
|
|
4073
|
-
}
|
|
4074
|
-
if (status === 404) {
|
|
4075
|
-
return new ZapierResourceNotFoundError2(
|
|
4076
|
-
`Authentication ${authenticationId} not found. It may not exist or you may not have access to it. (HTTP ${status})`,
|
|
4077
|
-
{
|
|
4078
|
-
resourceType: "Authentication",
|
|
4079
|
-
resourceId: String(authenticationId)
|
|
4080
|
-
}
|
|
4081
|
-
);
|
|
4082
|
-
}
|
|
4083
|
-
return void 0;
|
|
4084
|
-
}
|
|
4085
|
-
}
|
|
4086
|
-
);
|
|
4087
|
-
const normalizedAuthentication = normalizeAuthenticationItem2(authentication);
|
|
4088
|
-
return {
|
|
4089
|
-
data: normalizedAuthentication
|
|
4090
|
-
};
|
|
4091
|
-
};
|
|
4092
|
-
|
|
4093
3836
|
// src/api/router.ts
|
|
4094
3837
|
var routes = [
|
|
4095
3838
|
{
|
|
@@ -4097,12 +3840,6 @@ var routes = [
|
|
|
4097
3840
|
pattern: /^\/api\/v0\/apps$/,
|
|
4098
3841
|
handler: handleListApps,
|
|
4099
3842
|
paramMap: []
|
|
4100
|
-
},
|
|
4101
|
-
{
|
|
4102
|
-
method: "GET",
|
|
4103
|
-
pattern: /^\/api\/v0\/authentications\/([^\/]+)$/,
|
|
4104
|
-
handler: handleGetAuthentication,
|
|
4105
|
-
paramMap: ["authenticationId"]
|
|
4106
3843
|
}
|
|
4107
3844
|
];
|
|
4108
3845
|
function findMatchingRoute(routeList, method, path) {
|
|
@@ -5072,7 +4809,7 @@ function getCpuTime() {
|
|
|
5072
4809
|
|
|
5073
4810
|
// package.json
|
|
5074
4811
|
var package_default = {
|
|
5075
|
-
version: "0.18.
|
|
4812
|
+
version: "0.18.3"};
|
|
5076
4813
|
|
|
5077
4814
|
// src/plugins/eventEmission/builders.ts
|
|
5078
4815
|
function createBaseEvent(context = {}) {
|