@mitre-attack/attack-data-model
Version:
A TypeScript API for the MITRE ATT&CK data model
57 lines (54 loc) • 2.15 kB
JavaScript
import {
attackBaseDomainObjectSchema
} from "./chunk-ZHQVMLOZ.js";
import {
stixModifiedTimestampSchema
} from "./chunk-QVEHTIAE.js";
import {
objectMarkingRefsSchema,
stixCreatedByRefSchema
} from "./chunk-BUEHDLBB.js";
import {
descriptionSchema
} from "./chunk-DNIVZ2SM.js";
import {
xMitreModifiedByRefSchema
} from "./chunk-U55YRJAX.js";
import {
createStixIdValidator,
stixIdentifierSchema
} from "./chunk-E3OY6DRE.js";
import {
createStixTypeValidator
} from "./chunk-PFSYT437.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 collectionSchema = 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"),
x_mitre_modified_by_ref: xMitreModifiedByRefSchema.optional()
}).strict().meta({
description: `
See our [collections document](https://github.com/center-for-threat-informed-defense/attack-workbench-frontend/blob/main/docs/collections.md) for more information about the design and intention of collection objects.
`.trim()
});
export {
objectVersionReferenceSchema,
xMitreContentsSchema,
collectionSchema
};