UNPKG

webcm

Version:

Demonstrative implementation of a web-based manager for utilising Managed Components

28 lines (27 loc) 1.02 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.mockManifest = exports.isManifest = exports.ManifestShape = void 0; const zod_1 = require("zod"); const path_1 = __importDefault(require("path")); exports.ManifestShape = zod_1.z.object({ name: zod_1.z.string(), description: zod_1.z.string(), allowCustomFields: zod_1.z.oboolean(), permissions: zod_1.z.record(zod_1.z.object({ description: zod_1.z.string(), required: zod_1.z.boolean() })), }); function isManifest(obj) { return exports.ManifestShape.safeParse(obj).success; } exports.isManifest = isManifest; function mockManifest(componentPath) { return { name: path_1.default.basename(componentPath), permissions: {}, description: 'Imported from ' + componentPath, allowCustomFields: false, }; } exports.mockManifest = mockManifest;