@graphql-codegen/plugin-helpers 4.2.0-alpha-20230330112047-da0c5ec12 → 4.2.0-alpha-20230330142525-09b25a034
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/federation.js +5 -5
- package/cjs/utils.js +2 -2
- package/esm/federation.js +5 -5
- package/esm/utils.js +2 -2
- package/package.json +1 -1
package/cjs/federation.js
CHANGED
|
@@ -190,21 +190,21 @@ class ApolloFederation {
|
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
createMapOfProvides() {
|
|
193
|
+
var _a;
|
|
193
194
|
const providesMap = {};
|
|
194
|
-
Object.keys(this.schema.getTypeMap())
|
|
195
|
+
for (const typename of Object.keys(this.schema.getTypeMap())) {
|
|
195
196
|
const objectType = this.schema.getType(typename);
|
|
196
197
|
if ((0, graphql_1.isObjectType)(objectType)) {
|
|
197
|
-
Object.values(objectType.getFields())
|
|
198
|
-
var _a;
|
|
198
|
+
for (const field of Object.values(objectType.getFields())) {
|
|
199
199
|
const provides = getDirectivesByName('provides', field.astNode)
|
|
200
200
|
.map(this.extractFieldSet)
|
|
201
201
|
.reduce((prev, curr) => [...prev, ...Object.keys(curr)], []);
|
|
202
202
|
const ofType = (0, utils_js_1.getBaseType)(field.type);
|
|
203
203
|
providesMap[_a = ofType.name] || (providesMap[_a] = []);
|
|
204
204
|
providesMap[ofType.name].push(...provides);
|
|
205
|
-
}
|
|
205
|
+
}
|
|
206
206
|
}
|
|
207
|
-
}
|
|
207
|
+
}
|
|
208
208
|
return providesMap;
|
|
209
209
|
}
|
|
210
210
|
}
|
package/cjs/utils.js
CHANGED
|
@@ -5,7 +5,7 @@ const graphql_1 = require("graphql");
|
|
|
5
5
|
function mergeOutputs(content) {
|
|
6
6
|
const result = { content: '', prepend: [], append: [] };
|
|
7
7
|
if (Array.isArray(content)) {
|
|
8
|
-
|
|
8
|
+
for (const item of content) {
|
|
9
9
|
if (typeof item === 'string') {
|
|
10
10
|
result.content += item;
|
|
11
11
|
}
|
|
@@ -14,7 +14,7 @@ function mergeOutputs(content) {
|
|
|
14
14
|
result.prepend.push(...(item.prepend || []));
|
|
15
15
|
result.append.push(...(item.append || []));
|
|
16
16
|
}
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
}
|
|
19
19
|
return [...result.prepend, result.content, ...result.append].join('\n');
|
|
20
20
|
}
|
package/esm/federation.js
CHANGED
|
@@ -184,21 +184,21 @@ export class ApolloFederation {
|
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
createMapOfProvides() {
|
|
187
|
+
var _a;
|
|
187
188
|
const providesMap = {};
|
|
188
|
-
Object.keys(this.schema.getTypeMap())
|
|
189
|
+
for (const typename of Object.keys(this.schema.getTypeMap())) {
|
|
189
190
|
const objectType = this.schema.getType(typename);
|
|
190
191
|
if (isObjectType(objectType)) {
|
|
191
|
-
Object.values(objectType.getFields())
|
|
192
|
-
var _a;
|
|
192
|
+
for (const field of Object.values(objectType.getFields())) {
|
|
193
193
|
const provides = getDirectivesByName('provides', field.astNode)
|
|
194
194
|
.map(this.extractFieldSet)
|
|
195
195
|
.reduce((prev, curr) => [...prev, ...Object.keys(curr)], []);
|
|
196
196
|
const ofType = getBaseType(field.type);
|
|
197
197
|
providesMap[_a = ofType.name] || (providesMap[_a] = []);
|
|
198
198
|
providesMap[ofType.name].push(...provides);
|
|
199
|
-
}
|
|
199
|
+
}
|
|
200
200
|
}
|
|
201
|
-
}
|
|
201
|
+
}
|
|
202
202
|
return providesMap;
|
|
203
203
|
}
|
|
204
204
|
}
|
package/esm/utils.js
CHANGED
|
@@ -2,7 +2,7 @@ import { isListType, isNonNullType } from 'graphql';
|
|
|
2
2
|
export function mergeOutputs(content) {
|
|
3
3
|
const result = { content: '', prepend: [], append: [] };
|
|
4
4
|
if (Array.isArray(content)) {
|
|
5
|
-
|
|
5
|
+
for (const item of content) {
|
|
6
6
|
if (typeof item === 'string') {
|
|
7
7
|
result.content += item;
|
|
8
8
|
}
|
|
@@ -11,7 +11,7 @@ export function mergeOutputs(content) {
|
|
|
11
11
|
result.prepend.push(...(item.prepend || []));
|
|
12
12
|
result.append.push(...(item.append || []));
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
}
|
|
16
16
|
return [...result.prepend, result.content, ...result.append].join('\n');
|
|
17
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/plugin-helpers",
|
|
3
|
-
"version": "4.2.0-alpha-
|
|
3
|
+
"version": "4.2.0-alpha-20230330142525-09b25a034",
|
|
4
4
|
"description": "GraphQL Code Generator common utils and types",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|