@zapier/zapier-sdk 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +336 -128
- 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 +108 -58
- package/dist/index.d.mts +88 -434
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +108 -58
- package/dist/plugins/apps/index.d.ts +2 -2
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +21 -0
- package/dist/plugins/apps/schemas.d.ts +51 -0
- package/dist/plugins/apps/schemas.d.ts.map +1 -0
- package/dist/plugins/apps/schemas.js +13 -0
- package/dist/plugins/findFirstAuthentication/schemas.js +1 -1
- package/dist/plugins/findUniqueAuthentication/schemas.js +1 -1
- 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/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/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +12 -1
- 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/types/sdk.d.ts +1 -1
- package/dist/types/sdk.d.ts.map +1 -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/index.ts +28 -7
- package/src/plugins/apps/{types.ts → schemas.ts} +27 -9
- package/src/plugins/findFirstAuthentication/schemas.ts +1 -1
- package/src/plugins/findUniqueAuthentication/schemas.ts +1 -1
- 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 +4 -1
- 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/registry/index.ts +12 -1
- 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/types/sdk.ts +1 -1
- package/src/utils/domain-utils.ts +22 -9
- package/src/utils/schema-utils.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/plugins/apps/types.d.ts +0 -30
- package/dist/plugins/apps/types.d.ts.map +0 -1
- package/dist/plugins/apps/types.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/types/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,oBAAoB;;
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/types/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,oBAAoB;;CAKhC,CAAC;AAEF,eAAO,MAAM,wBAAwB,6GAW4B,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAGA,CAAC;AAErC,eAAO,MAAM,8BAA8B,aAGY,CAAC;AAExD,eAAO,MAAM,oBAAoB,wCAEa,CAAC;AAE/C,eAAO,MAAM,mBAAmB,2BAMgB,CAAC;AAEjD,eAAO,MAAM,oBAAoB,2BAKoB,CAAC;AAEtD,eAAO,MAAM,oBAAoB,aAA0C,CAAC;AAE5E,eAAO,MAAM,mBAAmB,4BAGG,CAAC;AAEpC,eAAO,MAAM,oBAAoB,wCAEG,CAAC;AAGrC,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/types/properties.js
CHANGED
|
@@ -3,7 +3,10 @@ import { withPositional } from "../utils/schema-utils";
|
|
|
3
3
|
import { MAX_PAGE_LIMIT } from "../constants";
|
|
4
4
|
// Shared property definitions for common parameters across functions
|
|
5
5
|
// These can be reused in function schemas without duplication
|
|
6
|
-
export const AppKeyPropertySchema = withPositional(z
|
|
6
|
+
export const AppKeyPropertySchema = withPositional(z
|
|
7
|
+
.string()
|
|
8
|
+
.min(1)
|
|
9
|
+
.describe("App key (e.g., 'SlackCLIAPI' or slug like 'github')"));
|
|
7
10
|
export const ActionTypePropertySchema = z
|
|
8
11
|
.enum([
|
|
9
12
|
"read",
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ import type { z } from "zod";
|
|
|
28
28
|
import type { RegistryPluginProvides } from "../plugins/registry";
|
|
29
29
|
import type { GetProfilePluginProvides } from "../plugins/getProfile";
|
|
30
30
|
import type { AppsPluginProvides, ZapierSdkApps } from "../plugins/apps";
|
|
31
|
-
import type { ActionProxy } from "../plugins/apps/
|
|
31
|
+
import type { ActionProxy } from "../plugins/apps/schemas";
|
|
32
32
|
import type { FetchPluginProvides } from "../plugins/fetch";
|
|
33
33
|
import type { ListAppsPluginProvides } from "../plugins/listApps";
|
|
34
34
|
import type { GetAppPluginProvides } from "../plugins/getApp";
|
package/dist/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/types/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE;YACJ,CAAC,MAAM,EAAE,MAAM,GAAG;gBAChB,kBAAkB,EAAE,MAAM,CAAC;gBAC3B,OAA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B,mCAAmC,GACnC,qBAAqB,GACrB,wBAAwB,CAC3B;IAED,IAAI,EAAE,WAAW,GAAG,aAAa,CAAC;CACnC"}
|
|
@@ -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,CAAC,CAQ9B;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAgBT;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,
|
|
1
|
+
{"version":3,"file":"domain-utils.d.ts","sourceRoot":"","sources":["../../src/utils/dom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AAI,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":"","sources":["../../src/utils/schema-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMvD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAA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AE,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";
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ActionExecutionOptions,
|
|
3
|
+
ActionProxy,
|
|
4
|
+
AppFactoryInput,
|
|
5
|
+
} from "./schemas";
|
|
6
|
+
import { ActionExecutionInputSchema, AppFactoryInputSchema } from "./schemas";
|
|
2
7
|
import { ZapierValidationError } from "../../types/errors";
|
|
3
8
|
import type { Plugin, GetSdkType } from "../../types/plugin";
|
|
4
9
|
import type { FetchPluginProvides } from "../fetch/index";
|
|
5
10
|
import type { RunActionPluginProvides } from "../runAction/index";
|
|
11
|
+
import { ActionResultItemSchema } from "../../schemas/Run";
|
|
6
12
|
|
|
7
13
|
export interface AppsPluginProvides {
|
|
8
14
|
apps: ActionProxy;
|
|
@@ -12,10 +18,6 @@ interface AppsPluginOptions {
|
|
|
12
18
|
sdk: GetSdkType<FetchPluginProvides & RunActionPluginProvides>;
|
|
13
19
|
}
|
|
14
20
|
|
|
15
|
-
interface AppFactoryOptions {
|
|
16
|
-
authenticationId: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
21
|
function createActionFunction(
|
|
20
22
|
appKey: string,
|
|
21
23
|
actionType: string,
|
|
@@ -127,7 +129,7 @@ function createPinnedAppProxy(
|
|
|
127
129
|
|
|
128
130
|
function createAppProxy(appKey: string, options: AppsPluginOptions) {
|
|
129
131
|
// Create the factory function that returns a pinned version
|
|
130
|
-
const appFactory = (factoryOptions:
|
|
132
|
+
const appFactory = (factoryOptions: AppFactoryInput) => {
|
|
131
133
|
return createPinnedAppProxy(
|
|
132
134
|
appKey,
|
|
133
135
|
options,
|
|
@@ -170,11 +172,30 @@ export const appsPlugin: Plugin<
|
|
|
170
172
|
// Return flat structure - apps goes directly to SDK
|
|
171
173
|
return {
|
|
172
174
|
apps: createAppsProxy({ sdk }),
|
|
175
|
+
context: {
|
|
176
|
+
meta: {
|
|
177
|
+
"apps.{appKey}": {
|
|
178
|
+
categories: ["app"],
|
|
179
|
+
packages: ["sdk"],
|
|
180
|
+
type: "function",
|
|
181
|
+
inputSchema: AppFactoryInputSchema,
|
|
182
|
+
returnType: "AppProxy",
|
|
183
|
+
},
|
|
184
|
+
"apps.{appKey}.{actionType}.{actionKey}": {
|
|
185
|
+
categories: ["app"],
|
|
186
|
+
packages: ["sdk"],
|
|
187
|
+
type: "list",
|
|
188
|
+
inputSchema: ActionExecutionInputSchema,
|
|
189
|
+
itemType: "ActionResult",
|
|
190
|
+
outputSchema: ActionResultItemSchema,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
173
194
|
};
|
|
174
195
|
};
|
|
175
196
|
|
|
176
197
|
// Export types for use in generated code
|
|
177
|
-
export type { ActionExecutionOptions } from "./
|
|
198
|
+
export type { ActionExecutionOptions } from "./schemas";
|
|
178
199
|
export type { ActionExecutionResult } from "../../api/types";
|
|
179
200
|
|
|
180
201
|
// Interface for generated apps - will be augmented by generated .d.ts files
|
|
@@ -1,16 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const ActionExecutionInputSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
inputs: z.record(z.unknown()).optional(),
|
|
6
|
+
authenticationId: z.number().optional(),
|
|
7
|
+
})
|
|
8
|
+
.describe(
|
|
9
|
+
"Execute an action with the given inputs for the bound app, as an alternative to runAction",
|
|
10
|
+
);
|
|
11
|
+
|
|
1
12
|
// Apps plugin-specific execution options
|
|
2
|
-
export
|
|
3
|
-
inputs?: Record<string, any>;
|
|
4
|
-
authenticationId?: number;
|
|
5
|
-
}
|
|
13
|
+
export type ActionExecutionOptions = z.infer<typeof ActionExecutionInputSchema>;
|
|
6
14
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
export const AppFactoryInputSchema = z
|
|
16
|
+
.object({
|
|
17
|
+
authenticationId: z.number(),
|
|
18
|
+
})
|
|
19
|
+
.describe("Bind an authentication ID to an app");
|
|
20
|
+
|
|
21
|
+
export type AppFactoryInput = z.infer<typeof AppFactoryInputSchema>;
|
|
10
22
|
|
|
11
23
|
// Base action type proxy for regular actions
|
|
12
24
|
interface BaseActionTypeProxy {
|
|
13
|
-
[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
|
+
};
|
|
14
32
|
}
|
|
15
33
|
|
|
16
34
|
// Special fetch function type
|
|
@@ -33,7 +51,7 @@ interface AppProxy {
|
|
|
33
51
|
}
|
|
34
52
|
|
|
35
53
|
interface AppFactory {
|
|
36
|
-
(options:
|
|
54
|
+
(options: AppFactoryInput): AppProxy;
|
|
37
55
|
}
|
|
38
56
|
|
|
39
57
|
// An app can be both a factory function and have properties for direct access
|
|
@@ -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()
|
|
@@ -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
|
};
|
|
@@ -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
|
|
|
@@ -53,7 +53,18 @@ export const registryPlugin: Plugin<
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const functions = metaKeys
|
|
56
|
-
.filter((key) =>
|
|
56
|
+
.filter((key) => {
|
|
57
|
+
const property = sdk[key as keyof typeof sdk];
|
|
58
|
+
if (typeof property === "function") {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
const [rootKey] = key.split(".");
|
|
62
|
+
const rootProperty = sdk[rootKey as keyof typeof sdk];
|
|
63
|
+
if (typeof rootProperty === "object" && rootProperty !== null) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
})
|
|
57
68
|
.map((key) => {
|
|
58
69
|
const meta = context.meta[key];
|
|
59
70
|
return {
|
|
@@ -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
|
package/src/types/sdk.ts
CHANGED
|
@@ -34,7 +34,7 @@ import type { z } from "zod";
|
|
|
34
34
|
import type { RegistryPluginProvides } from "../plugins/registry";
|
|
35
35
|
import type { GetProfilePluginProvides } from "../plugins/getProfile";
|
|
36
36
|
import type { AppsPluginProvides, ZapierSdkApps } from "../plugins/apps";
|
|
37
|
-
import type { ActionProxy } from "../plugins/apps/
|
|
37
|
+
import type { ActionProxy } from "../plugins/apps/schemas";
|
|
38
38
|
import type { FetchPluginProvides } from "../plugins/fetch";
|
|
39
39
|
import type { ListAppsPluginProvides } from "../plugins/listApps";
|
|
40
40
|
import type { GetAppPluginProvides } from "../plugins/getApp";
|
|
@@ -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",
|