TenantAtlas/apps/platform/.pnpm-store/v10/files/09/38191cf3930c0c904145576ed98115be68bb1819ddab430123b0da730caa4b7edec524f3451f51a38e13ed95573d82e6814ae745e7c50e0653bade3d98d575
ahmido 1fec9c6f9d
Some checks failed
Main Confidence / confidence (push) Failing after 45s
feat: compress governance operator outcomes (#253)
## 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
2026-04-19 12:30:36 +00:00

149 lines
4.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 bidiSerializer_exports = {};
__export(bidiSerializer_exports, {
BidiSerializer: () => BidiSerializer,
isDate: () => isDate,
isPlainObject: () => isPlainObject,
isRegExp: () => isRegExp
});
module.exports = __toCommonJS(bidiSerializer_exports);
/**
* @license
* Copyright 2024 Google Inc.
* Modifications copyright (c) Microsoft Corporation.
* SPDX-License-Identifier: Apache-2.0
*/
class UnserializableError extends Error {
}
class BidiSerializer {
static serialize(arg) {
switch (typeof arg) {
case "symbol":
case "function":
throw new UnserializableError(`Unable to serializable ${typeof arg}`);
case "object":
return BidiSerializer._serializeObject(arg);
case "undefined":
return {
type: "undefined"
};
case "number":
return BidiSerializer._serializeNumber(arg);
case "bigint":
return {
type: "bigint",
value: arg.toString()
};
case "string":
return {
type: "string",
value: arg
};
case "boolean":
return {
type: "boolean",
value: arg
};
}
}
static _serializeNumber(arg) {
let value;
if (Object.is(arg, -0)) {
value = "-0";
} else if (Object.is(arg, Infinity)) {
value = "Infinity";
} else if (Object.is(arg, -Infinity)) {
value = "-Infinity";
} else if (Object.is(arg, NaN)) {
value = "NaN";
} else {
value = arg;
}
return {
type: "number",
value
};
}
static _serializeObject(arg) {
if (arg === null) {
return {
type: "null"
};
} else if (Array.isArray(arg)) {
const parsedArray = arg.map((subArg) => {
return BidiSerializer.serialize(subArg);
});
return {
type: "array",
value: parsedArray
};
} else if (isPlainObject(arg)) {
try {
JSON.stringify(arg);
} catch (error) {
if (error instanceof TypeError && error.message.startsWith("Converting circular structure to JSON")) {
error.message += " Recursive objects are not allowed.";
}
throw error;
}
const parsedObject = [];
for (const key in arg) {
parsedObject.push([BidiSerializer.serialize(key), BidiSerializer.serialize(arg[key])]);
}
return {
type: "object",
value: parsedObject
};
} else if (isRegExp(arg)) {
return {
type: "regexp",
value: {
pattern: arg.source,
flags: arg.flags
}
};
} else if (isDate(arg)) {
return {
type: "date",
value: arg.toISOString()
};
}
throw new UnserializableError(
"Custom object serialization not possible. Use plain objects instead."
);
}
}
const isPlainObject = (obj) => {
return typeof obj === "object" && obj?.constructor === Object;
};
const isRegExp = (obj) => {
return typeof obj === "object" && obj?.constructor === RegExp;
};
const isDate = (obj) => {
return typeof obj === "object" && obj?.constructor === Date;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BidiSerializer,
isDate,
isPlainObject,
isRegExp
});