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:
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": ["../../../../.eslintrc.base.json"],
|
||||
"ignorePatterns": ["!**/*"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||
"rules": {},
|
||||
"extends": ["plugin:prettier/recommended"],
|
||||
"plugins": ["prettier"]
|
||||
},
|
||||
{
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
# pieces-snowflake
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "@activepieces/piece-snowflake",
|
||||
"version": "0.0.17",
|
||||
"dependencies": {
|
||||
"snowflake-sdk": "1.9.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "pieces-snowflake",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/snowflake/src",
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"options": {
|
||||
"outputPath": "dist/packages/pieces/community/snowflake",
|
||||
"tsConfig": "packages/pieces/community/snowflake/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/snowflake/package.json",
|
||||
"main": "packages/pieces/community/snowflake/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/snowflake/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/snowflake/src/i18n",
|
||||
"output": "./src/i18n",
|
||||
"glob": "**/!(i18n.json)"
|
||||
}
|
||||
],
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies",
|
||||
"updateBuildableProjectDepsInPackageJson": true
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build",
|
||||
"prebuild"
|
||||
]
|
||||
},
|
||||
"publish": {
|
||||
"command": "node tools/scripts/publish.mjs pieces-snowflake {args.ver} {args.tag}",
|
||||
"dependsOn": [
|
||||
"build"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
]
|
||||
},
|
||||
"prebuild": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/pieces/community/snowflake",
|
||||
"command": "bun install --no-save --silent"
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Data warehouse built for the cloud": "Datenlager für die Cloud gebaut",
|
||||
"Account": "Konto",
|
||||
"Username": "Benutzername",
|
||||
"Password": "Kennwort",
|
||||
"Private Key": "Privater Schlüssel",
|
||||
"Database": "Datenbank",
|
||||
"Role": "Rolle",
|
||||
"Warehouse": "Lagerhaus",
|
||||
"A string indicating the Snowflake account identifier.": "Eine Zeichenkette, die die Kennung des Snowflake Accounts angibt.",
|
||||
"The login name for your Snowflake user.": "Der Loginname für Ihren Snowflake Benutzer.",
|
||||
"Password for the user.": "Passwort für den Benutzer.",
|
||||
"The private key to authenticate with. Either this or password is required": "Der private Schlüssel für die Authentifizierung erforderlich ist. Entweder dieser oder das Passwort ist erforderlich",
|
||||
"The default database to use for the session after connecting.": "Die Standarddatenbank für die Sitzung nach der Verbindung.",
|
||||
"The default security role to use for the session after connecting.": "Die standardmäßige Sicherheitsrolle, die nach der Verbindung für die Sitzung verwendet wird.",
|
||||
"The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.": "Das voreingestellte virtuelle Lager für die Sitzung nach der Verbindung. Wird für Abfragen, Ladedaten usw. verwendet.",
|
||||
"Run Query": "Abfrage ausführen",
|
||||
"Run Multiple Queries": "Mehrere Abfragen ausführen",
|
||||
"Insert Row": "Insert Row",
|
||||
"Insert a row into a table.": "Fügen Sie eine Zeile in eine Tabelle ein.",
|
||||
"SQL query": "SQL-Abfrage",
|
||||
"Parameters": "Parameter",
|
||||
"Query timeout (ms)": "Abfrage-Timeout (ms)",
|
||||
"Application name": "Anwendungsname",
|
||||
"SQL queries": "SQL-Abfragen",
|
||||
"Use Transaction": "Transaktion verwenden",
|
||||
"Schema": "Schema",
|
||||
"Table": "Tisch",
|
||||
"Rows": "Zeilen",
|
||||
"Use :1, :2… or ? placeholders to use binding parameters.": "Verwenden Sie :1, :2… oder ? Platzhalter, um Verbindungsparameter zu verwenden.",
|
||||
"Binding parameters for the SQL query (to prevent SQL injection attacks)": "Bindung von Parametern für die SQL-Abfrage (um SQL-Injektionsangriffe zu vermeiden)",
|
||||
"An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.": "Ein Integer, der die maximale Anzahl an Millisekunden angibt, die vor dem Timing auf den Abschluss einer Abfrage warten sollen.",
|
||||
"A string indicating the name of the client application connecting to the server.": "Ein String, der den Namen der Client-Anwendung angibt, die sich mit dem Server verbindet.",
|
||||
"Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.": "Array von SQL-Abfragen, die in der gleichen Transaktion in der Reihenfolge ausgeführt werden sollen. Verwenden Sie :1, :2… Platzhalter, um Verbindungsparameter zu verwenden. Vermeiden Sie die Verwendung von \"?\", um unerwartete Verhaltensweisen zu vermeiden, wenn Sie mehrere Abfragen haben.",
|
||||
"Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.": "Verbinden von Parametern, die über alle Abfragen geteilt werden, um SQL-Einspritzangriffe zu verhindern. Verwenden Sie :1, :2, etc. um Parameter in der Reihenfolge zu referenzieren. Vermeiden Sie die Verwendung von \"?\", um unerwartetes Verhalten zu vermeiden, wenn Sie mehrere Abfragen haben. Unbenutzte Parameter sind erlaubt.",
|
||||
"When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back.": "Wenn aktiviert, werden alle Abfragen in einer einzigen Transaktion ausgeführt. Wenn eine Abfrage fehlschlägt, werden alle Änderungen zurückgesetzt."
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Data warehouse built for the cloud": "Almacén de datos construido para la nube",
|
||||
"Account": "Cuenta",
|
||||
"Username": "Usuario",
|
||||
"Password": "Contraseña",
|
||||
"Private Key": "Clave Privada",
|
||||
"Database": "Base de datos",
|
||||
"Role": "Rol",
|
||||
"Warehouse": "Almacén",
|
||||
"A string indicating the Snowflake account identifier.": "Una cadena que indica el identificador de cuenta de Snowflake.",
|
||||
"The login name for your Snowflake user.": "El nombre de usuario para su usuario de Snowflake.",
|
||||
"Password for the user.": "Contraseña para el usuario.",
|
||||
"The private key to authenticate with. Either this or password is required": "La clave privada con la que autenticarse. O esto o la contraseña es necesaria",
|
||||
"The default database to use for the session after connecting.": "La base de datos por defecto a usar para la sesión después de conectarse.",
|
||||
"The default security role to use for the session after connecting.": "El rol de seguridad predeterminado a usar para la sesión después de conectarse.",
|
||||
"The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.": "Almacén virtual por defecto a usar para la sesión después de conectarse. Utilizado para realizar consultas, cargar datos, etc.",
|
||||
"Run Query": "Ejecutar consulta",
|
||||
"Run Multiple Queries": "Ejecutar múltiples consultas",
|
||||
"Insert Row": "Insert Row",
|
||||
"Insert a row into a table.": "Inserta una fila en una tabla.",
|
||||
"SQL query": "Consulta SQL",
|
||||
"Parameters": "Parámetros",
|
||||
"Query timeout (ms)": "Tiempo de espera de consulta (ms)",
|
||||
"Application name": "Nombre de la aplicación",
|
||||
"SQL queries": "Consultas SQL",
|
||||
"Use Transaction": "Usar transacción",
|
||||
"Schema": "Esquema",
|
||||
"Table": "Tabla",
|
||||
"Rows": "Filas",
|
||||
"Use :1, :2… or ? placeholders to use binding parameters.": "Utilice :1, :2… o ? marcadores de posición para usar parámetros de enlazado.",
|
||||
"Binding parameters for the SQL query (to prevent SQL injection attacks)": "Parámetros de enlace para la consulta SQL (para prevenir ataques de inyección SQL)",
|
||||
"An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.": "Un entero que indica el número máximo de milisegundos a esperar a que se complete una consulta antes de agotar el tiempo de espera.",
|
||||
"A string indicating the name of the client application connecting to the server.": "Una cadena que indica el nombre de la aplicación cliente que se conecta al servidor.",
|
||||
"Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.": "Arreglo de consultas SQL a ejecutar en orden, en la misma transacción. Use :1, :2… marcadores de posición para usar parámetros de enlazado. Evite usar \"?\" para evitar comportamientos inesperados cuando tenga múltiples consultas.",
|
||||
"Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.": "Enlazar parámetros compartidos en todas las consultas para prevenir ataques de inyección SQL. Utilice :1, :2, etc. para referenciar parámetros en orden. Evita usar \"?\" para evitar comportamientos inesperados cuando se tienen múltiples consultas. Se permiten parámetros no utilizados.",
|
||||
"When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back.": "Cuando está habilitado, todas las consultas se ejecutarán en una sola transacción. Si cualquier consulta falla, todos los cambios se cancelarán."
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Data warehouse built for the cloud": "Entrepôt de données construit pour le cloud",
|
||||
"Account": "Compte client",
|
||||
"Username": "Nom d'utilisateur",
|
||||
"Password": "Password",
|
||||
"Private Key": "Clé privée",
|
||||
"Database": "Base de données",
|
||||
"Role": "Rôle",
|
||||
"Warehouse": "Entrepôt",
|
||||
"A string indicating the Snowflake account identifier.": "Une chaîne de caractères indiquant l'identifiant du compte Snowflake.",
|
||||
"The login name for your Snowflake user.": "Le nom de connexion de votre utilisateur Snowflake.",
|
||||
"Password for the user.": "Mot de passe pour l'utilisateur.",
|
||||
"The private key to authenticate with. Either this or password is required": "La clé privée avec laquelle s'authentifier. Soit ceci ou le mot de passe est requis",
|
||||
"The default database to use for the session after connecting.": "La base de données par défaut à utiliser pour la session après la connexion.",
|
||||
"The default security role to use for the session after connecting.": "Le rôle de sécurité par défaut à utiliser pour la session après la connexion.",
|
||||
"The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.": "L'entrepôt virtuel par défaut à utiliser pour la session après la connexion. Utilisé pour effectuer des requêtes, charger des données, etc.",
|
||||
"Run Query": "Exécuter la requête",
|
||||
"Run Multiple Queries": "Exécuter plusieurs requêtes",
|
||||
"Insert Row": "Insert Row",
|
||||
"Insert a row into a table.": "Insérer une ligne dans une table.",
|
||||
"SQL query": "Requête SQL",
|
||||
"Parameters": "Paramètres",
|
||||
"Query timeout (ms)": "Délai d'attente de requête (ms)",
|
||||
"Application name": "Nom de l'application",
|
||||
"SQL queries": "Requêtes SQL",
|
||||
"Use Transaction": "Utiliser la transaction",
|
||||
"Schema": "Schéma",
|
||||
"Table": "Tableau",
|
||||
"Rows": "Lignes",
|
||||
"Use :1, :2… or ? placeholders to use binding parameters.": "Utilisez :1, :2… ou ? des espaces réservés pour utiliser les paramètres de liaison.",
|
||||
"Binding parameters for the SQL query (to prevent SQL injection attacks)": "Paramètres de liaison pour la requête SQL (pour éviter les attaques d'injection SQL)",
|
||||
"An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.": "Un entier indiquant le nombre maximum de millisecondes à attendre qu'une requête soit terminée avant de la mettre en attente.",
|
||||
"A string indicating the name of the client application connecting to the server.": "Une chaîne de caractères indiquant le nom de l'application cliente se connectant au serveur.",
|
||||
"Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.": "Tableau des requêtes SQL à exécuter dans l'ordre, dans la même transaction. Utilisez :1, :2… des espaces réservés pour utiliser les paramètres de liaison. Évitez d'utiliser \"?\" pour éviter les comportements inattendus lorsque vous avez plusieurs requêtes.",
|
||||
"Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.": "Paramètres de liaison partagés entre toutes les requêtes pour prévenir les attaques d'injection SQL. Utilisez :1, :2, etc. pour référencer les paramètres dans l'ordre. Évitez d'utiliser \"?\" pour éviter les comportements inattendus lorsque vous avez plusieurs requêtes. Les paramètres inutilisés sont autorisés.",
|
||||
"When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back.": "Lorsque cette option est activée, toutes les requêtes seront exécutées dans une seule transaction. Si une requête échoue, toutes les modifications seront annulées."
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Data warehouse built for the cloud": "クラウド用に構築されたデータ倉庫",
|
||||
"Account": "アカウント",
|
||||
"Username": "ユーザー名",
|
||||
"Password": "パスワード",
|
||||
"Private Key": "プライベートキー",
|
||||
"Database": "データベース",
|
||||
"Role": "ロール",
|
||||
"Warehouse": "倉庫",
|
||||
"A string indicating the Snowflake account identifier.": "Snowflake アカウント識別子を示す文字列。",
|
||||
"The login name for your Snowflake user.": "Snowflake ユーザーのログイン名。",
|
||||
"Password for the user.": "ユーザーのパスワード",
|
||||
"The private key to authenticate with. Either this or password is required": "この秘密鍵またはパスワードが必要です",
|
||||
"The default database to use for the session after connecting.": "接続後のセッションで使用するデフォルトのデータベース。",
|
||||
"The default security role to use for the session after connecting.": "接続後のセッションに使用するデフォルトのセキュリティーロール。",
|
||||
"The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.": "接続後のセッションで使用するデフォルトの仮想倉庫です。クエリの実行、データの読み込みなどに使用します。",
|
||||
"Run Query": "クエリの実行",
|
||||
"Run Multiple Queries": "複数のクエリを実行",
|
||||
"Insert Row": "Insert Row",
|
||||
"Insert a row into a table.": "テーブルに行を挿入します。",
|
||||
"SQL query": "SQL クエリ",
|
||||
"Parameters": "パラメータ",
|
||||
"Query timeout (ms)": "クエリのタイムアウト (ms)",
|
||||
"Application name": "アプリケーション名",
|
||||
"SQL queries": "SQL クエリ",
|
||||
"Use Transaction": "トランザクションを使用",
|
||||
"Schema": "スキーマ",
|
||||
"Table": "表",
|
||||
"Rows": "行",
|
||||
"Use :1, :2… or ? placeholders to use binding parameters.": "バインディングパラメータを使用するには、:1、:2… または ? プレースホルダを使用します。",
|
||||
"Binding parameters for the SQL query (to prevent SQL injection attacks)": "SQLクエリのパラメータのバインド(SQLインジェクション攻撃を防ぐため)",
|
||||
"An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.": "タイムアウト前にクエリが完了するまで待機する最大ミリ秒数を示す整数。",
|
||||
"A string indicating the name of the client application connecting to the server.": "サーバーに接続しているクライアント・アプリケーションの名前を示す文字列。",
|
||||
"Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.": "同じトランザクションで順番に実行するSQLクエリの配列です。バインディングパラメータを使用するには、:1、:2… プレースホルダを使用してください。 複数のクエリがある場合、予期しない動作を避けるために \"?\" を使用しないでください。",
|
||||
"Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.": "SQLインジェクション攻撃を防ぐために、すべてのクエリ間で共有されるパラメータをバインドします。参照パラメータの順序には、:1、:2などを使用します。 複数のクエリがある場合、予期しない動作を避けるために \"?\" を使用しないでください。未使用のパラメータは許可されています。",
|
||||
"When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back.": "有効にすると、すべてのクエリは単一のトランザクションで実行されます。失敗した場合は、すべての変更がロールバックされます。"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Data warehouse built for the cloud": "Data magazijn gebouwd voor de cloud",
|
||||
"Account": "Rekening",
|
||||
"Username": "Gebruikersnaam",
|
||||
"Password": "Wachtwoord",
|
||||
"Private Key": "Persoonlijke sleutel",
|
||||
"Database": "Database",
|
||||
"Role": "Functie",
|
||||
"Warehouse": "Magazijn",
|
||||
"A string indicating the Snowflake account identifier.": "Een string die de Snowflake account identificatie aangeeft.",
|
||||
"The login name for your Snowflake user.": "De inlognaam voor uw Snowflake gebruiker.",
|
||||
"Password for the user.": "Wachtwoord voor de gebruiker.",
|
||||
"The private key to authenticate with. Either this or password is required": "De geheime sleutel om mee te verifiëren. Of dit of het wachtwoord is vereist",
|
||||
"The default database to use for the session after connecting.": "De standaard database te gebruiken voor de sessie na verbinden.",
|
||||
"The default security role to use for the session after connecting.": "De standaard beveiligingsrol die moet worden gebruikt voor de sessie na het verbinden.",
|
||||
"The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.": "Het standaard virtuele magazijn dat moet worden gebruikt voor de sessie na het verbinden. Gebruikt voor het uitvoeren van query's, gegevens laden, etc.",
|
||||
"Run Query": "Query uitvoeren",
|
||||
"Run Multiple Queries": "Voer meerdere query's uit",
|
||||
"Insert Row": "Rijen invoegen",
|
||||
"Insert a row into a table.": "Plaats een rij in een tafel.",
|
||||
"SQL query": "SQL query",
|
||||
"Parameters": "Parameters",
|
||||
"Query timeout (ms)": "Query timeout (ms)",
|
||||
"Application name": "Naam toepassing",
|
||||
"SQL queries": "SQL zoekopdrachten",
|
||||
"Use Transaction": "Transactie gebruiken",
|
||||
"Schema": "Schema",
|
||||
"Table": "Tabel",
|
||||
"Rows": "Rijen",
|
||||
"Use :1, :2… or ? placeholders to use binding parameters.": "Gebruik :1, :2… of ? plaatsvervangers om bindende parameters te gebruiken.",
|
||||
"Binding parameters for the SQL query (to prevent SQL injection attacks)": "Bindende parameters voor de SQL query (om aanvallen van SQL injectie te voorkomen)",
|
||||
"An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.": "Een integer geeft het maximale aantal milliseconden aan om te wachten tot een query is voltooid voordat de deadline is bereikt.",
|
||||
"A string indicating the name of the client application connecting to the server.": "Een string die de naam aangeeft van de client applicatie die naar de server verbindt.",
|
||||
"Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.": "Array van SQL queries om in volgorde uit te voeren, in dezelfde transactie. Gebruik :1, :2… placeholders om bindende parameters te gebruiken. Vermijd het gebruik van \"?\" om onverwachte gedragingen te vermijden bij het hebben van meerdere query's.",
|
||||
"Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.": "Binden parameters gedeeld over alle queries om SQL injectie aanvallen te voorkomen. Gebruik :1, :2, etc. om in volgorde te refereren. Vermijd het gebruik van \"?\" om onverwachte gedragingen te voorkomen bij het hebben van meerdere queries. Ongebruikte parameters zijn toegestaan.",
|
||||
"When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back.": "Wanneer ingeschakeld, worden alle query's uitgevoerd in een enkele transactie. Als een query mislukt, worden alle wijzigingen teruggedraaid"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Data warehouse built for the cloud": "Armazém de dados construído para a nuvem",
|
||||
"Account": "conta",
|
||||
"Username": "Usuário:",
|
||||
"Password": "Senha",
|
||||
"Private Key": "Chave Privada",
|
||||
"Database": "Banco",
|
||||
"Role": "Funções",
|
||||
"Warehouse": "Armazém",
|
||||
"A string indicating the Snowflake account identifier.": "Uma string indicando o identificador da conta no Floco de Neve.",
|
||||
"The login name for your Snowflake user.": "O nome de login para seu usuário do Floco de Neve.",
|
||||
"Password for the user.": "Senha para o usuário.",
|
||||
"The private key to authenticate with. Either this or password is required": "A chave privada para se autenticar. Ou isto ou a senha é necessária",
|
||||
"The default database to use for the session after connecting.": "O banco de dados padrão a ser usado na sessão depois de conectar.",
|
||||
"The default security role to use for the session after connecting.": "O papel de segurança padrão a ser usado na sessão após a conexão.",
|
||||
"The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.": "O armazém virtual padrão a ser usado na sessão após a conexão. Usado para executar consultas, carregar dados, etc.",
|
||||
"Run Query": "Executar consulta",
|
||||
"Run Multiple Queries": "Executar múltiplas consultas",
|
||||
"Insert Row": "Insert Row",
|
||||
"Insert a row into a table.": "Inserir uma linha em uma tabela.",
|
||||
"SQL query": "Consulta SQL",
|
||||
"Parameters": "Parâmetros",
|
||||
"Query timeout (ms)": "Tempo limite da consulta (ms)",
|
||||
"Application name": "Nome do aplicativo",
|
||||
"SQL queries": "Consultas SQL",
|
||||
"Use Transaction": "Usar transação",
|
||||
"Schema": "Esquema",
|
||||
"Table": "Classificações",
|
||||
"Rows": "Linhas",
|
||||
"Use :1, :2… or ? placeholders to use binding parameters.": "Use :1, :2… ou ? espaços reservados para usar a fixação de parâmetros.",
|
||||
"Binding parameters for the SQL query (to prevent SQL injection attacks)": "Vinculando parâmetros para a consulta SQL (para evitar ataques de injeção de SQL)",
|
||||
"An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.": "Um inteiro indicando o número máximo de milissegundos a esperar que uma consulta seja concluída antes do tempo limite.",
|
||||
"A string indicating the name of the client application connecting to the server.": "Uma string indicando o nome da aplicação cliente conectando ao servidor.",
|
||||
"Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.": "Array de consultas SQL para ser executado em ordem, na mesma transação. Use :1, :2… espaços reservados para usar a vinculação de parâmetros. Evite usar \"?\" para evitar comportamentos inesperados quando estiver fazendo várias pesquisas.",
|
||||
"Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.": "Vinculando parâmetros compartilhados em todas as consultas para evitar ataques de injeção de SQL. Use :1, :2, etc. para fazer referência a parâmetros na ordem. Evite usar \"?\" para evitar comportamentos inesperados quando estiver tendo várias consultas. Parâmetros não usados são permitidos.",
|
||||
"When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back.": "Quando ativado, todas as consultas serão executadas em uma única transação. Se qualquer consulta falhar, todas as mudanças serão revertidas."
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"Snowflake": "Снежинка",
|
||||
"Data warehouse built for the cloud": "Хранилище данных построено для облака",
|
||||
"Account": "Аккаунт",
|
||||
"Username": "Имя пользователя",
|
||||
"Password": "Пароль",
|
||||
"Database": "База данных",
|
||||
"Role": "Роль",
|
||||
"Warehouse": "Склад",
|
||||
"A string indicating the Snowflake account identifier.": "Строка, указывающая идентификатор учетной записи Snowflake.",
|
||||
"The login name for your Snowflake user.": "Логин пользователя Snowflake.",
|
||||
"Password for the user.": "Пароль для пользователя.",
|
||||
"The default database to use for the session after connecting.": "База данных по умолчанию используется для сессии после подключения.",
|
||||
"The default security role to use for the session after connecting.": "Роль безопасности по умолчанию, используемая для сессии после подключения.",
|
||||
"The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.": "Виртуальный склад по умолчанию используется для сессии после подключения. Используется для выполнения запросов, загрузки данных и т.д.",
|
||||
"Run Query": "Запустить запрос",
|
||||
"Run Multiple Queries": "Выполнить несколько запросов",
|
||||
"Insert Row": "Insert Row",
|
||||
"Insert a row into a table.": "Вставить строку в таблицу.",
|
||||
"SQL query": "SQL-запрос",
|
||||
"Parameters": "Параметры",
|
||||
"Query timeout (ms)": "Таймаут запроса (мс)",
|
||||
"Application name": "Имя приложения",
|
||||
"SQL queries": "SQL-запросы",
|
||||
"Use Transaction": "Использовать транзакцию",
|
||||
"Schema": "Схема",
|
||||
"Table": "Таблица",
|
||||
"Rows": "Строки",
|
||||
"Use :1, :2… or ? placeholders to use binding parameters.": "Используйте :1, :2… или ? заполнители для использования параметров привязки.",
|
||||
"Binding parameters for the SQL query (to prevent SQL injection attacks)": "Привязка параметров SQL-запроса (для предотвращения инжекции SQL)",
|
||||
"An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.": "Целое число, указывающее максимальное количество миллисекунд в ожидании выполнения запроса до истечения таймаута.",
|
||||
"A string indicating the name of the client application connecting to the server.": "Строка, указывающая имя клиентского приложения, подключаемого к серверу.",
|
||||
"Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.": "Массив SQL-запросов для выполнения по порядку в той же транзакции. Используйте :1, :2… для использования обязательных параметров. Избегайте использования \"?\", чтобы избежать неожиданных действий при нескольких запросах.",
|
||||
"Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.": "Привязка параметров ко всем запросам для предотвращения атак SQL инъекций. Используйте :1, :2 и т. д. для ссылочных параметров в порядке. Избегайте использования \"?\", чтобы избежать неожиданных действий при наличии нескольких запросов. Разрешены неиспользуемые параметры.",
|
||||
"When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back.": "Если включено, все запросы будут выполняться в рамках одной транзакции. Если запрос не удается, все изменения будут отменены."
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Data warehouse built for the cloud": "Data warehouse built for the cloud",
|
||||
"Account": "Account",
|
||||
"Username": "Username",
|
||||
"Password": "Password",
|
||||
"Private Key": "Private Key",
|
||||
"Database": "Database",
|
||||
"Role": "Role",
|
||||
"Warehouse": "Warehouse",
|
||||
"A string indicating the Snowflake account identifier.": "A string indicating the Snowflake account identifier.",
|
||||
"The login name for your Snowflake user.": "The login name for your Snowflake user.",
|
||||
"Password for the user.": "Password for the user.",
|
||||
"The private key to authenticate with. Either this or password is required": "The private key to authenticate with. Either this or password is required",
|
||||
"The default database to use for the session after connecting.": "The default database to use for the session after connecting.",
|
||||
"The default security role to use for the session after connecting.": "The default security role to use for the session after connecting.",
|
||||
"The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.": "The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.",
|
||||
"Run Query": "Run Query",
|
||||
"Run Multiple Queries": "Run Multiple Queries",
|
||||
"Insert Row": "Insert Row",
|
||||
"Insert a row into a table.": "Insert a row into a table.",
|
||||
"SQL query": "SQL query",
|
||||
"Parameters": "Parameters",
|
||||
"Query timeout (ms)": "Query timeout (ms)",
|
||||
"Application name": "Application name",
|
||||
"SQL queries": "SQL queries",
|
||||
"Use Transaction": "Use Transaction",
|
||||
"Schema": "Schema",
|
||||
"Table": "Table",
|
||||
"Rows": "Rows",
|
||||
"Use :1, :2… or ? placeholders to use binding parameters.": "Use :1, :2… or ? placeholders to use binding parameters.",
|
||||
"Binding parameters for the SQL query (to prevent SQL injection attacks)": "Binding parameters for the SQL query (to prevent SQL injection attacks)",
|
||||
"An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.": "An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.",
|
||||
"A string indicating the name of the client application connecting to the server.": "A string indicating the name of the client application connecting to the server.",
|
||||
"Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.": "Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.",
|
||||
"Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.": "Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.",
|
||||
"When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back.": "When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back."
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"Snowflake": "Snowflake",
|
||||
"Data warehouse built for the cloud": "Data warehouse built for the cloud",
|
||||
"Account": "Account",
|
||||
"Username": "Username",
|
||||
"Password": "Password",
|
||||
"Database": "Database",
|
||||
"Role": "Vai trò",
|
||||
"Warehouse": "Warehouse",
|
||||
"A string indicating the Snowflake account identifier.": "A string indicating the Snowflake account identifier.",
|
||||
"The login name for your Snowflake user.": "The login name for your Snowflake user.",
|
||||
"Password for the user.": "Password for the user.",
|
||||
"The default database to use for the session after connecting.": "The default database to use for the session after connecting.",
|
||||
"The default security role to use for the session after connecting.": "The default security role to use for the session after connecting.",
|
||||
"The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.": "The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.",
|
||||
"Run Query": "Run Query",
|
||||
"Run Multiple Queries": "Run Multiple Queries",
|
||||
"Insert Row": "Insert Row",
|
||||
"Insert a row into a table.": "Insert a row into a table.",
|
||||
"SQL query": "SQL query",
|
||||
"Parameters": "Parameters",
|
||||
"Query timeout (ms)": "Query timeout (ms)",
|
||||
"Application name": "Application name",
|
||||
"SQL queries": "SQL queries",
|
||||
"Use Transaction": "Use Transaction",
|
||||
"Schema": "Schema",
|
||||
"Table": "Table",
|
||||
"Rows": "Rows",
|
||||
"Use :1, :2… or ? placeholders to use binding parameters.": "Use :1, :2… or ? placeholders to use binding parameters.",
|
||||
"Binding parameters for the SQL query (to prevent SQL injection attacks)": "Binding parameters for the SQL query (to prevent SQL injection attacks)",
|
||||
"An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.": "An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.",
|
||||
"A string indicating the name of the client application connecting to the server.": "A string indicating the name of the client application connecting to the server.",
|
||||
"Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.": "Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.",
|
||||
"Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.": "Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.",
|
||||
"When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back.": "When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back."
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Data warehouse built for the cloud": "Data warehouse built for the cloud",
|
||||
"Account": "Account",
|
||||
"Username": "用户名",
|
||||
"Password": "密码",
|
||||
"Private Key": "Private Key",
|
||||
"Database": "Database",
|
||||
"Role": "作用",
|
||||
"Warehouse": "Warehouse",
|
||||
"A string indicating the Snowflake account identifier.": "A string indicating the Snowflake account identifier.",
|
||||
"The login name for your Snowflake user.": "The login name for your Snowflake user.",
|
||||
"Password for the user.": "Password for the user.",
|
||||
"The private key to authenticate with. Either this or password is required": "The private key to authenticate with. Either this or password is required",
|
||||
"The default database to use for the session after connecting.": "The default database to use for the session after connecting.",
|
||||
"The default security role to use for the session after connecting.": "The default security role to use for the session after connecting.",
|
||||
"The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.": "The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.",
|
||||
"Run Query": "Run Query",
|
||||
"Run Multiple Queries": "Run Multiple Queries",
|
||||
"Insert Row": "Insert Row",
|
||||
"Insert a row into a table.": "Insert a row into a table.",
|
||||
"SQL query": "SQL query",
|
||||
"Parameters": "Parameters",
|
||||
"Query timeout (ms)": "Query timeout (ms)",
|
||||
"Application name": "Application name",
|
||||
"SQL queries": "SQL queries",
|
||||
"Use Transaction": "Use Transaction",
|
||||
"Schema": "Schema",
|
||||
"Table": "表",
|
||||
"Rows": "Rows",
|
||||
"Use :1, :2… or ? placeholders to use binding parameters.": "Use :1, :2… or ? placeholders to use binding parameters.",
|
||||
"Binding parameters for the SQL query (to prevent SQL injection attacks)": "Binding parameters for the SQL query (to prevent SQL injection attacks)",
|
||||
"An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.": "An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.",
|
||||
"A string indicating the name of the client application connecting to the server.": "A string indicating the name of the client application connecting to the server.",
|
||||
"Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.": "Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries.",
|
||||
"Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.": "Binding parameters shared across all queries to prevent SQL injection attacks. Use :1, :2, etc. to reference parameters in order. Avoid using \"?\" to avoid unexpected behaviors when having multiple queries. Unused parameters are allowed.",
|
||||
"When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back.": "When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back."
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import {
|
||||
createPiece,
|
||||
PieceAuth,
|
||||
Property,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import { runMultipleQueries } from './lib/actions/run-multiple-queries';
|
||||
import { runQuery } from './lib/actions/run-query';
|
||||
import { PieceCategory } from '@activepieces/shared';
|
||||
import { insertRowAction } from './lib/actions/insert-row';
|
||||
|
||||
export const snowflakeAuth = PieceAuth.CustomAuth({
|
||||
props: {
|
||||
account: Property.ShortText({
|
||||
displayName: 'Account',
|
||||
required: true,
|
||||
description: 'A string indicating the Snowflake account identifier.',
|
||||
}),
|
||||
username: Property.ShortText({
|
||||
displayName: 'Username',
|
||||
required: true,
|
||||
description: 'The login name for your Snowflake user.',
|
||||
}),
|
||||
password: PieceAuth.SecretText({
|
||||
displayName: 'Password',
|
||||
description: 'Password for the user.',
|
||||
required: false,
|
||||
}),
|
||||
privateKey: PieceAuth.SecretText({
|
||||
displayName: 'Private Key',
|
||||
description:
|
||||
'The private key to authenticate with. Either this or password is required',
|
||||
required: false,
|
||||
}),
|
||||
database: Property.ShortText({
|
||||
displayName: 'Database',
|
||||
description:
|
||||
'The default database to use for the session after connecting.',
|
||||
required: false,
|
||||
}),
|
||||
role: Property.ShortText({
|
||||
displayName: 'Role',
|
||||
description:
|
||||
'The default security role to use for the session after connecting.',
|
||||
required: false,
|
||||
}),
|
||||
warehouse: Property.ShortText({
|
||||
displayName: 'Warehouse',
|
||||
description:
|
||||
'The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.',
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
required: true,
|
||||
validate: async ({ auth }) => {
|
||||
if (!auth.password && !auth.privateKey) {
|
||||
return {
|
||||
valid: false,
|
||||
error:
|
||||
'Either password or private key must be provided for authentication.',
|
||||
};
|
||||
}
|
||||
return {
|
||||
valid: true,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export const snowflake = createPiece({
|
||||
displayName: 'Snowflake',
|
||||
description: 'Data warehouse built for the cloud',
|
||||
|
||||
auth: snowflakeAuth,
|
||||
minimumSupportedRelease: '0.27.1',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/snowflake.png',
|
||||
categories: [PieceCategory.DEVELOPER_TOOLS],
|
||||
authors: ['AdamSelene', 'abuaboud', 'valentin-mourtialon'],
|
||||
actions: [runQuery, runMultipleQueries, insertRowAction],
|
||||
triggers: [],
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
import { createAction } from '@activepieces/pieces-framework';
|
||||
import { snowflakeAuth } from '../../';
|
||||
import {
|
||||
configureConnection,
|
||||
connect,
|
||||
destroy,
|
||||
execute,
|
||||
snowflakeCommonProps,
|
||||
} from '../common';
|
||||
|
||||
export const insertRowAction = createAction({
|
||||
name: 'insert-row',
|
||||
displayName: 'Insert Row',
|
||||
description: 'Insert a row into a table.',
|
||||
auth: snowflakeAuth,
|
||||
props: {
|
||||
database: snowflakeCommonProps.database,
|
||||
schema: snowflakeCommonProps.schema,
|
||||
table: snowflakeCommonProps.table,
|
||||
table_column_values: snowflakeCommonProps.table_column_values,
|
||||
},
|
||||
async run(context) {
|
||||
const tableName = context.propsValue.table;
|
||||
const tableColumnValues = context.propsValue.table_column_values;
|
||||
|
||||
const columns = Object.keys(tableColumnValues).join(',');
|
||||
const valuePlaceholders = Object.keys(tableColumnValues)
|
||||
.map(() => '?')
|
||||
.join(', ');
|
||||
const statement = `INSERT INTO ${tableName}(${columns}) VALUES(${valuePlaceholders})`;
|
||||
|
||||
const connection = configureConnection(context.auth.props);
|
||||
await connect(connection);
|
||||
|
||||
const response = await execute(
|
||||
connection,
|
||||
statement,
|
||||
Object.values(tableColumnValues)
|
||||
);
|
||||
await destroy(connection);
|
||||
|
||||
return response;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,159 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import snowflake, { Statement, SnowflakeError } from 'snowflake-sdk';
|
||||
import { snowflakeAuth } from '../../index';
|
||||
import { configureConnection } from '../common';
|
||||
|
||||
type QueryResult = unknown[] | undefined;
|
||||
type QueryResults = { query: string; result: QueryResult }[];
|
||||
|
||||
const DEFAULT_APPLICATION_NAME = 'ActivePieces';
|
||||
const DEFAULT_QUERY_TIMEOUT = 30000;
|
||||
|
||||
export const runMultipleQueries = createAction({
|
||||
name: 'runMultipleQueries',
|
||||
displayName: 'Run Multiple Queries',
|
||||
description: 'Run Multiple Queries',
|
||||
auth: snowflakeAuth,
|
||||
props: {
|
||||
sqlTexts: Property.Array({
|
||||
displayName: 'SQL queries',
|
||||
description:
|
||||
'Array of SQL queries to execute in order, in the same transaction. Use :1, :2… placeholders to use binding parameters. ' +
|
||||
'Avoid using "?" to avoid unexpected behaviors when having multiple queries.',
|
||||
required: true,
|
||||
}),
|
||||
binds: Property.Array({
|
||||
displayName: 'Parameters',
|
||||
description:
|
||||
'Binding parameters shared across all queries to prevent SQL injection attacks. ' +
|
||||
'Use :1, :2, etc. to reference parameters in order. ' +
|
||||
'Avoid using "?" to avoid unexpected behaviors when having multiple queries. ' +
|
||||
'Unused parameters are allowed.',
|
||||
required: false,
|
||||
}),
|
||||
useTransaction: Property.Checkbox({
|
||||
displayName: 'Use Transaction',
|
||||
description:
|
||||
'When enabled, all queries will be executed in a single transaction. If any query fails, all changes will be rolled back.',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
}),
|
||||
timeout: Property.Number({
|
||||
displayName: 'Query timeout (ms)',
|
||||
description:
|
||||
'An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.',
|
||||
required: false,
|
||||
defaultValue: DEFAULT_QUERY_TIMEOUT,
|
||||
}),
|
||||
application: Property.ShortText({
|
||||
displayName: 'Application name',
|
||||
description:
|
||||
'A string indicating the name of the client application connecting to the server.',
|
||||
required: false,
|
||||
defaultValue: DEFAULT_APPLICATION_NAME,
|
||||
}),
|
||||
},
|
||||
|
||||
async run(context) {
|
||||
const connection = configureConnection(
|
||||
context.auth.props,
|
||||
context.propsValue.application,
|
||||
context.propsValue.timeout
|
||||
);
|
||||
|
||||
return new Promise<QueryResults>((resolve, reject) => {
|
||||
connection.connect(async function (err: SnowflakeError | undefined) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
const { sqlTexts, binds, useTransaction } = context.propsValue;
|
||||
const queryResults: QueryResults = [];
|
||||
|
||||
function handleError(err: SnowflakeError) {
|
||||
if (useTransaction) {
|
||||
connection.execute({
|
||||
sqlText: 'ROLLBACK',
|
||||
complete: () => {
|
||||
connection.destroy(() => {
|
||||
reject(err);
|
||||
});
|
||||
},
|
||||
});
|
||||
} else {
|
||||
connection.destroy(() => {
|
||||
reject(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function executeQueriesSequentially() {
|
||||
try {
|
||||
if (useTransaction) {
|
||||
await new Promise<void>((resolveBegin, rejectBegin) => {
|
||||
connection.execute({
|
||||
sqlText: 'BEGIN',
|
||||
complete: (err: SnowflakeError | undefined) => {
|
||||
if (err) rejectBegin(err);
|
||||
else resolveBegin();
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
for (const sqlText of sqlTexts) {
|
||||
const result = await new Promise<QueryResult>(
|
||||
(resolveQuery, rejectQuery) => {
|
||||
connection.execute({
|
||||
sqlText: sqlText as string,
|
||||
binds: binds as snowflake.Binds,
|
||||
complete: (
|
||||
err: SnowflakeError | undefined,
|
||||
stmt: Statement,
|
||||
rows: QueryResult
|
||||
) => {
|
||||
if (err) {
|
||||
rejectQuery(err);
|
||||
return;
|
||||
}
|
||||
resolveQuery(rows);
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
queryResults.push({
|
||||
query: sqlText as string,
|
||||
result,
|
||||
});
|
||||
}
|
||||
|
||||
if (useTransaction) {
|
||||
await new Promise<void>((resolveCommit, rejectCommit) => {
|
||||
connection.execute({
|
||||
sqlText: 'COMMIT',
|
||||
complete: (err: SnowflakeError | undefined) => {
|
||||
if (err) rejectCommit(err);
|
||||
else resolveCommit();
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
connection.destroy((err: SnowflakeError | undefined) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
resolve(queryResults);
|
||||
});
|
||||
} catch (err) {
|
||||
handleError(err as SnowflakeError); // Reject with the original error!
|
||||
}
|
||||
}
|
||||
|
||||
executeQueriesSequentially();
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import snowflake from 'snowflake-sdk';
|
||||
import { snowflakeAuth } from '../../index';
|
||||
import { configureConnection } from '../common';
|
||||
|
||||
const DEFAULT_APPLICATION_NAME = 'ActivePieces';
|
||||
const DEFAULT_QUERY_TIMEOUT = 30000;
|
||||
|
||||
export const runQuery = createAction({
|
||||
name: 'runQuery',
|
||||
displayName: 'Run Query',
|
||||
description: 'Run Query',
|
||||
auth: snowflakeAuth,
|
||||
props: {
|
||||
sqlText: Property.ShortText({
|
||||
displayName: 'SQL query',
|
||||
description: 'Use :1, :2… or ? placeholders to use binding parameters.',
|
||||
required: true,
|
||||
}),
|
||||
binds: Property.Array({
|
||||
displayName: 'Parameters',
|
||||
description:
|
||||
'Binding parameters for the SQL query (to prevent SQL injection attacks)',
|
||||
required: false,
|
||||
}),
|
||||
timeout: Property.Number({
|
||||
displayName: 'Query timeout (ms)',
|
||||
description:
|
||||
'An integer indicating the maximum number of milliseconds to wait for a query to complete before timing out.',
|
||||
required: false,
|
||||
defaultValue: DEFAULT_QUERY_TIMEOUT,
|
||||
}),
|
||||
application: Property.ShortText({
|
||||
displayName: 'Application name',
|
||||
description:
|
||||
'A string indicating the name of the client application connecting to the server.',
|
||||
required: false,
|
||||
defaultValue: DEFAULT_APPLICATION_NAME,
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
const connection = configureConnection(
|
||||
context.auth.props,
|
||||
context.propsValue.application,
|
||||
context.propsValue.timeout
|
||||
);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
connection.connect(function (err, conn) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
|
||||
const { sqlText, binds } = context.propsValue;
|
||||
|
||||
connection.execute({
|
||||
sqlText,
|
||||
binds: binds as snowflake.Binds,
|
||||
complete: (err, stmt, rows) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
connection.destroy((err, conn) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
resolve(rows);
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,266 @@
|
||||
import {
|
||||
DynamicPropsValue,
|
||||
PiecePropValueSchema,
|
||||
Property,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import { snowflakeAuth } from '../..';
|
||||
import snowflake from 'snowflake-sdk';
|
||||
|
||||
const DEFAULT_APPLICATION_NAME = 'ActivePieces';
|
||||
const DEFAULT_QUERY_TIMEOUT = 30000;
|
||||
|
||||
function formatPrivateKey(privateKey: string): string {
|
||||
const privateKeyLines = privateKey
|
||||
.replace('-----BEGIN PRIVATE KEY-----', '')
|
||||
.replace('-----END PRIVATE KEY-----', '')
|
||||
.trim()
|
||||
.split(' ');
|
||||
|
||||
return [
|
||||
'-----BEGIN PRIVATE KEY-----',
|
||||
...privateKeyLines,
|
||||
'-----END PRIVATE KEY-----',
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
export function configureConnection(
|
||||
auth: PiecePropValueSchema<typeof snowflakeAuth>,
|
||||
application = DEFAULT_APPLICATION_NAME,
|
||||
timeout = DEFAULT_QUERY_TIMEOUT
|
||||
) {
|
||||
const connectionOptions: snowflake.ConnectionOptions = {
|
||||
application: application,
|
||||
timeout: timeout,
|
||||
username: auth.username,
|
||||
role: auth.role,
|
||||
database: auth.database,
|
||||
warehouse: auth.warehouse,
|
||||
account: auth.account,
|
||||
};
|
||||
|
||||
if (auth.privateKey) {
|
||||
connectionOptions.privateKey = formatPrivateKey(auth.privateKey);
|
||||
connectionOptions.authenticator = 'SNOWFLAKE_JWT';
|
||||
} else {
|
||||
connectionOptions.password = auth.password;
|
||||
}
|
||||
|
||||
return snowflake.createConnection(connectionOptions);
|
||||
}
|
||||
|
||||
export async function connect(conn: snowflake.Connection) {
|
||||
return await new Promise<void>((resolve, reject) => {
|
||||
conn.connect((error) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export async function destroy(conn: snowflake.Connection) {
|
||||
return await new Promise<void>((resolve, reject) => {
|
||||
conn.destroy((error) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export async function execute(
|
||||
conn: snowflake.Connection,
|
||||
sqlText: string,
|
||||
binds: snowflake.Binds
|
||||
) {
|
||||
return await new Promise<any[] | undefined>((resolve, reject) => {
|
||||
conn.execute({
|
||||
sqlText,
|
||||
binds,
|
||||
complete: (error, _, result) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export const snowflakeCommonProps = {
|
||||
database: Property.Dropdown({
|
||||
auth: snowflakeAuth,
|
||||
displayName: 'Database',
|
||||
refreshers: [],
|
||||
required: true,
|
||||
options: async ({ auth }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please connect your account first',
|
||||
};
|
||||
}
|
||||
|
||||
const authValue = auth;
|
||||
|
||||
const connection = configureConnection(authValue.props);
|
||||
|
||||
await connect(connection);
|
||||
|
||||
const response = await execute(connection, 'SHOW DATABASES', []);
|
||||
|
||||
await destroy(connection);
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: response
|
||||
? response.map((db: any) => {
|
||||
return {
|
||||
label: db.name,
|
||||
value: db.name,
|
||||
};
|
||||
})
|
||||
: [],
|
||||
};
|
||||
},
|
||||
}),
|
||||
schema: Property.Dropdown({
|
||||
auth: snowflakeAuth,
|
||||
displayName: 'Schema',
|
||||
refreshers: ['database'],
|
||||
required: true,
|
||||
options: async ({ auth, database }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please connect your account first',
|
||||
};
|
||||
}
|
||||
if (!database) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please select database first',
|
||||
};
|
||||
}
|
||||
|
||||
const authValue = auth;
|
||||
|
||||
const connection = configureConnection(authValue.props);
|
||||
|
||||
await connect(connection);
|
||||
|
||||
const response = await execute(
|
||||
connection,
|
||||
`SHOW SCHEMAS IN DATABASE ${database}`,
|
||||
[]
|
||||
);
|
||||
|
||||
await destroy(connection);
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: response
|
||||
? response.map((schema: any) => {
|
||||
return {
|
||||
label: schema.name,
|
||||
value: schema.name,
|
||||
};
|
||||
})
|
||||
: [],
|
||||
};
|
||||
},
|
||||
}),
|
||||
table: Property.Dropdown({
|
||||
auth: snowflakeAuth,
|
||||
displayName: 'Table',
|
||||
refreshers: ['database', 'schema'],
|
||||
required: true,
|
||||
options: async ({ auth, database, schema }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please connect your account first',
|
||||
};
|
||||
}
|
||||
if (!database) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please select database first',
|
||||
};
|
||||
}
|
||||
if (!schema) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please select schema first',
|
||||
};
|
||||
}
|
||||
|
||||
const authValue = auth;
|
||||
|
||||
const connection = configureConnection(authValue.props);
|
||||
|
||||
await connect(connection);
|
||||
|
||||
const response = await execute(
|
||||
connection,
|
||||
`SHOW TABLES IN SCHEMA ${database}.${schema}`,
|
||||
[]
|
||||
);
|
||||
|
||||
await destroy(connection);
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: response
|
||||
? response.map((table: any) => {
|
||||
return {
|
||||
label: table.name,
|
||||
value: `${database}.${schema}.${table.name}`,
|
||||
};
|
||||
})
|
||||
: [],
|
||||
};
|
||||
},
|
||||
}),
|
||||
table_column_values: Property.DynamicProperties({
|
||||
auth: snowflakeAuth,
|
||||
displayName: 'Rows',
|
||||
required: true,
|
||||
refreshers: ['database', 'schema', 'table'],
|
||||
props: async ({ auth, table }) => {
|
||||
if (!auth) return {};
|
||||
if (!table) return {};
|
||||
|
||||
const authValue = auth;
|
||||
|
||||
const connection = configureConnection(authValue.props);
|
||||
await connect(connection);
|
||||
const response = await execute(connection, `DESCRIBE TABLE ${table}`, []);
|
||||
await destroy(connection);
|
||||
|
||||
const fields: DynamicPropsValue = {};
|
||||
|
||||
if (response) {
|
||||
for (const column of response) {
|
||||
fields[column.name] = Property.ShortText({
|
||||
displayName: column.name,
|
||||
required: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return fields;
|
||||
},
|
||||
}),
|
||||
};
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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"]
|
||||
}
|
||||
Reference in New Issue
Block a user