@zapier/zapier-sdk-cli 0.43.0 → 0.43.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.
- package/CHANGELOG.md +26 -0
- package/dist/cli.cjs +434 -519
- package/dist/cli.mjs +437 -522
- package/dist/index.cjs +436 -521
- package/dist/index.d.mts +395 -23
- package/dist/index.d.ts +395 -23
- package/dist/index.mjs +440 -525
- package/dist/package.json +2 -1
- package/dist/src/plugins/add/index.d.ts +250 -11
- package/dist/src/plugins/add/index.js +8 -16
- package/dist/src/plugins/buildManifest/index.d.ts +116 -9
- package/dist/src/plugins/buildManifest/index.js +14 -23
- package/dist/src/plugins/bundleCode/index.d.ts +19 -10
- package/dist/src/plugins/bundleCode/index.js +7 -17
- package/dist/src/plugins/cliOverrides/index.d.ts +12 -10
- package/dist/src/plugins/cliOverrides/index.js +16 -20
- package/dist/src/plugins/curl/index.d.ts +69 -10
- package/dist/src/plugins/curl/index.js +3 -2
- package/dist/src/plugins/feedback/index.d.ts +18 -13
- package/dist/src/plugins/feedback/index.js +17 -25
- package/dist/src/plugins/generateAppTypes/index.d.ts +261 -9
- package/dist/src/plugins/generateAppTypes/index.js +17 -45
- package/dist/src/plugins/getLoginConfigPath/index.d.ts +12 -10
- package/dist/src/plugins/getLoginConfigPath/index.js +8 -18
- package/dist/src/plugins/init/index.d.ts +15 -11
- package/dist/src/plugins/init/index.js +9 -17
- package/dist/src/plugins/login/index.d.ts +18 -13
- package/dist/src/plugins/login/index.js +9 -17
- package/dist/src/plugins/logout/index.d.ts +12 -11
- package/dist/src/plugins/logout/index.js +10 -16
- package/dist/src/plugins/mcp/index.d.ts +18 -15
- package/dist/src/plugins/mcp/index.js +9 -21
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
|
@@ -1,17 +1,76 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { type CurlOptions } from "./schemas";
|
|
2
|
+
export declare const curlPlugin: (sdk: {
|
|
3
|
+
fetch: (url: string | URL, init?: import("@zapier/zapier-sdk").ZapierFetchInitOptions) => Promise<Response>;
|
|
4
|
+
} & {
|
|
5
|
+
context: {
|
|
6
|
+
meta: Record<string, import("@zapier/zapier-sdk").PluginMeta>;
|
|
7
|
+
};
|
|
8
|
+
}) => {
|
|
4
9
|
curl: (options: CurlOptions) => Promise<undefined>;
|
|
5
10
|
context: {
|
|
6
11
|
meta: {
|
|
7
12
|
curl: {
|
|
8
|
-
|
|
13
|
+
description: string;
|
|
14
|
+
categories: string[];
|
|
15
|
+
inputSchema: import("zod").ZodObject<{
|
|
16
|
+
url: import("zod").ZodString;
|
|
17
|
+
request: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
18
|
+
POST: "POST";
|
|
19
|
+
GET: "GET";
|
|
20
|
+
PUT: "PUT";
|
|
21
|
+
DELETE: "DELETE";
|
|
22
|
+
PATCH: "PATCH";
|
|
23
|
+
HEAD: "HEAD";
|
|
24
|
+
OPTIONS: "OPTIONS";
|
|
25
|
+
}>>;
|
|
26
|
+
header: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
27
|
+
data: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
28
|
+
dataRaw: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
29
|
+
dataAscii: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
30
|
+
dataBinary: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
31
|
+
dataUrlencode: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
32
|
+
json: import("zod").ZodOptional<import("zod").ZodString>;
|
|
33
|
+
form: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
34
|
+
formString: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
35
|
+
get: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
36
|
+
head: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
37
|
+
location: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
38
|
+
include: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
39
|
+
output: import("zod").ZodOptional<import("zod").ZodString>;
|
|
40
|
+
remoteName: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
41
|
+
verbose: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
42
|
+
silent: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
43
|
+
showError: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
44
|
+
fail: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
45
|
+
failWithBody: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
46
|
+
writeOut: import("zod").ZodOptional<import("zod").ZodString>;
|
|
47
|
+
maxTime: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
48
|
+
user: import("zod").ZodOptional<import("zod").ZodString>;
|
|
49
|
+
compressed: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
50
|
+
connection: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
|
|
51
|
+
connectionId: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
|
|
52
|
+
}, import("zod/v4/core").$strip>;
|
|
53
|
+
aliases: {
|
|
54
|
+
request: string;
|
|
55
|
+
header: string;
|
|
56
|
+
data: string;
|
|
57
|
+
form: string;
|
|
58
|
+
get: string;
|
|
59
|
+
head: string;
|
|
60
|
+
location: string;
|
|
61
|
+
include: string;
|
|
62
|
+
output: string;
|
|
63
|
+
remoteName: string;
|
|
64
|
+
verbose: string;
|
|
65
|
+
silent: string;
|
|
66
|
+
showError: string;
|
|
67
|
+
writeOut: string;
|
|
68
|
+
maxTime: string;
|
|
69
|
+
user: string;
|
|
70
|
+
fail: string;
|
|
71
|
+
};
|
|
9
72
|
};
|
|
10
73
|
};
|
|
11
74
|
};
|
|
12
|
-
}
|
|
13
|
-
type
|
|
14
|
-
fetch: F;
|
|
15
|
-
} : never;
|
|
16
|
-
export declare const curlPlugin: Plugin<SdkWithFetch, CurlPluginProvides>;
|
|
17
|
-
export {};
|
|
75
|
+
};
|
|
76
|
+
export type CurlPluginProvides = ReturnType<typeof curlPlugin>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { definePlugin } from "@zapier/zapier-sdk";
|
|
1
2
|
import { createWriteStream } from "fs";
|
|
2
3
|
import { promises as fs } from "fs";
|
|
3
4
|
import { dirname } from "path";
|
|
4
5
|
import { CurlSchema } from "./schemas";
|
|
5
6
|
import { CurlExitError, parseHeaderLine, basicAuthHeader, deriveRemoteFilename, formatWriteOut, appendQueryParams, readAllStdin, resolveDataArgText, resolveDataArgBinary, buildFormData, } from "./utils";
|
|
6
|
-
export const curlPlugin = (sdk) => {
|
|
7
|
+
export const curlPlugin = definePlugin((sdk) => {
|
|
7
8
|
async function curl(options) {
|
|
8
9
|
const { url: rawUrl, request, header = [], data = [], dataRaw = [], dataAscii = [], dataBinary = [], dataUrlencode = [], json, form = [], formString = [], get: forceGet, head: forceHead, location, include, output, remoteName, verbose, silent, showError, fail, failWithBody, writeOut, maxTime, user, compressed, connection: connectionParam, connectionId, } = options;
|
|
9
10
|
const connection = connectionParam ?? connectionId;
|
|
@@ -232,4 +233,4 @@ export const curlPlugin = (sdk) => {
|
|
|
232
233
|
},
|
|
233
234
|
},
|
|
234
235
|
};
|
|
235
|
-
};
|
|
236
|
+
});
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import { FeedbackSchema, type FeedbackOptions } from "./schemas";
|
|
3
|
-
export interface FeedbackPluginProvides {
|
|
4
|
-
feedback: (options: FeedbackOptions) => Promise<string>;
|
|
1
|
+
export declare const feedbackPlugin: (sdk: {
|
|
5
2
|
context: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
inputSchema: typeof FeedbackSchema;
|
|
9
|
-
};
|
|
3
|
+
options?: {
|
|
4
|
+
debug?: boolean;
|
|
10
5
|
};
|
|
11
6
|
};
|
|
12
|
-
}
|
|
13
|
-
|
|
7
|
+
} & {
|
|
8
|
+
context: import("@zapier/zapier-sdk").EventEmissionContext;
|
|
9
|
+
} & {
|
|
14
10
|
context: {
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
meta: Record<string, import("@zapier/zapier-sdk").PluginMeta>;
|
|
12
|
+
};
|
|
13
|
+
}) => {
|
|
14
|
+
feedback: (options?: {
|
|
15
|
+
feedback: string;
|
|
16
|
+
} | undefined) => Promise<string>;
|
|
17
|
+
} & {
|
|
18
|
+
context: {
|
|
19
|
+
meta: {
|
|
20
|
+
feedback: import("@zapier/zapier-sdk").PluginMeta;
|
|
17
21
|
};
|
|
18
22
|
};
|
|
19
|
-
}
|
|
23
|
+
};
|
|
24
|
+
export type FeedbackPluginProvides = ReturnType<typeof feedbackPlugin>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FeedbackSchema } from "./schemas";
|
|
2
|
-
import {
|
|
2
|
+
import { createPluginMethod, definePlugin, } from "@zapier/zapier-sdk";
|
|
3
3
|
import { getLoggedInUser } from "../../login";
|
|
4
4
|
const feedbackResolver = {
|
|
5
5
|
type: "static",
|
|
@@ -12,9 +12,9 @@ const RETRY_DELAY_MS = 1000;
|
|
|
12
12
|
function getFeedbackWebhookUrl() {
|
|
13
13
|
return (process.env.ZAPIER_FEEDBACK_WEBHOOK_URL || DEFAULT_FEEDBACK_WEBHOOK_URL);
|
|
14
14
|
}
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
15
|
+
// Feedback-specific retry wrapper. A generic fetchWithRetry util would be
|
|
16
|
+
// the better long-term solution but should be a separate MR so it's built
|
|
17
|
+
// with broader use cases in mind.
|
|
18
18
|
async function postWithRetry({ body, attemptsLeft, }) {
|
|
19
19
|
const response = await fetch(getFeedbackWebhookUrl(), {
|
|
20
20
|
method: "POST",
|
|
@@ -27,34 +27,26 @@ async function postWithRetry({ body, attemptsLeft, }) {
|
|
|
27
27
|
}
|
|
28
28
|
return response;
|
|
29
29
|
}
|
|
30
|
-
export const feedbackPlugin = (sdk) => {
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
export const feedbackPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
31
|
+
name: "feedback",
|
|
32
|
+
categories: ["utility"],
|
|
33
|
+
inputSchema: FeedbackSchema,
|
|
34
|
+
resolvers: { feedback: feedbackResolver },
|
|
35
|
+
handler: async ({ sdk, options }) => {
|
|
33
36
|
const user = await getLoggedInUser();
|
|
34
37
|
const body = JSON.stringify({
|
|
35
38
|
email: user.email,
|
|
36
39
|
customuser_id: user.customUserId,
|
|
37
40
|
feedback: options.feedback,
|
|
38
41
|
});
|
|
39
|
-
const response = await postWithRetry({
|
|
40
|
-
|
|
42
|
+
const response = await postWithRetry({
|
|
43
|
+
body,
|
|
44
|
+
attemptsLeft: MAX_RETRIES,
|
|
45
|
+
});
|
|
46
|
+
if (sdk.context.options?.debug) {
|
|
41
47
|
const text = await response.text();
|
|
42
48
|
console.error("[debug] Webhook response:", text);
|
|
43
49
|
}
|
|
44
50
|
return "Thank you for your feedback!";
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
feedback: feedbackWithSdk,
|
|
48
|
-
context: {
|
|
49
|
-
meta: {
|
|
50
|
-
feedback: {
|
|
51
|
-
categories: ["utility"],
|
|
52
|
-
inputSchema: FeedbackSchema,
|
|
53
|
-
resolvers: {
|
|
54
|
-
feedback: feedbackResolver,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
};
|
|
51
|
+
},
|
|
52
|
+
}));
|
|
@@ -1,13 +1,265 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type GenerateAppTypesOptions, type GenerateAppTypesResult } from "./schemas";
|
|
2
|
+
export declare const generateAppTypesPlugin: (sdk: {
|
|
3
|
+
listApps: (options?: ({
|
|
4
|
+
search?: string | undefined;
|
|
5
|
+
apps?: string[] | undefined;
|
|
6
|
+
appKeys?: string[] | undefined;
|
|
7
|
+
pageSize?: number | undefined;
|
|
8
|
+
maxItems?: number | undefined;
|
|
9
|
+
cursor?: string | undefined;
|
|
10
|
+
} & {
|
|
11
|
+
cursor?: string;
|
|
12
|
+
pageSize?: number;
|
|
13
|
+
maxItems?: number;
|
|
14
|
+
}) | undefined) => import("@zapier/zapier-sdk").PaginatedSdkResult<{
|
|
15
|
+
slug: string;
|
|
16
|
+
title: string;
|
|
17
|
+
key: string;
|
|
18
|
+
implementation_id: string;
|
|
19
|
+
description?: string | undefined;
|
|
20
|
+
is_hidden?: boolean | undefined;
|
|
21
|
+
auth_type?: string | undefined;
|
|
22
|
+
actions?: {
|
|
23
|
+
read?: number | undefined;
|
|
24
|
+
read_bulk?: number | undefined;
|
|
25
|
+
write?: number | undefined;
|
|
26
|
+
search?: number | undefined;
|
|
27
|
+
search_or_write?: number | undefined;
|
|
28
|
+
search_and_write?: number | undefined;
|
|
29
|
+
filter?: number | undefined;
|
|
30
|
+
} | undefined;
|
|
31
|
+
is_deprecated?: boolean | undefined;
|
|
32
|
+
is_beta?: boolean | undefined;
|
|
33
|
+
is_premium?: boolean | undefined;
|
|
34
|
+
age_in_days?: number | undefined;
|
|
35
|
+
banner?: string | undefined;
|
|
36
|
+
categories?: {
|
|
37
|
+
id: number;
|
|
38
|
+
name: string;
|
|
39
|
+
slug: string;
|
|
40
|
+
}[] | undefined;
|
|
41
|
+
images?: {
|
|
42
|
+
url_16x16?: string | undefined;
|
|
43
|
+
url_32x32?: string | undefined;
|
|
44
|
+
url_64x64?: string | undefined;
|
|
45
|
+
url_128x128?: string | undefined;
|
|
46
|
+
} | undefined;
|
|
47
|
+
popularity?: number | undefined;
|
|
48
|
+
has_filters?: boolean | undefined;
|
|
49
|
+
has_reads?: boolean | undefined;
|
|
50
|
+
has_searches?: boolean | undefined;
|
|
51
|
+
has_searches_or_writes?: boolean | undefined;
|
|
52
|
+
has_upfront_fields?: boolean | undefined;
|
|
53
|
+
has_writes?: boolean | undefined;
|
|
54
|
+
is_built_in?: boolean | undefined;
|
|
55
|
+
is_featured?: boolean | undefined;
|
|
56
|
+
is_invite?: boolean | undefined;
|
|
57
|
+
is_public?: boolean | undefined;
|
|
58
|
+
is_upcoming?: boolean | undefined;
|
|
59
|
+
visibility?: string | undefined;
|
|
60
|
+
primary_color?: string | undefined;
|
|
61
|
+
secondary_color?: string | undefined;
|
|
62
|
+
classification?: string | undefined;
|
|
63
|
+
api_docs_url?: string | undefined;
|
|
64
|
+
image?: string | undefined;
|
|
65
|
+
version?: string | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
} & {
|
|
5
68
|
context: {
|
|
6
69
|
meta: {
|
|
7
|
-
|
|
8
|
-
inputSchema: typeof GenerateAppTypesSchema;
|
|
9
|
-
};
|
|
70
|
+
listApps: import("@zapier/zapier-sdk").PluginMeta;
|
|
10
71
|
};
|
|
11
72
|
};
|
|
12
|
-
}
|
|
13
|
-
|
|
73
|
+
} & {
|
|
74
|
+
listActions: (options?: (({
|
|
75
|
+
app: string;
|
|
76
|
+
actionType?: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write" | undefined;
|
|
77
|
+
pageSize?: number | undefined;
|
|
78
|
+
maxItems?: number | undefined;
|
|
79
|
+
cursor?: string | undefined;
|
|
80
|
+
} | {
|
|
81
|
+
appKey: string;
|
|
82
|
+
actionType?: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write" | undefined;
|
|
83
|
+
pageSize?: number | undefined;
|
|
84
|
+
maxItems?: number | undefined;
|
|
85
|
+
cursor?: string | undefined;
|
|
86
|
+
}) & {
|
|
87
|
+
cursor?: string;
|
|
88
|
+
pageSize?: number;
|
|
89
|
+
maxItems?: number;
|
|
90
|
+
}) | undefined) => import("@zapier/zapier-sdk").PaginatedSdkResult<{
|
|
91
|
+
description: string;
|
|
92
|
+
key: string;
|
|
93
|
+
app_key: string;
|
|
94
|
+
action_type: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
95
|
+
title: string;
|
|
96
|
+
type: "action";
|
|
97
|
+
id?: string | undefined;
|
|
98
|
+
is_important?: boolean | undefined;
|
|
99
|
+
is_hidden?: boolean | undefined;
|
|
100
|
+
app_version?: string | undefined;
|
|
101
|
+
}>;
|
|
102
|
+
} & {
|
|
103
|
+
context: {
|
|
104
|
+
meta: {
|
|
105
|
+
listActions: import("@zapier/zapier-sdk").PluginMeta;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
} & {
|
|
109
|
+
listInputFields: (options?: (({
|
|
110
|
+
app: string;
|
|
111
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
112
|
+
action: string;
|
|
113
|
+
connection?: string | number | undefined;
|
|
114
|
+
connectionId?: string | number | null | undefined;
|
|
115
|
+
authenticationId?: string | number | null | undefined;
|
|
116
|
+
inputs?: Record<string, unknown> | undefined;
|
|
117
|
+
pageSize?: number | undefined;
|
|
118
|
+
maxItems?: number | undefined;
|
|
119
|
+
cursor?: string | undefined;
|
|
120
|
+
} | {
|
|
121
|
+
appKey: string;
|
|
122
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
123
|
+
actionKey: string;
|
|
124
|
+
connection?: string | number | undefined;
|
|
125
|
+
connectionId?: string | number | null | undefined;
|
|
126
|
+
authenticationId?: string | number | null | undefined;
|
|
127
|
+
inputs?: Record<string, unknown> | undefined;
|
|
128
|
+
pageSize?: number | undefined;
|
|
129
|
+
maxItems?: number | undefined;
|
|
130
|
+
cursor?: string | undefined;
|
|
131
|
+
}) & {
|
|
132
|
+
cursor?: string;
|
|
133
|
+
pageSize?: number;
|
|
134
|
+
maxItems?: number;
|
|
135
|
+
}) | undefined) => import("@zapier/zapier-sdk").PaginatedSdkResult<{
|
|
136
|
+
key: string;
|
|
137
|
+
type: "input_field";
|
|
138
|
+
default_value: string;
|
|
139
|
+
depends_on: string[];
|
|
140
|
+
description: string;
|
|
141
|
+
invalidates_input_fields: boolean;
|
|
142
|
+
is_required: boolean;
|
|
143
|
+
placeholder: string;
|
|
144
|
+
title: string;
|
|
145
|
+
value_type: string;
|
|
146
|
+
format?: string | undefined;
|
|
147
|
+
items?: {
|
|
148
|
+
type: string;
|
|
149
|
+
} | undefined;
|
|
150
|
+
} | {
|
|
151
|
+
key: string;
|
|
152
|
+
type: "info_field";
|
|
153
|
+
description: string;
|
|
154
|
+
title?: string | undefined;
|
|
155
|
+
} | import("@zapier/zapier-sdk").FieldsetItem>;
|
|
156
|
+
} & {
|
|
157
|
+
context: {
|
|
158
|
+
meta: {
|
|
159
|
+
listInputFields: import("@zapier/zapier-sdk").PluginMeta;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
} & {
|
|
163
|
+
listConnections: (options?: ({
|
|
164
|
+
title?: string | undefined;
|
|
165
|
+
search?: string | undefined;
|
|
166
|
+
owner?: string | undefined;
|
|
167
|
+
app?: string | undefined;
|
|
168
|
+
appKey?: string | undefined;
|
|
169
|
+
connections?: string[] | undefined;
|
|
170
|
+
connectionIds?: string[] | undefined;
|
|
171
|
+
authenticationIds?: string[] | undefined;
|
|
172
|
+
account?: string | undefined;
|
|
173
|
+
accountId?: string | undefined;
|
|
174
|
+
includeShared?: boolean | undefined;
|
|
175
|
+
isExpired?: boolean | undefined;
|
|
176
|
+
expired?: boolean | undefined;
|
|
177
|
+
pageSize?: number | undefined;
|
|
178
|
+
maxItems?: number | undefined;
|
|
179
|
+
cursor?: string | undefined;
|
|
180
|
+
} & {
|
|
181
|
+
cursor?: string;
|
|
182
|
+
pageSize?: number;
|
|
183
|
+
maxItems?: number;
|
|
184
|
+
}) | undefined) => import("@zapier/zapier-sdk").PaginatedSdkResult<{
|
|
185
|
+
date: string;
|
|
186
|
+
is_invite_only: boolean;
|
|
187
|
+
is_private: boolean;
|
|
188
|
+
shared_with_all: boolean;
|
|
189
|
+
id: string;
|
|
190
|
+
account_id: string;
|
|
191
|
+
title?: string | null | undefined;
|
|
192
|
+
lastchanged?: string | undefined;
|
|
193
|
+
destination_selected_api?: string | null | undefined;
|
|
194
|
+
is_stale?: string | undefined;
|
|
195
|
+
is_shared?: string | undefined;
|
|
196
|
+
marked_stale_at?: string | null | undefined;
|
|
197
|
+
label?: string | null | undefined;
|
|
198
|
+
identifier?: string | null | undefined;
|
|
199
|
+
url?: string | undefined;
|
|
200
|
+
groups?: Record<string, unknown>[] | undefined;
|
|
201
|
+
members?: string | undefined;
|
|
202
|
+
permissions?: Record<string, boolean> | undefined;
|
|
203
|
+
public_id?: string | undefined;
|
|
204
|
+
account_public_id?: string | undefined;
|
|
205
|
+
customuser_public_id?: string | undefined;
|
|
206
|
+
implementation_id?: string | undefined;
|
|
207
|
+
profile_id?: string | undefined;
|
|
208
|
+
is_expired?: string | undefined;
|
|
209
|
+
expired_at?: string | null | undefined;
|
|
210
|
+
app_key?: string | undefined;
|
|
211
|
+
app_version?: string | undefined;
|
|
212
|
+
}>;
|
|
213
|
+
} & {
|
|
214
|
+
context: {
|
|
215
|
+
meta: {
|
|
216
|
+
listConnections: import("@zapier/zapier-sdk").PluginMeta;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
} & {
|
|
220
|
+
context: {
|
|
221
|
+
getResolvedManifest: () => Promise<import("@zapier/zapier-sdk").Manifest | null>;
|
|
222
|
+
getVersionedImplementationId: (appKey: string) => Promise<string | null>;
|
|
223
|
+
resolveAppKeys: ({ appKeys }: {
|
|
224
|
+
appKeys: string[];
|
|
225
|
+
}) => Promise<import("@zapier/zapier-sdk").ResolvedAppLocator[]>;
|
|
226
|
+
updateManifestEntry: (options: import("@zapier/zapier-sdk").UpdateManifestEntryOptions) => Promise<import("@zapier/zapier-sdk").UpdateManifestEntryResult>;
|
|
227
|
+
addActionEntry: (options: import("@zapier/zapier-sdk").AddActionEntryOptions) => Promise<import("@zapier/zapier-sdk").AddActionEntryResult>;
|
|
228
|
+
findActionEntry: ({ name, manifest, }: {
|
|
229
|
+
name: string;
|
|
230
|
+
manifest: import("@zapier/zapier-sdk").Manifest;
|
|
231
|
+
}) => import("@zapier/zapier-sdk").ActionEntry | null;
|
|
232
|
+
listActionEntries: ({ configPath, }?: {
|
|
233
|
+
configPath?: string;
|
|
234
|
+
}) => Promise<Array<[string, import("@zapier/zapier-sdk").ActionEntry]>>;
|
|
235
|
+
deleteActionEntry: ({ name, configPath, skipWrite, }: {
|
|
236
|
+
name: string;
|
|
237
|
+
configPath?: string;
|
|
238
|
+
skipWrite?: boolean;
|
|
239
|
+
}) => Promise<import("@zapier/zapier-sdk").Manifest>;
|
|
240
|
+
hasActionEntry: ({ name, manifest, }: {
|
|
241
|
+
name: string;
|
|
242
|
+
manifest: import("@zapier/zapier-sdk").Manifest;
|
|
243
|
+
}) => boolean;
|
|
244
|
+
findManifestEntry: typeof import("@zapier/zapier-sdk").findManifestEntry;
|
|
245
|
+
readManifestFromFile: typeof import("@zapier/zapier-sdk").readManifestFromFile;
|
|
246
|
+
getManifestConnections: () => Promise<Record<string, {
|
|
247
|
+
connectionId: string | number;
|
|
248
|
+
}> | null>;
|
|
249
|
+
};
|
|
250
|
+
} & {
|
|
251
|
+
context: import("@zapier/zapier-sdk").EventEmissionContext;
|
|
252
|
+
} & {
|
|
253
|
+
context: {
|
|
254
|
+
meta: Record<string, import("@zapier/zapier-sdk").PluginMeta>;
|
|
255
|
+
};
|
|
256
|
+
}) => {
|
|
257
|
+
generateAppTypes: (options?: GenerateAppTypesOptions | undefined) => Promise<GenerateAppTypesResult>;
|
|
258
|
+
} & {
|
|
259
|
+
context: {
|
|
260
|
+
meta: {
|
|
261
|
+
generateAppTypes: import("@zapier/zapier-sdk").PluginMeta;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
export type GenerateAppTypesPluginProvides = ReturnType<typeof generateAppTypesPlugin>;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createPluginMethod, definePlugin, ZapierValidationError, ZapierUnknownError, } from "@zapier/zapier-sdk";
|
|
2
2
|
import { GenerateAppTypesSchema, } from "./schemas";
|
|
3
3
|
import { AstTypeGenerator } from "../../generators/ast-generator";
|
|
4
4
|
import { getManifestKey } from "../../utils/manifest-helpers";
|
|
5
5
|
import { mkdir, writeFile } from "fs/promises";
|
|
6
6
|
import { join, resolve } from "path";
|
|
7
7
|
import { detectTypesOutputDirectory } from "../../utils/directory-detection";
|
|
8
|
-
export const generateAppTypesPlugin = (sdk) => {
|
|
9
|
-
|
|
8
|
+
export const generateAppTypesPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
9
|
+
name: "generateAppTypes",
|
|
10
|
+
categories: ["utility"],
|
|
11
|
+
// Cast: schema validates JSON fields only; GenerateAppTypesOptions adds
|
|
12
|
+
// the runtime-only `onProgress` callback (passthrough via createFunction).
|
|
13
|
+
inputSchema: GenerateAppTypesSchema,
|
|
14
|
+
handler: async ({ sdk, options }) => {
|
|
10
15
|
const { apps: appKeys, connections: connectionIds, skipWrite = false, typesOutputDirectory = await detectTypesOutputDirectory(), onProgress, } = options;
|
|
11
16
|
const resolvedTypesOutput = resolve(typesOutputDirectory);
|
|
12
|
-
const result = {
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
// Get apps using listApps (which respects existing manifest for version locking)
|
|
17
|
+
const result = { typeDefinitions: {} };
|
|
18
|
+
// Get apps via listApps (respects existing manifest for version locking).
|
|
16
19
|
onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
|
|
17
20
|
const appsIterable = sdk.listApps({ apps: appKeys }).items();
|
|
18
21
|
const apps = [];
|
|
@@ -24,7 +27,6 @@ export const generateAppTypesPlugin = (sdk) => {
|
|
|
24
27
|
if (apps.length === 0) {
|
|
25
28
|
return result;
|
|
26
29
|
}
|
|
27
|
-
// Fetch connections if provided
|
|
28
30
|
const connections = [];
|
|
29
31
|
if (connectionIds && connectionIds.length > 0) {
|
|
30
32
|
onProgress?.({
|
|
@@ -42,15 +44,12 @@ export const generateAppTypesPlugin = (sdk) => {
|
|
|
42
44
|
count: connections.length,
|
|
43
45
|
});
|
|
44
46
|
}
|
|
45
|
-
// Ensure output directory exists if we're writing files
|
|
46
47
|
if (!skipWrite && resolvedTypesOutput) {
|
|
47
48
|
await mkdir(resolvedTypesOutput, { recursive: true });
|
|
48
49
|
}
|
|
49
|
-
// Initialize writtenFiles if we're writing to disk
|
|
50
50
|
if (!skipWrite) {
|
|
51
51
|
result.writtenFiles = {};
|
|
52
52
|
}
|
|
53
|
-
// Process each app
|
|
54
53
|
for (const app of apps) {
|
|
55
54
|
onProgress?.({
|
|
56
55
|
type: "app_processing_start",
|
|
@@ -72,12 +71,9 @@ export const generateAppTypesPlugin = (sdk) => {
|
|
|
72
71
|
},
|
|
73
72
|
});
|
|
74
73
|
}
|
|
75
|
-
// Find matching connection for this app if connections were provided
|
|
76
74
|
let connectionId;
|
|
77
75
|
if (connections.length > 0) {
|
|
78
|
-
const matchingConnection = connections.find((conn) =>
|
|
79
|
-
return conn.app_key === app.key;
|
|
80
|
-
});
|
|
76
|
+
const matchingConnection = connections.find((conn) => conn.app_key === app.key);
|
|
81
77
|
if (matchingConnection) {
|
|
82
78
|
connectionId = matchingConnection.id;
|
|
83
79
|
onProgress?.({
|
|
@@ -95,7 +91,6 @@ export const generateAppTypesPlugin = (sdk) => {
|
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
93
|
const manifestKey = getManifestKey(app);
|
|
98
|
-
// Generate type definitions
|
|
99
94
|
const generator = new AstTypeGenerator();
|
|
100
95
|
const typeDefinitionString = await generator.generateTypes({
|
|
101
96
|
app,
|
|
@@ -108,21 +103,13 @@ export const generateAppTypesPlugin = (sdk) => {
|
|
|
108
103
|
manifestKey,
|
|
109
104
|
sizeBytes: typeDefinitionString.length,
|
|
110
105
|
});
|
|
111
|
-
// Write to file if skipWrite is false
|
|
112
106
|
if (!skipWrite && resolvedTypesOutput && result.writtenFiles) {
|
|
113
107
|
const filePath = join(resolvedTypesOutput, `${manifestKey}.d.ts`);
|
|
114
108
|
await writeFile(filePath, typeDefinitionString, "utf8");
|
|
115
109
|
result.writtenFiles[manifestKey] = filePath;
|
|
116
|
-
onProgress?.({
|
|
117
|
-
type: "file_written",
|
|
118
|
-
manifestKey,
|
|
119
|
-
filePath,
|
|
120
|
-
});
|
|
110
|
+
onProgress?.({ type: "file_written", manifestKey, filePath });
|
|
121
111
|
}
|
|
122
|
-
onProgress?.({
|
|
123
|
-
type: "app_processing_complete",
|
|
124
|
-
app: app.key,
|
|
125
|
-
});
|
|
112
|
+
onProgress?.({ type: "app_processing_complete", app: app.key });
|
|
126
113
|
}
|
|
127
114
|
catch (error) {
|
|
128
115
|
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
@@ -132,26 +119,11 @@ export const generateAppTypesPlugin = (sdk) => {
|
|
|
132
119
|
error: errorMessage,
|
|
133
120
|
});
|
|
134
121
|
if (error instanceof ZapierValidationError) {
|
|
135
|
-
throw error;
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
throw new ZapierUnknownError(errorMessage, {
|
|
139
|
-
cause: error, // Works for both Error and non-Error
|
|
140
|
-
});
|
|
122
|
+
throw error;
|
|
141
123
|
}
|
|
124
|
+
throw new ZapierUnknownError(errorMessage, { cause: error });
|
|
142
125
|
}
|
|
143
126
|
}
|
|
144
127
|
return result;
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
generateAppTypes,
|
|
148
|
-
context: {
|
|
149
|
-
meta: {
|
|
150
|
-
generateAppTypes: {
|
|
151
|
-
categories: ["utility"],
|
|
152
|
-
inputSchema: GenerateAppTypesSchema,
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
};
|
|
128
|
+
},
|
|
129
|
+
}));
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export declare const getLoginConfigPathPlugin: (sdk: {
|
|
2
|
+
context: import("@zapier/zapier-sdk").EventEmissionContext;
|
|
3
|
+
} & {
|
|
4
|
+
context: {
|
|
5
|
+
meta: Record<string, import("@zapier/zapier-sdk").PluginMeta>;
|
|
6
|
+
};
|
|
7
|
+
}) => {
|
|
8
|
+
getLoginConfigPath: (options?: Record<string, never> | undefined) => Promise<string>;
|
|
9
|
+
} & {
|
|
5
10
|
context: {
|
|
6
11
|
meta: {
|
|
7
|
-
getLoginConfigPath:
|
|
8
|
-
inputSchema: typeof GetLoginConfigPathSchema;
|
|
9
|
-
};
|
|
12
|
+
getLoginConfigPath: import("@zapier/zapier-sdk").PluginMeta;
|
|
10
13
|
};
|
|
11
14
|
};
|
|
12
|
-
}
|
|
13
|
-
export
|
|
14
|
-
GetLoginConfigPathPluginProvides>;
|
|
15
|
+
};
|
|
16
|
+
export type GetLoginConfigPathPluginProvides = ReturnType<typeof getLoginConfigPathPlugin>;
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import { GetLoginConfigPathSchema
|
|
2
|
-
import {
|
|
1
|
+
import { GetLoginConfigPathSchema } from "./schemas";
|
|
2
|
+
import { createPluginMethod, definePlugin, } from "@zapier/zapier-sdk";
|
|
3
3
|
import { getConfigPath } from "../../login";
|
|
4
|
-
export const getLoginConfigPathPlugin = () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
context: {
|
|
11
|
-
meta: {
|
|
12
|
-
getLoginConfigPath: {
|
|
13
|
-
categories: ["utility"],
|
|
14
|
-
inputSchema: GetLoginConfigPathSchema,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
};
|
|
4
|
+
export const getLoginConfigPathPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
5
|
+
name: "getLoginConfigPath",
|
|
6
|
+
categories: ["utility"],
|
|
7
|
+
inputSchema: GetLoginConfigPathSchema,
|
|
8
|
+
handler: async () => getConfigPath(),
|
|
9
|
+
}));
|