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,39 @@
{
"Open-source time tracking software": "Open-Source-Zeiterfassungs-Software",
"Server URL": "Server-URL",
"Username": "Benutzername",
"API Password": "API-Passwort",
"Kimai Instance URL (e.g. https://demo.kimai.org)": "URL der Kimai Instanz (z.B. https://demo.kimai.org)",
"Kimai Username/Email": "Kimai Benutzername/E-Mail",
"Kimai API Password": "Kimai API Passwort",
"\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ": "\n Um API-Zugriff zu konfigurieren:\n\n 1. Gehen Sie zu Kimai Web UI;\n 2. Klicken Sie auf Ihr Benutzerprofil und gehen Sie dann zu \"API Access\";\n 3. API-Passwort konfigurieren (anders als Benutzer-Passwort).\n ",
"Create Timesheet": "Stundenzettel erstellen",
"Custom API Call": "Eigener API-Aufruf",
"Create a new timesheet": "Neues Stundenzettel erstellen",
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
"Project": "Projekt",
"Activity": "Aktivität",
"Begin Date": "Beginndatum",
"End Date": "Enddatum",
"Description": "Beschreibung",
"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)",
"Kimai project": "Kimai Projekt",
"Kimai activity": "Kimai-Aktivität",
"Begin Date of Timesheet": "Startdatum des Stundenzettels",
"End Date of Timesheet": "Enddatum des Stundenzettels",
"Description of Timesheet": "Beschreibung des Stundenzettels",
"Authorization headers are injected automatically from your connection.": "Autorisierungs-Header werden automatisch von Ihrer Verbindung injiziert.",
"Enable for files like PDFs, images, etc..": "Aktivieren für Dateien wie PDFs, Bilder, etc..",
"GET": "ERHALTEN",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "LÖSCHEN",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,39 @@
{
"Open-source time tracking software": "Software de seguimiento de tiempo de código abierto",
"Server URL": "URL del servidor",
"Username": "Usuario",
"API Password": "Contraseña API",
"Kimai Instance URL (e.g. https://demo.kimai.org)": "URL de Kimai Instance (ej. https://demo.kimai.org)",
"Kimai Username/Email": "Nombre de usuario/Email de Kimai",
"Kimai API Password": "Contraseña API de Kimai",
"\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ": "\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ",
"Create Timesheet": "Crear Hoja de Tiempo",
"Custom API Call": "Llamada API personalizada",
"Create a new timesheet": "Crear una nueva hoja de tiempo",
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
"Project": "Projekt",
"Activity": "Actividad",
"Begin Date": "Fecha de inicio",
"End Date": "Fecha de fin",
"Description": "Descripción",
"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)",
"Kimai project": "Proyecto Kimai",
"Kimai activity": "Actividad Kimai",
"Begin Date of Timesheet": "Fecha de inicio de la hoja de tiempo",
"End Date of Timesheet": "Fecha de fin de la hoja de tiempo",
"Description of Timesheet": "Descripción de la hoja de tiempo",
"Authorization headers are injected automatically from your connection.": "Las cabeceras de autorización se inyectan automáticamente desde tu conexión.",
"Enable for files like PDFs, images, etc..": "Activar para archivos como PDFs, imágenes, etc.",
"GET": "RECOGER",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "BORRAR",
"HEAD": "LIMPIO"
}

View File

@@ -0,0 +1,39 @@
{
"Open-source time tracking software": "Logiciel de suivi du temps open source",
"Server URL": "URL du serveur",
"Username": "Nom d'utilisateur",
"API Password": "Mot de passe API",
"Kimai Instance URL (e.g. https://demo.kimai.org)": "URL de l'instance Kimai (par exemple https://demo.kimai.org)",
"Kimai Username/Email": "Nom d'utilisateur/e-mail Kimai",
"Kimai API Password": "Mot de passe de l'API Kimai",
"\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ": "\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ",
"Create Timesheet": "Créer une feuille de temps",
"Custom API Call": "Appel API personnalisé",
"Create a new timesheet": "Créer une nouvelle feuille de temps",
"Make a custom API call to a specific endpoint": "Passez un appel API personnalisé à un point de terminaison spécifique",
"Project": "Projet",
"Activity": "Activité",
"Begin Date": "Date de début",
"End Date": "Date de fin",
"Description": "Libellé",
"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)",
"Kimai project": "Projet Kimai",
"Kimai activity": "Activité de Kimai",
"Begin Date of Timesheet": "Date de début de la feuille de temps",
"End Date of Timesheet": "Date de fin de la feuille de temps",
"Description of Timesheet": "Description de la feuille de temps",
"Authorization headers are injected automatically from your connection.": "Les en-têtes d'autorisation sont injectés automatiquement à partir de votre connexion.",
"Enable for files like PDFs, images, etc..": "Activer pour les fichiers comme les PDFs, les images, etc.",
"GET": "OBTENIR",
"POST": "POSTER",
"PATCH": "PATCH",
"PUT": "EFFACER",
"DELETE": "SUPPRIMER",
"HEAD": "TÊTE"
}

View File

@@ -0,0 +1,39 @@
{
"Open-source time tracking software": "オープンソースの時間追跡ソフトウェア",
"Server URL": "サーバー URL",
"Username": "ユーザー名",
"API Password": "APIパスワード",
"Kimai Instance URL (e.g. https://demo.kimai.org)": "Kimai Instance URL (例: https://demo.kimai.org)",
"Kimai Username/Email": "Kimai ユーザー名/Eメール",
"Kimai API Password": "Kimai APIパスワード",
"\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ": "\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ",
"Create Timesheet": "タイムシートを作成",
"Custom API Call": "カスタムAPI通話",
"Create a new timesheet": "新しいタイムシートを作成",
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
"Project": "プロジェクト",
"Activity": "アクティビティ",
"Begin Date": "開始日",
"End Date": "終了日",
"Description": "説明",
"Method": "方法",
"Headers": "ヘッダー",
"Query Parameters": "クエリパラメータ",
"Body": "本文",
"Response is Binary ?": "応答はバイナリですか?",
"No Error on Failure": "失敗時にエラーはありません",
"Timeout (in seconds)": "タイムアウト(秒)",
"Kimai project": "鬼舞プロジェクト",
"Kimai activity": "鬼舞活動",
"Begin Date of Timesheet": "開始日時",
"End Date of Timesheet": "終了日時",
"Description of Timesheet": "タイムシートの説明",
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
"GET": "取得",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "削除",
"HEAD": "頭"
}

View File

@@ -0,0 +1,39 @@
{
"Open-source time tracking software": "Open-source tijdregistratiesoftware",
"Server URL": "Server URL",
"Username": "Gebruikersnaam",
"API Password": "API wachtwoord",
"Kimai Instance URL (e.g. https://demo.kimai.org)": "Kimai Instance URL (bijv. https://demo.kimai.org)",
"Kimai Username/Email": "Kimai Gebruikersnaam/E-mail",
"Kimai API Password": "Kimai API wachtwoord",
"\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ": "\n Om API toegang te configureren:\n\n 1. Ga naar Kimai Web UI;\n 2. Klik op je gebruikersprofiel en ga vervolgens naar \"API Access\";\n 3. Stel een API-wachtwoord in (verschillend van gebruikerswachtwoord).\n ",
"Create Timesheet": "Tijdblad maken",
"Custom API Call": "Custom API Call",
"Create a new timesheet": "Maak een nieuw tijdblad",
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
"Project": "Project",
"Activity": "Activiteit",
"Begin Date": "Begin datum",
"End Date": "Eind datum",
"Description": "Beschrijving",
"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)",
"Kimai project": "Kimai project",
"Kimai activity": "Kimai activiteit",
"Begin Date of Timesheet": "Begindatum van tijdsplaatje",
"End Date of Timesheet": "Einddatum van tijdsplaatje",
"Description of Timesheet": "Beschrijving van tijdblad",
"Authorization headers are injected automatically from your connection.": "Autorisatie headers worden automatisch geïnjecteerd vanuit uw verbinding.",
"Enable for files like PDFs, images, etc..": "Inschakelen voor bestanden zoals PDF's, afbeeldingen etc..",
"GET": "KRIJG",
"POST": "POSTE",
"PATCH": "BEKIJK",
"PUT": "PUT",
"DELETE": "VERWIJDEREN",
"HEAD": "HOOFD"
}

View File

@@ -0,0 +1,39 @@
{
"Open-source time tracking software": "Software de rastreamento de tempo de código aberto",
"Server URL": "URL do servidor",
"Username": "Usuário:",
"API Password": "Senha da API",
"Kimai Instance URL (e.g. https://demo.kimai.org)": "URL da Instância Kimai (ex.: https://demo.kimai.org)",
"Kimai Username/Email": "Kimai usuário/E-mail",
"Kimai API Password": "Senha da API Kimai",
"\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ": "\n Para configurar o acesso à API:\n\n 1. Vá para Kimai Web UI;\n 2. Clique no seu perfil de usuário e, em seguida, vá em \"Acesso à API\";\n 3. Configurar uma senha da API (diferente da senha do usuário).\n ",
"Create Timesheet": "Criar Planilha de Tempo",
"Custom API Call": "Chamada de API personalizada",
"Create a new timesheet": "Criar um novo quadro de horários",
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
"Project": "Projecto",
"Activity": "Atividade",
"Begin Date": "Data de início",
"End Date": "Data de Término",
"Description": "Descrição",
"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)",
"Kimai project": "Kimai projeto",
"Kimai activity": "Atividade Kimai",
"Begin Date of Timesheet": "Data de início da folha de tempo",
"End Date of Timesheet": "Data Final da Folha de Tempo",
"Description of Timesheet": "Descrição da Planilha de Tempo",
"Authorization headers are injected automatically from your connection.": "Os cabeçalhos de autorização são inseridos automaticamente a partir da sua conexão.",
"Enable for files like PDFs, images, etc..": "Habilitar para arquivos como PDFs, imagens, etc..",
"GET": "OBTER",
"POST": "POSTAR",
"PATCH": "COMPRAR",
"PUT": "COLOCAR",
"DELETE": "EXCLUIR",
"HEAD": "CABEÇA"
}

View File

@@ -0,0 +1,38 @@
{
"Kimai": "Kimai",
"Open-source time tracking software": "Программное обеспечение для отслеживания времени с открытым исходным кодом",
"Server URL": "URL сервера",
"Username": "Имя пользователя",
"API Password": "API пароль",
"Kimai Instance URL (e.g. https://demo.kimai.org)": "URL-адрес экземпляра Kimai (например, https://demo.kimai.org)",
"Kimai Username/Email": "Kimai Логин/Email",
"Kimai API Password": "Пароль API Kimai",
"\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ": "\n Для настройки доступа к API:\n\n 1. Перейдите в веб-интерфейс Kimai;\n 2. Нажмите на свой пользовательский профиль и затем перейдите в \"API Access\";\n 3. Настроить пароль API (отличный от пароля пользователя).\n ",
"Create Timesheet": "Создать таблицу времени",
"Custom API Call": "Пользовательский вызов API",
"Create a new timesheet": "Создать новый график",
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
"Project": "Проект",
"Activity": "Активность",
"Begin Date": "Дата начала",
"End Date": "Дата окончания",
"Description": "Описание",
"Method": "Метод",
"Headers": "Заголовки",
"Query Parameters": "Параметры запроса",
"Body": "Тело",
"No Error on Failure": "Нет ошибок при ошибке",
"Timeout (in seconds)": "Таймаут (в секундах)",
"Kimai project": "Кимай проект",
"Kimai activity": "Активность Кимаи",
"Begin Date of Timesheet": "Начать работу с датой времени",
"End Date of Timesheet": "Конец таблицы времени",
"Description of Timesheet": "Описание шкалы времени",
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
"GET": "ПОЛУЧИТЬ",
"POST": "ПОСТ",
"PATCH": "ПАТЧ",
"PUT": "ПОКУПИТЬ",
"DELETE": "УДАЛИТЬ",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,39 @@
{
"Open-source time tracking software": "Open-source time tracking software",
"Server URL": "Server URL",
"Username": "Username",
"API Password": "API Password",
"Kimai Instance URL (e.g. https://demo.kimai.org)": "Kimai Instance URL (e.g. https://demo.kimai.org)",
"Kimai Username/Email": "Kimai Username/Email",
"Kimai API Password": "Kimai API Password",
"\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ": "\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ",
"Create Timesheet": "Create Timesheet",
"Custom API Call": "Custom API Call",
"Create a new timesheet": "Create a new timesheet",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Project": "Project",
"Activity": "Activity",
"Begin Date": "Begin Date",
"End Date": "End Date",
"Description": "Description",
"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)",
"Kimai project": "Kimai project",
"Kimai activity": "Kimai activity",
"Begin Date of Timesheet": "Begin Date of Timesheet",
"End Date of Timesheet": "End Date of Timesheet",
"Description of Timesheet": "Description of Timesheet",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,38 @@
{
"Kimai": "Kimai",
"Open-source time tracking software": "Open-source time tracking software",
"Server URL": "Server URL",
"Username": "Username",
"API Password": "API Password",
"Kimai Instance URL (e.g. https://demo.kimai.org)": "Kimai Instance URL (e.g. https://demo.kimai.org)",
"Kimai Username/Email": "Kimai Username/Email",
"Kimai API Password": "Kimai API Password",
"\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ": "\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ",
"Create Timesheet": "Create Timesheet",
"Custom API Call": "Custom API Call",
"Create a new timesheet": "Create a new timesheet",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Project": "Project",
"Activity": "Activity",
"Begin Date": "Begin Date",
"End Date": "End Date",
"Description": "Description",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Kimai project": "Kimai project",
"Kimai activity": "Kimai activity",
"Begin Date of Timesheet": "Begin Date of Timesheet",
"End Date of Timesheet": "End Date of Timesheet",
"Description of Timesheet": "Description of Timesheet",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,39 @@
{
"Open-source time tracking software": "Open-source time tracking software",
"Server URL": "服务器 URL",
"Username": "用户名",
"API Password": "API Password",
"Kimai Instance URL (e.g. https://demo.kimai.org)": "Kimai Instance URL (e.g. https://demo.kimai.org)",
"Kimai Username/Email": "Kimai Username/Email",
"Kimai API Password": "Kimai API Password",
"\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ": "\n To configure API access:\n\n 1. Go to Kimai Web UI;\n 2. Click on your user profile and then go to \"API Access\";\n 3. Configure an API password (different from user password).\n ",
"Create Timesheet": "Create Timesheet",
"Custom API Call": "自定义 API 呼叫",
"Create a new timesheet": "Create a new timesheet",
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
"Project": "项目",
"Activity": "Activity",
"Begin Date": "Begin Date",
"End Date": "End Date",
"Description": "描述",
"Method": "方法",
"Headers": "信头",
"Query Parameters": "查询参数",
"Body": "正文内容",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "失败时没有错误",
"Timeout (in seconds)": "超时(秒)",
"Kimai project": "Kimai project",
"Kimai activity": "Kimai activity",
"Begin Date of Timesheet": "Begin Date of Timesheet",
"End Date of Timesheet": "End Date of Timesheet",
"Description of Timesheet": "Description of Timesheet",
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"GET": "获取",
"POST": "帖子",
"PATCH": "PATCH",
"PUT": "弹出",
"DELETE": "删除",
"HEAD": "黑色"
}

View File

@@ -0,0 +1,112 @@
import {
createCustomApiCallAction,
HttpError,
} from '@activepieces/pieces-common';
import {
createPiece,
PieceAuth,
Property,
} from '@activepieces/pieces-framework';
import { AppConnectionType, PieceCategory } from '@activepieces/shared';
import { kimaiCreateTimesheetAction } from './lib/actions/create-timesheet';
import { makeClient } from './lib/common';
import { z } from 'zod';
import { propsValidation } from '@activepieces/pieces-common';
export const kimaiAuth = PieceAuth.CustomAuth({
description: `
To configure API access:
1. Go to Kimai Web UI;
2. Click on your user profile and then go to "API Access";
3. Configure an API password (different from user password).
`,
props: {
base_url: Property.ShortText({
displayName: 'Server URL',
description: 'Kimai Instance URL (e.g. https://demo.kimai.org)',
required: true,
}),
user: Property.ShortText({
displayName: 'Username',
description: 'Kimai Username/Email',
required: true,
}),
api_password: PieceAuth.SecretText({
displayName: 'API Password',
description: 'Kimai API Password',
required: true,
}),
},
validate: async ({ auth }) => {
if (auth) {
await propsValidation.validateZod(auth, {
base_url: z.string().url(),
});
}
if (!auth) {
return {
valid: false,
error: 'Configuration missing!',
};
}
const client = await makeClient({
type: AppConnectionType.CUSTOM_AUTH,
props: auth,
});
try {
const pingResponse = await client.ping();
if (pingResponse.message !== 'pong') {
return {
valid: false,
error: pingResponse.message,
};
}
return {
valid: true,
};
} catch (e) {
if (e instanceof HttpError) {
if (e.response.body instanceof Object && 'message' in e.response.body) {
return {
valid: false,
error: e.response.body.message as string,
};
}
}
return {
valid: false,
error: 'Please check your server URL/credentials and try again.',
};
}
},
required: true,
});
export const kimai = createPiece({
displayName: 'Kimai',
description: 'Open-source time tracking software',
auth: kimaiAuth,
minimumSupportedRelease: '0.30.0',
logoUrl: 'https://cdn.activepieces.com/pieces/kimai.png',
categories: [PieceCategory.PRODUCTIVITY],
authors: ["facferreira","kishanprmr","MoShizzle","abuaboud"],
actions: [
kimaiCreateTimesheetAction,
createCustomApiCallAction({
baseUrl: (auth) => (auth?.props.base_url ?? ''),
auth: kimaiAuth,
authMapping: async (auth) => ({
'X-AUTH-USER': auth.props.user,
'X-AUTH-TOKEN': auth.props.api_password,
}),
}),
],
triggers: [],
});

View File

@@ -0,0 +1,41 @@
import { Property, createAction } from '@activepieces/pieces-framework';
import { kimaiCommon, makeClient } from '../common';
import { kimaiAuth } from '../..';
export const kimaiCreateTimesheetAction = createAction({
auth: kimaiAuth,
name: 'create_timesheet',
description: 'Create a new timesheet',
displayName: 'Create Timesheet',
props: {
project: kimaiCommon.project,
activity: kimaiCommon.activity,
begin: Property.DateTime({
description: 'Begin Date of Timesheet',
displayName: 'Begin Date',
required: true,
}),
end: Property.DateTime({
description: 'End Date of Timesheet',
displayName: 'End Date',
required: false,
}),
description: Property.LongText({
description: 'Description of Timesheet',
displayName: 'Description',
required: false,
}),
},
async run({ auth, propsValue }) {
const { project, activity, begin, end, description } = propsValue;
const client = await makeClient(auth);
return await client.createTimesheet({
project,
activity,
begin,
end,
description,
});
},
});

View File

@@ -0,0 +1,102 @@
import {
HttpMethod,
HttpMessageBody,
httpClient,
HttpResponse,
} from '@activepieces/pieces-common';
type PingResponse = {
message: string;
};
type ProjectResponse = {
id: number;
name: string;
};
type ActivityResponse = {
id: number;
parentTitle?: string;
name: string;
};
type TimesheetCreateRequest = {
project: number;
activity: number;
begin: string;
end?: string;
description?: string;
};
type TimesheetResponse = {
id: number;
project: number;
activity: number;
begin: string;
end?: string;
description?: string;
};
export class KimaiClient {
constructor(
private baseUrl: string,
private user: string,
private apiPassword: string
) {
// Remove trailing slash from base URL
this.baseUrl = baseUrl.replace(/\/$/, '');
}
async ping(): Promise<PingResponse> {
return (await this.makeRequest<PingResponse>(HttpMethod.GET, '/api/ping'))
.body;
}
async getProjects(): Promise<ProjectResponse[]> {
return (
await this.makeRequest<ProjectResponse[]>(HttpMethod.GET, '/api/projects')
).body;
}
async getActivities(
project: number | undefined = undefined
): Promise<ActivityResponse[]> {
return (
await this.makeRequest<ActivityResponse[]>(
HttpMethod.GET,
'/api/activities',
{
project: project,
}
)
).body;
}
async createTimesheet(
createData: TimesheetCreateRequest
): Promise<TimesheetResponse> {
return (
await this.makeRequest<TimesheetResponse>(
HttpMethod.POST,
'/api/timesheets',
createData
)
).body;
}
async makeRequest<T extends HttpMessageBody>(
method: HttpMethod,
resourceUri: string,
body: any | undefined = undefined
): Promise<HttpResponse<T>> {
return await httpClient.sendRequest<T>({
method: method,
url: `${this.baseUrl}${resourceUri}`,
headers: {
'X-AUTH-USER': this.user,
'X-AUTH-TOKEN': this.apiPassword,
},
body: body,
});
}
}

View File

@@ -0,0 +1,87 @@
import { AppConnectionValueForAuthProperty, PiecePropValueSchema, Property } from '@activepieces/pieces-framework';
import { kimaiAuth } from '../..';
import { KimaiClient } from './client';
export const kimaiCommon = {
project: Property.Dropdown({
auth: kimaiAuth,
description: 'Kimai project',
displayName: 'Project',
required: true,
refreshers: [],
options: async ({ auth }) => {
if (!auth) {
return {
disabled: true,
placeholder: 'Connect your account first',
options: [],
};
}
const client = await makeClient(
auth
);
const projects = await client.getProjects();
return {
disabled: false,
options: projects.map((project) => {
return {
label: project.name,
value: project.id,
};
}),
};
},
}),
activity: Property.Dropdown({
auth: kimaiAuth,
description: 'Kimai activity',
displayName: 'Activity',
required: true,
refreshers: ['project'],
options: async ({ auth, project }) => {
if (!auth) {
return {
disabled: true,
placeholder: 'Connect your account first',
options: [],
};
}
if (!project) {
return {
disabled: true,
placeholder: 'Select project first',
options: [],
};
}
const client = await makeClient(
auth
);
const activities = await client.getActivities(project as number);
return {
disabled: false,
options: activities.map((activity) => {
const nameTokens = [];
if (activity.parentTitle) {
nameTokens.push(activity.parentTitle);
}
nameTokens.push(activity.name);
const name = nameTokens.join(' - ');
return {
label: name,
value: activity.id,
};
}),
};
},
}),
};
export async function makeClient(
auth: AppConnectionValueForAuthProperty<typeof kimaiAuth>
): Promise<KimaiClient> {
const client = new KimaiClient(auth.props.base_url, auth.props.user, auth.props.api_password);
return client;
}