@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
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ import type { Integration } from "../../types/domain";
3
+ export declare const ListAppsSchema: z.ZodObject<{
4
+ category: z.ZodOptional<z.ZodString>;
5
+ limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
6
+ offset: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ category?: string | undefined;
9
+ limit?: number | undefined;
10
+ offset?: number | undefined;
11
+ }, {
12
+ category?: string | undefined;
13
+ limit?: number | undefined;
14
+ offset?: number | undefined;
15
+ }>;
16
+ export type ListAppsOptions = z.infer<typeof ListAppsSchema> & {
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 ListAppsSdkFunction {
29
+ listApps: (options?: Partial<ListAppsOptions>) => Promise<Integration[]>;
30
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListAppsSchema = 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 App_1 = require("../../schemas/App");
8
+ // Pure Zod schema - no resolver metadata!
9
+ exports.ListAppsSchema = (0, schema_utils_1.withOutputSchema)(zod_1.z
10
+ .object({
11
+ category: zod_1.z.string().optional().describe("Filter apps by category"),
12
+ limit: properties_1.LimitPropertySchema.optional().describe("Maximum number of items to return (1-200)"),
13
+ offset: properties_1.OffsetPropertySchema.optional().describe("Number of items to skip for pagination"),
14
+ })
15
+ .describe("List all available apps with optional filtering"), App_1.AppItemSchema);
@@ -1,11 +1,5 @@
1
- import type { Authentication, FunctionConfig } from "../types";
2
- export interface ListAuthsOptions extends FunctionConfig {
3
- appKey?: string;
4
- account_id?: string;
5
- owner?: string;
6
- limit?: number;
7
- offset?: number;
8
- }
1
+ import type { Authentication } from "../../types/domain";
2
+ import type { ListAuthsOptions } from "./schemas";
9
3
  /**
10
4
  * List available authentications with optional filtering
11
5
  *
@@ -15,4 +9,4 @@ export interface ListAuthsOptions extends FunctionConfig {
15
9
  * @param options - Filtering, pagination, and API configuration options
16
10
  * @returns Promise<Authentication[]> with pagination metadata
17
11
  */
18
- export declare function listAuths(options?: ListAuthsOptions): Promise<Authentication[]>;
12
+ export declare function listAuths(options?: Partial<ListAuthsOptions>): Promise<Authentication[]>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.listAuths = listAuths;
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 authentications with optional filtering
8
8
  *
@@ -27,7 +27,7 @@ async function listAuths(options = {}) {
27
27
  try {
28
28
  // Use the standalone getApp function
29
29
  const app = await (0, getApp_1.getApp)({
30
- key: options.appKey,
30
+ appKey: options.appKey,
31
31
  api,
32
32
  token: options.token,
33
33
  baseUrl: options.baseUrl,
@@ -107,8 +107,8 @@ async function listAuths(options = {}) {
107
107
  owner: undefined,
108
108
  });
109
109
  // Filter out auths the user already owns to avoid duplicates
110
- const ownedAuthIds = new Set(ownedAuths.map((auth) => auth.id));
111
- const additionalAuths = allAuths.filter((auth) => !ownedAuthIds.has(auth.id));
110
+ const ownedAuthenticationIds = new Set(ownedAuths.map((auth) => auth.id));
111
+ const additionalAuths = allAuths.filter((auth) => !ownedAuthenticationIds.has(auth.id));
112
112
  // Combine and slice to the requested limit
113
113
  const combined = [...ownedAuths, ...additionalAuths];
114
114
  return combined.slice(0, options.limit);
@@ -0,0 +1,24 @@
1
+ import { listAuths } from "./index";
2
+ export declare const listAuthsInfo: {
3
+ name: string;
4
+ inputSchema: import("zod").ZodObject<{
5
+ appKey: import("zod").ZodOptional<import("zod").ZodString>;
6
+ account_id: import("zod").ZodOptional<import("zod").ZodString>;
7
+ owner: import("zod").ZodOptional<import("zod").ZodString>;
8
+ limit: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
9
+ offset: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
10
+ }, "strip", import("zod").ZodTypeAny, {
11
+ appKey?: string | undefined;
12
+ account_id?: string | undefined;
13
+ owner?: string | undefined;
14
+ limit?: number | undefined;
15
+ offset?: number | undefined;
16
+ }, {
17
+ appKey?: string | undefined;
18
+ account_id?: string | undefined;
19
+ owner?: string | undefined;
20
+ limit?: number | undefined;
21
+ offset?: number | undefined;
22
+ }>;
23
+ implementation: typeof listAuths;
24
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listAuthsInfo = 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.listAuthsInfo = {
8
+ name: index_1.listAuths.name,
9
+ inputSchema: schemas_1.ListAuthsSchema,
10
+ implementation: index_1.listAuths,
11
+ };
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ import type { Authentication } from "../../types/domain";
3
+ export declare const ListAuthsSchema: z.ZodObject<{
4
+ appKey: z.ZodOptional<z.ZodString>;
5
+ account_id: z.ZodOptional<z.ZodString>;
6
+ owner: z.ZodOptional<z.ZodString>;
7
+ limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
8
+ offset: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ appKey?: string | undefined;
11
+ account_id?: string | undefined;
12
+ owner?: string | undefined;
13
+ limit?: number | undefined;
14
+ offset?: number | undefined;
15
+ }, {
16
+ appKey?: string | undefined;
17
+ account_id?: string | undefined;
18
+ owner?: string | undefined;
19
+ limit?: number | undefined;
20
+ offset?: number | undefined;
21
+ }>;
22
+ export type ListAuthsOptions = z.infer<typeof ListAuthsSchema> & {
23
+ /** Base URL for Zapier API */
24
+ baseUrl?: string;
25
+ /** Authentication token */
26
+ token?: string;
27
+ /** Optional pre-instantiated API client */
28
+ api?: any;
29
+ /** Enable debug logging */
30
+ debug?: boolean;
31
+ /** Custom fetch implementation */
32
+ fetch?: typeof globalThis.fetch;
33
+ };
34
+ export interface ListAuthsSdkFunction {
35
+ listAuths: (options?: Partial<ListAuthsOptions>) => Promise<Authentication[]>;
36
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListAuthsSchema = 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 Auth_1 = require("../../schemas/Auth");
8
+ // Pure Zod schema - no resolver metadata!
9
+ exports.ListAuthsSchema = (0, schema_utils_1.withOutputSchema)(zod_1.z
10
+ .object({
11
+ appKey: properties_1.AppKeyPropertySchema.optional().describe("App slug to get authentications for (e.g., 'slack', 'github')"),
12
+ account_id: zod_1.z.string().optional().describe("Filter by account ID"),
13
+ owner: zod_1.z.string().optional().describe("Filter by owner"),
14
+ limit: properties_1.LimitPropertySchema.optional().describe("Maximum number of items to return (1-200)"),
15
+ offset: properties_1.OffsetPropertySchema.optional().describe("Number of items to skip for pagination"),
16
+ })
17
+ .describe("List available authentications with optional filtering"), Auth_1.AuthItemSchema);
@@ -1,18 +1,12 @@
1
- import type { ActionField, FunctionConfig } from "../types";
2
- export interface ListFieldsOptions extends FunctionConfig {
3
- app: string;
4
- action: string;
5
- type: string;
6
- authId?: number;
7
- params?: Record<string, any>;
8
- }
1
+ import type { ActionField } from "../../types/domain";
2
+ import type { ListFieldsOptions } from "./schemas";
9
3
  /**
10
4
  * List available fields for an action
11
5
  *
12
6
  * This function can be used standalone without instantiating a full SDK,
13
7
  * which enables better tree-shaking in applications that only need this functionality.
14
8
  *
15
- * @param options - Action details, auth ID, params, and API configuration options
9
+ * @param options - Action details, authentication ID, params, and API configuration options
16
10
  * @returns Promise<ActionField[]>
17
11
  */
18
12
  export declare function listFields(options: ListFieldsOptions): Promise<ActionField[]>;
@@ -1,27 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.listFields = listFields;
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 fields for an action
8
8
  *
9
9
  * This function can be used standalone without instantiating a full SDK,
10
10
  * which enables better tree-shaking in applications that only need this functionality.
11
11
  *
12
- * @param options - Action details, auth ID, params, and API configuration options
12
+ * @param options - Action details, authentication ID, params, and API configuration options
13
13
  * @returns Promise<ActionField[]>
14
14
  */
15
15
  async function listFields(options) {
16
16
  const api = (0, api_1.getOrCreateApiClient)(options);
17
- // Map consistent parameter names to internal API names
18
- const { app, action, type, authId, params } = options;
19
- const appKey = app;
20
- const actionKey = action;
21
- const actionType = type;
17
+ // Extract parameters
18
+ const { appKey, actionKey, actionType, authenticationId, params } = options;
22
19
  // Use the standalone getApp function
23
20
  const appData = await (0, getApp_1.getApp)({
24
- key: appKey,
21
+ appKey,
25
22
  api,
26
23
  token: options.token,
27
24
  baseUrl: options.baseUrl,
@@ -37,7 +34,7 @@ async function listFields(options) {
37
34
  selected_api: selectedApi,
38
35
  action: actionKey,
39
36
  type_of: actionType,
40
- authentication_id: authId,
37
+ authentication_id: authenticationId,
41
38
  params: params || {},
42
39
  };
43
40
  const needsData = await api.post("/api/v4/implementations/needs/", needsRequest);
@@ -65,3 +62,4 @@ async function listFields(options) {
65
62
  inputFormat: need.input_format,
66
63
  }));
67
64
  }
65
+ // No registry info here - moved to info.ts for proper tree-shaking
@@ -0,0 +1,24 @@
1
+ import { listFields } from "./index";
2
+ export declare const listFieldsInfo: {
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
+ authenticationId: import("zod").ZodOptional<import("zod").ZodNumber>;
9
+ params: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
10
+ }, "strip", import("zod").ZodTypeAny, {
11
+ appKey: string;
12
+ actionType: "create" | "update" | "search" | "delete" | "read" | "write";
13
+ actionKey: string;
14
+ params?: Record<string, any> | undefined;
15
+ authenticationId?: number | undefined;
16
+ }, {
17
+ appKey: string;
18
+ actionType: "create" | "update" | "search" | "delete" | "read" | "write";
19
+ actionKey: string;
20
+ params?: Record<string, any> | undefined;
21
+ authenticationId?: number | undefined;
22
+ }>;
23
+ implementation: typeof listFields;
24
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listFieldsInfo = 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.listFieldsInfo = {
8
+ name: index_1.listFields.name,
9
+ inputSchema: schemas_1.ListFieldsSchema,
10
+ implementation: index_1.listFields,
11
+ };
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ import type { ActionField } from "../../types/domain";
3
+ export declare const ListFieldsSchema: z.ZodObject<{
4
+ appKey: z.ZodString;
5
+ actionType: z.ZodEnum<["read", "write", "search", "create", "update", "delete"]>;
6
+ actionKey: z.ZodString;
7
+ authenticationId: z.ZodOptional<z.ZodNumber>;
8
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ appKey: string;
11
+ actionType: "create" | "update" | "search" | "delete" | "read" | "write";
12
+ actionKey: string;
13
+ params?: Record<string, any> | undefined;
14
+ authenticationId?: number | undefined;
15
+ }, {
16
+ appKey: string;
17
+ actionType: "create" | "update" | "search" | "delete" | "read" | "write";
18
+ actionKey: string;
19
+ params?: Record<string, any> | undefined;
20
+ authenticationId?: number | undefined;
21
+ }>;
22
+ export type ListFieldsOptions = z.infer<typeof ListFieldsSchema> & {
23
+ /** Base URL for Zapier API */
24
+ baseUrl?: string;
25
+ /** Authentication token */
26
+ token?: string;
27
+ /** Optional pre-instantiated API client */
28
+ api?: any;
29
+ /** Enable debug logging */
30
+ debug?: boolean;
31
+ /** Custom fetch implementation */
32
+ fetch?: typeof globalThis.fetch;
33
+ };
34
+ export interface ListFieldsSdkFunction {
35
+ listFields: (options: ListFieldsOptions) => Promise<ActionField[]>;
36
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListFieldsSchema = 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 Field_1 = require("../../schemas/Field");
8
+ // Pure Zod schema - no resolver metadata!
9
+ exports.ListFieldsSchema = (0, schema_utils_1.withOutputSchema)(zod_1.z
10
+ .object({
11
+ appKey: properties_1.AppKeyPropertySchema,
12
+ actionType: properties_1.ActionTypePropertySchema,
13
+ actionKey: properties_1.ActionKeyPropertySchema,
14
+ authenticationId: properties_1.AuthenticationIdPropertySchema.optional(),
15
+ params: properties_1.ParamsPropertySchema.optional().describe("Additional parameters that may affect available fields"),
16
+ })
17
+ .describe("Get the input fields required for a specific action"), Field_1.FieldItemSchema);
@@ -1,11 +1,5 @@
1
- import type { ActionExecutionResult, FunctionConfig } from "../types";
2
- export interface RunActionOptions extends FunctionConfig {
3
- app: string;
4
- type: string;
5
- action: string;
6
- inputs?: Record<string, any>;
7
- authId?: number;
8
- }
1
+ import type { ActionExecutionResult } from "../../types/domain";
2
+ import type { RunActionOptions } from "./schemas";
9
3
  /**
10
4
  * Execute an action
11
5
  *
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runAction = runAction;
4
- const api_1 = require("../api");
5
- const getAction_1 = require("./getAction");
6
- const getApp_1 = require("./getApp");
4
+ const api_1 = require("../../api");
5
+ const getAction_1 = require("../getAction");
6
+ const getApp_1 = require("../getApp");
7
7
  /**
8
8
  * Execute an action
9
9
  *
@@ -14,7 +14,7 @@ const getApp_1 = require("./getApp");
14
14
  * @returns Promise<ActionExecutionResult>
15
15
  */
16
16
  async function runAction(options) {
17
- const { app, type, action, inputs, authId: providedAuthId, token } = options;
17
+ const { appKey, actionType, actionKey, inputs, authenticationId: providedAuthenticationId, token, } = options;
18
18
  if (!token && !process.env.ZAPIER_TOKEN) {
19
19
  throw new Error("Authentication token is required to run actions. Please provide token in options or set ZAPIER_TOKEN environment variable.");
20
20
  }
@@ -22,24 +22,24 @@ async function runAction(options) {
22
22
  // Validate that the action exists
23
23
  const actionData = await (0, getAction_1.getAction)({
24
24
  ...options,
25
- app: app,
26
- action: action,
27
- type: type,
25
+ appKey: appKey,
26
+ actionKey: actionKey,
27
+ actionType: actionType,
28
28
  });
29
29
  // Validate action type matches
30
- if (actionData.type !== type) {
31
- throw new Error(`Action type mismatch: expected ${type}, got ${actionData.type}`);
30
+ if (actionData.type !== actionType) {
31
+ throw new Error(`Action type mismatch: expected ${actionType}, got ${actionData.type}`);
32
32
  }
33
33
  // Execute the action using the appropriate API based on action type
34
34
  const startTime = Date.now();
35
35
  const result = await executeActionWithStrategy({
36
36
  api,
37
- appSlug: app,
38
- actionKey: action,
37
+ appSlug: appKey,
38
+ actionKey: actionKey,
39
39
  actionType: actionData.type,
40
40
  executionOptions: { inputs: inputs || {} },
41
41
  auth: token
42
- ? { token: token, authentication_id: providedAuthId }
42
+ ? { token: token, authentication_id: providedAuthenticationId }
43
43
  : undefined,
44
44
  options,
45
45
  });
@@ -86,7 +86,7 @@ async function executeActionViaActionsApi(apiOptions) {
86
86
  const { api, appSlug, actionKey, actionType, executionOptions, auth, options, } = apiOptions;
87
87
  // Use the standalone getApp function
88
88
  const appData = await (0, getApp_1.getApp)({
89
- key: appSlug,
89
+ appKey: appSlug,
90
90
  api,
91
91
  token: options.token,
92
92
  baseUrl: options.baseUrl,
@@ -123,7 +123,7 @@ async function executeActionViaInvokeApi(apiOptions) {
123
123
  const { api, appSlug, actionKey, actionType, executionOptions, auth, options, } = apiOptions;
124
124
  // Use the standalone getApp function
125
125
  const appData = await (0, getApp_1.getApp)({
126
- key: appSlug,
126
+ appKey: appSlug,
127
127
  api,
128
128
  token: options.token,
129
129
  baseUrl: options.baseUrl,
@@ -154,3 +154,4 @@ async function executeActionViaInvokeApi(apiOptions) {
154
154
  resultExtractor: (result) => result.results || result,
155
155
  });
156
156
  }
157
+ // No registry info here - moved to info.ts for proper tree-shaking
@@ -0,0 +1,24 @@
1
+ import { runAction } from "./index";
2
+ export declare const runActionInfo: {
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
+ inputs: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
9
+ authenticationId: import("zod").ZodOptional<import("zod").ZodNumber>;
10
+ }, "strip", import("zod").ZodTypeAny, {
11
+ appKey: string;
12
+ actionType: "create" | "update" | "search" | "delete" | "read" | "write";
13
+ actionKey: string;
14
+ inputs?: Record<string, any> | undefined;
15
+ authenticationId?: number | undefined;
16
+ }, {
17
+ appKey: string;
18
+ actionType: "create" | "update" | "search" | "delete" | "read" | "write";
19
+ actionKey: string;
20
+ inputs?: Record<string, any> | undefined;
21
+ authenticationId?: number | undefined;
22
+ }>;
23
+ implementation: typeof runAction;
24
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runActionInfo = 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.runActionInfo = {
8
+ name: index_1.runAction.name,
9
+ inputSchema: schemas_1.RunActionSchema,
10
+ implementation: index_1.runAction,
11
+ };
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ import type { ActionExecutionResult } from "../../types/domain";
3
+ export declare const RunActionSchema: z.ZodObject<{
4
+ appKey: z.ZodString;
5
+ actionType: z.ZodEnum<["read", "write", "search", "create", "update", "delete"]>;
6
+ actionKey: z.ZodString;
7
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
8
+ authenticationId: z.ZodOptional<z.ZodNumber>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ appKey: string;
11
+ actionType: "create" | "update" | "search" | "delete" | "read" | "write";
12
+ actionKey: string;
13
+ inputs?: Record<string, any> | undefined;
14
+ authenticationId?: number | undefined;
15
+ }, {
16
+ appKey: string;
17
+ actionType: "create" | "update" | "search" | "delete" | "read" | "write";
18
+ actionKey: string;
19
+ inputs?: Record<string, any> | undefined;
20
+ authenticationId?: number | undefined;
21
+ }>;
22
+ export type RunActionOptions = z.infer<typeof RunActionSchema> & {
23
+ /** Base URL for Zapier API */
24
+ baseUrl?: string;
25
+ /** Authentication token */
26
+ token?: string;
27
+ /** Optional pre-instantiated API client */
28
+ api?: any;
29
+ /** Enable debug logging */
30
+ debug?: boolean;
31
+ /** Custom fetch implementation */
32
+ fetch?: typeof globalThis.fetch;
33
+ };
34
+ export interface RunActionSdkFunction {
35
+ runAction: (options: RunActionOptions) => Promise<ActionExecutionResult>;
36
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RunActionSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const properties_1 = require("../../types/properties");
6
+ // Pure Zod schema - no resolver metadata!
7
+ exports.RunActionSchema = zod_1.z
8
+ .object({
9
+ appKey: properties_1.AppKeyPropertySchema,
10
+ actionType: properties_1.ActionTypePropertySchema,
11
+ actionKey: properties_1.ActionKeyPropertySchema,
12
+ inputs: properties_1.InputsPropertySchema.optional().describe("Input parameters for the action"),
13
+ authenticationId: properties_1.AuthenticationIdPropertySchema.optional(),
14
+ })
15
+ .describe("Execute an action with the given inputs");
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- export * from "./types";
2
- export * from "./actions-sdk";
1
+ export * from "./types/domain";
2
+ export * from "./types/properties";
3
+ export * from "./plugins/apps";
4
+ export * from "./resolvers";
3
5
  export { listAuths } from "./functions/listAuths";
4
6
  export { listApps } from "./functions/listApps";
5
7
  export { getApp } from "./functions/getApp";
@@ -9,4 +11,5 @@ export { runAction } from "./functions/runAction";
9
11
  export { listFields } from "./functions/listFields";
10
12
  export { generateTypes } from "./functions/generateTypes";
11
13
  export { bundleCode } from "./functions/bundleCode";
12
- export { createZapierSdk, ZapierSdk, ZapierSdkOptions } from "./sdk";
14
+ export { createZapierSdk, ZapierSdkOptions } from "./sdk";
15
+ export type { ZapierSdk } from "./types/sdk";
package/dist/index.js CHANGED
@@ -15,9 +15,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.createZapierSdk = exports.bundleCode = exports.generateTypes = exports.listFields = exports.runAction = exports.getAction = exports.listActions = exports.getApp = exports.listApps = exports.listAuths = void 0;
18
- // Export everything from types and actions-sdk
19
- __exportStar(require("./types"), exports);
20
- __exportStar(require("./actions-sdk"), exports);
18
+ // Export everything from types and plugins
19
+ __exportStar(require("./types/domain"), exports);
20
+ __exportStar(require("./types/properties"), exports);
21
+ __exportStar(require("./plugins/apps"), exports);
22
+ // Export resolvers for CLI use
23
+ __exportStar(require("./resolvers"), exports);
24
+ // Note: SdkSchemas is now available via SDK.__registry
21
25
  // Export individual functions for tree-shaking
22
26
  var listAuths_1 = require("./functions/listAuths");
23
27
  Object.defineProperty(exports, "listAuths", { enumerable: true, get: function () { return listAuths_1.listAuths; } });
@@ -0,0 +1,8 @@
1
+ import { type ApiClient } from "../../api";
2
+ import type { ActionProxy } from "./types";
3
+ export interface AppsPluginOptions {
4
+ api: ApiClient;
5
+ token?: string;
6
+ }
7
+ export declare function createAppsPlugin(options: AppsPluginOptions): ActionProxy;
8
+ export type { ActionProxy, AppsPluginSdkExtension } from "./types";