full diff

at.tensei.mapping

tensei.at +42 −6
From
bafyreig2bpqv37ks53qr7dslaoedhmgbnquum5yndxhmp7iabxrsxpxrse indexed 2026-10-16 08:32 UTC View this version
To
bafyreig4pmoxl4oqrypl3oicthhd5zs537kge76dut7warmwf3a63mt6vy indexed 2026-10-16 13:31 UTC View this version

Compatibility

breaking 3 breaking changes, 6 non-breaking changes.

Breaking changes (3)
  • RequiredEdgeAdded RequiredEdgeAdded { vertex_id: "at.tensei.mapping#fixedPoint", src: "at.tensei.mapping#fixedPoint", tgt: "at.tensei.mapping#fixedPoint.value", kind: "prop", name: Some("value") }
  • RequiredEdgeAdded RequiredEdgeAdded { vertex_id: "at.tensei.mapping#scale", src: "at.tensei.mapping#scale", tgt: "at.tensei.mapping#scale.min", kind: "prop", name: Some("min") }
  • RequiredEdgeAdded RequiredEdgeAdded { vertex_id: "at.tensei.mapping#scale", src: "at.tensei.mapping#scale", tgt: "at.tensei.mapping#scale.max", kind: "prop", name: Some("max") }
Non-breaking changes (6)
  • AddedVertex AddedVertex { vertex_id: "at.tensei.mapping#fixedPoint" }
  • AddedVertex AddedVertex { vertex_id: "at.tensei.mapping#fixedPoint.value" }
  • AddedVertex AddedVertex { vertex_id: "at.tensei.mapping#mappingField.confidence" }
  • AddedVertex AddedVertex { vertex_id: "at.tensei.mapping#scale.max" }
  • AddedVertex AddedVertex { vertex_id: "at.tensei.mapping#scale.min" }
  • AddedEdge AddedEdge { src: "at.tensei.mapping#mappingField", tgt: "at.tensei.mapping#mappingField.confidence", kind: "prop", name: Some("confidence") }

Migration guidance

Added

  • AddedVertex { vertex_id: "at.tensei.mapping#fixedPoint" }
  • AddedVertex { vertex_id: "at.tensei.mapping#fixedPoint.value" }
  • AddedVertex { vertex_id: "at.tensei.mapping#mappingField.confidence" }
  • AddedVertex { vertex_id: "at.tensei.mapping#scale.max" }
  • AddedVertex { vertex_id: "at.tensei.mapping#scale.min" }

Notes

  • Breaking: RequiredEdgeAdded { vertex_id: "at.tensei.mapping#fixedPoint", src: "at.tensei.mapping#fixedPoint", tgt: "at.tensei.mapping#fixedPoint.value", kind: "prop", name: Some("value") }
  • Breaking: RequiredEdgeAdded { vertex_id: "at.tensei.mapping#scale", src: "at.tensei.mapping#scale", tgt: "at.tensei.mapping#scale.min", kind: "prop", name: Some("min") }
  • Breaking: RequiredEdgeAdded { vertex_id: "at.tensei.mapping#scale", src: "at.tensei.mapping#scale", tgt: "at.tensei.mapping#scale.max", kind: "prop", name: Some("max") }
  • Non-breaking: AddedEdge { src: "at.tensei.mapping#mappingField", tgt: "at.tensei.mapping#mappingField.confidence", kind: "prop", name: Some("confidence") }

Changes

11{
22 "$type": "com.atproto.lexicon.schema",
33 "defs": {
44 "fieldDefinition": {
55 "description": "A field's declared type and authored requiredness (§3.1). `required` is always written; validation supplies no default.",
66 "properties": {
77 "required": {
88 "type": "boolean"
99 },
1010 "type": {
1111 "ref": "#fieldType",
1212 "type": "ref"
1313 }
1414 },
1515 "required": [
1616 "type",
1717 "required"
1818 ],
1919 "type": "object"
2020 },
2121 "fieldType": {
2222 "description": "A declared output type (§3.1). `namespace` is required when `kind` is key and names the key namespace (§3.6).",
2323 "properties": {
2424 "kind": {
2525 "enum": [
2626 "text",
2727 "text[]",
2828 "number",
2929 "bool",
3030 "datetime",
3131 "uri",
3232 "did",
3333 "ref",
3434 "media",
3535 "score",
3636 "key",
3737 "json"
3838 ],
3939 "type": "string"
4040 },
4141 "namespace": {
4242 "ref": "#keyNamespace",
4343 "type": "ref"
4444 }
4545 },
4646 "required": [
4747 "kind"
4848 ],
4949 "type": "object"
5050 },
51 "fixedPoint": {
52 "description": "A number that is not an integer, where no type is declared for it (§1.5): `value` is the number times 10⁶, rounded to six decimal places, so 0.4 is {value: 400000}. An integer is never written this way; it is written as it is. Wherever `$type` names this def, the object is that number. Not stated by the lexicon, and enforced by the reader: it holds no property but `$type` and `value`.",
53 "properties": {
54 "value": {
55 "maximum": 999999999999999,
56 "minimum": -999999999999999,
57 "type": "integer"
58 }
59 },
60 "required": [
61 "value"
62 ],
63 "type": "object"
64 },
5165 "guard": {
52 "description": "A §5 leaf. `field` is a §4.2 source path. `value` is a scalar (a string, a finite number or a boolean; never null or an object), or for in/notIn an array of scalars, and is absent for exists/notExists; the lexicon language has no type for a scalar of any kind, so `value` is not declared.",
66 "description": "A §5 leaf. `field` is a §4.2 source path. `value` is a scalar (a string, an integer, a #fixedPoint for any other number, or a boolean; never null or an object), or for in/notIn an array of scalars, and is absent for exists/notExists; the lexicon language has no type for a scalar of any kind, so `value` is not declared.",
5367 "properties": {
5468 "field": {
5569 "minLength": 1,
5670 "type": "string"
5771 },
5872 "op": {
5973 "ref": "#predicateOp",
6074 "type": "ref"
6175 }
6276 },
6377 "required": [
6478 "field",
6579 "op"
6680 ],
6781 "type": "object"
6882 },
6983 "keyNamespace": {
7084 "enum": [
7185 "isbn",
7286 "olwork",
7387 "goodreads",
7488 "hive",
7589 "tmdb",
7690 "url"
7791 ],
7892 "type": "string"
7993 },
8094 "main": {
8195 "description": "One source collection → user-shaped output (§4.1). Also defines the field, expression and presentation types that at.tensei.pipeline refers to.",
8296 "key": "tid",
8397 "record": {
8498 "properties": {
8599 "createdAt": {
86100 "description": "When the mapping was created: a datetime as §3.1 reads one, which accepts forms atproto's `datetime` format does not, so the format is not declared.",
87101 "type": "string"
88102 },
89103 "guards": {
90104 "description": "§5 predicate leaves over source paths (§4.1); no all/any/not groups.",
91105 "items": {
92106 "ref": "#guard",
93107 "type": "ref"
94108 },
95109 "type": "array"
96110 },
97111 "origin": {
98112 "description": "Present on an adopted copy: the exact version copied (§1.3). Attribution and update-check input; execution never reads it.",
99113 "ref": "#origin",
100114 "type": "ref"
101115 },
102116 "presentation": {
103117 "description": "For a standalone preview and to keep a migrated draft's choices; a pipeline's own presentation is authoritative after downstream edits (§3.8). Its entries must name fields in slots.",
104118 "ref": "#presentation",
105119 "type": "ref"
106120 },
107121 "schema": {
108122 "ref": "#schemaPin",
109123 "type": "ref"
110124 },
111125 "slots": {
112126 "description": "The output fields: an object keyed by field names the user chooses, any non-empty name and not limited to a preset's, each value a #mappingField. The lexicon language has no map type, so the names and values are stated here rather than declared.",
113127 "type": "unknown"
114128 },
115129 "source": {
116130 "description": "The NSID of the collection this mapping reads, and the only place its field names appear.",
117131 "format": "nsid",
118132 "type": "string"
119133 },
120134 "version": {
121135 "const": 1,
122136 "description": "The document version. A document without one is the Phase-2 fixed-preset form, which is migrated explicitly to version 1 (§8.3) and never published as it is.",
123137 "type": "integer"
124138 },
125139 "viewType": {
126140 "description": "The built-in preset this mapping started from, as attribution only. It never adds, limits or requires a field (§3.8).",
127141 "enum": [
128142 "review",
129143 "bookmark"
130144 ],
131145 "type": "string"
132146 }
133147 },
134148 "required": [
135149 "version",
136150 "source",
137151 "slots"
138152 ],
139153 "type": "object"
140154 },
141155 "type": "record"
142156 },
143157 "mappingExpression": {
144 "description": "A source-mapping expression (§4.3): path {path}, constant {value}, operation {op, inputs, args?} or lookup {input, from, to}. Not stated by the lexicon: which properties each kind requires; `value`, any JSON value; `args`, whose count and types each operation fixes (a string separator for split, join and concat, a string find and replacement for replace, an optional string format for parseDate, a finite non-zero divisor for divide, none otherwise); the input count (one, or one or more for coalesce and concat); §4.2 path syntax; and a nesting depth of at most 64 levels.",
158 "description": "A source-mapping expression (§4.3): path {path}, constant {value}, operation {op, inputs, args?} or lookup {input, from, to}. Not stated by the lexicon: which properties each kind requires; `value`, any JSON value, in which a number that is not an integer is a #fixedPoint; `args`, whose count and types each operation fixes (a string separator for split, join and concat, a string find and replacement for replace, an optional string format for parseDate, a non-zero divisor for divide, none otherwise; a number that is not an integer is a #fixedPoint); the input count (one, or one or more for coalesce and concat); §4.2 path syntax; and a nesting depth of at most 64 levels.",
145159 "properties": {
146160 "from": {
147161 "ref": "#keyNamespace",
148162 "type": "ref"
149163 },
150164 "input": {
151165 "ref": "#mappingExpression",
152166 "type": "ref"
153167 },
154168 "inputs": {
155169 "items": {
156170 "ref": "#mappingExpression",
157171 "type": "ref"
158172 },
159173 "type": "array"
160174 },
161175 "kind": {
162176 "enum": [
163177 "path",
164178 "constant",
165179 "operation",
166180 "lookup"
167181 ],
168182 "type": "string"
169183 },
170184 "op": {
171185 "ref": "#operationName",
172186 "type": "ref"
173187 },
174188 "path": {
175189 "minLength": 1,
176190 "type": "string"
177191 },
178192 "to": {
179193 "ref": "#keyNamespace",
180194 "type": "ref"
181195 }
182196 },
183197 "required": [
184198 "kind"
185199 ],
186200 "type": "object"
187201 },
188202 "mappingField": {
189 "description": "One output field of a mapping (§4.1): a #fieldDefinition plus how this source fills it. An unmapped field has no `expr`. `confidence`, a number from 0 to 1, is proposal metadata; the lexicon language has no non-integer number type, so it is not declared.",
203 "description": "One output field of a mapping (§4.1): a #fieldDefinition plus how this source fills it. An unmapped field has no `expr`.",
190204 "properties": {
191205 "by": {
192206 "enum": [
193207 "constraint",
194208 "name",
195209 "stats",
196210 "model",
197211 "human"
198212 ],
199213 "type": "string"
200214 },
215 "confidence": {
216 "description": "Proposal metadata: a number from 0 to 1, in fixed point, the value times 10⁶ (§1.5), as a bare integer: 0.4 is 400000.",
217 "maximum": 1000000,
218 "minimum": 0,
219 "type": "integer"
220 },
201221 "expr": {
202222 "ref": "#mappingExpression",
203223 "type": "ref"
204224 },
205225 "normalization": {
206226 "ref": "#normalization",
207227 "type": "ref"
208228 },
209229 "required": {
210230 "type": "boolean"
211231 },
212232 "type": {
213233 "ref": "#fieldType",
214234 "type": "ref"
215235 }
216236 },
217237 "required": [
218238 "type",
219239 "required"
220240 ],
221241 "type": "object"
222242 },
223243 "normalization": {
224 "description": "Source-specific input normalization (§4.1), not part of the shared field type. A mapped score field needs {kind: score, scale}, a mapped media field {kind: media, mediaKind}, and canonical {namespace} belongs on a uri field only. `scale` is {min, max}, finite numbers with min < max; the lexicon language has no non-integer number type, so they are not declared.",
244 "description": "Source-specific input normalization (§4.1), not part of the shared field type. A mapped score field needs {kind: score, scale}, a mapped media field {kind: media, mediaKind}, and canonical {namespace} belongs on a uri field only.",
225245 "properties": {
226246 "kind": {
227247 "enum": [
228248 "score",
229249 "media",
230250 "canonical"
231251 ],
232252 "type": "string"
233253 },
234254 "mediaKind": {
235255 "enum": [
236256 "blob",
237257 "url"
238258 ],
239259 "type": "string"
240260 },
241261 "namespace": {
242262 "ref": "#keyNamespace",
243263 "type": "ref"
244264 },
245265 "scale": {
246266 "ref": "#scale",
247267 "type": "ref"
248268 }
249269 },
250270 "required": [
251271 "kind"
252272 ],
253273 "type": "object"
254274 },
255275 "operationName": {
256276 "description": "§4.3's closed list of operations. A new operation is a spec change, not an extension point.",
257277 "enum": [
258278 "split",
259279 "join",
260280 "wrap",
261281 "first",
262282 "trim",
263283 "lower",
264284 "replace",
265285 "divide",
266286 "parseDate",
267287 "coalesce",
268288 "concat"
269289 ],
270290 "type": "string"
271291 },
272292 "origin": {
273293 "description": "The original record an independent copy was made from (§1.3, §8.3).",
274294 "properties": {
275295 "cid": {
276296 "description": "The CID of the exact version copied. The `cid` format accepts any spelling of a CID; the validator accepts only the form atproto writes: version 1, in base32, over a SHA-256 digest.",
277297 "format": "cid",
278298 "type": "string"
279299 },
280300 "uri": {
281301 "description": "The record copied. Not stated by the lexicon, and enforced by the validator: exactly at://<DID>/<collection NSID>/<record key>, with a DID rather than a handle for its authority.",
282302 "format": "at-uri",
283303 "type": "string"
284304 }
285305 },
286306 "required": [
287307 "uri",
288308 "cid"
289309 ],
290310 "type": "object"
291311 },
292312 "predicateOp": {
293313 "description": "§5's closed list of operators.",
294314 "enum": [
295315 "eq",
296316 "ne",
297317 "lt",
298318 "lte",
299319 "gt",
300320 "gte",
301321 "contains",
302322 "notContains",
303323 "startsWith",
304324 "matches",
305325 "exists",
306326 "notExists",
307327 "in",
308328 "notIn"
309329 ],
310330 "type": "string"
311331 },
312332 "presentation": {
313333 "description": "How the output is shown (§3.8); it never changes data or requiredness. Entries are unique by `field`, each names a field of the shape it presents, and `display` is allowed on a score field only.",
314334 "properties": {
315335 "fields": {
316336 "items": {
317337 "ref": "#presentationField",
318338 "type": "ref"
319339 },
320340 "type": "array"
321341 },
322342 "layout": {
323343 "enum": [
324344 "list",
325345 "table",
326346 "review",
327347 "bookmark"
328348 ],
329349 "type": "string"
330350 }
331351 },
332352 "required": [
333353 "layout",
334354 "fields"
335355 ],
336356 "type": "object"
337357 },
338358 "presentationField": {
339359 "properties": {
340360 "display": {
341361 "enum": [
342362 "stars5",
343363 "stars10",
344364 "percent",
345365 "raw"
346366 ],
347367 "type": "string"
348368 },
349369 "field": {
350370 "minLength": 1,
351371 "type": "string"
352372 },
353373 "label": {
354374 "type": "string"
355375 },
356376 "visible": {
357377 "type": "boolean"
358378 }
359379 },
360380 "required": [
361381 "field",
362382 "visible"
363383 ],
364384 "type": "object"
365385 },
366386 "scale": {
367 "description": "A source's score scale (§3.4): {min, max}, finite numbers with min < max, not declared because they need not be integers.",
387 "description": "A source's score scale (§3.4), each bound in fixed point, the value times 10⁶ (§1.5), as a bare integer: a scale of 1 to 10 is 1000000 to 10000000. Not stated by the lexicon, and enforced by the validator: min < max.",
388 "properties": {
389 "max": {
390 "maximum": 999999999999999,
391 "minimum": -999999999999999,
392 "type": "integer"
393 },
394 "min": {
395 "maximum": 999999999999999,
396 "minimum": -999999999999999,
397 "type": "integer"
398 }
399 },
400 "required": [
401 "min",
402 "max"
403 ],
368404 "type": "object"
369405 },
370406 "schemaPin": {
371407 "description": "The schema version the mapping was written against (§4.1, §11). Not stated by the lexicon, and enforced by the validator: `nsid` is the mapping's `source`; a published pin has `cid` and no `hash`, an inferred one `hash` and no `cid`.",
372408 "properties": {
373409 "cid": {
374410 "description": "A published pin's version: the CID of the lexicon record. The `cid` format accepts any spelling of a CID; the validator accepts only the form atproto writes: version 1, in base32, over a SHA-256 digest.",
375411 "format": "cid",
376412 "type": "string"
377413 },
378414 "hash": {
379415 "description": "An inferred pin's version: `sha256:` and 64 lowercase hex digits, a form the lexicon language cannot state.",
380416 "minLength": 1,
381417 "type": "string"
382418 },
383419 "nsid": {
384420 "format": "nsid",
385421 "type": "string"
386422 },
387423 "provenance": {
388424 "enum": [
389425 "published",
390426 "inferred"
391427 ],
392428 "type": "string"
393429 },
394430 "resolvedAt": {
395431 "description": "When the version was resolved: a datetime as §3.1 reads one, which accepts forms atproto's `datetime` format does not, so the format is not declared.",
396432 "type": "string"
397433 }
398434 },
399435 "required": [
400436 "nsid",
401437 "provenance"
402438 ],
403439 "type": "object"
404440 }
405441 },
406 "description": "A Tensei mapping, version 1 (spec §4): records of one source collection mapped into output fields the user authors. Built-in presets are starting points, never a contract: any field name is allowed, and a field is mandatory only when the user marks it `required`. Where the lexicon language cannot state a rule the version-1 validator enforces, the property is left permissive here and the rule is named in its description.",
442 "description": "A Tensei mapping, version 1 (spec §4): records of one source collection mapped into output fields the user authors. Built-in presets are starting points, never a contract: any field name is allowed, and a field is mandatory only when the user marks it `required`. The atproto data model has integers only, so a number in the record is an integer written as it is, or any other number in fixed point, the value times 10⁶ (spec §1.5): a bare integer where this lexicon declares it — a #mappingField's `confidence` and a #scale's `min` and `max` — and a #fixedPoint everywhere else. Where the lexicon language cannot state a rule the version-1 validator enforces, the property is left permissive here and the rule is named in its description.",
407443 "id": "at.tensei.mapping",
408444 "lexicon": 1
409445}

Compare other versions