@omnigraph/grpc 0.1.3 → 0.2.0-alpha-20241229115416-4ccc09e0de79929094eb62e42fd3c201756b5355
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 +1 -21
- package/cjs/grpcLoaderHelper.js +3 -9
- package/esm/directives.js +0 -20
- package/esm/grpcLoaderHelper.js +4 -10
- package/package.json +1 -1
- package/typings/directives.d.cts +0 -1
- package/typings/directives.d.ts +0 -1
package/cjs/directives.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transportDirective = exports.
|
|
3
|
+
exports.transportDirective = exports.EnumDirective = exports.grpcConnectivityStateDirective = exports.grpcMethodDirective = void 0;
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
|
-
const transport_common_1 = require("@graphql-mesh/transport-common");
|
|
6
5
|
exports.grpcMethodDirective = new graphql_1.GraphQLDirective({
|
|
7
6
|
name: 'grpcMethod',
|
|
8
7
|
locations: [graphql_1.DirectiveLocation.FIELD_DEFINITION],
|
|
@@ -51,25 +50,6 @@ exports.EnumDirective = new graphql_1.GraphQLDirective({
|
|
|
51
50
|
},
|
|
52
51
|
},
|
|
53
52
|
});
|
|
54
|
-
exports.grpcRootJsonDirective = new graphql_1.GraphQLDirective({
|
|
55
|
-
name: 'grpcRootJson',
|
|
56
|
-
locations: [graphql_1.DirectiveLocation.OBJECT],
|
|
57
|
-
args: {
|
|
58
|
-
subgraph: {
|
|
59
|
-
type: graphql_1.GraphQLString,
|
|
60
|
-
},
|
|
61
|
-
name: {
|
|
62
|
-
type: graphql_1.GraphQLString,
|
|
63
|
-
},
|
|
64
|
-
rootJson: {
|
|
65
|
-
type: transport_common_1.ObjMapScalar,
|
|
66
|
-
},
|
|
67
|
-
loadOptions: {
|
|
68
|
-
type: transport_common_1.ObjMapScalar,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
isRepeatable: true,
|
|
72
|
-
});
|
|
73
53
|
exports.transportDirective = new graphql_1.GraphQLDirective({
|
|
74
54
|
name: 'transport',
|
|
75
55
|
args: {
|
package/cjs/grpcLoaderHelper.js
CHANGED
|
@@ -56,6 +56,7 @@ class GrpcLoaderHelper {
|
|
|
56
56
|
this.logger.debug(`Getting stored root and decoded descriptor set objects`);
|
|
57
57
|
const descriptorSets = await this.getDescriptorSets(creds);
|
|
58
58
|
const directives = [];
|
|
59
|
+
const roots = [];
|
|
59
60
|
for (const { name: rootJsonName, rootJson } of descriptorSets) {
|
|
60
61
|
const rootLogger = this.logger.child(rootJsonName);
|
|
61
62
|
this.logger.debug(`Building the schema structure based on the root object`);
|
|
@@ -67,15 +68,7 @@ class GrpcLoaderHelper {
|
|
|
67
68
|
rootJson,
|
|
68
69
|
rootLogger,
|
|
69
70
|
});
|
|
70
|
-
|
|
71
|
-
directives.push({
|
|
72
|
-
name: 'grpcRootJson',
|
|
73
|
-
args: {
|
|
74
|
-
subgraph: this.subgraphName,
|
|
75
|
-
name: rootJsonName,
|
|
76
|
-
rootJson,
|
|
77
|
-
},
|
|
78
|
-
});
|
|
71
|
+
roots.push({ name: rootJsonName, rootJson: JSON.stringify(rootJson) });
|
|
79
72
|
}
|
|
80
73
|
this.schemaComposer.Query.setDirectives(directives);
|
|
81
74
|
// graphql-compose doesn't add @defer and @stream to the schema
|
|
@@ -97,6 +90,7 @@ class GrpcLoaderHelper {
|
|
|
97
90
|
credentialsSsl: this.config.credentialsSsl,
|
|
98
91
|
useHTTPS: this.config.useHTTPS,
|
|
99
92
|
metaData: this.config.metaData,
|
|
93
|
+
roots,
|
|
100
94
|
},
|
|
101
95
|
};
|
|
102
96
|
return schema;
|
package/esm/directives.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DirectiveLocation, GraphQLBoolean, GraphQLDirective, GraphQLScalarType, GraphQLString, } from 'graphql';
|
|
2
|
-
import { ObjMapScalar } from '@graphql-mesh/transport-common';
|
|
3
2
|
export const grpcMethodDirective = new GraphQLDirective({
|
|
4
3
|
name: 'grpcMethod',
|
|
5
4
|
locations: [DirectiveLocation.FIELD_DEFINITION],
|
|
@@ -48,25 +47,6 @@ export const EnumDirective = new GraphQLDirective({
|
|
|
48
47
|
},
|
|
49
48
|
},
|
|
50
49
|
});
|
|
51
|
-
export const grpcRootJsonDirective = new GraphQLDirective({
|
|
52
|
-
name: 'grpcRootJson',
|
|
53
|
-
locations: [DirectiveLocation.OBJECT],
|
|
54
|
-
args: {
|
|
55
|
-
subgraph: {
|
|
56
|
-
type: GraphQLString,
|
|
57
|
-
},
|
|
58
|
-
name: {
|
|
59
|
-
type: GraphQLString,
|
|
60
|
-
},
|
|
61
|
-
rootJson: {
|
|
62
|
-
type: ObjMapScalar,
|
|
63
|
-
},
|
|
64
|
-
loadOptions: {
|
|
65
|
-
type: ObjMapScalar,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
isRepeatable: true,
|
|
69
|
-
});
|
|
70
50
|
export const transportDirective = new GraphQLDirective({
|
|
71
51
|
name: 'transport',
|
|
72
52
|
args: {
|
package/esm/grpcLoaderHelper.js
CHANGED
|
@@ -10,7 +10,7 @@ import { stringInterpolator } from '@graphql-mesh/string-interpolation';
|
|
|
10
10
|
import { GraphQLStreamDirective } from '@graphql-tools/utils';
|
|
11
11
|
import { credentials } from '@grpc/grpc-js';
|
|
12
12
|
import { AsyncDisposableStack } from '@whatwg-node/disposablestack';
|
|
13
|
-
import { EnumDirective, grpcConnectivityStateDirective, grpcMethodDirective,
|
|
13
|
+
import { EnumDirective, grpcConnectivityStateDirective, grpcMethodDirective, transportDirective, } from './directives.js';
|
|
14
14
|
import { addIncludePathResolver, getTypeName, walkToFindTypePath } from './utils.js';
|
|
15
15
|
const { Root } = protobufjs;
|
|
16
16
|
const QUERY_METHOD_PREFIXES = ['get', 'list', 'search'];
|
|
@@ -52,6 +52,7 @@ export class GrpcLoaderHelper {
|
|
|
52
52
|
this.logger.debug(`Getting stored root and decoded descriptor set objects`);
|
|
53
53
|
const descriptorSets = await this.getDescriptorSets(creds);
|
|
54
54
|
const directives = [];
|
|
55
|
+
const roots = [];
|
|
55
56
|
for (const { name: rootJsonName, rootJson } of descriptorSets) {
|
|
56
57
|
const rootLogger = this.logger.child(rootJsonName);
|
|
57
58
|
this.logger.debug(`Building the schema structure based on the root object`);
|
|
@@ -63,15 +64,7 @@ export class GrpcLoaderHelper {
|
|
|
63
64
|
rootJson,
|
|
64
65
|
rootLogger,
|
|
65
66
|
});
|
|
66
|
-
|
|
67
|
-
directives.push({
|
|
68
|
-
name: 'grpcRootJson',
|
|
69
|
-
args: {
|
|
70
|
-
subgraph: this.subgraphName,
|
|
71
|
-
name: rootJsonName,
|
|
72
|
-
rootJson,
|
|
73
|
-
},
|
|
74
|
-
});
|
|
67
|
+
roots.push({ name: rootJsonName, rootJson: JSON.stringify(rootJson) });
|
|
75
68
|
}
|
|
76
69
|
this.schemaComposer.Query.setDirectives(directives);
|
|
77
70
|
// graphql-compose doesn't add @defer and @stream to the schema
|
|
@@ -93,6 +86,7 @@ export class GrpcLoaderHelper {
|
|
|
93
86
|
credentialsSsl: this.config.credentialsSsl,
|
|
94
87
|
useHTTPS: this.config.useHTTPS,
|
|
95
88
|
metaData: this.config.metaData,
|
|
89
|
+
roots,
|
|
96
90
|
},
|
|
97
91
|
};
|
|
98
92
|
return schema;
|
package/package.json
CHANGED
package/typings/directives.d.cts
CHANGED
|
@@ -2,5 +2,4 @@ import { GraphQLDirective } from 'graphql';
|
|
|
2
2
|
export declare const grpcMethodDirective: GraphQLDirective;
|
|
3
3
|
export declare const grpcConnectivityStateDirective: GraphQLDirective;
|
|
4
4
|
export declare const EnumDirective: GraphQLDirective;
|
|
5
|
-
export declare const grpcRootJsonDirective: GraphQLDirective;
|
|
6
5
|
export declare const transportDirective: GraphQLDirective;
|
package/typings/directives.d.ts
CHANGED
|
@@ -2,5 +2,4 @@ import { GraphQLDirective } from 'graphql';
|
|
|
2
2
|
export declare const grpcMethodDirective: GraphQLDirective;
|
|
3
3
|
export declare const grpcConnectivityStateDirective: GraphQLDirective;
|
|
4
4
|
export declare const EnumDirective: GraphQLDirective;
|
|
5
|
-
export declare const grpcRootJsonDirective: GraphQLDirective;
|
|
6
5
|
export declare const transportDirective: GraphQLDirective;
|