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,58 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { base44Auth } from '../..';
import { createClient, Base44Error, type Base44Client } from '@base44/sdk';
export const createEntity = createAction({
auth: base44Auth,
name: 'create_entity',
displayName: 'Create Entity',
description: 'Creates an entity (record) in your Base44 app',
props: {
entityType: Property.ShortText({
displayName: 'Entity Type',
description: 'The name of the entity type (e.g. "Product", "User", "Order")',
required: true,
}),
entityData: Property.Json({
displayName: 'Entity Data',
description: 'The data to create the entity with',
required: true,
defaultValue: {},
}),
},
async run({ auth, propsValue }) {
const appId = auth.props.appId;
const token = auth.props.token;
const { entityType, entityData } = propsValue;
if (!appId) {
throw new Error('App ID is required.');
}
const base44: Base44Client = createClient({
appId,
token,
serviceToken: token,
});
try {
const entitiesModule = token
? base44.asServiceRole.entities as Record<string, { create: (data: Record<string, unknown>) => Promise<unknown> }>
: base44.entities as Record<string, { create: (data: Record<string, unknown>) => Promise<unknown> }>;
const result = await entitiesModule[entityType].create(entityData as Record<string, unknown>);
return result;
} catch (error: unknown) {
if (error instanceof Base44Error) {
if (error.status === 404) {
throw new Error(`Entity type "${entityType}" not found. Please check the name.`);
}
if (error.status === 401 || error.status === 403) {
throw new Error('Authentication failed. Please check your credentials.');
}
throw new Error(`Failed to create entity: ${error.message}`);
}
throw new Error(`Failed to create entity: ${error instanceof Error ? error.message : 'Unknown error'}`);
}
},
});

View File

@@ -0,0 +1,67 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { base44Auth } from '../..';
import { createClient, Base44Error, type Base44Client } from '@base44/sdk';
export const findEntity = createAction({
auth: base44Auth,
name: 'find_entity',
displayName: 'Find Entity Record',
description: 'Find a matching entity record in your Base44 app',
props: {
entityType: Property.ShortText({
displayName: 'Entity Type',
description: 'The name of the entity type (e.g. "Product", "User", "Order")',
required: true,
}),
searchQuery: Property.Json({
displayName: 'Search Query',
description: 'Query to find the entity (e.g. {"email": "john@example.com"})',
required: true,
defaultValue: {},
}),
},
async run({ auth, propsValue }) {
const appId = auth.props.appId;
const token = auth.props.token;
const { entityType, searchQuery } = propsValue;
if (!appId) {
throw new Error('App ID is required.');
}
const base44: Base44Client = createClient({
appId,
token,
serviceToken: token,
});
try {
const entitiesModule = token
? base44.asServiceRole.entities as Record<string, {
filter: (query: Record<string, unknown>) => Promise<unknown[]>;
}>
: base44.entities as Record<string, {
filter: (query: Record<string, unknown>) => Promise<unknown[]>;
}>;
const results = await entitiesModule[entityType].filter(searchQuery as Record<string, unknown>);
return {
found: Array.isArray(results) && results.length > 0,
count: Array.isArray(results) ? results.length : 0,
results: results,
};
} catch (error: unknown) {
if (error instanceof Base44Error) {
if (error.status === 404) {
throw new Error(`Entity type "${entityType}" not found. Please check the name.`);
}
if (error.status === 401 || error.status === 403) {
throw new Error('Authentication failed. Please check your credentials.');
}
throw new Error(`Failed to find entity: ${error.message}`);
}
throw new Error(`Failed to find entity: ${error instanceof Error ? error.message : 'Unknown error'}`);
}
},
});

View File

@@ -0,0 +1,85 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { base44Auth } from '../..';
import { createClient, Base44Error, type Base44Client } from '@base44/sdk';
export const findOrCreateEntity = createAction({
auth: base44Auth,
name: 'find_or_create_entity',
displayName: 'Find or Create Entity',
description: 'Find a matching entity record, or create one if not found',
props: {
entityType: Property.ShortText({
displayName: 'Entity Type',
description: 'The name of the entity type (e.g. "Product", "User", "Order")',
required: true,
}),
searchQuery: Property.Json({
displayName: 'Search Query',
description: 'Query to find the entity (e.g. {"email": "john@example.com"})',
required: true,
defaultValue: {},
}),
createData: Property.Json({
displayName: 'Create Data',
description: 'Data to create the entity with if not found',
required: true,
defaultValue: {},
}),
},
async run({ auth, propsValue }) {
const appId = auth.props.appId;
const token = auth.props.token;
const { entityType, searchQuery, createData } = propsValue;
if (!appId) {
throw new Error('App ID is required.');
}
const base44: Base44Client = createClient({
appId,
token,
serviceToken: token,
});
try {
const entitiesModule = token
? base44.asServiceRole.entities as Record<string, {
filter: (query: Record<string, unknown>) => Promise<unknown[]>;
create: (data: Record<string, unknown>) => Promise<unknown>;
}>
: base44.entities as Record<string, {
filter: (query: Record<string, unknown>) => Promise<unknown[]>;
create: (data: Record<string, unknown>) => Promise<unknown>;
}>;
const results = await entitiesModule[entityType].filter(searchQuery as Record<string, unknown>);
if (Array.isArray(results) && results.length > 0) {
return {
found: true,
created: false,
entity: results[0],
};
}
const newEntity = await entitiesModule[entityType].create(createData as Record<string, unknown>);
return {
found: false,
created: true,
entity: newEntity,
};
} catch (error: unknown) {
if (error instanceof Base44Error) {
if (error.status === 404) {
throw new Error(`Entity type "${entityType}" not found. Please check the name.`);
}
if (error.status === 401 || error.status === 403) {
throw new Error('Authentication failed. Please check your credentials.');
}
throw new Error(`Failed: ${error.message}`);
}
throw new Error(`Failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
}
},
});