Skip to content

feature/delete-db into main 👽 Delete database and orm, fix prettier errors, delete interceptors for routes and configs#271

Open
Camon-fi07 wants to merge 6 commits into
mainfrom
feature/delete-db
Open

feature/delete-db into main 👽 Delete database and orm, fix prettier errors, delete interceptors for routes and configs#271
Camon-fi07 wants to merge 6 commits into
mainfrom
feature/delete-db

Conversation

@Camon-fi07

@Camon-fi07 Camon-fi07 commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Features Removed

    • Database & ORM support removed from the mock server and examples
    • Database configuration options removed from server settings and validation
    • ORM no longer available in interceptor parameters; per-route/request interceptor hooks reduced
  • Documentation

    • Database & ORM docs and references removed; interceptor and logger docs updated to match API typing changes

@coderabbitai

coderabbitai Bot commented Apr 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c946a5cb-05b1-4dbe-a93e-c8b86d51a180

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This pull request removes the entire database and ORM functionality from the mock server framework, including database route creation, storage implementations, ORM and storage types, validation schemas, documentation, examples, tests, and related middleware/context injection logic.

Changes

Cohort / File(s) Summary
Documentation
packages/docs/content/docs/introduction/getting-started.mdx, packages/docs/content/docs/mocking-requests/meta.json, packages/docs/content/docs/mocking-requests/references/Database.mdx, packages/docs/content/docs/mocking-requests/references/Interceptors.mdx, packages/docs/content/docs/mocking-requests/references/MockServerSettings.mdx, packages/docs/content/docs/mocking-requests/references/meta.json, packages/docs/content/docs/mocking-requests/references/GraphQL.mdx, packages/docs/content/docs/mocking-requests/references/Logger.mdx, packages/docs/content/docs/mocking-requests/references/Rest.mdx
Removed database docs and navigation entries; updated interceptor and logger docs to drop ORM/Api generics and remove database links.
Core database modules deleted
packages/server/src/core/database/createDatabaseRoutes/createDatabaseRoutes.ts, packages/server/src/core/database/createOrm/createOrm.ts, packages/server/src/core/database/createStorage/createStorage.ts, packages/server/src/core/database/index.ts
Deleted database route factory, ORM factory, storage factory, and their barrel re-exports.
Storage implementations & tests removed
packages/server/src/core/database/createDatabaseRoutes/storages/File/FileStorage.ts, .../File/FileWriter.ts, .../Memory/MemoryStorage.ts, .../storages/index.ts, and corresponding *.test.ts files
Removed file-backed and in-memory storage classes, FileWriter concurrency logic, and associated tests.
Route helpers & utilities removed
packages/server/src/core/database/createDatabaseRoutes/helpers/... (e.g., createNestedDatabaseRoutes.ts, createShallowDatabaseRoutes.ts, createRewrittenDatabaseRoutes.ts, filter.ts, search.ts, sort.ts, pagination.ts, splitDatabaseByNesting.ts, array helpers)
Deleted all helpers that created DB routes, performed filtering/search/sort/pagination, and array/id utilities.
ORM tests removed
packages/server/src/core/database/createOrm/createOrm.test.ts
Removed ORM test coverage validating nested/shallow ORM behaviors and CRUD/bulk ops.
Validation & config updates
packages/server/src/utils/validate/databaseConfigSchema/databaseConfigSchema.ts, packages/server/src/utils/validate/index.ts, packages/server/src/utils/validate/validateFlatMockServerConfig.ts, packages/server/src/utils/validate/validateMockServerConfig.ts
Removed databaseConfigSchema and dropped database validation from mock server config validators.
Types & barrels modified
packages/server/src/utils/types/database.ts (removed), packages/shared/types/database.ts (removed), packages/server/src/utils/types/interceptors.ts, packages/shared/types/interceptors.ts, packages/server/src/utils/types/server.ts, packages/shared/types/server.ts, packages/server/src/utils/types/index.ts, packages/shared/types/index.ts, packages/server/src/utils/types/graphql.ts, packages/server/src/utils/types/rest.ts, packages/server/src/utils/types/logger.ts, packages/shared/types/logger.ts, packages/shared/types/graphql.ts, packages/shared/types/rest.ts, packages/server/src/utils/types/shared.ts, packages/shared/types/shared.ts
Removed database/ORM types and exports; removed ORM from interceptor/request/response param types; de-genericized interceptors/logger types; removed ApiType and updated config types to drop database.
Middleware, interceptors & request flows
packages/server/src/core/middlewares/contextMiddleware/contextMiddleware.ts, packages/server/src/core/graphql/createGraphQLRoute/createGraphQLRoute.ts, packages/server/src/core/rest/createRestRoute/createRestRoute.ts, packages/server/src/utils/helpers/interceptors/callRequestInterceptor/*, packages/server/src/utils/helpers/interceptors/callResponseInterceptors/*
Removed database initialization from context middleware and stopped injecting orm into request/context and interceptor params; removed route/request-level interceptors from invocation in request/response flows and tests.
Server setup & examples
packages/server/src/server/createMockServer/createMockServer.ts, packages/server/examples/database/index.ts, packages/server/README.md
Removed database mounting/usage in server creation; deleted database example and database documentation from README.
Config & build mapping changes
packages/server/.swcrc, packages/server/tsconfig.dev.json, packages/server/tsconfig.production.json, packages/docs/package.json
Removed @/core/database path alias from SWC/tsconfig files; reordered devDependencies in docs package.json.
Minor UI/formatting edits
packages/docs/src/app/(home)/page.tsx, packages/docs/src/app/layout.tsx, packages/docs/src/app/og/docs/[...slug]/route.tsx
Minor JSX/attribute reordering and a named-to-arrow function change.
Tests removed across database helpers
Many *.test.ts under packages/server/src/core/database/createDatabaseRoutes/helpers/..., storages/..., and createDatabaseRoutes
Removed comprehensive test coverage for database route helpers, storages, and related utilities.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately describes the main changes: removing database/ORM functionality and fixing documentation/prettier issues.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/delete-db

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Camon-fi07 Camon-fi07 marked this pull request as ready for review April 3, 2026 16:28
Comment thread packages/server/README.md
},
],
},
path: '/user',

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут vs code prettier ошибки поправил, signle quote и т.д. в целом не вижу ничего плохого поэтому решил оставить

@greptile-apps

greptile-apps Bot commented Apr 3, 2026

Copy link
Copy Markdown

Greptile Summary

This PR removes the database/ORM feature and eliminates route- and request-level interceptors, keeping only component- and server-level interceptors. The server-side implementation and internal types (packages/server/src/utils/types/) are cleaned up correctly, but the shared public types (packages/shared/types/) still expose interceptors fields on route configs, request configs, RestConfig, and GraphqlConfig that the server will silently never invoke — creating a misleading API surface for consumers.

Confidence Score: 4/5

Not safe to merge until shared public types are aligned with the server's removal of route/request-level interceptors.

Three P1 issues exist: the shared package types still advertise interceptors on route configs, request configs, RestConfig, and GraphqlConfig that the server silently ignores. This creates a breaking behavioral regression for any consumer relying on those interception points, with no TypeScript signal.

packages/shared/types/rest.ts, packages/shared/types/graphql.ts, packages/shared/types/server.ts — all retain interceptor fields that are no longer wired in the server implementation.

Important Files Changed

Filename Overview
packages/shared/types/rest.ts interceptors field retained on route/request configs but no longer processed by server — silently ignored at runtime
packages/shared/types/graphql.ts interceptors field retained on route/request configs but no longer processed by server — silently ignored at runtime
packages/shared/types/server.ts interceptors on RestConfig/GraphqlConfig no longer wired to artifacts; DatabaseConfig retained as an orphan exported interface
packages/server/src/server/createMockServer/createMockServer.ts correctly removes database setup and route/request-level interceptor wiring from artifact assembly
packages/server/src/core/middlewares/contextMiddleware/contextMiddleware.ts correctly removes ORM context initialization and request.context assignment
packages/server/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.ts correctly removes route/request interceptor invocations and orm param from response interceptor chain
packages/server/src/utils/helpers/interceptors/callRequestInterceptor/callRequestInterceptor.ts correctly removes orm param from request interceptor parameters
packages/server/src/utils/types/interceptors.ts correctly removes orm field and ApiType generic from all interceptor param types
packages/server/src/utils/types/logger.ts unifies logger token types by merging REST- and GraphQL-specific variants into a single unified type
packages/shared/types/interceptors.ts correctly removes orm field and ApiType generic from interceptor types, mirroring server changes

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Incoming Request] --> B[contextMiddleware]
    B --> C{Route matched?}
    C -- REST --> D[createRestRoute]
    C -- GraphQL --> E[createGraphQLRoute]
    D --> F[callRequestInterceptor\nserver-level only]
    E --> F
    F --> G[Process Route Config]
    G --> H[callResponseInterceptors]
    H --> I{Which interceptors?}
    I --> J[componentInterceptor]
    I --> K[serverInterceptor]
    J --> L[Final Response]
    K --> L
    style B fill:#f9c,stroke:#c00
    style F fill:#cfc,stroke:#090
    note1["❌ Removed: orm context\n❌ Removed: route/request interceptors\n❌ Removed: database routes"]
Loading

Reviews (2): Last reviewed commit: "feature/delete-db 👽 delete interceptors..." | Re-trigger Greptile

@debabin

debabin commented Apr 4, 2026

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 4, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Camon-fi07 Camon-fi07 changed the title Delete database and orm and fix prettier errors Delete database and orm, fix prettier errors, delete interceptors for routes and configs Apr 5, 2026
@Camon-fi07

Copy link
Copy Markdown
Collaborator Author

Из старых типов которые вроде как уже не используются не стал удалять interceptors, они все равно позже удалятся

@Camon-fi07

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 5, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Camon-fi07

Copy link
Copy Markdown
Collaborator Author

@greptileai

Comment on lines 53 to 62
settings?: RestSettings & { polling?: false };
file: RestFileResponse;
}
) & { entities?: RestEntitiesByEntityName<Method>; interceptors?: Interceptors<'rest'> };
) & { entities?: RestEntitiesByEntityName<Method>; interceptors?: Interceptors };

export type RestPathString = `/${string}`;

interface BaseRestRequestConfig<Method extends RestMethod> {
interceptors?: Interceptors<'rest'>;
interceptors?: Interceptors;
method: Method;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 interceptors on route/request configs silently ignored after server-side removal

The interceptors field is kept on RestRouteConfig (line 56) and BaseRestRequestConfig (line 62) in the shared types, but createMockServer.ts no longer maps config.interceptors or route.interceptors into the request artifacts. Any consumer who defines interceptors at the route or request-config level will receive no error — their interceptors will simply never be called. The server-side types in packages/server/src/utils/types/rest.ts correctly remove these fields; the shared types should match to avoid a misleading public API surface.

Comment on lines 38 to 47
settings?: GraphQLSettings & { polling?: false };
data: GraphqlDataResponse;
}
) & { entities?: GraphQLEntitiesByEntityName; interceptors?: Interceptors<'graphql'> };
) & { entities?: GraphQLEntitiesByEntityName; interceptors?: Interceptors };

interface BaseGraphQLRequestConfig {
interceptors?: Interceptors<'graphql'>;
interceptors?: Interceptors;
operationType: GraphQLOperationType;
routes: GraphQLRouteConfig[];
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 interceptors on GraphQL route/request configs silently ignored

Same issue as shared/types/rest.ts: interceptors is retained on GraphQLRouteConfig (line 41) and BaseGraphQLRequestConfig (line 45), but the server no longer wires these into request artifacts. Callers relying on route- or request-level GraphQL interceptors will experience silent no-ops with no TypeScript error to guide them. These fields should be removed to match the server's internal packages/server/src/utils/types/graphql.ts where they were correctly dropped.

Comment on lines 33 to 45
export interface RestConfig {
baseUrl?: BaseUrl;
configs: RestRequestConfig[];
interceptors?: Interceptors<'rest'>;
interceptors?: Interceptors;
}

export interface GraphqlConfig {
baseUrl?: BaseUrl;
configs: GraphQLRequestConfig[];
interceptors?: Interceptors<'graphql'>;
}

export interface DatabaseConfig {
data: `${string}.json` | Record<string, unknown>;
routes?: `${string}.json` | Record<`/${string}`, `/${string}`>;
interceptors?: Interceptors;
}

export interface BaseMockServerConfig {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 interceptors on RestConfig/GraphqlConfig silently ignored

RestConfig.interceptors and GraphqlConfig.interceptors remain in the shared types (lines 36, 43), but createMockServer.ts only reads interceptors from the top-level MockServerSettings — not from these component-level config objects. Any consumer who sets interceptors inside a RestConfig or GraphqlConfig block will have them silently dropped. The server's own packages/server/src/utils/types/server.ts already removed these fields; the shared types should follow suit.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/server/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.test.ts (1)

3-4: ⚠️ Potential issue | 🔴 Critical

Missing vi import will cause test failures.

The vi function is still used on lines 19-20 (vi.fn()) for mock interceptors, but it was removed from the vitest imports. This will cause a runtime error when running the tests.

🐛 Proposed fix
-import { describe, expect, it } from 'vitest';
+import { describe, expect, it, vi } from 'vitest';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/server/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.test.ts`
around lines 3 - 4, The test uses vi.fn() for mocks but removed vi from the
vitest import; restore vi in the import statement so the test can call vi.fn().
Update the top-level import (the one currently importing describe, expect, it
from vitest) to also include vi (e.g., import { describe, expect, it, vi } from
'vitest') so the mock creation in the CallResponseInterceptors test (where
vi.fn() is used) works at runtime.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/docs/content/docs/mocking-requests/references/Interceptors.mdx`:
- Line 83: The docs use a generic Partial<LoggerTokens> for interceptor phases;
change these to phase-specific token types so typings are precise: replace
occurrences of "(logger?: Logger<'request'>) => Partial<LoggerTokens>" with
"(logger?: Logger<'request'>) => Partial<RequestLoggerTokens>" for request-phase
interceptors and similarly use "(logger?: Logger<'response'>) =>
Partial<ResponseLoggerTokens>" (or the exact names used in your codebase) for
response-phase interceptors; update any related examples/signatures and ensure
RequestLoggerTokens/ResponseLoggerTokens are imported or defined where
LoggerTokens was used.

In `@packages/docs/content/docs/mocking-requests/references/Logger.mdx`:
- Line 43: Update the sentence describing LoggerTokens<Type>: remove the stale
reference to Api (`rest` | `graphql`) and rephrase to reflect the new type shape
— e.g., state that LoggerTokens<Type> is an object whose keys are the available
logger tokens for the selected Type (`request` | `response`) and whose values
are the token payloads; ensure the symbol LoggerTokens<Type> and the Type
options (`request` | `response`) are mentioned so readers can locate the correct
type.

In
`@packages/server/src/core/graphql/createGraphQLRoute/createGraphQLRoute.test.ts`:
- Around line 41-42: Remove the unused serverRequestInterceptor field from the
test artifacts and related types: delete any creation/assignment of
serverRequestInterceptor in the artifacts used by createMockServer (references
around the block that sets serverResponseInterceptor/serverRequestInterceptor)
and update the artifact/interface definitions so serverRequestInterceptor is no
longer expected; also remove any test references passing
serverRequestInterceptor into createGraphQLRoute/createRestRoute mocks and
adjust createMockServer middleware usage (the request interception remains
handled in the middleware path), and run/type-check to update affected tests and
types (look for symbol serverRequestInterceptor and files createMockServer.ts,
createGraphQLRoute.ts, createRestRoute.ts).

---

Outside diff comments:
In
`@packages/server/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.test.ts`:
- Around line 3-4: The test uses vi.fn() for mocks but removed vi from the
vitest import; restore vi in the import statement so the test can call vi.fn().
Update the top-level import (the one currently importing describe, expect, it
from vitest) to also include vi (e.g., import { describe, expect, it, vi } from
'vitest') so the mock creation in the CallResponseInterceptors test (where
vi.fn() is used) works at runtime.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e5121a5f-a9d4-4272-88a7-d7ba0f80f366

📥 Commits

Reviewing files that changed from the base of the PR and between 9a72b50 and 16c0467.

📒 Files selected for processing (26)
  • packages/docs/content/docs/mocking-requests/references/GraphQL.mdx
  • packages/docs/content/docs/mocking-requests/references/Interceptors.mdx
  • packages/docs/content/docs/mocking-requests/references/Logger.mdx
  • packages/docs/content/docs/mocking-requests/references/Rest.mdx
  • packages/server/README.md
  • packages/server/src/core/graphql/createGraphQLRoute/createGraphQLRoute.test.ts
  • packages/server/src/core/graphql/createGraphQLRoute/createGraphQLRoute.ts
  • packages/server/src/core/rest/createRestRoute/createRestRoute.test.ts
  • packages/server/src/core/rest/createRestRoute/createRestRoute.ts
  • packages/server/src/server/createMockServer/createMockServer.ts
  • packages/server/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.test.ts
  • packages/server/src/utils/helpers/interceptors/callResponseInterceptors/callResponseInterceptors.ts
  • packages/server/src/utils/types/graphql.ts
  • packages/server/src/utils/types/index.ts
  • packages/server/src/utils/types/interceptors.ts
  • packages/server/src/utils/types/logger.ts
  • packages/server/src/utils/types/rest.ts
  • packages/server/src/utils/types/server.ts
  • packages/server/src/utils/types/shared.ts
  • packages/shared/types/graphql.ts
  • packages/shared/types/index.ts
  • packages/shared/types/interceptors.ts
  • packages/shared/types/logger.ts
  • packages/shared/types/rest.ts
  • packages/shared/types/server.ts
  • packages/shared/types/shared.ts
💤 Files with no reviewable changes (7)
  • packages/shared/types/shared.ts
  • packages/server/src/utils/types/shared.ts
  • packages/server/src/core/graphql/createGraphQLRoute/createGraphQLRoute.ts
  • packages/server/src/utils/types/index.ts
  • packages/shared/types/index.ts
  • packages/server/src/core/rest/createRestRoute/createRestRoute.ts
  • packages/server/src/utils/types/server.ts

log: {
description: 'Log request data',
type: "(logger?: Logger<'request', Api>) => Partial<LoggerTokens>",
type: "(logger?: Logger<'request'>) => Partial<LoggerTokens>",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Specialize LoggerTokens by interceptor phase for clearer typing.

Line 83 and Line 154 currently return Partial<LoggerTokens>. Using request/response-specialized token types would make the docs more precise.

Proposed refinement
-      type: "(logger?: Logger<'request'>) => Partial<LoggerTokens>",
+      type: "(logger?: Logger<'request'>) => Partial<LoggerTokens<'request'>>",
-      type: "(logger?: Logger<'response'>) => Partial<LoggerTokens>",
+      type: "(logger?: Logger<'response'>) => Partial<LoggerTokens<'response'>>",

Also applies to: 154-154

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/docs/content/docs/mocking-requests/references/Interceptors.mdx` at
line 83, The docs use a generic Partial<LoggerTokens> for interceptor phases;
change these to phase-specific token types so typings are precise: replace
occurrences of "(logger?: Logger<'request'>) => Partial<LoggerTokens>" with
"(logger?: Logger<'request'>) => Partial<RequestLoggerTokens>" for request-phase
interceptors and similarly use "(logger?: Logger<'response'>) =>
Partial<ResponseLoggerTokens>" (or the exact names used in your codebase) for
response-phase interceptors; update any related examples/signatures and ensure
RequestLoggerTokens/ResponseLoggerTokens are imported or defined where
LoggerTokens was used.

## LoggerTokens

`LoggerTokens<Type, Api>` is an object where keys are [available logger tokens](#available-logger-tokens) for the selected `Type` (`request` | `response`) and `Api` (`rest` | `graphql`), and values are token payloads.
`LoggerTokens<Type>` is an object where keys are [available logger tokens](#available-logger-tokens) for the selected `Type` (`request` | `response`) and `Api` (`rest` | `graphql`), and values are token payloads.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove stale Api reference from LoggerTokens description.

Line 43 still says LoggerTokens<Type> depends on Api (rest | graphql), which conflicts with the new type shape documented on this page.

Proposed doc fix
-`LoggerTokens<Type>` is an object where keys are [available logger tokens](`#available-logger-tokens`) for the selected `Type` (`request` | `response`) and `Api` (`rest` | `graphql`), and values are token payloads.
+`LoggerTokens<Type>` is an object where keys are [available logger tokens](`#available-logger-tokens`) for the selected `Type` (`request` | `response`), and values are token payloads.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
`LoggerTokens<Type>` is an object where keys are [available logger tokens](#available-logger-tokens) for the selected `Type` (`request` | `response`) and `Api` (`rest` | `graphql`), and values are token payloads.
`LoggerTokens<Type>` is an object where keys are [available logger tokens](`#available-logger-tokens`) for the selected `Type` (`request` | `response`), and values are token payloads.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/docs/content/docs/mocking-requests/references/Logger.mdx` at line
43, Update the sentence describing LoggerTokens<Type>: remove the stale
reference to Api (`rest` | `graphql`) and rephrase to reflect the new type shape
— e.g., state that LoggerTokens<Type> is an object whose keys are the available
logger tokens for the selected Type (`request` | `response`) and whose values
are the token payloads; ensure the symbol LoggerTokens<Type> and the Type
options (`request` | `response`) are mentioned so readers can locate the correct
type.

Comment on lines 41 to 42
serverResponseInterceptor: interceptors?.response,
serverRequestInterceptor: interceptors?.request,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify serverRequestInterceptor usage in route creation files
echo "=== Checking serverRequestInterceptor usage in createGraphQLRoute.ts ==="
rg -n 'serverRequestInterceptor' packages/server/src/core/graphql/createGraphQLRoute/createGraphQLRoute.ts

echo ""
echo "=== Checking serverRequestInterceptor usage in createRestRoute.ts ==="
rg -n 'serverRequestInterceptor' packages/server/src/core/rest/createRestRoute/createRestRoute.ts

echo ""
echo "=== Checking where serverRequestInterceptor is actually used ==="
rg -n 'serverRequestInterceptor' packages/server/src --type ts -C2

Repository: siberiacancode/mock-config

Length of output: 4661


Remove unused serverRequestInterceptor from artifacts.

The field is passed in both REST and GraphQL artifacts (in createMockServer.ts lines 90–112) but never invoked in the route creation code (createGraphQLRoute.ts and createRestRoute.ts). Server-level request interception is handled by middleware in createMockServer.ts (lines 57–63), making the field in artifacts redundant.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/server/src/core/graphql/createGraphQLRoute/createGraphQLRoute.test.ts`
around lines 41 - 42, Remove the unused serverRequestInterceptor field from the
test artifacts and related types: delete any creation/assignment of
serverRequestInterceptor in the artifacts used by createMockServer (references
around the block that sets serverResponseInterceptor/serverRequestInterceptor)
and update the artifact/interface definitions so serverRequestInterceptor is no
longer expected; also remove any test references passing
serverRequestInterceptor into createGraphQLRoute/createRestRoute mocks and
adjust createMockServer middleware usage (the request interception remains
handled in the middleware path), and run/type-check to update affected tests and
types (look for symbol serverRequestInterceptor and files createMockServer.ts,
createGraphQLRoute.ts, createRestRoute.ts).

@Camon-fi07 Camon-fi07 changed the title Delete database and orm, fix prettier errors, delete interceptors for routes and configs feature/delete-db into main 👽 Delete database and orm, fix prettier errors, delete interceptors for routes and configs Apr 5, 2026
: Api extends 'graphql'
? LoggerGraphQLRequestTokens
: never
export type LoggerTokens<Type extends LoggerType = LoggerType> = Type extends 'request'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По сути API generic прокидывался только в интерцепторе запроса, которого теперь нет

@Camon-fi07

Copy link
Copy Markdown
Collaborator Author

Не удалял interceptors поля из старых интерфейсов, которые больше не используются

response?: ResponseInterceptor<any, Api>;
export interface Interceptors {
request?: RequestInterceptor;
response?: ResponseInterceptor<any>;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

этот дженерик ничего не делает

response?: ResponseInterceptor<any, Api>;
export interface Interceptors {
request?: RequestInterceptor;
response?: ResponseInterceptor<any>;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут тоже

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants