Workflow Document Version Handler (domain/document.ts)

FastGPT · packages/workflow-core/src/domain/document.ts · typescript · Apache-2.0
automation, database, lang:typescript, tag:validation, tag:json

Parses and validates versioned workflow documents, providing error handling for schema mismatches. Use this to ensure compatibility when importing or migrating workflow configurations.

// Source: https://github.com/labring/FastGPT | License: Apache-2.0 | Copyright 2023 Sealos
// Provided via justclaw.it.com; keep this notice with the code.
import { WorkflowDiagnosticCodeEnum } from '@fastgpt/global/core/workflow/diagnostic/constants';
import {
  WORKFLOW_DOCUMENT_SCHEMA_VERSION,
  WorkflowDocumentSchema,
  type WorkflowDocument
} from '@fastgpt/global/core/workflow/type/document';

export const WORKFLOW_DOCUMENT_MIGRATION_GUIDANCE =
  'Use a CLI version that supports the source schema, migrate one version at a time, and never remove or rewrite schemaVersion manually.';

export class WorkflowDocumentVersionError extends Error {
  readonly code = WorkflowDiagnosticCodeEnum.documentVersionUnsupported;

  constructor(readonly foundVersion: string | undefined) {
    super(
  

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key