UNPKG

arvo-core

Version:

The core Arvo package which provides application tier core primitives and contract system for building production-grade event-driven application. Provides ArvoEvent (CloudEvents-compliant), ArvoContract for type-safe service interfaces, event factories, O

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;