@envelop/apollo-federation 3.0.0-alpha-4ba70ab.0 → 3.0.0-alpha-d0d0776.0
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 +5 -8
- package/index.mjs +5 -8
- package/package.json +19 -7
package/index.js
CHANGED
|
@@ -28,11 +28,10 @@ function newCachePolicy() {
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
policyIfCacheable() {
|
|
31
|
-
var _a;
|
|
32
31
|
if (this.maxAge === undefined || this.maxAge === 0) {
|
|
33
32
|
return null;
|
|
34
33
|
}
|
|
35
|
-
return { maxAge: this.maxAge, scope:
|
|
34
|
+
return { maxAge: this.maxAge, scope: this.scope ?? apolloServerTypes.CacheScope.Public };
|
|
36
35
|
},
|
|
37
36
|
};
|
|
38
37
|
}
|
|
@@ -64,27 +63,25 @@ const useApolloFederation = (options) => {
|
|
|
64
63
|
};
|
|
65
64
|
},
|
|
66
65
|
onExecute({ args, setExecuteFn }) {
|
|
67
|
-
var _a;
|
|
68
66
|
let documentStr = documentSourceMap.get(args.document);
|
|
69
67
|
if (documentStr == null) {
|
|
70
68
|
documentStr = graphql.print(args.document);
|
|
71
69
|
documentSourceMap.set(args.document, documentStr);
|
|
72
70
|
}
|
|
73
|
-
const operation = graphql.getOperationAST(args.document,
|
|
71
|
+
const operation = graphql.getOperationAST(args.document, args.operationName ?? undefined);
|
|
74
72
|
if (!operation) {
|
|
75
73
|
throw new Error(`Operation ${args.operationName || ''} cannot be found in ${documentStr}`);
|
|
76
74
|
}
|
|
77
75
|
setExecuteFn(function federationExecutor() {
|
|
78
|
-
var _a, _b, _c;
|
|
79
76
|
return gateway.executor({
|
|
80
77
|
document: args.document,
|
|
81
78
|
request: {
|
|
82
79
|
query: documentStr,
|
|
83
|
-
operationName:
|
|
84
|
-
variables:
|
|
80
|
+
operationName: args.operationName ?? undefined,
|
|
81
|
+
variables: args.variableValues ?? undefined,
|
|
85
82
|
},
|
|
86
83
|
overallCachePolicy,
|
|
87
|
-
operationName:
|
|
84
|
+
operationName: args.operationName ?? null,
|
|
88
85
|
cache,
|
|
89
86
|
context: args.contextValue,
|
|
90
87
|
queryHash: documentStr,
|
package/index.mjs
CHANGED
|
@@ -24,11 +24,10 @@ function newCachePolicy() {
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
policyIfCacheable() {
|
|
27
|
-
var _a;
|
|
28
27
|
if (this.maxAge === undefined || this.maxAge === 0) {
|
|
29
28
|
return null;
|
|
30
29
|
}
|
|
31
|
-
return { maxAge: this.maxAge, scope:
|
|
30
|
+
return { maxAge: this.maxAge, scope: this.scope ?? CacheScope.Public };
|
|
32
31
|
},
|
|
33
32
|
};
|
|
34
33
|
}
|
|
@@ -60,27 +59,25 @@ const useApolloFederation = (options) => {
|
|
|
60
59
|
};
|
|
61
60
|
},
|
|
62
61
|
onExecute({ args, setExecuteFn }) {
|
|
63
|
-
var _a;
|
|
64
62
|
let documentStr = documentSourceMap.get(args.document);
|
|
65
63
|
if (documentStr == null) {
|
|
66
64
|
documentStr = print(args.document);
|
|
67
65
|
documentSourceMap.set(args.document, documentStr);
|
|
68
66
|
}
|
|
69
|
-
const operation = getOperationAST(args.document,
|
|
67
|
+
const operation = getOperationAST(args.document, args.operationName ?? undefined);
|
|
70
68
|
if (!operation) {
|
|
71
69
|
throw new Error(`Operation ${args.operationName || ''} cannot be found in ${documentStr}`);
|
|
72
70
|
}
|
|
73
71
|
setExecuteFn(function federationExecutor() {
|
|
74
|
-
var _a, _b, _c;
|
|
75
72
|
return gateway.executor({
|
|
76
73
|
document: args.document,
|
|
77
74
|
request: {
|
|
78
75
|
query: documentStr,
|
|
79
|
-
operationName:
|
|
80
|
-
variables:
|
|
76
|
+
operationName: args.operationName ?? undefined,
|
|
77
|
+
variables: args.variableValues ?? undefined,
|
|
81
78
|
},
|
|
82
79
|
overallCachePolicy,
|
|
83
|
-
operationName:
|
|
80
|
+
operationName: args.operationName ?? null,
|
|
84
81
|
cache,
|
|
85
82
|
context: args.contextValue,
|
|
86
83
|
queryHash: documentStr,
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/apollo-federation",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-d0d0776.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@apollo/gateway": "^0.41.0 || ^0.42.0 || ^0.43.0",
|
|
7
|
-
"@envelop/core": "
|
|
7
|
+
"@envelop/core": "3.0.0-alpha-d0d0776.0",
|
|
8
8
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/
|
|
16
|
+
"url": "https://github.com/n1ru4l/envelop.git",
|
|
17
17
|
"directory": "packages/plugins/apollo-federation"
|
|
18
18
|
},
|
|
19
19
|
"author": "Arda TANRIKULU <ardatanrikulu@gmail.com>",
|
|
@@ -26,12 +26,24 @@
|
|
|
26
26
|
},
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
-
"require":
|
|
30
|
-
|
|
29
|
+
"require": {
|
|
30
|
+
"default": "./index.js",
|
|
31
|
+
"types": "./index.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"import": {
|
|
34
|
+
"default": "./index.mjs",
|
|
35
|
+
"types": "./index.d.ts"
|
|
36
|
+
}
|
|
31
37
|
},
|
|
32
38
|
"./*": {
|
|
33
|
-
"require":
|
|
34
|
-
|
|
39
|
+
"require": {
|
|
40
|
+
"default": "./*.js",
|
|
41
|
+
"types": "./*.d.ts"
|
|
42
|
+
},
|
|
43
|
+
"import": {
|
|
44
|
+
"default": "./*.mjs",
|
|
45
|
+
"types": "./*.d.ts"
|
|
46
|
+
}
|
|
35
47
|
},
|
|
36
48
|
"./package.json": "./package.json"
|
|
37
49
|
}
|