@baeta/plugin-graphql 0.0.2 → 0.0.3
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/dist/index.cjs +1282 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.js +1260 -21
- package/package.json +13 -12
- package/dist/codegen.d.ts +0 -6
- package/dist/codegen.js +0 -116
- package/dist/codegen.mjs +0 -89
- package/dist/config.d.ts +0 -10
- package/dist/config.js +0 -16
- package/dist/config.mjs +0 -0
- package/dist/index.mjs +0 -19
- package/dist/modules/builder.d.ts +0 -17
- package/dist/modules/builder.js +0 -439
- package/dist/modules/builder.mjs +0 -429
- package/dist/modules/config.d.ts +0 -11
- package/dist/modules/config.js +0 -16
- package/dist/modules/config.mjs +0 -0
- package/dist/modules/index.d.ts +0 -6
- package/dist/modules/index.js +0 -148
- package/dist/modules/index.mjs +0 -132
- package/dist/modules/utils.d.ts +0 -28
- package/dist/modules/utils.js +0 -209
- package/dist/modules/utils.mjs +0 -168
- package/dist/resolvers/config.d.ts +0 -16
- package/dist/resolvers/config.js +0 -16
- package/dist/resolvers/config.mjs +0 -0
- package/dist/resolvers/index.d.ts +0 -10
- package/dist/resolvers/index.js +0 -309
- package/dist/resolvers/index.mjs +0 -289
- package/dist/resolvers/visitor.d.ts +0 -29
- package/dist/resolvers/visitor.js +0 -139
- package/dist/resolvers/visitor.mjs +0 -111
- package/dist/utils/cache.d.ts +0 -3
- package/dist/utils/cache.js +0 -40
- package/dist/utils/cache.mjs +0 -16
- package/dist/utils/hash.d.ts +0 -6
- package/dist/utils/hash.js +0 -38
- package/dist/utils/hash.mjs +0 -13
- package/dist/utils/load.d.ts +0 -9
- package/dist/utils/load.js +0 -62
- package/dist/utils/load.mjs +0 -40
- package/dist/utils/path.d.ts +0 -3
- package/dist/utils/path.js +0 -37
- package/dist/utils/path.mjs +0 -7
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var visitor_exports = {};
|
|
26
|
-
__export(visitor_exports, {
|
|
27
|
-
ENUM_RESOLVERS_SIGNATURE: () => ENUM_RESOLVERS_SIGNATURE,
|
|
28
|
-
TypeScriptResolversVisitor: () => TypeScriptResolversVisitor
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(visitor_exports);
|
|
31
|
-
var import_auto_bind = __toESM(require("auto-bind"));
|
|
32
|
-
var import_visitor_plugin_common = require("@graphql-codegen/visitor-plugin-common");
|
|
33
|
-
var import_typescript = require("@graphql-codegen/typescript");
|
|
34
|
-
const ENUM_RESOLVERS_SIGNATURE = "export type EnumResolverSignature<T, AllowedValues = any> = { [key in keyof T]?: AllowedValues };";
|
|
35
|
-
class TypeScriptResolversVisitor extends import_visitor_plugin_common.BaseResolversVisitor {
|
|
36
|
-
constructor(pluginConfig, schema) {
|
|
37
|
-
super(
|
|
38
|
-
pluginConfig,
|
|
39
|
-
{
|
|
40
|
-
avoidOptionals: (0, import_visitor_plugin_common.getConfigValue)(pluginConfig.avoidOptionals, false),
|
|
41
|
-
useIndexSignature: (0, import_visitor_plugin_common.getConfigValue)(
|
|
42
|
-
pluginConfig.useIndexSignature,
|
|
43
|
-
false
|
|
44
|
-
),
|
|
45
|
-
wrapFieldDefinitions: (0, import_visitor_plugin_common.getConfigValue)(
|
|
46
|
-
pluginConfig.wrapFieldDefinitions,
|
|
47
|
-
false
|
|
48
|
-
),
|
|
49
|
-
allowParentTypeOverride: (0, import_visitor_plugin_common.getConfigValue)(
|
|
50
|
-
pluginConfig.allowParentTypeOverride,
|
|
51
|
-
false
|
|
52
|
-
),
|
|
53
|
-
optionalInfoArgument: (0, import_visitor_plugin_common.getConfigValue)(
|
|
54
|
-
pluginConfig.optionalInfoArgument,
|
|
55
|
-
false
|
|
56
|
-
)
|
|
57
|
-
},
|
|
58
|
-
schema
|
|
59
|
-
);
|
|
60
|
-
(0, import_auto_bind.default)(this);
|
|
61
|
-
this.setVariablesTransformer(
|
|
62
|
-
new import_typescript.TypeScriptOperationVariablesToObject(
|
|
63
|
-
this.scalars,
|
|
64
|
-
this.convertName,
|
|
65
|
-
this.config.avoidOptionals,
|
|
66
|
-
this.config.immutableTypes,
|
|
67
|
-
this.config.namespacedImportName,
|
|
68
|
-
[],
|
|
69
|
-
this.config.enumPrefix,
|
|
70
|
-
this.config.enumValues
|
|
71
|
-
)
|
|
72
|
-
);
|
|
73
|
-
if (this.config.useIndexSignature) {
|
|
74
|
-
this._declarationBlockConfig = {
|
|
75
|
-
blockTransformer(block) {
|
|
76
|
-
return `ResolversObject<${block}>`;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
transformParentGenericType(parentType) {
|
|
82
|
-
if (this.config.allowParentTypeOverride) {
|
|
83
|
-
return `ParentType = ${parentType}`;
|
|
84
|
-
}
|
|
85
|
-
return `ParentType extends ${parentType} = ${parentType}`;
|
|
86
|
-
}
|
|
87
|
-
formatRootResolver(schemaTypeName, resolverType, declarationKind) {
|
|
88
|
-
var _a;
|
|
89
|
-
const avoidOptionals = ((_a = this.config.avoidOptionals) == null ? void 0 : _a.resolvers) ?? this.config.avoidOptionals === true;
|
|
90
|
-
return `${schemaTypeName}${avoidOptionals ? "" : "?"}: ${resolverType}${this.getPunctuation(declarationKind)}`;
|
|
91
|
-
}
|
|
92
|
-
clearOptional(str) {
|
|
93
|
-
if (str.startsWith("Maybe")) {
|
|
94
|
-
return str.replace(/Maybe<(.*?)>$/, "$1");
|
|
95
|
-
}
|
|
96
|
-
return str;
|
|
97
|
-
}
|
|
98
|
-
ListType(node) {
|
|
99
|
-
return `Maybe<${super.ListType(node)}>`;
|
|
100
|
-
}
|
|
101
|
-
wrapWithListType(str) {
|
|
102
|
-
return `${this.config.immutableTypes ? "ReadonlyArray" : "Array"}<${str}>`;
|
|
103
|
-
}
|
|
104
|
-
getParentTypeForSignature(node) {
|
|
105
|
-
if (this._federation.isResolveReferenceField(node) && this.config.wrapFieldDefinitions) {
|
|
106
|
-
return "UnwrappedObject<ParentType>";
|
|
107
|
-
}
|
|
108
|
-
return "ParentType";
|
|
109
|
-
}
|
|
110
|
-
NamedType(node) {
|
|
111
|
-
return `Maybe<${super.NamedType(node)}>`;
|
|
112
|
-
}
|
|
113
|
-
NonNullType(node) {
|
|
114
|
-
const baseValue = super.NonNullType(node);
|
|
115
|
-
return this.clearOptional(baseValue);
|
|
116
|
-
}
|
|
117
|
-
getPunctuation(_declarationKind) {
|
|
118
|
-
return ";";
|
|
119
|
-
}
|
|
120
|
-
buildEnumResolverContentBlock(node, mappedEnumType) {
|
|
121
|
-
const valuesMap = `{ ${(node.values || []).map(
|
|
122
|
-
(v) => `${v.name}${this.config.avoidOptionals ? "" : "?"}: any`
|
|
123
|
-
).join(", ")} }`;
|
|
124
|
-
this._globalDeclarations.add(ENUM_RESOLVERS_SIGNATURE);
|
|
125
|
-
return `EnumResolverSignature<${valuesMap}, ${mappedEnumType}>`;
|
|
126
|
-
}
|
|
127
|
-
buildEnumResolversExplicitMappedValues(node, valuesMapping) {
|
|
128
|
-
return `{ ${(node.values || []).map((v) => {
|
|
129
|
-
const valueName = v.name;
|
|
130
|
-
const mappedValue = valuesMapping[valueName];
|
|
131
|
-
return `${valueName}: ${typeof mappedValue === "number" ? mappedValue : `'${mappedValue}'`}`;
|
|
132
|
-
}).join(", ")} }`;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
136
|
-
0 && (module.exports = {
|
|
137
|
-
ENUM_RESOLVERS_SIGNATURE,
|
|
138
|
-
TypeScriptResolversVisitor
|
|
139
|
-
});
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import autoBind from "auto-bind";
|
|
2
|
-
import {
|
|
3
|
-
BaseResolversVisitor,
|
|
4
|
-
getConfigValue
|
|
5
|
-
} from "@graphql-codegen/visitor-plugin-common";
|
|
6
|
-
import { TypeScriptOperationVariablesToObject } from "@graphql-codegen/typescript";
|
|
7
|
-
const ENUM_RESOLVERS_SIGNATURE = "export type EnumResolverSignature<T, AllowedValues = any> = { [key in keyof T]?: AllowedValues };";
|
|
8
|
-
class TypeScriptResolversVisitor extends BaseResolversVisitor {
|
|
9
|
-
constructor(pluginConfig, schema) {
|
|
10
|
-
super(
|
|
11
|
-
pluginConfig,
|
|
12
|
-
{
|
|
13
|
-
avoidOptionals: getConfigValue(pluginConfig.avoidOptionals, false),
|
|
14
|
-
useIndexSignature: getConfigValue(
|
|
15
|
-
pluginConfig.useIndexSignature,
|
|
16
|
-
false
|
|
17
|
-
),
|
|
18
|
-
wrapFieldDefinitions: getConfigValue(
|
|
19
|
-
pluginConfig.wrapFieldDefinitions,
|
|
20
|
-
false
|
|
21
|
-
),
|
|
22
|
-
allowParentTypeOverride: getConfigValue(
|
|
23
|
-
pluginConfig.allowParentTypeOverride,
|
|
24
|
-
false
|
|
25
|
-
),
|
|
26
|
-
optionalInfoArgument: getConfigValue(
|
|
27
|
-
pluginConfig.optionalInfoArgument,
|
|
28
|
-
false
|
|
29
|
-
)
|
|
30
|
-
},
|
|
31
|
-
schema
|
|
32
|
-
);
|
|
33
|
-
autoBind(this);
|
|
34
|
-
this.setVariablesTransformer(
|
|
35
|
-
new TypeScriptOperationVariablesToObject(
|
|
36
|
-
this.scalars,
|
|
37
|
-
this.convertName,
|
|
38
|
-
this.config.avoidOptionals,
|
|
39
|
-
this.config.immutableTypes,
|
|
40
|
-
this.config.namespacedImportName,
|
|
41
|
-
[],
|
|
42
|
-
this.config.enumPrefix,
|
|
43
|
-
this.config.enumValues
|
|
44
|
-
)
|
|
45
|
-
);
|
|
46
|
-
if (this.config.useIndexSignature) {
|
|
47
|
-
this._declarationBlockConfig = {
|
|
48
|
-
blockTransformer(block) {
|
|
49
|
-
return `ResolversObject<${block}>`;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
transformParentGenericType(parentType) {
|
|
55
|
-
if (this.config.allowParentTypeOverride) {
|
|
56
|
-
return `ParentType = ${parentType}`;
|
|
57
|
-
}
|
|
58
|
-
return `ParentType extends ${parentType} = ${parentType}`;
|
|
59
|
-
}
|
|
60
|
-
formatRootResolver(schemaTypeName, resolverType, declarationKind) {
|
|
61
|
-
var _a;
|
|
62
|
-
const avoidOptionals = ((_a = this.config.avoidOptionals) == null ? void 0 : _a.resolvers) ?? this.config.avoidOptionals === true;
|
|
63
|
-
return `${schemaTypeName}${avoidOptionals ? "" : "?"}: ${resolverType}${this.getPunctuation(declarationKind)}`;
|
|
64
|
-
}
|
|
65
|
-
clearOptional(str) {
|
|
66
|
-
if (str.startsWith("Maybe")) {
|
|
67
|
-
return str.replace(/Maybe<(.*?)>$/, "$1");
|
|
68
|
-
}
|
|
69
|
-
return str;
|
|
70
|
-
}
|
|
71
|
-
ListType(node) {
|
|
72
|
-
return `Maybe<${super.ListType(node)}>`;
|
|
73
|
-
}
|
|
74
|
-
wrapWithListType(str) {
|
|
75
|
-
return `${this.config.immutableTypes ? "ReadonlyArray" : "Array"}<${str}>`;
|
|
76
|
-
}
|
|
77
|
-
getParentTypeForSignature(node) {
|
|
78
|
-
if (this._federation.isResolveReferenceField(node) && this.config.wrapFieldDefinitions) {
|
|
79
|
-
return "UnwrappedObject<ParentType>";
|
|
80
|
-
}
|
|
81
|
-
return "ParentType";
|
|
82
|
-
}
|
|
83
|
-
NamedType(node) {
|
|
84
|
-
return `Maybe<${super.NamedType(node)}>`;
|
|
85
|
-
}
|
|
86
|
-
NonNullType(node) {
|
|
87
|
-
const baseValue = super.NonNullType(node);
|
|
88
|
-
return this.clearOptional(baseValue);
|
|
89
|
-
}
|
|
90
|
-
getPunctuation(_declarationKind) {
|
|
91
|
-
return ";";
|
|
92
|
-
}
|
|
93
|
-
buildEnumResolverContentBlock(node, mappedEnumType) {
|
|
94
|
-
const valuesMap = `{ ${(node.values || []).map(
|
|
95
|
-
(v) => `${v.name}${this.config.avoidOptionals ? "" : "?"}: any`
|
|
96
|
-
).join(", ")} }`;
|
|
97
|
-
this._globalDeclarations.add(ENUM_RESOLVERS_SIGNATURE);
|
|
98
|
-
return `EnumResolverSignature<${valuesMap}, ${mappedEnumType}>`;
|
|
99
|
-
}
|
|
100
|
-
buildEnumResolversExplicitMappedValues(node, valuesMapping) {
|
|
101
|
-
return `{ ${(node.values || []).map((v) => {
|
|
102
|
-
const valueName = v.name;
|
|
103
|
-
const mappedValue = valuesMapping[valueName];
|
|
104
|
-
return `${valueName}: ${typeof mappedValue === "number" ? mappedValue : `'${mappedValue}'`}`;
|
|
105
|
-
}).join(", ")} }`;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
export {
|
|
109
|
-
ENUM_RESOLVERS_SIGNATURE,
|
|
110
|
-
TypeScriptResolversVisitor
|
|
111
|
-
};
|
package/dist/utils/cache.d.ts
DELETED
package/dist/utils/cache.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var cache_exports = {};
|
|
20
|
-
__export(cache_exports, {
|
|
21
|
-
createCache: () => createCache
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(cache_exports);
|
|
24
|
-
function createCache() {
|
|
25
|
-
const cache = /* @__PURE__ */ new Map();
|
|
26
|
-
return function ensure(namespace, key, factory) {
|
|
27
|
-
const cacheKey = `${namespace}:${key}`;
|
|
28
|
-
const cachedValue = cache.get(cacheKey);
|
|
29
|
-
if (cachedValue) {
|
|
30
|
-
return cachedValue;
|
|
31
|
-
}
|
|
32
|
-
const value = factory();
|
|
33
|
-
cache.set(cacheKey, value);
|
|
34
|
-
return value;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 && (module.exports = {
|
|
39
|
-
createCache
|
|
40
|
-
});
|
package/dist/utils/cache.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
function createCache() {
|
|
2
|
-
const cache = /* @__PURE__ */ new Map();
|
|
3
|
-
return function ensure(namespace, key, factory) {
|
|
4
|
-
const cacheKey = `${namespace}:${key}`;
|
|
5
|
-
const cachedValue = cache.get(cacheKey);
|
|
6
|
-
if (cachedValue) {
|
|
7
|
-
return cachedValue;
|
|
8
|
-
}
|
|
9
|
-
const value = factory();
|
|
10
|
-
cache.set(cacheKey, value);
|
|
11
|
-
return value;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
createCache
|
|
16
|
-
};
|
package/dist/utils/hash.d.ts
DELETED
package/dist/utils/hash.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var hash_exports = {};
|
|
20
|
-
__export(hash_exports, {
|
|
21
|
-
hashContent: () => hashContent,
|
|
22
|
-
hashSchema: () => hashSchema
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(hash_exports);
|
|
25
|
-
var import_plugin_helpers = require("@graphql-codegen/plugin-helpers");
|
|
26
|
-
var import_graphql = require("graphql");
|
|
27
|
-
var import_node_crypto = require("node:crypto");
|
|
28
|
-
function hashContent(content) {
|
|
29
|
-
return (0, import_node_crypto.createHash)("sha256").update(content).digest("hex");
|
|
30
|
-
}
|
|
31
|
-
function hashSchema(schema) {
|
|
32
|
-
return hashContent((0, import_graphql.print)((0, import_plugin_helpers.getCachedDocumentNodeFromSchema)(schema)));
|
|
33
|
-
}
|
|
34
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
-
0 && (module.exports = {
|
|
36
|
-
hashContent,
|
|
37
|
-
hashSchema
|
|
38
|
-
});
|
package/dist/utils/hash.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { getCachedDocumentNodeFromSchema } from "@graphql-codegen/plugin-helpers";
|
|
2
|
-
import { print } from "graphql";
|
|
3
|
-
import { createHash } from "node:crypto";
|
|
4
|
-
function hashContent(content) {
|
|
5
|
-
return createHash("sha256").update(content).digest("hex");
|
|
6
|
-
}
|
|
7
|
-
function hashSchema(schema) {
|
|
8
|
-
return hashContent(print(getCachedDocumentNodeFromSchema(schema)));
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
hashContent,
|
|
12
|
-
hashSchema
|
|
13
|
-
};
|
package/dist/utils/load.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as graphql from 'graphql';
|
|
2
|
-
import { UnnormalizedTypeDefPointer } from '@graphql-tools/load';
|
|
3
|
-
|
|
4
|
-
declare function loadSchema(schemaPointerMap: UnnormalizedTypeDefPointer, cwd: string): Promise<{
|
|
5
|
-
outputSchemaAst: graphql.GraphQLSchema;
|
|
6
|
-
outputSchema: graphql.DocumentNode;
|
|
7
|
-
}>;
|
|
8
|
-
|
|
9
|
-
export { loadSchema };
|
package/dist/utils/load.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var load_exports = {};
|
|
20
|
-
__export(load_exports, {
|
|
21
|
-
loadSchema: () => loadSchema
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(load_exports);
|
|
24
|
-
var import_plugin_helpers = require("@graphql-codegen/plugin-helpers");
|
|
25
|
-
var import_load = require("@graphql-tools/load");
|
|
26
|
-
var import_code_file_loader = require("@graphql-tools/code-file-loader");
|
|
27
|
-
var import_git_loader = require("@graphql-tools/git-loader");
|
|
28
|
-
var import_github_loader = require("@graphql-tools/github-loader");
|
|
29
|
-
var import_graphql_file_loader = require("@graphql-tools/graphql-file-loader");
|
|
30
|
-
var import_json_file_loader = require("@graphql-tools/json-file-loader");
|
|
31
|
-
var import_url_loader = require("@graphql-tools/url-loader");
|
|
32
|
-
var import_apollo_engine_loader = require("@graphql-tools/apollo-engine-loader");
|
|
33
|
-
var import_prisma_loader = require("@graphql-tools/prisma-loader");
|
|
34
|
-
var import_hash = require("./hash");
|
|
35
|
-
async function loadSchema(schemaPointerMap, cwd) {
|
|
36
|
-
const outputSchemaAst = await (0, import_load.loadSchema)(schemaPointerMap, {
|
|
37
|
-
loaders: [
|
|
38
|
-
new import_code_file_loader.CodeFileLoader(),
|
|
39
|
-
new import_git_loader.GitLoader(),
|
|
40
|
-
new import_github_loader.GithubLoader(),
|
|
41
|
-
new import_graphql_file_loader.GraphQLFileLoader(),
|
|
42
|
-
new import_json_file_loader.JsonFileLoader(),
|
|
43
|
-
new import_url_loader.UrlLoader(),
|
|
44
|
-
new import_apollo_engine_loader.ApolloEngineLoader(),
|
|
45
|
-
new import_prisma_loader.PrismaLoader()
|
|
46
|
-
],
|
|
47
|
-
cwd,
|
|
48
|
-
includeSources: true
|
|
49
|
-
});
|
|
50
|
-
if (!outputSchemaAst.extensions) {
|
|
51
|
-
outputSchemaAst.extensions = {};
|
|
52
|
-
}
|
|
53
|
-
outputSchemaAst.extensions["hash"] = (0, import_hash.hashSchema)(outputSchemaAst);
|
|
54
|
-
return {
|
|
55
|
-
outputSchemaAst,
|
|
56
|
-
outputSchema: (0, import_plugin_helpers.getCachedDocumentNodeFromSchema)(outputSchemaAst)
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
-
0 && (module.exports = {
|
|
61
|
-
loadSchema
|
|
62
|
-
});
|
package/dist/utils/load.mjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { getCachedDocumentNodeFromSchema } from "@graphql-codegen/plugin-helpers";
|
|
2
|
-
import {
|
|
3
|
-
loadSchema as loadSchemaToolkit
|
|
4
|
-
} from "@graphql-tools/load";
|
|
5
|
-
import { CodeFileLoader } from "@graphql-tools/code-file-loader";
|
|
6
|
-
import { GitLoader } from "@graphql-tools/git-loader";
|
|
7
|
-
import { GithubLoader } from "@graphql-tools/github-loader";
|
|
8
|
-
import { GraphQLFileLoader } from "@graphql-tools/graphql-file-loader";
|
|
9
|
-
import { JsonFileLoader } from "@graphql-tools/json-file-loader";
|
|
10
|
-
import { UrlLoader } from "@graphql-tools/url-loader";
|
|
11
|
-
import { ApolloEngineLoader } from "@graphql-tools/apollo-engine-loader";
|
|
12
|
-
import { PrismaLoader } from "@graphql-tools/prisma-loader";
|
|
13
|
-
import { hashSchema } from "./hash";
|
|
14
|
-
async function loadSchema(schemaPointerMap, cwd) {
|
|
15
|
-
const outputSchemaAst = await loadSchemaToolkit(schemaPointerMap, {
|
|
16
|
-
loaders: [
|
|
17
|
-
new CodeFileLoader(),
|
|
18
|
-
new GitLoader(),
|
|
19
|
-
new GithubLoader(),
|
|
20
|
-
new GraphQLFileLoader(),
|
|
21
|
-
new JsonFileLoader(),
|
|
22
|
-
new UrlLoader(),
|
|
23
|
-
new ApolloEngineLoader(),
|
|
24
|
-
new PrismaLoader()
|
|
25
|
-
],
|
|
26
|
-
cwd,
|
|
27
|
-
includeSources: true
|
|
28
|
-
});
|
|
29
|
-
if (!outputSchemaAst.extensions) {
|
|
30
|
-
outputSchemaAst.extensions = {};
|
|
31
|
-
}
|
|
32
|
-
outputSchemaAst.extensions["hash"] = hashSchema(outputSchemaAst);
|
|
33
|
-
return {
|
|
34
|
-
outputSchemaAst,
|
|
35
|
-
outputSchema: getCachedDocumentNodeFromSchema(outputSchemaAst)
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
loadSchema
|
|
40
|
-
};
|
package/dist/utils/path.d.ts
DELETED
package/dist/utils/path.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var path_exports = {};
|
|
26
|
-
__export(path_exports, {
|
|
27
|
-
fixPath: () => fixPath
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(path_exports);
|
|
30
|
-
var import_path = __toESM(require("path"));
|
|
31
|
-
function fixPath(root, toFix) {
|
|
32
|
-
return import_path.default.resolve(import_path.default.relative(root, toFix));
|
|
33
|
-
}
|
|
34
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
-
0 && (module.exports = {
|
|
36
|
-
fixPath
|
|
37
|
-
});
|