Function defineAction
- define
Action <CredentialType>(): (<Name, InputParamsSchema>(definition) => ActionDefinition<Name, InputParamsSchema, CredentialType>) Type Parameters
CredentialType extends AnyAppCredential
Returns (<Name, InputParamsSchema>(definition) => ActionDefinition<Name, InputParamsSchema, CredentialType>)
- <Name, InputParamsSchema>(definition): ActionDefinition<Name, InputParamsSchema, CredentialType>
Type Parameters
Name extends string
InputParamsSchema extends TObject<TProperties>
Parameters
definition: ActionDefinition<Name, InputParamsSchema, CredentialType>
Returns ActionDefinition<Name, InputParamsSchema, CredentialType>
Example
import { defineAction } from "@rollout/framework";
import { MyAppCredential } from "./auth";
const inputParamsSchema: z.object({
name: z.string()
});
export const action = defineAction<MyAppCredential>()({
name: "My Action",
inputParamsSchema,
async execute({ credential, resolvedInputParams }) {
// Execute the action here.
// Return the output.
return {};
}
});
Used to define a Connector Action.