UNPKG

@mitre-attack/attack-data-model

Version:

A TypeScript API for the MITRE ATT&CK data model

45 lines (42 loc) 1.37 kB
import { attackBaseDomainObjectSchema } from "./chunk-V2FCJ647.js"; import { descriptionSchema } from "./chunk-IL3U5D6K.js"; import { xMitreModifiedByRefSchema } from "./chunk-IE6R5TVY.js"; import { createStixIdValidator } from "./chunk-E3OY6DRE.js"; import { createStixTypeValidator } from "./chunk-PFSYT437.js"; import { xMitreDomainsSchema } from "./chunk-ZEHAFUHO.js"; // src/schemas/sdo/matrix.schema.ts import { z } from "zod/v4"; var xMitreTacticRefsSchema = z.array(createStixIdValidator("x-mitre-tactic")).min(1, { error: "At least one tactic ref is required" }).meta({ description: "An ordered list of x-mitre-tactic STIX IDs corresponding to the tactics of the matrix. The order determines the appearance within the matrix." }); var matrixSchema = attackBaseDomainObjectSchema.extend({ id: createStixIdValidator("x-mitre-matrix"), type: createStixTypeValidator("x-mitre-matrix"), description: descriptionSchema, x_mitre_domains: xMitreDomainsSchema, x_mitre_modified_by_ref: xMitreModifiedByRefSchema, tactic_refs: xMitreTacticRefsSchema }).required({ created_by_ref: true, // Optional in STIX but required in ATT&CK external_references: true, // Optional in STIX but required in ATT&CK object_marking_refs: true // Optional in STIX but required in ATT&CK }).strict(); export { xMitreTacticRefsSchema, matrixSchema };