一键导入
create-module
// Use when: scaffolding a new backend entity type, domain module, GraphQL schema, resolvers, or STIX converter in opencti-graphql
// Use when: scaffolding a new backend entity type, domain module, GraphQL schema, resolvers, or STIX converter in opencti-graphql
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: adding a new playbook automation component, implementing a PlaybookComponent interface, or registering a new playbook step
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-module |
| description | Use when: scaffolding a new backend entity type, domain module, GraphQL schema, resolvers, or STIX converter in opencti-graphql |
MalwareAnalysis).ENTITY_TYPE_MALWARE_ANALYSIS).ABSTRACT_STIX_DOMAIN_OBJECT.Create opencti-platform/opencti-graphql/src/modules/<entityName>.
<name>.graphql)Define the Input, Type, Queries, and Mutations.
<name>-types.ts)Define TypeScript interfaces for StixObject, StoreEntity, and internal representations.
Export the ENTITY_TYPE_X constant here.
<name>-converter.ts)Implement convert<Name>ToStix function to map StoreEntity to StixObject.
<name>-domain.ts)Implement CRUD functions: findAll, findById, add<Name>, delete<Name>.
Use listEntities and createEntity from database/middleware.
<name>-resolvers.ts)Map the GraphQL Query/Mutation fields to the functions in <name>-domain.ts.
<name>.ts)Implement ModuleDefinition interface.
Define attributes, relations, and register the definition using registerDefinition.
<name>-graphql.ts)Create a <name>-graphql.ts file in the module folder that imports the module schema/resolvers and calls registerGraphqlSchema(...).
src/modules/index.tsAdd two distinct imports in src/modules/index.ts:
region registration modules section, import ./<entityName>/<entityName> (module definition registration).region graphql registration section, import ./<entityName>/<entityName>-graphql (GraphQL endpoint registration).If the entity belongs to a STIX union type (e.g., StixObject, StixDomainObject), add it to the relevant unions in src/schema/opencti.graphql.
Run yarn build:schema to regenerate TypeScript types from the updated schema.