@graphql-mesh/transform-hive 0.1.78-alpha-20221124125639-2cff98e36 → 1.0.0-alpha-20230420181317-a95037648
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/{index.js → cjs/index.js} +29 -28
- package/cjs/package.json +1 -0
- package/{index.mjs → esm/index.js} +13 -13
- package/package.json +27 -20
- package/typings/index.d.cts +16 -0
- package/{index.d.ts → typings/index.d.ts} +3 -3
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const client_1 = require("@graphql-hive/client");
|
|
4
|
+
const cross_helpers_1 = require("@graphql-mesh/cross-helpers");
|
|
5
|
+
const string_interpolation_1 = require("@graphql-mesh/string-interpolation");
|
|
7
6
|
class HiveTransform {
|
|
8
7
|
constructor({ config, pubsub, logger }) {
|
|
9
8
|
var _a;
|
|
10
|
-
const token =
|
|
11
|
-
env:
|
|
9
|
+
const token = string_interpolation_1.stringInterpolator.parse(config.token, {
|
|
10
|
+
env: cross_helpers_1.process.env,
|
|
12
11
|
});
|
|
13
12
|
let usage;
|
|
14
13
|
if (config.usage) {
|
|
@@ -22,13 +21,13 @@ class HiveTransform {
|
|
|
22
21
|
if ((_a = config.usage) === null || _a === void 0 ? void 0 : _a.clientInfo) {
|
|
23
22
|
usage.clientInfo = function (context) {
|
|
24
23
|
return {
|
|
25
|
-
name:
|
|
24
|
+
name: string_interpolation_1.stringInterpolator.parse(config.usage.clientInfo.name, {
|
|
26
25
|
context,
|
|
27
|
-
env:
|
|
26
|
+
env: cross_helpers_1.process.env,
|
|
28
27
|
}),
|
|
29
|
-
version:
|
|
28
|
+
version: string_interpolation_1.stringInterpolator.parse(config.usage.clientInfo.version, {
|
|
30
29
|
context,
|
|
31
|
-
env:
|
|
30
|
+
env: cross_helpers_1.process.env,
|
|
32
31
|
}),
|
|
33
32
|
};
|
|
34
33
|
};
|
|
@@ -37,23 +36,26 @@ class HiveTransform {
|
|
|
37
36
|
let reporting;
|
|
38
37
|
if (config.reporting) {
|
|
39
38
|
reporting = {
|
|
40
|
-
author:
|
|
41
|
-
commit:
|
|
42
|
-
serviceName:
|
|
43
|
-
serviceUrl:
|
|
39
|
+
author: string_interpolation_1.stringInterpolator.parse(config.reporting.author, { env: cross_helpers_1.process.env }),
|
|
40
|
+
commit: string_interpolation_1.stringInterpolator.parse(config.reporting.commit, { env: cross_helpers_1.process.env }),
|
|
41
|
+
serviceName: string_interpolation_1.stringInterpolator.parse(config.reporting.serviceName, { env: cross_helpers_1.process.env }),
|
|
42
|
+
serviceUrl: string_interpolation_1.stringInterpolator.parse(config.reporting.serviceUrl, { env: cross_helpers_1.process.env }),
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
let agent;
|
|
46
|
+
if (config.agent) {
|
|
47
|
+
agent = {
|
|
48
|
+
timeout: config.agent.timeout,
|
|
49
|
+
maxRetries: config.agent.maxRetries,
|
|
50
|
+
minTimeout: config.agent.minTimeout,
|
|
51
|
+
sendInterval: config.agent.sendInterval,
|
|
52
|
+
maxSize: config.agent.maxSize,
|
|
53
|
+
logger,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
this.hiveClient = (0, client_1.createHive)({
|
|
55
57
|
enabled: true,
|
|
56
|
-
debug: !!
|
|
58
|
+
debug: !!cross_helpers_1.process.env.DEBUG,
|
|
57
59
|
token,
|
|
58
60
|
agent,
|
|
59
61
|
usage,
|
|
@@ -86,5 +88,4 @@ class HiveTransform {
|
|
|
86
88
|
return result;
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
|
-
|
|
90
|
-
module.exports = HiveTransform;
|
|
91
|
+
exports.default = HiveTransform;
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createHive } from '@graphql-hive/client';
|
|
2
|
-
import { stringInterpolator } from '@graphql-mesh/string-interpolation';
|
|
3
2
|
import { process } from '@graphql-mesh/cross-helpers';
|
|
4
|
-
|
|
5
|
-
class HiveTransform {
|
|
3
|
+
import { stringInterpolator } from '@graphql-mesh/string-interpolation';
|
|
4
|
+
export default class HiveTransform {
|
|
6
5
|
constructor({ config, pubsub, logger }) {
|
|
7
6
|
var _a;
|
|
8
7
|
const token = stringInterpolator.parse(config.token, {
|
|
@@ -41,14 +40,17 @@ class HiveTransform {
|
|
|
41
40
|
serviceUrl: stringInterpolator.parse(config.reporting.serviceUrl, { env: process.env }),
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
let agent;
|
|
44
|
+
if (config.agent) {
|
|
45
|
+
agent = {
|
|
46
|
+
timeout: config.agent.timeout,
|
|
47
|
+
maxRetries: config.agent.maxRetries,
|
|
48
|
+
minTimeout: config.agent.minTimeout,
|
|
49
|
+
sendInterval: config.agent.sendInterval,
|
|
50
|
+
maxSize: config.agent.maxSize,
|
|
51
|
+
logger,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
52
54
|
this.hiveClient = createHive({
|
|
53
55
|
enabled: true,
|
|
54
56
|
debug: !!process.env.DEBUG,
|
|
@@ -84,5 +86,3 @@ class HiveTransform {
|
|
|
84
86
|
return result;
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
|
-
|
|
88
|
-
export default HiveTransform;
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/transform-hive",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha-20230420181317-a95037648",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"graphql": "
|
|
6
|
+
"@graphql-mesh/cross-helpers": "^0.3.4",
|
|
7
|
+
"@graphql-mesh/types": "1.0.0-alpha-20230420181317-a95037648",
|
|
8
|
+
"@graphql-tools/utils": "^9.2.1",
|
|
9
|
+
"graphql": "*",
|
|
10
|
+
"tslib": "^2.4.0"
|
|
7
11
|
},
|
|
8
12
|
"dependencies": {
|
|
9
|
-
"@graphql-hive/client": "0.
|
|
10
|
-
"@graphql-mesh/
|
|
11
|
-
"@graphql-
|
|
12
|
-
"@graphql-mesh/types": "0.87.0-alpha-20221124125639-2cff98e36",
|
|
13
|
-
"@graphql-tools/delegate": "9.0.17",
|
|
14
|
-
"@graphql-tools/utils": "9.1.1",
|
|
15
|
-
"tslib": "^2.4.0"
|
|
13
|
+
"@graphql-hive/client": "0.23.1",
|
|
14
|
+
"@graphql-mesh/string-interpolation": "0.4.4",
|
|
15
|
+
"@graphql-tools/delegate": "9.0.32"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
@@ -20,21 +20,28 @@
|
|
|
20
20
|
"directory": "packages/transforms/hive"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
|
-
"main": "index.js",
|
|
24
|
-
"module": "index.
|
|
25
|
-
"typings": "index.d.ts",
|
|
23
|
+
"main": "cjs/index.js",
|
|
24
|
+
"module": "esm/index.js",
|
|
25
|
+
"typings": "typings/index.d.ts",
|
|
26
26
|
"typescript": {
|
|
27
|
-
"definition": "index.d.ts"
|
|
27
|
+
"definition": "typings/index.d.ts"
|
|
28
28
|
},
|
|
29
|
+
"type": "module",
|
|
29
30
|
"exports": {
|
|
30
31
|
".": {
|
|
31
|
-
"require":
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
32
|
+
"require": {
|
|
33
|
+
"types": "./typings/index.d.cts",
|
|
34
|
+
"default": "./cjs/index.js"
|
|
35
|
+
},
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./typings/index.d.ts",
|
|
38
|
+
"default": "./esm/index.js"
|
|
39
|
+
},
|
|
40
|
+
"default": {
|
|
41
|
+
"types": "./typings/index.d.ts",
|
|
42
|
+
"default": "./esm/index.js"
|
|
43
|
+
}
|
|
37
44
|
},
|
|
38
45
|
"./package.json": "./package.json"
|
|
39
46
|
}
|
|
40
|
-
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ExecutionResult, GraphQLSchema } from 'graphql';
|
|
2
|
+
import { HiveClient } from '@graphql-hive/client';
|
|
3
|
+
import { MeshTransform, MeshTransformOptions, YamlConfig } from '@graphql-mesh/types';
|
|
4
|
+
import { DelegationContext } from '@graphql-tools/delegate';
|
|
5
|
+
import { ExecutionRequest } from '@graphql-tools/utils';
|
|
6
|
+
interface TransformationContext {
|
|
7
|
+
collectUsageCallback: ReturnType<HiveClient['collectUsage']>;
|
|
8
|
+
}
|
|
9
|
+
export default class HiveTransform implements MeshTransform {
|
|
10
|
+
private hiveClient;
|
|
11
|
+
constructor({ config, pubsub, logger }: MeshTransformOptions<YamlConfig.HivePlugin>);
|
|
12
|
+
transformSchema(schema: GraphQLSchema): GraphQLSchema;
|
|
13
|
+
transformRequest(request: ExecutionRequest, delegationContext: DelegationContext, transformationContext: TransformationContext): ExecutionRequest<any, any, any, Record<string, any>, any>;
|
|
14
|
+
transformResult(result: ExecutionResult, _delegationContext: DelegationContext, transformationContext: TransformationContext): ExecutionResult<import("graphql/jsutils/ObjMap").ObjMap<unknown>, import("graphql/jsutils/ObjMap").ObjMap<unknown>>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MeshTransform, MeshTransformOptions, YamlConfig } from '@graphql-mesh/types';
|
|
2
|
-
import { HiveClient } from '@graphql-hive/client';
|
|
3
1
|
import { ExecutionResult, GraphQLSchema } from 'graphql';
|
|
2
|
+
import { HiveClient } from '@graphql-hive/client';
|
|
3
|
+
import { MeshTransform, MeshTransformOptions, YamlConfig } from '@graphql-mesh/types';
|
|
4
4
|
import { DelegationContext } from '@graphql-tools/delegate';
|
|
5
5
|
import { ExecutionRequest } from '@graphql-tools/utils';
|
|
6
6
|
interface TransformationContext {
|
|
@@ -10,7 +10,7 @@ export default class HiveTransform implements MeshTransform {
|
|
|
10
10
|
private hiveClient;
|
|
11
11
|
constructor({ config, pubsub, logger }: MeshTransformOptions<YamlConfig.HivePlugin>);
|
|
12
12
|
transformSchema(schema: GraphQLSchema): GraphQLSchema;
|
|
13
|
-
transformRequest(request: ExecutionRequest, delegationContext: DelegationContext, transformationContext: TransformationContext): ExecutionRequest<
|
|
13
|
+
transformRequest(request: ExecutionRequest, delegationContext: DelegationContext, transformationContext: TransformationContext): ExecutionRequest<any, any, any, Record<string, any>, any>;
|
|
14
14
|
transformResult(result: ExecutionResult, _delegationContext: DelegationContext, transformationContext: TransformationContext): ExecutionResult<import("graphql/jsutils/ObjMap").ObjMap<unknown>, import("graphql/jsutils/ObjMap").ObjMap<unknown>>;
|
|
15
15
|
}
|
|
16
16
|
export {};
|