UNPKG

@mitre-attack/attack-data-model

Version:

A TypeScript API for the MITRE ATT&CK data model

65 lines (62 loc) 2.64 kB
import { stixCreatedTimestampSchema, stixModifiedTimestampSchema } from "./chunk-O4MZPUSY.js"; import { extensionsSchema } from "./chunk-X6N7C26H.js"; import { stixSpecVersionSchema } from "./chunk-36L755UT.js"; import { objectMarkingRefsSchema } from "./chunk-Z7F5EWOT.js"; import { externalReferencesSchema, granularMarkingSchema, stixCreatedByRefSchema } from "./chunk-QY7EQ3UO.js"; import { stixIdentifierSchema } from "./chunk-OM2DJ5DL.js"; import { stixTypeSchema } from "./chunk-5JU73PGM.js"; // src/schemas/common/stix-core.ts import { z } from "zod/v4"; var stixBaseObjectSchema = z.object({ id: stixIdentifierSchema.meta({ description: "The id property universally and uniquely identifies this object." }), type: stixTypeSchema, spec_version: stixSpecVersionSchema.meta({ description: "The version of the STIX specification used to represent this object." }), created: stixCreatedTimestampSchema.meta({ description: "The created property represents the time at which the first version of this object was created. The timstamp value MUST be precise to the nearest millisecond." }), modified: stixModifiedTimestampSchema.meta({ description: "The modified property represents the time that this particular version of the object was modified. The timstamp value MUST be precise to the nearest millisecond." }), created_by_ref: stixCreatedByRefSchema.optional(), labels: z.array(z.string()).meta({ description: "The labels property specifies a set of terms used to meta this object." }).optional(), revoked: z.boolean().meta({ description: "The revoked property indicates whether the object has been revoked." }).optional(), confidence: z.number().meta({ description: "Identifies the confidence that the creator has in the correctness of their data." }).int().min(1).max(99).optional().refine((val) => val === void 0 || val > 0 && val < 100, { message: "Confidence must be between 1 and 99 inclusive." }).optional(), lang: z.string().meta({ description: "Identifies the language of the text content in this object." }).optional(), external_references: externalReferencesSchema.optional(), object_marking_refs: objectMarkingRefsSchema.optional(), granular_markings: z.array(granularMarkingSchema).meta({ description: "The set of granular markings that apply to this object." }).optional(), extensions: extensionsSchema.optional() }).strict(); var stixDomainObjectSchema = stixBaseObjectSchema.extend({}); var stixRelationshipObjectSchema = stixBaseObjectSchema.extend({}); export { stixDomainObjectSchema, stixRelationshipObjectSchema };