Add Activepieces integration for workflow automation

- Add Activepieces fork with SmoothSchedule custom piece
- Create integrations app with Activepieces service layer
- Add embed token endpoint for iframe integration
- Create Automations page with embedded workflow builder
- Add sidebar visibility fix for embed mode
- Add list inactive customers endpoint to Public API
- Include SmoothSchedule triggers: event created/updated/cancelled
- Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
poduck
2025-12-18 22:59:37 -05:00
parent 9848268d34
commit 3aa7199503
16292 changed files with 1284892 additions and 4708 deletions

View File

@@ -0,0 +1,18 @@
{
"extends": ["../../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

View File

@@ -0,0 +1,7 @@
# pieces-microsoft-onedrive
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build pieces-microsoft-onedrive` to build the library.

View File

@@ -0,0 +1,8 @@
{
"name": "@activepieces/piece-microsoft-onedrive",
"version": "0.0.25",
"dependencies": {
"@microsoft/microsoft-graph-client": "3.0.7",
"@microsoft/microsoft-graph-types": "2.40.0"
}
}

View File

@@ -0,0 +1,57 @@
{
"name": "pieces-microsoft-onedrive",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/pieces/community/microsoft-onedrive/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": [
"{options.outputPath}"
],
"options": {
"outputPath": "dist/packages/pieces/community/microsoft-onedrive",
"tsConfig": "packages/pieces/community/microsoft-onedrive/tsconfig.lib.json",
"packageJson": "packages/pieces/community/microsoft-onedrive/package.json",
"main": "packages/pieces/community/microsoft-onedrive/src/index.ts",
"assets": [
"packages/pieces/community/microsoft-onedrive/*.md",
{
"input": "packages/pieces/community/microsoft-onedrive/src/i18n",
"output": "./src/i18n",
"glob": "**/!(i18n.json)"
}
],
"buildableProjectDepsInPackageJsonType": "dependencies",
"updateBuildableProjectDepsInPackageJson": true
},
"dependsOn": [
"^build",
"prebuild"
]
},
"publish": {
"command": "node tools/scripts/publish.mjs pieces-microsoft-onedrive {args.ver} {args.tag}",
"dependsOn": [
"build"
]
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": [
"{options.outputFile}"
]
},
"prebuild": {
"executor": "nx:run-commands",
"options": {
"cwd": "packages/pieces/community/microsoft-onedrive",
"command": "bun install --no-save --silent"
},
"dependsOn": [
"^build"
]
}
},
"tags": []
}

View File

@@ -0,0 +1,40 @@
{
"Cloud storage by Microsoft": "Cloud-Speicher von Microsoft",
"\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 **Application (Client) ID**.\n10. Vom linken Menü gehen Sie zu **Zertifikate & Geheimnisse**.\n - Unter **Kundengeheimnis**, klicke **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 - Dateien. eadWrite\n - offline_access \n - Klicken Sie auf **Berechtigungen hinzufügen**.\n12. Kopieren Sie Ihre **Client-ID** und **Client-Geheimnis**.\n",
"Upload file": "Datei hochladen",
"Download file": "Datei herunterladen",
"List Files": "Dateien auflisten",
"List Folders": "Listen-Ordner",
"Custom API Call": "Eigener API-Aufruf",
"Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB": "Laden Sie eine Datei auf Ihr Microsoft OneDrive mit gechunktem Upload hoch, wenn die Datei größer als 4MiB ist",
"Download a file from your Microsoft OneDrive": "Laden Sie eine Datei von Ihrem Microsoft OneDrive herunter",
"List files in a OneDrive folder": "Dateien in einem OneDrive Ordner auflisten",
"List folders in a OneDrive folder": "Ordner in einem OneDrive Ordner auflisten",
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
"File name": "Dateiname",
"File": "Datei",
"Markdown": "Markdown",
"Parent Folder": "Eltern-Ordner",
"File ID": "Datei-ID",
"Method": "Methode",
"Headers": "Kopfzeilen",
"Query Parameters": "Abfrageparameter",
"Body": "Körper",
"Response is Binary ?": "Antwort ist binär?",
"No Error on Failure": "Kein Fehler bei Fehler",
"Timeout (in seconds)": "Timeout (in Sekunden)",
"The name the file should be saved as (e.g. file.txt)": "Der Name, unter dem die Datei gespeichert werden soll (z.B. file.txt)",
"The file URL or base64 to upload": "Die URL oder base64 hochzuladen",
"**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ": "**Notiz**: Wenn du den Ordner nicht in der Dropdown-Liste finden kannst (welche bis zu 1000 Ordner abruft) Bitte klicken Sie auf das **(F)** und geben Sie die Ordner-ID direkt ein.\n\n\n du findest die Ordner-ID in der OneDrive URL nach **?id=**, e. ., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ",
"The ID of the file to download": "Die ID der herunterzuladenden Datei",
"Authorization headers are injected automatically from your connection.": "Autorisierungs-Header werden automatisch von Ihrer Verbindung injiziert.",
"Enable for files like PDFs, images, etc..": "Aktivieren für Dateien wie PDFs, Bilder, etc..",
"GET": "ERHALTEN",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "LÖSCHEN",
"HEAD": "HEAD",
"New File": "Neue Datei",
"Trigger when a new file is uploaded.": "Auslösen wenn eine neue Datei hochgeladen wird."
}

View File

@@ -0,0 +1,40 @@
{
"Cloud storage by Microsoft": "Almacenamiento en la nube por Microsoft",
"\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, youll be redirected to the apps 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 - Files.ReadWrite\n - offline_access\n - Click **Add permissions**.\n12. Copy your **Client ID** and **Client Secret**.\n",
"Upload file": "Subir archivo",
"Download file": "Descargar archivo",
"List Files": "Listar archivos",
"List Folders": "Listar Carpetas",
"Custom API Call": "Llamada API personalizada",
"Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB": "Sube un archivo a tu Microsoft OneDrive con la carga de trozos si el archivo es mayor de 4MiB",
"Download a file from your Microsoft OneDrive": "Descargue un archivo de su Microsoft OneDrive",
"List files in a OneDrive folder": "Listar archivos en una carpeta OneDrive",
"List folders in a OneDrive folder": "Listar carpetas en una carpeta OneDrive",
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
"File name": "Nombre del archivo",
"File": "Archivo",
"Markdown": "Markdown",
"Parent Folder": "Carpeta padre",
"File ID": "ID de archivo",
"Method": "Método",
"Headers": "Encabezados",
"Query Parameters": "Parámetros de consulta",
"Body": "Cuerpo",
"Response is Binary ?": "¿Respuesta es binaria?",
"No Error on Failure": "No hay ningún error en fallo",
"Timeout (in seconds)": "Tiempo de espera (en segundos)",
"The name the file should be saved as (e.g. file.txt)": "El nombre del archivo debe guardarse como (ej: archivo.txt)",
"The file URL or base64 to upload": "La URL del archivo o base64 a subir",
"**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ": "**Nota**: Si no puedes encontrar la carpeta en la lista desplegable (que obtiene hasta 1000 carpetas), por favor haga clic en el **(F)** y escriba el ID de la carpeta directamente.\n\n\n puedes encontrar el ID de la carpeta en la URL de OneDrive después de **?id=**, e. ., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ",
"The ID of the file to download": "El ID del archivo a descargar",
"Authorization headers are injected automatically from your connection.": "Las cabeceras de autorización se inyectan automáticamente desde tu conexión.",
"Enable for files like PDFs, images, etc..": "Activar para archivos como PDFs, imágenes, etc.",
"GET": "RECOGER",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "BORRAR",
"HEAD": "LIMPIO",
"New File": "Nuevo archivo",
"Trigger when a new file is uploaded.": "Activar cuando se sube un nuevo archivo."
}

View File

@@ -0,0 +1,40 @@
{
"Cloud storage by Microsoft": "Stockage dans le cloud par Microsoft",
"\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, youll be redirected to the apps 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 - Files.ReadWrite\n - offline_access\n - Click **Add permissions**.\n12. Copy your **Client ID** and **Client Secret**.\n",
"Upload file": "Charger un fichier",
"Download file": "Télécharger le fichier",
"List Files": "Lister les fichiers",
"List Folders": "Lister les dossiers",
"Custom API Call": "Appel API personnalisé",
"Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB": "Téléchargez un fichier sur votre Microsoft OneDrive avec un téléchargement chunked si le fichier est plus grand que 4MiB",
"Download a file from your Microsoft OneDrive": "Téléchargez un fichier depuis votre OneDrive Microsoft",
"List files in a OneDrive folder": "Liste les fichiers dans un dossier OneDrive",
"List folders in a OneDrive folder": "Lister les dossiers dans un dossier OneDrive",
"Make a custom API call to a specific endpoint": "Passez un appel API personnalisé à un point de terminaison spécifique",
"File name": "Nom du fichier",
"File": "Ficher",
"Markdown": "Markdown",
"Parent Folder": "Dossier parent",
"File ID": "ID du fichier",
"Method": "Méthode",
"Headers": "En-têtes",
"Query Parameters": "Paramètres de requête",
"Body": "Corps",
"Response is Binary ?": "La réponse est Binaire ?",
"No Error on Failure": "Aucune erreur en cas d'échec",
"Timeout (in seconds)": "Délai d'attente (en secondes)",
"The name the file should be saved as (e.g. file.txt)": "Le nom du fichier doit être enregistré (par exemple file.txt)",
"The file URL or base64 to upload": "L'URL du fichier ou base64 à télécharger",
"**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ": "**Note**: Si vous ne trouvez pas le dossier dans la liste déroulante (qui récupère jusqu'à 1000 dossiers), cliquez sur le **(F)** et tapez l'ID du dossier directement.\n\n\n vous pouvez trouver l'ID du dossier dans l'URL de OneDrive après **?id=**, e. ., \"onedrive.live.com/?id=**folder-id**&cid=une-other-id\"\n\n ",
"The ID of the file to download": "L'ID du fichier à télécharger",
"Authorization headers are injected automatically from your connection.": "Les en-têtes d'autorisation sont injectés automatiquement à partir de votre connexion.",
"Enable for files like PDFs, images, etc..": "Activer pour les fichiers comme les PDFs, les images, etc.",
"GET": "OBTENIR",
"POST": "POSTER",
"PATCH": "PATCH",
"PUT": "EFFACER",
"DELETE": "SUPPRIMER",
"HEAD": "HEAD",
"New File": "Nouveau fichier",
"Trigger when a new file is uploaded.": "Déclencher quand un nouveau fichier est téléchargé."
}

View File

@@ -0,0 +1,40 @@
{
"Cloud storage by Microsoft": "マイクロソフトによるクラウドストレージ",
"\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, youll be redirected to the apps 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 - Files.ReadWrite\n - offline_access\n - Click **Add permissions**.\n12. Copy your **Client ID** and **Client Secret**.\n",
"Upload file": "ファイルをアップロード",
"Download file": "ファイルをダウンロード",
"List Files": "リストファイル",
"List Folders": "フォルダ一覧",
"Custom API Call": "カスタムAPI通話",
"Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB": "ファイルが4MiBより大きい場合は、ファイルをチャンク付きでMicrosoft OneDriveにアップロードしてください。",
"Download a file from your Microsoft OneDrive": "Microsoft OneDrive からファイルをダウンロード",
"List files in a OneDrive folder": "OneDriveフォルダ内のファイルの一覧",
"List folders in a OneDrive folder": "OneDriveフォルダ内のフォルダ一覧",
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
"File name": "ファイル名",
"File": "ファイル",
"Markdown": "Markdown",
"Parent Folder": "親フォルダ",
"File ID": "ファイルID",
"Method": "方法",
"Headers": "ヘッダー",
"Query Parameters": "クエリパラメータ",
"Body": "本文",
"Response is Binary ?": "応答はバイナリですか?",
"No Error on Failure": "失敗時にエラーはありません",
"Timeout (in seconds)": "タイムアウト(秒)",
"The name the file should be saved as (e.g. file.txt)": "ファイルを保存するファイル名file.txt",
"The file URL or base64 to upload": "アップロードするファイル URL または base64",
"**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ": "**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ",
"The ID of the file to download": "ダウンロードするファイルのID",
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
"GET": "取得",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "削除",
"HEAD": "頭",
"New File": "新規ファイル",
"Trigger when a new file is uploaded.": "新しいファイルがアップロードされたときにトリガーします。"
}

View File

@@ -0,0 +1,40 @@
{
"Cloud storage by Microsoft": "Cloud opslag door Microsoft",
"\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 op **Register**.\n9. Na registratie wordt u doorverwezen naar de overzichtspagina. Kopieer de **Applicatie (client) ID**.\n10. Vanuit het linkermenu ga naar **Certificaten & geheimen**.\n - Klik onder **Client geheimen** op **Nieuwe 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 - Bestanden. eadWrite\n - offline_access \n - Klik **Permissies toevoegen**.\n12. Kopieer uw **Client ID** en **Client Secret**.\n",
"Upload file": "Bestand uploaden",
"Download file": "Bestand downloaden",
"List Files": "Lijst van bestanden",
"List Folders": "Mappen weergeven",
"Custom API Call": "Custom API Call",
"Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB": "Upload een bestand naar je Microsoft OneDrive met gechunked upload als het bestand groter is dan 4MiB",
"Download a file from your Microsoft OneDrive": "Download een bestand van je Microsoft OneDrive",
"List files in a OneDrive folder": "Lijst van bestanden in een OneDrive map",
"List folders in a OneDrive folder": "Toon mappen in een OneDrive map",
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
"File name": "Bestandsnaam is vereist",
"File": "Bestand",
"Markdown": "Markdown",
"Parent Folder": "Bovenliggende map",
"File ID": "Bestand ID",
"Method": "Methode",
"Headers": "Kopteksten",
"Query Parameters": "Query parameters",
"Body": "Lichaam",
"Response is Binary ?": "Antwoord is binair?",
"No Error on Failure": "Geen fout bij fout",
"Timeout (in seconds)": "Time-out (in seconden)",
"The name the file should be saved as (e.g. file.txt)": "De naam van het bestand moet worden opgeslagen als (bijv. file.txt)",
"The file URL or base64 to upload": "De bestands-URL of base64 om te uploaden",
"**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ": "**Let op**: Als je de map niet kunt vinden in de keuzelijst (die maximaal 1000 mappen ophaalt), klik op **(F)** en typ de map-ID direct.\n\n\n u kunt de map-ID vinden in de OneDrive URL na **?id=**, e. ., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ",
"The ID of the file to download": "Het ID van het te downloaden bestand",
"Authorization headers are injected automatically from your connection.": "Autorisatie headers worden automatisch geïnjecteerd vanuit uw verbinding.",
"Enable for files like PDFs, images, etc..": "Inschakelen voor bestanden zoals PDF's, afbeeldingen etc..",
"GET": "KRIJG",
"POST": "POSTE",
"PATCH": "BEKIJK",
"PUT": "PUT",
"DELETE": "VERWIJDEREN",
"HEAD": "HOOFD",
"New File": "Nieuw bestand",
"Trigger when a new file is uploaded.": "Trigger wanneer een nieuw bestand wordt geüpload."
}

View File

@@ -0,0 +1,40 @@
{
"Cloud storage by Microsoft": "Armazenamento em nuvem da Microsoft",
"\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. Entre no [Microsoft Azure Portal](https://portal.azure.com/).\n. Na barra lateral esquerda, vá até **Microsoft Enfra ID**.\n3. Sob **Gerenciar**, clique em **Aplicativos registrados**.\n4. Clique no botão **Novo registro**.\n5. Digite um **Nome** para o seu aplicativo.\n6. Para **Tipos de conta suportados**, escolha:\n - **Contas em qualquer diretório organizacional (qualquer inquilino de ID da Microsoft Entra - Multitenant) e contas pessoais da Microsoft**\n - Ou selecione com base nos seus requisitos.\n7. Em **URI de redirecionamento**, selecione **Web** e adicione a URL fornecida.\n8. Clique em **Registrar**.\n9. Após o registro, você será redirecionado para a página de visão geral do aplicativo. Copie o **aplicativo (cliente) ID**.\n10. Do menu à esquerda, vá para **Certificados e segredos**.\n - Em **Segredos do Cliente**, clique em **Novo segredo do Cliente**.\n - Fornece uma descrição, define um vencimento e clique em **Adicionar**.\n - Copiar o **Valor** do segredo do cliente (não será mostrado novamente).\n11. Vá para **Permissões da API** no menu à esquerda.\n - Clique em **Adicionar permissão**.\n - Selecione **Microsoft Graph** → **Delegated permissions**.\n - Adicione os seguintes escopos:\n - Arquivos. eadWrite\n - offline_access \n - Clique em **Adicionar permissões**.\n12. Copie seu **ID do Cliente** e **Segredo do Cliente**.\n",
"Upload file": "Upload de arquivo",
"Download file": "Baixar arquivo",
"List Files": "Listar Arquivos",
"List Folders": "Lista de Pastas",
"Custom API Call": "Chamada de API personalizada",
"Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB": "Envie um arquivo para o seu Microsoft OneDrive com envio em chunked se o arquivo for maior que 4MiB",
"Download a file from your Microsoft OneDrive": "Baixar um arquivo da Microsoft OneDrive",
"List files in a OneDrive folder": "Lista arquivos em uma pasta do OneDrive",
"List folders in a OneDrive folder": "Listar pastas em uma pasta do OneDrive",
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
"File name": "Nome do arquivo",
"File": "Arquivo",
"Markdown": "Markdown",
"Parent Folder": "Pasta pai",
"File ID": "ID do arquivo",
"Method": "Método",
"Headers": "Cabeçalhos",
"Query Parameters": "Parâmetros da consulta",
"Body": "Conteúdo",
"Response is Binary ?": "A resposta é binária ?",
"No Error on Failure": "Nenhum erro no Failure",
"Timeout (in seconds)": "Tempo limite (em segundos)",
"The name the file should be saved as (e.g. file.txt)": "O nome que o arquivo deve ser salvo (por exemplo, arquivo.txt)",
"The file URL or base64 to upload": "URL do arquivo ou base64 para enviar",
"**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ": "**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ",
"The ID of the file to download": "O ID do arquivo para baixar",
"Authorization headers are injected automatically from your connection.": "Os cabeçalhos de autorização são inseridos automaticamente a partir da sua conexão.",
"Enable for files like PDFs, images, etc..": "Habilitar para arquivos como PDFs, imagens, etc..",
"GET": "OBTER",
"POST": "POSTAR",
"PATCH": "COMPRAR",
"PUT": "COLOCAR",
"DELETE": "EXCLUIR",
"HEAD": "CABEÇA",
"New File": "Novo arquivo",
"Trigger when a new file is uploaded.": "Dispara quando um novo arquivo é carregado."
}

View File

@@ -0,0 +1,39 @@
{
"Microsoft OneDrive": "Microsoft OneDrive",
"Cloud storage by Microsoft": "Облачное хранилище от Microsoft",
"Authentication for Microsoft OneDrive": "Аутентификация для Microsoft OneDrive",
"Upload file": "Загрузить файл",
"Download file": "Скачать файл",
"List Files": "Список файлов",
"List Folders": "Список папок",
"Custom API Call": "Пользовательский вызов API",
"Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB": "Загрузите файл в Microsoft OneDrive с закачкой, если размер файла превышает 4MiB",
"Download a file from your Microsoft OneDrive": "Скачать файл из Microsoft OneDrive",
"List files in a OneDrive folder": "Список файлов в папке OneDrive",
"List folders in a OneDrive folder": "Список папок в OneDrive",
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
"File name": "Имя файла",
"File": "Файл",
"Markdown": "Markdown",
"Parent Folder": "Родительская папка",
"File ID": "ID файла",
"Method": "Метод",
"Headers": "Заголовки",
"Query Parameters": "Параметры запроса",
"Body": "Тело",
"No Error on Failure": "Нет ошибок при ошибке",
"Timeout (in seconds)": "Таймаут (в секундах)",
"The name the file should be saved as (e.g. file.txt)": "Имя файла, которое должен быть сохранен как (например, file.txt)",
"The file URL or base64 to upload": "URL файла или base64 для загрузки",
"**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ": "**Примечание**: Если вы не можете найти папку в раскрывающемся списке (которая извлекает до 1000 папок), нажмите на **(F)** и введите ID папки напрямую.\n\n\n вы можете найти идентификатор папки в OneDrive URL после **?id=**, e. ., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ",
"The ID of the file to download": "ID файла для загрузки",
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
"GET": "ПОЛУЧИТЬ",
"POST": "ПОСТ",
"PATCH": "ПАТЧ",
"PUT": "ПОКУПИТЬ",
"DELETE": "УДАЛИТЬ",
"HEAD": "HEAD",
"New File": "Новый файл",
"Trigger when a new file is uploaded.": "Срабатывать при загрузке нового файла."
}

View File

@@ -0,0 +1,40 @@
{
"Cloud storage by Microsoft": "Cloud storage by Microsoft",
"\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, youll be redirected to the apps 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 - Files.ReadWrite\n - offline_access\n - Click **Add permissions**.\n12. Copy your **Client ID** and **Client Secret**.\n",
"Upload file": "Upload file",
"Download file": "Download file",
"List Files": "List Files",
"List Folders": "List Folders",
"Custom API Call": "Custom API Call",
"Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB": "Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB",
"Download a file from your Microsoft OneDrive": "Download a file from your Microsoft OneDrive",
"List files in a OneDrive folder": "List files in a OneDrive folder",
"List folders in a OneDrive folder": "List folders in a OneDrive folder",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"File name": "File name",
"File": "File",
"Markdown": "Markdown",
"Parent Folder": "Parent Folder",
"File ID": "File ID",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"The name the file should be saved as (e.g. file.txt)": "The name the file should be saved as (e.g. file.txt)",
"The file URL or base64 to upload": "The file URL or base64 to upload",
"**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ": "**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ",
"The ID of the file to download": "The ID of the file to download",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New File": "New File",
"Trigger when a new file is uploaded.": "Trigger when a new file is uploaded."
}

View File

@@ -0,0 +1,39 @@
{
"Microsoft OneDrive": "Microsoft OneDrive",
"Cloud storage by Microsoft": "Cloud storage by Microsoft",
"Authentication for Microsoft OneDrive": "Authentication for Microsoft OneDrive",
"Upload file": "Upload file",
"Download file": "Download file",
"List Files": "List Files",
"List Folders": "List Folders",
"Custom API Call": "Custom API Call",
"Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB": "Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB",
"Download a file from your Microsoft OneDrive": "Download a file from your Microsoft OneDrive",
"List files in a OneDrive folder": "List files in a OneDrive folder",
"List folders in a OneDrive folder": "List folders in a OneDrive folder",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"File name": "File name",
"File": "File",
"Markdown": "Markdown",
"Parent Folder": "Parent Folder",
"File ID": "File ID",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"The name the file should be saved as (e.g. file.txt)": "The name the file should be saved as (e.g. file.txt)",
"The file URL or base64 to upload": "The file URL or base64 to upload",
"**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ": "**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ",
"The ID of the file to download": "The ID of the file to download",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New File": "New File",
"Trigger when a new file is uploaded.": "Trigger when a new file is uploaded."
}

View File

@@ -0,0 +1,40 @@
{
"Cloud storage by Microsoft": "Cloud storage by Microsoft",
"\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, youll be redirected to the apps 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 - Files.ReadWrite\n - offline_access\n - Click **Add permissions**.\n12. Copy your **Client ID** and **Client Secret**.\n",
"Upload file": "Upload file",
"Download file": "Download file",
"List Files": "List Files",
"List Folders": "List Folders",
"Custom API Call": "自定义 API 呼叫",
"Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB": "Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB",
"Download a file from your Microsoft OneDrive": "Download a file from your Microsoft OneDrive",
"List files in a OneDrive folder": "List files in a OneDrive folder",
"List folders in a OneDrive folder": "List folders in a OneDrive folder",
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
"File name": "File name",
"File": "文件",
"Markdown": "Markdown",
"Parent Folder": "父文件夹",
"File ID": "File ID",
"Method": "方法",
"Headers": "信头",
"Query Parameters": "查询参数",
"Body": "正文内容",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "失败时没有错误",
"Timeout (in seconds)": "超时(秒)",
"The name the file should be saved as (e.g. file.txt)": "The name the file should be saved as (e.g. file.txt)",
"The file URL or base64 to upload": "The file URL or base64 to upload",
"**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ": "**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n\n\n you can find the folder ID in the OneDrive URL after **?id=**, e.g., \"onedrive.live.com/?id=**folder-id**&cid=some-other-id\"\n\n ",
"The ID of the file to download": "The ID of the file to download",
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"GET": "获取",
"POST": "帖子",
"PATCH": "PATCH",
"PUT": "弹出",
"DELETE": "删除",
"HEAD": "黑色",
"New File": "New File",
"Trigger when a new file is uploaded.": "Trigger when a new file is uploaded."
}

View File

@@ -0,0 +1,74 @@
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import {
createPiece,
OAuth2PropertyValue,
PieceAuth,
} from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { downloadFile } from './lib/actions/download-file';
import { listFiles } from './lib/actions/list-files';
import { listFolders } from './lib/actions/list-folders';
import { uploadFile } from './lib/actions/upload-file';
import { oneDriveCommon } from './lib/common/common';
import { newFile } from './lib/triggers/new-file';
const authDesc = `
1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).
2. From the left sidebar, go to **Microsoft Enfra ID**.
3. Under **Manage**, click on **App registrations**.
4. Click the **New registration** button.
5. Enter a **Name** for your app.
6. For **Supported account types**, choose:
- **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**
- Or select based on your requirement.
7. In **Redirect URI**, select **Web** and add the given URL.
8. Click **Register**.
9. After registration, youll be redirected to the apps overview page. Copy the **Application (client) ID**.
10. From the left menu, go to **Certificates & secrets**.
- Under **Client secrets**, click **New client secret**.
- Provide a description, set an expiry, and click **Add**.
- Copy the **Value** of the client secret (this will not be shown again).
11. Go to **API permissions** from the left menu.
- Click **Add a permission**.
- Select **Microsoft Graph** → **Delegated permissions**.
- Add the following scopes:
- Files.ReadWrite
- offline_access
- Click **Add permissions**.
12. Copy your **Client ID** and **Client Secret**.
`
export const oneDriveAuth = PieceAuth.OAuth2({
description: authDesc,
authUrl: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
tokenUrl: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
required: true,
scope: ['Files.ReadWrite', 'offline_access'],
prompt: 'omit'
});
export const microsoftOneDrive = createPiece({
displayName: 'Microsoft OneDrive',
description: 'Cloud storage by Microsoft',
auth: oneDriveAuth,
minimumSupportedRelease: '0.30.0',
logoUrl: 'https://cdn.activepieces.com/pieces/oneDrive.png',
categories: [PieceCategory.CONTENT_AND_FILES],
authors: ["BastienMe","kishanprmr","MoShizzle","abuaboud","ikus060"],
actions: [
uploadFile,
downloadFile,
listFiles,
listFolders,
createCustomApiCallAction({
baseUrl: () => oneDriveCommon.baseUrl,
auth: oneDriveAuth,
authMapping: async (auth) => ({
Authorization: `Bearer ${(auth as OAuth2PropertyValue).access_token}`,
}),
}),
],
triggers: [newFile],
});

View File

@@ -0,0 +1,67 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import {
httpClient,
HttpMethod,
AuthenticationType,
} from '@activepieces/pieces-common';
import { oneDriveAuth } from '../../';
import { oneDriveCommon } from '../common/common';
export const downloadFile = createAction({
auth: oneDriveAuth,
name: 'download_file',
description: 'Download a file from your Microsoft OneDrive',
displayName: 'Download file',
props: {
fileId: Property.ShortText({
displayName: 'File ID',
description: 'The ID of the file to download',
required: true,
}),
},
async run(context) {
const fileId = context.propsValue.fileId;
const fileDetails = await httpClient.sendRequest<{name:string}>({
method:HttpMethod.GET,
url:`${oneDriveCommon.baseUrl}/items/${fileId}?$select=name`,
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: context.auth.access_token,
},
})
const result = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${oneDriveCommon.baseUrl}/items/${fileId}/content`,
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: context.auth.access_token,
},
responseType:'arraybuffer'
});
const desiredHeaders = [
'content-length',
'content-type',
'content-location',
'expires',
];
const filteredHeaders: any = {};
if (result.headers) {
for (const key of desiredHeaders) {
filteredHeaders[key] = result.headers[key];
}
}
return {
...filteredHeaders,
data:await context.files.write({
fileName: fileDetails.body.name,
data: Buffer.from(result.body),
})
}
},
});

View File

@@ -0,0 +1,46 @@
import { createAction } from '@activepieces/pieces-framework';
import { oneDriveAuth } from '../../';
import { oneDriveCommon } from '../common/common';
import { Client, PageCollection } from '@microsoft/microsoft-graph-client';
import { DriveItem } from '@microsoft/microsoft-graph-types';
export const listFiles = createAction({
auth: oneDriveAuth,
name: 'list_files',
description: 'List files in a OneDrive folder',
displayName: 'List Files',
props: {
markdown:oneDriveCommon.parentFolderInfo,
parentFolder: oneDriveCommon.parentFolder,
},
async run(context) {
const endpoint = context.propsValue.parentFolder
? `/me/drive/items/${context.propsValue.parentFolder}/children`
: `/me/drive/items/root/children`;
const files = [];
const client = Client.initWithMiddleware({
authProvider: {
getAccessToken: () => Promise.resolve(context.auth.access_token),
},
});
let response: PageCollection = await client.api(endpoint).get();
while (response.value.length > 0) {
for (const item of response.value as DriveItem[]) {
if (item.file) {
files.push(item);
}
}
if (response['@odata.nextLink']) {
response = await client.api(response['@odata.nextLink']).get();
} else {
break;
}
}
return files;
},
});

View File

@@ -0,0 +1,33 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import {
httpClient,
HttpMethod,
AuthenticationType,
} from '@activepieces/pieces-common';
import { oneDriveAuth } from '../../';
import { oneDriveCommon } from '../common/common';
export const listFolders = createAction({
auth: oneDriveAuth,
name: 'list_folders',
description: 'List folders in a OneDrive folder',
displayName: 'List Folders',
props: {
markdown:oneDriveCommon.parentFolderInfo,
parentFolder: oneDriveCommon.parentFolder,
},
async run(context) {
const parentId = context.propsValue.parentFolder ?? 'root';
const result = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${oneDriveCommon.baseUrl}/items/${parentId}/children?$filter=folder ne null`,
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: context.auth.access_token,
},
});
return result.body['value'];
},
});

View File

@@ -0,0 +1,110 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import {
httpClient,
HttpMethod,
AuthenticationType,
} from '@activepieces/pieces-common';
import { oneDriveAuth } from '../../';
import mime from 'mime-types';
import { oneDriveCommon } from '../common/common';
const CHUNK_SIZE = 10485760; // Use 10MiB per chunk
export const uploadFile = createAction({
auth: oneDriveAuth,
name: 'upload_onedrive_file',
description: 'Upload a file to your Microsoft OneDrive with chunked upload if the file is larger than 4MiB',
displayName: 'Upload file',
props: {
fileName: Property.ShortText({
displayName: 'File name',
description: 'The name the file should be saved as (e.g. file.txt)',
required: true,
}),
file: Property.File({
displayName: 'File',
description: 'The file URL or base64 to upload',
required: true,
}),
markdown:oneDriveCommon.parentFolderInfo,
parentId: oneDriveCommon.parentFolder,
},
async run(context) {
const fileData = context.propsValue.file;
const mimeTypeLookup = mime.lookup(
fileData.extension ? fileData.extension : ''
);
const mimeType = mimeTypeLookup
? mimeTypeLookup
: 'application/octet-stream'; // Fallback to a default MIME type
const encodedFilename = encodeURIComponent(context.propsValue.fileName);
const parentId = context.propsValue.parentId ?? 'root';
if (fileData.data.length <= 4 * 1024 * 1024) {
// If file is smaller than 4MiB, use simple upload
const base64Data = Buffer.from(fileData.base64, 'base64');
const result = await httpClient.sendRequest({
method: HttpMethod.PUT,
url: `${oneDriveCommon.baseUrl}/items/${parentId}:/${encodedFilename}:/content`,
body: base64Data,
headers: {
'Content-Type': mimeType,
'Content-length': base64Data.length.toString(),
},
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: context.auth.access_token,
},
});
return result.body;
} else {
// For files larger than 4MiB, use chunked upload
const session = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${oneDriveCommon.baseUrl}/items/${parentId}:/${encodedFilename}:/createUploadSession`,
body: {
item: {
'@microsoft.graph.conflictBehavior': 'replace',
name: context.propsValue.fileName,
},
},
headers: {
'Content-Type': 'application/json',
},
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: context.auth.access_token,
},
});
const uploadUrl = session.body.uploadUrl;
let start = 0;
let end = CHUNK_SIZE - 1;
const fileSize = fileData.data.length;
let result;
while (start < fileSize) {
if (end >= fileSize) {
end = fileSize - 1;
}
const chunk = fileData.data.slice(start, end + 1);
result = await httpClient.sendRequest({
method: HttpMethod.PUT,
url: uploadUrl,
body: chunk,
headers: {
'Content-Length': chunk.length.toString(),
'Content-Range': `bytes ${start}-${end}/${fileSize}`,
},
});
start += CHUNK_SIZE;
end += CHUNK_SIZE;
}
return result?.body;
}
},
});

View File

@@ -0,0 +1,151 @@
import {
httpClient,
HttpMethod,
AuthenticationType,
} from '@activepieces/pieces-common';
import { OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { MarkdownVariant } from '@activepieces/shared';
import dayjs from 'dayjs';
import { oneDriveAuth } from '../..';
export const oneDriveCommon = {
baseUrl: 'https://graph.microsoft.com/v1.0/me/drive',
parentFolder: Property.Dropdown({
auth: oneDriveAuth,
displayName: 'Parent Folder',
required: false,
refreshers: ['auth'],
options: async ({ auth }) => {
if (!auth) {
return {
disabled: true,
options: [],
placeholder: 'Please authenticate first',
};
}
const authProp: OAuth2PropertyValue = auth as OAuth2PropertyValue;
let folders: { id: string; label: string }[] = [];
try {
folders = await getFoldersRecursively(authProp, 'root', '');
} catch (e) {
throw new Error(`Failed to get folders\nError:${e}`);
}
return {
disabled: false,
options: folders.map((folder: { id: string; label: string }) => {
return {
label: folder.label,
value: folder.id,
};
}),
};
},
}),
parentFolderInfo : Property.MarkDown({
value:
`**Note**: If you can't find the folder in the dropdown list (which fetches up to 1000 folders), please click on the **(F)** and type the folder ID directly.\n
you can find the folder ID in the OneDrive URL after **?id=**, e.g., "onedrive.live.com/?id=**folder-id**&cid=some-other-id"
`,
variant:MarkdownVariant.INFO
}),
async getFiles(
auth: OAuth2PropertyValue,
search?: {
parentFolder?: string;
createdTime?: string | number | Date;
createdTimeOp?: string;
}
) {
let url = `${this.baseUrl}/items/root/children?$filter=folder eq null`;
if (search?.parentFolder) {
url = `${this.baseUrl}/items/${search.parentFolder}/children?$filter=folder eq null`;
}
const response = await httpClient.sendRequest<{
value: { id: string; name: string; createdDateTime: string }[];
}>({
method: HttpMethod.GET,
url: url,
queryParams: {
$select: 'id,name,createdDateTime',
$orderby: 'createdDateTime asc',
},
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: auth.access_token,
},
});
const files = response.body.value;
if (search?.createdTime) {
const compareDate = dayjs(search.createdTime);
return files.filter((file) => {
const fileDate = dayjs(file.createdDateTime);
const comparison =
search.createdTimeOp === '<'
? fileDate.isBefore(compareDate)
: fileDate.isAfter(compareDate);
return comparison;
});
}
return files;
},
};
async function getFoldersRecursively(
auth: OAuth2PropertyValue,
folderId: string,
parentPath = '',
result: { label: string; id: string }[] = []
) {
// Stop recursion if limit is reached
if (result.length >= 1000) {
return result;
}
const url = `${oneDriveCommon.baseUrl}/items/${folderId}/children?$select=id,name,folder`;
try {
const response = await httpClient.sendRequest<getFoldersResponse>({
method: HttpMethod.GET,
url,
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: auth.access_token,
},
});
const items = response.body.value;
const folders = items.filter((item) => item.folder);
for (const folder of folders) {
const path = parentPath ? `${parentPath}/${folder.name}` : folder.name;
result.push({ label: path, id: folder.id });
if (folder.folder?.childCount && folder.folder.childCount > 0) {
await getFoldersRecursively(auth, folder.id, path, result);
}
}
} catch (e) {
throw new Error(`Failed to get folders\nError: ${e}`);
}
return result;
}
interface getFoldersResponse {
'@odata.nextLink'?: string;
'@odata.deltaLink'?: string;
value: { id: string; name: string; folder?: { childCount: number } }[];
}

View File

@@ -0,0 +1,132 @@
import { AppConnectionValueForAuthProperty, PiecePropValueSchema, Property, createTrigger } from '@activepieces/pieces-framework';
import { TriggerStrategy } from '@activepieces/pieces-framework';
import { DedupeStrategy, Polling, pollingHelper } from '@activepieces/pieces-common';
import dayjs from 'dayjs';
import { oneDriveAuth } from '../..';
import { oneDriveCommon } from '../common/common';
import { Client, PageCollection } from '@microsoft/microsoft-graph-client';
import { DriveItem } from '@microsoft/microsoft-graph-types';
type Props = {
parentFolder?: string;
};
const polling: Polling<AppConnectionValueForAuthProperty<typeof oneDriveAuth>, Props> = {
strategy: DedupeStrategy.TIMEBASED,
items: async ({ auth, propsValue, lastFetchEpochMS }) => {
const client = Client.initWithMiddleware({
authProvider: {
getAccessToken: () => Promise.resolve(auth.access_token),
},
});
const files = [];
const endpoint = propsValue.parentFolder
? `/me/drive/items/${propsValue.parentFolder}/children`
: `/me/drive/items/root/children`;
let response: PageCollection = await client.api(endpoint).get();
while (response.value.length > 0) {
for (const item of response.value as DriveItem[]) {
if (item.file) {
files.push(item);
}
}
if (response['@odata.nextLink']) {
response = await client.api(response['@odata.nextLink']).get();
} else {
break;
}
}
files.sort((a, b) => {
const aDate = dayjs(a.createdDateTime);
const bDate = dayjs(b.createdDateTime);
return bDate.diff(aDate);
});
return files.map((file) => ({
epochMilliSeconds: dayjs(file.createdDateTime).valueOf(),
data: file,
}));
},
};
export const newFile = createTrigger({
auth: oneDriveAuth,
name: 'new_file',
displayName: 'New File',
description: 'Trigger when a new file is uploaded.',
props: {
markdown:oneDriveCommon.parentFolderInfo,
parentFolder: oneDriveCommon.parentFolder,
},
type: TriggerStrategy.POLLING,
async onEnable(context) {
await pollingHelper.onEnable(polling, {
auth: context.auth,
store: context.store,
propsValue: context.propsValue,
});
},
async onDisable(context) {
await pollingHelper.onDisable(polling, {
auth: context.auth,
store: context.store,
propsValue: context.propsValue,
});
},
async test(context) {
return await pollingHelper.test(polling, context);
},
async run(context) {
return await pollingHelper.poll(polling, context);
},
sampleData: {
id: '123456',
name: 'example.jpg',
createdDateTime: '2023-10-20T10:16:35.5Z',
cTag: '07NkI9QUVCNEY1QzU9ITEySi4yNTD',
eTag: '331E4899BE5BFA2!sccbdc3441b454cc0a13be0f6be58ca3d',
lastModifiedDateTime: '2023-10-20T10:16:35.5Z',
size: 53431,
createdBy: {
application: {
id: '00000000-0000-0000-0000-0000481710a4',
displayName: '4c5b-b112-36a304b66dad',
},
user: {
email: 'john@outlook.com',
id: '0331E4899BE5BFA2',
displayName: 'John Doe',
},
},
lastModifiedBy: {
application: {
id: '00000000-0000-0000-0000-0000481710a4',
displayName: '36a304b66dad',
},
user: {
email: 'john@outlook.com',
id: '0331E4899BE5BFA2',
displayName: 'John Doe',
},
},
parentReference: {
driveType: 'personal',
driveId: 'E4899BE5BFA2',
id: '48dd8265f06fd5e8024d',
name: 'child',
path: '/drive/root:/parent/child',
siteId: '043b2233-0eed-436a',
},
file: {
mimeType: 'image/jpeg',
},
fileSystemInfo: {
createdDateTime: '2025-01-22T09:30:10Z',
lastModifiedDateTime: '2025-01-22T09:30:12Z',
},
},
});

View File

@@ -0,0 +1,19 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}

View File

@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
}