@frogbotai/piece-microsoft-outlook 0.0.0-stage → 0.40.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 (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -2
  3. package/dist/actions/categories.d.ts +82 -0
  4. package/dist/actions/categories.d.ts.map +1 -0
  5. package/dist/actions/categories.js +54 -0
  6. package/dist/actions/categories.js.map +1 -0
  7. package/dist/actions/createDraftEmail.d.ts +154 -0
  8. package/dist/actions/createDraftEmail.d.ts.map +1 -0
  9. package/dist/actions/createDraftEmail.js +24 -0
  10. package/dist/actions/createDraftEmail.js.map +1 -0
  11. package/dist/actions/createEvent.d.ts +109 -0
  12. package/dist/actions/createEvent.d.ts.map +1 -0
  13. package/dist/actions/createEvent.js +68 -0
  14. package/dist/actions/createEvent.js.map +1 -0
  15. package/dist/actions/customApiCall.d.ts +30 -0
  16. package/dist/actions/customApiCall.d.ts.map +1 -0
  17. package/dist/actions/customApiCall.js +9 -0
  18. package/dist/actions/customApiCall.js.map +1 -0
  19. package/dist/actions/deleteEvent.d.ts +41 -0
  20. package/dist/actions/deleteEvent.d.ts.map +1 -0
  21. package/dist/actions/deleteEvent.js +38 -0
  22. package/dist/actions/deleteEvent.js.map +1 -0
  23. package/dist/actions/downloadAttachment.d.ts +50 -0
  24. package/dist/actions/downloadAttachment.d.ts.map +1 -0
  25. package/dist/actions/downloadAttachment.js +51 -0
  26. package/dist/actions/downloadAttachment.js.map +1 -0
  27. package/dist/actions/findFreeBusyPeriods.d.ts +83 -0
  28. package/dist/actions/findFreeBusyPeriods.d.ts.map +1 -0
  29. package/dist/actions/findFreeBusyPeriods.js +66 -0
  30. package/dist/actions/findFreeBusyPeriods.js.map +1 -0
  31. package/dist/actions/forwardEmail.d.ts +43 -0
  32. package/dist/actions/forwardEmail.d.ts.map +1 -0
  33. package/dist/actions/forwardEmail.js +35 -0
  34. package/dist/actions/forwardEmail.js.map +1 -0
  35. package/dist/actions/listCalendars.d.ts +52 -0
  36. package/dist/actions/listCalendars.d.ts.map +1 -0
  37. package/dist/actions/listCalendars.js +27 -0
  38. package/dist/actions/listCalendars.js.map +1 -0
  39. package/dist/actions/listContacts.d.ts +81 -0
  40. package/dist/actions/listContacts.d.ts.map +1 -0
  41. package/dist/actions/listContacts.js +36 -0
  42. package/dist/actions/listContacts.js.map +1 -0
  43. package/dist/actions/listEmails.d.ts +161 -0
  44. package/dist/actions/listEmails.d.ts.map +1 -0
  45. package/dist/actions/listEmails.js +35 -0
  46. package/dist/actions/listEmails.js.map +1 -0
  47. package/dist/actions/listEvents.d.ts +118 -0
  48. package/dist/actions/listEvents.d.ts.map +1 -0
  49. package/dist/actions/listEvents.js +42 -0
  50. package/dist/actions/listEvents.js.map +1 -0
  51. package/dist/actions/listMailFolders.d.ts +68 -0
  52. package/dist/actions/listMailFolders.d.ts.map +1 -0
  53. package/dist/actions/listMailFolders.js +35 -0
  54. package/dist/actions/listMailFolders.js.map +1 -0
  55. package/dist/actions/moveEmail.d.ts +143 -0
  56. package/dist/actions/moveEmail.d.ts.map +1 -0
  57. package/dist/actions/moveEmail.js +28 -0
  58. package/dist/actions/moveEmail.js.map +1 -0
  59. package/dist/actions/replyToEmail.d.ts +157 -0
  60. package/dist/actions/replyToEmail.d.ts.map +1 -0
  61. package/dist/actions/replyToEmail.js +57 -0
  62. package/dist/actions/replyToEmail.js.map +1 -0
  63. package/dist/actions/searchEmails.d.ts +144 -0
  64. package/dist/actions/searchEmails.d.ts.map +1 -0
  65. package/dist/actions/searchEmails.js +31 -0
  66. package/dist/actions/searchEmails.js.map +1 -0
  67. package/dist/actions/sendDraft.d.ts +41 -0
  68. package/dist/actions/sendDraft.d.ts.map +1 -0
  69. package/dist/actions/sendDraft.js +31 -0
  70. package/dist/actions/sendDraft.js.map +1 -0
  71. package/dist/actions/sendEmail.d.ts +51 -0
  72. package/dist/actions/sendEmail.d.ts.map +1 -0
  73. package/dist/actions/sendEmail.js +32 -0
  74. package/dist/actions/sendEmail.js.map +1 -0
  75. package/dist/calendar.d.ts +39 -0
  76. package/dist/calendar.d.ts.map +1 -0
  77. package/dist/calendar.js +51 -0
  78. package/dist/calendar.js.map +1 -0
  79. package/dist/client.d.ts +39 -0
  80. package/dist/client.d.ts.map +1 -0
  81. package/dist/client.js +208 -0
  82. package/dist/client.js.map +1 -0
  83. package/dist/config.d.ts +33 -0
  84. package/dist/config.d.ts.map +1 -0
  85. package/dist/config.js +47 -0
  86. package/dist/config.js.map +1 -0
  87. package/dist/define.d.ts +220 -0
  88. package/dist/define.d.ts.map +1 -0
  89. package/dist/define.js +4 -0
  90. package/dist/define.js.map +1 -0
  91. package/dist/files.d.ts +27 -0
  92. package/dist/files.d.ts.map +1 -0
  93. package/dist/files.js +89 -0
  94. package/dist/files.js.map +1 -0
  95. package/dist/index.d.ts +4646 -0
  96. package/dist/index.d.ts.map +1 -0
  97. package/dist/index.js +130 -0
  98. package/dist/index.js.map +1 -0
  99. package/dist/mail.d.ts +124 -0
  100. package/dist/mail.d.ts.map +1 -0
  101. package/dist/mail.js +79 -0
  102. package/dist/mail.js.map +1 -0
  103. package/dist/pagination.d.ts +33 -0
  104. package/dist/pagination.d.ts.map +1 -0
  105. package/dist/pagination.js +39 -0
  106. package/dist/pagination.js.map +1 -0
  107. package/dist/triggers/newAttachment.d.ts +243 -0
  108. package/dist/triggers/newAttachment.d.ts.map +1 -0
  109. package/dist/triggers/newAttachment.js +64 -0
  110. package/dist/triggers/newAttachment.js.map +1 -0
  111. package/dist/triggers/newEmail.d.ts +221 -0
  112. package/dist/triggers/newEmail.d.ts.map +1 -0
  113. package/dist/triggers/newEmail.js +33 -0
  114. package/dist/triggers/newEmail.js.map +1 -0
  115. package/dist/triggers/newEmailInFolder.d.ts +219 -0
  116. package/dist/triggers/newEmailInFolder.d.ts.map +1 -0
  117. package/dist/triggers/newEmailInFolder.js +31 -0
  118. package/dist/triggers/newEmailInFolder.js.map +1 -0
  119. package/dist/triggers/poll.d.ts +28 -0
  120. package/dist/triggers/poll.d.ts.map +1 -0
  121. package/dist/triggers/poll.js +70 -0
  122. package/dist/triggers/poll.js.map +1 -0
  123. package/package.json +42 -3
@@ -0,0 +1,143 @@
1
+ import { z } from 'zod';
2
+ export declare const moveEmail: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
3
+ messageId: z.ZodString;
4
+ folderId: z.ZodString;
5
+ }, z.core.$strip>, z.ZodObject<{
6
+ id: z.ZodString;
7
+ subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
+ from: z.ZodOptional<z.ZodNullable<z.ZodObject<{
9
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
10
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
+ }, z.core.$strip>>>;
13
+ }, z.core.$strip>>>;
14
+ sender: z.ZodOptional<z.ZodNullable<z.ZodObject<{
15
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
16
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ }, z.core.$strip>>>;
19
+ }, z.core.$strip>>>;
20
+ toRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
21
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
22
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ }, z.core.$strip>>>;
25
+ }, z.core.$strip>>>>;
26
+ ccRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
27
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
28
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ }, z.core.$strip>>>;
31
+ }, z.core.$strip>>>>;
32
+ bccRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
33
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
34
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
35
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ }, z.core.$strip>>>;
37
+ }, z.core.$strip>>>>;
38
+ replyTo: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
39
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
40
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
+ }, z.core.$strip>>>;
43
+ }, z.core.$strip>>>>;
44
+ receivedDateTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
45
+ sentDateTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ conversationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
+ parentFolderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
+ bodyPreview: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ body: z.ZodOptional<z.ZodNullable<z.ZodObject<{
50
+ contentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
+ content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ }, z.core.$strip>>>;
53
+ categories: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
54
+ hasAttachments: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
55
+ isRead: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
56
+ isDraft: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
57
+ webLink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
58
+ }, z.core.$loose>, Record<string, never>, {
59
+ baseUrl: "https://graph.microsoft.com" | "https://graph.microsoft.us";
60
+ mailbox: string;
61
+ request: <T>(path: string, schema: z.ZodType<T>, options?: {
62
+ method?: string;
63
+ body?: unknown;
64
+ headers?: Record<string, string>;
65
+ query?: Record<string, string | number | undefined>;
66
+ signal?: AbortSignal;
67
+ }) => Promise<T>;
68
+ page: <T>(pathOrNextLink: string, item: z.ZodType<T>, options?: {
69
+ method?: string;
70
+ body?: unknown;
71
+ headers?: Record<string, string>;
72
+ query?: Record<string, string | number | undefined>;
73
+ signal?: AbortSignal;
74
+ }) => Promise<{
75
+ value: T[];
76
+ nextLink: string | null;
77
+ }>;
78
+ list: <T>(path: string, item: z.ZodType<T>, options?: {
79
+ method?: string;
80
+ body?: unknown;
81
+ headers?: Record<string, string>;
82
+ query?: Record<string, string | number | undefined>;
83
+ signal?: AbortSignal;
84
+ }) => Promise<T[]>;
85
+ authorize(target: URL, headers: Headers, signal?: AbortSignal): Promise<void>;
86
+ }, {
87
+ [x: string]: unknown;
88
+ id: string;
89
+ subject?: string | null | undefined;
90
+ from?: {
91
+ emailAddress?: {
92
+ name?: string | null | undefined;
93
+ address?: string | null | undefined;
94
+ } | null | undefined;
95
+ } | null | undefined;
96
+ sender?: {
97
+ emailAddress?: {
98
+ name?: string | null | undefined;
99
+ address?: string | null | undefined;
100
+ } | null | undefined;
101
+ } | null | undefined;
102
+ toRecipients?: {
103
+ emailAddress?: {
104
+ name?: string | null | undefined;
105
+ address?: string | null | undefined;
106
+ } | null | undefined;
107
+ }[] | null | undefined;
108
+ ccRecipients?: {
109
+ emailAddress?: {
110
+ name?: string | null | undefined;
111
+ address?: string | null | undefined;
112
+ } | null | undefined;
113
+ }[] | null | undefined;
114
+ bccRecipients?: {
115
+ emailAddress?: {
116
+ name?: string | null | undefined;
117
+ address?: string | null | undefined;
118
+ } | null | undefined;
119
+ }[] | null | undefined;
120
+ replyTo?: {
121
+ emailAddress?: {
122
+ name?: string | null | undefined;
123
+ address?: string | null | undefined;
124
+ } | null | undefined;
125
+ }[] | null | undefined;
126
+ receivedDateTime?: string | null | undefined;
127
+ sentDateTime?: string | null | undefined;
128
+ conversationId?: string | null | undefined;
129
+ parentFolderId?: string | null | undefined;
130
+ bodyPreview?: string | null | undefined;
131
+ body?: {
132
+ contentType?: string | null | undefined;
133
+ content?: string | null | undefined;
134
+ } | null | undefined;
135
+ categories?: string[] | null | undefined;
136
+ hasAttachments?: boolean | null | undefined;
137
+ isRead?: boolean | null | undefined;
138
+ isDraft?: boolean | null | undefined;
139
+ webLink?: string | null | undefined;
140
+ }> & {
141
+ slug: "moveEmail";
142
+ };
143
+ //# sourceMappingURL=moveEmail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moveEmail.d.ts","sourceRoot":"","sources":["../../src/actions/moveEmail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBpB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { signal } from '../client.js';
3
+ import { identifier } from '../config.js';
4
+ import { defineAction } from '../define.js';
5
+ import { message, messagePath } from '../mail.js';
6
+ export const moveEmail = defineAction({
7
+ slug: 'moveEmail',
8
+ description: 'Move an email to another folder. The moved email gets a new id.',
9
+ input: z.object({
10
+ messageId: identifier,
11
+ folderId: identifier.meta({
12
+ description: 'A folder id, or a well-known name such as inbox, archive or deleteditems.'
13
+ })
14
+ }),
15
+ output: message,
16
+ idempotent: false,
17
+ async run ({ client, input, req }) {
18
+ return client.request(`${messagePath(client.mailbox, input.messageId)}/move`, message, {
19
+ method: 'POST',
20
+ body: {
21
+ destinationId: input.folderId
22
+ },
23
+ signal: signal(req)
24
+ });
25
+ }
26
+ });
27
+
28
+ //# sourceMappingURL=moveEmail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/actions/moveEmail.ts"],"names":["z","signal","identifier","defineAction","message","messagePath","moveEmail","slug","description","input","object","messageId","folderId","meta","output","idempotent","run","client","req","request","mailbox","method","body","destinationId"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,YAAY,QAAQ,eAAe;AAC5C,SAASC,OAAO,EAAEC,WAAW,QAAQ,aAAa;AAElD,OAAO,MAAMC,YAAYH,aAAa;IACpCI,MAAM;IACNC,aAAa;IACbC,OAAOT,EAAEU,MAAM,CAAC;QACdC,WAAWT;QACXU,UAAUV,WAAWW,IAAI,CAAC;YACxBL,aAAa;QACf;IACF;IACAM,QAAQV;IACRW,YAAY;IACZ,MAAMC,KAAI,EAAEC,MAAM,EAAER,KAAK,EAAES,GAAG,EAAE;QAC9B,OAAOD,OAAOE,OAAO,CAAC,GAAGd,YAAYY,OAAOG,OAAO,EAAEX,MAAME,SAAS,EAAE,KAAK,CAAC,EAAEP,SAAS;YACrFiB,QAAQ;YACRC,MAAM;gBAAEC,eAAed,MAAMG,QAAQ;YAAC;YACtCX,QAAQA,OAAOiB;QACjB;IACF;AACF,GAAG","file":"moveEmail.js"}
@@ -0,0 +1,157 @@
1
+ import { z } from 'zod';
2
+ export declare const replyToEmail: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
3
+ messageId: z.ZodString;
4
+ body: z.ZodString;
5
+ replyAll: z.ZodDefault<z.ZodBoolean>;
6
+ cc: z.ZodOptional<z.ZodArray<z.ZodEmail>>;
7
+ bcc: z.ZodOptional<z.ZodArray<z.ZodEmail>>;
8
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
9
+ fileId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
10
+ name: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strip>>>;
12
+ draft: z.ZodDefault<z.ZodBoolean>;
13
+ }, z.core.$strip>, z.ZodObject<{
14
+ draft: z.ZodObject<{
15
+ id: z.ZodString;
16
+ subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
+ from: z.ZodOptional<z.ZodNullable<z.ZodObject<{
18
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
19
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
+ }, z.core.$strip>>>;
22
+ }, z.core.$strip>>>;
23
+ sender: z.ZodOptional<z.ZodNullable<z.ZodObject<{
24
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
25
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
+ }, z.core.$strip>>>;
28
+ }, z.core.$strip>>>;
29
+ toRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
30
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
31
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ }, z.core.$strip>>>;
34
+ }, z.core.$strip>>>>;
35
+ ccRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
36
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
37
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
+ }, z.core.$strip>>>;
40
+ }, z.core.$strip>>>>;
41
+ bccRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
42
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
43
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
45
+ }, z.core.$strip>>>;
46
+ }, z.core.$strip>>>>;
47
+ replyTo: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
48
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
49
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
+ }, z.core.$strip>>>;
52
+ }, z.core.$strip>>>>;
53
+ receivedDateTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ sentDateTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
+ conversationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
56
+ parentFolderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
+ bodyPreview: z.ZodOptional<z.ZodNullable<z.ZodString>>;
58
+ body: z.ZodOptional<z.ZodNullable<z.ZodObject<{
59
+ contentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
+ content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
+ }, z.core.$strip>>>;
62
+ categories: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
63
+ hasAttachments: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
64
+ isRead: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
65
+ isDraft: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
66
+ webLink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
+ }, z.core.$loose>;
68
+ sent: z.ZodBoolean;
69
+ }, z.core.$strip>, Record<string, never>, {
70
+ baseUrl: "https://graph.microsoft.com" | "https://graph.microsoft.us";
71
+ mailbox: string;
72
+ request: <T>(path: string, schema: z.ZodType<T>, options?: {
73
+ method?: string;
74
+ body?: unknown;
75
+ headers?: Record<string, string>;
76
+ query?: Record<string, string | number | undefined>;
77
+ signal?: AbortSignal;
78
+ }) => Promise<T>;
79
+ page: <T>(pathOrNextLink: string, item: z.ZodType<T>, options?: {
80
+ method?: string;
81
+ body?: unknown;
82
+ headers?: Record<string, string>;
83
+ query?: Record<string, string | number | undefined>;
84
+ signal?: AbortSignal;
85
+ }) => Promise<{
86
+ value: T[];
87
+ nextLink: string | null;
88
+ }>;
89
+ list: <T>(path: string, item: z.ZodType<T>, options?: {
90
+ method?: string;
91
+ body?: unknown;
92
+ headers?: Record<string, string>;
93
+ query?: Record<string, string | number | undefined>;
94
+ signal?: AbortSignal;
95
+ }) => Promise<T[]>;
96
+ authorize(target: URL, headers: Headers, signal?: AbortSignal): Promise<void>;
97
+ }, {
98
+ draft: {
99
+ [x: string]: unknown;
100
+ id: string;
101
+ subject?: string | null | undefined;
102
+ from?: {
103
+ emailAddress?: {
104
+ name?: string | null | undefined;
105
+ address?: string | null | undefined;
106
+ } | null | undefined;
107
+ } | null | undefined;
108
+ sender?: {
109
+ emailAddress?: {
110
+ name?: string | null | undefined;
111
+ address?: string | null | undefined;
112
+ } | null | undefined;
113
+ } | null | undefined;
114
+ toRecipients?: {
115
+ emailAddress?: {
116
+ name?: string | null | undefined;
117
+ address?: string | null | undefined;
118
+ } | null | undefined;
119
+ }[] | null | undefined;
120
+ ccRecipients?: {
121
+ emailAddress?: {
122
+ name?: string | null | undefined;
123
+ address?: string | null | undefined;
124
+ } | null | undefined;
125
+ }[] | null | undefined;
126
+ bccRecipients?: {
127
+ emailAddress?: {
128
+ name?: string | null | undefined;
129
+ address?: string | null | undefined;
130
+ } | null | undefined;
131
+ }[] | null | undefined;
132
+ replyTo?: {
133
+ emailAddress?: {
134
+ name?: string | null | undefined;
135
+ address?: string | null | undefined;
136
+ } | null | undefined;
137
+ }[] | null | undefined;
138
+ receivedDateTime?: string | null | undefined;
139
+ sentDateTime?: string | null | undefined;
140
+ conversationId?: string | null | undefined;
141
+ parentFolderId?: string | null | undefined;
142
+ bodyPreview?: string | null | undefined;
143
+ body?: {
144
+ contentType?: string | null | undefined;
145
+ content?: string | null | undefined;
146
+ } | null | undefined;
147
+ categories?: string[] | null | undefined;
148
+ hasAttachments?: boolean | null | undefined;
149
+ isRead?: boolean | null | undefined;
150
+ isDraft?: boolean | null | undefined;
151
+ webLink?: string | null | undefined;
152
+ };
153
+ sent: boolean;
154
+ }> & {
155
+ slug: "replyToEmail";
156
+ };
157
+ //# sourceMappingURL=replyToEmail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replyToEmail.d.ts","sourceRoot":"","sources":["../../src/actions/replyToEmail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CvB,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ import { signal } from '../client.js';
3
+ import { identifier } from '../config.js';
4
+ import { defineAction } from '../define.js';
5
+ import { fileInput } from '../files.js';
6
+ import { addresses, attachments, message, messagePath } from '../mail.js';
7
+ export const replyToEmail = defineAction({
8
+ slug: 'replyToEmail',
9
+ description: 'Reply to an email above the quoted thread, or save the reply as a draft. Reply all also includes the original recipients.',
10
+ input: z.object({
11
+ messageId: identifier,
12
+ body: z.string().meta({
13
+ description: 'The reply text, placed above the quoted thread.'
14
+ }),
15
+ replyAll: z.boolean().default(false),
16
+ cc: z.array(z.email()).optional(),
17
+ bcc: z.array(z.email()).optional(),
18
+ attachments: z.array(fileInput).optional(),
19
+ draft: z.boolean().default(false).meta({
20
+ description: 'Save the reply as a draft.'
21
+ })
22
+ }),
23
+ output: z.object({
24
+ draft: message,
25
+ sent: z.boolean()
26
+ }),
27
+ idempotent: false,
28
+ async run ({ client, input, req, overrideAccess }) {
29
+ const path = messagePath(client.mailbox, input.messageId);
30
+ const reply = await client.request(`${path}/${input.replyAll ? 'createReplyAll' : 'createReply'}`, message, {
31
+ method: 'POST',
32
+ body: {
33
+ comment: input.body,
34
+ message: {
35
+ ccRecipients: addresses(input.cc),
36
+ bccRecipients: addresses(input.bcc),
37
+ attachments: await attachments(req, input.attachments, overrideAccess)
38
+ }
39
+ },
40
+ signal: signal(req)
41
+ });
42
+ if (input.draft) return {
43
+ draft: reply,
44
+ sent: false
45
+ };
46
+ await client.request(`${messagePath(client.mailbox, reply.id)}/send`, z.unknown(), {
47
+ method: 'POST',
48
+ signal: signal(req)
49
+ });
50
+ return {
51
+ draft: reply,
52
+ sent: true
53
+ };
54
+ }
55
+ });
56
+
57
+ //# sourceMappingURL=replyToEmail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/actions/replyToEmail.ts"],"names":["z","signal","identifier","defineAction","fileInput","addresses","attachments","message","messagePath","replyToEmail","slug","description","input","object","messageId","body","string","meta","replyAll","boolean","default","cc","array","email","optional","bcc","draft","output","sent","idempotent","run","client","req","overrideAccess","path","mailbox","reply","request","method","comment","ccRecipients","bccRecipients","id","unknown"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,YAAY,QAAQ,eAAe;AAC5C,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,SAAS,EAAEC,WAAW,EAAEC,OAAO,EAAEC,WAAW,QAAQ,aAAa;AAE1E,OAAO,MAAMC,eAAeN,aAAa;IACvCO,MAAM;IACNC,aACE;IACFC,OAAOZ,EAAEa,MAAM,CAAC;QACdC,WAAWZ;QACXa,MAAMf,EAAEgB,MAAM,GAAGC,IAAI,CAAC;YAAEN,aAAa;QAAkD;QACvFO,UAAUlB,EAAEmB,OAAO,GAAGC,OAAO,CAAC;QAC9BC,IAAIrB,EAAEsB,KAAK,CAACtB,EAAEuB,KAAK,IAAIC,QAAQ;QAC/BC,KAAKzB,EAAEsB,KAAK,CAACtB,EAAEuB,KAAK,IAAIC,QAAQ;QAChClB,aAAaN,EAAEsB,KAAK,CAAClB,WAAWoB,QAAQ;QACxCE,OAAO1B,EAAEmB,OAAO,GAAGC,OAAO,CAAC,OAAOH,IAAI,CAAC;YAAEN,aAAa;QAA6B;IACrF;IACAgB,QAAQ3B,EAAEa,MAAM,CAAC;QAAEa,OAAOnB;QAASqB,MAAM5B,EAAEmB,OAAO;IAAG;IACrDU,YAAY;IACZ,MAAMC,KAAI,EAAEC,MAAM,EAAEnB,KAAK,EAAEoB,GAAG,EAAEC,cAAc,EAAE;QAC9C,MAAMC,OAAO1B,YAAYuB,OAAOI,OAAO,EAAEvB,MAAME,SAAS;QACxD,MAAMsB,QAAQ,MAAML,OAAOM,OAAO,CAChC,GAAGH,KAAK,CAAC,EAAEtB,MAAMM,QAAQ,GAAG,mBAAmB,eAAe,EAC9DX,SACA;YACE+B,QAAQ;YACRvB,MAAM;gBACJwB,SAAS3B,MAAMG,IAAI;gBACnBR,SAAS;oBACPiC,cAAcnC,UAAUO,MAAMS,EAAE;oBAChCoB,eAAepC,UAAUO,MAAMa,GAAG;oBAClCnB,aAAa,MAAMA,YAAY0B,KAAKpB,MAAMN,WAAW,EAAE2B;gBACzD;YACF;YACAhC,QAAQA,OAAO+B;QACjB;QAGF,IAAIpB,MAAMc,KAAK,EAAE,OAAO;YAAEA,OAAOU;YAAOR,MAAM;QAAM;QAEpD,MAAMG,OAAOM,OAAO,CAAC,GAAG7B,YAAYuB,OAAOI,OAAO,EAAEC,MAAMM,EAAE,EAAE,KAAK,CAAC,EAAE1C,EAAE2C,OAAO,IAAI;YACjFL,QAAQ;YACRrC,QAAQA,OAAO+B;QACjB;QAEA,OAAO;YAAEN,OAAOU;YAAOR,MAAM;QAAK;IACpC;AACF,GAAG","file":"replyToEmail.js"}
@@ -0,0 +1,144 @@
1
+ import { z } from 'zod';
2
+ export declare const searchEmails: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
3
+ query: z.ZodString;
4
+ folderId: z.ZodOptional<z.ZodString>;
5
+ limit: z.ZodDefault<z.ZodNumber>;
6
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
7
+ id: z.ZodString;
8
+ subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
+ from: z.ZodOptional<z.ZodNullable<z.ZodObject<{
10
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
11
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
+ }, z.core.$strip>>>;
14
+ }, z.core.$strip>>>;
15
+ sender: z.ZodOptional<z.ZodNullable<z.ZodObject<{
16
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
17
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ }, z.core.$strip>>>;
20
+ }, z.core.$strip>>>;
21
+ toRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
22
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
23
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
+ }, z.core.$strip>>>;
26
+ }, z.core.$strip>>>>;
27
+ ccRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
28
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
29
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ }, z.core.$strip>>>;
32
+ }, z.core.$strip>>>>;
33
+ bccRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
34
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
35
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ }, z.core.$strip>>>;
38
+ }, z.core.$strip>>>>;
39
+ replyTo: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
40
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
41
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
+ address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
+ }, z.core.$strip>>>;
44
+ }, z.core.$strip>>>>;
45
+ receivedDateTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ sentDateTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
+ conversationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
+ parentFolderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ bodyPreview: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ body: z.ZodOptional<z.ZodNullable<z.ZodObject<{
51
+ contentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ }, z.core.$strip>>>;
54
+ categories: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
55
+ hasAttachments: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
56
+ isRead: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
57
+ isDraft: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
58
+ webLink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
59
+ }, z.core.$loose>>, Record<string, never>, {
60
+ baseUrl: "https://graph.microsoft.com" | "https://graph.microsoft.us";
61
+ mailbox: string;
62
+ request: <T>(path: string, schema: z.ZodType<T>, options?: {
63
+ method?: string;
64
+ body?: unknown;
65
+ headers?: Record<string, string>;
66
+ query?: Record<string, string | number | undefined>;
67
+ signal?: AbortSignal;
68
+ }) => Promise<T>;
69
+ page: <T>(pathOrNextLink: string, item: z.ZodType<T>, options?: {
70
+ method?: string;
71
+ body?: unknown;
72
+ headers?: Record<string, string>;
73
+ query?: Record<string, string | number | undefined>;
74
+ signal?: AbortSignal;
75
+ }) => Promise<{
76
+ value: T[];
77
+ nextLink: string | null;
78
+ }>;
79
+ list: <T>(path: string, item: z.ZodType<T>, options?: {
80
+ method?: string;
81
+ body?: unknown;
82
+ headers?: Record<string, string>;
83
+ query?: Record<string, string | number | undefined>;
84
+ signal?: AbortSignal;
85
+ }) => Promise<T[]>;
86
+ authorize(target: URL, headers: Headers, signal?: AbortSignal): Promise<void>;
87
+ }, {
88
+ [x: string]: unknown;
89
+ id: string;
90
+ subject?: string | null | undefined;
91
+ from?: {
92
+ emailAddress?: {
93
+ name?: string | null | undefined;
94
+ address?: string | null | undefined;
95
+ } | null | undefined;
96
+ } | null | undefined;
97
+ sender?: {
98
+ emailAddress?: {
99
+ name?: string | null | undefined;
100
+ address?: string | null | undefined;
101
+ } | null | undefined;
102
+ } | null | undefined;
103
+ toRecipients?: {
104
+ emailAddress?: {
105
+ name?: string | null | undefined;
106
+ address?: string | null | undefined;
107
+ } | null | undefined;
108
+ }[] | null | undefined;
109
+ ccRecipients?: {
110
+ emailAddress?: {
111
+ name?: string | null | undefined;
112
+ address?: string | null | undefined;
113
+ } | null | undefined;
114
+ }[] | null | undefined;
115
+ bccRecipients?: {
116
+ emailAddress?: {
117
+ name?: string | null | undefined;
118
+ address?: string | null | undefined;
119
+ } | null | undefined;
120
+ }[] | null | undefined;
121
+ replyTo?: {
122
+ emailAddress?: {
123
+ name?: string | null | undefined;
124
+ address?: string | null | undefined;
125
+ } | null | undefined;
126
+ }[] | null | undefined;
127
+ receivedDateTime?: string | null | undefined;
128
+ sentDateTime?: string | null | undefined;
129
+ conversationId?: string | null | undefined;
130
+ parentFolderId?: string | null | undefined;
131
+ bodyPreview?: string | null | undefined;
132
+ body?: {
133
+ contentType?: string | null | undefined;
134
+ content?: string | null | undefined;
135
+ } | null | undefined;
136
+ categories?: string[] | null | undefined;
137
+ hasAttachments?: boolean | null | undefined;
138
+ isRead?: boolean | null | undefined;
139
+ isDraft?: boolean | null | undefined;
140
+ webLink?: string | null | undefined;
141
+ }[]> & {
142
+ slug: "searchEmails";
143
+ };
144
+ //# sourceMappingURL=searchEmails.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchEmails.d.ts","sourceRoot":"","sources":["../../src/actions/searchEmails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBvB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ import { signal } from '../client.js';
3
+ import { identifier } from '../config.js';
4
+ import { defineAction } from '../define.js';
5
+ import { message } from '../mail.js';
6
+ export const searchEmails = defineAction({
7
+ slug: 'searchEmails',
8
+ description: 'Search emails, newest first, with Outlook search syntax such as from:dana@acme.com, subject:invoice or hasAttachments:true.',
9
+ input: z.object({
10
+ query: z.string().trim().min(1),
11
+ folderId: identifier.optional().meta({
12
+ description: 'Search one folder instead of all mail.'
13
+ }),
14
+ limit: z.number().int().min(1).max(1000).default(25)
15
+ }),
16
+ output: z.array(message),
17
+ idempotent: true,
18
+ async run ({ client, input, req }) {
19
+ const folder = input.folderId ? `/mailFolders/${encodeURIComponent(input.folderId)}/messages` : '/messages';
20
+ const result = await client.page(`${client.mailbox}${folder}`, message, {
21
+ query: {
22
+ $search: `"${input.query.replaceAll('"', '\\"')}"`,
23
+ $top: input.limit
24
+ },
25
+ signal: signal(req)
26
+ });
27
+ return result.value.sort((a, b)=>(b.receivedDateTime ?? '').localeCompare(a.receivedDateTime ?? ''));
28
+ }
29
+ });
30
+
31
+ //# sourceMappingURL=searchEmails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/actions/searchEmails.ts"],"names":["z","signal","identifier","defineAction","message","searchEmails","slug","description","input","object","query","string","trim","min","folderId","optional","meta","limit","number","int","max","default","output","array","idempotent","run","client","req","folder","encodeURIComponent","result","page","mailbox","$search","replaceAll","$top","value","sort","a","b","receivedDateTime","localeCompare"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,YAAY,QAAQ,eAAe;AAC5C,SAASC,OAAO,QAAQ,aAAa;AAErC,OAAO,MAAMC,eAAeF,aAAa;IACvCG,MAAM;IACNC,aACE;IACFC,OAAOR,EAAES,MAAM,CAAC;QACdC,OAAOV,EAAEW,MAAM,GAAGC,IAAI,GAAGC,GAAG,CAAC;QAC7BC,UAAUZ,WAAWa,QAAQ,GAAGC,IAAI,CAAC;YAAET,aAAa;QAAyC;QAC7FU,OAAOjB,EAAEkB,MAAM,GAAGC,GAAG,GAAGN,GAAG,CAAC,GAAGO,GAAG,CAAC,MAAMC,OAAO,CAAC;IACnD;IACAC,QAAQtB,EAAEuB,KAAK,CAACnB;IAChBoB,YAAY;IACZ,MAAMC,KAAI,EAAEC,MAAM,EAAElB,KAAK,EAAEmB,GAAG,EAAE;QAC9B,MAAMC,SAASpB,MAAMM,QAAQ,GACzB,CAAC,aAAa,EAAEe,mBAAmBrB,MAAMM,QAAQ,EAAE,SAAS,CAAC,GAC7D;QAEJ,MAAMgB,SAAS,MAAMJ,OAAOK,IAAI,CAAC,GAAGL,OAAOM,OAAO,GAAGJ,QAAQ,EAAExB,SAAS;YACtEM,OAAO;gBAAEuB,SAAS,CAAC,CAAC,EAAEzB,MAAME,KAAK,CAACwB,UAAU,CAAC,KAAK,OAAO,CAAC,CAAC;gBAAEC,MAAM3B,MAAMS,KAAK;YAAC;YAC/EhB,QAAQA,OAAO0B;QACjB;QAEA,OAAOG,OAAOM,KAAK,CAACC,IAAI,CAAC,CAACC,GAAGC,IAC3B,AAACA,CAAAA,EAAEC,gBAAgB,IAAI,EAAC,EAAGC,aAAa,CAACH,EAAEE,gBAAgB,IAAI;IAEnE;AACF,GAAG","file":"searchEmails.js"}
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ export declare const sendDraft: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
3
+ messageId: z.ZodString;
4
+ }, z.core.$strip>, z.ZodObject<{
5
+ messageId: z.ZodString;
6
+ sent: z.ZodLiteral<true>;
7
+ }, z.core.$strip>, Record<string, never>, {
8
+ baseUrl: "https://graph.microsoft.com" | "https://graph.microsoft.us";
9
+ mailbox: string;
10
+ request: <T>(path: string, schema: z.ZodType<T>, options?: {
11
+ method?: string;
12
+ body?: unknown;
13
+ headers?: Record<string, string>;
14
+ query?: Record<string, string | number | undefined>;
15
+ signal?: AbortSignal;
16
+ }) => Promise<T>;
17
+ page: <T>(pathOrNextLink: string, item: z.ZodType<T>, options?: {
18
+ method?: string;
19
+ body?: unknown;
20
+ headers?: Record<string, string>;
21
+ query?: Record<string, string | number | undefined>;
22
+ signal?: AbortSignal;
23
+ }) => Promise<{
24
+ value: T[];
25
+ nextLink: string | null;
26
+ }>;
27
+ list: <T>(path: string, item: z.ZodType<T>, options?: {
28
+ method?: string;
29
+ body?: unknown;
30
+ headers?: Record<string, string>;
31
+ query?: Record<string, string | number | undefined>;
32
+ signal?: AbortSignal;
33
+ }) => Promise<T[]>;
34
+ authorize(target: URL, headers: Headers, signal?: AbortSignal): Promise<void>;
35
+ }, {
36
+ messageId: string;
37
+ sent: true;
38
+ }> & {
39
+ slug: "sendDraft";
40
+ };
41
+ //# sourceMappingURL=sendDraft.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendDraft.d.ts","sourceRoot":"","sources":["../../src/actions/sendDraft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcpB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ import { signal } from '../client.js';
3
+ import { identifier } from '../config.js';
4
+ import { defineAction } from '../define.js';
5
+ import { messagePath } from '../mail.js';
6
+ export const sendDraft = defineAction({
7
+ slug: 'sendDraft',
8
+ description: 'Send a saved draft.',
9
+ input: z.object({
10
+ messageId: identifier.meta({
11
+ description: 'The draft message id.'
12
+ })
13
+ }),
14
+ output: z.object({
15
+ messageId: z.string(),
16
+ sent: z.literal(true)
17
+ }),
18
+ idempotent: false,
19
+ async run ({ client, input, req }) {
20
+ await client.request(`${messagePath(client.mailbox, input.messageId)}/send`, z.unknown(), {
21
+ method: 'POST',
22
+ signal: signal(req)
23
+ });
24
+ return {
25
+ messageId: input.messageId,
26
+ sent: true
27
+ };
28
+ }
29
+ });
30
+
31
+ //# sourceMappingURL=sendDraft.js.map