-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,4 +58,4 @@ body: | |
validations: | ||
required: true | ||
|
||
projects: ['atls/11'] | ||
projects: ['atls/11'] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,4 @@ body: | |
validations: | ||
required: true | ||
|
||
projects: ['atls/11'] | ||
projects: ['atls/11'] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,4 @@ body: | |
validations: | ||
required: true | ||
|
||
projects: ['atls/11'] | ||
projects: ['atls/11'] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import type { PromiseClient } from '@connectrpc/connect' | ||
import type { INestMicroservice } from '@nestjs/common' | ||
|
||
import { ConnectError } from '@connectrpc/connect' | ||
import { ValidationError } from '@atls/protobuf-rpc' | ||
import { ConnectError } from '@connectrpc/connect' | ||
import { Test } from '@nestjs/testing' | ||
import { createPromiseClient } from '@connectrpc/connect' | ||
import { createGrpcTransport } from '@connectrpc/connect-node' | ||
|
@@ -64,6 +64,7 @@ describe('grpc error', () => { | |
expect( | ||
// @ts-expect-error | ||
error.details.map((detail: { value: Uint8Array }) => | ||
Check failure on line 66 in packages/nestjs-connectrpc-errors/integration/test/connectrpc-errors.test.ts GitHub Actions / Lint(@typescript-eslint/ban-ts-comment): Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 10 characters or longer.
Raw output
|
||
// @ts-expect-error | ||
ValidationError.fromBinary(detail.value)) | ||
Check failure on line 68 in packages/nestjs-connectrpc-errors/integration/test/connectrpc-errors.test.ts GitHub Actions / Lint(@typescript-eslint/ban-ts-comment): Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 10 characters or longer.
Raw output
|
||
).toEqual( | ||
Check failure on line 69 in packages/nestjs-connectrpc-errors/integration/test/connectrpc-errors.test.ts GitHub Actions / Lint(@typescript-eslint/no-unsafe-return): Unsafe return of a value of type error.
Raw output
Check failure on line 69 in packages/nestjs-connectrpc-errors/integration/test/connectrpc-errors.test.ts GitHub Actions / Lint(@typescript-eslint/no-unsafe-call): Unsafe call of a(n) `error` type typed value.
Raw output
|
||
expect.arrayContaining([ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import type { DomainError } from '@atls/core-errors' | ||
|
||
import { LogicalError } from '@atls/protobuf-rpc' | ||
import { Code } from '@connectrpc/connect' | ||
import { ConnectError } from '@connectrpc/connect' | ||
import { LogicalError } from '@atls/protobuf-rpc' | ||
import { RpcException } from '@nestjs/microservices' | ||
|
||
export const domainExceptionFactory = (error: DomainError): RpcException => { | ||
// @ts-expect-error types | ||
const logicalError = new LogicalError({ | ||
Check failure on line 10 in packages/nestjs-connectrpc-errors/src/exception-factories/domain.expection-factory.ts GitHub Actions / Lint(@typescript-eslint/ban-ts-comment): Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 10 characters or longer.
Raw output
|
||
// @ts-expect-error types | ||
Check failure on line 11 in packages/nestjs-connectrpc-errors/src/exception-factories/domain.expection-factory.ts GitHub Actions / Lint(@typescript-eslint/no-unsafe-call): Unsafe construction of a(n) `error` type typed value.
Raw output
|
||
id: error.id, | ||
Check failure on line 12 in packages/nestjs-connectrpc-errors/src/exception-factories/domain.expection-factory.ts GitHub Actions / Lint(@typescript-eslint/ban-ts-comment): Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 10 characters or longer.
Raw output
|
||
message: error.message, | ||
}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
import type { GuardErrors } from '@atls/guard-clause' | ||
|
||
import { Code } from '@connectrpc/connect' | ||
import { ConnectError } from '@connectrpc/connect' | ||
import { ValidationError } from '@atls/protobuf-rpc' | ||
import { ValidationErrorMessage } from '@atls/protobuf-rpc' | ||
import { Code } from '@connectrpc/connect' | ||
import { ConnectError } from '@connectrpc/connect' | ||
import { RpcException } from '@nestjs/microservices' | ||
|
||
export const guardExceptionFactory = (errors: GuardErrors): RpcException => { | ||
const validationErrors: Array<ValidationError> = errors.errors.map( | ||
(error) => | ||
// @ts-expect-error types | ||
new ValidationError({ | ||
Check failure on line 13 in packages/nestjs-connectrpc-errors/src/exception-factories/guard.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/ban-ts-comment): Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 10 characters or longer.
Raw output
|
||
id: error.code, | ||
Check failure on line 14 in packages/nestjs-connectrpc-errors/src/exception-factories/guard.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/no-unsafe-call): Unsafe construction of a(n) `error` type typed value.
Raw output
Check failure on line 14 in packages/nestjs-connectrpc-errors/src/exception-factories/guard.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/no-unsafe-return): Unsafe return of a value of type error.
Raw output
|
||
property: error.parameter, | ||
messages: [ | ||
// @ts-expect-error types | ||
new ValidationErrorMessage({ | ||
Check failure on line 18 in packages/nestjs-connectrpc-errors/src/exception-factories/guard.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/ban-ts-comment): Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 10 characters or longer.
Raw output
|
||
id: error.code, | ||
Check failure on line 19 in packages/nestjs-connectrpc-errors/src/exception-factories/guard.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/no-unsafe-call): Unsafe construction of a(n) `error` type typed value.
Raw output
|
||
constraint: error.message, | ||
|
@@ -22,6 +24,7 @@ export const guardExceptionFactory = (errors: GuardErrors): RpcException => { | |
) | ||
|
||
return new RpcException( | ||
// @ts-expect-error types | ||
new ConnectError('Request validation failed', Code.InvalidArgument, undefined, validationErrors) | ||
Check failure on line 28 in packages/nestjs-connectrpc-errors/src/exception-factories/guard.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/ban-ts-comment): Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 10 characters or longer.
Raw output
|
||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,10 @@ | |
|
||
import type { ValidationError as ValError } from '@nestjs/common' | ||
|
||
import { Code } from '@connectrpc/connect' | ||
import { ConnectError } from '@connectrpc/connect' | ||
import { ValidationError } from '@atls/protobuf-rpc' | ||
import { ValidationErrorMessage } from '@atls/protobuf-rpc' | ||
import { Code } from '@connectrpc/connect' | ||
import { ConnectError } from '@connectrpc/connect' | ||
import { RpcException } from '@nestjs/microservices' | ||
|
||
const traverseErrors = ( | ||
|
@@ -29,6 +29,7 @@ export const validationExceptionFactory = (errors: Array<ValError>): RpcExceptio | |
|
||
traverseErrors(errors, (error, id, property) => { | ||
const messages = Object.keys(error.constraints || {}).map((constraintId) => { | ||
// @ts-expect-error types | ||
const validationErrorMessage = new ValidationErrorMessage({ | ||
Check failure on line 33 in packages/nestjs-connectrpc-errors/src/exception-factories/validation.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/ban-ts-comment): Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 10 characters or longer.
Raw output
|
||
id: constraintId, | ||
Check failure on line 34 in packages/nestjs-connectrpc-errors/src/exception-factories/validation.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/no-unsafe-call): Unsafe construction of a(n) `error` type typed value.
Raw output
|
||
constraint: error.constraints![constraintId], | ||
|
@@ -38,6 +39,7 @@ export const validationExceptionFactory = (errors: Array<ValError>): RpcExceptio | |
}) | ||
Check failure on line 39 in packages/nestjs-connectrpc-errors/src/exception-factories/validation.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/no-unsafe-return): Unsafe return of a value of type error.
Raw output
|
||
|
||
validationErrors.push( | ||
// @ts-expect-error types | ||
new ValidationError({ | ||
Check failure on line 43 in packages/nestjs-connectrpc-errors/src/exception-factories/validation.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/ban-ts-comment): Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 10 characters or longer.
Raw output
|
||
id, | ||
Check failure on line 44 in packages/nestjs-connectrpc-errors/src/exception-factories/validation.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/no-unsafe-argument): Unsafe argument of type error typed assigned to a parameter of type `ValidationError`.
Raw output
Check failure on line 44 in packages/nestjs-connectrpc-errors/src/exception-factories/validation.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/no-unsafe-call): Unsafe construction of a(n) `error` type typed value.
Raw output
|
||
property, | ||
|
@@ -47,6 +49,7 @@ export const validationExceptionFactory = (errors: Array<ValError>): RpcExceptio | |
}) | ||
|
||
return new RpcException( | ||
// @ts-expect-error types | ||
new ConnectError('Request validation failed', Code.InvalidArgument, undefined, validationErrors) | ||
Check failure on line 53 in packages/nestjs-connectrpc-errors/src/exception-factories/validation.exception-factory.ts GitHub Actions / Lint(@typescript-eslint/ban-ts-comment): Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 10 characters or longer.
Raw output
|
||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ export class GraphQLMesh { | |
this.mesh = await getMesh(await this.config.create()) | ||
} | ||
|
||
|
||
return this.mesh | ||
} | ||
} |