Class ArvoOrchestrationSubject

Handles the creation and parsing of Arvo orchestration subjects.

Constructors

Methods

Constructors

Methods

  • Creates an Arvo orchestration subject from detailed content parameters. The content is validated, compressed using zlib, and encoded in base64 format.

    Parameters

    Returns string

    A base64 encoded string containing the compressed orchestration subject data

    Error if validation fails or compression encounters an error

    const subject = ArvoOrchestrationSubject.create({
    orchestrator: {
    name: "mainProcess",
    version: "1.0.0"
    },
    execution: {
    id: "550e8400-e29b-41d4-a716-446655440000",
    initiator: "systemA"
    }
    });
  • Creates a new orchestration subject string from an existing parent subject. This method parses the parent subject, merges its metadata with new metadata (if available), and creates a new subject with updated orchestrator information while maintaining the relationship to the parent context.

    Parameters

    • param: {
          meta?: Record<string, string>;
          orchestator: string;
          subject: string;
          version: null | `${number}.${number}.${number}`;
      }

      Configuration object for creating a new subject from a parent

      • Optionalmeta?: Record<string, string>

        Optional additional metadata to merge with the parent's metadata

      • orchestator: string

        Name identifier of the new orchestrator

      • subject: string

        Base64 encoded string of the parent orchestration subject

      • version: null | `${number}.${number}.${number}`

        Version of the new orchestrator. If null, defaults to WildCardArvoSemanticVersion

    Returns string

    A new base64 encoded string containing the compressed orchestration subject data

    Error if the parent subject is invalid or if the new parameters result in invalid subject content

    // Create a parent subject
    const parentSubject = ArvoOrchestrationSubject.new({
    orchestator: "parentProcess",
    version: "1.0.0",
    initiator: "systemA",
    meta: { environment: "production" }
    });

    // Create a new subject from the parent
    const childSubject = ArvoOrchestrationSubject.from({
    orchestator: "childProcess",
    version: "2.0.0",
    subject: parentSubject,
    meta: { step: "processing" } // Will be merged with parent's metadata
    });
  • Validates if a string represents a valid Arvo orchestration subject. A valid subject must:

    • Be base64 encoded
    • Contain zlib-compressed JSON data
    • Match the ArvoOrchestrationSubjectContent schema when decoded
    • Include valid orchestrator and execution details

    Use this method for validating subjects before processing them in orchestration workflows or when receiving subjects from external sources.

    Parameters

    • data: string

      The string to validate as an orchestration subject

    Returns boolean

    boolean - True if string is a valid orchestration subject, false otherwise

  • Creates a new Arvo orchestration subject with basic required parameters. This is a convenience method that wraps the more detailed create method.

    Parameters

    • param: {
          initiator: string;
          meta?: Record<string, string>;
          orchestator: string;
          version: null | `${number}.${number}.${number}`;
      }

      Configuration object for the orchestration subject

      • initiator: string

        Identifier of the entity initiating the orchestration

      • Optionalmeta?: Record<string, string>

        Optional metadata key-value pairs for additional orchestration context

      • orchestator: string

        Name identifier of the orchestrator

      • version: null | `${number}.${number}.${number}`

        Version of the orchestrator. If null, defaults to WildCardArvoSemanticVersion

    Returns string

    A base64 encoded string containing the compressed orchestration subject data

    Error if the provided parameters result in invalid subject content

    const subject = ArvoOrchestrationSubject.new({
    orchestator: "mainProcess",
    version: "1.0.0",
    initiator: "systemA"
    });

    // With metadata
    const subjectWithMeta = ArvoOrchestrationSubject.new({
    orchestator: "com.company.mainProcess",
    version: "1.0.0",
    initiator: "com.company.systemA",
    meta: {
    priority: "high",
    environment: "production"
    }
    });
  • Parses a base64 encoded orchestration subject string back into its structured content form. Performs decompression, JSON parsing, and validation of the subject content.

    Parameters

    • subject: string

      Base64 encoded string representing the compressed orchestration subject

    Returns ArvoOrchestrationSubjectContent

    The decoded and validated ArvoOrchestrationSubjectContent

    Error if decompression, parsing, or validation fails

    const content = ArvoOrchestrationSubject.parse(encodedSubject);
    console.log(content.orchestrator.name);
    console.log(content.execution.id);