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,99 @@
|
||||
import { LATEST_CONTEXT_VERSION } from '@activepieces/pieces-framework'
|
||||
import {
|
||||
FlowActionType,
|
||||
flowStructureUtil,
|
||||
FlowTriggerType,
|
||||
FlowVersion,
|
||||
GenericStepOutput,
|
||||
isNil,
|
||||
LoopStepOutput,
|
||||
RouterStepOutput,
|
||||
spreadIfDefined,
|
||||
StepOutputStatus,
|
||||
} from '@activepieces/shared'
|
||||
import { createPropsResolver } from '../../variables/props-resolver'
|
||||
import { FlowExecutorContext } from './flow-execution-context'
|
||||
|
||||
export const testExecutionContext = {
|
||||
async stateFromFlowVersion({
|
||||
flowVersion,
|
||||
excludedStepName,
|
||||
projectId,
|
||||
engineToken,
|
||||
apiUrl,
|
||||
sampleData,
|
||||
}: TestExecutionParams): Promise<FlowExecutorContext> {
|
||||
let flowExecutionContext = FlowExecutorContext.empty()
|
||||
if (isNil(flowVersion)) {
|
||||
return flowExecutionContext
|
||||
}
|
||||
|
||||
const flowSteps = flowStructureUtil.getAllSteps(flowVersion.trigger)
|
||||
|
||||
for (const step of flowSteps) {
|
||||
const { name } = step
|
||||
if (name === excludedStepName) {
|
||||
continue
|
||||
}
|
||||
|
||||
const stepType = step.type
|
||||
switch (stepType) {
|
||||
case FlowActionType.ROUTER:
|
||||
flowExecutionContext = flowExecutionContext.upsertStep(
|
||||
step.name,
|
||||
RouterStepOutput.create({
|
||||
input: step.settings,
|
||||
type: stepType,
|
||||
status: StepOutputStatus.SUCCEEDED,
|
||||
...spreadIfDefined('output', sampleData?.[step.name]),
|
||||
}),
|
||||
)
|
||||
break
|
||||
case FlowActionType.LOOP_ON_ITEMS: {
|
||||
const { resolvedInput } = await createPropsResolver({
|
||||
apiUrl,
|
||||
projectId,
|
||||
engineToken,
|
||||
contextVersion: LATEST_CONTEXT_VERSION,
|
||||
}).resolve<{ items: unknown[] }>({
|
||||
unresolvedInput: step.settings,
|
||||
executionState: flowExecutionContext,
|
||||
})
|
||||
flowExecutionContext = flowExecutionContext.upsertStep(
|
||||
step.name,
|
||||
LoopStepOutput.init({
|
||||
input: step.settings,
|
||||
}).setOutput({
|
||||
item: resolvedInput.items[0],
|
||||
index: 1,
|
||||
iterations: [],
|
||||
}),
|
||||
)
|
||||
break
|
||||
}
|
||||
case FlowActionType.PIECE:
|
||||
case FlowActionType.CODE:
|
||||
case FlowTriggerType.EMPTY:
|
||||
case FlowTriggerType.PIECE:
|
||||
flowExecutionContext = flowExecutionContext.upsertStep(step.name, GenericStepOutput.create({
|
||||
input: {},
|
||||
type: stepType,
|
||||
status: StepOutputStatus.SUCCEEDED,
|
||||
...spreadIfDefined('output', sampleData?.[step.name]),
|
||||
}))
|
||||
break
|
||||
}
|
||||
}
|
||||
return flowExecutionContext
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
type TestExecutionParams = {
|
||||
flowVersion?: FlowVersion
|
||||
excludedStepName?: string
|
||||
projectId: string
|
||||
apiUrl: string
|
||||
engineToken: string
|
||||
sampleData?: Record<string, unknown>
|
||||
}
|
||||
Reference in New Issue
Block a user