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:
co-authored by
Claude Opus 4.5
parent
9848268d34
commit
3aa7199503
@@ -0,0 +1,146 @@
|
||||
import * as soap from 'soap';
|
||||
import {
|
||||
CustomAuthProps,
|
||||
Property,
|
||||
ShortTextProperty,
|
||||
StaticDropdownProperty,
|
||||
StaticMultiSelectDropdownProperty,
|
||||
StaticPropsValue,
|
||||
createAction,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import { soapAuth } from '../shared/auth';
|
||||
|
||||
type DynamicProp =
|
||||
| ShortTextProperty<boolean>
|
||||
| StaticDropdownProperty<any, boolean>
|
||||
| StaticMultiSelectDropdownProperty<any, boolean>;
|
||||
|
||||
export const callMethod = createAction({
|
||||
name: 'call_method',
|
||||
displayName: 'Call SOAP Method',
|
||||
description: 'Call a SOAP from a given wsdl specification',
|
||||
auth: soapAuth(),
|
||||
props: {
|
||||
wsdl: Property.ShortText({
|
||||
displayName: 'WSDL URL',
|
||||
required: true,
|
||||
}),
|
||||
method: Property.Dropdown({
|
||||
auth: soapAuth(),
|
||||
description: 'The SOAP Method',
|
||||
displayName: 'Method',
|
||||
required: true,
|
||||
refreshers: ['wsdl'],
|
||||
options: async ({ wsdl }) => {
|
||||
if (!wsdl) {
|
||||
return {
|
||||
disabled: true,
|
||||
placeholder: 'Setup WSDL URL first',
|
||||
options: [],
|
||||
};
|
||||
}
|
||||
|
||||
const client = await soap.createClientAsync(wsdl as string);
|
||||
const spec = client.describe();
|
||||
const methods = Object.keys(
|
||||
Object.values(Object.values(spec)[0] as object)[0]
|
||||
);
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: methods.map((method) => {
|
||||
return {
|
||||
label: method,
|
||||
value: method,
|
||||
};
|
||||
}),
|
||||
};
|
||||
},
|
||||
}),
|
||||
args: Property.DynamicProperties({
|
||||
auth: soapAuth(),
|
||||
description: 'Arguments for the SOAP method',
|
||||
displayName: 'Parameters',
|
||||
required: true,
|
||||
refreshers: ['wsdl', 'method'],
|
||||
async props({ wsdl, method }) {
|
||||
if (!wsdl || !method) {
|
||||
return {};
|
||||
}
|
||||
const client = await soap.createClientAsync(wsdl as unknown as string);
|
||||
const spec = client.describe();
|
||||
const methods = Object.values(Object.values(spec)[0] as object)[0];
|
||||
|
||||
const properties: Record<string, DynamicProp> = {};
|
||||
|
||||
for (const key in methods[method as unknown as string]['input']) {
|
||||
properties[key as string] = Property.ShortText({
|
||||
displayName: key,
|
||||
required: true,
|
||||
});
|
||||
}
|
||||
|
||||
return properties;
|
||||
},
|
||||
}),
|
||||
parsed: Property.Checkbox({
|
||||
displayName: 'Parsed',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
}),
|
||||
},
|
||||
async run(ctx) {
|
||||
const { wsdl, method, args, parsed } = ctx.propsValue;
|
||||
|
||||
const client = await soap.createClientAsync(wsdl, {
|
||||
forceSoap12Headers: true,
|
||||
});
|
||||
|
||||
const auth = ctx.auth as StaticPropsValue<CustomAuthProps>;
|
||||
switch (auth['type']) {
|
||||
case 'WS':
|
||||
client.setSecurity(
|
||||
new soap.WSSecurity(
|
||||
auth['username'] as string,
|
||||
auth['password'] as string
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'Basic':
|
||||
client.setSecurity(
|
||||
new soap.BasicAuthSecurity(
|
||||
auth['username'] as string,
|
||||
auth['password'] as string
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'Header': // eslint-disable-next-line no-case-declarations
|
||||
client.addSoapHeader(ctx.auth.props.customHeader);
|
||||
break;
|
||||
}
|
||||
|
||||
const action = client[method + 'Async'];
|
||||
|
||||
try {
|
||||
const [actionRes] = await action(args);
|
||||
|
||||
if (parsed || false) {
|
||||
return actionRes;
|
||||
} else {
|
||||
return {
|
||||
request: client.lastRequest,
|
||||
response: client.lastResponse,
|
||||
};
|
||||
}
|
||||
} catch (e: any) {
|
||||
return {
|
||||
error: true,
|
||||
status: e.response.status,
|
||||
raw: {
|
||||
request: client.lastRequest,
|
||||
response: e.body,
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
import { PieceAuth, Property } from '@activepieces/pieces-framework';
|
||||
|
||||
export function soapAuth() {
|
||||
return PieceAuth.CustomAuth({
|
||||
required: true,
|
||||
props: {
|
||||
type: Property.StaticDropdown({
|
||||
displayName: 'Authentication Type',
|
||||
required: true,
|
||||
options: {
|
||||
options: [
|
||||
{
|
||||
label: 'None',
|
||||
value: 'None',
|
||||
},
|
||||
{
|
||||
label: 'WS Security',
|
||||
value: 'WS',
|
||||
},
|
||||
{
|
||||
label: 'Basic Auth',
|
||||
value: 'Basic',
|
||||
},
|
||||
{
|
||||
label: 'Custom Header',
|
||||
value: 'Header',
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
username: Property.ShortText({
|
||||
displayName: 'Username',
|
||||
description: 'The WS Security username',
|
||||
required: false,
|
||||
}),
|
||||
password: Property.ShortText({
|
||||
displayName: 'Password',
|
||||
description: 'The WS Security password',
|
||||
required: false,
|
||||
}),
|
||||
customHeader: Property.LongText({
|
||||
displayName: 'Custom Header',
|
||||
description: 'Custom Header Content',
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user