@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,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type LeasedTriggerMessageItem } from "../../../schemas/TriggerMessage";
|
|
3
|
+
export declare const LeaseTriggerInboxMessagesSchema: z.ZodObject<{
|
|
4
|
+
inbox: z.ZodString & {
|
|
5
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
6
|
+
};
|
|
7
|
+
leaseLimit: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
leaseSeconds: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type LeaseTriggerInboxMessagesOptions = z.infer<typeof LeaseTriggerInboxMessagesSchema>;
|
|
12
|
+
export declare const LeaseTriggerInboxMessagesItemSchema: z.ZodObject<{
|
|
13
|
+
lease_id: z.ZodNullable<z.ZodString>;
|
|
14
|
+
leased_until: z.ZodNullable<z.ZodString>;
|
|
15
|
+
results: z.ZodArray<z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
created_at: z.ZodString;
|
|
18
|
+
status: z.ZodUnion<readonly [z.ZodEnum<{
|
|
19
|
+
available: "available";
|
|
20
|
+
leased: "leased";
|
|
21
|
+
acked: "acked";
|
|
22
|
+
quarantined: "quarantined";
|
|
23
|
+
}>, z.ZodString]>;
|
|
24
|
+
message_attributes: z.ZodObject<{
|
|
25
|
+
lease_count: z.ZodNumber;
|
|
26
|
+
error_message: z.ZodNullable<z.ZodString>;
|
|
27
|
+
possible_duplicate_data: z.ZodBoolean;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
inbox_attributes: z.ZodObject<{
|
|
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
|
+
}, z.core.$strip>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type LeaseTriggerInboxMessagesItem = z.infer<typeof LeaseTriggerInboxMessagesItemSchema>;
|
|
53
|
+
export interface LeaseTriggerInboxMessagesResult {
|
|
54
|
+
data: LeaseTriggerInboxMessagesItem;
|
|
55
|
+
}
|
|
56
|
+
export type LeasedMessage = LeasedTriggerMessageItem;
|
|
57
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/leaseTriggerInboxMessages/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,iCAAiC,CAAC;AAEzC,eAAO,MAAM,+BAA+B;;;;;;;iBAczC,CAAC;AAEJ,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,+BAA+B,CACvC,CAAC;AAOF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK9C,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,mCAAmC,CAC3C,CAAC;AAEF,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,6BAA6B,CAAC;CACrC;AAED,MAAM,MAAM,aAAa,GAAG,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TriggerInboxPropertySchema, LeaseSecondsPropertySchema, LeaseLimitPropertySchema, } from "../../../types/properties";
|
|
3
|
+
import { TriggerInboxStatusSchema, TriggerInboxPausedReasonSchema, } from "../../../schemas/TriggerInbox";
|
|
4
|
+
import { LeasedTriggerMessageItemSchema, } from "../../../schemas/TriggerMessage";
|
|
5
|
+
export const LeaseTriggerInboxMessagesSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
inbox: TriggerInboxPropertySchema,
|
|
8
|
+
leaseLimit: LeaseLimitPropertySchema.optional(),
|
|
9
|
+
leaseSeconds: LeaseSecondsPropertySchema.optional(),
|
|
10
|
+
signal: z
|
|
11
|
+
.custom((v) => v instanceof AbortSignal)
|
|
12
|
+
.optional()
|
|
13
|
+
.describe("Abort signal forwarded to the lease HTTP request. Aborting causes the in-flight request to reject with AbortError."),
|
|
14
|
+
})
|
|
15
|
+
.describe("Lease up to N messages from a trigger inbox. Returns messages plus a lease ID; ack within the lease window to remove from the inbox.");
|
|
16
|
+
const InboxAttributesSchema = z.object({
|
|
17
|
+
status: TriggerInboxStatusSchema,
|
|
18
|
+
paused_reason: TriggerInboxPausedReasonSchema.nullable(),
|
|
19
|
+
});
|
|
20
|
+
export const LeaseTriggerInboxMessagesItemSchema = z.object({
|
|
21
|
+
lease_id: z.string().nullable(),
|
|
22
|
+
leased_until: z.string().nullable(),
|
|
23
|
+
results: z.array(LeasedTriggerMessageItemSchema),
|
|
24
|
+
inbox_attributes: InboxAttributesSchema,
|
|
25
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare const listTriggerInboxMessagesPlugin: (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
|
+
listTriggerInboxMessages: (options?: ({
|
|
25
|
+
inbox: string;
|
|
26
|
+
pageSize?: number | undefined;
|
|
27
|
+
maxItems?: number | undefined;
|
|
28
|
+
cursor?: string | undefined;
|
|
29
|
+
} & {
|
|
30
|
+
cursor?: string;
|
|
31
|
+
pageSize?: number;
|
|
32
|
+
maxItems?: number;
|
|
33
|
+
}) | undefined) => import("../../..").PaginatedSdkResult<{
|
|
34
|
+
id: string;
|
|
35
|
+
created_at: string;
|
|
36
|
+
status: string;
|
|
37
|
+
message_attributes: {
|
|
38
|
+
lease_count: number;
|
|
39
|
+
error_message: string | null;
|
|
40
|
+
possible_duplicate_data: boolean;
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
43
|
+
} & {
|
|
44
|
+
context: {
|
|
45
|
+
meta: {
|
|
46
|
+
listTriggerInboxMessages: import("../../..").PluginMeta;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export type ListTriggerInboxMessagesPluginProvides = ReturnType<typeof listTriggerInboxMessagesPlugin>;
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/listTriggerInboxMessages/index.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuC1C,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG,UAAU,CAC7D,OAAO,8BAA8B,CACtC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { definePlugin, createPaginatedPluginMethod, } from "../../../utils/plugin-utils";
|
|
2
|
+
import { ListTriggerInboxMessagesSchema, ListTriggerInboxMessagesApiResponseSchema, TriggerMessageItemSchema, } from "./schemas";
|
|
3
|
+
import { triggerInboxResolver } from "../../../resolvers";
|
|
4
|
+
import { resolveTriggerInboxId } from "../utils";
|
|
5
|
+
import { DEFAULT_PAGE_SIZE } from "../../../constants";
|
|
6
|
+
import { triggersDefaults } from "../shared";
|
|
7
|
+
function extractNextCursor(next) {
|
|
8
|
+
if (!next)
|
|
9
|
+
return undefined;
|
|
10
|
+
try {
|
|
11
|
+
const url = new URL(next);
|
|
12
|
+
return url.searchParams.get("cursor") ?? undefined;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export const listTriggerInboxMessagesPlugin = definePlugin((sdk) => createPaginatedPluginMethod(sdk, {
|
|
19
|
+
...triggersDefaults,
|
|
20
|
+
name: "listTriggerInboxMessages",
|
|
21
|
+
type: "list",
|
|
22
|
+
itemType: "TriggerMessage",
|
|
23
|
+
inputSchema: ListTriggerInboxMessagesSchema,
|
|
24
|
+
outputSchema: TriggerMessageItemSchema,
|
|
25
|
+
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
26
|
+
resolvers: { inbox: triggerInboxResolver },
|
|
27
|
+
handler: async ({ sdk, options }) => {
|
|
28
|
+
const { inbox, cursor, pageSize } = options;
|
|
29
|
+
const inboxId = await resolveTriggerInboxId({
|
|
30
|
+
api: sdk.context.api,
|
|
31
|
+
inbox,
|
|
32
|
+
});
|
|
33
|
+
const searchParams = {};
|
|
34
|
+
if (pageSize !== undefined) {
|
|
35
|
+
searchParams.limit = pageSize.toString();
|
|
36
|
+
}
|
|
37
|
+
if (cursor) {
|
|
38
|
+
searchParams.cursor = cursor;
|
|
39
|
+
}
|
|
40
|
+
const rawResponse = await sdk.context.api.get(`/trigger-inbox/api/v1/inboxes/${encodeURIComponent(inboxId)}/messages`, { searchParams, authRequired: true });
|
|
41
|
+
const response = ListTriggerInboxMessagesApiResponseSchema.parse(rawResponse);
|
|
42
|
+
return {
|
|
43
|
+
data: response.results,
|
|
44
|
+
next: response.next ?? null,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
extractCursor: (response) => extractNextCursor(response.next),
|
|
48
|
+
}));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TriggerMessageItemSchema, type TriggerMessageItem } from "../../../schemas/TriggerMessage";
|
|
3
|
+
export declare const ListTriggerInboxMessagesSchema: z.ZodObject<{
|
|
4
|
+
inbox: z.ZodString & {
|
|
5
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
6
|
+
};
|
|
7
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type ListTriggerInboxMessagesOptions = z.infer<typeof ListTriggerInboxMessagesSchema>;
|
|
12
|
+
export declare const ListTriggerInboxMessagesApiResponseSchema: z.ZodObject<{
|
|
13
|
+
next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
previous: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
results: z.ZodArray<z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
created_at: z.ZodString;
|
|
18
|
+
status: z.ZodUnion<readonly [z.ZodEnum<{
|
|
19
|
+
available: "available";
|
|
20
|
+
leased: "leased";
|
|
21
|
+
acked: "acked";
|
|
22
|
+
quarantined: "quarantined";
|
|
23
|
+
}>, z.ZodString]>;
|
|
24
|
+
message_attributes: z.ZodObject<{
|
|
25
|
+
lease_count: z.ZodNumber;
|
|
26
|
+
error_message: z.ZodNullable<z.ZodString>;
|
|
27
|
+
possible_duplicate_data: z.ZodBoolean;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export type ListTriggerInboxMessagesApiResponse = z.infer<typeof ListTriggerInboxMessagesApiResponseSchema>;
|
|
32
|
+
export interface ListTriggerInboxMessagesPage {
|
|
33
|
+
data: TriggerMessageItem[];
|
|
34
|
+
nextCursor?: string;
|
|
35
|
+
}
|
|
36
|
+
export { TriggerMessageItemSchema };
|
|
37
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/listTriggerInboxMessages/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,wBAAwB,EACxB,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AAEzC,eAAO,MAAM,8BAA8B;;;;;;;iBAiB8B,CAAC;AAE1E,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,8BAA8B,CACtC,CAAC;AAEF,eAAO,MAAM,yCAAyC;;;;;;;;;;;;;;;;;;iBAIpD,CAAC;AAEH,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,yCAAyC,CACjD,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TriggerInboxPropertySchema } from "../../../types/properties";
|
|
3
|
+
import { TriggerMessageItemSchema, } from "../../../schemas/TriggerMessage";
|
|
4
|
+
export const ListTriggerInboxMessagesSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
inbox: TriggerInboxPropertySchema,
|
|
7
|
+
pageSize: z
|
|
8
|
+
.number()
|
|
9
|
+
.int()
|
|
10
|
+
.min(1)
|
|
11
|
+
.optional()
|
|
12
|
+
.describe("Number of messages per page"),
|
|
13
|
+
maxItems: z
|
|
14
|
+
.number()
|
|
15
|
+
.int()
|
|
16
|
+
.min(1)
|
|
17
|
+
.optional()
|
|
18
|
+
.describe("Maximum total items to return across all pages"),
|
|
19
|
+
cursor: z.string().optional().describe("Pagination cursor"),
|
|
20
|
+
})
|
|
21
|
+
.describe("List messages in a trigger inbox (no payload, status-only)");
|
|
22
|
+
export const ListTriggerInboxMessagesApiResponseSchema = z.object({
|
|
23
|
+
next: z.string().nullable().optional(),
|
|
24
|
+
previous: z.string().nullable().optional(),
|
|
25
|
+
results: z.array(TriggerMessageItemSchema),
|
|
26
|
+
});
|
|
27
|
+
export { TriggerMessageItemSchema };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const listTriggerInboxesPlugin: (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
|
+
listTriggerInboxes: (options?: ({
|
|
25
|
+
name?: string | undefined;
|
|
26
|
+
status?: string | undefined;
|
|
27
|
+
pageSize?: number | undefined;
|
|
28
|
+
maxItems?: number | undefined;
|
|
29
|
+
cursor?: string | undefined;
|
|
30
|
+
} & {
|
|
31
|
+
cursor?: string;
|
|
32
|
+
pageSize?: number;
|
|
33
|
+
maxItems?: number;
|
|
34
|
+
}) | undefined) => import("../../..").PaginatedSdkResult<{
|
|
35
|
+
id: string;
|
|
36
|
+
created_at: string;
|
|
37
|
+
name: string | null;
|
|
38
|
+
status: string;
|
|
39
|
+
paused_reason: string | null;
|
|
40
|
+
notification_url: string | null;
|
|
41
|
+
subscription: {
|
|
42
|
+
connection_id: string | number | null;
|
|
43
|
+
app_key: string;
|
|
44
|
+
action_key: string;
|
|
45
|
+
inputs: Record<string, unknown>;
|
|
46
|
+
};
|
|
47
|
+
}>;
|
|
48
|
+
} & {
|
|
49
|
+
context: {
|
|
50
|
+
meta: {
|
|
51
|
+
listTriggerInboxes: import("../../..").PluginMeta;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export type ListTriggerInboxesPluginProvides = ReturnType<typeof listTriggerInboxesPlugin>;
|
|
56
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/listTriggerInboxes/index.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCpC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,UAAU,CACvD,OAAO,wBAAwB,CAChC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { definePlugin, createPaginatedPluginMethod, } from "../../../utils/plugin-utils";
|
|
2
|
+
import { ListTriggerInboxesSchema, ListTriggerInboxesApiResponseSchema, TriggerInboxItemSchema, } from "./schemas";
|
|
3
|
+
import { DEFAULT_PAGE_SIZE } from "../../../constants";
|
|
4
|
+
import { triggersDefaults } from "../shared";
|
|
5
|
+
function extractNextOffset(next) {
|
|
6
|
+
if (!next)
|
|
7
|
+
return undefined;
|
|
8
|
+
try {
|
|
9
|
+
const url = new URL(next);
|
|
10
|
+
const offset = url.searchParams.get("offset");
|
|
11
|
+
return offset || undefined;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export const listTriggerInboxesPlugin = definePlugin((sdk) => createPaginatedPluginMethod(sdk, {
|
|
18
|
+
...triggersDefaults,
|
|
19
|
+
name: "listTriggerInboxes",
|
|
20
|
+
type: "list",
|
|
21
|
+
itemType: "TriggerInbox",
|
|
22
|
+
inputSchema: ListTriggerInboxesSchema,
|
|
23
|
+
outputSchema: TriggerInboxItemSchema,
|
|
24
|
+
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
25
|
+
handler: async ({ sdk, options }) => {
|
|
26
|
+
const { api } = sdk.context;
|
|
27
|
+
const searchParams = {};
|
|
28
|
+
if (options.pageSize !== undefined) {
|
|
29
|
+
searchParams.limit = options.pageSize.toString();
|
|
30
|
+
}
|
|
31
|
+
if (options.cursor) {
|
|
32
|
+
searchParams.offset = options.cursor;
|
|
33
|
+
}
|
|
34
|
+
if (options.status) {
|
|
35
|
+
searchParams.status = options.status;
|
|
36
|
+
}
|
|
37
|
+
if (options.name) {
|
|
38
|
+
searchParams.name = options.name;
|
|
39
|
+
}
|
|
40
|
+
const rawResponse = await api.get("/trigger-inbox/api/v1/inboxes", {
|
|
41
|
+
searchParams,
|
|
42
|
+
authRequired: true,
|
|
43
|
+
});
|
|
44
|
+
const response = ListTriggerInboxesApiResponseSchema.parse(rawResponse);
|
|
45
|
+
return {
|
|
46
|
+
data: response.results,
|
|
47
|
+
next: response.next ?? null,
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
extractCursor: (response) => extractNextOffset(response.next),
|
|
51
|
+
}));
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TriggerInboxItemSchema, type TriggerInboxItem } from "../../../schemas/TriggerInbox";
|
|
3
|
+
export declare const ListTriggerInboxesSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodOptional<z.ZodString>;
|
|
5
|
+
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
6
|
+
initializing: "initializing";
|
|
7
|
+
active: "active";
|
|
8
|
+
paused: "paused";
|
|
9
|
+
deleting: "deleting";
|
|
10
|
+
initialization_failure: "initialization_failure";
|
|
11
|
+
}>, z.ZodString]>>;
|
|
12
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type ListTriggerInboxesOptions = z.infer<typeof ListTriggerInboxesSchema>;
|
|
17
|
+
export declare const ListTriggerInboxesApiResponseSchema: z.ZodObject<{
|
|
18
|
+
count: z.ZodNumber;
|
|
19
|
+
next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
|
+
previous: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
|
+
results: z.ZodArray<z.ZodObject<{
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
created_at: z.ZodString;
|
|
24
|
+
name: z.ZodNullable<z.ZodString>;
|
|
25
|
+
status: z.ZodUnion<readonly [z.ZodEnum<{
|
|
26
|
+
initializing: "initializing";
|
|
27
|
+
active: "active";
|
|
28
|
+
paused: "paused";
|
|
29
|
+
deleting: "deleting";
|
|
30
|
+
initialization_failure: "initialization_failure";
|
|
31
|
+
}>, z.ZodString]>;
|
|
32
|
+
paused_reason: z.ZodNullable<z.ZodUnion<readonly [z.ZodEnum<{
|
|
33
|
+
unknown: "unknown";
|
|
34
|
+
user: "user";
|
|
35
|
+
authentication: "authentication";
|
|
36
|
+
authentication_access_revoked: "authentication_access_revoked";
|
|
37
|
+
partner_revoked: "partner_revoked";
|
|
38
|
+
subscribe_failed: "subscribe_failed";
|
|
39
|
+
migrate_failed: "migrate_failed";
|
|
40
|
+
abandoned: "abandoned";
|
|
41
|
+
upstream_failures: "upstream_failures";
|
|
42
|
+
}>, z.ZodString]>>;
|
|
43
|
+
notification_url: z.ZodNullable<z.ZodString>;
|
|
44
|
+
subscription: z.ZodObject<{
|
|
45
|
+
connection_id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
46
|
+
app_key: z.ZodString;
|
|
47
|
+
action_key: z.ZodString;
|
|
48
|
+
inputs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
}, z.core.$strip>>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type ListTriggerInboxesApiResponse = z.infer<typeof ListTriggerInboxesApiResponseSchema>;
|
|
53
|
+
export interface ListTriggerInboxesPage {
|
|
54
|
+
data: TriggerInboxItem[];
|
|
55
|
+
nextCursor?: string;
|
|
56
|
+
}
|
|
57
|
+
export { TriggerInboxItemSchema };
|
|
58
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/listTriggerInboxes/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,sBAAsB,EAEtB,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AAEvC,eAAO,MAAM,wBAAwB;;;;;;;;;;;;iBA6B6B,CAAC;AAEnE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,wBAAwB,CAChC,CAAC;AAEF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK9C,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,mCAAmC,CAC3C,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TriggerInboxItemSchema, TriggerInboxStatusSchema, } from "../../../schemas/TriggerInbox";
|
|
3
|
+
export const ListTriggerInboxesSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
name: z
|
|
6
|
+
.string()
|
|
7
|
+
.min(1)
|
|
8
|
+
.optional()
|
|
9
|
+
.describe("Filter by inbox name (exact match). Names are unique per (user, account), so this returns at most one inbox."),
|
|
10
|
+
status: TriggerInboxStatusSchema.optional().describe("Filter by inbox status"),
|
|
11
|
+
pageSize: z
|
|
12
|
+
.number()
|
|
13
|
+
.int()
|
|
14
|
+
.min(1)
|
|
15
|
+
.optional()
|
|
16
|
+
.describe("Number of inboxes per page"),
|
|
17
|
+
maxItems: z
|
|
18
|
+
.number()
|
|
19
|
+
.int()
|
|
20
|
+
.min(1)
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Maximum total items to return across all pages"),
|
|
23
|
+
cursor: z
|
|
24
|
+
.string()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Cursor (offset) to start from for pagination"),
|
|
27
|
+
})
|
|
28
|
+
.describe("List all trigger inboxes for the authenticated user");
|
|
29
|
+
export const ListTriggerInboxesApiResponseSchema = z.object({
|
|
30
|
+
count: z.number().int(),
|
|
31
|
+
next: z.string().nullable().optional(),
|
|
32
|
+
previous: z.string().nullable().optional(),
|
|
33
|
+
results: z.array(TriggerInboxItemSchema),
|
|
34
|
+
});
|
|
35
|
+
export { TriggerInboxItemSchema };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export declare const listTriggerInputFieldChoicesPlugin: (sdk: {
|
|
2
|
+
listActionInputFieldChoices: (options?: (({
|
|
3
|
+
app: string;
|
|
4
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
5
|
+
action: string;
|
|
6
|
+
inputField: string;
|
|
7
|
+
connection?: string | number | undefined;
|
|
8
|
+
connectionId?: string | number | null | undefined;
|
|
9
|
+
authenticationId?: string | number | null | undefined;
|
|
10
|
+
inputs?: Record<string, unknown> | undefined;
|
|
11
|
+
page?: number | undefined;
|
|
12
|
+
pageSize?: number | undefined;
|
|
13
|
+
maxItems?: number | undefined;
|
|
14
|
+
cursor?: string | undefined;
|
|
15
|
+
} | {
|
|
16
|
+
appKey: string;
|
|
17
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
18
|
+
actionKey: string;
|
|
19
|
+
inputFieldKey: string;
|
|
20
|
+
connection?: string | number | undefined;
|
|
21
|
+
connectionId?: string | number | null | undefined;
|
|
22
|
+
authenticationId?: string | number | null | undefined;
|
|
23
|
+
inputs?: Record<string, unknown> | undefined;
|
|
24
|
+
page?: number | undefined;
|
|
25
|
+
pageSize?: number | undefined;
|
|
26
|
+
maxItems?: number | undefined;
|
|
27
|
+
cursor?: string | undefined;
|
|
28
|
+
}) & {
|
|
29
|
+
cursor?: string;
|
|
30
|
+
pageSize?: number;
|
|
31
|
+
maxItems?: number;
|
|
32
|
+
}) | undefined) => import("../../..").PaginatedSdkResult<{
|
|
33
|
+
key?: string | undefined;
|
|
34
|
+
label?: string | undefined;
|
|
35
|
+
sample?: string | undefined;
|
|
36
|
+
value?: string | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
} & {
|
|
39
|
+
context: {
|
|
40
|
+
meta: {
|
|
41
|
+
listActionInputFieldChoices: import("../../..").PluginMeta;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
} & {
|
|
45
|
+
context: {
|
|
46
|
+
meta: Record<string, import("../../..").PluginMeta>;
|
|
47
|
+
};
|
|
48
|
+
}) => {
|
|
49
|
+
listTriggerInputFieldChoices: (options?: ({
|
|
50
|
+
app: string;
|
|
51
|
+
action: string;
|
|
52
|
+
inputField: string;
|
|
53
|
+
connection?: string | number | undefined;
|
|
54
|
+
inputs?: Record<string, unknown> | undefined;
|
|
55
|
+
page?: number | undefined;
|
|
56
|
+
pageSize?: number | undefined;
|
|
57
|
+
maxItems?: number | undefined;
|
|
58
|
+
cursor?: string | undefined;
|
|
59
|
+
} & {
|
|
60
|
+
cursor?: string;
|
|
61
|
+
pageSize?: number;
|
|
62
|
+
maxItems?: number;
|
|
63
|
+
}) | undefined) => import("../../..").PaginatedSdkResult<{
|
|
64
|
+
key?: string | undefined;
|
|
65
|
+
label?: string | undefined;
|
|
66
|
+
sample?: string | undefined;
|
|
67
|
+
value?: string | undefined;
|
|
68
|
+
}>;
|
|
69
|
+
} & {
|
|
70
|
+
context: {
|
|
71
|
+
meta: {
|
|
72
|
+
listTriggerInputFieldChoices: import("../../..").PluginMeta;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export type ListTriggerInputFieldChoicesPluginProvides = ReturnType<typeof listTriggerInputFieldChoicesPlugin>;
|
|
77
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/listTriggerInputFieldChoices/index.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6B9C,CAAC;AAEF,MAAM,MAAM,0CAA0C,GAAG,UAAU,CACjE,OAAO,kCAAkC,CAC1C,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { definePlugin, createPaginatedPluginMethod, } from "../../../utils/plugin-utils";
|
|
2
|
+
import { ListTriggerInputFieldChoicesSchema } from "./schemas";
|
|
3
|
+
import { InputFieldChoiceItemSchema, } from "../../listActionInputFieldChoices/schemas";
|
|
4
|
+
import { appKeyResolver, actionKeyResolver, connectionIdResolver, inputFieldKeyResolver, inputsAllOptionalResolver, } from "../../../resolvers";
|
|
5
|
+
import { triggersDefaults } from "../shared";
|
|
6
|
+
import { DEFAULT_PAGE_SIZE } from "../../../constants";
|
|
7
|
+
export const listTriggerInputFieldChoicesPlugin = definePlugin((sdk) => createPaginatedPluginMethod(sdk, {
|
|
8
|
+
...triggersDefaults,
|
|
9
|
+
name: "listTriggerInputFieldChoices",
|
|
10
|
+
type: "list",
|
|
11
|
+
itemType: "InputFieldChoice",
|
|
12
|
+
inputSchema: ListTriggerInputFieldChoicesSchema,
|
|
13
|
+
outputSchema: InputFieldChoiceItemSchema,
|
|
14
|
+
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
15
|
+
resolvers: {
|
|
16
|
+
app: appKeyResolver,
|
|
17
|
+
action: actionKeyResolver,
|
|
18
|
+
connection: connectionIdResolver,
|
|
19
|
+
inputField: inputFieldKeyResolver,
|
|
20
|
+
inputs: inputsAllOptionalResolver,
|
|
21
|
+
actionType: { type: "constant", value: "read" },
|
|
22
|
+
},
|
|
23
|
+
handler: async ({ sdk, options, }) => {
|
|
24
|
+
const result = await sdk.listActionInputFieldChoices({
|
|
25
|
+
...options,
|
|
26
|
+
actionType: "read",
|
|
27
|
+
});
|
|
28
|
+
return { data: result.data, nextCursor: result.nextCursor };
|
|
29
|
+
},
|
|
30
|
+
}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ListTriggerInputFieldChoicesSchema: z.ZodObject<{
|
|
3
|
+
app: z.ZodString & {
|
|
4
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
5
|
+
};
|
|
6
|
+
action: z.ZodString & {
|
|
7
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
8
|
+
};
|
|
9
|
+
inputField: z.ZodString & {
|
|
10
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
11
|
+
};
|
|
12
|
+
connection: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
13
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
14
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type ListTriggerInputFieldChoicesOptions = z.infer<typeof ListTriggerInputFieldChoicesSchema>;
|
|
20
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/listTriggerInputFieldChoices/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;iBA+B5C,CAAC;AAEJ,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,kCAAkC,CAC1C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AppPropertySchema, ActionPropertySchema, ConnectionPropertySchema, InputsPropertySchema, InputFieldPropertySchema, } from "../../../types/properties";
|
|
3
|
+
export const ListTriggerInputFieldChoicesSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
app: AppPropertySchema,
|
|
6
|
+
action: ActionPropertySchema,
|
|
7
|
+
inputField: InputFieldPropertySchema,
|
|
8
|
+
connection: ConnectionPropertySchema.optional().describe("Connection alias or connection ID. Required if the trigger needs a connection to populate dynamic dropdown options."),
|
|
9
|
+
inputs: InputsPropertySchema.optional().describe("Current input values that may affect available choices"),
|
|
10
|
+
page: z
|
|
11
|
+
.number()
|
|
12
|
+
.int()
|
|
13
|
+
.min(0)
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("Page number for paginated results"),
|
|
16
|
+
pageSize: z
|
|
17
|
+
.number()
|
|
18
|
+
.min(1)
|
|
19
|
+
.optional()
|
|
20
|
+
.describe("Number of choices per page"),
|
|
21
|
+
maxItems: z
|
|
22
|
+
.number()
|
|
23
|
+
.min(1)
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("Maximum total items to return across all pages"),
|
|
26
|
+
cursor: z.string().optional().describe("Cursor to start from"),
|
|
27
|
+
})
|
|
28
|
+
.describe("Get the available choices for a dynamic dropdown input field on a trigger");
|