@frogbotai/piece-microsoft-outlook 0.0.0-stage → 0.41.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/LICENSE +21 -0
- package/README.md +80 -2
- package/dist/actions/categories.d.ts +82 -0
- package/dist/actions/categories.d.ts.map +1 -0
- package/dist/actions/categories.js +54 -0
- package/dist/actions/categories.js.map +1 -0
- package/dist/actions/createDraftEmail.d.ts +154 -0
- package/dist/actions/createDraftEmail.d.ts.map +1 -0
- package/dist/actions/createDraftEmail.js +24 -0
- package/dist/actions/createDraftEmail.js.map +1 -0
- package/dist/actions/createEvent.d.ts +109 -0
- package/dist/actions/createEvent.d.ts.map +1 -0
- package/dist/actions/createEvent.js +68 -0
- package/dist/actions/createEvent.js.map +1 -0
- package/dist/actions/customApiCall.d.ts +30 -0
- package/dist/actions/customApiCall.d.ts.map +1 -0
- package/dist/actions/customApiCall.js +9 -0
- package/dist/actions/customApiCall.js.map +1 -0
- package/dist/actions/deleteEvent.d.ts +41 -0
- package/dist/actions/deleteEvent.d.ts.map +1 -0
- package/dist/actions/deleteEvent.js +38 -0
- package/dist/actions/deleteEvent.js.map +1 -0
- package/dist/actions/downloadAttachment.d.ts +50 -0
- package/dist/actions/downloadAttachment.d.ts.map +1 -0
- package/dist/actions/downloadAttachment.js +51 -0
- package/dist/actions/downloadAttachment.js.map +1 -0
- package/dist/actions/findFreeBusyPeriods.d.ts +83 -0
- package/dist/actions/findFreeBusyPeriods.d.ts.map +1 -0
- package/dist/actions/findFreeBusyPeriods.js +66 -0
- package/dist/actions/findFreeBusyPeriods.js.map +1 -0
- package/dist/actions/forwardEmail.d.ts +43 -0
- package/dist/actions/forwardEmail.d.ts.map +1 -0
- package/dist/actions/forwardEmail.js +35 -0
- package/dist/actions/forwardEmail.js.map +1 -0
- package/dist/actions/listCalendars.d.ts +52 -0
- package/dist/actions/listCalendars.d.ts.map +1 -0
- package/dist/actions/listCalendars.js +27 -0
- package/dist/actions/listCalendars.js.map +1 -0
- package/dist/actions/listContacts.d.ts +81 -0
- package/dist/actions/listContacts.d.ts.map +1 -0
- package/dist/actions/listContacts.js +36 -0
- package/dist/actions/listContacts.js.map +1 -0
- package/dist/actions/listEmails.d.ts +161 -0
- package/dist/actions/listEmails.d.ts.map +1 -0
- package/dist/actions/listEmails.js +35 -0
- package/dist/actions/listEmails.js.map +1 -0
- package/dist/actions/listEvents.d.ts +118 -0
- package/dist/actions/listEvents.d.ts.map +1 -0
- package/dist/actions/listEvents.js +42 -0
- package/dist/actions/listEvents.js.map +1 -0
- package/dist/actions/listMailFolders.d.ts +68 -0
- package/dist/actions/listMailFolders.d.ts.map +1 -0
- package/dist/actions/listMailFolders.js +35 -0
- package/dist/actions/listMailFolders.js.map +1 -0
- package/dist/actions/moveEmail.d.ts +143 -0
- package/dist/actions/moveEmail.d.ts.map +1 -0
- package/dist/actions/moveEmail.js +28 -0
- package/dist/actions/moveEmail.js.map +1 -0
- package/dist/actions/replyToEmail.d.ts +157 -0
- package/dist/actions/replyToEmail.d.ts.map +1 -0
- package/dist/actions/replyToEmail.js +57 -0
- package/dist/actions/replyToEmail.js.map +1 -0
- package/dist/actions/searchEmails.d.ts +144 -0
- package/dist/actions/searchEmails.d.ts.map +1 -0
- package/dist/actions/searchEmails.js +31 -0
- package/dist/actions/searchEmails.js.map +1 -0
- package/dist/actions/sendDraft.d.ts +41 -0
- package/dist/actions/sendDraft.d.ts.map +1 -0
- package/dist/actions/sendDraft.js +31 -0
- package/dist/actions/sendDraft.js.map +1 -0
- package/dist/actions/sendEmail.d.ts +51 -0
- package/dist/actions/sendEmail.d.ts.map +1 -0
- package/dist/actions/sendEmail.js +32 -0
- package/dist/actions/sendEmail.js.map +1 -0
- package/dist/calendar.d.ts +39 -0
- package/dist/calendar.d.ts.map +1 -0
- package/dist/calendar.js +51 -0
- package/dist/calendar.js.map +1 -0
- package/dist/client.d.ts +39 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +208 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +33 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +47 -0
- package/dist/config.js.map +1 -0
- package/dist/define.d.ts +220 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +4 -0
- package/dist/define.js.map +1 -0
- package/dist/files.d.ts +27 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +89 -0
- package/dist/files.js.map +1 -0
- package/dist/index.d.ts +4646 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +130 -0
- package/dist/index.js.map +1 -0
- package/dist/mail.d.ts +124 -0
- package/dist/mail.d.ts.map +1 -0
- package/dist/mail.js +79 -0
- package/dist/mail.js.map +1 -0
- package/dist/pagination.d.ts +33 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +39 -0
- package/dist/pagination.js.map +1 -0
- package/dist/triggers/newAttachment.d.ts +243 -0
- package/dist/triggers/newAttachment.d.ts.map +1 -0
- package/dist/triggers/newAttachment.js +64 -0
- package/dist/triggers/newAttachment.js.map +1 -0
- package/dist/triggers/newEmail.d.ts +221 -0
- package/dist/triggers/newEmail.d.ts.map +1 -0
- package/dist/triggers/newEmail.js +33 -0
- package/dist/triggers/newEmail.js.map +1 -0
- package/dist/triggers/newEmailInFolder.d.ts +219 -0
- package/dist/triggers/newEmailInFolder.d.ts.map +1 -0
- package/dist/triggers/newEmailInFolder.js +31 -0
- package/dist/triggers/newEmailInFolder.js.map +1 -0
- package/dist/triggers/poll.d.ts +28 -0
- package/dist/triggers/poll.d.ts.map +1 -0
- package/dist/triggers/poll.js +70 -0
- package/dist/triggers/poll.js.map +1 -0
- package/package.json +42 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FrogBot
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,81 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@frogbotai/piece-microsoft-outlook`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Send, reply to, forward, file and search Outlook mail, manage calendar events, and page through mail, events and contacts over Microsoft Graph.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { createMicrosoftOutlook } from '@frogbotai/piece-microsoft-outlook';
|
|
9
|
+
|
|
10
|
+
// Each person links their own Microsoft account.
|
|
11
|
+
export const outlook = createMicrosoftOutlook({
|
|
12
|
+
oauth: {
|
|
13
|
+
clientId: process.env.MICROSOFT_CLIENT_ID!,
|
|
14
|
+
clientSecret: process.env.MICROSOFT_CLIENT_SECRET!,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
A company mailbox can be read with the app's own secret instead, with no signed-in person. An admin grants the app's application mail permissions once:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
export const salesMailbox = createMicrosoftOutlook({
|
|
23
|
+
auth: {
|
|
24
|
+
tenantId: process.env.MICROSOFT_TENANT_ID!,
|
|
25
|
+
clientId: process.env.MICROSOFT_CLIENT_ID!,
|
|
26
|
+
clientSecret: process.env.MICROSOFT_CLIENT_SECRET!,
|
|
27
|
+
mailbox: 'sales@acme.com',
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Linked accounts call `/me`; app-only access calls `/users/<mailbox>`. App-only tokens are reused until 5 minutes before they expire.
|
|
33
|
+
|
|
34
|
+
`defineMicrosoftOutlook({ cloud, tenantId })` picks the Microsoft cloud (`commercial` or `usGovernment`) and the sign-in tenant; `createMicrosoftOutlook` uses commercial and `common`. Every request stays on that cloud's Graph origin.
|
|
35
|
+
|
|
36
|
+
Graph errors keep Graph's code, message and status. A 429 or 503 waits for `Retry-After` and retries up to 3 times.
|
|
37
|
+
|
|
38
|
+
## OAuth scopes
|
|
39
|
+
|
|
40
|
+
- Always requested: `offline_access`, `User.Read`, `openid`, `email`, `profile`.
|
|
41
|
+
- Defaults: `Mail.ReadWrite`, `Mail.Send`, `Calendars.ReadWrite`, `Contacts.Read`.
|
|
42
|
+
- Also available: `Mail.Read`, `Calendars.Read`.
|
|
43
|
+
|
|
44
|
+
## Actions
|
|
45
|
+
|
|
46
|
+
Upstream splits mail (`microsoft-outlook`) and calendar (`microsoft-outlook-calendar`) into two pieces; here one linked account covers both.
|
|
47
|
+
|
|
48
|
+
| Upstream action slug | Native action | Notes |
|
|
49
|
+
| -------------------------- | --------------------- | ---------------------------------------------------------------------------------------------- |
|
|
50
|
+
| `send-email` | `sendEmail` | Attachments are FrogBot file ids |
|
|
51
|
+
| `reply-email` | `replyToEmail` | Text goes above the quoted thread; adds `replyAll`; `draft` saves without sending |
|
|
52
|
+
| `forwardEmail` | `forwardEmail` | Graph's forward keeps the original attachments |
|
|
53
|
+
| `createDraftEmail` | `createDraftEmail` | |
|
|
54
|
+
| `sendDraftEmail` | `sendDraft` | |
|
|
55
|
+
| `moveEmailToFolder` | `moveEmail` | Returns the moved email, which has a new id |
|
|
56
|
+
| `addLabelToEmail` | `addCategory` | Upstream labels are Outlook categories |
|
|
57
|
+
| `removeLabelFromEmail` | `removeCategory` | |
|
|
58
|
+
| `findEmail` | `searchEmails` | Returns the matching emails, newest first |
|
|
59
|
+
| `downloadAttachment` | `downloadAttachment` | Saves into FrogBot files; one attachment by id, or all |
|
|
60
|
+
| `request_approval_in_mail` | Dropped | Waiting for a reply belongs to workflows; ask a person with tool approval (ticket 389) instead |
|
|
61
|
+
| `create_event` | `createEvent` | Adds attendees and body; the end defaults to 30 minutes after the start |
|
|
62
|
+
| `delete_event` | `deleteEvent` | An event that is already gone counts as deleted |
|
|
63
|
+
| `list_events` | `listEvents` | Uses `calendarView` between `start` and `end`, so recurring events expand; paged with `cursor` |
|
|
64
|
+
| `custom_api_call` | `customApiCall` | Any Microsoft Graph v1.0 request |
|
|
65
|
+
| — | `listCalendars` | Every calendar in the mailbox |
|
|
66
|
+
| — | `findFreeBusyPeriods` | Graph `getSchedule`; work or school accounts only |
|
|
67
|
+
| — | `listMailFolders` | Paged with `cursor` |
|
|
68
|
+
| — | `listEmails` | Paged with `cursor`; newest first, optional `receivedAfter` |
|
|
69
|
+
| — | `listContacts` | Paged with `cursor`; the default contacts folder |
|
|
70
|
+
|
|
71
|
+
The list actions take `limit` (1–100, default 50) and `cursor`, and return `{ data, pagination: { count, hasMore, nextCursor, limit } }`. Pass `nextCursor` back as `cursor` for the next page; it is `null` on the last page. A cursor off the configured Graph origin is refused.
|
|
72
|
+
|
|
73
|
+
## Triggers
|
|
74
|
+
|
|
75
|
+
| Upstream trigger slug | Native trigger | Type | Notes |
|
|
76
|
+
| --------------------- | ------------------ | --------- | ----------------------------------------------------------------------------- |
|
|
77
|
+
| `newEmail` | `newEmail` | `polling` | Inbox; optional `from` and `to` filters |
|
|
78
|
+
| `newEmailInFolder` | `newEmailInFolder` | `polling` | One folder |
|
|
79
|
+
| `newAttachment` | `newAttachment` | `polling` | Saves each file attachment into FrogBot files; optional folder, default inbox |
|
|
80
|
+
|
|
81
|
+
All three poll every 5 minutes. The cursor is the newest `receivedDateTime` seen plus the ids received at that instant, so mail arriving in the same second isn't missed or repeated. The first poll emits nothing, saves no files, and starts the cursor at now. Polls run without a signed-in person, so they read the factory `auth` mailbox; watching each rep's own inbox isn't supported yet.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const addCategory: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
3
|
+
messageId: z.ZodString;
|
|
4
|
+
categories: z.ZodArray<z.ZodString>;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
categories: z.ZodArray<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>, Record<string, never>, {
|
|
9
|
+
baseUrl: "https://graph.microsoft.com" | "https://graph.microsoft.us";
|
|
10
|
+
mailbox: string;
|
|
11
|
+
request: <T>(path: string, schema: z.ZodType<T>, options?: {
|
|
12
|
+
method?: string;
|
|
13
|
+
body?: unknown;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
query?: Record<string, string | number | undefined>;
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
}) => Promise<T>;
|
|
18
|
+
page: <T>(pathOrNextLink: string, item: z.ZodType<T>, options?: {
|
|
19
|
+
method?: string;
|
|
20
|
+
body?: unknown;
|
|
21
|
+
headers?: Record<string, string>;
|
|
22
|
+
query?: Record<string, string | number | undefined>;
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}) => Promise<{
|
|
25
|
+
value: T[];
|
|
26
|
+
nextLink: string | null;
|
|
27
|
+
}>;
|
|
28
|
+
list: <T>(path: string, item: z.ZodType<T>, options?: {
|
|
29
|
+
method?: string;
|
|
30
|
+
body?: unknown;
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
query?: Record<string, string | number | undefined>;
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
}) => Promise<T[]>;
|
|
35
|
+
authorize(target: URL, headers: Headers, signal?: AbortSignal): Promise<void>;
|
|
36
|
+
}, {
|
|
37
|
+
id: string;
|
|
38
|
+
categories: string[];
|
|
39
|
+
}> & {
|
|
40
|
+
slug: "addCategory";
|
|
41
|
+
};
|
|
42
|
+
export declare const removeCategory: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
43
|
+
messageId: z.ZodString;
|
|
44
|
+
categories: z.ZodArray<z.ZodString>;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
categories: z.ZodArray<z.ZodString>;
|
|
48
|
+
}, z.core.$strip>, Record<string, never>, {
|
|
49
|
+
baseUrl: "https://graph.microsoft.com" | "https://graph.microsoft.us";
|
|
50
|
+
mailbox: string;
|
|
51
|
+
request: <T>(path: string, schema: z.ZodType<T>, options?: {
|
|
52
|
+
method?: string;
|
|
53
|
+
body?: unknown;
|
|
54
|
+
headers?: Record<string, string>;
|
|
55
|
+
query?: Record<string, string | number | undefined>;
|
|
56
|
+
signal?: AbortSignal;
|
|
57
|
+
}) => Promise<T>;
|
|
58
|
+
page: <T>(pathOrNextLink: string, item: z.ZodType<T>, options?: {
|
|
59
|
+
method?: string;
|
|
60
|
+
body?: unknown;
|
|
61
|
+
headers?: Record<string, string>;
|
|
62
|
+
query?: Record<string, string | number | undefined>;
|
|
63
|
+
signal?: AbortSignal;
|
|
64
|
+
}) => Promise<{
|
|
65
|
+
value: T[];
|
|
66
|
+
nextLink: string | null;
|
|
67
|
+
}>;
|
|
68
|
+
list: <T>(path: 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<T[]>;
|
|
75
|
+
authorize(target: URL, headers: Headers, signal?: AbortSignal): Promise<void>;
|
|
76
|
+
}, {
|
|
77
|
+
id: string;
|
|
78
|
+
categories: string[];
|
|
79
|
+
}> & {
|
|
80
|
+
slug: "removeCategory";
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=categories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../../src/actions/categories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkCxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUtB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUzB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
const input = z.object({
|
|
7
|
+
messageId: identifier,
|
|
8
|
+
categories: z.array(z.string().trim().min(1)).min(1)
|
|
9
|
+
});
|
|
10
|
+
const output = z.object({
|
|
11
|
+
id: z.string(),
|
|
12
|
+
categories: z.array(z.string())
|
|
13
|
+
});
|
|
14
|
+
async function updateCategories(client, messageId, abortSignal, update) {
|
|
15
|
+
const path = messagePath(client.mailbox, messageId);
|
|
16
|
+
const current = await client.request(path, z.object({
|
|
17
|
+
categories: z.array(z.string()).nullish()
|
|
18
|
+
}), {
|
|
19
|
+
query: {
|
|
20
|
+
$select: 'categories'
|
|
21
|
+
},
|
|
22
|
+
signal: abortSignal
|
|
23
|
+
});
|
|
24
|
+
return client.request(path, output, {
|
|
25
|
+
method: 'PATCH',
|
|
26
|
+
body: {
|
|
27
|
+
categories: update(current.categories ?? [])
|
|
28
|
+
},
|
|
29
|
+
signal: abortSignal
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export const addCategory = defineAction({
|
|
33
|
+
slug: 'addCategory',
|
|
34
|
+
description: 'Add Outlook categories (labels) to an email, keeping its existing ones.',
|
|
35
|
+
input,
|
|
36
|
+
output,
|
|
37
|
+
idempotent: true,
|
|
38
|
+
run: ({ client, input, req })=>updateCategories(client, input.messageId, signal(req), (current)=>[
|
|
39
|
+
...new Set([
|
|
40
|
+
...current,
|
|
41
|
+
...input.categories
|
|
42
|
+
])
|
|
43
|
+
])
|
|
44
|
+
});
|
|
45
|
+
export const removeCategory = defineAction({
|
|
46
|
+
slug: 'removeCategory',
|
|
47
|
+
description: 'Remove Outlook categories (labels) from an email.',
|
|
48
|
+
input,
|
|
49
|
+
output,
|
|
50
|
+
idempotent: true,
|
|
51
|
+
run: ({ client, input, req })=>updateCategories(client, input.messageId, signal(req), (current)=>current.filter((category)=>!input.categories.includes(category)))
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=categories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/actions/categories.ts"],"names":["z","signal","identifier","defineAction","messagePath","input","object","messageId","categories","array","string","trim","min","output","id","updateCategories","client","abortSignal","update","path","mailbox","current","request","nullish","query","$select","method","body","addCategory","slug","description","idempotent","run","req","Set","removeCategory","filter","category","includes"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,SAAsCC,MAAM,QAAQ,eAAe;AACnE,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,YAAY,QAAQ,eAAe;AAC5C,SAASC,WAAW,QAAQ,aAAa;AAEzC,MAAMC,QAAQL,EAAEM,MAAM,CAAC;IACrBC,WAAWL;IACXM,YAAYR,EAAES,KAAK,CAACT,EAAEU,MAAM,GAAGC,IAAI,GAAGC,GAAG,CAAC,IAAIA,GAAG,CAAC;AACpD;AAEA,MAAMC,SAASb,EAAEM,MAAM,CAAC;IAAEQ,IAAId,EAAEU,MAAM;IAAIF,YAAYR,EAAES,KAAK,CAACT,EAAEU,MAAM;AAAI;AAE1E,eAAeK,iBACbC,MAA8B,EAC9BT,SAAiB,EACjBU,WAAoC,EACpCC,MAAuC;IAEvC,MAAMC,OAAOf,YAAYY,OAAOI,OAAO,EAAEb;IACzC,MAAMc,UAAU,MAAML,OAAOM,OAAO,CAClCH,MACAnB,EAAEM,MAAM,CAAC;QAAEE,YAAYR,EAAES,KAAK,CAACT,EAAEU,MAAM,IAAIa,OAAO;IAAG,IACrD;QAAEC,OAAO;YAAEC,SAAS;QAAa;QAAGxB,QAAQgB;IAAY;IAG1D,OAAOD,OAAOM,OAAO,CAACH,MAAMN,QAAQ;QAClCa,QAAQ;QACRC,MAAM;YAAEnB,YAAYU,OAAOG,QAAQb,UAAU,IAAI,EAAE;QAAE;QACrDP,QAAQgB;IACV;AACF;AAEA,OAAO,MAAMW,cAAczB,aAAa;IACtC0B,MAAM;IACNC,aAAa;IACbzB;IACAQ;IACAkB,YAAY;IACZC,KAAK,CAAC,EAAEhB,MAAM,EAAEX,KAAK,EAAE4B,GAAG,EAAE,GAC1BlB,iBAAiBC,QAAQX,MAAME,SAAS,EAAEN,OAAOgC,MAAM,CAACZ,UAAY;mBAC/D,IAAIa,IAAI;uBAAIb;uBAAYhB,MAAMG,UAAU;iBAAC;aAC7C;AACL,GAAG;AAEH,OAAO,MAAM2B,iBAAiBhC,aAAa;IACzC0B,MAAM;IACNC,aAAa;IACbzB;IACAQ;IACAkB,YAAY;IACZC,KAAK,CAAC,EAAEhB,MAAM,EAAEX,KAAK,EAAE4B,GAAG,EAAE,GAC1BlB,iBAAiBC,QAAQX,MAAME,SAAS,EAAEN,OAAOgC,MAAM,CAACZ,UACtDA,QAAQe,MAAM,CAAC,CAACC,WAAa,CAAChC,MAAMG,UAAU,CAAC8B,QAAQ,CAACD;AAE9D,GAAG","file":"categories.js"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createDraftEmail: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
3
|
+
body: z.ZodString;
|
|
4
|
+
bodyType: z.ZodDefault<z.ZodEnum<{
|
|
5
|
+
text: "text";
|
|
6
|
+
html: "html";
|
|
7
|
+
}>>;
|
|
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
|
+
subject: z.ZodString;
|
|
13
|
+
to: z.ZodArray<z.ZodEmail>;
|
|
14
|
+
cc: z.ZodOptional<z.ZodArray<z.ZodEmail>>;
|
|
15
|
+
bcc: z.ZodOptional<z.ZodArray<z.ZodEmail>>;
|
|
16
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19
|
+
from: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
20
|
+
emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
21
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
}, z.core.$strip>>>;
|
|
24
|
+
}, z.core.$strip>>>;
|
|
25
|
+
sender: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
26
|
+
emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
27
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
}, z.core.$strip>>>;
|
|
30
|
+
}, z.core.$strip>>>;
|
|
31
|
+
toRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
32
|
+
emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
33
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
|
+
}, z.core.$strip>>>;
|
|
36
|
+
}, z.core.$strip>>>>;
|
|
37
|
+
ccRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
38
|
+
emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
39
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
|
+
address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
+
}, z.core.$strip>>>;
|
|
42
|
+
}, z.core.$strip>>>>;
|
|
43
|
+
bccRecipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
44
|
+
emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
45
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
+
address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
}, z.core.$strip>>>;
|
|
48
|
+
}, z.core.$strip>>>>;
|
|
49
|
+
replyTo: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
50
|
+
emailAddress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
51
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
}, z.core.$strip>>>;
|
|
54
|
+
}, z.core.$strip>>>>;
|
|
55
|
+
receivedDateTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
56
|
+
sentDateTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
|
+
conversationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
parentFolderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
bodyPreview: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
+
body: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
61
|
+
contentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
62
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
|
+
}, z.core.$strip>>>;
|
|
64
|
+
categories: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
65
|
+
hasAttachments: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
66
|
+
isRead: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
67
|
+
isDraft: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
68
|
+
webLink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
|
+
}, z.core.$loose>, 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
|
+
[x: string]: unknown;
|
|
99
|
+
id: string;
|
|
100
|
+
subject?: string | null | undefined;
|
|
101
|
+
from?: {
|
|
102
|
+
emailAddress?: {
|
|
103
|
+
name?: string | null | undefined;
|
|
104
|
+
address?: string | null | undefined;
|
|
105
|
+
} | null | undefined;
|
|
106
|
+
} | null | undefined;
|
|
107
|
+
sender?: {
|
|
108
|
+
emailAddress?: {
|
|
109
|
+
name?: string | null | undefined;
|
|
110
|
+
address?: string | null | undefined;
|
|
111
|
+
} | null | undefined;
|
|
112
|
+
} | null | undefined;
|
|
113
|
+
toRecipients?: {
|
|
114
|
+
emailAddress?: {
|
|
115
|
+
name?: string | null | undefined;
|
|
116
|
+
address?: string | null | undefined;
|
|
117
|
+
} | null | undefined;
|
|
118
|
+
}[] | null | undefined;
|
|
119
|
+
ccRecipients?: {
|
|
120
|
+
emailAddress?: {
|
|
121
|
+
name?: string | null | undefined;
|
|
122
|
+
address?: string | null | undefined;
|
|
123
|
+
} | null | undefined;
|
|
124
|
+
}[] | null | undefined;
|
|
125
|
+
bccRecipients?: {
|
|
126
|
+
emailAddress?: {
|
|
127
|
+
name?: string | null | undefined;
|
|
128
|
+
address?: string | null | undefined;
|
|
129
|
+
} | null | undefined;
|
|
130
|
+
}[] | null | undefined;
|
|
131
|
+
replyTo?: {
|
|
132
|
+
emailAddress?: {
|
|
133
|
+
name?: string | null | undefined;
|
|
134
|
+
address?: string | null | undefined;
|
|
135
|
+
} | null | undefined;
|
|
136
|
+
}[] | null | undefined;
|
|
137
|
+
receivedDateTime?: string | null | undefined;
|
|
138
|
+
sentDateTime?: string | null | undefined;
|
|
139
|
+
conversationId?: string | null | undefined;
|
|
140
|
+
parentFolderId?: string | null | undefined;
|
|
141
|
+
bodyPreview?: string | null | undefined;
|
|
142
|
+
body?: {
|
|
143
|
+
contentType?: string | null | undefined;
|
|
144
|
+
content?: string | null | undefined;
|
|
145
|
+
} | null | undefined;
|
|
146
|
+
categories?: string[] | null | undefined;
|
|
147
|
+
hasAttachments?: boolean | null | undefined;
|
|
148
|
+
isRead?: boolean | null | undefined;
|
|
149
|
+
isDraft?: boolean | null | undefined;
|
|
150
|
+
webLink?: string | null | undefined;
|
|
151
|
+
}> & {
|
|
152
|
+
slug: "createDraftEmail";
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=createDraftEmail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDraftEmail.d.ts","sourceRoot":"","sources":["../../src/actions/createDraftEmail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa3B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { signal } from '../client.js';
|
|
3
|
+
import { defineAction } from '../define.js';
|
|
4
|
+
import { content, message, newMessage, recipients } from '../mail.js';
|
|
5
|
+
export const createDraftEmail = defineAction({
|
|
6
|
+
slug: 'createDraftEmail',
|
|
7
|
+
description: 'Save a new email as a draft.',
|
|
8
|
+
input: z.object({
|
|
9
|
+
...recipients,
|
|
10
|
+
subject: z.string(),
|
|
11
|
+
...content
|
|
12
|
+
}),
|
|
13
|
+
output: message,
|
|
14
|
+
idempotent: false,
|
|
15
|
+
async run ({ client, input, req, overrideAccess }) {
|
|
16
|
+
return client.request(`${client.mailbox}/messages`, message, {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
body: await newMessage(req, input, overrideAccess),
|
|
19
|
+
signal: signal(req)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=createDraftEmail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/actions/createDraftEmail.ts"],"names":["z","signal","defineAction","content","message","newMessage","recipients","createDraftEmail","slug","description","input","object","subject","string","output","idempotent","run","client","req","overrideAccess","request","mailbox","method","body"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,YAAY,QAAQ,eAAe;AAC5C,SAASC,OAAO,EAAEC,OAAO,EAAEC,UAAU,EAAEC,UAAU,QAAQ,aAAa;AAEtE,OAAO,MAAMC,mBAAmBL,aAAa;IAC3CM,MAAM;IACNC,aAAa;IACbC,OAAOV,EAAEW,MAAM,CAAC;QAAE,GAAGL,UAAU;QAAEM,SAASZ,EAAEa,MAAM;QAAI,GAAGV,OAAO;IAAC;IACjEW,QAAQV;IACRW,YAAY;IACZ,MAAMC,KAAI,EAAEC,MAAM,EAAEP,KAAK,EAAEQ,GAAG,EAAEC,cAAc,EAAE;QAC9C,OAAOF,OAAOG,OAAO,CAAC,GAAGH,OAAOI,OAAO,CAAC,SAAS,CAAC,EAAEjB,SAAS;YAC3DkB,QAAQ;YACRC,MAAM,MAAMlB,WAAWa,KAAKR,OAAOS;YACnClB,QAAQA,OAAOiB;QACjB;IACF;AACF,GAAG","file":"createDraftEmail.js"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createEvent: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
3
|
+
calendarId: z.ZodOptional<z.ZodString>;
|
|
4
|
+
subject: z.ZodString;
|
|
5
|
+
start: z.ZodISODateTime;
|
|
6
|
+
end: z.ZodOptional<z.ZodISODateTime>;
|
|
7
|
+
timeZone: z.ZodDefault<z.ZodString>;
|
|
8
|
+
location: z.ZodOptional<z.ZodString>;
|
|
9
|
+
body: z.ZodOptional<z.ZodString>;
|
|
10
|
+
bodyType: z.ZodDefault<z.ZodEnum<{
|
|
11
|
+
text: "text";
|
|
12
|
+
html: "html";
|
|
13
|
+
}>>;
|
|
14
|
+
attendees: z.ZodOptional<z.ZodArray<z.ZodEmail>>;
|
|
15
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
18
|
+
start: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
19
|
+
dateTime: z.ZodString;
|
|
20
|
+
timeZone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
|
+
}, z.core.$strip>>>;
|
|
22
|
+
end: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
23
|
+
dateTime: z.ZodString;
|
|
24
|
+
timeZone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
}, z.core.$strip>>>;
|
|
26
|
+
isAllDay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
27
|
+
location: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
28
|
+
displayName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
}, z.core.$loose>>>;
|
|
30
|
+
organizer: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
31
|
+
emailAddress: z.ZodObject<{
|
|
32
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
}, z.core.$strip>>>;
|
|
36
|
+
attendees: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>>;
|
|
37
|
+
bodyPreview: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
38
|
+
webLink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
39
|
+
onlineMeeting: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
40
|
+
joinUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
+
}, z.core.$loose>>>;
|
|
42
|
+
seriesMasterId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
43
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
|
+
}, z.core.$loose>, Record<string, never>, {
|
|
45
|
+
baseUrl: "https://graph.microsoft.com" | "https://graph.microsoft.us";
|
|
46
|
+
mailbox: string;
|
|
47
|
+
request: <T>(path: string, schema: z.ZodType<T>, options?: {
|
|
48
|
+
method?: string;
|
|
49
|
+
body?: unknown;
|
|
50
|
+
headers?: Record<string, string>;
|
|
51
|
+
query?: Record<string, string | number | undefined>;
|
|
52
|
+
signal?: AbortSignal;
|
|
53
|
+
}) => Promise<T>;
|
|
54
|
+
page: <T>(pathOrNextLink: string, item: z.ZodType<T>, options?: {
|
|
55
|
+
method?: string;
|
|
56
|
+
body?: unknown;
|
|
57
|
+
headers?: Record<string, string>;
|
|
58
|
+
query?: Record<string, string | number | undefined>;
|
|
59
|
+
signal?: AbortSignal;
|
|
60
|
+
}) => Promise<{
|
|
61
|
+
value: T[];
|
|
62
|
+
nextLink: string | null;
|
|
63
|
+
}>;
|
|
64
|
+
list: <T>(path: string, item: z.ZodType<T>, options?: {
|
|
65
|
+
method?: string;
|
|
66
|
+
body?: unknown;
|
|
67
|
+
headers?: Record<string, string>;
|
|
68
|
+
query?: Record<string, string | number | undefined>;
|
|
69
|
+
signal?: AbortSignal;
|
|
70
|
+
}) => Promise<T[]>;
|
|
71
|
+
authorize(target: URL, headers: Headers, signal?: AbortSignal): Promise<void>;
|
|
72
|
+
}, {
|
|
73
|
+
[x: string]: unknown;
|
|
74
|
+
id: string;
|
|
75
|
+
subject?: string | null | undefined;
|
|
76
|
+
start?: {
|
|
77
|
+
dateTime: string;
|
|
78
|
+
timeZone?: string | null | undefined;
|
|
79
|
+
} | null | undefined;
|
|
80
|
+
end?: {
|
|
81
|
+
dateTime: string;
|
|
82
|
+
timeZone?: string | null | undefined;
|
|
83
|
+
} | null | undefined;
|
|
84
|
+
isAllDay?: boolean | null | undefined;
|
|
85
|
+
location?: {
|
|
86
|
+
[x: string]: unknown;
|
|
87
|
+
displayName?: string | null | undefined;
|
|
88
|
+
} | null | undefined;
|
|
89
|
+
organizer?: {
|
|
90
|
+
emailAddress: {
|
|
91
|
+
name?: string | null | undefined;
|
|
92
|
+
address?: string | null | undefined;
|
|
93
|
+
};
|
|
94
|
+
} | null | undefined;
|
|
95
|
+
attendees?: {
|
|
96
|
+
[x: string]: unknown;
|
|
97
|
+
}[] | null | undefined;
|
|
98
|
+
bodyPreview?: string | null | undefined;
|
|
99
|
+
webLink?: string | null | undefined;
|
|
100
|
+
onlineMeeting?: {
|
|
101
|
+
[x: string]: unknown;
|
|
102
|
+
joinUrl?: string | null | undefined;
|
|
103
|
+
} | null | undefined;
|
|
104
|
+
seriesMasterId?: string | null | undefined;
|
|
105
|
+
type?: string | null | undefined;
|
|
106
|
+
}> & {
|
|
107
|
+
slug: "createEvent";
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=createEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEvent.d.ts","sourceRoot":"","sources":["../../src/actions/createEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CtB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { calendarPath, dateTime, event, graphDateTime } from '../calendar.js';
|
|
3
|
+
import { signal } from '../client.js';
|
|
4
|
+
import { identifier } from '../config.js';
|
|
5
|
+
import { defineAction } from '../define.js';
|
|
6
|
+
import { addresses } from '../mail.js';
|
|
7
|
+
function plus30Minutes(start) {
|
|
8
|
+
const end = new Date(`${start.dateTime}Z`).getTime() + 30 * 60 * 1000;
|
|
9
|
+
return {
|
|
10
|
+
dateTime: new Date(end).toISOString().slice(0, 19),
|
|
11
|
+
timeZone: start.timeZone
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export const createEvent = defineAction({
|
|
15
|
+
slug: 'createEvent',
|
|
16
|
+
description: 'Create a calendar event. Attendees get an invitation. The end defaults to 30 minutes after the start.',
|
|
17
|
+
input: z.object({
|
|
18
|
+
calendarId: identifier.optional().meta({
|
|
19
|
+
description: 'Defaults to the main calendar.'
|
|
20
|
+
}),
|
|
21
|
+
subject: z.string(),
|
|
22
|
+
start: dateTime,
|
|
23
|
+
end: dateTime.optional(),
|
|
24
|
+
timeZone: z.string().default('UTC').meta({
|
|
25
|
+
description: 'Time zone for start and end without an offset, such as Europe/Paris.'
|
|
26
|
+
}),
|
|
27
|
+
location: z.string().optional(),
|
|
28
|
+
body: z.string().optional(),
|
|
29
|
+
bodyType: z.enum([
|
|
30
|
+
'text',
|
|
31
|
+
'html'
|
|
32
|
+
]).default('text'),
|
|
33
|
+
attendees: z.array(z.email()).optional()
|
|
34
|
+
}),
|
|
35
|
+
output: event,
|
|
36
|
+
idempotent: false,
|
|
37
|
+
async run ({ client, input, req }) {
|
|
38
|
+
const start = graphDateTime(input.start, input.timeZone);
|
|
39
|
+
return client.request(`${calendarPath(client.mailbox, input.calendarId)}/events`, event, {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
body: {
|
|
42
|
+
subject: input.subject,
|
|
43
|
+
start,
|
|
44
|
+
end: input.end ? graphDateTime(input.end, input.timeZone) : plus30Minutes(start),
|
|
45
|
+
...input.location ? {
|
|
46
|
+
location: {
|
|
47
|
+
displayName: input.location
|
|
48
|
+
}
|
|
49
|
+
} : {},
|
|
50
|
+
...input.body ? {
|
|
51
|
+
body: {
|
|
52
|
+
contentType: input.bodyType,
|
|
53
|
+
content: input.body
|
|
54
|
+
}
|
|
55
|
+
} : {},
|
|
56
|
+
...input.attendees?.length ? {
|
|
57
|
+
attendees: addresses(input.attendees)?.map((attendee)=>({
|
|
58
|
+
...attendee,
|
|
59
|
+
type: 'required'
|
|
60
|
+
}))
|
|
61
|
+
} : {}
|
|
62
|
+
},
|
|
63
|
+
signal: signal(req)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=createEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/actions/createEvent.ts"],"names":["z","calendarPath","dateTime","event","graphDateTime","signal","identifier","defineAction","addresses","plus30Minutes","start","end","Date","getTime","toISOString","slice","timeZone","createEvent","slug","description","input","object","calendarId","optional","meta","subject","string","default","location","body","bodyType","enum","attendees","array","email","output","idempotent","run","client","req","request","mailbox","method","displayName","contentType","content","length","map","attendee","type"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,SAASC,YAAY,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,aAAa,QAAQ,iBAAiB;AAC9E,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,YAAY,QAAQ,eAAe;AAC5C,SAASC,SAAS,QAAQ,aAAa;AAEvC,SAASC,cAAcC,KAA6C;IAClE,MAAMC,MAAM,IAAIC,KAAK,GAAGF,MAAMR,QAAQ,CAAC,CAAC,CAAC,EAAEW,OAAO,KAAK,KAAK,KAAK;IAEjE,OAAO;QAAEX,UAAU,IAAIU,KAAKD,KAAKG,WAAW,GAAGC,KAAK,CAAC,GAAG;QAAKC,UAAUN,MAAMM,QAAQ;IAAC;AACxF;AAEA,OAAO,MAAMC,cAAcV,aAAa;IACtCW,MAAM;IACNC,aACE;IACFC,OAAOpB,EAAEqB,MAAM,CAAC;QACdC,YAAYhB,WAAWiB,QAAQ,GAAGC,IAAI,CAAC;YAAEL,aAAa;QAAiC;QACvFM,SAASzB,EAAE0B,MAAM;QACjBhB,OAAOR;QACPS,KAAKT,SAASqB,QAAQ;QACtBP,UAAUhB,EAAE0B,MAAM,GAAGC,OAAO,CAAC,OAAOH,IAAI,CAAC;YACvCL,aAAa;QACf;QACAS,UAAU5B,EAAE0B,MAAM,GAAGH,QAAQ;QAC7BM,MAAM7B,EAAE0B,MAAM,GAAGH,QAAQ;QACzBO,UAAU9B,EAAE+B,IAAI,CAAC;YAAC;YAAQ;SAAO,EAAEJ,OAAO,CAAC;QAC3CK,WAAWhC,EAAEiC,KAAK,CAACjC,EAAEkC,KAAK,IAAIX,QAAQ;IACxC;IACAY,QAAQhC;IACRiC,YAAY;IACZ,MAAMC,KAAI,EAAEC,MAAM,EAAElB,KAAK,EAAEmB,GAAG,EAAE;QAC9B,MAAM7B,QAAQN,cAAcgB,MAAMV,KAAK,EAAEU,MAAMJ,QAAQ;QAEvD,OAAOsB,OAAOE,OAAO,CAAC,GAAGvC,aAAaqC,OAAOG,OAAO,EAAErB,MAAME,UAAU,EAAE,OAAO,CAAC,EAAEnB,OAAO;YACvFuC,QAAQ;YACRb,MAAM;gBACJJ,SAASL,MAAMK,OAAO;gBACtBf;gBACAC,KAAKS,MAAMT,GAAG,GAAGP,cAAcgB,MAAMT,GAAG,EAAES,MAAMJ,QAAQ,IAAIP,cAAcC;gBAC1E,GAAIU,MAAMQ,QAAQ,GAAG;oBAAEA,UAAU;wBAAEe,aAAavB,MAAMQ,QAAQ;oBAAC;gBAAE,IAAI,CAAC,CAAC;gBACvE,GAAIR,MAAMS,IAAI,GAAG;oBAAEA,MAAM;wBAAEe,aAAaxB,MAAMU,QAAQ;wBAAEe,SAASzB,MAAMS,IAAI;oBAAC;gBAAE,IAAI,CAAC,CAAC;gBACpF,GAAIT,MAAMY,SAAS,EAAEc,SACjB;oBACEd,WAAWxB,UAAUY,MAAMY,SAAS,GAAGe,IAAI,CAACC,WAAc,CAAA;4BACxD,GAAGA,QAAQ;4BACXC,MAAM;wBACR,CAAA;gBACF,IACA,CAAC,CAAC;YACR;YACA5C,QAAQA,OAAOkC;QACjB;IACF;AACF,GAAG","file":"createEvent.js"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const customApiCall: import("frogbot/pieces").CustomApiCallAction<Record<string, never>, {
|
|
2
|
+
baseUrl: "https://graph.microsoft.com" | "https://graph.microsoft.us";
|
|
3
|
+
mailbox: string;
|
|
4
|
+
request: <T>(path: string, schema: import("zod").ZodType<T>, options?: {
|
|
5
|
+
method?: string;
|
|
6
|
+
body?: unknown;
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
query?: Record<string, string | number | undefined>;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}) => Promise<T>;
|
|
11
|
+
page: <T>(pathOrNextLink: string, item: import("zod").ZodType<T>, options?: {
|
|
12
|
+
method?: string;
|
|
13
|
+
body?: unknown;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
query?: Record<string, string | number | undefined>;
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
}) => Promise<{
|
|
18
|
+
value: T[];
|
|
19
|
+
nextLink: string | null;
|
|
20
|
+
}>;
|
|
21
|
+
list: <T>(path: string, item: import("zod").ZodType<T>, options?: {
|
|
22
|
+
method?: string;
|
|
23
|
+
body?: unknown;
|
|
24
|
+
headers?: Record<string, string>;
|
|
25
|
+
query?: Record<string, string | number | undefined>;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}) => Promise<T[]>;
|
|
28
|
+
authorize(target: URL, headers: Headers, signal?: AbortSignal): Promise<void>;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=customApiCall.d.ts.map
|