Function createArvoOrchestratorContract

Creates an ArvoOrchestratorContract with specified parameters.

The ArvoOrchestratorContract is a specialized contract designed to manage the lifecycle of orchestration processes within the Arvo framework. It creates a contract with an init event type and a corresponding complete event type.

Key features:

  1. Type Validation: Ensures the type parameter follows lowercase alphanumeric with dots format
  2. Event Type Generation: Automatically generates init and complete event types based on the provided type
  3. Schema Merging: Merges provided init schemas with the OrchestrationInitEventBaseSchema
  4. Version Support: Handles multiple versions of the contract with their respective schemas

If the type parameter contains invalid characters (must be lowercase alphanumeric with dots)

const contract = createArvoOrchestratorContract({
uri: '#/orchestrators/data/processor',
name: 'data.processor',
versions: {
'1.0.0': {
init: z.object({
data: z.string(),
options: z.object({
format: z.string()
})
}),
complete: z.object({
processedData: z.string(),
metadata: z.record(z.string())
})
},
'1.1.0': {
init: z.object({
data: z.string(),
options: z.object({
format: z.string(),
compression: z.boolean().optional()
})
}),
complete: z.object({
processedData: z.string(),
metadata: z.record(z.string()),
performance: z.object({
duration: z.number(),
bytesProcessed: z.number()
})
})
}
}
});