@activepieces/piece-microsoft-outlook 0.1.10 → 0.1.12

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 (44) hide show
  1. package/package.json +3 -4
  2. package/src/i18n/de.json +1 -0
  3. package/src/i18n/es.json +1 -0
  4. package/src/i18n/fr.json +1 -0
  5. package/src/i18n/ja.json +1 -0
  6. package/src/i18n/nl.json +1 -0
  7. package/src/i18n/pt.json +1 -0
  8. package/src/i18n/translation.json +1 -0
  9. package/src/i18n/zh.json +1 -0
  10. package/src/index.js +23 -3
  11. package/src/index.js.map +1 -1
  12. package/src/lib/actions/add-label-to-email.d.ts +4 -0
  13. package/src/lib/actions/add-label-to-email.js +44 -0
  14. package/src/lib/actions/add-label-to-email.js.map +1 -0
  15. package/src/lib/actions/create-draft-email.d.ts +9 -0
  16. package/src/lib/actions/create-draft-email.js +108 -0
  17. package/src/lib/actions/create-draft-email.js.map +1 -0
  18. package/src/lib/actions/find-email.d.ts +5 -0
  19. package/src/lib/actions/find-email.js +67 -0
  20. package/src/lib/actions/find-email.js.map +1 -0
  21. package/src/lib/actions/forward-email.d.ts +5 -0
  22. package/src/lib/actions/forward-email.js +61 -0
  23. package/src/lib/actions/forward-email.js.map +1 -0
  24. package/src/lib/actions/move-email-to-folder.d.ts +4 -0
  25. package/src/lib/actions/move-email-to-folder.js +41 -0
  26. package/src/lib/actions/move-email-to-folder.js.map +1 -0
  27. package/src/lib/actions/remove-label-from-email.d.ts +4 -0
  28. package/src/lib/actions/remove-label-from-email.js +44 -0
  29. package/src/lib/actions/remove-label-from-email.js.map +1 -0
  30. package/src/lib/actions/reply-email.d.ts +1 -1
  31. package/src/lib/actions/reply-email.js +40 -2
  32. package/src/lib/actions/reply-email.js.map +1 -1
  33. package/src/lib/actions/send-draft-email.d.ts +3 -0
  34. package/src/lib/actions/send-draft-email.js +38 -0
  35. package/src/lib/actions/send-draft-email.js.map +1 -0
  36. package/src/lib/common/props.d.ts +9 -0
  37. package/src/lib/common/props.js +127 -0
  38. package/src/lib/common/props.js.map +1 -0
  39. package/src/lib/triggers/new-attachment.d.ts +8 -0
  40. package/src/lib/triggers/new-attachment.js +115 -0
  41. package/src/lib/triggers/new-attachment.js.map +1 -0
  42. package/src/lib/triggers/new-email-in-folder.d.ts +8 -0
  43. package/src/lib/triggers/new-email-in-folder.js +95 -0
  44. package/src/lib/triggers/new-email-in-folder.js.map +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activepieces/piece-microsoft-outlook",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "dependencies": {
5
5
  "@microsoft/microsoft-graph-client": "3.0.7",
6
6
  "@microsoft/microsoft-graph-types": "2.40.0",
@@ -9,14 +9,13 @@
9
9
  "axios-retry": "4.4.1",
10
10
  "dayjs": "1.11.9",
11
11
  "deepmerge-ts": "7.1.0",
12
- "fast-glob": "3.3.3",
13
12
  "mime-types": "2.1.35",
14
13
  "nanoid": "3.3.8",
15
14
  "semver": "7.6.0",
16
15
  "zod": "3.25.76",
17
16
  "@activepieces/pieces-common": "0.7.0",
18
- "@activepieces/pieces-framework": "0.18.5",
19
- "@activepieces/shared": "0.20.0",
17
+ "@activepieces/pieces-framework": "0.20.0",
18
+ "@activepieces/shared": "0.20.1",
20
19
  "tslib": "2.8.1"
21
20
  },
22
21
  "overrides": {
package/src/i18n/de.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "Microsoft Outlook": "Microsoft Outlook",
3
+ "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and ad": "\n1. Melden Sie sich bei [Microsoft Azure Portal](https://portal.azure.com/).\n. Von der linken Seitenleiste gehen Sie zur **Microsoft Enfra ID**.\n3. Unter **Verwalten** klicken Sie auf **App-Registrierungen**.\n4. Klicken Sie auf die **Neue Registrierung** Schaltfläche.\n5. Geben Sie einen **Name** für Ihre App ein.\n6. Für **unterstützte Kontotypen**, auswählen:\n - **Konten in jedem Organisationsverzeichnis (jeder Microsoft-Entra-ID-Mieter - Multitenant) und persönlichen Microsoft-Konten**\n - Oder wählen Sie nach Ihren Anforderungen aus.\n7. In **Umleitungs-URI** wählen Sie **Web** und fügen Sie die angegebene URL hinzu.\n8. Klicken Sie auf **Registrieren**.\n9. Nach der Registrierung werden Sie zur Übersichtsseite der App weitergeleitet. Kopieren Sie die **Anwendungs-(Client)-ID**.\n10. Gehen Sie aus dem linken Menü zu **Zertifikate & Geheimnisse**.\n - Unter **Kundengeheimnis**, klicken Sie auf **Neues Kundengeheimnis**.\n - Geben Sie eine Beschreibung an, setzen Sie ein Ablaufdatum und klicken Sie auf **Hinzufügen**.\n - Kopieren Sie den **Wert** des Client-Geheimnisses (dies wird nicht wieder angezeigt).\n11. Gehe zu **API Berechtigungen** vom linken Menü.\n - Klicke **Berechtigung hinzufügen**.\n - Wähle **Microsoft Graph** → **delegierte Berechtigungen**.\n - Fügen Sie folgende Bereiche hinzu:\n - Mail. eadSchreiben\n - Mail.Senden Sie \n - Kalender. ead\n\t - offline_access\n\t - User.Lesen Sie\n - Klicken Sie auf **Berechtigungen hinzufügen**.\n12. Kopieren Sie Ihre **Client-ID** und **Client-Geheimnis**.\n",
3
4
  "Send Email": "E-Mail senden",
4
5
  "Download Attachment": "Anhang herunterladen",
5
6
  "Reply to Email": "Auf E-Mail antworten",
package/src/i18n/es.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "Microsoft Outlook": "Microsoft Outlook",
3
+ "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and ad": "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and add the given URL.\n8. Click **Register**.\n9. After registration, you’ll be redirected to the app’s overview page. Copy the **Application (client) ID**.\n10. From the left menu, go to **Certificates & secrets**.\n - Under **Client secrets**, click **New client secret**.\n - Provide a description, set an expiry, and click **Add**.\n - Copy the **Value** of the client secret (this will not be shown again).\n11. Go to **API permissions** from the left menu.\n - Click **Add a permission**.\n - Select **Microsoft Graph** → **Delegated permissions**.\n - Add the following scopes:\n - Mail.ReadWrite\n - Mail.Send\n\t - Calendars.Read\n\t - offline_access\n\t - User.Read\n - Click **Add permissions**.\n12. Copy your **Client ID** and **Client Secret**.\n",
3
4
  "Send Email": "Enviar Email",
4
5
  "Download Attachment": "Descargar adjunto",
5
6
  "Reply to Email": "Responder al email",
package/src/i18n/fr.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "Microsoft Outlook": "Microsoft Outlook",
3
+ "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and ad": "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and add the given URL.\n8. Click **Register**.\n9. After registration, you’ll be redirected to the app’s overview page. Copy the **Application (client) ID**.\n10. From the left menu, go to **Certificates & secrets**.\n - Under **Client secrets**, click **New client secret**.\n - Provide a description, set an expiry, and click **Add**.\n - Copy the **Value** of the client secret (this will not be shown again).\n11. Go to **API permissions** from the left menu.\n - Click **Add a permission**.\n - Select **Microsoft Graph** → **Delegated permissions**.\n - Add the following scopes:\n - Mail.ReadWrite\n - Mail.Send\n\t - Calendars.Read\n\t - offline_access\n\t - User.Read\n - Click **Add permissions**.\n12. Copy your **Client ID** and **Client Secret**.\n",
3
4
  "Send Email": "Envoyer un e-mail",
4
5
  "Download Attachment": "Télécharger la pièce jointe",
5
6
  "Reply to Email": "Répondre à l'e-mail",
package/src/i18n/ja.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "Microsoft Outlook": "Microsoft Outlook",
3
+ "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and ad": "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and add the given URL.\n8. Click **Register**.\n9. After registration, you’ll be redirected to the app’s overview page. Copy the **Application (client) ID**.\n10. From the left menu, go to **Certificates & secrets**.\n - Under **Client secrets**, click **New client secret**.\n - Provide a description, set an expiry, and click **Add**.\n - Copy the **Value** of the client secret (this will not be shown again).\n11. Go to **API permissions** from the left menu.\n - Click **Add a permission**.\n - Select **Microsoft Graph** → **Delegated permissions**.\n - Add the following scopes:\n - Mail.ReadWrite\n - Mail.Send\n\t - Calendars.Read\n\t - offline_access\n\t - User.Read\n - Click **Add permissions**.\n12. Copy your **Client ID** and **Client Secret**.\n",
3
4
  "Send Email": "メール送信",
4
5
  "Download Attachment": "添付ファイルをダウンロード",
5
6
  "Reply to Email": "メールに返信",
package/src/i18n/nl.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "Microsoft Outlook": "Microsoft Outlook",
3
+ "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and ad": "\n1. Log in bij [Microsoft Azure Portal](https://portal.azure.com/).\n. Ga naar **Microsoft Enfra ID**.\n3. Onder **Beheren**, klik op **App registraties**.\n4. Klik op de **Nieuwe registratie** knop.\n5. Voer een **Naam** in voor uw app.\n6. Voor **Ondersteunde accounttypen**, kies keuze:\n - **Accounts in elke map van de organisatie (Any Microsoft Entra ID-tenant - Multitenant) en persoonlijke Microsoft accounts**\n - Of selecteer gebaseerd op uw vereiste.\n7. In **Redirect URI**, selecteer **Web** en voeg de opgegeven URL toe.\n8. Klik **Register**.\n9. Na registratie wordt u doorgestuurd naar de overzichtspagina. Kopieer de **Applicatie (client) ID**.\n10. Ga in het linkermenu, naar **Certificaten & geheimen**.\n - onder **Client secrets**, klik op **Nieuw client geheim**.\n - Geef een beschrijving, verloop, en klik **Toevoegen**.\n - Kopieer de **Waarde** van de client secret (dit zal niet meer worden getoond).\n11. Ga naar **API-rechten** vanuit het linkermenu.\n - Klik **Een machtiging toevoegen**.\n - Selecteer **Microsoft Graph** → **gedelegeerde rechten**.\n - Voeg de volgende toepassingsgebieden toe:\n - Mail. eadWrite\n - Mail.Send \n - Kalenders. ead\n\t - offline_access\n\t - User.Read\n - Klik **Machtigingen toevoegen**.\n12. Kopieer uw **Client ID** en **Client Secret**.\n",
3
4
  "Send Email": "E-mail verzenden",
4
5
  "Download Attachment": "Bijlage downloaden",
5
6
  "Reply to Email": "Beantwoord e-mail",
package/src/i18n/pt.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "Microsoft Outlook": "Microsoft Outlook",
3
+ "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and ad": "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and add the given URL.\n8. Click **Register**.\n9. After registration, you’ll be redirected to the app’s overview page. Copy the **Application (client) ID**.\n10. From the left menu, go to **Certificates & secrets**.\n - Under **Client secrets**, click **New client secret**.\n - Provide a description, set an expiry, and click **Add**.\n - Copy the **Value** of the client secret (this will not be shown again).\n11. Go to **API permissions** from the left menu.\n - Click **Add a permission**.\n - Select **Microsoft Graph** → **Delegated permissions**.\n - Add the following scopes:\n - Mail.ReadWrite\n - Mail.Send\n\t - Calendars.Read\n\t - offline_access\n\t - User.Read\n - Click **Add permissions**.\n12. Copy your **Client ID** and **Client Secret**.\n",
3
4
  "Send Email": "Enviar e-mail",
4
5
  "Download Attachment": "Baixar anexo",
5
6
  "Reply to Email": "Responder para o E-mail",
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "Microsoft Outlook": "Microsoft Outlook",
3
+ "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and ad": "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and add the given URL.\n8. Click **Register**.\n9. After registration, you’ll be redirected to the app’s overview page. Copy the **Application (client) ID**.\n10. From the left menu, go to **Certificates & secrets**.\n - Under **Client secrets**, click **New client secret**.\n - Provide a description, set an expiry, and click **Add**.\n - Copy the **Value** of the client secret (this will not be shown again).\n11. Go to **API permissions** from the left menu.\n - Click **Add a permission**.\n - Select **Microsoft Graph** → **Delegated permissions**.\n - Add the following scopes:\n - Mail.ReadWrite\n - Mail.Send\n\t - Calendars.Read\n\t - offline_access\n\t - User.Read\n - Click **Add permissions**.\n12. Copy your **Client ID** and **Client Secret**.\n",
3
4
  "Send Email": "Send Email",
4
5
  "Download Attachment": "Download Attachment",
5
6
  "Reply to Email": "Reply to Email",
package/src/i18n/zh.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "Microsoft Outlook": "Microsoft Outlook",
3
+ "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and ad": "\n1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).\n2. From the left sidebar, go to **Microsoft Enfra ID**.\n3. Under **Manage**, click on **App registrations**.\n4. Click the **New registration** button.\n5. Enter a **Name** for your app.\n6. For **Supported account types**, choose:\n - **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**\n - Or select based on your requirement.\n7. In **Redirect URI**, select **Web** and add the given URL.\n8. Click **Register**.\n9. After registration, you’ll be redirected to the app’s overview page. Copy the **Application (client) ID**.\n10. From the left menu, go to **Certificates & secrets**.\n - Under **Client secrets**, click **New client secret**.\n - Provide a description, set an expiry, and click **Add**.\n - Copy the **Value** of the client secret (this will not be shown again).\n11. Go to **API permissions** from the left menu.\n - Click **Add a permission**.\n - Select **Microsoft Graph** → **Delegated permissions**.\n - Add the following scopes:\n - Mail.ReadWrite\n - Mail.Send\n\t - Calendars.Read\n\t - offline_access\n\t - User.Read\n - Click **Add permissions**.\n12. Copy your **Client ID** and **Client Secret**.\n",
3
4
  "Send Email": "Send Email",
4
5
  "Download Attachment": "Download Attachment",
5
6
  "Reply to Email": "Reply to Email",
package/src/index.js CHANGED
@@ -5,22 +5,38 @@ const tslib_1 = require("tslib");
5
5
  const pieces_common_1 = require("@activepieces/pieces-common");
6
6
  const pieces_framework_1 = require("@activepieces/pieces-framework");
7
7
  const shared_1 = require("@activepieces/shared");
8
+ const add_label_to_email_1 = require("./lib/actions/add-label-to-email");
9
+ const create_draft_email_1 = require("./lib/actions/create-draft-email");
8
10
  const download_email_attachment_1 = require("./lib/actions/download-email-attachment");
11
+ const find_email_1 = require("./lib/actions/find-email");
12
+ const forward_email_1 = require("./lib/actions/forward-email");
13
+ const move_email_to_folder_1 = require("./lib/actions/move-email-to-folder");
14
+ const remove_label_from_email_1 = require("./lib/actions/remove-label-from-email");
15
+ const reply_email_1 = require("./lib/actions/reply-email");
16
+ const send_draft_email_1 = require("./lib/actions/send-draft-email");
9
17
  const send_email_1 = require("./lib/actions/send-email");
10
18
  const auth_1 = require("./lib/common/auth");
19
+ const new_attachment_1 = require("./lib/triggers/new-attachment");
20
+ const new_email_in_folder_1 = require("./lib/triggers/new-email-in-folder");
11
21
  const new_email_1 = require("./lib/triggers/new-email");
12
- const reply_email_1 = require("./lib/actions/reply-email");
13
22
  exports.microsoftOutlook = (0, pieces_framework_1.createPiece)({
14
23
  displayName: 'Microsoft Outlook',
15
24
  auth: auth_1.microsoftOutlookAuth,
16
25
  minimumSupportedRelease: '0.36.1',
17
- logoUrl: 'https://cdn.activepieces.com/pieces/outlook.png',
26
+ logoUrl: 'https://cdn.activepieces.com/pieces/microsoft-outlook.jpg',
18
27
  categories: [shared_1.PieceCategory.PRODUCTIVITY],
19
28
  authors: ['lucaslimasouza', 'kishanprmr'],
20
29
  actions: [
21
30
  send_email_1.sendEmailAction,
22
31
  download_email_attachment_1.downloadAttachmentAction,
23
32
  reply_email_1.replyEmailAction,
33
+ create_draft_email_1.createDraftEmailAction,
34
+ add_label_to_email_1.addLabelToEmailAction,
35
+ remove_label_from_email_1.removeLabelFromEmailAction,
36
+ move_email_to_folder_1.moveEmailToFolderAction,
37
+ send_draft_email_1.sendDraftEmailAction,
38
+ forward_email_1.forwardEmailAction,
39
+ find_email_1.findEmailAction,
24
40
  (0, pieces_common_1.createCustomApiCallAction)({
25
41
  auth: auth_1.microsoftOutlookAuth,
26
42
  baseUrl: () => 'https://graph.microsoft.com/v1.0/',
@@ -31,6 +47,10 @@ exports.microsoftOutlook = (0, pieces_framework_1.createPiece)({
31
47
  }),
32
48
  }),
33
49
  ],
34
- triggers: [new_email_1.newEmailTrigger],
50
+ triggers: [
51
+ new_email_1.newEmailTrigger,
52
+ new_email_in_folder_1.newEmailInFolderTrigger,
53
+ new_attachment_1.newAttachmentTrigger,
54
+ ],
35
55
  });
36
56
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/microsoft-outlook/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAAkF;AAClF,iDAAqD;AACrD,uFAAmF;AACnF,yDAA2D;AAC3D,4CAAyD;AACzD,wDAA2D;AAC3D,2DAA6D;AAChD,QAAA,gBAAgB,GAAG,IAAA,8BAAW,EAAC;IAC3C,WAAW,EAAE,mBAAmB;IAChC,IAAI,EAAE,2BAAoB;IAC1B,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,iDAAiD;IAC1D,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,CAAC;IACxC,OAAO,EAAE,CAAC,gBAAgB,EAAE,YAAY,CAAC;IACzC,OAAO,EAAE;QACR,4BAAe;QACf,oDAAwB;QACxB,8BAAgB;QAChB,IAAA,yCAAyB,EAAC;YACzB,IAAI,EAAE,2BAAoB;YAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,mCAAmC;YAClD,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC7B,aAAa,EAAE,UAAW,IAA4B,CAAC,YAAY,EAAE;iBACrE,CAAC,CAAA;cAAA;SACF,CAAC;KACF;IACD,QAAQ,EAAE,CAAC,2BAAe,CAAC;CAC3B,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/microsoft-outlook/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAAkF;AAClF,iDAAqD;AACrD,yEAAyE;AACzE,yEAA0E;AAC1E,uFAAmF;AACnF,yDAA2D;AAC3D,+DAAiE;AACjE,6EAA6E;AAC7E,mFAAmF;AACnF,2DAA6D;AAC7D,qEAAsE;AACtE,yDAA2D;AAC3D,4CAAyD;AACzD,kEAAqE;AACrE,4EAA6E;AAC7E,wDAA2D;AAE9C,QAAA,gBAAgB,GAAG,IAAA,8BAAW,EAAC;IAC3C,WAAW,EAAE,mBAAmB;IAChC,IAAI,EAAE,2BAAoB;IAC1B,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,2DAA2D;IACpE,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,CAAC;IACxC,OAAO,EAAE,CAAC,gBAAgB,EAAE,YAAY,CAAC;IACzC,OAAO,EAAE;QACR,4BAAe;QACf,oDAAwB;QACxB,8BAAgB;QAChB,2CAAsB;QACtB,0CAAqB;QACrB,oDAA0B;QAC1B,8CAAuB;QACvB,uCAAoB;QACpB,kCAAkB;QAClB,4BAAe;QACf,IAAA,yCAAyB,EAAC;YACzB,IAAI,EAAE,2BAAoB;YAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,mCAAmC;YAClD,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC7B,aAAa,EAAE,UAAW,IAA4B,CAAC,YAAY,EAAE;iBACrE,CAAC,CAAA;cAAA;SACF,CAAC;KACF;IACD,QAAQ,EAAE;QACT,2BAAe;QACf,6CAAuB;QACvB,qCAAoB;KACpB;CACD,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const addLabelToEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ messageId: import("@activepieces/pieces-framework").DropdownProperty<string | undefined, false> | import("@activepieces/pieces-framework").DropdownProperty<string | undefined, true>;
3
+ categories: import("@activepieces/pieces-framework").ArrayProperty<true>;
4
+ }>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addLabelToEmailAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
7
+ const auth_1 = require("../common/auth");
8
+ const props_1 = require("../common/props");
9
+ exports.addLabelToEmailAction = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.microsoftOutlookAuth,
11
+ name: 'addLabelToEmail',
12
+ displayName: 'Add Label to Email',
13
+ description: 'Adds a category (label) to an email message.',
14
+ props: {
15
+ messageId: (0, props_1.messageIdDropdown)({
16
+ displayName: 'Email',
17
+ description: 'Select the email message to add the label to.',
18
+ required: true,
19
+ }),
20
+ categories: pieces_framework_1.Property.Array({
21
+ displayName: 'Categories',
22
+ description: 'Categories to add to the email.',
23
+ required: true,
24
+ }),
25
+ },
26
+ run(context) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ const { messageId, categories } = context.propsValue;
29
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
30
+ authProvider: {
31
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
32
+ },
33
+ });
34
+ const message = yield client.api(`/me/messages/${messageId}`).get();
35
+ const existingCategories = message.categories || [];
36
+ const updatedCategories = [...new Set([...existingCategories, ...categories])];
37
+ const response = yield client.api(`/me/messages/${messageId}`).patch({
38
+ categories: updatedCategories,
39
+ });
40
+ return response;
41
+ });
42
+ },
43
+ });
44
+ //# sourceMappingURL=add-label-to-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-label-to-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/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,UAAU,EAAE,iBAAiB;aAC7B,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QACjB,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const createDraftEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ recipients: import("@activepieces/pieces-framework").ArrayProperty<true>;
3
+ ccRecipients: import("@activepieces/pieces-framework").ArrayProperty<false>;
4
+ bccRecipients: import("@activepieces/pieces-framework").ArrayProperty<false>;
5
+ subject: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
+ bodyFormat: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
7
+ body: import("@activepieces/pieces-framework").LongTextProperty<true>;
8
+ attachments: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
9
+ }>;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDraftEmailAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
7
+ const auth_1 = require("../common/auth");
8
+ exports.createDraftEmailAction = (0, pieces_framework_1.createAction)({
9
+ auth: auth_1.microsoftOutlookAuth,
10
+ name: 'createDraftEmail',
11
+ displayName: 'Create Draft Email',
12
+ description: 'Creates a draft email message.',
13
+ props: {
14
+ recipients: pieces_framework_1.Property.Array({
15
+ displayName: 'To Email(s)',
16
+ required: true,
17
+ }),
18
+ ccRecipients: pieces_framework_1.Property.Array({
19
+ displayName: 'CC Email(s)',
20
+ required: false,
21
+ defaultValue: [],
22
+ }),
23
+ bccRecipients: pieces_framework_1.Property.Array({
24
+ displayName: 'BCC Email(s)',
25
+ required: false,
26
+ defaultValue: [],
27
+ }),
28
+ subject: pieces_framework_1.Property.ShortText({
29
+ displayName: 'Subject',
30
+ required: true,
31
+ }),
32
+ bodyFormat: pieces_framework_1.Property.StaticDropdown({
33
+ displayName: 'Body Format',
34
+ required: true,
35
+ defaultValue: 'text',
36
+ options: {
37
+ disabled: false,
38
+ options: [
39
+ { label: 'HTML', value: 'html' },
40
+ { label: 'Text', value: 'text' },
41
+ ],
42
+ },
43
+ }),
44
+ body: pieces_framework_1.Property.LongText({
45
+ displayName: 'Body',
46
+ required: true,
47
+ }),
48
+ attachments: pieces_framework_1.Property.Array({
49
+ displayName: 'Attachments',
50
+ required: false,
51
+ defaultValue: [],
52
+ properties: {
53
+ file: pieces_framework_1.Property.File({
54
+ displayName: 'File',
55
+ required: true,
56
+ }),
57
+ fileName: pieces_framework_1.Property.ShortText({
58
+ displayName: 'File Name',
59
+ required: false,
60
+ }),
61
+ },
62
+ }),
63
+ },
64
+ run(context) {
65
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
66
+ const recipients = context.propsValue.recipients;
67
+ const ccRecipients = context.propsValue.ccRecipients;
68
+ const bccRecipients = context.propsValue.bccRecipients;
69
+ const attachments = context.propsValue.attachments;
70
+ const { subject, body, bodyFormat } = context.propsValue;
71
+ const mailPayload = {
72
+ subject,
73
+ body: {
74
+ content: body,
75
+ contentType: bodyFormat,
76
+ },
77
+ toRecipients: recipients.map((mail) => ({
78
+ emailAddress: {
79
+ address: mail,
80
+ },
81
+ })),
82
+ ccRecipients: ccRecipients.map((mail) => ({
83
+ emailAddress: {
84
+ address: mail,
85
+ },
86
+ })),
87
+ bccRecipients: bccRecipients.map((mail) => ({
88
+ emailAddress: {
89
+ address: mail,
90
+ },
91
+ })),
92
+ attachments: attachments.map((attachment) => ({
93
+ '@odata.type': '#microsoft.graph.fileAttachment',
94
+ name: attachment.fileName || attachment.file.filename,
95
+ contentBytes: attachment.file.base64,
96
+ })),
97
+ };
98
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
99
+ authProvider: {
100
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
101
+ },
102
+ });
103
+ const response = yield client.api('/me/messages').post(mailPayload);
104
+ return response;
105
+ });
106
+ },
107
+ });
108
+ //# sourceMappingURL=create-draft-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-draft-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-outlook/src/lib/actions/create-draft-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,8EAA2D;AAE3D,yCAAsD;AAEzC,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,gCAAgC;IAC7C,KAAK,EAAE;QACN,UAAU,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC1B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC5B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SAChB,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC7B,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACnC,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE;gBACR,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACR,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;oBAChC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;i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,IAAI;qBACb;iBACD,CAAC,CAAC;gBACH,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBAC3C,YAAY,EAAE;wBACb,OAAO,EAAE,IAAI;qBACb;iBACD,CAAC,CAAC;gBACH,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;oBAC7C,aAAa,EAAE,iCAAiC;oBAChD,IAAI,EAAE,UAAU,CAAC,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ;oBACrD,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM;iBACpC,CAAC,CAAC;aACH,CAAC;YAEF,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACxC,YAAY,EAAE;oBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBAChE;aACD,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAEpE,OAAO,QAAQ,CAAC;QACjB,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const findEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ searchQuery: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ folderId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
4
+ top: import("@activepieces/pieces-framework").NumberProperty<false>;
5
+ }>;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findEmailAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
7
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
8
+ const auth_1 = require("../common/auth");
9
+ const props_1 = require("../common/props");
10
+ exports.findEmailAction = (0, pieces_framework_1.createAction)({
11
+ auth: auth_1.microsoftOutlookAuth,
12
+ name: 'findEmail',
13
+ displayName: 'Find Email',
14
+ description: 'Searches for emails using full-text search.',
15
+ props: {
16
+ searchQuery: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Search Query',
18
+ description: 'Search terms to find emails (e.g., "from:john@example.com", "subject:urgent", "hasAttachments:true")',
19
+ required: true,
20
+ }),
21
+ folderId: (0, props_1.mailFolderIdDropdown)({
22
+ displayName: 'Folder',
23
+ description: 'Search in a specific folder. Leave empty to search all folders.',
24
+ required: false,
25
+ }),
26
+ top: pieces_framework_1.Property.Number({
27
+ displayName: 'Max Results',
28
+ description: 'Maximum number of results to return (1-1000).',
29
+ required: false,
30
+ defaultValue: 25,
31
+ }),
32
+ },
33
+ run(context) {
34
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
35
+ const { searchQuery, folderId, top } = context.propsValue;
36
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
37
+ authProvider: {
38
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
39
+ },
40
+ });
41
+ const baseUrl = folderId ? `/me/mailFolders/${folderId}/messages` : '/me/messages';
42
+ const searchParam = `$search="${searchQuery}"`;
43
+ const topParam = top ? `$top=${Math.min(Math.max(top, 1), 1000)}` : '$top=25';
44
+ const selectParam = ['id', 'subject', 'from', 'toRecipients', 'receivedDateTime'].join(',');
45
+ const queryParams = [searchParam, topParam, selectParam].filter(Boolean).join('&');
46
+ const url = `${baseUrl}?${queryParams}`;
47
+ const headers = {
48
+ ConsistencyLevel: 'eventual',
49
+ Prefer: 'outlook.body-content-type="text"',
50
+ };
51
+ const response = yield client.api(url).headers(headers).get();
52
+ const messages = response.value;
53
+ const nextPageUrl = response['@odata.nextLink'];
54
+ if (searchQuery) {
55
+ messages.sort((a, b) => (0, dayjs_1.default)(b.receivedDateTime).valueOf() - (0, dayjs_1.default)(a.receivedDateTime).valueOf());
56
+ }
57
+ return {
58
+ found: messages.length > 0,
59
+ result: messages,
60
+ hasMore: !!nextPageUrl,
61
+ nextPageUrl: nextPageUrl,
62
+ totalCount: messages.length,
63
+ };
64
+ });
65
+ },
66
+ });
67
+ //# sourceMappingURL=find-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-outlook/src/lib/actions/find-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,8EAA2E;AAE3E,0DAA0B;AAC1B,yCAAsD;AACtD,2CAAuD;AAE1C,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,6CAA6C;IAC1D,KAAK,EAAE;QACN,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,cAAc;YAC3B,WAAW,EACV,sGAAsG;YACvG,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,QAAQ,EAAE,IAAA,4BAAoB,EAAC;YAC9B,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,iEAAiE;YAC9E,QAAQ,EAAE,KAAK;SACf,CAAC;QACF,GAAG,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACpB,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,+CAA+C;YAC5D,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SAChB,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE1D,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,C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CAAC,IAAA,eAAK,EAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,OAAO,EAAE,GAAG,IAAA,eAAK,EAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,OAAO,EAAE,CACnF,CAAC;YACH,CAAC;YAED,OAAO;gBACN,KAAK,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC;gBAC1B,MAAM,EAAE,QAAQ;gBAChB,OAAO,EAAE,CAAC,CAAC,WAAW;gBACtB,WAAW,EAAE,WAAW;gBACxB,UAAU,EAAE,QAAQ,CAAC,MAAM;aAC3B,CAAC;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const forwardEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ messageId: import("@activepieces/pieces-framework").DropdownProperty<string | undefined, false> | import("@activepieces/pieces-framework").DropdownProperty<string | undefined, true>;
3
+ recipients: import("@activepieces/pieces-framework").ArrayProperty<true>;
4
+ comment: import("@activepieces/pieces-framework").LongTextProperty<false>;
5
+ }>;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.forwardEmailAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
7
+ const auth_1 = require("../common/auth");
8
+ const props_1 = require("../common/props");
9
+ exports.forwardEmailAction = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.microsoftOutlookAuth,
11
+ name: 'forwardEmail',
12
+ displayName: 'Forward Email',
13
+ description: 'Forwards an email message.',
14
+ props: {
15
+ messageId: (0, props_1.messageIdDropdown)({
16
+ displayName: 'Email',
17
+ description: 'Select the email message to forward.',
18
+ required: true,
19
+ }),
20
+ recipients: pieces_framework_1.Property.Array({
21
+ displayName: 'To Email(s)',
22
+ required: true,
23
+ }),
24
+ comment: pieces_framework_1.Property.LongText({
25
+ displayName: 'Comment',
26
+ description: 'Optional comment to include with the forwarded message.',
27
+ required: false,
28
+ }),
29
+ },
30
+ run(context) {
31
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
+ const { messageId, comment } = context.propsValue;
33
+ const recipients = context.propsValue.recipients;
34
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
35
+ authProvider: {
36
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
37
+ },
38
+ });
39
+ const message = yield client.api(`/me/messages/${messageId}`).get();
40
+ const messagePayload = {
41
+ toRecipients: recipients.map((mail) => ({
42
+ emailAddress: {
43
+ address: mail,
44
+ },
45
+ })),
46
+ body: {
47
+ contentType: 'html',
48
+ content: (comment !== null && comment !== void 0 ? comment : '') + '<br><br>' + message.body.content,
49
+ },
50
+ attachments: message.attachments,
51
+ };
52
+ const response = yield client
53
+ .api(`/me/messages/${messageId}/forward`)
54
+ .post({
55
+ message: messagePayload,
56
+ });
57
+ return Object.assign({ success: true, message: 'Email forwarded successfully.', messageId: response.id }, response);
58
+ });
59
+ },
60
+ });
61
+ //# sourceMappingURL=forward-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forward-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-outlook/src/lib/actions/forward-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,8EAA2D;AAE3D,yCAAsD;AACtD,2CAAoD;AAEvC,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,4BAA4B;IACzC,KAAK,EAAE;QACN,SAAS,EAAE,IAAA,yBAAiB,EAAC;YAC5B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,UAAU,EAAE,2BAA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O,EAAE,IAAI,EACb,OAAO,EAAE,+BAA+B,EACxC,SAAS,EAAE,QAAQ,CAAC,EAAE,IACnB,QAAQ,EACV;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const moveEmailToFolderAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ messageId: import("@activepieces/pieces-framework").DropdownProperty<string | undefined, false> | import("@activepieces/pieces-framework").DropdownProperty<string | undefined, true>;
3
+ destinationFolderId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
4
+ }>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.moveEmailToFolderAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
7
+ const auth_1 = require("../common/auth");
8
+ const props_1 = require("../common/props");
9
+ exports.moveEmailToFolderAction = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.microsoftOutlookAuth,
11
+ name: 'moveEmailToFolder',
12
+ displayName: 'Move Email to Folder',
13
+ description: 'Moves an email message to a specific folder.',
14
+ props: {
15
+ messageId: (0, props_1.messageIdDropdown)({
16
+ displayName: 'Email',
17
+ description: 'Select the email message to move.',
18
+ required: true,
19
+ }),
20
+ destinationFolderId: (0, props_1.mailFolderIdDropdown)({
21
+ displayName: 'Destination Folder',
22
+ description: 'The folder to move the email to.',
23
+ required: true,
24
+ }),
25
+ },
26
+ run(context) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ const { messageId, destinationFolderId } = context.propsValue;
29
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
30
+ authProvider: {
31
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
32
+ },
33
+ });
34
+ const response = yield client.api(`/me/messages/${messageId}/move`).post({
35
+ destinationId: destinationFolderId,
36
+ });
37
+ return response;
38
+ });
39
+ },
40
+ });
41
+ //# sourceMappingURL=move-email-to-folder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-email-to-folder.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-outlook/src/lib/actions/move-email-to-folder.ts"],"names":[],"mappings":";;;;AAAA,qEAA6F;AAC7F,8EAA2E;AAE3E,yCAAsD;AACtD,2CAA0E;AAE7D,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,8CAA8C;IAC3D,KAAK,EAAE;QACN,SAAS,EAAE,IAAA,yBAAiB,EAAC;YAC5B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,mBAAmB,EAAE,IAAA,4BAAoB,EAAC;YACzC,WAAW,EAAE,oBAAoB;YACjC,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE9D,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACxC,YAAY,EAAE;oBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBAChE;aACD,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,gBAAgB,SAAS,OAAO,CAAC,CAAC,IAAI,CAAC;gBACxE,aAAa,EAAE,mBAAmB;aAClC,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QACjB,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const removeLabelFromEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ messageId: import("@activepieces/pieces-framework").DropdownProperty<string | undefined, false> | import("@activepieces/pieces-framework").DropdownProperty<string | undefined, true>;
3
+ categories: import("@activepieces/pieces-framework").ArrayProperty<true>;
4
+ }>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeLabelFromEmailAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
7
+ const auth_1 = require("../common/auth");
8
+ const props_1 = require("../common/props");
9
+ exports.removeLabelFromEmailAction = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.microsoftOutlookAuth,
11
+ name: 'removeLabelFromEmail',
12
+ displayName: 'Remove Label from Email',
13
+ description: 'Removes a category (label) from an email message.',
14
+ props: {
15
+ messageId: (0, props_1.messageIdDropdown)({
16
+ displayName: 'Email',
17
+ description: 'Select the email message to remove the label from.',
18
+ required: true,
19
+ }),
20
+ categories: pieces_framework_1.Property.Array({
21
+ displayName: 'Categories to Remove',
22
+ description: 'Categories to remove from the email.',
23
+ required: true,
24
+ }),
25
+ },
26
+ run(context) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ const { messageId, categories } = context.propsValue;
29
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
30
+ authProvider: {
31
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
32
+ },
33
+ });
34
+ const message = yield client.api(`/me/messages/${messageId}`).get();
35
+ const existingCategories = message.categories || [];
36
+ const updatedCategories = existingCategories.filter((category) => !categories.includes(category));
37
+ const response = yield client.api(`/me/messages/${messageId}`).patch({
38
+ categories: updatedCategories,
39
+ });
40
+ return response;
41
+ });
42
+ },
43
+ });
44
+ //# sourceMappingURL=remove-label-from-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-label-from-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-outlook/src/lib/actions/remove-label-from-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,8EAA2D;AAC3D,yCAAsD;AACtD,2CAAoD;AAEvC,QAAA,0BAA0B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,mDAAmD;IAChE,KAAK,EAAE;QACN,SAAS,EAAE,IAAA,yBAAiB,EAAC;YAC5B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,oDAAoD;YACjE,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC1B,WAAW,EAAE,sBAAsB;YACnC,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAErD,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACxC,YAAY,EAAE;oBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBAChE;aACD,CAAC,CAAC;YAEH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,gBAAgB,SAAS,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;YACpE,MAAM,kBAAkB,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;YAEpD,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,MAAM,CAClD,CAAC,QAAgB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACpD,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,gBAAgB,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC;gBACpE,UAAU,EAAE,iBAAiB;aAC7B,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QACjB,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export declare const replyEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- messageId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
2
+ messageId: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
3
3
  bodyFormat: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
4
4
  replyBody: import("@activepieces/pieces-framework").LongTextProperty<true>;
5
5
  ccRecipients: import("@activepieces/pieces-framework").ArrayProperty<false>;
@@ -11,9 +11,47 @@ exports.replyEmailAction = (0, pieces_framework_1.createAction)({
11
11
  displayName: 'Reply to Email',
12
12
  description: 'Reply to an outlook email.',
13
13
  props: {
14
- messageId: pieces_framework_1.Property.ShortText({
15
- displayName: 'Message ID',
14
+ messageId: pieces_framework_1.Property.Dropdown({
15
+ displayName: 'Email',
16
+ description: 'Select the email message to reply to.',
16
17
  required: true,
18
+ refreshers: [],
19
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
20
+ if (!auth) {
21
+ return {
22
+ disabled: true,
23
+ options: [],
24
+ };
25
+ }
26
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
27
+ authProvider: {
28
+ getAccessToken: () => Promise.resolve(auth.access_token),
29
+ },
30
+ });
31
+ try {
32
+ const response = yield client
33
+ .api('/me/messages?$top=50&$select=id,subject,from,receivedDateTime')
34
+ .orderby('receivedDateTime desc')
35
+ .get();
36
+ const messages = response.value;
37
+ return {
38
+ disabled: false,
39
+ options: messages.map((message) => {
40
+ var _a, _b, _c, _d;
41
+ return ({
42
+ label: `${message.subject || 'No Subject'} - ${((_b = (_a = message.from) === null || _a === void 0 ? void 0 : _a.emailAddress) === null || _b === void 0 ? void 0 : _b.name) || ((_d = (_c = message.from) === null || _c === void 0 ? void 0 : _c.emailAddress) === null || _d === void 0 ? void 0 : _d.address) || 'Unknown Sender'}`,
43
+ value: message.id || '',
44
+ });
45
+ }),
46
+ };
47
+ }
48
+ catch (error) {
49
+ return {
50
+ disabled: true,
51
+ options: [],
52
+ };
53
+ }
54
+ }),
17
55
  }),
18
56
  bodyFormat: pieces_framework_1.Property.StaticDropdown({
19
57
  displayName: 'Body Format',
@@ -1 +1 @@
1
- {"version":3,"file":"reply-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-outlook/src/lib/actions/reply-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,yCAAsD;AAEtD,8EAA2D;AAE9C,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,4BAA4B;IACzC,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAClC,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE;gBACP,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;oBAChC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;iBACjC;aACF;SACF,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC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L,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,6BAA6B;oBACtC,OAAO,EAAE,OAAO;oBAChB,SAAS,EAAE,6CAA6C,OAAO,EAAE;iBAClE,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;gBAC3C,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;gBAC3D,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"reply-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-outlook/src/lib/actions/reply-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAqG;AACrG,yCAAsD;AAEtD,8EAA2E;AAE9D,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,4BAA4B;IACzC,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC3B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,EAAE;YACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;gBACtB,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,OAAO;wBACL,QAAQ,EAAE,IAAI;wBACd,OAAO,EAAE,EAAE;qBACZ,CAAC;gBACJ,CAAC;gBAED,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;oBACvC,YAAY,EAAE;wBACZ,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAE,IAA4B,C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,6BAA6B;oBACtC,OAAO,EAAE,OAAO;oBAChB,SAAS,EAAE,6CAA6C,OAAO,EAAE;iBAClE,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;gBAC3C,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;gBAC3D,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const sendDraftEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ messageId: import("@activepieces/pieces-framework").DropdownProperty<string | undefined, false> | import("@activepieces/pieces-framework").DropdownProperty<string | undefined, true>;
3
+ }>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendDraftEmailAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
7
+ const auth_1 = require("../common/auth");
8
+ const props_1 = require("../common/props");
9
+ exports.sendDraftEmailAction = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.microsoftOutlookAuth,
11
+ name: 'sendDraftEmail',
12
+ displayName: 'Send Draft Email',
13
+ description: 'Sends a draft email message.',
14
+ props: {
15
+ messageId: (0, props_1.draftMessageIdDropdown)({
16
+ displayName: 'Draft Email',
17
+ description: 'Select the draft email message to send.',
18
+ required: true,
19
+ }),
20
+ },
21
+ run(context) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ const { messageId } = context.propsValue;
24
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
25
+ authProvider: {
26
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
27
+ },
28
+ });
29
+ yield client.api(`/me/messages/${messageId}/send`).post({});
30
+ return {
31
+ success: true,
32
+ message: 'Draft sent successfully.',
33
+ messageId: messageId,
34
+ };
35
+ });
36
+ },
37
+ });
38
+ //# sourceMappingURL=send-draft-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-draft-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-outlook/src/lib/actions/send-draft-email.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,8EAA2D;AAC3D,yCAAsD;AACtD,2CAAyD;AAE5C,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,8BAA8B;IAC3C,KAAK,EAAE;QACN,SAAS,EAAE,IAAA,8BAAsB,EAAC;YACjC,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEzC,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACxC,YAAY,EAAE;oBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBAChE;aACD,CAAC,CAAC;YAEH,MAAM,MAAM,CAAC,GAAG,CAAC,gBAAgB,SAAS,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAE5D,OAAO;gBACN,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,0BAA0B;gBACnC,SAAS,EAAE,SAAS;aACpB,CAAC;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ type DropdownParams = {
2
+ displayName: string;
3
+ description: string;
4
+ required: boolean;
5
+ };
6
+ export declare const messageIdDropdown: (params: DropdownParams) => import("@activepieces/pieces-framework").DropdownProperty<string | undefined, false> | import("@activepieces/pieces-framework").DropdownProperty<string | undefined, true>;
7
+ export declare const draftMessageIdDropdown: (params: DropdownParams) => import("@activepieces/pieces-framework").DropdownProperty<string | undefined, false> | import("@activepieces/pieces-framework").DropdownProperty<string | undefined, true>;
8
+ export declare const mailFolderIdDropdown: (params: DropdownParams) => import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
9
+ export {};
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mailFolderIdDropdown = exports.draftMessageIdDropdown = exports.messageIdDropdown = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
7
+ const messageIdDropdown = (params) => pieces_framework_1.Property.Dropdown({
8
+ displayName: params.displayName,
9
+ description: params.description,
10
+ required: params.required,
11
+ refreshers: [],
12
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
13
+ if (!auth) {
14
+ return {
15
+ placeholder: 'Please connect your account first.',
16
+ disabled: true,
17
+ options: [],
18
+ };
19
+ }
20
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
21
+ authProvider: {
22
+ getAccessToken: () => Promise.resolve(auth.access_token),
23
+ },
24
+ });
25
+ try {
26
+ const response = yield client
27
+ .api('/me/messages?$top=50&$select=id,subject,from,receivedDateTime')
28
+ .orderby('receivedDateTime desc')
29
+ .get();
30
+ const messages = response.value;
31
+ return {
32
+ disabled: false,
33
+ options: messages.map((message) => ({
34
+ label: `${message.subject || 'No Subject'}`,
35
+ value: message.id,
36
+ })),
37
+ };
38
+ }
39
+ catch (error) {
40
+ return {
41
+ disabled: true,
42
+ options: [],
43
+ };
44
+ }
45
+ }),
46
+ });
47
+ exports.messageIdDropdown = messageIdDropdown;
48
+ const draftMessageIdDropdown = (params) => pieces_framework_1.Property.Dropdown({
49
+ displayName: params.displayName,
50
+ description: params.description,
51
+ required: params.required,
52
+ refreshers: [],
53
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
54
+ if (!auth) {
55
+ return {
56
+ placeholder: 'Please connect your account first.',
57
+ disabled: true,
58
+ options: [],
59
+ };
60
+ }
61
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
62
+ authProvider: {
63
+ getAccessToken: () => Promise.resolve(auth.access_token),
64
+ },
65
+ });
66
+ try {
67
+ const response = yield client
68
+ .api('/me/mailFolders/drafts/messages?$top=50&$select=id,subject,from,receivedDateTime')
69
+ .orderby('receivedDateTime desc')
70
+ .get();
71
+ const messages = response.value;
72
+ return {
73
+ disabled: false,
74
+ options: messages.map((message) => ({
75
+ label: `${message.subject || 'No Subject'}`,
76
+ value: message.id,
77
+ })),
78
+ };
79
+ }
80
+ catch (error) {
81
+ return {
82
+ disabled: true,
83
+ options: [],
84
+ };
85
+ }
86
+ }),
87
+ });
88
+ exports.draftMessageIdDropdown = draftMessageIdDropdown;
89
+ const mailFolderIdDropdown = (params) => pieces_framework_1.Property.Dropdown({
90
+ displayName: params.displayName,
91
+ description: params.description,
92
+ required: params.required,
93
+ refreshers: [],
94
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
95
+ if (!auth) {
96
+ return {
97
+ placeholder: 'Please connect your account first.',
98
+ disabled: true,
99
+ options: [],
100
+ };
101
+ }
102
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
103
+ authProvider: {
104
+ getAccessToken: () => Promise.resolve(auth.access_token),
105
+ },
106
+ });
107
+ try {
108
+ const response = yield client.api('/me/mailFolders').get();
109
+ const folders = response.value;
110
+ return {
111
+ disabled: false,
112
+ options: folders.map((folder) => ({
113
+ label: folder.displayName || folder.id || 'Unknown',
114
+ value: folder.id || '',
115
+ })),
116
+ };
117
+ }
118
+ catch (error) {
119
+ return {
120
+ disabled: true,
121
+ options: [],
122
+ };
123
+ }
124
+ }),
125
+ });
126
+ exports.mailFolderIdDropdown = mailFolderIdDropdown;
127
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-outlook/src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,qEAA+E;AAC/E,8EAA2E;AASpE,MAAM,iBAAiB,GAAG,CAAC,MAAsB,EAAE,EAAE,CAC3D,2BAAQ,CAAC,QAAQ,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC,WAAW;IAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;IAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;IACzB,UAAU,EAAE,EAAE;IACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC,IAAI,EAAE,CAAC;YACX,OAAO;gBACN,WAAW,EAAE,oCAAoC;gBACjD,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;aACX,CAAC;QACH,CAAC;QAED,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;YACxC,YAAY,EAAE;gBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAE,IAA4B,CAAC,YAAY,CAAC;aACjF;SACD,CAAC,CAAC;QAEH,IAAI,CAAC;YACJ,MAAM,QAAQ,GAAmB,MAAM,MAAM;iBAC3C,GAAG,CAAC,+DAA+D,CAAC;iBACpE,OAAO,CAAC,uBAAuB,CAAC;iBAChC,GAAG,EAAE,CAAC;YAER,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAkB,CAAC;YAE7C,OAAO;gBACN,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,QA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,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;oBACjC,KAAK,EAAE,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,EAAE,IAAI,SAAS;oBACnD,KAAK,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE;iBACtB,CAAC,CAAC;aACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO;gBACN,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;aACX,CAAC;QACH,CAAC;IACF,CAAC,CAAA;CACD,CAAC,CAAC;AAxCS,QAAA,oBAAoB,wBAwC7B"}
@@ -0,0 +1,8 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const newAttachmentTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
3
+ folderId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
4
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
5
+ folderId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
6
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
7
+ folderId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
8
+ }>;
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newAttachmentTrigger = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
7
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
8
+ const auth_1 = require("../common/auth");
9
+ const props_1 = require("../common/props");
10
+ const shared_1 = require("@activepieces/shared");
11
+ function enrichAttachments(client, messages, files) {
12
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
+ const attachments = [];
14
+ for (const message of messages) {
15
+ const attachmentResponse = yield client
16
+ .api(`/me/messages/${message.id}/attachments`)
17
+ .get();
18
+ for (const attachment of attachmentResponse.value) {
19
+ const { contentBytes } = attachment, rest = tslib_1.__rest(attachment, ["contentBytes"]);
20
+ if (attachment.name && contentBytes) {
21
+ const file = yield files.write({
22
+ fileName: attachment.name,
23
+ data: Buffer.from(contentBytes, 'base64'),
24
+ });
25
+ attachments.push(Object.assign({ file, messageId: message.id, messageSubject: message.subject, messageSender: message.sender, messageReceivedDateTime: message.receivedDateTime, parentFolderId: message.parentFolderId }, rest));
26
+ }
27
+ }
28
+ }
29
+ return attachments;
30
+ });
31
+ }
32
+ exports.newAttachmentTrigger = (0, pieces_framework_1.createTrigger)({
33
+ auth: auth_1.microsoftOutlookAuth,
34
+ name: 'newAttachment',
35
+ displayName: 'New Attachment',
36
+ description: 'Triggers when a new email containing one or more attachments arrives.',
37
+ props: {
38
+ folderId: (0, props_1.mailFolderIdDropdown)({
39
+ displayName: 'Folder',
40
+ description: 'Monitor attachments in a specific folder. Leave empty to monitor all folders.',
41
+ required: false,
42
+ }),
43
+ },
44
+ sampleData: {},
45
+ type: pieces_framework_1.TriggerStrategy.POLLING,
46
+ onEnable(context) {
47
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
48
+ yield context.store.put('lastPoll', Date.now());
49
+ });
50
+ },
51
+ onDisable(context) {
52
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
+ // return
54
+ });
55
+ },
56
+ test(context) {
57
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
58
+ const { folderId } = context.propsValue;
59
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
60
+ authProvider: {
61
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
62
+ },
63
+ });
64
+ const baseUrl = folderId ? `/me/mailFolders/${folderId}/messages` : '/me/messages';
65
+ const response = yield client
66
+ .api(`${baseUrl}?$filter=hasAttachments eq true`)
67
+ .top(10)
68
+ .get();
69
+ const attachments = yield enrichAttachments(client, response.value, context.files);
70
+ const items = attachments.map((attachment) => ({
71
+ epochMilliSeconds: (0, dayjs_1.default)(attachment['messageReceivedDateTime']).valueOf(),
72
+ data: attachment,
73
+ }));
74
+ return items.map((item) => item.data);
75
+ });
76
+ },
77
+ run(context) {
78
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
79
+ const lastFetchEpochMS = yield context.store.get('lastPoll');
80
+ if ((0, shared_1.isNil)(lastFetchEpochMS)) {
81
+ throw new Error("lastPoll doesn't exist in the store.");
82
+ }
83
+ const { folderId } = context.propsValue;
84
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
85
+ authProvider: {
86
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
87
+ },
88
+ });
89
+ const baseUrl = folderId ? `/me/mailFolders/${folderId}/messages` : '/me/messages';
90
+ let response = yield client
91
+ .api(`${baseUrl}?$filter=receivedDateTime gt ${(0, dayjs_1.default)(lastFetchEpochMS).toISOString()} and hasAttachments eq true`)
92
+ .orderby('receivedDateTime desc')
93
+ .get();
94
+ const messages = [];
95
+ while (response.value.length > 0) {
96
+ messages.push(...response.value);
97
+ if (response['@odata.nextLink']) {
98
+ response = yield client.api(response['@odata.nextLink']).get();
99
+ }
100
+ else {
101
+ break;
102
+ }
103
+ }
104
+ const attachments = yield enrichAttachments(client, messages, context.files);
105
+ const items = attachments.map((attachment) => ({
106
+ epochMilliSeconds: (0, dayjs_1.default)(attachment['messageReceivedDateTime']).valueOf(),
107
+ data: attachment,
108
+ }));
109
+ const newLastEpochMilliSeconds = items.reduce((acc, item) => Math.max(acc, item.epochMilliSeconds), lastFetchEpochMS);
110
+ yield context.store.put('lastPoll', newLastEpochMilliSeconds);
111
+ return items.filter((f) => f.epochMilliSeconds > lastFetchEpochMS).map((item) => item.data);
112
+ });
113
+ },
114
+ });
115
+ //# sourceMappingURL=new-attachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-attachment.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-outlook/src/lib/triggers/new-attachment.ts"],"names":[],"mappings":";;;;AAAA,qEAA8F;AAC9F,8EAA2E;AAE3E,0DAA0B;AAC1B,yCAAsD;AACtD,2CAAuD;AACvD,iDAA6C;AAE7C,SAAe,iBAAiB,CAC/B,MAAc,EACd,QAAmB,EACnB,KAAmB;;QAEnB,MAAM,WAAW,GAA0B,EAAE,CAAC;QAE9C,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAChC,MAAM,kBAAkB,GAAmB,MAAM,MAAM;iBACrD,GAAG,CAAC,gBAAgB,OAAO,CAAC,EAAE,cAAc,CAAC;iBAC7C,GAAG,EAAE,CAAC;YAER,KAAK,MAAM,UAAU,IAAI,kBAAkB,CAAC,KAAyB,EAAE,CAAC;gBACvE,MAAM,EAAE,YAAY,KAAc,UAAU,EAAnB,IAAI,kBAAK,UAAU,EAAtC,gBAAyB,CAAa,CAAC;gBAE7C,IAAI,UAAU,CAAC,IAAI,IAAI,YAAY,EAAE,CAAC;oBACrC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC;wBAC9B,QAAQ,EAAE,UAAU,CAAC,IAAI;wBACzB,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC;qBACzC,CAAC,CAAC;oBAEH,WAAW,CAAC,IAAI,iBACf,IAAI,EACJ,SAAS,EAAE,OAAO,CAAC,EAAG,EACtB,cAAc,EAAE,OAAO,CAAC,OAAO,EAC/B,aAAa,EAAE,OAAO,CAAC,MAAM,EAC7B,uBAAuB,EAAE,OAAO,CAAC,gBAAgB,EACjD,cAAc,EAAE,OAAO,CA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 export declare const newEmailInFolderTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
3
+ folderId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
4
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
5
+ folderId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
6
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
7
+ folderId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
8
+ }>;
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newEmailInFolderTrigger = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
8
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
9
+ const auth_1 = require("../common/auth");
10
+ const props_1 = require("../common/props");
11
+ const polling = {
12
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
13
+ items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, lastFetchEpochMS, propsValue }) {
14
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
15
+ authProvider: {
16
+ getAccessToken: () => Promise.resolve(auth.access_token),
17
+ },
18
+ });
19
+ const messages = [];
20
+ const folderId = propsValue.folderId;
21
+ const filter = lastFetchEpochMS === 0
22
+ ? '$top=10'
23
+ : `$filter=createdDateTime gt ${(0, dayjs_1.default)(lastFetchEpochMS).toISOString()}`;
24
+ let response = yield client
25
+ .api(`/me/mailFolders/${folderId}/messages?${filter}`)
26
+ .orderby('createdDateTime desc')
27
+ .get();
28
+ if (lastFetchEpochMS === 0) {
29
+ for (const message of response.value) {
30
+ messages.push(message);
31
+ }
32
+ }
33
+ else {
34
+ while (response.value.length > 0) {
35
+ for (const message of response.value) {
36
+ messages.push(message);
37
+ }
38
+ if (response['@odata.nextLink']) {
39
+ response = yield client.api(response['@odata.nextLink']).get();
40
+ }
41
+ else {
42
+ break;
43
+ }
44
+ }
45
+ }
46
+ return messages.map((message) => ({
47
+ epochMilliSeconds: (0, dayjs_1.default)(message.createdDateTime).valueOf(),
48
+ data: message,
49
+ }));
50
+ }),
51
+ };
52
+ exports.newEmailInFolderTrigger = (0, pieces_framework_1.createTrigger)({
53
+ auth: auth_1.microsoftOutlookAuth,
54
+ name: 'newEmailInFolder',
55
+ displayName: 'New Email in Folder',
56
+ description: 'Triggers when a new email is delivered into the specified folder.',
57
+ props: {
58
+ folderId: (0, props_1.mailFolderIdDropdown)({
59
+ displayName: 'Folder',
60
+ description: '',
61
+ required: true,
62
+ }),
63
+ },
64
+ sampleData: {},
65
+ type: pieces_framework_1.TriggerStrategy.POLLING,
66
+ onEnable(context) {
67
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
68
+ yield pieces_common_1.pollingHelper.onEnable(polling, {
69
+ auth: context.auth,
70
+ store: context.store,
71
+ propsValue: context.propsValue,
72
+ });
73
+ });
74
+ },
75
+ onDisable(context) {
76
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
77
+ yield pieces_common_1.pollingHelper.onDisable(polling, {
78
+ auth: context.auth,
79
+ store: context.store,
80
+ propsValue: context.propsValue,
81
+ });
82
+ });
83
+ },
84
+ test(context) {
85
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
86
+ return yield pieces_common_1.pollingHelper.test(polling, context);
87
+ });
88
+ },
89
+ run(context) {
90
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
91
+ return yield pieces_common_1.pollingHelper.poll(polling, context);
92
+ });
93
+ },
94
+ });
95
+ //# sourceMappingURL=new-email-in-folder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-email-in-folder.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-outlook/src/lib/triggers/new-email-in-folder.ts"],"names":[],"mappings":";;;;AAAA,+DAAqF;AACrF,qEAIwC;AACxC,8EAA2E;AAE3E,0DAA0B;AAC1B,yCAAsD;AACtD,2CAAuD;AAEvD,MAAM,OAAO,GAAsF;IAClG,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE;QACnD,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;YACxC,YAAY,EAAE;gBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;aACxD;SACD,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,EAAE,CAAC;QACpB,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QAErC,MAAM,MAAM,GACX,gBAAgB,KAAK,CAAC;YACrB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,8BAA8B,IAAA,eAAK,EAAC,gBAAgB,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QAE1E,IAAI,QAAQ,GAAmB,MAAM,MAAM;aACzC,GAAG,CAAC,mBAAmB,QAAQ,aAAa,MAAM,EAAE,CAAC;aACrD,OAAO,CAAC,sBAAsB,CAAC;aAC/B,GAAG,EAAE,CAAC;QAER,IAAI,gBAAgB,KAAK,CAAC,EAAE,CAAC;YAC5B,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,KAAkB,EAAE,CAAC;gBACnD,QAAQ,CAAC,IAAI,CAAC,OAAO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