一键导入
create-playbook-component
// Use when: adding a new playbook automation component, implementing a PlaybookComponent interface, or registering a new playbook step
// Use when: adding a new playbook automation component, implementing a PlaybookComponent interface, or registering a new playbook step
Use when: scaffolding a creation form drawer with Formik validation and a Relay mutation for a new entity
Use when: creating a new ElasticSearch database migration file, adding or transforming data at deploy time
Use when: scaffolding a new backend entity type, domain module, GraphQL schema, resolvers, or STIX converter in opencti-graphql
Use when: creating a new Relay-connected React component, defining a GraphQL fragment, or wiring a component to a query
Use when: scaffolding a new GitHub Actions CI/CD workflow, adding automation for tests, builds, releases, or security scans
| name | create-playbook-component |
| description | Use when: adding a new playbook automation component, implementing a PlaybookComponent interface, or registering a new playbook step |
PLAYBOOK_MY_COMPONENT).Location: opencti-platform/opencti-graphql/src/modules/playbook/components/<name>-component.ts.
Define a TypeScript interface for the config and a JSONSchema for validation.
export interface MyComponentConfig {
key: string;
}
const SCHEMA: JSONSchemaType<MyComponentConfig> = {
type: 'object',
properties: {
key: { type: 'string' },
},
required: ['key'],
};
Implement PlaybookComponent<MyComponentConfig>.
export const PLAYBOOK_MY_COMPONENT: PlaybookComponent<MyComponentConfig> = {
id: 'PLAYBOOK_MY_COMPONENT',
name: 'My Component',
description: 'Does something useful',
icon: 'icon-name',
is_entry_point: false,
is_internal: true,
ports: [{ id: 'out', type: 'out' }],
configuration_schema: SCHEMA,
schema: async () => SCHEMA,
executor: async ({ bundle, playbookNode }) => {
// Business logic here
const config = playbookNode.configuration;
return { output_port: 'out', bundle };
},
};
Import and add to PLAYBOOK_COMPONENTS in src/modules/playbook/playbook-components.ts.