Some checks failed
Main Confidence / confidence (push) Failing after 45s
## Summary - introduce surface-aware compressed governance outcomes and reuse the shared truth/explanation seams for operator-first summaries - apply the compressed outcome hierarchy across baseline, evidence, review, review-pack, canonical review/evidence, and artifact-oriented operation-run surfaces - expand spec 214 fixtures and Pest coverage, and fix tenant-panel route assertions by generating explicit tenant-panel URLs in the affected Filament tests ## Validation - `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` - focused governance compression suite from `specs/214-governance-outcome-compression/quickstart.md` passed (`68` tests, `445` assertions) - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Filament/InventoryItemResourceTest.php tests/Feature/Filament/BackupSetUiEnforcementTest.php tests/Feature/Filament/RestoreRunUiEnforcementTest.php` passed (`18` tests, `81` assertions) Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #253
90 lines
3.0 KiB
Plaintext
90 lines
3.0 KiB
Plaintext
"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);
|
|
var jsonSchema_exports = {};
|
|
__export(jsonSchema_exports, {
|
|
validate: () => validate
|
|
});
|
|
module.exports = __toCommonJS(jsonSchema_exports);
|
|
const regexCache = /* @__PURE__ */ new Map();
|
|
function validate(value, schema, path) {
|
|
const errors = [];
|
|
if (schema.oneOf) {
|
|
let bestErrors;
|
|
for (const variant of schema.oneOf) {
|
|
const variantErrors = validate(value, variant, path);
|
|
if (variantErrors.length === 0)
|
|
return [];
|
|
if (!bestErrors || variantErrors.length < bestErrors.length)
|
|
bestErrors = variantErrors;
|
|
}
|
|
if (bestErrors.length === 1 && bestErrors[0].startsWith(`${path}: expected `))
|
|
return [`${path}: does not match any of the expected types`];
|
|
return bestErrors;
|
|
}
|
|
if (schema.type === "string") {
|
|
if (typeof value !== "string") {
|
|
errors.push(`${path}: expected string, got ${typeof value}`);
|
|
return errors;
|
|
}
|
|
if (schema.pattern && !cachedRegex(schema.pattern).test(value))
|
|
errors.push(schema.patternError || `${path}: must match pattern "${schema.pattern}"`);
|
|
return errors;
|
|
}
|
|
if (schema.type === "array") {
|
|
if (!Array.isArray(value)) {
|
|
errors.push(`${path}: expected array, got ${typeof value}`);
|
|
return errors;
|
|
}
|
|
if (schema.items) {
|
|
for (let i = 0; i < value.length; i++)
|
|
errors.push(...validate(value[i], schema.items, `${path}[${i}]`));
|
|
}
|
|
return errors;
|
|
}
|
|
if (schema.type === "object") {
|
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
errors.push(`${path}: expected object, got ${Array.isArray(value) ? "array" : typeof value}`);
|
|
return errors;
|
|
}
|
|
const obj = value;
|
|
for (const key of schema.required || []) {
|
|
if (obj[key] === void 0)
|
|
errors.push(`${path}.${key}: required`);
|
|
}
|
|
for (const [key, propSchema] of Object.entries(schema.properties || {})) {
|
|
if (obj[key] !== void 0)
|
|
errors.push(...validate(obj[key], propSchema, `${path}.${key}`));
|
|
}
|
|
return errors;
|
|
}
|
|
return errors;
|
|
}
|
|
function cachedRegex(pattern) {
|
|
let regex = regexCache.get(pattern);
|
|
if (!regex) {
|
|
regex = new RegExp(pattern);
|
|
regexCache.set(pattern, regex);
|
|
}
|
|
return regex;
|
|
}
|
|
// Annotate the CommonJS export names for ESM import in node:
|
|
0 && (module.exports = {
|
|
validate
|
|
});
|