feat(data-plane): add bounded Gelios telemetry contract
This commit is contained in:
@@ -65,6 +65,40 @@ assert.throws(
|
||||
}, definition),
|
||||
(error) => error?.status === 422 && error?.code === "data_product_field_type_invalid",
|
||||
);
|
||||
|
||||
const telemetryDefinition = normalizeDataProductDefinition({
|
||||
id: "test.telemetry.current.v1",
|
||||
version: "1.0.0",
|
||||
ontologyRevision: "ontology.test.telemetry.v1",
|
||||
deliveryMode: "snapshot+patch",
|
||||
semanticTypes: ["map.moving_object"],
|
||||
fields: ["sensor_readings"],
|
||||
fieldContracts: {
|
||||
sensor_readings: { type: "telemetry_readings", required: false },
|
||||
},
|
||||
history: { mode: "none", retentionDays: 1 },
|
||||
});
|
||||
const validReadings = [{
|
||||
id: "battery.voltage",
|
||||
label: "Battery voltage",
|
||||
value: 51.7,
|
||||
unit: "V",
|
||||
observedAt: "2026-07-22T08:00:00.000Z",
|
||||
}];
|
||||
assert.doesNotThrow(() => assertPublishMatchesDefinition({ facts: [{
|
||||
sourceId: "unit-telemetry",
|
||||
semanticType: "map.moving_object",
|
||||
observedAt: "2026-07-22T08:00:00.000Z",
|
||||
attributes: { sensor_readings: validReadings },
|
||||
}] }, telemetryDefinition));
|
||||
assert.throws(
|
||||
() => assertPublishMatchesDefinition({ facts: [{
|
||||
sourceId: "unit-telemetry",
|
||||
semanticType: "map.moving_object",
|
||||
attributes: { sensor_readings: [{ ...validReadings[0], value: { raw: 51.7 } }] },
|
||||
}] }, telemetryDefinition),
|
||||
(error) => error?.status === 422 && error?.code === "data_product_field_type_invalid",
|
||||
);
|
||||
assert.throws(
|
||||
() => assertPublishMatchesDefinition({
|
||||
facts: [{ ...fact, attributes: { ...fact.attributes, speed_kph: -1 } }],
|
||||
|
||||
Reference in New Issue
Block a user