@zapier/zapier-sdk-cli 0.59.0 → 0.59.2

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 (174) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/cli.cjs +2 -2
  3. package/dist/cli.mjs +2 -2
  4. package/dist/experimental.cjs +1 -1
  5. package/dist/experimental.mjs +1 -1
  6. package/dist/index.cjs +2 -2
  7. package/dist/index.mjs +2 -2
  8. package/package.json +4 -4
  9. package/dist/package.json +0 -121
  10. package/dist/src/cli.d.ts +0 -2
  11. package/dist/src/cli.js +0 -219
  12. package/dist/src/experimental.d.ts +0 -33
  13. package/dist/src/experimental.js +0 -86
  14. package/dist/src/generators/ast-generator.d.ts +0 -41
  15. package/dist/src/generators/ast-generator.js +0 -405
  16. package/dist/src/index.d.ts +0 -5
  17. package/dist/src/index.js +0 -5
  18. package/dist/src/login/config.d.ts +0 -4
  19. package/dist/src/login/config.js +0 -21
  20. package/dist/src/login/credentials-revoke.d.ts +0 -14
  21. package/dist/src/login/credentials-revoke.js +0 -95
  22. package/dist/src/login/credentials-store.d.ts +0 -60
  23. package/dist/src/login/credentials-store.js +0 -181
  24. package/dist/src/login/filesystem-cache.d.ts +0 -25
  25. package/dist/src/login/filesystem-cache.js +0 -195
  26. package/dist/src/login/index.d.ts +0 -110
  27. package/dist/src/login/index.js +0 -424
  28. package/dist/src/login/keychain.d.ts +0 -18
  29. package/dist/src/login/keychain.js +0 -74
  30. package/dist/src/login/legacy-jwt.d.ts +0 -4
  31. package/dist/src/login/legacy-jwt.js +0 -18
  32. package/dist/src/login.d.ts +0 -10
  33. package/dist/src/login.js +0 -10
  34. package/dist/src/paths.d.ts +0 -1
  35. package/dist/src/paths.js +0 -6
  36. package/dist/src/plugins/add/index.d.ts +0 -254
  37. package/dist/src/plugins/add/index.js +0 -95
  38. package/dist/src/plugins/add/schemas.d.ts +0 -8
  39. package/dist/src/plugins/add/schemas.js +0 -22
  40. package/dist/src/plugins/auth/credentials-base-url.d.ts +0 -11
  41. package/dist/src/plugins/auth/credentials-base-url.js +0 -24
  42. package/dist/src/plugins/buildManifest/index.d.ts +0 -120
  43. package/dist/src/plugins/buildManifest/index.js +0 -71
  44. package/dist/src/plugins/buildManifest/schemas.d.ts +0 -44
  45. package/dist/src/plugins/buildManifest/schemas.js +0 -17
  46. package/dist/src/plugins/bundleCode/index.d.ts +0 -23
  47. package/dist/src/plugins/bundleCode/index.js +0 -62
  48. package/dist/src/plugins/bundleCode/schemas.d.ts +0 -10
  49. package/dist/src/plugins/bundleCode/schemas.js +0 -19
  50. package/dist/src/plugins/cliOverrides/index.d.ts +0 -21
  51. package/dist/src/plugins/cliOverrides/index.js +0 -17
  52. package/dist/src/plugins/curl/index.d.ts +0 -76
  53. package/dist/src/plugins/curl/index.js +0 -236
  54. package/dist/src/plugins/curl/schemas.d.ts +0 -40
  55. package/dist/src/plugins/curl/schemas.js +0 -108
  56. package/dist/src/plugins/curl/utils.d.ts +0 -34
  57. package/dist/src/plugins/curl/utils.js +0 -150
  58. package/dist/src/plugins/drainTriggerInbox/index.d.ts +0 -46
  59. package/dist/src/plugins/drainTriggerInbox/index.js +0 -178
  60. package/dist/src/plugins/feedback/index.d.ts +0 -24
  61. package/dist/src/plugins/feedback/index.js +0 -52
  62. package/dist/src/plugins/feedback/schemas.d.ts +0 -5
  63. package/dist/src/plugins/feedback/schemas.js +0 -8
  64. package/dist/src/plugins/generateAppTypes/index.d.ts +0 -265
  65. package/dist/src/plugins/generateAppTypes/index.js +0 -129
  66. package/dist/src/plugins/generateAppTypes/schemas.d.ts +0 -58
  67. package/dist/src/plugins/generateAppTypes/schemas.js +0 -21
  68. package/dist/src/plugins/getLoginConfigPath/index.d.ts +0 -16
  69. package/dist/src/plugins/getLoginConfigPath/index.js +0 -9
  70. package/dist/src/plugins/getLoginConfigPath/schemas.d.ts +0 -3
  71. package/dist/src/plugins/getLoginConfigPath/schemas.js +0 -5
  72. package/dist/src/plugins/index.d.ts +0 -15
  73. package/dist/src/plugins/index.js +0 -15
  74. package/dist/src/plugins/init/display.d.ts +0 -9
  75. package/dist/src/plugins/init/display.js +0 -72
  76. package/dist/src/plugins/init/index.d.ts +0 -21
  77. package/dist/src/plugins/init/index.js +0 -56
  78. package/dist/src/plugins/init/schemas.d.ts +0 -9
  79. package/dist/src/plugins/init/schemas.js +0 -19
  80. package/dist/src/plugins/init/steps.d.ts +0 -39
  81. package/dist/src/plugins/init/steps.js +0 -141
  82. package/dist/src/plugins/init/types.d.ts +0 -31
  83. package/dist/src/plugins/init/types.js +0 -1
  84. package/dist/src/plugins/init/utils.d.ts +0 -48
  85. package/dist/src/plugins/init/utils.js +0 -135
  86. package/dist/src/plugins/login/index.d.ts +0 -25
  87. package/dist/src/plugins/login/index.js +0 -12
  88. package/dist/src/plugins/login/schemas.d.ts +0 -9
  89. package/dist/src/plugins/login/schemas.js +0 -27
  90. package/dist/src/plugins/logout/index.d.ts +0 -30
  91. package/dist/src/plugins/logout/index.js +0 -33
  92. package/dist/src/plugins/logout/schemas.d.ts +0 -2
  93. package/dist/src/plugins/logout/schemas.js +0 -4
  94. package/dist/src/plugins/mcp/index.d.ts +0 -28
  95. package/dist/src/plugins/mcp/index.js +0 -24
  96. package/dist/src/plugins/mcp/schemas.d.ts +0 -5
  97. package/dist/src/plugins/mcp/schemas.js +0 -10
  98. package/dist/src/plugins/signup/index.d.ts +0 -25
  99. package/dist/src/plugins/signup/index.js +0 -12
  100. package/dist/src/plugins/signup/schemas.d.ts +0 -9
  101. package/dist/src/plugins/signup/schemas.js +0 -26
  102. package/dist/src/plugins/signup/test-harness.d.ts +0 -34
  103. package/dist/src/plugins/signup/test-harness.js +0 -76
  104. package/dist/src/plugins/watchTriggerInbox/index.d.ts +0 -46
  105. package/dist/src/plugins/watchTriggerInbox/index.js +0 -166
  106. package/dist/src/sdk.d.ts +0 -17
  107. package/dist/src/sdk.js +0 -67
  108. package/dist/src/telemetry/builders.d.ts +0 -44
  109. package/dist/src/telemetry/builders.js +0 -59
  110. package/dist/src/telemetry/events.d.ts +0 -40
  111. package/dist/src/telemetry/events.js +0 -4
  112. package/dist/src/types/sdk.d.ts +0 -6
  113. package/dist/src/types/sdk.js +0 -1
  114. package/dist/src/utils/api/client.d.ts +0 -15
  115. package/dist/src/utils/api/client.js +0 -27
  116. package/dist/src/utils/approval-errors.d.ts +0 -1
  117. package/dist/src/utils/approval-errors.js +0 -9
  118. package/dist/src/utils/approval-progress.d.ts +0 -12
  119. package/dist/src/utils/approval-progress.js +0 -179
  120. package/dist/src/utils/auth/account-auth.d.ts +0 -33
  121. package/dist/src/utils/auth/account-auth.js +0 -302
  122. package/dist/src/utils/auth/client-credentials.d.ts +0 -26
  123. package/dist/src/utils/auth/client-credentials.js +0 -67
  124. package/dist/src/utils/auth/oauth-callback.d.ts +0 -6
  125. package/dist/src/utils/auth/oauth-callback.js +0 -28
  126. package/dist/src/utils/auth/oauth-errors.d.ts +0 -2
  127. package/dist/src/utils/auth/oauth-errors.js +0 -39
  128. package/dist/src/utils/auth/oauth-flow.d.ts +0 -37
  129. package/dist/src/utils/auth/oauth-flow.js +0 -313
  130. package/dist/src/utils/auth/oauth-transaction.d.ts +0 -35
  131. package/dist/src/utils/auth/oauth-transaction.js +0 -69
  132. package/dist/src/utils/cli-generator-utils.d.ts +0 -14
  133. package/dist/src/utils/cli-generator-utils.js +0 -122
  134. package/dist/src/utils/cli-generator.d.ts +0 -4
  135. package/dist/src/utils/cli-generator.js +0 -831
  136. package/dist/src/utils/cli-options.d.ts +0 -16
  137. package/dist/src/utils/cli-options.js +0 -34
  138. package/dist/src/utils/cli-renderer.d.ts +0 -53
  139. package/dist/src/utils/cli-renderer.js +0 -265
  140. package/dist/src/utils/constants.d.ts +0 -3
  141. package/dist/src/utils/constants.js +0 -5
  142. package/dist/src/utils/directory-detection.d.ts +0 -5
  143. package/dist/src/utils/directory-detection.js +0 -21
  144. package/dist/src/utils/errors.d.ts +0 -33
  145. package/dist/src/utils/errors.js +0 -36
  146. package/dist/src/utils/extensions.d.ts +0 -20
  147. package/dist/src/utils/extensions.js +0 -66
  148. package/dist/src/utils/getCallablePromise.d.ts +0 -6
  149. package/dist/src/utils/getCallablePromise.js +0 -14
  150. package/dist/src/utils/log.d.ts +0 -8
  151. package/dist/src/utils/log.js +0 -26
  152. package/dist/src/utils/manifest-helpers.d.ts +0 -10
  153. package/dist/src/utils/manifest-helpers.js +0 -19
  154. package/dist/src/utils/non-interactive.d.ts +0 -14
  155. package/dist/src/utils/non-interactive.js +0 -15
  156. package/dist/src/utils/package-manager-detector.d.ts +0 -18
  157. package/dist/src/utils/package-manager-detector.js +0 -72
  158. package/dist/src/utils/parameter-resolver.d.ts +0 -179
  159. package/dist/src/utils/parameter-resolver.js +0 -1554
  160. package/dist/src/utils/retry.d.ts +0 -6
  161. package/dist/src/utils/retry.js +0 -21
  162. package/dist/src/utils/schema-formatter.d.ts +0 -11
  163. package/dist/src/utils/schema-formatter.js +0 -131
  164. package/dist/src/utils/serializeAsync.d.ts +0 -2
  165. package/dist/src/utils/serializeAsync.js +0 -16
  166. package/dist/src/utils/spinner.d.ts +0 -1
  167. package/dist/src/utils/spinner.js +0 -21
  168. package/dist/src/utils/string-utils.d.ts +0 -1
  169. package/dist/src/utils/string-utils.js +0 -6
  170. package/dist/src/utils/triggerDrain.d.ts +0 -144
  171. package/dist/src/utils/triggerDrain.js +0 -351
  172. package/dist/src/utils/version-checker.d.ts +0 -17
  173. package/dist/src/utils/version-checker.js +0 -154
  174. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,254 +0,0 @@
1
- export declare const addAppsPlugin: (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
- } & {
67
- context: {
68
- meta: {
69
- listApps: import("@zapier/zapier-sdk").PluginMeta<unknown>;
70
- };
71
- };
72
- } & {
73
- listActions: (options?: (({
74
- app: string;
75
- actionType?: "read" | "read_bulk" | "write" | "search" | "search_or_write" | "search_and_write" | "filter" | "run" | undefined;
76
- pageSize?: number | undefined;
77
- maxItems?: number | undefined;
78
- cursor?: string | undefined;
79
- } | {
80
- appKey: string;
81
- actionType?: "read" | "read_bulk" | "write" | "search" | "search_or_write" | "search_and_write" | "filter" | "run" | 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: "read" | "read_bulk" | "write" | "search" | "search_or_write" | "search_and_write" | "filter" | "run";
94
- title: string;
95
- type: "action";
96
- is_hidden?: boolean | undefined;
97
- id?: string | undefined;
98
- is_important?: boolean | undefined;
99
- app_version?: string | undefined;
100
- }>;
101
- } & {
102
- context: {
103
- meta: {
104
- listActions: import("@zapier/zapier-sdk").PluginMeta<unknown>;
105
- };
106
- };
107
- } & {
108
- listActionInputFields: (options?: (({
109
- app: string;
110
- actionType: "read" | "read_bulk" | "write" | "search" | "search_or_write" | "search_and_write" | "filter" | "run";
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: "read" | "read_bulk" | "write" | "search" | "search_or_write" | "search_and_write" | "filter" | "run";
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
- listActionInputFields: import("@zapier/zapier-sdk").PluginMeta<unknown>;
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<unknown>;
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<unknown>;
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<unknown>;
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<unknown>;
251
- };
252
- };
253
- };
254
- export type AddAppsPluginProvides = ReturnType<typeof addAppsPlugin>;
@@ -1,95 +0,0 @@
1
- import { createPluginMethod, definePlugin } from "@zapier/zapier-sdk";
2
- import { AddSchema } from "./schemas";
3
- import { detectTypesOutputDirectory } from "../../utils/directory-detection";
4
- import { resolve } from "path";
5
- export const addAppsPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
6
- name: "add",
7
- categories: ["utility"],
8
- inputSchema: AddSchema,
9
- handler: async ({ sdk, options }) => {
10
- const { apps: appKeys, connections: connectionIds, configPath, typesOutput = await detectTypesOutputDirectory(), } = options;
11
- const resolvedTypesOutput = resolve(typesOutput);
12
- console.log(`📦 Adding ${appKeys.length} app(s)...`);
13
- // Track app names for better console output
14
- const appSlugAndKeyMap = new Map();
15
- // Define progress handler for manifest building
16
- const handleManifestProgress = (event) => {
17
- switch (event.type) {
18
- case "apps_lookup_start":
19
- console.log(`📦 Looking up ${event.count} app(s)...`);
20
- break;
21
- case "app_found":
22
- // Store the app display name for later use
23
- const displayName = event.app.slug
24
- ? `${event.app.slug} (${event.app.key})`
25
- : event.app.key;
26
- appSlugAndKeyMap.set(event.app.key, displayName);
27
- break;
28
- case "apps_lookup_complete":
29
- if (event.count === 0) {
30
- console.warn("⚠️ No apps found");
31
- }
32
- break;
33
- case "app_processing_start":
34
- const appName = event.slug
35
- ? `${event.slug} (${event.app})`
36
- : event.app;
37
- console.log(`📦 Adding ${appName}...`);
38
- break;
39
- case "manifest_updated":
40
- const appDisplay = appSlugAndKeyMap.get(event.app) || event.app;
41
- console.log(`📝 Locked ${appDisplay} to ${event.app}@${event.version} using key '${event.manifestKey}'`);
42
- break;
43
- case "app_processing_error":
44
- const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
45
- console.warn(`⚠️ ${event.error} for ${errorApp}`);
46
- break;
47
- }
48
- };
49
- // Define progress handler for type generation
50
- const handleTypesProgress = (event) => {
51
- switch (event.type) {
52
- case "connections_lookup_start":
53
- console.log(`🔐 Looking up ${event.count} connection(s)...`);
54
- break;
55
- case "connections_lookup_complete":
56
- console.log(`🔐 Found ${event.count} connection(s)`);
57
- break;
58
- case "connection_matched":
59
- const appWithConnection = appSlugAndKeyMap.get(event.app) || event.app;
60
- console.log(`🔐 Using connection ${event.connectionId} (${event.connectionTitle}) for ${appWithConnection}`);
61
- break;
62
- case "connection_not_matched":
63
- const appWithoutConnection = appSlugAndKeyMap.get(event.app) || event.app;
64
- console.warn(`⚠️ No matching connection found for ${appWithoutConnection}`);
65
- break;
66
- case "file_written":
67
- console.log(`🔧 Generated types for ${event.manifestKey} at ${event.filePath}`);
68
- break;
69
- case "app_processing_error":
70
- const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
71
- console.warn(`⚠️ ${event.error} for ${errorApp}`);
72
- break;
73
- }
74
- };
75
- const manifestResult = await sdk.buildManifest({
76
- apps: appKeys,
77
- skipWrite: false,
78
- configPath,
79
- onProgress: handleManifestProgress,
80
- });
81
- const typesResult = await sdk.generateAppTypes({
82
- apps: appKeys,
83
- connections: connectionIds,
84
- skipWrite: false,
85
- typesOutputDirectory: resolvedTypesOutput,
86
- onProgress: handleTypesProgress,
87
- });
88
- const results = manifestResult.manifest?.apps || {};
89
- // Final summary
90
- const successfulApps = Object.keys(results).filter((manifestKey) => typesResult.writtenFiles?.[manifestKey]);
91
- if (successfulApps.length > 0) {
92
- console.log(`✅ Added ${successfulApps.length} app(s) to manifest`);
93
- }
94
- },
95
- }));
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
- export declare const AddSchema: z.ZodObject<{
3
- apps: z.ZodArray<z.ZodString>;
4
- connections: z.ZodOptional<z.ZodArray<z.ZodString>>;
5
- configPath: z.ZodOptional<z.ZodString>;
6
- typesOutput: z.ZodOptional<z.ZodString>;
7
- }, z.core.$strip>;
8
- export type AddOptions = z.infer<typeof AddSchema>;
@@ -1,22 +0,0 @@
1
- import { z } from "zod";
2
- import { DEFAULT_CONFIG_PATH } from "@zapier/zapier-sdk";
3
- export const AddSchema = z
4
- .object({
5
- apps: z
6
- .array(z.string().min(1, "App key cannot be empty"))
7
- .min(1, "At least one app key is required")
8
- .describe("One or more app keys to add (e.g., 'slack', 'github', 'trello')"),
9
- connections: z
10
- .array(z.string())
11
- .optional()
12
- .describe("Connection IDs to use for type generation (e.g., ['123', '456'])"),
13
- configPath: z
14
- .string()
15
- .optional()
16
- .describe(`Path to Zapier config file (defaults to '${DEFAULT_CONFIG_PATH}', e.g., './custom/.zapierrc')`),
17
- typesOutput: z
18
- .string()
19
- .optional()
20
- .describe("Directory for TypeScript type files (defaults to (src/lib/.)/zapier/apps/, e.g., './src/types/zapier/')"),
21
- })
22
- .describe("Add apps with manifest locking and TypeScript type generation - updates .zapierrc with app versions and generates TypeScript definition files");
@@ -1,11 +0,0 @@
1
- import { type ResolvedCredentials } from "@zapier/zapier-sdk";
2
- interface BaseUrlContext {
3
- resolveCredentials?: () => Promise<ResolvedCredentials | undefined>;
4
- resolvedCredentials?: ResolvedCredentials | undefined;
5
- options?: {
6
- baseUrl?: string;
7
- credentials?: unknown;
8
- };
9
- }
10
- export declare function resolveCredentialsBaseUrl(context: BaseUrlContext): Promise<string | undefined>;
11
- export {};
@@ -1,24 +0,0 @@
1
- import { isCredentialsObject, } from "@zapier/zapier-sdk";
2
- function getBaseUrlFromResolvedCredentials(credentials) {
3
- if (credentials && isCredentialsObject(credentials)) {
4
- return credentials.baseUrl;
5
- }
6
- return undefined;
7
- }
8
- function getBaseUrlFromOptionsCredentials(credentials) {
9
- if (credentials &&
10
- typeof credentials === "object" &&
11
- "baseUrl" in credentials &&
12
- typeof credentials.baseUrl === "string") {
13
- return credentials.baseUrl;
14
- }
15
- return undefined;
16
- }
17
- export async function resolveCredentialsBaseUrl(context) {
18
- const resolvedCredentials = "resolvedCredentials" in context
19
- ? context.resolvedCredentials
20
- : await context.resolveCredentials?.();
21
- return (getBaseUrlFromResolvedCredentials(resolvedCredentials) ??
22
- getBaseUrlFromOptionsCredentials(context.options?.credentials) ??
23
- context.options?.baseUrl);
24
- }
@@ -1,120 +0,0 @@
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
- } & {
69
- context: {
70
- meta: {
71
- listApps: import("@zapier/zapier-sdk").PluginMeta<unknown>;
72
- };
73
- };
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<unknown>;
117
- };
118
- };
119
- };
120
- export type BuildManifestPluginProvides = ReturnType<typeof buildManifestPlugin>;
@@ -1,71 +0,0 @@
1
- import { createPluginMethod, definePlugin, ZapierValidationError, ZapierUnknownError, } from "@zapier/zapier-sdk";
2
- import { BuildManifestSchema, } from "./schemas";
3
- import { createManifestEntry } from "../../utils/manifest-helpers";
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 }) => {
13
- const { apps: appKeys, skipWrite = false, configPath, onProgress, } = options;
14
- onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
15
- const appsIterable = sdk.listApps({ apps: appKeys }).items();
16
- const apps = [];
17
- for await (const app of appsIterable) {
18
- apps.push(app);
19
- onProgress?.({ type: "app_found", app });
20
- }
21
- onProgress?.({ type: "apps_lookup_complete", count: apps.length });
22
- if (apps.length === 0) {
23
- return {};
24
- }
25
- let updatedManifest;
26
- for (const app of apps) {
27
- onProgress?.({
28
- type: "app_processing_start",
29
- app: app.key,
30
- slug: app.slug,
31
- });
32
- try {
33
- const manifestEntry = createManifestEntry(app);
34
- onProgress?.({
35
- type: "manifest_entry_built",
36
- app: app.key,
37
- manifestKey: manifestEntry.implementationName,
38
- version: manifestEntry.version || "",
39
- });
40
- const { key: updatedManifestKey, manifest } = await sdk.context.updateManifestEntry({
41
- appKey: app.key,
42
- entry: manifestEntry,
43
- configPath,
44
- skipWrite,
45
- manifest: updatedManifest,
46
- });
47
- updatedManifest = manifest;
48
- onProgress?.({
49
- type: "manifest_updated",
50
- app: app.key,
51
- manifestKey: updatedManifestKey,
52
- version: manifestEntry.version || "",
53
- });
54
- onProgress?.({ type: "app_processing_complete", app: app.key });
55
- }
56
- catch (error) {
57
- const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
58
- onProgress?.({
59
- type: "app_processing_error",
60
- app: app.key,
61
- error: errorMessage,
62
- });
63
- if (error instanceof ZapierValidationError) {
64
- throw error;
65
- }
66
- throw new ZapierUnknownError(errorMessage, { cause: error });
67
- }
68
- }
69
- return { manifest: updatedManifest };
70
- },
71
- }));
@@ -1,44 +0,0 @@
1
- import { z } from "zod";
2
- import type { AppItem, Manifest } from "@zapier/zapier-sdk";
3
- export declare const BuildManifestSchema: z.ZodObject<{
4
- apps: z.ZodArray<z.ZodString>;
5
- skipWrite: z.ZodOptional<z.ZodBoolean>;
6
- configPath: z.ZodOptional<z.ZodString>;
7
- }, z.core.$strip>;
8
- export type BuildManifestOptions = z.infer<typeof BuildManifestSchema> & {
9
- onProgress?: (event: ManifestBuildProgressEvent) => void;
10
- };
11
- export type ManifestBuildProgressEvent = {
12
- type: "apps_lookup_start";
13
- count: number;
14
- } | {
15
- type: "app_found";
16
- app: AppItem;
17
- } | {
18
- type: "apps_lookup_complete";
19
- count: number;
20
- } | {
21
- type: "app_processing_start";
22
- app: string;
23
- slug?: string;
24
- } | {
25
- type: "manifest_entry_built";
26
- app: string;
27
- manifestKey: string;
28
- version: string;
29
- } | {
30
- type: "manifest_updated";
31
- app: string;
32
- manifestKey: string;
33
- version: string;
34
- } | {
35
- type: "app_processing_complete";
36
- app: string;
37
- } | {
38
- type: "app_processing_error";
39
- app: string;
40
- error: string;
41
- };
42
- export interface BuildManifestResult {
43
- manifest?: Manifest;
44
- }
@@ -1,17 +0,0 @@
1
- import { z } from "zod";
2
- export const BuildManifestSchema = z
3
- .object({
4
- apps: z
5
- .array(z.string().min(1, "App key cannot be empty"))
6
- .min(1, "At least one app key is required")
7
- .describe("One or more app keys to build manifest entries for (e.g., 'slack', 'github', 'trello')"),
8
- skipWrite: z
9
- .boolean()
10
- .optional()
11
- .describe("If true, returns manifest entries without writing to disk. If false or omitted, writes to the manifest file."),
12
- configPath: z
13
- .string()
14
- .optional()
15
- .describe("Path to the manifest file. Only used when skipWrite is false or omitted."),
16
- })
17
- .describe("Build manifest entries for apps - can optionally write to disk or just return JSON");