@cadenza.io/core 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -382,6 +382,7 @@ type SchemaDefinition = {
382
382
  items?: SchemaDefinition;
383
383
  constraints?: SchemaConstraints;
384
384
  description?: string;
385
+ strict?: boolean;
385
386
  };
386
387
 
387
388
  type TaskFunction = (context: AnyObject, progressCallback: (progress: number) => void) => TaskResult;
@@ -662,6 +663,8 @@ declare class GraphRegistry {
662
663
  private routines;
663
664
  registerTask: Task;
664
665
  updateTaskId: Task;
666
+ updateTaskInputSchema: Task;
667
+ updateTaskOutputSchema: Task;
665
668
  getTaskById: Task;
666
669
  getTaskByName: Task;
667
670
  getTasksByLayer: Task;
@@ -878,4 +881,4 @@ declare class SignalTask extends Task {
878
881
  constructor(signal: string, description?: string);
879
882
  }
880
883
 
881
- export { type AnyObject, DebounceTask, EphemeralTask, GraphContext, GraphRegistry, GraphRoutine, GraphRun, SignalEmitter, SignalParticipant, SignalTask, Task, type TaskOptions, type TaskResult, Cadenza as default };
884
+ export { type AnyObject, DebounceTask, EphemeralTask, GraphContext, GraphRegistry, GraphRoutine, GraphRun, type SchemaConstraints, type SchemaDefinition, type SchemaType, SignalEmitter, SignalParticipant, SignalTask, Task, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default };
package/dist/index.d.ts CHANGED
@@ -382,6 +382,7 @@ type SchemaDefinition = {
382
382
  items?: SchemaDefinition;
383
383
  constraints?: SchemaConstraints;
384
384
  description?: string;
385
+ strict?: boolean;
385
386
  };
386
387
 
387
388
  type TaskFunction = (context: AnyObject, progressCallback: (progress: number) => void) => TaskResult;
@@ -662,6 +663,8 @@ declare class GraphRegistry {
662
663
  private routines;
663
664
  registerTask: Task;
664
665
  updateTaskId: Task;
666
+ updateTaskInputSchema: Task;
667
+ updateTaskOutputSchema: Task;
665
668
  getTaskById: Task;
666
669
  getTaskByName: Task;
667
670
  getTasksByLayer: Task;
@@ -878,4 +881,4 @@ declare class SignalTask extends Task {
878
881
  constructor(signal: string, description?: string);
879
882
  }
880
883
 
881
- export { type AnyObject, DebounceTask, EphemeralTask, GraphContext, GraphRegistry, GraphRoutine, GraphRun, SignalEmitter, SignalParticipant, SignalTask, Task, type TaskOptions, type TaskResult, Cadenza as default };
884
+ export { type AnyObject, DebounceTask, EphemeralTask, GraphContext, GraphRegistry, GraphRoutine, GraphRun, type SchemaConstraints, type SchemaDefinition, type SchemaType, SignalEmitter, SignalParticipant, SignalTask, Task, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default };
package/dist/index.js CHANGED
@@ -1369,6 +1369,8 @@ var Task = class extends SignalParticipant {
1369
1369
  } else if (constraints.oneOf && !constraints.oneOf.includes(value)) {
1370
1370
  errors[`${path}.${key}`] = `Value '${value}' for '${key}' not in oneOf ${JSON.stringify(constraints.oneOf)}`;
1371
1371
  }
1372
+ } else if (schema.strict) {
1373
+ errors[`${path}.${key}`] = `Key '${key}' is not allowed`;
1372
1374
  }
1373
1375
  }
1374
1376
  if (Object.keys(errors).length > 0) {
@@ -1628,6 +1630,28 @@ var GraphRegistry = class _GraphRegistry {
1628
1630
  },
1629
1631
  "Updates task id."
1630
1632
  ).doOn("meta.task.global_id_set");
1633
+ this.updateTaskInputSchema = Cadenza.createMetaTask(
1634
+ "Update task input schema",
1635
+ (context) => {
1636
+ const { __id, __schema } = context;
1637
+ const task = this.tasks.get(__id);
1638
+ if (!task) return true;
1639
+ task.setInputContextSchema(__schema);
1640
+ return true;
1641
+ },
1642
+ "Updates task input schema."
1643
+ ).doOn("meta.task.input_schema_updated");
1644
+ this.updateTaskOutputSchema = Cadenza.createMetaTask(
1645
+ "Update task input schema",
1646
+ (context) => {
1647
+ const { __id, __schema } = context;
1648
+ const task = this.tasks.get(__id);
1649
+ if (!task) return true;
1650
+ task.setOutputContextSchema(__schema);
1651
+ return true;
1652
+ },
1653
+ "Updates task input schema."
1654
+ ).doOn("meta.task.output_schema_updated");
1631
1655
  this.getTaskById = Cadenza.createMetaTask(
1632
1656
  "Get task by id",
1633
1657
  (context) => {