{"version":3,"file":"errors.cjs","names":["Data"],"sources":["../../../src/services/deploy/errors.ts"],"sourcesContent":["import { Data } from \"effect\";\nimport type { WorkspaceDeployResult } from \"../../contract\";\nimport type { BosConfigInput } from \"../../types\";\n\n/**\n * The publish train's typed error channel (ticket #422): every terminal\n * failure is a tagged instance carrying its leg identity — handlers map it to\n * the wire result shape mechanically via `toResult()` instead of matching\n * string errors. `kind` discriminates the failed leg; `error` is the\n * human-facing message (unchanged wording from the string-error era).\n */\n\nexport type TrainErrorKind =\n  | \"preflight\"\n  | \"build\"\n  | \"reload\"\n  | \"config-state\"\n  | \"upload\"\n  | \"missing-manifest\"\n  | \"memory-backend\"\n  | \"config-write\"\n  | \"pin-verification\"\n  | \"platform-truth\"\n  | \"sign\"\n  | \"submit\"\n  | \"confirm\";\n\nexport interface PublishTrainOk {\n  status: \"published\" | \"dry-run\";\n  registryUrl: string;\n  txHash?: string;\n  built?: string[];\n  skipped?: string[];\n  publishConfig?: BosConfigInput;\n  deployResults?: WorkspaceDeployResult[];\n  fingerprint?: string;\n  slotPins?: Record<string, string>;\n}\n\n/** The wire shape the train's caller sees on terminal failure. */\nexport interface PublishTrainFailureResult {\n  status: \"error\";\n  registryUrl: string;\n  error: string;\n  built?: string[];\n  skipped?: string[];\n  deployResults?: WorkspaceDeployResult[];\n}\n\nexport class PublishTrainError extends Data.TaggedError(\"PublishTrainError\")<{\n  readonly kind: TrainErrorKind;\n  readonly registryUrl: string;\n  readonly error: string;\n  readonly built?: string[];\n  readonly skipped?: string[];\n  readonly deployResults?: WorkspaceDeployResult[];\n}> {\n  toResult(): PublishTrainFailureResult {\n    return {\n      status: \"error\",\n      registryUrl: this.registryUrl,\n      error: this.error,\n      ...(this.built !== undefined ? { built: this.built } : {}),\n      ...(this.skipped !== undefined ? { skipped: this.skipped } : {}),\n      ...(this.deployResults !== undefined ? { deployResults: this.deployResults } : {}),\n    };\n  }\n}\n"],"mappings":";;;AAiDA,IAAa,oBAAb,cAAuCA,YAAK,YAAY,mBAAmB,CAAC,CAOzE;CACD,WAAsC;EACpC,OAAO;GACL,QAAQ;GACR,aAAa,KAAK;GAClB,OAAO,KAAK;GACZ,GAAI,KAAK,UAAU,SAAY,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;GACxD,GAAI,KAAK,YAAY,SAAY,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;GAC9D,GAAI,KAAK,kBAAkB,SAAY,EAAE,eAAe,KAAK,cAAc,IAAI,CAAC;EAClF;CACF;AACF"}