@zapier/zapier-sdk-cli 0.13.5 → 0.13.7
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 +21 -0
- package/README.md +39 -0
- package/dist/cli.cjs +360 -82
- package/dist/cli.mjs +356 -78
- package/dist/index.cjs +359 -81
- package/dist/index.d.mts +155 -3
- package/dist/index.d.ts +155 -3
- package/dist/index.mjs +355 -77
- package/dist/package.json +1 -1
- package/dist/src/plugins/add/index.d.ts +4 -2
- package/dist/src/plugins/add/index.js +89 -98
- package/dist/src/plugins/buildManifest/index.d.ts +13 -0
- package/dist/src/plugins/buildManifest/index.js +81 -0
- package/dist/src/plugins/buildManifest/schemas.d.ts +56 -0
- package/dist/src/plugins/buildManifest/schemas.js +17 -0
- package/dist/src/plugins/generateAppTypes/index.d.ts +13 -0
- package/dist/src/plugins/generateAppTypes/index.js +169 -0
- package/dist/src/plugins/generateAppTypes/schemas.d.ts +72 -0
- package/dist/src/plugins/generateAppTypes/schemas.js +21 -0
- package/dist/src/plugins/index.d.ts +2 -0
- package/dist/src/plugins/index.js +2 -0
- package/dist/src/sdk.d.ts +4 -3
- package/dist/src/sdk.js +16 -14
- package/dist/src/types/sdk.d.ts +5 -0
- package/dist/src/types/sdk.js +1 -0
- package/dist/src/utils/constants.d.ts +1 -3
- package/dist/src/utils/constants.js +3 -4
- package/dist/src/utils/directory-detection.d.ts +5 -0
- package/dist/src/utils/directory-detection.js +21 -0
- package/dist/src/utils/manifest-helpers.d.ts +10 -0
- package/dist/src/utils/manifest-helpers.js +19 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/plugins/add/index.ts +123 -125
- package/src/plugins/buildManifest/index.test.ts +612 -0
- package/src/plugins/buildManifest/index.ts +128 -0
- package/src/plugins/buildManifest/schemas.ts +59 -0
- package/src/plugins/generateAppTypes/index.ts +235 -0
- package/src/plugins/generateAppTypes/schemas.ts +65 -0
- package/src/plugins/index.ts +2 -0
- package/src/sdk.ts +25 -21
- package/src/types/sdk.ts +8 -0
- package/src/utils/constants.ts +7 -6
- package/src/utils/directory-detection.ts +23 -0
- package/src/utils/manifest-helpers.ts +25 -0
- /package/dist/src/{plugins/add → generators}/ast-generator.d.ts +0 -0
- /package/dist/src/{plugins/add → generators}/ast-generator.js +0 -0
- /package/src/{plugins/add → generators}/ast-generator.ts +0 -0
package/dist/src/sdk.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
1
|
+
import { type ZapierSdkOptions } from "@zapier/zapier-sdk";
|
|
2
|
+
import type { ZapierSdkCli } from "./types/sdk";
|
|
3
|
+
export interface ZapierCliSdkOptions extends ZapierSdkOptions {
|
|
3
4
|
debug?: boolean;
|
|
4
5
|
eventEmission?: {
|
|
5
6
|
enabled?: boolean;
|
|
@@ -14,4 +15,4 @@ export interface ZapierCliSdkOptions {
|
|
|
14
15
|
* Create a Zapier SDK instance configured specifically for the CLI
|
|
15
16
|
* Includes all CLI-specific plugins in addition to the standard SDK functionality
|
|
16
17
|
*/
|
|
17
|
-
export declare function createZapierCliSdk(options?: ZapierCliSdkOptions):
|
|
18
|
+
export declare function createZapierCliSdk(options?: ZapierCliSdkOptions): ZapierSdkCli;
|
package/dist/src/sdk.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { createZapierSdkWithoutRegistry, registryPlugin, } from "@zapier/zapier-sdk";
|
|
2
|
-
import { loginPlugin, logoutPlugin, mcpPlugin, bundleCodePlugin, getLoginConfigPathPlugin, addPlugin, } from "./plugins/index";
|
|
2
|
+
import { loginPlugin, logoutPlugin, mcpPlugin, bundleCodePlugin, getLoginConfigPathPlugin, addPlugin, generateAppTypesPlugin, buildManifestPlugin, } from "./plugins/index";
|
|
3
3
|
/**
|
|
4
4
|
* Create a Zapier SDK instance configured specifically for the CLI
|
|
5
5
|
* Includes all CLI-specific plugins in addition to the standard SDK functionality
|
|
6
6
|
*/
|
|
7
7
|
export function createZapierCliSdk(options = {}) {
|
|
8
|
-
// Create SDK instance
|
|
9
|
-
|
|
8
|
+
// Create SDK instance and chain all plugins
|
|
9
|
+
// Chaining prevents type widening that occurs with let reassignment
|
|
10
|
+
return (createZapierSdkWithoutRegistry({
|
|
10
11
|
debug: options.debug,
|
|
11
12
|
eventEmission: options.eventEmission,
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
})
|
|
14
|
+
// Add CLI-specific plugins before registry
|
|
15
|
+
.addPlugin(generateAppTypesPlugin)
|
|
16
|
+
.addPlugin(buildManifestPlugin)
|
|
17
|
+
.addPlugin(bundleCodePlugin)
|
|
18
|
+
.addPlugin(getLoginConfigPathPlugin)
|
|
19
|
+
.addPlugin(addPlugin)
|
|
20
|
+
.addPlugin(mcpPlugin)
|
|
21
|
+
.addPlugin(loginPlugin)
|
|
22
|
+
.addPlugin(logoutPlugin)
|
|
23
|
+
// Add registry plugin to finalize SDK
|
|
24
|
+
.addPlugin(registryPlugin));
|
|
23
25
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { GetSdkType, ZapierSdk } from "@zapier/zapier-sdk";
|
|
2
|
+
import type { BuildManifestPluginProvides } from "../plugins/buildManifest";
|
|
3
|
+
import type { GenerateAppTypesPluginProvides } from "../plugins/generateAppTypes";
|
|
4
|
+
export interface ZapierSdkCli extends GetSdkType<ZapierSdk & BuildManifestPluginProvides & GenerateAppTypesPluginProvides> {
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const LOGIN_CLIENT_ID = "K5eEnRE9TTmSFATdkkWhKF8NOKwoiOnYAyIqJjae";
|
|
1
|
+
export { ZAPIER_BASE, LOGIN_CLIENT_ID, AUTH_MODE_HEADER, } from "@zapier/zapier-sdk-cli-login";
|
|
3
2
|
export declare const LOGIN_PORTS: number[];
|
|
4
3
|
export declare const LOGIN_TIMEOUT_MS = 300000;
|
|
5
|
-
export declare const AUTH_MODE_HEADER = "X-Auth";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// Import shared OAuth constants from login package
|
|
2
|
+
export { ZAPIER_BASE, LOGIN_CLIENT_ID, AUTH_MODE_HEADER, } from "@zapier/zapier-sdk-cli-login";
|
|
3
|
+
// CLI-specific constants
|
|
4
4
|
export const LOGIN_PORTS = [49505, 50575, 52804, 55981, 61010, 63851];
|
|
5
5
|
export const LOGIN_TIMEOUT_MS = 300000; // 5 minutes
|
|
6
|
-
export const AUTH_MODE_HEADER = "X-Auth";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { access } from "fs/promises";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
/**
|
|
4
|
+
* Detect the best default directory for TypeScript types
|
|
5
|
+
* Looks for src or lib directories, falls back to current directory
|
|
6
|
+
*/
|
|
7
|
+
export async function detectTypesOutputDirectory() {
|
|
8
|
+
// Check for common source directories in priority order
|
|
9
|
+
const candidates = ["src", "lib"];
|
|
10
|
+
for (const candidate of candidates) {
|
|
11
|
+
try {
|
|
12
|
+
await access(candidate);
|
|
13
|
+
return join(candidate, "zapier", "apps");
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// Directory doesn't exist, continue to next candidate
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Fall back to current directory
|
|
20
|
+
return "./zapier/apps/";
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AppItem, ManifestEntry } from "@zapier/zapier-sdk";
|
|
2
|
+
/**
|
|
3
|
+
* Get the preferred key for a manifest entry
|
|
4
|
+
* Prefers slug over implementation name
|
|
5
|
+
*/
|
|
6
|
+
export declare function getManifestKey(app: AppItem): string;
|
|
7
|
+
/**
|
|
8
|
+
* Create a manifest entry from an app
|
|
9
|
+
*/
|
|
10
|
+
export declare function createManifestEntry(app: AppItem): ManifestEntry;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the preferred key for a manifest entry
|
|
3
|
+
* Prefers slug over implementation name
|
|
4
|
+
*/
|
|
5
|
+
export function getManifestKey(app) {
|
|
6
|
+
return app.slug || app.key;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Create a manifest entry from an app
|
|
10
|
+
*/
|
|
11
|
+
export function createManifestEntry(app) {
|
|
12
|
+
if (!app.version) {
|
|
13
|
+
throw new Error(`App ${app.key} does not have a version. Implementation ID: ${app.implementation_id}`);
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
implementationName: app.key,
|
|
17
|
+
version: app.version,
|
|
18
|
+
};
|
|
19
|
+
}
|