Give Heimdall Odin documents unique catalog keys
This commit is contained in:
parent
1ba75b729a
commit
1086aee011
2 changed files with 24 additions and 9 deletions
|
|
@ -36,7 +36,22 @@ export async function publishHeimdallOdinState(
|
||||||
);
|
);
|
||||||
const publish = options.publish ?? publishRecord;
|
const publish = options.publish ?? publishRecord;
|
||||||
for (const record of buildHeimdallVerseRecords(config, pulse)) {
|
for (const record of buildHeimdallVerseRecords(config, pulse)) {
|
||||||
await publish(record, endpoint);
|
await publish({ ...record, key: odinCatalogKey(record) }, endpoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function odinCatalogKey(record: CultCacheRecord): string {
|
||||||
|
switch (record.schemaId) {
|
||||||
|
case "gamecult.eve.provider_advertisement.v1":
|
||||||
|
return "eve:provider:heimdall";
|
||||||
|
case "heimdall.command_boundary.v1":
|
||||||
|
return "heimdall:command-boundary";
|
||||||
|
case "gamecult.eve.plugin_advertisement.v1":
|
||||||
|
return "eve:plugin:gamecult.heimdall.access";
|
||||||
|
case "heimdall.transport_profile.v1":
|
||||||
|
return "heimdall:transport-profile";
|
||||||
|
default:
|
||||||
|
throw new Error(`Heimdall has no Odin catalog key for ${record.schemaId}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,10 @@ describe("Heimdall Odin publication", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(published.map((record) => [record.schemaId, record.key])).toEqual([
|
expect(published.map((record) => [record.schemaId, record.key])).toEqual([
|
||||||
["gamecult.eve.provider_advertisement.v1", "heimdall"],
|
["gamecult.eve.provider_advertisement.v1", "eve:provider:heimdall"],
|
||||||
["heimdall.command_boundary.v1", "heimdall"],
|
["heimdall.command_boundary.v1", "heimdall:command-boundary"],
|
||||||
["gamecult.eve.plugin_advertisement.v1", "gamecult.heimdall.access"],
|
["gamecult.eve.plugin_advertisement.v1", "eve:plugin:gamecult.heimdall.access"],
|
||||||
["heimdall.transport_profile.v1", "heimdall"],
|
["heimdall.transport_profile.v1", "heimdall:transport-profile"],
|
||||||
]);
|
]);
|
||||||
const serialized = JSON.stringify(published);
|
const serialized = JSON.stringify(published);
|
||||||
expect(serialized).not.toContain("must-never-publish");
|
expect(serialized).not.toContain("must-never-publish");
|
||||||
|
|
@ -85,10 +85,10 @@ describe("Heimdall Odin publication", () => {
|
||||||
environment: { CULTMESH_URI_ODIN_RUDP: `127.0.0.1:${server.bind.port}` },
|
environment: { CULTMESH_URI_ODIN_RUDP: `127.0.0.1:${server.bind.port}` },
|
||||||
});
|
});
|
||||||
expect([...received].sort()).toEqual([
|
expect([...received].sort()).toEqual([
|
||||||
"gamecult.eve.plugin_advertisement.v1:gamecult.heimdall.access",
|
"gamecult.eve.plugin_advertisement.v1:eve:plugin:gamecult.heimdall.access",
|
||||||
"gamecult.eve.provider_advertisement.v1:heimdall",
|
"gamecult.eve.provider_advertisement.v1:eve:provider:heimdall",
|
||||||
"heimdall.command_boundary.v1:heimdall",
|
"heimdall.command_boundary.v1:heimdall:command-boundary",
|
||||||
"heimdall.transport_profile.v1:heimdall",
|
"heimdall.transport_profile.v1:heimdall:transport-profile",
|
||||||
]);
|
]);
|
||||||
} finally {
|
} finally {
|
||||||
server.close();
|
server.close();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue