feat(provider): publish full unit identity product

This commit is contained in:
Codex
2026-07-24 11:42:41 +03:00
parent 8cc917508e
commit abebb9fac6
13 changed files with 801 additions and 32 deletions
@@ -14,26 +14,26 @@ import {
validateL2ExecutionPlan,
} from "../src/index.mjs";
import {
geliosProviderPackageV10,
geliosTelemetryFieldRegistryV3,
} from "../providers/gelios/v10/index.mjs";
geliosProviderPackageV11,
geliosTelemetryFieldRegistryV4,
} from "../providers/gelios/v11/index.mjs";
const positionsConnection = instantiateL2Connection(geliosProviderPackageV10, {
const positionsConnection = instantiateL2Connection(geliosProviderPackageV11, {
tenantId: "tenant-compiler-fixture",
connectionId: "gelios-compiler-fixture",
collectionProfileId: "gelios.positions.current.realtime.v7",
providerCredentialRef: "ndc-credref:provider-compiler-fixture-0001",
});
const positionsPlan = compileL2ExecutionPlan(
geliosProviderPackageV10,
geliosProviderPackageV11,
positionsConnection,
{ telemetryFieldRegistry: geliosTelemetryFieldRegistryV3 },
{ telemetryFieldRegistry: geliosTelemetryFieldRegistryV4 },
);
assert.equal(positionsPlan.schemaVersion, L2_EXECUTION_PLAN_SCHEMA_VERSION);
assert.equal(L2_EXECUTION_PLAN_COMPILER_VERSION, "1.3.0");
assert.deepEqual(L2_EXECUTION_PLAN_SUPPORTED_COMPILER_VERSIONS, ["1.1.0", "1.2.0", "1.3.0"]);
assert.equal(positionsPlan.compilerVersion, "1.3.0");
assert.equal(L2_EXECUTION_PLAN_COMPILER_VERSION, "1.4.0");
assert.deepEqual(L2_EXECUTION_PLAN_SUPPORTED_COMPILER_VERSIONS, ["1.1.0", "1.2.0", "1.3.0", "1.4.0"]);
assert.equal(positionsPlan.compilerVersion, "1.4.0");
assert.deepEqual(validateL2ExecutionPlan(positionsPlan), { ok: true, errors: [] });
assert.match(positionsPlan.executionPlanDigest, /^sha256:[a-f0-9]{64}$/);
assert.match(positionsPlan.artifacts.packageDigest, /^sha256:[a-f0-9]{64}$/);
@@ -123,9 +123,9 @@ assert.equal(Object.isFrozen(positionsPlan.steps), true);
assert.equal(Object.isFrozen(positionsPlan.graphBlueprint), true);
const clonedPlan = compileL2ExecutionPlan(
structuredClone(geliosProviderPackageV10),
structuredClone(geliosProviderPackageV11),
structuredClone(positionsConnection),
{ telemetryFieldRegistry: structuredClone(geliosTelemetryFieldRegistryV3) },
{ telemetryFieldRegistry: structuredClone(geliosTelemetryFieldRegistryV4) },
);
assert.equal(clonedPlan.executionPlanDigest, positionsPlan.executionPlanDigest);
@@ -151,34 +151,34 @@ assert.equal(
);
assert.throws(
() => compileL2ExecutionPlan(geliosProviderPackageV10, positionsConnection),
() => compileL2ExecutionPlan(geliosProviderPackageV11, positionsConnection),
/telemetry_registry_required/,
);
const profileConnection = instantiateL2Connection(geliosProviderPackageV10, {
const profileConnection = instantiateL2Connection(geliosProviderPackageV11, {
tenantId: "tenant-compiler-fixture",
connectionId: "gelios-profile-compiler-fixture",
collectionProfileId: "gelios.units.profile.cold.v1",
providerCredentialRef: "ndc-credref:provider-compiler-fixture-0001",
});
const profilePlan = compileL2ExecutionPlan(geliosProviderPackageV10, profileConnection);
const profilePlan = compileL2ExecutionPlan(geliosProviderPackageV11, profileConnection);
assert.deepEqual(validateL2ExecutionPlan(profilePlan), { ok: true, errors: [] });
assert.equal(profilePlan.artifacts.telemetryRegistryDigest, undefined);
assert.notEqual(profilePlan.executionPlanDigest, positionsPlan.executionPlanDigest);
assert.deepEqual(profilePlan.graphBlueprint.runtime.mappingRuntime.derivationKinds, []);
for (const collectionProfile of geliosProviderPackageV10.collectionProfiles) {
const connection = instantiateL2Connection(geliosProviderPackageV10, {
for (const collectionProfile of geliosProviderPackageV11.collectionProfiles) {
const connection = instantiateL2Connection(geliosProviderPackageV11, {
tenantId: "tenant-all-profiles-fixture",
connectionId: `connection-${collectionProfile.id.replaceAll(".", "-")}`,
collectionProfileId: collectionProfile.id,
providerCredentialRef: "ndc-credref:provider-all-profiles-fixture",
});
const plan = compileL2ExecutionPlan(
geliosProviderPackageV10,
geliosProviderPackageV11,
connection,
collectionProfile.dataProductId === "fleet.positions.current.v5"
? { telemetryFieldRegistry: geliosTelemetryFieldRegistryV3 }
? { telemetryFieldRegistry: geliosTelemetryFieldRegistryV4 }
: {},
);
assert.deepEqual(validateL2ExecutionPlan(plan), { ok: true, errors: [] });
@@ -188,16 +188,16 @@ for (const collectionProfile of geliosProviderPackageV10.collectionProfiles) {
assert.equal(plan.graphBlueprint.edges.length, plan.steps.length + expectedEntrypoints - 2);
}
const secondConnection = instantiateL2Connection(geliosProviderPackageV10, {
const secondConnection = instantiateL2Connection(geliosProviderPackageV11, {
tenantId: "tenant-compiler-fixture",
connectionId: "gelios-compiler-fixture-two",
collectionProfileId: "gelios.positions.current.realtime.v7",
providerCredentialRef: "ndc-credref:provider-compiler-fixture-0002",
});
const secondPlan = compileL2ExecutionPlan(
geliosProviderPackageV10,
geliosProviderPackageV11,
secondConnection,
{ telemetryFieldRegistry: geliosTelemetryFieldRegistryV3 },
{ telemetryFieldRegistry: geliosTelemetryFieldRegistryV4 },
);
assert.notEqual(secondPlan.executionPlanDigest, positionsPlan.executionPlanDigest);
@@ -3,11 +3,13 @@ import { validateProviderCapabilityCatalog } from "../src/index.mjs";
import {
geliosCapabilityCatalogV1,
geliosCapabilityCatalogV2,
geliosCapabilityCatalogV3,
geliosProviderPackageV8,
} from "../providers/gelios/index.mjs";
assert.deepEqual(validateProviderCapabilityCatalog(geliosCapabilityCatalogV1), { ok: true, errors: [] });
assert.deepEqual(validateProviderCapabilityCatalog(geliosCapabilityCatalogV2), { ok: true, errors: [] });
assert.deepEqual(validateProviderCapabilityCatalog(geliosCapabilityCatalogV3), { ok: true, errors: [] });
const expectedUnitRoots = [
"activatedAt", "availableToUsers", "blockTime", "commands", "counters", "createdAt",
@@ -54,6 +56,16 @@ assert.equal(
geliosCapabilityCatalogV2.dataFamilies.find(({ id }) => id === "gelios.unit.sensor_definitions").status,
"planned",
);
for (const familyId of [
"gelios.unit.device_identifiers",
"gelios.unit.driver",
"gelios.unit.asset_identifiers",
"gelios.unit.custom_fields",
]) {
const family = geliosCapabilityCatalogV3.dataFamilies.find(({ id }) => id === familyId);
assert.equal(family.status, "implemented");
assert.equal(family.dataProductIds.includes("fleet.units.identity.current.v1"), true);
}
const restrictedPublish = structuredClone(geliosCapabilityCatalogV1);
restrictedPublish.dataFamilies.find(({ id }) => id === "gelios.unit.device_identifiers").disposition = "publish";
@@ -23,6 +23,7 @@ import { geliosProviderPackageV7 } from "../providers/gelios/v7/index.mjs";
import { geliosProviderPackageV8 } from "../providers/gelios/v8/index.mjs";
import { geliosProviderPackageV9 } from "../providers/gelios/v9/index.mjs";
import { geliosProviderPackageV10 } from "../providers/gelios/v10/index.mjs";
import { geliosProviderPackageV11 } from "../providers/gelios/v11/index.mjs";
import { normalizeDataProductDefinition } from "../../../services/external-data-plane/src/data-product-policy.mjs";
const expectedFields = [
@@ -51,10 +52,13 @@ assert.deepEqual(validateProviderPackage(geliosProviderPackageV7), { ok: true, e
assert.deepEqual(validateProviderPackage(geliosProviderPackageV8), { ok: true, errors: [] });
assert.deepEqual(validateProviderPackage(geliosProviderPackageV9), { ok: true, errors: [] });
assert.deepEqual(validateProviderPackage(geliosProviderPackageV10), { ok: true, errors: [] });
assert.deepEqual(validateProviderPackage(geliosProviderPackageV11), { ok: true, errors: [] });
assert.equal(geliosProviderPackageV9.id, "gelios.provider.v9");
assert.equal(geliosProviderPackageV9.version, "9.0.0");
assert.equal(geliosProviderPackageV10.id, "gelios.provider.v10");
assert.equal(geliosProviderPackageV10.version, "10.0.0");
assert.equal(geliosProviderPackageV11.id, "gelios.provider.v11");
assert.equal(geliosProviderPackageV11.version, "11.0.0");
assert.equal(geliosProviderPackageV8.id, "gelios.provider.v8");
const profileProduct = geliosProviderPackageV8.dataProducts.find((product) => product.id === "fleet.units.profile.current.v1");
@@ -97,6 +101,34 @@ assert.equal(contactsMapping.fact.attributes.device_phone_primary.guardPath, "ph
assert.equal(contactsMapping.fact.attributes.device_phone_secondary.guardPath, "phone2IsVisible");
assert.equal(contactsMapping.fact.attributes.provider_creator_login.paths[0], "creator.login");
const identityProduct = geliosProviderPackageV11.dataProducts.find(
(product) => product.id === "fleet.units.identity.current.v1",
);
const registeredIdentityProduct = JSON.parse(await readFile(new URL(
"../../../services/external-data-plane/definitions/fleet.units.identity.current.v1.json",
import.meta.url,
), "utf8"));
assert.deepEqual(identityProduct, registeredIdentityProduct);
assert.equal(identityProduct.fieldContracts.available_user_logins.type, "string_array");
assert.equal(identityProduct.fieldContracts.custom_fields.type, "string_array");
const identityCapability = geliosProviderPackageV11.capabilities.find(
(capability) => capability.id === "gelios.units.identity.read",
);
assert.deepEqual(identityCapability.request.query, {
inclextra: "true",
inclcstmflds: "true",
incldrvrs: "true",
inclusersav: "true",
});
const identityMapping = geliosProviderPackageV11.mappingContracts.find(
(mapping) => mapping.id === "gelios.units.to.fleet.units.identity.current.v1",
);
assert.equal(identityMapping.fact.attributes.device_imei.guardPath, undefined);
assert.equal(identityMapping.fact.attributes.device_phone_primary.guardPath, undefined);
assert.equal(identityMapping.fact.attributes.assigned_driver_name.paths[0], "driver.name");
assert.equal(identityMapping.derivations.available_user_logins.kind, "bounded_string_list");
assert.equal(identityMapping.derivations.custom_fields.kind, "bounded_named_values");
const incompleteGuard = structuredClone(geliosProviderPackageV10);
delete incompleteGuard.mappingContracts.at(-1).fact.attributes.device_imei.guardEquals;
assert.equal(