@mitre-attack/attack-data-model
Version:
A TypeScript API for the MITRE ATT&CK data model
71 lines (68 loc) • 2.77 kB
JavaScript
import {
stixCreatedTimestampSchema,
stixModifiedTimestampSchema
} from "./chunk-QVEHTIAE.js";
import {
extensionsSchema
} from "./chunk-Y24HOPQL.js";
import {
granularMarkingSchema
} from "./chunk-S3URW6XG.js";
import {
stixSpecVersionSchema
} from "./chunk-7GRR66XR.js";
import {
objectMarkingRefsSchema,
stixCreatedByRefSchema
} from "./chunk-BUEHDLBB.js";
import {
externalReferencesSchema
} from "./chunk-UP3ZMB5U.js";
import {
stixIdentifierSchema
} from "./chunk-E3OY6DRE.js";
import {
stixTypeSchema
} from "./chunk-PFSYT437.js";
import {
nonEmptyRequiredString,
stixListOfString
} from "./chunk-KFUJRXYX.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: stixListOfString.optional().meta({
description: "The labels property specifies a set of terms used to meta this object."
}),
revoked: z.boolean().optional().meta({ description: "The revoked property indicates whether the object has been revoked." }),
confidence: z.number().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().meta({
description: "Identifies the confidence that the creator has in the correctness of their data."
}),
lang: nonEmptyRequiredString.optional().meta({ description: "Identifies the language of the text content in this object." }),
external_references: externalReferencesSchema.optional(),
object_marking_refs: objectMarkingRefsSchema.optional(),
granular_markings: z.array(granularMarkingSchema).optional().meta({ description: "The set of granular markings that apply to this object." }),
extensions: extensionsSchema.optional()
}).strict();
var stixDomainObjectSchema = stixBaseObjectSchema.extend({});
var stixRelationshipObjectSchema = stixBaseObjectSchema.extend({});
export {
stixDomainObjectSchema,
stixRelationshipObjectSchema
};