@hexagen-monaco/sync 0.9.0 → 0.12.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.
Files changed (199) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +58 -10
  3. package/dist/application/ports/out/file-system.port.d.ts.map +1 -1
  4. package/dist/application/ports/out/index.d.ts +1 -2
  5. package/dist/application/ports/out/index.d.ts.map +1 -1
  6. package/dist/application/ports/out/symbol-reference-index.port.d.ts +74 -0
  7. package/dist/application/ports/out/symbol-reference-index.port.d.ts.map +1 -0
  8. package/dist/application/use-cases/get-architecture-graph.use-case.d.ts +1 -1
  9. package/dist/application/use-cases/get-architecture-graph.use-case.d.ts.map +1 -1
  10. package/dist/application/use-cases/get-linter-report.use-case.d.ts +1 -1
  11. package/dist/application/use-cases/get-linter-report.use-case.d.ts.map +1 -1
  12. package/dist/application/use-cases/index.d.ts +0 -1
  13. package/dist/application/use-cases/index.d.ts.map +1 -1
  14. package/dist/application/use-cases/migrate-manifest.use-case.d.ts +4 -1
  15. package/dist/application/use-cases/migrate-manifest.use-case.d.ts.map +1 -1
  16. package/dist/application/use-cases/refactoring-impact.use-case.d.ts +25 -6
  17. package/dist/application/use-cases/refactoring-impact.use-case.d.ts.map +1 -1
  18. package/dist/arch-linter-bin.d.ts +19 -3
  19. package/dist/arch-linter-bin.d.ts.map +1 -1
  20. package/dist/cli.js +3449 -5375
  21. package/dist/cli.js.map +1 -1
  22. package/dist/commands/add/validate.d.ts.map +1 -1
  23. package/dist/commands/adopt/index.d.ts +24 -0
  24. package/dist/commands/adopt/index.d.ts.map +1 -0
  25. package/dist/commands/bootstrap/index.d.ts +62 -0
  26. package/dist/commands/bootstrap/index.d.ts.map +1 -0
  27. package/dist/commands/manifest/migrate.d.ts.map +1 -1
  28. package/dist/commands/report/baseline-read.d.ts +12 -0
  29. package/dist/commands/report/baseline-read.d.ts.map +1 -0
  30. package/dist/commands/report/build-report.d.ts +13 -0
  31. package/dist/commands/report/build-report.d.ts.map +1 -0
  32. package/dist/commands/report/context-map.d.ts +9 -0
  33. package/dist/commands/report/context-map.d.ts.map +1 -0
  34. package/dist/commands/report/exec-git.d.ts +3 -0
  35. package/dist/commands/report/exec-git.d.ts.map +1 -0
  36. package/dist/commands/report/handoff.d.ts +3 -0
  37. package/dist/commands/report/handoff.d.ts.map +1 -0
  38. package/dist/commands/report/index.d.ts +14 -0
  39. package/dist/commands/report/index.d.ts.map +1 -0
  40. package/dist/commands/report/lint-collect.d.ts +4 -0
  41. package/dist/commands/report/lint-collect.d.ts.map +1 -0
  42. package/dist/commands/report/ratchet-trend.d.ts +3 -0
  43. package/dist/commands/report/ratchet-trend.d.ts.map +1 -0
  44. package/dist/commands/report/render-html.d.ts +3 -0
  45. package/dist/commands/report/render-html.d.ts.map +1 -0
  46. package/dist/commands/report/render-markdown.d.ts +3 -0
  47. package/dist/commands/report/render-markdown.d.ts.map +1 -0
  48. package/dist/commands/report/types.d.ts +52 -0
  49. package/dist/commands/report/types.d.ts.map +1 -0
  50. package/dist/commands/report/zip-store.d.ts +10 -0
  51. package/dist/commands/report/zip-store.d.ts.map +1 -0
  52. package/dist/commands/scan/index.d.ts +185 -0
  53. package/dist/commands/scan/index.d.ts.map +1 -0
  54. package/dist/commands/shared/detect-workspaces.d.ts +12 -0
  55. package/dist/commands/shared/detect-workspaces.d.ts.map +1 -0
  56. package/dist/commands/shared/index.d.ts +2 -1
  57. package/dist/commands/shared/index.d.ts.map +1 -1
  58. package/dist/commands/shared/lstat-exists.d.ts +7 -0
  59. package/dist/commands/shared/lstat-exists.d.ts.map +1 -0
  60. package/dist/commands/shared/project-root.d.ts +7 -0
  61. package/dist/commands/shared/project-root.d.ts.map +1 -1
  62. package/dist/domain/services/emission-plan-builder.d.ts +14 -3
  63. package/dist/domain/services/emission-plan-builder.d.ts.map +1 -1
  64. package/dist/domain/services/impact-analysis.types.d.ts +6 -1
  65. package/dist/domain/services/impact-analysis.types.d.ts.map +1 -1
  66. package/dist/domain/services/impact-request-validator.d.ts.map +1 -1
  67. package/dist/domain/services/index.d.ts +2 -0
  68. package/dist/domain/services/index.d.ts.map +1 -1
  69. package/dist/domain/services/layer-classifier.d.ts +53 -2
  70. package/dist/domain/services/layer-classifier.d.ts.map +1 -1
  71. package/dist/domain/services/layer-dir-resolver.d.ts +82 -0
  72. package/dist/domain/services/layer-dir-resolver.d.ts.map +1 -0
  73. package/dist/domain/services/name-normalizer.d.ts +35 -0
  74. package/dist/domain/services/name-normalizer.d.ts.map +1 -0
  75. package/dist/domain/services/stub-template-resolver.d.ts +33 -2
  76. package/dist/domain/services/stub-template-resolver.d.ts.map +1 -1
  77. package/dist/generators/apps-framework-templates.d.ts.map +1 -1
  78. package/dist/generators/architecture-file-templates.d.ts +2 -2
  79. package/dist/generators/architecture-file-templates.d.ts.map +1 -1
  80. package/dist/generators/architecture-files.d.ts.map +1 -1
  81. package/dist/generators/cross-context.d.ts.map +1 -1
  82. package/dist/generators/eslint.d.ts.map +1 -1
  83. package/dist/generators/layer-folders.d.ts +9 -1
  84. package/dist/generators/layer-folders.d.ts.map +1 -1
  85. package/dist/generators/package-json.d.ts.map +1 -1
  86. package/dist/generators/package-src-index.d.ts +5 -0
  87. package/dist/generators/package-src-index.d.ts.map +1 -0
  88. package/dist/generators/root-file-templates.d.ts +1 -1
  89. package/dist/generators/root-file-templates.d.ts.map +1 -1
  90. package/dist/generators/root-files.d.ts.map +1 -1
  91. package/dist/generators/stubs.d.ts +4 -1
  92. package/dist/generators/stubs.d.ts.map +1 -1
  93. package/dist/index.d.ts +23 -3
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +633 -4727
  96. package/dist/index.js.map +1 -1
  97. package/dist/infrastructure/adapters/atomic-file-system.adapter.d.ts.map +1 -1
  98. package/dist/infrastructure/adapters/file-system-workspace.adapter.d.ts.map +1 -1
  99. package/dist/infrastructure/adapters/index.d.ts +1 -0
  100. package/dist/infrastructure/adapters/index.d.ts.map +1 -1
  101. package/dist/infrastructure/adapters/ts-morph-symbol-index.adapter.d.ts +47 -0
  102. package/dist/infrastructure/adapters/ts-morph-symbol-index.adapter.d.ts.map +1 -0
  103. package/dist/infrastructure/config/layout-schema.d.ts +29 -0
  104. package/dist/infrastructure/config/layout-schema.d.ts.map +1 -0
  105. package/dist/infrastructure/config/load-layout-config.d.ts +8 -0
  106. package/dist/infrastructure/config/load-layout-config.d.ts.map +1 -0
  107. package/dist/linter.d.ts +24 -0
  108. package/dist/linter.d.ts.map +1 -1
  109. package/dist/manifest-service.d.ts.map +1 -1
  110. package/dist/refactoring/impact-analyzer.d.ts +7 -2
  111. package/dist/refactoring/impact-analyzer.d.ts.map +1 -1
  112. package/dist/sync-engine.d.ts.map +1 -1
  113. package/dist/templates/adobe-creative-production/files/src/domain/ports/out/creative-production.port.ts +2 -4
  114. package/dist/templates/adobe-creative-production/files/src/infrastructure/adobe/creative-production/creative-production.adapter.ts +8 -7
  115. package/dist/templates/adobe-express/files/src/domain/ports/out/express.port.ts +2 -4
  116. package/dist/templates/adobe-express/files/src/infrastructure/adobe/express/express.adapter.ts +9 -8
  117. package/dist/templates/adobe-firefly-composite/files/src/domain/ports/out/composite.port.ts +2 -4
  118. package/dist/templates/adobe-firefly-composite/files/src/infrastructure/adobe/composite/composite.adapter.ts +12 -12
  119. package/dist/templates/adobe-firefly-content-tagging/files/src/domain/ports/out/content-tagging.port.ts +2 -4
  120. package/dist/templates/adobe-firefly-content-tagging/files/src/infrastructure/adobe/content-tagging/content-tagging.adapter.ts +6 -5
  121. package/dist/templates/adobe-firefly-core/README.md +1 -1
  122. package/dist/templates/adobe-firefly-core/files/src/domain/errors/creative-service-error.ts +62 -0
  123. package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/errors/to-creative-service-error.ts +45 -0
  124. package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/index.ts +9 -0
  125. package/dist/templates/adobe-firefly-core/manifest.json +2 -0
  126. package/dist/templates/adobe-firefly-custom-models/files/src/domain/ports/out/custom-model.port.ts +5 -7
  127. package/dist/templates/adobe-firefly-custom-models/files/src/infrastructure/adobe/custom-models/firefly-custom-model.adapter.ts +16 -15
  128. package/dist/templates/adobe-firefly-generate/files/src/domain/ports/out/image-generation.port.ts +6 -8
  129. package/dist/templates/adobe-firefly-generate/files/src/infrastructure/adobe/generate/firefly-generate.adapter.ts +14 -16
  130. package/dist/templates/adobe-firefly-media/files/src/domain/ports/out/media-generation.port.ts +6 -8
  131. package/dist/templates/adobe-firefly-media/files/src/infrastructure/adobe/media/firefly-media.adapter.ts +11 -10
  132. package/dist/templates/adobe-firefly-upscale/files/src/domain/ports/out/upscale.port.ts +2 -4
  133. package/dist/templates/adobe-firefly-upscale/files/src/infrastructure/adobe/upscale/upscale.adapter.ts +13 -11
  134. package/dist/templates/adobe-illustrator/files/src/domain/ports/out/illustrator.port.ts +4 -6
  135. package/dist/templates/adobe-illustrator/files/src/infrastructure/adobe/illustrator/illustrator.adapter.ts +17 -15
  136. package/dist/templates/adobe-indesign/files/src/domain/ports/out/indesign.port.ts +4 -6
  137. package/dist/templates/adobe-indesign/files/src/infrastructure/adobe/indesign/indesign.adapter.ts +10 -9
  138. package/dist/templates/adobe-lightroom/files/src/domain/ports/out/lightroom.port.ts +4 -6
  139. package/dist/templates/adobe-lightroom/files/src/infrastructure/adobe/lightroom/lightroom.adapter.ts +10 -9
  140. package/dist/templates/adobe-photoshop/files/src/domain/ports/out/photoshop-automation.port.ts +6 -8
  141. package/dist/templates/adobe-photoshop/files/src/infrastructure/adobe/photoshop/photoshop-automation.adapter.ts +12 -11
  142. package/dist/templates/adobe-substance-3d/files/src/domain/ports/out/substance-3d.port.ts +4 -6
  143. package/dist/templates/adobe-substance-3d/files/src/infrastructure/adobe/substance-3d/substance-3d.adapter.ts +10 -9
  144. package/dist/templates/agents-md/files/AGENTS.md +5 -5
  145. package/dist/templates/bedrock-agentcore-runtime/files/src/application/ports/agent-runtime.port.ts +25 -0
  146. package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/http/invocations.handler.ts +1 -1
  147. package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/http/server.ts +1 -1
  148. package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/runtime/payload.ts +5 -22
  149. package/dist/templates/bedrock-agentcore-runtime/manifest.json +1 -0
  150. package/dist/templates/ci-github-actions/README.md +13 -7
  151. package/dist/templates/ci-github-actions/files/.github/dependabot.yml +9 -2
  152. package/dist/templates/ci-github-actions/files/.github/workflows/ci.yml +18 -14
  153. package/dist/templates/ci-github-actions/files/.github/workflows/deploy-fly.yml +12 -6
  154. package/dist/templates/ci-github-actions/files/.github/workflows/deploy-railway.yml +14 -8
  155. package/dist/templates/ci-github-actions/files/.github/workflows/deploy-vercel.yml +29 -8
  156. package/dist/templates/ci-github-actions/files/.github/workflows/deploy-vps.yml +14 -8
  157. package/dist/templates/ci-github-actions/files/.github/workflows/preview.yml +34 -18
  158. package/dist/templates/ci-github-actions/manifest.json +2 -2
  159. package/dist/templates/docker/README.md +3 -0
  160. package/dist/templates/docker/files/.github/workflows/docker-build.yml +15 -6
  161. package/dist/templates/docker/manifest.json +1 -0
  162. package/dist/templates/llm-adapter/files/src/domain/errors/llm-error.ts +35 -0
  163. package/dist/templates/llm-adapter/files/src/domain/ports/out/llm-client.port.ts +1 -1
  164. package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/anthropic-llm-client.adapter.ts +1 -1
  165. package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/azure-openai-llm-client.adapter.ts +1 -1
  166. package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/ollama-llm-client.adapter.ts +1 -1
  167. package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/openai-llm-client.adapter.ts +1 -1
  168. package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/xai-llm-client.adapter.ts +1 -1
  169. package/dist/templates/llm-adapter/files/src/infrastructure/llm/errors/llm-errors.ts +9 -23
  170. package/dist/templates/llm-adapter/files/src/infrastructure/llm/index.ts +4 -3
  171. package/dist/templates/llm-adapter/files/src/infrastructure/llm/router/llm-router.ts +1 -1
  172. package/dist/templates/llm-adapter/files/src/infrastructure/llm/utils/retry.ts +1 -1
  173. package/dist/templates/llm-adapter/files/src/infrastructure/llm/utils/structured-output.ts +1 -1
  174. package/dist/templates/llm-adapter/manifest.json +1 -0
  175. package/dist/templates/llm-adapter-bedrock/files/src/infrastructure/llm/adapters/bedrock-llm-client.adapter.ts +1 -1
  176. package/dist/templates/llm-adapter-bedrock/files/src/infrastructure/llm/errors/bedrock-errors.ts +1 -1
  177. package/dist/templates/mcp-server/README.md +1 -1
  178. package/dist/templates/mcp-server-http/README.md +1 -1
  179. package/dist/types/index.d.ts +20 -1
  180. package/dist/types/index.d.ts.map +1 -1
  181. package/package.json +6 -5
  182. package/dist/application/ports/out/project-configuration-read.port.d.ts +0 -9
  183. package/dist/application/ports/out/project-configuration-read.port.d.ts.map +0 -1
  184. package/dist/application/ports/out/symbol-reference-provider.port.d.ts +0 -10
  185. package/dist/application/ports/out/symbol-reference-provider.port.d.ts.map +0 -1
  186. package/dist/application/use-cases/get-manifest-resource.use-case.d.ts +0 -8
  187. package/dist/application/use-cases/get-manifest-resource.use-case.d.ts.map +0 -1
  188. package/dist/generators/validators/index.d.ts +0 -11
  189. package/dist/generators/validators/index.d.ts.map +0 -1
  190. package/dist/generators/validators/validate-dependencies.d.ts +0 -7
  191. package/dist/generators/validators/validate-dependencies.d.ts.map +0 -1
  192. package/dist/generators/validators/validate-manifest-sync.d.ts +0 -5
  193. package/dist/generators/validators/validate-manifest-sync.d.ts.map +0 -1
  194. package/dist/generators/validators/validate-port-adapter.d.ts +0 -5
  195. package/dist/generators/validators/validate-port-adapter.d.ts.map +0 -1
  196. package/dist/generators/validators/validation-types.d.ts +0 -20
  197. package/dist/generators/validators/validation-types.d.ts.map +0 -1
  198. package/dist/generators/validators.d.ts +0 -7
  199. package/dist/generators/validators.d.ts.map +0 -1
@@ -29,6 +29,15 @@ export {
29
29
  classifyAdobeError,
30
30
  } from "./errors/firefly-errors";
31
31
  export type { AdobeErrorLike } from "./errors/firefly-errors";
32
+ export { toCreativeServiceError } from "./errors/to-creative-service-error";
33
+
34
+ // The out-ports' failure channel is domain-owned (ADR-0053); re-exported here so
35
+ // service adapters and callers keep a single import for the foundation.
36
+ export { CreativeServiceError } from "../../domain/errors/creative-service-error";
37
+ export type {
38
+ CreativeServiceErrorKind,
39
+ CreativeServiceErrorOptions,
40
+ } from "../../domain/errors/creative-service-error";
32
41
 
33
42
  export type {
34
43
  FireflyAuthPort,
@@ -56,6 +56,7 @@
56
56
  "ADOBE_WEBHOOK_TIMEOUT_MS"
57
57
  ],
58
58
  "outputs": [
59
+ "src/domain/errors/creative-service-error.ts",
59
60
  "src/domain/ports/out/firefly-auth.port.ts",
60
61
  "src/domain/ports/out/firefly-job.port.ts",
61
62
  "src/domain/ports/out/firefly-storage.port.ts",
@@ -67,6 +68,7 @@
67
68
  "src/infrastructure/adobe/jobs/job-port.ts",
68
69
  "src/infrastructure/adobe/storage/passthrough-storage.adapter.ts",
69
70
  "src/infrastructure/adobe/errors/firefly-errors.ts",
71
+ "src/infrastructure/adobe/errors/to-creative-service-error.ts",
70
72
  "src/infrastructure/adobe/index.ts",
71
73
  ".env.adobe.example",
72
74
  {
@@ -1,7 +1,5 @@
1
1
  import type { Result } from "../../../shared/result";
2
- // Type-only import of the infrastructure error (erased at compile) — the deliberate
3
- // domain→infra decoupling for the port's failure channel, not an oversight.
4
- import type { FireflyError } from "../../../infrastructure/adobe/errors/firefly-errors";
2
+ import type { CreativeServiceError } from "../../errors/creative-service-error";
5
3
 
6
4
  /**
7
5
  * Outbound port for the Adobe Firefly Custom Models API.
@@ -62,16 +60,16 @@ export interface CustomModelPort {
62
60
  * Submit a training job and await it over `queued → training → completed`.
63
61
  * Resolves to the trained model id.
64
62
  */
65
- train(req: TrainRequest): Promise<Result<string, FireflyError>>;
63
+ train(req: TrainRequest): Promise<Result<string, CreativeServiceError>>;
66
64
  /** Fetch a model's current training status. */
67
- status(modelId: string): Promise<Result<TrainedModel, FireflyError>>;
65
+ status(modelId: string): Promise<Result<TrainedModel, CreativeServiceError>>;
68
66
  /** List the project's custom models. */
69
- list(): Promise<Result<TrainedModel[], FireflyError>>;
67
+ list(): Promise<Result<TrainedModel[], CreativeServiceError>>;
70
68
  /**
71
69
  * Generate images with a trained custom model. Resolves to one output href per
72
70
  * variation, in request order.
73
71
  */
74
72
  generateWith(
75
73
  req: GenerateWithRequest,
76
- ): Promise<Result<string[], FireflyError>>;
74
+ ): Promise<Result<string[], CreativeServiceError>>;
77
75
  }
@@ -10,7 +10,8 @@ import { fireflyClient } from "../http/firefly-client";
10
10
  import { jobPort } from "../jobs/job-port";
11
11
  import { toJobHandle } from "../jobs/job-result";
12
12
  import { getStoragePresigner } from "../storage/passthrough-storage.adapter";
13
- import { classifyAdobeError, FireflyError } from "../errors/firefly-errors";
13
+ import { toCreativeServiceError } from "../errors/to-creative-service-error";
14
+ import { CreativeServiceError } from "../../../domain/errors/creative-service-error";
14
15
  import { ok, err, type Result } from "../../../shared/result";
15
16
 
16
17
  /**
@@ -34,7 +35,7 @@ const DEFAULT_BASE_MODEL =
34
35
  const DATASET_CAPTION_FORMAT = "{dataset_caption_format}";
35
36
 
36
37
  export class FireflyCustomModelAdapter implements CustomModelPort {
37
- async train(req: TrainRequest): Promise<Result<string, FireflyError>> {
38
+ async train(req: TrainRequest): Promise<Result<string, CreativeServiceError>> {
38
39
  try {
39
40
  // The dataset is already uploaded to storage; presign it so Firefly can read it.
40
41
  const dataset = await getStoragePresigner().presignInput(req.datasetHref);
@@ -48,7 +49,7 @@ export class FireflyCustomModelAdapter implements CustomModelPort {
48
49
  );
49
50
  if (!handle.jobId) {
50
51
  return err(
51
- new FireflyError(
52
+ new CreativeServiceError("unknown",
52
53
  "Custom-model train submit did not include a job id.",
53
54
  ),
54
55
  );
@@ -57,24 +58,24 @@ export class FireflyCustomModelAdapter implements CustomModelPort {
57
58
  const done = await jobPort.await(handle);
58
59
  if (done.status !== "succeeded") {
59
60
  return err(
60
- new FireflyError(done.error ?? "Custom-model training did not complete."),
61
+ new CreativeServiceError("unknown", done.error ?? "Custom-model training did not complete."),
61
62
  );
62
63
  }
63
64
  const modelId = extractModelId(done.outputs[0]);
64
65
  if (!modelId) {
65
66
  return err(
66
- new FireflyError(
67
+ new CreativeServiceError("unknown",
67
68
  "Custom-model training completed without a model id (verify the result field against Adobe docs).",
68
69
  ),
69
70
  );
70
71
  }
71
72
  return ok(modelId);
72
73
  } catch (error) {
73
- return err(classifyAdobeError(error));
74
+ return err(toCreativeServiceError(error));
74
75
  }
75
76
  }
76
77
 
77
- async status(modelId: string): Promise<Result<TrainedModel, FireflyError>> {
78
+ async status(modelId: string): Promise<Result<TrainedModel, CreativeServiceError>> {
78
79
  try {
79
80
  const raw = await fireflyClient.get<unknown>(
80
81
  `/v3/custom-models/${encodeURIComponent(modelId)}`,
@@ -84,16 +85,16 @@ export class FireflyCustomModelAdapter implements CustomModelPort {
84
85
  // Don't return ok with an empty, unusable model id — that just pushes the
85
86
  // failure to the next call (status/generateWith expect a real id).
86
87
  return err(
87
- new FireflyError("Custom-model status response had no model id."),
88
+ new CreativeServiceError("unknown", "Custom-model status response had no model id."),
88
89
  );
89
90
  }
90
91
  return ok(model);
91
92
  } catch (error) {
92
- return err(classifyAdobeError(error));
93
+ return err(toCreativeServiceError(error));
93
94
  }
94
95
  }
95
96
 
96
- async list(): Promise<Result<TrainedModel[], FireflyError>> {
97
+ async list(): Promise<Result<TrainedModel[], CreativeServiceError>> {
97
98
  try {
98
99
  const raw = await fireflyClient.get<unknown>("/v3/custom-models");
99
100
  const models = (raw as { models?: unknown[] })?.models;
@@ -105,13 +106,13 @@ export class FireflyCustomModelAdapter implements CustomModelPort {
105
106
  .filter((m): m is TrainedModel => m !== undefined);
106
107
  return ok(trained);
107
108
  } catch (error) {
108
- return err(classifyAdobeError(error));
109
+ return err(toCreativeServiceError(error));
109
110
  }
110
111
  }
111
112
 
112
113
  async generateWith(
113
114
  req: GenerateWithRequest,
114
- ): Promise<Result<string[], FireflyError>> {
115
+ ): Promise<Result<string[], CreativeServiceError>> {
115
116
  try {
116
117
  const output = await getStoragePresigner().presignOutput(req.outputHref);
117
118
  const body: Record<string, unknown> = {
@@ -127,7 +128,7 @@ export class FireflyCustomModelAdapter implements CustomModelPort {
127
128
  );
128
129
  if (!handle.jobId) {
129
130
  return err(
130
- new FireflyError(
131
+ new CreativeServiceError("unknown",
131
132
  "Custom-model generate submit did not include a job id.",
132
133
  ),
133
134
  );
@@ -138,14 +139,14 @@ export class FireflyCustomModelAdapter implements CustomModelPort {
138
139
  .filter((h): h is string => typeof h === "string" && h.length > 0);
139
140
  if (done.status !== "succeeded" || hrefs.length === 0) {
140
141
  return err(
141
- new FireflyError(
142
+ new CreativeServiceError("unknown",
142
143
  done.error ?? "Custom-model generation produced no output.",
143
144
  ),
144
145
  );
145
146
  }
146
147
  return ok(hrefs);
147
148
  } catch (error) {
148
- return err(classifyAdobeError(error));
149
+ return err(toCreativeServiceError(error));
149
150
  }
150
151
  }
151
152
  }
@@ -1,7 +1,5 @@
1
1
  import type { Result } from "../../../shared/result";
2
- // Type-only import of the infrastructure error (erased at compile) — types a
3
- // port's failure channel without runtime domain→infra coupling.
4
- import type { FireflyError } from "../../../infrastructure/adobe/errors/firefly-errors";
2
+ import type { CreativeServiceError } from "../../errors/creative-service-error";
5
3
 
6
4
  /**
7
5
  * Outbound port for the Firefly Generate service.
@@ -49,13 +47,13 @@ export interface ImageEditRequest extends GenerateOptions {
49
47
 
50
48
  export interface ImageGenerationPort {
51
49
  /** Generate image(s) from a text prompt. */
52
- textToImage(req: TextToImageRequest): Promise<Result<string[], FireflyError>>;
50
+ textToImage(req: TextToImageRequest): Promise<Result<string[], CreativeServiceError>>;
53
51
  /** Fill a masked region of an image. */
54
- generativeFill(req: ImageEditRequest): Promise<Result<string[], FireflyError>>;
52
+ generativeFill(req: ImageEditRequest): Promise<Result<string[], CreativeServiceError>>;
55
53
  /** Extend an image beyond its original bounds. */
56
- generativeExpand(req: ImageEditRequest): Promise<Result<string[], FireflyError>>;
54
+ generativeExpand(req: ImageEditRequest): Promise<Result<string[], CreativeServiceError>>;
57
55
  /** Generate a new image conditioned on a reference image. */
58
- imageToImage(req: ImageEditRequest): Promise<Result<string[], FireflyError>>;
56
+ imageToImage(req: ImageEditRequest): Promise<Result<string[], CreativeServiceError>>;
59
57
  /** Apply the style of a reference image to a generation. */
60
- styleTransfer(req: ImageEditRequest): Promise<Result<string[], FireflyError>>;
58
+ styleTransfer(req: ImageEditRequest): Promise<Result<string[], CreativeServiceError>>;
61
59
  }
@@ -9,11 +9,9 @@ import { fireflyClient } from "../http/firefly-client";
9
9
  import { jobPort } from "../jobs/job-port";
10
10
  import { toJobHandle } from "../jobs/job-result";
11
11
  import { getStoragePresigner } from "../storage/passthrough-storage.adapter";
12
- import {
13
- classifyAdobeError,
14
- FireflyError,
15
- FireflyValidationError,
16
- } from "../errors/firefly-errors";
12
+ import { FireflyValidationError } from "../errors/firefly-errors";
13
+ import { toCreativeServiceError } from "../errors/to-creative-service-error";
14
+ import { CreativeServiceError } from "../../../domain/errors/creative-service-error";
17
15
  import { ok, err, type Result } from "../../../shared/result";
18
16
 
19
17
  /**
@@ -42,7 +40,7 @@ function resolveDefaultSize(raw: string | undefined): string {
42
40
  }
43
41
 
44
42
  export class FireflyGenerateAdapter implements ImageGenerationPort {
45
- async textToImage(req: TextToImageRequest): Promise<Result<string[], FireflyError>> {
43
+ async textToImage(req: TextToImageRequest): Promise<Result<string[], CreativeServiceError>> {
46
44
  return this.run(async () => {
47
45
  const output = await getStoragePresigner().presignOutput(req.outputHref);
48
46
  const body = this.applyOptions({ prompt: req.prompt, output: external(output.href) }, req);
@@ -50,15 +48,15 @@ export class FireflyGenerateAdapter implements ImageGenerationPort {
50
48
  });
51
49
  }
52
50
 
53
- async generativeFill(req: ImageEditRequest): Promise<Result<string[], FireflyError>> {
51
+ async generativeFill(req: ImageEditRequest): Promise<Result<string[], CreativeServiceError>> {
54
52
  return this.edit("/v3/images/fill-async", req);
55
53
  }
56
54
 
57
- async generativeExpand(req: ImageEditRequest): Promise<Result<string[], FireflyError>> {
55
+ async generativeExpand(req: ImageEditRequest): Promise<Result<string[], CreativeServiceError>> {
58
56
  return this.edit("/v3/images/expand-async", req);
59
57
  }
60
58
 
61
- async imageToImage(req: ImageEditRequest): Promise<Result<string[], FireflyError>> {
59
+ async imageToImage(req: ImageEditRequest): Promise<Result<string[], CreativeServiceError>> {
62
60
  // Conditioned generation: the source image is a reference, not a mask target.
63
61
  return this.run(async () => {
64
62
  const storage = getStoragePresigner();
@@ -73,7 +71,7 @@ export class FireflyGenerateAdapter implements ImageGenerationPort {
73
71
  });
74
72
  }
75
73
 
76
- async styleTransfer(req: ImageEditRequest): Promise<Result<string[], FireflyError>> {
74
+ async styleTransfer(req: ImageEditRequest): Promise<Result<string[], CreativeServiceError>> {
77
75
  return this.run(async () => {
78
76
  const storage = getStoragePresigner();
79
77
  const input = await storage.presignInput(req.inputHref);
@@ -88,7 +86,7 @@ export class FireflyGenerateAdapter implements ImageGenerationPort {
88
86
  }
89
87
 
90
88
  /** Shared flow for the mask-style edits (fill / expand). */
91
- private async edit(path: string, req: ImageEditRequest): Promise<Result<string[], FireflyError>> {
89
+ private async edit(path: string, req: ImageEditRequest): Promise<Result<string[], CreativeServiceError>> {
92
90
  return this.run(async () => {
93
91
  const storage = getStoragePresigner();
94
92
  const input = await storage.presignInput(req.inputHref);
@@ -108,26 +106,26 @@ export class FireflyGenerateAdapter implements ImageGenerationPort {
108
106
  /** Submit → await → collect output hrefs. Presigning happens inside `build`. */
109
107
  private async run(
110
108
  build: () => Promise<{ path: string; body: unknown }>,
111
- ): Promise<Result<string[], FireflyError>> {
109
+ ): Promise<Result<string[], CreativeServiceError>> {
112
110
  try {
113
111
  const { path, body } = await build();
114
112
  const handle = toJobHandle(await fireflyClient.post(path, body));
115
113
  if (!handle.jobId) {
116
- return err(new FireflyError("Generate submit response did not include a job id."));
114
+ return err(new CreativeServiceError("unknown", "Generate submit response did not include a job id."));
117
115
  }
118
116
  const done = await jobPort.await(handle);
119
117
  if (done.status !== "succeeded") {
120
- return err(new FireflyError(done.error ?? "Generate job did not succeed."));
118
+ return err(new CreativeServiceError("unknown", done.error ?? "Generate job did not succeed."));
121
119
  }
122
120
  const hrefs = done.outputs
123
121
  .map((output) => output.href)
124
122
  .filter((href): href is string => Boolean(href));
125
123
  if (hrefs.length === 0) {
126
- return err(new FireflyError("Generate job produced no output."));
124
+ return err(new CreativeServiceError("unknown", "Generate job produced no output."));
127
125
  }
128
126
  return ok(hrefs);
129
127
  } catch (error) {
130
- return err(classifyAdobeError(error));
128
+ return err(toCreativeServiceError(error));
131
129
  }
132
130
  }
133
131
 
@@ -1,7 +1,5 @@
1
1
  import type { Result } from "../../../shared/result";
2
- // Type-only import of the infrastructure error (erased at compile) — the deliberate
3
- // domain→infra decoupling for the port's failure channel, not an oversight.
4
- import type { FireflyError } from "../../../infrastructure/adobe/errors/firefly-errors";
2
+ import type { CreativeServiceError } from "../../errors/creative-service-error";
5
3
 
6
4
  /**
7
5
  * Outbound port for the Adobe Firefly Audio/Video (Media) API.
@@ -64,17 +62,17 @@ export interface SoundEffectRequest extends MediaOptions {
64
62
 
65
63
  export interface MediaGenerationPort {
66
64
  /** Generate a video from a text prompt. */
67
- textToVideo(req: TextToVideoRequest): Promise<Result<string, FireflyError>>;
65
+ textToVideo(req: TextToVideoRequest): Promise<Result<string, CreativeServiceError>>;
68
66
  /** Animate a source image into a video. */
69
- imageToVideo(req: ImageToVideoRequest): Promise<Result<string, FireflyError>>;
67
+ imageToVideo(req: ImageToVideoRequest): Promise<Result<string, CreativeServiceError>>;
70
68
  /** Translate the audio/video of a source asset into another locale. */
71
69
  translateAudioVideo(
72
70
  req: TranslateAudioVideoRequest,
73
- ): Promise<Result<string, FireflyError>>;
71
+ ): Promise<Result<string, CreativeServiceError>>;
74
72
  /** Synthesise speech from text. */
75
73
  generateSpeech(
76
74
  req: GenerateSpeechRequest,
77
- ): Promise<Result<string, FireflyError>>;
75
+ ): Promise<Result<string, CreativeServiceError>>;
78
76
  /** Generate a sound effect from a text prompt. */
79
- soundEffect(req: SoundEffectRequest): Promise<Result<string, FireflyError>>;
77
+ soundEffect(req: SoundEffectRequest): Promise<Result<string, CreativeServiceError>>;
80
78
  }
@@ -12,7 +12,8 @@ import { fireflyClient } from "../http/firefly-client";
12
12
  import { jobPort } from "../jobs/job-port";
13
13
  import { toJobHandle } from "../jobs/job-result";
14
14
  import { getStoragePresigner } from "../storage/passthrough-storage.adapter";
15
- import { classifyAdobeError, FireflyError } from "../errors/firefly-errors";
15
+ import { toCreativeServiceError } from "../errors/to-creative-service-error";
16
+ import { CreativeServiceError } from "../../../domain/errors/creative-service-error";
16
17
  import { ok, err, type Result } from "../../../shared/result";
17
18
 
18
19
  /**
@@ -38,7 +39,7 @@ const DEFAULT_MODEL =
38
39
  export class FireflyMediaAdapter implements MediaGenerationPort {
39
40
  async textToVideo(
40
41
  req: TextToVideoRequest,
41
- ): Promise<Result<string, FireflyError>> {
42
+ ): Promise<Result<string, CreativeServiceError>> {
42
43
  return this.run(async () => {
43
44
  const output = await getStoragePresigner().presignOutput(req.outputHref);
44
45
  return {
@@ -50,7 +51,7 @@ export class FireflyMediaAdapter implements MediaGenerationPort {
50
51
 
51
52
  async imageToVideo(
52
53
  req: ImageToVideoRequest,
53
- ): Promise<Result<string, FireflyError>> {
54
+ ): Promise<Result<string, CreativeServiceError>> {
54
55
  return this.run(async () => {
55
56
  const storage = getStoragePresigner();
56
57
  const input = await storage.presignInput(req.inputHref);
@@ -67,7 +68,7 @@ export class FireflyMediaAdapter implements MediaGenerationPort {
67
68
 
68
69
  async translateAudioVideo(
69
70
  req: TranslateAudioVideoRequest,
70
- ): Promise<Result<string, FireflyError>> {
71
+ ): Promise<Result<string, CreativeServiceError>> {
71
72
  return this.run(async () => {
72
73
  const storage = getStoragePresigner();
73
74
  const input = await storage.presignInput(req.inputHref);
@@ -88,7 +89,7 @@ export class FireflyMediaAdapter implements MediaGenerationPort {
88
89
 
89
90
  async generateSpeech(
90
91
  req: GenerateSpeechRequest,
91
- ): Promise<Result<string, FireflyError>> {
92
+ ): Promise<Result<string, CreativeServiceError>> {
92
93
  return this.run(async () => {
93
94
  const output = await getStoragePresigner().presignOutput(req.outputHref);
94
95
  const body: Record<string, unknown> = {
@@ -102,7 +103,7 @@ export class FireflyMediaAdapter implements MediaGenerationPort {
102
103
 
103
104
  async soundEffect(
104
105
  req: SoundEffectRequest,
105
- ): Promise<Result<string, FireflyError>> {
106
+ ): Promise<Result<string, CreativeServiceError>> {
106
107
  return this.run(async () => {
107
108
  const output = await getStoragePresigner().presignOutput(req.outputHref);
108
109
  return {
@@ -114,7 +115,7 @@ export class FireflyMediaAdapter implements MediaGenerationPort {
114
115
 
115
116
  private async run(
116
117
  build: () => Promise<{ path: string; body: unknown }>,
117
- ): Promise<Result<string, FireflyError>> {
118
+ ): Promise<Result<string, CreativeServiceError>> {
118
119
  try {
119
120
  const { path, body } = await build();
120
121
  const handle = toJobHandle(await fireflyClient.post(path, body));
@@ -122,7 +123,7 @@ export class FireflyMediaAdapter implements MediaGenerationPort {
122
123
  // collide in webhook mode — fail here with a precise error.
123
124
  if (!handle.jobId) {
124
125
  return err(
125
- new FireflyError("Media submit response did not include a job id."),
126
+ new CreativeServiceError("unknown", "Media submit response did not include a job id."),
126
127
  );
127
128
  }
128
129
  // Long (minutes) jobs: await transparently polls or resolves a webhook.
@@ -130,12 +131,12 @@ export class FireflyMediaAdapter implements MediaGenerationPort {
130
131
  const href = done.outputs[0]?.href;
131
132
  if (done.status !== "succeeded" || !href) {
132
133
  return err(
133
- new FireflyError(done.error ?? "Media job did not produce an output."),
134
+ new CreativeServiceError("unknown", done.error ?? "Media job did not produce an output."),
134
135
  );
135
136
  }
136
137
  return ok(href);
137
138
  } catch (error) {
138
- return err(classifyAdobeError(error));
139
+ return err(toCreativeServiceError(error));
139
140
  }
140
141
  }
141
142
  }
@@ -1,7 +1,5 @@
1
1
  import type { Result } from "../../../shared/result";
2
- // Type-only import of the infrastructure error (erased at compile) — the accepted
3
- // pattern for typing a port's failure channel without runtime domain→infra coupling.
4
- import type { FireflyError } from "../../../infrastructure/adobe/errors/firefly-errors";
2
+ import type { CreativeServiceError } from "../../errors/creative-service-error";
5
3
 
6
4
  /**
7
5
  * Outbound port for the Firefly Upscale service.
@@ -21,5 +19,5 @@ export interface UpscaleRequest {
21
19
 
22
20
  export interface UpscalePort {
23
21
  /** Upscale `inputHref` into `outputHref`; resolves to the output href on success. */
24
- upscale(req: UpscaleRequest): Promise<Result<string, FireflyError>>;
22
+ upscale(req: UpscaleRequest): Promise<Result<string, CreativeServiceError>>;
25
23
  }
@@ -7,11 +7,8 @@ import { fireflyClient } from "../http/firefly-client";
7
7
  import { jobPort } from "../jobs/job-port";
8
8
  import { toJobHandle } from "../jobs/job-result";
9
9
  import { getStoragePresigner } from "../storage/passthrough-storage.adapter";
10
- import {
11
- classifyAdobeError,
12
- FireflyError,
13
- FireflyValidationError,
14
- } from "../errors/firefly-errors";
10
+ import { toCreativeServiceError } from "../errors/to-creative-service-error";
11
+ import { CreativeServiceError } from "../../../domain/errors/creative-service-error";
15
12
  import { ok, err, type Result } from "../../../shared/result";
16
13
 
17
14
  /**
@@ -21,7 +18,7 @@ import { ok, err, type Result } from "../../../shared/result";
21
18
  * the async upscale job through the shared `fireflyClient`, awaits completion via
22
19
  * `FireflyJobPort` (polling or webhook, transparently), and returns the output
23
20
  * href. All failures are converted to a `Result` at this boundary — the foundation
24
- * throws typed `FireflyError`s, the port surfaces them.
21
+ * throws typed `CreativeServiceError`s, the port surfaces them.
25
22
  */
26
23
  // The install default is always a valid select value ("2"/"4"); fall back to it
27
24
  // if ADOBE_UPSCALE_FACTOR is unset or misconfigured, so a bad env never yields
@@ -41,12 +38,17 @@ function isValidFactor(factor: number): boolean {
41
38
  const DEFAULT_FACTOR = resolveDefaultFactor();
42
39
 
43
40
  export class FireflyUpscaleAdapter implements UpscalePort {
44
- async upscale(req: UpscaleRequest): Promise<Result<string, FireflyError>> {
41
+ async upscale(req: UpscaleRequest): Promise<Result<string, CreativeServiceError>> {
45
42
  const factor = req.factor ?? DEFAULT_FACTOR;
46
43
  if (!isValidFactor(factor)) {
47
44
  // Don't send NaN/0/negative to the API — fail fast with a config error.
45
+ // The request never reached the vendor, so the port's own failure type is
46
+ // returned directly rather than mapped from one (ADR-0053 §1).
48
47
  return err(
49
- new FireflyValidationError(`Invalid upscale factor ${JSON.stringify(req.factor)} — must be a positive number.`),
48
+ new CreativeServiceError(
49
+ "invalid-request",
50
+ `Invalid upscale factor ${JSON.stringify(req.factor)} — must be a positive number.`,
51
+ ),
50
52
  );
51
53
  }
52
54
 
@@ -66,17 +68,17 @@ export class FireflyUpscaleAdapter implements UpscalePort {
66
68
  // empty 202 body) can't be correlated and would collide in webhook mode.
67
69
  // The job port also guards this, but failing here gives a precise error.
68
70
  if (!handle.jobId) {
69
- return err(new FireflyError("Upscale submit response did not include a job id."));
71
+ return err(new CreativeServiceError("unknown", "Upscale submit response did not include a job id."));
70
72
  }
71
73
 
72
74
  const done = await jobPort.await(handle);
73
75
  const href = done.outputs[0]?.href;
74
76
  if (done.status !== "succeeded" || !href) {
75
- return err(new FireflyError(done.error ?? "Upscale job did not produce an output"));
77
+ return err(new CreativeServiceError("unknown", done.error ?? "Upscale job did not produce an output"));
76
78
  }
77
79
  return ok(href);
78
80
  } catch (error) {
79
- return err(classifyAdobeError(error));
81
+ return err(toCreativeServiceError(error));
80
82
  }
81
83
  }
82
84
  }
@@ -1,7 +1,5 @@
1
1
  import type { Result } from "../../../shared/result";
2
- // Type-only import of the infrastructure error (erased at compile) — the deliberate
3
- // domain→infra decoupling for the port's failure channel, not an oversight.
4
- import type { FireflyError } from "../../../infrastructure/adobe/errors/firefly-errors";
2
+ import type { CreativeServiceError } from "../../errors/creative-service-error";
5
3
 
6
4
  /**
7
5
  * Outbound port for the Adobe Illustrator API (image.adobe.io).
@@ -43,9 +41,9 @@ export interface ScaleVectorRequest extends IllustratorRequest {
43
41
 
44
42
  export interface IllustratorPort {
45
43
  /** Render an artboard to a raster/PDF at a given scale. */
46
- renderArtboard(req: RenderArtboardRequest): Promise<Result<string, FireflyError>>;
44
+ renderArtboard(req: RenderArtboardRequest): Promise<Result<string, CreativeServiceError>>;
47
45
  /** Merge variable data into a template document. */
48
- dataMerge(req: DataMergeRequest): Promise<Result<string, FireflyError>>;
46
+ dataMerge(req: DataMergeRequest): Promise<Result<string, CreativeServiceError>>;
49
47
  /** Scale a vector to an arbitrary size and rasterise. */
50
- scaleVector(req: ScaleVectorRequest): Promise<Result<string, FireflyError>>;
48
+ scaleVector(req: ScaleVectorRequest): Promise<Result<string, CreativeServiceError>>;
51
49
  }
@@ -10,11 +10,8 @@ import { fireflyClient } from "../http/firefly-client";
10
10
  import { jobPort } from "../jobs/job-port";
11
11
  import { toJobHandle } from "../jobs/job-result";
12
12
  import { getStoragePresigner } from "../storage/passthrough-storage.adapter";
13
- import {
14
- classifyAdobeError,
15
- FireflyError,
16
- FireflyValidationError,
17
- } from "../errors/firefly-errors";
13
+ import { toCreativeServiceError } from "../errors/to-creative-service-error";
14
+ import { CreativeServiceError } from "../../../domain/errors/creative-service-error";
18
15
  import { ok, err, type Result } from "../../../shared/result";
19
16
 
20
17
  /**
@@ -41,7 +38,7 @@ const DEFAULT_FORMAT: IllustratorFormat =
41
38
  : "{output_format}";
42
39
 
43
40
  export class IllustratorAdapter implements IllustratorPort {
44
- async renderArtboard(req: RenderArtboardRequest): Promise<Result<string, FireflyError>> {
41
+ async renderArtboard(req: RenderArtboardRequest): Promise<Result<string, CreativeServiceError>> {
45
42
  return this.run(async () => {
46
43
  const { input, output } = await this.presignIO(req);
47
44
  return {
@@ -55,7 +52,7 @@ export class IllustratorAdapter implements IllustratorPort {
55
52
  });
56
53
  }
57
54
 
58
- async dataMerge(req: DataMergeRequest): Promise<Result<string, FireflyError>> {
55
+ async dataMerge(req: DataMergeRequest): Promise<Result<string, CreativeServiceError>> {
59
56
  return this.run(async () => {
60
57
  const { input, output } = await this.presignIO(req);
61
58
  return {
@@ -69,12 +66,17 @@ export class IllustratorAdapter implements IllustratorPort {
69
66
  });
70
67
  }
71
68
 
72
- async scaleVector(req: ScaleVectorRequest): Promise<Result<string, FireflyError>> {
69
+ async scaleVector(req: ScaleVectorRequest): Promise<Result<string, CreativeServiceError>> {
73
70
  // Fail fast on an empty target: the API rejects scaling with no dimensions,
74
- // so surface a clear validation error rather than a downstream 400.
71
+ // so surface a clear validation error rather than a downstream 400. The
72
+ // request never reached the vendor, so the port's own failure type is
73
+ // returned directly rather than mapped from one (ADR-0053 §1).
75
74
  if (req.scale === undefined && req.width === undefined && req.height === undefined) {
76
75
  return err(
77
- new FireflyValidationError("scaleVector requires at least one of scale, width, or height."),
76
+ new CreativeServiceError(
77
+ "invalid-request",
78
+ "scaleVector requires at least one of scale, width, or height.",
79
+ ),
78
80
  );
79
81
  }
80
82
  return this.run(async () => {
@@ -102,7 +104,7 @@ export class IllustratorAdapter implements IllustratorPort {
102
104
 
103
105
  private async run(
104
106
  build: () => Promise<{ path: string; body: unknown }>,
105
- ): Promise<Result<string, FireflyError>> {
107
+ ): Promise<Result<string, CreativeServiceError>> {
106
108
  try {
107
109
  const { path, body } = await build();
108
110
  const handle = toJobHandle(await fireflyClient.post(path, body));
@@ -112,22 +114,22 @@ export class IllustratorAdapter implements IllustratorPort {
112
114
  // clear error rather than routing through the job port's await — which only
113
115
  // resolves a jobId-only handle in webhook mode and would fail in polling builds.
114
116
  if (!handle.statusUrl) {
115
- return err(new FireflyError("Illustrator submit response had no status URL to track the job."));
117
+ return err(new CreativeServiceError("unknown", "Illustrator submit response had no status URL to track the job."));
116
118
  }
117
119
  const done = await jobPort.poll(handle);
118
120
  if (done.status !== "succeeded") {
119
- return err(new FireflyError(done.error ?? "Illustrator job did not succeed."));
121
+ return err(new CreativeServiceError("unknown", done.error ?? "Illustrator job did not succeed."));
120
122
  }
121
123
  // `done.outputs` is a non-optional JobOutput[] (parseJobResult always returns
122
124
  // an array), so `[0]?.href` is enough — an empty array yields the no-output
123
125
  // path below; no `?.` on `outputs` itself is needed.
124
126
  const href = done.outputs[0]?.href;
125
127
  if (!href) {
126
- return err(new FireflyError("Illustrator job produced no output."));
128
+ return err(new CreativeServiceError("unknown", "Illustrator job produced no output."));
127
129
  }
128
130
  return ok(href);
129
131
  } catch (error) {
130
- return err(classifyAdobeError(error));
132
+ return err(toCreativeServiceError(error));
131
133
  }
132
134
  }
133
135
  }
@@ -1,7 +1,5 @@
1
1
  import type { Result } from "../../../shared/result";
2
- // Type-only import of the infrastructure error (erased at compile) — the deliberate
3
- // domain→infra decoupling for the port's failure channel, not an oversight.
4
- import type { FireflyError } from "../../../infrastructure/adobe/errors/firefly-errors";
2
+ import type { CreativeServiceError } from "../../errors/creative-service-error";
5
3
 
6
4
  /**
7
5
  * Outbound port for the Adobe InDesign API (image.adobe.io).
@@ -35,9 +33,9 @@ export type ExportPdfRequest = InDesignRequest;
35
33
 
36
34
  export interface InDesignPort {
37
35
  /** Merge a data source into a template, producing one document per record set. */
38
- dataMerge(req: DataMergeRequest): Promise<Result<string, FireflyError>>;
36
+ dataMerge(req: DataMergeRequest): Promise<Result<string, CreativeServiceError>>;
39
37
  /** Render a template's layout to an image/PDF. */
40
- renderLayout(req: RenderLayoutRequest): Promise<Result<string, FireflyError>>;
38
+ renderLayout(req: RenderLayoutRequest): Promise<Result<string, CreativeServiceError>>;
41
39
  /** Export a template to PDF. */
42
- exportPdf(req: ExportPdfRequest): Promise<Result<string, FireflyError>>;
40
+ exportPdf(req: ExportPdfRequest): Promise<Result<string, CreativeServiceError>>;
43
41
  }