@graphql-codegen/core 4.0.2 → 4.0.3-alpha-20250118081501-dd2b0bdaa05321a511f89cfeee5bf398fc77b86b
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/codegen.js +2 -3
- package/cjs/execute-plugin.js +1 -2
- package/cjs/transform-document.js +1 -2
- package/cjs/utils.js +8 -9
- package/package.json +5 -2
package/cjs/codegen.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.codegen = codegen;
|
|
4
|
+
exports.sortPrependValues = sortPrependValues;
|
|
4
5
|
const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
|
|
5
6
|
const schema_1 = require("@graphql-tools/schema");
|
|
6
7
|
const utils_1 = require("@graphql-tools/utils");
|
|
@@ -129,7 +130,6 @@ async function codegen(options) {
|
|
|
129
130
|
.filter(Boolean)
|
|
130
131
|
.join('\n');
|
|
131
132
|
}
|
|
132
|
-
exports.codegen = codegen;
|
|
133
133
|
function resolveCompareValue(a) {
|
|
134
134
|
if (a.startsWith('/*') || a.startsWith('//') || a.startsWith(' *') || a.startsWith(' */') || a.startsWith('*/')) {
|
|
135
135
|
return 0;
|
|
@@ -155,7 +155,6 @@ function sortPrependValues(values) {
|
|
|
155
155
|
return 0;
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
exports.sortPrependValues = sortPrependValues;
|
|
159
158
|
function validateDuplicateDocuments(files) {
|
|
160
159
|
// duplicated names
|
|
161
160
|
const definitionMap = {};
|
package/cjs/execute-plugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.executePlugin =
|
|
3
|
+
exports.executePlugin = executePlugin;
|
|
4
4
|
const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
|
|
5
5
|
const graphql_1 = require("graphql");
|
|
6
6
|
async function executePlugin(options, plugin) {
|
|
@@ -38,4 +38,3 @@ async function executePlugin(options, plugin) {
|
|
|
38
38
|
pluginContext,
|
|
39
39
|
})), `Plugin ${options.name} execution`);
|
|
40
40
|
}
|
|
41
|
-
exports.executePlugin = executePlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformDocuments =
|
|
3
|
+
exports.transformDocuments = transformDocuments;
|
|
4
4
|
const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
|
|
5
5
|
async function transformDocuments(options) {
|
|
6
6
|
const documentTransforms = options.documentTransforms || [];
|
|
@@ -41,4 +41,3 @@ async function transformDocuments(options) {
|
|
|
41
41
|
}
|
|
42
42
|
return documents;
|
|
43
43
|
}
|
|
44
|
-
exports.transformDocuments = transformDocuments;
|
package/cjs/utils.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isObjectMap = isObjectMap;
|
|
4
|
+
exports.prioritize = prioritize;
|
|
5
|
+
exports.pickFlag = pickFlag;
|
|
6
|
+
exports.shouldValidateDuplicateDocuments = shouldValidateDuplicateDocuments;
|
|
7
|
+
exports.shouldValidateDocumentsAgainstSchema = shouldValidateDocumentsAgainstSchema;
|
|
8
|
+
exports.getSkipDocumentsValidationOption = getSkipDocumentsValidationOption;
|
|
9
|
+
exports.hasFederationSpec = hasFederationSpec;
|
|
10
|
+
exports.extractHashFromSchema = extractHashFromSchema;
|
|
4
11
|
const utils_1 = require("@graphql-tools/utils");
|
|
5
12
|
const graphql_1 = require("graphql");
|
|
6
13
|
function isObjectMap(obj) {
|
|
7
14
|
return obj && typeof obj === 'object' && !Array.isArray(obj);
|
|
8
15
|
}
|
|
9
|
-
exports.isObjectMap = isObjectMap;
|
|
10
16
|
function prioritize(...values) {
|
|
11
17
|
const picked = values.find(val => typeof val === 'boolean');
|
|
12
18
|
if (typeof picked !== 'boolean') {
|
|
@@ -14,11 +20,9 @@ function prioritize(...values) {
|
|
|
14
20
|
}
|
|
15
21
|
return picked;
|
|
16
22
|
}
|
|
17
|
-
exports.prioritize = prioritize;
|
|
18
23
|
function pickFlag(flag, config) {
|
|
19
24
|
return isObjectMap(config) ? config[flag] : undefined;
|
|
20
25
|
}
|
|
21
|
-
exports.pickFlag = pickFlag;
|
|
22
26
|
function shouldValidateDuplicateDocuments(skipDocumentsValidationOption) {
|
|
23
27
|
// If the value is true, skip all
|
|
24
28
|
if (skipDocumentsValidationOption === true) {
|
|
@@ -31,7 +35,6 @@ function shouldValidateDuplicateDocuments(skipDocumentsValidationOption) {
|
|
|
31
35
|
// If the value is falsy or the specific flag is not set, validate
|
|
32
36
|
return true;
|
|
33
37
|
}
|
|
34
|
-
exports.shouldValidateDuplicateDocuments = shouldValidateDuplicateDocuments;
|
|
35
38
|
function shouldValidateDocumentsAgainstSchema(skipDocumentsValidationOption) {
|
|
36
39
|
// If the value is true, skip all
|
|
37
40
|
if (skipDocumentsValidationOption === true) {
|
|
@@ -44,7 +47,6 @@ function shouldValidateDocumentsAgainstSchema(skipDocumentsValidationOption) {
|
|
|
44
47
|
// If the value is falsy or the specific flag is not set, validate
|
|
45
48
|
return true;
|
|
46
49
|
}
|
|
47
|
-
exports.shouldValidateDocumentsAgainstSchema = shouldValidateDocumentsAgainstSchema;
|
|
48
50
|
function getSkipDocumentsValidationOption(options) {
|
|
49
51
|
// If the value is set on the root level
|
|
50
52
|
if (options.skipDocumentsValidation) {
|
|
@@ -57,7 +59,6 @@ function getSkipDocumentsValidationOption(options) {
|
|
|
57
59
|
}
|
|
58
60
|
return false;
|
|
59
61
|
}
|
|
60
|
-
exports.getSkipDocumentsValidationOption = getSkipDocumentsValidationOption;
|
|
61
62
|
const federationDirectives = ['key', 'requires', 'provides', 'external'];
|
|
62
63
|
function hasFederationSpec(schemaOrAST) {
|
|
63
64
|
if ((0, graphql_1.isSchema)(schemaOrAST)) {
|
|
@@ -68,9 +69,7 @@ function hasFederationSpec(schemaOrAST) {
|
|
|
68
69
|
}
|
|
69
70
|
return false;
|
|
70
71
|
}
|
|
71
|
-
exports.hasFederationSpec = hasFederationSpec;
|
|
72
72
|
function extractHashFromSchema(schema) {
|
|
73
73
|
schema.extensions ||= {};
|
|
74
74
|
return schema.extensions['hash'] ?? null;
|
|
75
75
|
}
|
|
76
|
-
exports.extractHashFromSchema = extractHashFromSchema;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3-alpha-20250118081501-dd2b0bdaa05321a511f89cfeee5bf398fc77b86b",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"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"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@graphql-codegen/plugin-helpers": "
|
|
8
|
+
"@graphql-codegen/plugin-helpers": "6.0.0-alpha-20250118081501-dd2b0bdaa05321a511f89cfeee5bf398fc77b86b",
|
|
9
9
|
"@graphql-tools/schema": "^10.0.0",
|
|
10
10
|
"@graphql-tools/utils": "^10.0.0",
|
|
11
11
|
"tslib": "~2.6.0"
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
],
|
|
36
36
|
"author": "Dotan Simha <dotansimha@gmail.com>",
|
|
37
37
|
"license": "MIT",
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=16"
|
|
40
|
+
},
|
|
38
41
|
"main": "cjs/index.js",
|
|
39
42
|
"module": "esm/index.js",
|
|
40
43
|
"typings": "typings/index.d.ts",
|