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-pastefy
This library was generated with [Nx](https://nx.dev).
## Running lint
Run `nx lint pieces-pastefy` to execute the lint via [ESLint](https://eslint.org/).

View File

@@ -0,0 +1,7 @@
{
"name": "@activepieces/piece-pastefy",
"version": "0.1.13",
"dependencies": {
"crypto-js": "4.2.0"
}
}

View File

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

View File

@@ -0,0 +1,58 @@
{
"Sharing code snippets platform": "Code-Snippets Plattform teilen",
"Pastefy Instance URL": "Pastefy Instance URL",
"API-Token": "API-Token",
"\nCreate an account and obtain the API Key from Pastefy.\n": "\nErstellen Sie ein Konto und erhalten Sie den API-Schlüssel von Pastefy.\n",
"Create Paste": "Einfügen",
"Get Paste": "Einfügen",
"Edit Paste": "Einfügen bearbeiten",
"Delete Paste": "Einfügen löschen",
"Create Folder": "Ordner erstellen",
"Get Folder": "Ordner abrufen",
"Get Folder Hierarchy": "OrdnerHierarchie abrufen",
"Delete Folder": "Ordner löschen",
"Custom API Call": "Eigener API-Aufruf",
"Creates a new paste": "Erstellt eine neue Paste",
"Retrieves a paste": "Abruft eine Paste ab",
"Edits an existing private paste": "Bearbeitet eine bestehende private Paste",
"Deletes a paste": "Löscht eine Einfügung",
"Creates a new folder": "Erstellt einen neuen Ordner",
"Retrieves information about a folder": "Ruft Informationen über einen Ordner ab",
"Retrieves a hierarchy of all folders": "Ruft eine Hierarchie aller Ordner ab",
"Deletes a folder": "Löscht einen Ordner",
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
"Content": "Inhalt",
"Title": "Titel",
"Encryption Password": "Verschlüsselungspasswort",
"Folder": "Ordner",
"Visibility": "Sichtbarkeit",
"Expiry Date": "Expiry Date",
"Paste ID": "ID einfügen",
"Name": "Name",
"Parent Folder": "Eltern-Ordner",
"Start Folder": "Ordner starten",
"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)",
"Encrypts the paste with this password": "Verschlüsselt das Einfügen mit diesem Passwort",
"A folder": "Ein Ordner",
"Decrypts the paste with this password": "Entschlüsselt das Einfügen mit diesem Passwort",
"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..",
"Public": "Öffentlich",
"Unlisted": "Nicht gelistet",
"Private": "Privat",
"GET": "ERHALTEN",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "LÖSCHEN",
"HEAD": "HEAD",
"Paste Changed": "Geändert einfügen",
"Triggers when the content (or title) of the paste changes": "Wird ausgelöst, wenn sich der Inhalt (oder der Titel) des Einfügens ändert",
"Include Title": "Titel einbeziehen"
}

View File

@@ -0,0 +1,58 @@
{
"Sharing code snippets platform": "Plataforma de fragmentos de código compartido",
"Pastefy Instance URL": "Pastefy Instance URL",
"API-Token": "API-Token",
"\nCreate an account and obtain the API Key from Pastefy.\n": "\nCrear una cuenta y obtener la clave API de Pastefy.\n",
"Create Paste": "Crear Paste",
"Get Paste": "Pegar",
"Edit Paste": "Editar Pegado",
"Delete Paste": "Eliminar Pegado",
"Create Folder": "Crear carpeta",
"Get Folder": "Obtener carpeta",
"Get Folder Hierarchy": "Obtener jerarquía de carpetas",
"Delete Folder": "Eliminar carpeta",
"Custom API Call": "Llamada API personalizada",
"Creates a new paste": "Crea una nueva pega",
"Retrieves a paste": "Recuperar una pega",
"Edits an existing private paste": "Edita una pega privada existente",
"Deletes a paste": "Elimina un pegado",
"Creates a new folder": "Crea una nueva carpeta",
"Retrieves information about a folder": "Recuperar información sobre una carpeta",
"Retrieves a hierarchy of all folders": "Recuperar una jerarquía de todas las carpetas",
"Deletes a folder": "Elimina una carpeta",
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
"Content": "Contenido",
"Title": "Título",
"Encryption Password": "Contraseña del cifrado",
"Folder": "Carpeta",
"Visibility": "Visibilidad",
"Expiry Date": "Expiry Date",
"Paste ID": "Pegar ID",
"Name": "Nombre",
"Parent Folder": "Carpeta padre",
"Start Folder": "Carpeta inicial",
"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)",
"Encrypts the paste with this password": "Cifra la pega con esta contraseña",
"A folder": "Una carpeta",
"Decrypts the paste with this password": "Desencripta la pega con esta contraseña",
"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.",
"Public": "Público",
"Unlisted": "Sin enumerar",
"Private": "Privado",
"GET": "RECOGER",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "BORRAR",
"HEAD": "LIMPIO",
"Paste Changed": "Pegar cambiado",
"Triggers when the content (or title) of the paste changes": "Se activa cuando el contenido (o título) de la pega cambia",
"Include Title": "Incluye título"
}

View File

@@ -0,0 +1,58 @@
{
"Sharing code snippets platform": "Partage de la plateforme de code snippets",
"Pastefy Instance URL": "Pastefy Instance URL",
"API-Token": "API-Token",
"\nCreate an account and obtain the API Key from Pastefy.\n": "\nCreate an account and obtain the API Key from Pastefy.\n",
"Create Paste": "Créer Coller",
"Get Paste": "Récupérer Coller",
"Edit Paste": "Editer Coller",
"Delete Paste": "Supprimer Coller",
"Create Folder": "Créer un dossier",
"Get Folder": "Récupérer le dossier",
"Get Folder Hierarchy": "Obtenir la hiérarchie des dossiers",
"Delete Folder": "Supprimer le dossier",
"Custom API Call": "Appel API personnalisé",
"Creates a new paste": "Crée un nouveau coller",
"Retrieves a paste": "Récupère un coller",
"Edits an existing private paste": "Modifie un coller privé existant",
"Deletes a paste": "Supprime un coller",
"Creates a new folder": "Crée un nouveau dossier",
"Retrieves information about a folder": "Récupère des informations sur un dossier",
"Retrieves a hierarchy of all folders": "Récupère une hiérarchie de tous les dossiers",
"Deletes a folder": "Supprime un dossier",
"Make a custom API call to a specific endpoint": "Passez un appel API personnalisé à un point de terminaison spécifique",
"Content": "Contenus",
"Title": "Titre de la page",
"Encryption Password": "Mot de passe de chiffrement",
"Folder": "Dossier",
"Visibility": "Visibilité",
"Expiry Date": "Expiry Date",
"Paste ID": "Coller l'ID",
"Name": "Nom",
"Parent Folder": "Dossier parent",
"Start Folder": "Dossier de démarrage",
"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)",
"Encrypts the paste with this password": "Chiffre le coller avec ce mot de passe",
"A folder": "Un dossier",
"Decrypts the paste with this password": "Décrypte le coller avec ce mot de passe",
"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.",
"Public": "Publique",
"Unlisted": "Non listé",
"Private": "Privé",
"GET": "OBTENIR",
"POST": "POSTER",
"PATCH": "PATCH",
"PUT": "EFFACER",
"DELETE": "SUPPRIMER",
"HEAD": "TÊTE",
"Paste Changed": "Coller modifié",
"Triggers when the content (or title) of the paste changes": "Déclenche lorsque le contenu (ou le titre) du coller change",
"Include Title": "Inclure le titre"
}

View File

@@ -0,0 +1,58 @@
{
"Sharing code snippets platform": "コードスニペットプラットフォームを共有",
"Pastefy Instance URL": "Pastefy Instance URL",
"API-Token": "API-Token",
"\nCreate an account and obtain the API Key from Pastefy.\n": "\nアカウントを作成し、PastefyからAPIキーを取得します。\n",
"Create Paste": "貼り付け",
"Get Paste": "貼り付け",
"Edit Paste": "貼り付けを編集",
"Delete Paste": "貼り付けを削除",
"Create Folder": "フォルダを作成",
"Get Folder": "フォルダを取得する",
"Get Folder Hierarchy": "フォルダ階層の取得",
"Delete Folder": "フォルダを削除",
"Custom API Call": "カスタムAPI通話",
"Creates a new paste": "新規ペーストを作成",
"Retrieves a paste": "貼り付けを取得",
"Edits an existing private paste": "既存のプライベートペーストを編集",
"Deletes a paste": "貼り付けを削除",
"Creates a new folder": "新しいフォルダを作成します",
"Retrieves information about a folder": "フォルダに関する情報を取得します",
"Retrieves a hierarchy of all folders": "すべてのフォルダの階層を取得します",
"Deletes a folder": "フォルダを削除",
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
"Content": "コンテンツ",
"Title": "タイトル",
"Encryption Password": "暗号化パスワード",
"Folder": "Folder",
"Visibility": "公開範囲",
"Expiry Date": "Expiry Date",
"Paste ID": "IDを貼り付け",
"Name": "名前",
"Parent Folder": "親フォルダ",
"Start Folder": "フォルダの開始",
"Method": "方法",
"Headers": "ヘッダー",
"Query Parameters": "クエリパラメータ",
"Body": "本文",
"Response is Binary ?": "応答はバイナリですか?",
"No Error on Failure": "失敗時にエラーはありません",
"Timeout (in seconds)": "タイムアウト(秒)",
"Encrypts the paste with this password": "このパスワードでペーストを暗号化します。",
"A folder": "フォルダ",
"Decrypts the paste with this password": "このパスワードでペーストを復号します。",
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
"Public": "公開",
"Unlisted": "リストにありません",
"Private": "非公開",
"GET": "取得",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "削除",
"HEAD": "頭",
"Paste Changed": "貼り付けが変更されました",
"Triggers when the content (or title) of the paste changes": "貼り付けの内容(またはタイトル)が変更されたときにトリガーします",
"Include Title": "タイトルを含める"
}

View File

@@ -0,0 +1,58 @@
{
"Sharing code snippets platform": "Code snippets platform delen",
"Pastefy Instance URL": "Pastefy Instance URL",
"API-Token": "API-Token",
"\nCreate an account and obtain the API Key from Pastefy.\n": "\nMaak een account aan en verkrijg de API-sleutel uit Pastefy.\n",
"Create Paste": "Maak plakken",
"Get Paste": "Plakken",
"Edit Paste": "Bewerken plakken",
"Delete Paste": "Plakken verwijderen",
"Create Folder": "Map aanmaken",
"Get Folder": "Map ophalen",
"Get Folder Hierarchy": "Haal maphiërarchie op",
"Delete Folder": "Map verwijderen",
"Custom API Call": "Custom API Call",
"Creates a new paste": "Maakt een nieuwe plak",
"Retrieves a paste": "Haalt een plak op",
"Edits an existing private paste": "Bewerkt een bestaande privé plak",
"Deletes a paste": "Verwijdert een plak",
"Creates a new folder": "Maakt een nieuwe map aan",
"Retrieves information about a folder": "Ophalen informatie over een map",
"Retrieves a hierarchy of all folders": "Ophalen van een hiërarchie van alle mappen",
"Deletes a folder": "Verwijdert een map",
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
"Content": "Inhoud",
"Title": "Aanspreektitel",
"Encryption Password": "Encryptie wachtwoord",
"Folder": "Map",
"Visibility": "Zichtbaarheid",
"Expiry Date": "Expiry Date",
"Paste ID": "Plak ID",
"Name": "Naam",
"Parent Folder": "Bovenliggende map",
"Start Folder": "Start map",
"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)",
"Encrypts the paste with this password": "Versleutel het plakken met dit wachtwoord",
"A folder": "Een map",
"Decrypts the paste with this password": "Decodeert het plakken met dit wachtwoord",
"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..",
"Public": "Openbaar",
"Unlisted": "Niet-genoteerd",
"Private": "Privé",
"GET": "KRIJG",
"POST": "POSTE",
"PATCH": "BEKIJK",
"PUT": "PUT",
"DELETE": "VERWIJDEREN",
"HEAD": "HOOFD",
"Paste Changed": "Plakken gewijzigd",
"Triggers when the content (or title) of the paste changes": "Triggert wanneer de inhoud (of titel) van de plak verandert",
"Include Title": "Titel opnemen"
}

View File

@@ -0,0 +1,58 @@
{
"Sharing code snippets platform": "Compartilhando plataforma de snippets de código",
"Pastefy Instance URL": "Pastefy Instance URL",
"API-Token": "API-Token",
"\nCreate an account and obtain the API Key from Pastefy.\n": "U\nCrie uma conta e obtenha a chave de API de Pastefy.\n",
"Create Paste": "Criar Colar",
"Get Paste": "Obter Colar",
"Edit Paste": "Editar Colar",
"Delete Paste": "Excluir Colar",
"Create Folder": "Criar pasta",
"Get Folder": "Obter pasta",
"Get Folder Hierarchy": "Obter hierarquia de pastas",
"Delete Folder": "Excluir Pasta",
"Custom API Call": "Chamada de API personalizada",
"Creates a new paste": "Cria uma nova colagem",
"Retrieves a paste": "Recupera uma colagem",
"Edits an existing private paste": "Edita uma colagem privada existente",
"Deletes a paste": "Exclui uma colagem",
"Creates a new folder": "Cria uma nova pasta",
"Retrieves information about a folder": "Recupera informações sobre uma pasta",
"Retrieves a hierarchy of all folders": "Recupera uma hierarquia de todas as pastas",
"Deletes a folder": "Exclui uma pasta",
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
"Content": "Conteúdo",
"Title": "Título",
"Encryption Password": "Senha de Criptografia",
"Folder": "Pasta",
"Visibility": "Visibilidade",
"Expiry Date": "Expiry Date",
"Paste ID": "Colar ID",
"Name": "Nome",
"Parent Folder": "Pasta pai",
"Start Folder": "Iniciar pasta",
"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)",
"Encrypts the paste with this password": "Criptografa a colar com esta senha",
"A folder": "Uma pasta",
"Decrypts the paste with this password": "Descriptografa a colar com esta senha",
"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..",
"Public": "Público",
"Unlisted": "Não-listado",
"Private": "Privado",
"GET": "OBTER",
"POST": "POSTAR",
"PATCH": "COMPRAR",
"PUT": "COLOCAR",
"DELETE": "EXCLUIR",
"HEAD": "CABEÇA",
"Paste Changed": "Colar alterado",
"Triggers when the content (or title) of the paste changes": "Dispara quando o conteúdo (ou título) das alterações de colar",
"Include Title": "Incluir Título"
}

View File

@@ -0,0 +1,57 @@
{
"Pastefy": "Pastefy",
"Sharing code snippets platform": "Обмен фрагментами кода",
"Pastefy Instance URL": "Pastefy Instance URL",
"API-Token": "API-Token",
"\nCreate an account and obtain the API Key from Pastefy.\n": "\nСоздайте учетную запись и получите API Key от Pastefy.\n",
"Create Paste": "Создать вставку",
"Get Paste": "Получить вставку",
"Edit Paste": "Изменить вставку",
"Delete Paste": "Удалить вставку",
"Create Folder": "Создать папку",
"Get Folder": "Получить папку",
"Get Folder Hierarchy": "Получить иерархию папок",
"Delete Folder": "Удалить папку",
"Custom API Call": "Пользовательский вызов API",
"Creates a new paste": "Создать новую вставку",
"Retrieves a paste": "Получает вставку",
"Edits an existing private paste": "Редактирует существующую частную вставку",
"Deletes a paste": "Удаляет вставку",
"Creates a new folder": "Создать новую папку",
"Retrieves information about a folder": "Получает информацию о папке",
"Retrieves a hierarchy of all folders": "Возвращает иерархию всех папок",
"Deletes a folder": "Удаляет папку",
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
"Content": "Содержание",
"Title": "Заголовок",
"Encryption Password": "Пароль шифрования",
"Folder": "Папка",
"Visibility": "Видимость",
"Expiry Date": "Expiry Date",
"Paste ID": "Вставить ID",
"Name": "Наименование",
"Parent Folder": "Родительская папка",
"Start Folder": "Начальная папка",
"Method": "Метод",
"Headers": "Заголовки",
"Query Parameters": "Параметры запроса",
"Body": "Тело",
"No Error on Failure": "Нет ошибок при ошибке",
"Timeout (in seconds)": "Таймаут (в секундах)",
"Encrypts the paste with this password": "Шифрует вставку с этим паролем",
"A folder": "Папка",
"Decrypts the paste with this password": "Расшифрует вставку с этим паролем",
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
"Public": "Публичный",
"Unlisted": "Не занесено",
"Private": "Приватный",
"GET": "ПОЛУЧИТЬ",
"POST": "ПОСТ",
"PATCH": "ПАТЧ",
"PUT": "ПОКУПИТЬ",
"DELETE": "УДАЛИТЬ",
"HEAD": "HEAD",
"Paste Changed": "Вставить изменения",
"Triggers when the content (or title) of the paste changes": "Включает когда содержимое (или название) вставки изменяется",
"Include Title": "Включить название"
}

View File

@@ -0,0 +1,58 @@
{
"Sharing code snippets platform": "Sharing code snippets platform",
"Pastefy Instance URL": "Pastefy Instance URL",
"API-Token": "API-Token",
"\nCreate an account and obtain the API Key from Pastefy.\n": "\nCreate an account and obtain the API Key from Pastefy.\n",
"Create Paste": "Create Paste",
"Get Paste": "Get Paste",
"Edit Paste": "Edit Paste",
"Delete Paste": "Delete Paste",
"Create Folder": "Create Folder",
"Get Folder": "Get Folder",
"Get Folder Hierarchy": "Get Folder Hierarchy",
"Delete Folder": "Delete Folder",
"Custom API Call": "Custom API Call",
"Creates a new paste": "Creates a new paste",
"Retrieves a paste": "Retrieves a paste",
"Edits an existing private paste": "Edits an existing private paste",
"Deletes a paste": "Deletes a paste",
"Creates a new folder": "Creates a new folder",
"Retrieves information about a folder": "Retrieves information about a folder",
"Retrieves a hierarchy of all folders": "Retrieves a hierarchy of all folders",
"Deletes a folder": "Deletes a folder",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Content": "Content",
"Title": "Title",
"Encryption Password": "Encryption Password",
"Folder": "Folder",
"Visibility": "Visibility",
"Expiry Date": "Expiry Date",
"Paste ID": "Paste ID",
"Name": "Name",
"Parent Folder": "Parent Folder",
"Start Folder": "Start Folder",
"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)",
"Encrypts the paste with this password": "Encrypts the paste with this password",
"A folder": "A folder",
"Decrypts the paste with this password": "Decrypts the paste with this password",
"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..",
"Public": "Public",
"Unlisted": "Unlisted",
"Private": "Private",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"Paste Changed": "Paste Changed",
"Triggers when the content (or title) of the paste changes": "Triggers when the content (or title) of the paste changes",
"Include Title": "Include Title"
}

View File

@@ -0,0 +1,57 @@
{
"Pastefy": "Pastefy",
"Sharing code snippets platform": "Sharing code snippets platform",
"Pastefy Instance URL": "Pastefy Instance URL",
"API-Token": "API-Token",
"\nCreate an account and obtain the API Key from Pastefy.\n": "\nCreate an account and obtain the API Key from Pastefy.\n",
"Create Paste": "Create Paste",
"Get Paste": "Get Paste",
"Edit Paste": "Edit Paste",
"Delete Paste": "Delete Paste",
"Create Folder": "Create Folder",
"Get Folder": "Get Folder",
"Get Folder Hierarchy": "Get Folder Hierarchy",
"Delete Folder": "Delete Folder",
"Custom API Call": "Custom API Call",
"Creates a new paste": "Creates a new paste",
"Retrieves a paste": "Retrieves a paste",
"Edits an existing private paste": "Edits an existing private paste",
"Deletes a paste": "Deletes a paste",
"Creates a new folder": "Creates a new folder",
"Retrieves information about a folder": "Retrieves information about a folder",
"Retrieves a hierarchy of all folders": "Retrieves a hierarchy of all folders",
"Deletes a folder": "Deletes a folder",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Content": "Content",
"Title": "Title",
"Encryption Password": "Encryption Password",
"Folder": "Folder",
"Visibility": "Visibility",
"Expiry Date": "Expiry Date",
"Paste ID": "Paste ID",
"Name": "Name",
"Parent Folder": "Parent Folder",
"Start Folder": "Start Folder",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Encrypts the paste with this password": "Encrypts the paste with this password",
"A folder": "A folder",
"Decrypts the paste with this password": "Decrypts the paste with this password",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"Public": "Public",
"Unlisted": "Unlisted",
"Private": "Private",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"Paste Changed": "Paste Changed",
"Triggers when the content (or title) of the paste changes": "Triggers when the content (or title) of the paste changes",
"Include Title": "Include Title"
}

View File

@@ -0,0 +1,58 @@
{
"Sharing code snippets platform": "Sharing code snippets platform",
"Pastefy Instance URL": "Pastefy Instance URL",
"API-Token": "API-Token",
"\nCreate an account and obtain the API Key from Pastefy.\n": "\nCreate an account and obtain the API Key from Pastefy.\n",
"Create Paste": "Create Paste",
"Get Paste": "Get Paste",
"Edit Paste": "Edit Paste",
"Delete Paste": "Delete Paste",
"Create Folder": "Create Folder",
"Get Folder": "Get Folder",
"Get Folder Hierarchy": "Get Folder Hierarchy",
"Delete Folder": "Delete Folder",
"Custom API Call": "自定义 API 呼叫",
"Creates a new paste": "Creates a new paste",
"Retrieves a paste": "Retrieves a paste",
"Edits an existing private paste": "Edits an existing private paste",
"Deletes a paste": "Deletes a paste",
"Creates a new folder": "Creates a new folder",
"Retrieves information about a folder": "Retrieves information about a folder",
"Retrieves a hierarchy of all folders": "Retrieves a hierarchy of all folders",
"Deletes a folder": "Deletes a folder",
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
"Content": "Content",
"Title": "标题",
"Encryption Password": "Encryption Password",
"Folder": "Folder",
"Visibility": "Visibility",
"Expiry Date": "Expiry Date",
"Paste ID": "Paste ID",
"Name": "名称",
"Parent Folder": "父文件夹",
"Start Folder": "Start Folder",
"Method": "方法",
"Headers": "信头",
"Query Parameters": "查询参数",
"Body": "正文内容",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "失败时没有错误",
"Timeout (in seconds)": "超时(秒)",
"Encrypts the paste with this password": "Encrypts the paste with this password",
"A folder": "A folder",
"Decrypts the paste with this password": "Decrypts the paste with this password",
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"Public": "Public",
"Unlisted": "Unlisted",
"Private": "Private",
"GET": "获取",
"POST": "帖子",
"PATCH": "PATCH",
"PUT": "弹出",
"DELETE": "删除",
"HEAD": "黑色",
"Paste Changed": "Paste Changed",
"Triggers when the content (or title) of the paste changes": "Triggers when the content (or title) of the paste changes",
"Include Title": "Include Title"
}

View File

@@ -0,0 +1,60 @@
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import {
PieceAuth,
Property,
createPiece,
} from '@activepieces/pieces-framework';
import actions from './lib/actions';
import triggers from './lib/triggers';
const markdown = `
Create an account and obtain the API Key from Pastefy.
`;
export const pastefyAuth = PieceAuth.CustomAuth({
description: markdown,
required: true,
props: {
instance_url: Property.ShortText({
displayName: 'Pastefy Instance URL',
required: false,
defaultValue: 'https://pastefy.app',
}),
token: PieceAuth.SecretText({
displayName: 'API-Token',
required: false,
}),
},
});
export const pastefy = createPiece({
displayName: 'Pastefy',
description: 'Sharing code snippets platform',
minimumSupportedRelease: '0.30.0',
logoUrl: 'https://cdn.activepieces.com/pieces/pastefy.png',
categories: [],
authors: ["JanHolger","kishanprmr","MoShizzle","khaledmashaly","abuaboud"],
auth: pastefyAuth,
actions: [
...actions,
createCustomApiCallAction({
baseUrl: (auth) => {
if (!auth) {
return '';
}
const typedAuth = auth.props as { instance_url: string };
return typedAuth.instance_url + '/api/v2';
},
auth: pastefyAuth,
authMapping: async (auth) => {
const typedAuth = auth as { token?: string };
return {
Authorization: typedAuth.token
? `Bearer ${typedAuth.token}`
: undefined,
};
},
}),
],
triggers: triggers,
});

View File

@@ -0,0 +1,25 @@
import { Property, createAction } from '@activepieces/pieces-framework';
import { makeClient, pastefyCommon } from '../common';
import { pastefyAuth } from '../..';
export default createAction({
auth: pastefyAuth,
name: 'create_folder',
displayName: 'Create Folder',
description: 'Creates a new folder',
props: {
name: Property.ShortText({
displayName: 'Name',
required: true,
}),
parent_id: pastefyCommon.folder_id(false, 'Parent Folder'),
},
async run(context) {
const client = makeClient(context.auth, context.propsValue);
const res = await client.createFolder({
name: context.propsValue.name as string,
parent: context.propsValue.parent_id,
});
return res.folder;
},
});

View File

@@ -0,0 +1,54 @@
import { Property, createAction } from '@activepieces/pieces-framework';
import { formatDate, makeClient, pastefyCommon } from '../common';
import { pastefyAuth } from '../..';
import CryptoJS from 'crypto-js';
export default createAction({
auth: pastefyAuth,
name: 'create_paste',
displayName: 'Create Paste',
description: 'Creates a new paste',
props: {
content: Property.LongText({
displayName: 'Content',
required: true,
}),
title: Property.ShortText({
displayName: 'Title',
required: false,
}),
password: Property.ShortText({
displayName: 'Encryption Password',
description: 'Encrypts the paste with this password',
required: false,
}),
folder_id: pastefyCommon.folder_id(false),
visibility: pastefyCommon.visibility(false),
expiry: Property.DateTime({
displayName: 'Expiry Date',
required: false,
}),
},
async run(context) {
const client = makeClient(context.auth, context.propsValue);
const password = context.propsValue.password;
let content = context.propsValue.content;
let title = context.propsValue.title;
if (password) {
content = CryptoJS.AES.encrypt(content, password).toString();
if (title) {
title = CryptoJS.AES.encrypt(title, password).toString();
}
}
const res = await client.createPaste({
title,
content,
encrypted: !!password,
folder: context.propsValue.folder_id,
visibility: context.propsValue.visibility,
expire_at: formatDate(context.propsValue.expiry),
});
return res.paste;
},
});

View File

@@ -0,0 +1,20 @@
import { createAction } from '@activepieces/pieces-framework';
import { makeClient, pastefyCommon } from '../common';
import { pastefyAuth } from '../..';
export default createAction({
auth: pastefyAuth,
name: 'delete_folder',
displayName: 'Delete Folder',
description: 'Deletes a folder',
props: {
folder_id: pastefyCommon.folder_id(true),
},
async run(context) {
const client = makeClient(context.auth, context.propsValue);
const res = await client.deleteFolder(
context.propsValue.folder_id as string
);
return res;
},
});

View File

@@ -0,0 +1,21 @@
import { Property, createAction } from '@activepieces/pieces-framework';
import { makeClient } from '../common';
import { pastefyAuth } from '../..';
export default createAction({
auth: pastefyAuth,
name: 'delete_paste',
displayName: 'Delete Paste',
description: 'Deletes a paste',
props: {
paste_id: Property.ShortText({
displayName: 'Paste ID',
required: true,
}),
},
async run(context) {
const client = makeClient(context.auth, context.propsValue);
const res = await client.deletePaste(context.propsValue.paste_id);
return res;
},
});

View File

@@ -0,0 +1,59 @@
import { Property, createAction } from '@activepieces/pieces-framework';
import { formatDate, makeClient, pastefyCommon } from '../common';
import { pastefyAuth } from '../..';
import CryptoJS from 'crypto-js';
export default createAction({
auth: pastefyAuth,
name: 'edit_paste',
displayName: 'Edit Paste',
description: 'Edits an existing private paste',
props: {
paste_id: Property.ShortText({
displayName: 'Paste ID',
required: true,
}),
content: Property.LongText({
displayName: 'Content',
required: false,
}),
title: Property.ShortText({
displayName: 'Title',
required: false,
}),
password: Property.ShortText({
displayName: 'Encryption Password',
description: 'Encrypts the paste with this password',
required: false,
}),
folder_id: pastefyCommon.folder_id(false),
visibility: pastefyCommon.visibility(false),
expiry: Property.DateTime({
displayName: 'Expiry Date',
required: false,
}),
},
async run(context) {
const client = makeClient(context.auth, context.propsValue);
const password = context.propsValue.password;
let content = context.propsValue.content;
let title = context.propsValue.title;
if (password) {
if (content) {
content = CryptoJS.AES.encrypt(content, password).toString();
}
if (title) {
title = CryptoJS.AES.encrypt(title, password).toString();
}
}
const res = await client.editPaste(context.propsValue.paste_id, {
title,
content,
encrypted: !!password,
folder: context.propsValue.folder_id,
visibility: context.propsValue.visibility,
expire_at: formatDate(context.propsValue.expiry),
});
return res;
},
});

View File

@@ -0,0 +1,20 @@
import { createAction } from '@activepieces/pieces-framework';
import { makeClient, pastefyCommon } from '../common';
import { pastefyAuth } from '../..';
export default createAction({
auth: pastefyAuth,
name: 'get_folder_hierarchy',
displayName: 'Get Folder Hierarchy',
description: 'Retrieves a hierarchy of all folders',
props: {
parent_id: pastefyCommon.folder_id(false, 'Start Folder'),
},
async run(context) {
const client = makeClient(context.auth, context.propsValue);
const hierarchy = await client.getFolderHierarchy(
context.propsValue.parent_id
);
return hierarchy;
},
});

View File

@@ -0,0 +1,20 @@
import { createAction } from '@activepieces/pieces-framework';
import { makeClient, pastefyCommon } from '../common';
import { pastefyAuth } from '../..';
export default createAction({
auth: pastefyAuth,
name: 'get_folder',
displayName: 'Get Folder',
description: 'Retrieves information about a folder',
props: {
folder_id: pastefyCommon.folder_id(true),
},
async run(context) {
const client = makeClient(context.auth, context.propsValue);
const folder = await client.getFolder(
context.propsValue.folder_id as string
);
return folder;
},
});

View File

@@ -0,0 +1,38 @@
import { Property, createAction } from '@activepieces/pieces-framework';
import { makeClient } from '../common';
import { pastefyAuth } from '../..';
import CryptoJS from 'crypto-js';
export default createAction({
auth: pastefyAuth,
name: 'get_paste',
displayName: 'Get Paste',
description: 'Retrieves a paste',
props: {
paste_id: Property.ShortText({
displayName: 'Paste ID',
required: true,
}),
password: Property.ShortText({
displayName: 'Encryption Password',
description: 'Decrypts the paste with this password',
required: false,
}),
},
async run(context) {
const client = makeClient(context.auth, context.propsValue);
const password = context.propsValue.password;
const paste = await client.getPaste(context.propsValue.paste_id);
if (paste.encrypted && password) {
paste.content = CryptoJS.AES.decrypt(paste.content, password).toString(
CryptoJS.enc.Utf8
);
if (paste.title) {
paste.title = CryptoJS.AES.decrypt(paste.title, password).toString(
CryptoJS.enc.Utf8
);
}
}
return paste;
},
});

View File

@@ -0,0 +1,19 @@
import createFolder from './create-folder';
import createPaste from './create-paste';
import deleteFolder from './delete-folder';
import deletePaste from './delete-paste';
import editPaste from './edit-paste';
import getFolder from './get-folder';
import getFolderHierarchy from './get-folder-hierarchy';
import getPaste from './get-paste';
export default [
createPaste,
getPaste,
editPaste,
deletePaste,
createFolder,
getFolder,
getFolderHierarchy,
deleteFolder,
];

View File

@@ -0,0 +1,156 @@
import {
Authentication,
AuthenticationType,
HttpMessageBody,
HttpMethod,
QueryParams,
httpClient,
} from '@activepieces/pieces-common';
import {
Folder,
FolderCreateRequest,
FolderCreateResponse,
FolderGetRequest,
FolderHierarchy,
FolderListRequest,
} from './models/folder';
import { ActionResponse, prepareQueryRequest } from './models/common';
import {
Paste,
PasteCreateRequest,
PasteCreateResponse,
PasteEditRequest,
PasteListRequest,
PasteShareRequest,
} from './models/paste';
function ensureSuccessfulResponse<T extends ActionResponse>(res: T): T {
if (!res.success) {
throw 'Request failed';
}
return res;
}
export class PastefyClient {
constructor(
private apiKey?: string,
private instanceUrl = 'https://pastefy.app'
) {}
async makeRequest<T extends HttpMessageBody>(
method: HttpMethod,
url: string,
query?: QueryParams,
body?: object
): Promise<T> {
const authentication: Authentication | undefined = this.apiKey
? {
type: AuthenticationType.BEARER_TOKEN,
token: this.apiKey,
}
: undefined;
const res = await httpClient.sendRequest<T>({
method,
url: this.instanceUrl + '/api/v2' + url,
queryParams: query,
body,
authentication,
});
return res.body;
}
async createFolder(
request: FolderCreateRequest
): Promise<FolderCreateResponse> {
return ensureSuccessfulResponse<FolderCreateResponse>(
await this.makeRequest(HttpMethod.POST, '/folder', undefined, request)
);
}
async listFolders(request: FolderListRequest): Promise<Folder[]> {
return await this.makeRequest(
HttpMethod.GET,
'/folder',
prepareQueryRequest(request)
);
}
async getFolder(id: string, request?: FolderGetRequest): Promise<Folder> {
return await this.makeRequest(
HttpMethod.GET,
'/folder/' + id,
prepareQueryRequest(request)
);
}
async getFolderHierarchy(parentId?: string): Promise<FolderHierarchy[]> {
const folders = await this.listFolders({
page_size: 99999,
filter: {
parent: parentId || 'null',
},
});
const hierarchies: FolderHierarchy[] = [];
for (const folder of folders) {
hierarchies.push({
id: folder.id,
name: folder.name,
children: await this.getFolderHierarchy(folder.id),
});
}
return hierarchies;
}
async deleteFolder(id: string): Promise<ActionResponse> {
return ensureSuccessfulResponse(
await this.makeRequest(HttpMethod.DELETE, '/folder/' + id)
);
}
async createPaste(request: PasteCreateRequest): Promise<PasteCreateResponse> {
return ensureSuccessfulResponse<PasteCreateResponse>(
await this.makeRequest(HttpMethod.POST, '/paste', undefined, request)
);
}
async listPastes(request: PasteListRequest): Promise<Paste[]> {
return await this.makeRequest(
HttpMethod.GET,
'/paste',
prepareQueryRequest(request)
);
}
async getPaste(id: string): Promise<Paste> {
return await this.makeRequest(HttpMethod.GET, '/paste/' + id);
}
async editPaste(
id: string,
request: PasteEditRequest
): Promise<ActionResponse> {
return ensureSuccessfulResponse(
await this.makeRequest(HttpMethod.PUT, '/paste/' + id, undefined, request)
);
}
async deletePaste(id: string): Promise<ActionResponse> {
return ensureSuccessfulResponse(
await this.makeRequest(HttpMethod.DELETE, '/paste/' + id)
);
}
async sharePaste(
id: string,
request: PasteShareRequest
): Promise<ActionResponse> {
return ensureSuccessfulResponse(
await this.makeRequest(
HttpMethod.POST,
'/paste/' + id + '/friend',
undefined,
request
)
);
}
}

View File

@@ -0,0 +1,92 @@
import {
AppConnectionValueForAuthProperty,
PiecePropValueSchema,
PiecePropertyMap,
Property,
StaticPropsValue,
} from '@activepieces/pieces-framework';
import { PastefyClient } from './client';
import { FolderHierarchy } from './models/folder';
import { PasteVisibility } from './models/paste';
import { pastefyAuth } from '../..';
interface FlatFolder {
id: string;
name: string;
}
function flattenFolderHierarchy(hierarchy: FolderHierarchy[]): FlatFolder[] {
const folders: FlatFolder[] = [];
for (const h of hierarchy) {
folders.push({ id: h.id, name: h.name });
flattenFolderHierarchy(h.children).forEach((e) => {
folders.push({
id: e.id,
name: h.name + ' / ' + e.name,
});
});
}
return folders;
}
export function formatDate(date?: string): string | undefined {
if (!date) return date;
return date
.replace('T', ' ')
.replace('Z', '')
.replace(/\.[0-9]{3}/, '');
}
export const pastefyCommon = {
folder_id: (required = true, displayName = 'Folder') =>
Property.Dropdown({
auth: pastefyAuth,
description: 'A folder',
displayName: displayName,
required,
refreshers: [],
options: async ({ auth }) => {
if (!auth) {
return {
disabled: true,
placeholder: 'setup authentication first',
options: [],
};
}
const client = makeClient(
auth,
{ ...auth.props }
);
const folders = await client.getFolderHierarchy();
return {
disabled: false,
options: flattenFolderHierarchy(folders).map((folder) => {
return {
label: folder.name,
value: folder.id,
};
}),
};
},
}),
visibility: (required = true) =>
Property.StaticDropdown({
displayName: 'Visibility',
required,
options: {
options: [
{ label: 'Public', value: PasteVisibility.PUBLIC },
{ label: 'Unlisted', value: PasteVisibility.UNLISTED },
{ label: 'Private', value: PasteVisibility.PRIVATE },
],
},
}),
};
export function makeClient(
auth: AppConnectionValueForAuthProperty<typeof pastefyAuth>,
propsValue: StaticPropsValue<PiecePropertyMap>
): PastefyClient {
return new PastefyClient(auth.props.token || undefined, propsValue.instance_url);
}

View File

@@ -0,0 +1,48 @@
import { QueryParams } from '@activepieces/pieces-common';
export interface ActionResponse {
success: boolean;
}
export interface ListRequest {
page?: number;
page_size?: number;
search?: string;
filter?: Record<string, any>;
}
function emptyValueFilter(
accessor: (key: string) => any
): (key: string) => boolean {
return (key: string) => {
const val = accessor(key);
return (
val !== null &&
val !== undefined &&
(typeof val != 'string' || val.length > 0)
);
};
}
export function prepareQueryRequest(
request?: ListRequest | Record<string, any | undefined>
): QueryParams {
const params: QueryParams = {};
if (!request) return params;
const requestObj = request as Record<string, any>;
Object.keys(request)
.filter((k) => k != 'filter')
.filter(emptyValueFilter((k) => requestObj[k]))
.forEach((k: string) => {
params[k] = (request as Record<string, any>)[k].toString();
});
if (request.filter) {
const filter = request.filter; // For some reason required to pass the unidentified check
Object.keys(request.filter)
.filter(emptyValueFilter((k) => filter[k]))
.forEach((k) => {
params['filter[' + k + ']'] = filter[k].toString();
});
}
return params;
}

View File

@@ -0,0 +1,43 @@
import { ActionResponse, ListRequest } from './common';
import { Paste } from './paste';
export interface Folder {
exists: boolean;
id: string;
name: string;
user_id: string;
children?: Folder[];
pastes?: Paste[];
created: string;
}
export interface FolderCreateRequest {
name: string;
parent?: string;
}
export interface FolderCreateResponse extends ActionResponse {
folder: Folder;
}
export interface FolderEditRequest {
name?: string;
}
export interface FolderEditResponse extends ActionResponse {
folder: Folder;
}
export interface FolderGetRequest {
hide_children?: string;
}
export interface FolderListRequest extends ListRequest {
user_id?: string;
}
export interface FolderHierarchy {
id: string;
name: string;
children: FolderHierarchy[];
}

View File

@@ -0,0 +1,75 @@
import { ActionResponse } from './common';
export enum PasteType {
PASTE = 'PASTE',
MULTI_PASTE = 'MULTI_PASTE',
}
export enum PasteVisibility {
PUBLIC = 'PUBLIC',
UNLISTED = 'UNLISTED',
PRIVATE = 'PRIVATE',
}
export interface Paste {
exists: boolean;
id: string;
content: string;
title: string;
encrypted: boolean;
folder: string;
user_id?: string;
visibility: PasteVisibility;
forked_from?: string;
raw_url: string;
type: PasteType;
created_at: string;
expire_at?: string;
}
export interface PasteCreateRequest {
title?: string;
content: string;
encrypted?: boolean;
folder?: string;
expire_at?: string;
forked_from?: string;
visibility?: PasteVisibility;
type?: PasteType;
}
export interface PasteCreateResponse extends ActionResponse {
paste: Paste;
}
export interface PasteEditRequest {
title?: string;
content?: string;
encrypted?: boolean;
folder?: string;
type?: PasteType;
visibility?: PasteVisibility;
expire_at?: string;
}
export interface PasteEditResponse extends ActionResponse {
paste: Paste;
}
export interface PasteShareRequest {
friend: string;
}
export interface PasteListRequest {
page?: number;
page_size?: number;
search?: string;
shorten_content?: boolean;
}
export interface PasteListTrendingRequest {
page?: number;
page_size?: number;
trending?: boolean;
shorten_content?: boolean;
}

View File

@@ -0,0 +1,21 @@
export enum UserType {
USER,
ADMIN,
BLOCKED,
AWAITING_ACCESS,
}
export interface User {
name: string;
avatar?: string;
displayName: string;
}
export interface DetailedUser extends User {
id: string;
color: string;
profile_picture?: string;
logged_in: true;
auth_type: string;
type: UserType;
}

View File

@@ -0,0 +1,3 @@
import pasteChanged from './paste-changed';
export default [pasteChanged];

View File

@@ -0,0 +1,72 @@
import {
createTrigger,
Property,
StoreScope,
TriggerStrategy,
} from '@activepieces/pieces-framework';
import { makeClient } from '../common';
import { createHash } from 'crypto';
import { pastefyAuth } from '../..';
export default createTrigger({
auth: pastefyAuth,
name: 'paste_changed',
displayName: 'Paste Changed',
description: 'Triggers when the content (or title) of the paste changes',
type: TriggerStrategy.POLLING,
props: {
paste_id: Property.ShortText({
displayName: 'Paste ID',
required: true,
}),
include_title: Property.Checkbox({
displayName: 'Include Title',
required: false,
}),
},
sampleData: {},
onEnable: async (context) => {
const client = makeClient(context.auth, context.propsValue);
const paste = await client.getPaste(context.propsValue.paste_id);
const hash = createHash('md5')
.update(
paste.content + (context.propsValue.include_title ? paste.title : '')
)
.digest('hex');
await context.store.put(
'paste_changed_trigger_hash',
hash,
StoreScope.FLOW
);
},
onDisable: async (context) => {
await context.store.delete('paste_changed_trigger_hash', StoreScope.FLOW);
},
run: async (context) => {
const oldHash = await context.store.get(
'paste_changed_trigger_hash',
StoreScope.FLOW
);
const client = makeClient(context.auth, context.propsValue);
const paste = await client.getPaste(context.propsValue.paste_id);
const newHash = createHash('md5')
.update(
paste.content + (context.propsValue.include_title ? paste.title : '')
)
.digest('hex');
if (oldHash != newHash) {
await context.store.put(
'paste_changed_trigger_hash',
newHash,
StoreScope.FLOW
);
return [paste];
}
return [];
},
test: async (context) => {
const client = makeClient(context.auth, context.propsValue);
const paste = await client.getPaste(context.propsValue.paste_id);
return [paste];
},
});

View File

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

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"]
}