mapres resolves placeholders by searching through a LayerStack — an ordered collection ofDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/iFamishedX/mapres/llms.txt
Use this file to discover all available pages before exploring further.
Layer objects. Each layer groups one or more maps (DataMap instances or plain dicts) under a name and a numeric priority. When the resolver encounters a placeholder key, it walks the layers from lowest priority number to highest: the first layer that contains the key wins, and all remaining layers serve as progressively lower-priority fallbacks. This lets you compose a rich, multi-source configuration from simple, single-concern maps without any manual merging.
The Layer class
A Layer bundles a list of maps under a name and a priority value:
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | — | Unique identifier for this layer within a LayerStack. |
maps | list | None | None ([]) | Ordered list of DataMap instances or plain dict objects held by this layer. |
priority | int | 0 | Numeric priority controlling resolution order (see Priority ordering). |
add(m)
Append a map to the layer’s internal list after construction:
Layer is also directly iterable — for m in layer yields each map in insertion order.
The LayerStack class
LayerStack manages the full collection of layers and is the object MapResolver operates on:
Methods
add_layer(layer)
Register a Layer. If a layer with the same name already exists it is replaced:
remove_layer(name)
Remove a layer by name (no-op if the name is not present):
get_layer(name)
Retrieve a Layer by name, or None if not found:
clone()
Return a shallow copy of the stack with the same layers. Used internally by MapResolver.res() when extra_maps are provided so the original stack is never mutated:
all_maps()
Yield every map across all layers, sorted by ascending priority (lowest priority number first):
LayerStack.__iter__ delegates to all_maps(), so you can iterate a stack directly.
Priority ordering
Thepriority value is a plain integer — lower numbers are resolved first. A layer with priority=0 is consulted before a layer with priority=10, which is consulted before priority=999.
color it finds "crimson" (from user, priority 0) and stops. font is not in user or theme, so it falls back to defaults and returns "sans-serif".
extra_maps and override_maps
MapResolver.res() exposes two per-call parameters that interact with the LayerStack without mutating it permanently:
extra_maps
When provided, extra_maps are wrapped in a new Layer("extra", ..., priority=999) and appended to a clone of the existing stack. Because priority=999 is very high numerically, these maps act as low-priority fallbacks — consulted only when no existing layer has the key:
override_maps
When provided, override_maps construct a brand-new LayerStack containing only a single Layer("override", ..., priority=0). The resolver’s own self.layers are completely ignored for that call:
| Argument | Existing layers | Priority | Cache used? |
|---|---|---|---|
extra_maps | Kept (clone) | 999 (fallback) | No |
override_maps | Ignored | 0 (only source) | No |