Register prepared glossary input identities
This commit is contained in:
@@ -13,10 +13,14 @@ import (
|
||||
const (
|
||||
SourceBoundsSession = "narratio.bounds.session"
|
||||
|
||||
SourceInputPlayers = "narratio.input.players"
|
||||
SourceInputParty = "narratio.input.party"
|
||||
SourceInputGlossary = "narratio.input.glossary"
|
||||
SourceInputSpellCatalog = "narratio.input.spell_catalog"
|
||||
SourceInputPlayers = "narratio.input.players"
|
||||
SourceInputParty = "narratio.input.party"
|
||||
SourceInputGlossary = "narratio.input.glossary"
|
||||
SourceInputGlossaryParty = "narratio.input.glossary.party"
|
||||
SourceInputGlossaryCampaign = "narratio.input.glossary.campaign"
|
||||
SourceInputGlossarySetting = "narratio.input.glossary.setting"
|
||||
SourceInputGlossarySpells = "narratio.input.glossary.spells"
|
||||
SourceInputSpellCatalog = "narratio.input.spell_catalog"
|
||||
|
||||
configuredSourcePrefix = "narratio.artifact."
|
||||
extractionSourcePrefix = "narratio.extraction."
|
||||
@@ -167,6 +171,9 @@ func DescribeScriptoriumInputSource(source string) (ScriptoriumInputSourceDescri
|
||||
if trimmed == "" {
|
||||
return ScriptoriumInputSourceDescriptor{}, ErrUnsupportedScriptoriumInputSource
|
||||
}
|
||||
if trimmed == SourceInputGlossary {
|
||||
return ScriptoriumInputSourceDescriptor{}, fmt.Errorf("%w: replace %s with an explicit narratio.input.glossary.<party|campaign|setting|spells> source", ErrUnsupportedScriptoriumInputSource, trimmed)
|
||||
}
|
||||
if prepared, ok := DescribePreparedInputSource(trimmed); ok {
|
||||
return ScriptoriumInputSourceDescriptor{
|
||||
Source: Source{ID: prepared.SourceID, Kind: SourceKindStableInput},
|
||||
@@ -205,11 +212,10 @@ var preparedInputSources = map[string]PreparedInputSourceDescriptor{
|
||||
ManifestKind: "party",
|
||||
Filename: "party.yml",
|
||||
},
|
||||
SourceInputGlossary: {
|
||||
SourceID: SourceInputGlossary,
|
||||
ManifestKind: "glossary",
|
||||
Filename: "glossary.yml",
|
||||
},
|
||||
SourceInputGlossaryParty: {SourceID: SourceInputGlossaryParty, ManifestKind: "glossary_party", Filename: "glossaries/party.yml"},
|
||||
SourceInputGlossaryCampaign: {SourceID: SourceInputGlossaryCampaign, ManifestKind: "glossary_campaign", Filename: "glossaries/campaign.yml"},
|
||||
SourceInputGlossarySetting: {SourceID: SourceInputGlossarySetting, ManifestKind: "glossary_setting", Filename: "glossaries/setting.yml"},
|
||||
SourceInputGlossarySpells: {SourceID: SourceInputGlossarySpells, ManifestKind: "glossary_spells", Filename: "glossaries/spells.yml"},
|
||||
SourceInputSpellCatalog: {
|
||||
SourceID: SourceInputSpellCatalog,
|
||||
ManifestKind: "spell_catalog",
|
||||
|
||||
@@ -169,7 +169,8 @@ func TestDescribeScriptoriumInputSource(t *testing.T) {
|
||||
{name: "built in markdown", source: "narratio.transcript.final_markdown", wantKind: SourceKindBuiltIn},
|
||||
{name: "prepared players input", source: "narratio.input.players", wantKind: SourceKindStableInput},
|
||||
{name: "prepared party input", source: "narratio.input.party", wantKind: SourceKindStableInput},
|
||||
{name: "prepared glossary input", source: "narratio.input.glossary", wantKind: SourceKindStableInput},
|
||||
{name: "prepared glossary input", source: SourceInputGlossaryCampaign, wantKind: SourceKindStableInput},
|
||||
{name: "retired glossary input", source: SourceInputGlossary, wantErr: ErrUnsupportedScriptoriumInputSource, wantErrLike: "replace"},
|
||||
{name: "prepared spell catalog input", source: "narratio.input.spell_catalog", wantKind: SourceKindStableInput},
|
||||
{name: "configured", source: "narratio.artifact.session_recap", wantKind: SourceKindConfiguredArtifact, wantKey: "session_recap"},
|
||||
{name: "previous", source: "narratio.previous_session.artifact.session_recap", wantKind: SourceKindPreviousArtifact, wantKey: "session_recap", wantPrev: true},
|
||||
@@ -220,7 +221,10 @@ func TestDescribePreparedInputSource(t *testing.T) {
|
||||
}{
|
||||
{source: SourceInputPlayers, manifestKind: "players", filename: "players.yml"},
|
||||
{source: SourceInputParty, manifestKind: "party", filename: "party.yml"},
|
||||
{source: SourceInputGlossary, manifestKind: "glossary", filename: "glossary.yml"},
|
||||
{source: SourceInputGlossaryParty, manifestKind: "glossary_party", filename: "glossaries/party.yml"},
|
||||
{source: SourceInputGlossaryCampaign, manifestKind: "glossary_campaign", filename: "glossaries/campaign.yml"},
|
||||
{source: SourceInputGlossarySetting, manifestKind: "glossary_setting", filename: "glossaries/setting.yml"},
|
||||
{source: SourceInputGlossarySpells, manifestKind: "glossary_spells", filename: "glossaries/spells.yml"},
|
||||
{source: SourceInputSpellCatalog, manifestKind: "spell_catalog", filename: "spell_catalog.json"},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user