UNPKG

@mitre-attack/attack-data-model

Version:

A TypeScript API for the MITRE ATT&CK data model

54 lines (51 loc) 1.58 kB
import { z } from 'zod/v4'; /** * Schema for validating object descriptions. * * A non-empty, trimmed string providing descriptive information about a STIX or ATT&CK object. * * @example * ```typescript * descriptionSchema.parse("This technique describes..."); // "This technique describes..." * descriptionSchema.parse(" "); // throws error * ``` */ declare const descriptionSchema: z.ZodString; /** * Type representing a validated object description. */ type Description = z.infer<typeof descriptionSchema>; /** * Schema for validating object names. * * A non-empty, trimmed string representing the name of a STIX or ATT&CK object. * * @example * ```typescript * nameSchema.parse("Attack Pattern"); // "Attack Pattern" * nameSchema.parse(""); // throws error * ``` */ declare const nameSchema: z.ZodString; /** * Type representing a validated object name. */ type Name = z.infer<typeof nameSchema>; /** * Schema for validating object aliases. * * An array of alternative names used to identify an object. According to ATT&CK conventions, * the first alias in the array must match the object's name property. * * @example * ```typescript * aliasesSchema.parse(["APT28", "Fancy Bear", "Sofacy"]); // Valid * aliasesSchema.parse([]); // throws error - at least one alias required * ``` */ declare const aliasesSchema: z.ZodArray<z.ZodString>; /** * Type representing a list of object aliases. */ type Aliases = z.infer<typeof aliasesSchema>; export { type Aliases, type Description, type Name, aliasesSchema, descriptionSchema, nameSchema };