UNPKG

@mitre-attack/attack-data-model

Version:

A TypeScript API for the MITRE ATT&CK data model

51 lines (48 loc) 1.8 kB
import { attackBaseDomainObjectSchema } from "./chunk-63MLXW5B.js"; import { descriptionSchema, objectMarkingRefsSchema } from "./chunk-7SVTHS3K.js"; import { stixCreatedByRefSchema } from "./chunk-ZAIY3U5E.js"; import { createStixIdValidator, stixIdentifierSchema } from "./chunk-BX5HSTNG.js"; import { createStixTypeValidator } from "./chunk-E6AAF2HD.js"; import { stixModifiedTimestampSchema } from "./chunk-M5Z5D4DC.js"; // src/schemas/sdo/collection.schema.ts import { z } from "zod"; var objectVersionReferenceSchema = z.object({ object_ref: stixIdentifierSchema.describe("The ID of the referenced object."), object_modified: stixModifiedTimestampSchema.describe( "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.").describe("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.describe( "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 };