Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Oct 30, 2024
1 parent 281c6cb commit 828b242
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 23 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ newrelic_agent.log
!.yarn/versions
.mise.toml
docker/supergraph.graphql

4 changes: 2 additions & 2 deletions e2e/grpc-example/services/movies/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { Opts } from '@e2e/opts';
import {
loadPackageDefinition,
Expand All @@ -7,7 +8,6 @@ import {
type ServiceClientConstructor,
} from '@grpc/grpc-js';
import { load } from '@grpc/proto-loader';
import { fileURLToPath } from 'url';

const opts = Opts(process.argv);

Expand Down Expand Up @@ -53,7 +53,7 @@ const Movies = [
];

async function startServer(subscriptionInterval = 1000, debug = false): Promise<Server> {
const logger = debug ? (...args) => console.log(...args) : () => { };
const logger = debug ? (...args) => console.log(...args) : () => {};
const server = new Server();

const packageDefinition = await load('./service.proto', {
Expand Down
2 changes: 1 addition & 1 deletion e2e/top-level-await/mesh.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GraphQLObjectType, GraphQLSchema, GraphQLString } from 'graphql';
import { defineConfig as defineComposeConfig } from '@graphql-mesh/compose-cli';
import { defineConfig as defineGatewayConfig } from '@graphql-hive/gateway';
import { defineConfig as defineComposeConfig } from '@graphql-mesh/compose-cli';

// top level await
await Promise.resolve();
Expand Down
15 changes: 7 additions & 8 deletions packages/loaders/grpc/src/directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ export const GrpcCredentialsSsl = new GraphQLInputObjectType({
privateKey: {
type: GraphQLString,
},
}
})

},
});

export const TransportOptions = new GraphQLInputObjectType({
name: 'TransportOptions',
Expand All @@ -109,9 +108,9 @@ export const TransportOptions = new GraphQLInputObjectType({
},
metaData: {
type: ObjMapScalar,
}
}
})
},
},
});

export const transportDirective = new GraphQLDirective({
name: 'transport',
Expand All @@ -127,8 +126,8 @@ export const transportDirective = new GraphQLDirective({
},
options: {
type: TransportOptions,
}
},
},
isRepeatable: true,
locations: [DirectiveLocation.SCHEMA],
})
});
1 change: 0 additions & 1 deletion packages/loaders/grpc/src/scalars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ export function getGraphQLScalarForGrpc(scalarType: string): string {
}
return SCALARS.get(scalarType);
}

15 changes: 7 additions & 8 deletions packages/loaders/grpc/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { existsSync } from "fs";
import type { SchemaComposer } from "graphql-compose";
import { isAbsolute, join } from "path";
import type { INamespace, Root } from "protobufjs";
import { getGraphQLScalarForGrpc, isGrpcScalar } from "./scalars.js";
import type { SchemaComposer } from 'graphql-compose';
import lodashHas from 'lodash.has';
import type { INamespace, Root } from 'protobufjs';
import { fs, path as pathModule } from '@graphql-mesh/cross-helpers';
import { getGraphQLScalarForGrpc, isGrpcScalar } from './scalars.js';

export function addIncludePathResolver(root: Root, includePaths: string[]): void {
const originalResolvePath = root.resolvePath;
root.resolvePath = (origin: string, target: string) => {
if (isAbsolute(target)) {
if (pathModule.isAbsolute(target)) {
return target;
}
for (const directory of includePaths) {
const fullPath: string = join(directory, target);
if (existsSync(fullPath)) {
const fullPath: string = pathModule.join(directory, target);
if (fs.existsSync(fullPath)) {
return fullPath;
}
}
Expand Down
4 changes: 3 additions & 1 deletion packages/loaders/grpc/test/scalars.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ describe.each<[string, string]>([

describe('Invalid Scalars', () => {
test('getGraphQLScalar should throw an error', () => {
expect(() => getGraphQLScalarForGrpc('randomType')).toThrow(/Could not find GraphQL Scalar for type/);
expect(() => getGraphQLScalarForGrpc('randomType')).toThrow(
/Could not find GraphQL Scalar for type/,
);
});
test('isScalarType should return false for none scalars', () => {
expect(isGrpcScalar('randomType')).toBe(false);
Expand Down
2 changes: 1 addition & 1 deletion packages/transports/grpc/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { GraphQLScalarType } from 'graphql';
import lodashGet from 'lodash.get';
import type { ResolverData } from '@graphql-mesh/string-interpolation';
import { stringInterpolator } from '@graphql-mesh/string-interpolation';
Expand All @@ -9,7 +10,6 @@ import type {
MetadataValue,
} from '@grpc/grpc-js';
import { Metadata } from '@grpc/grpc-js';
import type { GraphQLScalarType } from 'graphql';

function isBlob(input: any): input is Blob {
return input != null && input.stream instanceof Function;
Expand Down

0 comments on commit 828b242

Please sign in to comment.