@zapier/zapier-sdk 0.3.0 → 0.4.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 (158) hide show
  1. package/dist/index.cjs +2001 -0
  2. package/dist/index.d.mts +840 -0
  3. package/dist/index.d.ts +840 -20
  4. package/dist/index.mjs +1955 -0
  5. package/package.json +19 -7
  6. package/src/api/client.ts +84 -16
  7. package/src/api/types.ts +9 -1
  8. package/src/auth.ts +19 -287
  9. package/src/functions/fetch/index.ts +180 -0
  10. package/src/functions/fetch/info.ts +8 -0
  11. package/src/functions/fetch/schemas.ts +46 -0
  12. package/src/functions/findFirstAuthentication/schemas.ts +3 -13
  13. package/src/functions/findUniqueAuthentication/schemas.ts +3 -13
  14. package/src/functions/generateTypes/index.ts +15 -0
  15. package/src/functions/generateTypes/schemas.ts +3 -10
  16. package/src/functions/getAction/schemas.ts +3 -13
  17. package/src/functions/getApp/schemas.ts +2 -13
  18. package/src/functions/getAuthentication/index.ts +0 -1
  19. package/src/functions/getAuthentication/schemas.ts +3 -17
  20. package/src/functions/listActions/schemas.ts +3 -13
  21. package/src/functions/listApps/schemas.ts +2 -13
  22. package/src/functions/listAuthentications/index.ts +0 -1
  23. package/src/functions/listAuthentications/schemas.ts +3 -15
  24. package/src/functions/listFields/schemas.ts +3 -13
  25. package/src/functions/runAction/index.ts +0 -1
  26. package/src/functions/runAction/schemas.ts +6 -15
  27. package/src/index.ts +4 -2
  28. package/src/plugins/apps/index.ts +35 -9
  29. package/src/sdk.ts +20 -22
  30. package/src/types/domain.ts +16 -0
  31. package/src/types/sdk.ts +13 -1
  32. package/tsconfig.json +2 -2
  33. package/tsup.config.ts +21 -0
  34. package/dist/api/auth.d.ts +0 -8
  35. package/dist/api/auth.js +0 -29
  36. package/dist/api/client.d.ts +0 -8
  37. package/dist/api/client.js +0 -119
  38. package/dist/api/debug.d.ts +0 -12
  39. package/dist/api/debug.js +0 -50
  40. package/dist/api/index.d.ts +0 -28
  41. package/dist/api/index.js +0 -52
  42. package/dist/api/polling.d.ts +0 -17
  43. package/dist/api/polling.js +0 -34
  44. package/dist/api/types.d.ts +0 -147
  45. package/dist/api/types.js +0 -9
  46. package/dist/auth.d.ts +0 -59
  47. package/dist/auth.js +0 -261
  48. package/dist/functions/bundleCode/index.d.ts +0 -11
  49. package/dist/functions/bundleCode/index.js +0 -91
  50. package/dist/functions/bundleCode/info.d.ts +0 -27
  51. package/dist/functions/bundleCode/info.js +0 -11
  52. package/dist/functions/bundleCode/schemas.d.ts +0 -27
  53. package/dist/functions/bundleCode/schemas.js +0 -22
  54. package/dist/functions/findFirstAuthentication/index.d.ts +0 -12
  55. package/dist/functions/findFirstAuthentication/index.js +0 -21
  56. package/dist/functions/findFirstAuthentication/info.d.ts +0 -30
  57. package/dist/functions/findFirstAuthentication/info.js +0 -11
  58. package/dist/functions/findFirstAuthentication/schemas.d.ts +0 -42
  59. package/dist/functions/findFirstAuthentication/schemas.js +0 -25
  60. package/dist/functions/findUniqueAuthentication/index.d.ts +0 -13
  61. package/dist/functions/findUniqueAuthentication/index.js +0 -28
  62. package/dist/functions/findUniqueAuthentication/info.d.ts +0 -30
  63. package/dist/functions/findUniqueAuthentication/info.js +0 -11
  64. package/dist/functions/findUniqueAuthentication/schemas.d.ts +0 -42
  65. package/dist/functions/findUniqueAuthentication/schemas.js +0 -25
  66. package/dist/functions/generateTypes/index.d.ts +0 -11
  67. package/dist/functions/generateTypes/index.js +0 -305
  68. package/dist/functions/generateTypes/info.d.ts +0 -21
  69. package/dist/functions/generateTypes/info.js +0 -11
  70. package/dist/functions/generateTypes/schemas.d.ts +0 -30
  71. package/dist/functions/generateTypes/schemas.js +0 -14
  72. package/dist/functions/getAction/index.d.ts +0 -12
  73. package/dist/functions/getAction/index.js +0 -26
  74. package/dist/functions/getAction/info.d.ts +0 -18
  75. package/dist/functions/getAction/info.js +0 -11
  76. package/dist/functions/getAction/schemas.d.ts +0 -30
  77. package/dist/functions/getAction/schemas.js +0 -13
  78. package/dist/functions/getApp/index.d.ts +0 -12
  79. package/dist/functions/getApp/index.js +0 -37
  80. package/dist/functions/getApp/info.d.ts +0 -12
  81. package/dist/functions/getApp/info.js +0 -11
  82. package/dist/functions/getApp/schemas.d.ts +0 -24
  83. package/dist/functions/getApp/schemas.js +0 -11
  84. package/dist/functions/getAuthentication/index.d.ts +0 -13
  85. package/dist/functions/getAuthentication/index.js +0 -38
  86. package/dist/functions/getAuthentication/info.d.ts +0 -12
  87. package/dist/functions/getAuthentication/info.js +0 -11
  88. package/dist/functions/getAuthentication/schemas.d.ts +0 -26
  89. package/dist/functions/getAuthentication/schemas.js +0 -16
  90. package/dist/functions/listActions/index.d.ts +0 -12
  91. package/dist/functions/listActions/index.js +0 -128
  92. package/dist/functions/listActions/info.d.ts +0 -15
  93. package/dist/functions/listActions/info.js +0 -11
  94. package/dist/functions/listActions/schemas.d.ts +0 -27
  95. package/dist/functions/listActions/schemas.js +0 -14
  96. package/dist/functions/listApps/index.d.ts +0 -12
  97. package/dist/functions/listApps/index.js +0 -50
  98. package/dist/functions/listApps/info.d.ts +0 -18
  99. package/dist/functions/listApps/info.js +0 -11
  100. package/dist/functions/listApps/schemas.d.ts +0 -30
  101. package/dist/functions/listApps/schemas.js +0 -15
  102. package/dist/functions/listAuthentications/index.d.ts +0 -12
  103. package/dist/functions/listAuthentications/index.js +0 -131
  104. package/dist/functions/listAuthentications/info.d.ts +0 -30
  105. package/dist/functions/listAuthentications/info.js +0 -11
  106. package/dist/functions/listAuthentications/schemas.d.ts +0 -44
  107. package/dist/functions/listAuthentications/schemas.js +0 -25
  108. package/dist/functions/listFields/index.d.ts +0 -12
  109. package/dist/functions/listFields/index.js +0 -65
  110. package/dist/functions/listFields/info.d.ts +0 -24
  111. package/dist/functions/listFields/info.js +0 -11
  112. package/dist/functions/listFields/schemas.d.ts +0 -36
  113. package/dist/functions/listFields/schemas.js +0 -17
  114. package/dist/functions/runAction/index.d.ts +0 -12
  115. package/dist/functions/runAction/index.js +0 -86
  116. package/dist/functions/runAction/info.d.ts +0 -24
  117. package/dist/functions/runAction/info.js +0 -11
  118. package/dist/functions/runAction/schemas.d.ts +0 -38
  119. package/dist/functions/runAction/schemas.js +0 -15
  120. package/dist/index.js +0 -57
  121. package/dist/plugins/apps/index.d.ts +0 -8
  122. package/dist/plugins/apps/index.js +0 -77
  123. package/dist/plugins/apps/info.d.ts +0 -6
  124. package/dist/plugins/apps/info.js +0 -13
  125. package/dist/plugins/apps/types.d.ts +0 -21
  126. package/dist/plugins/apps/types.js +0 -2
  127. package/dist/resolvers/actionKey.d.ts +0 -8
  128. package/dist/resolvers/actionKey.js +0 -20
  129. package/dist/resolvers/actionType.d.ts +0 -8
  130. package/dist/resolvers/actionType.js +0 -21
  131. package/dist/resolvers/appKey.d.ts +0 -6
  132. package/dist/resolvers/appKey.js +0 -8
  133. package/dist/resolvers/authenticationId.d.ts +0 -8
  134. package/dist/resolvers/authenticationId.js +0 -29
  135. package/dist/resolvers/index.d.ts +0 -39
  136. package/dist/resolvers/index.js +0 -105
  137. package/dist/resolvers/inputs.d.ts +0 -7
  138. package/dist/resolvers/inputs.js +0 -15
  139. package/dist/schema-utils.d.ts +0 -44
  140. package/dist/schema-utils.js +0 -76
  141. package/dist/schemas/Action.d.ts +0 -21
  142. package/dist/schemas/Action.js +0 -31
  143. package/dist/schemas/App.d.ts +0 -19
  144. package/dist/schemas/App.js +0 -32
  145. package/dist/schemas/Auth.d.ts +0 -27
  146. package/dist/schemas/Auth.js +0 -42
  147. package/dist/schemas/Field.d.ts +0 -15
  148. package/dist/schemas/Field.js +0 -25
  149. package/dist/sdk.d.ts +0 -6
  150. package/dist/sdk.js +0 -90
  151. package/dist/types/domain.d.ts +0 -25
  152. package/dist/types/domain.js +0 -21
  153. package/dist/types/events.d.ts +0 -37
  154. package/dist/types/events.js +0 -8
  155. package/dist/types/properties.d.ts +0 -21
  156. package/dist/types/properties.js +0 -52
  157. package/dist/types/sdk.d.ts +0 -24
  158. package/dist/types/sdk.js +0 -2
@@ -1,30 +0,0 @@
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
- }
@@ -1,14 +0,0 @@
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,12 +0,0 @@
1
- import type { Action } from "../../types/domain";
2
- import type { GetActionOptions } from "./schemas";
3
- /**
4
- * Get a specific action by app, action key, and type
5
- *
6
- * This function can be used standalone without instantiating a full SDK,
7
- * which enables better tree-shaking in applications that only need this functionality.
8
- *
9
- * @param options - App key, action key, type, and API configuration options
10
- * @returns Promise<Action>
11
- */
12
- export declare function getAction(options: GetActionOptions): Promise<Action>;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAction = getAction;
4
- const listActions_1 = require("../listActions");
5
- /**
6
- * Get a specific action by app, action key, and type
7
- *
8
- * This function can be used standalone without instantiating a full SDK,
9
- * which enables better tree-shaking in applications that only need this functionality.
10
- *
11
- * @param options - App key, action key, type, and API configuration options
12
- * @returns Promise<Action>
13
- */
14
- async function getAction(options) {
15
- const { appKey, actionKey, actionType } = options;
16
- const actions = await (0, listActions_1.listActions)({
17
- ...options,
18
- appKey: appKey,
19
- });
20
- const action = actions.find((a) => a.key === actionKey && a.type === actionType);
21
- if (!action) {
22
- throw new Error(`Action not found: ${actionKey} with type ${actionType}`);
23
- }
24
- return action;
25
- }
26
- // No registry info here - moved to info.ts for proper tree-shaking
@@ -1,18 +0,0 @@
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", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
7
- actionKey: import("zod").ZodString;
8
- }, "strip", import("zod").ZodTypeAny, {
9
- appKey: string;
10
- actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
11
- actionKey: string;
12
- }, {
13
- appKey: string;
14
- actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
15
- actionKey: string;
16
- }>;
17
- implementation: typeof getAction;
18
- };
@@ -1,11 +0,0 @@
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
- };
@@ -1,30 +0,0 @@
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", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
6
- actionKey: z.ZodString;
7
- }, "strip", z.ZodTypeAny, {
8
- appKey: string;
9
- actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
10
- actionKey: string;
11
- }, {
12
- appKey: string;
13
- actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
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
- }
@@ -1,13 +0,0 @@
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,12 +0,0 @@
1
- import type { Integration } from "../../types/domain";
2
- import type { GetAppOptions } from "./schemas";
3
- /**
4
- * Get a specific app by key
5
- *
6
- * This function can be used standalone without instantiating a full SDK,
7
- * which enables better tree-shaking in applications that only need this functionality.
8
- *
9
- * @param options - App key and API configuration options
10
- * @returns Promise<Integration>
11
- */
12
- export declare function getApp(options: GetAppOptions): Promise<Integration>;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getApp = getApp;
4
- const api_1 = require("../../api");
5
- const domain_1 = require("../../types/domain");
6
- /**
7
- * Get a specific app by key
8
- *
9
- * This function can be used standalone without instantiating a full SDK,
10
- * which enables better tree-shaking in applications that only need this functionality.
11
- *
12
- * @param options - App key and API configuration options
13
- * @returns Promise<Integration>
14
- */
15
- async function getApp(options) {
16
- const api = (0, api_1.getOrCreateApiClient)(options);
17
- const { appKey } = options;
18
- const app = await api.get(`/api/v4/apps/${appKey}/`, {
19
- customErrorHandler: (response) => {
20
- if (response.status === 404) {
21
- return new domain_1.AppNotFoundError(appKey);
22
- }
23
- return undefined;
24
- },
25
- });
26
- return {
27
- key: app.slug,
28
- name: app.name,
29
- description: app.description,
30
- version: "1.0.0",
31
- category: app.category?.name,
32
- actions: [],
33
- triggers: [],
34
- current_implementation_id: app.current_implementation_id,
35
- };
36
- }
37
- // No registry info here - moved to info.ts for proper tree-shaking
@@ -1,12 +0,0 @@
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
- };
@@ -1,11 +0,0 @@
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
- };
@@ -1,24 +0,0 @@
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
- }
@@ -1,11 +0,0 @@
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,13 +0,0 @@
1
- import type { Authentication } from "../../types/domain";
2
- import type { GetAuthenticationOptions } from "./schemas";
3
- /**
4
- * Get a specific authentication by ID
5
- *
6
- * This function can be used standalone without instantiating a full SDK,
7
- * which enables better tree-shaking in applications that only need this functionality.
8
- *
9
- * @param options - Authentication ID and API configuration options
10
- * @returns Promise<Authentication> - The authentication details
11
- * @throws Error if authentication not found or access denied
12
- */
13
- export declare function getAuthentication(options: GetAuthenticationOptions): Promise<Authentication>;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAuthentication = getAuthentication;
4
- const api_1 = require("../../api");
5
- /**
6
- * Get a specific authentication by ID
7
- *
8
- * This function can be used standalone without instantiating a full SDK,
9
- * which enables better tree-shaking in applications that only need this functionality.
10
- *
11
- * @param options - Authentication ID and API configuration options
12
- * @returns Promise<Authentication> - The authentication details
13
- * @throws Error if authentication not found or access denied
14
- */
15
- async function getAuthentication(options) {
16
- const { authenticationId } = options;
17
- const api = (0, api_1.getOrCreateApiClient)(options);
18
- api.requireAuthTo("get authentication");
19
- const data = await api.get(`/api/v4/authentications/${authenticationId}/`, {
20
- customErrorHandler: (response) => {
21
- if (response.status === 401) {
22
- return new Error(`Authentication failed. Your token may not have permission to access authentications or may be expired. (HTTP ${response.status})`);
23
- }
24
- if (response.status === 403) {
25
- return new Error(`Access forbidden. Your token may not have the required scopes to get authentication ${authenticationId}. (HTTP ${response.status})`);
26
- }
27
- if (response.status === 404) {
28
- return new Error(`Authentication ${authenticationId} not found. It may not exist or you may not have access to it. (HTTP ${response.status})`);
29
- }
30
- return undefined;
31
- },
32
- });
33
- // Coerce title from label if title is missing (API cleanup)
34
- return {
35
- ...data,
36
- title: data.title || data.label || undefined,
37
- };
38
- }
@@ -1,12 +0,0 @@
1
- import { getAuthentication } from "./index";
2
- export declare const getAuthenticationInfo: {
3
- name: string;
4
- inputSchema: import("zod").ZodObject<{
5
- authenticationId: import("zod").ZodNumber;
6
- }, "strip", import("zod").ZodTypeAny, {
7
- authenticationId: number;
8
- }, {
9
- authenticationId: number;
10
- }>;
11
- implementation: typeof getAuthentication;
12
- };
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAuthenticationInfo = 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.getAuthenticationInfo = {
8
- name: index_1.getAuthentication.name,
9
- inputSchema: schemas_1.GetAuthenticationSchema,
10
- implementation: index_1.getAuthentication,
11
- };
@@ -1,26 +0,0 @@
1
- import { z } from "zod";
2
- import type { Authentication } from "../../types/domain";
3
- export declare const GetAuthenticationSchema: z.ZodObject<{
4
- authenticationId: z.ZodNumber;
5
- }, "strip", z.ZodTypeAny, {
6
- authenticationId: number;
7
- }, {
8
- authenticationId: number;
9
- }>;
10
- export type GetAuthenticationOptions = z.infer<typeof GetAuthenticationSchema> & {
11
- /** Base URL for Zapier API */
12
- baseUrl?: string;
13
- /** Authentication token */
14
- token?: string;
15
- /** Function to dynamically resolve authentication token */
16
- getToken?: () => Promise<string | undefined>;
17
- /** Optional pre-instantiated API client */
18
- api?: any;
19
- /** Enable debug logging */
20
- debug?: boolean;
21
- /** Custom fetch implementation */
22
- fetch?: typeof globalThis.fetch;
23
- };
24
- export interface GetAuthenticationSdkFunction {
25
- getAuthentication: (options: GetAuthenticationOptions) => Promise<Authentication>;
26
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetAuthenticationSchema = void 0;
4
- const zod_1 = require("zod");
5
- const schema_utils_1 = require("../../schema-utils");
6
- const Auth_1 = require("../../schemas/Auth");
7
- // Pure Zod schema - no resolver metadata!
8
- exports.GetAuthenticationSchema = (0, schema_utils_1.withOutputSchema)(zod_1.z
9
- .object({
10
- authenticationId: zod_1.z
11
- .number()
12
- .int()
13
- .positive()
14
- .describe("Authentication ID to retrieve"),
15
- })
16
- .describe("Get a specific authentication by ID"), Auth_1.AuthItemSchema);
@@ -1,12 +0,0 @@
1
- import type { Action } from "../../types/domain";
2
- import type { ListActionsOptions } from "./schemas";
3
- /**
4
- * List available actions with optional filtering
5
- *
6
- * This function can be used standalone without instantiating a full SDK,
7
- * which enables better tree-shaking in applications that only need this functionality.
8
- *
9
- * @param options - Filtering and API configuration options
10
- * @returns Promise<Action[]> with pagination metadata
11
- */
12
- export declare function listActions(options?: Partial<ListActionsOptions>): Promise<Action[]>;
@@ -1,128 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listActions = listActions;
4
- const api_1 = require("../../api");
5
- const getApp_1 = require("../getApp");
6
- /**
7
- * List available actions with optional filtering
8
- *
9
- * This function can be used standalone without instantiating a full SDK,
10
- * which enables better tree-shaking in applications that only need this functionality.
11
- *
12
- * @param options - Filtering and API configuration options
13
- * @returns Promise<Action[]> with pagination metadata
14
- */
15
- async function listActions(options = {}) {
16
- const api = (0, api_1.getOrCreateApiClient)(options);
17
- // If filtering by appKey, use optimized approach with selected_apis parameter
18
- if (options.appKey) {
19
- try {
20
- // Use the standalone getApp function
21
- const appData = await (0, getApp_1.getApp)({
22
- appKey: options.appKey,
23
- api,
24
- token: options.token,
25
- baseUrl: options.baseUrl,
26
- debug: options.debug,
27
- fetch: options.fetch,
28
- });
29
- // Extract implementation name from current_implementation_id (e.g., "SlackCLIAPI@1.20.0" -> "SlackCLIAPI")
30
- const implementationId = appData.current_implementation_id?.split("@")[0];
31
- if (!implementationId) {
32
- throw new Error("No current_implementation_id found for app");
33
- }
34
- const searchParams = {
35
- global: "true",
36
- public_only: "true",
37
- selected_apis: implementationId,
38
- };
39
- const data = await api.get("/api/v4/implementations/", {
40
- searchParams,
41
- });
42
- const actions = [];
43
- // Transform implementations to actions
44
- for (const implementation of data.results || []) {
45
- if (implementation.actions) {
46
- for (const action of implementation.actions) {
47
- const transformedAction = {
48
- key: action.key,
49
- name: action.name || action.label,
50
- description: action.description || "",
51
- appKey: implementation.slug || "",
52
- type: action.type || action.type_of || "read",
53
- inputFields: [], // Would need additional API call for detailed fields
54
- outputFields: [],
55
- };
56
- // Apply type filter if provided
57
- if (options?.type && transformedAction.type !== options.type) {
58
- continue;
59
- }
60
- actions.push(transformedAction);
61
- }
62
- }
63
- }
64
- // Add pagination metadata for app-specific queries
65
- if (actions.length > 0) {
66
- actions.__pagination = {
67
- count: data.count,
68
- hasNext: !!data.next,
69
- hasPrevious: !!data.previous,
70
- nextUrl: data.next,
71
- previousUrl: data.previous,
72
- };
73
- }
74
- return actions;
75
- }
76
- catch (error) {
77
- // If it's an AppNotFoundError, don't try fallback - just re-throw
78
- if (error instanceof Error && error.name === "AppNotFoundError") {
79
- throw error;
80
- }
81
- // Fallback to original approach if optimized approach fails
82
- console.warn("Optimized app lookup failed, falling back to full scan:", error);
83
- }
84
- }
85
- // Original approach for general queries or when optimization fails
86
- const searchParams = {
87
- global: "true",
88
- public_only: "true",
89
- };
90
- const data = await api.get("/api/v4/implementations/", { searchParams });
91
- const actions = [];
92
- // Transform implementations to actions
93
- for (const implementation of data.results || []) {
94
- if (implementation.actions) {
95
- for (const action of implementation.actions) {
96
- const transformedAction = {
97
- key: action.key,
98
- name: action.name || action.label,
99
- description: action.description || "",
100
- appKey: implementation.slug || "",
101
- type: action.type || action.type_of || "read",
102
- inputFields: [], // Would need additional API call for detailed fields
103
- outputFields: [],
104
- };
105
- // Apply filters
106
- if (options?.appKey && transformedAction.appKey !== options.appKey) {
107
- continue;
108
- }
109
- if (options?.type && transformedAction.type !== options.type) {
110
- continue;
111
- }
112
- actions.push(transformedAction);
113
- }
114
- }
115
- }
116
- // Add pagination metadata for general queries
117
- if (actions.length > 0) {
118
- actions.__pagination = {
119
- count: data.count,
120
- hasNext: !!data.next,
121
- hasPrevious: !!data.previous,
122
- nextUrl: data.next,
123
- previousUrl: data.previous,
124
- };
125
- }
126
- return actions;
127
- }
128
- // No registry info here - moved to info.ts for proper tree-shaking
@@ -1,15 +0,0 @@
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", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>>;
7
- }, "strip", import("zod").ZodTypeAny, {
8
- type?: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter" | undefined;
9
- appKey?: string | undefined;
10
- }, {
11
- type?: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter" | undefined;
12
- appKey?: string | undefined;
13
- }>;
14
- implementation: typeof listActions;
15
- };
@@ -1,11 +0,0 @@
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
- };
@@ -1,27 +0,0 @@
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", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>>;
6
- }, "strip", z.ZodTypeAny, {
7
- type?: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter" | undefined;
8
- appKey?: string | undefined;
9
- }, {
10
- type?: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter" | 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
- }
@@ -1,14 +0,0 @@
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,12 +0,0 @@
1
- import type { Integration } from "../../types/domain";
2
- import type { ListAppsOptions } from "./schemas";
3
- /**
4
- * List available apps with optional filtering
5
- *
6
- * This function can be used standalone without instantiating a full SDK,
7
- * which enables better tree-shaking in applications that only need this functionality.
8
- *
9
- * @param options - Filtering, pagination, and API configuration options
10
- * @returns Promise<Integration[]> with pagination metadata
11
- */
12
- export declare function listApps(options?: ListAppsOptions): Promise<Integration[]>;