@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
|
@@ -27,12 +27,12 @@ export declare function normalizeImplementationMetaToAppItem(implementationMeta:
|
|
|
27
27
|
* @param auth - Raw Authentication from API
|
|
28
28
|
* @param options - Additional fields to include
|
|
29
29
|
* @param options.app_key - selected_api from implementations endpoint
|
|
30
|
-
* @param options.
|
|
30
|
+
* @param options.app_version - Version extracted from selected_api
|
|
31
31
|
* @returns Normalized AuthenticationItem
|
|
32
32
|
*/
|
|
33
33
|
export declare function normalizeAuthenticationItem(auth: Authentication, options?: {
|
|
34
34
|
app_key?: string;
|
|
35
|
-
|
|
35
|
+
app_version?: string;
|
|
36
36
|
}): AuthenticationItem;
|
|
37
37
|
export declare function normalizeActionItem(action: Action): ActionItem;
|
|
38
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-utils.d.ts","sourceRoot":"","sources":["../../src/utils/domain-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE/E;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,GACnB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAA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E,MAAM,EAAE,CAAC;CAChB,CAUA;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOtD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY1D;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAI9C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAkBvD;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,UAAU,GACrB,UAAU,IAAI,kBAAkB,CAElC;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAEzE"}
|
|
@@ -47,13 +47,13 @@ export function normalizeImplementationMetaToAppItem(implementationMeta) {
|
|
|
47
47
|
* @param auth - Raw Authentication from API
|
|
48
48
|
* @param options - Additional fields to include
|
|
49
49
|
* @param options.app_key - selected_api from implementations endpoint
|
|
50
|
-
* @param options.
|
|
50
|
+
* @param options.app_version - Version extracted from selected_api
|
|
51
51
|
* @returns Normalized AuthenticationItem
|
|
52
52
|
*/
|
|
53
53
|
export function normalizeAuthenticationItem(auth, options = {}) {
|
|
54
54
|
// Extract app key and version from selected_api if not provided
|
|
55
55
|
let appKey = options.app_key;
|
|
56
|
-
let
|
|
56
|
+
let appVersion = options.app_version;
|
|
57
57
|
if (auth.selected_api) {
|
|
58
58
|
const [extractedAppKey, extractedVersion] = splitVersionedKey(auth.selected_api);
|
|
59
59
|
// Use extracted app key if not provided in options
|
|
@@ -61,8 +61,8 @@ export function normalizeAuthenticationItem(auth, options = {}) {
|
|
|
61
61
|
appKey = extractedAppKey;
|
|
62
62
|
}
|
|
63
63
|
// Use extracted version if not provided in options
|
|
64
|
-
if (!
|
|
65
|
-
|
|
64
|
+
if (!appVersion) {
|
|
65
|
+
appVersion = extractedVersion;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
const { selected_api: selectedApi, customuser_id: userId, ...restOfAuth } = auth;
|
|
@@ -73,15 +73,26 @@ export function normalizeAuthenticationItem(auth, options = {}) {
|
|
|
73
73
|
is_expired: auth.is_stale, // Map is_stale to is_expired
|
|
74
74
|
expired_at: auth.marked_stale_at, // Map marked_stale_at to expired_at
|
|
75
75
|
app_key: appKey, // App key from implementations endpoint or parsed from selected_api
|
|
76
|
-
|
|
76
|
+
app_version: appVersion, // Version from selected_api or provided
|
|
77
77
|
user_id: userId, // Map customuser_id to user_id
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
export function normalizeActionItem(action) {
|
|
81
|
-
const { name, type, selected_api:
|
|
81
|
+
const { name, type, selected_api: selectedApi } = action;
|
|
82
|
+
// Split version from selected_api
|
|
83
|
+
const [appKey, appVersion] = selectedApi
|
|
84
|
+
? splitVersionedKey(selectedApi)
|
|
85
|
+
: ["", undefined];
|
|
82
86
|
return {
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
// Only include the fields we want - explicitly list them
|
|
88
|
+
id: action.id,
|
|
89
|
+
key: action.key,
|
|
90
|
+
description: action.description,
|
|
91
|
+
is_important: action.is_important,
|
|
92
|
+
is_hidden: action.is_hidden,
|
|
93
|
+
// Transformed fields
|
|
94
|
+
app_key: appKey,
|
|
95
|
+
app_version: appVersion,
|
|
85
96
|
action_type: type,
|
|
86
97
|
title: name, // Map name to title
|
|
87
98
|
type: "action",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-utils.d.ts","sourceRoot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AG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAEjC,QAAQ,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CAI5C;AAGD,wBAAgB,YAAY,CAC1B,CAAC,SAAS,CAAC,CAAC,OAAO,EACnB,KAAK,GAAG,OAAO,EACf,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAMtD;AAMD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,GAAG,MAAM,GAAG,SAAS,CAE5E;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,GACjC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWxB;AAMD,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE;QACd,UAAU,EAAE,IAAI,CAAC;KAClB,CAAC;CACH;AAGD,wBAAgB,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAChD,MAAM,EAAE,CAAC,GACR,CAAC,GAAG;IACL,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,kBAAkB,CAAC;CACtC,CAQA;AAWD,wBAAgB,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,OAAO,CAoBvD"}
|
package/package.json
CHANGED
package/src/api/schemas.ts
CHANGED
|
@@ -83,16 +83,10 @@ export const ActionSchema = z.object({
|
|
|
83
83
|
]),
|
|
84
84
|
key: z.string(),
|
|
85
85
|
name: z.string(),
|
|
86
|
-
noun: z.string().optional(),
|
|
87
86
|
description: z.string(),
|
|
88
|
-
description_html: z.string().optional(),
|
|
89
87
|
is_important: z.boolean().optional(),
|
|
90
88
|
is_hidden: z.boolean().optional(),
|
|
91
|
-
needs: z.array(NeedSchema).optional(),
|
|
92
|
-
meta: z.string().optional(),
|
|
93
89
|
selected_api: z.string().optional(),
|
|
94
|
-
links: ActionLinksSchema.optional(),
|
|
95
|
-
permissions: ActionPermissionsSchema.optional(),
|
|
96
90
|
});
|
|
97
91
|
|
|
98
92
|
export const ChoiceSchema = z.object({
|
package/src/index.ts
CHANGED
|
@@ -40,6 +40,7 @@ export type {
|
|
|
40
40
|
// Export schema utilities for CLI
|
|
41
41
|
export { isPositional, PositionalMetadata } from "./utils/schema-utils";
|
|
42
42
|
export { createFunction } from "./utils/function-utils";
|
|
43
|
+
export type { FormattedItem, FormatMetadata } from "./utils/schema-utils";
|
|
43
44
|
|
|
44
45
|
// Export resolver utilities for CLI
|
|
45
46
|
export * from "./resolvers";
|
|
@@ -22,7 +22,13 @@ export type AppFactoryInput = z.infer<typeof AppFactoryInputSchema>;
|
|
|
22
22
|
|
|
23
23
|
// Base action type proxy for regular actions
|
|
24
24
|
interface BaseActionTypeProxy {
|
|
25
|
-
[action: string]: (options?: ActionExecutionOptions) =>
|
|
25
|
+
[action: string]: (options?: ActionExecutionOptions) => Promise<{
|
|
26
|
+
data: any[];
|
|
27
|
+
nextCursor?: string;
|
|
28
|
+
}> &
|
|
29
|
+
AsyncIterable<{ data: any[]; nextCursor?: string }> & {
|
|
30
|
+
items(): AsyncIterable<any>;
|
|
31
|
+
};
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
// Special fetch function type
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
export const FindFirstAuthenticationSchema = z
|
|
13
13
|
.object({
|
|
14
14
|
appKey: AppKeyPropertySchema.optional().describe(
|
|
15
|
-
"App key of authentication to find (e.g., 'SlackCLIAPI')",
|
|
15
|
+
"App key of authentication to find (e.g., 'SlackCLIAPI' or slug like 'github')",
|
|
16
16
|
),
|
|
17
17
|
search: z
|
|
18
18
|
.string()
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
export const FindUniqueAuthenticationSchema = z
|
|
14
14
|
.object({
|
|
15
15
|
appKey: AppKeyPropertySchema.optional().describe(
|
|
16
|
-
"App key of authentication to find (e.g., 'SlackCLIAPI')",
|
|
16
|
+
"App key of authentication to find (e.g., 'SlackCLIAPI' or slug like 'github')",
|
|
17
17
|
),
|
|
18
18
|
search: z
|
|
19
19
|
.string()
|
|
@@ -52,19 +52,41 @@ describe("getApp plugin", () => {
|
|
|
52
52
|
const sdk = createTestSdk();
|
|
53
53
|
const context = sdk.getContext();
|
|
54
54
|
|
|
55
|
-
// Mock the API client
|
|
56
|
-
(context.api as any).get = vi
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
// Mock the API client to handle both resolveAppKeys and listApps calls
|
|
56
|
+
(context.api as any).get = vi
|
|
57
|
+
.fn()
|
|
58
|
+
// First call: resolveAppKeys may call to resolve slug to implementation name
|
|
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",
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
next: null,
|
|
73
|
+
})
|
|
74
|
+
// Second call: listApps main API call
|
|
75
|
+
.mockResolvedValueOnce({
|
|
76
|
+
results: [
|
|
77
|
+
{
|
|
78
|
+
id: "SlackCLIAPI@1.0.0",
|
|
79
|
+
name: "Slack",
|
|
80
|
+
description: "Team communication",
|
|
81
|
+
primary_color: "#4A154B",
|
|
82
|
+
categories: ["communication"],
|
|
83
|
+
slug: "slack",
|
|
84
|
+
key: "SlackCLIAPI",
|
|
85
|
+
version: "1.0.0",
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
next: null,
|
|
89
|
+
});
|
|
68
90
|
|
|
69
91
|
const result = await sdk.getApp({
|
|
70
92
|
appKey: "slack",
|
|
@@ -82,11 +104,19 @@ describe("getApp plugin", () => {
|
|
|
82
104
|
const sdk = createTestSdk();
|
|
83
105
|
const context = sdk.getContext();
|
|
84
106
|
|
|
85
|
-
// Mock API to return empty results
|
|
86
|
-
(context.api as any).get = vi
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
107
|
+
// Mock API to return empty results for both potential calls
|
|
108
|
+
(context.api as any).get = vi
|
|
109
|
+
.fn()
|
|
110
|
+
// First call: resolveAppKeys may call to resolve slug
|
|
111
|
+
.mockResolvedValueOnce({
|
|
112
|
+
results: [],
|
|
113
|
+
next: null,
|
|
114
|
+
})
|
|
115
|
+
// Second call: listApps main API call
|
|
116
|
+
.mockResolvedValueOnce({
|
|
117
|
+
results: [],
|
|
118
|
+
next: null,
|
|
119
|
+
});
|
|
90
120
|
|
|
91
121
|
await expect(
|
|
92
122
|
sdk.getApp({
|
|
@@ -101,19 +131,41 @@ describe("getApp plugin", () => {
|
|
|
101
131
|
const sdk = createTestSdk();
|
|
102
132
|
const context = sdk.getContext();
|
|
103
133
|
|
|
104
|
-
// Mock the API client
|
|
105
|
-
(context.api as any).get = vi
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
134
|
+
// Mock the API client to handle both resolveAppKeys and listApps calls
|
|
135
|
+
(context.api as any).get = vi
|
|
136
|
+
.fn()
|
|
137
|
+
// First call: resolveAppKeys may call to resolve slug to implementation name
|
|
138
|
+
.mockResolvedValueOnce({
|
|
139
|
+
results: [
|
|
140
|
+
{
|
|
141
|
+
id: "TestCLIAPI@1.0.0",
|
|
142
|
+
name: "Test App",
|
|
143
|
+
description: "Test description",
|
|
144
|
+
primary_color: "#FF0000",
|
|
145
|
+
categories: ["testing"],
|
|
146
|
+
slug: "test",
|
|
147
|
+
key: "TestCLIAPI",
|
|
148
|
+
version: "1.0.0",
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
next: null,
|
|
152
|
+
})
|
|
153
|
+
// Second call: listApps main API call
|
|
154
|
+
.mockResolvedValueOnce({
|
|
155
|
+
results: [
|
|
156
|
+
{
|
|
157
|
+
id: "TestCLIAPI@1.0.0",
|
|
158
|
+
name: "Test App",
|
|
159
|
+
description: "Test description",
|
|
160
|
+
primary_color: "#FF0000",
|
|
161
|
+
categories: ["testing"],
|
|
162
|
+
slug: "test",
|
|
163
|
+
key: "TestCLIAPI",
|
|
164
|
+
version: "1.0.0",
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
next: null,
|
|
168
|
+
});
|
|
117
169
|
|
|
118
170
|
const result = await sdk.getApp({
|
|
119
171
|
appKey: "test",
|
|
@@ -19,7 +19,7 @@ export type GetAppError =
|
|
|
19
19
|
export const GetAppSchema = z
|
|
20
20
|
.object({
|
|
21
21
|
appKey: AppKeyPropertySchema.describe(
|
|
22
|
-
"App key of app to fetch (e.g., 'SlackCLIAPI')",
|
|
22
|
+
"App key of app to fetch (e.g., 'SlackCLIAPI' or slug like 'github')",
|
|
23
23
|
),
|
|
24
24
|
})
|
|
25
25
|
.describe("Get detailed information about a specific app");
|
|
@@ -126,7 +126,7 @@ describe("getAuthentication plugin", () => {
|
|
|
126
126
|
label: "My Slack Workspace",
|
|
127
127
|
title: "My Slack Workspace",
|
|
128
128
|
app_key: "SlackCLIAPI",
|
|
129
|
-
|
|
129
|
+
app_version: "1.21.1",
|
|
130
130
|
user_id: undefined, // customuser_id wasn't in mock data
|
|
131
131
|
is_stale: "false", // Original field preserved
|
|
132
132
|
marked_stale_at: null, // Original field preserved
|
|
@@ -20,6 +20,7 @@ import { appKeyResolver, actionTypeResolver } from "../../resolvers";
|
|
|
20
20
|
export interface ListActionsPluginProvides {
|
|
21
21
|
listActions: (options?: ListActionsOptions) => Promise<{
|
|
22
22
|
data: ActionItem[];
|
|
23
|
+
nextCursor?: string;
|
|
23
24
|
}> &
|
|
24
25
|
AsyncIterable<{ data: ActionItem[]; nextCursor?: string }> & {
|
|
25
26
|
items(): AsyncIterable<ActionItem>;
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
export const ListActionsSchema = z
|
|
16
16
|
.object({
|
|
17
17
|
appKey: AppKeyPropertySchema.describe(
|
|
18
|
-
"App key of actions to list (e.g., 'SlackCLIAPI')",
|
|
18
|
+
"App key of actions to list (e.g., 'SlackCLIAPI' or slug like 'github')",
|
|
19
19
|
),
|
|
20
20
|
actionType: ActionTypePropertySchema.optional().describe(
|
|
21
21
|
"Filter actions by type",
|
|
@@ -30,6 +30,7 @@ export const ListActionsSchema = z
|
|
|
30
30
|
.min(1)
|
|
31
31
|
.optional()
|
|
32
32
|
.describe("Maximum total items to return across all pages"),
|
|
33
|
+
cursor: z.string().optional().describe("Cursor to start from"),
|
|
33
34
|
})
|
|
34
35
|
.describe("List all actions for a specific app");
|
|
35
36
|
|
|
@@ -17,7 +17,10 @@ import type { ManifestPluginProvides } from "../manifest";
|
|
|
17
17
|
import type { ApiPluginProvides } from "../api";
|
|
18
18
|
// ListApps plugin provides interface - listApps goes directly to SDK root
|
|
19
19
|
export interface ListAppsPluginProvides {
|
|
20
|
-
listApps: (options?: ListAppsOptions) => Promise<{
|
|
20
|
+
listApps: (options?: ListAppsOptions) => Promise<{
|
|
21
|
+
data: AppItem[];
|
|
22
|
+
nextCursor?: string;
|
|
23
|
+
}> &
|
|
21
24
|
AsyncIterable<{ data: AppItem[]; nextCursor?: string }> & {
|
|
22
25
|
items(): AsyncIterable<AppItem>;
|
|
23
26
|
};
|
|
@@ -38,11 +41,11 @@ export const listAppsPlugin: Plugin<
|
|
|
38
41
|
const listApps = createPaginatedFunction(async function listAppsPage(
|
|
39
42
|
options: ListAppsOptions & { cursor?: string } & { pageSize: number },
|
|
40
43
|
): Promise<ListAppsPage> {
|
|
41
|
-
const api = context
|
|
42
|
-
const
|
|
44
|
+
const { api, resolveAppKeys } = context;
|
|
45
|
+
const appKeys = options.appKeys ?? [];
|
|
43
46
|
|
|
44
|
-
const appLocators = await
|
|
45
|
-
appKeys: [...
|
|
47
|
+
const appLocators = await resolveAppKeys({
|
|
48
|
+
appKeys: [...appKeys],
|
|
46
49
|
});
|
|
47
50
|
const implementationNameToLocator: Record<string, ResolvedAppLocator[]> =
|
|
48
51
|
{};
|
|
@@ -64,10 +67,10 @@ export const listAppsPlugin: Plugin<
|
|
|
64
67
|
);
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
if (
|
|
70
|
+
if (options.search) {
|
|
68
71
|
const searchParams: Record<string, string> = {};
|
|
69
72
|
|
|
70
|
-
searchParams.term =
|
|
73
|
+
searchParams.term = options.search;
|
|
71
74
|
|
|
72
75
|
const searchEnvelope: ImplementationsMetaResponse = await api.get(
|
|
73
76
|
"/api/v4/implementations-meta/search/",
|
|
@@ -98,22 +101,31 @@ export const listAppsPlugin: Plugin<
|
|
|
98
101
|
|
|
99
102
|
const searchParams: Record<string, string> = {};
|
|
100
103
|
|
|
101
|
-
if (
|
|
102
|
-
searchParams.limit =
|
|
104
|
+
if (options.pageSize) {
|
|
105
|
+
searchParams.limit = options.pageSize.toString();
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
if (appLocators.length === 0) {
|
|
106
109
|
searchParams.latest_only = "true";
|
|
107
110
|
}
|
|
108
111
|
|
|
109
|
-
if (
|
|
110
|
-
searchParams.offset =
|
|
112
|
+
if (options.cursor) {
|
|
113
|
+
searchParams.offset = options.cursor;
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
searchParams.selected_apis = appLocators
|
|
114
117
|
.map((locator) => toImplementationId(locator))
|
|
115
118
|
.join(",");
|
|
116
119
|
|
|
120
|
+
// If we have app keys, but they resolved to an empty list, then we need to short-circuit and return an empty list.
|
|
121
|
+
// Otherwise, the API will return all apps, since no selected_apis are provided.
|
|
122
|
+
if (appKeys.length > 0 && appLocators.length === 0) {
|
|
123
|
+
return {
|
|
124
|
+
data: [],
|
|
125
|
+
nextCursor: undefined,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
117
129
|
const implementationsEnvelope: ImplementationsMetaResponse = await api.get(
|
|
118
130
|
"/api/v4/implementations-meta/lookup/",
|
|
119
131
|
{
|
|
@@ -28,6 +28,7 @@ export const ListAppsSchema = z
|
|
|
28
28
|
.min(1)
|
|
29
29
|
.optional()
|
|
30
30
|
.describe("Maximum total items to return across all pages"),
|
|
31
|
+
cursor: z.string().optional().describe("Cursor to start from"),
|
|
31
32
|
})
|
|
32
33
|
.describe("List all available apps with optional filtering");
|
|
33
34
|
|
|
@@ -24,6 +24,7 @@ import { AuthenticationItemSchema } from "../../schemas/Auth";
|
|
|
24
24
|
export interface ListAuthenticationsPluginProvides {
|
|
25
25
|
listAuthentications: (options?: ListAuthenticationsOptions) => Promise<{
|
|
26
26
|
data: AuthenticationItem[];
|
|
27
|
+
nextCursor?: string;
|
|
27
28
|
}> &
|
|
28
29
|
AsyncIterable<{ data: AuthenticationItem[]; nextCursor?: string }> & {
|
|
29
30
|
items(): AsyncIterable<AuthenticationItem>;
|
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
export const ListAuthenticationsSchema = z
|
|
15
15
|
.object({
|
|
16
16
|
appKey: AppKeyPropertySchema.optional().describe(
|
|
17
|
-
"App key of authentications to list (e.g., 'SlackCLIAPI')",
|
|
17
|
+
"App key of authentications to list (e.g., 'SlackCLIAPI' or slug like 'github')",
|
|
18
18
|
),
|
|
19
19
|
authenticationIds: z
|
|
20
20
|
.array(z.string())
|
|
@@ -45,6 +45,7 @@ export const ListAuthenticationsSchema = z
|
|
|
45
45
|
.min(1)
|
|
46
46
|
.optional()
|
|
47
47
|
.describe("Maximum total items to return across all pages"),
|
|
48
|
+
cursor: z.string().optional().describe("Cursor to start from"),
|
|
48
49
|
})
|
|
49
50
|
.describe("List available authentications with optional filtering");
|
|
50
51
|
|
|
@@ -39,6 +39,7 @@ function transformNeedChoicesToInputFieldChoiceItem(
|
|
|
39
39
|
export interface ListInputFieldChoicesPluginProvides {
|
|
40
40
|
listInputFieldChoices: (options: ListInputFieldChoicesOptions) => Promise<{
|
|
41
41
|
data: InputFieldChoiceItem[];
|
|
42
|
+
nextCursor?: string;
|
|
42
43
|
}> &
|
|
43
44
|
AsyncIterable<{ data: InputFieldChoiceItem[]; nextCursor?: string }> & {
|
|
44
45
|
items(): AsyncIterable<InputFieldChoiceItem>;
|
|
@@ -92,6 +92,7 @@ export const ListInputFieldChoicesSchema = z
|
|
|
92
92
|
.min(1)
|
|
93
93
|
.optional()
|
|
94
94
|
.describe("Maximum total items to return across all pages"),
|
|
95
|
+
cursor: z.string().optional().describe("Cursor to start from"),
|
|
95
96
|
})
|
|
96
97
|
.describe("Get the available choices for a dynamic dropdown input field");
|
|
97
98
|
|
|
@@ -181,6 +181,7 @@ function transformNeedsToFields(needs: Need[]): RootFieldItem[] {
|
|
|
181
181
|
export interface ListInputFieldsPluginProvides {
|
|
182
182
|
listInputFields: (options?: ListInputFieldsOptions) => Promise<{
|
|
183
183
|
data: RootFieldItem[];
|
|
184
|
+
nextCursor?: string;
|
|
184
185
|
}> &
|
|
185
186
|
AsyncIterable<{ data: RootFieldItem[]; nextCursor?: string }> & {
|
|
186
187
|
items(): AsyncIterable<InputFieldItem | InfoFieldItem | FieldsetItem>;
|
|
@@ -37,6 +37,7 @@ export const ListInputFieldsSchema = z
|
|
|
37
37
|
.min(1)
|
|
38
38
|
.optional()
|
|
39
39
|
.describe("Maximum total items to return across all pages"),
|
|
40
|
+
cursor: z.string().optional().describe("Cursor to start from"),
|
|
40
41
|
})
|
|
41
42
|
.describe("Get the input fields required for a specific action");
|
|
42
43
|
|
|
@@ -24,7 +24,10 @@ import {
|
|
|
24
24
|
import type { GetVersionedImplementationId } from "../manifest/schemas";
|
|
25
25
|
|
|
26
26
|
export interface RunActionPluginProvides {
|
|
27
|
-
runAction: (options?: RunActionOptions) => Promise<{
|
|
27
|
+
runAction: (options?: RunActionOptions) => Promise<{
|
|
28
|
+
data: any[];
|
|
29
|
+
nextCursor?: string;
|
|
30
|
+
}> &
|
|
28
31
|
AsyncIterable<{ data: any[]; nextCursor?: string }> & {
|
|
29
32
|
items(): AsyncIterable<any>;
|
|
30
33
|
};
|
package/src/schemas/Action.ts
CHANGED
|
@@ -7,8 +7,9 @@ import { ActionSchema } from "../api/schemas";
|
|
|
7
7
|
// ============================================================================
|
|
8
8
|
|
|
9
9
|
export const ActionItemSchema = withFormatter(
|
|
10
|
-
ActionSchema.omit({ type: true, name: true }).extend({
|
|
11
|
-
app_key: z.string(), //
|
|
10
|
+
ActionSchema.omit({ type: true, name: true, selected_api: true }).extend({
|
|
11
|
+
app_key: z.string(), // App key without version (extracted from selected_api)
|
|
12
|
+
app_version: z.string().optional(), // Version extracted from selected_api
|
|
12
13
|
action_type: ActionSchema.shape.type, // Mapped from original 'type' field
|
|
13
14
|
title: z.string(), // Mapped from original 'name' field
|
|
14
15
|
type: z.literal("action"), // Fixed type identifier
|
package/src/schemas/App.ts
CHANGED
package/src/schemas/Auth.ts
CHANGED
|
@@ -13,7 +13,7 @@ export const AuthenticationItemSchema = withFormatter(
|
|
|
13
13
|
is_expired: z.string().optional(), // Mapped from is_stale
|
|
14
14
|
expired_at: z.string().nullable().optional(), // Mapped from marked_stale_at
|
|
15
15
|
app_key: z.string().optional(), // App key from implementations endpoint
|
|
16
|
-
|
|
16
|
+
app_version: z.string().optional(), // Version extracted from implementation_id
|
|
17
17
|
user_id: z.number().optional(),
|
|
18
18
|
},
|
|
19
19
|
),
|
package/src/types/properties.ts
CHANGED
|
@@ -6,7 +6,10 @@ import { MAX_PAGE_LIMIT } from "../constants";
|
|
|
6
6
|
// These can be reused in function schemas without duplication
|
|
7
7
|
|
|
8
8
|
export const AppKeyPropertySchema = withPositional(
|
|
9
|
-
z
|
|
9
|
+
z
|
|
10
|
+
.string()
|
|
11
|
+
.min(1)
|
|
12
|
+
.describe("App key (e.g., 'SlackCLIAPI' or slug like 'github')"),
|
|
10
13
|
);
|
|
11
14
|
|
|
12
15
|
export const ActionTypePropertySchema = z
|
|
@@ -59,16 +59,16 @@ export function normalizeImplementationMetaToAppItem(
|
|
|
59
59
|
* @param auth - Raw Authentication from API
|
|
60
60
|
* @param options - Additional fields to include
|
|
61
61
|
* @param options.app_key - selected_api from implementations endpoint
|
|
62
|
-
* @param options.
|
|
62
|
+
* @param options.app_version - Version extracted from selected_api
|
|
63
63
|
* @returns Normalized AuthenticationItem
|
|
64
64
|
*/
|
|
65
65
|
export function normalizeAuthenticationItem(
|
|
66
66
|
auth: Authentication,
|
|
67
|
-
options: { app_key?: string;
|
|
67
|
+
options: { app_key?: string; app_version?: string } = {},
|
|
68
68
|
): AuthenticationItem {
|
|
69
69
|
// Extract app key and version from selected_api if not provided
|
|
70
70
|
let appKey = options.app_key;
|
|
71
|
-
let
|
|
71
|
+
let appVersion = options.app_version;
|
|
72
72
|
|
|
73
73
|
if (auth.selected_api) {
|
|
74
74
|
const [extractedAppKey, extractedVersion] = splitVersionedKey(
|
|
@@ -81,8 +81,8 @@ export function normalizeAuthenticationItem(
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// Use extracted version if not provided in options
|
|
84
|
-
if (!
|
|
85
|
-
|
|
84
|
+
if (!appVersion) {
|
|
85
|
+
appVersion = extractedVersion;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -99,16 +99,29 @@ export function normalizeAuthenticationItem(
|
|
|
99
99
|
is_expired: auth.is_stale, // Map is_stale to is_expired
|
|
100
100
|
expired_at: auth.marked_stale_at, // Map marked_stale_at to expired_at
|
|
101
101
|
app_key: appKey, // App key from implementations endpoint or parsed from selected_api
|
|
102
|
-
|
|
102
|
+
app_version: appVersion, // Version from selected_api or provided
|
|
103
103
|
user_id: userId, // Map customuser_id to user_id
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
export function normalizeActionItem(action: Action): ActionItem {
|
|
108
|
-
const { name, type, selected_api:
|
|
108
|
+
const { name, type, selected_api: selectedApi } = action;
|
|
109
|
+
|
|
110
|
+
// Split version from selected_api
|
|
111
|
+
const [appKey, appVersion] = selectedApi
|
|
112
|
+
? splitVersionedKey(selectedApi)
|
|
113
|
+
: ["", undefined];
|
|
114
|
+
|
|
109
115
|
return {
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
// Only include the fields we want - explicitly list them
|
|
117
|
+
id: action.id,
|
|
118
|
+
key: action.key,
|
|
119
|
+
description: action.description,
|
|
120
|
+
is_important: action.is_important,
|
|
121
|
+
is_hidden: action.is_hidden,
|
|
122
|
+
// Transformed fields
|
|
123
|
+
app_key: appKey,
|
|
124
|
+
app_version: appVersion,
|
|
112
125
|
action_type: type,
|
|
113
126
|
title: name, // Map name to title
|
|
114
127
|
type: "action",
|