UNPKG

@mitre-attack/attack-data-model

Version:

A TypeScript API for the MITRE ATT&CK data model

51 lines (48 loc) 1.85 kB
import { attackBaseDomainObjectSchema } from "./chunk-ZQ5CIHH7.js"; import { stixModifiedTimestampSchema } from "./chunk-O4MZPUSY.js"; import { descriptionSchema, objectMarkingRefsSchema } from "./chunk-Z7F5EWOT.js"; import { stixCreatedByRefSchema } from "./chunk-QY7EQ3UO.js"; import { createStixIdValidator, stixIdentifierSchema } from "./chunk-OM2DJ5DL.js"; import { createStixTypeValidator } from "./chunk-5JU73PGM.js"; // src/schemas/sdo/collection.schema.ts import { z } from "zod/v4"; var objectVersionReferenceSchema = z.object({ object_ref: stixIdentifierSchema.meta({ description: "The ID of the referenced object." }), object_modified: stixModifiedTimestampSchema.meta({ description: "The modified time of the referenced object. It MUST be an exact match for the modified time of the STIX object being referenced." }) }); var xMitreContentsSchema = z.array(objectVersionReferenceSchema).min(1, "At least one STIX object reference is required.").meta({ description: "Specifies the objects contained within the collection." }); var extensibleCollectionSchema = attackBaseDomainObjectSchema.extend({ id: createStixIdValidator("x-mitre-collection"), type: createStixTypeValidator("x-mitre-collection"), // Optional in STIX but required in ATT&CK created_by_ref: stixCreatedByRefSchema, // Optional in STIX but required in ATT&CK object_marking_refs: objectMarkingRefsSchema, description: descriptionSchema.meta({ description: "Details, context, and explanation about the purpose or contents of the collection." }), x_mitre_contents: xMitreContentsSchema.min(1, "At least one STIX object reference is required") }).strict(); var collectionSchema = extensibleCollectionSchema; export { objectVersionReferenceSchema, xMitreContentsSchema, extensibleCollectionSchema, collectionSchema };