@zapier/zapier-sdk 0.46.0 → 0.47.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 (212) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/api/client.d.ts.map +1 -1
  3. package/dist/api/client.js +17 -6
  4. package/dist/api/types.d.ts +11 -0
  5. package/dist/api/types.d.ts.map +1 -1
  6. package/dist/index.cjs +3048 -3629
  7. package/dist/index.d.mts +6700 -2148
  8. package/dist/index.d.ts +5 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +1 -0
  11. package/dist/index.mjs +3045 -3630
  12. package/dist/plugins/api/index.d.ts +22 -10
  13. package/dist/plugins/api/index.d.ts.map +1 -1
  14. package/dist/plugins/api/index.js +4 -4
  15. package/dist/plugins/apps/index.d.ts +108 -7
  16. package/dist/plugins/apps/index.d.ts.map +1 -1
  17. package/dist/plugins/apps/index.js +3 -4
  18. package/dist/plugins/capabilities/index.d.ts +9 -6
  19. package/dist/plugins/capabilities/index.d.ts.map +1 -1
  20. package/dist/plugins/capabilities/index.js +3 -2
  21. package/dist/plugins/connections/index.d.ts +15 -9
  22. package/dist/plugins/connections/index.d.ts.map +1 -1
  23. package/dist/plugins/connections/index.js +3 -2
  24. package/dist/plugins/createClientCredentials/index.d.ts +26 -14
  25. package/dist/plugins/createClientCredentials/index.d.ts.map +1 -1
  26. package/dist/plugins/createClientCredentials/index.js +16 -39
  27. package/dist/plugins/createClientCredentials/schemas.d.ts +0 -2
  28. package/dist/plugins/createClientCredentials/schemas.d.ts.map +1 -1
  29. package/dist/plugins/deleteClientCredentials/index.d.ts +20 -14
  30. package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
  31. package/dist/plugins/deleteClientCredentials/index.js +18 -37
  32. package/dist/plugins/deleteClientCredentials/schemas.d.ts +0 -2
  33. package/dist/plugins/deleteClientCredentials/schemas.d.ts.map +1 -1
  34. package/dist/plugins/deprecated/authentications.d.ts +597 -41
  35. package/dist/plugins/deprecated/authentications.d.ts.map +1 -1
  36. package/dist/plugins/deprecated/authentications.js +9 -8
  37. package/dist/plugins/eventEmission/index.d.ts +9 -6
  38. package/dist/plugins/eventEmission/index.d.ts.map +1 -1
  39. package/dist/plugins/eventEmission/index.js +3 -2
  40. package/dist/plugins/fetch/index.d.ts +40 -17
  41. package/dist/plugins/fetch/index.d.ts.map +1 -1
  42. package/dist/plugins/fetch/index.js +6 -4
  43. package/dist/plugins/findFirstConnection/index.d.ts +109 -14
  44. package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
  45. package/dist/plugins/findFirstConnection/index.js +14 -26
  46. package/dist/plugins/findFirstConnection/schemas.d.ts +0 -2
  47. package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -1
  48. package/dist/plugins/findUniqueConnection/index.d.ts +109 -14
  49. package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
  50. package/dist/plugins/findUniqueConnection/index.js +14 -26
  51. package/dist/plugins/findUniqueConnection/schemas.d.ts +0 -2
  52. package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -1
  53. package/dist/plugins/getAction/index.d.ts +68 -15
  54. package/dist/plugins/getAction/index.d.ts.map +1 -1
  55. package/dist/plugins/getAction/index.js +21 -31
  56. package/dist/plugins/getAction/schemas.d.ts +0 -2
  57. package/dist/plugins/getAction/schemas.d.ts.map +1 -1
  58. package/dist/plugins/getApp/index.d.ts +140 -14
  59. package/dist/plugins/getApp/index.d.ts.map +1 -1
  60. package/dist/plugins/getApp/index.js +16 -38
  61. package/dist/plugins/getApp/schemas.d.ts +0 -2
  62. package/dist/plugins/getApp/schemas.d.ts.map +1 -1
  63. package/dist/plugins/getConnection/index.d.ts +50 -16
  64. package/dist/plugins/getConnection/index.d.ts.map +1 -1
  65. package/dist/plugins/getConnection/index.js +22 -29
  66. package/dist/plugins/getConnection/schemas.d.ts +0 -2
  67. package/dist/plugins/getConnection/schemas.d.ts.map +1 -1
  68. package/dist/plugins/getInputFieldsSchema/index.d.ts +59 -13
  69. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
  70. package/dist/plugins/getInputFieldsSchema/index.js +21 -32
  71. package/dist/plugins/getInputFieldsSchema/schemas.d.ts +0 -2
  72. package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +1 -1
  73. package/dist/plugins/getProfile/index.d.ts +25 -18
  74. package/dist/plugins/getProfile/index.d.ts.map +1 -1
  75. package/dist/plugins/getProfile/index.js +13 -26
  76. package/dist/plugins/getProfile/schemas.d.ts +0 -8
  77. package/dist/plugins/getProfile/schemas.d.ts.map +1 -1
  78. package/dist/plugins/getProfile/schemas.js +0 -1
  79. package/dist/plugins/listActions/index.d.ts +73 -23
  80. package/dist/plugins/listActions/index.d.ts.map +1 -1
  81. package/dist/plugins/listActions/index.js +25 -53
  82. package/dist/plugins/listActions/schemas.d.ts +0 -11
  83. package/dist/plugins/listActions/schemas.d.ts.map +1 -1
  84. package/dist/plugins/listApps/index.d.ts +121 -13
  85. package/dist/plugins/listApps/index.d.ts.map +1 -1
  86. package/dist/plugins/listApps/index.js +22 -31
  87. package/dist/plugins/listApps/schemas.d.ts +0 -2
  88. package/dist/plugins/listApps/schemas.d.ts.map +1 -1
  89. package/dist/plugins/listClientCredentials/index.d.ts +29 -16
  90. package/dist/plugins/listClientCredentials/index.d.ts.map +1 -1
  91. package/dist/plugins/listClientCredentials/index.js +17 -37
  92. package/dist/plugins/listClientCredentials/schemas.d.ts +0 -2
  93. package/dist/plugins/listClientCredentials/schemas.d.ts.map +1 -1
  94. package/dist/plugins/listConnections/index.d.ts +95 -17
  95. package/dist/plugins/listConnections/index.d.ts.map +1 -1
  96. package/dist/plugins/listConnections/index.js +25 -49
  97. package/dist/plugins/listConnections/schemas.d.ts +0 -2
  98. package/dist/plugins/listConnections/schemas.d.ts.map +1 -1
  99. package/dist/plugins/listInputFieldChoices/index.d.ts +77 -22
  100. package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
  101. package/dist/plugins/listInputFieldChoices/index.js +27 -50
  102. package/dist/plugins/listInputFieldChoices/schemas.d.ts +0 -2
  103. package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
  104. package/dist/plugins/listInputFields/index.d.ts +154 -22
  105. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  106. package/dist/plugins/listInputFields/index.js +28 -41
  107. package/dist/plugins/listInputFields/schemas.d.ts +0 -2
  108. package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
  109. package/dist/plugins/manifest/index.d.ts +40 -36
  110. package/dist/plugins/manifest/index.d.ts.map +1 -1
  111. package/dist/plugins/manifest/index.js +3 -2
  112. package/dist/plugins/registry/index.d.ts +11 -9
  113. package/dist/plugins/registry/index.d.ts.map +1 -1
  114. package/dist/plugins/registry/index.js +3 -2
  115. package/dist/plugins/request/index.d.ts +61 -15
  116. package/dist/plugins/request/index.d.ts.map +1 -1
  117. package/dist/plugins/request/index.js +14 -22
  118. package/dist/plugins/request/schemas.d.ts +0 -2
  119. package/dist/plugins/request/schemas.d.ts.map +1 -1
  120. package/dist/plugins/runAction/index.d.ts +137 -23
  121. package/dist/plugins/runAction/index.d.ts.map +1 -1
  122. package/dist/plugins/runAction/index.js +65 -78
  123. package/dist/plugins/runAction/schemas.d.ts +0 -10
  124. package/dist/plugins/runAction/schemas.d.ts.map +1 -1
  125. package/dist/plugins/tables/createTable/index.d.ts +43 -11
  126. package/dist/plugins/tables/createTable/index.d.ts.map +1 -1
  127. package/dist/plugins/tables/createTable/index.js +16 -44
  128. package/dist/plugins/tables/createTable/schemas.d.ts +0 -2
  129. package/dist/plugins/tables/createTable/schemas.d.ts.map +1 -1
  130. package/dist/plugins/tables/createTableFields/index.d.ts +54 -11
  131. package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
  132. package/dist/plugins/tables/createTableFields/index.js +17 -41
  133. package/dist/plugins/tables/createTableFields/schemas.d.ts +0 -2
  134. package/dist/plugins/tables/createTableFields/schemas.d.ts.map +1 -1
  135. package/dist/plugins/tables/createTableRecords/index.d.ts +47 -11
  136. package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
  137. package/dist/plugins/tables/createTableRecords/index.js +17 -43
  138. package/dist/plugins/tables/createTableRecords/schemas.d.ts +0 -2
  139. package/dist/plugins/tables/createTableRecords/schemas.d.ts.map +1 -1
  140. package/dist/plugins/tables/deleteTable/index.d.ts +36 -13
  141. package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
  142. package/dist/plugins/tables/deleteTable/index.js +18 -40
  143. package/dist/plugins/tables/deleteTable/schemas.d.ts +0 -2
  144. package/dist/plugins/tables/deleteTable/schemas.d.ts.map +1 -1
  145. package/dist/plugins/tables/deleteTableFields/index.d.ts +36 -11
  146. package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -1
  147. package/dist/plugins/tables/deleteTableFields/index.js +17 -39
  148. package/dist/plugins/tables/deleteTableFields/schemas.d.ts +0 -2
  149. package/dist/plugins/tables/deleteTableFields/schemas.d.ts.map +1 -1
  150. package/dist/plugins/tables/deleteTableRecords/index.d.ts +36 -11
  151. package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -1
  152. package/dist/plugins/tables/deleteTableRecords/index.js +18 -41
  153. package/dist/plugins/tables/deleteTableRecords/schemas.d.ts +0 -2
  154. package/dist/plugins/tables/deleteTableRecords/schemas.d.ts.map +1 -1
  155. package/dist/plugins/tables/getTable/index.d.ts +43 -12
  156. package/dist/plugins/tables/getTable/index.d.ts.map +1 -1
  157. package/dist/plugins/tables/getTable/index.js +18 -43
  158. package/dist/plugins/tables/getTable/schemas.d.ts +0 -2
  159. package/dist/plugins/tables/getTable/schemas.d.ts.map +1 -1
  160. package/dist/plugins/tables/getTableRecord/index.d.ts +43 -11
  161. package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -1
  162. package/dist/plugins/tables/getTableRecord/index.js +18 -42
  163. package/dist/plugins/tables/getTableRecord/schemas.d.ts +0 -2
  164. package/dist/plugins/tables/getTableRecord/schemas.d.ts.map +1 -1
  165. package/dist/plugins/tables/listTableFields/index.d.ts +46 -11
  166. package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -1
  167. package/dist/plugins/tables/listTableFields/index.js +17 -41
  168. package/dist/plugins/tables/listTableFields/schemas.d.ts +0 -2
  169. package/dist/plugins/tables/listTableFields/schemas.d.ts.map +1 -1
  170. package/dist/plugins/tables/listTableRecords/index.d.ts +66 -18
  171. package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
  172. package/dist/plugins/tables/listTableRecords/index.js +27 -50
  173. package/dist/plugins/tables/listTableRecords/schemas.d.ts +0 -2
  174. package/dist/plugins/tables/listTableRecords/schemas.d.ts.map +1 -1
  175. package/dist/plugins/tables/listTables/index.d.ts +53 -20
  176. package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
  177. package/dist/plugins/tables/listTables/index.js +24 -51
  178. package/dist/plugins/tables/listTables/schemas.d.ts +0 -2
  179. package/dist/plugins/tables/listTables/schemas.d.ts.map +1 -1
  180. package/dist/plugins/tables/shared.d.ts +10 -0
  181. package/dist/plugins/tables/shared.d.ts.map +1 -0
  182. package/dist/plugins/tables/shared.js +9 -0
  183. package/dist/plugins/tables/updateTableRecords/index.d.ts +49 -11
  184. package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
  185. package/dist/plugins/tables/updateTableRecords/index.js +20 -43
  186. package/dist/plugins/tables/updateTableRecords/schemas.d.ts +0 -2
  187. package/dist/plugins/tables/updateTableRecords/schemas.d.ts.map +1 -1
  188. package/dist/plugins/tables/utils.d.ts.map +1 -1
  189. package/dist/plugins/tables/utils.js +1 -0
  190. package/dist/registry.d.ts.map +1 -1
  191. package/dist/registry.js +21 -1
  192. package/dist/resolvers/actionKey.d.ts +1 -2
  193. package/dist/resolvers/actionKey.d.ts.map +1 -1
  194. package/dist/resolvers/actionType.d.ts +1 -2
  195. package/dist/resolvers/actionType.d.ts.map +1 -1
  196. package/dist/sdk.d.ts +2942 -2
  197. package/dist/sdk.d.ts.map +1 -1
  198. package/dist/types/errors.d.ts +13 -10
  199. package/dist/types/errors.d.ts.map +1 -1
  200. package/dist/types/errors.js +15 -12
  201. package/dist/types/functions.d.ts +18 -2
  202. package/dist/types/functions.d.ts.map +1 -1
  203. package/dist/types/plugin.d.ts +1 -1
  204. package/dist/types/plugin.d.ts.map +1 -1
  205. package/dist/types/registry.d.ts +1 -1
  206. package/dist/types/registry.d.ts.map +1 -1
  207. package/dist/utils/function-utils.d.ts +11 -12
  208. package/dist/utils/function-utils.d.ts.map +1 -1
  209. package/dist/utils/plugin-utils.d.ts +243 -0
  210. package/dist/utils/plugin-utils.d.ts.map +1 -0
  211. package/dist/utils/plugin-utils.js +232 -0
  212. package/package.json +2 -1
@@ -1,38 +1,31 @@
1
- import { createFunction } from "../../utils/function-utils";
1
+ import { definePlugin } from "../../utils/plugin-utils";
2
+ import { createPluginMethod } from "../../utils/plugin-utils";
2
3
  import { connectionIdGenericResolver } from "../../resolvers";
3
4
  import { transformConnectionItem } from "../../utils/domain-utils";
4
5
  import { ConnectionItemSchema } from "../../schemas/Connection";
5
- import { createTelemetryCallback } from "../../utils/telemetry-utils";
6
6
  import { GetConnectionParamSchema } from "./schemas";
7
- export const getConnectionPlugin = (sdk) => {
8
- async function getConnection(options) {
7
+ export const getConnectionPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
8
+ name: "getConnection",
9
+ categories: ["connection"],
10
+ type: "item",
11
+ itemType: "Connection",
12
+ inputSchema: GetConnectionParamSchema,
13
+ outputSchema: ConnectionItemSchema,
14
+ resolvers: { connection: connectionIdGenericResolver },
15
+ handler: async ({ sdk, options }) => {
9
16
  const { api } = sdk.context;
10
- const resolvedConnectionId = options.connection ?? options.connectionId ?? options.authenticationId;
17
+ const resolvedConnectionId = options.connection ??
18
+ options.connectionId ??
19
+ options.authenticationId;
11
20
  if (!resolvedConnectionId) {
12
21
  throw new Error("connection is required");
13
22
  }
14
- const response = await api.get(`/api/v0/connections/${encodeURIComponent(String(resolvedConnectionId))}`);
15
- return {
16
- ...response,
17
- data: transformConnectionItem(response.data),
18
- };
19
- }
20
- const getConnectionDefinition = createFunction(getConnection, GetConnectionParamSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, getConnection.name));
21
- return {
22
- getConnection: getConnectionDefinition,
23
- context: {
24
- meta: {
25
- getConnection: {
26
- categories: ["connection"],
27
- type: "item",
28
- itemType: "Connection",
29
- inputSchema: GetConnectionParamSchema,
30
- outputSchema: ConnectionItemSchema,
31
- resolvers: {
32
- connection: connectionIdGenericResolver,
33
- },
34
- },
23
+ const response = await api.get(`/api/v0/connections/${encodeURIComponent(String(resolvedConnectionId))}`, {
24
+ resource: {
25
+ type: "connection",
26
+ id: String(resolvedConnectionId),
35
27
  },
36
- },
37
- };
38
- };
28
+ });
29
+ return { ...response, data: transformConnectionItem(response.data) };
30
+ },
31
+ }));
@@ -1,13 +1,11 @@
1
1
  import type { GetConnectionResponse } from "@zapier/zapier-sdk-core/v0/schemas/connections";
2
2
  import { z } from "zod";
3
- import type { ZapierAuthenticationError, ZapierResourceNotFoundError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
4
3
  export declare const GetConnectionParamSchema: z.ZodObject<{
5
4
  connection: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
6
5
  connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
7
6
  authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
8
7
  }, z.core.$strip>;
9
8
  export type GetConnectionParam = z.infer<typeof GetConnectionParamSchema>;
10
- export type GetConnectionError = ZapierAuthenticationError | ZapierResourceNotFoundError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
11
9
  export interface GetConnectionSdkFunction {
12
10
  getConnection: (options: GetConnectionParam) => Promise<GetConnectionResponse>;
13
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getConnection/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC3B,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,wBAAwB;;;;iBAUnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAG1E,MAAM,MAAM,kBAAkB,GAC1B,yBAAyB,GACzB,2BAA2B,GAC3B,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,CACb,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACrC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getConnection/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,wBAAwB;;;;iBAUnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAG1E,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,CACb,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACrC"}
@@ -1,26 +1,72 @@
1
- import type { Plugin } from "../../types/plugin";
2
1
  import type { ApiClient } from "../../api";
3
- import { GetInputFieldsSchemaSchema, type GetInputFieldsSchemaOptions as GetInputFieldsSchemaOptions } from "./schemas";
4
- import type { GetActionPluginProvides } from "../getAction";
5
2
  import type { GetVersionedImplementationId } from "../manifest/schemas";
6
- import type { EventEmissionProvides } from "../eventEmission";
7
3
  import type { ConnectionsPluginProvides } from "../connections";
8
- export interface GetInputFieldsSchemaPluginProvides {
9
- getInputFieldsSchema: (options: GetInputFieldsSchemaOptions) => Promise<{
10
- data: Record<string, unknown>;
4
+ export declare const getInputFieldsSchemaPlugin: (sdk: {
5
+ getAction: (options?: {
6
+ app: string;
7
+ actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
8
+ action: string;
9
+ } | {
10
+ appKey: string;
11
+ actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
12
+ actionKey: string;
13
+ } | undefined) => Promise<{
14
+ data: {
15
+ description: string;
16
+ key: string;
17
+ app_key: string;
18
+ action_type: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
19
+ title: string;
20
+ type: "action";
21
+ id?: string | undefined;
22
+ is_important?: boolean | undefined;
23
+ is_hidden?: boolean | undefined;
24
+ app_version?: string | undefined;
25
+ };
11
26
  }>;
27
+ } & {
12
28
  context: {
13
29
  meta: {
14
- getInputFieldsSchema: {
15
- inputSchema: typeof GetInputFieldsSchemaSchema;
16
- };
30
+ getAction: import("../..").PluginMeta;
17
31
  };
18
32
  };
19
- }
20
- export declare const getInputFieldsSchemaPlugin: Plugin<GetActionPluginProvides & {
33
+ } & {
21
34
  context: {
22
35
  api: ApiClient;
23
36
  getVersionedImplementationId: GetVersionedImplementationId;
24
37
  } & ConnectionsPluginProvides["context"];
25
- } & EventEmissionProvides, GetInputFieldsSchemaPluginProvides>;
38
+ } & {
39
+ context: import("../eventEmission").EventEmissionContext;
40
+ } & {
41
+ context: {
42
+ meta: Record<string, import("../..").PluginMeta>;
43
+ };
44
+ }) => {
45
+ getInputFieldsSchema: (options?: {
46
+ app: string;
47
+ actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
48
+ action: string;
49
+ connection?: string | number | undefined;
50
+ connectionId?: string | number | null | undefined;
51
+ authenticationId?: string | number | null | undefined;
52
+ inputs?: Record<string, unknown> | undefined;
53
+ } | {
54
+ appKey: string;
55
+ actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
56
+ actionKey: string;
57
+ connection?: string | number | undefined;
58
+ connectionId?: string | number | null | undefined;
59
+ authenticationId?: string | number | null | undefined;
60
+ inputs?: Record<string, unknown> | undefined;
61
+ } | undefined) => Promise<{
62
+ data: Record<string, unknown>;
63
+ }>;
64
+ } & {
65
+ context: {
66
+ meta: {
67
+ getInputFieldsSchema: import("../..").PluginMeta;
68
+ };
69
+ };
70
+ };
71
+ export type GetInputFieldsSchemaPluginProvides = ReturnType<typeof getInputFieldsSchemaPlugin>;
26
72
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getInputFieldsSchema/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAE1B,KAAK,2BAA2B,IAAI,2BAA2B,EAChE,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAUxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAIhE,MAAM,WAAW,kCAAkC;IACjD,oBAAoB,EAAE,CACpB,OAAO,EAAE,2BAA2B,KACjC,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;IAChD,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,oBAAoB,EAAE;gBACpB,WAAW,EAAE,OAAO,0BAA0B,CAAC;aAChD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAC7C,uBAAuB,GAAG;IACxB,OAAO,EAAE;QACP,GAAG,EAAE,SAAS,CAAC;QACf,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAC;CAC1C,GAAG,qBAAqB,EACzB,kCAAkC,CAmFnC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getInputFieldsSchema/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI3C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAUxE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAIhE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAGxB;QACP,GAAG,EAAE,SAAS,CAAC;QACf,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D,GAAG,yBAAyB,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;cAmBpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;CAoDhD,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,UAAU,CACzD,OAAO,0BAA0B,CAClC,CAAC"}
@@ -1,17 +1,29 @@
1
- import { GetInputFieldsSchemaSchema, GetInputFieldsSchemaInputSchema, } from "./schemas";
1
+ import { definePlugin } from "../../utils/plugin-utils";
2
+ import { createPluginMethod } from "../../utils/plugin-utils";
3
+ import { GetInputFieldsSchemaInputSchema } from "./schemas";
2
4
  import { ZapierConfigurationError } from "../../types/errors";
3
- import { createFunction } from "../../utils/function-utils";
4
5
  import { appKeyResolver, actionTypeResolver, actionKeyResolver, connectionIdResolver, inputsAllOptionalResolver, } from "../../resolvers";
5
6
  import { fetchImplementationNeeds } from "../../services/implementations";
6
- import { createTelemetryCallback } from "../../utils/telemetry-utils";
7
7
  import { resolveConnectionId } from "../../utils/domain-utils";
8
8
  import { setMethodMetadata } from "../../utils/telemetry-context";
9
- export const getInputFieldsSchemaPlugin = (sdk) => {
10
- async function getInputFieldsSchema(options) {
9
+ export const getInputFieldsSchemaPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
10
+ name: "getInputFieldsSchema",
11
+ categories: ["action"],
12
+ type: "item",
13
+ itemType: "InputSchema",
14
+ inputSchema: GetInputFieldsSchemaInputSchema,
15
+ resolvers: {
16
+ app: appKeyResolver,
17
+ actionType: actionTypeResolver,
18
+ action: actionKeyResolver,
19
+ connection: connectionIdResolver,
20
+ inputs: inputsAllOptionalResolver,
21
+ },
22
+ handler: async ({ sdk, options, }) => {
11
23
  const { api, getVersionedImplementationId } = sdk.context;
12
24
  const appKey = "app" in options ? options.app : options.appKey;
13
25
  const actionKey = "action" in options ? options.action : options.actionKey;
14
- const { actionType, connection, connectionId, authenticationId, inputs } = options;
26
+ const { actionType, connection, connectionId, authenticationId, inputs, } = options;
15
27
  const resolvedConnectionId = await resolveConnectionId({
16
28
  connection,
17
29
  connectionId,
@@ -40,29 +52,6 @@ export const getInputFieldsSchemaPlugin = (sdk) => {
40
52
  connectionId: resolvedConnectionId ?? null,
41
53
  inputs,
42
54
  });
43
- return {
44
- data: needsData.schema || {},
45
- };
46
- }
47
- const getInputFieldsSchemaDefinition = createFunction(getInputFieldsSchema, GetInputFieldsSchemaInputSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, getInputFieldsSchema.name));
48
- return {
49
- getInputFieldsSchema: getInputFieldsSchemaDefinition,
50
- context: {
51
- meta: {
52
- getInputFieldsSchema: {
53
- categories: ["action"],
54
- type: "item",
55
- itemType: "InputSchema",
56
- inputSchema: GetInputFieldsSchemaSchema,
57
- resolvers: {
58
- app: appKeyResolver,
59
- actionType: actionTypeResolver,
60
- action: actionKeyResolver,
61
- connection: connectionIdResolver,
62
- inputs: inputsAllOptionalResolver,
63
- },
64
- },
65
- },
66
- },
67
- };
68
- };
55
+ return { data: needsData.schema || {} };
56
+ },
57
+ }));
@@ -1,5 +1,4 @@
1
1
  import { z } from "zod";
2
- import type { ZapierConfigurationError, ZapierApiError, ZapierAuthenticationError, ZapierAppNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
3
2
  export declare const GetInputFieldsSchemaSchema: z.ZodObject<{
4
3
  app: z.ZodString & {
5
4
  _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
@@ -89,7 +88,6 @@ export type GetInputFieldsSchemaOptions = z.infer<typeof GetInputFieldsSchemaSch
89
88
  /** @deprecated Use `action` instead. */
90
89
  actionKey: z.infer<typeof GetInputFieldsSchemaSchemaDeprecated>["actionKey"];
91
90
  });
92
- export type GetInputFieldsSchemaError = ZapierConfigurationError | ZapierApiError | ZapierAuthenticationError | ZapierAppNotFoundError | ZapierValidationError | ZapierUnknownError;
93
91
  export interface GetInputFieldsSchemaSdkFunction {
94
92
  getInputFieldsSchema: (options: GetInputFieldsSchemaOptions) => Promise<{
95
93
  data: Record<string, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getInputFieldsSchema/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,OAAO,KAAK,EACV,wBAAwB,EACxB,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AA6B5B,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;iBAqBnC,CAAC;AAGL,QAAA,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;iBAYF,CAAC;AAGzC,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAEA,CAAC;AAG7C,MAAM,MAAM,2BAA2B,GACnC,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,GAC1C,CAAC,IAAI,CACH,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,EACpD,QAAQ,GAAG,WAAW,CACvB,GAAG;IACF,qCAAqC;IACrC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACvE,wCAAwC;IACxC,SAAS,EAAE,CAAC,CAAC,KAAK,CAChB,OAAO,oCAAoC,CAC5C,CAAC,WAAW,CAAC,CAAC;CAChB,CAAC,CAAC;AAEP,MAAM,MAAM,yBAAyB,GACjC,wBAAwB,GACxB,cAAc,GACd,yBAAyB,GACzB,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,+BAA+B;IAC9C,oBAAoB,EAAE,CACpB,OAAO,EAAE,2BAA2B,KACjC,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CACjD"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getInputFieldsSchema/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwCxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;iBAqBnC,CAAC;AAGL,QAAA,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;iBAYF,CAAC;AAGzC,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAEA,CAAC;AAG7C,MAAM,MAAM,2BAA2B,GACnC,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,GAC1C,CAAC,IAAI,CACH,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,EACpD,QAAQ,GAAG,WAAW,CACvB,GAAG;IACF,qCAAqC;IACrC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACvE,wCAAwC;IACxC,SAAS,EAAE,CAAC,CAAC,KAAK,CAChB,OAAO,oCAAoC,CAC5C,CAAC,WAAW,CAAC,CAAC;CAChB,CAAC,CAAC;AAEP,MAAM,WAAW,+BAA+B;IAC9C,oBAAoB,EAAE,CACpB,OAAO,EAAE,2BAA2B,KACjC,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CACjD"}
@@ -1,25 +1,32 @@
1
- import type { GetProfileOptions } from "./schemas";
2
1
  import type { ApiClient } from "../../api/types";
3
- import type { Plugin } from "../../types/plugin";
4
- import type { UserProfileItem } from "../../types/domain";
5
- import { GetProfileSchema } from "./schemas";
6
- import type { EventEmissionProvides } from "../eventEmission";
7
- export interface GetProfilePluginProvides {
8
- getProfile: (options?: GetProfileOptions) => Promise<{
9
- data: UserProfileItem;
2
+ export declare const getProfilePlugin: (sdk: {
3
+ context: {
4
+ api: ApiClient;
5
+ };
6
+ } & {
7
+ context: import("../eventEmission").EventEmissionContext;
8
+ } & {
9
+ context: {
10
+ meta: Record<string, import("../..").PluginMeta>;
11
+ };
12
+ }) => {
13
+ getProfile: (options?: Record<string, never> | undefined) => Promise<{
14
+ data: {
15
+ id: string;
16
+ first_name: string;
17
+ last_name: string;
18
+ full_name: string;
19
+ email: string;
20
+ email_confirmed: boolean;
21
+ timezone: string;
22
+ };
10
23
  }>;
24
+ } & {
11
25
  context: {
12
26
  meta: {
13
- getProfile: {
14
- inputSchema: typeof GetProfileSchema;
15
- };
27
+ getProfile: import("../..").PluginMeta;
16
28
  };
17
29
  };
18
- }
19
- export declare const getProfilePlugin: Plugin<{
20
- context: {
21
- api: ApiClient;
22
- };
23
- } & EventEmissionProvides, // no SDK dependencies, requires api and eventEmission in context
24
- GetProfilePluginProvides>;
30
+ };
31
+ export type GetProfilePluginProvides = ReturnType<typeof getProfilePlugin>;
25
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAG9D,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,CACV,OAAO,CAAC,EAAE,iBAAiB,KACxB,OAAO,CAAC;QAAE,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC,CAAC;IACxC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,UAAU,EAAE;gBACV,WAAW,EAAE,OAAO,gBAAgB,CAAC;aACtC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAGD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC;IAAE,OAAO,EAAE;QAAE,GAAG,EAAE,SAAS,CAAA;KAAE,CAAA;CAAE,GAAG,qBAAqB,EAAE,iEAAiE;AAC1H,wBAAwB,CA+CzB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAO9D,eAAO,MAAM,gBAAgB;aAGd;QAAE,GAAG,EAAE,SAAS,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;CA4BhC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -1,13 +1,16 @@
1
- import { createFunction } from "../../utils/function-utils";
1
+ import { definePlugin } from "../../utils/plugin-utils";
2
+ import { createPluginMethod } from "../../utils/plugin-utils";
2
3
  import { GetProfileSchema } from "./schemas";
3
4
  import { UserProfileItemSchema } from "../../schemas/UserProfile";
4
- import { createTelemetryCallback } from "../../utils/telemetry-utils";
5
- // Direct plugin function - takes options + sdk + context in one object
6
- export const getProfilePlugin = (sdk) => {
7
- async function getProfile() {
8
- const profile = await sdk.context.api.get("/zapier/api/v4/profile/", {
9
- authRequired: true,
10
- });
5
+ export const getProfilePlugin = definePlugin((sdk) => createPluginMethod(sdk, {
6
+ name: "getProfile",
7
+ categories: ["account"],
8
+ type: "item",
9
+ itemType: "Profile",
10
+ inputSchema: GetProfileSchema,
11
+ outputSchema: UserProfileItemSchema,
12
+ handler: async ({ sdk }) => {
13
+ const profile = await sdk.context.api.get("/zapier/api/v4/profile/", { authRequired: true });
11
14
  return {
12
15
  data: {
13
16
  id: String(profile.public_id ?? profile.id),
@@ -19,21 +22,5 @@ export const getProfilePlugin = (sdk) => {
19
22
  timezone: profile.timezone,
20
23
  },
21
24
  };
22
- }
23
- const getProfileDefinition = createFunction(getProfile, GetProfileSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, getProfile.name));
24
- // Return flat structure - getProfile goes directly to SDK
25
- return {
26
- getProfile: getProfileDefinition,
27
- context: {
28
- meta: {
29
- getProfile: {
30
- categories: ["account"],
31
- type: "item",
32
- itemType: "Profile",
33
- inputSchema: GetProfileSchema,
34
- outputSchema: UserProfileItemSchema,
35
- },
36
- },
37
- },
38
- };
39
- };
25
+ },
26
+ }));
@@ -1,13 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import type { FunctionOptions } from "../../types/functions";
3
- import type { UserProfileItem } from "../../types/domain";
4
- import type { ZapierApiError, ZapierValidationError } from "../../types/errors";
5
- export type GetProfileError = ZapierApiError | ZapierValidationError;
6
3
  export declare const GetProfileSchema: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
7
4
  export type GetProfileOptions = z.infer<typeof GetProfileSchema> & FunctionOptions;
8
- export interface GetProfileSdkFunction {
9
- getProfile: (options?: GetProfileOptions) => Promise<{
10
- data: UserProfileItem;
11
- }>;
12
- }
13
5
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGhF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,qBAAqB,CAAC;AAGrE,eAAO,MAAM,gBAAgB,+CAGwB,CAAC;AAGtD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GAC9D,eAAe,CAAC;AAGlB,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,CACV,OAAO,CAAC,EAAE,iBAAiB,KACxB,OAAO,CAAC;QAAE,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC,CAAC;CACzC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,eAAO,MAAM,gBAAgB,+CAGwB,CAAC;AAEtD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GAC9D,eAAe,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { z } from "zod";
2
- // Pure Zod schema - no resolver metadata!
3
2
  export const GetProfileSchema = z
4
3
  .object({})
5
4
  .optional()
@@ -1,32 +1,82 @@
1
- import type { Plugin } from "../../types/plugin";
2
1
  import type { ApiClient } from "../../api";
3
- import type { ActionItem } from "../../types/domain";
4
- import { ListActionsSchema, type ListActionsOptions } from "./schemas";
5
- import type { ManifestPluginProvides } from "../manifest";
6
2
  import type { GetVersionedImplementationId } from "../manifest/schemas";
7
- import type { EventEmissionProvides } from "../eventEmission";
8
- export interface ListActionsPluginProvides {
9
- listActions: (options?: ListActionsOptions) => Promise<{
10
- data: ActionItem[];
11
- nextCursor?: string;
12
- }> & AsyncIterable<{
13
- data: ActionItem[];
14
- nextCursor?: string;
15
- }> & {
16
- items(): AsyncIterable<ActionItem>;
17
- };
3
+ export declare const listActionsPlugin: (sdk: {
18
4
  context: {
19
- meta: {
20
- listActions: {
21
- inputSchema: typeof ListActionsSchema;
22
- };
23
- };
5
+ getResolvedManifest: () => Promise<import("../manifest").Manifest | null>;
6
+ getVersionedImplementationId: (appKey: string) => Promise<string | null>;
7
+ resolveAppKeys: ({ appKeys }: {
8
+ appKeys: string[];
9
+ }) => Promise<import("../..").ResolvedAppLocator[]>;
10
+ updateManifestEntry: (options: import("../manifest").UpdateManifestEntryOptions) => Promise<import("../manifest").UpdateManifestEntryResult>;
11
+ addActionEntry: (options: import("../manifest").AddActionEntryOptions) => Promise<import("../manifest").AddActionEntryResult>;
12
+ findActionEntry: ({ name, manifest, }: {
13
+ name: string;
14
+ manifest: import("../manifest").Manifest;
15
+ }) => import("../manifest").ActionEntry | null;
16
+ listActionEntries: ({ configPath, }?: {
17
+ configPath?: string;
18
+ }) => Promise<Array<[string, import("../manifest").ActionEntry]>>;
19
+ deleteActionEntry: ({ name, configPath, skipWrite, }: {
20
+ name: string;
21
+ configPath?: string;
22
+ skipWrite?: boolean;
23
+ }) => Promise<import("../manifest").Manifest>;
24
+ hasActionEntry: ({ name, manifest, }: {
25
+ name: string;
26
+ manifest: import("../manifest").Manifest;
27
+ }) => boolean;
28
+ findManifestEntry: typeof import("../manifest").findManifestEntry;
29
+ readManifestFromFile: typeof import("../manifest").readManifestFromFile;
30
+ getManifestConnections: () => Promise<Record<string, {
31
+ connectionId: string | number;
32
+ }> | null>;
24
33
  };
25
- }
26
- export declare const listActionsPlugin: Plugin<ManifestPluginProvides & {
34
+ } & {
27
35
  context: {
28
36
  api: ApiClient;
29
37
  getVersionedImplementationId: GetVersionedImplementationId;
30
38
  };
31
- } & EventEmissionProvides, ListActionsPluginProvides>;
39
+ } & {
40
+ context: import("../eventEmission").EventEmissionContext;
41
+ } & {
42
+ context: {
43
+ meta: Record<string, import("../..").PluginMeta>;
44
+ };
45
+ }) => {
46
+ listActions: (options?: (({
47
+ app: string;
48
+ actionType?: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write" | undefined;
49
+ pageSize?: number | undefined;
50
+ maxItems?: number | undefined;
51
+ cursor?: string | undefined;
52
+ } | {
53
+ appKey: string;
54
+ actionType?: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write" | undefined;
55
+ pageSize?: number | undefined;
56
+ maxItems?: number | undefined;
57
+ cursor?: string | undefined;
58
+ }) & {
59
+ cursor?: string;
60
+ pageSize?: number;
61
+ maxItems?: number;
62
+ }) | undefined) => import("../..").PaginatedSdkResult<{
63
+ description: string;
64
+ key: string;
65
+ app_key: string;
66
+ action_type: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
67
+ title: string;
68
+ type: "action";
69
+ id?: string | undefined;
70
+ is_important?: boolean | undefined;
71
+ is_hidden?: boolean | undefined;
72
+ app_version?: string | undefined;
73
+ }>;
74
+ } & {
75
+ context: {
76
+ meta: {
77
+ listActions: import("../..").PluginMeta;
78
+ };
79
+ };
80
+ };
81
+ export type ListActionsPluginProvides = ReturnType<typeof listActionsPlugin>;
32
82
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,iBAAiB,EAEjB,KAAK,kBAAkB,EAExB,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAK9D,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC;QACrD,IAAI,EAAE,UAAU,EAAE,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC3D,KAAK,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;KACpC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,WAAW,EAAE,OAAO,iBAAiB,CAAC;aACvC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CACpC,sBAAsB,GAAG;IACvB,OAAO,EAAE;QACP,GAAG,EAAE,SAAS,CAAC;QACf,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D,CAAC;CACH,GAAG,qBAAqB,EACzB,yBAAyB,CAgH1B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,WAAW,CAAC;AAQ3D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAKxE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;sBA8E4tW,CAAC;;;;sBAAiX,CAAC;qBAAyB,CAAC;;;;;;;;;;;;;aA3ExnX;QACP,GAAG,EAAE,SAAS,CAAC;QACf,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEN,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,83 +1,55 @@
1
+ import { definePlugin } from "../../utils/plugin-utils";
2
+ import { createPaginatedPluginMethod } from "../../utils/plugin-utils";
1
3
  import { normalizeActionItem } from "../../utils/domain-utils";
2
- import { ListActionsSchema, ListActionsInputSchema, } from "./schemas";
4
+ import { ListActionsInputSchema } from "./schemas";
3
5
  import { ActionItemSchema } from "../../schemas/Action";
4
- import { ZapierConfigurationError, ZapierAuthenticationError, } from "../../types/errors";
5
- import { createPaginatedFunction } from "../../utils/function-utils";
6
+ import { ZapierConfigurationError } from "../../types/errors";
6
7
  import { DEFAULT_PAGE_SIZE } from "../../constants";
7
8
  import { appKeyResolver, actionTypeResolver } from "../../resolvers";
8
- import { createTelemetryCallback } from "../../utils/telemetry-utils";
9
- import { stripPageSuffix } from "../../utils/string-utils";
10
9
  import { setMethodMetadata } from "../../utils/telemetry-context";
11
- export const listActionsPlugin = (sdk) => {
12
- const methodMeta = {
13
- categories: ["action"],
14
- type: "list",
15
- itemType: "Action",
16
- inputSchema: ListActionsSchema,
17
- outputSchema: ActionItemSchema,
18
- resolvers: {
19
- app: appKeyResolver,
20
- actionType: actionTypeResolver,
21
- },
22
- };
23
- async function listActionsPage(options) {
10
+ export const listActionsPlugin = definePlugin((sdk) => createPaginatedPluginMethod(sdk, {
11
+ name: "listActions",
12
+ categories: ["action"],
13
+ type: "list",
14
+ itemType: "Action",
15
+ inputSchema: ListActionsInputSchema,
16
+ outputSchema: ActionItemSchema,
17
+ defaultPageSize: DEFAULT_PAGE_SIZE,
18
+ resolvers: { app: appKeyResolver, actionType: actionTypeResolver },
19
+ handler: async ({ sdk, options, }) => {
24
20
  const { api, getVersionedImplementationId } = sdk.context;
25
21
  const appKey = "app" in options ? options.app : options.appKey;
26
- // Use getVersionedImplementationId (optimized to check manifest first)
27
22
  const selectedApi = await getVersionedImplementationId(appKey);
28
23
  if (!selectedApi) {
29
24
  throw new ZapierConfigurationError("No current_implementation_id found for app", { configType: "current_implementation_id" });
30
25
  }
31
- // operationKey is intentionally omitted — listActions is a list-level operation with no specific action key.
26
+ // operationKey intentionally omitted — listActions is a list-level
27
+ // operation with no specific action key.
32
28
  setMethodMetadata({
33
29
  selectedApi,
34
30
  operationType: options.actionType ?? null,
35
31
  });
36
- const searchParams = {
37
- global: "true",
38
- public_only: "true",
39
- selected_apis: selectedApi,
40
- };
41
32
  const data = await api.get("/zapier/api/v4/implementations/", {
42
- searchParams,
43
- customErrorHandler: ({ status }) => {
44
- if (status === 401) {
45
- return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to access implementations or may be expired. (HTTP ${status})`, { statusCode: status });
46
- }
47
- if (status === 403) {
48
- return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to list implementations. (HTTP ${status})`, { statusCode: status });
49
- }
50
- return undefined;
33
+ searchParams: {
34
+ global: "true",
35
+ public_only: "true",
36
+ selected_apis: selectedApi,
51
37
  },
52
38
  });
53
39
  let allActions = [];
54
40
  for (const implementation of data.results || []) {
55
41
  if (implementation.actions) {
56
42
  for (const action of implementation.actions) {
57
- const actionWithContext = {
43
+ allActions.push(normalizeActionItem({
58
44
  ...action,
59
45
  selected_api: action.selected_api || implementation.selected_api,
60
- };
61
- allActions.push(normalizeActionItem(actionWithContext));
46
+ }));
62
47
  }
63
48
  }
64
49
  }
65
50
  if (options.actionType) {
66
51
  allActions = allActions.filter((action) => action.action_type === options.actionType);
67
52
  }
68
- return {
69
- data: allActions,
70
- nextCursor: undefined,
71
- };
72
- }
73
- const methodName = stripPageSuffix(listActionsPage.name);
74
- const listActionsDefinition = createPaginatedFunction(listActionsPage, ListActionsInputSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
75
- return {
76
- listActions: listActionsDefinition,
77
- context: {
78
- meta: {
79
- listActions: methodMeta,
80
- },
81
- },
82
- };
83
- };
53
+ return { data: allActions };
54
+ },
55
+ }));