UNPKG

arvo-core

Version:

This core package contains all the core classes and components of the Arvo Event Driven System

24 lines (23 loc) 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isValidArvoSemanticVersion = exports.ArvoSemanticVersionSchema = exports.ArvoErrorSchema = void 0; var zod_1 = require("zod"); /** * Schema for Arvo error objects. * * This schema defines the structure of error objects used in the Arvo system. * It uses Zod for runtime type checking and validation. */ exports.ArvoErrorSchema = zod_1.z.object({ errorName: zod_1.z.string().describe('The name of the error.'), errorMessage: zod_1.z.string().describe('A descriptive message for the error.'), errorStack: zod_1.z.string().nullable().describe('The stack trace of the error.'), }); // Zod schema for ArvoSemanticVersion exports.ArvoSemanticVersionSchema = zod_1.z .string() .regex(/^\d+\.\d+\.\d+$/, 'Invalid version format of the semantic version') .describe('Semantic version of the Arvo component in the format X.Y.Z'); // Check is the provided version is a valid arvo semantic version var isValidArvoSemanticVersion = function (version) { return exports.ArvoSemanticVersionSchema.safeParse(version).success; }; exports.isValidArvoSemanticVersion = isValidArvoSemanticVersion;