@x12i/reportic-catalog 0.2.3 → 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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { JsonSchema, StudioDiagnostic, Agent, DatasetDefinition, TemplateDocument, Fixture, DatasetSource, DatasetPlanRecord, DatasetRunRecord, DatasetResponseFixture, HostIdentity, Principal, Action, FieldDescriptor, SchemaVersion, AuthoringManifest, Analysis, Mapping } from './types.js';
1
+ import { JsonSchema, StudioDiagnostic, Agent, DatasetDefinition, TemplateDocument, Fixture, DatasetSource, DatasetPlanRecord, DatasetRunRecord, DatasetResponseFixture, HostIdentity, Principal, Action, FieldDescriptor, SchemaVersion, StudioPage, AuthoringManifest, Analysis, Mapping } from './types.js';
2
2
  export { ApprovedOperation, BindingInspection, Compatibility, DatasetAction, DatasetCount, DatasetCoverage, DatasetDiagnostic, DatasetObject, DatasetPlanSummary, DatasetPlanVersion, DatasetPrecision, DatasetProtocol, DatasetRunMetadata, DatasetScope, DatasetTrace, DatasetVerification, Presence, PublishedRevision, ReportAcquisition, RequestSlot, SchemaChange, SourceRevision, StudioAsset, datasetActions } from './types.js';
3
3
  import { compatibility } from './schema.js';
4
4
  export { ProjectionOptions, compareSchemas, fieldAt, inferSchema, isObject, jsonPointer, projectFields, resolveSchemaRef, safeInput, schemaTypes } from './schema.js';
@@ -62,6 +62,12 @@ declare class FileCatalogStorage implements CatalogStorage {
62
62
  transaction<T>(work: (state: CatalogState) => T | Promise<T>): Promise<T>;
63
63
  }
64
64
 
65
+ /** Theme tokens, theme rules and page setup travel with a template. Only plain, bounded values are kept. */
66
+ declare function lookOf(input: any): {
67
+ themeTokens?: Record<string, unknown>;
68
+ themeRules?: Record<string, Record<string, string | number>>;
69
+ page?: StudioPage;
70
+ };
65
71
  declare class CatalogError extends Error {
66
72
  code: string;
67
73
  status: number;
@@ -151,4 +157,4 @@ declare function bindingCandidates(source: string, manifest: AuthoringManifest,
151
157
  alias?: string;
152
158
  }[];
153
159
 
154
- export { Action, Agent, Analysis, type AuditEvent, AuthoringManifest, CatalogError, CatalogService, type CatalogState, type CatalogStorage, DatasetDefinition, DatasetPlanRecord, DatasetResponseFixture, DatasetRunRecord, DatasetSource, FieldDescriptor, FileCatalogStorage, Fixture, HostIdentity, JsonSchema, Mapping, MemoryCatalogStorage, Principal, SchemaVersion, StudioDiagnostic, TemplateDocument, analyzeBindings, assertName, audit, bindingCandidates, canonicalJson, compatibility, createSchemaValidator, digest, emptyState, manifestFor, publishDatasetSchema, schemaReferences, scopeMatch, slotPath, validateSample, validateSchemaDocument, valueAt };
160
+ export { Action, Agent, Analysis, type AuditEvent, AuthoringManifest, CatalogError, CatalogService, type CatalogState, type CatalogStorage, DatasetDefinition, DatasetPlanRecord, DatasetResponseFixture, DatasetRunRecord, DatasetSource, FieldDescriptor, FileCatalogStorage, Fixture, HostIdentity, JsonSchema, Mapping, MemoryCatalogStorage, Principal, SchemaVersion, StudioDiagnostic, StudioPage, TemplateDocument, analyzeBindings, assertName, audit, bindingCandidates, canonicalJson, compatibility, createSchemaValidator, digest, emptyState, lookOf, manifestFor, publishDatasetSchema, schemaReferences, scopeMatch, slotPath, validateSample, validateSchemaDocument, valueAt };
package/dist/index.js CHANGED
@@ -409,6 +409,37 @@ var FileCatalogStorage = class {
409
409
 
410
410
  // packages/reportic-catalog/src/service.ts
411
411
  import { randomUUID } from "crypto";
412
+ function lookOf(input) {
413
+ const out = {};
414
+ const bounded = (value, name) => {
415
+ if (!isObject(value) || Buffer.byteLength(JSON.stringify(value)) > 1e5) throw new CatalogError("INVALID_THEME", name + " must be a small object.");
416
+ return value;
417
+ };
418
+ if (input?.themeTokens !== void 0 && input.themeTokens !== null) out.themeTokens = bounded(input.themeTokens, "Theme tokens");
419
+ if (input?.themeRules !== void 0 && input.themeRules !== null) {
420
+ const rules = bounded(input.themeRules, "Theme rules");
421
+ for (const value of Object.values(rules)) if (!isObject(value) || Object.values(value).some((v) => typeof v !== "string" && typeof v !== "number")) throw new CatalogError("INVALID_THEME", "Theme rules must map selectors to text or number values.");
422
+ out.themeRules = rules;
423
+ }
424
+ if (input?.page !== void 0 && input.page !== null) {
425
+ const page = input.page, next = {};
426
+ if (!isObject(page)) throw new CatalogError("INVALID_PAGE", "Page setup must be an object.");
427
+ if (page.size !== void 0) {
428
+ if (page.size !== "A4" && page.size !== "Letter") throw new CatalogError("INVALID_PAGE", "Page size must be A4 or Letter.");
429
+ next.size = page.size;
430
+ }
431
+ if (page.landscape !== void 0) {
432
+ if (typeof page.landscape !== "boolean") throw new CatalogError("INVALID_PAGE", "Page orientation must be true or false.");
433
+ next.landscape = page.landscape;
434
+ }
435
+ if (page.deck !== void 0) {
436
+ if (page.deck !== "wide" && page.deck !== "standard") throw new CatalogError("INVALID_PAGE", "Slide shape must be wide or standard.");
437
+ next.deck = page.deck;
438
+ }
439
+ out.page = next;
440
+ }
441
+ return out;
442
+ }
412
443
  var CatalogError = class extends Error {
413
444
  constructor(code, message, status = 422, details) {
414
445
  super(message);
@@ -591,7 +622,7 @@ var CatalogService = class {
591
622
  safeInput(input);
592
623
  return this.storage.transaction((state) => {
593
624
  const now = (/* @__PURE__ */ new Date()).toISOString();
594
- const t = { id: "tpl_" + randomUUID().replace(/-/g, ""), workspaceId: p.workspaceId, agentId, name: String(input.name || "Untitled report").slice(0, 200), description: String(input.description || "").slice(0, 2e3), category: String(input.category || "Custom"), color: String(input.color || "sage"), source: String(input.source ?? "# {{reportTitle}}\n\nA clear perspective.\n"), manifest: input.manifest ?? manifestFor(agentId), revision: 1, theme: input.theme ?? "editorial", css: input.css, assets: input.assets ?? {}, fixtureId: void 0, updatedAt: now, updatedBy: p.id, publishedRevisions: [] };
625
+ const t = { id: "tpl_" + randomUUID().replace(/-/g, ""), workspaceId: p.workspaceId, agentId, name: String(input.name || "Untitled report").slice(0, 200), description: String(input.description || "").slice(0, 2e3), category: String(input.category || "Custom"), color: String(input.color || "sage"), source: String(input.source ?? "# {{reportTitle}}\n\nA clear perspective.\n"), manifest: input.manifest ?? manifestFor(agentId), revision: 1, theme: input.theme ?? "editorial", css: input.css, ...lookOf(input), assets: input.assets ?? {}, fixtureId: void 0, updatedAt: now, updatedBy: p.id, publishedRevisions: [] };
595
626
  if (t.manifest.agentId !== agentId || t.manifest.manifestVersion !== 1) throw new CatalogError("MANIFEST_SCOPE_MISMATCH", "The manifest must use the current authorized agent.");
596
627
  if (Buffer.byteLength(t.source) > 1e6) throw new CatalogError("LIMIT_EXCEEDED", "Template exceeds 1 MB.");
597
628
  state.templates.push(t);
@@ -616,6 +647,8 @@ var CatalogService = class {
616
647
  t.manifest = input.manifest;
617
648
  }
618
649
  for (const key of ["name", "description", "category", "theme", "css", "color", "fixtureId"]) if (input[key] !== void 0) t[key] = input[key];
650
+ Object.assign(t, lookOf(input));
651
+ for (const key of ["themeTokens", "themeRules", "page"]) if (input[key] === null) delete t[key];
619
652
  if (input.assets) t.assets = input.assets;
620
653
  t.revision++;
621
654
  t.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
@@ -710,6 +743,7 @@ function analyzeBindings(source, manifest, datasets, components, options = {}) {
710
743
  }
711
744
  if (root === "row") {
712
745
  if (!row) return { missingRoot: true };
746
+ if (row.schema === true) return { unverified: true, inline: true };
713
747
  const itemPath = [name, ...parts].filter(Boolean).join(".");
714
748
  const field = !itemPath ? { path: "", segments: [], types: schemaTypes(row.schema), presence: "required", nullable: schemaTypes(row.schema).includes("null"), addressable: true, schemaPointer: "#", schema: row.schema, label: "Current item", scope: "row", reporticPath: "row" } : fieldAt(row.schema, itemPath, { root: "row", schemaRef: row.schemaRef, registry });
715
749
  return { field, alias: row.alias, ref: row.schemaRef, catalogPath: row.catalogPrefix + (itemPath ? "." + itemPath : "") };
@@ -750,9 +784,11 @@ function analyzeBindings(source, manifest, datasets, components, options = {}) {
750
784
  if (binding.path.startsWith("row") && !slot?.rowSource && !parentRow) result = { state: "incompatible", reason: "There is no local row in this property. Select a collection or use a global path.", score: 0 };
751
785
  else if (slot?.binding === false) result = { state: "incompatible", reason: "This property requires a literal value.", score: 0 };
752
786
  else if (slot && !slot.roots.includes(binding.path.split(".")[0])) result = { state: "incompatible", reason: "This root is not permitted for the selected property.", score: 0 };
753
- else if (resolved.unverified || !slot) result = { state: "unknown", reason: resolved.unverified ? "No variable schema is configured; runtime input validation is required." : "The registry does not establish this property\u2019s expected shape.", score: 25 };
787
+ else if (binding.slot === "when" && resolved.field) result = { state: "compatible", reason: "A when condition may refer to an optional field.", score: 90 };
788
+ else if (resolved.unverified || !slot) result = { state: "unknown", reason: resolved.inline ? "These rows are written in the template, so their fields are checked when the report runs." : resolved.unverified ? "No variable schema is configured; runtime input validation is required." : "The registry does not establish this property\u2019s expected shape.", score: 25 };
754
789
  else if (!resolved.field) result = { state: "incompatible", reason: resolved.missingRoot ? "This dataset or row context is not pinned." : "The exact field is absent from the pinned schema.", score: 0 };
755
790
  else result = compatibility(resolved.field, slot.expected, slot.roles);
791
+ if (binding.guarded && result.state === "conditional") result = { ...result, state: "compatible", reason: "An explicit default or when condition covers the case where this field is missing." };
756
792
  bindings.push({ elementId: entry.id, slot: binding.slot, path: binding.path, range: binding.range, datasetAlias: resolved.alias, schemaRef: resolved.ref, catalogPath: resolved.catalogPath, compatibility: result, field: resolved.field });
757
793
  if (result.state !== "compatible") diagnostics.push({ code: result.state === "incompatible" ? "BINDING_INCOMPATIBLE" : result.state === "conditional" ? "BINDING_CONDITIONAL" : "BINDING_UNVERIFIED", severity: result.state === "incompatible" ? "error" : result.state === "conditional" ? "warning" : "info", phase: "binding", message: result.reason, elementId: entry.id, slot: binding.slot, bindingPath: binding.path, datasetAlias: resolved.alias, schemaRef: resolved.ref, line: binding.range.line, column: binding.range.column, range: binding.range, state: result.state, guidance: result.state === "incompatible" ? "Review this binding in the property inspector." : "Verify an approved fixture or supply an explicit runtime fallback." });
758
794
  };
@@ -848,6 +884,7 @@ export {
848
884
  inferSchema,
849
885
  isObject,
850
886
  jsonPointer,
887
+ lookOf,
851
888
  manifestFor,
852
889
  projectFields,
853
890
  publishDatasetSchema,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schema.ts","../src/validation.ts","../src/store.ts","../src/service.ts","../src/analysis.ts","../src/dataset-types.ts"],"sourcesContent":["import type{JsonSchema,FieldDescriptor,Presence,Compatibility,SchemaChange}from'./types.js';\nconst unsafe=new Set(['__proto__','constructor','prototype']);\nexport const isObject=(v:any):v is Record<string,any>=>v!==null&&typeof v==='object'&&!Array.isArray(v);\nexport const jsonPointer=(s:string)=>s.replace(/~/g,'~0').replace(/\\//g,'~1');\nexport function safeInput(value:any,depth=0):void{if(depth>48)throw new Error('Input exceeds the depth limit.');if(Array.isArray(value)){if(value.length>10000)throw new Error('Collection exceeds 10,000 items.');value.forEach(v=>safeInput(v,depth+1));}else if(isObject(value)){for(const[k,v]of Object.entries(value)){if(unsafe.has(k))throw new Error('Prototype keys are not allowed.');safeInput(v,depth+1);}}}\nexport function schemaTypes(schema:JsonSchema):string[]{if(schema===true)return['unknown'];if(schema===false)return['never'];if(schema.type)return Array.isArray(schema.type)?schema.type:[schema.type];if(Object.hasOwn(schema,'const'))return[valueType(schema.const)];if(schema.enum)return[...new Set(schema.enum.map(valueType))] as string[];if(schema.properties)return['object'];if(schema.items||schema.prefixItems)return['array'];if(schema.anyOf||schema.oneOf)return[...new Set((schema.anyOf ?? schema.oneOf).flatMap(schemaTypes))] as string[];if(schema.allOf){const groups=schema.allOf.map(schemaTypes).filter((g:string[])=>!g.includes('unknown'));return groups.length?groups.reduce((a:string[],b:string[])=>a.filter(t=>b.includes(t)||(t==='integer'&&b.includes('number')))) :['unknown'];}return['unknown'];}\nconst valueType=(v:any):string=>v===null?'null':Array.isArray(v)?'array':typeof v==='number'?(Number.isInteger(v)?'integer':'number'):typeof v;\nexport type ProjectionOptions={root?:'dataSets'|'variables'|'row';alias?:string;datasetId?:string;schemaRef?:string;registry?:Record<string,JsonSchema>;maxDepth?:number};\nexport function resolveSchemaRef(ref:string,document:JsonSchema,registry:Record<string,JsonSchema>={}):JsonSchema|undefined{\n const split=ref.indexOf('#'),base=split<0?ref:ref.slice(0,split),fragment=split<0?'':ref.slice(split+1);let target:any=base?registry[base]:document;if(target===undefined)return;\n if(!fragment)return target;if(fragment.startsWith('/')){for(const raw of fragment.slice(1).split('/')){const key=decodeURIComponent(raw).replace(/~1/g,'/').replace(/~0/g,'~');if(unsafe.has(key)||!isObject(target)&&!Array.isArray(target)||!Object.hasOwn(target,key))return;target=(target as any)[key];}return target;}\n let found:any;const walk=(v:any)=>{if(!isObject(v)||found)return;if(v.$anchor===fragment||v.$dynamicAnchor===fragment){found=v;return;}Object.values(v).forEach(child=>{if(Array.isArray(child))child.forEach(walk);else walk(child);});};walk(target);return found;\n}\ntype Variant={schema:JsonSchema;pointer:string;conditional:boolean;recursive?:boolean};\nfunction variants(schema:JsonSchema,root:JsonSchema,registry:Record<string,JsonSchema>,pointer='#',seen=new Set<string>(),depth=0):Variant[]{\n if(depth>24)return[{schema:true,pointer,conditional:true,recursive:true}];if(typeof schema==='boolean')return[{schema,pointer,conditional:false}];\n if(schema.$dynamicRef)return[{schema:true,pointer,conditional:true,recursive:true}];\n if(schema.$ref){if(seen.has(schema.$ref))return[{schema:true,pointer,conditional:true,recursive:true}];const target=resolveSchemaRef(schema.$ref,root,registry);if(target===undefined)return[{schema:true,pointer,conditional:true}];const next=new Set(seen).add(schema.$ref);const base=schema.$ref.split('#')[0];return variants(target,base?registry[base]??root:root,registry,schema.$ref,next,depth+1).map(v=>({...v,schema:mergeSchemas(v.schema,Object.fromEntries(Object.entries(schema).filter(([k])=>k!=='$ref')))}));}\n const own={...schema};delete own.anyOf;delete own.oneOf;delete own.allOf;\n let result:Variant[]=[{schema:own,pointer,conditional:!!(schema.if||schema.dependentSchemas||schema.not)}];\n if(schema.allOf)for(let i=0;i<schema.allOf.length;i++){const branches=variants(schema.allOf[i],root,registry,`${pointer}/allOf/${i}`,seen,depth+1);result=result.flatMap(a=>branches.map(b=>({schema:mergeSchemas(a.schema,b.schema),pointer:a.pointer,conditional:a.conditional||b.conditional,recursive:a.recursive||b.recursive}))).slice(0,64);}\n const union=schema.anyOf ?? schema.oneOf;if(union)result=result.flatMap(a=>union.flatMap((s:any,i:number)=>variants(s,root,registry,`${pointer}/${schema.anyOf?'anyOf':'oneOf'}/${i}`,seen,depth+1).map(b=>({schema:mergeSchemas(a.schema,b.schema),pointer:b.pointer,conditional:a.conditional||b.conditional,recursive:b.recursive})))).slice(0,64);\n return result;\n}\nfunction mergeSchemas(a:JsonSchema,b:JsonSchema):JsonSchema{if(a===false||b===false)return false;if(a===true)return b;if(b===true)return a;const out:any={...a,...b};if(a.type&&b.type){const ta=schemaTypes(a),tb=schemaTypes(b);const types=ta.filter(t=>tb.includes(t)||(t==='integer'&&tb.includes('number'))).concat(tb.filter(t=>t==='integer'&&ta.includes('number')));if(!types.length)return false;out.type=[...new Set(types)];}if(a.properties||b.properties){out.properties={...a.properties};for(const[k,v]of Object.entries(b.properties ?? {}))out.properties[k]=a.properties?.[k]?mergeSchemas(a.properties[k],v as any):v;}if(a.required||b.required)out.required=[...new Set([...(a.required??[]),...(b.required??[])])];return out;}\nfunction combine(schemas:JsonSchema[]):JsonSchema{if(schemas.length===1)return schemas[0];return{anyOf:schemas};}\nfunction qualifyReferences(value:any,base:string,depth=0):any{if(depth>48)return true;if(Array.isArray(value))return value.map(v=>qualifyReferences(v,base,depth+1));if(!isObject(value))return value;const current=typeof value.$id==='string'?value.$id:base;return Object.fromEntries(Object.entries(value).map(([key,v])=>[key,(key==='$ref'||key==='$dynamicRef')&&typeof v==='string'&&v.startsWith('#')?current+v:qualifyReferences(v,current,depth+1)]));}\nexport function projectFields(schema:JsonSchema,options:ProjectionOptions={}):FieldDescriptor[]{\n const root=options.root ?? 'dataSets',registry:Record<string,JsonSchema>=Object.fromEntries(Object.entries(options.registry??{}).map(([ref,document])=>[ref,qualifyReferences(document,ref)])),result:FieldDescriptor[]=[];\n const base=options.schemaRef??(isObject(schema)&&typeof schema.$id==='string'?schema.$id:'reportic.projection.root');schema=qualifyReferences(schema,base);registry[base]??=schema;\n const walk=(current:JsonSchema,segments:string[],pointer:string,parentPresence:Presence,collectionPath?:string,depth=0,ancestry=new Set<JsonSchema>())=>{\n if(depth>(options.maxDepth ?? 12))return;const branches=variants(current,schema,registry,pointer),objects=branches.filter(v=>isObject(v.schema));const keys=new Set(objects.flatMap(v=>Object.keys((v.schema as any).properties ?? {})));\n for(const key of keys){const candidates=objects.filter(v=>Object.hasOwn((v.schema as any).properties ?? {},key));const schemas=candidates.map(v=>(v.schema as any).properties[key] as JsonSchema);const combined=combine(schemas),types=[...new Set(schemas.flatMap(s=>variants(s,schema,registry).flatMap(v=>schemaTypes(v.schema))))];const conditional=candidates.length!==branches.length||candidates.some(v=>v.conditional);const locallyRequired=candidates.length===branches.length&&candidates.every(v=>((v.schema as any).required ?? []).includes(key));\n const presence:Presence=parentPresence==='conditional'||conditional?'conditional':parentPresence==='optional'||!locallyRequired?'optional':parentPresence==='unknown'?'unknown':'required';\n const pathParts=[...segments,key],path=pathParts.join('.').replace(/\\.\\[\\]/g,'[]');const addressable=pathParts.every(p=>p==='[]'||/^[A-Za-z0-9_-]+$/.test(p)&&!unsafe.has(p))&&!collectionPath;\n const shape=isObject(schemas[0])?schemas[0]:{};const prefix=root==='dataSets'?`dataSets.${options.alias ?? 'dataset'}`:root;\n const expanded=variants(combined,schema,registry,pointer+'/properties/'+jsonPointer(key));const recursive=expanded.some(v=>v.recursive);const itemSchemas=expanded.filter(v=>isObject(v.schema)&&v.schema.items!==undefined).map(v=>(v.schema as any).items as JsonSchema);const itemSchema=itemSchemas.length?combine(itemSchemas):undefined;\n const field:FieldDescriptor={path,segments:pathParts,reporticPath:addressable?prefix+'.'+path:undefined,schemaPointer:pointer+'/properties/'+jsonPointer(key),types,presence,nullable:types.includes('null'),addressable,reason:collectionPath?'Item fields need an explicit row scope from '+collectionPath:!addressable?'This property name is not representable by Reportic’s exact dot-path grammar.':recursive?'Recursive shape; deeper paths require runtime validation.':undefined,description:shape.description,label:shape['x-reportic-label']??shape.title??key.replace(/([a-z])([A-Z])/g,'$1 $2').replace(/[_-]/g,' '),format:shape.format,role:shape['x-reportic-role'],unit:shape['x-reportic-unit'],sensitivity:shape['x-reportic-sensitivity'],schema:combined,itemSchema,datasetId:options.datasetId,schemaRef:options.schemaRef,scope:root,collectionPath,conditional,recursive};\n result.push(field);if(!recursive&&!ancestry.has(combined)){const next=new Set(ancestry).add(combined);if(types.includes('object'))walk(combined,pathParts,field.schemaPointer,presence,collectionPath,depth+1,next);if(types.includes('array')&&itemSchema)walk(itemSchema,[...pathParts,'[]'],field.schemaPointer+'/items',presence,path,depth+1,next);}\n }\n };walk(schema,[],'#','required');return result;\n}\nexport function fieldAt(schema:JsonSchema,path:string,options:ProjectionOptions={}):FieldDescriptor|undefined{const fields=projectFields(schema,{...options,maxDepth:20}).filter(f=>f.path===path);return fields.find(f=>f.addressable)??fields[0];}\nfunction shapeCompatibility(actual:JsonSchema,expected:JsonSchema,depth=0):Compatibility{\n const outcome=(state:Compatibility['state'],reason:string):Compatibility=>({state,reason,score:{compatible:100,conditional:65,unknown:25,incompatible:0}[state]});\n if(depth>10)return outcome('unknown','Deep object shapes require runtime validation.');\n if(expected===true)return outcome('compatible','No additional shape constraints.');\n if(expected===false||actual===false)return outcome('incompatible','The schema does not permit this value.');\n if(actual===true||isObject(actual)&&actual.$ref)return outcome('unknown','This object shape needs runtime validation.');\n if(expected.anyOf||expected.oneOf)return(expected.anyOf??expected.oneOf).map((branch:JsonSchema)=>shapeCompatibility(actual,branch,depth+1)).sort((a:Compatibility,b:Compatibility)=>b.score-a.score)[0];\n if(actual.anyOf||actual.oneOf){const matches=(actual.anyOf??actual.oneOf).map((branch:JsonSchema)=>shapeCompatibility(branch,expected,depth+1));if(matches.every((m:Compatibility)=>m.state==='compatible'))return matches[0];if(matches.every((m:Compatibility)=>m.state==='incompatible'))return matches[0];return outcome('conditional','Only some object branches guarantee the required shape.');}\n const wanted=schemaTypes(expected),types=schemaTypes(actual);if(types.includes('unknown'))return outcome('unknown','The schema does not establish this nested shape.');if(!types.some(t=>wanted.includes(t)||t==='integer'&&wanted.includes('number')||wanted.includes('unknown')))return outcome('incompatible','A required nested field has an incompatible type.');\n const results:Compatibility[]=[];\n for(const key of expected.required??[]){const child=actual.properties?.[key];if(!child){results.push(outcome(actual.additionalProperties===false?'incompatible':'unknown','The required '+key+' field is not established by the schema.'));continue;}if(!actual.required?.includes(key))results.push(outcome('conditional','The required '+key+' field is optional in this schema.'));if(expected.properties?.[key])results.push(shapeCompatibility(child,expected.properties[key],depth+1));}\n if(wanted.includes('array')&&expected.items)results.push(actual.items?shapeCompatibility(actual.items,expected.items,depth+1):outcome('unknown','The collection item shape is not established.'));\n return results.sort((a,b)=>a.score-b.score)[0]??outcome('compatible','The required object fields match.');\n}\nexport function compatibility(field:Pick<FieldDescriptor,'types'|'presence'|'nullable'|'addressable'|'schema'>,expected:JsonSchema,roles:string[]=[]):Compatibility{\n if(!field.addressable)return{state:'incompatible',reason:'This field is not addressable in the current Reportic scope.',score:0};\n const wanted=schemaTypes(expected),actual=field.types;if(wanted.includes('unknown')||actual.includes('unknown'))return{state:'unknown',reason:'The schema does not establish this shape. Validate actual inputs.',score:25};\n const matches=(t:string)=>wanted.includes(t)||(t==='integer'&&wanted.includes('number'));const overlap=actual.filter(matches);\n if(!overlap.length)return{state:'incompatible',reason:`Expected ${wanted.join(' or ')}, found ${actual.join(' or ')}.`,score:0};\n if(wanted.includes('array')&&actual.includes('array')&&isObject(expected)&&isObject(expected.items)&&schemaTypes(expected.items).includes('object')){\n const item=isObject(field.schema)?field.schema.items:undefined;if(item){const itemTypes=schemaTypes(item);if(!itemTypes.includes('object')&&!itemTypes.includes('unknown'))return{state:'incompatible',reason:'This collection does not contain records.',score:0};}\n }\n if(wanted.includes('object')||wanted.includes('array')){const shape=shapeCompatibility(field.schema,expected);if(shape.state!=='compatible')return shape;}\n if(overlap.length<actual.length||field.presence!=='required')return{state:'conditional',reason:overlap.length<actual.length?'Only some union branches match the expected type.':field.presence==='conditional'?'This path is available in only some schema branches.':'An ancestor or this field is optional; provide a fallback or verify the runtime branch.',score:65};\n return{state:'compatible',reason:'The declared type and guaranteed presence match this property.',score:100};\n}\nexport function inferSchema(samples:unknown[]):Record<string,any>{\n const infer=(values:any[]):JsonSchema=>{const types=[...new Set(values.map(valueType))];if(types.every(t=>t==='integer'||t==='number'))return{type:types.includes('number')?'number':'integer','x-reportic-inferred':true};if(types.length!==1)return{anyOf:types.map(type=>infer(values.filter(v=>valueType(v)===type))),'x-reportic-review':'Mixed sample types do not establish the full contract.'};const type=types[0]??'unknown';if(type==='object'){const keys=new Set(values.flatMap(v=>Object.keys(v)));return{type:'object',properties:Object.fromEntries([...keys].map(k=>[k,infer(values.filter(v=>Object.hasOwn(v,k)).map(v=>v[k]))])),additionalProperties:true,'x-reportic-review':'Required fields were not inferred. Review presence and constraints.'};}if(type==='array'){const all=values.flat();return{type:'array',items:all.length?infer(all):{},'x-reportic-review':all.length?'Item shapes are based on examples only.':'Empty arrays do not establish an item type.'};}return{type:type==='undefined'?'null':type,'x-reportic-inferred':true};};\n if(!samples.length||samples.some(v=>!isObject(v)))throw new Error('Provide one or more object samples.');samples.forEach(s=>safeInput(s));return{$schema:'https://json-schema.org/draft/2020-12/schema',...infer(samples) as any};\n}\nexport function compareSchemas(previous:JsonSchema,next:JsonSchema,registry:Record<string,JsonSchema>={}):SchemaChange[]{\n const before=projectFields(previous,{registry}),after=projectFields(next,{registry}),changes:SchemaChange[]=[];\n for(const field of before){const replacement=after.find(f=>f.path===field.path);if(!replacement){const parent=field.path.slice(0,field.path.lastIndexOf('.')+1);const candidates=after.filter(f=>f.path.startsWith(parent)&&f.path.slice(parent.length).indexOf('.')<0&&!before.some(b=>b.path===f.path)&&f.types.some(t=>field.types.includes(t)));changes.push({path:field.path,kind:'removed',severity:'breaking',message:'Field removed from the new contract.',replacement:candidates.length===1?candidates[0].path:undefined});continue;}if(field.types.some(t=>!replacement.types.includes(t)&&!(t==='integer'&&replacement.types.includes('number'))))changes.push({path:field.path,kind:'type',severity:'breaking',message:`Type changed from ${field.types.join('|')} to ${replacement.types.join('|')}.`});if(field.presence==='required'&&replacement.presence!=='required')changes.push({path:field.path,kind:'presence',severity:'breaking',message:'A previously guaranteed field is now optional or conditional.'});if(!field.nullable&&replacement.nullable)changes.push({path:field.path,kind:'nullable',severity:'breaking',message:'Null is newly permitted.'});if(JSON.stringify(field.schema)!==JSON.stringify(replacement.schema)&&!changes.some(c=>c.path===field.path))changes.push({path:field.path,kind:'constraints',severity:'review',message:'Constraints or annotations changed; review compatibility.'});}\n for(const f of after)if(!before.some(b=>b.path===f.path))changes.push({path:f.path,kind:'added',severity:'additive',message:'New field available.'});return changes;\n}\n","import Ajv2020 from 'ajv/dist/2020.js';\nimport addFormats from 'ajv-formats';\nimport {createHash}from'node:crypto';\nimport {isObject,safeInput,schemaTypes,resolveSchemaRef}from'./schema.js';\nimport type{JsonSchema,StudioDiagnostic}from'./types.js';\nexport const canonicalJson=(value:any):string=>Array.isArray(value)?'['+value.map(canonicalJson).join(',')+']':isObject(value)?'{'+Object.keys(value).sort().map(k=>JSON.stringify(k)+':'+canonicalJson(value[k])).join(',')+'}':JSON.stringify(value);\nexport const digest=(value:any)=>createHash('sha256').update(typeof value==='string'?value:canonicalJson(value)).digest('hex');\nexport function schemaReferences(schema:any):string[]{const refs=new Set<string>();const walk=(value:any)=>{if(!isObject(value))return;for(const[key,v]of Object.entries(value)){if(['$ref','$dynamicRef'].includes(key)&&typeof v==='string'&&!v.startsWith('#'))refs.add(v.split('#')[0]);else if(Array.isArray(v))v.forEach(walk);else if(isObject(v))walk(v);}};walk(schema);return[...refs];}\nexport function createSchemaValidator(schema:JsonSchema,registry:Record<string,JsonSchema>={}){\n const ajv=new Ajv2020({allErrors:true,strict:false,allowUnionTypes:true,validateFormats:true,loadSchema:undefined});addFormats(ajv);\n for(const[ref,s]of Object.entries(registry)){if(s===schema||isObject(s)&&isObject(schema)&&s.$id&&s.$id===schema.$id)continue;if(!ajv.getSchema(ref))ajv.addSchema(s,ref);}\n return{ajv,validate:ajv.compile(schema)};\n}\nexport function validateSchemaDocument(schema:any,registry:Record<string,JsonSchema>={}):StudioDiagnostic[]{\n const ds:StudioDiagnostic[]=[];try{\n safeInput(schema);if(Buffer.byteLength(JSON.stringify(schema))>2_000_000)throw new Error('Schema exceeds 2 MB.');\n if(!isObject(schema))throw new Error('A dataset schema must be an object.');\n if(schema.$schema&&schema.$schema!=='https://json-schema.org/draft/2020-12/schema'&&schema.$schema!=='https://json-schema.org/draft/2020-12/schema#')throw new Error('Use JSON Schema draft 2020-12.');\n const types=schemaTypes(schema);if(!types.includes('object')||types.some(t=>!['object','unknown'].includes(t)))throw new Error('Dataset schema root must guarantee an object.');\n for(const ref of schemaReferences(schema))if(!Object.hasOwn(registry,ref))ds.push({code:'SCHEMA_REFERENCE_UNAVAILABLE',severity:'error',phase:'catalog',message:`Schema reference ${ref} is unavailable in this agent’s catalog.`,schemaRef:ref});\n const scan=(v:any)=>{if(!isObject(v))return;if(typeof v.$ref==='string'&&v.$ref.startsWith('#')&&resolveSchemaRef(v.$ref,schema,registry)===undefined)ds.push({code:'SCHEMA_REFERENCE_UNAVAILABLE',severity:'error',phase:'catalog',message:'An internal schema reference does not resolve.',schemaRef:v.$ref});for(const child of Object.values(v)){if(Array.isArray(child))child.forEach(scan);else scan(child);}};scan(schema);\n if(!ds.some(d=>d.severity==='error'))createSchemaValidator(schema,registry);\n }catch(e:any){ds.push({code:'INVALID_SCHEMA',severity:'error',phase:'catalog',message:String(e.message).slice(0,600)});}return ds;\n}\nexport function validateSample(schema:JsonSchema,value:any,registry:Record<string,JsonSchema>={}):{valid:boolean;diagnostics:StudioDiagnostic[]}{\n const diagnostics:StudioDiagnostic[]=[];try{safeInput(value);const{validate}=createSchemaValidator(schema,registry);if(!validate(value))for(const error of validate.errors ?? [])diagnostics.push({code:'FIXTURE_SCHEMA_MISMATCH',severity:'error',phase:'input',message:`${error.instancePath||'/'} ${error.message}`,bindingPath:error.instancePath,guidance:'Update the sample or choose its exact schema version.'});}catch{diagnostics.push({code:'FIXTURE_VALIDATION_FAILED',severity:'error',phase:'input',message:'The sample or its pinned schema could not be validated.'});}return{valid:!diagnostics.some(d=>d.severity==='error'),diagnostics};\n}\n","import{mkdir,readFile,writeFile,rename,unlink,open,stat}from'node:fs/promises';\nimport{dirname,resolve}from'node:path';\nimport type{Agent,DatasetDefinition,TemplateDocument,Fixture}from'./types.js';\nimport type { DatasetSource, DatasetPlanRecord, DatasetRunRecord, DatasetResponseFixture } from './dataset-types.js';\nexport type AuditEvent={id:string;at:string;actor:string;workspaceId:string;agentId:string;action:string;resourceId:string;detail?:Record<string,any>};\nexport type CatalogState={version:1;agents:Agent[];datasets:DatasetDefinition[];templates:TemplateDocument[];fixtures:Fixture[];audit:AuditEvent[];datasetSources?:DatasetSource[];datasetPlans?:DatasetPlanRecord[];datasetRuns?:DatasetRunRecord[];datasetResponseFixtures?:DatasetResponseFixture[]};\nexport interface CatalogStorage{read():Promise<CatalogState>;transaction<T>(work:(state:CatalogState)=>T|Promise<T>):Promise<T>;}\nexport const emptyState=():CatalogState=>({version:1,agents:[],datasets:[],templates:[],fixtures:[],audit:[]});\nexport class MemoryCatalogStorage implements CatalogStorage{\n private state:CatalogState;private pending=Promise.resolve();constructor(seed:CatalogState=emptyState()){this.state=structuredClone(seed);}\n async read(){await this.pending;return structuredClone(this.state);}\n transaction<T>(work:(state:CatalogState)=>T|Promise<T>):Promise<T>{const task=this.pending.then(async()=>{const next=structuredClone(this.state);const result=await work(next);this.state=next;return structuredClone(result);});this.pending=task.then(()=>{},()=>{});return task;}\n}\nexport class FileCatalogStorage implements CatalogStorage{\n readonly filename:string;private pending=Promise.resolve();constructor(filename:string){this.filename=resolve(filename);}\n async read(){await this.pending;return this.load();}\n private async load():Promise<CatalogState>{try{const data=JSON.parse(await readFile(this.filename,'utf8'));if(data.version!==1)throw new Error('Unsupported catalog storage version.');return data;}catch(e:any){if(e.code==='ENOENT')return emptyState();throw e;}}\n transaction<T>(work:(state:CatalogState)=>T|Promise<T>):Promise<T>{const task=this.pending.then(async()=>{\n await mkdir(dirname(this.filename),{recursive:true});const lock=this.filename+'.lock';let handle:any;\n for(let i=0;i<100;i++){try{handle=await open(lock,'wx');await handle.writeFile(String(process.pid));break;}catch(e:any){if(e.code!=='EEXIST')throw e;try{const pid=Number(await readFile(lock,'utf8'));if(pid&&pid!==process.pid){try{process.kill(pid,0);}catch(err:any){if(err.code==='ESRCH'){await unlink(lock);continue;}}}}catch{}await new Promise(r=>setTimeout(r,50));}}\n if(!handle)throw new Error('Catalog storage is busy. Retry the operation.');const temporary=this.filename+'.'+process.pid+'.tmp';\n try{const state=await this.load();const result=await work(state);const content=JSON.stringify(state);if(Buffer.byteLength(content)>150_000_000)throw new Error('Local catalog storage limit reached.');await writeFile(temporary,content,{encoding:'utf8',mode:0o600});await rename(temporary,this.filename);return structuredClone(result);}finally{await handle.close();await unlink(lock).catch(()=>{});await unlink(temporary).catch(()=>{});}\n });this.pending=task.then(()=>{},()=>{});return task;}\n}\n","import{randomUUID}from'node:crypto';\nimport type{CatalogStorage,CatalogState}from'./store.js';\nimport type{Principal,HostIdentity,Action,Agent,DatasetDefinition,SchemaVersion,TemplateDocument,AuthoringManifest,Fixture,Mapping}from'./types.js';\nimport{inferSchema,projectFields,compareSchemas,isObject,safeInput}from'./schema.js';\nimport{validateSchemaDocument,validateSample,digest,schemaReferences}from'./validation.js';\n\nexport class CatalogError extends Error{constructor(public code:string,message:string,public status=422,public details?:any){super(message);this.name='CatalogError';}}\nexport function assertName(name:any){if(typeof name!=='string'||!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)||['constructor','prototype','__proto__'].includes(name))throw new CatalogError('INVALID_DATASET_NAME','Use an identifier-style canonical name.');}\nexport const scopeMatch=(v:{workspaceId:string;agentId:string},p:Principal,agentId:string)=>v.workspaceId===p.workspaceId&&v.agentId===agentId;\nexport function audit(state:CatalogState,p:Principal,agentId:string,action:string,resourceId:string,detail?:any){state.audit.push({id:randomUUID(),at:new Date().toISOString(),actor:p.id,workspaceId:p.workspaceId,agentId,action,resourceId,detail});if(state.audit.length>10000)state.audit.splice(0,state.audit.length-10000);}\nexport const manifestFor=(agentId:string):AuthoringManifest=>({manifestVersion:1,agentId,dataSetMappings:{}});\nexport function publishDatasetSchema(\n state: CatalogState, actor: Principal, dataset: DatasetDefinition, expectedRevision: number,\n registry: Record<string, Record<string, unknown>>,\n): SchemaVersion {\n if (expectedRevision !== dataset.revision) {\n throw new CatalogError('REVISION_CONFLICT','The schema draft changed. Review its current revision before publishing.',409,{current:dataset});\n }\n let draft;\n try { draft = JSON.parse(dataset.draftSchemaText); } catch {\n throw new CatalogError('INVALID_SCHEMA_JSON','Fix the schema JSON before publishing.');\n }\n const diagnostics = validateSchemaDocument(draft, registry);\n if (diagnostics.length) throw new CatalogError('INVALID_SCHEMA','The schema cannot be published.',422,{diagnostics});\n const previous = dataset.versions.at(-1);\n const version = (previous?.version ?? 0) + 1;\n const schemaRef = 'reportic.dataset.' + dataset.id + '.v' + version;\n const schema = {$schema:'https://json-schema.org/draft/2020-12/schema', ...draft, $id:schemaRef};\n const published: SchemaVersion = {\n version, schemaRef, schema, digest:digest(schema), references:schemaReferences(schema),\n publishedAt:new Date().toISOString(), publishedBy:actor.id,\n compatibility:previous ? compareSchemas(previous.schema,schema,registry) : [],\n };\n dataset.versions.push(published);\n dataset.status = 'active';\n dataset.revision++;\n dataset.updatedAt = published.publishedAt;\n audit(state,actor,dataset.agentId,'schema.published',dataset.id,{schemaRef,version,digest:published.digest});\n return published;\n}\n\nexport class CatalogService{\n constructor(public storage:CatalogStorage,public identity:HostIdentity){}\n async authorize(principal:Principal,agentId:string,action:Action){const state=await this.storage.read();const agent=state.agents.find(a=>a.id===agentId&&a.workspaceId===principal.workspaceId);if(!agent||!principal.agentIds.includes(agentId)||!principal.actions.includes(action)||this.identity.authorize&&!await this.identity.authorize(principal,agent,action))throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);return agent;}\n async agents(p:Principal){const state=await this.storage.read();const result:Agent[]=[];for(const a of state.agents)if(a.workspaceId===p.workspaceId&&p.agentIds.includes(a.id)&&(!this.identity.authorize||await this.identity.authorize(p,a,'catalog.read')))result.push(a);return result;}\n async registry(p:Principal,agentId:string){await this.authorize(p,agentId,'catalog.read');const state=await this.storage.read();return this.registryFrom(state,p,agentId);}\n registryFrom(state:CatalogState,p:Principal,agentId:string):Record<string,any>{return Object.fromEntries(state.datasets.filter(d=>scopeMatch(d,p,agentId)).flatMap(d=>d.versions.map(v=>[v.schemaRef,v.schema])));}\n async listDatasets(p:Principal,agentId:string,search='',includeArchived=false){await this.authorize(p,agentId,'catalog.read');const state=await this.storage.read();return state.datasets.filter(d=>scopeMatch(d,p,agentId)&&(includeArchived||d.status!=='archived')&&JSON.stringify([d.name,d.displayName,d.description,d.tags,d.producer,d.status,d.versions.map(v=>v.version),d.draftSchemaText]).toLowerCase().includes(search.toLowerCase()));}\n async getDataset(p:Principal,agentId:string,id:string){await this.authorize(p,agentId,'catalog.read');const state=await this.storage.read();const d=state.datasets.find(d=>d.id===id&&scopeMatch(d,p,agentId));if(!d)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);return d;}\n async createDataset(p:Principal,agentId:string,input:any){await this.authorize(p,agentId,'catalog.edit');assertName(input.name);safeInput(input);const schemaText=typeof input.schemaText==='string'?input.schemaText:JSON.stringify(input.schema ?? (input.samples?inferSchema(input.samples):{$schema:'https://json-schema.org/draft/2020-12/schema',type:'object',properties:{}}),null,2);if(schemaText.length>2_000_000)throw new CatalogError('LIMIT_EXCEEDED','Schema text exceeds 2 MB.');return this.storage.transaction(state=>{if(state.datasets.some(d=>scopeMatch(d,p,agentId)&&d.name===input.name))throw new CatalogError('DUPLICATE_DATASET_NAME','This agent already has that canonical name.',409);const now=new Date().toISOString();const d:DatasetDefinition={id:'ds_'+randomUUID().replace(/-/g,''),workspaceId:p.workspaceId,agentId,name:input.name,displayName:String(input.displayName||input.name).slice(0,200),description:String(input.description||'').slice(0,2000),tags:Array.isArray(input.tags)?input.tags.slice(0,20).map(String):[],producer:typeof input.producer==='string'?input.producer.slice(0,200):undefined,kind:input.kind==='variables'?'variables':'dataset',status:'draft',revision:1,draftSchemaText:schemaText,versions:[],createdAt:now,updatedAt:now,owner:p.id};state.datasets.push(d);audit(state,p,agentId,'dataset.created',d.id);return d;});}\n async saveDataset(p:Principal,agentId:string,id:string,input:any){await this.authorize(p,agentId,'catalog.edit');return this.storage.transaction(state=>{const d=state.datasets.find(d=>d.id===id&&scopeMatch(d,p,agentId));if(!d)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);if(input.expectedRevision!==d.revision)throw new CatalogError('REVISION_CONFLICT','This dataset changed in another session. Your local edit has been preserved.',409,{current:d});if(typeof input.schemaText==='string'){if(input.schemaText.length>2_000_000)throw new CatalogError('LIMIT_EXCEEDED','Schema text exceeds 2 MB.');d.draftSchemaText=input.schemaText;}for(const key of ['displayName','description','producer']as const)if(typeof input[key]==='string')d[key]=input[key].slice(0,key==='description'?2000:200);if(Array.isArray(input.tags))d.tags=input.tags.slice(0,20).map(String);d.revision++;d.updatedAt=new Date().toISOString();return d;});}\n async checkDataset(p:Principal,agentId:string,id:string,sample?:any){const d=await this.getDataset(p,agentId,id),registry=await this.registry(p,agentId);let schema:any;try{schema=JSON.parse(d.draftSchemaText);}catch{return{valid:false,diagnostics:[{code:'INVALID_SCHEMA_JSON',severity:'error',phase:'catalog',message:'The schema is not valid JSON.'}],fields:[]};}const diagnostics=validateSchemaDocument(schema,registry);const sampleResult=sample!==undefined?validateSample(schema,sample,registry):undefined;return{valid:!diagnostics.some(d=>d.severity==='error'),diagnostics,fields:projectFields(schema,{registry,datasetId:d.id,alias:d.name}),sample:sampleResult};}\n async publishDataset(p:Principal,agentId:string,id:string,expectedRevision:number){\n await this.authorize(p,agentId,'catalog.publish');\n return this.storage.transaction(state => {\n const dataset=state.datasets.find(item => item.id===id && scopeMatch(item,p,agentId));\n if(!dataset) throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);\n return {dataset,version:publishDatasetSchema(state,p,dataset,expectedRevision,this.registryFrom(state,p,agentId))};\n });\n }\n async setLifecycle(p:Principal,agentId:string,id:string,status:any,expectedRevision:number){await this.authorize(p,agentId,'catalog.publish');if(!['active','deprecated','archived'].includes(status))throw new CatalogError('INVALID_STATUS','Choose active, deprecated, or archived.');return this.storage.transaction(state=>{const d=state.datasets.find(d=>d.id===id&&scopeMatch(d,p,agentId));if(!d)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);if(d.revision!==expectedRevision)throw new CatalogError('REVISION_CONFLICT','Dataset changed. Refresh before changing its lifecycle.',409,{current:d});d.status=status;d.revision++;audit(state,p,agentId,'dataset.'+status,id);return d;});}\n async removeVersion(p:Principal,agentId:string,id:string,version:number){await this.authorize(p,agentId,'catalog.publish');return this.storage.transaction(state=>{const d=state.datasets.find(d=>d.id===id&&scopeMatch(d,p,agentId)),v=d?.versions.find(v=>v.version===version);if(!d||!v)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);if(state.templates.some(t=>scopeMatch(t,p,agentId)&&[t.manifest,...t.publishedRevisions.map(r=>r.manifest)].some(m=>Object.values(m.dataSetMappings).some(pin=>pin.schemaRef===v.schemaRef)))||state.datasets.some(d=>scopeMatch(d,p,agentId)&&d.versions.some(other=>other.references.includes(v.schemaRef)))||state.fixtures.some(f=>scopeMatch(f,p,agentId)&&Date.parse(f.expiresAt)>Date.now()&&Object.values(f.schemaPins).includes(v.schemaRef)))throw new CatalogError('SCHEMA_IN_USE','Retained templates, schemas, or fixtures still depend on this version.',409);throw new CatalogError('RETENTION_REQUIRED','Published schemas are retained. Configure an explicit host purge policy before removal.',409);});}\n async listTemplates(p:Principal,agentId:string){await this.authorize(p,agentId,'templates.read');return(await this.storage.read()).templates.filter(t=>scopeMatch(t,p,agentId));}\n async getTemplate(p:Principal,agentId:string,id:string){await this.authorize(p,agentId,'templates.read');const t=(await this.storage.read()).templates.find(t=>t.id===id&&scopeMatch(t,p,agentId));if(!t)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);return t;}\n async createTemplate(p:Principal,agentId:string,input:any){await this.authorize(p,agentId,'templates.edit');safeInput(input);return this.storage.transaction(state=>{const now=new Date().toISOString();const t:TemplateDocument={id:'tpl_'+randomUUID().replace(/-/g,''),workspaceId:p.workspaceId,agentId,name:String(input.name||'Untitled report').slice(0,200),description:String(input.description||'').slice(0,2000),category:String(input.category||'Custom'),color:String(input.color||'sage'),source:String(input.source ?? '# {{reportTitle}}\\n\\nA clear perspective.\\n'),manifest:input.manifest ?? manifestFor(agentId),revision:1,theme:input.theme ?? 'editorial',css:input.css,assets:input.assets ?? {},fixtureId:undefined,updatedAt:now,updatedBy:p.id,publishedRevisions:[]};if(t.manifest.agentId!==agentId||t.manifest.manifestVersion!==1)throw new CatalogError('MANIFEST_SCOPE_MISMATCH','The manifest must use the current authorized agent.');if(Buffer.byteLength(t.source)>1_000_000)throw new CatalogError('LIMIT_EXCEEDED','Template exceeds 1 MB.');state.templates.push(t);audit(state,p,agentId,'template.created',t.id);return t;});}\n async saveTemplate(p:Principal,agentId:string,id:string,input:any){await this.authorize(p,agentId,'templates.edit');safeInput(input);return this.storage.transaction(state=>{const t=state.templates.find(t=>t.id===id&&scopeMatch(t,p,agentId));if(!t)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);if(input.expectedRevision!==t.revision)throw new CatalogError('REVISION_CONFLICT','Another tab changed this draft. Keep your local version and review the conflict.',409,{current:t});if(typeof input.source==='string'){if(Buffer.byteLength(input.source)>1_000_000)throw new CatalogError('LIMIT_EXCEEDED','Template exceeds 1 MB.');t.source=input.source;}if(input.manifest){if(input.manifest.agentId!==agentId||input.manifest.manifestVersion!==1)throw new CatalogError('MANIFEST_SCOPE_MISMATCH','Manifest scope does not match the authorized agent.');if(digest(t.manifest)!==digest(input.manifest))audit(state,p,agentId,'template.mapping.changed',id,{schemaRefs:Object.values(input.manifest.dataSetMappings ?? {}).map((m:any)=>m.schemaRef)});t.manifest=input.manifest;}for(const key of ['name','description','category','theme','css','color','fixtureId']as const)if(input[key]!==undefined)(t as any)[key]=input[key];if(input.assets)t.assets=input.assets;t.revision++;t.updatedAt=new Date().toISOString();t.updatedBy=p.id;return t;});}\n async listFixtures(p:Principal,agentId:string,templateId?:string){await this.authorize(p,agentId,'fixtures.read');const s=await this.storage.read();return s.fixtures.filter(f=>scopeMatch(f,p,agentId)&&Date.parse(f.expiresAt)>Date.now()&&(!templateId||!f.templateId||f.templateId===templateId)).map(({dataSets,variables,...metadata})=>metadata);}\n async getFixture(p:Principal,agentId:string,id:string){await this.authorize(p,agentId,'fixtures.read');return this.storage.transaction(state=>{const f=state.fixtures.find(f=>f.id===id&&scopeMatch(f,p,agentId)&&Date.parse(f.expiresAt)>Date.now());if(!f)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);audit(state,p,agentId,'fixture.accessed',id);return f;});}\n async createFixture(p:Principal,agentId:string,input:any){await this.authorize(p,agentId,'fixtures.manage');safeInput(input);if(!Array.isArray(input.dataSets)||!isObject(input.variables ?? {}))throw new CatalogError('INVALID_FIXTURE','Fixtures need a dataset array and variables object.');if(Buffer.byteLength(JSON.stringify(input))>12_000_000)throw new CatalogError('LIMIT_EXCEEDED','Fixture exceeds 12 MB.');const registry=await this.registry(p,agentId),diagnostics:any[]=[];for(const[name,ref]of Object.entries(input.schemaPins ?? {})){const schema=registry[String(ref)];if(!schema)throw new CatalogError('RESOURCE_UNAVAILABLE','A pinned schema is unavailable.',404);const data=name==='$variables'?{data:input.variables??{}}:input.dataSets.find((d:any)=>d.name===name);if(data)diagnostics.push(...validateSample(schema,data.data,registry).diagnostics);}\n if(diagnostics.length)throw new CatalogError('INVALID_FIXTURE','Fixture values do not match their pinned schemas.',422,{diagnostics});return this.storage.transaction(state=>{if(input.templateId&&!state.templates.some(t=>t.id===input.templateId&&scopeMatch(t,p,agentId)))throw new CatalogError('RESOURCE_UNAVAILABLE','Template unavailable.',404);const f:Fixture={id:'fx_'+randomUUID().replace(/-/g,''),workspaceId:p.workspaceId,agentId,templateId:input.templateId,name:String(input.name||'Preview fixture').slice(0,200),dataSets:input.dataSets,variables:input.variables ?? {},schemaPins:input.schemaPins ?? {},createdAt:new Date().toISOString(),expiresAt:new Date(Date.now()+Math.min(90,Math.max(1,Number(input.retentionDays)||30))*86400000).toISOString(),owner:p.id,sample:input.sample!==false};state.fixtures.push(f);audit(state,p,agentId,'fixture.created',f.id,{schemaPins:f.schemaPins,expiresAt:f.expiresAt});return f;});}\n async expireFixture(p:Principal,agentId:string,id:string){await this.authorize(p,agentId,'fixtures.manage');return this.storage.transaction(state=>{const f=state.fixtures.find(f=>f.id===id&&scopeMatch(f,p,agentId));if(!f)throw new CatalogError('RESOURCE_UNAVAILABLE','Fixture unavailable.',404);f.expiresAt=new Date().toISOString();f.dataSets=[];f.variables={};audit(state,p,agentId,'fixture.expired',id);return{id,state:'expired'};});}\n}\n","import{indexSource,getBindingSlot,sourceFingerprint,editElementProperty,declareDataset,type IndexedElement,type IndexedBinding}from'@x12i/reportic-core/authoring';\nimport type{ComponentDefinition}from'@x12i/reportic-core';\nimport{projectFields,fieldAt,compatibility,schemaTypes,isObject}from'./schema.js';\nimport type{Analysis,AuthoringManifest,DatasetDefinition,FieldDescriptor,BindingInspection,JsonSchema,StudioDiagnostic,Mapping}from'./types.js';\ntype RowContext={schema:JsonSchema;alias?:string;catalogPrefix:string;schemaRef?:string};\nexport const slotPath=(path:string):(string|number)[]=>path.replace(/\\[(\\d+)\\]/g,'.$1').split('.').filter(Boolean).map(p=>/^\\d+$/.test(p)?Number(p):p);\nexport const valueAt=(value:any,path:(string|number)[])=>path.reduce((v,key)=>v&&Object.hasOwn(v,key)?v[key]:undefined,value);\nexport function analyzeBindings(source:string,manifest:AuthoringManifest,datasets:DatasetDefinition[],components:Pick<ComponentDefinition,'type'|'schema'|'rowScopes'|'bindingSlots'|'capabilities'>[],options:{agentId?:string;format?:string;editability?:string}={}):Analysis{\n const index=indexSource(source),diagnostics:StudioDiagnostic[]=index.diagnostics.map(d=>({...d,phase:'authoring',line:d.range?.line,column:d.range?.column}));const bindings:BindingInspection[]=[];const schemaPins:Record<string,string>={};\n const registry=Object.fromEntries(datasets.flatMap(d=>d.versions.map(v=>[v.schemaRef,v.schema])));\n if(!manifest||manifest.manifestVersion!==1||options.agentId&&manifest.agentId!==options.agentId)diagnostics.push({code:'MANIFEST_SCOPE_MISMATCH',severity:'error',phase:'catalog',message:'The manifest does not match this agent context.'});\n const mappings=manifest?.dataSetMappings ?? {};const roots:Record<string,{schema:JsonSchema;schemaRef:string}>={};\n for(const[alias,mapping]of Object.entries(mappings)){\n const dataset=datasets.find(d=>d.id===mapping.datasetId),version=dataset?.versions.find(v=>v.version===mapping.schemaVersion&&v.schemaRef===mapping.schemaRef);\n if(!version){diagnostics.push({code:'SCHEMA_UNAVAILABLE',severity:'error',phase:'catalog',message:`The pinned schema for ${alias} is unavailable in this agent.`,datasetAlias:alias,guidance:'Choose an authorized dataset and exact published version.'});continue;}\n roots[alias]={schema:version.schema,schemaRef:version.schemaRef};schemaPins[alias]=version.schemaRef;\n if(index.metadata.dataSets?.[alias]?.schema!==version.schemaRef)diagnostics.push({code:'MAPPING_CONFLICT',severity:'error',phase:'catalog',message:`Source declaration and manifest disagree for ${alias}.`,datasetAlias:alias,schemaRef:version.schemaRef,guidance:'Review and reconcile the source declaration and saved mapping.'});\n if(dataset!.status==='deprecated')diagnostics.push({code:'DATASET_DEPRECATED',severity:'warning',phase:'catalog',message:`${alias} uses a deprecated catalog definition.`,datasetAlias:alias,schemaRef:version.schemaRef});\n }\n for(const[alias,decl]of Object.entries(index.metadata.dataSets ?? {}) as [string,any][])if(decl?.schema&&!mappings[alias])diagnostics.push({code:'SCHEMA_UNMAPPED',severity:'error',phase:'catalog',message:`Schema declaration ${alias} has no pinned authoring mapping.`,datasetAlias:alias,guidance:'Use the mapping reconciliation action or explicitly map this dataset.'});\n const variablePin=manifest?.variablesContract,variableDefinition=variablePin?datasets.find(d=>d.id===variablePin.datasetId&&d.kind==='variables'&&d.versions.some(v=>v.version===variablePin.schemaVersion&&v.schemaRef===variablePin.schemaRef)):undefined;\n const variableSchema=manifest?.variablesSchema ?? (variableDefinition&&variablePin?registry[variablePin.schemaRef]:undefined);if(variableDefinition&&variablePin)schemaPins['$variables']=variablePin.schemaRef;\n if(manifest?.variablesContract&&!variableDefinition)diagnostics.push({code:'VARIABLE_SCHEMA_UNAVAILABLE',severity:'error',phase:'catalog',message:'The pinned variable contract is unavailable in this agent.'});\n const resolve=(path:string,row?:RowContext):{field?:FieldDescriptor;alias?:string;ref?:string;catalogPath?:string;missingRoot?:boolean;unverified?:boolean}=>{\n const [root,name,...parts]=path.split('.');if(root==='dataSets'){\n const entry=roots[name];if(!entry)return{alias:name,missingRoot:true};if(!parts.length)return{field:{path:'',segments:[],types:['object'],presence:'required',nullable:false,addressable:true,schemaPointer:'#',schema:entry.schema,label:name,scope:'dataSets',reporticPath:path,schemaRef:entry.schemaRef},alias:name,ref:entry.schemaRef,catalogPath:''};\n return{field:fieldAt(entry.schema,parts.join('.'),{alias:name,schemaRef:entry.schemaRef,registry}),alias:name,ref:entry.schemaRef,catalogPath:parts.join('.')};\n }\n if(root==='row'){\n if(!row)return{missingRoot:true};const itemPath=[name,...parts].filter(Boolean).join('.');const field=!itemPath?{path:'',segments:[],types:schemaTypes(row.schema),presence:'required' as const,nullable:schemaTypes(row.schema).includes('null'),addressable:true,schemaPointer:'#',schema:row.schema,label:'Current item',scope:'row' as const,reporticPath:'row'}:fieldAt(row.schema,itemPath,{root:'row',schemaRef:row.schemaRef,registry});return{field,alias:row.alias,ref:row.schemaRef,catalogPath:row.catalogPrefix+(itemPath?'.'+itemPath:'')};\n }\n if(root==='variables')return variableSchema?{field:fieldAt(variableSchema,[name,...parts].filter(Boolean).join('.'),{root:'variables',registry}),ref:manifest?.variablesContract?.schemaRef}:{unverified:true};\n return{unverified:true};\n };\n const incomingCache=new Map<string,RowContext|undefined>();\n const incoming=(entry:IndexedElement):RowContext|undefined=>{if(incomingCache.has(entry.id))return incomingCache.get(entry.id);const parent=index.elements.find(e=>e.id===entry.parentId);if(!parent){incomingCache.set(entry.id,undefined);return;}let context=incoming(parent);const definition=components.find(c=>c.type===parent.type);const driver=definition?.bindingSlots?.find(s=>s.establishesRow&&s.childrenInheritRow);if(driver)context=collection(parent,driver.path,context);incomingCache.set(entry.id,context);return context;};\n const collection=(entry:IndexedElement,sourcePath:string,row?:RowContext):RowContext|undefined=>{\n const value=valueAt(entry.value,slotPath(sourcePath));if(isObject(value)&&typeof value.$bind==='string'){const resolved=resolve(value.$bind,row);if(resolved.field?.itemSchema)return{schema:resolved.field.itemSchema,alias:resolved.alias,catalogPrefix:resolved.catalogPath?resolved.catalogPath+'[]':'',schemaRef:resolved.ref};}\n if(Array.isArray(value))return{schema:true,catalogPrefix:'',alias:undefined};return;\n };\n const inspect=(entry:IndexedElement,binding:IndexedBinding)=>{\n const definition=components.find(c=>c.type===entry.type),slot=definition?getBindingSlot(definition,binding.slot,entry.value.props):undefined;\n const parentRow=incoming(entry);const row=slot?.rowSource?collection(entry,slot.rowSource,parentRow):parentRow;const resolved=resolve(binding.path,row);let result:any;\n if(binding.path.startsWith('row')&&!slot?.rowSource&&!parentRow)result={state:'incompatible',reason:'There is no local row in this property. Select a collection or use a global path.',score:0};\n else if(slot?.binding===false)result={state:'incompatible',reason:'This property requires a literal value.',score:0};\n else if(slot&&!slot.roots.includes(binding.path.split('.')[0] as any))result={state:'incompatible',reason:'This root is not permitted for the selected property.',score:0};\n else if(resolved.unverified||!slot)result={state:'unknown',reason:resolved.unverified?'No variable schema is configured; runtime input validation is required.':'The registry does not establish this property’s expected shape.',score:25};\n else if(!resolved.field)result={state:'incompatible',reason:resolved.missingRoot?'This dataset or row context is not pinned.':'The exact field is absent from the pinned schema.',score:0};\n else result=compatibility(resolved.field,slot.expected,slot.roles);\n bindings.push({elementId:entry.id,slot:binding.slot,path:binding.path,range:binding.range,datasetAlias:resolved.alias,schemaRef:resolved.ref,catalogPath:resolved.catalogPath,compatibility:result,field:resolved.field});\n if(result.state!=='compatible')diagnostics.push({code:result.state==='incompatible'?'BINDING_INCOMPATIBLE':result.state==='conditional'?'BINDING_CONDITIONAL':'BINDING_UNVERIFIED',severity:result.state==='incompatible'?'error':result.state==='conditional'?'warning':'info',phase:'binding',message:result.reason,elementId:entry.id,slot:binding.slot,bindingPath:binding.path,datasetAlias:resolved.alias,schemaRef:resolved.ref,line:binding.range.line,column:binding.range.column,range:binding.range,state:result.state,guidance:result.state==='incompatible'?'Review this binding in the property inspector.':'Verify an approved fixture or supply an explicit runtime fallback.'});\n };\n for(const entry of index.elements){\n if(!entry.valid)continue;const definition=components.find(c=>c.type===entry.type);if(definition&&options.format&&definition.capabilities[options.format as keyof typeof definition.capabilities]==='unavailable')diagnostics.push({code:'TARGET_UNAVAILABLE',severity:'error',phase:'authoring',message:`${entry.type} is unavailable for ${options.format}.`,elementId:entry.id,range:entry.range});entry.bindings.forEach(b=>inspect(entry,b));\n }\n for(const token of index.inlineBindings){let path=token.path;if(!/^(?:variables|dataSets|row)\\./.test(path))path='variables.'+path;const resolved=resolve(path);if(resolved.missingRoot)diagnostics.push({code:'INLINE_DATASET_UNMAPPED',severity:'error',phase:'binding',message:'An inline dataset expression is not mapped.',bindingPath:path,datasetAlias:resolved.alias,range:token.range,line:token.range.line});else if(!resolved.field||resolved.unverified)diagnostics.push({code:'INLINE_UNVERIFIED',severity:'info',phase:'binding',message:'Inline Rendrix resolution is deferred until actual inputs are supplied.',bindingPath:path,range:token.range,state:'unknown'});}\n if(/{{\\s*(?:function|#|smartInput|file:)/.test(source))diagnostics.push({code:'DYNAMIC_REQUIREMENTS_DEFERRED',severity:'info',phase:'binding',message:'Dynamic helpers, files, and conditional branches are checked with the selected runtime inputs.',state:'unknown'});\n const valid=!diagnostics.some(d=>d.severity==='error');return{valid,status:!valid?'Invalid':diagnostics.some(d=>d.state==='conditional')?'Conditional':diagnostics.some(d=>d.state==='unknown')?'Unverified':'Structurally valid',diagnostics,bindings,fingerprint:sourceFingerprint(source+JSON.stringify(manifest)),schemaPins};\n}\nexport function bindingCandidates(source:string,manifest:AuthoringManifest,datasets:DatasetDefinition[],components:Pick<ComponentDefinition,'type'|'schema'|'rowScopes'|'bindingSlots'|'capabilities'>[],elementId:string,propertyPath:string):{field:FieldDescriptor;compatibility:ReturnType<typeof compatibility>;mapping?:Mapping;alias?:string}[]{\n const index=indexSource(source),entry=index.elements.find(e=>e.id===elementId),definition=components.find(c=>c.type===entry?.type),slot=definition?getBindingSlot(definition,propertyPath,entry?.value.props):undefined;if(!entry||!slot)return[];\n const registry=Object.fromEntries(datasets.flatMap(d=>d.versions.map(v=>[v.schemaRef,v.schema]))),result:{field:FieldDescriptor;compatibility:ReturnType<typeof compatibility>;mapping?:Mapping;alias?:string}[]=[];\n if(slot.roots.includes('dataSets'))for(const dataset of datasets.filter(d=>d.status!=='archived'&&d.kind==='dataset'))for(const version of dataset.versions){const existing=Object.entries(manifest.dataSetMappings).find(([,m])=>m.datasetId===dataset.id&&m.schemaVersion===version.version),alias=existing?.[0]??dataset.name;const mapping={datasetId:dataset.id,schemaVersion:version.version,schemaRef:version.schemaRef};for(const field of projectFields(version.schema,{alias,schemaRef:version.schemaRef,datasetId:dataset.id,registry}).filter(f=>!f.collectionPath)){const match=compatibility(field,slot.expected,slot.roles);if(slot.roles?.includes(field.role ?? ''))match.score+=12;if(existing)match.score+=8;result.push({field,compatibility:match,mapping,alias});}}\n const variablesSchema=manifest.variablesSchema??(manifest.variablesContract?registry[manifest.variablesContract.schemaRef]:undefined);\n if(slot.roots.includes('variables')&&variablesSchema)for(const field of projectFields(variablesSchema,{root:'variables',registry}))result.push({field,compatibility:compatibility(field,slot.expected,slot.roles)});\n // Reuse the same scope engine to discover the exact collection establishing this row.\n if(slot.roots.includes('row')){\n let owner:IndexedElement|undefined=entry,driver=slot.rowSource;let driverOwner=entry;\n while(!driver&&owner?.parentId){owner=index.elements.find(e=>e.id===owner!.parentId);const def=components.find(c=>c.type===owner?.type);const inherited=def?.bindingSlots?.find(s=>s.establishesRow&&s.childrenInheritRow);if(inherited){driver=inherited.path;driverOwner=owner!;break;}}\n if(driver){const dummy=editElementProperty(source,entry.id,slotPath(propertyPath),{$bind:'row'},sourceFingerprint(source));const analysis=analyzeBindings(dummy,manifest,datasets,components);const row=analysis.bindings.find(b=>b.elementId===entry.id&&b.slot===propertyPath)?.field;if(row){const fields=projectFields(row.schema,{root:'row',schemaRef:row.schemaRef,registry});if(!fields.length)fields.push({...row,path:'',reporticPath:'row',addressable:true,scope:'row'});for(const field of fields.filter(f=>!f.collectionPath))result.push({field,compatibility:compatibility(field,slot.expected,slot.roles)});}}\n }\n return result.sort((a,b)=>b.compatibility.score-a.compatibility.score||a.field.path.localeCompare(b.field.path));\n}\n","export type DatasetProtocol = 'rest' | 'graphql' | 'grpc' | 'postgrest' | 'mongo';\nexport type DatasetObject = Record<string, unknown>;\nexport type DatasetPrecision = 'exact' | 'estimated' | 'unknown';\nexport type DatasetCoverage = 'complete' | 'limitedByDesign' | 'partial' | 'failed';\n\nexport interface DatasetScope {\n workspaceId: string;\n agentId: string;\n}\n\nexport interface RequestSlot {\n section: 'path' | 'query' | 'body' | 'variables' | 'message' | 'operands';\n name: string;\n schema: DatasetObject;\n required?: boolean;\n}\n\nexport interface ApprovedOperation {\n label: string;\n slots: RequestSlot[];\n configuration: DatasetObject;\n responseSchema?: DatasetObject;\n safeToRetry?: boolean;\n stableOrder?: boolean;\n rawPreviewPaths?: string[];\n}\n\nexport interface SourceRevision extends DatasetScope {\n id: string;\n sourceId: string;\n revision: number;\n protocol: DatasetProtocol;\n connectionRef: string;\n connectionRevision?: string;\n fixtureOnly: boolean;\n operations: Record<string, ApprovedOperation>;\n publishedAt: string;\n publishedBy: string;\n digest: string;\n}\n\nexport interface DatasetSource extends DatasetScope {\n id: string;\n name: string;\n status: 'active' | 'deprecated' | 'revoked';\n revision: number;\n versions: SourceRevision[];\n}\n\nexport interface DatasetPlanSummary {\n revision: number;\n schemaRef: string;\n digest: string;\n publishedAt: string;\n}\n\nexport interface DatasetPlanVersion extends DatasetPlanSummary {\n sourceText: string;\n sourceRefs: string[];\n publishedBy: string;\n verification: DatasetVerification;\n}\n\nexport interface DatasetVerification {\n digest: string;\n mode: 'fixture' | 'live';\n at: string;\n}\n\nexport interface DatasetPlanRecord extends DatasetScope {\n datasetId: string;\n draft: {revision: number; sourceText: string; updatedAt: string; verification?: DatasetVerification};\n versions: DatasetPlanVersion[];\n}\n\nexport interface DatasetCount {\n value: number | string | null;\n precision: DatasetPrecision;\n scope: string;\n}\n\nexport interface DatasetDiagnostic {\n code: string;\n phase: 'plan' | 'connection' | 'request' | 'page' | 'mapping' | 'reduction' | 'output' | 'run';\n message: string;\n operation?: string;\n path?: string;\n line?: number;\n retryable?: boolean;\n}\n\nexport interface DatasetTrace {\n operation: string;\n protocol: DatasetProtocol;\n page: number;\n attempt: number;\n outcome: 'accepted' | 'retry' | 'failed';\n status?: number;\n rows: number;\n bytes: number;\n durationMs: number;\n slots: string[];\n}\n\nexport interface DatasetRunMetadata {\n schemaRef: string;\n planRevision?: number;\n sourceRefs: string[];\n startedAt: string;\n finishedAt: string;\n durationMs: number;\n calls: number;\n pages: number;\n rows: number;\n bytes: number;\n retries: number;\n completeness: DatasetCoverage;\n consistency: 'bestEffort' | 'snapshot';\n counts: Record<string, DatasetCount>;\n operationCoverage: Record<string, DatasetCoverage>;\n reductions: Record<string, {coverage: DatasetCoverage; rows: number}>;\n trace: DatasetTrace[];\n diagnostics: DatasetDiagnostic[];\n}\n\nexport interface DatasetRunRecord extends DatasetScope {\n id: string;\n datasetId: string;\n actor: string;\n planRevision: number;\n schemaRef: string;\n sourceRefs: string[];\n state: 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';\n createdAt: string;\n expiresAt: string;\n workerPid: number;\n idempotencyKey?: string;\n requestDigest: string;\n cancelRequested?: boolean;\n metadata?: DatasetRunMetadata;\n diagnostics: DatasetDiagnostic[];\n data?: DatasetObject;\n}\n\nexport interface DatasetResponseFixture extends DatasetScope {\n id: string;\n datasetId: string;\n owner: string;\n name: string;\n createdAt: string;\n expiresAt: string;\n parameters: DatasetObject;\n responses: Record<string, DatasetObject[]>;\n}\n\nexport interface ReportAcquisition {\n planRevision: number;\n parameters?: Record<string, unknown>;\n}\n\nexport const datasetActions = [\n 'sources.read', 'sources.manage', 'sources.connect', 'datasets.plan.edit',\n 'datasets.test', 'datasets.execute', 'datasets.results', 'datasets.raw', 'datasets.publish',\n] as const;\n\nexport type DatasetAction = typeof datasetActions[number];\n"],"mappings":";AACA,IAAM,SAAO,oBAAI,IAAI,CAAC,aAAY,eAAc,WAAW,CAAC;AACrD,IAAM,WAAS,CAAC,MAAgC,MAAI,QAAM,OAAO,MAAI,YAAU,CAAC,MAAM,QAAQ,CAAC;AAC/F,IAAM,cAAY,CAAC,MAAW,EAAE,QAAQ,MAAK,IAAI,EAAE,QAAQ,OAAM,IAAI;AACrE,SAAS,UAAU,OAAU,QAAM,GAAO;AAAC,MAAG,QAAM,GAAG,OAAM,IAAI,MAAM,gCAAgC;AAAE,MAAG,MAAM,QAAQ,KAAK,GAAE;AAAC,QAAG,MAAM,SAAO,IAAM,OAAM,IAAI,MAAM,kCAAkC;AAAE,UAAM,QAAQ,OAAG,UAAU,GAAE,QAAM,CAAC,CAAC;AAAA,EAAE,WAAS,SAAS,KAAK,GAAE;AAAC,eAAS,CAAC,GAAE,CAAC,KAAI,OAAO,QAAQ,KAAK,GAAE;AAAC,UAAG,OAA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,KAAK,EAAC,CAAC;AAAA,MAAE;AAAA,IAAC;AAAA,EAChmB;AACA,SAAO,OAAO,KAAK,CAAC,GAAE,MAAI,EAAE,cAAc,QAAM,EAAE,cAAc,SAAO,EAAE,MAAM,KAAK,cAAc,EAAE,MAAM,IAAI,CAAC;AACjH;;;ACwFO,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EAAgB;AAAA,EAAkB;AAAA,EAAmB;AAAA,EACrD;AAAA,EAAiB;AAAA,EAAoB;AAAA,EAAoB;AAAA,EAAgB;AAC3E;","names":["type","d","v","t","f","resolve"]}
1
+ {"version":3,"sources":["../src/schema.ts","../src/validation.ts","../src/store.ts","../src/service.ts","../src/analysis.ts","../src/dataset-types.ts"],"sourcesContent":["import type{JsonSchema,FieldDescriptor,Presence,Compatibility,SchemaChange}from'./types.js';\nconst unsafe=new Set(['__proto__','constructor','prototype']);\nexport const isObject=(v:any):v is Record<string,any>=>v!==null&&typeof v==='object'&&!Array.isArray(v);\nexport const jsonPointer=(s:string)=>s.replace(/~/g,'~0').replace(/\\//g,'~1');\nexport function safeInput(value:any,depth=0):void{if(depth>48)throw new Error('Input exceeds the depth limit.');if(Array.isArray(value)){if(value.length>10000)throw new Error('Collection exceeds 10,000 items.');value.forEach(v=>safeInput(v,depth+1));}else if(isObject(value)){for(const[k,v]of Object.entries(value)){if(unsafe.has(k))throw new Error('Prototype keys are not allowed.');safeInput(v,depth+1);}}}\nexport function schemaTypes(schema:JsonSchema):string[]{if(schema===true)return['unknown'];if(schema===false)return['never'];if(schema.type)return Array.isArray(schema.type)?schema.type:[schema.type];if(Object.hasOwn(schema,'const'))return[valueType(schema.const)];if(schema.enum)return[...new Set(schema.enum.map(valueType))] as string[];if(schema.properties)return['object'];if(schema.items||schema.prefixItems)return['array'];if(schema.anyOf||schema.oneOf)return[...new Set((schema.anyOf ?? schema.oneOf).flatMap(schemaTypes))] as string[];if(schema.allOf){const groups=schema.allOf.map(schemaTypes).filter((g:string[])=>!g.includes('unknown'));return groups.length?groups.reduce((a:string[],b:string[])=>a.filter(t=>b.includes(t)||(t==='integer'&&b.includes('number')))) :['unknown'];}return['unknown'];}\nconst valueType=(v:any):string=>v===null?'null':Array.isArray(v)?'array':typeof v==='number'?(Number.isInteger(v)?'integer':'number'):typeof v;\nexport type ProjectionOptions={root?:'dataSets'|'variables'|'row';alias?:string;datasetId?:string;schemaRef?:string;registry?:Record<string,JsonSchema>;maxDepth?:number};\nexport function resolveSchemaRef(ref:string,document:JsonSchema,registry:Record<string,JsonSchema>={}):JsonSchema|undefined{\n const split=ref.indexOf('#'),base=split<0?ref:ref.slice(0,split),fragment=split<0?'':ref.slice(split+1);let target:any=base?registry[base]:document;if(target===undefined)return;\n if(!fragment)return target;if(fragment.startsWith('/')){for(const raw of fragment.slice(1).split('/')){const key=decodeURIComponent(raw).replace(/~1/g,'/').replace(/~0/g,'~');if(unsafe.has(key)||!isObject(target)&&!Array.isArray(target)||!Object.hasOwn(target,key))return;target=(target as any)[key];}return target;}\n let found:any;const walk=(v:any)=>{if(!isObject(v)||found)return;if(v.$anchor===fragment||v.$dynamicAnchor===fragment){found=v;return;}Object.values(v).forEach(child=>{if(Array.isArray(child))child.forEach(walk);else walk(child);});};walk(target);return found;\n}\ntype Variant={schema:JsonSchema;pointer:string;conditional:boolean;recursive?:boolean};\nfunction variants(schema:JsonSchema,root:JsonSchema,registry:Record<string,JsonSchema>,pointer='#',seen=new Set<string>(),depth=0):Variant[]{\n if(depth>24)return[{schema:true,pointer,conditional:true,recursive:true}];if(typeof schema==='boolean')return[{schema,pointer,conditional:false}];\n if(schema.$dynamicRef)return[{schema:true,pointer,conditional:true,recursive:true}];\n if(schema.$ref){if(seen.has(schema.$ref))return[{schema:true,pointer,conditional:true,recursive:true}];const target=resolveSchemaRef(schema.$ref,root,registry);if(target===undefined)return[{schema:true,pointer,conditional:true}];const next=new Set(seen).add(schema.$ref);const base=schema.$ref.split('#')[0];return variants(target,base?registry[base]??root:root,registry,schema.$ref,next,depth+1).map(v=>({...v,schema:mergeSchemas(v.schema,Object.fromEntries(Object.entries(schema).filter(([k])=>k!=='$ref')))}));}\n const own={...schema};delete own.anyOf;delete own.oneOf;delete own.allOf;\n let result:Variant[]=[{schema:own,pointer,conditional:!!(schema.if||schema.dependentSchemas||schema.not)}];\n if(schema.allOf)for(let i=0;i<schema.allOf.length;i++){const branches=variants(schema.allOf[i],root,registry,`${pointer}/allOf/${i}`,seen,depth+1);result=result.flatMap(a=>branches.map(b=>({schema:mergeSchemas(a.schema,b.schema),pointer:a.pointer,conditional:a.conditional||b.conditional,recursive:a.recursive||b.recursive}))).slice(0,64);}\n const union=schema.anyOf ?? schema.oneOf;if(union)result=result.flatMap(a=>union.flatMap((s:any,i:number)=>variants(s,root,registry,`${pointer}/${schema.anyOf?'anyOf':'oneOf'}/${i}`,seen,depth+1).map(b=>({schema:mergeSchemas(a.schema,b.schema),pointer:b.pointer,conditional:a.conditional||b.conditional,recursive:b.recursive})))).slice(0,64);\n return result;\n}\nfunction mergeSchemas(a:JsonSchema,b:JsonSchema):JsonSchema{if(a===false||b===false)return false;if(a===true)return b;if(b===true)return a;const out:any={...a,...b};if(a.type&&b.type){const ta=schemaTypes(a),tb=schemaTypes(b);const types=ta.filter(t=>tb.includes(t)||(t==='integer'&&tb.includes('number'))).concat(tb.filter(t=>t==='integer'&&ta.includes('number')));if(!types.length)return false;out.type=[...new Set(types)];}if(a.properties||b.properties){out.properties={...a.properties};for(const[k,v]of Object.entries(b.properties ?? {}))out.properties[k]=a.properties?.[k]?mergeSchemas(a.properties[k],v as any):v;}if(a.required||b.required)out.required=[...new Set([...(a.required??[]),...(b.required??[])])];return out;}\nfunction combine(schemas:JsonSchema[]):JsonSchema{if(schemas.length===1)return schemas[0];return{anyOf:schemas};}\nfunction qualifyReferences(value:any,base:string,depth=0):any{if(depth>48)return true;if(Array.isArray(value))return value.map(v=>qualifyReferences(v,base,depth+1));if(!isObject(value))return value;const current=typeof value.$id==='string'?value.$id:base;return Object.fromEntries(Object.entries(value).map(([key,v])=>[key,(key==='$ref'||key==='$dynamicRef')&&typeof v==='string'&&v.startsWith('#')?current+v:qualifyReferences(v,current,depth+1)]));}\nexport function projectFields(schema:JsonSchema,options:ProjectionOptions={}):FieldDescriptor[]{\n const root=options.root ?? 'dataSets',registry:Record<string,JsonSchema>=Object.fromEntries(Object.entries(options.registry??{}).map(([ref,document])=>[ref,qualifyReferences(document,ref)])),result:FieldDescriptor[]=[];\n const base=options.schemaRef??(isObject(schema)&&typeof schema.$id==='string'?schema.$id:'reportic.projection.root');schema=qualifyReferences(schema,base);registry[base]??=schema;\n const walk=(current:JsonSchema,segments:string[],pointer:string,parentPresence:Presence,collectionPath?:string,depth=0,ancestry=new Set<JsonSchema>())=>{\n if(depth>(options.maxDepth ?? 12))return;const branches=variants(current,schema,registry,pointer),objects=branches.filter(v=>isObject(v.schema));const keys=new Set(objects.flatMap(v=>Object.keys((v.schema as any).properties ?? {})));\n for(const key of keys){const candidates=objects.filter(v=>Object.hasOwn((v.schema as any).properties ?? {},key));const schemas=candidates.map(v=>(v.schema as any).properties[key] as JsonSchema);const combined=combine(schemas),types=[...new Set(schemas.flatMap(s=>variants(s,schema,registry).flatMap(v=>schemaTypes(v.schema))))];const conditional=candidates.length!==branches.length||candidates.some(v=>v.conditional);const locallyRequired=candidates.length===branches.length&&candidates.every(v=>((v.schema as any).required ?? []).includes(key));\n const presence:Presence=parentPresence==='conditional'||conditional?'conditional':parentPresence==='optional'||!locallyRequired?'optional':parentPresence==='unknown'?'unknown':'required';\n const pathParts=[...segments,key],path=pathParts.join('.').replace(/\\.\\[\\]/g,'[]');const addressable=pathParts.every(p=>p==='[]'||/^[A-Za-z0-9_-]+$/.test(p)&&!unsafe.has(p))&&!collectionPath;\n const shape=isObject(schemas[0])?schemas[0]:{};const prefix=root==='dataSets'?`dataSets.${options.alias ?? 'dataset'}`:root;\n const expanded=variants(combined,schema,registry,pointer+'/properties/'+jsonPointer(key));const recursive=expanded.some(v=>v.recursive);const itemSchemas=expanded.filter(v=>isObject(v.schema)&&v.schema.items!==undefined).map(v=>(v.schema as any).items as JsonSchema);const itemSchema=itemSchemas.length?combine(itemSchemas):undefined;\n const field:FieldDescriptor={path,segments:pathParts,reporticPath:addressable?prefix+'.'+path:undefined,schemaPointer:pointer+'/properties/'+jsonPointer(key),types,presence,nullable:types.includes('null'),addressable,reason:collectionPath?'Item fields need an explicit row scope from '+collectionPath:!addressable?'This property name is not representable by Reportic’s exact dot-path grammar.':recursive?'Recursive shape; deeper paths require runtime validation.':undefined,description:shape.description,label:shape['x-reportic-label']??shape.title??key.replace(/([a-z])([A-Z])/g,'$1 $2').replace(/[_-]/g,' '),format:shape.format,role:shape['x-reportic-role'],unit:shape['x-reportic-unit'],sensitivity:shape['x-reportic-sensitivity'],schema:combined,itemSchema,datasetId:options.datasetId,schemaRef:options.schemaRef,scope:root,collectionPath,conditional,recursive};\n result.push(field);if(!recursive&&!ancestry.has(combined)){const next=new Set(ancestry).add(combined);if(types.includes('object'))walk(combined,pathParts,field.schemaPointer,presence,collectionPath,depth+1,next);if(types.includes('array')&&itemSchema)walk(itemSchema,[...pathParts,'[]'],field.schemaPointer+'/items',presence,path,depth+1,next);}\n }\n };walk(schema,[],'#','required');return result;\n}\nexport function fieldAt(schema:JsonSchema,path:string,options:ProjectionOptions={}):FieldDescriptor|undefined{const fields=projectFields(schema,{...options,maxDepth:20}).filter(f=>f.path===path);return fields.find(f=>f.addressable)??fields[0];}\nfunction shapeCompatibility(actual:JsonSchema,expected:JsonSchema,depth=0):Compatibility{\n const outcome=(state:Compatibility['state'],reason:string):Compatibility=>({state,reason,score:{compatible:100,conditional:65,unknown:25,incompatible:0}[state]});\n if(depth>10)return outcome('unknown','Deep object shapes require runtime validation.');\n if(expected===true)return outcome('compatible','No additional shape constraints.');\n if(expected===false||actual===false)return outcome('incompatible','The schema does not permit this value.');\n if(actual===true||isObject(actual)&&actual.$ref)return outcome('unknown','This object shape needs runtime validation.');\n if(expected.anyOf||expected.oneOf)return(expected.anyOf??expected.oneOf).map((branch:JsonSchema)=>shapeCompatibility(actual,branch,depth+1)).sort((a:Compatibility,b:Compatibility)=>b.score-a.score)[0];\n if(actual.anyOf||actual.oneOf){const matches=(actual.anyOf??actual.oneOf).map((branch:JsonSchema)=>shapeCompatibility(branch,expected,depth+1));if(matches.every((m:Compatibility)=>m.state==='compatible'))return matches[0];if(matches.every((m:Compatibility)=>m.state==='incompatible'))return matches[0];return outcome('conditional','Only some object branches guarantee the required shape.');}\n const wanted=schemaTypes(expected),types=schemaTypes(actual);if(types.includes('unknown'))return outcome('unknown','The schema does not establish this nested shape.');if(!types.some(t=>wanted.includes(t)||t==='integer'&&wanted.includes('number')||wanted.includes('unknown')))return outcome('incompatible','A required nested field has an incompatible type.');\n const results:Compatibility[]=[];\n for(const key of expected.required??[]){const child=actual.properties?.[key];if(!child){results.push(outcome(actual.additionalProperties===false?'incompatible':'unknown','The required '+key+' field is not established by the schema.'));continue;}if(!actual.required?.includes(key))results.push(outcome('conditional','The required '+key+' field is optional in this schema.'));if(expected.properties?.[key])results.push(shapeCompatibility(child,expected.properties[key],depth+1));}\n if(wanted.includes('array')&&expected.items)results.push(actual.items?shapeCompatibility(actual.items,expected.items,depth+1):outcome('unknown','The collection item shape is not established.'));\n return results.sort((a,b)=>a.score-b.score)[0]??outcome('compatible','The required object fields match.');\n}\nexport function compatibility(field:Pick<FieldDescriptor,'types'|'presence'|'nullable'|'addressable'|'schema'>,expected:JsonSchema,roles:string[]=[]):Compatibility{\n if(!field.addressable)return{state:'incompatible',reason:'This field is not addressable in the current Reportic scope.',score:0};\n const wanted=schemaTypes(expected),actual=field.types;if(wanted.includes('unknown')||actual.includes('unknown'))return{state:'unknown',reason:'The schema does not establish this shape. Validate actual inputs.',score:25};\n const matches=(t:string)=>wanted.includes(t)||(t==='integer'&&wanted.includes('number'));const overlap=actual.filter(matches);\n if(!overlap.length)return{state:'incompatible',reason:`Expected ${wanted.join(' or ')}, found ${actual.join(' or ')}.`,score:0};\n if(wanted.includes('array')&&actual.includes('array')&&isObject(expected)&&isObject(expected.items)&&schemaTypes(expected.items).includes('object')){\n const item=isObject(field.schema)?field.schema.items:undefined;if(item){const itemTypes=schemaTypes(item);if(!itemTypes.includes('object')&&!itemTypes.includes('unknown'))return{state:'incompatible',reason:'This collection does not contain records.',score:0};}\n }\n if(wanted.includes('object')||wanted.includes('array')){const shape=shapeCompatibility(field.schema,expected);if(shape.state!=='compatible')return shape;}\n if(overlap.length<actual.length||field.presence!=='required')return{state:'conditional',reason:overlap.length<actual.length?'Only some union branches match the expected type.':field.presence==='conditional'?'This path is available in only some schema branches.':'An ancestor or this field is optional; provide a fallback or verify the runtime branch.',score:65};\n return{state:'compatible',reason:'The declared type and guaranteed presence match this property.',score:100};\n}\nexport function inferSchema(samples:unknown[]):Record<string,any>{\n const infer=(values:any[]):JsonSchema=>{const types=[...new Set(values.map(valueType))];if(types.every(t=>t==='integer'||t==='number'))return{type:types.includes('number')?'number':'integer','x-reportic-inferred':true};if(types.length!==1)return{anyOf:types.map(type=>infer(values.filter(v=>valueType(v)===type))),'x-reportic-review':'Mixed sample types do not establish the full contract.'};const type=types[0]??'unknown';if(type==='object'){const keys=new Set(values.flatMap(v=>Object.keys(v)));return{type:'object',properties:Object.fromEntries([...keys].map(k=>[k,infer(values.filter(v=>Object.hasOwn(v,k)).map(v=>v[k]))])),additionalProperties:true,'x-reportic-review':'Required fields were not inferred. Review presence and constraints.'};}if(type==='array'){const all=values.flat();return{type:'array',items:all.length?infer(all):{},'x-reportic-review':all.length?'Item shapes are based on examples only.':'Empty arrays do not establish an item type.'};}return{type:type==='undefined'?'null':type,'x-reportic-inferred':true};};\n if(!samples.length||samples.some(v=>!isObject(v)))throw new Error('Provide one or more object samples.');samples.forEach(s=>safeInput(s));return{$schema:'https://json-schema.org/draft/2020-12/schema',...infer(samples) as any};\n}\nexport function compareSchemas(previous:JsonSchema,next:JsonSchema,registry:Record<string,JsonSchema>={}):SchemaChange[]{\n const before=projectFields(previous,{registry}),after=projectFields(next,{registry}),changes:SchemaChange[]=[];\n for(const field of before){const replacement=after.find(f=>f.path===field.path);if(!replacement){const parent=field.path.slice(0,field.path.lastIndexOf('.')+1);const candidates=after.filter(f=>f.path.startsWith(parent)&&f.path.slice(parent.length).indexOf('.')<0&&!before.some(b=>b.path===f.path)&&f.types.some(t=>field.types.includes(t)));changes.push({path:field.path,kind:'removed',severity:'breaking',message:'Field removed from the new contract.',replacement:candidates.length===1?candidates[0].path:undefined});continue;}if(field.types.some(t=>!replacement.types.includes(t)&&!(t==='integer'&&replacement.types.includes('number'))))changes.push({path:field.path,kind:'type',severity:'breaking',message:`Type changed from ${field.types.join('|')} to ${replacement.types.join('|')}.`});if(field.presence==='required'&&replacement.presence!=='required')changes.push({path:field.path,kind:'presence',severity:'breaking',message:'A previously guaranteed field is now optional or conditional.'});if(!field.nullable&&replacement.nullable)changes.push({path:field.path,kind:'nullable',severity:'breaking',message:'Null is newly permitted.'});if(JSON.stringify(field.schema)!==JSON.stringify(replacement.schema)&&!changes.some(c=>c.path===field.path))changes.push({path:field.path,kind:'constraints',severity:'review',message:'Constraints or annotations changed; review compatibility.'});}\n for(const f of after)if(!before.some(b=>b.path===f.path))changes.push({path:f.path,kind:'added',severity:'additive',message:'New field available.'});return changes;\n}\n","import Ajv2020 from 'ajv/dist/2020.js';\nimport addFormats from 'ajv-formats';\nimport {createHash}from'node:crypto';\nimport {isObject,safeInput,schemaTypes,resolveSchemaRef}from'./schema.js';\nimport type{JsonSchema,StudioDiagnostic}from'./types.js';\nexport const canonicalJson=(value:any):string=>Array.isArray(value)?'['+value.map(canonicalJson).join(',')+']':isObject(value)?'{'+Object.keys(value).sort().map(k=>JSON.stringify(k)+':'+canonicalJson(value[k])).join(',')+'}':JSON.stringify(value);\nexport const digest=(value:any)=>createHash('sha256').update(typeof value==='string'?value:canonicalJson(value)).digest('hex');\nexport function schemaReferences(schema:any):string[]{const refs=new Set<string>();const walk=(value:any)=>{if(!isObject(value))return;for(const[key,v]of Object.entries(value)){if(['$ref','$dynamicRef'].includes(key)&&typeof v==='string'&&!v.startsWith('#'))refs.add(v.split('#')[0]);else if(Array.isArray(v))v.forEach(walk);else if(isObject(v))walk(v);}};walk(schema);return[...refs];}\nexport function createSchemaValidator(schema:JsonSchema,registry:Record<string,JsonSchema>={}){\n const ajv=new Ajv2020({allErrors:true,strict:false,allowUnionTypes:true,validateFormats:true,loadSchema:undefined});addFormats(ajv);\n for(const[ref,s]of Object.entries(registry)){if(s===schema||isObject(s)&&isObject(schema)&&s.$id&&s.$id===schema.$id)continue;if(!ajv.getSchema(ref))ajv.addSchema(s,ref);}\n return{ajv,validate:ajv.compile(schema)};\n}\nexport function validateSchemaDocument(schema:any,registry:Record<string,JsonSchema>={}):StudioDiagnostic[]{\n const ds:StudioDiagnostic[]=[];try{\n safeInput(schema);if(Buffer.byteLength(JSON.stringify(schema))>2_000_000)throw new Error('Schema exceeds 2 MB.');\n if(!isObject(schema))throw new Error('A dataset schema must be an object.');\n if(schema.$schema&&schema.$schema!=='https://json-schema.org/draft/2020-12/schema'&&schema.$schema!=='https://json-schema.org/draft/2020-12/schema#')throw new Error('Use JSON Schema draft 2020-12.');\n const types=schemaTypes(schema);if(!types.includes('object')||types.some(t=>!['object','unknown'].includes(t)))throw new Error('Dataset schema root must guarantee an object.');\n for(const ref of schemaReferences(schema))if(!Object.hasOwn(registry,ref))ds.push({code:'SCHEMA_REFERENCE_UNAVAILABLE',severity:'error',phase:'catalog',message:`Schema reference ${ref} is unavailable in this agent’s catalog.`,schemaRef:ref});\n const scan=(v:any)=>{if(!isObject(v))return;if(typeof v.$ref==='string'&&v.$ref.startsWith('#')&&resolveSchemaRef(v.$ref,schema,registry)===undefined)ds.push({code:'SCHEMA_REFERENCE_UNAVAILABLE',severity:'error',phase:'catalog',message:'An internal schema reference does not resolve.',schemaRef:v.$ref});for(const child of Object.values(v)){if(Array.isArray(child))child.forEach(scan);else scan(child);}};scan(schema);\n if(!ds.some(d=>d.severity==='error'))createSchemaValidator(schema,registry);\n }catch(e:any){ds.push({code:'INVALID_SCHEMA',severity:'error',phase:'catalog',message:String(e.message).slice(0,600)});}return ds;\n}\nexport function validateSample(schema:JsonSchema,value:any,registry:Record<string,JsonSchema>={}):{valid:boolean;diagnostics:StudioDiagnostic[]}{\n const diagnostics:StudioDiagnostic[]=[];try{safeInput(value);const{validate}=createSchemaValidator(schema,registry);if(!validate(value))for(const error of validate.errors ?? [])diagnostics.push({code:'FIXTURE_SCHEMA_MISMATCH',severity:'error',phase:'input',message:`${error.instancePath||'/'} ${error.message}`,bindingPath:error.instancePath,guidance:'Update the sample or choose its exact schema version.'});}catch{diagnostics.push({code:'FIXTURE_VALIDATION_FAILED',severity:'error',phase:'input',message:'The sample or its pinned schema could not be validated.'});}return{valid:!diagnostics.some(d=>d.severity==='error'),diagnostics};\n}\n","import{mkdir,readFile,writeFile,rename,unlink,open,stat}from'node:fs/promises';\r\nimport{dirname,resolve}from'node:path';\r\nimport type{Agent,DatasetDefinition,TemplateDocument,Fixture}from'./types.js';\r\nimport type { DatasetSource, DatasetPlanRecord, DatasetRunRecord, DatasetResponseFixture } from './dataset-types.js';\r\nexport type AuditEvent={id:string;at:string;actor:string;workspaceId:string;agentId:string;action:string;resourceId:string;detail?:Record<string,any>};\r\nexport type CatalogState={version:1;agents:Agent[];datasets:DatasetDefinition[];templates:TemplateDocument[];fixtures:Fixture[];audit:AuditEvent[];datasetSources?:DatasetSource[];datasetPlans?:DatasetPlanRecord[];datasetRuns?:DatasetRunRecord[];datasetResponseFixtures?:DatasetResponseFixture[]};\r\nexport interface CatalogStorage{read():Promise<CatalogState>;transaction<T>(work:(state:CatalogState)=>T|Promise<T>):Promise<T>;}\r\nexport const emptyState=():CatalogState=>({version:1,agents:[],datasets:[],templates:[],fixtures:[],audit:[]});\r\nexport class MemoryCatalogStorage implements CatalogStorage{\r\n private state:CatalogState;private pending=Promise.resolve();constructor(seed:CatalogState=emptyState()){this.state=structuredClone(seed);}\r\n async read(){await this.pending;return structuredClone(this.state);}\r\n transaction<T>(work:(state:CatalogState)=>T|Promise<T>):Promise<T>{const task=this.pending.then(async()=>{const next=structuredClone(this.state);const result=await work(next);this.state=next;return structuredClone(result);});this.pending=task.then(()=>{},()=>{});return task;}\r\n}\r\nexport class FileCatalogStorage implements CatalogStorage{\r\n readonly filename:string;private pending=Promise.resolve();constructor(filename:string){this.filename=resolve(filename);}\r\n async read(){await this.pending;return this.load();}\r\n private async load():Promise<CatalogState>{try{const data=JSON.parse(await readFile(this.filename,'utf8'));if(data.version!==1)throw new Error('Unsupported catalog storage version.');return data;}catch(e:any){if(e.code==='ENOENT')return emptyState();throw e;}}\r\n transaction<T>(work:(state:CatalogState)=>T|Promise<T>):Promise<T>{const task=this.pending.then(async()=>{\r\n await mkdir(dirname(this.filename),{recursive:true});const lock=this.filename+'.lock';let handle:any;\r\n for(let i=0;i<100;i++){try{handle=await open(lock,'wx');await handle.writeFile(String(process.pid));break;}catch(e:any){if(e.code!=='EEXIST')throw e;try{const pid=Number(await readFile(lock,'utf8'));if(pid&&pid!==process.pid){try{process.kill(pid,0);}catch(err:any){if(err.code==='ESRCH'){await unlink(lock);continue;}}}}catch{}await new Promise(r=>setTimeout(r,50));}}\r\n if(!handle)throw new Error('Catalog storage is busy. Retry the operation.');const temporary=this.filename+'.'+process.pid+'.tmp';\r\n try{const state=await this.load();const result=await work(state);const content=JSON.stringify(state);if(Buffer.byteLength(content)>150_000_000)throw new Error('Local catalog storage limit reached.');await writeFile(temporary,content,{encoding:'utf8',mode:0o600});await rename(temporary,this.filename);return structuredClone(result);}finally{await handle.close();await unlink(lock).catch(()=>{});await unlink(temporary).catch(()=>{});}\r\n });this.pending=task.then(()=>{},()=>{});return task;}\r\n}\r\n","import{randomUUID}from'node:crypto';\nimport type{CatalogStorage,CatalogState}from'./store.js';\nimport type{Principal,HostIdentity,Action,Agent,DatasetDefinition,SchemaVersion,TemplateDocument,AuthoringManifest,Fixture,Mapping,StudioPage}from'./types.js';\nimport{inferSchema,projectFields,compareSchemas,isObject,safeInput}from'./schema.js';\nimport{validateSchemaDocument,validateSample,digest,schemaReferences}from'./validation.js';\n/** Theme tokens, theme rules and page setup travel with a template. Only plain, bounded values are kept. */\nexport function lookOf(input:any):{themeTokens?:Record<string,unknown>;themeRules?:Record<string,Record<string,string|number>>;page?:StudioPage}{const out:any={};const bounded=(value:any,name:string)=>{if(!isObject(value)||Buffer.byteLength(JSON.stringify(value))>100_000)throw new CatalogError('INVALID_THEME',name+' must be a small object.');return value;};if(input?.themeTokens!==undefined&&input.themeTokens!==null)out.themeTokens=bounded(input.themeTokens,'Theme tokens');if(input?.themeRules!==undefined&&input.themeRules!==null){const rules=bounded(input.themeRules,'Theme rules');for(const value of Object.values(rules))if(!isObject(value)||Object.values(value).some(v=>typeof v!=='string'&&typeof v!=='number'))throw new CatalogError('INVALID_THEME','Theme rules must map selectors to text or number values.');out.themeRules=rules;}if(input?.page!==undefined&&input.page!==null){const page=input.page,next:StudioPage={};if(!isObject(page))throw new CatalogError('INVALID_PAGE','Page setup must be an object.');if(page.size!==undefined){if(page.size!=='A4'&&page.size!=='Letter')throw new CatalogError('INVALID_PAGE','Page size must be A4 or Letter.');next.size=page.size;}if(page.landscape!==undefined){if(typeof page.landscape!=='boolean')throw new CatalogError('INVALID_PAGE','Page orientation must be true or false.');next.landscape=page.landscape;}if(page.deck!==undefined){if(page.deck!=='wide'&&page.deck!=='standard')throw new CatalogError('INVALID_PAGE','Slide shape must be wide or standard.');next.deck=page.deck;}out.page=next;}return out;}\n\nexport class CatalogError extends Error{constructor(public code:string,message:string,public status=422,public details?:any){super(message);this.name='CatalogError';}}\nexport function assertName(name:any){if(typeof name!=='string'||!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)||['constructor','prototype','__proto__'].includes(name))throw new CatalogError('INVALID_DATASET_NAME','Use an identifier-style canonical name.');}\nexport const scopeMatch=(v:{workspaceId:string;agentId:string},p:Principal,agentId:string)=>v.workspaceId===p.workspaceId&&v.agentId===agentId;\nexport function audit(state:CatalogState,p:Principal,agentId:string,action:string,resourceId:string,detail?:any){state.audit.push({id:randomUUID(),at:new Date().toISOString(),actor:p.id,workspaceId:p.workspaceId,agentId,action,resourceId,detail});if(state.audit.length>10000)state.audit.splice(0,state.audit.length-10000);}\nexport const manifestFor=(agentId:string):AuthoringManifest=>({manifestVersion:1,agentId,dataSetMappings:{}});\nexport function publishDatasetSchema(\n state: CatalogState, actor: Principal, dataset: DatasetDefinition, expectedRevision: number,\n registry: Record<string, Record<string, unknown>>,\n): SchemaVersion {\n if (expectedRevision !== dataset.revision) {\n throw new CatalogError('REVISION_CONFLICT','The schema draft changed. Review its current revision before publishing.',409,{current:dataset});\n }\n let draft;\n try { draft = JSON.parse(dataset.draftSchemaText); } catch {\n throw new CatalogError('INVALID_SCHEMA_JSON','Fix the schema JSON before publishing.');\n }\n const diagnostics = validateSchemaDocument(draft, registry);\n if (diagnostics.length) throw new CatalogError('INVALID_SCHEMA','The schema cannot be published.',422,{diagnostics});\n const previous = dataset.versions.at(-1);\n const version = (previous?.version ?? 0) + 1;\n const schemaRef = 'reportic.dataset.' + dataset.id + '.v' + version;\n const schema = {$schema:'https://json-schema.org/draft/2020-12/schema', ...draft, $id:schemaRef};\n const published: SchemaVersion = {\n version, schemaRef, schema, digest:digest(schema), references:schemaReferences(schema),\n publishedAt:new Date().toISOString(), publishedBy:actor.id,\n compatibility:previous ? compareSchemas(previous.schema,schema,registry) : [],\n };\n dataset.versions.push(published);\n dataset.status = 'active';\n dataset.revision++;\n dataset.updatedAt = published.publishedAt;\n audit(state,actor,dataset.agentId,'schema.published',dataset.id,{schemaRef,version,digest:published.digest});\n return published;\n}\n\nexport class CatalogService{\n constructor(public storage:CatalogStorage,public identity:HostIdentity){}\n async authorize(principal:Principal,agentId:string,action:Action){const state=await this.storage.read();const agent=state.agents.find(a=>a.id===agentId&&a.workspaceId===principal.workspaceId);if(!agent||!principal.agentIds.includes(agentId)||!principal.actions.includes(action)||this.identity.authorize&&!await this.identity.authorize(principal,agent,action))throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);return agent;}\n async agents(p:Principal){const state=await this.storage.read();const result:Agent[]=[];for(const a of state.agents)if(a.workspaceId===p.workspaceId&&p.agentIds.includes(a.id)&&(!this.identity.authorize||await this.identity.authorize(p,a,'catalog.read')))result.push(a);return result;}\n async registry(p:Principal,agentId:string){await this.authorize(p,agentId,'catalog.read');const state=await this.storage.read();return this.registryFrom(state,p,agentId);}\n registryFrom(state:CatalogState,p:Principal,agentId:string):Record<string,any>{return Object.fromEntries(state.datasets.filter(d=>scopeMatch(d,p,agentId)).flatMap(d=>d.versions.map(v=>[v.schemaRef,v.schema])));}\n async listDatasets(p:Principal,agentId:string,search='',includeArchived=false){await this.authorize(p,agentId,'catalog.read');const state=await this.storage.read();return state.datasets.filter(d=>scopeMatch(d,p,agentId)&&(includeArchived||d.status!=='archived')&&JSON.stringify([d.name,d.displayName,d.description,d.tags,d.producer,d.status,d.versions.map(v=>v.version),d.draftSchemaText]).toLowerCase().includes(search.toLowerCase()));}\n async getDataset(p:Principal,agentId:string,id:string){await this.authorize(p,agentId,'catalog.read');const state=await this.storage.read();const d=state.datasets.find(d=>d.id===id&&scopeMatch(d,p,agentId));if(!d)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);return d;}\n async createDataset(p:Principal,agentId:string,input:any){await this.authorize(p,agentId,'catalog.edit');assertName(input.name);safeInput(input);const schemaText=typeof input.schemaText==='string'?input.schemaText:JSON.stringify(input.schema ?? (input.samples?inferSchema(input.samples):{$schema:'https://json-schema.org/draft/2020-12/schema',type:'object',properties:{}}),null,2);if(schemaText.length>2_000_000)throw new CatalogError('LIMIT_EXCEEDED','Schema text exceeds 2 MB.');return this.storage.transaction(state=>{if(state.datasets.some(d=>scopeMatch(d,p,agentId)&&d.name===input.name))throw new CatalogError('DUPLICATE_DATASET_NAME','This agent already has that canonical name.',409);const now=new Date().toISOString();const d:DatasetDefinition={id:'ds_'+randomUUID().replace(/-/g,''),workspaceId:p.workspaceId,agentId,name:input.name,displayName:String(input.displayName||input.name).slice(0,200),description:String(input.description||'').slice(0,2000),tags:Array.isArray(input.tags)?input.tags.slice(0,20).map(String):[],producer:typeof input.producer==='string'?input.producer.slice(0,200):undefined,kind:input.kind==='variables'?'variables':'dataset',status:'draft',revision:1,draftSchemaText:schemaText,versions:[],createdAt:now,updatedAt:now,owner:p.id};state.datasets.push(d);audit(state,p,agentId,'dataset.created',d.id);return d;});}\n async saveDataset(p:Principal,agentId:string,id:string,input:any){await this.authorize(p,agentId,'catalog.edit');return this.storage.transaction(state=>{const d=state.datasets.find(d=>d.id===id&&scopeMatch(d,p,agentId));if(!d)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);if(input.expectedRevision!==d.revision)throw new CatalogError('REVISION_CONFLICT','This dataset changed in another session. Your local edit has been preserved.',409,{current:d});if(typeof input.schemaText==='string'){if(input.schemaText.length>2_000_000)throw new CatalogError('LIMIT_EXCEEDED','Schema text exceeds 2 MB.');d.draftSchemaText=input.schemaText;}for(const key of ['displayName','description','producer']as const)if(typeof input[key]==='string')d[key]=input[key].slice(0,key==='description'?2000:200);if(Array.isArray(input.tags))d.tags=input.tags.slice(0,20).map(String);d.revision++;d.updatedAt=new Date().toISOString();return d;});}\n async checkDataset(p:Principal,agentId:string,id:string,sample?:any){const d=await this.getDataset(p,agentId,id),registry=await this.registry(p,agentId);let schema:any;try{schema=JSON.parse(d.draftSchemaText);}catch{return{valid:false,diagnostics:[{code:'INVALID_SCHEMA_JSON',severity:'error',phase:'catalog',message:'The schema is not valid JSON.'}],fields:[]};}const diagnostics=validateSchemaDocument(schema,registry);const sampleResult=sample!==undefined?validateSample(schema,sample,registry):undefined;return{valid:!diagnostics.some(d=>d.severity==='error'),diagnostics,fields:projectFields(schema,{registry,datasetId:d.id,alias:d.name}),sample:sampleResult};}\n async publishDataset(p:Principal,agentId:string,id:string,expectedRevision:number){\n await this.authorize(p,agentId,'catalog.publish');\n return this.storage.transaction(state => {\n const dataset=state.datasets.find(item => item.id===id && scopeMatch(item,p,agentId));\n if(!dataset) throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);\n return {dataset,version:publishDatasetSchema(state,p,dataset,expectedRevision,this.registryFrom(state,p,agentId))};\n });\n }\n async setLifecycle(p:Principal,agentId:string,id:string,status:any,expectedRevision:number){await this.authorize(p,agentId,'catalog.publish');if(!['active','deprecated','archived'].includes(status))throw new CatalogError('INVALID_STATUS','Choose active, deprecated, or archived.');return this.storage.transaction(state=>{const d=state.datasets.find(d=>d.id===id&&scopeMatch(d,p,agentId));if(!d)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);if(d.revision!==expectedRevision)throw new CatalogError('REVISION_CONFLICT','Dataset changed. Refresh before changing its lifecycle.',409,{current:d});d.status=status;d.revision++;audit(state,p,agentId,'dataset.'+status,id);return d;});}\n async removeVersion(p:Principal,agentId:string,id:string,version:number){await this.authorize(p,agentId,'catalog.publish');return this.storage.transaction(state=>{const d=state.datasets.find(d=>d.id===id&&scopeMatch(d,p,agentId)),v=d?.versions.find(v=>v.version===version);if(!d||!v)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);if(state.templates.some(t=>scopeMatch(t,p,agentId)&&[t.manifest,...t.publishedRevisions.map(r=>r.manifest)].some(m=>Object.values(m.dataSetMappings).some(pin=>pin.schemaRef===v.schemaRef)))||state.datasets.some(d=>scopeMatch(d,p,agentId)&&d.versions.some(other=>other.references.includes(v.schemaRef)))||state.fixtures.some(f=>scopeMatch(f,p,agentId)&&Date.parse(f.expiresAt)>Date.now()&&Object.values(f.schemaPins).includes(v.schemaRef)))throw new CatalogError('SCHEMA_IN_USE','Retained templates, schemas, or fixtures still depend on this version.',409);throw new CatalogError('RETENTION_REQUIRED','Published schemas are retained. Configure an explicit host purge policy before removal.',409);});}\n async listTemplates(p:Principal,agentId:string){await this.authorize(p,agentId,'templates.read');return(await this.storage.read()).templates.filter(t=>scopeMatch(t,p,agentId));}\n async getTemplate(p:Principal,agentId:string,id:string){await this.authorize(p,agentId,'templates.read');const t=(await this.storage.read()).templates.find(t=>t.id===id&&scopeMatch(t,p,agentId));if(!t)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);return t;}\n async createTemplate(p:Principal,agentId:string,input:any){await this.authorize(p,agentId,'templates.edit');safeInput(input);return this.storage.transaction(state=>{const now=new Date().toISOString();const t:TemplateDocument={id:'tpl_'+randomUUID().replace(/-/g,''),workspaceId:p.workspaceId,agentId,name:String(input.name||'Untitled report').slice(0,200),description:String(input.description||'').slice(0,2000),category:String(input.category||'Custom'),color:String(input.color||'sage'),source:String(input.source ?? '# {{reportTitle}}\\n\\nA clear perspective.\\n'),manifest:input.manifest ?? manifestFor(agentId),revision:1,theme:input.theme ?? 'editorial',css:input.css,...lookOf(input),assets:input.assets ?? {},fixtureId:undefined,updatedAt:now,updatedBy:p.id,publishedRevisions:[]};if(t.manifest.agentId!==agentId||t.manifest.manifestVersion!==1)throw new CatalogError('MANIFEST_SCOPE_MISMATCH','The manifest must use the current authorized agent.');if(Buffer.byteLength(t.source)>1_000_000)throw new CatalogError('LIMIT_EXCEEDED','Template exceeds 1 MB.');state.templates.push(t);audit(state,p,agentId,'template.created',t.id);return t;});}\n async saveTemplate(p:Principal,agentId:string,id:string,input:any){await this.authorize(p,agentId,'templates.edit');safeInput(input);return this.storage.transaction(state=>{const t=state.templates.find(t=>t.id===id&&scopeMatch(t,p,agentId));if(!t)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);if(input.expectedRevision!==t.revision)throw new CatalogError('REVISION_CONFLICT','Another tab changed this draft. Keep your local version and review the conflict.',409,{current:t});if(typeof input.source==='string'){if(Buffer.byteLength(input.source)>1_000_000)throw new CatalogError('LIMIT_EXCEEDED','Template exceeds 1 MB.');t.source=input.source;}if(input.manifest){if(input.manifest.agentId!==agentId||input.manifest.manifestVersion!==1)throw new CatalogError('MANIFEST_SCOPE_MISMATCH','Manifest scope does not match the authorized agent.');if(digest(t.manifest)!==digest(input.manifest))audit(state,p,agentId,'template.mapping.changed',id,{schemaRefs:Object.values(input.manifest.dataSetMappings ?? {}).map((m:any)=>m.schemaRef)});t.manifest=input.manifest;}for(const key of ['name','description','category','theme','css','color','fixtureId']as const)if(input[key]!==undefined)(t as any)[key]=input[key];Object.assign(t,lookOf(input));for(const key of ['themeTokens','themeRules','page']as const)if(input[key]===null)delete t[key];if(input.assets)t.assets=input.assets;t.revision++;t.updatedAt=new Date().toISOString();t.updatedBy=p.id;return t;});}\n async listFixtures(p:Principal,agentId:string,templateId?:string){await this.authorize(p,agentId,'fixtures.read');const s=await this.storage.read();return s.fixtures.filter(f=>scopeMatch(f,p,agentId)&&Date.parse(f.expiresAt)>Date.now()&&(!templateId||!f.templateId||f.templateId===templateId)).map(({dataSets,variables,...metadata})=>metadata);}\n async getFixture(p:Principal,agentId:string,id:string){await this.authorize(p,agentId,'fixtures.read');return this.storage.transaction(state=>{const f=state.fixtures.find(f=>f.id===id&&scopeMatch(f,p,agentId)&&Date.parse(f.expiresAt)>Date.now());if(!f)throw new CatalogError('RESOURCE_UNAVAILABLE','Resource not found or unavailable.',404);audit(state,p,agentId,'fixture.accessed',id);return f;});}\n async createFixture(p:Principal,agentId:string,input:any){await this.authorize(p,agentId,'fixtures.manage');safeInput(input);if(!Array.isArray(input.dataSets)||!isObject(input.variables ?? {}))throw new CatalogError('INVALID_FIXTURE','Fixtures need a dataset array and variables object.');if(Buffer.byteLength(JSON.stringify(input))>12_000_000)throw new CatalogError('LIMIT_EXCEEDED','Fixture exceeds 12 MB.');const registry=await this.registry(p,agentId),diagnostics:any[]=[];for(const[name,ref]of Object.entries(input.schemaPins ?? {})){const schema=registry[String(ref)];if(!schema)throw new CatalogError('RESOURCE_UNAVAILABLE','A pinned schema is unavailable.',404);const data=name==='$variables'?{data:input.variables??{}}:input.dataSets.find((d:any)=>d.name===name);if(data)diagnostics.push(...validateSample(schema,data.data,registry).diagnostics);}\n if(diagnostics.length)throw new CatalogError('INVALID_FIXTURE','Fixture values do not match their pinned schemas.',422,{diagnostics});return this.storage.transaction(state=>{if(input.templateId&&!state.templates.some(t=>t.id===input.templateId&&scopeMatch(t,p,agentId)))throw new CatalogError('RESOURCE_UNAVAILABLE','Template unavailable.',404);const f:Fixture={id:'fx_'+randomUUID().replace(/-/g,''),workspaceId:p.workspaceId,agentId,templateId:input.templateId,name:String(input.name||'Preview fixture').slice(0,200),dataSets:input.dataSets,variables:input.variables ?? {},schemaPins:input.schemaPins ?? {},createdAt:new Date().toISOString(),expiresAt:new Date(Date.now()+Math.min(90,Math.max(1,Number(input.retentionDays)||30))*86400000).toISOString(),owner:p.id,sample:input.sample!==false};state.fixtures.push(f);audit(state,p,agentId,'fixture.created',f.id,{schemaPins:f.schemaPins,expiresAt:f.expiresAt});return f;});}\n async expireFixture(p:Principal,agentId:string,id:string){await this.authorize(p,agentId,'fixtures.manage');return this.storage.transaction(state=>{const f=state.fixtures.find(f=>f.id===id&&scopeMatch(f,p,agentId));if(!f)throw new CatalogError('RESOURCE_UNAVAILABLE','Fixture unavailable.',404);f.expiresAt=new Date().toISOString();f.dataSets=[];f.variables={};audit(state,p,agentId,'fixture.expired',id);return{id,state:'expired'};});}\n}\n","import{indexSource,getBindingSlot,sourceFingerprint,editElementProperty,declareDataset,type IndexedElement,type IndexedBinding}from'@x12i/reportic-core/authoring';\nimport type{ComponentDefinition}from'@x12i/reportic-core';\nimport{projectFields,fieldAt,compatibility,schemaTypes,isObject}from'./schema.js';\nimport type{Analysis,AuthoringManifest,DatasetDefinition,FieldDescriptor,BindingInspection,JsonSchema,StudioDiagnostic,Mapping}from'./types.js';\ntype RowContext={schema:JsonSchema;alias?:string;catalogPrefix:string;schemaRef?:string};\nexport const slotPath=(path:string):(string|number)[]=>path.replace(/\\[(\\d+)\\]/g,'.$1').split('.').filter(Boolean).map(p=>/^\\d+$/.test(p)?Number(p):p);\nexport const valueAt=(value:any,path:(string|number)[])=>path.reduce((v,key)=>v&&Object.hasOwn(v,key)?v[key]:undefined,value);\nexport function analyzeBindings(source:string,manifest:AuthoringManifest,datasets:DatasetDefinition[],components:Pick<ComponentDefinition,'type'|'schema'|'rowScopes'|'bindingSlots'|'capabilities'>[],options:{agentId?:string;format?:string;editability?:string}={}):Analysis{\n const index=indexSource(source),diagnostics:StudioDiagnostic[]=index.diagnostics.map(d=>({...d,phase:'authoring',line:d.range?.line,column:d.range?.column}));const bindings:BindingInspection[]=[];const schemaPins:Record<string,string>={};\n const registry=Object.fromEntries(datasets.flatMap(d=>d.versions.map(v=>[v.schemaRef,v.schema])));\n if(!manifest||manifest.manifestVersion!==1||options.agentId&&manifest.agentId!==options.agentId)diagnostics.push({code:'MANIFEST_SCOPE_MISMATCH',severity:'error',phase:'catalog',message:'The manifest does not match this agent context.'});\n const mappings=manifest?.dataSetMappings ?? {};const roots:Record<string,{schema:JsonSchema;schemaRef:string}>={};\n for(const[alias,mapping]of Object.entries(mappings)){\n const dataset=datasets.find(d=>d.id===mapping.datasetId),version=dataset?.versions.find(v=>v.version===mapping.schemaVersion&&v.schemaRef===mapping.schemaRef);\n if(!version){diagnostics.push({code:'SCHEMA_UNAVAILABLE',severity:'error',phase:'catalog',message:`The pinned schema for ${alias} is unavailable in this agent.`,datasetAlias:alias,guidance:'Choose an authorized dataset and exact published version.'});continue;}\n roots[alias]={schema:version.schema,schemaRef:version.schemaRef};schemaPins[alias]=version.schemaRef;\n if(index.metadata.dataSets?.[alias]?.schema!==version.schemaRef)diagnostics.push({code:'MAPPING_CONFLICT',severity:'error',phase:'catalog',message:`Source declaration and manifest disagree for ${alias}.`,datasetAlias:alias,schemaRef:version.schemaRef,guidance:'Review and reconcile the source declaration and saved mapping.'});\n if(dataset!.status==='deprecated')diagnostics.push({code:'DATASET_DEPRECATED',severity:'warning',phase:'catalog',message:`${alias} uses a deprecated catalog definition.`,datasetAlias:alias,schemaRef:version.schemaRef});\n }\n for(const[alias,decl]of Object.entries(index.metadata.dataSets ?? {}) as [string,any][])if(decl?.schema&&!mappings[alias])diagnostics.push({code:'SCHEMA_UNMAPPED',severity:'error',phase:'catalog',message:`Schema declaration ${alias} has no pinned authoring mapping.`,datasetAlias:alias,guidance:'Use the mapping reconciliation action or explicitly map this dataset.'});\n const variablePin=manifest?.variablesContract,variableDefinition=variablePin?datasets.find(d=>d.id===variablePin.datasetId&&d.kind==='variables'&&d.versions.some(v=>v.version===variablePin.schemaVersion&&v.schemaRef===variablePin.schemaRef)):undefined;\n const variableSchema=manifest?.variablesSchema ?? (variableDefinition&&variablePin?registry[variablePin.schemaRef]:undefined);if(variableDefinition&&variablePin)schemaPins['$variables']=variablePin.schemaRef;\n if(manifest?.variablesContract&&!variableDefinition)diagnostics.push({code:'VARIABLE_SCHEMA_UNAVAILABLE',severity:'error',phase:'catalog',message:'The pinned variable contract is unavailable in this agent.'});\n const resolve=(path:string,row?:RowContext):{field?:FieldDescriptor;alias?:string;ref?:string;catalogPath?:string;missingRoot?:boolean;unverified?:boolean;inline?:boolean}=>{\n const [root,name,...parts]=path.split('.');if(root==='dataSets'){\n const entry=roots[name];if(!entry)return{alias:name,missingRoot:true};if(!parts.length)return{field:{path:'',segments:[],types:['object'],presence:'required',nullable:false,addressable:true,schemaPointer:'#',schema:entry.schema,label:name,scope:'dataSets',reporticPath:path,schemaRef:entry.schemaRef},alias:name,ref:entry.schemaRef,catalogPath:''};\n return{field:fieldAt(entry.schema,parts.join('.'),{alias:name,schemaRef:entry.schemaRef,registry}),alias:name,ref:entry.schemaRef,catalogPath:parts.join('.')};\n }\n if(root==='row'){\n if(!row)return{missingRoot:true};if(row.schema===true)return{unverified:true,inline:true};const itemPath=[name,...parts].filter(Boolean).join('.');const field=!itemPath?{path:'',segments:[],types:schemaTypes(row.schema),presence:'required' as const,nullable:schemaTypes(row.schema).includes('null'),addressable:true,schemaPointer:'#',schema:row.schema,label:'Current item',scope:'row' as const,reporticPath:'row'}:fieldAt(row.schema,itemPath,{root:'row',schemaRef:row.schemaRef,registry});return{field,alias:row.alias,ref:row.schemaRef,catalogPath:row.catalogPrefix+(itemPath?'.'+itemPath:'')};\n }\n if(root==='variables')return variableSchema?{field:fieldAt(variableSchema,[name,...parts].filter(Boolean).join('.'),{root:'variables',registry}),ref:manifest?.variablesContract?.schemaRef}:{unverified:true};\n return{unverified:true};\n };\n const incomingCache=new Map<string,RowContext|undefined>();\n const incoming=(entry:IndexedElement):RowContext|undefined=>{if(incomingCache.has(entry.id))return incomingCache.get(entry.id);const parent=index.elements.find(e=>e.id===entry.parentId);if(!parent){incomingCache.set(entry.id,undefined);return;}let context=incoming(parent);const definition=components.find(c=>c.type===parent.type);const driver=definition?.bindingSlots?.find(s=>s.establishesRow&&s.childrenInheritRow);if(driver)context=collection(parent,driver.path,context);incomingCache.set(entry.id,context);return context;};\n const collection=(entry:IndexedElement,sourcePath:string,row?:RowContext):RowContext|undefined=>{\n const value=valueAt(entry.value,slotPath(sourcePath));if(isObject(value)&&typeof value.$bind==='string'){const resolved=resolve(value.$bind,row);if(resolved.field?.itemSchema)return{schema:resolved.field.itemSchema,alias:resolved.alias,catalogPrefix:resolved.catalogPath?resolved.catalogPath+'[]':'',schemaRef:resolved.ref};}\n if(Array.isArray(value))return{schema:true,catalogPrefix:'',alias:undefined};return;\n };\n const inspect=(entry:IndexedElement,binding:IndexedBinding)=>{\n const definition=components.find(c=>c.type===entry.type),slot=definition?getBindingSlot(definition,binding.slot,entry.value.props):undefined;\n const parentRow=incoming(entry);const row=slot?.rowSource?collection(entry,slot.rowSource,parentRow):parentRow;const resolved=resolve(binding.path,row);let result:any;\n if(binding.path.startsWith('row')&&!slot?.rowSource&&!parentRow)result={state:'incompatible',reason:'There is no local row in this property. Select a collection or use a global path.',score:0};\n else if(slot?.binding===false)result={state:'incompatible',reason:'This property requires a literal value.',score:0};\n else if(slot&&!slot.roots.includes(binding.path.split('.')[0] as any))result={state:'incompatible',reason:'This root is not permitted for the selected property.',score:0};\n else if(binding.slot==='when'&&resolved.field)result={state:'compatible',reason:'A when condition may refer to an optional field.',score:90};\n else if(resolved.unverified||!slot)result={state:'unknown',reason:resolved.inline?'These rows are written in the template, so their fields are checked when the report runs.':resolved.unverified?'No variable schema is configured; runtime input validation is required.':'The registry does not establish this property’s expected shape.',score:25};\n else if(!resolved.field)result={state:'incompatible',reason:resolved.missingRoot?'This dataset or row context is not pinned.':'The exact field is absent from the pinned schema.',score:0};\n else result=compatibility(resolved.field,slot.expected,slot.roles);\n if(binding.guarded&&result.state==='conditional')result={...result,state:'compatible',reason:'An explicit default or when condition covers the case where this field is missing.'};\n bindings.push({elementId:entry.id,slot:binding.slot,path:binding.path,range:binding.range,datasetAlias:resolved.alias,schemaRef:resolved.ref,catalogPath:resolved.catalogPath,compatibility:result,field:resolved.field});\n if(result.state!=='compatible')diagnostics.push({code:result.state==='incompatible'?'BINDING_INCOMPATIBLE':result.state==='conditional'?'BINDING_CONDITIONAL':'BINDING_UNVERIFIED',severity:result.state==='incompatible'?'error':result.state==='conditional'?'warning':'info',phase:'binding',message:result.reason,elementId:entry.id,slot:binding.slot,bindingPath:binding.path,datasetAlias:resolved.alias,schemaRef:resolved.ref,line:binding.range.line,column:binding.range.column,range:binding.range,state:result.state,guidance:result.state==='incompatible'?'Review this binding in the property inspector.':'Verify an approved fixture or supply an explicit runtime fallback.'});\n };\n for(const entry of index.elements){\n if(!entry.valid)continue;const definition=components.find(c=>c.type===entry.type);if(definition&&options.format&&definition.capabilities[options.format as keyof typeof definition.capabilities]==='unavailable')diagnostics.push({code:'TARGET_UNAVAILABLE',severity:'error',phase:'authoring',message:`${entry.type} is unavailable for ${options.format}.`,elementId:entry.id,range:entry.range});entry.bindings.forEach(b=>inspect(entry,b));\n }\n for(const token of index.inlineBindings){let path=token.path;if(!/^(?:variables|dataSets|row)\\./.test(path))path='variables.'+path;const resolved=resolve(path);if(resolved.missingRoot)diagnostics.push({code:'INLINE_DATASET_UNMAPPED',severity:'error',phase:'binding',message:'An inline dataset expression is not mapped.',bindingPath:path,datasetAlias:resolved.alias,range:token.range,line:token.range.line});else if(!resolved.field||resolved.unverified)diagnostics.push({code:'INLINE_UNVERIFIED',severity:'info',phase:'binding',message:'Inline Rendrix resolution is deferred until actual inputs are supplied.',bindingPath:path,range:token.range,state:'unknown'});}\n if(/{{\\s*(?:function|#|smartInput|file:)/.test(source))diagnostics.push({code:'DYNAMIC_REQUIREMENTS_DEFERRED',severity:'info',phase:'binding',message:'Dynamic helpers, files, and conditional branches are checked with the selected runtime inputs.',state:'unknown'});\n const valid=!diagnostics.some(d=>d.severity==='error');return{valid,status:!valid?'Invalid':diagnostics.some(d=>d.state==='conditional')?'Conditional':diagnostics.some(d=>d.state==='unknown')?'Unverified':'Structurally valid',diagnostics,bindings,fingerprint:sourceFingerprint(source+JSON.stringify(manifest)),schemaPins};\n}\nexport function bindingCandidates(source:string,manifest:AuthoringManifest,datasets:DatasetDefinition[],components:Pick<ComponentDefinition,'type'|'schema'|'rowScopes'|'bindingSlots'|'capabilities'>[],elementId:string,propertyPath:string):{field:FieldDescriptor;compatibility:ReturnType<typeof compatibility>;mapping?:Mapping;alias?:string}[]{\n const index=indexSource(source),entry=index.elements.find(e=>e.id===elementId),definition=components.find(c=>c.type===entry?.type),slot=definition?getBindingSlot(definition,propertyPath,entry?.value.props):undefined;if(!entry||!slot)return[];\n const registry=Object.fromEntries(datasets.flatMap(d=>d.versions.map(v=>[v.schemaRef,v.schema]))),result:{field:FieldDescriptor;compatibility:ReturnType<typeof compatibility>;mapping?:Mapping;alias?:string}[]=[];\n if(slot.roots.includes('dataSets'))for(const dataset of datasets.filter(d=>d.status!=='archived'&&d.kind==='dataset'))for(const version of dataset.versions){const existing=Object.entries(manifest.dataSetMappings).find(([,m])=>m.datasetId===dataset.id&&m.schemaVersion===version.version),alias=existing?.[0]??dataset.name;const mapping={datasetId:dataset.id,schemaVersion:version.version,schemaRef:version.schemaRef};for(const field of projectFields(version.schema,{alias,schemaRef:version.schemaRef,datasetId:dataset.id,registry}).filter(f=>!f.collectionPath)){const match=compatibility(field,slot.expected,slot.roles);if(slot.roles?.includes(field.role ?? ''))match.score+=12;if(existing)match.score+=8;result.push({field,compatibility:match,mapping,alias});}}\n const variablesSchema=manifest.variablesSchema??(manifest.variablesContract?registry[manifest.variablesContract.schemaRef]:undefined);\n if(slot.roots.includes('variables')&&variablesSchema)for(const field of projectFields(variablesSchema,{root:'variables',registry}))result.push({field,compatibility:compatibility(field,slot.expected,slot.roles)});\n // Reuse the same scope engine to discover the exact collection establishing this row.\n if(slot.roots.includes('row')){\n let owner:IndexedElement|undefined=entry,driver=slot.rowSource;let driverOwner=entry;\n while(!driver&&owner?.parentId){owner=index.elements.find(e=>e.id===owner!.parentId);const def=components.find(c=>c.type===owner?.type);const inherited=def?.bindingSlots?.find(s=>s.establishesRow&&s.childrenInheritRow);if(inherited){driver=inherited.path;driverOwner=owner!;break;}}\n if(driver){const dummy=editElementProperty(source,entry.id,slotPath(propertyPath),{$bind:'row'},sourceFingerprint(source));const analysis=analyzeBindings(dummy,manifest,datasets,components);const row=analysis.bindings.find(b=>b.elementId===entry.id&&b.slot===propertyPath)?.field;if(row){const fields=projectFields(row.schema,{root:'row',schemaRef:row.schemaRef,registry});if(!fields.length)fields.push({...row,path:'',reporticPath:'row',addressable:true,scope:'row'});for(const field of fields.filter(f=>!f.collectionPath))result.push({field,compatibility:compatibility(field,slot.expected,slot.roles)});}}\n }\n return result.sort((a,b)=>b.compatibility.score-a.compatibility.score||a.field.path.localeCompare(b.field.path));\n}\n","export type DatasetProtocol = 'rest' | 'graphql' | 'grpc' | 'postgrest' | 'mongo';\nexport type DatasetObject = Record<string, unknown>;\nexport type DatasetPrecision = 'exact' | 'estimated' | 'unknown';\nexport type DatasetCoverage = 'complete' | 'limitedByDesign' | 'partial' | 'failed';\n\nexport interface DatasetScope {\n workspaceId: string;\n agentId: string;\n}\n\nexport interface RequestSlot {\n section: 'path' | 'query' | 'body' | 'variables' | 'message' | 'operands';\n name: string;\n schema: DatasetObject;\n required?: boolean;\n}\n\nexport interface ApprovedOperation {\n label: string;\n slots: RequestSlot[];\n configuration: DatasetObject;\n responseSchema?: DatasetObject;\n safeToRetry?: boolean;\n stableOrder?: boolean;\n rawPreviewPaths?: string[];\n}\n\nexport interface SourceRevision extends DatasetScope {\n id: string;\n sourceId: string;\n revision: number;\n protocol: DatasetProtocol;\n connectionRef: string;\n connectionRevision?: string;\n fixtureOnly: boolean;\n operations: Record<string, ApprovedOperation>;\n publishedAt: string;\n publishedBy: string;\n digest: string;\n}\n\nexport interface DatasetSource extends DatasetScope {\n id: string;\n name: string;\n status: 'active' | 'deprecated' | 'revoked';\n revision: number;\n versions: SourceRevision[];\n}\n\nexport interface DatasetPlanSummary {\n revision: number;\n schemaRef: string;\n digest: string;\n publishedAt: string;\n}\n\nexport interface DatasetPlanVersion extends DatasetPlanSummary {\n sourceText: string;\n sourceRefs: string[];\n publishedBy: string;\n verification: DatasetVerification;\n}\n\nexport interface DatasetVerification {\n digest: string;\n mode: 'fixture' | 'live';\n at: string;\n}\n\nexport interface DatasetPlanRecord extends DatasetScope {\n datasetId: string;\n draft: {revision: number; sourceText: string; updatedAt: string; verification?: DatasetVerification};\n versions: DatasetPlanVersion[];\n}\n\nexport interface DatasetCount {\n value: number | string | null;\n precision: DatasetPrecision;\n scope: string;\n}\n\nexport interface DatasetDiagnostic {\n code: string;\n phase: 'plan' | 'connection' | 'request' | 'page' | 'mapping' | 'reduction' | 'output' | 'run';\n message: string;\n operation?: string;\n path?: string;\n line?: number;\n retryable?: boolean;\n}\n\nexport interface DatasetTrace {\n operation: string;\n protocol: DatasetProtocol;\n page: number;\n attempt: number;\n outcome: 'accepted' | 'retry' | 'failed';\n status?: number;\n rows: number;\n bytes: number;\n durationMs: number;\n slots: string[];\n}\n\nexport interface DatasetRunMetadata {\n schemaRef: string;\n planRevision?: number;\n sourceRefs: string[];\n startedAt: string;\n finishedAt: string;\n durationMs: number;\n calls: number;\n pages: number;\n rows: number;\n bytes: number;\n retries: number;\n completeness: DatasetCoverage;\n consistency: 'bestEffort' | 'snapshot';\n counts: Record<string, DatasetCount>;\n operationCoverage: Record<string, DatasetCoverage>;\n reductions: Record<string, {coverage: DatasetCoverage; rows: number}>;\n trace: DatasetTrace[];\n diagnostics: DatasetDiagnostic[];\n}\n\nexport interface DatasetRunRecord extends DatasetScope {\n id: string;\n datasetId: string;\n actor: string;\n planRevision: number;\n schemaRef: string;\n sourceRefs: string[];\n state: 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';\n createdAt: string;\n expiresAt: string;\n workerPid: number;\n idempotencyKey?: string;\n requestDigest: string;\n cancelRequested?: boolean;\n metadata?: DatasetRunMetadata;\n diagnostics: DatasetDiagnostic[];\n data?: DatasetObject;\n}\n\nexport interface DatasetResponseFixture extends DatasetScope {\n id: string;\n datasetId: string;\n owner: string;\n name: string;\n createdAt: string;\n expiresAt: string;\n parameters: DatasetObject;\n responses: Record<string, DatasetObject[]>;\n}\n\nexport interface ReportAcquisition {\n planRevision: number;\n parameters?: Record<string, unknown>;\n}\n\nexport const datasetActions = [\n 'sources.read', 'sources.manage', 'sources.connect', 'datasets.plan.edit',\n 'datasets.test', 'datasets.execute', 'datasets.results', 'datasets.raw', 'datasets.publish',\n] as const;\n\nexport type DatasetAction = typeof datasetActions[number];\n"],"mappings":";AACA,IAAM,SAAO,oBAAI,IAAI,CAAC,aAAY,eAAc,WAAW,CAAC;AACrD,IAAM,WAAS,CAAC,MAAgC,MAAI,QAAM,OAAO,MAAI,YAAU,CAAC,MAAM,QAAQ,CAAC;AAC/F,IAAM,cAAY,CAAC,MAAW,EAAE,QAAQ,MAAK,IAAI,EAAE,QAAQ,OAAM,IAAI;AACrE,SAAS,UAAU,OAAU,QAAM,GAAO;AAAC,MAAG,QAAM,GAAG,OAAM,IAAI,MAAM,gCAAgC;AAAE,MAAG,MAAM,QAAQ,KAAK,GAAE;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EAAE,kBAAgB,EAAE,kBAAkB;AAAE,UAAG,WAAU;AAAC,iBAAO,UAAU;AAAK,sBAAY;AAAO;AAAA,MAAM;AAAA,IAAC;AACzR,QAAG,QAAO;AAAC,YAAM,QAAM,oBAAoB,QAAO,MAAM,IAAG,SAAS,YAAY,GAAE,EAAC,OAAM,MAAK,GAAE,kBAAkB,MAAM,CAAC;AAAE,YAAM,WAAS,gBAAgB,OAAM,UAAS,UAAS,UAAU;AAAE,YAAM,MAAI,SAAS,SAAS,KAAK,OAAG,EAAE,cAAY,MAAM,MAAI,EAAE,SAAO,YAAY,GAAG;AAAM,UAAG,KAAI;AAAC,cAAM,SAAO,cAAc,IAAI,QAAO,EAAC,MAAK,OAAM,WAAU,IAAI,WAAU,SAAQ,CAAC;AAAE,YAAG,CAAC,OAAO,OAAO,QAAO,KAAK,EAAC,GAAG,KAAI,MAAK,IAAG,cAAa,OAAM,aAAY,MAAK,OAAM,MAAK,CAAC;AAAE,mBAAU,SAAS,OAAO,OAAO,OAAG,CAAC,EAAE,cAAc,EAAE,QAAO,KAAK,EAAC,OAAM,eAAc,cAAc,OAAM,KAAK,UAAS,KAAK,KAAK,EAAC,CAAC;AAAA,MAAE;AAAA,IAAC;AAAA,EAChmB;AACA,SAAO,OAAO,KAAK,CAAC,GAAE,MAAI,EAAE,cAAc,QAAM,EAAE,cAAc,SAAO,EAAE,MAAM,KAAK,cAAc,EAAE,MAAM,IAAI,CAAC;AACjH;;;ACsFO,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EAAgB;AAAA,EAAkB;AAAA,EAAmB;AAAA,EACrD;AAAA,EAAiB;AAAA,EAAoB;AAAA,EAAoB;AAAA,EAAgB;AAC3E;","names":["type","d","v","t","f","resolve"]}
package/dist/types.d.ts CHANGED
@@ -209,6 +209,12 @@ type StudioAsset = {
209
209
  mediaType: string;
210
210
  name?: string;
211
211
  };
212
+ /** How the report sits on a page or slide: paper size and orientation for PDF and Word, and the deck shape for PowerPoint. */
213
+ type StudioPage = {
214
+ size?: 'A4' | 'Letter';
215
+ landscape?: boolean;
216
+ deck?: 'wide' | 'standard';
217
+ };
212
218
  type TemplateDocument = {
213
219
  id: string;
214
220
  workspaceId: string;
@@ -221,7 +227,10 @@ type TemplateDocument = {
221
227
  manifest: AuthoringManifest;
222
228
  revision: number;
223
229
  theme: string;
230
+ themeTokens?: Record<string, unknown>;
231
+ themeRules?: Record<string, Record<string, string | number>>;
224
232
  css?: string;
233
+ page?: StudioPage;
225
234
  assets: Record<string, StudioAsset>;
226
235
  fixtureId?: string;
227
236
  updatedAt: string;
@@ -233,7 +242,10 @@ type PublishedRevision = {
233
242
  source: string;
234
243
  manifest: AuthoringManifest;
235
244
  theme: string;
245
+ themeTokens?: Record<string, unknown>;
246
+ themeRules?: Record<string, Record<string, string | number>>;
236
247
  css?: string;
248
+ page?: StudioPage;
237
249
  assets: Record<string, StudioAsset>;
238
250
  publishedAt: string;
239
251
  publishedBy: string;
@@ -356,4 +368,4 @@ type Analysis = {
356
368
  schemaPins: Record<string, string>;
357
369
  };
358
370
 
359
- export { type Action, type Agent, type Analysis, type ApprovedOperation, type AuthoringManifest, type BindingInspection, type Compatibility, type DatasetAction, type DatasetCount, type DatasetCoverage, type DatasetDefinition, type DatasetDiagnostic, type DatasetObject, type DatasetPlanRecord, type DatasetPlanSummary, type DatasetPlanVersion, type DatasetPrecision, type DatasetProtocol, type DatasetResponseFixture, type DatasetRunMetadata, type DatasetRunRecord, type DatasetScope, type DatasetSource, type DatasetTrace, type DatasetVerification, type FieldDescriptor, type Fixture, type HostIdentity, type JsonSchema, type Mapping, type Presence, type Principal, type PublishedRevision, type ReportAcquisition, type RequestSlot, type SchemaChange, type SchemaVersion, type SourceRevision, type StudioAsset, type StudioDiagnostic, type TemplateDocument, datasetActions };
371
+ export { type Action, type Agent, type Analysis, type ApprovedOperation, type AuthoringManifest, type BindingInspection, type Compatibility, type DatasetAction, type DatasetCount, type DatasetCoverage, type DatasetDefinition, type DatasetDiagnostic, type DatasetObject, type DatasetPlanRecord, type DatasetPlanSummary, type DatasetPlanVersion, type DatasetPrecision, type DatasetProtocol, type DatasetResponseFixture, type DatasetRunMetadata, type DatasetRunRecord, type DatasetScope, type DatasetSource, type DatasetTrace, type DatasetVerification, type FieldDescriptor, type Fixture, type HostIdentity, type JsonSchema, type Mapping, type Presence, type Principal, type PublishedRevision, type ReportAcquisition, type RequestSlot, type SchemaChange, type SchemaVersion, type SourceRevision, type StudioAsset, type StudioDiagnostic, type StudioPage, type TemplateDocument, datasetActions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x12i/reportic-catalog",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "reportic-catalog — integrated Reportic authoring and catalog",
@@ -31,9 +31,9 @@
31
31
  "README.md"
32
32
  ],
33
33
  "dependencies": {
34
- "@x12i/reportic-core": "0.2.3",
35
- "@x12i/reportic": "0.2.3",
36
- "@x12i/reportic-elements": "0.2.3",
34
+ "@x12i/reportic-core": "0.2.5",
35
+ "@x12i/reportic": "0.2.5",
36
+ "@x12i/reportic-elements": "0.2.5",
37
37
  "ajv": "^8.17.1",
38
38
  "ajv-formats": "^3.0.1",
39
39
  "yaml": "^2.8.1"