@graphql-mesh/transport-grpc 0.3.0-alpha-20250124181238-87366ee8e2a95025d881bdaba556f04d337e8331 → 0.3.0-alpha-20250303154240-da9897c303aaefec5798b499a7ac8fef3e01b201
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/index.js +3 -2
- package/esm/index.js +4 -3
- package/package.json +7 -6
package/cjs/index.js
CHANGED
|
@@ -15,6 +15,7 @@ const disposablestack_1 = require("@whatwg-node/disposablestack");
|
|
|
15
15
|
const utils_js_1 = require("./utils.js");
|
|
16
16
|
require("./patchLongJs.js");
|
|
17
17
|
const utils_2 = require("@graphql-mesh/utils");
|
|
18
|
+
const promise_helpers_1 = require("@whatwg-node/promise-helpers");
|
|
18
19
|
class GrpcTransportHelper extends disposablestack_1.DisposableStack {
|
|
19
20
|
constructor(subgraphName, baseDir, logger, endpoint, config) {
|
|
20
21
|
super();
|
|
@@ -126,7 +127,7 @@ class GrpcTransportHelper extends disposablestack_1.DisposableStack {
|
|
|
126
127
|
const grpcObjectByRootJsonName = new Map();
|
|
127
128
|
for (let { name, rootJson, loadOptions } of roots) {
|
|
128
129
|
rootJson = typeof rootJson === 'string' ? JSON.parse(rootJson) : rootJson;
|
|
129
|
-
const rootLogger = this.logger.child(name);
|
|
130
|
+
const rootLogger = this.logger.child({ root: name });
|
|
130
131
|
grpcObjectByRootJsonName.set(name, this.getGrpcObject({ rootJson, loadOptions, rootLogger }));
|
|
131
132
|
}
|
|
132
133
|
const rootTypes = (0, utils_1.getRootTypes)(schema);
|
|
@@ -221,7 +222,7 @@ exports.GrpcTransportHelper = GrpcTransportHelper;
|
|
|
221
222
|
exports.default = {
|
|
222
223
|
getSubgraphExecutor({ transportEntry, subgraph, cwd, logger }) {
|
|
223
224
|
const transport = new GrpcTransportHelper(transportEntry.subgraph, cwd, logger, transportEntry.location, transportEntry.options);
|
|
224
|
-
return (0,
|
|
225
|
+
return (0, promise_helpers_1.handleMaybePromise)(() => transport.getCredentials(), creds => {
|
|
225
226
|
transport.processDirectives({ schema: subgraph, creds });
|
|
226
227
|
return (0, utils_2.makeDisposable)((0, transport_common_1.createDefaultExecutor)(subgraph), () => transport.dispose());
|
|
227
228
|
});
|
package/esm/index.js
CHANGED
|
@@ -4,13 +4,14 @@ import lodashGet from 'lodash.get';
|
|
|
4
4
|
import { fs, path, process } from '@graphql-mesh/cross-helpers';
|
|
5
5
|
import { stringInterpolator } from '@graphql-mesh/string-interpolation';
|
|
6
6
|
import { createDefaultExecutor, ObjMapScalar, } from '@graphql-mesh/transport-common';
|
|
7
|
-
import { getDirective, getDirectives, getRootTypes,
|
|
7
|
+
import { getDirective, getDirectives, getRootTypes, } from '@graphql-tools/utils';
|
|
8
8
|
import { credentials, loadPackageDefinition } from '@grpc/grpc-js';
|
|
9
9
|
import { fromJSON } from '@grpc/proto-loader';
|
|
10
10
|
import { DisposableStack } from '@whatwg-node/disposablestack';
|
|
11
11
|
import { addExecutionLogicToScalar, addMetaDataToCall } from './utils.js';
|
|
12
12
|
import './patchLongJs.js';
|
|
13
13
|
import { makeDisposable } from '@graphql-mesh/utils';
|
|
14
|
+
import { handleMaybePromise } from '@whatwg-node/promise-helpers';
|
|
14
15
|
export class GrpcTransportHelper extends DisposableStack {
|
|
15
16
|
constructor(subgraphName, baseDir, logger, endpoint, config) {
|
|
16
17
|
super();
|
|
@@ -122,7 +123,7 @@ export class GrpcTransportHelper extends DisposableStack {
|
|
|
122
123
|
const grpcObjectByRootJsonName = new Map();
|
|
123
124
|
for (let { name, rootJson, loadOptions } of roots) {
|
|
124
125
|
rootJson = typeof rootJson === 'string' ? JSON.parse(rootJson) : rootJson;
|
|
125
|
-
const rootLogger = this.logger.child(name);
|
|
126
|
+
const rootLogger = this.logger.child({ root: name });
|
|
126
127
|
grpcObjectByRootJsonName.set(name, this.getGrpcObject({ rootJson, loadOptions, rootLogger }));
|
|
127
128
|
}
|
|
128
129
|
const rootTypes = getRootTypes(schema);
|
|
@@ -216,7 +217,7 @@ export class GrpcTransportHelper extends DisposableStack {
|
|
|
216
217
|
export default {
|
|
217
218
|
getSubgraphExecutor({ transportEntry, subgraph, cwd, logger }) {
|
|
218
219
|
const transport = new GrpcTransportHelper(transportEntry.subgraph, cwd, logger, transportEntry.location, transportEntry.options);
|
|
219
|
-
return
|
|
220
|
+
return handleMaybePromise(() => transport.getCredentials(), creds => {
|
|
220
221
|
transport.processDirectives({ schema: subgraph, creds });
|
|
221
222
|
return makeDisposable(createDefaultExecutor(subgraph), () => transport.dispose());
|
|
222
223
|
});
|
package/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/transport-grpc",
|
|
3
|
-
"version": "0.3.0-alpha-
|
|
3
|
+
"version": "0.3.0-alpha-20250303154240-da9897c303aaefec5798b499a7ac8fef3e01b201",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"graphql": "*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@graphql-mesh/cross-helpers": "^0.4.
|
|
9
|
+
"@graphql-mesh/cross-helpers": "^0.4.10",
|
|
10
10
|
"@graphql-mesh/string-interpolation": "^0.5.8",
|
|
11
11
|
"@graphql-mesh/transport-common": "^0.7.13",
|
|
12
|
-
"@graphql-mesh/types": "0.104.0-alpha-
|
|
13
|
-
"@graphql-mesh/utils": "0.104.0-alpha-
|
|
14
|
-
"@graphql-tools/utils": "^10.
|
|
12
|
+
"@graphql-mesh/types": "0.104.0-alpha-20250303154240-da9897c303aaefec5798b499a7ac8fef3e01b201",
|
|
13
|
+
"@graphql-mesh/utils": "0.104.0-alpha-20250303154240-da9897c303aaefec5798b499a7ac8fef3e01b201",
|
|
14
|
+
"@graphql-tools/utils": "^10.8.0",
|
|
15
15
|
"@grpc/grpc-js": "^1.1.7",
|
|
16
16
|
"@grpc/proto-loader": "^0.7.8",
|
|
17
|
-
"@whatwg-node/disposablestack": "^0.0.
|
|
17
|
+
"@whatwg-node/disposablestack": "^0.0.6",
|
|
18
|
+
"@whatwg-node/promise-helpers": "^1.0.0",
|
|
18
19
|
"graphql-scalars": "^1.22.4",
|
|
19
20
|
"lodash.get": "^4.4.2",
|
|
20
21
|
"long": "4.0.0",
|