feat(provider): version gelios items response envelope
This commit is contained in:
@@ -6,3 +6,4 @@ export * from "./v8/index.mjs";
|
||||
export * from "./v9/index.mjs";
|
||||
export { geliosProviderPackageV10 } from "./v10/index.mjs";
|
||||
export { geliosProviderPackageV11 } from "./v11/index.mjs";
|
||||
export { geliosProviderPackageV12 } from "./v12/index.mjs";
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
export {
|
||||
GELIOS_PROVIDER_PACKAGE_ID,
|
||||
GELIOS_PROVIDER_PACKAGE_VERSION,
|
||||
GELIOS_UNIT_IDENTITY_DATA_PRODUCT_ID,
|
||||
GELIOS_UNIT_IDENTITY_DATA_PRODUCT_VERSION,
|
||||
GELIOS_UNIT_IDENTITY_ONTOLOGY_REVISION,
|
||||
geliosProviderPackageV12,
|
||||
} from "./package.mjs";
|
||||
export { geliosTelemetryFieldRegistryV5 } from "./telemetry-field-registry.mjs";
|
||||
export { geliosCapabilityCatalogV3 } from "../capability-catalog-v3.mjs";
|
||||
@@ -0,0 +1,59 @@
|
||||
import { geliosProviderPackageV11 } from "../v11/package.mjs";
|
||||
|
||||
export const GELIOS_PROVIDER_PACKAGE_ID = "gelios.provider.v12";
|
||||
export const GELIOS_PROVIDER_PACKAGE_VERSION = "12.0.0";
|
||||
export const GELIOS_UNIT_IDENTITY_DATA_PRODUCT_ID = "fleet.units.identity.current.v1";
|
||||
export const GELIOS_UNIT_IDENTITY_DATA_PRODUCT_VERSION = "1.0.0";
|
||||
export const GELIOS_UNIT_IDENTITY_ONTOLOGY_REVISION = "ontology.map.moving_object.v3";
|
||||
|
||||
const IDENTITY_CAPABILITY_ID = "gelios.units.identity.read";
|
||||
const IDENTITY_PROFILE_ID = "gelios.units.identity.warm.v1";
|
||||
const IDENTITY_MAPPING_ID = "gelios.units.to.fleet.units.identity.current.v1";
|
||||
const IDENTITY_TEMPLATE_ID = "gelios.units.identity.l2.v1";
|
||||
|
||||
const value = structuredClone(geliosProviderPackageV11);
|
||||
value.id = GELIOS_PROVIDER_PACKAGE_ID;
|
||||
value.version = GELIOS_PROVIDER_PACKAGE_VERSION;
|
||||
value.manifest = {
|
||||
...value.manifest,
|
||||
id: "gelios.provider.manifest.v12",
|
||||
version: GELIOS_PROVIDER_PACKAGE_VERSION,
|
||||
};
|
||||
|
||||
const identityCapability = value.capabilities.find(
|
||||
(capability) => capability.id === IDENTITY_CAPABILITY_ID,
|
||||
);
|
||||
if (!identityCapability) throw new Error("gelios_v12_identity_capability_missing");
|
||||
identityCapability.request.response.collectionPaths = [
|
||||
"items",
|
||||
...identityCapability.request.response.collectionPaths.filter(
|
||||
(path) => path !== "items",
|
||||
),
|
||||
];
|
||||
|
||||
const identityProfile = value.collectionProfiles.find(
|
||||
(profile) => profile.id === IDENTITY_PROFILE_ID,
|
||||
);
|
||||
if (!identityProfile) throw new Error("gelios_v12_identity_profile_missing");
|
||||
identityProfile.version = GELIOS_PROVIDER_PACKAGE_VERSION;
|
||||
|
||||
const identityMapping = value.mappingContracts.find(
|
||||
(mapping) => mapping.id === IDENTITY_MAPPING_ID,
|
||||
);
|
||||
if (!identityMapping) throw new Error("gelios_v12_identity_mapping_missing");
|
||||
identityMapping.version = GELIOS_PROVIDER_PACKAGE_VERSION;
|
||||
|
||||
const identityTemplate = value.l2Templates.find(
|
||||
(template) => template.id === IDENTITY_TEMPLATE_ID,
|
||||
);
|
||||
if (!identityTemplate) throw new Error("gelios_v12_identity_template_missing");
|
||||
identityTemplate.version = GELIOS_PROVIDER_PACKAGE_VERSION;
|
||||
|
||||
export const geliosProviderPackageV12 = deepFreeze(value);
|
||||
|
||||
function deepFreeze(input) {
|
||||
if (!input || typeof input !== "object" || Object.isFrozen(input)) return input;
|
||||
Object.freeze(input);
|
||||
for (const child of Object.values(input)) deepFreeze(child);
|
||||
return input;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { geliosTelemetryFieldRegistryV4 } from "../v11/telemetry-field-registry.mjs";
|
||||
import {
|
||||
GELIOS_PROVIDER_PACKAGE_ID,
|
||||
GELIOS_PROVIDER_PACKAGE_VERSION,
|
||||
} from "./package.mjs";
|
||||
|
||||
const value = structuredClone(geliosTelemetryFieldRegistryV4);
|
||||
value.providerPackage = {
|
||||
id: GELIOS_PROVIDER_PACKAGE_ID,
|
||||
version: GELIOS_PROVIDER_PACKAGE_VERSION,
|
||||
};
|
||||
|
||||
export const geliosTelemetryFieldRegistryV5 = deepFreeze(value);
|
||||
|
||||
function deepFreeze(input) {
|
||||
if (!input || typeof input !== "object" || Object.isFrozen(input)) return input;
|
||||
Object.freeze(input);
|
||||
for (const child of Object.values(input)) deepFreeze(child);
|
||||
return input;
|
||||
}
|
||||
@@ -24,6 +24,7 @@ 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 { geliosProviderPackageV12 } from "../providers/gelios/v12/index.mjs";
|
||||
import { normalizeDataProductDefinition } from "../../../services/external-data-plane/src/data-product-policy.mjs";
|
||||
|
||||
const expectedFields = [
|
||||
@@ -53,12 +54,15 @@ assert.deepEqual(validateProviderPackage(geliosProviderPackageV8), { ok: true, e
|
||||
assert.deepEqual(validateProviderPackage(geliosProviderPackageV9), { ok: true, errors: [] });
|
||||
assert.deepEqual(validateProviderPackage(geliosProviderPackageV10), { ok: true, errors: [] });
|
||||
assert.deepEqual(validateProviderPackage(geliosProviderPackageV11), { ok: true, errors: [] });
|
||||
assert.deepEqual(validateProviderPackage(geliosProviderPackageV12), { 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(geliosProviderPackageV12.id, "gelios.provider.v12");
|
||||
assert.equal(geliosProviderPackageV12.version, "12.0.0");
|
||||
assert.equal(geliosProviderPackageV8.id, "gelios.provider.v8");
|
||||
|
||||
const profileProduct = geliosProviderPackageV8.dataProducts.find((product) => product.id === "fleet.units.profile.current.v1");
|
||||
@@ -120,6 +124,16 @@ assert.deepEqual(identityCapability.request.query, {
|
||||
incldrvrs: "true",
|
||||
inclusersav: "true",
|
||||
});
|
||||
const identityCapabilityV12 = geliosProviderPackageV12.capabilities.find(
|
||||
(capability) => capability.id === "gelios.units.identity.read",
|
||||
);
|
||||
assert.equal(identityCapability.request.response.collectionPaths.includes("items"), false);
|
||||
assert.deepEqual(identityCapabilityV12.request.response.collectionPaths, [
|
||||
"items",
|
||||
...identityCapability.request.response.collectionPaths,
|
||||
]);
|
||||
assert.equal(Object.isFrozen(geliosProviderPackageV12), true);
|
||||
assert.equal(Object.isFrozen(identityCapabilityV12.request.response.collectionPaths), true);
|
||||
const identityMapping = geliosProviderPackageV11.mappingContracts.find(
|
||||
(mapping) => mapping.id === "gelios.units.to.fleet.units.identity.current.v1",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user