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,33 @@
|
||||
{
|
||||
"extends": [
|
||||
"../../../../.eslintrc.base.json"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx",
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# pieces-parser-expert
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build pieces-parser-expert` to build the library.
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@activepieces/piece-parser-expert",
|
||||
"version": "0.0.1",
|
||||
"type": "commonjs",
|
||||
"main": "./src/index.js",
|
||||
"types": "./src/index.d.ts",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "pieces-parser-expert",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/parser-expert/src",
|
||||
"projectType": "library",
|
||||
"release": {
|
||||
"version": {
|
||||
"manifestRootsToUpdate": [
|
||||
"dist/{projectRoot}"
|
||||
],
|
||||
"currentVersionResolver": "git-tag",
|
||||
"fallbackCurrentVersionResolver": "disk"
|
||||
}
|
||||
},
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"options": {
|
||||
"outputPath": "dist/packages/pieces/community/parser-expert",
|
||||
"tsConfig": "packages/pieces/community/parser-expert/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/parser-expert/package.json",
|
||||
"main": "packages/pieces/community/parser-expert/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/parser-expert/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/parser-expert/src/i18n",
|
||||
"output": "./src/i18n",
|
||||
"glob": "**/!(i18n.json)"
|
||||
}
|
||||
],
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies",
|
||||
"updateBuildableProjectDepsInPackageJson": true
|
||||
},
|
||||
"dependsOn": [
|
||||
"prebuild",
|
||||
"^build"
|
||||
]
|
||||
},
|
||||
"nx-release-publish": {
|
||||
"options": {
|
||||
"packageRoot": "dist/{projectRoot}"
|
||||
}
|
||||
},
|
||||
"prebuild": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
],
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/pieces/community/parser-expert",
|
||||
"command": "bun install --no-save --silent"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { createPiece } from "@activepieces/pieces-framework";
|
||||
import { PieceCategory } from "@activepieces/shared";
|
||||
import { parserExpertAuth } from "./lib/common/auth";
|
||||
import { uploadDocument } from "./lib/actions/upload-document";
|
||||
import { getExtractedData } from "./lib/actions/get-extracted-data";
|
||||
|
||||
export const parserExpert = createPiece({
|
||||
displayName: "Parser Expert",
|
||||
auth: parserExpertAuth,
|
||||
minimumSupportedRelease: '0.36.1',
|
||||
logoUrl: "https://cdn.activepieces.com/pieces/parser-expert.png",
|
||||
description: "Parse documents and extract data from PDFs, DOCX files, images, and webpages using Parser Expert's powerful API.",
|
||||
categories: [PieceCategory.CONTENT_AND_FILES],
|
||||
authors: ["onyedikachi-david"],
|
||||
actions: [
|
||||
uploadDocument,
|
||||
getExtractedData,
|
||||
],
|
||||
triggers: [],
|
||||
});
|
||||
@@ -0,0 +1,47 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { parserExpertAuth } from '../common/auth';
|
||||
import { parserExpertCommon } from '../common/client';
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
|
||||
export const getExtractedData = createAction({
|
||||
auth: parserExpertAuth,
|
||||
name: 'get_extracted_data',
|
||||
displayName: 'Get Extracted Data',
|
||||
description: 'Retrieve the extracted data using the parser ID and bucket ID. The parser ID is returned when you upload a document.',
|
||||
props: {
|
||||
parser_id: Property.ShortText({
|
||||
displayName: 'Parser ID',
|
||||
description: 'The ID of the parser. This is returned when content is uploaded.',
|
||||
required: true,
|
||||
}),
|
||||
bucket_id: Property.ShortText({
|
||||
displayName: 'Bucket ID',
|
||||
description: 'The ID of the bucket where the data is stored.',
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
async run({ auth, propsValue }) {
|
||||
const { parser_id, bucket_id } = propsValue;
|
||||
|
||||
const response = await parserExpertCommon.apiCall<{
|
||||
data: Array<{
|
||||
parsed_data: Record<string, unknown>;
|
||||
parser_id: string;
|
||||
status: 'pending' | 'parsed' | 'error';
|
||||
updated_at: string;
|
||||
}>;
|
||||
message: string;
|
||||
}>({
|
||||
method: HttpMethod.GET,
|
||||
url: '/v1/extracts',
|
||||
auth: auth.secret_text,
|
||||
queryParams: {
|
||||
parser_id,
|
||||
bucket_id,
|
||||
},
|
||||
});
|
||||
|
||||
return response;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { parserExpertAuth } from '../common/auth';
|
||||
import { parserExpertCommon } from '../common/client';
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
import FormData from 'form-data';
|
||||
|
||||
export const uploadDocument = createAction({
|
||||
auth: parserExpertAuth,
|
||||
name: 'upload_document',
|
||||
displayName: 'Upload Document',
|
||||
description: 'Upload a document or provide a webpage URL to parse. Supported formats: PDF, DOCX, Image, Txt File (maximum 10 pages per document).',
|
||||
props: {
|
||||
bucket_id: Property.ShortText({
|
||||
displayName: 'Bucket ID',
|
||||
description: 'The ID of the bucket where the data will be stored. You can find this in your dashboard under Manage Bucket.',
|
||||
required: true,
|
||||
}),
|
||||
file: Property.File({
|
||||
displayName: 'File',
|
||||
description: 'The file to upload. Supported formats: PDF, DOCX, Image, Txt File (maximum 10 pages per document). This will be ignored if webpage URL is provided.',
|
||||
required: false,
|
||||
}),
|
||||
webpage_url: Property.ShortText({
|
||||
displayName: 'Webpage URL',
|
||||
description: 'The URL of the webpage to extract content from. This will be ignored if file is provided.',
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
async run({ auth, propsValue }) {
|
||||
const { bucket_id, file, webpage_url } = propsValue;
|
||||
|
||||
if (!file && !webpage_url) {
|
||||
throw new Error('Either file or webpage URL must be provided');
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('bucket_id', bucket_id);
|
||||
|
||||
if (file) {
|
||||
formData.append('file', file.data, file.filename);
|
||||
} else if (webpage_url) {
|
||||
formData.append('webpage_url', webpage_url);
|
||||
}
|
||||
|
||||
const response = await parserExpertCommon.apiCall<{
|
||||
data: {
|
||||
parser_id: string;
|
||||
};
|
||||
message: string;
|
||||
}>({
|
||||
method: HttpMethod.POST,
|
||||
url: '/v1/upload',
|
||||
auth: auth.secret_text,
|
||||
body: formData,
|
||||
headers: formData.getHeaders(),
|
||||
});
|
||||
|
||||
return response;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { PieceAuth } from '@activepieces/pieces-framework';
|
||||
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
|
||||
|
||||
export const parserExpertAuth = PieceAuth.SecretText({
|
||||
displayName: 'API Key',
|
||||
description: 'Your Parser Expert API key. You can find this in your dashboard under Integration -> New API Key.',
|
||||
required: true,
|
||||
validate: async ({ auth }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
valid: false,
|
||||
error: 'API key is required',
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
return {
|
||||
valid: true,
|
||||
};
|
||||
} catch (error: any) {
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Invalid API key. Please check your API key and try again.',
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
|
||||
|
||||
export const parserExpertCommon = {
|
||||
baseUrl: 'https://api.parser.expert',
|
||||
|
||||
async apiCall<T>({
|
||||
method,
|
||||
url,
|
||||
auth,
|
||||
body,
|
||||
headers,
|
||||
queryParams,
|
||||
}: {
|
||||
method: HttpMethod;
|
||||
url: string;
|
||||
auth: string;
|
||||
body?: any;
|
||||
headers?: Record<string, string>;
|
||||
queryParams?: Record<string, string>;
|
||||
}): Promise<T> {
|
||||
let fullUrl = `${this.baseUrl}${url}`;
|
||||
|
||||
if (queryParams && Object.keys(queryParams).length > 0) {
|
||||
const params = new URLSearchParams(queryParams);
|
||||
fullUrl += `?${params.toString()}`;
|
||||
}
|
||||
|
||||
const response = await httpClient.sendRequest<T>({
|
||||
method,
|
||||
url: fullUrl,
|
||||
headers: {
|
||||
'X-API-Key': auth,
|
||||
...headers,
|
||||
},
|
||||
body,
|
||||
});
|
||||
|
||||
if (response.status >= 400) {
|
||||
throw new Error(`Parser Expert API error: ${response.status} ${JSON.stringify(response.body)}`);
|
||||
}
|
||||
|
||||
return response.body;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"importHelpers": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noPropertyAccessFromIndexSignature": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user