@zapier/zapier-sdk-cli 0.16.1 → 0.16.4

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 (60) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/cli.cjs +7 -7
  3. package/dist/cli.mjs +7 -7
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.mjs +1 -1
  6. package/dist/package.json +8 -2
  7. package/dist/src/cli.js +2 -1
  8. package/dist/src/utils/cli-generator.js +8 -7
  9. package/dist/tsconfig.tsbuildinfo +1 -1
  10. package/package.json +11 -5
  11. package/src/cli.test.ts +0 -28
  12. package/src/cli.ts +0 -96
  13. package/src/generators/ast-generator.test.ts +0 -908
  14. package/src/generators/ast-generator.ts +0 -774
  15. package/src/index.ts +0 -12
  16. package/src/plugins/add/index.test.ts +0 -58
  17. package/src/plugins/add/index.ts +0 -177
  18. package/src/plugins/add/schemas.ts +0 -35
  19. package/src/plugins/buildManifest/index.test.ts +0 -679
  20. package/src/plugins/buildManifest/index.ts +0 -131
  21. package/src/plugins/buildManifest/schemas.ts +0 -55
  22. package/src/plugins/bundleCode/index.ts +0 -128
  23. package/src/plugins/bundleCode/schemas.ts +0 -24
  24. package/src/plugins/generateAppTypes/index.test.ts +0 -679
  25. package/src/plugins/generateAppTypes/index.ts +0 -227
  26. package/src/plugins/generateAppTypes/schemas.ts +0 -61
  27. package/src/plugins/getLoginConfigPath/index.ts +0 -45
  28. package/src/plugins/getLoginConfigPath/schemas.ts +0 -10
  29. package/src/plugins/index.ts +0 -8
  30. package/src/plugins/login/index.ts +0 -135
  31. package/src/plugins/login/schemas.ts +0 -13
  32. package/src/plugins/logout/index.ts +0 -37
  33. package/src/plugins/logout/schemas.ts +0 -8
  34. package/src/plugins/mcp/index.ts +0 -43
  35. package/src/plugins/mcp/schemas.ts +0 -13
  36. package/src/sdk.ts +0 -45
  37. package/src/telemetry/builders.ts +0 -113
  38. package/src/telemetry/events.ts +0 -39
  39. package/src/types/sdk.ts +0 -8
  40. package/src/utils/api/client.ts +0 -44
  41. package/src/utils/auth/login.ts +0 -214
  42. package/src/utils/cli-generator-utils.ts +0 -169
  43. package/src/utils/cli-generator.test.ts +0 -347
  44. package/src/utils/cli-generator.ts +0 -807
  45. package/src/utils/constants.ts +0 -9
  46. package/src/utils/directory-detection.ts +0 -23
  47. package/src/utils/errors.ts +0 -26
  48. package/src/utils/getCallablePromise.ts +0 -21
  49. package/src/utils/log.ts +0 -23
  50. package/src/utils/manifest-helpers.ts +0 -25
  51. package/src/utils/package-manager-detector.ts +0 -83
  52. package/src/utils/parameter-resolver.ts +0 -1075
  53. package/src/utils/schema-formatter.ts +0 -153
  54. package/src/utils/serializeAsync.ts +0 -26
  55. package/src/utils/spinner.ts +0 -23
  56. package/src/utils/version-checker.test.ts +0 -239
  57. package/src/utils/version-checker.ts +0 -237
  58. package/tsconfig.build.json +0 -18
  59. package/tsconfig.json +0 -19
  60. package/tsup.config.ts +0 -23
@@ -1,227 +0,0 @@
1
- import type {
2
- Plugin,
3
- GetSdkType,
4
- ListActionsPluginProvides,
5
- ListAppsPluginProvides,
6
- ListInputFieldsPluginProvides,
7
- ListAuthenticationsPluginProvides,
8
- ManifestPluginProvides,
9
- AppItem,
10
- } from "@zapier/zapier-sdk";
11
- import {
12
- createFunction,
13
- ZapierValidationError,
14
- ZapierUnknownError,
15
- } from "@zapier/zapier-sdk";
16
- import {
17
- GenerateAppTypesSchema,
18
- type GenerateAppTypesOptions,
19
- type GenerateAppTypesResult,
20
- } from "./schemas";
21
- import { AstTypeGenerator } from "../../generators/ast-generator";
22
- import { getManifestKey } from "../../utils/manifest-helpers";
23
- import { mkdir, writeFile } from "fs/promises";
24
- import { join, resolve } from "path";
25
- import { detectTypesOutputDirectory } from "../../utils/directory-detection";
26
-
27
- export interface GenerateAppTypesPluginProvides {
28
- generateAppTypes: (
29
- options: GenerateAppTypesOptions,
30
- ) => Promise<GenerateAppTypesResult>;
31
- context: {
32
- meta: {
33
- generateAppTypes: {
34
- inputSchema: typeof GenerateAppTypesSchema;
35
- };
36
- };
37
- };
38
- }
39
-
40
- export const generateAppTypesPlugin: Plugin<
41
- GetSdkType<
42
- ListAppsPluginProvides &
43
- ListActionsPluginProvides &
44
- ListInputFieldsPluginProvides &
45
- ListAuthenticationsPluginProvides &
46
- ManifestPluginProvides
47
- >,
48
- {},
49
- GenerateAppTypesPluginProvides
50
- > = ({ sdk }) => {
51
- const generateAppTypes = createFunction(async function generateAppTypes(
52
- options: GenerateAppTypesOptions,
53
- ): Promise<GenerateAppTypesResult> {
54
- const {
55
- appKeys,
56
- authenticationIds,
57
- skipWrite = false,
58
- typesOutputDirectory = await detectTypesOutputDirectory(),
59
- onProgress,
60
- } = options;
61
-
62
- const resolvedTypesOutput = resolve(typesOutputDirectory);
63
-
64
- const result: GenerateAppTypesResult = {
65
- typeDefinitions: {},
66
- };
67
-
68
- // Get apps using listApps (which respects existing manifest for version locking)
69
- onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
70
- const appsIterator = sdk.listApps({ appKeys }).items();
71
- const apps: AppItem[] = [];
72
- for await (const app of appsIterator) {
73
- apps.push(app);
74
- onProgress?.({ type: "app_found", app });
75
- }
76
- onProgress?.({ type: "apps_lookup_complete", count: apps.length });
77
-
78
- if (apps.length === 0) {
79
- return result;
80
- }
81
-
82
- // Fetch authentications if provided
83
- const authentications = [];
84
- if (authenticationIds && authenticationIds.length > 0) {
85
- onProgress?.({
86
- type: "authentications_lookup_start",
87
- count: authenticationIds.length,
88
- });
89
- const authsIterator = sdk
90
- .listAuthentications({ authenticationIds })
91
- .items();
92
- for await (const auth of authsIterator) {
93
- authentications.push(auth);
94
- }
95
- onProgress?.({
96
- type: "authentications_lookup_complete",
97
- count: authentications.length,
98
- });
99
- }
100
-
101
- // Ensure output directory exists if we're writing files
102
- if (!skipWrite && resolvedTypesOutput) {
103
- await mkdir(resolvedTypesOutput, { recursive: true });
104
- }
105
-
106
- // Initialize writtenFiles if we're writing to disk
107
- if (!skipWrite) {
108
- result.writtenFiles = {};
109
- }
110
-
111
- // Process each app
112
- for (const app of apps) {
113
- onProgress?.({
114
- type: "app_processing_start",
115
- appKey: app.key,
116
- slug: app.slug,
117
- });
118
-
119
- try {
120
- if (!app.version) {
121
- const errorMessage = `Invalid implementation ID format: ${app.implementation_id}. Expected format: <implementationName>@<version>`;
122
- onProgress?.({
123
- type: "app_processing_error",
124
- appKey: app.key,
125
- error: errorMessage,
126
- });
127
- throw new ZapierValidationError(errorMessage, {
128
- details: {
129
- appKey: app.key,
130
- implementationId: app.implementation_id,
131
- },
132
- });
133
- }
134
-
135
- // Find matching authentication for this app if authentications were provided
136
- let authenticationId: number | undefined;
137
- if (authentications.length > 0) {
138
- const matchingAuth = authentications.find((auth) => {
139
- return auth.app_key === app.key;
140
- });
141
-
142
- if (matchingAuth) {
143
- authenticationId = matchingAuth.id;
144
- onProgress?.({
145
- type: "authentication_matched",
146
- appKey: app.key,
147
- authenticationId: matchingAuth.id,
148
- authenticationTitle: matchingAuth.title || "",
149
- });
150
- } else {
151
- onProgress?.({
152
- type: "authentication_not_matched",
153
- appKey: app.key,
154
- });
155
- }
156
- }
157
-
158
- const manifestKey = getManifestKey(app);
159
-
160
- // Generate type definitions
161
- const generator = new AstTypeGenerator();
162
- const typeDefinitionString = await generator.generateTypes({
163
- app,
164
- authenticationId,
165
- sdk,
166
- });
167
-
168
- result.typeDefinitions[manifestKey] = typeDefinitionString;
169
-
170
- onProgress?.({
171
- type: "type_generated",
172
- manifestKey,
173
- sizeBytes: typeDefinitionString.length,
174
- });
175
-
176
- // Write to file if skipWrite is false
177
- if (!skipWrite && resolvedTypesOutput && result.writtenFiles) {
178
- const filePath = join(resolvedTypesOutput, `${manifestKey}.d.ts`);
179
- await writeFile(filePath, typeDefinitionString, "utf8");
180
-
181
- result.writtenFiles[manifestKey] = filePath;
182
-
183
- onProgress?.({
184
- type: "file_written",
185
- manifestKey,
186
- filePath,
187
- });
188
- }
189
-
190
- onProgress?.({
191
- type: "app_processing_complete",
192
- appKey: app.key,
193
- });
194
- } catch (error) {
195
- const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
196
-
197
- onProgress?.({
198
- type: "app_processing_error",
199
- appKey: app.key,
200
- error: errorMessage,
201
- });
202
-
203
- if (error instanceof ZapierValidationError) {
204
- throw error; // Preserve the specific error type
205
- } else {
206
- throw new ZapierUnknownError(errorMessage, {
207
- cause: error, // Works for both Error and non-Error
208
- });
209
- }
210
- }
211
- }
212
-
213
- return result;
214
- }, GenerateAppTypesSchema);
215
-
216
- return {
217
- generateAppTypes,
218
- context: {
219
- meta: {
220
- generateAppTypes: {
221
- categories: ["utility"],
222
- inputSchema: GenerateAppTypesSchema,
223
- },
224
- },
225
- },
226
- };
227
- };
@@ -1,61 +0,0 @@
1
- import { z } from "zod";
2
- import type { AppItem } from "@zapier/zapier-sdk";
3
-
4
- export const GenerateAppTypesSchema = z
5
- .object({
6
- appKeys: z
7
- .array(z.string().min(1, "App key cannot be empty"))
8
- .min(1, "At least one app key is required")
9
- .describe(
10
- "One or more app keys to generate types for (e.g., 'slack', 'github', 'trello')",
11
- ),
12
- authenticationIds: z
13
- .array(z.string())
14
- .optional()
15
- .describe(
16
- "Authentication IDs to use for type generation (e.g., ['123', '456'])",
17
- ),
18
- skipWrite: z
19
- .boolean()
20
- .optional()
21
- .describe(
22
- "If true, returns type definitions without writing to disk. If false or omitted, writes type files.",
23
- ),
24
- typesOutputDirectory: z
25
- .string()
26
- .optional()
27
- .describe(
28
- "Directory for TypeScript type files. Required when skipWrite is false or omitted.",
29
- ),
30
- })
31
- .describe(
32
- "Generate TypeScript type definitions for apps - can optionally write to disk or just return type strings",
33
- );
34
-
35
- export type GenerateAppTypesOptions = z.infer<typeof GenerateAppTypesSchema> & {
36
- onProgress?: (event: AppTypesProgressEvent) => void;
37
- };
38
-
39
- export type AppTypesProgressEvent =
40
- | { type: "apps_lookup_start"; count: number }
41
- | { type: "app_found"; app: AppItem }
42
- | { type: "apps_lookup_complete"; count: number }
43
- | { type: "authentications_lookup_start"; count: number }
44
- | { type: "authentications_lookup_complete"; count: number }
45
- | { type: "app_processing_start"; appKey: string; slug?: string }
46
- | {
47
- type: "authentication_matched";
48
- appKey: string;
49
- authenticationId: number;
50
- authenticationTitle: string;
51
- }
52
- | { type: "authentication_not_matched"; appKey: string }
53
- | { type: "type_generated"; manifestKey: string; sizeBytes: number }
54
- | { type: "file_written"; manifestKey: string; filePath: string }
55
- | { type: "app_processing_complete"; appKey: string }
56
- | { type: "app_processing_error"; appKey: string; error: string };
57
-
58
- export interface GenerateAppTypesResult {
59
- typeDefinitions: Record<string, string>; // manifestKey -> type definition string
60
- writtenFiles?: Record<string, string>; // manifestKey -> file path (only when skipWrite is false)
61
- }
@@ -1,45 +0,0 @@
1
- import type { Plugin } from "@zapier/zapier-sdk";
2
- import {
3
- GetLoginConfigPathSchema,
4
- type GetLoginConfigPathOptions,
5
- } from "./schemas";
6
- import { createFunction } from "@zapier/zapier-sdk";
7
- import { getConfigPath } from "@zapier/zapier-sdk-cli-login";
8
-
9
- export interface GetLoginConfigPathPluginProvides {
10
- getLoginConfigPath: (options?: GetLoginConfigPathOptions) => Promise<string>;
11
- context: {
12
- meta: {
13
- getLoginConfigPath: {
14
- inputSchema: typeof GetLoginConfigPathSchema;
15
- };
16
- };
17
- };
18
- }
19
-
20
- export const getLoginConfigPathPlugin: Plugin<
21
- {}, // requires no existing SDK methods
22
- {}, // requires no context
23
- GetLoginConfigPathPluginProvides
24
- > = () => {
25
- const getLoginConfigPathWithSdk = createFunction(
26
- async function getLoginConfigPathWithSdk(
27
- _options?: GetLoginConfigPathOptions,
28
- ): Promise<string> {
29
- return getConfigPath();
30
- },
31
- GetLoginConfigPathSchema,
32
- );
33
-
34
- return {
35
- getLoginConfigPath: getLoginConfigPathWithSdk,
36
- context: {
37
- meta: {
38
- getLoginConfigPath: {
39
- categories: ["utility"],
40
- inputSchema: GetLoginConfigPathSchema,
41
- },
42
- },
43
- },
44
- };
45
- };
@@ -1,10 +0,0 @@
1
- import { z } from "zod";
2
-
3
- // Get login config path schema - simple command with no parameters
4
- export const GetLoginConfigPathSchema = z
5
- .object({})
6
- .describe("Show the path to the login configuration file");
7
-
8
- export type GetLoginConfigPathOptions = z.infer<
9
- typeof GetLoginConfigPathSchema
10
- >;
@@ -1,8 +0,0 @@
1
- export { loginPlugin } from "./login";
2
- export { logoutPlugin } from "./logout";
3
- export { mcpPlugin } from "./mcp";
4
- export { bundleCodePlugin } from "./bundleCode";
5
- export { getLoginConfigPathPlugin } from "./getLoginConfigPath";
6
- export { addPlugin } from "./add";
7
- export { generateAppTypesPlugin } from "./generateAppTypes";
8
- export { buildManifestPlugin } from "./buildManifest";
@@ -1,135 +0,0 @@
1
- import { createFunction } from "@zapier/zapier-sdk";
2
- import type { Plugin } from "@zapier/zapier-sdk";
3
- import type { EventEmissionContext } from "@zapier/zapier-sdk";
4
- import login from "../../utils/auth/login";
5
- import { getLoggedInUser } from "@zapier/zapier-sdk-cli-login";
6
- import { LoginSchema, type LoginOptions } from "./schemas";
7
- import { buildCliCommandExecutedEvent } from "../../telemetry/builders";
8
- import cliPackageJson from "../../../package.json";
9
-
10
- interface CliContext {
11
- session_id?: string | null;
12
- selected_api?: string | null;
13
- app_id?: number | null;
14
- app_version_id?: number | null;
15
- }
16
-
17
- interface LoginPluginProvides {
18
- login: (options: LoginOptions) => Promise<void>;
19
- context: {
20
- meta: {
21
- login: {
22
- inputSchema: typeof LoginSchema;
23
- categories: string[];
24
- };
25
- };
26
- };
27
- }
28
-
29
- const CLI_COMMAND_EXECUTED_EVENT_SUBJECT =
30
- "platform.sdk.CliCommandExecutedEvent";
31
-
32
- // Internal type for loginWithSdk that includes SDK URL options
33
- interface LoginWithSdkOptions extends LoginOptions {
34
- baseUrl?: string;
35
- authBaseUrl?: string;
36
- authClientId?: string;
37
- }
38
-
39
- const loginWithSdk = createFunction(
40
- async (options: LoginWithSdkOptions): Promise<void> => {
41
- const timeoutSeconds = options.timeout
42
- ? parseInt(options.timeout, 10)
43
- : 300;
44
- if (isNaN(timeoutSeconds) || timeoutSeconds <= 0) {
45
- throw new Error("Timeout must be a positive number");
46
- }
47
-
48
- await login({
49
- timeoutMs: timeoutSeconds * 1000,
50
- baseUrl: options.baseUrl,
51
- authBaseUrl: options.authBaseUrl,
52
- authClientId: options.authClientId,
53
- });
54
- const user = await getLoggedInUser();
55
-
56
- console.log(`✅ Successfully logged in as ${user.email}`);
57
- },
58
- );
59
-
60
- export const loginPlugin: Plugin<
61
- {},
62
- EventEmissionContext & CliContext,
63
- LoginPluginProvides
64
- > = ({ context }) => {
65
- // Wrap the login function to emit telemetry events
66
- const loginWithTelemetry = async (options: LoginOptions): Promise<void> => {
67
- const startTime = Date.now();
68
- let success = false;
69
- let errorMessage: string | null = null;
70
- let accountId: number | null = null;
71
- let customUserId: number | null = null;
72
-
73
- try {
74
- await loginWithSdk({
75
- ...options,
76
- baseUrl: context.options?.baseUrl,
77
- authBaseUrl: context.options?.authBaseUrl,
78
- authClientId: context.options?.authClientId,
79
- });
80
- success = true;
81
-
82
- // Extract user IDs after successful login
83
- try {
84
- ({ accountId, customUserId } = await getLoggedInUser());
85
- } catch {
86
- // If we can't get user info, continue without it
87
- }
88
- } catch (error) {
89
- success = false;
90
- errorMessage = error instanceof Error ? error.message : "Login failed";
91
- throw error;
92
- } finally {
93
- // Emit CLI command executed event if event emission is available
94
- const event = buildCliCommandExecutedEvent({
95
- data: {
96
- cli_primary_command: "login",
97
- success_flag: success,
98
- execution_duration_ms: Date.now() - startTime,
99
- exit_code: success ? 0 : 1,
100
- error_message: errorMessage,
101
- command_category: "authentication",
102
- requires_auth: false,
103
- cli_arguments: [
104
- "login",
105
- options.timeout ? `--timeout=${options.timeout}` : null,
106
- ].filter(Boolean) as string[],
107
- },
108
- context: {
109
- session_id: context.session_id,
110
- selected_api: context.selected_api,
111
- app_id: context.app_id,
112
- app_version_id: context.app_version_id,
113
- customuser_id: customUserId,
114
- account_id: accountId,
115
- },
116
- cliVersion: cliPackageJson.version,
117
- });
118
- context.eventEmission.emit(CLI_COMMAND_EXECUTED_EVENT_SUBJECT, event);
119
- }
120
- };
121
-
122
- return {
123
- login: loginWithTelemetry,
124
- context: {
125
- meta: {
126
- login: {
127
- categories: ["account"],
128
- inputSchema: LoginSchema,
129
- },
130
- },
131
- },
132
- };
133
- };
134
-
135
- export type { LoginPluginProvides };
@@ -1,13 +0,0 @@
1
- import { z } from "zod";
2
-
3
- // Login schema
4
- export const LoginSchema = z
5
- .object({
6
- timeout: z
7
- .string()
8
- .optional()
9
- .describe("Login timeout in seconds (default: 300)"),
10
- })
11
- .describe("Log in to Zapier to access your account");
12
-
13
- export type LoginOptions = z.infer<typeof LoginSchema>;
@@ -1,37 +0,0 @@
1
- import { createFunction } from "@zapier/zapier-sdk";
2
- import type { Plugin } from "@zapier/zapier-sdk";
3
- import { logout } from "@zapier/zapier-sdk-cli-login";
4
- import { LogoutSchema, type LogoutOptions } from "./schemas";
5
-
6
- interface LogoutPluginProvides {
7
- logout: (options: LogoutOptions) => Promise<void>;
8
- context: {
9
- meta: {
10
- logout: {
11
- inputSchema: typeof LogoutSchema;
12
- categories: string[];
13
- };
14
- };
15
- };
16
- }
17
-
18
- const logoutWithSdk = createFunction(async function logoutWithSdk(
19
- _options: LogoutOptions,
20
- ): Promise<void> {
21
- logout();
22
- console.log("✅ Successfully logged out");
23
- }, LogoutSchema);
24
-
25
- export const logoutPlugin: Plugin<{}, {}, LogoutPluginProvides> = () => ({
26
- logout: logoutWithSdk,
27
- context: {
28
- meta: {
29
- logout: {
30
- categories: ["account"],
31
- inputSchema: LogoutSchema,
32
- },
33
- },
34
- },
35
- });
36
-
37
- export type { LogoutPluginProvides };
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
-
3
- // Logout schema (no parameters needed)
4
- export const LogoutSchema = z
5
- .object({})
6
- .describe("Log out of your Zapier account");
7
-
8
- export type LogoutOptions = z.infer<typeof LogoutSchema>;
@@ -1,43 +0,0 @@
1
- import { createFunction } from "@zapier/zapier-sdk";
2
- import type { Plugin } from "@zapier/zapier-sdk";
3
- import { startMcpServer } from "@zapier/zapier-sdk-mcp";
4
- import { McpSchema, type McpOptions } from "./schemas";
5
-
6
- interface McpPluginProvides {
7
- mcp: (options: McpOptions) => Promise<void>;
8
- context: {
9
- meta: {
10
- mcp: {
11
- inputSchema: typeof McpSchema;
12
- categories: string[];
13
- };
14
- };
15
- };
16
- }
17
-
18
- export const mcpPlugin: Plugin<{}, {}, McpPluginProvides> = ({ context }) => {
19
- const mcpWithSdk = createFunction(async function mcpWithSdk(
20
- options: McpOptions,
21
- ): Promise<void> {
22
- // Pass through the SDK's debug option to the MCP server
23
- const mcpOptions = {
24
- ...options,
25
- debug: context.options.debug,
26
- };
27
- return await startMcpServer(mcpOptions);
28
- }, McpSchema);
29
-
30
- return {
31
- mcp: mcpWithSdk,
32
- context: {
33
- meta: {
34
- mcp: {
35
- categories: ["utility"],
36
- inputSchema: McpSchema,
37
- },
38
- },
39
- },
40
- };
41
- };
42
-
43
- export type { McpPluginProvides };
@@ -1,13 +0,0 @@
1
- import { z } from "zod";
2
-
3
- // MCP server schema
4
- export const McpSchema = z
5
- .object({
6
- port: z
7
- .string()
8
- .optional()
9
- .describe("Port to listen on (for future HTTP transport)"),
10
- })
11
- .describe("Start MCP server for Zapier SDK");
12
-
13
- export type McpOptions = z.infer<typeof McpSchema>;
package/src/sdk.ts DELETED
@@ -1,45 +0,0 @@
1
- import {
2
- createZapierSdkWithoutRegistry,
3
- registryPlugin,
4
- type ZapierSdkOptions,
5
- } from "@zapier/zapier-sdk";
6
- import {
7
- loginPlugin,
8
- logoutPlugin,
9
- mcpPlugin,
10
- bundleCodePlugin,
11
- getLoginConfigPathPlugin,
12
- addPlugin,
13
- generateAppTypesPlugin,
14
- buildManifestPlugin,
15
- } from "./plugins/index";
16
- import type { ZapierSdkCli } from "./types/sdk";
17
-
18
- export interface ZapierCliSdkOptions extends ZapierSdkOptions {}
19
-
20
- /**
21
- * Create a Zapier SDK instance configured specifically for the CLI
22
- * Includes all CLI-specific plugins in addition to the standard SDK functionality
23
- */
24
- export function createZapierCliSdk(
25
- options: ZapierCliSdkOptions = {},
26
- ): ZapierSdkCli {
27
- // Create SDK instance and chain all plugins
28
- // Chaining prevents type widening that occurs with let reassignment
29
- return (
30
- createZapierSdkWithoutRegistry({
31
- ...options,
32
- })
33
- // Add CLI-specific plugins before registry
34
- .addPlugin(generateAppTypesPlugin)
35
- .addPlugin(buildManifestPlugin)
36
- .addPlugin(bundleCodePlugin)
37
- .addPlugin(getLoginConfigPathPlugin)
38
- .addPlugin(addPlugin)
39
- .addPlugin(mcpPlugin)
40
- .addPlugin(loginPlugin)
41
- .addPlugin(logoutPlugin)
42
- // Add registry plugin to finalize SDK
43
- .addPlugin(registryPlugin)
44
- );
45
- }