ThingDomain.Present and Items; every constructor, factory and key builder passes each non-nullable reference parameter through Present (refusal names the slot, never a value) and each list through Items (a private read-only copy, nil items refused). Lists are IReadOnlyList on every type. TextInputNode's slot 2 property and parameter are InputKind, matching Rust input_kind. Tests: NilPositionTests reads the Rust vector row by row; PresenceTests and ReadOnlyListTests walk every door by reflection; InputKindNameTests. NameSetTests and the unit-arm rewrite follow. Unit-arm statics are still present in this commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
1.4 KiB
C#
25 lines
1.4 KiB
C#
using System.Globalization;
|
|
|
|
namespace GameCult.Thing.Contract;
|
|
|
|
/// <summary>
|
|
/// The key of each kind. Each key joins free-string provider or publisher ids (dotted, as the Verse names them)
|
|
/// with typed trailing parts: a segment holds no dot and a seq or version is digits, so a key splits at its last dot
|
|
/// (surface, asset catalog, result) or last two (composition), and two different field sets never build one key.
|
|
/// </summary>
|
|
public static class ThingKeys
|
|
{
|
|
public static string SurfaceKey(string providerId, string label) =>
|
|
$"thing:surface:{ThingDomain.Present(providerId, "ProviderId")}.{ThingDomain.Segment(label)}";
|
|
|
|
public static string CompositionKey(string publisher, string name, long version) =>
|
|
$"thing:composition:{ThingDomain.Present(publisher, "Publisher")}.{ThingDomain.Segment(name)}.v{ThingDomain.Version(version).ToString(CultureInfo.InvariantCulture)}";
|
|
|
|
public static string InvocationKey(string invocationId) => $"thing:invocation:{ThingDomain.Present(invocationId, "InvocationId")}";
|
|
|
|
public static string ResultKey(string invocationId, int seq) =>
|
|
$"thing:result:{ThingDomain.Present(invocationId, "InvocationId")}.{ThingDomain.Seq(seq).ToString(CultureInfo.InvariantCulture)}";
|
|
|
|
public static string AssetCatalogKey(string providerId, string catalogId) =>
|
|
$"thing:asset_catalog:{ThingDomain.Present(providerId, "ProviderId")}.{ThingDomain.Segment(catalogId)}";
|
|
}
|