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,33 @@
{
"extends": [
"../../../../.eslintrc.base.json"
],
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"rules": {}
}
]
}

View File

@@ -0,0 +1,7 @@
# pieces-air-ops
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build pieces-air-ops` to build the library.

View File

@@ -0,0 +1,4 @@
{
"name": "@activepieces/piece-air-ops",
"version": "0.0.1"
}

View File

@@ -0,0 +1,65 @@
{
"name": "pieces-air-ops",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/pieces/community/air-ops/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/air-ops",
"tsConfig": "packages/pieces/community/air-ops/tsconfig.lib.json",
"packageJson": "packages/pieces/community/air-ops/package.json",
"main": "packages/pieces/community/air-ops/src/index.ts",
"assets": [
"packages/pieces/community/air-ops/*.md",
{
"input": "packages/pieces/community/air-ops/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/air-ops",
"command": "bun install --no-save --silent"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": [
"{options.outputFile}"
]
}
}
}

View File

@@ -0,0 +1,53 @@
import { createPiece, PieceAuth } from '@activepieces/pieces-framework';
import {
createCustomApiCallAction,
HttpMethod,
} from '@activepieces/pieces-common';
import { PieceCategory } from '@activepieces/shared';
import { BASE_URL, makeRequest } from './lib/common';
import { runWorkflow } from './lib/actions/run-workflow';
import { runWorkflowAsync } from './lib/actions/run-workflow-async';
import { getExecution } from './lib/actions/get-execution';
export const airOpsAuth = PieceAuth.SecretText({
displayName: 'API Key',
description:
'Your API key can be found in the **Workspace Settings** section of your AirOps account.',
required: true,
validate: async ({ auth }) => {
try {
await makeRequest(auth, HttpMethod.GET, '/public_api/airops_apps');
return {
valid: true,
};
} catch (e) {
return {
valid: false,
error: 'Invalid API Key.',
};
}
},
});
export const airOps = createPiece({
displayName: 'AirOps',
description: 'Build and deploy AI-powered workflows and agents.',
auth: airOpsAuth,
minimumSupportedRelease: '0.36.1',
logoUrl: 'https://cdn.activepieces.com/pieces/air-ops.png',
categories: [PieceCategory.ARTIFICIAL_INTELLIGENCE],
authors: ['onyedikachi-david'],
actions: [
runWorkflow,
runWorkflowAsync,
getExecution,
createCustomApiCallAction({
auth: airOpsAuth,
baseUrl: () => BASE_URL,
authMapping: async (auth) => ({
Authorization: `Bearer ${auth.secret_text}`,
}),
}),
],
triggers: [],
});

View File

@@ -0,0 +1,115 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { airOpsAuth } from '../..';
import { makeRequest } from '../common';
export const getExecution = createAction({
auth: airOpsAuth,
name: 'get_execution',
displayName: 'Get Execution',
description: 'Get an execution by UUID.',
props: {
app: Property.Dropdown({
displayName: 'Workflow',
description: 'Select the workflow.',
required: true,
refreshers: [],
auth: airOpsAuth,
options: async ({ auth }) => {
if (!auth) {
return {
disabled: true,
placeholder: 'Connect your AirOps account first',
options: [],
};
}
try {
const apps = await makeRequest(
auth.secret_text,
HttpMethod.GET,
'/public_api/airops_apps'
);
return {
disabled: false,
options: (apps as AirOpsApp[]).map((app) => ({
label: app.name,
value: app.id,
})),
};
} catch (error) {
return {
disabled: true,
placeholder: 'Failed to load workflows',
options: [],
};
}
},
}),
execution_uuid: Property.ShortText({
displayName: 'Execution UUID',
description: 'The UUID of the execution to retrieve.',
required: true,
}),
},
async run(context) {
const { app, execution_uuid } = context.propsValue;
const response = (await makeRequest(
context.auth.secret_text,
HttpMethod.GET,
`/public_api/airops_apps/${app}/executions`
)) as ExecutionsResponse;
const execution = response.data.find((e) => e.uuid === execution_uuid);
if (!execution) {
throw new Error(`Execution with UUID "${execution_uuid}" not found.`);
}
return execution;
},
});
interface AirOpsApp {
id: number;
name: string;
description: string;
background_color: string;
created_at: string;
updated_at: string;
active_version_id: number;
emoji: string;
public: boolean;
uuid: string;
readme: string;
}
interface Execution {
id: string;
status: string;
airops_apps_version_id: number;
conversation_id: string | null;
credits_used: number;
error_code: string | null;
error_message: unknown;
feedback: string | null;
inputs: Record<string, unknown>;
output: Record<string, unknown> | null;
runtime: number | null;
source: string | null;
uuid: string;
workspace_id: number;
createdAt: string;
updatedAt: string;
}
interface ExecutionsResponse {
data: Execution[];
meta: {
count: number;
has_more: boolean;
cursor: string;
};
}

View File

@@ -0,0 +1,105 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { airOpsAuth } from '../..';
import { makeRequest } from '../common';
export const runWorkflowAsync = createAction({
auth: airOpsAuth,
name: 'run_workflow_async',
displayName: 'Run Workflow (Async)',
description: 'Queue an AirOps workflow for asynchronous execution.',
props: {
app: Property.Dropdown({
displayName: 'Workflow',
description: 'Select the workflow to execute.',
required: true,
refreshers: [],
auth: airOpsAuth,
options: async ({ auth }) => {
if (!auth) {
return {
disabled: true,
placeholder: 'Connect your AirOps account first',
options: [],
};
}
try {
const apps = await makeRequest(
auth.secret_text,
HttpMethod.GET,
'/public_api/airops_apps'
);
return {
disabled: false,
options: (apps as AirOpsApp[]).map((app) => ({
label: app.name,
value: app.uuid,
})),
};
} catch (error) {
return {
disabled: true,
placeholder: 'Failed to load workflows',
options: [],
};
}
},
}),
inputs: Property.Json({
displayName: 'Inputs',
description: 'Input values for the workflow.',
required: false,
defaultValue: {},
}),
inputs_schema: Property.Json({
displayName: 'Inputs Schema',
description: 'Schema defining the workflow inputs (advanced).',
required: false,
}),
definition: Property.Json({
displayName: 'Definition',
description: 'Custom workflow definition steps (advanced).',
required: false,
}),
},
async run(context) {
const { app, inputs, inputs_schema, definition } = context.propsValue;
const body: Record<string, unknown> = {};
if (inputs) {
body['inputs'] = inputs;
}
if (inputs_schema) {
body['inputs_schema'] = inputs_schema;
}
if (definition) {
body['definition'] = definition;
}
const response = await makeRequest(
context.auth.secret_text,
HttpMethod.POST,
`/public_api/airops_apps/${app}/async_execute_definition`,
body
);
return response;
},
});
interface AirOpsApp {
id: number;
name: string;
description: string;
background_color: string;
created_at: string;
updated_at: string;
active_version_id: number;
emoji: string;
public: boolean;
uuid: string;
readme: string;
}

View File

@@ -0,0 +1,106 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { airOpsAuth } from '../..';
import { makeRequest } from '../common';
export const runWorkflow = createAction({
auth: airOpsAuth,
name: 'run_workflow',
displayName: 'Run Workflow',
description: 'Execute an AirOps workflow synchronously.',
props: {
app: Property.Dropdown({
displayName: 'Workflow',
description: 'Select the workflow to execute.',
required: true,
refreshers: [],
auth: airOpsAuth,
options: async ({ auth }) => {
if (!auth) {
return {
disabled: true,
placeholder: 'Connect your AirOps account first',
options: [],
};
}
try {
const apps = await makeRequest(
auth.secret_text,
HttpMethod.GET,
'/public_api/airops_apps'
);
return {
disabled: false,
options: (apps as AirOpsApp[]).map((app) => ({
label: app.name,
value: app.uuid,
})),
};
} catch (error) {
return {
disabled: true,
placeholder: 'Failed to load workflows',
options: [],
};
}
},
}),
inputs: Property.Json({
displayName: 'Inputs',
description: 'Input values for the workflow.',
required: false,
defaultValue: {},
}),
inputs_schema: Property.Json({
displayName: 'Inputs Schema',
description: 'Schema defining the workflow inputs (advanced).',
required: false,
}),
definition: Property.Json({
displayName: 'Definition',
description: 'Custom workflow definition steps (advanced).',
required: false,
}),
},
async run(context) {
const { app, inputs, inputs_schema, definition } = context.propsValue;
const body: Record<string, unknown> = {};
if (inputs) {
body['inputs'] = inputs;
}
if (inputs_schema) {
body['inputs_schema'] = inputs_schema;
}
if (definition) {
body['definition'] = definition;
}
const response = await makeRequest(
context.auth.secret_text,
HttpMethod.POST,
`/public_api/airops_apps/${app}/execute_definition`,
body
);
return response;
},
});
interface AirOpsApp {
id: number;
name: string;
description: string;
background_color: string;
created_at: string;
updated_at: string;
active_version_id: number;
emoji: string;
public: boolean;
uuid: string;
readme: string;
}

View File

@@ -0,0 +1,23 @@
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
export const BASE_URL = 'https://api.airops.com';
export async function makeRequest(
auth: string,
method: HttpMethod,
path: string,
body?: unknown
) {
const response = await httpClient.sendRequest({
method,
url: `${BASE_URL}${path}`,
headers: {
Authorization: `Bearer ${auth}`,
'Content-Type': 'application/json',
},
body,
});
return response.body;
}

View File

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

View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"]
}