Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#102 into [email protected] 🐘 add logger support #131

Merged
merged 26 commits into from
Jan 5, 2025

Conversation

RiceWithMeat
Copy link
Collaborator

Resolves #102

# Conflicts:
#	src/core/graphql/createGraphQLRoutes/createGraphQLRoutes.test.ts
#	src/core/graphql/createGraphQLRoutes/createGraphQLRoutes.ts
#	src/core/middlewares/notFoundMiddleware/notFoundMiddleware.test.ts
#	src/core/rest/createRestRoutes/createRestRoutes.test.ts
#	src/core/rest/createRestRoutes/createRestRoutes.ts
#	src/server/createGraphQLMockServer/createGraphQLMockServer.ts
#	src/server/createMockServer/createMockServer.ts
#	src/server/createRestMockServer/createRestMockServer.ts
@RiceWithMeat RiceWithMeat added the enhancement New feature or request label Nov 21, 2023
@RiceWithMeat RiceWithMeat self-assigned this Nov 21, 2023
…, update logger logic in createGraphQLRoutes
@RiceWithMeat RiceWithMeat linked an issue Nov 22, 2023 that may be closed by this pull request
.eslintrc.js Outdated Show resolved Hide resolved
src/core/rest/createRestRoutes/createRestRoutes.ts Outdated Show resolved Hide resolved
src/utils/types/logger.ts Outdated Show resolved Hide resolved
src/utils/helpers/logger/helpers/formatLogMessage.ts Outdated Show resolved Hide resolved
Comment on lines 31 to 42
const isValidGraphQLRequest =
graphQLInput &&
graphQLInput.query &&
graphQLQuery?.operationType &&
graphQLQuery.operationName;
request.graphQL = isValidGraphQLRequest
? {
operationType: graphQLQuery.operationType as GraphQLOperationType,
operationName: graphQLQuery.operationName,
variables: graphQLInput.variables
}
: null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

operationType и operationName в типе ResponseLogFunctionParams могут быть undefined, хотя по сути не могут

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

почему не могут? request.graphQL?.operationType будет undefined т.к. graphQL === null

src/static/views/features/scheme/index.js Outdated Show resolved Hide resolved
# Conflicts:
#	.eslintrc.js
#	src/core/graphql/createGraphQLRoutes/createGraphQLRoutes.ts
#	src/core/middlewares/notFoundMiddleware/notFoundMiddleware.ts
#	src/core/rest/createRestRoutes/createRestRoutes.ts
#	src/server/createGraphQLMockServer/createGraphQLMockServer.ts
#	src/server/createMockServer/createMockServer.ts
#	src/server/createRestMockServer/createRestMockServer.ts
#	src/utils/helpers/interceptors/callRequestInterceptor/callRequestInterceptor.test.ts
#	src/utils/types/graphql.ts
#	src/utils/types/rest.ts
#	src/utils/types/utils.ts
@RiceWithMeat RiceWithMeat changed the title #102 into [email protected] 🐘 add logger support #102 into [email protected] 🐘 add logger support Apr 6, 2024
bin/run.ts Outdated Show resolved Hide resolved
src/utils/types/values.ts Outdated Show resolved Hide resolved
src/utils/types/server.ts Outdated Show resolved Hide resolved
src/utils/types/logger.ts Outdated Show resolved Hide resolved
.eslintrc.js Outdated Show resolved Hide resolved
src/utils/types/logger.ts Outdated Show resolved Hide resolved
@RiceWithMeat RiceWithMeat changed the title #102 into [email protected] 🐘 add logger support #102 into [email protected] 🐘 add logger support Nov 11, 2024
@RiceWithMeat RiceWithMeat marked this pull request as ready for review December 20, 2024 19:29
@RiceWithMeat RiceWithMeat changed the title #102 into [email protected] 🐘 add logger support #102 into [email protected] 🐘 add logger support Dec 22, 2024
…leware refactoring fix readme, add callResponseLogger tests, add statusCode in default response log
src/utils/types/logger.ts Show resolved Hide resolved
src/utils/types/logger.ts Outdated Show resolved Hide resolved
src/utils/types/logger.ts Outdated Show resolved Hide resolved
src/utils/types/logger.ts Outdated Show resolved Hide resolved
src/utils/types/logger.ts Outdated Show resolved Hide resolved
src/utils/types/interceptors.ts Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
… and graphql interceptors, replace (.mock.calls.length).toBe() -> .toBeCalledTimes(), fix readme
src/utils/types/interceptors.ts Outdated Show resolved Hide resolved
src/utils/types/logger.ts Outdated Show resolved Hide resolved
Comment on lines 36 to 38
if (objectTokenOption) {
acc[objectTokenName] = objectTokenValues[objectTokenName];
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Может быть так, что body - это примитив, и тогда здесь код упадет

Copy link
Collaborator Author

@RiceWithMeat RiceWithMeat Jan 5, 2025

Choose a reason for hiding this comment

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

если body будет примитивом, то мы же только один раз достанем из него ключ и он будет undefined. я код не смог сломать. Но на всякий добавил проверку, чтобы actual token тоже был объектом. мало ли потом стрельнет когда body будем глубоко логать

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
const tokenObjectOptionsFilterMode = resolveTokenObjectOptionsFilterMode(option);

if (tokenObjectOptionsFilterMode === 'whitelist') {
acc[name] = Object.entries(option).reduce((acc, [name, objectTokenOption]) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

objectTokenOption

  1. А почему везде ушла приписка token, а тут осталась?
  2. Мб назвать тогда nestedOption? Раз сверху название просто option

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. поправил
  2. согл

Copy link
Collaborator

Choose a reason for hiding this comment

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

После этого я еще больше стал топить за no-shadow)))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

если ты про параметр name, то хз как его обозвать. это не nestedOptionName потому что name есть только у токенов и не nestedTokenName потому что nested может быть только option, а не токен

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logger for rest and graphl routes
4 participants