@zapier/zapier-sdk 0.48.0 → 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.
- package/CHANGELOG.md +12 -0
- package/README.md +1519 -314
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +10 -1
- package/dist/api/polling.d.ts +7 -0
- package/dist/api/polling.d.ts.map +1 -1
- package/dist/api/polling.js +29 -4
- package/dist/api/types.d.ts +7 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/experimental.cjs +10389 -0
- package/dist/experimental.d.mts +2292 -0
- package/dist/experimental.d.ts +2308 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +155 -0
- package/dist/experimental.mjs +10207 -0
- package/dist/index-C2vsvjgN.d.mts +9539 -0
- package/dist/index-C2vsvjgN.d.ts +9539 -0
- package/dist/index.cjs +817 -603
- package/dist/index.d.mts +6 -8562
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.mjs +805 -603
- package/dist/plugins/apps/index.d.ts +1 -1
- package/dist/plugins/deprecated/inputFields.d.ts +468 -0
- package/dist/plugins/deprecated/inputFields.d.ts.map +1 -0
- package/dist/plugins/deprecated/inputFields.js +73 -0
- package/dist/plugins/fetch/index.d.ts +1 -1
- package/dist/plugins/fetch/schemas.d.ts +1 -1
- package/dist/plugins/{getInputFieldsSchema → getActionInputFieldsSchema}/index.d.ts +4 -4
- package/dist/plugins/getActionInputFieldsSchema/index.d.ts.map +1 -0
- package/dist/plugins/{getInputFieldsSchema → getActionInputFieldsSchema}/index.js +4 -4
- package/dist/plugins/{getInputFieldsSchema → getActionInputFieldsSchema}/schemas.d.ts +8 -8
- package/dist/plugins/getActionInputFieldsSchema/schemas.d.ts.map +1 -0
- package/dist/plugins/{getInputFieldsSchema → getActionInputFieldsSchema}/schemas.js +13 -10
- package/dist/plugins/{listInputFieldChoices → listActionInputFieldChoices}/index.d.ts +4 -4
- package/dist/plugins/listActionInputFieldChoices/index.d.ts.map +1 -0
- package/dist/plugins/{listInputFieldChoices → listActionInputFieldChoices}/index.js +4 -4
- package/dist/plugins/{listInputFieldChoices → listActionInputFieldChoices}/schemas.d.ts +10 -10
- package/dist/plugins/listActionInputFieldChoices/schemas.d.ts.map +1 -0
- package/dist/plugins/{listInputFieldChoices → listActionInputFieldChoices}/schemas.js +13 -10
- package/dist/plugins/{listInputFields → listActionInputFields}/index.d.ts +4 -4
- package/dist/plugins/listActionInputFields/index.d.ts.map +1 -0
- package/dist/plugins/{listInputFields → listActionInputFields}/index.js +5 -5
- package/dist/plugins/{listInputFields → listActionInputFields}/schemas.d.ts +9 -9
- package/dist/plugins/listActionInputFields/schemas.d.ts.map +1 -0
- package/dist/plugins/{listInputFields → listActionInputFields}/schemas.js +7 -7
- package/dist/plugins/request/index.d.ts +2 -2
- package/dist/plugins/request/schemas.d.ts +2 -2
- package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/index.js +1 -0
- package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/index.js +1 -0
- package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/updateTableRecords/index.js +1 -0
- package/dist/plugins/triggers/ackTriggerInboxMessages/index.d.ts +51 -0
- package/dist/plugins/triggers/ackTriggerInboxMessages/index.d.ts.map +1 -0
- package/dist/plugins/triggers/ackTriggerInboxMessages/index.js +35 -0
- package/dist/plugins/triggers/ackTriggerInboxMessages/schemas.d.ts +34 -0
- package/dist/plugins/triggers/ackTriggerInboxMessages/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/ackTriggerInboxMessages/schemas.js +17 -0
- package/dist/plugins/triggers/createTriggerInbox/index.d.ts +62 -0
- package/dist/plugins/triggers/createTriggerInbox/index.d.ts.map +1 -0
- package/dist/plugins/triggers/createTriggerInbox/index.js +54 -0
- package/dist/plugins/triggers/createTriggerInbox/schemas.d.ts +20 -0
- package/dist/plugins/triggers/createTriggerInbox/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/createTriggerInbox/schemas.js +20 -0
- package/dist/plugins/triggers/deleteTriggerInbox/index.d.ts +50 -0
- package/dist/plugins/triggers/deleteTriggerInbox/index.d.ts.map +1 -0
- package/dist/plugins/triggers/deleteTriggerInbox/index.js +27 -0
- package/dist/plugins/triggers/deleteTriggerInbox/schemas.d.ts +14 -0
- package/dist/plugins/triggers/deleteTriggerInbox/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/deleteTriggerInbox/schemas.js +9 -0
- package/dist/plugins/triggers/drainTriggerInbox/index.d.ts +213 -0
- package/dist/plugins/triggers/drainTriggerInbox/index.d.ts.map +1 -0
- package/dist/plugins/triggers/drainTriggerInbox/index.js +227 -0
- package/dist/plugins/triggers/drainTriggerInbox/pipeline.d.ts +56 -0
- package/dist/plugins/triggers/drainTriggerInbox/pipeline.d.ts.map +1 -0
- package/dist/plugins/triggers/drainTriggerInbox/pipeline.js +225 -0
- package/dist/plugins/triggers/drainTriggerInbox/schemas.d.ts +104 -0
- package/dist/plugins/triggers/drainTriggerInbox/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/drainTriggerInbox/schemas.js +102 -0
- package/dist/plugins/triggers/ensureTriggerInbox/index.d.ts +63 -0
- package/dist/plugins/triggers/ensureTriggerInbox/index.d.ts.map +1 -0
- package/dist/plugins/triggers/ensureTriggerInbox/index.js +77 -0
- package/dist/plugins/triggers/ensureTriggerInbox/schemas.d.ts +21 -0
- package/dist/plugins/triggers/ensureTriggerInbox/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/ensureTriggerInbox/schemas.js +21 -0
- package/dist/plugins/triggers/getTriggerInbox/index.d.ts +50 -0
- package/dist/plugins/triggers/getTriggerInbox/index.d.ts.map +1 -0
- package/dist/plugins/triggers/getTriggerInbox/index.js +26 -0
- package/dist/plugins/triggers/getTriggerInbox/schemas.d.ts +14 -0
- package/dist/plugins/triggers/getTriggerInbox/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/getTriggerInbox/schemas.js +9 -0
- package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.d.ts +48 -0
- package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.d.ts.map +1 -0
- package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.js +23 -0
- package/dist/plugins/triggers/getTriggerInputFieldsSchema/schemas.d.ts +13 -0
- package/dist/plugins/triggers/getTriggerInputFieldsSchema/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/getTriggerInputFieldsSchema/schemas.js +10 -0
- package/dist/plugins/triggers/leaseTriggerInboxMessages/index.d.ts +58 -0
- package/dist/plugins/triggers/leaseTriggerInboxMessages/index.d.ts.map +1 -0
- package/dist/plugins/triggers/leaseTriggerInboxMessages/index.js +70 -0
- package/dist/plugins/triggers/leaseTriggerInboxMessages/schemas.d.ts +57 -0
- package/dist/plugins/triggers/leaseTriggerInboxMessages/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/leaseTriggerInboxMessages/schemas.js +25 -0
- package/dist/plugins/triggers/listTriggerInboxMessages/index.d.ts +51 -0
- package/dist/plugins/triggers/listTriggerInboxMessages/index.d.ts.map +1 -0
- package/dist/plugins/triggers/listTriggerInboxMessages/index.js +48 -0
- package/dist/plugins/triggers/listTriggerInboxMessages/schemas.d.ts +37 -0
- package/dist/plugins/triggers/listTriggerInboxMessages/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/listTriggerInboxMessages/schemas.js +27 -0
- package/dist/plugins/triggers/listTriggerInboxes/index.d.ts +56 -0
- package/dist/plugins/triggers/listTriggerInboxes/index.d.ts.map +1 -0
- package/dist/plugins/triggers/listTriggerInboxes/index.js +51 -0
- package/dist/plugins/triggers/listTriggerInboxes/schemas.d.ts +58 -0
- package/dist/plugins/triggers/listTriggerInboxes/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/listTriggerInboxes/schemas.js +35 -0
- package/dist/plugins/triggers/listTriggerInputFieldChoices/index.d.ts +77 -0
- package/dist/plugins/triggers/listTriggerInputFieldChoices/index.d.ts.map +1 -0
- package/dist/plugins/triggers/listTriggerInputFieldChoices/index.js +30 -0
- package/dist/plugins/triggers/listTriggerInputFieldChoices/schemas.d.ts +20 -0
- package/dist/plugins/triggers/listTriggerInputFieldChoices/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/listTriggerInputFieldChoices/schemas.js +28 -0
- package/dist/plugins/triggers/listTriggerInputFields/index.d.ts +101 -0
- package/dist/plugins/triggers/listTriggerInputFields/index.d.ts.map +1 -0
- package/dist/plugins/triggers/listTriggerInputFields/index.js +33 -0
- package/dist/plugins/triggers/listTriggerInputFields/schemas.d.ts +16 -0
- package/dist/plugins/triggers/listTriggerInputFields/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/listTriggerInputFields/schemas.js +21 -0
- package/dist/plugins/triggers/pauseTriggerInbox/index.d.ts +50 -0
- package/dist/plugins/triggers/pauseTriggerInbox/index.d.ts.map +1 -0
- package/dist/plugins/triggers/pauseTriggerInbox/index.js +26 -0
- package/dist/plugins/triggers/pauseTriggerInbox/schemas.d.ts +14 -0
- package/dist/plugins/triggers/pauseTriggerInbox/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/pauseTriggerInbox/schemas.js +9 -0
- package/dist/plugins/triggers/releaseTriggerInboxMessages/index.d.ts +51 -0
- package/dist/plugins/triggers/releaseTriggerInboxMessages/index.d.ts.map +1 -0
- package/dist/plugins/triggers/releaseTriggerInboxMessages/index.js +37 -0
- package/dist/plugins/triggers/releaseTriggerInboxMessages/schemas.d.ts +34 -0
- package/dist/plugins/triggers/releaseTriggerInboxMessages/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/releaseTriggerInboxMessages/schemas.js +17 -0
- package/dist/plugins/triggers/resumeTriggerInbox/index.d.ts +50 -0
- package/dist/plugins/triggers/resumeTriggerInbox/index.d.ts.map +1 -0
- package/dist/plugins/triggers/resumeTriggerInbox/index.js +26 -0
- package/dist/plugins/triggers/resumeTriggerInbox/schemas.d.ts +14 -0
- package/dist/plugins/triggers/resumeTriggerInbox/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/resumeTriggerInbox/schemas.js +9 -0
- package/dist/plugins/triggers/shared.d.ts +17 -0
- package/dist/plugins/triggers/shared.d.ts.map +1 -0
- package/dist/plugins/triggers/shared.js +16 -0
- package/dist/plugins/triggers/updateTriggerInbox/index.d.ts +51 -0
- package/dist/plugins/triggers/updateTriggerInbox/index.d.ts.map +1 -0
- package/dist/plugins/triggers/updateTriggerInbox/index.js +30 -0
- package/dist/plugins/triggers/updateTriggerInbox/schemas.d.ts +15 -0
- package/dist/plugins/triggers/updateTriggerInbox/schemas.d.ts.map +1 -0
- package/dist/plugins/triggers/updateTriggerInbox/schemas.js +15 -0
- package/dist/plugins/triggers/utils.d.ts +17 -0
- package/dist/plugins/triggers/utils.d.ts.map +1 -0
- package/dist/plugins/triggers/utils.js +28 -0
- package/dist/plugins/triggers/watchTriggerInbox/index.d.ts +163 -0
- package/dist/plugins/triggers/watchTriggerInbox/index.d.ts.map +1 -0
- package/dist/plugins/triggers/watchTriggerInbox/index.js +111 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +2 -0
- package/dist/resolvers/actionKey.d.ts +1 -0
- package/dist/resolvers/actionKey.d.ts.map +1 -1
- package/dist/resolvers/actionKey.js +1 -1
- package/dist/resolvers/index.d.ts +2 -2
- package/dist/resolvers/index.d.ts.map +1 -1
- package/dist/resolvers/index.js +2 -2
- package/dist/resolvers/triggerInbox.d.ts +4 -0
- package/dist/resolvers/triggerInbox.d.ts.map +1 -0
- package/dist/resolvers/triggerInbox.js +18 -0
- package/dist/schemas/TriggerInbox.d.ts +59 -0
- package/dist/schemas/TriggerInbox.d.ts.map +1 -0
- package/dist/schemas/TriggerInbox.js +81 -0
- package/dist/schemas/TriggerMessage.d.ts +48 -0
- package/dist/schemas/TriggerMessage.d.ts.map +1 -0
- package/dist/schemas/TriggerMessage.js +79 -0
- package/dist/sdk.d.ts +621 -17
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +26 -9
- package/dist/types/errors.d.ts +13 -0
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +16 -0
- package/dist/types/plugin.d.ts +12 -1
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/properties.d.ts +12 -0
- package/dist/types/properties.d.ts.map +1 -1
- package/dist/types/properties.js +25 -0
- package/dist/types/registry.d.ts +5 -0
- package/dist/types/registry.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +2 -2
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/signals.d.ts +20 -0
- package/dist/types/signals.d.ts.map +1 -0
- package/dist/types/signals.js +21 -0
- package/dist/utils/abort-utils.d.ts +13 -0
- package/dist/utils/abort-utils.d.ts.map +1 -1
- package/dist/utils/abort-utils.js +15 -0
- package/dist/utils/retry-utils.d.ts +6 -2
- package/dist/utils/retry-utils.d.ts.map +1 -1
- package/dist/utils/retry-utils.js +22 -3
- package/dist/utils/schema-utils.d.ts +19 -1
- package/dist/utils/schema-utils.d.ts.map +1 -1
- package/package.json +12 -1
- package/dist/plugins/getInputFieldsSchema/index.d.ts.map +0 -1
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +0 -1
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +0 -1
- package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +0 -1
- package/dist/plugins/listInputFields/index.d.ts.map +0 -1
- package/dist/plugins/listInputFields/schemas.d.ts.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
|
|
2
|
+
import { UpdateTriggerInboxSchema, TriggerInboxItemSchema } from "./schemas";
|
|
3
|
+
import { triggerInboxResolver } from "../../../resolvers";
|
|
4
|
+
import { resolveTriggerInboxId } from "../utils";
|
|
5
|
+
import { triggersDefaults } from "../shared";
|
|
6
|
+
export const updateTriggerInboxPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
7
|
+
...triggersDefaults,
|
|
8
|
+
name: "updateTriggerInbox",
|
|
9
|
+
type: "update",
|
|
10
|
+
itemType: "TriggerInbox",
|
|
11
|
+
inputSchema: UpdateTriggerInboxSchema,
|
|
12
|
+
outputSchema: TriggerInboxItemSchema,
|
|
13
|
+
resolvers: { inbox: triggerInboxResolver },
|
|
14
|
+
handler: async ({ sdk, options }) => {
|
|
15
|
+
const { inbox, notificationUrl } = options;
|
|
16
|
+
const inboxId = await resolveTriggerInboxId({
|
|
17
|
+
api: sdk.context.api,
|
|
18
|
+
inbox,
|
|
19
|
+
});
|
|
20
|
+
const requestBody = {};
|
|
21
|
+
if (notificationUrl !== undefined) {
|
|
22
|
+
requestBody.notification_url = notificationUrl;
|
|
23
|
+
}
|
|
24
|
+
const rawResponse = await sdk.context.api.patch(`/trigger-inbox/api/v1/inboxes/${encodeURIComponent(inboxId)}`, requestBody, {
|
|
25
|
+
authRequired: true,
|
|
26
|
+
resource: { type: "trigger_inbox", id: inboxId },
|
|
27
|
+
});
|
|
28
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
29
|
+
},
|
|
30
|
+
}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { FunctionOptions } from "../../../types/functions";
|
|
3
|
+
import { TriggerInboxItemSchema, type TriggerInboxItem } from "../../../schemas/TriggerInbox";
|
|
4
|
+
export declare const UpdateTriggerInboxSchema: z.ZodObject<{
|
|
5
|
+
inbox: z.ZodString & {
|
|
6
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
7
|
+
};
|
|
8
|
+
notificationUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type UpdateTriggerInboxOptions = z.infer<typeof UpdateTriggerInboxSchema> & FunctionOptions;
|
|
11
|
+
export interface UpdateTriggerInboxResult {
|
|
12
|
+
data: TriggerInboxItem;
|
|
13
|
+
}
|
|
14
|
+
export { TriggerInboxItemSchema };
|
|
15
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/updateTriggerInbox/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;;;;;iBAYsB,CAAC;AAE5D,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,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TriggerInboxPropertySchema } from "../../../types/properties";
|
|
3
|
+
import { TriggerInboxItemSchema, } from "../../../schemas/TriggerInbox";
|
|
4
|
+
export const UpdateTriggerInboxSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
inbox: TriggerInboxPropertySchema,
|
|
7
|
+
notificationUrl: z
|
|
8
|
+
.string()
|
|
9
|
+
.url()
|
|
10
|
+
.nullable()
|
|
11
|
+
.optional()
|
|
12
|
+
.describe("Webhook URL to POST to when new messages arrive. Pass null to clear."),
|
|
13
|
+
})
|
|
14
|
+
.describe("Update settings on an existing trigger inbox");
|
|
15
|
+
export { TriggerInboxItemSchema };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ApiClient } from "../../api";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves an `inbox` locator (UUID or name) to a UUID.
|
|
4
|
+
*
|
|
5
|
+
* Per the locator rule, the value is loose: the API takes a UUID, but the
|
|
6
|
+
* SDK accepts either form. UUID-shaped inputs pass through unchanged;
|
|
7
|
+
* anything else is looked up by name via `GET /inboxes?name=...`.
|
|
8
|
+
*
|
|
9
|
+
* Edge case: if a user names an inbox with a UUID-shaped string, this
|
|
10
|
+
* method treats it as a UUID. To target a UUID-shaped name, use
|
|
11
|
+
* `listTriggerInboxes({ name })` to get the actual UUID, then pass that.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveTriggerInboxId({ api, inbox, }: {
|
|
14
|
+
api: ApiClient;
|
|
15
|
+
inbox: string;
|
|
16
|
+
}): Promise<string>;
|
|
17
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/triggers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAM3C;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CAAC,EAC1C,GAAG,EACH,KAAK,GACN,EAAE;IACD,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBlB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ZapierResourceNotFoundError } from "../../types/errors";
|
|
2
|
+
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
3
|
+
/**
|
|
4
|
+
* Resolves an `inbox` locator (UUID or name) to a UUID.
|
|
5
|
+
*
|
|
6
|
+
* Per the locator rule, the value is loose: the API takes a UUID, but the
|
|
7
|
+
* SDK accepts either form. UUID-shaped inputs pass through unchanged;
|
|
8
|
+
* anything else is looked up by name via `GET /inboxes?name=...`.
|
|
9
|
+
*
|
|
10
|
+
* Edge case: if a user names an inbox with a UUID-shaped string, this
|
|
11
|
+
* method treats it as a UUID. To target a UUID-shaped name, use
|
|
12
|
+
* `listTriggerInboxes({ name })` to get the actual UUID, then pass that.
|
|
13
|
+
*/
|
|
14
|
+
export async function resolveTriggerInboxId({ api, inbox, }) {
|
|
15
|
+
if (UUID_REGEX.test(inbox)) {
|
|
16
|
+
return inbox;
|
|
17
|
+
}
|
|
18
|
+
const rawResponse = await api.get("/trigger-inbox/api/v1/inboxes", {
|
|
19
|
+
searchParams: { name: inbox, limit: "1" },
|
|
20
|
+
authRequired: true,
|
|
21
|
+
});
|
|
22
|
+
const response = rawResponse;
|
|
23
|
+
const id = response.results?.[0]?.id;
|
|
24
|
+
if (!id) {
|
|
25
|
+
throw new ZapierResourceNotFoundError(`No trigger inbox named "${inbox}" found.`, { resourceType: "trigger_inbox", resourceId: inbox });
|
|
26
|
+
}
|
|
27
|
+
return id;
|
|
28
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { type WatchTriggerInboxOptions } from "../drainTriggerInbox/schemas";
|
|
2
|
+
/**
|
|
3
|
+
* `watchTriggerInbox` is the continuous-consumption variant of
|
|
4
|
+
* `drainTriggerInbox`. Same options surface, same callback shape;
|
|
5
|
+
* the difference is that an empty lease triggers poll-and-wait
|
|
6
|
+
* (with backoff) rather than ending the command. Resolves cleanly
|
|
7
|
+
* on `signal` abort or when a callback throws
|
|
8
|
+
* `ZapierAbortDrainSignal`; rejects on a fatal error or a
|
|
9
|
+
* fail-fast handler error (when `continueOnError` is false).
|
|
10
|
+
*/
|
|
11
|
+
export declare const watchTriggerInboxPlugin: (sdk: {
|
|
12
|
+
context: {
|
|
13
|
+
api: import("../../..").ApiClient;
|
|
14
|
+
resolveCredentials: () => Promise<string | {
|
|
15
|
+
clientId: string;
|
|
16
|
+
clientSecret: string;
|
|
17
|
+
type?: "client_credentials" | undefined;
|
|
18
|
+
baseUrl?: string | undefined;
|
|
19
|
+
scope?: string | undefined;
|
|
20
|
+
} | {
|
|
21
|
+
clientId: string;
|
|
22
|
+
type?: "pkce" | undefined;
|
|
23
|
+
baseUrl?: string | undefined;
|
|
24
|
+
scope?: string | undefined;
|
|
25
|
+
} | undefined>;
|
|
26
|
+
};
|
|
27
|
+
} & {
|
|
28
|
+
leaseTriggerInboxMessages: (options?: {
|
|
29
|
+
inbox: string;
|
|
30
|
+
leaseLimit?: number | undefined;
|
|
31
|
+
leaseSeconds?: number | undefined;
|
|
32
|
+
signal?: AbortSignal | undefined;
|
|
33
|
+
} | undefined) => Promise<{
|
|
34
|
+
data: {
|
|
35
|
+
lease_id: string | null;
|
|
36
|
+
leased_until: string | null;
|
|
37
|
+
results: {
|
|
38
|
+
id: string;
|
|
39
|
+
created_at: string;
|
|
40
|
+
status: string;
|
|
41
|
+
message_attributes: {
|
|
42
|
+
lease_count: number;
|
|
43
|
+
error_message: string | null;
|
|
44
|
+
possible_duplicate_data: boolean;
|
|
45
|
+
};
|
|
46
|
+
payload: Record<string, unknown>;
|
|
47
|
+
}[];
|
|
48
|
+
inbox_attributes: {
|
|
49
|
+
status: string;
|
|
50
|
+
paused_reason: string | null;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
} & {
|
|
55
|
+
context: {
|
|
56
|
+
meta: {
|
|
57
|
+
leaseTriggerInboxMessages: import("../../..").PluginMeta;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
} & {
|
|
61
|
+
ackTriggerInboxMessages: (options?: {
|
|
62
|
+
inbox: string;
|
|
63
|
+
lease: string;
|
|
64
|
+
messages?: string[] | undefined;
|
|
65
|
+
} | undefined) => Promise<{
|
|
66
|
+
data: {
|
|
67
|
+
acked_id: string | null;
|
|
68
|
+
results: {
|
|
69
|
+
id: string;
|
|
70
|
+
created_at: string;
|
|
71
|
+
status: string;
|
|
72
|
+
message_attributes: {
|
|
73
|
+
lease_count: number;
|
|
74
|
+
error_message: string | null;
|
|
75
|
+
possible_duplicate_data: boolean;
|
|
76
|
+
};
|
|
77
|
+
}[];
|
|
78
|
+
};
|
|
79
|
+
}>;
|
|
80
|
+
} & {
|
|
81
|
+
context: {
|
|
82
|
+
meta: {
|
|
83
|
+
ackTriggerInboxMessages: import("../../..").PluginMeta;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
} & {
|
|
87
|
+
releaseTriggerInboxMessages: (options?: {
|
|
88
|
+
inbox: string;
|
|
89
|
+
lease: string;
|
|
90
|
+
messages?: string[] | undefined;
|
|
91
|
+
} | undefined) => Promise<{
|
|
92
|
+
data: {
|
|
93
|
+
released_id: string | null;
|
|
94
|
+
results: {
|
|
95
|
+
id: string;
|
|
96
|
+
created_at: string;
|
|
97
|
+
status: string;
|
|
98
|
+
message_attributes: {
|
|
99
|
+
lease_count: number;
|
|
100
|
+
error_message: string | null;
|
|
101
|
+
possible_duplicate_data: boolean;
|
|
102
|
+
};
|
|
103
|
+
}[];
|
|
104
|
+
};
|
|
105
|
+
}>;
|
|
106
|
+
} & {
|
|
107
|
+
context: {
|
|
108
|
+
meta: {
|
|
109
|
+
releaseTriggerInboxMessages: import("../../..").PluginMeta;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
} & {
|
|
113
|
+
context: {
|
|
114
|
+
meta: Record<string, import("../../..").PluginMeta>;
|
|
115
|
+
};
|
|
116
|
+
}) => {
|
|
117
|
+
watchTriggerInbox: (options: WatchTriggerInboxOptions) => Promise<void>;
|
|
118
|
+
context: {
|
|
119
|
+
meta: {
|
|
120
|
+
watchTriggerInbox: {
|
|
121
|
+
type: "create";
|
|
122
|
+
description: string;
|
|
123
|
+
itemType: string;
|
|
124
|
+
returnType: string;
|
|
125
|
+
inputSchema: import("zod").ZodObject<{
|
|
126
|
+
inbox: import("zod").ZodString & {
|
|
127
|
+
_def: import("zod/v4/core").$ZodStringDef & import("../../..").PositionalMetadata;
|
|
128
|
+
};
|
|
129
|
+
onMessage: import("zod").ZodOptional<import("zod").ZodFunction<import("zod/v4/core").$ZodFunctionArgs, import("zod/v4/core").$ZodFunctionOut>>;
|
|
130
|
+
concurrency: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
131
|
+
leaseLimit: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
132
|
+
leaseSeconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
133
|
+
releaseOnError: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
134
|
+
continueOnError: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
135
|
+
onError: import("zod").ZodOptional<import("zod").ZodFunction<import("zod/v4/core").$ZodFunctionArgs, import("zod/v4/core").$ZodFunctionOut>>;
|
|
136
|
+
signal: import("zod").ZodOptional<import("zod").ZodCustom<AbortSignal, AbortSignal>>;
|
|
137
|
+
maxDrainIntervalSeconds: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
138
|
+
}, import("zod/v4/core").$strip>;
|
|
139
|
+
resolvers: {
|
|
140
|
+
inbox: import("../../..").DynamicResolver<{
|
|
141
|
+
id: string;
|
|
142
|
+
created_at: string;
|
|
143
|
+
name: string | null;
|
|
144
|
+
status: string;
|
|
145
|
+
paused_reason: string | null;
|
|
146
|
+
notification_url: string | null;
|
|
147
|
+
subscription: {
|
|
148
|
+
connection_id: string | number | null;
|
|
149
|
+
app_key: string;
|
|
150
|
+
action_key: string;
|
|
151
|
+
inputs: Record<string, unknown>;
|
|
152
|
+
};
|
|
153
|
+
}, {}>;
|
|
154
|
+
};
|
|
155
|
+
packages: readonly ["sdk"];
|
|
156
|
+
categories: string[];
|
|
157
|
+
experimental: true;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
export type WatchTriggerInboxPluginProvides = ReturnType<typeof watchTriggerInboxPlugin>;
|
|
163
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/watchTriggerInbox/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,8BAA8B,CAAC;AAkDtC;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAQrB,wBAAwB,KAChC,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0EnB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,UAAU,CACtD,OAAO,uBAAuB,CAC/B,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { definePlugin } from "../../../utils/plugin-utils";
|
|
2
|
+
import { WatchTriggerInboxSchema, } from "../drainTriggerInbox/schemas";
|
|
3
|
+
import { requireOnMessage, resolveConcurrencyAndLease, runDrainPass, } from "../drainTriggerInbox";
|
|
4
|
+
import { resolveTriggerInboxId } from "../utils";
|
|
5
|
+
import { triggerInboxResolver } from "../../../resolvers";
|
|
6
|
+
import { triggersDefaults } from "../shared";
|
|
7
|
+
const POLL_STAGES = [
|
|
8
|
+
[125, 125],
|
|
9
|
+
[375, 250],
|
|
10
|
+
[875, 500],
|
|
11
|
+
[10000, 1000],
|
|
12
|
+
[30000, 2500],
|
|
13
|
+
[60000, 5000],
|
|
14
|
+
[180000, 10000],
|
|
15
|
+
];
|
|
16
|
+
const DEFAULT_MAX_DRAIN_INTERVAL_MS = 60000;
|
|
17
|
+
function pickPollIntervalMs(elapsedMs, maxIntervalMs) {
|
|
18
|
+
const stage = POLL_STAGES.find(([threshold]) => elapsedMs < threshold);
|
|
19
|
+
const interval = stage ? stage[1] : maxIntervalMs;
|
|
20
|
+
return Math.min(interval, maxIntervalMs);
|
|
21
|
+
}
|
|
22
|
+
function sleepOrAbort(ms, signal) {
|
|
23
|
+
if (signal?.aborted)
|
|
24
|
+
return Promise.resolve();
|
|
25
|
+
return new Promise((resolve) => {
|
|
26
|
+
let settled = false;
|
|
27
|
+
const settle = () => {
|
|
28
|
+
if (settled)
|
|
29
|
+
return;
|
|
30
|
+
settled = true;
|
|
31
|
+
clearTimeout(timer);
|
|
32
|
+
signal?.removeEventListener("abort", settle);
|
|
33
|
+
resolve();
|
|
34
|
+
};
|
|
35
|
+
const timer = setTimeout(settle, ms);
|
|
36
|
+
signal?.addEventListener("abort", settle, { once: true });
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* `watchTriggerInbox` is the continuous-consumption variant of
|
|
41
|
+
* `drainTriggerInbox`. Same options surface, same callback shape;
|
|
42
|
+
* the difference is that an empty lease triggers poll-and-wait
|
|
43
|
+
* (with backoff) rather than ending the command. Resolves cleanly
|
|
44
|
+
* on `signal` abort or when a callback throws
|
|
45
|
+
* `ZapierAbortDrainSignal`; rejects on a fatal error or a
|
|
46
|
+
* fail-fast handler error (when `continueOnError` is false).
|
|
47
|
+
*/
|
|
48
|
+
export const watchTriggerInboxPlugin = definePlugin((sdk) => {
|
|
49
|
+
async function watchTriggerInbox(options) {
|
|
50
|
+
const onMessage = requireOnMessage(options.onMessage);
|
|
51
|
+
const { concurrency, leaseLimit } = resolveConcurrencyAndLease(options);
|
|
52
|
+
const inboxId = await resolveTriggerInboxId({
|
|
53
|
+
api: sdk.context.api,
|
|
54
|
+
inbox: options.inbox,
|
|
55
|
+
});
|
|
56
|
+
const maxDrainIntervalMs = options.maxDrainIntervalSeconds !== undefined
|
|
57
|
+
? options.maxDrainIntervalSeconds * 1000
|
|
58
|
+
: DEFAULT_MAX_DRAIN_INTERVAL_MS;
|
|
59
|
+
let firstFetch = true;
|
|
60
|
+
let lastNonEmptyAt = Date.now();
|
|
61
|
+
while (!options.signal?.aborted) {
|
|
62
|
+
const outcome = await runDrainPass({
|
|
63
|
+
sdk,
|
|
64
|
+
inboxId,
|
|
65
|
+
onMessage,
|
|
66
|
+
concurrency,
|
|
67
|
+
leaseLimit,
|
|
68
|
+
leaseSeconds: options.leaseSeconds,
|
|
69
|
+
maxMessages: undefined,
|
|
70
|
+
releaseOnError: options.releaseOnError ?? false,
|
|
71
|
+
continueOnError: options.continueOnError ?? false,
|
|
72
|
+
onError: options.onError,
|
|
73
|
+
signal: options.signal,
|
|
74
|
+
firstFetch,
|
|
75
|
+
});
|
|
76
|
+
firstFetch = false;
|
|
77
|
+
if (options.signal?.aborted)
|
|
78
|
+
return;
|
|
79
|
+
if (outcome.abortedFromCallback)
|
|
80
|
+
return;
|
|
81
|
+
if (outcome.processed > 0) {
|
|
82
|
+
lastNonEmptyAt = Date.now();
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const elapsedMs = Date.now() - lastNonEmptyAt;
|
|
86
|
+
await sleepOrAbort(pickPollIntervalMs(elapsedMs, maxDrainIntervalMs), options.signal);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
watchTriggerInbox,
|
|
91
|
+
context: {
|
|
92
|
+
meta: {
|
|
93
|
+
watchTriggerInbox: {
|
|
94
|
+
...triggersDefaults,
|
|
95
|
+
type: "create",
|
|
96
|
+
description: "Continuously consume a trigger inbox: drain currently-available messages via onMessage, then poll with backoff for new arrivals, until aborted. Resolves cleanly on signal abort or ZapierAbortDrainSignal from a handler; rejects on fatal SDK errors or fail-fast handler errors.",
|
|
97
|
+
itemType: "void",
|
|
98
|
+
// See drainTriggerInbox: override the doc generator's default
|
|
99
|
+
// suffix so the rendered return type is Promise<void>, not
|
|
100
|
+
// Promise<voidItem>.
|
|
101
|
+
returnType: "void",
|
|
102
|
+
inputSchema: WatchTriggerInboxSchema,
|
|
103
|
+
resolvers: {
|
|
104
|
+
inbox: triggerInboxResolver,
|
|
105
|
+
},
|
|
106
|
+
packages: ["sdk"],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
});
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA6CvD,wBAAgB,aAAa,CAAC,EAC5B,GAAG,EACH,IAAI,EACJ,aAAa,GACd,EAAE;IACD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,cAAc,CAoEjB"}
|
package/dist/registry.js
CHANGED
|
@@ -28,6 +28,7 @@ const categoryDefinitions = {
|
|
|
28
28
|
titlePlural: "Client Credentials",
|
|
29
29
|
},
|
|
30
30
|
table: { title: "Table" },
|
|
31
|
+
trigger: { title: "Trigger" },
|
|
31
32
|
http: { title: "HTTP Request" },
|
|
32
33
|
utility: { title: "Utility", titlePlural: "Utilities" },
|
|
33
34
|
other: { title: "Other" },
|
|
@@ -57,6 +58,7 @@ export function buildRegistry({ sdk, meta, packageFilter, }) {
|
|
|
57
58
|
categories: m.categories || [],
|
|
58
59
|
resolvers: m.resolvers,
|
|
59
60
|
formatter: m.formatter,
|
|
61
|
+
experimental: m.experimental,
|
|
60
62
|
packages: m.packages,
|
|
61
63
|
confirm: m.confirm ?? (m.type === "delete" ? "delete" : undefined),
|
|
62
64
|
deprecation: m.deprecation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAC7C,UAAU,EACV;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,kBAAkB,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"actionKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAC7C,UAAU,EACV;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,kBAAkB,CAAA;CAAE,CAwBhD,CAAC"}
|
|
@@ -5,7 +5,7 @@ export const actionKeyResolver = {
|
|
|
5
5
|
const actionsResponse = await sdk.listActions({
|
|
6
6
|
app: resolvedParams.app,
|
|
7
7
|
});
|
|
8
|
-
return actionsResponse.data.filter((action) => action.action_type === resolvedParams.actionType);
|
|
8
|
+
return actionsResponse.data.filter((action) => action.action_type === resolvedParams.actionType && !action.is_hidden);
|
|
9
9
|
},
|
|
10
10
|
prompt: (actions) => ({
|
|
11
11
|
type: "list",
|
|
@@ -6,12 +6,12 @@ export { connectionIdResolver, connectionIdGenericResolver, } from "./connection
|
|
|
6
6
|
export { connectionIdResolver as authenticationIdResolver } from "./connectionId";
|
|
7
7
|
/** @deprecated Use connectionIdGenericResolver instead */
|
|
8
8
|
export { connectionIdGenericResolver as authenticationIdGenericResolver } from "./connectionId";
|
|
9
|
-
export { inputsResolver } from "./inputs";
|
|
9
|
+
export { inputsResolver, inputsAllOptionalResolver } from "./inputs";
|
|
10
10
|
export { inputFieldKeyResolver } from "./inputFieldKey";
|
|
11
|
-
export { inputsAllOptionalResolver } from "./inputs";
|
|
12
11
|
export { clientCredentialsNameResolver } from "./clientCredentialsName";
|
|
13
12
|
export { clientIdResolver } from "./clientId";
|
|
14
13
|
export { tableIdResolver } from "./tableId";
|
|
14
|
+
export { triggerInboxResolver } from "./triggerInbox";
|
|
15
15
|
export { tableRecordIdResolver, tableRecordIdsResolver } from "./tableRecordId";
|
|
16
16
|
export { tableFieldIdsResolver } from "./tableFieldIds";
|
|
17
17
|
export { tableNameResolver } from "./tableName";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resolvers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAGxB,mDAAmD;AACnD,OAAO,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAClF,0DAA0D;AAC1D,OAAO,EAAE,2BAA2B,IAAI,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resolvers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAGxB,mDAAmD;AACnD,OAAO,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAClF,0DAA0D;AAC1D,OAAO,EAAE,2BAA2B,IAAI,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/resolvers/index.js
CHANGED
|
@@ -8,12 +8,12 @@ export { connectionIdResolver, connectionIdGenericResolver, } from "./connection
|
|
|
8
8
|
export { connectionIdResolver as authenticationIdResolver } from "./connectionId";
|
|
9
9
|
/** @deprecated Use connectionIdGenericResolver instead */
|
|
10
10
|
export { connectionIdGenericResolver as authenticationIdGenericResolver } from "./connectionId";
|
|
11
|
-
export { inputsResolver } from "./inputs";
|
|
11
|
+
export { inputsResolver, inputsAllOptionalResolver } from "./inputs";
|
|
12
12
|
export { inputFieldKeyResolver } from "./inputFieldKey";
|
|
13
|
-
export { inputsAllOptionalResolver } from "./inputs";
|
|
14
13
|
export { clientCredentialsNameResolver } from "./clientCredentialsName";
|
|
15
14
|
export { clientIdResolver } from "./clientId";
|
|
16
15
|
export { tableIdResolver } from "./tableId";
|
|
16
|
+
export { triggerInboxResolver } from "./triggerInbox";
|
|
17
17
|
export { tableRecordIdResolver, tableRecordIdsResolver } from "./tableRecordId";
|
|
18
18
|
export { tableFieldIdsResolver } from "./tableFieldIds";
|
|
19
19
|
export { tableNameResolver } from "./tableName";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggerInbox.d.ts","sourceRoot":"","sources":["../../src/resolvers/triggerInbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAchE,eAAO,MAAM,oBAAoB,EAAE,eAAe,CAAC,gBAAgB,EAAE,EAAE,CAiBtE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { toIterable } from "../utils/pagination-utils";
|
|
2
|
+
export const triggerInboxResolver = {
|
|
3
|
+
type: "dynamic",
|
|
4
|
+
fetch: async (sdk) => toIterable(sdk.listTriggerInboxes()),
|
|
5
|
+
prompt: (inboxes) => ({
|
|
6
|
+
type: "list",
|
|
7
|
+
name: "inbox",
|
|
8
|
+
message: "Select a trigger inbox:",
|
|
9
|
+
// `deleting` inboxes are on their way out — no operation against them
|
|
10
|
+
// is useful (delete is a no-op, pause/resume/update are rejected).
|
|
11
|
+
choices: inboxes
|
|
12
|
+
.filter((inbox) => inbox.status !== "deleting")
|
|
13
|
+
.map((inbox) => ({
|
|
14
|
+
name: `${inbox.name ?? inbox.id} (${inbox.subscription.app_key} / ${inbox.subscription.action_key}, ${inbox.status})`,
|
|
15
|
+
value: inbox.id,
|
|
16
|
+
})),
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const TriggerInboxStatusSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
3
|
+
initializing: "initializing";
|
|
4
|
+
active: "active";
|
|
5
|
+
paused: "paused";
|
|
6
|
+
deleting: "deleting";
|
|
7
|
+
initialization_failure: "initialization_failure";
|
|
8
|
+
}>, z.ZodString]>;
|
|
9
|
+
export type TriggerInboxStatus = z.infer<typeof TriggerInboxStatusSchema>;
|
|
10
|
+
export declare const TriggerInboxPausedReasonSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
11
|
+
unknown: "unknown";
|
|
12
|
+
user: "user";
|
|
13
|
+
authentication: "authentication";
|
|
14
|
+
authentication_access_revoked: "authentication_access_revoked";
|
|
15
|
+
partner_revoked: "partner_revoked";
|
|
16
|
+
subscribe_failed: "subscribe_failed";
|
|
17
|
+
migrate_failed: "migrate_failed";
|
|
18
|
+
abandoned: "abandoned";
|
|
19
|
+
upstream_failures: "upstream_failures";
|
|
20
|
+
}>, z.ZodString]>;
|
|
21
|
+
export type TriggerInboxPausedReason = z.infer<typeof TriggerInboxPausedReasonSchema>;
|
|
22
|
+
export declare const TriggerSubscriptionApiSchema: z.ZodObject<{
|
|
23
|
+
connection_id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
24
|
+
app_key: z.ZodString;
|
|
25
|
+
action_key: z.ZodString;
|
|
26
|
+
inputs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export declare const TriggerInboxItemSchema: z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
created_at: z.ZodString;
|
|
31
|
+
name: z.ZodNullable<z.ZodString>;
|
|
32
|
+
status: z.ZodUnion<readonly [z.ZodEnum<{
|
|
33
|
+
initializing: "initializing";
|
|
34
|
+
active: "active";
|
|
35
|
+
paused: "paused";
|
|
36
|
+
deleting: "deleting";
|
|
37
|
+
initialization_failure: "initialization_failure";
|
|
38
|
+
}>, z.ZodString]>;
|
|
39
|
+
paused_reason: z.ZodNullable<z.ZodUnion<readonly [z.ZodEnum<{
|
|
40
|
+
unknown: "unknown";
|
|
41
|
+
user: "user";
|
|
42
|
+
authentication: "authentication";
|
|
43
|
+
authentication_access_revoked: "authentication_access_revoked";
|
|
44
|
+
partner_revoked: "partner_revoked";
|
|
45
|
+
subscribe_failed: "subscribe_failed";
|
|
46
|
+
migrate_failed: "migrate_failed";
|
|
47
|
+
abandoned: "abandoned";
|
|
48
|
+
upstream_failures: "upstream_failures";
|
|
49
|
+
}>, z.ZodString]>>;
|
|
50
|
+
notification_url: z.ZodNullable<z.ZodString>;
|
|
51
|
+
subscription: z.ZodObject<{
|
|
52
|
+
connection_id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
53
|
+
app_key: z.ZodString;
|
|
54
|
+
action_key: z.ZodString;
|
|
55
|
+
inputs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
export type TriggerInboxItem = z.infer<typeof TriggerInboxItemSchema>;
|
|
59
|
+
//# sourceMappingURL=TriggerInbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TriggerInbox.d.ts","sourceRoot":"","sources":["../../src/schemas/TriggerInbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,wBAAwB;;;;;;iBAWA,CAAC;AAEtC,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAI1E,eAAO,MAAM,8BAA8B;;;;;;;;;;iBAeW,CAAC;AAEvD,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;iBAKvC,CAAC;AAYH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuClC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|