@zapier/zapier-sdk 0.12.1 → 0.13.1
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 +172 -84
- package/dist/api/schemas.d.ts +10 -865
- package/dist/api/schemas.d.ts.map +1 -1
- package/dist/api/schemas.js +0 -6
- package/dist/index.cjs +58 -41
- package/dist/index.d.mts +69 -427
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +58 -41
- package/dist/plugins/apps/schemas.d.ts +9 -1
- package/dist/plugins/apps/schemas.d.ts.map +1 -1
- package/dist/plugins/findFirstAuthentication/schemas.js +1 -1
- package/dist/plugins/findUniqueAuthentication/schemas.js +1 -1
- package/dist/plugins/getApp/index.test.js +58 -6
- package/dist/plugins/getApp/schemas.js +1 -1
- package/dist/plugins/getAuthentication/index.test.js +1 -1
- package/dist/plugins/listActions/index.d.ts +1 -0
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/schemas.d.ts +3 -0
- package/dist/plugins/listActions/schemas.d.ts.map +1 -1
- package/dist/plugins/listActions/schemas.js +2 -1
- package/dist/plugins/listApps/index.d.ts +1 -0
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +18 -10
- package/dist/plugins/listApps/schemas.d.ts +3 -0
- package/dist/plugins/listApps/schemas.d.ts.map +1 -1
- package/dist/plugins/listApps/schemas.js +1 -0
- package/dist/plugins/listAuthentications/index.d.ts +1 -0
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/schemas.d.ts +3 -0
- package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/schemas.js +2 -1
- package/dist/plugins/listInputFieldChoices/index.d.ts +1 -0
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +3 -0
- package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/schemas.js +1 -0
- package/dist/plugins/listInputFields/index.d.ts +1 -0
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/schemas.d.ts +3 -0
- package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFields/schemas.js +1 -0
- package/dist/plugins/runAction/index.d.ts +1 -0
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/schemas.d.ts +3 -0
- package/dist/plugins/runAction/schemas.d.ts.map +1 -1
- package/dist/plugins/runAction/schemas.js +1 -0
- package/dist/schemas/Action.d.ts +4 -206
- package/dist/schemas/Action.d.ts.map +1 -1
- package/dist/schemas/Action.js +3 -2
- package/dist/schemas/App.d.ts.map +1 -1
- package/dist/schemas/App.js +1 -0
- package/dist/schemas/Auth.d.ts +10 -10
- package/dist/schemas/Auth.js +1 -1
- package/dist/types/properties.d.ts.map +1 -1
- package/dist/types/properties.js +4 -1
- package/dist/utils/domain-utils.d.ts +2 -2
- package/dist/utils/domain-utils.d.ts.map +1 -1
- package/dist/utils/domain-utils.js +19 -8
- package/dist/utils/schema-utils.d.ts +1 -0
- package/dist/utils/schema-utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/schemas.ts +0 -6
- package/src/index.ts +1 -0
- package/src/plugins/apps/schemas.ts +7 -1
- package/src/plugins/findFirstAuthentication/schemas.ts +1 -1
- package/src/plugins/findUniqueAuthentication/schemas.ts +1 -1
- package/src/plugins/getApp/index.test.ts +83 -31
- package/src/plugins/getApp/schemas.ts +1 -1
- package/src/plugins/getAuthentication/index.test.ts +1 -1
- package/src/plugins/listActions/index.ts +1 -0
- package/src/plugins/listActions/schemas.ts +2 -1
- package/src/plugins/listApps/index.ts +23 -11
- package/src/plugins/listApps/schemas.ts +1 -0
- package/src/plugins/listAuthentications/index.ts +1 -0
- package/src/plugins/listAuthentications/schemas.ts +2 -1
- package/src/plugins/listInputFieldChoices/index.ts +1 -0
- package/src/plugins/listInputFieldChoices/schemas.ts +1 -0
- package/src/plugins/listInputFields/index.ts +1 -0
- package/src/plugins/listInputFields/schemas.ts +1 -0
- package/src/plugins/runAction/index.ts +4 -1
- package/src/plugins/runAction/schemas.ts +1 -0
- package/src/schemas/Action.ts +3 -2
- package/src/schemas/App.ts +1 -0
- package/src/schemas/Auth.ts +1 -1
- package/src/types/properties.ts +4 -1
- package/src/utils/domain-utils.ts +22 -9
- package/src/utils/schema-utils.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export * from "./plugins/api";
|
|
|
21
21
|
export type { Action, App, Need, Field, Choice, ActionExecutionResult, ActionField, ActionFieldChoice, NeedsRequest, NeedsResponse, Authentication, AuthenticationsResponse, UserProfile, } from "./api/types";
|
|
22
22
|
export { isPositional, PositionalMetadata } from "./utils/schema-utils";
|
|
23
23
|
export { createFunction } from "./utils/function-utils";
|
|
24
|
+
export type { FormattedItem, FormatMetadata } from "./utils/schema-utils";
|
|
24
25
|
export * from "./resolvers";
|
|
25
26
|
export * from "./auth";
|
|
26
27
|
export { RelayRequestSchema, RelayFetchSchema, } from "./plugins/request/schemas";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAG9B,YAAY,EACV,MAAM,EACN,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAG9B,YAAY,EACV,MAAM,EACN,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG1E,cAAc,aAAa,CAAC;AAG5B,cAAc,QAAQ,CAAC;AAIvB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,SAAS,EACT,gBAAgB,GACjB,MAAM,OAAO,CAAC;AAGf,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGzD,YAAY,EACV,MAAM,EACN,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,cAAc,EACd,GAAG,GACJ,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -35,7 +35,7 @@ var MAX_PAGE_LIMIT = 1e4;
|
|
|
35
35
|
|
|
36
36
|
// src/types/properties.ts
|
|
37
37
|
var AppKeyPropertySchema = withPositional(
|
|
38
|
-
z.string().min(1).describe("App key (e.g., 'SlackCLIAPI')")
|
|
38
|
+
z.string().min(1).describe("App key (e.g., 'SlackCLIAPI' or slug like 'github')")
|
|
39
39
|
);
|
|
40
40
|
var ActionTypePropertySchema = z.enum([
|
|
41
41
|
"read",
|
|
@@ -692,7 +692,8 @@ var ListAppsSchema = z.object({
|
|
|
692
692
|
),
|
|
693
693
|
search: z.string().optional().describe("Search for apps by name"),
|
|
694
694
|
pageSize: z.number().min(1).optional().describe("Number of apps per page"),
|
|
695
|
-
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
|
|
695
|
+
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
696
|
+
cursor: z.string().optional().describe("Cursor to start from")
|
|
696
697
|
}).describe("List all available apps with optional filtering");
|
|
697
698
|
var NeedChoicesSchema = z.object({
|
|
698
699
|
key: z.string().optional(),
|
|
@@ -741,10 +742,10 @@ var NeedSchema = z.object({
|
|
|
741
742
|
]).optional(),
|
|
742
743
|
list: z.boolean().optional()
|
|
743
744
|
});
|
|
744
|
-
|
|
745
|
+
z.object({
|
|
745
746
|
action_url: z.string().optional()
|
|
746
747
|
});
|
|
747
|
-
|
|
748
|
+
z.object({
|
|
748
749
|
can_use: z.boolean().optional()
|
|
749
750
|
});
|
|
750
751
|
var ActionSchema = z.object({
|
|
@@ -761,16 +762,10 @@ var ActionSchema = z.object({
|
|
|
761
762
|
]),
|
|
762
763
|
key: z.string(),
|
|
763
764
|
name: z.string(),
|
|
764
|
-
noun: z.string().optional(),
|
|
765
765
|
description: z.string(),
|
|
766
|
-
description_html: z.string().optional(),
|
|
767
766
|
is_important: z.boolean().optional(),
|
|
768
767
|
is_hidden: z.boolean().optional(),
|
|
769
|
-
|
|
770
|
-
meta: z.string().optional(),
|
|
771
|
-
selected_api: z.string().optional(),
|
|
772
|
-
links: ActionLinksSchema.optional(),
|
|
773
|
-
permissions: ActionPermissionsSchema.optional()
|
|
768
|
+
selected_api: z.string().optional()
|
|
774
769
|
});
|
|
775
770
|
var ChoiceSchema = z.object({
|
|
776
771
|
value: z.union([z.string(), z.number()]),
|
|
@@ -1100,6 +1095,7 @@ var AppItemSchema = withFormatter(
|
|
|
1100
1095
|
return {
|
|
1101
1096
|
title: item.title,
|
|
1102
1097
|
key: item.key,
|
|
1098
|
+
keys: [item.slug, item.key].filter(Boolean),
|
|
1103
1099
|
description: item.description,
|
|
1104
1100
|
details: []
|
|
1105
1101
|
};
|
|
@@ -1134,7 +1130,7 @@ function normalizeImplementationMetaToAppItem(implementationMeta) {
|
|
|
1134
1130
|
}
|
|
1135
1131
|
function normalizeAuthenticationItem(auth, options = {}) {
|
|
1136
1132
|
let appKey = options.app_key;
|
|
1137
|
-
let
|
|
1133
|
+
let appVersion = options.app_version;
|
|
1138
1134
|
if (auth.selected_api) {
|
|
1139
1135
|
const [extractedAppKey, extractedVersion] = splitVersionedKey(
|
|
1140
1136
|
auth.selected_api
|
|
@@ -1142,8 +1138,8 @@ function normalizeAuthenticationItem(auth, options = {}) {
|
|
|
1142
1138
|
if (!appKey) {
|
|
1143
1139
|
appKey = extractedAppKey;
|
|
1144
1140
|
}
|
|
1145
|
-
if (!
|
|
1146
|
-
|
|
1141
|
+
if (!appVersion) {
|
|
1142
|
+
appVersion = extractedVersion;
|
|
1147
1143
|
}
|
|
1148
1144
|
}
|
|
1149
1145
|
const {
|
|
@@ -1164,17 +1160,25 @@ function normalizeAuthenticationItem(auth, options = {}) {
|
|
|
1164
1160
|
// Map marked_stale_at to expired_at
|
|
1165
1161
|
app_key: appKey,
|
|
1166
1162
|
// App key from implementations endpoint or parsed from selected_api
|
|
1167
|
-
|
|
1163
|
+
app_version: appVersion,
|
|
1168
1164
|
// Version from selected_api or provided
|
|
1169
1165
|
user_id: userId
|
|
1170
1166
|
// Map customuser_id to user_id
|
|
1171
1167
|
};
|
|
1172
1168
|
}
|
|
1173
1169
|
function normalizeActionItem(action) {
|
|
1174
|
-
const { name, type, selected_api:
|
|
1170
|
+
const { name, type, selected_api: selectedApi } = action;
|
|
1171
|
+
const [appKey, appVersion] = selectedApi ? splitVersionedKey(selectedApi) : ["", void 0];
|
|
1175
1172
|
return {
|
|
1176
|
-
|
|
1177
|
-
|
|
1173
|
+
// Only include the fields we want - explicitly list them
|
|
1174
|
+
id: action.id,
|
|
1175
|
+
key: action.key,
|
|
1176
|
+
description: action.description,
|
|
1177
|
+
is_important: action.is_important,
|
|
1178
|
+
is_hidden: action.is_hidden,
|
|
1179
|
+
// Transformed fields
|
|
1180
|
+
app_key: appKey,
|
|
1181
|
+
app_version: appVersion,
|
|
1178
1182
|
action_type: type,
|
|
1179
1183
|
title: name,
|
|
1180
1184
|
// Map name to title
|
|
@@ -1229,10 +1233,10 @@ function toImplementationId(appLocator) {
|
|
|
1229
1233
|
// src/plugins/listApps/index.ts
|
|
1230
1234
|
var listAppsPlugin = ({ context }) => {
|
|
1231
1235
|
const listApps = createPaginatedFunction(async function listAppsPage(options) {
|
|
1232
|
-
const api = context
|
|
1233
|
-
const
|
|
1234
|
-
const appLocators = await
|
|
1235
|
-
appKeys: [...
|
|
1236
|
+
const { api, resolveAppKeys: resolveAppKeys2 } = context;
|
|
1237
|
+
const appKeys = options.appKeys ?? [];
|
|
1238
|
+
const appLocators = await resolveAppKeys2({
|
|
1239
|
+
appKeys: [...appKeys]
|
|
1236
1240
|
});
|
|
1237
1241
|
const implementationNameToLocator = {};
|
|
1238
1242
|
for (const locator of appLocators) {
|
|
@@ -1247,9 +1251,9 @@ var listAppsPlugin = ({ context }) => {
|
|
|
1247
1251
|
`Duplicate lookup app keys found: ${duplicatedLookupAppKeys.join(", ")}`
|
|
1248
1252
|
);
|
|
1249
1253
|
}
|
|
1250
|
-
if (
|
|
1254
|
+
if (options.search) {
|
|
1251
1255
|
const searchParams2 = {};
|
|
1252
|
-
searchParams2.term =
|
|
1256
|
+
searchParams2.term = options.search;
|
|
1253
1257
|
const searchEnvelope = await api.get(
|
|
1254
1258
|
"/api/v4/implementations-meta/search/",
|
|
1255
1259
|
{
|
|
@@ -1274,16 +1278,22 @@ var listAppsPlugin = ({ context }) => {
|
|
|
1274
1278
|
}
|
|
1275
1279
|
}
|
|
1276
1280
|
const searchParams = {};
|
|
1277
|
-
if (
|
|
1278
|
-
searchParams.limit =
|
|
1281
|
+
if (options.pageSize) {
|
|
1282
|
+
searchParams.limit = options.pageSize.toString();
|
|
1279
1283
|
}
|
|
1280
1284
|
if (appLocators.length === 0) {
|
|
1281
1285
|
searchParams.latest_only = "true";
|
|
1282
1286
|
}
|
|
1283
|
-
if (
|
|
1284
|
-
searchParams.offset =
|
|
1287
|
+
if (options.cursor) {
|
|
1288
|
+
searchParams.offset = options.cursor;
|
|
1285
1289
|
}
|
|
1286
1290
|
searchParams.selected_apis = appLocators.map((locator) => toImplementationId(locator)).join(",");
|
|
1291
|
+
if (appKeys.length > 0 && appLocators.length === 0) {
|
|
1292
|
+
return {
|
|
1293
|
+
data: [],
|
|
1294
|
+
nextCursor: void 0
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1287
1297
|
const implementationsEnvelope = await api.get(
|
|
1288
1298
|
"/api/v4/implementations-meta/lookup/",
|
|
1289
1299
|
{
|
|
@@ -1314,18 +1324,21 @@ var listAppsPlugin = ({ context }) => {
|
|
|
1314
1324
|
};
|
|
1315
1325
|
var ListActionsSchema = z.object({
|
|
1316
1326
|
appKey: AppKeyPropertySchema.describe(
|
|
1317
|
-
"App key of actions to list (e.g., 'SlackCLIAPI')"
|
|
1327
|
+
"App key of actions to list (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
1318
1328
|
),
|
|
1319
1329
|
actionType: ActionTypePropertySchema.optional().describe(
|
|
1320
1330
|
"Filter actions by type"
|
|
1321
1331
|
),
|
|
1322
1332
|
pageSize: z.number().min(1).optional().describe("Number of actions per page"),
|
|
1323
|
-
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
|
|
1333
|
+
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
1334
|
+
cursor: z.string().optional().describe("Cursor to start from")
|
|
1324
1335
|
}).describe("List all actions for a specific app");
|
|
1325
1336
|
var ActionItemSchema = withFormatter(
|
|
1326
|
-
ActionSchema.omit({ type: true, name: true }).extend({
|
|
1337
|
+
ActionSchema.omit({ type: true, name: true, selected_api: true }).extend({
|
|
1327
1338
|
app_key: z.string(),
|
|
1328
|
-
//
|
|
1339
|
+
// App key without version (extracted from selected_api)
|
|
1340
|
+
app_version: z.string().optional(),
|
|
1341
|
+
// Version extracted from selected_api
|
|
1329
1342
|
action_type: ActionSchema.shape.type,
|
|
1330
1343
|
// Mapped from original 'type' field
|
|
1331
1344
|
title: z.string(),
|
|
@@ -1637,7 +1650,8 @@ var ListInputFieldsSchema = z.object({
|
|
|
1637
1650
|
"Current input values that may affect available fields"
|
|
1638
1651
|
),
|
|
1639
1652
|
pageSize: z.number().min(1).optional().describe("Number of input fields per page"),
|
|
1640
|
-
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
|
|
1653
|
+
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
1654
|
+
cursor: z.string().optional().describe("Cursor to start from")
|
|
1641
1655
|
}).describe("Get the input fields required for a specific action");
|
|
1642
1656
|
var BaseFieldItemSchema = z.object({
|
|
1643
1657
|
type: z.string(),
|
|
@@ -1924,7 +1938,7 @@ var listInputFieldsPlugin = ({ context }) => {
|
|
|
1924
1938
|
};
|
|
1925
1939
|
var ListAuthenticationsSchema = z.object({
|
|
1926
1940
|
appKey: AppKeyPropertySchema.optional().describe(
|
|
1927
|
-
"App key of authentications to list (e.g., 'SlackCLIAPI')"
|
|
1941
|
+
"App key of authentications to list (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
1928
1942
|
),
|
|
1929
1943
|
authenticationIds: z.array(z.string()).optional().describe("List of authentication IDs to filter by"),
|
|
1930
1944
|
search: z.string().optional().describe("Search term to filter authentications by title"),
|
|
@@ -1934,7 +1948,8 @@ var ListAuthenticationsSchema = z.object({
|
|
|
1934
1948
|
"Filter by owner, 'me' for your own authentications or a specific user ID"
|
|
1935
1949
|
),
|
|
1936
1950
|
pageSize: z.number().min(1).optional().describe("Number of authentications per page"),
|
|
1937
|
-
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
|
|
1951
|
+
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
1952
|
+
cursor: z.string().optional().describe("Cursor to start from")
|
|
1938
1953
|
}).describe("List available authentications with optional filtering");
|
|
1939
1954
|
var AuthenticationItemSchema = withFormatter(
|
|
1940
1955
|
AuthenticationSchema.omit({ selected_api: true, customuser_id: true }).extend(
|
|
@@ -1947,7 +1962,7 @@ var AuthenticationItemSchema = withFormatter(
|
|
|
1947
1962
|
// Mapped from marked_stale_at
|
|
1948
1963
|
app_key: z.string().optional(),
|
|
1949
1964
|
// App key from implementations endpoint
|
|
1950
|
-
|
|
1965
|
+
app_version: z.string().optional(),
|
|
1951
1966
|
// Version extracted from implementation_id
|
|
1952
1967
|
user_id: z.number().optional()
|
|
1953
1968
|
}
|
|
@@ -2068,7 +2083,7 @@ var listAuthenticationsPlugin = ({ context }) => {
|
|
|
2068
2083
|
};
|
|
2069
2084
|
var GetAppSchema = z.object({
|
|
2070
2085
|
appKey: AppKeyPropertySchema.describe(
|
|
2071
|
-
"App key of app to fetch (e.g., 'SlackCLIAPI')"
|
|
2086
|
+
"App key of app to fetch (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
2072
2087
|
)
|
|
2073
2088
|
}).describe("Get detailed information about a specific app");
|
|
2074
2089
|
|
|
@@ -2207,7 +2222,7 @@ var getAuthenticationPlugin = ({ context }) => {
|
|
|
2207
2222
|
};
|
|
2208
2223
|
var FindFirstAuthenticationSchema = z.object({
|
|
2209
2224
|
appKey: AppKeyPropertySchema.optional().describe(
|
|
2210
|
-
"App key of authentication to find (e.g., 'SlackCLIAPI')"
|
|
2225
|
+
"App key of authentication to find (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
2211
2226
|
),
|
|
2212
2227
|
search: z.string().optional().describe("Search term to filter authentications by title"),
|
|
2213
2228
|
title: z.string().optional().describe("Filter authentications by exact title match"),
|
|
@@ -2252,7 +2267,7 @@ var findFirstAuthenticationPlugin = ({ sdk }) => {
|
|
|
2252
2267
|
};
|
|
2253
2268
|
var FindUniqueAuthenticationSchema = z.object({
|
|
2254
2269
|
appKey: AppKeyPropertySchema.optional().describe(
|
|
2255
|
-
"App key of authentication to find (e.g., 'SlackCLIAPI')"
|
|
2270
|
+
"App key of authentication to find (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
2256
2271
|
),
|
|
2257
2272
|
search: z.string().optional().describe("Search term to filter authentications by title"),
|
|
2258
2273
|
title: z.string().optional().describe("Filter authentications by exact title match"),
|
|
@@ -2310,7 +2325,8 @@ var RunActionSchema = z.object({
|
|
|
2310
2325
|
"Input parameters for the action"
|
|
2311
2326
|
),
|
|
2312
2327
|
pageSize: z.number().min(1).optional().describe("Number of results per page"),
|
|
2313
|
-
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
|
|
2328
|
+
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
2329
|
+
cursor: z.string().optional().describe("Cursor to start from")
|
|
2314
2330
|
}).describe("Execute an action with the given inputs");
|
|
2315
2331
|
|
|
2316
2332
|
// src/plugins/runAction/index.ts
|
|
@@ -3649,7 +3665,8 @@ var ListInputFieldChoicesSchema = z.object({
|
|
|
3649
3665
|
page: z.number().int().min(0).optional().describe("Page number for paginated results"),
|
|
3650
3666
|
// Pagination options (SDK-level)
|
|
3651
3667
|
pageSize: z.number().min(1).optional().describe("Number of choices per page"),
|
|
3652
|
-
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
|
|
3668
|
+
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
3669
|
+
cursor: z.string().optional().describe("Cursor to start from")
|
|
3653
3670
|
}).describe("Get the available choices for a dynamic dropdown input field");
|
|
3654
3671
|
|
|
3655
3672
|
// src/plugins/listInputFieldChoices/index.ts
|
|
@@ -19,7 +19,15 @@ export declare const AppFactoryInputSchema: z.ZodObject<{
|
|
|
19
19
|
}>;
|
|
20
20
|
export type AppFactoryInput = z.infer<typeof AppFactoryInputSchema>;
|
|
21
21
|
interface BaseActionTypeProxy {
|
|
22
|
-
[action: string]: (options?: ActionExecutionOptions) =>
|
|
22
|
+
[action: string]: (options?: ActionExecutionOptions) => Promise<{
|
|
23
|
+
data: any[];
|
|
24
|
+
nextCursor?: string;
|
|
25
|
+
}> & AsyncIterable<{
|
|
26
|
+
data: any[];
|
|
27
|
+
nextCursor?: string;
|
|
28
|
+
}> & {
|
|
29
|
+
items(): AsyncIterable<any>;
|
|
30
|
+
};
|
|
23
31
|
}
|
|
24
32
|
interface FetchActionType {
|
|
25
33
|
fetch: (url: string | URL, init?: RequestInit & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,0BAA0B;;;;;;;;;EAOpC,CAAC;AAGJ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEhF,eAAO,MAAM,qBAAqB;;;;;;EAIgB,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,UAAU,mBAAmB;IAC3B,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,0BAA0B;;;;;;;;;EAOpC,CAAC;AAGJ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEhF,eAAO,MAAM,qBAAqB;;;;;;EAIgB,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,UAAU,mBAAmB;IAC3B,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC;QAC9D,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACpD,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;KAC7B,CAAC;CACL;AAGD,UAAU,eAAe;IACvB,KAAK,EAAE,CACL,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,CAAC,EAAE,WAAW,GAAG;QACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,sBAAsB,CAAC,EAAE,MAAM,CAAC;KACjC,KACE,OAAO,CAAC,QAAQ,CAAC,CAAC;CACxB;AAGD,KAAK,eAAe,GAAG,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEtE,UAAU,QAAQ;IAChB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;CACjC;AAED,UAAU,UAAU;IAClB,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAAC;CACtC;AAGD,KAAK,mBAAmB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACpC"}
|
|
@@ -3,7 +3,7 @@ import { AppKeyPropertySchema } from "../../types/properties";
|
|
|
3
3
|
// Pure Zod schema - no resolver metadata!
|
|
4
4
|
export const FindFirstAuthenticationSchema = z
|
|
5
5
|
.object({
|
|
6
|
-
appKey: AppKeyPropertySchema.optional().describe("App key of authentication to find (e.g., 'SlackCLIAPI')"),
|
|
6
|
+
appKey: AppKeyPropertySchema.optional().describe("App key of authentication to find (e.g., 'SlackCLIAPI' or slug like 'github')"),
|
|
7
7
|
search: z
|
|
8
8
|
.string()
|
|
9
9
|
.optional()
|
|
@@ -3,7 +3,7 @@ import { AppKeyPropertySchema } from "../../types/properties";
|
|
|
3
3
|
// Pure Zod schema - no resolver metadata!
|
|
4
4
|
export const FindUniqueAuthenticationSchema = z
|
|
5
5
|
.object({
|
|
6
|
-
appKey: AppKeyPropertySchema.optional().describe("App key of authentication to find (e.g., 'SlackCLIAPI')"),
|
|
6
|
+
appKey: AppKeyPropertySchema.optional().describe("App key of authentication to find (e.g., 'SlackCLIAPI' or slug like 'github')"),
|
|
7
7
|
search: z
|
|
8
8
|
.string()
|
|
9
9
|
.optional()
|
|
@@ -36,8 +36,11 @@ describe("getApp plugin", () => {
|
|
|
36
36
|
it("should pass validation with valid appKey", async () => {
|
|
37
37
|
const sdk = createTestSdk();
|
|
38
38
|
const context = sdk.getContext();
|
|
39
|
-
// Mock the API client
|
|
40
|
-
context.api.get = vi
|
|
39
|
+
// Mock the API client to handle both resolveAppKeys and listApps calls
|
|
40
|
+
context.api.get = vi
|
|
41
|
+
.fn()
|
|
42
|
+
// First call: resolveAppKeys may call to resolve slug to implementation name
|
|
43
|
+
.mockResolvedValueOnce({
|
|
41
44
|
results: [
|
|
42
45
|
{
|
|
43
46
|
id: "SlackCLIAPI@1.0.0",
|
|
@@ -45,6 +48,25 @@ describe("getApp plugin", () => {
|
|
|
45
48
|
description: "Team communication",
|
|
46
49
|
primary_color: "#4A154B",
|
|
47
50
|
categories: ["communication"],
|
|
51
|
+
slug: "slack",
|
|
52
|
+
key: "SlackCLIAPI",
|
|
53
|
+
version: "1.0.0",
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
next: null,
|
|
57
|
+
})
|
|
58
|
+
// Second call: listApps main API call
|
|
59
|
+
.mockResolvedValueOnce({
|
|
60
|
+
results: [
|
|
61
|
+
{
|
|
62
|
+
id: "SlackCLIAPI@1.0.0",
|
|
63
|
+
name: "Slack",
|
|
64
|
+
description: "Team communication",
|
|
65
|
+
primary_color: "#4A154B",
|
|
66
|
+
categories: ["communication"],
|
|
67
|
+
slug: "slack",
|
|
68
|
+
key: "SlackCLIAPI",
|
|
69
|
+
version: "1.0.0",
|
|
48
70
|
},
|
|
49
71
|
],
|
|
50
72
|
next: null,
|
|
@@ -62,8 +84,16 @@ describe("getApp plugin", () => {
|
|
|
62
84
|
it("should throw ZapierAppNotFoundError when app does not exist", async () => {
|
|
63
85
|
const sdk = createTestSdk();
|
|
64
86
|
const context = sdk.getContext();
|
|
65
|
-
// Mock API to return empty results
|
|
66
|
-
context.api.get = vi
|
|
87
|
+
// Mock API to return empty results for both potential calls
|
|
88
|
+
context.api.get = vi
|
|
89
|
+
.fn()
|
|
90
|
+
// First call: resolveAppKeys may call to resolve slug
|
|
91
|
+
.mockResolvedValueOnce({
|
|
92
|
+
results: [],
|
|
93
|
+
next: null,
|
|
94
|
+
})
|
|
95
|
+
// Second call: listApps main API call
|
|
96
|
+
.mockResolvedValueOnce({
|
|
67
97
|
results: [],
|
|
68
98
|
next: null,
|
|
69
99
|
});
|
|
@@ -76,8 +106,27 @@ describe("getApp plugin", () => {
|
|
|
76
106
|
it("should return essential app properties", async () => {
|
|
77
107
|
const sdk = createTestSdk();
|
|
78
108
|
const context = sdk.getContext();
|
|
79
|
-
// Mock the API client
|
|
80
|
-
context.api.get = vi
|
|
109
|
+
// Mock the API client to handle both resolveAppKeys and listApps calls
|
|
110
|
+
context.api.get = vi
|
|
111
|
+
.fn()
|
|
112
|
+
// First call: resolveAppKeys may call to resolve slug to implementation name
|
|
113
|
+
.mockResolvedValueOnce({
|
|
114
|
+
results: [
|
|
115
|
+
{
|
|
116
|
+
id: "TestCLIAPI@1.0.0",
|
|
117
|
+
name: "Test App",
|
|
118
|
+
description: "Test description",
|
|
119
|
+
primary_color: "#FF0000",
|
|
120
|
+
categories: ["testing"],
|
|
121
|
+
slug: "test",
|
|
122
|
+
key: "TestCLIAPI",
|
|
123
|
+
version: "1.0.0",
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
next: null,
|
|
127
|
+
})
|
|
128
|
+
// Second call: listApps main API call
|
|
129
|
+
.mockResolvedValueOnce({
|
|
81
130
|
results: [
|
|
82
131
|
{
|
|
83
132
|
id: "TestCLIAPI@1.0.0",
|
|
@@ -85,6 +134,9 @@ describe("getApp plugin", () => {
|
|
|
85
134
|
description: "Test description",
|
|
86
135
|
primary_color: "#FF0000",
|
|
87
136
|
categories: ["testing"],
|
|
137
|
+
slug: "test",
|
|
138
|
+
key: "TestCLIAPI",
|
|
139
|
+
version: "1.0.0",
|
|
88
140
|
},
|
|
89
141
|
],
|
|
90
142
|
next: null,
|
|
@@ -3,6 +3,6 @@ import { AppKeyPropertySchema } from "../../types/properties";
|
|
|
3
3
|
// Pure Zod schema - no resolver metadata!
|
|
4
4
|
export const GetAppSchema = z
|
|
5
5
|
.object({
|
|
6
|
-
appKey: AppKeyPropertySchema.describe("App key of app to fetch (e.g., 'SlackCLIAPI')"),
|
|
6
|
+
appKey: AppKeyPropertySchema.describe("App key of app to fetch (e.g., 'SlackCLIAPI' or slug like 'github')"),
|
|
7
7
|
})
|
|
8
8
|
.describe("Get detailed information about a specific app");
|
|
@@ -93,7 +93,7 @@ describe("getAuthentication plugin", () => {
|
|
|
93
93
|
label: "My Slack Workspace",
|
|
94
94
|
title: "My Slack Workspace",
|
|
95
95
|
app_key: "SlackCLIAPI",
|
|
96
|
-
|
|
96
|
+
app_version: "1.21.1",
|
|
97
97
|
user_id: undefined, // customuser_id wasn't in mock data
|
|
98
98
|
is_stale: "false", // Original field preserved
|
|
99
99
|
marked_stale_at: null, // Original field preserved
|
|
@@ -7,6 +7,7 @@ import type { GetVersionedImplementationId } from "../manifest/schemas";
|
|
|
7
7
|
export interface ListActionsPluginProvides {
|
|
8
8
|
listActions: (options?: ListActionsOptions) => Promise<{
|
|
9
9
|
data: ActionItem[];
|
|
10
|
+
nextCursor?: string;
|
|
10
11
|
}> & AsyncIterable<{
|
|
11
12
|
data: ActionItem[];
|
|
12
13
|
nextCursor?: string;
|
|
@@ -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;AAOnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAGxE,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC;QACrD,IAAI,EAAE,UAAU,EAAE,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;AAOnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAGxE,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC;QACrD,IAAI,EAAE,UAAU,EAAE,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,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,EAClC;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,EACD,yBAAyB,CAyF1B,CAAC"}
|
|
@@ -9,16 +9,19 @@ export declare const ListActionsSchema: z.ZodObject<{
|
|
|
9
9
|
actionType: z.ZodOptional<z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>>;
|
|
10
10
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
11
11
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
12
13
|
}, "strip", z.ZodTypeAny, {
|
|
13
14
|
appKey: string;
|
|
14
15
|
actionType?: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | undefined;
|
|
15
16
|
pageSize?: number | undefined;
|
|
16
17
|
maxItems?: number | undefined;
|
|
18
|
+
cursor?: string | undefined;
|
|
17
19
|
}, {
|
|
18
20
|
appKey: string;
|
|
19
21
|
actionType?: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | undefined;
|
|
20
22
|
pageSize?: number | undefined;
|
|
21
23
|
maxItems?: number | undefined;
|
|
24
|
+
cursor?: string | undefined;
|
|
22
25
|
}>;
|
|
23
26
|
export type ListActionsOptions = z.infer<typeof ListActionsSchema>;
|
|
24
27
|
export interface ListActionsPage {
|
|
@@ -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;AAKxB,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
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,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;;;;;;;;;;;;;;;;;;;;EAoBoB,CAAC;AAGnD,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"}
|
|
@@ -3,7 +3,7 @@ import { AppKeyPropertySchema, ActionTypePropertySchema, } from "../../types/pro
|
|
|
3
3
|
// Pure Zod schema - no resolver metadata!
|
|
4
4
|
export const ListActionsSchema = z
|
|
5
5
|
.object({
|
|
6
|
-
appKey: AppKeyPropertySchema.describe("App key of actions to list (e.g., 'SlackCLIAPI')"),
|
|
6
|
+
appKey: AppKeyPropertySchema.describe("App key of actions to list (e.g., 'SlackCLIAPI' or slug like 'github')"),
|
|
7
7
|
actionType: ActionTypePropertySchema.optional().describe("Filter actions by type"),
|
|
8
8
|
pageSize: z
|
|
9
9
|
.number()
|
|
@@ -15,5 +15,6 @@ export const ListActionsSchema = z
|
|
|
15
15
|
.min(1)
|
|
16
16
|
.optional()
|
|
17
17
|
.describe("Maximum total items to return across all pages"),
|
|
18
|
+
cursor: z.string().optional().describe("Cursor to start from"),
|
|
18
19
|
})
|
|
19
20
|
.describe("List all actions for a specific app");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listApps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAWlD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listApps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAWlD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC;QAC/C,IAAI,EAAE,OAAO,EAAE,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACxD,KAAK,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;KACjC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,QAAQ,EAAE;gBACR,WAAW,EAAE,OAAO,cAAc,CAAC;aACpC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,EAAE,EACF,cAAc,CAAC,iBAAiB,GAAG,sBAAsB,CAAC,EAC1D,sBAAsB,CAwHvB,CAAC"}
|
|
@@ -5,10 +5,10 @@ import { normalizeImplementationMetaToAppItem, splitVersionedKey, toAppLocator,
|
|
|
5
5
|
import { extractCursor } from "../../utils/function-utils";
|
|
6
6
|
export const listAppsPlugin = ({ context }) => {
|
|
7
7
|
const listApps = createPaginatedFunction(async function listAppsPage(options) {
|
|
8
|
-
const api = context
|
|
9
|
-
const
|
|
10
|
-
const appLocators = await
|
|
11
|
-
appKeys: [...
|
|
8
|
+
const { api, resolveAppKeys } = context;
|
|
9
|
+
const appKeys = options.appKeys ?? [];
|
|
10
|
+
const appLocators = await resolveAppKeys({
|
|
11
|
+
appKeys: [...appKeys],
|
|
12
12
|
});
|
|
13
13
|
const implementationNameToLocator = {};
|
|
14
14
|
for (const locator of appLocators) {
|
|
@@ -25,9 +25,9 @@ export const listAppsPlugin = ({ context }) => {
|
|
|
25
25
|
if (duplicatedLookupAppKeys.length > 0) {
|
|
26
26
|
throw new Error(`Duplicate lookup app keys found: ${duplicatedLookupAppKeys.join(", ")}`);
|
|
27
27
|
}
|
|
28
|
-
if (
|
|
28
|
+
if (options.search) {
|
|
29
29
|
const searchParams = {};
|
|
30
|
-
searchParams.term =
|
|
30
|
+
searchParams.term = options.search;
|
|
31
31
|
const searchEnvelope = await api.get("/api/v4/implementations-meta/search/", {
|
|
32
32
|
searchParams,
|
|
33
33
|
});
|
|
@@ -45,18 +45,26 @@ export const listAppsPlugin = ({ context }) => {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
const searchParams = {};
|
|
48
|
-
if (
|
|
49
|
-
searchParams.limit =
|
|
48
|
+
if (options.pageSize) {
|
|
49
|
+
searchParams.limit = options.pageSize.toString();
|
|
50
50
|
}
|
|
51
51
|
if (appLocators.length === 0) {
|
|
52
52
|
searchParams.latest_only = "true";
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
55
|
-
searchParams.offset =
|
|
54
|
+
if (options.cursor) {
|
|
55
|
+
searchParams.offset = options.cursor;
|
|
56
56
|
}
|
|
57
57
|
searchParams.selected_apis = appLocators
|
|
58
58
|
.map((locator) => toImplementationId(locator))
|
|
59
59
|
.join(",");
|
|
60
|
+
// If we have app keys, but they resolved to an empty list, then we need to short-circuit and return an empty list.
|
|
61
|
+
// Otherwise, the API will return all apps, since no selected_apis are provided.
|
|
62
|
+
if (appKeys.length > 0 && appLocators.length === 0) {
|
|
63
|
+
return {
|
|
64
|
+
data: [],
|
|
65
|
+
nextCursor: undefined,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
60
68
|
const implementationsEnvelope = await api.get("/api/v4/implementations-meta/lookup/", {
|
|
61
69
|
searchParams,
|
|
62
70
|
});
|
|
@@ -12,15 +12,18 @@ export declare const ListAppsSchema: z.ZodObject<{
|
|
|
12
12
|
search: z.ZodOptional<z.ZodString>;
|
|
13
13
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
14
14
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
15
16
|
}, "strip", z.ZodTypeAny, {
|
|
16
17
|
search?: string | undefined;
|
|
17
18
|
pageSize?: number | undefined;
|
|
18
19
|
maxItems?: number | undefined;
|
|
20
|
+
cursor?: string | undefined;
|
|
19
21
|
appKeys?: string[] | undefined;
|
|
20
22
|
}, {
|
|
21
23
|
search?: string | undefined;
|
|
22
24
|
pageSize?: number | undefined;
|
|
23
25
|
maxItems?: number | undefined;
|
|
26
|
+
cursor?: string | undefined;
|
|
24
27
|
appKeys?: string[] | undefined;
|
|
25
28
|
}>;
|
|
26
29
|
export type ListAppsOptions = z.infer<typeof ListAppsSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listApps/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGhF,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,qBAAqB,CAAC;AAGnE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listApps/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGhF,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,qBAAqB,CAAC;AAGnE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;EAiBmC,CAAC;AAG/D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAG7D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,oBAAoB,CAAC,eAAe,GAAG,SAAS,EAAE,OAAO,CAAC,CAAC;CACtE"}
|
|
@@ -7,6 +7,7 @@ import type { ManifestPluginProvides } from "../manifest";
|
|
|
7
7
|
export interface ListAuthenticationsPluginProvides {
|
|
8
8
|
listAuthentications: (options?: ListAuthenticationsOptions) => Promise<{
|
|
9
9
|
data: AuthenticationItem[];
|
|
10
|
+
nextCursor?: string;
|
|
10
11
|
}> & AsyncIterable<{
|
|
11
12
|
data: AuthenticationItem[];
|
|
12
13
|
nextCursor?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listAuthentications/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,yBAAyB,EACzB,KAAK,0BAA0B,EAEhC,MAAM,WAAW,CAAC;AAUnB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAI1D,MAAM,WAAW,iCAAiC;IAChD,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,0BAA0B,KAAK,OAAO,CAAC;QACrE,IAAI,EAAE,kBAAkB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listAuthentications/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,yBAAyB,EACzB,KAAK,0BAA0B,EAEhC,MAAM,WAAW,CAAC;AAUnB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAI1D,MAAM,WAAW,iCAAiC;IAChD,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,0BAA0B,KAAK,OAAO,CAAC;QACrE,IAAI,EAAE,kBAAkB,EAAE,CAAC;QAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACnE,KAAK,IAAI,aAAa,CAAC,kBAAkB,CAAC,CAAC;KAC5C,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,mBAAmB,EAAE;gBACnB,WAAW,EAAE,OAAO,yBAAyB,CAAC;aAC/C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAC5C,UAAU,CAAC,sBAAsB,CAAC,EAClC;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,EACD,iCAAiC,CAyGlC,CAAC"}
|