feat(foundry): support restricted subject aspects

This commit is contained in:
Codex
2026-07-24 09:31:34 +03:00
parent 03aa9e3e7e
commit 49f0c449c1
13 changed files with 313 additions and 15 deletions
+67
View File
@@ -132,6 +132,73 @@ test("subject details compose declared aspect bindings by stable source id", ()
assert.equal(card.tabs[0].sections[0].rows[0].value, "cargo_trike");
});
test("restricted joined aspects render declared identifiers and remain fail-closed otherwise", () => {
const profile = {
id: "map.subject-detail.restricted",
version: "1.0.0",
title: "Restricted",
semanticTypes: ["map.moving_object"],
defaultTabId: "contacts",
tabs: [{
id: "contacts",
label: "Контакты",
emptyMessage: "Нет данных",
sections: [{
id: "device",
label: "Контакты устройства",
fields: [
{
id: "contacts.phone",
aspectId: "unit_contacts",
source: "attribute",
field: "device_phone_primary",
label: "Телефон 1",
format: "text",
dataClass: "restricted",
},
{
id: "contacts.imei",
aspectId: "unit_contacts",
source: "attribute",
field: "device_imei",
label: "IMEI",
format: "text",
dataClass: "restricted",
},
],
}],
}],
};
const contactAspect = {
bindingId: "trike-unit-contacts",
dataProductId: "fleet.units.contacts.current.v1",
dataClass: "restricted",
fact: {
sourceId: fact.sourceId,
semanticType: "map.moving_object",
attributes: {
device_phone_primary: "+79991234567",
device_imei: "867236078012345",
},
},
};
const card = buildMapSubjectCardModel(fact, {
profile,
aspects: { unit_contacts: contactAspect },
});
assert.deepEqual(
card.tabs[0].sections[0].rows.map((row) => row.value),
["+79991234567", "867236078012345"],
);
const rejected = buildMapSubjectCardModel(fact, {
profile,
aspects: {
unit_contacts: { ...contactAspect, dataClass: "operational" },
},
});
assert.equal(rejected.tabs[0].empty, true);
});
test("Cesium pin and label share one entity selection that opens the subject card", async () => {
const [renderer, preview] = await Promise.all([
readFile(new URL("../apps/catalog/src/CesiumMapRenderer.tsx", import.meta.url), "utf8"),