UNPKG

wmod-proxy

Version:
65 lines (48 loc) 2.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.schemaScriptFile = exports.schemaManifestScript = exports.schemaManifestRuleActionScripts = exports.schemaManifestRuleActionResponse = exports.schemaManifestRuleActionClose = exports.schemaManifestRule = exports.schemaManifest = void 0; var _zod = require("zod"); var _httpMethodEnum = require("http-method-enum"); var schemaScriptFile = _zod.z.object({ path: _zod.z.string(), inject: _zod.z["boolean"]() }).strict(); exports.schemaScriptFile = schemaScriptFile; var schemaManifestScript = _zod.z.object({ name: _zod.z.string(), files: schemaScriptFile.array().nonempty() }).strict(); exports.schemaManifestScript = schemaManifestScript; var schemaManifestRuleActionResponse = _zod.z.object({ response: _zod.z.number() }).strict(); exports.schemaManifestRuleActionResponse = schemaManifestRuleActionResponse; var schemaManifestRuleActionScripts = _zod.z.object({ scripts: _zod.z.string().array().nonempty() }).strict(); exports.schemaManifestRuleActionScripts = schemaManifestRuleActionScripts; var schemaManifestRuleActionClose = _zod.z.object({ close: _zod.z["boolean"]() }).strict(); exports.schemaManifestRuleActionClose = schemaManifestRuleActionClose; var schemaManifestRule = _zod.z.object({ // TODO: should be one of three url: _zod.z.union([_zod.z.string(), _zod.z["instanceof"](RegExp)]).optional(), hostname: _zod.z.union([_zod.z.string(), _zod.z["instanceof"](RegExp)]).optional(), path: _zod.z.union([_zod.z.string(), _zod.z["instanceof"](RegExp)]).optional(), method: _zod.z.nativeEnum(_httpMethodEnum.HTTPMethod).optional(), action: _zod.z.union([schemaManifestRuleActionResponse, schemaManifestRuleActionScripts, schemaManifestRuleActionClose]) }).strict(); exports.schemaManifestRule = schemaManifestRule; var schemaManifest = _zod.z.object({ name: _zod.z.string(), version: _zod.z.string().optional(), description: _zod.z.string().optional(), homepage: _zod.z.string().optional(), scripts: schemaManifestScript.array().nonempty(), rules: _zod.z.array(schemaManifestRule).nonempty() }).strict(); exports.schemaManifest = schemaManifest; //# sourceMappingURL=manifest.schema.js.map