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:
3
activepieces-fork/packages/pieces/community/csv/.babelrc
Normal file
3
activepieces-fork/packages/pieces/community/csv/.babelrc
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"presets": [["@nx/js/babel", { "useBuiltIns": "usage" }]]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": ["../../../../.eslintrc.json"],
|
||||
"ignorePatterns": ["!**/*"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# pieces-csv
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Running lint
|
||||
|
||||
Run `nx lint pieces-csv` to execute the lint via [ESLint](https://eslint.org/).
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "@activepieces/piece-csv",
|
||||
"version": "0.4.9",
|
||||
"dependencies": {
|
||||
"csv-parse": "5.6.0",
|
||||
"csv-stringify": "6.5.2",
|
||||
"safe-flat": "2.1.0"
|
||||
}
|
||||
}
|
||||
51
activepieces-fork/packages/pieces/community/csv/project.json
Normal file
51
activepieces-fork/packages/pieces/community/csv/project.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "pieces-csv",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/csv/src",
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"options": {
|
||||
"outputPath": "dist/packages/pieces/community/csv",
|
||||
"tsConfig": "packages/pieces/community/csv/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/csv/package.json",
|
||||
"main": "packages/pieces/community/csv/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/csv/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/csv/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/csv",
|
||||
"command": "bun install --no-save --silent"
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"CSV": "CSV",
|
||||
"Manipulate CSV text": "Manipulate CSV text",
|
||||
"Convert CSV to JSON": "Convert CSV to JSON",
|
||||
"Convert JSON to CSV": "Convert JSON to CSV",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "This function reads a CSV string and converts it into JSON array format.",
|
||||
"This function reads a JSON array and converts it into CSV format.": "This function reads a JSON array and converts it into CSV format.",
|
||||
"CSV Text": "CSV Text",
|
||||
"Does the CSV have headers?": "Does the CSV have headers?",
|
||||
"Delimiter Type": "Delimiter Type",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "JSON Array",
|
||||
"Select the delimiter type for the CSV text.": "Select the delimiter type for the CSV text.",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "Provide a JSON array to convert to CSV format.",
|
||||
"Select the delimiter type for the CSV file.": "Select the delimiter type for the CSV file.",
|
||||
"Comma": "Comma",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Manipulate CSV text": "CSV-Text bearbeiten",
|
||||
"Convert CSV to JSON": "CSV in JSON konvertieren",
|
||||
"Convert JSON to CSV": "JSON in CSV konvertieren",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "Diese Funktion liest einen CSV-String und konvertiert ihn in JSON-Array-Format.",
|
||||
"This function reads a JSON array and converts it into CSV format.": "Diese Funktion liest ein JSON-Array und konvertiert es in CSV-Format.",
|
||||
"CSV Text": "CSV-Text",
|
||||
"Does the CSV have headers?": "Hat die CSV Header?",
|
||||
"Delimiter Type": "Trennzeichentyp",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "JSON Array",
|
||||
"Select the delimiter type for the CSV text.": "Wählen Sie den Trennungstyp für den CSV-Text.",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Notizen**:\n* Die Eingabe sollte ein JSON-Array sein.\n* Das JSON-Objekt wird abgeflacht, wenn verschachtelt und die Schlüssel werden als Header verwendet.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "Geben Sie ein JSON-Array an, um es in das CSV-Format zu konvertieren.",
|
||||
"Select the delimiter type for the CSV file.": "Wählen Sie den Trennungstyp für die CSV-Datei.",
|
||||
"Comma": "Komma",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Manipulate CSV text": "Manipular texto CSV",
|
||||
"Convert CSV to JSON": "Convierte CSV a JSON",
|
||||
"Convert JSON to CSV": "Convertir JSON a CSV",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "Esta función lee una cadena CSV y la convierte en formato matriz JSON.",
|
||||
"This function reads a JSON array and converts it into CSV format.": "Esta función lee un array JSON y lo convierte en formato CSV.",
|
||||
"CSV Text": "Texto CSV",
|
||||
"Does the CSV have headers?": "¿El CSV tiene cabeceras?",
|
||||
"Delimiter Type": "Tipo de delimitador",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "Matriz JSON",
|
||||
"Select the delimiter type for the CSV text.": "Seleccione el tipo de delimitador para el texto CSV.",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "Proporcione una matriz JSON para convertir a formato CSV.",
|
||||
"Select the delimiter type for the CSV file.": "Seleccione el tipo de delimitador para el archivo CSV.",
|
||||
"Comma": "Coma",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Manipulate CSV text": "Manipuler le texte CSV",
|
||||
"Convert CSV to JSON": "Convertir CSV en JSON",
|
||||
"Convert JSON to CSV": "Convertir JSON en CSV",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "Cette fonction lit une chaîne CSV et la convertit au format JSON.",
|
||||
"This function reads a JSON array and converts it into CSV format.": "Cette fonction lit un tableau JSON et le convertit au format CSV.",
|
||||
"CSV Text": "Texte CSV",
|
||||
"Does the CSV have headers?": "Le CSV a-t-il des en-têtes ?",
|
||||
"Delimiter Type": "Type de séparateur",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "Tableau JSON",
|
||||
"Select the delimiter type for the CSV text.": "Sélectionnez le type de délimiteur pour le texte CSV.",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Notes** :\n* L'entrée doit être un tableau JSON.\n* L'objet JSON sera aplani si imbriqué et les clés seront utilisées comme en-têtes.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "Fournir un tableau JSON à convertir au format CSV.",
|
||||
"Select the delimiter type for the CSV file.": "Sélectionnez le type de délimiteur pour le fichier CSV.",
|
||||
"Comma": "Virgule",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"CSV": "CSV",
|
||||
"Manipulate CSV text": "Manipulate CSV text",
|
||||
"Convert CSV to JSON": "Convert CSV to JSON",
|
||||
"Convert JSON to CSV": "Convert JSON to CSV",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "This function reads a CSV string and converts it into JSON array format.",
|
||||
"This function reads a JSON array and converts it into CSV format.": "This function reads a JSON array and converts it into CSV format.",
|
||||
"CSV Text": "CSV Text",
|
||||
"Does the CSV have headers?": "Does the CSV have headers?",
|
||||
"Delimiter Type": "Delimiter Type",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "JSON Array",
|
||||
"Select the delimiter type for the CSV text.": "Select the delimiter type for the CSV text.",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "Provide a JSON array to convert to CSV format.",
|
||||
"Select the delimiter type for the CSV file.": "Select the delimiter type for the CSV file.",
|
||||
"Comma": "Comma",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"CSV": "CSV",
|
||||
"Manipulate CSV text": "Manipulate CSV text",
|
||||
"Convert CSV to JSON": "Convert CSV to JSON",
|
||||
"Convert JSON to CSV": "Convert JSON to CSV",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "This function reads a CSV string and converts it into JSON array format.",
|
||||
"This function reads a JSON array and converts it into CSV format.": "This function reads a JSON array and converts it into CSV format.",
|
||||
"CSV Text": "CSV Text",
|
||||
"Does the CSV have headers?": "Does the CSV have headers?",
|
||||
"Delimiter Type": "Delimiter Type",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "JSON Array",
|
||||
"Select the delimiter type for the CSV text.": "Select the delimiter type for the CSV text.",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "Provide a JSON array to convert to CSV format.",
|
||||
"Select the delimiter type for the CSV file.": "Select the delimiter type for the CSV file.",
|
||||
"Comma": "Comma",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Manipulate CSV text": "CSV テキストを操作します",
|
||||
"Convert CSV to JSON": "CSVをJSONに変換",
|
||||
"Convert JSON to CSV": "JSONをCSVに変換",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "この関数はCSV文字列を読み込み、JSON配列形式に変換します。",
|
||||
"This function reads a JSON array and converts it into CSV format.": "この関数はJSON配列を読み込み、CSV形式に変換します。",
|
||||
"CSV Text": "CSV テキスト",
|
||||
"Does the CSV have headers?": "CSVにはヘッダーがありますか?",
|
||||
"Delimiter Type": "区切り文字の種類",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "JSON配列",
|
||||
"Select the delimiter type for the CSV text.": "CSV テキストの区切り文字の種類を選択します。",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "CSV形式に変換するJSON配列を提供します。",
|
||||
"Select the delimiter type for the CSV file.": "CSV ファイルの区切り文字の種類を選択します。",
|
||||
"Comma": "カンマ語",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Manipulate CSV text": "CSV-tekst toevoegen",
|
||||
"Convert CSV to JSON": "Converteer CSV naar JSON",
|
||||
"Convert JSON to CSV": "JSON converteren naar CSV",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "Deze functie leest een CSV-string en converteert deze in JSON array formaat.",
|
||||
"This function reads a JSON array and converts it into CSV format.": "Deze functie leest een JSON array en converteert het naar CSV-formaat.",
|
||||
"CSV Text": "CSV tekst",
|
||||
"Does the CSV have headers?": "Heeft de CSV koppen?",
|
||||
"Delimiter Type": "Scheidingsteken type",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "JSON matrix",
|
||||
"Select the delimiter type for the CSV text.": "Selecteer het scheidingsteken type voor de CSV-tekst.",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Notes**:\n* De invoer moet een JSON array zijn.\n* Het JSON-object zal worden samengeperst indien genezen en de sleutels zullen worden gebruikt als headers.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "Geef een JSON array aan om te converteren naar CSV formaat.",
|
||||
"Select the delimiter type for the CSV file.": "Selecteer het scheidingsteken type voor het CSV-bestand.",
|
||||
"Comma": "Komma",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Manipulate CSV text": "Manipular texto CSV",
|
||||
"Convert CSV to JSON": "Converter CSV para JSON",
|
||||
"Convert JSON to CSV": "Converter JSON para CSV",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "Esta função lê uma string CSV e a converte em um formato JSON array.",
|
||||
"This function reads a JSON array and converts it into CSV format.": "Esta função lê um array JSON e o converte em formato CSV.",
|
||||
"CSV Text": "Texto CSV",
|
||||
"Does the CSV have headers?": "O CSV tem cabeçalhos?",
|
||||
"Delimiter Type": "Tipo de delimitador",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "Matriz JSON",
|
||||
"Select the delimiter type for the CSV text.": "Selecione o tipo de delimitador para o texto CSV.",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "Forneça um array JSON para converter o formato CSV.",
|
||||
"Select the delimiter type for the CSV file.": "Selecione o tipo de delimitador para o arquivo CSV.",
|
||||
"Comma": "Vírgula",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"CSV": "CSV",
|
||||
"Manipulate CSV text": "Управление текстом CSV",
|
||||
"Convert CSV to JSON": "Преобразовать CSV в JSON",
|
||||
"Convert JSON to CSV": "Преобразовать JSON в CSV",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "Эта функция читает строку CSV и преобразует ее в формат массива JSON.",
|
||||
"This function reads a JSON array and converts it into CSV format.": "Эта функция читает массив JSON и преобразует его в формат CSV.",
|
||||
"CSV Text": "Текст CSV",
|
||||
"Does the CSV have headers?": "Есть ли в CSV заголовки?",
|
||||
"Delimiter Type": "Тип разделителя",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "JSON массив",
|
||||
"Select the delimiter type for the CSV text.": "Выберите тип разделителя для текста CSV.",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Примечания**:\n* Значение должно быть массивом JSON.\n* Объект JSON будет уплощен при вложении и ключи будут использоваться в качестве заголовков.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "Преобразует массив JSON для преобразования в формат CSV.",
|
||||
"Select the delimiter type for the CSV file.": "Выберите тип разделителя для CSV-файла.",
|
||||
"Comma": "Запятая",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Manipulate CSV text": "Manipulate CSV text",
|
||||
"Convert CSV to JSON": "Convert CSV to JSON",
|
||||
"Convert JSON to CSV": "Convert JSON to CSV",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "This function reads a CSV string and converts it into JSON array format.",
|
||||
"This function reads a JSON array and converts it into CSV format.": "This function reads a JSON array and converts it into CSV format.",
|
||||
"CSV Text": "CSV Text",
|
||||
"Does the CSV have headers?": "Does the CSV have headers?",
|
||||
"Delimiter Type": "Delimiter Type",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "JSON Array",
|
||||
"Select the delimiter type for the CSV text.": "Select the delimiter type for the CSV text.",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "Provide a JSON array to convert to CSV format.",
|
||||
"Select the delimiter type for the CSV file.": "Select the delimiter type for the CSV file.",
|
||||
"Comma": "Comma",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"CSV": "CSV",
|
||||
"Manipulate CSV text": "Manipulate CSV text",
|
||||
"Convert CSV to JSON": "Convert CSV to JSON",
|
||||
"Convert JSON to CSV": "Convert JSON to CSV",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "This function reads a CSV string and converts it into JSON array format.",
|
||||
"This function reads a JSON array and converts it into CSV format.": "This function reads a JSON array and converts it into CSV format.",
|
||||
"CSV Text": "CSV Text",
|
||||
"Does the CSV have headers?": "Does the CSV have headers?",
|
||||
"Delimiter Type": "Delimiter Type",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "JSON Array",
|
||||
"Select the delimiter type for the CSV text.": "Select the delimiter type for the CSV text.",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "Provide a JSON array to convert to CSV format.",
|
||||
"Select the delimiter type for the CSV file.": "Select the delimiter type for the CSV file.",
|
||||
"Comma": "Comma",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Manipulate CSV text": "Manipulate CSV text",
|
||||
"Convert CSV to JSON": "Convert CSV to JSON",
|
||||
"Convert JSON to CSV": "Convert JSON to CSV",
|
||||
"This function reads a CSV string and converts it into JSON array format.": "This function reads a CSV string and converts it into JSON array format.",
|
||||
"This function reads a JSON array and converts it into CSV format.": "This function reads a JSON array and converts it into CSV format.",
|
||||
"CSV Text": "CSV Text",
|
||||
"Does the CSV have headers?": "Does the CSV have headers?",
|
||||
"Delimiter Type": "Delimiter Type",
|
||||
"Markdown": "Markdown",
|
||||
"JSON Array": "JSON Array",
|
||||
"Select the delimiter type for the CSV text.": "Select the delimiter type for the CSV text.",
|
||||
"\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n": "\n**Notes**:\n* The input should be a JSON array.\n* The JSON object will be flattened If nested and the keys will be used as headers.\n",
|
||||
"Provide a JSON array to convert to CSV format.": "Provide a JSON array to convert to CSV format.",
|
||||
"Select the delimiter type for the CSV file.": "Select the delimiter type for the CSV file.",
|
||||
"Comma": "Comma",
|
||||
"Tab": "Tab"
|
||||
}
|
||||
16
activepieces-fork/packages/pieces/community/csv/src/index.ts
Normal file
16
activepieces-fork/packages/pieces/community/csv/src/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { PieceAuth, createPiece } from '@activepieces/pieces-framework';
|
||||
import { PieceCategory } from '@activepieces/shared';
|
||||
import { csvToJsonAction } from './lib/actions/convert-csv-to-json';
|
||||
import { jsonToCsvAction } from './lib/actions/convert-json-to-csv';
|
||||
|
||||
export const csv = createPiece({
|
||||
displayName: 'CSV',
|
||||
description: 'Manipulate CSV text',
|
||||
minimumSupportedRelease: '0.30.0',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/csv.svg',
|
||||
auth: PieceAuth.None(),
|
||||
categories: [PieceCategory.CORE],
|
||||
actions: [csvToJsonAction, jsonToCsvAction],
|
||||
authors: ["kishanprmr", "MoShizzle", "khaledmashaly", "abuaboud"],
|
||||
triggers: [],
|
||||
});
|
||||
@@ -0,0 +1,53 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { isString } from '@activepieces/shared';
|
||||
import {parse} from 'csv-parse/sync';
|
||||
|
||||
export const csvToJsonAction = createAction({
|
||||
name: 'convert_csv_to_json',
|
||||
displayName: 'Convert CSV to JSON',
|
||||
description:
|
||||
'This function reads a CSV string and converts it into JSON array format.',
|
||||
errorHandlingOptions: {
|
||||
continueOnFailure: {
|
||||
hide: true,
|
||||
},
|
||||
retryOnFailure: {
|
||||
hide: true,
|
||||
},
|
||||
},
|
||||
props: {
|
||||
csv_text: Property.LongText({
|
||||
displayName: 'CSV Text',
|
||||
defaultValue: '',
|
||||
required: true,
|
||||
}),
|
||||
has_headers: Property.Checkbox({
|
||||
displayName: 'Does the CSV have headers?',
|
||||
defaultValue: false,
|
||||
required: true,
|
||||
}),
|
||||
delimiter_type: Property.StaticDropdown({
|
||||
displayName: 'Delimiter Type',
|
||||
description: 'Select the delimiter type for the CSV text.',
|
||||
defaultValue: '',
|
||||
required: true,
|
||||
options: {
|
||||
options: [
|
||||
{ label: 'Comma', value: ',' },
|
||||
{ label: 'Tab', value: '\t' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
const { csv_text, has_headers, delimiter_type } = context.propsValue;
|
||||
if (!isString(csv_text)) {
|
||||
throw new Error(JSON.stringify({
|
||||
message: 'The input should be a string.',
|
||||
}))
|
||||
}
|
||||
|
||||
const records = parse(csv_text,{delimiter: delimiter_type,columns: has_headers ? true : false});
|
||||
return records;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,73 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { flatten } from 'safe-flat';
|
||||
import { stringify } from "csv-stringify/sync";
|
||||
|
||||
const markdown = `
|
||||
**Notes**:
|
||||
* The input should be a JSON array.
|
||||
* The JSON object will be flattened If nested and the keys will be used as headers.
|
||||
`
|
||||
export const jsonToCsvAction = createAction({
|
||||
name: 'convert_json_to_csv',
|
||||
displayName: 'Convert JSON to CSV',
|
||||
description: 'This function reads a JSON array and converts it into CSV format.',
|
||||
errorHandlingOptions: {
|
||||
continueOnFailure: { hide: true },
|
||||
retryOnFailure: { hide: true },
|
||||
},
|
||||
props: {
|
||||
markdown: Property.MarkDown({
|
||||
value: markdown,
|
||||
}),
|
||||
json_array: Property.Json({
|
||||
displayName: 'JSON Array',
|
||||
defaultValue: [
|
||||
{
|
||||
name: 'John',
|
||||
age: 30,
|
||||
address: {
|
||||
street: '123 Main St',
|
||||
city: 'Los Angeles',
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Jane',
|
||||
age: 25,
|
||||
address: {
|
||||
street: '123 Main St',
|
||||
city: 'Los Angeles',
|
||||
}
|
||||
}
|
||||
],
|
||||
description:
|
||||
'Provide a JSON array to convert to CSV format.',
|
||||
required: true,
|
||||
}),
|
||||
delimiter_type: Property.StaticDropdown({
|
||||
displayName: 'Delimiter Type',
|
||||
description: 'Select the delimiter type for the CSV file.',
|
||||
defaultValue: ',',
|
||||
required: true,
|
||||
options: {
|
||||
options: [
|
||||
{ label: 'Comma', value: ',' },
|
||||
{ label: 'Tab', value: '\t' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
const { json_array, delimiter_type } = context.propsValue;
|
||||
if (!Array.isArray(json_array)) {
|
||||
throw new Error(JSON.stringify({
|
||||
message: 'The input should be a JSON array.',
|
||||
}))
|
||||
}
|
||||
const flattened = json_array.map((item) => flatten(item) as Record<string, string>);
|
||||
|
||||
return stringify(flattened, {
|
||||
header: true,
|
||||
delimiter: delimiter_type,
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
}
|
||||
],
|
||||
"compilerOptions": {
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
}
|
||||
}
|
||||
@@ -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