@zapier/zapier-sdk 0.48.1 → 0.49.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 (207) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +818 -70
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +10 -1
  5. package/dist/api/polling.d.ts +7 -0
  6. package/dist/api/polling.d.ts.map +1 -1
  7. package/dist/api/polling.js +29 -4
  8. package/dist/api/types.d.ts +7 -0
  9. package/dist/api/types.d.ts.map +1 -1
  10. package/dist/experimental.cjs +10389 -0
  11. package/dist/experimental.d.mts +2292 -0
  12. package/dist/experimental.d.ts +2308 -0
  13. package/dist/experimental.d.ts.map +1 -0
  14. package/dist/experimental.js +155 -0
  15. package/dist/experimental.mjs +10207 -0
  16. package/dist/index-C2vsvjgN.d.mts +9539 -0
  17. package/dist/index-C2vsvjgN.d.ts +9539 -0
  18. package/dist/index.cjs +813 -602
  19. package/dist/index.d.mts +6 -8562
  20. package/dist/index.d.ts +7 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +5 -1
  23. package/dist/index.mjs +801 -602
  24. package/dist/plugins/apps/index.d.ts +1 -1
  25. package/dist/plugins/deprecated/inputFields.d.ts +468 -0
  26. package/dist/plugins/deprecated/inputFields.d.ts.map +1 -0
  27. package/dist/plugins/deprecated/inputFields.js +73 -0
  28. package/dist/plugins/fetch/index.d.ts +1 -1
  29. package/dist/plugins/fetch/schemas.d.ts +1 -1
  30. package/dist/plugins/{getInputFieldsSchema → getActionInputFieldsSchema}/index.d.ts +4 -4
  31. package/dist/plugins/getActionInputFieldsSchema/index.d.ts.map +1 -0
  32. package/dist/plugins/{getInputFieldsSchema → getActionInputFieldsSchema}/index.js +4 -4
  33. package/dist/plugins/{getInputFieldsSchema → getActionInputFieldsSchema}/schemas.d.ts +8 -8
  34. package/dist/plugins/getActionInputFieldsSchema/schemas.d.ts.map +1 -0
  35. package/dist/plugins/{getInputFieldsSchema → getActionInputFieldsSchema}/schemas.js +13 -10
  36. package/dist/plugins/{listInputFieldChoices → listActionInputFieldChoices}/index.d.ts +4 -4
  37. package/dist/plugins/listActionInputFieldChoices/index.d.ts.map +1 -0
  38. package/dist/plugins/{listInputFieldChoices → listActionInputFieldChoices}/index.js +4 -4
  39. package/dist/plugins/{listInputFieldChoices → listActionInputFieldChoices}/schemas.d.ts +10 -10
  40. package/dist/plugins/listActionInputFieldChoices/schemas.d.ts.map +1 -0
  41. package/dist/plugins/{listInputFieldChoices → listActionInputFieldChoices}/schemas.js +13 -10
  42. package/dist/plugins/{listInputFields → listActionInputFields}/index.d.ts +4 -4
  43. package/dist/plugins/listActionInputFields/index.d.ts.map +1 -0
  44. package/dist/plugins/{listInputFields → listActionInputFields}/index.js +4 -4
  45. package/dist/plugins/{listInputFields → listActionInputFields}/schemas.d.ts +9 -9
  46. package/dist/plugins/listActionInputFields/schemas.d.ts.map +1 -0
  47. package/dist/plugins/{listInputFields → listActionInputFields}/schemas.js +7 -7
  48. package/dist/plugins/request/index.d.ts +2 -2
  49. package/dist/plugins/request/schemas.d.ts +2 -2
  50. package/dist/plugins/triggers/ackTriggerInboxMessages/index.d.ts +51 -0
  51. package/dist/plugins/triggers/ackTriggerInboxMessages/index.d.ts.map +1 -0
  52. package/dist/plugins/triggers/ackTriggerInboxMessages/index.js +35 -0
  53. package/dist/plugins/triggers/ackTriggerInboxMessages/schemas.d.ts +34 -0
  54. package/dist/plugins/triggers/ackTriggerInboxMessages/schemas.d.ts.map +1 -0
  55. package/dist/plugins/triggers/ackTriggerInboxMessages/schemas.js +17 -0
  56. package/dist/plugins/triggers/createTriggerInbox/index.d.ts +62 -0
  57. package/dist/plugins/triggers/createTriggerInbox/index.d.ts.map +1 -0
  58. package/dist/plugins/triggers/createTriggerInbox/index.js +54 -0
  59. package/dist/plugins/triggers/createTriggerInbox/schemas.d.ts +20 -0
  60. package/dist/plugins/triggers/createTriggerInbox/schemas.d.ts.map +1 -0
  61. package/dist/plugins/triggers/createTriggerInbox/schemas.js +20 -0
  62. package/dist/plugins/triggers/deleteTriggerInbox/index.d.ts +50 -0
  63. package/dist/plugins/triggers/deleteTriggerInbox/index.d.ts.map +1 -0
  64. package/dist/plugins/triggers/deleteTriggerInbox/index.js +27 -0
  65. package/dist/plugins/triggers/deleteTriggerInbox/schemas.d.ts +14 -0
  66. package/dist/plugins/triggers/deleteTriggerInbox/schemas.d.ts.map +1 -0
  67. package/dist/plugins/triggers/deleteTriggerInbox/schemas.js +9 -0
  68. package/dist/plugins/triggers/drainTriggerInbox/index.d.ts +213 -0
  69. package/dist/plugins/triggers/drainTriggerInbox/index.d.ts.map +1 -0
  70. package/dist/plugins/triggers/drainTriggerInbox/index.js +227 -0
  71. package/dist/plugins/triggers/drainTriggerInbox/pipeline.d.ts +56 -0
  72. package/dist/plugins/triggers/drainTriggerInbox/pipeline.d.ts.map +1 -0
  73. package/dist/plugins/triggers/drainTriggerInbox/pipeline.js +225 -0
  74. package/dist/plugins/triggers/drainTriggerInbox/schemas.d.ts +104 -0
  75. package/dist/plugins/triggers/drainTriggerInbox/schemas.d.ts.map +1 -0
  76. package/dist/plugins/triggers/drainTriggerInbox/schemas.js +102 -0
  77. package/dist/plugins/triggers/ensureTriggerInbox/index.d.ts +63 -0
  78. package/dist/plugins/triggers/ensureTriggerInbox/index.d.ts.map +1 -0
  79. package/dist/plugins/triggers/ensureTriggerInbox/index.js +77 -0
  80. package/dist/plugins/triggers/ensureTriggerInbox/schemas.d.ts +21 -0
  81. package/dist/plugins/triggers/ensureTriggerInbox/schemas.d.ts.map +1 -0
  82. package/dist/plugins/triggers/ensureTriggerInbox/schemas.js +21 -0
  83. package/dist/plugins/triggers/getTriggerInbox/index.d.ts +50 -0
  84. package/dist/plugins/triggers/getTriggerInbox/index.d.ts.map +1 -0
  85. package/dist/plugins/triggers/getTriggerInbox/index.js +26 -0
  86. package/dist/plugins/triggers/getTriggerInbox/schemas.d.ts +14 -0
  87. package/dist/plugins/triggers/getTriggerInbox/schemas.d.ts.map +1 -0
  88. package/dist/plugins/triggers/getTriggerInbox/schemas.js +9 -0
  89. package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.d.ts +48 -0
  90. package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.d.ts.map +1 -0
  91. package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.js +23 -0
  92. package/dist/plugins/triggers/getTriggerInputFieldsSchema/schemas.d.ts +13 -0
  93. package/dist/plugins/triggers/getTriggerInputFieldsSchema/schemas.d.ts.map +1 -0
  94. package/dist/plugins/triggers/getTriggerInputFieldsSchema/schemas.js +10 -0
  95. package/dist/plugins/triggers/leaseTriggerInboxMessages/index.d.ts +58 -0
  96. package/dist/plugins/triggers/leaseTriggerInboxMessages/index.d.ts.map +1 -0
  97. package/dist/plugins/triggers/leaseTriggerInboxMessages/index.js +70 -0
  98. package/dist/plugins/triggers/leaseTriggerInboxMessages/schemas.d.ts +57 -0
  99. package/dist/plugins/triggers/leaseTriggerInboxMessages/schemas.d.ts.map +1 -0
  100. package/dist/plugins/triggers/leaseTriggerInboxMessages/schemas.js +25 -0
  101. package/dist/plugins/triggers/listTriggerInboxMessages/index.d.ts +51 -0
  102. package/dist/plugins/triggers/listTriggerInboxMessages/index.d.ts.map +1 -0
  103. package/dist/plugins/triggers/listTriggerInboxMessages/index.js +48 -0
  104. package/dist/plugins/triggers/listTriggerInboxMessages/schemas.d.ts +37 -0
  105. package/dist/plugins/triggers/listTriggerInboxMessages/schemas.d.ts.map +1 -0
  106. package/dist/plugins/triggers/listTriggerInboxMessages/schemas.js +27 -0
  107. package/dist/plugins/triggers/listTriggerInboxes/index.d.ts +56 -0
  108. package/dist/plugins/triggers/listTriggerInboxes/index.d.ts.map +1 -0
  109. package/dist/plugins/triggers/listTriggerInboxes/index.js +51 -0
  110. package/dist/plugins/triggers/listTriggerInboxes/schemas.d.ts +58 -0
  111. package/dist/plugins/triggers/listTriggerInboxes/schemas.d.ts.map +1 -0
  112. package/dist/plugins/triggers/listTriggerInboxes/schemas.js +35 -0
  113. package/dist/plugins/triggers/listTriggerInputFieldChoices/index.d.ts +77 -0
  114. package/dist/plugins/triggers/listTriggerInputFieldChoices/index.d.ts.map +1 -0
  115. package/dist/plugins/triggers/listTriggerInputFieldChoices/index.js +30 -0
  116. package/dist/plugins/triggers/listTriggerInputFieldChoices/schemas.d.ts +20 -0
  117. package/dist/plugins/triggers/listTriggerInputFieldChoices/schemas.d.ts.map +1 -0
  118. package/dist/plugins/triggers/listTriggerInputFieldChoices/schemas.js +28 -0
  119. package/dist/plugins/triggers/listTriggerInputFields/index.d.ts +101 -0
  120. package/dist/plugins/triggers/listTriggerInputFields/index.d.ts.map +1 -0
  121. package/dist/plugins/triggers/listTriggerInputFields/index.js +33 -0
  122. package/dist/plugins/triggers/listTriggerInputFields/schemas.d.ts +16 -0
  123. package/dist/plugins/triggers/listTriggerInputFields/schemas.d.ts.map +1 -0
  124. package/dist/plugins/triggers/listTriggerInputFields/schemas.js +21 -0
  125. package/dist/plugins/triggers/pauseTriggerInbox/index.d.ts +50 -0
  126. package/dist/plugins/triggers/pauseTriggerInbox/index.d.ts.map +1 -0
  127. package/dist/plugins/triggers/pauseTriggerInbox/index.js +26 -0
  128. package/dist/plugins/triggers/pauseTriggerInbox/schemas.d.ts +14 -0
  129. package/dist/plugins/triggers/pauseTriggerInbox/schemas.d.ts.map +1 -0
  130. package/dist/plugins/triggers/pauseTriggerInbox/schemas.js +9 -0
  131. package/dist/plugins/triggers/releaseTriggerInboxMessages/index.d.ts +51 -0
  132. package/dist/plugins/triggers/releaseTriggerInboxMessages/index.d.ts.map +1 -0
  133. package/dist/plugins/triggers/releaseTriggerInboxMessages/index.js +37 -0
  134. package/dist/plugins/triggers/releaseTriggerInboxMessages/schemas.d.ts +34 -0
  135. package/dist/plugins/triggers/releaseTriggerInboxMessages/schemas.d.ts.map +1 -0
  136. package/dist/plugins/triggers/releaseTriggerInboxMessages/schemas.js +17 -0
  137. package/dist/plugins/triggers/resumeTriggerInbox/index.d.ts +50 -0
  138. package/dist/plugins/triggers/resumeTriggerInbox/index.d.ts.map +1 -0
  139. package/dist/plugins/triggers/resumeTriggerInbox/index.js +26 -0
  140. package/dist/plugins/triggers/resumeTriggerInbox/schemas.d.ts +14 -0
  141. package/dist/plugins/triggers/resumeTriggerInbox/schemas.d.ts.map +1 -0
  142. package/dist/plugins/triggers/resumeTriggerInbox/schemas.js +9 -0
  143. package/dist/plugins/triggers/shared.d.ts +17 -0
  144. package/dist/plugins/triggers/shared.d.ts.map +1 -0
  145. package/dist/plugins/triggers/shared.js +16 -0
  146. package/dist/plugins/triggers/updateTriggerInbox/index.d.ts +51 -0
  147. package/dist/plugins/triggers/updateTriggerInbox/index.d.ts.map +1 -0
  148. package/dist/plugins/triggers/updateTriggerInbox/index.js +30 -0
  149. package/dist/plugins/triggers/updateTriggerInbox/schemas.d.ts +15 -0
  150. package/dist/plugins/triggers/updateTriggerInbox/schemas.d.ts.map +1 -0
  151. package/dist/plugins/triggers/updateTriggerInbox/schemas.js +15 -0
  152. package/dist/plugins/triggers/utils.d.ts +17 -0
  153. package/dist/plugins/triggers/utils.d.ts.map +1 -0
  154. package/dist/plugins/triggers/utils.js +28 -0
  155. package/dist/plugins/triggers/watchTriggerInbox/index.d.ts +163 -0
  156. package/dist/plugins/triggers/watchTriggerInbox/index.d.ts.map +1 -0
  157. package/dist/plugins/triggers/watchTriggerInbox/index.js +111 -0
  158. package/dist/registry.d.ts.map +1 -1
  159. package/dist/registry.js +2 -0
  160. package/dist/resolvers/actionKey.d.ts +1 -0
  161. package/dist/resolvers/actionKey.d.ts.map +1 -1
  162. package/dist/resolvers/actionKey.js +1 -1
  163. package/dist/resolvers/index.d.ts +2 -2
  164. package/dist/resolvers/index.d.ts.map +1 -1
  165. package/dist/resolvers/index.js +2 -2
  166. package/dist/resolvers/triggerInbox.d.ts +4 -0
  167. package/dist/resolvers/triggerInbox.d.ts.map +1 -0
  168. package/dist/resolvers/triggerInbox.js +18 -0
  169. package/dist/schemas/TriggerInbox.d.ts +59 -0
  170. package/dist/schemas/TriggerInbox.d.ts.map +1 -0
  171. package/dist/schemas/TriggerInbox.js +81 -0
  172. package/dist/schemas/TriggerMessage.d.ts +48 -0
  173. package/dist/schemas/TriggerMessage.d.ts.map +1 -0
  174. package/dist/schemas/TriggerMessage.js +79 -0
  175. package/dist/sdk.d.ts +621 -17
  176. package/dist/sdk.d.ts.map +1 -1
  177. package/dist/sdk.js +26 -9
  178. package/dist/types/errors.d.ts +13 -0
  179. package/dist/types/errors.d.ts.map +1 -1
  180. package/dist/types/errors.js +16 -0
  181. package/dist/types/plugin.d.ts +12 -1
  182. package/dist/types/plugin.d.ts.map +1 -1
  183. package/dist/types/properties.d.ts +12 -0
  184. package/dist/types/properties.d.ts.map +1 -1
  185. package/dist/types/properties.js +25 -0
  186. package/dist/types/registry.d.ts +5 -0
  187. package/dist/types/registry.d.ts.map +1 -1
  188. package/dist/types/sdk.d.ts +2 -2
  189. package/dist/types/sdk.d.ts.map +1 -1
  190. package/dist/types/signals.d.ts +20 -0
  191. package/dist/types/signals.d.ts.map +1 -0
  192. package/dist/types/signals.js +21 -0
  193. package/dist/utils/abort-utils.d.ts +13 -0
  194. package/dist/utils/abort-utils.d.ts.map +1 -1
  195. package/dist/utils/abort-utils.js +15 -0
  196. package/dist/utils/retry-utils.d.ts +6 -2
  197. package/dist/utils/retry-utils.d.ts.map +1 -1
  198. package/dist/utils/retry-utils.js +22 -3
  199. package/dist/utils/schema-utils.d.ts +19 -1
  200. package/dist/utils/schema-utils.d.ts.map +1 -1
  201. package/package.json +12 -1
  202. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +0 -1
  203. package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +0 -1
  204. package/dist/plugins/listInputFieldChoices/index.d.ts.map +0 -1
  205. package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +0 -1
  206. package/dist/plugins/listInputFields/index.d.ts.map +0 -1
  207. package/dist/plugins/listInputFields/schemas.d.ts.map +0 -1
@@ -0,0 +1,62 @@
1
+ import { CreateTriggerInboxSchema } from "./schemas";
2
+ import type { GetVersionedImplementationId } from "../../manifest/schemas";
3
+ import type { ConnectionsPluginProvides } from "../../connections";
4
+ export declare const createTriggerInboxPlugin: (sdk: {
5
+ context: {
6
+ api: import("../../..").ApiClient;
7
+ resolveCredentials: () => Promise<string | {
8
+ clientId: string;
9
+ clientSecret: string;
10
+ type?: "client_credentials" | undefined;
11
+ baseUrl?: string | undefined;
12
+ scope?: string | undefined;
13
+ } | {
14
+ clientId: string;
15
+ type?: "pkce" | undefined;
16
+ baseUrl?: string | undefined;
17
+ scope?: string | undefined;
18
+ } | undefined>;
19
+ };
20
+ } & {
21
+ context: import("../../eventEmission").EventEmissionContext;
22
+ } & {
23
+ context: {
24
+ getVersionedImplementationId: GetVersionedImplementationId;
25
+ } & ConnectionsPluginProvides["context"];
26
+ } & {
27
+ context: {
28
+ meta: Record<string, import("../../..").PluginMeta>;
29
+ };
30
+ }) => {
31
+ createTriggerInbox: (options?: {
32
+ app: string;
33
+ action: string;
34
+ connection?: string | number | null | undefined;
35
+ inputs?: Record<string, unknown> | undefined;
36
+ notificationUrl?: string | undefined;
37
+ } | undefined) => Promise<{
38
+ data: {
39
+ id: string;
40
+ created_at: string;
41
+ name: string | null;
42
+ status: string;
43
+ paused_reason: string | null;
44
+ notification_url: string | null;
45
+ subscription: {
46
+ connection_id: string | number | null;
47
+ app_key: string;
48
+ action_key: string;
49
+ inputs: Record<string, unknown>;
50
+ };
51
+ };
52
+ }>;
53
+ } & {
54
+ context: {
55
+ meta: {
56
+ createTriggerInbox: import("../../..").PluginMeta;
57
+ };
58
+ };
59
+ };
60
+ export type CreateTriggerInboxPluginProvides = ReturnType<typeof createTriggerInboxPlugin>;
61
+ export { CreateTriggerInboxSchema };
62
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/createTriggerInbox/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAA0B,MAAM,WAAW,CAAC;AAU7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAInE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;aAIpB;QACP,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D,GAAG,yBAAyB,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgF/C,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,UAAU,CACvD,OAAO,wBAAwB,CAChC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
2
+ import { CreateTriggerInboxSchema, TriggerInboxItemSchema } from "./schemas";
3
+ import { ZapierConfigurationError } from "../../../types/errors";
4
+ import { appKeyResolver, actionKeyResolver, connectionIdResolver, inputsResolver, } from "../../../resolvers";
5
+ import { resolveConnectionId } from "../../../utils/domain-utils";
6
+ import { triggersDefaults } from "../shared";
7
+ export const createTriggerInboxPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
8
+ ...triggersDefaults,
9
+ name: "createTriggerInbox",
10
+ type: "create",
11
+ itemType: "TriggerInbox",
12
+ inputSchema: CreateTriggerInboxSchema,
13
+ outputSchema: TriggerInboxItemSchema,
14
+ // actionKeyResolver and inputsResolver depend on actionType, which is
15
+ // always "read" for triggers. Pin it as a constant resolver so it's
16
+ // seeded into resolvedParams without polluting the user-facing schema
17
+ // (where it would leak into the SDK method signature and CLI flags).
18
+ resolvers: {
19
+ app: appKeyResolver,
20
+ action: actionKeyResolver,
21
+ connection: connectionIdResolver,
22
+ inputs: inputsResolver,
23
+ actionType: { type: "constant", value: "read" },
24
+ },
25
+ handler: async ({ sdk, options }) => {
26
+ const { api } = sdk.context;
27
+ const { app: appKey, action: actionKey, connection, inputs = {}, notificationUrl, } = options;
28
+ const resolvedConnectionId = await resolveConnectionId({
29
+ connection,
30
+ resolveConnection: sdk.context.resolveConnection,
31
+ });
32
+ const selectedApi = await sdk.context.getVersionedImplementationId(appKey);
33
+ if (!selectedApi) {
34
+ throw new ZapierConfigurationError(`No current_implementation_id found for app "${appKey}"`, { configType: "current_implementation_id" });
35
+ }
36
+ const requestBody = {
37
+ subscription: {
38
+ app_key: selectedApi,
39
+ action_key: actionKey,
40
+ inputs,
41
+ },
42
+ };
43
+ if (notificationUrl !== undefined) {
44
+ requestBody.notification_url = notificationUrl;
45
+ }
46
+ if (resolvedConnectionId !== undefined &&
47
+ resolvedConnectionId !== null) {
48
+ requestBody.subscription.connection_id = resolvedConnectionId;
49
+ }
50
+ const rawResponse = await api.post("/trigger-inbox/api/v1/inboxes", requestBody, { authRequired: true });
51
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
52
+ },
53
+ }));
54
+ export { CreateTriggerInboxSchema };
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import type { FunctionOptions } from "../../../types/functions";
3
+ import { TriggerInboxItemSchema, type TriggerInboxItem } from "../../../schemas/TriggerInbox";
4
+ export declare const CreateTriggerInboxSchema: z.ZodObject<{
5
+ app: z.ZodString & {
6
+ _def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
7
+ };
8
+ action: z.ZodString & {
9
+ _def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
10
+ };
11
+ connection: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
12
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13
+ notificationUrl: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strip>;
15
+ export type CreateTriggerInboxOptions = z.infer<typeof CreateTriggerInboxSchema> & FunctionOptions;
16
+ export interface CreateTriggerInboxResult {
17
+ data: TriggerInboxItem;
18
+ }
19
+ export { TriggerInboxItemSchema };
20
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/createTriggerInbox/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAOhE,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AAKvC,eAAO,MAAM,wBAAwB;;;;;;;;;;iBAkBK,CAAC;AAE3C,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,wBAAwB,CAChC,GACC,eAAe,CAAC;AAElB,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import { AppPropertySchema, ActionPropertySchema, ConnectionPropertySchema, InputsPropertySchema, } from "../../../types/properties";
3
+ import { TriggerInboxItemSchema, } from "../../../schemas/TriggerInbox";
4
+ const CreateTriggerInboxDescription = "Create a new trigger inbox subscription with an auto-generated name. Always creates; use ensureTriggerInbox for get-or-create on a stable name.";
5
+ export const CreateTriggerInboxSchema = z
6
+ .object({
7
+ app: AppPropertySchema,
8
+ action: ActionPropertySchema,
9
+ connection: ConnectionPropertySchema.nullable()
10
+ .optional()
11
+ .describe("Connection alias or connection ID. Optional for triggers that don't require auth."),
12
+ inputs: InputsPropertySchema.optional().describe("Input parameters for the trigger subscription"),
13
+ notificationUrl: z
14
+ .string()
15
+ .url()
16
+ .optional()
17
+ .describe("Webhook URL to POST to when new messages arrive"),
18
+ })
19
+ .describe(CreateTriggerInboxDescription);
20
+ export { TriggerInboxItemSchema };
@@ -0,0 +1,50 @@
1
+ export declare const deleteTriggerInboxPlugin: (sdk: {
2
+ context: {
3
+ api: import("../../..").ApiClient;
4
+ resolveCredentials: () => Promise<string | {
5
+ clientId: string;
6
+ clientSecret: string;
7
+ type?: "client_credentials" | undefined;
8
+ baseUrl?: string | undefined;
9
+ scope?: string | undefined;
10
+ } | {
11
+ clientId: string;
12
+ type?: "pkce" | undefined;
13
+ baseUrl?: string | undefined;
14
+ scope?: string | undefined;
15
+ } | undefined>;
16
+ };
17
+ } & {
18
+ context: import("../../eventEmission").EventEmissionContext;
19
+ } & {
20
+ context: {
21
+ meta: Record<string, import("../../..").PluginMeta>;
22
+ };
23
+ }) => {
24
+ deleteTriggerInbox: (options?: {
25
+ inbox: string;
26
+ } | undefined) => Promise<{
27
+ data: {
28
+ id: string;
29
+ created_at: string;
30
+ name: string | null;
31
+ status: string;
32
+ paused_reason: string | null;
33
+ notification_url: string | null;
34
+ subscription: {
35
+ connection_id: string | number | null;
36
+ app_key: string;
37
+ action_key: string;
38
+ inputs: Record<string, unknown>;
39
+ };
40
+ };
41
+ }>;
42
+ } & {
43
+ context: {
44
+ meta: {
45
+ deleteTriggerInbox: import("../../..").PluginMeta;
46
+ };
47
+ };
48
+ };
49
+ export type DeleteTriggerInboxPluginProvides = ReturnType<typeof deleteTriggerInboxPlugin>;
50
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/deleteTriggerInbox/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BpC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,UAAU,CACvD,OAAO,wBAAwB,CAChC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
2
+ import { DeleteTriggerInboxSchema, TriggerInboxItemSchema } from "./schemas";
3
+ import { triggerInboxResolver } from "../../../resolvers";
4
+ import { resolveTriggerInboxId } from "../utils";
5
+ import { triggersDefaults } from "../shared";
6
+ export const deleteTriggerInboxPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
7
+ ...triggersDefaults,
8
+ name: "deleteTriggerInbox",
9
+ type: "delete",
10
+ itemType: "TriggerInbox",
11
+ inputSchema: DeleteTriggerInboxSchema,
12
+ outputSchema: TriggerInboxItemSchema,
13
+ resolvers: { inbox: triggerInboxResolver },
14
+ confirm: "delete",
15
+ handler: async ({ sdk, options }) => {
16
+ const { inbox } = options;
17
+ const inboxId = await resolveTriggerInboxId({
18
+ api: sdk.context.api,
19
+ inbox,
20
+ });
21
+ const rawResponse = await sdk.context.api.delete(`/trigger-inbox/api/v1/inboxes/${encodeURIComponent(inboxId)}`, undefined, {
22
+ authRequired: true,
23
+ resource: { type: "trigger_inbox", id: inboxId },
24
+ });
25
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
26
+ },
27
+ }));
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ import type { FunctionOptions } from "../../../types/functions";
3
+ import { TriggerInboxItemSchema, type TriggerInboxItem } from "../../../schemas/TriggerInbox";
4
+ export declare const DeleteTriggerInboxSchema: z.ZodObject<{
5
+ inbox: z.ZodString & {
6
+ _def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
7
+ };
8
+ }, z.core.$strip>;
9
+ export type DeleteTriggerInboxOptions = z.infer<typeof DeleteTriggerInboxSchema> & FunctionOptions;
10
+ export interface DeleteTriggerInboxResult {
11
+ data: TriggerInboxItem;
12
+ }
13
+ export { TriggerInboxItemSchema };
14
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/deleteTriggerInbox/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AAEvC,eAAO,MAAM,wBAAwB;;;;iBAIW,CAAC;AAEjD,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,wBAAwB,CAChC,GACC,eAAe,CAAC;AAElB,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ import { TriggerInboxPropertySchema } from "../../../types/properties";
3
+ import { TriggerInboxItemSchema, } from "../../../schemas/TriggerInbox";
4
+ export const DeleteTriggerInboxSchema = z
5
+ .object({
6
+ inbox: TriggerInboxPropertySchema,
7
+ })
8
+ .describe("Mark a trigger inbox for deletion");
9
+ export { TriggerInboxItemSchema };
@@ -0,0 +1,213 @@
1
+ import { type DrainTriggerInboxCallback, type DrainTriggerInboxOptions } from "./schemas";
2
+ import type { ApiPluginProvides } from "../../api";
3
+ import type { LeaseTriggerInboxMessagesPluginProvides } from "../leaseTriggerInboxMessages";
4
+ import type { AckTriggerInboxMessagesPluginProvides } from "../ackTriggerInboxMessages";
5
+ import type { ReleaseTriggerInboxMessagesPluginProvides } from "../releaseTriggerInboxMessages";
6
+ import type { LeasedTriggerMessageItem } from "../../../schemas/TriggerMessage";
7
+ export { ZapierAbortDrainSignal, ZapierReleaseTriggerMessageSignal, } from "./schemas";
8
+ interface RunDrainPassOptions {
9
+ sdk: ApiPluginProvides & LeaseTriggerInboxMessagesPluginProvides & AckTriggerInboxMessagesPluginProvides & ReleaseTriggerInboxMessagesPluginProvides;
10
+ inboxId: string;
11
+ onMessage: DrainTriggerInboxCallback;
12
+ concurrency: number;
13
+ leaseLimit: number;
14
+ leaseSeconds: number | undefined;
15
+ maxMessages: number | undefined;
16
+ releaseOnError: boolean;
17
+ continueOnError: boolean;
18
+ onError: ((err: unknown, msg: LeasedTriggerMessageItem) => void | Promise<void>) | undefined;
19
+ signal: AbortSignal | undefined;
20
+ firstFetch: boolean;
21
+ }
22
+ export interface RunDrainPassOutcome {
23
+ /** True if a callback raised the abort signal during this pass. */
24
+ abortedFromCallback: boolean;
25
+ /** Number of items the pipeline marked done (ok or rejected). */
26
+ processed: number;
27
+ }
28
+ /**
29
+ * One drain pass through `runBatchedDrainPipeline`. Used directly by
30
+ * `drainTriggerInbox` (single pass) and as the inner loop body of
31
+ * `watchTriggerInbox` (called repeatedly with poll backoff between
32
+ * empty passes).
33
+ */
34
+ export declare function runDrainPass(options: RunDrainPassOptions): Promise<RunDrainPassOutcome>;
35
+ /**
36
+ * Validate the per-message callback. `onMessage` is required — no
37
+ * identity default, since "lease and ack everything in this inbox"
38
+ * is a footgun on a casual call. JS callers that skip onMessage hit
39
+ * this guard at runtime; TS callers are rejected at the call site.
40
+ */
41
+ export declare function requireOnMessage(onMessage: DrainTriggerInboxCallback | undefined): DrainTriggerInboxCallback;
42
+ /**
43
+ * Compute concurrency and lease size with symmetric defaulting:
44
+ *
45
+ * both unset -> concurrency=1, leaseLimit=1
46
+ * concurrency=N -> concurrency=N, leaseLimit=N
47
+ * leaseLimit=L -> concurrency=L, leaseLimit=L
48
+ * both set -> use both as given
49
+ *
50
+ * The symmetry kills the "set leaseLimit alone, get prefetch
51
+ * pathology" footgun: a leased message buffer is never larger than
52
+ * the worker pool that can immediately work it.
53
+ */
54
+ export declare function resolveConcurrencyAndLease(options: {
55
+ concurrency?: number;
56
+ leaseLimit?: number;
57
+ }): {
58
+ concurrency: number;
59
+ leaseLimit: number;
60
+ };
61
+ export declare const drainTriggerInboxPlugin: (sdk: {
62
+ context: {
63
+ api: import("../../..").ApiClient;
64
+ resolveCredentials: () => Promise<string | {
65
+ clientId: string;
66
+ clientSecret: string;
67
+ type?: "client_credentials" | undefined;
68
+ baseUrl?: string | undefined;
69
+ scope?: string | undefined;
70
+ } | {
71
+ clientId: string;
72
+ type?: "pkce" | undefined;
73
+ baseUrl?: string | undefined;
74
+ scope?: string | undefined;
75
+ } | undefined>;
76
+ };
77
+ } & {
78
+ leaseTriggerInboxMessages: (options?: {
79
+ inbox: string;
80
+ leaseLimit?: number | undefined;
81
+ leaseSeconds?: number | undefined;
82
+ signal?: AbortSignal | undefined;
83
+ } | undefined) => Promise<{
84
+ data: {
85
+ lease_id: string | null;
86
+ leased_until: string | null;
87
+ results: {
88
+ id: string;
89
+ created_at: string;
90
+ status: string;
91
+ message_attributes: {
92
+ lease_count: number;
93
+ error_message: string | null;
94
+ possible_duplicate_data: boolean;
95
+ };
96
+ payload: Record<string, unknown>;
97
+ }[];
98
+ inbox_attributes: {
99
+ status: string;
100
+ paused_reason: string | null;
101
+ };
102
+ };
103
+ }>;
104
+ } & {
105
+ context: {
106
+ meta: {
107
+ leaseTriggerInboxMessages: import("../../..").PluginMeta;
108
+ };
109
+ };
110
+ } & {
111
+ ackTriggerInboxMessages: (options?: {
112
+ inbox: string;
113
+ lease: string;
114
+ messages?: string[] | undefined;
115
+ } | undefined) => Promise<{
116
+ data: {
117
+ acked_id: string | null;
118
+ results: {
119
+ id: string;
120
+ created_at: string;
121
+ status: string;
122
+ message_attributes: {
123
+ lease_count: number;
124
+ error_message: string | null;
125
+ possible_duplicate_data: boolean;
126
+ };
127
+ }[];
128
+ };
129
+ }>;
130
+ } & {
131
+ context: {
132
+ meta: {
133
+ ackTriggerInboxMessages: import("../../..").PluginMeta;
134
+ };
135
+ };
136
+ } & {
137
+ releaseTriggerInboxMessages: (options?: {
138
+ inbox: string;
139
+ lease: string;
140
+ messages?: string[] | undefined;
141
+ } | undefined) => Promise<{
142
+ data: {
143
+ released_id: string | null;
144
+ results: {
145
+ id: string;
146
+ created_at: string;
147
+ status: string;
148
+ message_attributes: {
149
+ lease_count: number;
150
+ error_message: string | null;
151
+ possible_duplicate_data: boolean;
152
+ };
153
+ }[];
154
+ };
155
+ }>;
156
+ } & {
157
+ context: {
158
+ meta: {
159
+ releaseTriggerInboxMessages: import("../../..").PluginMeta;
160
+ };
161
+ };
162
+ } & {
163
+ context: {
164
+ meta: Record<string, import("../../..").PluginMeta>;
165
+ };
166
+ }) => {
167
+ drainTriggerInbox: (options: DrainTriggerInboxOptions) => Promise<void>;
168
+ context: {
169
+ meta: {
170
+ drainTriggerInbox: {
171
+ type: "create";
172
+ description: string;
173
+ itemType: string;
174
+ returnType: string;
175
+ inputSchema: import("zod").ZodObject<{
176
+ inbox: import("zod").ZodString & {
177
+ _def: import("zod/v4/core").$ZodStringDef & import("../../..").PositionalMetadata;
178
+ };
179
+ onMessage: import("zod").ZodOptional<import("zod").ZodFunction<import("zod/v4/core").$ZodFunctionArgs, import("zod/v4/core").$ZodFunctionOut>>;
180
+ concurrency: import("zod").ZodOptional<import("zod").ZodNumber>;
181
+ leaseLimit: import("zod").ZodOptional<import("zod").ZodNumber>;
182
+ leaseSeconds: import("zod").ZodOptional<import("zod").ZodNumber>;
183
+ releaseOnError: import("zod").ZodOptional<import("zod").ZodBoolean>;
184
+ continueOnError: import("zod").ZodOptional<import("zod").ZodBoolean>;
185
+ onError: import("zod").ZodOptional<import("zod").ZodFunction<import("zod/v4/core").$ZodFunctionArgs, import("zod/v4/core").$ZodFunctionOut>>;
186
+ signal: import("zod").ZodOptional<import("zod").ZodCustom<AbortSignal, AbortSignal>>;
187
+ maxMessages: import("zod").ZodOptional<import("zod").ZodNumber>;
188
+ }, import("zod/v4/core").$strip>;
189
+ resolvers: {
190
+ inbox: import("../../..").DynamicResolver<{
191
+ id: string;
192
+ created_at: string;
193
+ name: string | null;
194
+ status: string;
195
+ paused_reason: string | null;
196
+ notification_url: string | null;
197
+ subscription: {
198
+ connection_id: string | number | null;
199
+ app_key: string;
200
+ action_key: string;
201
+ inputs: Record<string, unknown>;
202
+ };
203
+ }, {}>;
204
+ };
205
+ packages: readonly ["sdk"];
206
+ categories: string[];
207
+ experimental: true;
208
+ };
209
+ };
210
+ };
211
+ };
212
+ export type DrainTriggerInboxPluginProvides = ReturnType<typeof drainTriggerInboxPlugin>;
213
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/drainTriggerInbox/index.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC9B,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,gCAAgC,CAAC;AAGhG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAMhF,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,WAAW,CAAC;AAcnB,UAAU,mBAAmB;IAC3B,GAAG,EAAE,iBAAiB,GACpB,uCAAuC,GACvC,qCAAqC,GACrC,yCAAyC,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,yBAAyB,CAAC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EACH,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,wBAAwB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GACvE,SAAS,CAAC;IACd,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CAsI9B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,yBAAyB,GAAG,SAAS,GAC/C,yBAAyB,CAK3B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAI9C;AAED,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAQrB,wBAAwB,KAChC,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDnB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,UAAU,CACtD,OAAO,uBAAuB,CAC/B,CAAC"}