@zapier/zapier-sdk 0.0.3 → 0.1.1

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 (189) 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/findFirstAuthentication/index.d.ts +12 -0
  19. package/dist/functions/findFirstAuthentication/index.js +21 -0
  20. package/dist/functions/findFirstAuthentication/info.d.ts +30 -0
  21. package/dist/functions/findFirstAuthentication/info.js +11 -0
  22. package/dist/functions/findFirstAuthentication/schemas.d.ts +42 -0
  23. package/dist/functions/findFirstAuthentication/schemas.js +25 -0
  24. package/dist/functions/findUniqueAuthentication/index.d.ts +13 -0
  25. package/dist/functions/findUniqueAuthentication/index.js +28 -0
  26. package/dist/functions/findUniqueAuthentication/info.d.ts +30 -0
  27. package/dist/functions/findUniqueAuthentication/info.js +11 -0
  28. package/dist/functions/findUniqueAuthentication/schemas.d.ts +42 -0
  29. package/dist/functions/findUniqueAuthentication/schemas.js +25 -0
  30. package/dist/functions/{generateTypes.d.ts → generateTypes/index.d.ts} +2 -7
  31. package/dist/functions/{generateTypes.js → generateTypes/index.js} +58 -24
  32. package/dist/functions/generateTypes/info.d.ts +21 -0
  33. package/dist/functions/generateTypes/info.js +11 -0
  34. package/dist/functions/generateTypes/schemas.d.ts +30 -0
  35. package/dist/functions/generateTypes/schemas.js +14 -0
  36. package/dist/functions/{getAction.d.ts → getAction/index.d.ts} +2 -6
  37. package/dist/functions/{getAction.js → getAction/index.js} +6 -5
  38. package/dist/functions/getAction/info.d.ts +18 -0
  39. package/dist/functions/getAction/info.js +11 -0
  40. package/dist/functions/getAction/schemas.d.ts +30 -0
  41. package/dist/functions/getAction/schemas.js +13 -0
  42. package/dist/functions/{getApp.d.ts → getApp/index.d.ts} +2 -4
  43. package/dist/functions/{getApp.js → getApp/index.js} +6 -10
  44. package/dist/functions/getApp/info.d.ts +12 -0
  45. package/dist/functions/getApp/info.js +11 -0
  46. package/dist/functions/getApp/schemas.d.ts +24 -0
  47. package/dist/functions/getApp/schemas.js +11 -0
  48. package/dist/functions/{listActions.d.ts → listActions/index.d.ts} +3 -6
  49. package/dist/functions/{listActions.js → listActions/index.js} +4 -3
  50. package/dist/functions/listActions/info.d.ts +15 -0
  51. package/dist/functions/listActions/info.js +11 -0
  52. package/dist/functions/listActions/schemas.d.ts +27 -0
  53. package/dist/functions/listActions/schemas.js +14 -0
  54. package/dist/functions/{listApps.d.ts → listApps/index.d.ts} +2 -6
  55. package/dist/functions/{listApps.js → listApps/index.js} +1 -1
  56. package/dist/functions/listApps/info.d.ts +18 -0
  57. package/dist/functions/listApps/info.js +11 -0
  58. package/dist/functions/listApps/schemas.d.ts +30 -0
  59. package/dist/functions/listApps/schemas.js +15 -0
  60. package/dist/functions/{listAuths.d.ts → listAuthentications/index.d.ts} +3 -9
  61. package/dist/functions/{listAuths.js → listAuthentications/index.js} +28 -12
  62. package/dist/functions/listAuthentications/info.d.ts +30 -0
  63. package/dist/functions/listAuthentications/info.js +11 -0
  64. package/dist/functions/listAuthentications/schemas.d.ts +42 -0
  65. package/dist/functions/listAuthentications/schemas.js +25 -0
  66. package/dist/functions/{listFields.d.ts → listFields/index.d.ts} +3 -9
  67. package/dist/functions/{listFields.js → listFields/index.js} +8 -10
  68. package/dist/functions/listFields/info.d.ts +24 -0
  69. package/dist/functions/listFields/info.js +11 -0
  70. package/dist/functions/listFields/schemas.d.ts +36 -0
  71. package/dist/functions/listFields/schemas.js +17 -0
  72. package/dist/functions/{runAction.d.ts → runAction/index.d.ts} +2 -8
  73. package/dist/functions/{runAction.js → runAction/index.js} +15 -14
  74. package/dist/functions/runAction/info.d.ts +24 -0
  75. package/dist/functions/runAction/info.js +11 -0
  76. package/dist/functions/runAction/schemas.d.ts +36 -0
  77. package/dist/functions/runAction/schemas.js +15 -0
  78. package/dist/index.d.ts +10 -4
  79. package/dist/index.js +17 -6
  80. package/dist/plugins/apps/index.d.ts +8 -0
  81. package/dist/plugins/apps/index.js +77 -0
  82. package/dist/plugins/apps/info.d.ts +6 -0
  83. package/dist/plugins/apps/info.js +13 -0
  84. package/dist/plugins/apps/types.d.ts +21 -0
  85. package/dist/plugins/apps/types.js +2 -0
  86. package/dist/resolvers/actionKey.d.ts +8 -0
  87. package/dist/resolvers/actionKey.js +20 -0
  88. package/dist/resolvers/actionType.d.ts +8 -0
  89. package/dist/resolvers/actionType.js +21 -0
  90. package/dist/resolvers/appKey.d.ts +6 -0
  91. package/dist/resolvers/appKey.js +8 -0
  92. package/dist/resolvers/authenticationId.d.ts +8 -0
  93. package/dist/resolvers/authenticationId.js +29 -0
  94. package/dist/resolvers/index.d.ts +39 -0
  95. package/dist/resolvers/index.js +105 -0
  96. package/dist/resolvers/inputs.d.ts +7 -0
  97. package/dist/resolvers/inputs.js +15 -0
  98. package/dist/schema-utils.d.ts +44 -0
  99. package/dist/schema-utils.js +76 -0
  100. package/dist/schemas/Action.d.ts +21 -0
  101. package/dist/schemas/Action.js +31 -0
  102. package/dist/schemas/App.d.ts +19 -0
  103. package/dist/schemas/App.js +32 -0
  104. package/dist/schemas/Auth.d.ts +27 -0
  105. package/dist/schemas/Auth.js +42 -0
  106. package/dist/schemas/Field.d.ts +15 -0
  107. package/dist/schemas/Field.js +25 -0
  108. package/dist/sdk.d.ts +3 -4
  109. package/dist/sdk.js +104 -11
  110. package/dist/types/domain.d.ts +22 -0
  111. package/dist/types/domain.js +21 -0
  112. package/dist/types/properties.d.ts +21 -0
  113. package/dist/types/properties.js +43 -0
  114. package/dist/types/sdk.d.ts +23 -0
  115. package/dist/types/sdk.js +2 -0
  116. package/package.json +4 -2
  117. package/src/api/auth.ts +28 -0
  118. package/src/api/client.ts +148 -0
  119. package/src/api/debug.ts +58 -0
  120. package/src/api/index.ts +83 -0
  121. package/src/api/polling.ts +56 -0
  122. package/src/api/types.ts +177 -0
  123. package/src/functions/{bundleCode.ts → bundleCode/index.ts} +1 -8
  124. package/src/functions/bundleCode/info.ts +9 -0
  125. package/src/functions/bundleCode/schemas.ts +30 -0
  126. package/src/functions/findFirstAuthentication/index.ts +24 -0
  127. package/src/functions/findFirstAuthentication/info.ts +9 -0
  128. package/src/functions/findFirstAuthentication/schemas.ts +60 -0
  129. package/src/functions/findUniqueAuthentication/index.ts +35 -0
  130. package/src/functions/findUniqueAuthentication/info.ts +9 -0
  131. package/src/functions/findUniqueAuthentication/schemas.ts +60 -0
  132. package/src/functions/{generateTypes.ts → generateTypes/index.ts} +70 -31
  133. package/src/functions/generateTypes/info.ts +9 -0
  134. package/src/functions/generateTypes/schemas.ts +38 -0
  135. package/src/functions/{getAction.ts → getAction/index.ts} +11 -12
  136. package/src/functions/getAction/info.ts +9 -0
  137. package/src/functions/getAction/schemas.ts +35 -0
  138. package/src/functions/{getApp.ts → getApp/index.ts} +9 -15
  139. package/src/functions/getApp/info.ts +9 -0
  140. package/src/functions/getApp/schemas.ts +31 -0
  141. package/src/functions/{listActions.ts → listActions/index.ts} +8 -10
  142. package/src/functions/listActions/info.ts +9 -0
  143. package/src/functions/listActions/schemas.ts +40 -0
  144. package/src/functions/{listApps.ts → listApps/index.ts} +3 -8
  145. package/src/functions/listApps/info.ts +9 -0
  146. package/src/functions/listApps/schemas.ts +43 -0
  147. package/src/functions/{listAuths.ts → listAuthentications/index.ts} +32 -23
  148. package/src/functions/listAuthentications/info.ts +9 -0
  149. package/src/functions/listAuthentications/schemas.ts +60 -0
  150. package/src/functions/{listFields.ts → listFields/index.ts} +11 -20
  151. package/src/functions/listFields/info.ts +9 -0
  152. package/src/functions/listFields/schemas.ts +46 -0
  153. package/src/functions/{runAction.ts → runAction/index.ts} +25 -23
  154. package/src/functions/runAction/info.ts +9 -0
  155. package/src/functions/runAction/schemas.ts +41 -0
  156. package/src/index.ts +19 -5
  157. package/src/plugins/apps/index.ts +144 -0
  158. package/src/plugins/apps/info.ts +12 -0
  159. package/src/plugins/apps/types.ts +34 -0
  160. package/src/resolvers/actionKey.ts +33 -0
  161. package/src/resolvers/actionType.ts +30 -0
  162. package/src/resolvers/appKey.ts +11 -0
  163. package/src/resolvers/authenticationId.ts +38 -0
  164. package/src/resolvers/index.ts +117 -0
  165. package/src/resolvers/inputs.ts +23 -0
  166. package/src/schema-utils.ts +154 -0
  167. package/src/schemas/Action.ts +40 -0
  168. package/src/schemas/App.ts +43 -0
  169. package/src/schemas/Auth.ts +54 -0
  170. package/src/schemas/Field.ts +34 -0
  171. package/src/sdk.ts +165 -19
  172. package/src/types/domain.ts +54 -0
  173. package/src/types/properties.ts +67 -0
  174. package/src/types/sdk.ts +46 -0
  175. package/dist/actions-sdk.d.ts +0 -47
  176. package/dist/actions-sdk.js +0 -208
  177. package/dist/api.d.ts +0 -62
  178. package/dist/api.js +0 -227
  179. package/dist/output-schemas.d.ts +0 -95
  180. package/dist/output-schemas.js +0 -138
  181. package/dist/schemas.d.ts +0 -338
  182. package/dist/schemas.js +0 -336
  183. package/dist/types.js +0 -41
  184. package/src/actions-sdk.ts +0 -356
  185. package/src/api.ts +0 -361
  186. package/src/output-schemas.ts +0 -196
  187. package/src/schemas.ts +0 -467
  188. package/src/types.ts +0 -257
  189. /package/dist/functions/{bundleCode.js → bundleCode/index.js} +0 -0
@@ -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
+ };
@@ -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 { ListAuthenticationsOptions } 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 listAuthentications(options?: Partial<ListAuthenticationsOptions>): Promise<Authentication[]>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listAuths = listAuths;
4
- const api_1 = require("../api");
5
- const getApp_1 = require("./getApp");
3
+ exports.listAuthentications = listAuthentications;
4
+ const api_1 = require("../../api");
5
+ const getApp_1 = require("../getApp");
6
6
  /**
7
7
  * List available authentications with optional filtering
8
8
  *
@@ -12,14 +12,14 @@ const getApp_1 = require("./getApp");
12
12
  * @param options - Filtering, pagination, and API configuration options
13
13
  * @returns Promise<Authentication[]> with pagination metadata
14
14
  */
15
- async function listAuths(options = {}) {
15
+ async function listAuthentications(options = {}) {
16
16
  const { token } = options;
17
17
  if (!token && !process.env.ZAPIER_TOKEN) {
18
18
  throw new Error("Authentication token is required to list authentications. Please provide token in options or set ZAPIER_TOKEN environment variable.");
19
19
  }
20
20
  const api = (0, api_1.getOrCreateApiClient)(options);
21
21
  // Local function to handle the actual API fetching
22
- const listAuthsInternal = async (options = {}) => {
22
+ const listAuthenticationsInternal = async (options = {}) => {
23
23
  // Build search parameters
24
24
  const searchParams = {};
25
25
  // Handle appKey filtering by getting the selected_api first
@@ -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,
@@ -52,6 +52,13 @@ async function listAuths(options = {}) {
52
52
  }
53
53
  }
54
54
  // Add other query parameters if provided
55
+ // Use title as search if no explicit search provided
56
+ if (options.search) {
57
+ searchParams.search = options.search;
58
+ }
59
+ else if (options.title) {
60
+ searchParams.search = options.title;
61
+ }
55
62
  if (options.account_id) {
56
63
  searchParams.account_id = options.account_id;
57
64
  }
@@ -77,7 +84,16 @@ async function listAuths(options = {}) {
77
84
  },
78
85
  });
79
86
  // Transform API response
80
- const auths = data.results || [];
87
+ let auths = data.results || [];
88
+ // Coerce title from label if title is missing (API cleanup)
89
+ auths = auths.map((auth) => ({
90
+ ...auth,
91
+ title: auth.title || auth.label || undefined,
92
+ }));
93
+ // Filter by exact title match if specified
94
+ if (options.title) {
95
+ auths = auths.filter((auth) => auth.title === options.title);
96
+ }
81
97
  // Add pagination metadata to the response
82
98
  if (auths.length > 0) {
83
99
  auths.__pagination = {
@@ -93,7 +109,7 @@ async function listAuths(options = {}) {
93
109
  // If a limit is provided and no specific owner filter, prioritize owned auths
94
110
  if (options.limit && options.owner === undefined) {
95
111
  // First get owned auths
96
- const ownedAuths = await listAuthsInternal({
112
+ const ownedAuths = await listAuthenticationsInternal({
97
113
  ...options,
98
114
  owner: "me",
99
115
  });
@@ -102,17 +118,17 @@ async function listAuths(options = {}) {
102
118
  return ownedAuths.slice(0, options.limit);
103
119
  }
104
120
  // Get all auths up to the original limit to fill remaining slots
105
- const allAuths = await listAuthsInternal({
121
+ const allAuths = await listAuthenticationsInternal({
106
122
  ...options,
107
123
  owner: undefined,
108
124
  });
109
125
  // 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));
126
+ const ownedAuthenticationIds = new Set(ownedAuths.map((auth) => auth.id));
127
+ const additionalAuths = allAuths.filter((auth) => !ownedAuthenticationIds.has(auth.id));
112
128
  // Combine and slice to the requested limit
113
129
  const combined = [...ownedAuths, ...additionalAuths];
114
130
  return combined.slice(0, options.limit);
115
131
  }
116
132
  // Standard implementation for non-prioritized requests
117
- return listAuthsInternal(options);
133
+ return listAuthenticationsInternal(options);
118
134
  }
@@ -0,0 +1,30 @@
1
+ import { listAuthentications } from "./index";
2
+ export declare const listAuthenticationsInfo: {
3
+ name: string;
4
+ inputSchema: import("zod").ZodObject<{
5
+ appKey: import("zod").ZodOptional<import("zod").ZodString>;
6
+ search: import("zod").ZodOptional<import("zod").ZodString>;
7
+ title: import("zod").ZodOptional<import("zod").ZodString>;
8
+ account_id: import("zod").ZodOptional<import("zod").ZodString>;
9
+ owner: import("zod").ZodOptional<import("zod").ZodString>;
10
+ limit: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
11
+ offset: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
12
+ }, "strip", import("zod").ZodTypeAny, {
13
+ search?: string | undefined;
14
+ appKey?: string | undefined;
15
+ title?: string | undefined;
16
+ account_id?: string | undefined;
17
+ owner?: string | undefined;
18
+ limit?: number | undefined;
19
+ offset?: number | undefined;
20
+ }, {
21
+ search?: string | undefined;
22
+ appKey?: string | undefined;
23
+ title?: string | undefined;
24
+ account_id?: string | undefined;
25
+ owner?: string | undefined;
26
+ limit?: number | undefined;
27
+ offset?: number | undefined;
28
+ }>;
29
+ implementation: typeof listAuthentications;
30
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listAuthenticationsInfo = 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.listAuthenticationsInfo = {
8
+ name: index_1.listAuthentications.name,
9
+ inputSchema: schemas_1.ListAuthenticationsSchema,
10
+ implementation: index_1.listAuthentications,
11
+ };
@@ -0,0 +1,42 @@
1
+ import { z } from "zod";
2
+ import type { Authentication } from "../../types/domain";
3
+ export declare const ListAuthenticationsSchema: z.ZodObject<{
4
+ appKey: z.ZodOptional<z.ZodString>;
5
+ search: z.ZodOptional<z.ZodString>;
6
+ title: z.ZodOptional<z.ZodString>;
7
+ account_id: z.ZodOptional<z.ZodString>;
8
+ owner: z.ZodOptional<z.ZodString>;
9
+ limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
10
+ offset: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ search?: string | undefined;
13
+ appKey?: string | undefined;
14
+ title?: string | undefined;
15
+ account_id?: string | undefined;
16
+ owner?: string | undefined;
17
+ limit?: number | undefined;
18
+ offset?: number | undefined;
19
+ }, {
20
+ search?: string | undefined;
21
+ appKey?: string | undefined;
22
+ title?: string | undefined;
23
+ account_id?: string | undefined;
24
+ owner?: string | undefined;
25
+ limit?: number | undefined;
26
+ offset?: number | undefined;
27
+ }>;
28
+ export type ListAuthenticationsOptions = z.infer<typeof ListAuthenticationsSchema> & {
29
+ /** Base URL for Zapier API */
30
+ baseUrl?: string;
31
+ /** Authentication token */
32
+ token?: string;
33
+ /** Optional pre-instantiated API client */
34
+ api?: any;
35
+ /** Enable debug logging */
36
+ debug?: boolean;
37
+ /** Custom fetch implementation */
38
+ fetch?: typeof globalThis.fetch;
39
+ };
40
+ export interface ListAuthenticationsSdkFunction {
41
+ listAuthentications: (options?: Partial<ListAuthenticationsOptions>) => Promise<Authentication[]>;
42
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListAuthenticationsSchema = 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.ListAuthenticationsSchema = (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
+ search: zod_1.z
13
+ .string()
14
+ .optional()
15
+ .describe("Search term to filter authentications by title"),
16
+ title: zod_1.z
17
+ .string()
18
+ .optional()
19
+ .describe("Filter authentications by exact title match"),
20
+ account_id: zod_1.z.string().optional().describe("Filter by account ID"),
21
+ owner: zod_1.z.string().optional().describe("Filter by owner"),
22
+ limit: properties_1.LimitPropertySchema.optional().describe("Maximum number of items to return (1-200)"),
23
+ offset: properties_1.OffsetPropertySchema.optional().describe("Number of items to skip for pagination"),
24
+ })
25
+ .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
+ };