Repository: pmcelhaney/counterfact
Pull request #629 (2023-10-24 23:31:08)

untangle type mess
- put types shared by server and application code in `types.d.ts`
- Don't import the `Schema` type from `json-schema-faker` because it's no more useful than `unknown`
- Fix an issue where HttpStatusCode is not imported in path-types files


Patch:
diff --git a/.github/workflows/debug-windows.yaml b/.github/workflows/debug-windows.yaml
index ed489a5..f792eb9 100644
--- a/.github/workflows/debug-windows.yaml
+++ b/.github/workflows/debug-windows.yaml
@@ -1,6 +1,7 @@
 name: Debug Windows
 
 on:
+  pull_request:
   workflow_dispatch:
 
 env:
@@ -33,7 +34,5 @@ jobs:
         run: yarn install --frozen-lockfile --network-timeout 100000
       - name: Build
         run: yarn build
-      - name: Try running the petstore
-        run: npx . https://petstore3.swagger.io/api/v3/openapi.json out
-        timeout-minutes: 2
-        continue-on-error: true
+      - name: Show files
+        run: Get-ChildItem -Recurse
diff --git a/bin/counterfact.js b/bin/counterfact.js
index ae55ac6..af54ca3 100755
--- a/bin/counterfact.js
+++ b/bin/counterfact.js
@@ -6,8 +6,8 @@ import { program } from "commander";
 import createDebug from "debug";
 import open from "open";
 
-import { migrate } from "../dist/src/migrations/0.27.js";
-import { counterfact } from "../dist/src/server/app.js";
+import { migrate } from "../dist/migrations/0.27.js";
+import { counterfact } from "../dist/server/app.js";
 
 const DEFAULT_PORT = 3100;
 
diff --git a/package.json b/package.json
index 09fe6e9..6b4631d 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,7 @@
     "test": "yarn node --experimental-vm-modules ./node_modules/jest-cli/bin/jest --testPathIgnorePatterns=black-box --forceExit",
     "test:black-box": "rimraf dist && rimraf out && yarn build && yarn node --experimental-vm-modules ./node_modules/jest-cli/bin/jest black-box --forceExit --coverage=false",
     "test:mutants": "stryker run stryker.config.json",
-    "build": "tsc && copyfiles src/client/** dist && copyfiles templates/** dist",
+    "build": "tsc && copyfiles -f \"src/client/**\" dist/client",
     "prepack": "yarn build",
     "release": "npx changeset publish",
     "prepare": "husky install",
diff --git a/src/server/dispatcher.ts b/src/server/dispatcher.ts
index a90d244..8e63b89 100644
--- a/src/server/dispatcher.ts
+++ b/src/server/dispatcher.ts
@@ -1,5 +1,4 @@
 /* eslint-disable import/newline-after-import */
-/* eslint-disable max-lines */
 
 import { mediaTypes } from "@hapi/accept";
 import createDebugger from "debug";
@@ -13,11 +12,9 @@ import type {
   NormalizedCounterfactResponseObject,
   Registry,
 } from "./registry.js";
-import {
-  createResponseBuilder,
-  type OpenApiOperation,
-} from "./response-builder.js";
+import { createResponseBuilder } from "./response-builder.js";
 import { Tools } from "./tools.js";
+import type { OpenApiOperation, OpenApiParameters } from "./types.d.ts";
 
 const debug = createDebugger("counterfact:server:dispatcher");
 
@@ -42,14 +39,6 @@ interface ParameterTypes {
   };
 }
 
-interface OpenApiParameters {
-  in: "body" | "cookie" | "formData" | "header" | "path" | "query";
-  name: string;
-  schema?: {
-    type: string;
-  };
-}
-
 export interface OpenApiDocument {
   paths: {
     [key: string]: {
@@ -304,5 +293,3 @@ export class Dispatcher {
     return normalizedResponse;
   }
 }
-
-export type { OpenApiParameters };
diff --git a/src/server/registry.ts b/src/server/registry.ts
index 8de9bae..8fc30fe 100644
--- a/src/server/registry.ts
+++ b/src/server/registry.ts
@@ -1,8 +1,7 @@
 import createDebugger from "debug";
 
-import type { ResponseBuilderFactory } from "../../templates/response-builder-factory.js";
-import type { MediaType } from "./response-builder.js";
 import type { Tools } from "./tools.js";
+import type { MediaType, ResponseBuilderFactory } from "./types.d.ts";
 
 const debug = createDebugger("counterfact:server:registry");
 
diff --git a/src/server/response-builder.ts b/src/server/response-builder.ts
index 1b1194f..1cf8ce4 100644
--- a/src/server/response-builder.ts
+++ b/src/server/response-builder.ts
@@ -1,28 +1,6 @@
-import { JSONSchemaFaker, type Schema } from "json-schema-faker";
-
-import type { OpenApiParameters } from "./dispatcher.js";
-
-interface ResponseBuilder {
-  [status: number | `${number} ${string}`]: ResponseBuilder;
-  content?: { body: unknown; type: string }[];
-  header: (name: string, value: string) => ResponseBuilder;
-  headers: { [name: string]: string };
-  html: (body: unknown) => ResponseBuilder;
-  json: (body: unknown) => ResponseBuilder;
-  match: (contentType: string, body: unknown) => ResponseBuilder;
-  random: () => ResponseBuilder;
-  randomLegacy: () => ResponseBuilder;
-  status?: number;
-  text: (body: unknown) => ResponseBuilder;
-}
-
-interface OpenApiHeader {
-  schema: unknown;
-}
+import { JSONSchemaFaker } from "json-schema-faker";
 
-interface OpenApiContent {
-  schema: unknown;
-}
+import type { OpenApiOperation, ResponseBuilder } from "./types.d.ts";
 
 JSONSchemaFaker.option("useExamplesValue", true);
 JSONSchemaFaker.option("minItems", 0);
@@ -52,36 +30,6 @@ function unknownStatusCodeResponse(statusCode: number | undefined) {
   };
 }
 
-interface Example {
-  description: string;
-  summary: string;
-  value: unknown;
-}
-
-export type MediaType = `${string}/${string}`;
-
-export interface OpenApiResponse {
-  content: { [key: MediaType]: OpenApiContent };
-  headers: { [key: string]: OpenApiHeader };
-}
-
-export interface OpenApiOperation {
-  parameters?: OpenApiParameters[];
-  produces?: string[];
-  responses: {
-    [status: string]: {
-      content?: {
-        [type: number | string]: {
-          examples?: { [key: string]: Example };
-          schema: unknown;
-        };
-      };
-      examples?: { [key: string]: unknown };
-      schema?: Schema;
-    };
-  };
-}
-
 export function createResponseBuilder(
   operation: OpenApiOperation,
 ): ResponseBuilder {
@@ -176,7 +124,8 @@ export function createResponseBuilder(
 
         const body = response.examples
           ? oneOf(response.examples)
-          : JSONSchemaFaker.generate(response.schema ?? { type: "object" });
+          : // eslint-disable-next-line total-functions/no-unsafe-readonly-mutable-assignment
+            JSONSchemaFaker.generate(response.schema ?? { type: "object" });
 
         return {
           ...this,
@@ -196,3 +145,5 @@ export function createResponseBuilder(
     }),
   });
 }
+
+export type { OpenApiOperation };
diff --git a/src/server/types.d.ts b/src/server/types.d.ts
new file mode 100644
index 0000000..0881c42
--- /dev/null
+++ b/src/server/types.d.ts
@@ -0,0 +1,201 @@
+interface OpenApiHeader {
+  schema: unknown;
+}
+
+interface OpenApiContent {
+  schema: unknown;
+}
+
+interface Example {
+  description: string;
+  summary: string;
+  value: unknown;
+}
+
+type MediaType = `${string}/${string}`;
+
+type OmitValueWhenNever<Base> = Pick<
+  Base,
+  {
+    [Key in keyof Base]: [Base[Key]] extends [never] ? never : Key;
+  }[keyof Base]
+>;
+
+interface OpenApiResponse {
+  content: { [key: MediaType]: OpenApiContent };
+  headers: { [key: string]: OpenApiHeader };
+}
+
+interface OpenApiResponses {
+  [key: string]: OpenApiResponse;
+}
+
+type IfHasKey<SomeObject, Key, Yes, No> = Key extends keyof SomeObject
+  ? Yes
+  : No;
+
+type MaybeShortcut<
+  ContentType extends MediaType,
+  Response extends OpenApiResponse,
+> = IfHasKey<
+  Response["content"],
+  ContentType,
+  (body: Response["content"][ContentType]["schema"]) => GenericResponseBuilder<{
+    content: Omit<Response["content"], ContentType>;
+    headers: Response["headers"];
+  }>,
+  never
+>;
+
+type MatchFunction<Response extends OpenApiResponse> = <
+  ContentType extends MediaType & keyof Response["content"],
+>(
+  contentType: ContentType,
+  body: Response["content"][ContentType]["schema"],
+) => GenericResponseBuilder<{
+  content: Omit<Response["content"], ContentType>;
+  headers: Response["headers"];
+}>;
+
+type HeaderFunction<Response extends OpenApiResponse> = <
+  Header extends string & keyof Response["headers"],
+>(
+  header: Header,
+  value: Response["headers"][Header]["schema"],
+) => GenericResponseBuilder<{
+  content: Response["content"];
+  headers: Omit<Response["headers"], Header>;
+}>;
+
+interface ResponseBuilder {
+  [status: number | `${number} ${string}`]: ResponseBuilder;
+  content?: { body: unknown; type: string }[];
+  header: (name: string, value: string) => ResponseBuilder;
+  headers: { [name: string]: string };
+  html: (body: unknown) => ResponseBuilder;
+  json: (body: unknown) => ResponseBuilder;
+  match: (contentType: string, body: unknown) => ResponseBuilder;
+  random: () => ResponseBuilder;
+  randomLegacy: () => ResponseBuilder;
+  status?: number;
+  text: (body: unknown) => ResponseBuilder;
+}
+
+type GenericResponseBuilder<
+  Response extends OpenApiResponse = OpenApiResponse,
+> = [keyof Response["content"]] extends [never]
+  ? // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
+    void
+  : OmitValueWhenNever<{
+      header: [keyof Response["headers"]] extends [never]
+        ? never
+        : HeaderFunction<Response>;
+      html: MaybeShortcut<"text/html", Response>;
+      json: MaybeShortcut<"application/json", Response>;
+      match: [keyof Response["content"]] extends [never]
+        ? never
+        : MatchFunction<Response>;
+      random: [keyof Response["content"]] extends [never] ? never : () => void;
+      text: MaybeShortcut<"text/plain", Response>;
+    }>;
+
+type ResponseBuilderFactory<
+  Responses extends OpenApiResponses = OpenApiResponses,
+> = {
+  [StatusCode in keyof Responses]: GenericResponseBuilder<
+    Responses[StatusCode]
+  >;
+} & { [key: string]: GenericResponseBuilder<Responses["default"]> };
+
+type HttpStatusCode =
+  | 100
+  | 101
+  | 102
+  | 200
+  | 201
+  | 202
+  | 203
+  | 204
+  | 205
+  | 206
+  | 207
+  | 226
+  | 300
+  | 301
+  | 302
+  | 303
+  | 304
+  | 305
+  | 307
+  | 308
+  | 400
+  | 401
+  | 402
+  | 403
+  | 404
+  | 405
+  | 406
+  | 407
+  | 408
+  | 409
+  | 410
+  | 411
+  | 412
+  | 413
+  | 414
+  | 415
+  | 416
+  | 417
+  | 418
+  | 422
+  | 423
+  | 424
+  | 426
+  | 428
+  | 429
+  | 431
+  | 451
+  | 500
+  | 501
+  | 502
+  | 503
+  | 504
+  | 505
+  | 506
+  | 507
+  | 511;
+
+interface OpenApiParameters {
+  in: "body" | "cookie" | "formData" | "header" | "path" | "query";
+  name: string;
+  schema?: {
+    type: string;
+  };
+}
+
+interface OpenApiOperation {
+  parameters?: OpenApiParameters[];
+  produces?: string[];
+  responses: {
+    [status: string]: {
+      content?: {
+        [type: number | string]: {
+          examples?: { [key: string]: Example };
+          schema: unknown;
+        };
+      };
+      examples?: { [key: string]: unknown };
+      schema?: unknown;
+    };
+  };
+}
+
+export type {
+  HttpStatusCode,
+  MediaType,
+  OpenApiOperation,
+  OpenApiParameters,
+  OpenApiResponse,
+  ResponseBuilder,
+  ResponseBuilderFactory,
+};
diff --git a/src/typescript-generator/repository.js b/src/typescript-generator/repository.js
index 4f5c5af..9f93ab1 100644
--- a/src/typescript-generator/repository.js
+++ b/src/typescript-generator/repository.js
@@ -50,20 +50,12 @@ export class Repository {
   }
 
   copyCoreFiles(destination) {
-    const files = ["response-builder-factory.ts"];
-
-    return files.map((file) => {
-      const path = nodePath.join(destination, file).replaceAll("\\", "/");
-
-      process.stdout.write(`writing ${path}\n`);
-
-      return fs.copyFile(
-        nodePath
-          .join(__dirname, `../../templates/${file}`)
-          .replaceAll("\\", "/"),
-        path,
-      );
-    });
+    return fs.copyFile(
+      nodePath
+        .join(__dirname, "../../src/server/types.d.ts")
+        .replaceAll("\\", "/"),
+      nodePath.join(destination, "types.d.ts").replaceAll("\\", "/"),
+    );
   }
 
   async writeFiles(destination) {
diff --git a/src/typescript-generator/response-type-coder.js b/src/typescript-generator/response-type-coder.js
index 9055690..ef85b00 100644
--- a/src/typescript-generator/response-type-coder.js
+++ b/src/typescript-generator/response-type-coder.js
@@ -12,8 +12,6 @@ export class ResponseTypeCoder extends Coder {
   }
 
   typeForDefaultStatusCode(listedStatusCodes) {
-    this.needsHttpStatusCodeImport = true;
-
     const definedStatusCodes = listedStatusCodes.filter(
       (key) => key !== "default",
     );
@@ -101,20 +99,20 @@ export class ResponseTypeCoder extends Coder {
 
     script.importExternalType(
       "ResponseBuilderFactory",
-      nodePath
-        .join(basePath, "response-builder-factory.js")
-        .replaceAll("\\", "/"),
+      nodePath.join(basePath, "types.d.ts").replaceAll("\\", "/"),
     );
 
-    if (this.needsHttpStatusCodeImport) {
+    const text = `ResponseBuilderFactory<${this.buildResponseObjectType(
+      script,
+    )}>`;
+
+    if (text.includes("HttpStatusCode")) {
       script.importExternalType(
         "HttpStatusCode",
-        nodePath
-          .join(basePath, "response-builder-factory.js")
-          .replaceAll("\\", "/"),
+        nodePath.join(basePath, "types.d.ts").replaceAll("\\", "/"),
       );
     }
 
-    return `ResponseBuilderFactory<${this.buildResponseObjectType(script)}>`;
+    return text;
   }
 }
diff --git a/templates/response-builder-factory.ts b/templates/response-builder-factory.ts
index 3a5f70a..288a982 100644
--- a/templates/response-builder-factory.ts
+++ b/templates/response-builder-factory.ts
@@ -1,4 +1,4 @@
-import type { OpenApiResponse } from "../src/server/response-builder.js";
+import type { OpenApiResponse } from "../src/server/types.d.ts";
 
 type OmitValueWhenNever<Base> = Pick<
   Base,


Test patch:
diff --git a/test/server/response-builder.test.ts b/test/server/response-builder.test.ts
index 8323aad..6bc9ad8 100644
--- a/test/server/response-builder.test.ts
+++ b/test/server/response-builder.test.ts
@@ -1,7 +1,5 @@
-import {
-  createResponseBuilder,
-  type OpenApiOperation,
-} from "../../src/server/response-builder.js";
+import { createResponseBuilder } from "../../src/server/response-builder.js";
+import type { OpenApiOperation } from "../../src/server/types.d.ts";
 
 describe("a response builder", () => {
   it("starts building a response object when the status is selected", () => {
diff --git a/test/typescript-generator/__snapshots__/generate.test.ts.snap b/test/typescript-generator/__snapshots__/generate.test.ts.snap
index a04ce38..aa63ba3 100644
--- a/test/typescript-generator/__snapshots__/generate.test.ts.snap
+++ b/test/typescript-generator/__snapshots__/generate.test.ts.snap
@@ -141,7 +141,7 @@ Map {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../response-builder-factory.js",
+              "modulePath": "../types.d.ts",
             },
           },
           "imports": Map {
@@ -408,7 +408,7 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../response-builder-factory.js",
+              "modulePath": "../types.d.ts",
             },
           },
           "imports": Map {
@@ -679,7 +679,7 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../response-builder-factory.js",
+        "modulePath": "../types.d.ts",
       },
     },
     "imports": Map {
@@ -917,7 +917,7 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -1115,7 +1115,7 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../../response-builder-factory.js",
+        "modulePath": "../../types.d.ts",
       },
     },
     "imports": Map {
@@ -1330,7 +1330,7 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -1528,7 +1528,7 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../../response-builder-factory.js",
+        "modulePath": "../../types.d.ts",
       },
     },
     "imports": Map {
@@ -1813,7 +1813,7 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -2051,7 +2051,7 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -2289,7 +2289,7 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -2531,7 +2531,7 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../../response-builder-factory.js",
+        "modulePath": "../../types.d.ts",
       },
     },
     "imports": Map {
@@ -2733,7 +2733,7 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../../response-builder-factory.js",
+              "modulePath": "../../../types.d.ts",
             },
           },
           "imports": Map {
@@ -2853,7 +2853,7 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../../../response-builder-factory.js",
+        "modulePath": "../../../types.d.ts",
       },
     },
     "imports": Map {
@@ -2989,7 +2989,7 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -3077,7 +3077,7 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../../response-builder-factory.js",
+        "modulePath": "../../types.d.ts",
       },
     },
     "imports": Map {
@@ -3189,7 +3189,7 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -3315,7 +3315,7 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../../response-builder-factory.js",
+        "modulePath": "../../types.d.ts",
       },
     },
     "imports": Map {
@@ -3509,7 +3509,7 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../../response-builder-factory.js",
+              "modulePath": "../../../types.d.ts",
             },
           },
           "imports": Map {
@@ -3669,7 +3669,7 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../../response-builder-factory.js",
+              "modulePath": "../../../types.d.ts",
             },
           },
           "imports": Map {
@@ -3833,7 +3833,7 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../../../response-builder-factory.js",
+        "modulePath": "../../../types.d.ts",
       },
     },
     "imports": Map {
@@ -3977,7 +3977,11 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../response-builder-factory.js",
+              "modulePath": "../types.d.ts",
+            },
+            "HttpStatusCode" => {
+              "isType": true,
+              "modulePath": "../types.d.ts",
             },
           },
           "imports": Map {
@@ -4127,7 +4131,11 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../response-builder-factory.js",
+        "modulePath": "../types.d.ts",
+      },
+      "HttpStatusCode" => {
+        "isType": true,
+        "modulePath": "../types.d.ts",
       },
     },
     "imports": Map {
@@ -4300,7 +4308,11 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
+            },
+            "HttpStatusCode" => {
+              "isType": true,
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -4433,7 +4445,11 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../../response-builder-factory.js",
+        "modulePath": "../../types.d.ts",
+      },
+      "HttpStatusCode" => {
+        "isType": true,
+        "modulePath": "../../types.d.ts",
       },
     },
     "imports": Map {
@@ -4585,7 +4601,7 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -4689,7 +4705,7 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../../response-builder-factory.js",
+        "modulePath": "../../types.d.ts",
       },
     },
     "imports": Map {
@@ -4786,7 +4802,11 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
+            },
+            "HttpStatusCode" => {
+              "isType": true,
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -4868,7 +4888,11 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../../response-builder-factory.js",
+        "modulePath": "../../types.d.ts",
+      },
+      "HttpStatusCode" => {
+        "isType": true,
+        "modulePath": "../../types.d.ts",
       },
     },
     "imports": Map {
@@ -5063,7 +5087,11 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
+            },
+            "HttpStatusCode" => {
+              "isType": true,
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -5242,7 +5270,11 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
+            },
+            "HttpStatusCode" => {
+              "isType": true,
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -5421,7 +5453,11 @@ class Context {
           "externalImport": Map {
             "ResponseBuilderFactory" => {
               "isType": true,
-              "modulePath": "../../response-builder-factory.js",
+              "modulePath": "../../types.d.ts",
+            },
+            "HttpStatusCode" => {
+              "isType": true,
+              "modulePath": "../../types.d.ts",
             },
           },
           "imports": Map {
@@ -5604,7 +5640,11 @@ class Context {
     "externalImport": Map {
       "ResponseBuilderFactory" => {
         "isType": true,
-        "modulePath": "../../response-builder-factory.js",
+        "modulePath": "../../types.d.ts",
+      },
+      "HttpStatusCode" => {
+        "isType": true,
+        "modulePath": "../../types.d.ts",
       },
     },
     "imports": Map {