@zapier/zapier-sdk-cli 0.43.0 → 0.43.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cli.cjs +434 -519
  3. package/dist/cli.mjs +437 -522
  4. package/dist/index.cjs +436 -521
  5. package/dist/index.d.mts +395 -23
  6. package/dist/index.d.ts +395 -23
  7. package/dist/index.mjs +440 -525
  8. package/dist/package.json +1 -1
  9. package/dist/src/plugins/add/index.d.ts +250 -11
  10. package/dist/src/plugins/add/index.js +8 -16
  11. package/dist/src/plugins/buildManifest/index.d.ts +116 -9
  12. package/dist/src/plugins/buildManifest/index.js +14 -23
  13. package/dist/src/plugins/bundleCode/index.d.ts +19 -10
  14. package/dist/src/plugins/bundleCode/index.js +7 -17
  15. package/dist/src/plugins/cliOverrides/index.d.ts +12 -10
  16. package/dist/src/plugins/cliOverrides/index.js +16 -20
  17. package/dist/src/plugins/curl/index.d.ts +69 -10
  18. package/dist/src/plugins/curl/index.js +3 -2
  19. package/dist/src/plugins/feedback/index.d.ts +18 -13
  20. package/dist/src/plugins/feedback/index.js +17 -25
  21. package/dist/src/plugins/generateAppTypes/index.d.ts +261 -9
  22. package/dist/src/plugins/generateAppTypes/index.js +17 -45
  23. package/dist/src/plugins/getLoginConfigPath/index.d.ts +12 -10
  24. package/dist/src/plugins/getLoginConfigPath/index.js +8 -18
  25. package/dist/src/plugins/init/index.d.ts +15 -11
  26. package/dist/src/plugins/init/index.js +9 -17
  27. package/dist/src/plugins/login/index.d.ts +18 -13
  28. package/dist/src/plugins/login/index.js +9 -17
  29. package/dist/src/plugins/logout/index.d.ts +12 -11
  30. package/dist/src/plugins/logout/index.js +10 -16
  31. package/dist/src/plugins/mcp/index.d.ts +18 -15
  32. package/dist/src/plugins/mcp/index.js +9 -21
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +3 -3
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-cli",
3
- "version": "0.43.0",
3
+ "version": "0.43.1",
4
4
  "description": "Command line interface for Zapier SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -1,15 +1,254 @@
1
- import type { Plugin, ListActionsPluginProvides, ListAppsPluginProvides, ListInputFieldsPluginProvides, ListConnectionsPluginProvides } from "@zapier/zapier-sdk";
2
- import { AddSchema, type AddOptions } from "./schemas";
3
- import { type GenerateAppTypesPluginProvides } from "../generateAppTypes";
4
- import { type BuildManifestPluginProvides } from "../buildManifest";
5
- export interface AddPluginProvides {
6
- add: (options: AddOptions) => Promise<void>;
1
+ export declare const addPlugin: (sdk: {
2
+ listApps: (options?: ({
3
+ search?: string | undefined;
4
+ apps?: string[] | undefined;
5
+ appKeys?: string[] | undefined;
6
+ pageSize?: number | undefined;
7
+ maxItems?: number | undefined;
8
+ cursor?: string | undefined;
9
+ } & {
10
+ cursor?: string;
11
+ pageSize?: number;
12
+ maxItems?: number;
13
+ }) | undefined) => import("@zapier/zapier-sdk").PaginatedSdkResult<{
14
+ slug: string;
15
+ title: string;
16
+ key: string;
17
+ implementation_id: string;
18
+ description?: string | undefined;
19
+ is_hidden?: boolean | undefined;
20
+ auth_type?: string | undefined;
21
+ actions?: {
22
+ read?: number | undefined;
23
+ read_bulk?: number | undefined;
24
+ write?: number | undefined;
25
+ search?: number | undefined;
26
+ search_or_write?: number | undefined;
27
+ search_and_write?: number | undefined;
28
+ filter?: number | undefined;
29
+ } | undefined;
30
+ is_deprecated?: boolean | undefined;
31
+ is_beta?: boolean | undefined;
32
+ is_premium?: boolean | undefined;
33
+ age_in_days?: number | undefined;
34
+ banner?: string | undefined;
35
+ categories?: {
36
+ id: number;
37
+ name: string;
38
+ slug: string;
39
+ }[] | undefined;
40
+ images?: {
41
+ url_16x16?: string | undefined;
42
+ url_32x32?: string | undefined;
43
+ url_64x64?: string | undefined;
44
+ url_128x128?: string | undefined;
45
+ } | undefined;
46
+ popularity?: number | undefined;
47
+ has_filters?: boolean | undefined;
48
+ has_reads?: boolean | undefined;
49
+ has_searches?: boolean | undefined;
50
+ has_searches_or_writes?: boolean | undefined;
51
+ has_upfront_fields?: boolean | undefined;
52
+ has_writes?: boolean | undefined;
53
+ is_built_in?: boolean | undefined;
54
+ is_featured?: boolean | undefined;
55
+ is_invite?: boolean | undefined;
56
+ is_public?: boolean | undefined;
57
+ is_upcoming?: boolean | undefined;
58
+ visibility?: string | undefined;
59
+ primary_color?: string | undefined;
60
+ secondary_color?: string | undefined;
61
+ classification?: string | undefined;
62
+ api_docs_url?: string | undefined;
63
+ image?: string | undefined;
64
+ version?: string | undefined;
65
+ }>;
66
+ } & {
7
67
  context: {
8
68
  meta: {
9
- add: {
10
- inputSchema: typeof AddSchema;
11
- };
69
+ listApps: import("@zapier/zapier-sdk").PluginMeta;
12
70
  };
13
71
  };
14
- }
15
- export declare const addPlugin: Plugin<ListAppsPluginProvides & ListActionsPluginProvides & ListInputFieldsPluginProvides & ListConnectionsPluginProvides & BuildManifestPluginProvides & GenerateAppTypesPluginProvides, AddPluginProvides>;
72
+ } & {
73
+ listActions: (options?: (({
74
+ app: string;
75
+ actionType?: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write" | undefined;
76
+ pageSize?: number | undefined;
77
+ maxItems?: number | undefined;
78
+ cursor?: string | undefined;
79
+ } | {
80
+ appKey: string;
81
+ actionType?: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write" | undefined;
82
+ pageSize?: number | undefined;
83
+ maxItems?: number | undefined;
84
+ cursor?: string | undefined;
85
+ }) & {
86
+ cursor?: string;
87
+ pageSize?: number;
88
+ maxItems?: number;
89
+ }) | undefined) => import("@zapier/zapier-sdk").PaginatedSdkResult<{
90
+ description: string;
91
+ key: string;
92
+ app_key: string;
93
+ action_type: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
94
+ title: string;
95
+ type: "action";
96
+ id?: string | undefined;
97
+ is_important?: boolean | undefined;
98
+ is_hidden?: boolean | undefined;
99
+ app_version?: string | undefined;
100
+ }>;
101
+ } & {
102
+ context: {
103
+ meta: {
104
+ listActions: import("@zapier/zapier-sdk").PluginMeta;
105
+ };
106
+ };
107
+ } & {
108
+ listInputFields: (options?: (({
109
+ app: string;
110
+ actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
111
+ action: string;
112
+ connection?: string | number | undefined;
113
+ connectionId?: string | number | null | undefined;
114
+ authenticationId?: string | number | null | undefined;
115
+ inputs?: Record<string, unknown> | undefined;
116
+ pageSize?: number | undefined;
117
+ maxItems?: number | undefined;
118
+ cursor?: string | undefined;
119
+ } | {
120
+ appKey: string;
121
+ actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
122
+ actionKey: string;
123
+ connection?: string | number | undefined;
124
+ connectionId?: string | number | null | undefined;
125
+ authenticationId?: string | number | null | undefined;
126
+ inputs?: Record<string, unknown> | undefined;
127
+ pageSize?: number | undefined;
128
+ maxItems?: number | undefined;
129
+ cursor?: string | undefined;
130
+ }) & {
131
+ cursor?: string;
132
+ pageSize?: number;
133
+ maxItems?: number;
134
+ }) | undefined) => import("@zapier/zapier-sdk").PaginatedSdkResult<{
135
+ key: string;
136
+ type: "input_field";
137
+ default_value: string;
138
+ depends_on: string[];
139
+ description: string;
140
+ invalidates_input_fields: boolean;
141
+ is_required: boolean;
142
+ placeholder: string;
143
+ title: string;
144
+ value_type: string;
145
+ format?: string | undefined;
146
+ items?: {
147
+ type: string;
148
+ } | undefined;
149
+ } | {
150
+ key: string;
151
+ type: "info_field";
152
+ description: string;
153
+ title?: string | undefined;
154
+ } | import("@zapier/zapier-sdk").FieldsetItem>;
155
+ } & {
156
+ context: {
157
+ meta: {
158
+ listInputFields: import("@zapier/zapier-sdk").PluginMeta;
159
+ };
160
+ };
161
+ } & {
162
+ listConnections: (options?: ({
163
+ title?: string | undefined;
164
+ search?: string | undefined;
165
+ owner?: string | undefined;
166
+ app?: string | undefined;
167
+ appKey?: string | undefined;
168
+ connections?: string[] | undefined;
169
+ connectionIds?: string[] | undefined;
170
+ authenticationIds?: string[] | undefined;
171
+ account?: string | undefined;
172
+ accountId?: string | undefined;
173
+ includeShared?: boolean | undefined;
174
+ isExpired?: boolean | undefined;
175
+ expired?: boolean | undefined;
176
+ pageSize?: number | undefined;
177
+ maxItems?: number | undefined;
178
+ cursor?: string | undefined;
179
+ } & {
180
+ cursor?: string;
181
+ pageSize?: number;
182
+ maxItems?: number;
183
+ }) | undefined) => import("@zapier/zapier-sdk").PaginatedSdkResult<{
184
+ date: string;
185
+ is_invite_only: boolean;
186
+ is_private: boolean;
187
+ shared_with_all: boolean;
188
+ id: string;
189
+ account_id: string;
190
+ title?: string | null | undefined;
191
+ lastchanged?: string | undefined;
192
+ destination_selected_api?: string | null | undefined;
193
+ is_stale?: string | undefined;
194
+ is_shared?: string | undefined;
195
+ marked_stale_at?: string | null | undefined;
196
+ label?: string | null | undefined;
197
+ identifier?: string | null | undefined;
198
+ url?: string | undefined;
199
+ groups?: Record<string, unknown>[] | undefined;
200
+ members?: string | undefined;
201
+ permissions?: Record<string, boolean> | undefined;
202
+ public_id?: string | undefined;
203
+ account_public_id?: string | undefined;
204
+ customuser_public_id?: string | undefined;
205
+ implementation_id?: string | undefined;
206
+ profile_id?: string | undefined;
207
+ is_expired?: string | undefined;
208
+ expired_at?: string | null | undefined;
209
+ app_key?: string | undefined;
210
+ app_version?: string | undefined;
211
+ }>;
212
+ } & {
213
+ context: {
214
+ meta: {
215
+ listConnections: import("@zapier/zapier-sdk").PluginMeta;
216
+ };
217
+ };
218
+ } & {
219
+ buildManifest: (options?: import("../buildManifest/schemas").BuildManifestOptions | undefined) => Promise<import("../buildManifest/schemas").BuildManifestResult>;
220
+ } & {
221
+ context: {
222
+ meta: {
223
+ buildManifest: import("@zapier/zapier-sdk").PluginMeta;
224
+ };
225
+ };
226
+ } & {
227
+ generateAppTypes: (options?: import("../generateAppTypes/schemas").GenerateAppTypesOptions | undefined) => Promise<import("../generateAppTypes/schemas").GenerateAppTypesResult>;
228
+ } & {
229
+ context: {
230
+ meta: {
231
+ generateAppTypes: import("@zapier/zapier-sdk").PluginMeta;
232
+ };
233
+ };
234
+ } & {
235
+ context: import("@zapier/zapier-sdk").EventEmissionContext;
236
+ } & {
237
+ context: {
238
+ meta: Record<string, import("@zapier/zapier-sdk").PluginMeta>;
239
+ };
240
+ }) => {
241
+ add: (options?: {
242
+ apps: string[];
243
+ connections?: string[] | undefined;
244
+ configPath?: string | undefined;
245
+ typesOutput?: string | undefined;
246
+ } | undefined) => Promise<void>;
247
+ } & {
248
+ context: {
249
+ meta: {
250
+ add: import("@zapier/zapier-sdk").PluginMeta;
251
+ };
252
+ };
253
+ };
254
+ export type AddPluginProvides = ReturnType<typeof addPlugin>;
@@ -1,9 +1,12 @@
1
- import { createFunction } from "@zapier/zapier-sdk";
1
+ import { createPluginMethod, definePlugin } from "@zapier/zapier-sdk";
2
2
  import { AddSchema } from "./schemas";
3
3
  import { detectTypesOutputDirectory } from "../../utils/directory-detection";
4
4
  import { resolve } from "path";
5
- export const addPlugin = (sdk) => {
6
- const add = createFunction(async function add(options) {
5
+ export const addPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
6
+ name: "add",
7
+ categories: ["utility"],
8
+ inputSchema: AddSchema,
9
+ handler: async ({ sdk, options }) => {
7
10
  const { apps: appKeys, connections: connectionIds, configPath, typesOutput = await detectTypesOutputDirectory(), } = options;
8
11
  const resolvedTypesOutput = resolve(typesOutput);
9
12
  console.log(`📦 Adding ${appKeys.length} app(s)...`);
@@ -88,16 +91,5 @@ export const addPlugin = (sdk) => {
88
91
  if (successfulApps.length > 0) {
89
92
  console.log(`✅ Added ${successfulApps.length} app(s) to manifest`);
90
93
  }
91
- }, AddSchema);
92
- return {
93
- add,
94
- context: {
95
- meta: {
96
- add: {
97
- categories: ["utility"],
98
- inputSchema: AddSchema,
99
- },
100
- },
101
- },
102
- };
103
- };
94
+ },
95
+ }));
@@ -1,13 +1,120 @@
1
- import type { Plugin, ListAppsPluginProvides, ManifestPluginProvides } from "@zapier/zapier-sdk";
2
- import { BuildManifestSchema, type BuildManifestOptions, type BuildManifestResult } from "./schemas";
3
- export interface BuildManifestPluginProvides {
4
- buildManifest: (options: BuildManifestOptions) => Promise<BuildManifestResult>;
1
+ import type { Manifest } from "@zapier/zapier-sdk";
2
+ import { type BuildManifestOptions, type BuildManifestResult } from "./schemas";
3
+ export declare const buildManifestPlugin: (sdk: {
4
+ listApps: (options?: ({
5
+ search?: string | undefined;
6
+ apps?: string[] | undefined;
7
+ appKeys?: string[] | undefined;
8
+ pageSize?: number | undefined;
9
+ maxItems?: number | undefined;
10
+ cursor?: string | undefined;
11
+ } & {
12
+ cursor?: string;
13
+ pageSize?: number;
14
+ maxItems?: number;
15
+ }) | undefined) => import("@zapier/zapier-sdk").PaginatedSdkResult<{
16
+ slug: string;
17
+ title: string;
18
+ key: string;
19
+ implementation_id: string;
20
+ description?: string | undefined;
21
+ is_hidden?: boolean | undefined;
22
+ auth_type?: string | undefined;
23
+ actions?: {
24
+ read?: number | undefined;
25
+ read_bulk?: number | undefined;
26
+ write?: number | undefined;
27
+ search?: number | undefined;
28
+ search_or_write?: number | undefined;
29
+ search_and_write?: number | undefined;
30
+ filter?: number | undefined;
31
+ } | undefined;
32
+ is_deprecated?: boolean | undefined;
33
+ is_beta?: boolean | undefined;
34
+ is_premium?: boolean | undefined;
35
+ age_in_days?: number | undefined;
36
+ banner?: string | undefined;
37
+ categories?: {
38
+ id: number;
39
+ name: string;
40
+ slug: string;
41
+ }[] | undefined;
42
+ images?: {
43
+ url_16x16?: string | undefined;
44
+ url_32x32?: string | undefined;
45
+ url_64x64?: string | undefined;
46
+ url_128x128?: string | undefined;
47
+ } | undefined;
48
+ popularity?: number | undefined;
49
+ has_filters?: boolean | undefined;
50
+ has_reads?: boolean | undefined;
51
+ has_searches?: boolean | undefined;
52
+ has_searches_or_writes?: boolean | undefined;
53
+ has_upfront_fields?: boolean | undefined;
54
+ has_writes?: boolean | undefined;
55
+ is_built_in?: boolean | undefined;
56
+ is_featured?: boolean | undefined;
57
+ is_invite?: boolean | undefined;
58
+ is_public?: boolean | undefined;
59
+ is_upcoming?: boolean | undefined;
60
+ visibility?: string | undefined;
61
+ primary_color?: string | undefined;
62
+ secondary_color?: string | undefined;
63
+ classification?: string | undefined;
64
+ api_docs_url?: string | undefined;
65
+ image?: string | undefined;
66
+ version?: string | undefined;
67
+ }>;
68
+ } & {
5
69
  context: {
6
70
  meta: {
7
- buildManifest: {
8
- inputSchema: typeof BuildManifestSchema;
9
- };
71
+ listApps: import("@zapier/zapier-sdk").PluginMeta;
10
72
  };
11
73
  };
12
- }
13
- export declare const buildManifestPlugin: Plugin<ListAppsPluginProvides & ManifestPluginProvides, BuildManifestPluginProvides>;
74
+ } & {
75
+ context: {
76
+ getResolvedManifest: () => Promise<Manifest | null>;
77
+ getVersionedImplementationId: (appKey: string) => Promise<string | null>;
78
+ resolveAppKeys: ({ appKeys }: {
79
+ appKeys: string[];
80
+ }) => Promise<import("@zapier/zapier-sdk").ResolvedAppLocator[]>;
81
+ updateManifestEntry: (options: import("@zapier/zapier-sdk").UpdateManifestEntryOptions) => Promise<import("@zapier/zapier-sdk").UpdateManifestEntryResult>;
82
+ addActionEntry: (options: import("@zapier/zapier-sdk").AddActionEntryOptions) => Promise<import("@zapier/zapier-sdk").AddActionEntryResult>;
83
+ findActionEntry: ({ name, manifest, }: {
84
+ name: string;
85
+ manifest: Manifest;
86
+ }) => import("@zapier/zapier-sdk").ActionEntry | null;
87
+ listActionEntries: ({ configPath, }?: {
88
+ configPath?: string;
89
+ }) => Promise<Array<[string, import("@zapier/zapier-sdk").ActionEntry]>>;
90
+ deleteActionEntry: ({ name, configPath, skipWrite, }: {
91
+ name: string;
92
+ configPath?: string;
93
+ skipWrite?: boolean;
94
+ }) => Promise<Manifest>;
95
+ hasActionEntry: ({ name, manifest, }: {
96
+ name: string;
97
+ manifest: Manifest;
98
+ }) => boolean;
99
+ findManifestEntry: typeof import("@zapier/zapier-sdk").findManifestEntry;
100
+ readManifestFromFile: typeof import("@zapier/zapier-sdk").readManifestFromFile;
101
+ getManifestConnections: () => Promise<Record<string, {
102
+ connectionId: string | number;
103
+ }> | null>;
104
+ };
105
+ } & {
106
+ context: import("@zapier/zapier-sdk").EventEmissionContext;
107
+ } & {
108
+ context: {
109
+ meta: Record<string, import("@zapier/zapier-sdk").PluginMeta>;
110
+ };
111
+ }) => {
112
+ buildManifest: (options?: BuildManifestOptions | undefined) => Promise<BuildManifestResult>;
113
+ } & {
114
+ context: {
115
+ meta: {
116
+ buildManifest: import("@zapier/zapier-sdk").PluginMeta;
117
+ };
118
+ };
119
+ };
120
+ export type BuildManifestPluginProvides = ReturnType<typeof buildManifestPlugin>;
@@ -1,8 +1,15 @@
1
- import { createFunction, ZapierValidationError, ZapierUnknownError, } from "@zapier/zapier-sdk";
1
+ import { createPluginMethod, definePlugin, ZapierValidationError, ZapierUnknownError, } from "@zapier/zapier-sdk";
2
2
  import { BuildManifestSchema, } from "./schemas";
3
3
  import { createManifestEntry } from "../../utils/manifest-helpers";
4
- export const buildManifestPlugin = (sdk) => {
5
- const buildManifest = createFunction(async function buildManifest(options) {
4
+ export const buildManifestPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
5
+ name: "buildManifest",
6
+ categories: ["utility"],
7
+ // Cast: BuildManifestSchema validates JSON-serializable fields only.
8
+ // BuildManifestOptions adds an `onProgress` callback that rides through
9
+ // `createFunction`'s passthrough spread at runtime; this widens TInput
10
+ // so the handler can read it.
11
+ inputSchema: BuildManifestSchema,
12
+ handler: async ({ sdk, options }) => {
6
13
  const { apps: appKeys, skipWrite = false, configPath, onProgress, } = options;
7
14
  onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
8
15
  const appsIterable = sdk.listApps({ apps: appKeys }).items();
@@ -16,7 +23,6 @@ export const buildManifestPlugin = (sdk) => {
16
23
  return {};
17
24
  }
18
25
  let updatedManifest;
19
- // Process each app
20
26
  for (const app of apps) {
21
27
  onProgress?.({
22
28
  type: "app_processing_start",
@@ -55,26 +61,11 @@ export const buildManifestPlugin = (sdk) => {
55
61
  error: errorMessage,
56
62
  });
57
63
  if (error instanceof ZapierValidationError) {
58
- throw error; // Preserve the specific error type
59
- }
60
- else {
61
- throw new ZapierUnknownError(errorMessage, {
62
- cause: error, // Works for both Error and non-Error
63
- });
64
+ throw error;
64
65
  }
66
+ throw new ZapierUnknownError(errorMessage, { cause: error });
65
67
  }
66
68
  }
67
69
  return { manifest: updatedManifest };
68
- }, BuildManifestSchema);
69
- return {
70
- buildManifest,
71
- context: {
72
- meta: {
73
- buildManifest: {
74
- categories: ["utility"],
75
- inputSchema: BuildManifestSchema,
76
- },
77
- },
78
- },
79
- };
80
- };
70
+ },
71
+ }));
@@ -1,14 +1,23 @@
1
- import type { Plugin } from "@zapier/zapier-sdk";
2
- import { BundleCodeSchema, type BundleCodeOptions } from "./schemas";
3
- export interface BundleCodePluginProvides {
4
- bundleCode: (options: BundleCodeOptions) => Promise<string>;
1
+ export declare const bundleCodePlugin: (sdk: {
2
+ context: import("@zapier/zapier-sdk").EventEmissionContext;
3
+ } & {
4
+ context: {
5
+ meta: Record<string, import("@zapier/zapier-sdk").PluginMeta>;
6
+ };
7
+ }) => {
8
+ bundleCode: (options?: {
9
+ input: string;
10
+ output?: string | undefined;
11
+ string?: boolean | undefined;
12
+ minify?: boolean | undefined;
13
+ target?: string | undefined;
14
+ cjs?: boolean | undefined;
15
+ } | undefined) => Promise<string>;
16
+ } & {
5
17
  context: {
6
18
  meta: {
7
- bundleCode: {
8
- inputSchema: typeof BundleCodeSchema;
9
- };
19
+ bundleCode: import("@zapier/zapier-sdk").PluginMeta;
10
20
  };
11
21
  };
12
- }
13
- export declare const bundleCodePlugin: Plugin<{}, // requires no existing SDK methods
14
- BundleCodePluginProvides>;
22
+ };
23
+ export type BundleCodePluginProvides = ReturnType<typeof bundleCodePlugin>;
@@ -1,24 +1,14 @@
1
1
  import { BundleCodeSchema } from "./schemas";
2
- import { createFunction } from "@zapier/zapier-sdk";
2
+ import { createPluginMethod, definePlugin, } from "@zapier/zapier-sdk";
3
3
  import { buildSync } from "esbuild";
4
4
  import * as fs from "fs";
5
5
  import * as path from "path";
6
- export const bundleCodePlugin = () => {
7
- const bundleCodeWithSdk = createFunction(async function bundleCodeWithSdk(options) {
8
- return await bundleCode(options);
9
- }, BundleCodeSchema);
10
- return {
11
- bundleCode: bundleCodeWithSdk,
12
- context: {
13
- meta: {
14
- bundleCode: {
15
- categories: ["utility", "deprecated"],
16
- inputSchema: BundleCodeSchema,
17
- },
18
- },
19
- },
20
- };
21
- };
6
+ export const bundleCodePlugin = definePlugin((sdk) => createPluginMethod(sdk, {
7
+ name: "bundleCode",
8
+ categories: ["utility", "deprecated"],
9
+ inputSchema: BundleCodeSchema,
10
+ handler: async ({ options }) => bundleCode(options),
11
+ }));
22
12
  class ZapierBundleError extends Error {
23
13
  constructor(message, details, originalError) {
24
14
  super(message);
@@ -1,24 +1,26 @@
1
- import type { FunctionDeprecation, Plugin } from "@zapier/zapier-sdk";
1
+ import type { FunctionDeprecation, PluginMeta } from "@zapier/zapier-sdk";
2
2
  interface FetchMeta {
3
3
  categories?: string[];
4
4
  deprecation?: FunctionDeprecation;
5
5
  }
6
- interface CliOverridesProvides {
7
- context: {
8
- meta: {
9
- fetch?: FetchMeta;
10
- };
11
- };
12
- }
13
6
  /**
14
7
  * CLI-specific metadata overrides.
15
8
  * Adds "deprecated" category to fetch so it's hidden from CLI help.
16
9
  */
17
- export declare const cliOverridesPlugin: Plugin<{
10
+ export declare const cliOverridesPlugin: (sdk: {
18
11
  context: {
19
12
  meta: {
20
13
  fetch?: FetchMeta;
21
14
  };
22
15
  };
23
- }, CliOverridesProvides>;
16
+ } & {
17
+ context: {
18
+ meta: Record<string, PluginMeta>;
19
+ };
20
+ }) => {
21
+ context: {
22
+ meta: Record<string, PluginMeta>;
23
+ };
24
+ };
25
+ export type CliOverridesProvides = ReturnType<typeof cliOverridesPlugin>;
24
26
  export {};
@@ -1,25 +1,21 @@
1
+ import { definePlugin } from "@zapier/zapier-sdk";
1
2
  /**
2
3
  * CLI-specific metadata overrides.
3
4
  * Adds "deprecated" category to fetch so it's hidden from CLI help.
4
5
  */
5
- export const cliOverridesPlugin = (sdk) => {
6
- if (!sdk.context.meta.fetch) {
7
- return { context: { meta: {} } };
8
- }
9
- return {
10
- context: {
11
- meta: {
12
- fetch: {
13
- ...sdk.context.meta.fetch,
14
- categories: [
15
- ...(sdk.context.meta.fetch.categories || []),
16
- "deprecated",
17
- ],
18
- deprecation: {
19
- message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl",
20
- },
21
- },
6
+ export const cliOverridesPlugin = definePlugin((sdk) => {
7
+ const meta = {};
8
+ if (sdk.context.meta.fetch) {
9
+ meta.fetch = {
10
+ ...sdk.context.meta.fetch,
11
+ categories: [
12
+ ...(sdk.context.meta.fetch.categories || []),
13
+ "deprecated",
14
+ ],
15
+ deprecation: {
16
+ message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl",
22
17
  },
23
- },
24
- };
25
- };
18
+ };
19
+ }
20
+ return { context: { meta } };
21
+ });