oatschema 0.0.1 → 0.1.0

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.
Files changed (56) hide show
  1. package/AUTHORS +4 -0
  2. package/CHANGELOG.md +17 -0
  3. package/README.md +113 -13
  4. package/THIRD-PARTY-NOTICES +28 -0
  5. package/dist/ajv.d.ts +21 -0
  6. package/dist/ajv.js +28 -0
  7. package/dist/compiled/0.8.0/audio-transcription.js +4 -0
  8. package/dist/compiled/0.8.0/classification.js +4 -0
  9. package/dist/compiled/0.8.0/document-extraction.js +4 -0
  10. package/dist/compiled/0.8.0/embedding.js +4 -0
  11. package/dist/compiled/0.8.0/entity-extraction.js +4 -0
  12. package/dist/compiled/0.8.0/generic.js +4 -0
  13. package/dist/compiled/0.8.0/geolocation.js +4 -0
  14. package/dist/compiled/0.8.0/llm-output.js +4 -0
  15. package/dist/compiled/0.8.0/object-detection.js +4 -0
  16. package/dist/compiled/0.8.0/ranking.js +4 -0
  17. package/dist/compiled/0.8.0/regression.js +4 -0
  18. package/dist/compiled/0.8.0/temporal-segmentation.js +4 -0
  19. package/dist/compiled/index.js +30 -0
  20. package/dist/errors.d.ts +27 -0
  21. package/dist/errors.js +63 -0
  22. package/dist/formats.d.ts +13 -0
  23. package/dist/formats.js +106 -0
  24. package/dist/index.d.ts +6 -45
  25. package/dist/index.js +10 -56
  26. package/dist/names.d.ts +33 -0
  27. package/dist/names.js +33 -0
  28. package/dist/validate/audio-transcription.d.ts +27 -0
  29. package/dist/validate/audio-transcription.js +14 -0
  30. package/dist/validate/classification.d.ts +27 -0
  31. package/dist/validate/classification.js +14 -0
  32. package/dist/validate/document-extraction.d.ts +27 -0
  33. package/dist/validate/document-extraction.js +14 -0
  34. package/dist/validate/embedding.d.ts +27 -0
  35. package/dist/validate/embedding.js +14 -0
  36. package/dist/validate/entity-extraction.d.ts +27 -0
  37. package/dist/validate/entity-extraction.js +14 -0
  38. package/dist/validate/generic.d.ts +27 -0
  39. package/dist/validate/generic.js +14 -0
  40. package/dist/validate/geolocation.d.ts +27 -0
  41. package/dist/validate/geolocation.js +14 -0
  42. package/dist/validate/llm-output.d.ts +27 -0
  43. package/dist/validate/llm-output.js +14 -0
  44. package/dist/validate/object-detection.d.ts +27 -0
  45. package/dist/validate/object-detection.js +14 -0
  46. package/dist/validate/ranking.d.ts +27 -0
  47. package/dist/validate/ranking.js +14 -0
  48. package/dist/validate/regression.d.ts +27 -0
  49. package/dist/validate/regression.js +14 -0
  50. package/dist/validate/temporal-segmentation.d.ts +27 -0
  51. package/dist/validate/temporal-segmentation.js +14 -0
  52. package/dist/validate.d.ts +40 -0
  53. package/dist/validate.js +59 -0
  54. package/dist/validation.d.ts +74 -0
  55. package/dist/validation.js +328 -0
  56. package/package.json +24 -6
@@ -0,0 +1,4 @@
1
+ // SPDX-FileCopyrightText: 2026 The OATS Authors
2
+ // SPDX-FileCopyrightText: 2015-2021 Evgeny Poberezkin
3
+ // SPDX-License-Identifier: Apache-2.0 AND MIT
4
+ import{FORMATS as D,ucs2length as S}from"../../formats.js";const B=x;var G=x;const C={"x-license":{id:"Apache-2.0",notice:"Copyright 2025-2026 The OATS Authors",url:"https://github.com/oatschema/oats/blob/main/LICENSE"},$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://oatschema.org/0.8.0/regression",title:"Regression","x-version":"0.8.0",description:"Represent continuous numerical predictions. Supports point estimates, confidence intervals, and time-series forecasting.",type:"object",properties:{target:{type:"string",description:"The name of or a reference to the variable being predicted (e.g., 'temperature', 'stock_price').",maxLength:256},unit:{type:"string",description:"The unit of measurement.",maxLength:128},producer:{type:"string",description:"The creator (model, tool or author) of this regression.",maxLength:1024},score_explanation:{type:"string",description:"Explanation of the score metric and its semantics (e.g. 'R-squared' or 'Model Confidence').",maxLength:256},points:{type:"array",description:"The regression data points. A single item represents a point estimate; multiple items represent a time series or distribution.",minItems:1,maxItems:1e4,items:{type:"object",description:"A single predicted value.",properties:{value:{description:"The predicted or sampled value. Null represents a missing value, such as a gap in a time series.",anyOf:[{type:"number"},{type:"null"}]},statistic:{type:"string",description:"The statistical nature of this value.",enum:["mean","median","mode","min","max","quantile","sample"]},quantile_level:{type:"number",description:"The quantile level (e.g., 0.95). Required when statistic is 'quantile', and only allowed then.",minimum:0,maximum:1},timestamp:{type:"string",format:"date-time",maxLength:128,description:"The specific time this prediction applies to."},interval_lower:{type:"number",description:"The lower bound of the confidence interval."},interval_upper:{type:"number",description:"The upper bound of the confidence interval. Must not be less than interval_lower."},score:{type:"number",description:"A normalized score for this point (-1.0 to 1.0). Depending on the metric, this may be a probability (0 to 1) or a bipolar metric such as R-squared clipped to [-1, 1]. Use score_explanation to clarify.",minimum:-1,maximum:1},attributes:{type:"object",description:"Arbitrary metadata relevant to this point.",maxProperties:16,propertyNames:{maxLength:128},additionalProperties:{anyOf:[{type:"string",maxLength:1024},{type:"number"},{type:"boolean"},{type:"null"}]}}},required:["value"],allOf:[{if:{properties:{statistic:{const:"quantile"}},required:["statistic"]},then:{required:["quantile_level"]}},{if:{required:["quantile_level"]},then:{properties:{statistic:{const:"quantile"}},required:["statistic"]}}],additionalProperties:!1}},attributes:{type:"object",description:"Arbitrary metadata relevant to this regression.",maxProperties:16,propertyNames:{maxLength:128},additionalProperties:{anyOf:[{type:"string",maxLength:1024},{type:"number"},{type:"boolean"},{type:"null"}]}}},required:["points"],additionalProperties:!1},u=Object.prototype.hasOwnProperty,b=S,M=D["date-time"];function x(l,{instancePath:a="",parentData:K,parentDataProperty:U,rootData:V=l,dynamicAnchors:$={}}={}){let e=null,t=0;const q=x.evaluated;if(q.dynamicProps&&(q.props=void 0),q.dynamicItems&&(q.items=void 0),l&&typeof l=="object"&&!Array.isArray(l)){if(l.points===void 0||!u.call(l,"points")){const o={instancePath:a,schemaPath:"#/required",keyword:"required",params:{missingProperty:"points"}};e===null?e=[o]:e.push(o),t++}for(const o of Object.keys(l))if(!(o==="target"||o==="unit"||o==="producer"||o==="score_explanation"||o==="points"||o==="attributes")){const n={instancePath:a,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o}};e===null?e=[n]:e.push(n),t++}if(l.target!==void 0&&u.call(l,"target")){let o=l.target;if(typeof o=="string"){if(b(o)>256){const n={instancePath:a+"/target",schemaPath:"#/properties/target/maxLength",keyword:"maxLength",params:{limit:256}};e===null?e=[n]:e.push(n),t++}}else{const n={instancePath:a+"/target",schemaPath:"#/properties/target/type",keyword:"type",params:{type:"string"}};e===null?e=[n]:e.push(n),t++}}if(l.unit!==void 0&&u.call(l,"unit")){let o=l.unit;if(typeof o=="string"){if(b(o)>128){const n={instancePath:a+"/unit",schemaPath:"#/properties/unit/maxLength",keyword:"maxLength",params:{limit:128}};e===null?e=[n]:e.push(n),t++}}else{const n={instancePath:a+"/unit",schemaPath:"#/properties/unit/type",keyword:"type",params:{type:"string"}};e===null?e=[n]:e.push(n),t++}}if(l.producer!==void 0&&u.call(l,"producer")){let o=l.producer;if(typeof o=="string"){if(b(o)>1024){const n={instancePath:a+"/producer",schemaPath:"#/properties/producer/maxLength",keyword:"maxLength",params:{limit:1024}};e===null?e=[n]:e.push(n),t++}}else{const n={instancePath:a+"/producer",schemaPath:"#/properties/producer/type",keyword:"type",params:{type:"string"}};e===null?e=[n]:e.push(n),t++}}if(l.score_explanation!==void 0&&u.call(l,"score_explanation")){let o=l.score_explanation;if(typeof o=="string"){if(b(o)>256){const n={instancePath:a+"/score_explanation",schemaPath:"#/properties/score_explanation/maxLength",keyword:"maxLength",params:{limit:256}};e===null?e=[n]:e.push(n),t++}}else{const n={instancePath:a+"/score_explanation",schemaPath:"#/properties/score_explanation/type",keyword:"type",params:{type:"string"}};e===null?e=[n]:e.push(n),t++}}if(l.points!==void 0&&u.call(l,"points")){let o=l.points;if(Array.isArray(o)){if(o.length>1e4){const p={instancePath:a+"/points",schemaPath:"#/properties/points/maxItems",keyword:"maxItems",params:{limit:1e4}};e===null?e=[p]:e.push(p),t++}if(o.length<1){const p={instancePath:a+"/points",schemaPath:"#/properties/points/minItems",keyword:"minItems",params:{limit:1}};e===null?e=[p]:e.push(p),t++}const n=o.length;for(let p=0;p<n;p++){let i=o[p];const y=t;let O=!0;const N=t;if(i&&typeof i=="object"&&!Array.isArray(i)){let r;if((i.statistic===void 0||!u.call(i,"statistic"))&&(r="statistic")){const s={};e===null?e=[s]:e.push(s),t++}else if(i.statistic!==void 0&&u.call(i,"statistic")&&i.statistic!=="quantile"){const s={};e===null?e=[s]:e.push(s),t++}}var j=N===t;if(t=y,e!==null&&(y?e.length=y:e=null),j){const r=t;if(i&&typeof i=="object"&&!Array.isArray(i)&&(i.quantile_level===void 0||!u.call(i,"quantile_level"))){const m={instancePath:a+"/points/"+p,schemaPath:"#/properties/points/items/allOf/0/then/required",keyword:"required",params:{missingProperty:"quantile_level"}};e===null?e=[m]:e.push(m),t++}var j=r===t;O=j}if(!O){const r={instancePath:a+"/points/"+p,schemaPath:"#/properties/points/items/allOf/0/if",keyword:"if",params:{failingKeyword:"then"}};e===null?e=[r]:e.push(r),t++}const k=t;let _=!0;const c=t;if(i&&typeof i=="object"&&!Array.isArray(i)){let r;if((i.quantile_level===void 0||!u.call(i,"quantile_level"))&&(r="quantile_level")){const s={};e===null?e=[s]:e.push(s),t++}}var A=c===t;if(t=k,e!==null&&(k?e.length=k:e=null),A){const r=t;if(i&&typeof i=="object"&&!Array.isArray(i)){if(i.statistic===void 0||!u.call(i,"statistic")){const m={instancePath:a+"/points/"+p,schemaPath:"#/properties/points/items/allOf/1/then/required",keyword:"required",params:{missingProperty:"statistic"}};e===null?e=[m]:e.push(m),t++}if(i.statistic!==void 0&&u.call(i,"statistic")&&i.statistic!=="quantile"){const m={instancePath:a+"/points/"+p+"/statistic",schemaPath:"#/properties/points/items/allOf/1/then/properties/statistic/const",keyword:"const",params:{allowedValue:"quantile"}};e===null?e=[m]:e.push(m),t++}}var A=r===t;if(_=A,_){var w={};w.statistic=!0}}if(!_){const r={instancePath:a+"/points/"+p,schemaPath:"#/properties/points/items/allOf/1/if",keyword:"if",params:{failingKeyword:"then"}};e===null?e=[r]:e.push(r),t++}if(w!==!0&&(w=w||{},w.statistic=!0),i&&typeof i=="object"&&!Array.isArray(i)){if(i.value===void 0||!u.call(i,"value")){const r={instancePath:a+"/points/"+p,schemaPath:"#/properties/points/items/required",keyword:"required",params:{missingProperty:"value"}};e===null?e=[r]:e.push(r),t++}for(const r of Object.keys(i))if(!(r==="value"||r==="statistic"||r==="quantile_level"||r==="timestamp"||r==="interval_lower"||r==="interval_upper"||r==="score"||r==="attributes")){const s={instancePath:a+"/points/"+p,schemaPath:"#/properties/points/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r}};e===null?e=[s]:e.push(s),t++}if(i.value!==void 0&&u.call(i,"value")){let r=i.value;const s=t;let m=!1;const h=t;if(!(typeof r=="number"&&isFinite(r))){const g={instancePath:a+"/points/"+p+"/value",schemaPath:"#/properties/points/items/properties/value/anyOf/0/type",keyword:"type",params:{type:"number"}};e===null?e=[g]:e.push(g),t++}var L=h===t;m=m||L;const d=t;if(r!==null){const g={instancePath:a+"/points/"+p+"/value",schemaPath:"#/properties/points/items/properties/value/anyOf/1/type",keyword:"type",params:{type:"null"}};e===null?e=[g]:e.push(g),t++}var L=d===t;if(m=m||L,m)t=s,e!==null&&(s?e.length=s:e=null);else{const g={instancePath:a+"/points/"+p+"/value",schemaPath:"#/properties/points/items/properties/value/anyOf",keyword:"anyOf",params:Object.assign({},{branchErrors:t-s})};e===null?e=[g]:e.push(g),t++}}if(i.statistic!==void 0&&u.call(i,"statistic")){let r=i.statistic;if(typeof r!="string"){const s={instancePath:a+"/points/"+p+"/statistic",schemaPath:"#/properties/points/items/properties/statistic/type",keyword:"type",params:{type:"string"}};e===null?e=[s]:e.push(s),t++}if(!(r==="mean"||r==="median"||r==="mode"||r==="min"||r==="max"||r==="quantile"||r==="sample")){const s={instancePath:a+"/points/"+p+"/statistic",schemaPath:"#/properties/points/items/properties/statistic/enum",keyword:"enum",params:{allowedValues:C.properties.points.items.properties.statistic.enum}};e===null?e=[s]:e.push(s),t++}}if(i.quantile_level!==void 0&&u.call(i,"quantile_level")){let r=i.quantile_level;if(typeof r=="number"&&isFinite(r)){if(r>1||isNaN(r)){const s={instancePath:a+"/points/"+p+"/quantile_level",schemaPath:"#/properties/points/items/properties/quantile_level/maximum",keyword:"maximum",params:{comparison:"<=",limit:1}};e===null?e=[s]:e.push(s),t++}if(r<0||isNaN(r)){const s={instancePath:a+"/points/"+p+"/quantile_level",schemaPath:"#/properties/points/items/properties/quantile_level/minimum",keyword:"minimum",params:{comparison:">=",limit:0}};e===null?e=[s]:e.push(s),t++}}else{const s={instancePath:a+"/points/"+p+"/quantile_level",schemaPath:"#/properties/points/items/properties/quantile_level/type",keyword:"type",params:{type:"number"}};e===null?e=[s]:e.push(s),t++}}if(i.timestamp!==void 0&&u.call(i,"timestamp")){let r=i.timestamp;if(typeof r=="string"){if(b(r)>128){const s={instancePath:a+"/points/"+p+"/timestamp",schemaPath:"#/properties/points/items/properties/timestamp/maxLength",keyword:"maxLength",params:{limit:128}};e===null?e=[s]:e.push(s),t++}if(!M(r)){const s={instancePath:a+"/points/"+p+"/timestamp",schemaPath:"#/properties/points/items/properties/timestamp/format",keyword:"format",params:{format:"date-time"}};e===null?e=[s]:e.push(s),t++}}else{const s={instancePath:a+"/points/"+p+"/timestamp",schemaPath:"#/properties/points/items/properties/timestamp/type",keyword:"type",params:{type:"string"}};e===null?e=[s]:e.push(s),t++}}if(i.interval_lower!==void 0&&u.call(i,"interval_lower")){let r=i.interval_lower;if(!(typeof r=="number"&&isFinite(r))){const s={instancePath:a+"/points/"+p+"/interval_lower",schemaPath:"#/properties/points/items/properties/interval_lower/type",keyword:"type",params:{type:"number"}};e===null?e=[s]:e.push(s),t++}}if(i.interval_upper!==void 0&&u.call(i,"interval_upper")){let r=i.interval_upper;if(!(typeof r=="number"&&isFinite(r))){const s={instancePath:a+"/points/"+p+"/interval_upper",schemaPath:"#/properties/points/items/properties/interval_upper/type",keyword:"type",params:{type:"number"}};e===null?e=[s]:e.push(s),t++}}if(i.score!==void 0&&u.call(i,"score")){let r=i.score;if(typeof r=="number"&&isFinite(r)){if(r>1||isNaN(r)){const s={instancePath:a+"/points/"+p+"/score",schemaPath:"#/properties/points/items/properties/score/maximum",keyword:"maximum",params:{comparison:"<=",limit:1}};e===null?e=[s]:e.push(s),t++}if(r<-1||isNaN(r)){const s={instancePath:a+"/points/"+p+"/score",schemaPath:"#/properties/points/items/properties/score/minimum",keyword:"minimum",params:{comparison:">=",limit:-1}};e===null?e=[s]:e.push(s),t++}}else{const s={instancePath:a+"/points/"+p+"/score",schemaPath:"#/properties/points/items/properties/score/type",keyword:"type",params:{type:"number"}};e===null?e=[s]:e.push(s),t++}}if(i.attributes!==void 0&&u.call(i,"attributes")){let r=i.attributes;if(r&&typeof r=="object"&&!Array.isArray(r)){if(Object.keys(r).length>16){const s={instancePath:a+"/points/"+p+"/attributes",schemaPath:"#/properties/points/items/properties/attributes/maxProperties",keyword:"maxProperties",params:{limit:16}};e===null?e=[s]:e.push(s),t++}for(const s of Object.keys(r)){const m=t;if(typeof s=="string"&&b(s)>128){const h={instancePath:a+"/points/"+p+"/attributes",schemaPath:"#/properties/points/items/properties/attributes/propertyNames/maxLength",keyword:"maxLength",params:{limit:128},propertyName:s};e===null?e=[h]:e.push(h),t++}var T=m===t;if(!T){const h={instancePath:a+"/points/"+p+"/attributes",schemaPath:"#/properties/points/items/properties/attributes/propertyNames",keyword:"propertyNames",params:{propertyName:s}};e===null?e=[h]:e.push(h),t++}}for(const s of Object.keys(r)){let m=r[s];const h=t;let d=!1;const g=t;if(typeof m=="string"){if(b(m)>1024){const f={instancePath:a+"/points/"+p+"/attributes/"+s.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/points/items/properties/attributes/additionalProperties/anyOf/0/maxLength",keyword:"maxLength",params:{limit:1024}};e===null?e=[f]:e.push(f),t++}}else{const f={instancePath:a+"/points/"+p+"/attributes/"+s.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/points/items/properties/attributes/additionalProperties/anyOf/0/type",keyword:"type",params:{type:"string"}};e===null?e=[f]:e.push(f),t++}var P=g===t;d=d||P;const I=t;if(!(typeof m=="number"&&isFinite(m))){const f={instancePath:a+"/points/"+p+"/attributes/"+s.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/points/items/properties/attributes/additionalProperties/anyOf/1/type",keyword:"type",params:{type:"number"}};e===null?e=[f]:e.push(f),t++}var P=I===t;d=d||P;const E=t;if(typeof m!="boolean"){const f={instancePath:a+"/points/"+p+"/attributes/"+s.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/points/items/properties/attributes/additionalProperties/anyOf/2/type",keyword:"type",params:{type:"boolean"}};e===null?e=[f]:e.push(f),t++}var P=E===t;d=d||P;const R=t;if(m!==null){const f={instancePath:a+"/points/"+p+"/attributes/"+s.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/points/items/properties/attributes/additionalProperties/anyOf/3/type",keyword:"type",params:{type:"null"}};e===null?e=[f]:e.push(f),t++}var P=R===t;if(d=d||P,d)t=h,e!==null&&(h?e.length=h:e=null);else{const f={instancePath:a+"/points/"+p+"/attributes/"+s.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/points/items/properties/attributes/additionalProperties/anyOf",keyword:"anyOf",params:Object.assign({},{branchErrors:t-h})};e===null?e=[f]:e.push(f),t++}}}else{const s={instancePath:a+"/points/"+p+"/attributes",schemaPath:"#/properties/points/items/properties/attributes/type",keyword:"type",params:{type:"object"}};e===null?e=[s]:e.push(s),t++}}}else{const r={instancePath:a+"/points/"+p,schemaPath:"#/properties/points/items/type",keyword:"type",params:{type:"object"}};e===null?e=[r]:e.push(r),t++}}}else{const n={instancePath:a+"/points",schemaPath:"#/properties/points/type",keyword:"type",params:{type:"array"}};e===null?e=[n]:e.push(n),t++}}if(l.attributes!==void 0&&u.call(l,"attributes")){let o=l.attributes;if(o&&typeof o=="object"&&!Array.isArray(o)){if(Object.keys(o).length>16){const n={instancePath:a+"/attributes",schemaPath:"#/properties/attributes/maxProperties",keyword:"maxProperties",params:{limit:16}};e===null?e=[n]:e.push(n),t++}for(const n of Object.keys(o)){const p=t;if(typeof n=="string"&&b(n)>128){const i={instancePath:a+"/attributes",schemaPath:"#/properties/attributes/propertyNames/maxLength",keyword:"maxLength",params:{limit:128},propertyName:n};e===null?e=[i]:e.push(i),t++}var F=p===t;if(!F){const i={instancePath:a+"/attributes",schemaPath:"#/properties/attributes/propertyNames",keyword:"propertyNames",params:{propertyName:n}};e===null?e=[i]:e.push(i),t++}}for(const n of Object.keys(o)){let p=o[n];const i=t;let y=!1;const O=t;if(typeof p=="string"){if(b(p)>1024){const c={instancePath:a+"/attributes/"+n.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/attributes/additionalProperties/anyOf/0/maxLength",keyword:"maxLength",params:{limit:1024}};e===null?e=[c]:e.push(c),t++}}else{const c={instancePath:a+"/attributes/"+n.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/attributes/additionalProperties/anyOf/0/type",keyword:"type",params:{type:"string"}};e===null?e=[c]:e.push(c),t++}var v=O===t;y=y||v;const N=t;if(!(typeof p=="number"&&isFinite(p))){const c={instancePath:a+"/attributes/"+n.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/attributes/additionalProperties/anyOf/1/type",keyword:"type",params:{type:"number"}};e===null?e=[c]:e.push(c),t++}var v=N===t;y=y||v;const k=t;if(typeof p!="boolean"){const c={instancePath:a+"/attributes/"+n.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/attributes/additionalProperties/anyOf/2/type",keyword:"type",params:{type:"boolean"}};e===null?e=[c]:e.push(c),t++}var v=k===t;y=y||v;const _=t;if(p!==null){const c={instancePath:a+"/attributes/"+n.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/attributes/additionalProperties/anyOf/3/type",keyword:"type",params:{type:"null"}};e===null?e=[c]:e.push(c),t++}var v=_===t;if(y=y||v,y)t=i,e!==null&&(i?e.length=i:e=null);else{const c={instancePath:a+"/attributes/"+n.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/attributes/additionalProperties/anyOf",keyword:"anyOf",params:Object.assign({},{branchErrors:t-i})};e===null?e=[c]:e.push(c),t++}}}else{const n={instancePath:a+"/attributes",schemaPath:"#/properties/attributes/type",keyword:"type",params:{type:"object"}};e===null?e=[n]:e.push(n),t++}}}else{const o={instancePath:a,schemaPath:"#/type",keyword:"type",params:{type:"object"}};e===null?e=[o]:e.push(o),t++}return x.errors=e,t===0}x.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};export{G as default,B as validate};
@@ -0,0 +1,4 @@
1
+ // SPDX-FileCopyrightText: 2026 The OATS Authors
2
+ // SPDX-FileCopyrightText: 2015-2021 Evgeny Poberezkin
3
+ // SPDX-License-Identifier: Apache-2.0 AND MIT
4
+ import{FORMATS as O,ucs2length as A}from"../../formats.js";const E=P;var D=P;const j={"x-license":{id:"Apache-2.0",notice:"Copyright 2025-2026 The OATS Authors",url:"https://github.com/oatschema/oats/blob/main/LICENSE"},$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://oatschema.org/0.8.0/temporal-segmentation",title:"Temporal Segmentation","x-version":"0.8.0",description:"Represent labelled time intervals within a media source, such as chapters, scenes, shots, speaker turns or detected events. Segments may overlap, may nest, and need not cover the whole source.",type:"object",properties:{producer:{type:"string",description:"The creator (model, tool or author) of these segments (e.g., 'PySceneDetect', 'pyannote', 'Manual Review').",maxLength:1024},track_id:{type:"string",description:"(Optional) Identifier for the specific audio or video track in the source media. Numeric identifiers are written as strings (e.g., '0').",maxLength:128},duration:{type:"number",description:"The total duration of the source media in seconds. When present, no segment's end_time may exceed it.",minimum:0},vocabulary:{type:"array",description:"A list of the possible segment labels. For more than 100 labels, use 'vocabulary_url'.",maxItems:100,uniqueItems:!0,items:{type:"string",description:"A single valid label from the vocabulary.",maxLength:128}},vocabulary_url:{type:"string",description:"A URL pointing to a more detailed external vocabulary or ontology.",format:"uri",maxLength:2048},score_explanation:{type:"string",description:"Defines the meaning of the 'score' field.",maxLength:256},segments:{type:"array",description:"The labelled time intervals. Can be empty if no segments were found.",maxItems:1e5,items:{type:"object",description:"A single labelled time interval.",properties:{id:{type:"string",description:"An identifier for this segment (e.g., 'scene-12'). Must be unique within the record.",maxLength:128},parent_id:{type:"string",description:"The id of the segment that contains this one (e.g., the chapter containing a scene). Must be the id of another segment in the record, and this segment must lie within its parent's interval.",maxLength:128},group_id:{type:"string",description:"An identifier for the entity this segment belongs to. Segments sharing a group_id belong to the same entity (e.g., all turns of speaker 'SPEAKER_00'). Numeric identifiers, such as diarization cluster numbers, are written as strings (e.g., '0').",maxLength:128},label:{type:"string",description:"The category of the segment (e.g., 'chapter', 'scene', 'speaker', 'explosion'). Must be a member of 'vocabulary' when it is present.",maxLength:128},title:{type:"string",description:"A human-readable name for this segment (e.g., a chapter title).",maxLength:128},description:{type:"string",description:"A description of what happens in this segment.",maxLength:1024},start_time:{type:"number",description:"Segment start time in seconds from the start of the source.",minimum:0},end_time:{type:"number",description:"Segment end time in seconds from the start of the source. Must not be earlier than start_time; equal times mark an instantaneous event.",minimum:0},score:{type:"number",description:"The confidence that the label applies to this interval, ranging from 0.0 (uncertain) to 1.0 (certain).",minimum:0,maximum:1},attributes:{type:"object",description:"Arbitrary metadata relevant to this segment.",maxProperties:16,propertyNames:{maxLength:128},additionalProperties:{anyOf:[{type:"string",maxLength:1024},{type:"number"},{type:"boolean"},{type:"null"}]}}},required:["label","start_time","end_time"],additionalProperties:!1}},attributes:{type:"object",description:"Arbitrary metadata relevant to this record (e.g., annotator, source, job ID).",maxProperties:16,propertyNames:{maxLength:128},additionalProperties:{anyOf:[{type:"string",maxLength:1024},{type:"number"},{type:"boolean"},{type:"null"}]}}},required:["segments"],additionalProperties:!1},m=Object.prototype.hasOwnProperty,y=A,N=O.uri;function P(l,{instancePath:i="",parentData:q,parentDataProperty:I,rootData:S=l,dynamicAnchors:T={}}={}){let e=null,t=0;const k=P.evaluated;if(k.dynamicProps&&(k.props=void 0),k.dynamicItems&&(k.items=void 0),l&&typeof l=="object"&&!Array.isArray(l)){if(l.segments===void 0||!m.call(l,"segments")){const o={instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:"segments"}};e===null?e=[o]:e.push(o),t++}for(const o of Object.keys(l))if(!(o==="producer"||o==="track_id"||o==="duration"||o==="vocabulary"||o==="vocabulary_url"||o==="score_explanation"||o==="segments"||o==="attributes")){const a={instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o}};e===null?e=[a]:e.push(a),t++}if(l.producer!==void 0&&m.call(l,"producer")){let o=l.producer;if(typeof o=="string"){if(y(o)>1024){const a={instancePath:i+"/producer",schemaPath:"#/properties/producer/maxLength",keyword:"maxLength",params:{limit:1024}};e===null?e=[a]:e.push(a),t++}}else{const a={instancePath:i+"/producer",schemaPath:"#/properties/producer/type",keyword:"type",params:{type:"string"}};e===null?e=[a]:e.push(a),t++}}if(l.track_id!==void 0&&m.call(l,"track_id")){let o=l.track_id;if(typeof o=="string"){if(y(o)>128){const a={instancePath:i+"/track_id",schemaPath:"#/properties/track_id/maxLength",keyword:"maxLength",params:{limit:128}};e===null?e=[a]:e.push(a),t++}}else{const a={instancePath:i+"/track_id",schemaPath:"#/properties/track_id/type",keyword:"type",params:{type:"string"}};e===null?e=[a]:e.push(a),t++}}if(l.duration!==void 0&&m.call(l,"duration")){let o=l.duration;if(typeof o=="number"&&isFinite(o)){if(o<0||isNaN(o)){const a={instancePath:i+"/duration",schemaPath:"#/properties/duration/minimum",keyword:"minimum",params:{comparison:">=",limit:0}};e===null?e=[a]:e.push(a),t++}}else{const a={instancePath:i+"/duration",schemaPath:"#/properties/duration/type",keyword:"type",params:{type:"number"}};e===null?e=[a]:e.push(a),t++}}if(l.vocabulary!==void 0&&m.call(l,"vocabulary")){let o=l.vocabulary;if(Array.isArray(o)){if(o.length>100){const s={instancePath:i+"/vocabulary",schemaPath:"#/properties/vocabulary/maxItems",keyword:"maxItems",params:{limit:100}};e===null?e=[s]:e.push(s),t++}const a=o.length;for(let s=0;s<a;s++){let r=o[s];if(typeof r=="string"){if(y(r)>128){const c={instancePath:i+"/vocabulary/"+s,schemaPath:"#/properties/vocabulary/items/maxLength",keyword:"maxLength",params:{limit:128}};e===null?e=[c]:e.push(c),t++}}else{const c={instancePath:i+"/vocabulary/"+s,schemaPath:"#/properties/vocabulary/items/type",keyword:"type",params:{type:"string"}};e===null?e=[c]:e.push(c),t++}}let n=o.length,p;if(n>1){const s={};for(;n--;){let r=o[n];if(typeof r=="string"){if(typeof s[r]=="number"){p=s[r];const c={instancePath:i+"/vocabulary",schemaPath:"#/properties/vocabulary/uniqueItems",keyword:"uniqueItems",params:{i:n,j:p}};e===null?e=[c]:e.push(c),t++;break}s[r]=n}}}}else{const a={instancePath:i+"/vocabulary",schemaPath:"#/properties/vocabulary/type",keyword:"type",params:{type:"array"}};e===null?e=[a]:e.push(a),t++}}if(l.vocabulary_url!==void 0&&m.call(l,"vocabulary_url")){let o=l.vocabulary_url;if(typeof o=="string"){if(y(o)>2048){const a={instancePath:i+"/vocabulary_url",schemaPath:"#/properties/vocabulary_url/maxLength",keyword:"maxLength",params:{limit:2048}};e===null?e=[a]:e.push(a),t++}if(!N(o)){const a={instancePath:i+"/vocabulary_url",schemaPath:"#/properties/vocabulary_url/format",keyword:"format",params:{format:"uri"}};e===null?e=[a]:e.push(a),t++}}else{const a={instancePath:i+"/vocabulary_url",schemaPath:"#/properties/vocabulary_url/type",keyword:"type",params:{type:"string"}};e===null?e=[a]:e.push(a),t++}}if(l.score_explanation!==void 0&&m.call(l,"score_explanation")){let o=l.score_explanation;if(typeof o=="string"){if(y(o)>256){const a={instancePath:i+"/score_explanation",schemaPath:"#/properties/score_explanation/maxLength",keyword:"maxLength",params:{limit:256}};e===null?e=[a]:e.push(a),t++}}else{const a={instancePath:i+"/score_explanation",schemaPath:"#/properties/score_explanation/type",keyword:"type",params:{type:"string"}};e===null?e=[a]:e.push(a),t++}}if(l.segments!==void 0&&m.call(l,"segments")){let o=l.segments;if(Array.isArray(o)){if(o.length>1e5){const n={instancePath:i+"/segments",schemaPath:"#/properties/segments/maxItems",keyword:"maxItems",params:{limit:1e5}};e===null?e=[n]:e.push(n),t++}const a=o.length;for(let n=0;n<a;n++){let p=o[n];if(p&&typeof p=="object"&&!Array.isArray(p)){if(p.label===void 0||!m.call(p,"label")){const s={instancePath:i+"/segments/"+n,schemaPath:"#/properties/segments/items/required",keyword:"required",params:{missingProperty:"label"}};e===null?e=[s]:e.push(s),t++}if(p.start_time===void 0||!m.call(p,"start_time")){const s={instancePath:i+"/segments/"+n,schemaPath:"#/properties/segments/items/required",keyword:"required",params:{missingProperty:"start_time"}};e===null?e=[s]:e.push(s),t++}if(p.end_time===void 0||!m.call(p,"end_time")){const s={instancePath:i+"/segments/"+n,schemaPath:"#/properties/segments/items/required",keyword:"required",params:{missingProperty:"end_time"}};e===null?e=[s]:e.push(s),t++}for(const s of Object.keys(p))if(!m.call(j.properties.segments.items.properties,s)){const r={instancePath:i+"/segments/"+n,schemaPath:"#/properties/segments/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s}};e===null?e=[r]:e.push(r),t++}if(p.id!==void 0&&m.call(p,"id")){let s=p.id;if(typeof s=="string"){if(y(s)>128){const r={instancePath:i+"/segments/"+n+"/id",schemaPath:"#/properties/segments/items/properties/id/maxLength",keyword:"maxLength",params:{limit:128}};e===null?e=[r]:e.push(r),t++}}else{const r={instancePath:i+"/segments/"+n+"/id",schemaPath:"#/properties/segments/items/properties/id/type",keyword:"type",params:{type:"string"}};e===null?e=[r]:e.push(r),t++}}if(p.parent_id!==void 0&&m.call(p,"parent_id")){let s=p.parent_id;if(typeof s=="string"){if(y(s)>128){const r={instancePath:i+"/segments/"+n+"/parent_id",schemaPath:"#/properties/segments/items/properties/parent_id/maxLength",keyword:"maxLength",params:{limit:128}};e===null?e=[r]:e.push(r),t++}}else{const r={instancePath:i+"/segments/"+n+"/parent_id",schemaPath:"#/properties/segments/items/properties/parent_id/type",keyword:"type",params:{type:"string"}};e===null?e=[r]:e.push(r),t++}}if(p.group_id!==void 0&&m.call(p,"group_id")){let s=p.group_id;if(typeof s=="string"){if(y(s)>128){const r={instancePath:i+"/segments/"+n+"/group_id",schemaPath:"#/properties/segments/items/properties/group_id/maxLength",keyword:"maxLength",params:{limit:128}};e===null?e=[r]:e.push(r),t++}}else{const r={instancePath:i+"/segments/"+n+"/group_id",schemaPath:"#/properties/segments/items/properties/group_id/type",keyword:"type",params:{type:"string"}};e===null?e=[r]:e.push(r),t++}}if(p.label!==void 0&&m.call(p,"label")){let s=p.label;if(typeof s=="string"){if(y(s)>128){const r={instancePath:i+"/segments/"+n+"/label",schemaPath:"#/properties/segments/items/properties/label/maxLength",keyword:"maxLength",params:{limit:128}};e===null?e=[r]:e.push(r),t++}}else{const r={instancePath:i+"/segments/"+n+"/label",schemaPath:"#/properties/segments/items/properties/label/type",keyword:"type",params:{type:"string"}};e===null?e=[r]:e.push(r),t++}}if(p.title!==void 0&&m.call(p,"title")){let s=p.title;if(typeof s=="string"){if(y(s)>128){const r={instancePath:i+"/segments/"+n+"/title",schemaPath:"#/properties/segments/items/properties/title/maxLength",keyword:"maxLength",params:{limit:128}};e===null?e=[r]:e.push(r),t++}}else{const r={instancePath:i+"/segments/"+n+"/title",schemaPath:"#/properties/segments/items/properties/title/type",keyword:"type",params:{type:"string"}};e===null?e=[r]:e.push(r),t++}}if(p.description!==void 0&&m.call(p,"description")){let s=p.description;if(typeof s=="string"){if(y(s)>1024){const r={instancePath:i+"/segments/"+n+"/description",schemaPath:"#/properties/segments/items/properties/description/maxLength",keyword:"maxLength",params:{limit:1024}};e===null?e=[r]:e.push(r),t++}}else{const r={instancePath:i+"/segments/"+n+"/description",schemaPath:"#/properties/segments/items/properties/description/type",keyword:"type",params:{type:"string"}};e===null?e=[r]:e.push(r),t++}}if(p.start_time!==void 0&&m.call(p,"start_time")){let s=p.start_time;if(typeof s=="number"&&isFinite(s)){if(s<0||isNaN(s)){const r={instancePath:i+"/segments/"+n+"/start_time",schemaPath:"#/properties/segments/items/properties/start_time/minimum",keyword:"minimum",params:{comparison:">=",limit:0}};e===null?e=[r]:e.push(r),t++}}else{const r={instancePath:i+"/segments/"+n+"/start_time",schemaPath:"#/properties/segments/items/properties/start_time/type",keyword:"type",params:{type:"number"}};e===null?e=[r]:e.push(r),t++}}if(p.end_time!==void 0&&m.call(p,"end_time")){let s=p.end_time;if(typeof s=="number"&&isFinite(s)){if(s<0||isNaN(s)){const r={instancePath:i+"/segments/"+n+"/end_time",schemaPath:"#/properties/segments/items/properties/end_time/minimum",keyword:"minimum",params:{comparison:">=",limit:0}};e===null?e=[r]:e.push(r),t++}}else{const r={instancePath:i+"/segments/"+n+"/end_time",schemaPath:"#/properties/segments/items/properties/end_time/type",keyword:"type",params:{type:"number"}};e===null?e=[r]:e.push(r),t++}}if(p.score!==void 0&&m.call(p,"score")){let s=p.score;if(typeof s=="number"&&isFinite(s)){if(s>1||isNaN(s)){const r={instancePath:i+"/segments/"+n+"/score",schemaPath:"#/properties/segments/items/properties/score/maximum",keyword:"maximum",params:{comparison:"<=",limit:1}};e===null?e=[r]:e.push(r),t++}if(s<0||isNaN(s)){const r={instancePath:i+"/segments/"+n+"/score",schemaPath:"#/properties/segments/items/properties/score/minimum",keyword:"minimum",params:{comparison:">=",limit:0}};e===null?e=[r]:e.push(r),t++}}else{const r={instancePath:i+"/segments/"+n+"/score",schemaPath:"#/properties/segments/items/properties/score/type",keyword:"type",params:{type:"number"}};e===null?e=[r]:e.push(r),t++}}if(p.attributes!==void 0&&m.call(p,"attributes")){let s=p.attributes;if(s&&typeof s=="object"&&!Array.isArray(s)){if(Object.keys(s).length>16){const r={instancePath:i+"/segments/"+n+"/attributes",schemaPath:"#/properties/segments/items/properties/attributes/maxProperties",keyword:"maxProperties",params:{limit:16}};e===null?e=[r]:e.push(r),t++}for(const r of Object.keys(s)){const c=t;if(typeof r=="string"&&y(r)>128){const d={instancePath:i+"/segments/"+n+"/attributes",schemaPath:"#/properties/segments/items/properties/attributes/propertyNames/maxLength",keyword:"maxLength",params:{limit:128},propertyName:r};e===null?e=[d]:e.push(d),t++}var _=c===t;if(!_){const d={instancePath:i+"/segments/"+n+"/attributes",schemaPath:"#/properties/segments/items/properties/attributes/propertyNames",keyword:"propertyNames",params:{propertyName:r}};e===null?e=[d]:e.push(d),t++}}for(const r of Object.keys(s)){let c=s[r];const d=t;let f=!1;const u=t;if(typeof c=="string"){if(y(c)>1024){const h={instancePath:i+"/segments/"+n+"/attributes/"+r.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/segments/items/properties/attributes/additionalProperties/anyOf/0/maxLength",keyword:"maxLength",params:{limit:1024}};e===null?e=[h]:e.push(h),t++}}else{const h={instancePath:i+"/segments/"+n+"/attributes/"+r.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/segments/items/properties/attributes/additionalProperties/anyOf/0/type",keyword:"type",params:{type:"string"}};e===null?e=[h]:e.push(h),t++}var g=u===t;f=f||g;const x=t;if(!(typeof c=="number"&&isFinite(c))){const h={instancePath:i+"/segments/"+n+"/attributes/"+r.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/segments/items/properties/attributes/additionalProperties/anyOf/1/type",keyword:"type",params:{type:"number"}};e===null?e=[h]:e.push(h),t++}var g=x===t;f=f||g;const v=t;if(typeof c!="boolean"){const h={instancePath:i+"/segments/"+n+"/attributes/"+r.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/segments/items/properties/attributes/additionalProperties/anyOf/2/type",keyword:"type",params:{type:"boolean"}};e===null?e=[h]:e.push(h),t++}var g=v===t;f=f||g;const L=t;if(c!==null){const h={instancePath:i+"/segments/"+n+"/attributes/"+r.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/segments/items/properties/attributes/additionalProperties/anyOf/3/type",keyword:"type",params:{type:"null"}};e===null?e=[h]:e.push(h),t++}var g=L===t;if(f=f||g,f)t=d,e!==null&&(d?e.length=d:e=null);else{const h={instancePath:i+"/segments/"+n+"/attributes/"+r.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/segments/items/properties/attributes/additionalProperties/anyOf",keyword:"anyOf",params:Object.assign({},{branchErrors:t-d})};e===null?e=[h]:e.push(h),t++}}}else{const r={instancePath:i+"/segments/"+n+"/attributes",schemaPath:"#/properties/segments/items/properties/attributes/type",keyword:"type",params:{type:"object"}};e===null?e=[r]:e.push(r),t++}}}else{const s={instancePath:i+"/segments/"+n,schemaPath:"#/properties/segments/items/type",keyword:"type",params:{type:"object"}};e===null?e=[s]:e.push(s),t++}}}else{const a={instancePath:i+"/segments",schemaPath:"#/properties/segments/type",keyword:"type",params:{type:"array"}};e===null?e=[a]:e.push(a),t++}}if(l.attributes!==void 0&&m.call(l,"attributes")){let o=l.attributes;if(o&&typeof o=="object"&&!Array.isArray(o)){if(Object.keys(o).length>16){const a={instancePath:i+"/attributes",schemaPath:"#/properties/attributes/maxProperties",keyword:"maxProperties",params:{limit:16}};e===null?e=[a]:e.push(a),t++}for(const a of Object.keys(o)){const n=t;if(typeof a=="string"&&y(a)>128){const p={instancePath:i+"/attributes",schemaPath:"#/properties/attributes/propertyNames/maxLength",keyword:"maxLength",params:{limit:128},propertyName:a};e===null?e=[p]:e.push(p),t++}var w=n===t;if(!w){const p={instancePath:i+"/attributes",schemaPath:"#/properties/attributes/propertyNames",keyword:"propertyNames",params:{propertyName:a}};e===null?e=[p]:e.push(p),t++}}for(const a of Object.keys(o)){let n=o[a];const p=t;let s=!1;const r=t;if(typeof n=="string"){if(y(n)>1024){const u={instancePath:i+"/attributes/"+a.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/attributes/additionalProperties/anyOf/0/maxLength",keyword:"maxLength",params:{limit:1024}};e===null?e=[u]:e.push(u),t++}}else{const u={instancePath:i+"/attributes/"+a.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/attributes/additionalProperties/anyOf/0/type",keyword:"type",params:{type:"string"}};e===null?e=[u]:e.push(u),t++}var b=r===t;s=s||b;const c=t;if(!(typeof n=="number"&&isFinite(n))){const u={instancePath:i+"/attributes/"+a.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/attributes/additionalProperties/anyOf/1/type",keyword:"type",params:{type:"number"}};e===null?e=[u]:e.push(u),t++}var b=c===t;s=s||b;const d=t;if(typeof n!="boolean"){const u={instancePath:i+"/attributes/"+a.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/attributes/additionalProperties/anyOf/2/type",keyword:"type",params:{type:"boolean"}};e===null?e=[u]:e.push(u),t++}var b=d===t;s=s||b;const f=t;if(n!==null){const u={instancePath:i+"/attributes/"+a.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/attributes/additionalProperties/anyOf/3/type",keyword:"type",params:{type:"null"}};e===null?e=[u]:e.push(u),t++}var b=f===t;if(s=s||b,s)t=p,e!==null&&(p?e.length=p:e=null);else{const u={instancePath:i+"/attributes/"+a.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/attributes/additionalProperties/anyOf",keyword:"anyOf",params:Object.assign({},{branchErrors:t-p})};e===null?e=[u]:e.push(u),t++}}}else{const a={instancePath:i+"/attributes",schemaPath:"#/properties/attributes/type",keyword:"type",params:{type:"object"}};e===null?e=[a]:e.push(a),t++}}}else{const o={instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"}};e===null?e=[o]:e.push(o),t++}return P.errors=e,t===0}P.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};export{D as default,E as validate};
@@ -0,0 +1,30 @@
1
+ // SPDX-FileCopyrightText: 2026 The OATS Authors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import v0 from "./0.8.0/audio-transcription.js";
5
+ import v1 from "./0.8.0/classification.js";
6
+ import v2 from "./0.8.0/document-extraction.js";
7
+ import v3 from "./0.8.0/embedding.js";
8
+ import v4 from "./0.8.0/entity-extraction.js";
9
+ import v5 from "./0.8.0/generic.js";
10
+ import v6 from "./0.8.0/geolocation.js";
11
+ import v7 from "./0.8.0/llm-output.js";
12
+ import v8 from "./0.8.0/object-detection.js";
13
+ import v9 from "./0.8.0/ranking.js";
14
+ import v10 from "./0.8.0/regression.js";
15
+ import v11 from "./0.8.0/temporal-segmentation.js";
16
+
17
+ export const COMPILED = new Map([
18
+ ["audio-transcription", new Map([["0.8.0", v0]])],
19
+ ["classification", new Map([["0.8.0", v1]])],
20
+ ["document-extraction", new Map([["0.8.0", v2]])],
21
+ ["embedding", new Map([["0.8.0", v3]])],
22
+ ["entity-extraction", new Map([["0.8.0", v4]])],
23
+ ["generic", new Map([["0.8.0", v5]])],
24
+ ["geolocation", new Map([["0.8.0", v6]])],
25
+ ["llm-output", new Map([["0.8.0", v7]])],
26
+ ["object-detection", new Map([["0.8.0", v8]])],
27
+ ["ranking", new Map([["0.8.0", v9]])],
28
+ ["regression", new Map([["0.8.0", v10]])],
29
+ ["temporal-segmentation", new Map([["0.8.0", v11]])],
30
+ ]);
@@ -0,0 +1,27 @@
1
+ /** Return `text`, cut to at most `limit` characters with a trailing `…` if it is longer. */
2
+ export declare function shorten(text: string, limit: number): string;
3
+ /** Return a short, bounded description of a requested name or version, for an error message. */
4
+ export declare function describe(value: unknown): string;
5
+ /** Thrown when a schema name exists in no bundled version. */
6
+ export declare class UnknownSchemaError extends Error {
7
+ name: string;
8
+ /** The name that was requested, cut to 100 characters if it is a longer string. */
9
+ readonly schemaName: unknown;
10
+ constructor(schemaName: unknown);
11
+ }
12
+ /**
13
+ * Thrown when a schema version is not bundled, or does not contain the requested schema.
14
+ * Versions must be exact, such as `"0.8.0"`; `"0.8"` and `"latest"` are not bundled versions.
15
+ */
16
+ export declare class SchemaLookupError extends Error {
17
+ name: string;
18
+ /** The schema name that was requested. */
19
+ readonly schemaName: string;
20
+ /** The schema version that was requested, cut to 100 characters if it is a longer string. */
21
+ readonly schemaVersion: unknown;
22
+ constructor(schemaName: string, schemaVersion: unknown, message: string);
23
+ }
24
+ /** Return the error for a version that is not bundled. */
25
+ export declare function unbundledVersion(name: string, version: unknown): SchemaLookupError;
26
+ /** Return the error for a bundled version that does not contain the schema. */
27
+ export declare function missingFromVersion(name: string, version: string): SchemaLookupError;
package/dist/errors.js ADDED
@@ -0,0 +1,63 @@
1
+ // SPDX-FileCopyrightText: 2026 The OATS Authors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { SCHEMA_NAMES, SCHEMA_VERSIONS } from "./names.js";
4
+ const DESCRIBE_LIMIT = 100;
5
+ /** Return `text`, cut to at most `limit` characters with a trailing `…` if it is longer. */
6
+ export function shorten(text, limit) {
7
+ if (text.length <= limit) {
8
+ return text;
9
+ }
10
+ let end = limit - 1;
11
+ const last = text.charCodeAt(end - 1);
12
+ if (last >= 0xd800 && last <= 0xdbff) {
13
+ end -= 1;
14
+ }
15
+ return `${text.slice(0, end)}…`;
16
+ }
17
+ /** Return a short, bounded description of a requested name or version, for an error message. */
18
+ export function describe(value) {
19
+ if (typeof value === "string") {
20
+ return JSON.stringify(shorten(value, DESCRIBE_LIMIT));
21
+ }
22
+ if (value === null || ["undefined", "number", "boolean", "bigint"].includes(typeof value)) {
23
+ return shorten(String(value), DESCRIBE_LIMIT);
24
+ }
25
+ return `a value of type ${typeof value}`;
26
+ }
27
+ function bounded(value) {
28
+ return typeof value === "string" ? shorten(value, DESCRIBE_LIMIT) : value;
29
+ }
30
+ /** Thrown when a schema name exists in no bundled version. */
31
+ export class UnknownSchemaError extends Error {
32
+ name = "UnknownSchemaError";
33
+ /** The name that was requested, cut to 100 characters if it is a longer string. */
34
+ schemaName;
35
+ constructor(schemaName) {
36
+ super(`unknown schema name ${describe(schemaName)}; expected one of ${[...SCHEMA_NAMES].sort().join(", ")}`);
37
+ this.schemaName = bounded(schemaName);
38
+ }
39
+ }
40
+ /**
41
+ * Thrown when a schema version is not bundled, or does not contain the requested schema.
42
+ * Versions must be exact, such as `"0.8.0"`; `"0.8"` and `"latest"` are not bundled versions.
43
+ */
44
+ export class SchemaLookupError extends Error {
45
+ name = "SchemaLookupError";
46
+ /** The schema name that was requested. */
47
+ schemaName;
48
+ /** The schema version that was requested, cut to 100 characters if it is a longer string. */
49
+ schemaVersion;
50
+ constructor(schemaName, schemaVersion, message) {
51
+ super(message);
52
+ this.schemaName = bounded(schemaName);
53
+ this.schemaVersion = bounded(schemaVersion);
54
+ }
55
+ }
56
+ /** Return the error for a version that is not bundled. */
57
+ export function unbundledVersion(name, version) {
58
+ return new SchemaLookupError(name, version, `schema version ${describe(version)} is not bundled; available: ${SCHEMA_VERSIONS.join(", ")}`);
59
+ }
60
+ /** Return the error for a bundled version that does not contain the schema. */
61
+ export function missingFromVersion(name, version) {
62
+ return new SchemaLookupError(name, version, `schema ${describe(name)} is not in schema version ${version}`);
63
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Return whether `value` is an RFC 3339 `date-time`, as JSON Schema's `date-time` format requires.
3
+ *
4
+ * The date and time are separated by `T` (or `t`), the offset is `Z` (or `z`) or `±hh:mm`, and the date must exist.
5
+ * A leap second (`:60`) is accepted only at 23:59 UTC, after applying the offset.
6
+ */
7
+ export declare function isDateTime(value: string): boolean;
8
+ /**
9
+ * Return whether `value` is an absolute RFC 3986 URI, as JSON Schema's `uri` format requires.
10
+ *
11
+ * Only ASCII is accepted, so an IRI or a URI with an unencoded space is not a `uri`. An empty path, as in `x:`, is.
12
+ */
13
+ export declare function isUri(value: string): boolean;
@@ -0,0 +1,106 @@
1
+ // SPDX-FileCopyrightText: 2026 The OATS Authors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ const DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:[Zz]|([+-])(\d{2}):(\d{2}))$/;
4
+ const DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
5
+ const UNRESERVED = "A-Za-z0-9\\-._~";
6
+ const SUB_DELIMS = "!$&'()*+,;=";
7
+ const PCT = "%[0-9A-Fa-f]{2}";
8
+ const PCHAR = `(?:[${UNRESERVED}${SUB_DELIMS}:@]|${PCT})`;
9
+ const SEGMENT = `${PCHAR}*`;
10
+ const SEGMENT_NZ = `${PCHAR}+`;
11
+ const H16 = "[0-9A-Fa-f]{1,4}";
12
+ const DEC_OCTET = "(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])";
13
+ const IPV4 = `${DEC_OCTET}(?:\\.${DEC_OCTET}){3}`;
14
+ const LS32 = `(?:${H16}:${H16}|${IPV4})`;
15
+ const IPV6 = [
16
+ `(?:${H16}:){6}${LS32}`,
17
+ `::(?:${H16}:){5}${LS32}`,
18
+ `(?:${H16})?::(?:${H16}:){4}${LS32}`,
19
+ `(?:(?:${H16}:){0,1}${H16})?::(?:${H16}:){3}${LS32}`,
20
+ `(?:(?:${H16}:){0,2}${H16})?::(?:${H16}:){2}${LS32}`,
21
+ `(?:(?:${H16}:){0,3}${H16})?::${H16}:${LS32}`,
22
+ `(?:(?:${H16}:){0,4}${H16})?::${LS32}`,
23
+ `(?:(?:${H16}:){0,5}${H16})?::${H16}`,
24
+ `(?:(?:${H16}:){0,6}${H16})?::`,
25
+ ].join("|");
26
+ const IP_FUTURE = `[vV][0-9A-Fa-f]+\\.[${UNRESERVED}${SUB_DELIMS}:]+`;
27
+ const HOST = `(?:\\[(?:${IPV6}|${IP_FUTURE})\\]|(?:[${UNRESERVED}${SUB_DELIMS}]|${PCT})*)`;
28
+ const AUTHORITY = `(?:(?:[${UNRESERVED}${SUB_DELIMS}:]|${PCT})*@)?${HOST}(?::[0-9]*)?`;
29
+ const HIER_PART = `(?:\\/\\/${AUTHORITY}(?:\\/${SEGMENT})*|\\/(?:${SEGMENT_NZ}(?:\\/${SEGMENT})*)?|${SEGMENT_NZ}(?:\\/${SEGMENT})*)?`;
30
+ const QUERY = `(?:${PCHAR}|[/?])*`;
31
+ const URI = new RegExp(`^[A-Za-z][A-Za-z0-9+\\-.]*:${HIER_PART}(?:\\?${QUERY})?(?:#${QUERY})?$`);
32
+ let checking = true;
33
+ function isLeapYear(year) {
34
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
35
+ }
36
+ /**
37
+ * Return whether `value` is an RFC 3339 `date-time`, as JSON Schema's `date-time` format requires.
38
+ *
39
+ * The date and time are separated by `T` (or `t`), the offset is `Z` (or `z`) or `±hh:mm`, and the date must exist.
40
+ * A leap second (`:60`) is accepted only at 23:59 UTC, after applying the offset.
41
+ */
42
+ export function isDateTime(value) {
43
+ const match = DATE_TIME.exec(value);
44
+ if (match === null) {
45
+ return false;
46
+ }
47
+ const [year, month, day, hour, minute, second] = match.slice(1, 7).map(Number);
48
+ if (month < 1 || month > 12 || day < 1) {
49
+ return false;
50
+ }
51
+ const days = month === 2 && isLeapYear(year) ? 29 : (DAYS_IN_MONTH[month - 1] ?? 0);
52
+ if (day > days || hour > 23 || minute > 59 || second > 60) {
53
+ return false;
54
+ }
55
+ const offsetHour = match[8] === undefined ? 0 : Number(match[8]);
56
+ const offsetMinute = match[9] === undefined ? 0 : Number(match[9]);
57
+ if (offsetHour > 23 || offsetMinute > 59) {
58
+ return false;
59
+ }
60
+ if (second === 60) {
61
+ const sign = match[7] === "-" ? -1 : 1;
62
+ const utc = (((hour * 60 + minute - sign * (offsetHour * 60 + offsetMinute)) % 1440) + 1440) % 1440;
63
+ return utc === 23 * 60 + 59;
64
+ }
65
+ return true;
66
+ }
67
+ /**
68
+ * Return whether `value` is an absolute RFC 3986 URI, as JSON Schema's `uri` format requires.
69
+ *
70
+ * Only ASCII is accepted, so an IRI or a URI with an unencoded space is not a `uri`. An empty path, as in `x:`, is.
71
+ */
72
+ export function isUri(value) {
73
+ return URI.test(value);
74
+ }
75
+ /** @internal */
76
+ export function ucs2length(value) {
77
+ const length = value.length;
78
+ let count = 0;
79
+ for (let index = 0; index < length; index++) {
80
+ const code = value.charCodeAt(index);
81
+ if (code >= 0xd800 && code <= 0xdbff && index + 1 < length) {
82
+ const next = value.charCodeAt(index + 1);
83
+ if (next >= 0xdc00 && next <= 0xdfff) {
84
+ index++;
85
+ }
86
+ }
87
+ count++;
88
+ }
89
+ return count;
90
+ }
91
+ /** @internal */
92
+ export const FORMATS = Object.freeze({
93
+ "date-time": (value) => !checking || isDateTime(value),
94
+ uri: (value) => !checking || isUri(value),
95
+ });
96
+ /** @internal */
97
+ export function withFormats(check, action) {
98
+ const previous = checking;
99
+ checking = check;
100
+ try {
101
+ return action();
102
+ }
103
+ finally {
104
+ checking = previous;
105
+ }
106
+ }
package/dist/index.d.ts CHANGED
@@ -1,26 +1,6 @@
1
- /** The names of the schemas in {@link SCHEMA_VERSION}. Older bundled versions contain a subset of them. */
2
- export declare const SCHEMA_NAMES: readonly [
3
- "audio-transcription",
4
- "classification",
5
- "document-extraction",
6
- "embedding",
7
- "entity-extraction",
8
- "generic",
9
- "geolocation",
10
- "llm-output",
11
- "object-detection",
12
- "ranking",
13
- "regression",
14
- "temporal-segmentation"
15
- ];
16
- /** The name of an OATS schema, such as `"classification"`. */
17
- export type SchemaName = (typeof SCHEMA_NAMES)[number];
18
- /**
19
- * The newest bundled OATS schema version, used when no version is given.
20
- *
21
- * A schema's own version is in its `x-version` keyword.
22
- */
23
- export declare const SCHEMA_VERSION = "0.8.0";
1
+ import { type SchemaName, type SchemaVersion } from "./names.ts";
2
+ export { SchemaLookupError, UnknownSchemaError } from "./errors.ts";
3
+ export { isSchemaVersion, SCHEMA_NAMES, SCHEMA_VERSION, type SchemaName, type SchemaVersion } from "./names.ts";
24
4
  /** A JSON value, as parsed from a schema file. */
25
5
  export type JsonValue = string | number | boolean | null | JsonValue[] | {
26
6
  [key: string]: JsonValue;
@@ -29,27 +9,8 @@ export type JsonValue = string | number | boolean | null | JsonValue[] | {
29
9
  export type Schema = {
30
10
  [key: string]: JsonValue;
31
11
  };
32
- /** Thrown when a schema name exists in no bundled version. */
33
- export declare class UnknownSchemaError extends Error {
34
- name: string;
35
- /** The name that was requested. */
36
- readonly schemaName: unknown;
37
- constructor(schemaName: unknown);
38
- }
39
- /**
40
- * Thrown when a schema version is not bundled, or does not contain the requested schema.
41
- * Versions must be exact, such as `"0.8.0"`; `"0.8"` and `"latest"` are not bundled versions.
42
- */
43
- export declare class SchemaLookupError extends Error {
44
- name: string;
45
- /** The schema name that was requested. */
46
- readonly schemaName: string;
47
- /** The schema version that was requested. */
48
- readonly schemaVersion: unknown;
49
- constructor(schemaName: string, schemaVersion: unknown, message: string);
50
- }
51
12
  /** Return every bundled schema version, oldest first. */
52
- export declare function availableVersions(): string[];
13
+ export declare function availableVersions(): SchemaVersion[];
53
14
  /**
54
15
  * Return the schema `name` from schema version `version`, or from {@link SCHEMA_VERSION} if it is omitted.
55
16
  *
@@ -60,7 +21,7 @@ export declare function availableVersions(): string[];
60
21
  * @throws {UnknownSchemaError} `name` is not a schema in any bundled version.
61
22
  * @throws {SchemaLookupError} `version` is not bundled, or does not contain `name`.
62
23
  */
63
- export declare function getSchema(name: SchemaName, version?: string): Schema;
24
+ export declare function getSchema(name: SchemaName, version?: SchemaVersion): Schema;
64
25
  /**
65
26
  * Return the text of the schema `name` from schema version `version` exactly as released, or from
66
27
  * {@link SCHEMA_VERSION} if `version` is omitted.
@@ -70,4 +31,4 @@ export declare function getSchema(name: SchemaName, version?: string): Schema;
70
31
  * @throws {UnknownSchemaError} `name` is not a schema in any bundled version.
71
32
  * @throws {SchemaLookupError} `version` is not bundled, or does not contain `name`.
72
33
  */
73
- export declare function getSchemaJson(name: SchemaName, version?: string): string;
34
+ export declare function getSchemaJson(name: SchemaName, version?: SchemaVersion): string;
package/dist/index.js CHANGED
@@ -3,79 +3,33 @@
3
3
  /**
4
4
  * The OATS (Open Annotation Task Schemas) JSON schemas, bundled for JavaScript and TypeScript.
5
5
  *
6
+ * Validation is in `oatschema/validate`, and in `oatschema/validate/<name>` for a single schema.
7
+ *
6
8
  * @module
7
9
  */
8
10
  import { BUNDLED } from "./bundled.js";
9
- /** The names of the schemas in {@link SCHEMA_VERSION}. Older bundled versions contain a subset of them. */
10
- export const SCHEMA_NAMES = Object.freeze([
11
- "audio-transcription",
12
- "classification",
13
- "document-extraction",
14
- "embedding",
15
- "entity-extraction",
16
- "generic",
17
- "geolocation",
18
- "llm-output",
19
- "object-detection",
20
- "ranking",
21
- "regression",
22
- "temporal-segmentation",
23
- ]);
24
- /**
25
- * The newest bundled OATS schema version, used when no version is given.
26
- *
27
- * A schema's own version is in its `x-version` keyword.
28
- */
29
- export const SCHEMA_VERSION = "0.8.0";
30
- /** Thrown when a schema name exists in no bundled version. */
31
- export class UnknownSchemaError extends Error {
32
- name = "UnknownSchemaError";
33
- /** The name that was requested. */
34
- schemaName;
35
- constructor(schemaName) {
36
- const known = [...new Set([...BUNDLED.values()].flatMap((names) => [...names.keys()]))].sort();
37
- super(`unknown schema name ${describe(schemaName)}; expected one of ${known.join(", ")}`);
38
- this.schemaName = schemaName;
39
- }
40
- }
41
- /**
42
- * Thrown when a schema version is not bundled, or does not contain the requested schema.
43
- * Versions must be exact, such as `"0.8.0"`; `"0.8"` and `"latest"` are not bundled versions.
44
- */
45
- export class SchemaLookupError extends Error {
46
- name = "SchemaLookupError";
47
- /** The schema name that was requested. */
48
- schemaName;
49
- /** The schema version that was requested. */
50
- schemaVersion;
51
- constructor(schemaName, schemaVersion, message) {
52
- super(message);
53
- this.schemaName = schemaName;
54
- this.schemaVersion = schemaVersion;
55
- }
56
- }
57
- function describe(value) {
58
- return typeof value === "string" ? JSON.stringify(value) : String(value);
59
- }
11
+ import { missingFromVersion, UnknownSchemaError, unbundledVersion } from "./errors.js";
12
+ import { SCHEMA_NAMES, SCHEMA_VERSION, SCHEMA_VERSIONS } from "./names.js";
13
+ export { SchemaLookupError, UnknownSchemaError } from "./errors.js";
14
+ export { isSchemaVersion, SCHEMA_NAMES, SCHEMA_VERSION } from "./names.js";
60
15
  function lookup(name, version) {
61
- const names = [...BUNDLED.values()];
62
- if (typeof name !== "string" || !names.some((schemas) => schemas.has(name))) {
16
+ if (typeof name !== "string" || !SCHEMA_NAMES.includes(name)) {
63
17
  throw new UnknownSchemaError(name);
64
18
  }
65
19
  const resolved = version === undefined ? SCHEMA_VERSION : version;
66
20
  const schemas = typeof resolved === "string" ? BUNDLED.get(resolved) : undefined;
67
21
  if (schemas === undefined) {
68
- throw new SchemaLookupError(name, resolved, `schema version ${describe(resolved)} is not bundled; available: ${[...BUNDLED.keys()].join(", ")}`);
22
+ throw unbundledVersion(name, resolved);
69
23
  }
70
24
  const text = schemas.get(name);
71
25
  if (text === undefined) {
72
- throw new SchemaLookupError(name, resolved, `schema ${describe(name)} is not in schema version ${resolved}`);
26
+ throw missingFromVersion(name, resolved);
73
27
  }
74
28
  return text;
75
29
  }
76
30
  /** Return every bundled schema version, oldest first. */
77
31
  export function availableVersions() {
78
- return [...BUNDLED.keys()];
32
+ return [...SCHEMA_VERSIONS];
79
33
  }
80
34
  /**
81
35
  * Return the schema `name` from schema version `version`, or from {@link SCHEMA_VERSION} if it is omitted.
@@ -0,0 +1,33 @@
1
+ /** The names of the schemas in {@link SCHEMA_VERSION}. Older bundled versions contain a subset of them. */
2
+ export declare const SCHEMA_NAMES: readonly [
3
+ "audio-transcription",
4
+ "classification",
5
+ "document-extraction",
6
+ "embedding",
7
+ "entity-extraction",
8
+ "generic",
9
+ "geolocation",
10
+ "llm-output",
11
+ "object-detection",
12
+ "ranking",
13
+ "regression",
14
+ "temporal-segmentation"
15
+ ];
16
+ /** The name of an OATS schema, such as `"classification"`. */
17
+ export type SchemaName = (typeof SCHEMA_NAMES)[number];
18
+ /** Every bundled schema version, oldest first. */
19
+ export declare const SCHEMA_VERSIONS: readonly ["0.8.0"];
20
+ /** A bundled OATS schema version, such as `"0.8.0"`. */
21
+ export type SchemaVersion = (typeof SCHEMA_VERSIONS)[number];
22
+ /**
23
+ * The newest bundled OATS schema version, used when no version is given.
24
+ *
25
+ * A schema's own version is in its `x-version` keyword.
26
+ */
27
+ export declare const SCHEMA_VERSION: SchemaVersion;
28
+ /**
29
+ * Return whether `value` is a bundled schema version, narrowing it to {@link SchemaVersion}.
30
+ *
31
+ * Use it on a version read from a record before passing it to `getSchema` or a validator.
32
+ */
33
+ export declare function isSchemaVersion(value: unknown): value is SchemaVersion;
package/dist/names.js ADDED
@@ -0,0 +1,33 @@
1
+ // SPDX-FileCopyrightText: 2026 The OATS Authors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ /** The names of the schemas in {@link SCHEMA_VERSION}. Older bundled versions contain a subset of them. */
4
+ export const SCHEMA_NAMES = Object.freeze([
5
+ "audio-transcription",
6
+ "classification",
7
+ "document-extraction",
8
+ "embedding",
9
+ "entity-extraction",
10
+ "generic",
11
+ "geolocation",
12
+ "llm-output",
13
+ "object-detection",
14
+ "ranking",
15
+ "regression",
16
+ "temporal-segmentation",
17
+ ]);
18
+ /** Every bundled schema version, oldest first. */
19
+ export const SCHEMA_VERSIONS = Object.freeze(["0.8.0"]);
20
+ /**
21
+ * The newest bundled OATS schema version, used when no version is given.
22
+ *
23
+ * A schema's own version is in its `x-version` keyword.
24
+ */
25
+ export const SCHEMA_VERSION = "0.8.0";
26
+ /**
27
+ * Return whether `value` is a bundled schema version, narrowing it to {@link SchemaVersion}.
28
+ *
29
+ * Use it on a version read from a record before passing it to `getSchema` or a validator.
30
+ */
31
+ export function isSchemaVersion(value) {
32
+ return typeof value === "string" && SCHEMA_VERSIONS.includes(value);
33
+ }
@@ -0,0 +1,27 @@
1
+ // SPDX-FileCopyrightText: 2026 The OATS Authors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /**
5
+ * Validation of records against the `audio-transcription` OATS schema only, with precompiled validators.
6
+ *
7
+ * @module
8
+ */
9
+
10
+ import type { SchemaVersion } from "../names.js";
11
+ import type { ValidateOptions, Validator } from "../validation.js";
12
+
13
+ export { SchemaLookupError } from "../errors.js";
14
+ export { ValidationError, type ValidationErrorDetails, type ValidateOptions, type Validator } from "../validation.js";
15
+
16
+ /**
17
+ * Return a cached {@link Validator} for the `audio-transcription` schema in schema version `version`, or in
18
+ * `SCHEMA_VERSION` if `version` is omitted.
19
+ *
20
+ * Formats (`date-time`, `uri`, …) are checked unless `options.checkFormats` is `false`.
21
+ *
22
+ * @param version An exact bundled version such as `"0.8.0"`.
23
+ * @param options Validation options.
24
+ * @throws {SchemaLookupError} `version` is not bundled, or does not contain `audio-transcription`.
25
+ * @throws {TypeError} `options` is not an object, has an unknown key, or `checkFormats` is not a boolean.
26
+ */
27
+ export declare function getValidator(version?: SchemaVersion, options?: ValidateOptions): Validator;
@@ -0,0 +1,14 @@
1
+ // SPDX-FileCopyrightText: 2026 The OATS Authors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import v0 from "../compiled/0.8.0/audio-transcription.js";
5
+ import { versionValidator } from "../validation.js";
6
+
7
+ export { SchemaLookupError } from "../errors.js";
8
+ export { ValidationError } from "../validation.js";
9
+
10
+ const VERSIONS = new Map([["0.8.0", v0]]);
11
+
12
+ export function getValidator(version, options) {
13
+ return versionValidator("audio-transcription", VERSIONS, version, options);
14
+ }