@zapier/zapier-sdk 0.0.3 → 0.1.0

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 (171) hide show
  1. package/dist/api/auth.d.ts +8 -0
  2. package/dist/api/auth.js +29 -0
  3. package/dist/api/client.d.ts +8 -0
  4. package/dist/api/client.js +102 -0
  5. package/dist/api/debug.d.ts +12 -0
  6. package/dist/api/debug.js +50 -0
  7. package/dist/api/index.d.ts +26 -0
  8. package/dist/api/index.js +51 -0
  9. package/dist/api/polling.d.ts +17 -0
  10. package/dist/api/polling.js +34 -0
  11. package/dist/{types.d.ts → api/types.d.ts} +37 -88
  12. package/dist/api/types.js +9 -0
  13. package/dist/functions/{bundleCode.d.ts → bundleCode/index.d.ts} +1 -8
  14. package/dist/functions/bundleCode/info.d.ts +27 -0
  15. package/dist/functions/bundleCode/info.js +11 -0
  16. package/dist/functions/bundleCode/schemas.d.ts +27 -0
  17. package/dist/functions/bundleCode/schemas.js +22 -0
  18. package/dist/functions/{generateTypes.d.ts → generateTypes/index.d.ts} +2 -7
  19. package/dist/functions/{generateTypes.js → generateTypes/index.js} +58 -24
  20. package/dist/functions/generateTypes/info.d.ts +21 -0
  21. package/dist/functions/generateTypes/info.js +11 -0
  22. package/dist/functions/generateTypes/schemas.d.ts +30 -0
  23. package/dist/functions/generateTypes/schemas.js +14 -0
  24. package/dist/functions/{getAction.d.ts → getAction/index.d.ts} +2 -6
  25. package/dist/functions/{getAction.js → getAction/index.js} +6 -5
  26. package/dist/functions/getAction/info.d.ts +18 -0
  27. package/dist/functions/getAction/info.js +11 -0
  28. package/dist/functions/getAction/schemas.d.ts +30 -0
  29. package/dist/functions/getAction/schemas.js +13 -0
  30. package/dist/functions/{getApp.d.ts → getApp/index.d.ts} +2 -4
  31. package/dist/functions/{getApp.js → getApp/index.js} +6 -10
  32. package/dist/functions/getApp/info.d.ts +12 -0
  33. package/dist/functions/getApp/info.js +11 -0
  34. package/dist/functions/getApp/schemas.d.ts +24 -0
  35. package/dist/functions/getApp/schemas.js +11 -0
  36. package/dist/functions/{listActions.d.ts → listActions/index.d.ts} +3 -6
  37. package/dist/functions/{listActions.js → listActions/index.js} +4 -3
  38. package/dist/functions/listActions/info.d.ts +15 -0
  39. package/dist/functions/listActions/info.js +11 -0
  40. package/dist/functions/listActions/schemas.d.ts +27 -0
  41. package/dist/functions/listActions/schemas.js +14 -0
  42. package/dist/functions/{listApps.d.ts → listApps/index.d.ts} +2 -6
  43. package/dist/functions/{listApps.js → listApps/index.js} +1 -1
  44. package/dist/functions/listApps/info.d.ts +18 -0
  45. package/dist/functions/listApps/info.js +11 -0
  46. package/dist/functions/listApps/schemas.d.ts +30 -0
  47. package/dist/functions/listApps/schemas.js +15 -0
  48. package/dist/functions/{listAuths.d.ts → listAuths/index.d.ts} +3 -9
  49. package/dist/functions/{listAuths.js → listAuths/index.js} +5 -5
  50. package/dist/functions/listAuths/info.d.ts +24 -0
  51. package/dist/functions/listAuths/info.js +11 -0
  52. package/dist/functions/listAuths/schemas.d.ts +36 -0
  53. package/dist/functions/listAuths/schemas.js +17 -0
  54. package/dist/functions/{listFields.d.ts → listFields/index.d.ts} +3 -9
  55. package/dist/functions/{listFields.js → listFields/index.js} +8 -10
  56. package/dist/functions/listFields/info.d.ts +24 -0
  57. package/dist/functions/listFields/info.js +11 -0
  58. package/dist/functions/listFields/schemas.d.ts +36 -0
  59. package/dist/functions/listFields/schemas.js +17 -0
  60. package/dist/functions/{runAction.d.ts → runAction/index.d.ts} +2 -8
  61. package/dist/functions/{runAction.js → runAction/index.js} +15 -14
  62. package/dist/functions/runAction/info.d.ts +24 -0
  63. package/dist/functions/runAction/info.js +11 -0
  64. package/dist/functions/runAction/schemas.d.ts +36 -0
  65. package/dist/functions/runAction/schemas.js +15 -0
  66. package/dist/index.d.ts +6 -3
  67. package/dist/index.js +7 -3
  68. package/dist/plugins/apps/index.d.ts +8 -0
  69. package/dist/plugins/apps/index.js +77 -0
  70. package/dist/plugins/apps/info.d.ts +6 -0
  71. package/dist/plugins/apps/info.js +13 -0
  72. package/dist/plugins/apps/types.d.ts +21 -0
  73. package/dist/plugins/apps/types.js +2 -0
  74. package/dist/resolvers/actionKey.d.ts +8 -0
  75. package/dist/resolvers/actionKey.js +20 -0
  76. package/dist/resolvers/actionType.d.ts +8 -0
  77. package/dist/resolvers/actionType.js +21 -0
  78. package/dist/resolvers/appKey.d.ts +6 -0
  79. package/dist/resolvers/appKey.js +8 -0
  80. package/dist/resolvers/authenticationId.d.ts +8 -0
  81. package/dist/resolvers/authenticationId.js +29 -0
  82. package/dist/resolvers/index.d.ts +39 -0
  83. package/dist/resolvers/index.js +105 -0
  84. package/dist/resolvers/inputs.d.ts +7 -0
  85. package/dist/resolvers/inputs.js +15 -0
  86. package/dist/schema-utils.d.ts +39 -0
  87. package/dist/schema-utils.js +52 -0
  88. package/dist/schemas/Action.d.ts +21 -0
  89. package/dist/schemas/Action.js +31 -0
  90. package/dist/schemas/App.d.ts +19 -0
  91. package/dist/schemas/App.js +32 -0
  92. package/dist/schemas/Auth.d.ts +30 -0
  93. package/dist/schemas/Auth.js +49 -0
  94. package/dist/schemas/Field.d.ts +15 -0
  95. package/dist/schemas/Field.js +25 -0
  96. package/dist/sdk.d.ts +3 -4
  97. package/dist/sdk.js +96 -11
  98. package/dist/types/domain.d.ts +22 -0
  99. package/dist/types/domain.js +21 -0
  100. package/dist/types/properties.d.ts +21 -0
  101. package/dist/types/properties.js +45 -0
  102. package/dist/types/sdk.d.ts +21 -0
  103. package/dist/types/sdk.js +2 -0
  104. package/package.json +4 -2
  105. package/src/api/auth.ts +28 -0
  106. package/src/api/client.ts +148 -0
  107. package/src/api/debug.ts +58 -0
  108. package/src/api/index.ts +83 -0
  109. package/src/api/polling.ts +56 -0
  110. package/src/api/types.ts +177 -0
  111. package/src/functions/{bundleCode.ts → bundleCode/index.ts} +1 -8
  112. package/src/functions/bundleCode/info.ts +9 -0
  113. package/src/functions/bundleCode/schemas.ts +30 -0
  114. package/src/functions/{generateTypes.ts → generateTypes/index.ts} +70 -31
  115. package/src/functions/generateTypes/info.ts +9 -0
  116. package/src/functions/generateTypes/schemas.ts +38 -0
  117. package/src/functions/{getAction.ts → getAction/index.ts} +11 -12
  118. package/src/functions/getAction/info.ts +9 -0
  119. package/src/functions/getAction/schemas.ts +35 -0
  120. package/src/functions/{getApp.ts → getApp/index.ts} +9 -15
  121. package/src/functions/getApp/info.ts +9 -0
  122. package/src/functions/getApp/schemas.ts +31 -0
  123. package/src/functions/{listActions.ts → listActions/index.ts} +8 -10
  124. package/src/functions/listActions/info.ts +9 -0
  125. package/src/functions/listActions/schemas.ts +40 -0
  126. package/src/functions/{listApps.ts → listApps/index.ts} +3 -8
  127. package/src/functions/listApps/info.ts +9 -0
  128. package/src/functions/listApps/schemas.ts +43 -0
  129. package/src/functions/{listAuths.ts → listAuths/index.ts} +8 -16
  130. package/src/functions/listAuths/info.ts +9 -0
  131. package/src/functions/listAuths/schemas.ts +48 -0
  132. package/src/functions/{listFields.ts → listFields/index.ts} +11 -20
  133. package/src/functions/listFields/info.ts +9 -0
  134. package/src/functions/listFields/schemas.ts +46 -0
  135. package/src/functions/{runAction.ts → runAction/index.ts} +25 -23
  136. package/src/functions/runAction/info.ts +9 -0
  137. package/src/functions/runAction/schemas.ts +41 -0
  138. package/src/index.ts +13 -4
  139. package/src/plugins/apps/index.ts +144 -0
  140. package/src/plugins/apps/info.ts +12 -0
  141. package/src/plugins/apps/types.ts +34 -0
  142. package/src/resolvers/actionKey.ts +33 -0
  143. package/src/resolvers/actionType.ts +30 -0
  144. package/src/resolvers/appKey.ts +11 -0
  145. package/src/resolvers/authenticationId.ts +38 -0
  146. package/src/resolvers/index.ts +117 -0
  147. package/src/resolvers/inputs.ts +23 -0
  148. package/src/schema-utils.ts +119 -0
  149. package/src/schemas/Action.ts +40 -0
  150. package/src/schemas/App.ts +43 -0
  151. package/src/schemas/Auth.ts +62 -0
  152. package/src/schemas/Field.ts +34 -0
  153. package/src/sdk.ts +153 -19
  154. package/src/types/domain.ts +54 -0
  155. package/src/types/properties.ts +67 -0
  156. package/src/types/sdk.ts +42 -0
  157. package/dist/actions-sdk.d.ts +0 -47
  158. package/dist/actions-sdk.js +0 -208
  159. package/dist/api.d.ts +0 -62
  160. package/dist/api.js +0 -227
  161. package/dist/output-schemas.d.ts +0 -95
  162. package/dist/output-schemas.js +0 -138
  163. package/dist/schemas.d.ts +0 -338
  164. package/dist/schemas.js +0 -336
  165. package/dist/types.js +0 -41
  166. package/src/actions-sdk.ts +0 -356
  167. package/src/api.ts +0 -361
  168. package/src/output-schemas.ts +0 -196
  169. package/src/schemas.ts +0 -467
  170. package/src/types.ts +0 -257
  171. /package/dist/functions/{bundleCode.js → bundleCode/index.js} +0 -0
@@ -34,19 +34,19 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.generateTypes = generateTypes;
37
- const listActions_1 = require("./listActions");
38
- const listFields_1 = require("./listFields");
37
+ const listActions_1 = require("../listActions");
38
+ const listFields_1 = require("../listFields");
39
39
  /**
40
40
  * Generate TypeScript types for a specific app
41
41
  *
42
42
  * This function can be used standalone without instantiating a full SDK,
43
43
  * which enables better tree-shaking in applications that only need this functionality.
44
44
  *
45
- * @param options - App key, auth ID, output path, and API configuration options
45
+ * @param options - App key, authentication ID, output path, and API configuration options
46
46
  * @returns Promise<string> - Generated TypeScript code
47
47
  */
48
48
  async function generateTypes(options) {
49
- const { appKey, authId, output = `./types/${appKey}.d.ts` } = options;
49
+ const { appKey, authenticationId, output = `./types/${appKey}.d.ts`, } = options;
50
50
  // Parse app identifier (support app@version format)
51
51
  const { app, version } = parseAppIdentifier(appKey);
52
52
  // Fetch all actions for the app
@@ -66,15 +66,15 @@ async function generateTypes(options) {
66
66
  }
67
67
  // Fetch input fields for each action
68
68
  const actionsWithFields = [];
69
- if (authId) {
69
+ if (authenticationId) {
70
70
  for (const action of actions) {
71
71
  try {
72
72
  const fields = await (0, listFields_1.listFields)({
73
73
  ...options,
74
- app: action.appKey,
75
- action: action.key,
76
- type: action.type,
77
- authId: authId,
74
+ appKey: action.appKey,
75
+ actionKey: action.key,
76
+ actionType: action.type,
77
+ authenticationId: authenticationId,
78
78
  });
79
79
  actionsWithFields.push({ ...action, inputFields: fields });
80
80
  }
@@ -132,8 +132,15 @@ ${versionComment}
132
132
  * Generated on: ${new Date().toISOString()}
133
133
  *
134
134
  * Usage:
135
- * import type { ${appName}Actions } from './path/to/this/file'
136
- * const sdk: ActionsSdk & { actions: ${appName}Actions } = createActionsSdk(...)
135
+ * import type { ${appName}Sdk } from './path/to/this/file'
136
+ * const sdk = createZapierSdk() as unknown as ${appName}Sdk
137
+ *
138
+ * // Direct usage (per-call auth):
139
+ * await sdk.apps.${appKey}.search.user_by_email({ authenticationId: 123, inputs: { email } })
140
+ *
141
+ * // Factory usage (pinned auth):
142
+ * const my${appName} = sdk.apps.${appKey}({ authenticationId: 123 })
143
+ * await my${appName}.search.user_by_email({ inputs: { email } })
137
144
  */
138
145
 
139
146
  import type { ActionExecutionOptions, ActionExecutionResult } from '@zapier/zapier-sdk'
@@ -176,15 +183,24 @@ import type { ActionExecutionOptions, ActionExecutionResult } from '@zapier/zapi
176
183
  });
177
184
  output += `}\n\n`;
178
185
  });
179
- // Generate the main app actions interface
180
- output += `export interface ${appName}Actions {\n`;
181
- output += ` run: {\n`;
182
- output += ` ${appKey}: {\n`;
186
+ // Generate the main app SDK interface with factory pattern support
187
+ // Generate the app proxy interface (actions grouped by type)
188
+ output += `interface ${appName}AppProxy {\n`;
183
189
  Object.keys(actionsByType).forEach((actionType) => {
184
190
  const typeName = `${appName}${capitalize(actionType)}Actions`;
185
- output += ` ${actionType}: ${typeName}\n`;
191
+ output += ` ${actionType}: ${typeName}\n`;
186
192
  });
187
- output += ` }\n`;
193
+ output += `}\n\n`;
194
+ // Generate the factory function interface
195
+ output += `interface ${appName}AppFactory {\n`;
196
+ output += ` (options: { authenticationId: number }): ${appName}AppProxy\n`;
197
+ output += `}\n\n`;
198
+ // Combine factory and direct access
199
+ output += `type ${appName}AppWithFactory = ${appName}AppFactory & ${appName}AppProxy\n\n`;
200
+ // Generate the main SDK interface
201
+ output += `export interface ${appName}Sdk {\n`;
202
+ output += ` apps: {\n`;
203
+ output += ` ${appKey}: ${appName}AppWithFactory\n`;
188
204
  output += ` }\n`;
189
205
  output += `}\n`;
190
206
  return output;
@@ -205,11 +221,19 @@ ${versionComment}
205
221
 
206
222
  import type { ActionExecutionOptions, ActionExecutionResult } from '@zapier/zapier-sdk'
207
223
 
208
- export interface ${appName}Actions {
209
- run: {
210
- ${appKey}: {
211
- // No actions available
212
- }
224
+ interface ${appName}AppProxy {
225
+ // No actions available
226
+ }
227
+
228
+ interface ${appName}AppFactory {
229
+ (options: { authenticationId: number }): ${appName}AppProxy
230
+ }
231
+
232
+ type ${appName}AppWithFactory = ${appName}AppFactory & ${appName}AppProxy
233
+
234
+ export interface ${appName}Sdk {
235
+ apps: {
236
+ ${appKey}: ${appName}AppWithFactory
213
237
  }
214
238
  }
215
239
  `;
@@ -219,11 +243,21 @@ function capitalize(str) {
219
243
  }
220
244
  function sanitizeActionName(actionKey) {
221
245
  // Ensure the action name is a valid TypeScript identifier
222
- return actionKey.replace(/[^a-zA-Z0-9_$]/g, "_");
246
+ let sanitized = actionKey.replace(/[^a-zA-Z0-9_$]/g, "_");
247
+ // If it starts with a number, prepend an underscore
248
+ if (/^[0-9]/.test(sanitized)) {
249
+ sanitized = "_" + sanitized;
250
+ }
251
+ return sanitized;
223
252
  }
224
253
  function sanitizeFieldName(fieldKey) {
225
254
  // Ensure the field name is a valid TypeScript identifier
226
- return fieldKey.replace(/[^a-zA-Z0-9_$]/g, "_");
255
+ let sanitized = fieldKey.replace(/[^a-zA-Z0-9_$]/g, "_");
256
+ // If it starts with a number, prepend an underscore
257
+ if (/^[0-9]/.test(sanitized)) {
258
+ sanitized = "_" + sanitized;
259
+ }
260
+ return sanitized;
227
261
  }
228
262
  function escapeComment(comment) {
229
263
  // Escape comment text to prevent breaking the JSDoc comment
@@ -0,0 +1,21 @@
1
+ import { generateTypes } from "./index";
2
+ export declare const generateTypesInfo: {
3
+ name: string;
4
+ inputSchema: import("zod").ZodObject<{
5
+ appKey: import("zod").ZodString;
6
+ authenticationId: import("zod").ZodOptional<import("zod").ZodNumber>;
7
+ output: import("zod").ZodOptional<import("zod").ZodString>;
8
+ debug: import("zod").ZodDefault<import("zod").ZodBoolean>;
9
+ }, "strip", import("zod").ZodTypeAny, {
10
+ debug: boolean;
11
+ appKey: string;
12
+ authenticationId?: number | undefined;
13
+ output?: string | undefined;
14
+ }, {
15
+ appKey: string;
16
+ debug?: boolean | undefined;
17
+ authenticationId?: number | undefined;
18
+ output?: string | undefined;
19
+ }>;
20
+ implementation: typeof generateTypes;
21
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateTypesInfo = void 0;
4
+ const index_1 = require("./index");
5
+ const schemas_1 = require("./schemas");
6
+ // Function registry info - imports both function and schema
7
+ exports.generateTypesInfo = {
8
+ name: index_1.generateTypes.name,
9
+ inputSchema: schemas_1.GenerateTypesSchema,
10
+ implementation: index_1.generateTypes,
11
+ };
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ export declare const GenerateTypesSchema: z.ZodObject<{
3
+ appKey: z.ZodString;
4
+ authenticationId: z.ZodOptional<z.ZodNumber>;
5
+ output: z.ZodOptional<z.ZodString>;
6
+ debug: z.ZodDefault<z.ZodBoolean>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ debug: boolean;
9
+ appKey: string;
10
+ authenticationId?: number | undefined;
11
+ output?: string | undefined;
12
+ }, {
13
+ appKey: string;
14
+ debug?: boolean | undefined;
15
+ authenticationId?: number | undefined;
16
+ output?: string | undefined;
17
+ }>;
18
+ export type GenerateTypesOptions = z.infer<typeof GenerateTypesSchema> & {
19
+ /** Base URL for Zapier API */
20
+ baseUrl?: string;
21
+ /** Authentication token */
22
+ token?: string;
23
+ /** Optional pre-instantiated API client */
24
+ api?: any;
25
+ /** Custom fetch implementation */
26
+ fetch?: typeof globalThis.fetch;
27
+ };
28
+ export interface GenerateTypesSdkFunction {
29
+ generateTypes: (options: GenerateTypesOptions) => Promise<string>;
30
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenerateTypesSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const properties_1 = require("../../types/properties");
6
+ // Pure Zod schema - no resolver metadata!
7
+ exports.GenerateTypesSchema = zod_1.z
8
+ .object({
9
+ appKey: properties_1.AppKeyPropertySchema.describe("App key to generate SDK code for"),
10
+ authenticationId: properties_1.AuthenticationIdPropertySchema.optional(),
11
+ output: properties_1.OutputPropertySchema.optional().describe("Output file path (defaults to generated/<appKey>.ts)"),
12
+ debug: properties_1.DebugPropertySchema.describe("Enable debug logging during generation"),
13
+ })
14
+ .describe("Generate TypeScript SDK code for a specific app");
@@ -1,9 +1,5 @@
1
- import type { Action, FunctionConfig } from "../types";
2
- export interface GetActionOptions extends FunctionConfig {
3
- app: string;
4
- action: string;
5
- type: string;
6
- }
1
+ import type { Action } from "../../types/domain";
2
+ import type { GetActionOptions } from "./schemas";
7
3
  /**
8
4
  * Get a specific action by app, action key, and type
9
5
  *
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAction = getAction;
4
- const listActions_1 = require("./listActions");
4
+ const listActions_1 = require("../listActions");
5
5
  /**
6
6
  * Get a specific action by app, action key, and type
7
7
  *
@@ -12,14 +12,15 @@ const listActions_1 = require("./listActions");
12
12
  * @returns Promise<Action>
13
13
  */
14
14
  async function getAction(options) {
15
- const { app, action: actionKey, type } = options;
15
+ const { appKey, actionKey, actionType } = options;
16
16
  const actions = await (0, listActions_1.listActions)({
17
17
  ...options,
18
- appKey: app,
18
+ appKey: appKey,
19
19
  });
20
- const action = actions.find((a) => a.key === actionKey && a.type === type);
20
+ const action = actions.find((a) => a.key === actionKey && a.type === actionType);
21
21
  if (!action) {
22
- throw new Error(`Action not found: ${actionKey} with type ${type}`);
22
+ throw new Error(`Action not found: ${actionKey} with type ${actionType}`);
23
23
  }
24
24
  return action;
25
25
  }
26
+ // No registry info here - moved to info.ts for proper tree-shaking
@@ -0,0 +1,18 @@
1
+ import { getAction } from "./index";
2
+ export declare const getActionInfo: {
3
+ name: string;
4
+ inputSchema: import("zod").ZodObject<{
5
+ appKey: import("zod").ZodString;
6
+ actionType: import("zod").ZodEnum<["read", "write", "search", "create", "update", "delete"]>;
7
+ actionKey: import("zod").ZodString;
8
+ }, "strip", import("zod").ZodTypeAny, {
9
+ appKey: string;
10
+ actionType: "create" | "update" | "search" | "delete" | "read" | "write";
11
+ actionKey: string;
12
+ }, {
13
+ appKey: string;
14
+ actionType: "create" | "update" | "search" | "delete" | "read" | "write";
15
+ actionKey: string;
16
+ }>;
17
+ implementation: typeof getAction;
18
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getActionInfo = void 0;
4
+ const index_1 = require("./index");
5
+ const schemas_1 = require("./schemas");
6
+ // Function registry info - imports both function and schema
7
+ exports.getActionInfo = {
8
+ name: index_1.getAction.name,
9
+ inputSchema: schemas_1.GetActionSchema,
10
+ implementation: index_1.getAction,
11
+ };
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ import type { Action } from "../../types/domain";
3
+ export declare const GetActionSchema: z.ZodObject<{
4
+ appKey: z.ZodString;
5
+ actionType: z.ZodEnum<["read", "write", "search", "create", "update", "delete"]>;
6
+ actionKey: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ appKey: string;
9
+ actionType: "create" | "update" | "search" | "delete" | "read" | "write";
10
+ actionKey: string;
11
+ }, {
12
+ appKey: string;
13
+ actionType: "create" | "update" | "search" | "delete" | "read" | "write";
14
+ actionKey: string;
15
+ }>;
16
+ export type GetActionOptions = z.infer<typeof GetActionSchema> & {
17
+ /** Base URL for Zapier API */
18
+ baseUrl?: string;
19
+ /** Authentication token */
20
+ token?: string;
21
+ /** Optional pre-instantiated API client */
22
+ api?: any;
23
+ /** Enable debug logging */
24
+ debug?: boolean;
25
+ /** Custom fetch implementation */
26
+ fetch?: typeof globalThis.fetch;
27
+ };
28
+ export interface GetActionSdkFunction {
29
+ getAction: (options: GetActionOptions) => Promise<Action>;
30
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetActionSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const properties_1 = require("../../types/properties");
6
+ // Pure Zod schema - no resolver metadata!
7
+ exports.GetActionSchema = zod_1.z
8
+ .object({
9
+ appKey: properties_1.AppKeyPropertySchema,
10
+ actionType: properties_1.ActionTypePropertySchema,
11
+ actionKey: properties_1.ActionKeyPropertySchema,
12
+ })
13
+ .describe("Get detailed information about a specific action");
@@ -1,7 +1,5 @@
1
- import type { Integration, FunctionConfig } from "../types";
2
- export interface GetAppOptions extends FunctionConfig {
3
- key: string;
4
- }
1
+ import type { Integration } from "../../types/domain";
2
+ import type { GetAppOptions } from "./schemas";
5
3
  /**
6
4
  * Get a specific app by key
7
5
  *
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getApp = getApp;
4
- const api_1 = require("../api");
4
+ const api_1 = require("../../api");
5
+ const domain_1 = require("../../types/domain");
5
6
  /**
6
7
  * Get a specific app by key
7
8
  *
@@ -13,17 +14,11 @@ const api_1 = require("../api");
13
14
  */
14
15
  async function getApp(options) {
15
16
  const api = (0, api_1.getOrCreateApiClient)(options);
16
- const { key } = options;
17
- const app = await api.get(`/api/v4/apps/${key}/`, {
17
+ const { appKey } = options;
18
+ const app = await api.get(`/api/v4/apps/${appKey}/`, {
18
19
  customErrorHandler: (response) => {
19
20
  if (response.status === 404) {
20
- const AppNotFoundError = class extends Error {
21
- constructor(appKey) {
22
- super(`App not found: ${appKey}`);
23
- this.name = "AppNotFoundError";
24
- }
25
- };
26
- return new AppNotFoundError(key);
21
+ return new domain_1.AppNotFoundError(appKey);
27
22
  }
28
23
  return undefined;
29
24
  },
@@ -39,3 +34,4 @@ async function getApp(options) {
39
34
  current_implementation_id: app.current_implementation_id,
40
35
  };
41
36
  }
37
+ // No registry info here - moved to info.ts for proper tree-shaking
@@ -0,0 +1,12 @@
1
+ import { getApp } from "./index";
2
+ export declare const getAppInfo: {
3
+ name: string;
4
+ inputSchema: import("zod").ZodObject<{
5
+ appKey: import("zod").ZodString;
6
+ }, "strip", import("zod").ZodTypeAny, {
7
+ appKey: string;
8
+ }, {
9
+ appKey: string;
10
+ }>;
11
+ implementation: typeof getApp;
12
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAppInfo = void 0;
4
+ const index_1 = require("./index");
5
+ const schemas_1 = require("./schemas");
6
+ // Function registry info - imports both function and schema
7
+ exports.getAppInfo = {
8
+ name: index_1.getApp.name,
9
+ inputSchema: schemas_1.GetAppSchema,
10
+ implementation: index_1.getApp,
11
+ };
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ import type { Integration } from "../../types/domain";
3
+ export declare const GetAppSchema: z.ZodObject<{
4
+ appKey: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ appKey: string;
7
+ }, {
8
+ appKey: string;
9
+ }>;
10
+ export type GetAppOptions = z.infer<typeof GetAppSchema> & {
11
+ /** Base URL for Zapier API */
12
+ baseUrl?: string;
13
+ /** Authentication token */
14
+ token?: string;
15
+ /** Optional pre-instantiated API client */
16
+ api?: any;
17
+ /** Enable debug logging */
18
+ debug?: boolean;
19
+ /** Custom fetch implementation */
20
+ fetch?: typeof globalThis.fetch;
21
+ };
22
+ export interface GetAppSdkFunction {
23
+ getApp: (options: GetAppOptions) => Promise<Integration>;
24
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetAppSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const properties_1 = require("../../types/properties");
6
+ // Pure Zod schema - no resolver metadata!
7
+ exports.GetAppSchema = zod_1.z
8
+ .object({
9
+ appKey: properties_1.AppKeyPropertySchema.describe("App key or slug to fetch (e.g., google-sheets, slack, github)"),
10
+ })
11
+ .describe("Get detailed information about a specific app");
@@ -1,8 +1,5 @@
1
- import type { Action, FunctionConfig } from "../types";
2
- export interface ListActionsOptions extends FunctionConfig {
3
- appKey?: string;
4
- type?: string;
5
- }
1
+ import type { Action } from "../../types/domain";
2
+ import type { ListActionsOptions } from "./schemas";
6
3
  /**
7
4
  * List available actions with optional filtering
8
5
  *
@@ -12,4 +9,4 @@ export interface ListActionsOptions extends FunctionConfig {
12
9
  * @param options - Filtering and API configuration options
13
10
  * @returns Promise<Action[]> with pagination metadata
14
11
  */
15
- export declare function listActions(options?: ListActionsOptions): Promise<Action[]>;
12
+ export declare function listActions(options?: Partial<ListActionsOptions>): Promise<Action[]>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.listActions = listActions;
4
- const api_1 = require("../api");
5
- const getApp_1 = require("./getApp");
4
+ const api_1 = require("../../api");
5
+ const getApp_1 = require("../getApp");
6
6
  /**
7
7
  * List available actions with optional filtering
8
8
  *
@@ -19,7 +19,7 @@ async function listActions(options = {}) {
19
19
  try {
20
20
  // Use the standalone getApp function
21
21
  const appData = await (0, getApp_1.getApp)({
22
- key: options.appKey,
22
+ appKey: options.appKey,
23
23
  api,
24
24
  token: options.token,
25
25
  baseUrl: options.baseUrl,
@@ -125,3 +125,4 @@ async function listActions(options = {}) {
125
125
  }
126
126
  return actions;
127
127
  }
128
+ // No registry info here - moved to info.ts for proper tree-shaking
@@ -0,0 +1,15 @@
1
+ import { listActions } from "./index";
2
+ export declare const listActionsInfo: {
3
+ name: string;
4
+ inputSchema: import("zod").ZodObject<{
5
+ appKey: import("zod").ZodOptional<import("zod").ZodString>;
6
+ type: import("zod").ZodOptional<import("zod").ZodEnum<["read", "write", "search", "create", "update", "delete"]>>;
7
+ }, "strip", import("zod").ZodTypeAny, {
8
+ type?: "create" | "update" | "search" | "delete" | "read" | "write" | undefined;
9
+ appKey?: string | undefined;
10
+ }, {
11
+ type?: "create" | "update" | "search" | "delete" | "read" | "write" | undefined;
12
+ appKey?: string | undefined;
13
+ }>;
14
+ implementation: typeof listActions;
15
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listActionsInfo = void 0;
4
+ const index_1 = require("./index");
5
+ const schemas_1 = require("./schemas");
6
+ // Function registry info - imports both function and schema
7
+ exports.listActionsInfo = {
8
+ name: index_1.listActions.name,
9
+ inputSchema: schemas_1.ListActionsSchema,
10
+ implementation: index_1.listActions,
11
+ };
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ import type { Action } from "../../types/domain";
3
+ export declare const ListActionsSchema: z.ZodObject<{
4
+ appKey: z.ZodOptional<z.ZodString>;
5
+ type: z.ZodOptional<z.ZodEnum<["read", "write", "search", "create", "update", "delete"]>>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ type?: "create" | "update" | "search" | "delete" | "read" | "write" | undefined;
8
+ appKey?: string | undefined;
9
+ }, {
10
+ type?: "create" | "update" | "search" | "delete" | "read" | "write" | undefined;
11
+ appKey?: string | undefined;
12
+ }>;
13
+ export type ListActionsOptions = z.infer<typeof ListActionsSchema> & {
14
+ /** Base URL for Zapier API */
15
+ baseUrl?: string;
16
+ /** Authentication token */
17
+ token?: string;
18
+ /** Optional pre-instantiated API client */
19
+ api?: any;
20
+ /** Enable debug logging */
21
+ debug?: boolean;
22
+ /** Custom fetch implementation */
23
+ fetch?: typeof globalThis.fetch;
24
+ };
25
+ export interface ListActionsSdkFunction {
26
+ listActions: (options?: Partial<ListActionsOptions>) => Promise<Action[]>;
27
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListActionsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const properties_1 = require("../../types/properties");
6
+ const schema_utils_1 = require("../../schema-utils");
7
+ const Action_1 = require("../../schemas/Action");
8
+ // Pure Zod schema - no resolver metadata!
9
+ exports.ListActionsSchema = (0, schema_utils_1.withOutputSchema)(zod_1.z
10
+ .object({
11
+ appKey: properties_1.AppKeyPropertySchema.optional(),
12
+ type: properties_1.ActionTypePropertySchema.optional().describe("Filter actions by type"),
13
+ })
14
+ .describe("List all actions for a specific app"), Action_1.ActionItemSchema);
@@ -1,9 +1,5 @@
1
- import type { Integration, FunctionConfig } from "../types";
2
- export interface ListAppsOptions extends FunctionConfig {
3
- category?: string;
4
- limit?: number;
5
- offset?: number;
6
- }
1
+ import type { Integration } from "../../types/domain";
2
+ import type { ListAppsOptions } from "./schemas";
7
3
  /**
8
4
  * List available apps with optional filtering
9
5
  *
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.listApps = listApps;
4
- const api_1 = require("../api");
4
+ const api_1 = require("../../api");
5
5
  /**
6
6
  * List available apps with optional filtering
7
7
  *
@@ -0,0 +1,18 @@
1
+ import { listApps } from "./index";
2
+ export declare const listAppsInfo: {
3
+ name: string;
4
+ inputSchema: import("zod").ZodObject<{
5
+ category: import("zod").ZodOptional<import("zod").ZodString>;
6
+ limit: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
7
+ offset: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
8
+ }, "strip", import("zod").ZodTypeAny, {
9
+ category?: string | undefined;
10
+ limit?: number | undefined;
11
+ offset?: number | undefined;
12
+ }, {
13
+ category?: string | undefined;
14
+ limit?: number | undefined;
15
+ offset?: number | undefined;
16
+ }>;
17
+ implementation: typeof listApps;
18
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listAppsInfo = void 0;
4
+ const index_1 = require("./index");
5
+ const schemas_1 = require("./schemas");
6
+ // Function registry info - imports both function and schema
7
+ exports.listAppsInfo = {
8
+ name: index_1.listApps.name,
9
+ inputSchema: schemas_1.ListAppsSchema,
10
+ implementation: index_1.listApps,
11
+ };