UNPKG

@mitre-attack/attack-data-model

Version:

A TypeScript API for the MITRE ATT&CK data model

65 lines (62 loc) 2.58 kB
import { objectMarkingRefsSchema } from "./chunk-7SVTHS3K.js"; import { extensionsSchema, externalReferencesSchema, granularMarkingSchema, stixCreatedByRefSchema } from "./chunk-ZAIY3U5E.js"; import { stixIdentifierSchema } from "./chunk-BX5HSTNG.js"; import { stixTypeSchema } from "./chunk-E6AAF2HD.js"; import { stixSpecVersionSchema } from "./chunk-Q47ULSOA.js"; import { stixCreatedTimestampSchema, stixModifiedTimestampSchema } from "./chunk-M5Z5D4DC.js"; // src/schemas/common/stix-core.ts import { z } from "zod"; var stixBaseObjectSchema = z.object({ id: stixIdentifierSchema.describe( "The id property universally and uniquely identifies this object." ), type: stixTypeSchema, spec_version: stixSpecVersionSchema.describe( "The version of the STIX specification used to represent this object." ), created: stixCreatedTimestampSchema.describe( "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.describe( "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()).describe("The labels property specifies a set of terms used to describe this object.").optional(), revoked: z.boolean().describe("The revoked property indicates whether the object has been revoked.").optional(), confidence: z.number().describe("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().describe("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).describe("The set of granular markings that apply to this object.").optional(), extensions: extensionsSchema.optional() }).required({ id: true, type: true, spec_version: true, created: true, modified: true }).strict(); var stixDomainObjectSchema = stixBaseObjectSchema.extend({}); var stixRelationshipObjectSchema = stixBaseObjectSchema.extend({}); export { stixDomainObjectSchema, stixRelationshipObjectSchema };