@wildshard/sdk 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GUIDE.md +64 -9
- package/codemods/0.2.5.mjs +12 -0
- package/lint/ratchet.json +1 -9
- package/lint/sdk-plugin.mjs +24 -2
- package/package.json +4 -3
- package/scripts/gen-format-schema.mjs +1 -1
- package/scripts/wildshard.mjs +8 -2
- package/skills/wildshard-upgrade/SKILL.md +15 -23
- package/src/cli/help.ts +6 -3
- package/src/sharddev/agentFiles.ts +1 -1
- package/src/sharddev/author.ts +16 -3
- package/src/sharddev/bake/authoredWorld.ts +1 -1
- package/src/sharddev/bake/specimenCatalogue.ts +1 -1
- package/src/sharddev/bake/staticMaterials.ts +1 -1
- package/src/sharddev/checkProject.ts +1 -1
- package/src/sharddev/cli.ts +11 -7
- package/src/sharddev/formatJsonSchema.ts +1117 -3
- package/src/sharddev/kit/bakedGeometry.ts +58 -12
- package/src/sharddev/nativePopulationRows.ts +1 -1
- package/src/sharddev/performancePolicy.ts +1 -1
- package/src/sharddev/phasedBoss.ts +212 -34
- package/src/sharddev/project.ts +1 -1
- package/src/sharddev/projectEntryProof.ts +1 -1
- package/src/sharddev/projectGeneration.ts +1 -1
- package/src/sharddev/projectOutput.ts +1 -1
- package/src/sharddev/projectSections.ts +1 -1
- package/src/sharddev/refusals.ts +9 -5
- package/src/sharddev/reportCard.ts +1 -1
- package/src/sharddev/sections.ts +1 -1
- package/src/sharddev/species/clips.ts +64 -24
- package/src/sharddev/speciesBrains.ts +98 -15
- package/src/sharddev/updatePins.ts +254 -0
- package/src/sharddev/weapons/bowProfile.ts +3 -3
- package/src/sharddev/weapons/meleeProfile.ts +48 -4
- package/src/sharddev/worldScenes.ts +1 -1
- package/tsconfig.author.json +1 -0
|
@@ -1,3 +1,1117 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
|
|
1
|
+
// Format JSON Schema and named-row helpers: the SDK turns shard-format's valibot schemas into JSON Schema and admits
|
|
2
|
+
// author rows against them (SHARD-AUTHORING SA26). It was engine's host/formatJsonSchema, which no engine module
|
|
3
|
+
// imports; the SDK owns it now, built on shard-format and valibot alone.
|
|
4
|
+
// oxlint-disable unicorn/prefer-string-raw -- Its patterns are schema bytes, kept as sharddev wrote them.
|
|
5
|
+
import { SpeciesActorsFileSchema as SpeciesActorsDocumentSchema } from '@wildshard/format/speciesActorsFile';
|
|
6
|
+
import { QuestRuntimeDocumentSchema } from '@wildshard/format/questRuntime';
|
|
7
|
+
import { QuestStoryBindingsSchema } from '@wildshard/format/questStoryBindings';
|
|
8
|
+
import { QuestInteractionSourceSchema } from '@wildshard/format/questInteractionSource';
|
|
9
|
+
import { uniformIdentityTransforms } from '@wildshard/format/uniformRows';
|
|
10
|
+
import { HeldCueSchema, ArcWeaponItemSchema } from '@wildshard/format/heldMelee';
|
|
11
|
+
import { HeldJianDocumentSchema } from '@wildshard/format/heldJianDocument';
|
|
12
|
+
import { BladeDocumentSchema, PolearmDocumentSchema, HeldSlotsDocumentSchema } from '@wildshard/format/heldWeaponDocuments';
|
|
13
|
+
import { WaterWorldSchema } from '@wildshard/format/waterWorld';
|
|
14
|
+
import { ForestNativeInputsSchema } from '@wildshard/format/forestNativeInputs';
|
|
15
|
+
import { FindsCatalogueSchema } from '@wildshard/format/findsCatalogue';
|
|
16
|
+
import { WildlifePopulationSchema } from '@wildshard/format/wildlifePopulation';
|
|
17
|
+
import { ArenaRoomDocumentSchema, ArenaRoomDocumentRowsSchema, ArenaKingRowsSchema } from '@wildshard/format/arenaRoomDocument';
|
|
18
|
+
import { ReturnProgramDocumentSchema, ReturnProgramWireDocumentSchema } from '@wildshard/format/returnProgramDocument';
|
|
19
|
+
import { WeatherBundleSchema, WeatherDocumentSchema } from '@wildshard/format/weatherBundle';
|
|
20
|
+
import { WeatherEffectsSchema, WeatherGeometrySchema, WeatherGeometryDataSchema } from '@wildshard/format/weatherEffects';
|
|
21
|
+
import { RainPresentationSchema } from '@wildshard/format/rainPresentation';
|
|
22
|
+
import { ForestWeatherObservationSchema, RangedPageSchema } from '@wildshard/format/rangedPage';
|
|
23
|
+
import { PostGraphLookSchema, ScaledPostInputSchema, postGraphIdentityTransforms } from '@wildshard/format/postGraphLook';
|
|
24
|
+
import { PaintedAirSchema, PaintedGroundSchema, PaintedPanoramaSchema, PainterKeyLightSchema, PainterlyWorldSchema } from '@wildshard/format/paintedResources';
|
|
25
|
+
import { WorldScenePageSchema } from '@wildshard/format/worldScenePages';
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
import { SceneModelSourceSchema, SceneBakeSourceSchema } from '@wildshard/format/sceneSources';
|
|
29
|
+
import { PopulationFieldSchema, PopulationHabitatSchema } from '@wildshard/format/populationEnvironment';
|
|
30
|
+
import { FixedDrawRowsSchema } from '@wildshard/format/fixedDraws';
|
|
31
|
+
import { AudioSceneSchema } from '@wildshard/format/audioScene';
|
|
32
|
+
import { ForestGroundLayoutSchema, ForestPageSchema, LivingPageSitesSchema } from '@wildshard/format/forestPage';
|
|
33
|
+
import { CaveFileSchema, CaveInteriorSchema } from '@wildshard/format/caveInterior';
|
|
34
|
+
import { SceneBuffersSchema } from '@wildshard/format/sceneBuffers';
|
|
35
|
+
import { BakedPlacementPlanSchema, BakedTilesSchema } from '@wildshard/format/bakedTiles';
|
|
36
|
+
import { ClientRidingSessionSchema } from '@wildshard/format/riding';
|
|
37
|
+
import { ManifestMetadataSchema } from '@wildshard/format/minimap';
|
|
38
|
+
import { AdventurePersistenceSchema, HEADLESS_ASSEMBLY_JSON_SCHEMA, ReturnProgramSchema, PageReturnRowsSchema, QuestTraderSchema, PosedLibrarySchema } from '@wildshard/format/namedJsonContracts';
|
|
39
|
+
import {NativeQuestCompositionSchema,NativeQuestServiceSpotsSchema} from '@wildshard/format/nativeQuestComposition';
|
|
40
|
+
import { MixedPopulationSchema, PerchBodyFileSchema } from '@wildshard/format/mixedPopulation';
|
|
41
|
+
import { ResolvedIslandLibrarySchema, FixedGeometryGroupsSchema } from '@wildshard/format/islandLibrary';
|
|
42
|
+
import { CollectionDisplaysSchema } from '@wildshard/format/collectionDisplay';
|
|
43
|
+
import { SpecimenCatalogueSchema, PackedSpecimenSchema, SpecimenMaterialSchema, SpecimenAssetSchema, SpecimenBookSchema } from '@wildshard/format/specimenCatalogue';
|
|
44
|
+
import { BinarySourceSchema } from '@wildshard/format/binarySource';
|
|
45
|
+
import { NativeGroundFileSchema, nativeBodySchema, nativeColliderRecordSchema, nativeGroundRecordSchema, type NativeColliderRecord, type NativeArrayStorage } from '@wildshard/format/nativePhysics';
|
|
46
|
+
import { WorldAssemblySchema } from '@wildshard/format/worldAssembly';
|
|
47
|
+
import { ReturnModulesSchema } from '@wildshard/format/scriptContract';
|
|
48
|
+
import { BowVariantSchema } from '@wildshard/format/bowVariantRows';
|
|
49
|
+
import { ReturnProjectionV2Schema } from '@wildshard/format/returnProjectionV2';
|
|
50
|
+
import { ScalarChannelSchema,ScalarLatticeSchema,ScalarTripletSchema } from '@wildshard/format/scalarChannel';
|
|
51
|
+
import { RuntimeBoundsSchema } from '@wildshard/format/clientPlan';
|
|
52
|
+
import { WorldUpdatesSchema } from '@wildshard/format/worldUpdates';
|
|
53
|
+
import { StreamedCoverSchema, CoverCompositionSchema } from '@wildshard/format/streamedCover';
|
|
54
|
+
import { MountedSpecimenSeatSchema } from '@wildshard/format/mountedSpecimenRows';
|
|
55
|
+
import { SpeciesActorsFileSchema, SpeciesLookBookSchema, CreatureGuestSchema } from '@wildshard/format/speciesBookRows';
|
|
56
|
+
import { PaintedLookSchema } from '@wildshard/format/paintedLook';
|
|
57
|
+
import { MaterialsSchema } from '@wildshard/format/materials';
|
|
58
|
+
import { ArenaScriptFightFileSchema,ArenaScriptGeometrySchema } from '@wildshard/format/arenaScriptRows';
|
|
59
|
+
import { TimedEncountersSchema, CloudSpecimenSchema, CloudBodySchema } from '@wildshard/format/encounterRows';
|
|
60
|
+
import { RoamingCombatSchema } from '@wildshard/format/roamingCombat';
|
|
61
|
+
import { PopulationProjectionSchema, EnemyPlacementsSchema } from '@wildshard/format/populationProjection';
|
|
62
|
+
import { CreatureInstallSchema, PackedCreatureLooksSchema } from '@wildshard/format/speciesLooks';
|
|
63
|
+
import { SceneScatterPageSchema, SceneDressingSchema, SceneBakedGeometrySchema, SceneFloorSchema, SceneDressingContactsSchema } from '@wildshard/format/sceneDressing';
|
|
64
|
+
import { CueDirectorWireSchema } from '@wildshard/format/cueDirector';
|
|
65
|
+
import { ExchangeSchema } from '@wildshard/format/exchange';
|
|
66
|
+
import { LootBagSchema } from '@wildshard/format/lootBag';
|
|
67
|
+
import { CatalogueEconomySchema } from '@wildshard/format/catalogueEconomy';
|
|
68
|
+
import { ClaimedPickupSchema } from '@wildshard/format/lootEconomy';
|
|
69
|
+
import { ContractCatalogueSchema, ContractBoardPageSchema } from '@wildshard/format/contracts';
|
|
70
|
+
import { AchievementCounterDataSchema } from '@wildshard/format/achievementCounters';
|
|
71
|
+
import { PopulationShelterSchema } from '@wildshard/format/herdShelter';
|
|
72
|
+
import { PanelDefinitionSchema,QuestPanelCatalogueSchema } from '@wildshard/format/panelTemplate';
|
|
73
|
+
import { HeldFinishesSchema } from '@wildshard/format/heldFinishes';
|
|
74
|
+
import { FigureCatalogueSchema, FigureGroupSchema } from '@wildshard/format/figures';
|
|
75
|
+
import { QuestStorySchema, ChapterStoryPresentationSchema, AdventureContentSchema } from '@wildshard/format/questStory';
|
|
76
|
+
import { WeatherProgramSchema, WeatherHitTagSchema } from '@wildshard/format/weatherProgram';
|
|
77
|
+
import { ForestWeatherSchema } from '@wildshard/format/forestWeather';
|
|
78
|
+
import { NativePopulationRowsSchema, TamingPoseFileSchema } from '@wildshard/format/populationRoster';
|
|
79
|
+
import { ChapterDirectorSchema, ChapterWakeSchema } from '@wildshard/format/chapterDirector';
|
|
80
|
+
import { EliteFeatureSchema } from '@wildshard/format/eliteFeature';
|
|
81
|
+
import { CoverAppearanceSchema } from '@wildshard/format/coverAppearance';
|
|
82
|
+
import { PageLifeSchema } from '@wildshard/format/pageLife';
|
|
83
|
+
import { InputActionSchema, InputKeysSchema } from '@wildshard/format/inputDeclarations';
|
|
84
|
+
import { BodySlotsSchema } from '@wildshard/format/bodySlots';
|
|
85
|
+
import { LimbRigSchema, LimbBlendSchema, BakedClipTable } from '@wildshard/format/limbRig';
|
|
86
|
+
import { LimbCollisionBake } from '@wildshard/format/limbCollision';
|
|
87
|
+
import { ToonArmsLookSchema, HeldArmsSchema, HeldGraphCardsSchema } from '@wildshard/format/heldArms';
|
|
88
|
+
import { GraphArmsSchema } from '@wildshard/format/graphArmsRows';
|
|
89
|
+
import { PracticeSceneSchema,RidingPracticeSchema,PracticeControllerSchema, FixedPracticeFileSchema } from '@wildshard/format/practiceCourseRows';
|
|
90
|
+
import { RoamingEncounterSchema, WakeEncounterSchema, BossEncounterPresentationSchema, NativeBossBindingSchema } from '@wildshard/format/bossEncounter';
|
|
91
|
+
import { BossProfileSchema, ArenaBossProfileSchema, RoamingBossProfileSchema, SpawnedBossProfileSchema, HeldBossProfileSchema, ScriptBossProfileSchema } from '@wildshard/format/bossProfiles';
|
|
92
|
+
import { NpcRowSchema, NpcMotionSchema, NpcDialogueRowSchema, QuestNpcBindingSchema, QuestNpcBindingsSchema, QuestPageTalksSchema } from '@wildshard/format/npcs';
|
|
93
|
+
import { WeaponProfileSchema, MeleeWeaponProfileSchema, BowWeaponProfileSchema, FirearmWeaponProfileSchema, ThrownWeaponProfileSchema, LashWeaponProfileSchema, ConeWeaponProfileSchema, HeldBowBaseSchema, HeldBowRowsSchema, HeldBowDefinitionSchema, HeldBowFileSchema, HeldFirearmPageSchema } from '@wildshard/format/weaponProfiles';
|
|
94
|
+
import { toJsonSchema, type JsonSchema } from '@valibot/to-json-schema';
|
|
95
|
+
import { finite, strictObject, object, looseObject, tuple, tupleWithRest, optional, array, literal as literalSchema, parse, safeParse as sourceSafeParse, pipe, check as sourceCheck, number, string, boolean, unknown, null as nullSchema, integer, minValue, maxValue, minLength, maxLength, startsWith, length, picklist, record, nullable, exactOptional, safeInteger, regex as sourceRegex, maxEntries, union, variant, assert, is as sourceIs, type VariantOptions, type SafeParseResult, type GenericSchema, type InferInput, type InferOutput } from 'valibot';
|
|
96
|
+
import { PopulationKeeperRowsSchema } from '@wildshard/format/populationKeeper';
|
|
97
|
+
import { EdgeProfileSchema, EdgeProfilesSchema } from '@wildshard/format/edgeProfiles';
|
|
98
|
+
import { PlumbingSchema } from '@wildshard/format/plumbing';
|
|
99
|
+
import { StateSchema } from '@wildshard/format/state';
|
|
100
|
+
import {QuestStepRowsSchema,QuestServiceActionsSchema,QuestKillRowsSchema,QuestHintRowsSchema,CarriedQuestSchema} from '@wildshard/format/questSteps';
|
|
101
|
+
import { SpeciesSchema } from '@wildshard/format/speciesPrograms';
|
|
102
|
+
import { BuildingLifeDocumentSchema, BakedBuildingLookSchema, BuildingLifeLookSchema, BuildingLifeRowsSchema, BuildingCloudPoseSchema } from '@wildshard/format/buildings';
|
|
103
|
+
import { WorldSceneWeldSchema, WorldSceneWeldNodeSchema } from '@wildshard/format/worldSceneWeld';
|
|
104
|
+
import { WorldSceneModelsSchema } from '@wildshard/format/worldSceneModels';
|
|
105
|
+
import { WorldScenePlacementSchema, WorldScenePlacementPageSchema } from '@wildshard/format/worldScenePlacement';
|
|
106
|
+
import { CommonsCostsSchema } from '@wildshard/format/commonsCosts';
|
|
107
|
+
import { SHARDFILE_ADMISSION_LIMITS } from '@wildshard/format/admissionLimits';
|
|
108
|
+
import { registeredJsonContract,type RegisteredSchemaJsonName } from '@wildshard/format/registeredJson';
|
|
109
|
+
|
|
110
|
+
import { StalkerSchema, GuardianPatternsSchema, SkirmisherSchema, ScriptBrainSchema, GuardianSchema, PerchHunterSchema } from '@wildshard/format/brains';
|
|
111
|
+
import { DiverSchema, OrbitDiverSchema, PatrolDiverSchema, BurstFlyerSchema } from '@wildshard/format/flyers';
|
|
112
|
+
import { RamGrazerSchema, ChallengeGrazerSchema, GrazerSchema } from '@wildshard/format/grazers';
|
|
113
|
+
import { GroupBrainSchema } from '@wildshard/format/groupBrains';
|
|
114
|
+
import { CreaturesSchema, CreatureHomeSchema, CreatureStrikeSchema } from '@wildshard/format/creatures';
|
|
115
|
+
import { FlockSchema } from '@wildshard/format/crowds';
|
|
116
|
+
import { EncountersSchema } from '@wildshard/format/encounters';
|
|
117
|
+
import { AudioMusicSchema, AudioSamplesSchema, AudioZonesSchema } from '@wildshard/format/audioProfiles';
|
|
118
|
+
import { AudioRoutingSchema } from '@wildshard/format/audioRouting';
|
|
119
|
+
import { AudioDataSchema } from '@wildshard/format/audio';
|
|
120
|
+
import { LedgerFactSchema, LedgerRulesSchema } from '@wildshard/format/ledger';
|
|
121
|
+
import { DirectorSchema } from '@wildshard/format/director';
|
|
122
|
+
import { DirectorProductSchema } from '@wildshard/format/directorProduct';
|
|
123
|
+
import { DirectorStagesSchema } from '@wildshard/format/directorStages';
|
|
124
|
+
import { LogicalStateSchema, MigrationsSchema } from '@wildshard/format/migrations';
|
|
125
|
+
import { TraversalSchema } from '@wildshard/format/traversal';
|
|
126
|
+
import { RuntimeBindsSchema } from '@wildshard/format/runtimeBinds';
|
|
127
|
+
import { RuntimeSpawnsSchema } from '@wildshard/format/runtimeSpawns';
|
|
128
|
+
import { SkinPoseLayerSchema } from '@wildshard/format/skinLayers';
|
|
129
|
+
import { PresentationSchema } from '@wildshard/format/presentation';
|
|
130
|
+
import { MeshCollisionSchema } from '@wildshard/format/meshCollision';
|
|
131
|
+
import { ScriptBindingsSchema } from '@wildshard/format/scripts';
|
|
132
|
+
import { ActorMovesSchema } from '@wildshard/format/actorMoves';
|
|
133
|
+
import { DecisionScriptsSchema } from '@wildshard/format/decisionScripts';
|
|
134
|
+
import { HooksSchema } from '@wildshard/format/hooks';
|
|
135
|
+
import { TerrainSchema,ForestRowsSchema,GroundRowsSchema } from '@wildshard/format/terrain';
|
|
136
|
+
import { WaterSchema } from '@wildshard/format/water';
|
|
137
|
+
import { AccentSchema, ACCENT_IDS } from '@wildshard/format/accent';
|
|
138
|
+
import { ItemsSchema, ItemFamilyNameSchema } from '@wildshard/format/items';
|
|
139
|
+
import { TargetsSchema } from '@wildshard/format/targets';
|
|
140
|
+
import { QuestDataSchema } from '@wildshard/format/quests';
|
|
141
|
+
import { QuestGraphSchema } from '@wildshard/format/questGraph';
|
|
142
|
+
import { InteractionRowsSchema, QuestPageInteractionsSchema } from '@wildshard/format/questInteractions';
|
|
143
|
+
import { QuestPageSchema, QuestPageCompositionSchema, ChapterViewSchema } from '@wildshard/format/questPageComposition';
|
|
144
|
+
import { QuestContinuationSchema } from '@wildshard/format/questContinuation';
|
|
145
|
+
import { QuestWorldSchema } from '@wildshard/format/questWorld';
|
|
146
|
+
import { QuestFiguresSchema, KitFigureCardsSchema } from '@wildshard/format/questFigures';
|
|
147
|
+
import { QuestHostSchema } from '@wildshard/format/questHost';
|
|
148
|
+
|
|
149
|
+
import { RowsSchema } from '@wildshard/format/rows';
|
|
150
|
+
import { MoversSchema } from '@wildshard/format/movers';
|
|
151
|
+
import { ModesSchema, ZiplineModeSchema, UpdraftModeSchema, RideGaitsSchema, RideModeSchema, GrappleModeSchema, TraverseModeSchema } from '@wildshard/format/modes';
|
|
152
|
+
import { MoverMotionSchema, MoverTrackSchema, MoverTriggerSchema, MoverDriverSchema } from '@wildshard/format/moverMotion';
|
|
153
|
+
import { SocketLiftSchema } from '@wildshard/format/socketLift';
|
|
154
|
+
import { PortalLinkSchema } from '@wildshard/format/portalLink';
|
|
155
|
+
import { EntrywaysSchema } from '@wildshard/format/entryways';
|
|
156
|
+
import { NavigationSchema } from '@wildshard/format/navigation';
|
|
157
|
+
import { NativeGroundSchema } from '@wildshard/format/nativeGround';
|
|
158
|
+
import { UiSchema } from '@wildshard/format/ui';
|
|
159
|
+
import { ClientScriptsSchema } from '@wildshard/format/clientScripts';
|
|
160
|
+
import { HeldMeleeActionSchema, ClientChannelsSchema, ClientChannelProgramSchema, PrivateSceneSchema, WorldSceneSchema, NumericPoseSchema } from '@wildshard/format/clientChannels';
|
|
161
|
+
|
|
162
|
+
import { ForestLifeSchema, AmbientFlockSchema, AmbientPerchesSchema, ForagerContinuation } from '@wildshard/format/ambientLife';
|
|
163
|
+
|
|
164
|
+
import { MemoryMeasurementSchema, RuntimeCostSchema, RegionalSimCostSchema } from '@wildshard/format/runtimeCost';
|
|
165
|
+
import { RuntimeSchema, ClientPlanRuntimeSchema } from '@wildshard/format/runtime';
|
|
166
|
+
import { ClientCheckpointSchema, ItemCheckpointStatesSchema, LogicalClientCheckpointSchema } from '@wildshard/format/clientState';
|
|
167
|
+
import { LiftRiderSchema } from '@wildshard/format/liftRider';
|
|
168
|
+
import { ScriptSpeciesSchema } from '@wildshard/format/speciesScripts';
|
|
169
|
+
import { EliteScriptSchema } from '@wildshard/format/eliteScripts';
|
|
170
|
+
import { SkinLookParametersSchema, SkinClipParametersSchema, ShardSkinFileSchema } from '@wildshard/format/skins';
|
|
171
|
+
import { SkinClipNameSchema, SkinRowSchema, SkinBindingSchema } from '@wildshard/format/skinData';
|
|
172
|
+
|
|
173
|
+
import { ShardNaturalSchema, ShardFiniteSchema, ShardHashSchema, ShardReferenceSchema, ShardReferencesSchema, ShardNamesSchema, CellBoundsSchema, IdentitySchema, RequiresSchema, BudgetsSchema, SimSchema, AuthorCapsSchema, ServerBudgetSchema, FilesSchema, TilesSchema, LibrarySchema, CriticalSchema, FarSchema, SpawnSchema } from '@wildshard/format/shardSections';
|
|
174
|
+
|
|
175
|
+
/** JSON Schema plus explicit admission checks that JSON Schema cannot express. */
|
|
176
|
+
export interface FormatJsonSchema extends JsonSchema {
|
|
177
|
+
'x-wildshard-checks'?: string[];
|
|
178
|
+
'x-wildshard-string-length'?: 'utf16-code-units';
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const plumbing = PlumbingSchema.pipe[2];
|
|
182
|
+
const input = plumbing.entries.input.pipe[0].item;
|
|
183
|
+
const debug = plumbing.entries.debug.pipe[0].item;
|
|
184
|
+
// These identities are the defining schemas, not message-based permissions for arbitrary author code.
|
|
185
|
+
const customSchemas = new Map<object, FormatJsonSchema>([
|
|
186
|
+
[WeatherHitTagSchema, { type: 'string', pattern: '^[a-z][a-zA-Z0-9.-]*\\.[a-zA-Z0-9.*-]+$' }],
|
|
187
|
+
[InputActionSchema.options[1], { type: 'string', maxLength: 128, pattern: '^[a-z][a-zA-Z0-9-]*(?:\\.[a-zA-Z0-9-]+)+$' }],
|
|
188
|
+
[input.entries.id, { type: 'string', maxLength: 128, pattern: '^[a-z][a-z0-9-]*(?:\\.[a-z][a-zA-Z0-9-]*)+$' }],
|
|
189
|
+
[debug.entries.ask, { type: 'string', pattern: '^E[1-9][0-9]*$' }],
|
|
190
|
+
]);
|
|
191
|
+
// Faithful projection of the native four-field header predicate. Registered
|
|
192
|
+
// post documents additionally run complete scaled-post and graph admission.
|
|
193
|
+
customSchemas.set(ScaledPostInputSchema, { type: 'object', required: ['programs', 'draws', 'targets', 'outputs'],
|
|
194
|
+
'x-wildshard-checks': ['@wildshard/format/scaledPostContract#parseScaledPostRow'] } satisfies FormatJsonSchema);
|
|
195
|
+
customSchemas.set(HeldCueSchema, { type: 'string', pattern: '^cue\\.[a-z][a-zA-Z0-9.-]*$' });
|
|
196
|
+
customSchemas.set(ArcWeaponItemSchema, { type: 'string', pattern: '^weapon\\.[a-z][a-zA-Z0-9.-]*$' });
|
|
197
|
+
const postIdentityTransforms = new Set([...postGraphIdentityTransforms, ...uniformIdentityTransforms]);
|
|
198
|
+
customSchemas.set(HeldMeleeActionSchema, { type: 'string', pattern: '^[a-z][a-zA-Z0-9-]*\\.[a-zA-Z0-9.-]+$' });
|
|
199
|
+
const bowVariant = BowVariantSchema.pipe[2].entries;
|
|
200
|
+
customSchemas.set(bowVariant.id, { type: 'string', pattern: '^weapon\\.[a-z0-9.-]+$' });
|
|
201
|
+
customSchemas.set(bowVariant.sourceTag, { type: 'string', pattern: '^[^.]+\\..+$' });
|
|
202
|
+
customSchemas.set(CreatureStrikeSchema.entries.tags.pipe[0].item, { type: 'string', maxLength: 128, pattern: '^[a-z][a-zA-Z0-9.-]*\\.[a-zA-Z0-9.*-]+$' });
|
|
203
|
+
// Exact fixed-palette validator; a caller's new custom schema receives no bridge.
|
|
204
|
+
customSchemas.set(AccentSchema.pipe[2], { type: 'string', enum: [...ACCENT_IDS] });
|
|
205
|
+
// Template-literal item identities keep their exact native predicates; only these defining schema objects bridge.
|
|
206
|
+
const itemRows = ItemsSchema.pipe[2].entries.rows.pipe[0].item;
|
|
207
|
+
const weaponRow = itemRows.options[0], toolRow = itemRows.options[1];
|
|
208
|
+
customSchemas.set(weaponRow.entries.id, { type: 'string', maxLength: 128, pattern: '^weapon\\.[a-z][a-zA-Z0-9.-]*$' });
|
|
209
|
+
customSchemas.set(toolRow.entries.id, { type: 'string', maxLength: 128, pattern: '^tool\\.[a-z][a-zA-Z0-9.-]*$' });
|
|
210
|
+
customSchemas.set(weaponRow.entries.slot, { type: 'string', maxLength: 128, pattern: '^declared\\.weapon\\.[a-z][a-zA-Z0-9.-]*$' });
|
|
211
|
+
customSchemas.set(weaponRow.entries.light.entries.tags.pipe[0].item, { type: 'string', maxLength: 128, pattern: '^[a-z][a-zA-Z0-9.-]*\\.[a-zA-Z0-9.-]+$' });
|
|
212
|
+
customSchemas.set(ConeWeaponProfileSchema.entries.gust.entries.tags.pipe[0].item, { type: 'string', maxLength: 128, pattern: '^[a-z][a-zA-Z0-9.-]*\\.[a-zA-Z0-9.-]+$' });
|
|
213
|
+
customSchemas.set(weaponRow.entries.light.entries.effect.wrapped, { type: 'string', pattern: '^effect\\.[a-z][a-zA-Z0-9.-]*$' });
|
|
214
|
+
customSchemas.set(toolRow.entries.action.wrapped, { type: 'string', pattern: '^[a-z][a-zA-Z0-9.-]*\\.[a-zA-Z0-9.-]+$' });
|
|
215
|
+
// The namespaced combat tag validator is the exact defining row object.
|
|
216
|
+
customSchemas.set(RowsSchema.pipe[2].entries.strikes.pipe[0].item.entries.tags.pipe[0].item, { type: 'string', maxLength: 128, pattern: '^[a-z][a-zA-Z0-9.-]*\\.[a-zA-Z0-9.-]+$' });
|
|
217
|
+
const unicodeRegexes = new Set<object>([
|
|
218
|
+
plumbing.entries.namespace.pipe[1],
|
|
219
|
+
InputKeysSchema.pipe[0].item.pipe[1],
|
|
220
|
+
debug.entries.reviewBy.pipe[1],
|
|
221
|
+
]);
|
|
222
|
+
const stateField = StateSchema.pipe[0].entries.shared.pipe[0].item;
|
|
223
|
+
unicodeRegexes.add(stateField.entries.name.pipe[1]);
|
|
224
|
+
unicodeRegexes.add(CommonsCostsSchema.pipe[0].key.pipe[1]);
|
|
225
|
+
const edge = EdgeProfileSchema.pipe[0];
|
|
226
|
+
const finiteNumbers = new Set<object>([
|
|
227
|
+
edge.entries.heights.item.pipe[1],
|
|
228
|
+
stateField.entries.default.options[1].pipe[1],
|
|
229
|
+
...edge.entries.colours.item.items.map(channel => channel.pipe[1]),
|
|
230
|
+
]);
|
|
231
|
+
|
|
232
|
+
// Only the exact retained defining roots grant action bridges. A caller's new check or transform never joins.
|
|
233
|
+
const wireRoots: Readonly<Record<string, GenericSchema>> = {
|
|
234
|
+
'audioScene.AudioScene': AudioSceneSchema,
|
|
235
|
+
'forestPage.LivingPageSites': LivingPageSitesSchema,
|
|
236
|
+
'fixedDraws.FixedDrawRows': FixedDrawRowsSchema,
|
|
237
|
+
'forestPage.ForestPage': ForestPageSchema,
|
|
238
|
+
'forestPage.ForestGroundLayout': ForestGroundLayoutSchema,
|
|
239
|
+
'caveInterior.CaveFile': CaveFileSchema,
|
|
240
|
+
'caveInterior.CaveInterior': CaveInteriorSchema,
|
|
241
|
+
'streamedCover.CoverComposition': CoverCompositionSchema,
|
|
242
|
+
'speciesLooks.CreatureInstall': CreatureInstallSchema,
|
|
243
|
+
'speciesLooks.PackedCreatureLooks': PackedCreatureLooksSchema,
|
|
244
|
+
'questPageComposition.QuestPageComposition': QuestPageCompositionSchema,
|
|
245
|
+
'chapterDirector.ChapterWake': ChapterWakeSchema,
|
|
246
|
+
'bowVariantRows.BowVariant': BowVariantSchema,
|
|
247
|
+
'scalarChannel.ScalarChannel': ScalarChannelSchema,
|
|
248
|
+
'terrain.ForestRows': ForestRowsSchema,
|
|
249
|
+
'clientPlan.RuntimeBounds': RuntimeBoundsSchema,
|
|
250
|
+
'worldUpdates.WorldUpdates': WorldUpdatesSchema,
|
|
251
|
+
'streamedCover.StreamedCover': StreamedCoverSchema,
|
|
252
|
+
'practiceCourseRows.PracticeScene':PracticeSceneSchema,
|
|
253
|
+
'graphArmsRows.GraphArms': GraphArmsSchema,
|
|
254
|
+
'practiceCourseRows.RidingPractice':RidingPracticeSchema,
|
|
255
|
+
'mountedSpecimenRows.MountedSpecimenSeat': MountedSpecimenSeatSchema,
|
|
256
|
+
'speciesBookRows.SpeciesActorsFile': SpeciesActorsFileSchema,
|
|
257
|
+
'arenaScriptRows.ArenaScriptFightFile': ArenaScriptFightFileSchema,
|
|
258
|
+
'arenaScriptRows.ArenaScriptGeometry': ArenaScriptGeometrySchema,
|
|
259
|
+
'encounterRows.TimedEncounters': TimedEncountersSchema,
|
|
260
|
+
'encounterRows.CloudSpecimen': CloudSpecimenSchema,
|
|
261
|
+
'roamingCombat.RoamingCombat': RoamingCombatSchema,
|
|
262
|
+
'populationProjection.PopulationProjection': PopulationProjectionSchema,
|
|
263
|
+
'populationProjection.EnemyPlacements': EnemyPlacementsSchema,
|
|
264
|
+
'sceneDressing.SceneDressing': SceneDressingSchema,
|
|
265
|
+
'clientChannels.NumericPose': NumericPoseSchema,
|
|
266
|
+
'populationKeeper.PopulationKeeperRows': PopulationKeeperRowsSchema,
|
|
267
|
+
'questInteractions.QuestPageInteractions': QuestPageInteractionsSchema,
|
|
268
|
+
'questPageComposition.QuestPage': QuestPageSchema,
|
|
269
|
+
'questContinuation.QuestContinuation': QuestContinuationSchema,
|
|
270
|
+
'questWorld.QuestWorld': QuestWorldSchema,
|
|
271
|
+
'questFigures.QuestFigures': QuestFiguresSchema,
|
|
272
|
+
'questFigures.KitFigureCards': KitFigureCardsSchema,
|
|
273
|
+
'cueDirector.CueDirectorWire': CueDirectorWireSchema,
|
|
274
|
+
'questSteps.QuestHintRows': QuestHintRowsSchema,
|
|
275
|
+
'questSteps.QuestKillRows': QuestKillRowsSchema,
|
|
276
|
+
'questSteps.QuestServiceActions': QuestServiceActionsSchema,
|
|
277
|
+
'exchange.Exchange': ExchangeSchema,
|
|
278
|
+
'catalogueEconomy.CatalogueEconomy': CatalogueEconomySchema,
|
|
279
|
+
'lootBag.LootBag': LootBagSchema,
|
|
280
|
+
'contracts.ContractCatalogue': ContractCatalogueSchema,
|
|
281
|
+
'achievementCounters.AchievementCounterData': AchievementCounterDataSchema,
|
|
282
|
+
'herdShelter.PopulationShelter': PopulationShelterSchema,
|
|
283
|
+
'panelTemplate.PanelDefinition': PanelDefinitionSchema,
|
|
284
|
+
'heldFinishes.HeldFinishes': HeldFinishesSchema,
|
|
285
|
+
'figures.FigureCatalogue': FigureCatalogueSchema,
|
|
286
|
+
'figures.FigureGroup': FigureGroupSchema,
|
|
287
|
+
'questStory.QuestStory': QuestStorySchema,
|
|
288
|
+
'weatherProgram.WeatherProgram': WeatherProgramSchema,
|
|
289
|
+
'forestWeather.ForestWeather': ForestWeatherSchema,
|
|
290
|
+
'populationRoster.NativePopulationRows': NativePopulationRowsSchema,
|
|
291
|
+
'chapterDirector.ChapterDirector': ChapterDirectorSchema,
|
|
292
|
+
'eliteFeature.EliteFeature': EliteFeatureSchema,
|
|
293
|
+
'coverAppearance.CoverAppearance': CoverAppearanceSchema,
|
|
294
|
+
'pageLife.PageLife': PageLifeSchema,
|
|
295
|
+
'worldSceneWeld.WorldSceneWeld': WorldSceneWeldSchema,
|
|
296
|
+
'worldSceneModels.WorldSceneModels': WorldSceneModelsSchema,
|
|
297
|
+
'sceneBuffers.SceneBuffers': SceneBuffersSchema,
|
|
298
|
+
'worldScenePlacement.WorldScenePlacement': WorldScenePlacementSchema,
|
|
299
|
+
'clientChannels.WorldScene': WorldSceneSchema,
|
|
300
|
+
'buildings.BuildingLifeRows': BuildingLifeRowsSchema,
|
|
301
|
+
'buildings.BuildingCloudPose': BuildingCloudPoseSchema,
|
|
302
|
+
'bodySlots.BodySlots': BodySlotsSchema,
|
|
303
|
+
'limbRig.LimbRig': LimbRigSchema,
|
|
304
|
+
'limbRig.LimbBlend': LimbBlendSchema,
|
|
305
|
+
'limbRig.BakedClipTable': BakedClipTable,
|
|
306
|
+
'limbCollision.LimbCollisionBake': LimbCollisionBake,
|
|
307
|
+
'plumbing.Plumbing': PlumbingSchema,
|
|
308
|
+
'heldArms.ToonArmsLook': ToonArmsLookSchema,
|
|
309
|
+
'npcs.QuestNpcBinding': QuestNpcBindingSchema,
|
|
310
|
+
'questHost.QuestHost': QuestHostSchema,
|
|
311
|
+
'npcs.QuestNpcBindings': QuestNpcBindingsSchema,
|
|
312
|
+
'npcs.NpcRow': NpcRowSchema,
|
|
313
|
+
'npcs.NpcMotion': NpcMotionSchema,
|
|
314
|
+
'npcs.NpcDialogueRow': NpcDialogueRowSchema,
|
|
315
|
+
'bossProfiles.BossProfile': BossProfileSchema,
|
|
316
|
+
'bossProfiles.ArenaBossProfile': ArenaBossProfileSchema,
|
|
317
|
+
'bossProfiles.RoamingBossProfile': RoamingBossProfileSchema,
|
|
318
|
+
'bossProfiles.SpawnedBossProfile': SpawnedBossProfileSchema,
|
|
319
|
+
'bossProfiles.HeldBossProfile': HeldBossProfileSchema,
|
|
320
|
+
'bossProfiles.ScriptBossProfile': ScriptBossProfileSchema,
|
|
321
|
+
'bossEncounter.RoamingEncounter': RoamingEncounterSchema,
|
|
322
|
+
'bossEncounter.WakeEncounter': WakeEncounterSchema,
|
|
323
|
+
'bossEncounter.BossEncounterPresentation': BossEncounterPresentationSchema,
|
|
324
|
+
'bossEncounter.NativeBossBinding': NativeBossBindingSchema,
|
|
325
|
+
'weaponProfiles.WeaponProfile': WeaponProfileSchema,
|
|
326
|
+
'weaponProfiles.MeleeWeaponProfile': MeleeWeaponProfileSchema,
|
|
327
|
+
'weaponProfiles.BowWeaponProfile': BowWeaponProfileSchema,
|
|
328
|
+
'weaponProfiles.FirearmWeaponProfile': FirearmWeaponProfileSchema,
|
|
329
|
+
'weaponProfiles.ThrownWeaponProfile': ThrownWeaponProfileSchema,
|
|
330
|
+
'weaponProfiles.LashWeaponProfile': LashWeaponProfileSchema,
|
|
331
|
+
'weaponProfiles.ConeWeaponProfile': ConeWeaponProfileSchema,
|
|
332
|
+
'weaponProfiles.HeldBowBase': HeldBowBaseSchema,
|
|
333
|
+
'weaponProfiles.HeldBowRows': HeldBowRowsSchema,
|
|
334
|
+
'weaponProfiles.HeldBowDefinition': HeldBowDefinitionSchema,
|
|
335
|
+
'brains.Skirmisher': SkirmisherSchema,
|
|
336
|
+
'brains.Stalker': StalkerSchema,
|
|
337
|
+
'brains.ScriptBrain': ScriptBrainSchema,
|
|
338
|
+
'brains.Guardian': GuardianSchema,
|
|
339
|
+
'brains.GuardianPatterns': GuardianPatternsSchema,
|
|
340
|
+
'brains.PerchHunter': PerchHunterSchema,
|
|
341
|
+
'flyers.Diver': DiverSchema,
|
|
342
|
+
'flyers.OrbitDiver': OrbitDiverSchema,
|
|
343
|
+
'flyers.PatrolDiver': PatrolDiverSchema,
|
|
344
|
+
'flyers.BurstFlyer': BurstFlyerSchema,
|
|
345
|
+
'grazers.Grazer': GrazerSchema,
|
|
346
|
+
'grazers.RamGrazer': RamGrazerSchema,
|
|
347
|
+
'grazers.ChallengeGrazer': ChallengeGrazerSchema,
|
|
348
|
+
'groupBrains.GroupBrain': GroupBrainSchema,
|
|
349
|
+
'creatures.Creatures': CreaturesSchema,
|
|
350
|
+
'creatures.CreatureHome': CreatureHomeSchema,
|
|
351
|
+
'crowds.Flock': FlockSchema,
|
|
352
|
+
'encounters.Encounters': EncountersSchema,
|
|
353
|
+
'audioProfiles.AudioMusic': AudioMusicSchema,
|
|
354
|
+
'audioProfiles.AudioSamples': AudioSamplesSchema,
|
|
355
|
+
'audioProfiles.AudioZones': AudioZonesSchema,
|
|
356
|
+
'audioRouting.AudioRouting': AudioRoutingSchema,
|
|
357
|
+
'audio.AudioData': AudioDataSchema,
|
|
358
|
+
'ledger.LedgerFact': LedgerFactSchema,
|
|
359
|
+
'ledger.LedgerRules': LedgerRulesSchema,
|
|
360
|
+
'director.Director': DirectorSchema,
|
|
361
|
+
'directorProduct.DirectorProduct': DirectorProductSchema,
|
|
362
|
+
'directorStages.DirectorStages': DirectorStagesSchema,
|
|
363
|
+
'migrations.LogicalState': LogicalStateSchema,
|
|
364
|
+
'migrations.Migrations': MigrationsSchema,
|
|
365
|
+
'traversal.Traversal': TraversalSchema,
|
|
366
|
+
'runtimeBinds.RuntimeBinds': RuntimeBindsSchema,
|
|
367
|
+
'runtimeSpawns.RuntimeSpawns': RuntimeSpawnsSchema,
|
|
368
|
+
'skinLayers.SkinPoseLayer': SkinPoseLayerSchema,
|
|
369
|
+
'presentation.Presentation': PresentationSchema,
|
|
370
|
+
'meshCollision.MeshCollision': MeshCollisionSchema,
|
|
371
|
+
'scripts.ScriptBindings': ScriptBindingsSchema,
|
|
372
|
+
'actorMoves.ActorMoves': ActorMovesSchema,
|
|
373
|
+
'decisionScripts.DecisionScripts': DecisionScriptsSchema,
|
|
374
|
+
'hooks.Hooks': HooksSchema,
|
|
375
|
+
'terrain.Terrain': TerrainSchema,
|
|
376
|
+
'water.Water': WaterSchema,
|
|
377
|
+
'accent.Accent': AccentSchema,
|
|
378
|
+
'items.ItemFamilyName': ItemFamilyNameSchema,
|
|
379
|
+
'items.Items': ItemsSchema,
|
|
380
|
+
'targets.Targets': TargetsSchema,
|
|
381
|
+
'quests.QuestData': QuestDataSchema,
|
|
382
|
+
'questGraph.QuestGraph': QuestGraphSchema,
|
|
383
|
+
'questSteps.QuestStepRows': QuestStepRowsSchema,
|
|
384
|
+
'speciesPrograms.Species': SpeciesSchema,
|
|
385
|
+
'buildings.BakedBuildingLook': BakedBuildingLookSchema,
|
|
386
|
+
'buildings.BuildingLifeLook': BuildingLifeLookSchema,
|
|
387
|
+
'questInteractions.InteractionRows': InteractionRowsSchema,
|
|
388
|
+
'rows.Rows': RowsSchema,
|
|
389
|
+
'movers.Movers': MoversSchema,
|
|
390
|
+
'modes.Modes': ModesSchema,
|
|
391
|
+
'modes.ZiplineMode': ZiplineModeSchema,
|
|
392
|
+
'modes.UpdraftMode': UpdraftModeSchema,
|
|
393
|
+
'modes.RideGaits': RideGaitsSchema,
|
|
394
|
+
'modes.RideMode': RideModeSchema,
|
|
395
|
+
'modes.GrappleMode': GrappleModeSchema,
|
|
396
|
+
'modes.TraverseMode': TraverseModeSchema,
|
|
397
|
+
'moverMotion.MoverMotion': MoverMotionSchema,
|
|
398
|
+
'moverMotion.MoverTrack': MoverTrackSchema,
|
|
399
|
+
'moverMotion.MoverTrigger': MoverTriggerSchema,
|
|
400
|
+
'moverMotion.MoverDriver': MoverDriverSchema,
|
|
401
|
+
'socketLift.SocketLift': SocketLiftSchema,
|
|
402
|
+
'portalLink.PortalLink': PortalLinkSchema,
|
|
403
|
+
'entryways.Entryways': EntrywaysSchema,
|
|
404
|
+
'navigation.Navigation': NavigationSchema,
|
|
405
|
+
'nativeGround.NativeGround': NativeGroundSchema,
|
|
406
|
+
'ui.Ui': UiSchema,
|
|
407
|
+
'clientScripts.ClientScripts': ClientScriptsSchema,
|
|
408
|
+
'clientChannels.ClientChannels': ClientChannelsSchema,
|
|
409
|
+
'clientChannels.ClientChannelProgram': ClientChannelProgramSchema,
|
|
410
|
+
'clientChannels.PrivateScene': PrivateSceneSchema,
|
|
411
|
+
'ambientLife.ForestLife': ForestLifeSchema,
|
|
412
|
+
'runtimeCost.MemoryMeasurement': MemoryMeasurementSchema,
|
|
413
|
+
'runtimeCost.RuntimeCost': RuntimeCostSchema,
|
|
414
|
+
'runtimeCost.RegionalSimCost': RegionalSimCostSchema,
|
|
415
|
+
'runtime.Runtime': RuntimeSchema,
|
|
416
|
+
'runtime.ClientPlan': ClientPlanRuntimeSchema,
|
|
417
|
+
'clientState.ClientCheckpoint': ClientCheckpointSchema,
|
|
418
|
+
'clientState.ItemCheckpointStates': ItemCheckpointStatesSchema,
|
|
419
|
+
'clientState.LogicalClientCheckpoint': LogicalClientCheckpointSchema,
|
|
420
|
+
'liftRider.LiftRider': LiftRiderSchema,
|
|
421
|
+
'speciesScripts.ScriptSpecies': ScriptSpeciesSchema,
|
|
422
|
+
'eliteScripts.EliteScript': EliteScriptSchema,
|
|
423
|
+
'skins.SkinLookParameters': SkinLookParametersSchema,
|
|
424
|
+
'skins.SkinClipParameters': SkinClipParametersSchema,
|
|
425
|
+
'skins.ShardSkinFile': ShardSkinFileSchema,
|
|
426
|
+
'skinData.SkinClipName': SkinClipNameSchema,
|
|
427
|
+
'skinData.SkinRow': SkinRowSchema,
|
|
428
|
+
'skinData.SkinBinding': SkinBindingSchema,
|
|
429
|
+
'shardSections.ShardNatural': ShardNaturalSchema,
|
|
430
|
+
'shardSections.ShardFinite': ShardFiniteSchema,
|
|
431
|
+
'shardSections.ShardHash': ShardHashSchema,
|
|
432
|
+
'shardSections.ShardReference': ShardReferenceSchema,
|
|
433
|
+
'shardSections.ShardReferences': ShardReferencesSchema,
|
|
434
|
+
'shardSections.ShardNames': ShardNamesSchema,
|
|
435
|
+
'shardSections.CellBounds': CellBoundsSchema,
|
|
436
|
+
'shardSections.Identity': IdentitySchema,
|
|
437
|
+
'shardSections.Requires': RequiresSchema,
|
|
438
|
+
'shardSections.Budgets': BudgetsSchema,
|
|
439
|
+
'shardSections.Sim': SimSchema,
|
|
440
|
+
'shardSections.AuthorCaps': AuthorCapsSchema,
|
|
441
|
+
'shardSections.ServerBudget': ServerBudgetSchema,
|
|
442
|
+
'shardSections.Files': FilesSchema,
|
|
443
|
+
'shardSections.Tiles': TilesSchema,
|
|
444
|
+
'shardSections.Library': LibrarySchema,
|
|
445
|
+
'shardSections.Critical': CriticalSchema,
|
|
446
|
+
'shardSections.Far': FarSchema,
|
|
447
|
+
'shardSections.Spawn': SpawnSchema,
|
|
448
|
+
'terrain.GroundRows': GroundRowsSchema,
|
|
449
|
+
'scalarChannel.ScalarLattice': ScalarLatticeSchema,
|
|
450
|
+
'practiceCourseRows.Controller': PracticeControllerSchema,
|
|
451
|
+
'scalarChannel.ScalarTriplet': ScalarTripletSchema,
|
|
452
|
+
'returnProjectionV2.ReturnProjectionV2': ReturnProjectionV2Schema,
|
|
453
|
+
'scriptContract.ReturnModules': ReturnModulesSchema,
|
|
454
|
+
'nativePhysics.NativeGroundFile': NativeGroundFileSchema,
|
|
455
|
+
'worldAssembly.WorldAssembly': WorldAssemblySchema,
|
|
456
|
+
'binarySource.BinarySource': BinarySourceSchema,
|
|
457
|
+
'namedJsonContracts.QuestTrader': QuestTraderSchema,
|
|
458
|
+
'namedJsonContracts.AdventurePersistence': AdventurePersistenceSchema,
|
|
459
|
+
'namedJsonContracts.PosedLibrary': PosedLibrarySchema,
|
|
460
|
+
'populationEnvironment.PopulationField': PopulationFieldSchema,
|
|
461
|
+
'namedJsonContracts.PageReturnRows': PageReturnRowsSchema,
|
|
462
|
+
'worldScenePlacement.WorldScenePlacementPage': WorldScenePlacementPageSchema,
|
|
463
|
+
'questSteps.CarriedQuest': CarriedQuestSchema,
|
|
464
|
+
'nativeQuestComposition.NativeQuestComposition': NativeQuestCompositionSchema,
|
|
465
|
+
'nativeQuestComposition.NativeQuestServiceSpots': NativeQuestServiceSpotsSchema,
|
|
466
|
+
'panelTemplate.QuestPanelCatalogue': QuestPanelCatalogueSchema,
|
|
467
|
+
'sceneDressing.SceneScatterPage': SceneScatterPageSchema,
|
|
468
|
+
'buildings.BuildingLifeDocument': BuildingLifeDocumentSchema,
|
|
469
|
+
'bakedTiles.BakedPlacementPlan': BakedPlacementPlanSchema,
|
|
470
|
+
'sceneSources.SceneModelSource': SceneModelSourceSchema,
|
|
471
|
+
'sceneSources.SceneBakeSource': SceneBakeSourceSchema,
|
|
472
|
+
'worldScenePages.WorldScenePage': WorldScenePageSchema,
|
|
473
|
+
'weatherBundle.WeatherBundle': WeatherBundleSchema,
|
|
474
|
+
'weatherBundle.WeatherDocument': WeatherDocumentSchema,
|
|
475
|
+
'weatherEffects.WeatherEffects': WeatherEffectsSchema,
|
|
476
|
+
'rainPresentation.RainPresentation': RainPresentationSchema,
|
|
477
|
+
'rangedPage.ForestWeatherObservation': ForestWeatherObservationSchema,
|
|
478
|
+
'paintedResources.PaintedAir': PaintedAirSchema,
|
|
479
|
+
'paintedResources.PaintedGround': PaintedGroundSchema,
|
|
480
|
+
'paintedResources.PaintedPanorama': PaintedPanoramaSchema,
|
|
481
|
+
'paintedResources.PainterKeyLight': PainterKeyLightSchema,
|
|
482
|
+
'paintedResources.PainterlyWorld': PainterlyWorldSchema,
|
|
483
|
+
'postGraphLook.PostGraphLook': PostGraphLookSchema,
|
|
484
|
+
'questStory.ChapterStoryPresentation': ChapterStoryPresentationSchema,
|
|
485
|
+
|
|
486
|
+
'mixedPopulation.PerchBodyFile': PerchBodyFileSchema,
|
|
487
|
+
'returnProgramDocument.ReturnProgramDocument': ReturnProgramDocumentSchema,
|
|
488
|
+
'returnProgramDocument.ReturnProgramWireDocument': ReturnProgramWireDocumentSchema,
|
|
489
|
+
'populationEnvironment.PopulationHabitat': PopulationHabitatSchema,
|
|
490
|
+
'populationRoster.TamingPoseFile': TamingPoseFileSchema,
|
|
491
|
+
'questStory.AdventureContent': AdventureContentSchema,
|
|
492
|
+
'findsCatalogue.FindsCatalogue': FindsCatalogueSchema,
|
|
493
|
+
'wildlifePopulation.WildlifePopulation': WildlifePopulationSchema,
|
|
494
|
+
'practiceCourseRows.FixedPracticeFile': FixedPracticeFileSchema,
|
|
495
|
+
'islandLibrary.FixedGeometryGroups': FixedGeometryGroupsSchema,
|
|
496
|
+
'specimenCatalogue.SpecimenBook': SpecimenBookSchema,
|
|
497
|
+
'heldArms.HeldGraphCards': HeldGraphCardsSchema,
|
|
498
|
+
'arenaRoomDocument.ArenaRoomDocument': ArenaRoomDocumentSchema,
|
|
499
|
+
'riding.ClientRidingSession': ClientRidingSessionSchema,
|
|
500
|
+
'rangedPage.RangedPage': RangedPageSchema,
|
|
501
|
+
'speciesActorsFile.SpeciesActorsFile': SpeciesActorsDocumentSchema,
|
|
502
|
+
|
|
503
|
+
'forestNativeInputs.ForestNativeInputs': ForestNativeInputsSchema,
|
|
504
|
+
'waterWorld.WaterWorld': WaterWorldSchema,
|
|
505
|
+
'weaponProfiles.HeldBowFile': HeldBowFileSchema,
|
|
506
|
+
'weaponProfiles.HeldFirearmPage': HeldFirearmPageSchema,
|
|
507
|
+
'heldWeaponDocuments.BladeDocument': BladeDocumentSchema,
|
|
508
|
+
'heldWeaponDocuments.PolearmDocument': PolearmDocumentSchema,
|
|
509
|
+
'heldWeaponDocuments.HeldSlotsDocument': HeldSlotsDocumentSchema,
|
|
510
|
+
'heldJianDocument.HeldJianDocument': HeldJianDocumentSchema,
|
|
511
|
+
'questInteractionSource.QuestInteractionSource': QuestInteractionSourceSchema,
|
|
512
|
+
'questRuntime.QuestRuntimeDocument': QuestRuntimeDocumentSchema,
|
|
513
|
+
'questStoryBindings.QuestStoryBindings': QuestStoryBindingsSchema,
|
|
514
|
+
'questPageComposition.ChapterView': ChapterViewSchema,
|
|
515
|
+
};
|
|
516
|
+
const wireChecks = new Map<object, string>();
|
|
517
|
+
const wireFinite = new Set<object>();
|
|
518
|
+
const wireRegexes = new Set<object>();
|
|
519
|
+
function rememberActions(value: unknown, path: string, seen: WeakSet<object>): void {
|
|
520
|
+
if (typeof value !== 'object' || value === null || seen.has(value)) return;
|
|
521
|
+
seen.add(value);
|
|
522
|
+
const kind: unknown = Reflect.get(value, 'kind'), type: unknown = Reflect.get(value, 'type');
|
|
523
|
+
if (kind === 'schema' && type === 'lazy') {
|
|
524
|
+
const getter: unknown = Reflect.get(value, 'getter');
|
|
525
|
+
if (typeof getter === 'function') {
|
|
526
|
+
const nested: unknown = Reflect.apply(getter, undefined, [undefined]);
|
|
527
|
+
rememberActions(nested, `${path}.wrapped`, seen);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
if (kind === 'validation') {
|
|
531
|
+
if (type === 'check' && !wireChecks.has(value)) wireChecks.set(value, path);
|
|
532
|
+
else if (type === 'finite') wireFinite.add(value);
|
|
533
|
+
else if (type === 'regex') {
|
|
534
|
+
const regex: unknown = Reflect.get(value, 'requirement');
|
|
535
|
+
if (regex instanceof RegExp && regex.flags === 'u') wireRegexes.add(value);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
for (const [key, child] of Object.entries(value)) rememberActions(child, `${path}.${key}`, seen);
|
|
539
|
+
}
|
|
540
|
+
for (const [key, schema] of Object.entries(wireRoots)) {
|
|
541
|
+
const module = key.slice(0, key.indexOf('.')), binding = key.slice(key.indexOf('.') + 1);
|
|
542
|
+
rememberActions(schema, `@wildshard/format/${module}#${binding}Schema`, new WeakSet());
|
|
543
|
+
}
|
|
544
|
+
// A composed quest host shares this exact check object; its nested path must not rename the defining public check.
|
|
545
|
+
wireChecks.set(DirectorStagesSchema.pipe[1], '@wildshard/format/directorStages#DirectorStagesSchema.pipe.1');
|
|
546
|
+
// ChapterWake borrows this check; composition cannot rename its defining public identity.
|
|
547
|
+
const wakePipe: unknown = Reflect.get(WakeEncounterSchema, 'pipe');
|
|
548
|
+
const wakeCheck: unknown = Array.isArray(wakePipe) ? wakePipe[1] : undefined;
|
|
549
|
+
if (typeof wakeCheck !== 'object' || wakeCheck === null
|
|
550
|
+
|| Reflect.get(wakeCheck, 'kind') !== 'validation' || Reflect.get(wakeCheck, 'type') !== 'check') {
|
|
551
|
+
throw new Error('Missing defining wake encounter validation');
|
|
552
|
+
}
|
|
553
|
+
wireChecks.set(wakeCheck, '@wildshard/format/bossEncounter#WakeEncounterSchema.pipe.1');
|
|
554
|
+
|
|
555
|
+
/** Share only complete native grammars within these exact documents. The
|
|
556
|
+
* defining format parsers still own every semantic and resource admission. */
|
|
557
|
+
function encounterDefinitions(schema: GenericSchema): Record<string, GenericSchema> | undefined {
|
|
558
|
+
if (schema === ArenaScriptFightFileSchema) return {
|
|
559
|
+
room: ArenaRoomDocumentRowsSchema, king: ArenaKingRowsSchema, privateScene: PrivateSceneSchema,
|
|
560
|
+
bossProfile: BossProfileSchema, legacyReturn: ReturnProgramSchema, completeReturn: ReturnProgramDocumentSchema,
|
|
561
|
+
projection: ReturnProjectionV2Schema,
|
|
562
|
+
};
|
|
563
|
+
if (schema === ArenaRoomDocumentSchema) return {
|
|
564
|
+
room: ArenaRoomDocumentRowsSchema, privateScene: PrivateSceneSchema, bossProfile: BossProfileSchema,
|
|
565
|
+
legacyReturn: ReturnProgramSchema, completeReturn: ReturnProgramDocumentSchema, projection: ReturnProjectionV2Schema,
|
|
566
|
+
};
|
|
567
|
+
if (schema === ArenaScriptGeometrySchema) return {
|
|
568
|
+
privateScene: PrivateSceneSchema, nativeGeometry: WeatherGeometrySchema, channelPrograms: ClientChannelsSchema,
|
|
569
|
+
};
|
|
570
|
+
if (schema === CloudSpecimenSchema) return {
|
|
571
|
+
cloudBody: CloudBodySchema, privateScene: PrivateSceneSchema,
|
|
572
|
+
nativeGeometry: WeatherGeometrySchema, channelPrograms: ClientChannelsSchema,
|
|
573
|
+
};
|
|
574
|
+
if (schema === ClientRidingSessionSchema) return {
|
|
575
|
+
legacyReturn: ReturnProgramSchema, completeReturn: ReturnProgramDocumentSchema, projection: ReturnProjectionV2Schema,
|
|
576
|
+
};
|
|
577
|
+
if (schema === TimedEncountersSchema) return {
|
|
578
|
+
nativeGeometryData: WeatherGeometryDataSchema, projection: ReturnProjectionV2Schema,
|
|
579
|
+
};
|
|
580
|
+
if (schema === MountedSpecimenSeatSchema) return { bakedGeometry: SceneBakedGeometrySchema };
|
|
581
|
+
return undefined;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/** Complete repeated grammars factored only within the approved native documents. */
|
|
585
|
+
function heldDocumentDefinitions(schema: GenericSchema): Record<string, GenericSchema> | undefined {
|
|
586
|
+
if (schema === HeldJianDocumentSchema) return {
|
|
587
|
+
graphArms: GraphArmsSchema, postGraph: PostGraphLookSchema, channels: ClientChannelsSchema,
|
|
588
|
+
};
|
|
589
|
+
if (schema === BladeDocumentSchema || schema === PolearmDocumentSchema || schema === HeldSlotsDocumentSchema) return {
|
|
590
|
+
completeReturn: ReturnProgramDocumentSchema, projection: ReturnProjectionV2Schema,
|
|
591
|
+
};
|
|
592
|
+
if (schema === WaterWorldSchema) return {
|
|
593
|
+
sceneNode: WorldSceneWeldNodeSchema, completeReturn: ReturnProgramDocumentSchema, projection: ReturnProjectionV2Schema,
|
|
594
|
+
};
|
|
595
|
+
if (schema === HeldFirearmPageSchema) return { channels: ClientChannelsSchema };
|
|
596
|
+
return undefined;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Convert an author schema with the official converter, refusing every unrecognised custom check or transform.
|
|
601
|
+
* The extracted format checks have explicit bridges. Plumbing's cross-field checks remain named mandatory
|
|
602
|
+
* admission checks; Valibot string bounds use UTF-16 code units, unlike JSON Schema's Unicode code points.
|
|
603
|
+
* The custom-section bridge uses draft-07; existing wire documents keep draft-2020-12.
|
|
604
|
+
* This structural document never replaces the defining format parser's admission verdict.
|
|
605
|
+
*/
|
|
606
|
+
export function formatJsonSchema(schema: GenericSchema, target: 'draft-07' | 'draft-2020-12' = 'draft-2020-12'): FormatJsonSchema {
|
|
607
|
+
const heldDefinitions = heldDocumentDefinitions(schema);
|
|
608
|
+
const definitions = encounterDefinitions(schema);
|
|
609
|
+
return toJsonSchema(schema, {
|
|
610
|
+
target, errorMode: 'throw', typeMode: 'output',
|
|
611
|
+
// Both page kinds share the complete node grammar. A local definition
|
|
612
|
+
// retains every constraint without repeating that grammar per branch.
|
|
613
|
+
...(schema === WorldScenePageSchema ? { definitions: { sceneNode: WorldSceneWeldNodeSchema } } : {}),
|
|
614
|
+
// Both existing weather wires contain the same complete phase program.
|
|
615
|
+
...(schema === WeatherDocumentSchema ? { definitions: { weatherProgram: WeatherProgramSchema } } : {}),
|
|
616
|
+
...(heldDefinitions === undefined ? {} : { definitions: heldDefinitions }),
|
|
617
|
+
// The complete sheep document keeps both original return envelopes and
|
|
618
|
+
// exact-input script/projection constraints, shared without repetition.
|
|
619
|
+
...(schema === SpeciesActorsDocumentSchema ? { definitions: { legacyReturn: ReturnProgramSchema, wireReturn: ReturnProgramWireDocumentSchema, projection: ReturnProjectionV2Schema } } : {}),
|
|
620
|
+
...(definitions === undefined ? {} : { definitions }),
|
|
621
|
+
// The population's six identical return descriptors share their complete
|
|
622
|
+
// native grammars; the defining parser and every wire constraint remain.
|
|
623
|
+
...(schema === WildlifePopulationSchema ? { definitions: { legacyReturn: ReturnProgramSchema, projection: ReturnProjectionV2Schema } } : {}),
|
|
624
|
+
...(schema === PopulationProjectionSchema || schema === PerchBodyFileSchema ? { definitions: { legacyReturn: ReturnProgramSchema, wireReturn: ReturnProgramWireDocumentSchema, projection: ReturnProjectionV2Schema } } : {}),
|
|
625
|
+
overrideSchema: ({ valibotSchema }) => customSchemas.get(valibotSchema),
|
|
626
|
+
overrideAction: ({ valibotAction, jsonSchema, errors }) => {
|
|
627
|
+
if (postIdentityTransforms.has(valibotAction)) return jsonSchema;
|
|
628
|
+
// Exact one-pass sample transforms retain the original wire grammar; JSON numbers are finite.
|
|
629
|
+
if (valibotAction === SkinPoseLayerSchema.entries.times.pipe[1]) return { type: 'array', items: { type: 'number' }, minItems: 2, maxItems: 4097 };
|
|
630
|
+
if (valibotAction === SkinPoseLayerSchema.entries.tracks.pipe[0].item.entries.values.pipe[1]) return { type: 'array', items: { type: 'number' }, maxItems: 300000 };
|
|
631
|
+
if (valibotAction === GraphArmsSchema.entries.rig.entries.sockets.pipe[3]) return { ...jsonSchema, uniqueItems: true };
|
|
632
|
+
if (valibotAction === HeldArmsSchema.options[1].entries.tools.pipe[2]) return { ...jsonSchema, uniqueItems: true };
|
|
633
|
+
// This defining transform only omits empty optional namespaces; all nonempty maps retain the schema below.
|
|
634
|
+
if (valibotAction === DecisionScriptsSchema.pipe[7]) return jsonSchema;
|
|
635
|
+
if (valibotAction === EdgeProfileSchema.pipe[1]) {
|
|
636
|
+
// Both arrays must have the same native sample count; bound each branch exactly.
|
|
637
|
+
return { ...jsonSchema, anyOf: [256, 257].map(count => ({ properties: {
|
|
638
|
+
heights: { minItems: count, maxItems: count }, colours: { minItems: count, maxItems: count },
|
|
639
|
+
} })) };
|
|
640
|
+
}
|
|
641
|
+
if (valibotAction === PlumbingSchema.pipe[3]) {
|
|
642
|
+
return { ...jsonSchema, 'x-wildshard-checks': ['@wildshard/format/plumbing#plumbingRules'] } satisfies FormatJsonSchema;
|
|
643
|
+
}
|
|
644
|
+
if (valibotAction === StateSchema.pipe[1]) {
|
|
645
|
+
return { ...jsonSchema, 'x-wildshard-checks': ['@wildshard/format/state#stateRules'] } satisfies FormatJsonSchema;
|
|
646
|
+
}
|
|
647
|
+
if (valibotAction === CommonsCostsSchema.pipe[1]) {
|
|
648
|
+
return { ...jsonSchema, maxProperties: SHARDFILE_ADMISSION_LIMITS.commons };
|
|
649
|
+
}
|
|
650
|
+
// Only the defining query form derives an omitted collider reference from its required sampling file.
|
|
651
|
+
if (valibotAction === TerrainSchema.options[1].pipe[1]) return {
|
|
652
|
+
...jsonSchema, required: [...jsonSchema.required ?? [], 'collider'],
|
|
653
|
+
'x-wildshard-checks': ['@wildshard/format/terrain#TerrainSchema.options.1.pipe.1'],
|
|
654
|
+
} satisfies FormatJsonSchema;
|
|
655
|
+
// The retained clip transform returns its input unchanged; identity is checked against its defining object.
|
|
656
|
+
if (valibotAction === SkinClipNameSchema.pipe[2]) return jsonSchema;
|
|
657
|
+
const check = wireChecks.get(valibotAction);
|
|
658
|
+
if (check !== undefined) {
|
|
659
|
+
const before = (jsonSchema as FormatJsonSchema)['x-wildshard-checks'] ?? [];
|
|
660
|
+
return { ...jsonSchema, 'x-wildshard-checks': [...before, check] } satisfies FormatJsonSchema;
|
|
661
|
+
}
|
|
662
|
+
// JSON numbers cannot contain NaN or infinity. The existing ASCII regexes only use the Unicode flag.
|
|
663
|
+
if (valibotAction.reference === finite || finiteNumbers.has(valibotAction) || unicodeRegexes.has(valibotAction) || wireFinite.has(valibotAction) || wireRegexes.has(valibotAction)) return jsonSchema;
|
|
664
|
+
if (errors === undefined && jsonSchema.type === 'string' &&
|
|
665
|
+
(valibotAction.type === 'min_length' || valibotAction.type === 'max_length')) {
|
|
666
|
+
return { ...jsonSchema, 'x-wildshard-string-length': 'utf16-code-units' } satisfies FormatJsonSchema;
|
|
667
|
+
}
|
|
668
|
+
return undefined;
|
|
669
|
+
},
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
const namedSchemas = new WeakMap<GenericSchema, Readonly<Record<string, unknown>>>();
|
|
674
|
+
/** Build-only draft-07 structure for a named JSON producer's defining schema.
|
|
675
|
+
* Like the custom-section bridge, omit documentation annotations that Ajv does
|
|
676
|
+
* not implement; the producer and defining reader retain semantic admission.
|
|
677
|
+
* Unknown checks and transforms still refuse conversion. Never infer from data.
|
|
678
|
+
* New named JSON requests provenance: only an exact defining format root receives
|
|
679
|
+
* its source identity. The default preserves every existing schema byte. */
|
|
680
|
+
export function namedJsonSchema(schema: GenericSchema, options: { provenance?: boolean } = {}): Readonly<Record<string, unknown>> {
|
|
681
|
+
if (options.provenance === true) {
|
|
682
|
+
const entry = Object.entries(wireRoots).find(([, root]) => root === schema);
|
|
683
|
+
if (entry === undefined) throw new Error('Named JSON provenance requires a defining shared format root');
|
|
684
|
+
const [key] = entry, split = key.indexOf('.');
|
|
685
|
+
return { ...namedJsonSchema(schema), $comment: `@wildshard/format/${key.slice(0, split)}#${key.slice(split + 1)}Schema` };
|
|
686
|
+
}
|
|
687
|
+
const previous = namedSchemas.get(schema);
|
|
688
|
+
if (previous !== undefined) return previous;
|
|
689
|
+
const structural = (value: unknown): unknown => {
|
|
690
|
+
if (typeof value === 'string' && value.startsWith('#/$defs/')) return value.replace('#/$defs/', '#/definitions/');
|
|
691
|
+
if (Array.isArray(value)) return value.map(structural);
|
|
692
|
+
if (typeof value !== 'object' || value === null) return value;
|
|
693
|
+
return Object.fromEntries(Object.entries(value)
|
|
694
|
+
.filter(([key]) => key !== 'x-wildshard-checks' && key !== 'x-wildshard-string-length')
|
|
695
|
+
.map(([key, child]) => [key === '$defs' ? 'definitions' : key, structural(child)]));
|
|
696
|
+
};
|
|
697
|
+
const wire = structural(formatJsonSchema(schema, 'draft-07'));
|
|
698
|
+
if (typeof wire !== 'object' || wire === null || Array.isArray(wire)) throw new Error('Named JSON requires a defining object schema');
|
|
699
|
+
const result: Readonly<Record<string, unknown>> = Object.fromEntries(Object.entries(wire));
|
|
700
|
+
namedSchemas.set(schema, result);
|
|
701
|
+
return result;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/** Project one registered consumer contract to its exact named draft-07 document.
|
|
705
|
+
* Author tools name the contract without borrowing the format's Valibot object. */
|
|
706
|
+
export function namedFormatJsonSchema(name: string): Readonly<Record<string, unknown>> {
|
|
707
|
+
if (!Object.hasOwn(wireRoots, name)) throw new Error(`Unknown named format contract: ${name}`);
|
|
708
|
+
const schema = wireRoots[name];
|
|
709
|
+
if (schema === undefined) throw new Error(`Missing named format contract: ${name}`);
|
|
710
|
+
return namedJsonSchema(schema);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/** Build-only provenance catalogue from the defining format objects, independently checked by the product freeze. */
|
|
714
|
+
export function namedFormatJsonSchemas(): Readonly<Record<string, Readonly<Record<string, unknown>>>> {
|
|
715
|
+
return Object.fromEntries(Object.values(wireRoots).map(schema => {
|
|
716
|
+
const document = namedJsonSchema(schema, { provenance: true });
|
|
717
|
+
return [String(document['$comment']), document];
|
|
718
|
+
}));
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/** Publish the exact defining schema of a registered logical JSON name.
|
|
722
|
+
* Only metadata changes; the caller retains the original document bytes. */
|
|
723
|
+
export function registeredJsonSchema(name:RegisteredSchemaJsonName):Readonly<Record<string,unknown>>;
|
|
724
|
+
export function registeredJsonSchema(name:string):Readonly<Record<string,unknown>>|undefined;
|
|
725
|
+
export function registeredJsonSchema(name:string):Readonly<Record<string,unknown>>|undefined {
|
|
726
|
+
const contract=registeredJsonContract(name);
|
|
727
|
+
if(contract===undefined)return undefined;
|
|
728
|
+
const document=namedJsonSchema(contract.schema,{provenance:true});
|
|
729
|
+
if(document['$comment']!==contract.source)throw new Error(`Registered JSON defining binding differs: ${name}`);
|
|
730
|
+
return document;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/** The migrated wire roots, generated from their defining Valibot schemas; whole-shard extraction remains open. */
|
|
734
|
+
export function formatJsonSchemas(): Readonly<Record<string, FormatJsonSchema>> {
|
|
735
|
+
const document = (name: string, schema: GenericSchema): FormatJsonSchema => {
|
|
736
|
+
try { return {
|
|
737
|
+
...formatJsonSchema(schema), title: name,
|
|
738
|
+
$comment: 'DO-NOT-EDIT: generated from @wildshard/format by scripts/gen-format-schema.mjs. Structural schema; named checks and UTF-16 bounds still require the defining Valibot parser.',
|
|
739
|
+
}; } catch (error) { throw new Error(`Format schema ${name}: ${String(error)}`, { cause: error }); }
|
|
740
|
+
};
|
|
741
|
+
return { 'edge-profiles': document('edge-profiles', EdgeProfilesSchema), plumbing: document('plumbing', PlumbingSchema),
|
|
742
|
+
state: document('state', StateSchema), 'commons-costs': document('commons-costs', CommonsCostsSchema),
|
|
743
|
+
...Object.fromEntries(Object.entries(wireRoots).map(([name, schema]) => [name, document(name, schema)])) };
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/** JSON-only declaration discovery. Rules describe admission; this document never grants admission. */
|
|
747
|
+
export interface SchemaDeclaration {
|
|
748
|
+
kind: string;
|
|
749
|
+
rules: { kind: string; requirement?: string | number | boolean; message?: string }[];
|
|
750
|
+
properties?: Record<string, SchemaDeclaration>;
|
|
751
|
+
items?: SchemaDeclaration[];
|
|
752
|
+
item?: SchemaDeclaration;
|
|
753
|
+
alternatives?: SchemaDeclaration[];
|
|
754
|
+
wrapped?: SchemaDeclaration;
|
|
755
|
+
optional?: boolean;
|
|
756
|
+
default?: string | number | boolean | null | object;
|
|
757
|
+
value?: string | number | boolean;
|
|
758
|
+
values?: (string | number | boolean)[];
|
|
759
|
+
key?: SchemaDeclaration;
|
|
760
|
+
valueSchema?: SchemaDeclaration;
|
|
761
|
+
rest?: SchemaDeclaration;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
function declarationOf(value: unknown): SchemaDeclaration {
|
|
765
|
+
if (typeof value !== 'object' || value === null) throw new Error('Expected a defining schema');
|
|
766
|
+
const read = (key: string): unknown => Reflect.get(value, key);
|
|
767
|
+
const type = read('type');
|
|
768
|
+
if (typeof type !== 'string') throw new Error('Expected a defining schema type');
|
|
769
|
+
const pipeline = read('pipe');
|
|
770
|
+
if (Array.isArray(pipeline)) {
|
|
771
|
+
const schemas = pipeline.filter((part: unknown) => typeof part === 'object' && part !== null && Reflect.get(part, 'kind') === 'schema');
|
|
772
|
+
const base: unknown = schemas.at(-1);
|
|
773
|
+
if (base === undefined) throw new Error('Missing pipeline schema');
|
|
774
|
+
const declaration = declarationOf(base);
|
|
775
|
+
for (const part of pipeline) {
|
|
776
|
+
if (typeof part !== 'object' || part === null || Reflect.get(part, 'kind') === 'schema') continue;
|
|
777
|
+
const kind: unknown = Reflect.get(part, 'type'), requirement: unknown = Reflect.get(part, 'requirement'), message: unknown = Reflect.get(part, 'message');
|
|
778
|
+
if (typeof kind !== 'string') throw new Error('Missing admission rule type');
|
|
779
|
+
declaration.rules.push({ kind,
|
|
780
|
+
...(requirement instanceof RegExp ? { requirement: requirement.source } : typeof requirement === 'number' || typeof requirement === 'string' || typeof requirement === 'boolean' ? { requirement } : {}),
|
|
781
|
+
...(typeof message === 'string' ? { message } : {}),
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
return declaration;
|
|
785
|
+
}
|
|
786
|
+
const declaration: SchemaDeclaration = { kind: type, rules: [] };
|
|
787
|
+
const entries = read('entries'), items = read('items'), item = read('item'), alternatives = read('options'), wrapped = read('wrapped');
|
|
788
|
+
if (typeof entries === 'object' && entries !== null) declaration.properties = Object.fromEntries(Object.entries(entries).map(([key, schema]) => [key, declarationOf(schema)]));
|
|
789
|
+
if (Array.isArray(items)) declaration.items = items.map(declarationOf);
|
|
790
|
+
if (typeof item === 'object' && item !== null) declaration.item = declarationOf(item);
|
|
791
|
+
if (Array.isArray(alternatives)) {
|
|
792
|
+
if (alternatives.every((option: unknown) => typeof option === 'string' || typeof option === 'number' || typeof option === 'boolean')) declaration.values = alternatives;
|
|
793
|
+
else declaration.alternatives = alternatives.map(declarationOf);
|
|
794
|
+
}
|
|
795
|
+
if (typeof wrapped === 'object' && wrapped !== null) declaration.wrapped = declarationOf(wrapped);
|
|
796
|
+
for (const [source, target] of [['key', 'key'], ['value', 'valueSchema'], ['rest', 'rest']] as const) {
|
|
797
|
+
const child = read(source);
|
|
798
|
+
if (typeof child === 'object' && child !== null) declaration[target] = declarationOf(child);
|
|
799
|
+
}
|
|
800
|
+
if (type === 'optional' || type === 'exact_optional') declaration.optional = true;
|
|
801
|
+
const fallback = read('default'), literal = read('literal');
|
|
802
|
+
if (fallback === null || typeof fallback === 'string' || typeof fallback === 'number' || typeof fallback === 'boolean' || typeof fallback === 'object') declaration.default = structuredClone(fallback);
|
|
803
|
+
if (typeof literal === 'string' || typeof literal === 'number' || typeof literal === 'boolean') declaration.value = literal;
|
|
804
|
+
return declaration;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/** Inspect every defining field, tuple and union without reaching into Valibot; semantic rules remain mandatory. */
|
|
808
|
+
export function schemaDeclaration(schema: GenericSchema): SchemaDeclaration { return declarationOf(schema); }
|
|
809
|
+
|
|
810
|
+
/** Select an existing JSON document field by RFC 6901 pointer; malformed escapes and absent fields refuse. */
|
|
811
|
+
export function schemaAt(document: object, pointer = ''): unknown {
|
|
812
|
+
if (pointer === '') return document;
|
|
813
|
+
if (!pointer.startsWith('/')) throw new Error('Schema pointer must be empty or start with /');
|
|
814
|
+
let value: unknown = document;
|
|
815
|
+
for (const token of pointer.slice(1).split('/')) {
|
|
816
|
+
if (/~(?![01])/u.test(token)) throw new Error('Invalid schema pointer escape');
|
|
817
|
+
const key = token.replaceAll('~1', '/').replaceAll('~0', '~');
|
|
818
|
+
if (typeof value !== 'object' || value === null || !Object.hasOwn(value, key)) throw new Error(`Unknown schema pointer: ${pointer}`);
|
|
819
|
+
value = Reflect.get(value, key);
|
|
820
|
+
}
|
|
821
|
+
return value;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
/** Declarative author composition; named strings resolve only defining format roots. */
|
|
826
|
+
export type NamedJsonComposition = string | GenericSchema
|
|
827
|
+
| { readonly kind: 'number'; readonly finite?: boolean; readonly integer?: boolean; readonly safeInteger?: boolean; readonly min?: number; readonly max?: number }
|
|
828
|
+
| { readonly kind: 'string'; readonly min?: number; readonly max?: number; readonly startsWith?: string; readonly regex?: RegExp }
|
|
829
|
+
| { readonly kind: 'boolean' | 'unknown' | 'null' }
|
|
830
|
+
| { readonly kind: 'literal'; readonly value: string | number | boolean | null }
|
|
831
|
+
| { readonly kind: 'picklist'; readonly values: readonly (string | number)[] }
|
|
832
|
+
| { readonly kind: 'array'; readonly item: NamedJsonComposition; readonly min?: number; readonly max?: number; readonly length?: number }
|
|
833
|
+
| { readonly kind: 'object'; readonly entries: Readonly<Record<string, NamedJsonComposition>>; readonly mode?: 'strict' | 'strip' | 'loose' }
|
|
834
|
+
| { readonly kind: 'tuple'; readonly items: readonly NamedJsonComposition[] }
|
|
835
|
+
| { readonly kind: 'tuple-rest'; readonly items: readonly NamedJsonComposition[]; readonly rest: NamedJsonComposition }
|
|
836
|
+
| { readonly kind: 'record'; readonly key: { readonly kind: 'string'; readonly min?: number; readonly max?: number; readonly startsWith?: string; readonly regex?: RegExp }; readonly value: NamedJsonComposition; readonly maxEntries?: number }
|
|
837
|
+
| { readonly kind: 'union'; readonly options: readonly NamedJsonComposition[] }
|
|
838
|
+
| { readonly kind: 'variant'; readonly key: string; readonly options: readonly NamedJsonComposition[] }
|
|
839
|
+
| { readonly kind: 'nullable' | 'exact-optional'; readonly item: NamedJsonComposition }
|
|
840
|
+
| { readonly kind: 'optional'; readonly item: NamedJsonComposition; readonly default?: object | string | number | boolean | null };
|
|
841
|
+
|
|
842
|
+
type OptionalCompositionKeys<E extends Readonly<Record<string, NamedJsonComposition>>, M extends 'input' | 'output'> = {
|
|
843
|
+
[K in keyof E]: E[K] extends { readonly kind: 'exact-optional' } ? K
|
|
844
|
+
: E[K] extends { readonly kind: 'optional' } ? M extends 'input' ? K : E[K] extends { readonly default: unknown } ? never : K : never
|
|
845
|
+
}[keyof E];
|
|
846
|
+
type CompositionObjectValue<E extends Readonly<Record<string, NamedJsonComposition>>, M extends 'input' | 'output'> = {
|
|
847
|
+
-readonly [K in Exclude<keyof E, OptionalCompositionKeys<E, M>>]: NamedRowValue<E[K], M>
|
|
848
|
+
} & { -readonly [K in OptionalCompositionKeys<E, M>]?: E[K] extends { readonly kind: 'exact-optional'; readonly item: infer I extends NamedJsonComposition } ? NamedRowValue<I, M> : NamedRowValue<E[K], M> };
|
|
849
|
+
type FlattenCompositionObject<T> = { [K in keyof T]: T[K] };
|
|
850
|
+
|
|
851
|
+
/** Mutable native output, retaining tuple lengths, exact optionality and literal
|
|
852
|
+
* discriminants. A named format string stays opaque; an admitted native leaf
|
|
853
|
+
* retains its complete defining output type. */
|
|
854
|
+
export type NamedRowValue<C extends NamedJsonComposition, M extends 'input' | 'output' = 'output'> = NamedJsonComposition extends C ? unknown : C extends GenericSchema ? M extends 'input' ? InferInput<C> : InferOutput<C>
|
|
855
|
+
: C extends { readonly kind: 'number' } ? number
|
|
856
|
+
: C extends { readonly kind: 'string' } ? string
|
|
857
|
+
: C extends { readonly kind: 'boolean' } ? boolean
|
|
858
|
+
: C extends { readonly kind: 'null' } ? null
|
|
859
|
+
: C extends { readonly kind: 'literal'; readonly value: infer L } ? L
|
|
860
|
+
: C extends { readonly kind: 'picklist'; readonly values: readonly (infer L)[] } ? L
|
|
861
|
+
: C extends { readonly kind: 'array'; readonly item: infer I extends NamedJsonComposition } ? NamedRowValue<I, M>[]
|
|
862
|
+
: C extends { readonly kind: 'tuple'; readonly items: infer I extends readonly NamedJsonComposition[] } ? { -readonly [K in keyof I]: NamedRowValue<I[K], M> }
|
|
863
|
+
: C extends { readonly kind: 'tuple-rest'; readonly items: infer I extends readonly NamedJsonComposition[]; readonly rest: infer R extends NamedJsonComposition } ? [...{ -readonly [K in keyof I]: NamedRowValue<I[K], M> }, ...NamedRowValue<R, M>[]]
|
|
864
|
+
: C extends { readonly kind: 'object'; readonly entries: infer E extends Readonly<Record<string, NamedJsonComposition>> } ? C extends { readonly mode: 'loose' } ? FlattenCompositionObject<CompositionObjectValue<E, M>> & Record<string, unknown> : FlattenCompositionObject<CompositionObjectValue<E, M>>
|
|
865
|
+
: C extends { readonly kind: 'record'; readonly value: infer V extends NamedJsonComposition } ? Record<string, NamedRowValue<V, M>>
|
|
866
|
+
: C extends { readonly kind: 'union' | 'variant'; readonly options: infer O extends readonly NamedJsonComposition[] } ? NamedRowValue<O[number], M>
|
|
867
|
+
: C extends { readonly kind: 'nullable'; readonly item: infer I extends NamedJsonComposition } ? NamedRowValue<I, M> | null
|
|
868
|
+
: C extends { readonly kind: 'exact-optional'; readonly item: infer I extends NamedJsonComposition } ? NamedRowValue<I, M> | undefined
|
|
869
|
+
: C extends { readonly kind: 'optional'; readonly item: infer I extends NamedJsonComposition } ? NamedRowValue<I, M> | (M extends 'output' ? C extends { readonly default: unknown } ? never : undefined : undefined)
|
|
870
|
+
: unknown;
|
|
871
|
+
|
|
872
|
+
/** Original assertion input, including native leaves that transform on parse. */
|
|
873
|
+
export type NamedRowInput<C extends NamedJsonComposition> = NamedRowValue<C, 'input'>;
|
|
874
|
+
|
|
875
|
+
function resolveNamedComposition(node: NamedJsonComposition): GenericSchema {
|
|
876
|
+
if (typeof node === 'string') {
|
|
877
|
+
if (!Object.hasOwn(wireRoots, node)) throw new Error(`Unknown named format contract: ${node}`);
|
|
878
|
+
const root = wireRoots[node];
|
|
879
|
+
if (root === undefined) throw new Error(`Missing named format contract: ${node}`);
|
|
880
|
+
return root;
|
|
881
|
+
}
|
|
882
|
+
switch (node.kind) {
|
|
883
|
+
case 'schema': return node;
|
|
884
|
+
case 'number': {
|
|
885
|
+
let schema: GenericSchema<unknown, number> = number();
|
|
886
|
+
if (node.finite === true) schema = pipe(schema, finite());
|
|
887
|
+
if (node.integer === true) schema = pipe(schema, integer());
|
|
888
|
+
if (node.safeInteger === true) schema = pipe(schema, safeInteger());
|
|
889
|
+
if (node.min !== undefined) schema = pipe(schema, minValue(node.min));
|
|
890
|
+
if (node.max !== undefined) schema = pipe(schema, maxValue(node.max));
|
|
891
|
+
return schema;
|
|
892
|
+
}
|
|
893
|
+
case 'string': {
|
|
894
|
+
let schema: GenericSchema<unknown, string> = string();
|
|
895
|
+
if (node.min !== undefined) schema = pipe(schema, minLength(node.min));
|
|
896
|
+
if (node.max !== undefined) schema = pipe(schema, maxLength(node.max));
|
|
897
|
+
if (node.startsWith !== undefined) schema = pipe(schema, startsWith(node.startsWith));
|
|
898
|
+
if (node.regex !== undefined) schema = pipe(schema, sourceRegex(node.regex));
|
|
899
|
+
return schema;
|
|
900
|
+
}
|
|
901
|
+
case 'boolean': return boolean();
|
|
902
|
+
case 'unknown': return unknown();
|
|
903
|
+
case 'null': return nullSchema();
|
|
904
|
+
case 'literal': {
|
|
905
|
+
if (typeof node.value === 'number' && !Number.isFinite(node.value)) throw new Error('Named JSON literal must be finite');
|
|
906
|
+
return node.value === null ? nullSchema() : literalSchema(node.value);
|
|
907
|
+
}
|
|
908
|
+
case 'picklist': return picklist(node.values);
|
|
909
|
+
case 'array': {
|
|
910
|
+
let schema: GenericSchema<unknown, unknown[]> = array(resolveNamedComposition(node.item));
|
|
911
|
+
if (node.min !== undefined) schema = pipe(schema, minLength(node.min));
|
|
912
|
+
if (node.max !== undefined) schema = pipe(schema, maxLength(node.max));
|
|
913
|
+
if (node.length !== undefined) schema = pipe(schema, length(node.length));
|
|
914
|
+
return schema;
|
|
915
|
+
}
|
|
916
|
+
case 'tuple': return tuple(node.items.map(resolveNamedComposition));
|
|
917
|
+
case 'tuple-rest': return tupleWithRest(node.items.map(resolveNamedComposition), resolveNamedComposition(node.rest));
|
|
918
|
+
case 'object': {
|
|
919
|
+
const entries = Object.fromEntries(Object.entries(node.entries).map(([name, item]) => [name, resolveNamedComposition(item)]));
|
|
920
|
+
return node.mode === 'strip' ? object(entries) : node.mode === 'loose' ? looseObject(entries) : strictObject(entries);
|
|
921
|
+
}
|
|
922
|
+
case 'record': {
|
|
923
|
+
const schema = record(resolveNamedComposition(node.key) as GenericSchema<string, string>, resolveNamedComposition(node.value));
|
|
924
|
+
return node.maxEntries === undefined ? schema : pipe(schema, maxEntries(node.maxEntries));
|
|
925
|
+
}
|
|
926
|
+
case 'union': return union(node.options.map(resolveNamedComposition));
|
|
927
|
+
case 'variant': return variant(node.key, node.options.map(resolveNamedComposition) as VariantOptions<string>);
|
|
928
|
+
case 'nullable': return nullable(resolveNamedComposition(node.item));
|
|
929
|
+
case 'exact-optional': return exactOptional(resolveNamedComposition(node.item));
|
|
930
|
+
case 'optional': return optional(resolveNamedComposition(node.item), node.default);
|
|
931
|
+
default: throw new Error('Unknown named row composition');
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/** One compiled source contract, with complete native admission and the exact
|
|
936
|
+
* wire schema from that same grammar. Custom checks stay author-side; asking
|
|
937
|
+
* for their wire schema still refuses unless the defining bridge knows them. */
|
|
938
|
+
export interface NamedRows<T = unknown, I = T> {
|
|
939
|
+
readonly schema: GenericSchema<I, T>;
|
|
940
|
+
readonly jsonSchema: Readonly<Record<string, unknown>>;
|
|
941
|
+
readonly parse: (input: unknown) => T;
|
|
942
|
+
/** Preserve native non-throwing parsed output and complete validation issues. */
|
|
943
|
+
readonly safeParse: (input: unknown) => SafeParseResult<GenericSchema<I, T>>;
|
|
944
|
+
/** Validate and retain the original object, including unknown stripped fields. */
|
|
945
|
+
readonly admit: (input: unknown) => I;
|
|
946
|
+
/** Non-throwing native admission for callers retaining their own error text. */
|
|
947
|
+
readonly accepts: (input: unknown) => input is I;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
/** Compile a source-owned finite grammar once, before validating or emitting
|
|
951
|
+
* any rows. The recursive output mapping mirrors each native compiler branch;
|
|
952
|
+
* no input value is cast to its admitted output type. */
|
|
953
|
+
export function defineNamedRows<const C extends NamedJsonComposition>(composition: C,
|
|
954
|
+
refinement?: (value: NamedRowValue<C>) => boolean, message?: string): NamedRows<NamedRowValue<C>, NamedRowInput<C>> {
|
|
955
|
+
const native = resolveNamedComposition(composition) as GenericSchema<NamedRowInput<C>, NamedRowValue<C>>;
|
|
956
|
+
const schema = refinement === undefined ? native : pipe(native, sourceCheck(refinement, message));
|
|
957
|
+
return { schema, parse: rowsValue => parse(schema, rowsValue), safeParse: rowsValue => sourceSafeParse(schema, rowsValue), admit: rowsValue => { assert(schema, rowsValue); return rowsValue; },
|
|
958
|
+
accepts: (rowsValue): rowsValue is NamedRowInput<C> => sourceIs(schema, rowsValue), get jsonSchema() { return namedJsonSchema(schema); } };
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
/** Compose defining roots and local structural leaves without exporting runtime consumer schemas.
|
|
962
|
+
* Conversion keeps the ordinary unknown-check/transform refusals and never infers a contract from data. */
|
|
963
|
+
export function composeNamedJsonSchema(composition: NamedJsonComposition): Readonly<Record<string, unknown>> {
|
|
964
|
+
return namedJsonSchema(resolveNamedComposition(composition));
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/** Exact defining pure-format objects for checked author compositions. */
|
|
968
|
+
interface AuthorFormatObjects {
|
|
969
|
+
readonly 'nativePhysics.nativeGroundRecordSchema': typeof nativeGroundRecordSchema;
|
|
970
|
+
readonly 'ambientLife.ForagerContinuation': typeof ForagerContinuation;
|
|
971
|
+
readonly 'riding.ClientRidingSessionSchema': typeof ClientRidingSessionSchema;
|
|
972
|
+
readonly 'mountedSpecimenRows.MountedSpecimenSeatSchema': typeof MountedSpecimenSeatSchema;
|
|
973
|
+
readonly 'lootEconomy.ClaimedPickupSchema': typeof ClaimedPickupSchema;
|
|
974
|
+
readonly 'lootBag.LootBagSchema': typeof LootBagSchema;
|
|
975
|
+
readonly 'questContinuation.QuestContinuationSchema': typeof QuestContinuationSchema;
|
|
976
|
+
readonly 'npcs.QuestNpcBindingsSchema': typeof QuestNpcBindingsSchema;
|
|
977
|
+
readonly 'questHost.QuestHostSchema': typeof QuestHostSchema;
|
|
978
|
+
readonly 'speciesBookRows.CreatureGuestSchema': typeof CreatureGuestSchema;
|
|
979
|
+
readonly 'speciesBookRows.SpeciesLookBookSchema': typeof SpeciesLookBookSchema;
|
|
980
|
+
readonly 'paintedLook.PaintedLookSchema': typeof PaintedLookSchema;
|
|
981
|
+
readonly 'materials.MaterialsSchema': typeof MaterialsSchema;
|
|
982
|
+
readonly 'sceneDressing.SceneDressingSchema': typeof SceneDressingSchema;
|
|
983
|
+
readonly 'sceneDressing.SceneScatterPageSchema': typeof SceneScatterPageSchema;
|
|
984
|
+
readonly 'sceneDressing.SceneBakedGeometrySchema': typeof SceneBakedGeometrySchema;
|
|
985
|
+
readonly 'sceneDressing.SceneFloorSchema': typeof SceneFloorSchema;
|
|
986
|
+
readonly 'sceneDressing.SceneDressingContactsSchema': typeof SceneDressingContactsSchema;
|
|
987
|
+
readonly 'specimenCatalogue.SpecimenCatalogueSchema': typeof SpecimenCatalogueSchema;
|
|
988
|
+
readonly 'specimenCatalogue.PackedSpecimenSchema': typeof PackedSpecimenSchema;
|
|
989
|
+
readonly 'specimenCatalogue.SpecimenMaterialSchema': typeof SpecimenMaterialSchema;
|
|
990
|
+
readonly 'specimenCatalogue.SpecimenAssetSchema': typeof SpecimenAssetSchema;
|
|
991
|
+
readonly 'ambientLife.AmbientFlockSchema': typeof AmbientFlockSchema;
|
|
992
|
+
readonly 'ambientLife.AmbientPerchesSchema': typeof AmbientPerchesSchema;
|
|
993
|
+
readonly 'clientChannels.PrivateSceneSchema': typeof PrivateSceneSchema;
|
|
994
|
+
readonly 'collectionDisplay.CollectionDisplaysSchema': typeof CollectionDisplaysSchema;
|
|
995
|
+
readonly 'bodySlots.BodySlotsSchema': typeof BodySlotsSchema;
|
|
996
|
+
readonly 'bakedTiles.BakedTilesSchema': typeof BakedTilesSchema;
|
|
997
|
+
readonly 'populationProjection.PopulationProjectionSchema': typeof PopulationProjectionSchema;
|
|
998
|
+
readonly 'populationProjection.EnemyPlacementsSchema': typeof EnemyPlacementsSchema;
|
|
999
|
+
readonly 'populationKeeper.PopulationKeeperRowsSchema': typeof PopulationKeeperRowsSchema;
|
|
1000
|
+
readonly 'scalarChannel.ScalarTripletSchema': typeof ScalarTripletSchema;
|
|
1001
|
+
readonly 'scalarChannel.ScalarLatticeSchema': typeof ScalarLatticeSchema;
|
|
1002
|
+
readonly 'terrain.GroundRowsSchema': typeof GroundRowsSchema;
|
|
1003
|
+
readonly 'questFigures.KitFigureCardsSchema': typeof KitFigureCardsSchema;
|
|
1004
|
+
readonly 'questFigures.QuestFiguresSchema': typeof QuestFiguresSchema;
|
|
1005
|
+
readonly 'catalogueEconomy.CatalogueEconomySchema': typeof CatalogueEconomySchema;
|
|
1006
|
+
readonly 'minimap.ManifestMetadataSchema': typeof ManifestMetadataSchema;
|
|
1007
|
+
readonly 'islandLibrary.ResolvedIslandLibrarySchema': typeof ResolvedIslandLibrarySchema;
|
|
1008
|
+
readonly 'islandLibrary.FixedGeometryGroupsSchema': typeof FixedGeometryGroupsSchema;
|
|
1009
|
+
readonly 'practiceCourseRows.FixedPracticeFileSchema': typeof FixedPracticeFileSchema;
|
|
1010
|
+
readonly 'mixedPopulation.MixedPopulationSchema': typeof MixedPopulationSchema;
|
|
1011
|
+
readonly 'nativeQuestComposition.NativeQuestCompositionSchema': typeof NativeQuestCompositionSchema;
|
|
1012
|
+
readonly 'namedJsonContracts.HEADLESS_ASSEMBLY_JSON_SCHEMA': typeof HEADLESS_ASSEMBLY_JSON_SCHEMA;
|
|
1013
|
+
readonly 'namedJsonContracts.ReturnProgramSchema': typeof ReturnProgramSchema;
|
|
1014
|
+
readonly 'namedJsonContracts.PageReturnRowsSchema': typeof PageReturnRowsSchema;
|
|
1015
|
+
readonly 'namedJsonContracts.QuestTraderSchema': typeof QuestTraderSchema;
|
|
1016
|
+
readonly 'namedJsonContracts.PosedLibrarySchema': typeof PosedLibrarySchema;
|
|
1017
|
+
readonly 'npcs.QuestPageTalksSchema': typeof QuestPageTalksSchema;
|
|
1018
|
+
readonly 'contracts.ContractBoardPageSchema': typeof ContractBoardPageSchema;
|
|
1019
|
+
readonly 'practiceCourseRows.PracticeSceneSchema': typeof PracticeSceneSchema;
|
|
1020
|
+
readonly 'practiceCourseRows.PracticeControllerSchema': typeof PracticeControllerSchema;
|
|
1021
|
+
readonly 'nativePhysics.nativeBodySchema': typeof nativeBodySchema;
|
|
1022
|
+
readonly 'nativePhysics.nativeColliderRecordSchema': typeof nativeColliderRecordSchema;
|
|
1023
|
+
}
|
|
1024
|
+
const authorFormats: AuthorFormatObjects = {
|
|
1025
|
+
'nativePhysics.nativeGroundRecordSchema': nativeGroundRecordSchema,
|
|
1026
|
+
'ambientLife.ForagerContinuation': ForagerContinuation,
|
|
1027
|
+
'riding.ClientRidingSessionSchema': ClientRidingSessionSchema,
|
|
1028
|
+
'mountedSpecimenRows.MountedSpecimenSeatSchema': MountedSpecimenSeatSchema,
|
|
1029
|
+
'lootEconomy.ClaimedPickupSchema': ClaimedPickupSchema,
|
|
1030
|
+
'lootBag.LootBagSchema': LootBagSchema,
|
|
1031
|
+
'questContinuation.QuestContinuationSchema': QuestContinuationSchema,
|
|
1032
|
+
'npcs.QuestNpcBindingsSchema': QuestNpcBindingsSchema,
|
|
1033
|
+
'questHost.QuestHostSchema': QuestHostSchema,
|
|
1034
|
+
'speciesBookRows.CreatureGuestSchema': CreatureGuestSchema,
|
|
1035
|
+
'speciesBookRows.SpeciesLookBookSchema': SpeciesLookBookSchema,
|
|
1036
|
+
'paintedLook.PaintedLookSchema': PaintedLookSchema,
|
|
1037
|
+
'materials.MaterialsSchema': MaterialsSchema,
|
|
1038
|
+
'sceneDressing.SceneDressingSchema': SceneDressingSchema,
|
|
1039
|
+
'sceneDressing.SceneScatterPageSchema': SceneScatterPageSchema,
|
|
1040
|
+
'sceneDressing.SceneBakedGeometrySchema': SceneBakedGeometrySchema,
|
|
1041
|
+
'sceneDressing.SceneFloorSchema': SceneFloorSchema,
|
|
1042
|
+
'sceneDressing.SceneDressingContactsSchema': SceneDressingContactsSchema,
|
|
1043
|
+
'specimenCatalogue.SpecimenCatalogueSchema': SpecimenCatalogueSchema,
|
|
1044
|
+
'specimenCatalogue.PackedSpecimenSchema': PackedSpecimenSchema,
|
|
1045
|
+
'specimenCatalogue.SpecimenMaterialSchema': SpecimenMaterialSchema,
|
|
1046
|
+
'specimenCatalogue.SpecimenAssetSchema': SpecimenAssetSchema,
|
|
1047
|
+
'ambientLife.AmbientFlockSchema': AmbientFlockSchema,
|
|
1048
|
+
'ambientLife.AmbientPerchesSchema': AmbientPerchesSchema,
|
|
1049
|
+
'clientChannels.PrivateSceneSchema': PrivateSceneSchema,
|
|
1050
|
+
'collectionDisplay.CollectionDisplaysSchema': CollectionDisplaysSchema,
|
|
1051
|
+
'bodySlots.BodySlotsSchema': BodySlotsSchema,
|
|
1052
|
+
'bakedTiles.BakedTilesSchema': BakedTilesSchema,
|
|
1053
|
+
'populationProjection.PopulationProjectionSchema': PopulationProjectionSchema,
|
|
1054
|
+
'populationProjection.EnemyPlacementsSchema': EnemyPlacementsSchema,
|
|
1055
|
+
'populationKeeper.PopulationKeeperRowsSchema': PopulationKeeperRowsSchema,
|
|
1056
|
+
'scalarChannel.ScalarTripletSchema': ScalarTripletSchema,
|
|
1057
|
+
'scalarChannel.ScalarLatticeSchema': ScalarLatticeSchema,
|
|
1058
|
+
'terrain.GroundRowsSchema': GroundRowsSchema,
|
|
1059
|
+
'questFigures.KitFigureCardsSchema': KitFigureCardsSchema,
|
|
1060
|
+
'questFigures.QuestFiguresSchema': QuestFiguresSchema,
|
|
1061
|
+
'catalogueEconomy.CatalogueEconomySchema': CatalogueEconomySchema,
|
|
1062
|
+
'minimap.ManifestMetadataSchema': ManifestMetadataSchema,
|
|
1063
|
+
'islandLibrary.ResolvedIslandLibrarySchema': ResolvedIslandLibrarySchema,
|
|
1064
|
+
'islandLibrary.FixedGeometryGroupsSchema': FixedGeometryGroupsSchema,
|
|
1065
|
+
'practiceCourseRows.FixedPracticeFileSchema': FixedPracticeFileSchema,
|
|
1066
|
+
'mixedPopulation.MixedPopulationSchema': MixedPopulationSchema,
|
|
1067
|
+
'nativeQuestComposition.NativeQuestCompositionSchema': NativeQuestCompositionSchema,
|
|
1068
|
+
'namedJsonContracts.HEADLESS_ASSEMBLY_JSON_SCHEMA': HEADLESS_ASSEMBLY_JSON_SCHEMA,
|
|
1069
|
+
'namedJsonContracts.ReturnProgramSchema': ReturnProgramSchema,
|
|
1070
|
+
'namedJsonContracts.PageReturnRowsSchema': PageReturnRowsSchema,
|
|
1071
|
+
'namedJsonContracts.QuestTraderSchema': QuestTraderSchema,
|
|
1072
|
+
'namedJsonContracts.PosedLibrarySchema': PosedLibrarySchema,
|
|
1073
|
+
'npcs.QuestPageTalksSchema': QuestPageTalksSchema,
|
|
1074
|
+
'contracts.ContractBoardPageSchema': ContractBoardPageSchema,
|
|
1075
|
+
'practiceCourseRows.PracticeSceneSchema': PracticeSceneSchema,
|
|
1076
|
+
'practiceCourseRows.PracticeControllerSchema': PracticeControllerSchema,
|
|
1077
|
+
'nativePhysics.nativeBodySchema': nativeBodySchema,
|
|
1078
|
+
'nativePhysics.nativeColliderRecordSchema': nativeColliderRecordSchema,
|
|
1079
|
+
};
|
|
1080
|
+
/** Select a defining validator, pure grammar factory or structural document by its finite module/export identity.
|
|
1081
|
+
* The original object, exact type, custom checks and metadata identity are retained;
|
|
1082
|
+
* no engine/game runtime binding or unregistered dynamic grammar is borrowed. */
|
|
1083
|
+
export function authorFormatSchema<Name extends keyof AuthorFormatObjects>(name: Name): AuthorFormatObjects[Name] {
|
|
1084
|
+
if (!Object.hasOwn(authorFormats, name)) throw new Error(`Unknown author format: ${name}`);
|
|
1085
|
+
return authorFormats[name];
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
/** Finite validator identities; factories and structural documents are not admission grammars. */
|
|
1089
|
+
type AuthorSchemaName = { [Name in keyof AuthorFormatObjects]: AuthorFormatObjects[Name] extends GenericSchema ? Name : never }[keyof AuthorFormatObjects];
|
|
1090
|
+
|
|
1091
|
+
/** Admit author data through its original defining validator, preserving defaults,
|
|
1092
|
+
* custom checks, transforms and issue ordering. No ad-hoc schema or runtime service is accepted. */
|
|
1093
|
+
export function authorFormatRows<Name extends AuthorSchemaName>(name: Name, rowsValue: unknown): InferOutput<AuthorFormatObjects[Name]> {
|
|
1094
|
+
const schema = authorFormatSchema(name);
|
|
1095
|
+
if (schema.kind !== 'schema') throw new Error('Author admission requires a validator');
|
|
1096
|
+
return parse(schema, rowsValue);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/** Admit every explicitly named catalogue member through its defining format.
|
|
1100
|
+
* Key order and native member defaults/checks remain; missing or extra members refuse. */
|
|
1101
|
+
export function authorCatalogueRows<Name extends AuthorSchemaName, const Keys extends readonly string[]>(name: Name, keys: Keys,
|
|
1102
|
+
rowsValue: unknown): Record<Keys[number], InferOutput<AuthorFormatObjects[Name]>>;
|
|
1103
|
+
export function authorCatalogueRows(name: AuthorSchemaName, keys: readonly string[], rowsValue: unknown): Record<string, unknown> {
|
|
1104
|
+
if (keys.length > 1024 || new Set(keys).size !== keys.length
|
|
1105
|
+
|| keys.some(key => typeof key !== 'string' || key === '' || ['__proto__', 'prototype', 'constructor'].includes(key))) throw new Error('Invalid author catalogue keys');
|
|
1106
|
+
const schema = authorFormatSchema(name);
|
|
1107
|
+
if (schema.kind !== 'schema') throw new Error('Author catalogue requires a validator');
|
|
1108
|
+
const entries = Object.fromEntries<GenericSchema>(keys.map(key => [key, schema]));
|
|
1109
|
+
return parse(strictObject(entries), rowsValue);
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/** Admit authored native collider arrays with the defining shape/provenance
|
|
1113
|
+
* checks and original file-slice storage. No decoding or runtime service. */
|
|
1114
|
+
export function nativeColliderSourceRows<const S extends readonly (1 | 2 | 6 | 9)[]>(rowsValue: unknown, shapes: S,
|
|
1115
|
+
owner: 'piece' | 'tagged'): NativeColliderRecord<S[number], NativeArrayStorage>[] {
|
|
1116
|
+
return parse(array(nativeColliderRecordSchema(shapes, owner, true)), rowsValue);
|
|
1117
|
+
}
|