UNPKG

@mitre-attack/attack-data-model

Version:

A TypeScript API for the MITRE ATT&CK data model

48 lines (44 loc) 2.28 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/schemas/common/property-schemas/stix-common-properties.ts var stix_common_properties_exports = {}; __export(stix_common_properties_exports, { aliasesSchema: () => aliasesSchema, descriptionSchema: () => descriptionSchema, nameSchema: () => nameSchema }); module.exports = __toCommonJS(stix_common_properties_exports); var import_v4 = require("zod/v4"); // src/schemas/common/property-schemas/generics.ts var import_zod = require("zod"); var nonEmptyRequiredString = import_zod.z.string().trim().min(1, { error: "At least one character is required. Whitespace is not permissible." }); var emptyStixListErrorMessage = "Empty lists are prohibited in STIX and MUST NOT be used as a substitute for omitting the property if it is optional. The list MUST be present and MUST have at least one value."; var stixListOfString = import_zod.z.array(nonEmptyRequiredString).min(1, { error: emptyStixListErrorMessage }); // src/schemas/common/property-schemas/stix-common-properties.ts var descriptionSchema = nonEmptyRequiredString.meta({ description: "A description of the object." }); var nameSchema = nonEmptyRequiredString.meta({ description: "The name of the object." }); var aliasesSchema = stixListOfString.meta({ description: "Alternative names used to identify this object. The first alias must match the object's name." }); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { aliasesSchema, descriptionSchema, nameSchema });