@zapier/zapier-sdk 0.12.1 → 0.13.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 (87) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +137 -76
  3. package/dist/api/schemas.d.ts +10 -865
  4. package/dist/api/schemas.d.ts.map +1 -1
  5. package/dist/api/schemas.js +0 -6
  6. package/dist/index.cjs +42 -31
  7. package/dist/index.d.mts +69 -427
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.mjs +42 -31
  11. package/dist/plugins/apps/schemas.d.ts +9 -1
  12. package/dist/plugins/apps/schemas.d.ts.map +1 -1
  13. package/dist/plugins/findFirstAuthentication/schemas.js +1 -1
  14. package/dist/plugins/findUniqueAuthentication/schemas.js +1 -1
  15. package/dist/plugins/getApp/schemas.js +1 -1
  16. package/dist/plugins/getAuthentication/index.test.js +1 -1
  17. package/dist/plugins/listActions/index.d.ts +1 -0
  18. package/dist/plugins/listActions/index.d.ts.map +1 -1
  19. package/dist/plugins/listActions/schemas.d.ts +3 -0
  20. package/dist/plugins/listActions/schemas.d.ts.map +1 -1
  21. package/dist/plugins/listActions/schemas.js +2 -1
  22. package/dist/plugins/listApps/index.d.ts +1 -0
  23. package/dist/plugins/listApps/index.d.ts.map +1 -1
  24. package/dist/plugins/listApps/schemas.d.ts +3 -0
  25. package/dist/plugins/listApps/schemas.d.ts.map +1 -1
  26. package/dist/plugins/listApps/schemas.js +1 -0
  27. package/dist/plugins/listAuthentications/index.d.ts +1 -0
  28. package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
  29. package/dist/plugins/listAuthentications/schemas.d.ts +3 -0
  30. package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
  31. package/dist/plugins/listAuthentications/schemas.js +2 -1
  32. package/dist/plugins/listInputFieldChoices/index.d.ts +1 -0
  33. package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
  34. package/dist/plugins/listInputFieldChoices/schemas.d.ts +3 -0
  35. package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
  36. package/dist/plugins/listInputFieldChoices/schemas.js +1 -0
  37. package/dist/plugins/listInputFields/index.d.ts +1 -0
  38. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  39. package/dist/plugins/listInputFields/schemas.d.ts +3 -0
  40. package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
  41. package/dist/plugins/listInputFields/schemas.js +1 -0
  42. package/dist/plugins/runAction/index.d.ts +1 -0
  43. package/dist/plugins/runAction/index.d.ts.map +1 -1
  44. package/dist/plugins/runAction/schemas.d.ts +3 -0
  45. package/dist/plugins/runAction/schemas.d.ts.map +1 -1
  46. package/dist/plugins/runAction/schemas.js +1 -0
  47. package/dist/schemas/Action.d.ts +4 -206
  48. package/dist/schemas/Action.d.ts.map +1 -1
  49. package/dist/schemas/Action.js +3 -2
  50. package/dist/schemas/App.d.ts.map +1 -1
  51. package/dist/schemas/App.js +1 -0
  52. package/dist/schemas/Auth.d.ts +10 -10
  53. package/dist/schemas/Auth.js +1 -1
  54. package/dist/types/properties.d.ts.map +1 -1
  55. package/dist/types/properties.js +4 -1
  56. package/dist/utils/domain-utils.d.ts +2 -2
  57. package/dist/utils/domain-utils.d.ts.map +1 -1
  58. package/dist/utils/domain-utils.js +19 -8
  59. package/dist/utils/schema-utils.d.ts +1 -0
  60. package/dist/utils/schema-utils.d.ts.map +1 -1
  61. package/package.json +1 -1
  62. package/src/api/schemas.ts +0 -6
  63. package/src/index.ts +1 -0
  64. package/src/plugins/apps/schemas.ts +7 -1
  65. package/src/plugins/findFirstAuthentication/schemas.ts +1 -1
  66. package/src/plugins/findUniqueAuthentication/schemas.ts +1 -1
  67. package/src/plugins/getApp/schemas.ts +1 -1
  68. package/src/plugins/getAuthentication/index.test.ts +1 -1
  69. package/src/plugins/listActions/index.ts +1 -0
  70. package/src/plugins/listActions/schemas.ts +2 -1
  71. package/src/plugins/listApps/index.ts +4 -1
  72. package/src/plugins/listApps/schemas.ts +1 -0
  73. package/src/plugins/listAuthentications/index.ts +1 -0
  74. package/src/plugins/listAuthentications/schemas.ts +2 -1
  75. package/src/plugins/listInputFieldChoices/index.ts +1 -0
  76. package/src/plugins/listInputFieldChoices/schemas.ts +1 -0
  77. package/src/plugins/listInputFields/index.ts +1 -0
  78. package/src/plugins/listInputFields/schemas.ts +1 -0
  79. package/src/plugins/runAction/index.ts +4 -1
  80. package/src/plugins/runAction/schemas.ts +1 -0
  81. package/src/schemas/Action.ts +3 -2
  82. package/src/schemas/App.ts +1 -0
  83. package/src/schemas/Auth.ts +1 -1
  84. package/src/types/properties.ts +4 -1
  85. package/src/utils/domain-utils.ts +22 -9
  86. package/src/utils/schema-utils.ts +1 -0
  87. package/tsconfig.tsbuildinfo +1 -1
@@ -126,7 +126,7 @@ describe("getAuthentication plugin", () => {
126
126
  label: "My Slack Workspace",
127
127
  title: "My Slack Workspace",
128
128
  app_key: "SlackCLIAPI",
129
- version: "1.21.1",
129
+ app_version: "1.21.1",
130
130
  user_id: undefined, // customuser_id wasn't in mock data
131
131
  is_stale: "false", // Original field preserved
132
132
  marked_stale_at: null, // Original field preserved
@@ -20,6 +20,7 @@ import { appKeyResolver, actionTypeResolver } from "../../resolvers";
20
20
  export interface ListActionsPluginProvides {
21
21
  listActions: (options?: ListActionsOptions) => Promise<{
22
22
  data: ActionItem[];
23
+ nextCursor?: string;
23
24
  }> &
24
25
  AsyncIterable<{ data: ActionItem[]; nextCursor?: string }> & {
25
26
  items(): AsyncIterable<ActionItem>;
@@ -15,7 +15,7 @@ import type {
15
15
  export const ListActionsSchema = z
16
16
  .object({
17
17
  appKey: AppKeyPropertySchema.describe(
18
- "App key of actions to list (e.g., 'SlackCLIAPI')",
18
+ "App key of actions to list (e.g., 'SlackCLIAPI' or slug like 'github')",
19
19
  ),
20
20
  actionType: ActionTypePropertySchema.optional().describe(
21
21
  "Filter actions by type",
@@ -30,6 +30,7 @@ export const ListActionsSchema = z
30
30
  .min(1)
31
31
  .optional()
32
32
  .describe("Maximum total items to return across all pages"),
33
+ cursor: z.string().optional().describe("Cursor to start from"),
33
34
  })
34
35
  .describe("List all actions for a specific app");
35
36
 
@@ -17,7 +17,10 @@ import type { ManifestPluginProvides } from "../manifest";
17
17
  import type { ApiPluginProvides } from "../api";
18
18
  // ListApps plugin provides interface - listApps goes directly to SDK root
19
19
  export interface ListAppsPluginProvides {
20
- listApps: (options?: ListAppsOptions) => Promise<{ data: AppItem[] }> &
20
+ listApps: (options?: ListAppsOptions) => Promise<{
21
+ data: AppItem[];
22
+ nextCursor?: string;
23
+ }> &
21
24
  AsyncIterable<{ data: AppItem[]; nextCursor?: string }> & {
22
25
  items(): AsyncIterable<AppItem>;
23
26
  };
@@ -28,6 +28,7 @@ export const ListAppsSchema = z
28
28
  .min(1)
29
29
  .optional()
30
30
  .describe("Maximum total items to return across all pages"),
31
+ cursor: z.string().optional().describe("Cursor to start from"),
31
32
  })
32
33
  .describe("List all available apps with optional filtering");
33
34
 
@@ -24,6 +24,7 @@ import { AuthenticationItemSchema } from "../../schemas/Auth";
24
24
  export interface ListAuthenticationsPluginProvides {
25
25
  listAuthentications: (options?: ListAuthenticationsOptions) => Promise<{
26
26
  data: AuthenticationItem[];
27
+ nextCursor?: string;
27
28
  }> &
28
29
  AsyncIterable<{ data: AuthenticationItem[]; nextCursor?: string }> & {
29
30
  items(): AsyncIterable<AuthenticationItem>;
@@ -14,7 +14,7 @@ import type {
14
14
  export const ListAuthenticationsSchema = z
15
15
  .object({
16
16
  appKey: AppKeyPropertySchema.optional().describe(
17
- "App key of authentications to list (e.g., 'SlackCLIAPI')",
17
+ "App key of authentications to list (e.g., 'SlackCLIAPI' or slug like 'github')",
18
18
  ),
19
19
  authenticationIds: z
20
20
  .array(z.string())
@@ -45,6 +45,7 @@ export const ListAuthenticationsSchema = z
45
45
  .min(1)
46
46
  .optional()
47
47
  .describe("Maximum total items to return across all pages"),
48
+ cursor: z.string().optional().describe("Cursor to start from"),
48
49
  })
49
50
  .describe("List available authentications with optional filtering");
50
51
 
@@ -39,6 +39,7 @@ function transformNeedChoicesToInputFieldChoiceItem(
39
39
  export interface ListInputFieldChoicesPluginProvides {
40
40
  listInputFieldChoices: (options: ListInputFieldChoicesOptions) => Promise<{
41
41
  data: InputFieldChoiceItem[];
42
+ nextCursor?: string;
42
43
  }> &
43
44
  AsyncIterable<{ data: InputFieldChoiceItem[]; nextCursor?: string }> & {
44
45
  items(): AsyncIterable<InputFieldChoiceItem>;
@@ -92,6 +92,7 @@ export const ListInputFieldChoicesSchema = z
92
92
  .min(1)
93
93
  .optional()
94
94
  .describe("Maximum total items to return across all pages"),
95
+ cursor: z.string().optional().describe("Cursor to start from"),
95
96
  })
96
97
  .describe("Get the available choices for a dynamic dropdown input field");
97
98
 
@@ -181,6 +181,7 @@ function transformNeedsToFields(needs: Need[]): RootFieldItem[] {
181
181
  export interface ListInputFieldsPluginProvides {
182
182
  listInputFields: (options?: ListInputFieldsOptions) => Promise<{
183
183
  data: RootFieldItem[];
184
+ nextCursor?: string;
184
185
  }> &
185
186
  AsyncIterable<{ data: RootFieldItem[]; nextCursor?: string }> & {
186
187
  items(): AsyncIterable<InputFieldItem | InfoFieldItem | FieldsetItem>;
@@ -37,6 +37,7 @@ export const ListInputFieldsSchema = z
37
37
  .min(1)
38
38
  .optional()
39
39
  .describe("Maximum total items to return across all pages"),
40
+ cursor: z.string().optional().describe("Cursor to start from"),
40
41
  })
41
42
  .describe("Get the input fields required for a specific action");
42
43
 
@@ -24,7 +24,10 @@ import {
24
24
  import type { GetVersionedImplementationId } from "../manifest/schemas";
25
25
 
26
26
  export interface RunActionPluginProvides {
27
- runAction: (options?: RunActionOptions) => Promise<{ data: any[] }> &
27
+ runAction: (options?: RunActionOptions) => Promise<{
28
+ data: any[];
29
+ nextCursor?: string;
30
+ }> &
28
31
  AsyncIterable<{ data: any[]; nextCursor?: string }> & {
29
32
  items(): AsyncIterable<any>;
30
33
  };
@@ -34,6 +34,7 @@ export const RunActionSchema = z
34
34
  .min(1)
35
35
  .optional()
36
36
  .describe("Maximum total items to return across all pages"),
37
+ cursor: z.string().optional().describe("Cursor to start from"),
37
38
  })
38
39
  .describe("Execute an action with the given inputs");
39
40
 
@@ -7,8 +7,9 @@ import { ActionSchema } from "../api/schemas";
7
7
  // ============================================================================
8
8
 
9
9
  export const ActionItemSchema = withFormatter(
10
- ActionSchema.omit({ type: true, name: true }).extend({
11
- app_key: z.string(), // Mapped from selected_api
10
+ ActionSchema.omit({ type: true, name: true, selected_api: true }).extend({
11
+ app_key: z.string(), // App key without version (extracted from selected_api)
12
+ app_version: z.string().optional(), // Version extracted from selected_api
12
13
  action_type: ActionSchema.shape.type, // Mapped from original 'type' field
13
14
  title: z.string(), // Mapped from original 'name' field
14
15
  type: z.literal("action"), // Fixed type identifier
@@ -19,6 +19,7 @@ export const AppItemSchema = withFormatter(
19
19
  return {
20
20
  title: item.title,
21
21
  key: item.key,
22
+ keys: [item.slug, item.key].filter(Boolean),
22
23
  description: item.description,
23
24
  details: [],
24
25
  };
@@ -13,7 +13,7 @@ export const AuthenticationItemSchema = withFormatter(
13
13
  is_expired: z.string().optional(), // Mapped from is_stale
14
14
  expired_at: z.string().nullable().optional(), // Mapped from marked_stale_at
15
15
  app_key: z.string().optional(), // App key from implementations endpoint
16
- version: z.string().optional(), // Version extracted from implementation_id
16
+ app_version: z.string().optional(), // Version extracted from implementation_id
17
17
  user_id: z.number().optional(),
18
18
  },
19
19
  ),
@@ -6,7 +6,10 @@ import { MAX_PAGE_LIMIT } from "../constants";
6
6
  // These can be reused in function schemas without duplication
7
7
 
8
8
  export const AppKeyPropertySchema = withPositional(
9
- z.string().min(1).describe("App key (e.g., 'SlackCLIAPI')"),
9
+ z
10
+ .string()
11
+ .min(1)
12
+ .describe("App key (e.g., 'SlackCLIAPI' or slug like 'github')"),
10
13
  );
11
14
 
12
15
  export const ActionTypePropertySchema = z
@@ -59,16 +59,16 @@ export function normalizeImplementationMetaToAppItem(
59
59
  * @param auth - Raw Authentication from API
60
60
  * @param options - Additional fields to include
61
61
  * @param options.app_key - selected_api from implementations endpoint
62
- * @param options.version - Version extracted from selected_api
62
+ * @param options.app_version - Version extracted from selected_api
63
63
  * @returns Normalized AuthenticationItem
64
64
  */
65
65
  export function normalizeAuthenticationItem(
66
66
  auth: Authentication,
67
- options: { app_key?: string; version?: string } = {},
67
+ options: { app_key?: string; app_version?: string } = {},
68
68
  ): AuthenticationItem {
69
69
  // Extract app key and version from selected_api if not provided
70
70
  let appKey = options.app_key;
71
- let version = options.version;
71
+ let appVersion = options.app_version;
72
72
 
73
73
  if (auth.selected_api) {
74
74
  const [extractedAppKey, extractedVersion] = splitVersionedKey(
@@ -81,8 +81,8 @@ export function normalizeAuthenticationItem(
81
81
  }
82
82
 
83
83
  // Use extracted version if not provided in options
84
- if (!version) {
85
- version = extractedVersion;
84
+ if (!appVersion) {
85
+ appVersion = extractedVersion;
86
86
  }
87
87
  }
88
88
 
@@ -99,16 +99,29 @@ export function normalizeAuthenticationItem(
99
99
  is_expired: auth.is_stale, // Map is_stale to is_expired
100
100
  expired_at: auth.marked_stale_at, // Map marked_stale_at to expired_at
101
101
  app_key: appKey, // App key from implementations endpoint or parsed from selected_api
102
- version, // Version from selected_api or provided
102
+ app_version: appVersion, // Version from selected_api or provided
103
103
  user_id: userId, // Map customuser_id to user_id
104
104
  };
105
105
  }
106
106
 
107
107
  export function normalizeActionItem(action: Action): ActionItem {
108
- const { name, type, selected_api: appKey, ...restOfAction } = action;
108
+ const { name, type, selected_api: selectedApi } = action;
109
+
110
+ // Split version from selected_api
111
+ const [appKey, appVersion] = selectedApi
112
+ ? splitVersionedKey(selectedApi)
113
+ : ["", undefined];
114
+
109
115
  return {
110
- ...restOfAction,
111
- app_key: appKey || "",
116
+ // Only include the fields we want - explicitly list them
117
+ id: action.id,
118
+ key: action.key,
119
+ description: action.description,
120
+ is_important: action.is_important,
121
+ is_hidden: action.is_hidden,
122
+ // Transformed fields
123
+ app_key: appKey,
124
+ app_version: appVersion,
112
125
  action_type: type,
113
126
  title: name, // Map name to title
114
127
  type: "action",
@@ -10,6 +10,7 @@ export interface FormattedItem {
10
10
  title: string;
11
11
  id?: string;
12
12
  key?: string;
13
+ keys?: string[];
13
14
  description?: string;
14
15
  data?: unknown; // Optional: if provided, CLI will use formatJsonOutput instead of details
15
16
  details: Array<{