UNPKG

@mitre-attack/attack-data-model

Version:

A TypeScript API for the MITRE ATT&CK data model

48 lines (45 loc) 1.83 kB
import { z } from 'zod/v4'; /** * Schema for validating MITRE object versions (`x_mitre_version`). * * Validates version strings in 'major.minor' format where both components are integers * between 0 and 99. This follows semantic versioning principles but excludes the patch number. * The version is incremented by ATT&CK when object content is updated. * * Note: This property does not apply to relationship objects. * * @example * ```typescript * xMitreVersionSchema.parse("1.0"); // "1.0" * xMitreVersionSchema.parse("12.5"); // "12.5" * xMitreVersionSchema.parse("1.0.0"); // throws error - no patch version allowed * xMitreVersionSchema.parse("100.0"); // throws error - major > 99 * ``` */ declare const xMitreVersionSchema: z.ZodString; /** * Type representing a validated MITRE version string. */ type XMitreVersion = z.infer<typeof xMitreVersionSchema>; /** * Schema for validating ATT&CK spec versions (`x_mitre_attack_spec_version`). * * Validates semantic version strings in 'MAJOR.MINOR.PATCH' format. This field helps * consuming software determine if the data format is supported. If not present on an * object, the spec version is assumed to be 2.0.0. * * Refer to the ATT&CK CHANGELOG for all supported versions. * * @example * ```typescript * xMitreAttackSpecVersionSchema.parse("3.0.0"); // "3.0.0" * xMitreAttackSpecVersionSchema.parse("2.1.0"); // "2.1.0" * xMitreAttackSpecVersionSchema.parse("1.0"); // throws error - must include patch version * ``` */ declare const xMitreAttackSpecVersionSchema: z.ZodString; /** * Type representing a validated ATT&CK spec version string. */ type XMitreAttackSpecVersion = z.infer<typeof xMitreAttackSpecVersionSchema>; export { type XMitreAttackSpecVersion, type XMitreVersion, xMitreAttackSpecVersionSchema, xMitreVersionSchema };