@omnigraph/grpc 0.0.0 → 0.0.1-alpha-20241030121714-828aaaadf0d222a6f997910e981100741bf51959

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/directives.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.grpcRootJsonDirective = exports.EnumDirective = exports.grpcConnectivityStateDirective = exports.grpcMethodDirective = void 0;
3
+ exports.transportDirective = exports.TransportOptions = exports.GrpcCredentialsSsl = exports.grpcRootJsonDirective = exports.EnumDirective = exports.grpcConnectivityStateDirective = exports.grpcMethodDirective = void 0;
4
4
  const graphql_1 = require("graphql");
5
5
  const transport_common_1 = require("@graphql-mesh/transport-common");
6
6
  exports.grpcMethodDirective = new graphql_1.GraphQLDirective({
@@ -70,3 +70,53 @@ exports.grpcRootJsonDirective = new graphql_1.GraphQLDirective({
70
70
  },
71
71
  isRepeatable: true,
72
72
  });
73
+ exports.GrpcCredentialsSsl = new graphql_1.GraphQLInputObjectType({
74
+ name: 'GrpcCredentialsSsl',
75
+ fields: {
76
+ rootCA: {
77
+ type: graphql_1.GraphQLString,
78
+ },
79
+ certChain: {
80
+ type: graphql_1.GraphQLString,
81
+ },
82
+ privateKey: {
83
+ type: graphql_1.GraphQLString,
84
+ },
85
+ }
86
+ });
87
+ exports.TransportOptions = new graphql_1.GraphQLInputObjectType({
88
+ name: 'TransportOptions',
89
+ fields: {
90
+ requestTimeout: {
91
+ type: graphql_1.GraphQLInt,
92
+ },
93
+ credentialsSsl: {
94
+ type: exports.GrpcCredentialsSsl,
95
+ },
96
+ useHTTPS: {
97
+ type: graphql_1.GraphQLBoolean,
98
+ },
99
+ metaData: {
100
+ type: transport_common_1.ObjMapScalar,
101
+ }
102
+ }
103
+ });
104
+ exports.transportDirective = new graphql_1.GraphQLDirective({
105
+ name: 'transport',
106
+ args: {
107
+ subgraph: {
108
+ type: graphql_1.GraphQLString,
109
+ },
110
+ kind: {
111
+ type: graphql_1.GraphQLString,
112
+ },
113
+ location: {
114
+ type: graphql_1.GraphQLString,
115
+ },
116
+ options: {
117
+ type: exports.TransportOptions,
118
+ }
119
+ },
120
+ isRepeatable: true,
121
+ locations: [graphql_1.DirectiveLocation.SCHEMA],
122
+ });
package/cjs/gRPCLoader.js CHANGED
@@ -85,6 +85,7 @@ class gRPCLoader {
85
85
  this.schemaComposer.addDirective(utils_1.GraphQLStreamDirective);
86
86
  }
87
87
  this.logger.debug(`Building the final GraphQL Schema`);
88
+ this.schemaComposer.addDirective(directives_js_1.transportDirective);
88
89
  const schema = this.schemaComposer.buildSchema();
89
90
  const schemaExtensions = schema.extensions = schema.extensions || {};
90
91
  const directiveExtensions = schemaExtensions.directives = schemaExtensions.directives || {};
package/esm/directives.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DirectiveLocation, GraphQLBoolean, GraphQLDirective, GraphQLString, } from 'graphql';
1
+ import { DirectiveLocation, GraphQLBoolean, GraphQLDirective, GraphQLInputObjectType, GraphQLInt, GraphQLString, } from 'graphql';
2
2
  import { ObjMapScalar } from '@graphql-mesh/transport-common';
3
3
  export const grpcMethodDirective = new GraphQLDirective({
4
4
  name: 'grpcMethod',
@@ -67,3 +67,53 @@ export const grpcRootJsonDirective = new GraphQLDirective({
67
67
  },
68
68
  isRepeatable: true,
69
69
  });
70
+ export const GrpcCredentialsSsl = new GraphQLInputObjectType({
71
+ name: 'GrpcCredentialsSsl',
72
+ fields: {
73
+ rootCA: {
74
+ type: GraphQLString,
75
+ },
76
+ certChain: {
77
+ type: GraphQLString,
78
+ },
79
+ privateKey: {
80
+ type: GraphQLString,
81
+ },
82
+ }
83
+ });
84
+ export const TransportOptions = new GraphQLInputObjectType({
85
+ name: 'TransportOptions',
86
+ fields: {
87
+ requestTimeout: {
88
+ type: GraphQLInt,
89
+ },
90
+ credentialsSsl: {
91
+ type: GrpcCredentialsSsl,
92
+ },
93
+ useHTTPS: {
94
+ type: GraphQLBoolean,
95
+ },
96
+ metaData: {
97
+ type: ObjMapScalar,
98
+ }
99
+ }
100
+ });
101
+ export const transportDirective = new GraphQLDirective({
102
+ name: 'transport',
103
+ args: {
104
+ subgraph: {
105
+ type: GraphQLString,
106
+ },
107
+ kind: {
108
+ type: GraphQLString,
109
+ },
110
+ location: {
111
+ type: GraphQLString,
112
+ },
113
+ options: {
114
+ type: TransportOptions,
115
+ }
116
+ },
117
+ isRepeatable: true,
118
+ locations: [DirectiveLocation.SCHEMA],
119
+ });
package/esm/gRPCLoader.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { specifiedDirectives } from "graphql";
2
2
  import { SchemaComposer } from "graphql-compose";
3
3
  import { GraphQLBigInt, GraphQLByte, GraphQLUnsignedInt, GraphQLVoid, GraphQLJSON } from "graphql-scalars";
4
- import { EnumDirective, grpcConnectivityStateDirective, grpcMethodDirective, grpcRootJsonDirective } from "./directives.js";
4
+ import { EnumDirective, grpcConnectivityStateDirective, grpcMethodDirective, grpcRootJsonDirective, transportDirective } from "./directives.js";
5
5
  import { credentials } from '@grpc/grpc-js';
6
6
  import protobufjs from 'protobufjs';
7
7
  import { stringInterpolator } from '@graphql-mesh/string-interpolation';
@@ -81,6 +81,7 @@ export class gRPCLoader {
81
81
  this.schemaComposer.addDirective(GraphQLStreamDirective);
82
82
  }
83
83
  this.logger.debug(`Building the final GraphQL Schema`);
84
+ this.schemaComposer.addDirective(transportDirective);
84
85
  const schema = this.schemaComposer.buildSchema();
85
86
  const schemaExtensions = schema.extensions = schema.extensions || {};
86
87
  const directiveExtensions = schemaExtensions.directives = schemaExtensions.directives || {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnigraph/grpc",
3
- "version": "0.0.0",
3
+ "version": "0.0.1-alpha-20241030121714-828aaaadf0d222a6f997910e981100741bf51959",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "*"
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "@ardatan/grpc-reflection-js": "^0.0.2",
10
10
  "@graphql-mesh/string-interpolation": "^0.5.6",
11
- "@graphql-mesh/transport-common": "^0.7.11",
11
+ "@graphql-mesh/transport-common": "0.7.12-alpha-20241030121714-828aaaadf0d222a6f997910e981100741bf51959",
12
12
  "@graphql-tools/utils": "^10.5.5",
13
13
  "@grpc/grpc-js": "^1.1.7",
14
14
  "@whatwg-node/disposablestack": "^0.0.5",
@@ -1,5 +1,8 @@
1
- import { GraphQLDirective } from 'graphql';
1
+ import { GraphQLDirective, GraphQLInputObjectType } from 'graphql';
2
2
  export declare const grpcMethodDirective: GraphQLDirective;
3
3
  export declare const grpcConnectivityStateDirective: GraphQLDirective;
4
4
  export declare const EnumDirective: GraphQLDirective;
5
5
  export declare const grpcRootJsonDirective: GraphQLDirective;
6
+ export declare const GrpcCredentialsSsl: GraphQLInputObjectType;
7
+ export declare const TransportOptions: GraphQLInputObjectType;
8
+ export declare const transportDirective: GraphQLDirective;
@@ -1,5 +1,8 @@
1
- import { GraphQLDirective } from 'graphql';
1
+ import { GraphQLDirective, GraphQLInputObjectType } from 'graphql';
2
2
  export declare const grpcMethodDirective: GraphQLDirective;
3
3
  export declare const grpcConnectivityStateDirective: GraphQLDirective;
4
4
  export declare const EnumDirective: GraphQLDirective;
5
5
  export declare const grpcRootJsonDirective: GraphQLDirective;
6
+ export declare const GrpcCredentialsSsl: GraphQLInputObjectType;
7
+ export declare const TransportOptions: GraphQLInputObjectType;
8
+ export declare const transportDirective: GraphQLDirective;