@zapier/zapier-sdk-cli 0.16.1 → 0.16.3

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 +18 -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,9 +0,0 @@
1
- // Import shared OAuth constants from login package
2
- export {
3
- ZAPIER_AUTH_CLIENT_ID,
4
- AUTH_MODE_HEADER,
5
- } from "@zapier/zapier-sdk-cli-login";
6
-
7
- // CLI-specific constants
8
- export const LOGIN_PORTS = [49505, 50575, 52804, 55981, 61010, 63851];
9
- export const LOGIN_TIMEOUT_MS = 300000; // 5 minutes
@@ -1,23 +0,0 @@
1
- import { access } from "fs/promises";
2
- import { join } from "path";
3
-
4
- /**
5
- * Detect the best default directory for TypeScript types
6
- * Looks for src or lib directories, falls back to current directory
7
- */
8
- export async function detectTypesOutputDirectory(): Promise<string> {
9
- // Check for common source directories in priority order
10
- const candidates = ["src", "lib"];
11
-
12
- for (const candidate of candidates) {
13
- try {
14
- await access(candidate);
15
- return join(candidate, "zapier", "apps");
16
- } catch {
17
- // Directory doesn't exist, continue to next candidate
18
- }
19
- }
20
-
21
- // Fall back to current directory
22
- return "./zapier/apps/";
23
- }
@@ -1,26 +0,0 @@
1
- import { ZapierError } from "@zapier/zapier-sdk";
2
-
3
- export abstract class ZapierCliError extends ZapierError {
4
- public abstract readonly exitCode: number;
5
- }
6
-
7
- export class ZapierCliUserCancellationError extends ZapierCliError {
8
- public readonly name = "ZapierCliUserCancellationError";
9
- public readonly code = "ZAPIER_CLI_USER_CANCELLATION";
10
- public readonly exitCode = 0;
11
-
12
- constructor(message: string = "Operation cancelled by user") {
13
- super(message);
14
- }
15
- }
16
-
17
- export class ZapierCliExitError extends ZapierCliError {
18
- public readonly name = "ZapierCliExitError";
19
- public readonly code = "ZAPIER_CLI_EXIT";
20
- public readonly exitCode: number;
21
-
22
- constructor(message: string, exitCode: number = 1) {
23
- super(message);
24
- this.exitCode = exitCode;
25
- }
26
- }
@@ -1,21 +0,0 @@
1
- const getCallablePromise = <T>(): {
2
- promise: Promise<T>;
3
- resolve: (value: T) => void;
4
- reject: (reason: unknown) => void;
5
- } => {
6
- let resolve: (value: T) => void = () => {};
7
- let reject: (reason: unknown) => void = () => {};
8
-
9
- const promise = new Promise<T>((_resolve, _reject) => {
10
- resolve = _resolve;
11
- reject = _reject;
12
- });
13
-
14
- return {
15
- promise,
16
- resolve,
17
- reject,
18
- };
19
- };
20
-
21
- export default getCallablePromise;
package/src/utils/log.ts DELETED
@@ -1,23 +0,0 @@
1
- import chalk from "chalk";
2
-
3
- const log = {
4
- info: (message: string, ...args: unknown[]) => {
5
- console.log(chalk.blue("ℹ"), message, ...args);
6
- },
7
- error: (message: string, ...args: unknown[]) => {
8
- console.error(chalk.red("✖"), message, ...args);
9
- },
10
- success: (message: string, ...args: unknown[]) => {
11
- console.log(chalk.green("✓"), message, ...args);
12
- },
13
- warn: (message: string, ...args: unknown[]) => {
14
- console.log(chalk.yellow("⚠"), message, ...args);
15
- },
16
- debug: (message: string, ...args: unknown[]) => {
17
- if (process.env.DEBUG === "true" || process.argv.includes("--debug")) {
18
- console.log(chalk.gray("🐛"), message, ...args);
19
- }
20
- },
21
- };
22
-
23
- export default log;
@@ -1,25 +0,0 @@
1
- import type { AppItem, ManifestEntry } from "@zapier/zapier-sdk";
2
-
3
- /**
4
- * Get the preferred key for a manifest entry
5
- * Prefers slug over implementation name
6
- */
7
- export function getManifestKey(app: AppItem): string {
8
- return app.slug || app.key;
9
- }
10
-
11
- /**
12
- * Create a manifest entry from an app
13
- */
14
- export function createManifestEntry(app: AppItem): ManifestEntry {
15
- if (!app.version) {
16
- throw new Error(
17
- `App ${app.key} does not have a version. Implementation ID: ${app.implementation_id}`,
18
- );
19
- }
20
-
21
- return {
22
- implementationName: app.key,
23
- version: app.version,
24
- };
25
- }
@@ -1,83 +0,0 @@
1
- import { existsSync } from "fs";
2
- import { join } from "path";
3
- import isInstalledGlobally from "is-installed-globally";
4
-
5
- export interface PackageManagerInfo {
6
- name: "npm" | "yarn" | "pnpm" | "bun" | "unknown";
7
- source: "runtime" | "lockfile" | "fallback";
8
- }
9
-
10
- /**
11
- * Detect which package manager is being used or configured for this project.
12
- *
13
- * Returns an object like:
14
- * { name: 'npm' | 'yarn' | 'pnpm' | 'bun' | 'unknown', source: 'runtime' | 'lockfile' | 'fallback' }
15
- */
16
- export function detectPackageManager(cwd = process.cwd()): PackageManagerInfo {
17
- // --- 1. Runtime detection (based on env)
18
- const ua = process.env.npm_config_user_agent;
19
- if (ua) {
20
- if (ua.includes("yarn")) return { name: "yarn", source: "runtime" };
21
- if (ua.includes("pnpm")) return { name: "pnpm", source: "runtime" };
22
- if (ua.includes("bun")) return { name: "bun", source: "runtime" };
23
- if (ua.includes("npm")) return { name: "npm", source: "runtime" };
24
- }
25
-
26
- // --- 2. Lockfile detection (based on files in cwd)
27
- const files: Array<[string, PackageManagerInfo["name"]]> = [
28
- ["pnpm-lock.yaml", "pnpm"],
29
- ["yarn.lock", "yarn"],
30
- ["bun.lockb", "bun"],
31
- ["package-lock.json", "npm"],
32
- ];
33
-
34
- for (const [file, name] of files) {
35
- if (existsSync(join(cwd, file))) {
36
- return { name, source: "lockfile" };
37
- }
38
- }
39
-
40
- // --- 3. Fallback
41
- return { name: "unknown", source: "fallback" };
42
- }
43
-
44
- /**
45
- * Get the appropriate update command for the detected package manager.
46
- * Returns global update commands if globally installed, local commands if locally installed.
47
- */
48
- export function getUpdateCommand(packageName: string): string {
49
- const pm = detectPackageManager();
50
- const isGlobal = isInstalledGlobally;
51
-
52
- if (isGlobal) {
53
- // Global update commands
54
- switch (pm.name) {
55
- case "yarn":
56
- return `yarn global upgrade ${packageName}@latest`;
57
- case "pnpm":
58
- return `pnpm update -g ${packageName}@latest`;
59
- case "bun":
60
- return `bun update -g ${packageName}@latest`;
61
- case "npm":
62
- return `npm update -g ${packageName}@latest`;
63
- case "unknown":
64
- // Default to npm since it's most widely supported
65
- return `npm update -g ${packageName}@latest`;
66
- }
67
- } else {
68
- // Local update commands
69
- switch (pm.name) {
70
- case "yarn":
71
- return `yarn upgrade ${packageName}@latest`;
72
- case "pnpm":
73
- return `pnpm update ${packageName}@latest`;
74
- case "bun":
75
- return `bun update ${packageName}@latest`;
76
- case "npm":
77
- return `npm update ${packageName}@latest`;
78
- case "unknown":
79
- // Default to npm since it's most widely supported
80
- return `npm update ${packageName}@latest`;
81
- }
82
- }
83
- }