@graphitation/supermassive 1.1.6 → 2.0.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/.eslintcache +1 -1
- package/CHANGELOG.md +18 -2
- package/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -2
- package/lib/index.mjs +0 -2
- package/package.json +11 -19
- package/bin/supermassive.js +0 -5
- package/lib/bin/supermassive.d.ts +0 -3
- package/lib/bin/supermassive.d.ts.map +0 -1
- package/lib/bin/supermassive.js +0 -133
- package/lib/bin/supermassive.mjs +0 -113
- package/lib/codegen/context/expect.d.ts +0 -1
- package/lib/codegen/context/expect.d.ts.map +0 -1
- package/lib/codegen/context/expect.js +0 -0
- package/lib/codegen/context/expect.mjs +0 -0
- package/lib/codegen/context/import.d.ts +0 -5
- package/lib/codegen/context/import.d.ts.map +0 -1
- package/lib/codegen/context/import.js +0 -55
- package/lib/codegen/context/import.mjs +0 -37
- package/lib/codegen/context/index.d.ts +0 -52
- package/lib/codegen/context/index.d.ts.map +0 -1
- package/lib/codegen/context/index.js +0 -253
- package/lib/codegen/context/index.mjs +0 -242
- package/lib/codegen/context/model.d.ts +0 -5
- package/lib/codegen/context/model.d.ts.map +0 -1
- package/lib/codegen/context/model.js +0 -53
- package/lib/codegen/context/model.mjs +0 -37
- package/lib/codegen/context/utilities.d.ts +0 -2
- package/lib/codegen/context/utilities.d.ts.map +0 -1
- package/lib/codegen/context/utilities.js +0 -26
- package/lib/codegen/context/utilities.mjs +0 -8
- package/lib/codegen/index.d.ts +0 -7
- package/lib/codegen/index.d.ts.map +0 -1
- package/lib/codegen/index.js +0 -41
- package/lib/codegen/index.mjs +0 -23
- package/lib/codegen/models.d.ts +0 -5
- package/lib/codegen/models.d.ts.map +0 -1
- package/lib/codegen/models.js +0 -159
- package/lib/codegen/models.mjs +0 -142
- package/lib/codegen/resolvers.d.ts +0 -5
- package/lib/codegen/resolvers.d.ts.map +0 -1
- package/lib/codegen/resolvers.js +0 -157
- package/lib/codegen/resolvers.mjs +0 -144
- package/lib/codegen/typedVisitor.d.ts +0 -57
- package/lib/codegen/typedVisitor.d.ts.map +0 -1
- package/lib/codegen/typedVisitor.js +0 -26
- package/lib/codegen/typedVisitor.mjs +0 -8
- package/lib/codegen/types.d.ts +0 -18
- package/lib/codegen/types.d.ts.map +0 -1
- package/lib/codegen/types.js +0 -15
- package/lib/codegen/types.mjs +0 -0
- package/lib/codegen/utilities.d.ts +0 -50
- package/lib/codegen/utilities.d.ts.map +0 -1
- package/lib/codegen/utilities.js +0 -193
- package/lib/codegen/utilities.mjs +0 -175
- package/lib/extractors/extractImplicitTypesToTypescript.d.ts +0 -4
- package/lib/extractors/extractImplicitTypesToTypescript.d.ts.map +0 -1
- package/lib/extractors/extractImplicitTypesToTypescript.js +0 -217
- package/lib/extractors/extractImplicitTypesToTypescript.mjs +0 -198
- package/lib/extractors/index.d.ts +0 -2
- package/lib/extractors/index.d.ts.map +0 -1
- package/lib/extractors/index.js +0 -23
- package/lib/extractors/index.mjs +0 -5
- package/lib/transforms/transformerTestUtils.d.ts +0 -79
- package/lib/transforms/transformerTestUtils.d.ts.map +0 -1
- package/lib/transforms/transformerTestUtils.js +0 -174
- package/lib/transforms/transformerTestUtils.mjs +0 -156
package/lib/codegen/resolvers.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
var resolvers_exports = {};
|
|
22
|
-
__export(resolvers_exports, {
|
|
23
|
-
generateResolvers: () => generateResolvers
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(resolvers_exports);
|
|
26
|
-
var import_typescript = __toESM(require("typescript"));
|
|
27
|
-
var import_graphql = require("graphql");
|
|
28
|
-
var import_typedVisitor = require("./typedVisitor");
|
|
29
|
-
var import_utilities = require("./utilities");
|
|
30
|
-
function generateResolvers(context, document) {
|
|
31
|
-
return (0, import_typedVisitor.visit)(document, createResolversReducer(context));
|
|
32
|
-
}
|
|
33
|
-
function createResolversReducer(context) {
|
|
34
|
-
return {
|
|
35
|
-
Document: {
|
|
36
|
-
leave(node) {
|
|
37
|
-
const imports = context.getAllResolverImportDeclarations();
|
|
38
|
-
const statements = node.definitions;
|
|
39
|
-
return import_typescript.factory.createSourceFile(imports.concat(statements.flat()), import_typescript.factory.createToken(import_typescript.default.SyntaxKind.EndOfFileToken), import_typescript.default.NodeFlags.None);
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
SchemaExtension: {
|
|
43
|
-
leave() {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
ObjectTypeDefinition: {
|
|
48
|
-
leave(node) {
|
|
49
|
-
return import_typescript.factory.createModuleDeclaration(void 0, [
|
|
50
|
-
import_typescript.factory.createModifier(import_typescript.default.SyntaxKind.ExportKeyword),
|
|
51
|
-
import_typescript.factory.createModifier(import_typescript.default.SyntaxKind.DeclareKeyword)
|
|
52
|
-
], import_typescript.factory.createIdentifier(node.name), import_typescript.factory.createModuleBlock(node.fields || []), import_typescript.default.NodeFlags.Namespace);
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
ObjectTypeExtension: {
|
|
56
|
-
leave(node) {
|
|
57
|
-
return import_typescript.factory.createModuleDeclaration(void 0, [
|
|
58
|
-
import_typescript.factory.createModifier(import_typescript.default.SyntaxKind.ExportKeyword),
|
|
59
|
-
import_typescript.factory.createModifier(import_typescript.default.SyntaxKind.DeclareKeyword)
|
|
60
|
-
], import_typescript.factory.createIdentifier(node.name), import_typescript.factory.createModuleBlock(node.fields || []), import_typescript.default.NodeFlags.Namespace);
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
FieldDefinition: {
|
|
64
|
-
leave(node, _a, _p, _path, ancestors) {
|
|
65
|
-
const parentObject = ancestors[ancestors.length - 1];
|
|
66
|
-
if (!("kind" in parentObject && ((0, import_graphql.isTypeDefinitionNode)(parentObject) || (0, import_graphql.isTypeExtensionNode)(parentObject)))) {
|
|
67
|
-
throw new Error("Invalid parent for field");
|
|
68
|
-
}
|
|
69
|
-
const parentName = parentObject.name.value;
|
|
70
|
-
let modelIdentifier;
|
|
71
|
-
if (["Query", "Mutation", "Subscription"].includes(parentName)) {
|
|
72
|
-
modelIdentifier = import_typescript.factory.createKeywordTypeNode(import_typescript.default.SyntaxKind.UnknownKeyword);
|
|
73
|
-
} else if (parentObject.kind !== import_graphql.Kind.INTERFACE_TYPE_DEFINITION) {
|
|
74
|
-
modelIdentifier = context.getModelType(parentName).toTypeReference();
|
|
75
|
-
}
|
|
76
|
-
const resolverParametersDefinitions = {
|
|
77
|
-
parent: {
|
|
78
|
-
name: "model",
|
|
79
|
-
type: modelIdentifier
|
|
80
|
-
},
|
|
81
|
-
args: { name: "args", type: node.arguments || [] },
|
|
82
|
-
context: {
|
|
83
|
-
name: "context",
|
|
84
|
-
type: context.getContextType().toTypeReference()
|
|
85
|
-
},
|
|
86
|
-
resolveInfo: {
|
|
87
|
-
name: "info",
|
|
88
|
-
type: context.getResolveInfoType().toTypeReference()
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
return import_typescript.factory.createTypeAliasDeclaration(void 0, [import_typescript.factory.createModifier(import_typescript.default.SyntaxKind.ExportKeyword)], import_typescript.factory.createIdentifier(node.name), parentName === "Subscription" ? [
|
|
92
|
-
import_typescript.factory.createTypeParameterDeclaration(import_typescript.factory.createIdentifier("A"), void 0, import_typescript.factory.createKeywordTypeNode(import_typescript.default.SyntaxKind.UnknownKeyword))
|
|
93
|
-
] : void 0, (0, import_utilities.getResolverReturnType)(node.type, parentName, resolverParametersDefinitions));
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
NamedType: {
|
|
97
|
-
leave(node, _a, _p, _path) {
|
|
98
|
-
return (0, import_utilities.createNullableType)(context.getModelType(node.name, true).toTypeReference());
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
ListType: {
|
|
102
|
-
leave({ type }) {
|
|
103
|
-
return (0, import_utilities.createNullableType)(import_typescript.factory.createArrayTypeNode(type));
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
NonNullType: {
|
|
107
|
-
leave({ type }) {
|
|
108
|
-
return (0, import_utilities.createNonNullableType)(type);
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
Name: {
|
|
112
|
-
leave(node) {
|
|
113
|
-
return node.value;
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
Directive: {
|
|
117
|
-
leave() {
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
InputValueDefinition: {
|
|
122
|
-
leave(node) {
|
|
123
|
-
return import_typescript.factory.createPropertySignature(void 0, node.name, void 0, node.type);
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
InputObjectTypeDefinition: {
|
|
127
|
-
leave(node) {
|
|
128
|
-
return import_typescript.factory.createTypeAliasDeclaration(void 0, [import_typescript.factory.createModifier(import_typescript.default.SyntaxKind.ExportKeyword)], node.name, void 0, import_typescript.factory.createTypeLiteralNode(node.fields || []));
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
UnionTypeDefinition: {
|
|
132
|
-
leave() {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
EnumTypeDefinition: {
|
|
137
|
-
leave() {
|
|
138
|
-
return null;
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
InterfaceTypeDefinition: {
|
|
142
|
-
leave() {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
DirectiveDefinition: {
|
|
147
|
-
leave() {
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
ScalarTypeDefinition: {
|
|
152
|
-
leave() {
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
// src/codegen/resolvers.ts
|
|
2
|
-
import ts, { factory } from "typescript";
|
|
3
|
-
import {
|
|
4
|
-
isTypeDefinitionNode,
|
|
5
|
-
isTypeExtensionNode,
|
|
6
|
-
Kind
|
|
7
|
-
} from "graphql";
|
|
8
|
-
import { visit } from "./typedVisitor.mjs";
|
|
9
|
-
import {
|
|
10
|
-
createNullableType,
|
|
11
|
-
createNonNullableType,
|
|
12
|
-
getResolverReturnType
|
|
13
|
-
} from "./utilities.mjs";
|
|
14
|
-
function generateResolvers(context, document) {
|
|
15
|
-
return visit(document, createResolversReducer(context));
|
|
16
|
-
}
|
|
17
|
-
function createResolversReducer(context) {
|
|
18
|
-
return {
|
|
19
|
-
Document: {
|
|
20
|
-
leave(node) {
|
|
21
|
-
const imports = context.getAllResolverImportDeclarations();
|
|
22
|
-
const statements = node.definitions;
|
|
23
|
-
return factory.createSourceFile(imports.concat(statements.flat()), factory.createToken(ts.SyntaxKind.EndOfFileToken), ts.NodeFlags.None);
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
SchemaExtension: {
|
|
27
|
-
leave() {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
ObjectTypeDefinition: {
|
|
32
|
-
leave(node) {
|
|
33
|
-
return factory.createModuleDeclaration(void 0, [
|
|
34
|
-
factory.createModifier(ts.SyntaxKind.ExportKeyword),
|
|
35
|
-
factory.createModifier(ts.SyntaxKind.DeclareKeyword)
|
|
36
|
-
], factory.createIdentifier(node.name), factory.createModuleBlock(node.fields || []), ts.NodeFlags.Namespace);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
ObjectTypeExtension: {
|
|
40
|
-
leave(node) {
|
|
41
|
-
return factory.createModuleDeclaration(void 0, [
|
|
42
|
-
factory.createModifier(ts.SyntaxKind.ExportKeyword),
|
|
43
|
-
factory.createModifier(ts.SyntaxKind.DeclareKeyword)
|
|
44
|
-
], factory.createIdentifier(node.name), factory.createModuleBlock(node.fields || []), ts.NodeFlags.Namespace);
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
FieldDefinition: {
|
|
48
|
-
leave(node, _a, _p, _path, ancestors) {
|
|
49
|
-
const parentObject = ancestors[ancestors.length - 1];
|
|
50
|
-
if (!("kind" in parentObject && (isTypeDefinitionNode(parentObject) || isTypeExtensionNode(parentObject)))) {
|
|
51
|
-
throw new Error("Invalid parent for field");
|
|
52
|
-
}
|
|
53
|
-
const parentName = parentObject.name.value;
|
|
54
|
-
let modelIdentifier;
|
|
55
|
-
if (["Query", "Mutation", "Subscription"].includes(parentName)) {
|
|
56
|
-
modelIdentifier = factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword);
|
|
57
|
-
} else if (parentObject.kind !== Kind.INTERFACE_TYPE_DEFINITION) {
|
|
58
|
-
modelIdentifier = context.getModelType(parentName).toTypeReference();
|
|
59
|
-
}
|
|
60
|
-
const resolverParametersDefinitions = {
|
|
61
|
-
parent: {
|
|
62
|
-
name: "model",
|
|
63
|
-
type: modelIdentifier
|
|
64
|
-
},
|
|
65
|
-
args: { name: "args", type: node.arguments || [] },
|
|
66
|
-
context: {
|
|
67
|
-
name: "context",
|
|
68
|
-
type: context.getContextType().toTypeReference()
|
|
69
|
-
},
|
|
70
|
-
resolveInfo: {
|
|
71
|
-
name: "info",
|
|
72
|
-
type: context.getResolveInfoType().toTypeReference()
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
return factory.createTypeAliasDeclaration(void 0, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier(node.name), parentName === "Subscription" ? [
|
|
76
|
-
factory.createTypeParameterDeclaration(factory.createIdentifier("A"), void 0, factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword))
|
|
77
|
-
] : void 0, getResolverReturnType(node.type, parentName, resolverParametersDefinitions));
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
NamedType: {
|
|
81
|
-
leave(node, _a, _p, _path) {
|
|
82
|
-
return createNullableType(context.getModelType(node.name, true).toTypeReference());
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
ListType: {
|
|
86
|
-
leave({ type }) {
|
|
87
|
-
return createNullableType(factory.createArrayTypeNode(type));
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
NonNullType: {
|
|
91
|
-
leave({ type }) {
|
|
92
|
-
return createNonNullableType(type);
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
Name: {
|
|
96
|
-
leave(node) {
|
|
97
|
-
return node.value;
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
Directive: {
|
|
101
|
-
leave() {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
InputValueDefinition: {
|
|
106
|
-
leave(node) {
|
|
107
|
-
return factory.createPropertySignature(void 0, node.name, void 0, node.type);
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
InputObjectTypeDefinition: {
|
|
111
|
-
leave(node) {
|
|
112
|
-
return factory.createTypeAliasDeclaration(void 0, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], node.name, void 0, factory.createTypeLiteralNode(node.fields || []));
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
UnionTypeDefinition: {
|
|
116
|
-
leave() {
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
EnumTypeDefinition: {
|
|
121
|
-
leave() {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
InterfaceTypeDefinition: {
|
|
126
|
-
leave() {
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
DirectiveDefinition: {
|
|
131
|
-
leave() {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
ScalarTypeDefinition: {
|
|
136
|
-
leave() {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
export {
|
|
143
|
-
generateResolvers
|
|
144
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { ASTNode } from "graphql";
|
|
2
|
-
/**
|
|
3
|
-
* Hack GraphQL Visitor to have better type safety.
|
|
4
|
-
*
|
|
5
|
-
* You can provide type that defines how reducer of visitor converts type (becomes return type
|
|
6
|
-
* of leave) and how are fields converted (becomes fields on the node).
|
|
7
|
-
*/
|
|
8
|
-
export declare type ReducerResultMap<T> = {
|
|
9
|
-
[NodeT in ASTNode as NodeT["kind"]]?: T | T[] | null;
|
|
10
|
-
};
|
|
11
|
-
export declare type ReducerFieldMap<T> = {
|
|
12
|
-
[NodeT in ASTNode as NodeT["kind"]]?: {
|
|
13
|
-
[K in keyof NodeT]?: T | T[] | null;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export declare type ASTReducer<T, TR extends ReducerResultMap<T>, TRF extends ReducerFieldMap<T>> = {
|
|
17
|
-
readonly [NodeT in ASTNode as NodeT["kind"]]?: {
|
|
18
|
-
readonly enter?: ASTVisitFn<NodeT>;
|
|
19
|
-
readonly leave: ASTReducerFn<NodeT, TR[NodeT["kind"]], TRF[NodeT["kind"]]>;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
declare type ASTReducerFn<TReducedNode extends ASTNode, TResult, TReducerMap> = (
|
|
23
|
-
/** The current node being visiting. */
|
|
24
|
-
node: {
|
|
25
|
-
[K in keyof TReducedNode]: ReducedField<TReducedNode[K], TReducerMap extends undefined ? undefined : K extends keyof TReducerMap ? TReducerMap[K] extends undefined ? undefined : TReducerMap[K] : undefined>;
|
|
26
|
-
},
|
|
27
|
-
/** The index or key to this node from the parent node or Array. */
|
|
28
|
-
key: string | number | undefined,
|
|
29
|
-
/** The parent immediately above this node, which may be an Array. */
|
|
30
|
-
parent: ASTNode | ReadonlyArray<ASTNode> | undefined,
|
|
31
|
-
/** The key path to get to this node from the root node. */
|
|
32
|
-
path: ReadonlyArray<string | number>,
|
|
33
|
-
/**
|
|
34
|
-
* All nodes and Arrays visited before reaching parent of this node.
|
|
35
|
-
* These correspond to array indices in `path`.
|
|
36
|
-
* Note: ancestors includes arrays which contain the parent of visited node.
|
|
37
|
-
*/
|
|
38
|
-
ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>) => TResult;
|
|
39
|
-
declare type ReducedField<T, R> = R extends undefined ? T : T extends null | undefined ? T : T extends ReadonlyArray<any> ? ReadonlyArray<R> : R;
|
|
40
|
-
export declare type ASTVisitFn<TVisitedNode extends ASTNode> = (
|
|
41
|
-
/** The current node being visiting. */
|
|
42
|
-
node: TVisitedNode,
|
|
43
|
-
/** The index or key to this node from the parent node or Array. */
|
|
44
|
-
key: string | number | undefined,
|
|
45
|
-
/** The parent immediately above this node, which may be an Array. */
|
|
46
|
-
parent: ASTNode | ReadonlyArray<ASTNode> | undefined,
|
|
47
|
-
/** The key path to get to this node from the root node. */
|
|
48
|
-
path: ReadonlyArray<string | number>,
|
|
49
|
-
/**
|
|
50
|
-
* All nodes and Arrays visited before reaching parent of this node.
|
|
51
|
-
* These correspond to array indices in `path`.
|
|
52
|
-
* Note: ancestors includes arrays which contain the parent of visited node.
|
|
53
|
-
*/
|
|
54
|
-
ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>) => any;
|
|
55
|
-
export declare function visit<T, TR, TTR>(root: ASTNode, visitor: ASTReducer<T, TR, TTR>): T;
|
|
56
|
-
export {};
|
|
57
|
-
//# sourceMappingURL=typedVisitor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typedVisitor.d.ts","sourceRoot":"","sources":["../../src/codegen/typedVisitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA2B,MAAM,SAAS,CAAC;AAE3D;;;;;GAKG;AAEH,oBAAY,gBAAgB,CAAC,CAAC,IAAI;KAC/B,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI;CACrD,CAAC;AAEF,oBAAY,eAAe,CAAC,CAAC,IAAI;KAC9B,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;SACnC,CAAC,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI;KACpC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,MAAM,UAAU,CAC5B,CAAC,EACD,EAAE,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAC9B,GAAG,SAAS,eAAe,CAAC,CAAC,CAAC,IAC5B;IACF,QAAQ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AM,UAAU,CAAC,YAAY,SAAS,OAAO,IAAI;AAC7D,uCAAuC;AACvC,IAAI,EAAE,YAAY;AAClB,mEAAmE;AACnE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;AAChC,qEAAqE;AACrE,MAAM,EAAE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,SAAS;AACpD,2DAA2D;AAC3D,IAAI,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC;AACpC;;;;GAIG;AACH,SAAS,EAAE,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,KACvD,GAAG,CAAC;AAET,wBAAgB,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAC9B,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,GAC9B,CAAC,CAEH"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var typedVisitor_exports = {};
|
|
19
|
-
__export(typedVisitor_exports, {
|
|
20
|
-
visit: () => visit
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(typedVisitor_exports);
|
|
23
|
-
var import_graphql = require("graphql");
|
|
24
|
-
function visit(root, visitor) {
|
|
25
|
-
return (0, import_graphql.visit)(root, visitor);
|
|
26
|
-
}
|
package/lib/codegen/types.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DirectiveNode } from "graphql";
|
|
2
|
-
export declare type DefinitionImport = {
|
|
3
|
-
from: string;
|
|
4
|
-
defs: {
|
|
5
|
-
typeName: string;
|
|
6
|
-
}[];
|
|
7
|
-
importName: string;
|
|
8
|
-
directive: DirectiveNode;
|
|
9
|
-
};
|
|
10
|
-
export declare type DefinitionModel = {
|
|
11
|
-
typeName: string;
|
|
12
|
-
modelName: string;
|
|
13
|
-
tsType: string;
|
|
14
|
-
from: string | null;
|
|
15
|
-
importName: string | null;
|
|
16
|
-
directive: DirectiveNode;
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/codegen/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC"}
|
package/lib/codegen/types.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var types_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(types_exports);
|
package/lib/codegen/types.mjs
DELETED
|
File without changes
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
export declare function createNullableType(node: ts.TypeNode): ts.UnionTypeNode;
|
|
3
|
-
declare type ResolverParameterDefinition<T> = {
|
|
4
|
-
name: string;
|
|
5
|
-
type: T;
|
|
6
|
-
};
|
|
7
|
-
declare type ResolverParametersDefinitions = {
|
|
8
|
-
parent: ResolverParameterDefinition<ts.TypeReferenceNode>;
|
|
9
|
-
args: ResolverParameterDefinition<readonly ts.TypeElement[]>;
|
|
10
|
-
context: ResolverParameterDefinition<ts.TypeReferenceNode>;
|
|
11
|
-
resolveInfo: ResolverParameterDefinition<ts.TypeReferenceNode>;
|
|
12
|
-
};
|
|
13
|
-
export declare function getResolverParameters({ parent, args, context, resolveInfo, }: ResolverParametersDefinitions): ts.ParameterDeclaration[];
|
|
14
|
-
export declare function getResolverReturnType(typeNode: ts.TypeNode, parentName: string, resolverParametersDefinitions: ResolverParametersDefinitions): ts.FunctionTypeNode | ts.UnionTypeNode;
|
|
15
|
-
export declare function createNonNullableType(node: ts.TypeNode): ts.TypeNode;
|
|
16
|
-
export declare function addModelSuffix(typeName: string): string;
|
|
17
|
-
export declare function createVariableNameFromImport(path: string): string;
|
|
18
|
-
export declare type CamelCaseOptions = {
|
|
19
|
-
/**
|
|
20
|
-
Uppercase the first character: `foo-bar` → `FooBar`.
|
|
21
|
-
@default false
|
|
22
|
-
*/
|
|
23
|
-
readonly pascalCase?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
Preserve consecutive uppercase characters: `foo-BAR` → `FooBAR`.
|
|
26
|
-
@default false
|
|
27
|
-
*/
|
|
28
|
-
readonly preserveConsecutiveUppercase?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
The locale parameter indicates the locale to be used to convert to upper/lower case according to any locale-specific case mappings. If multiple locales are given in an array, the best available locale is used.
|
|
31
|
-
Setting `locale: false` ignores the platform locale and uses the [Unicode Default Case Conversion](https://unicode-org.github.io/icu/userguide/transforms/casemappings.html#simple-single-character-case-mapping) algorithm.
|
|
32
|
-
Default: The host environment’s current locale.
|
|
33
|
-
@example
|
|
34
|
-
```
|
|
35
|
-
import camelCase from 'camelcase';
|
|
36
|
-
camelCase('lorem-ipsum', {locale: 'en-US'});
|
|
37
|
-
//=> 'loremIpsum'
|
|
38
|
-
camelCase('lorem-ipsum', {locale: 'tr-TR'});
|
|
39
|
-
//=> 'loremİpsum'
|
|
40
|
-
camelCase('lorem-ipsum', {locale: ['en-US', 'en-GB']});
|
|
41
|
-
//=> 'loremIpsum'
|
|
42
|
-
camelCase('lorem-ipsum', {locale: ['tr', 'TR', 'tr-TR']});
|
|
43
|
-
//=> 'loremİpsum'
|
|
44
|
-
```
|
|
45
|
-
*/
|
|
46
|
-
readonly locale?: false | string | readonly string[];
|
|
47
|
-
};
|
|
48
|
-
export declare function camelCase(input: string | readonly string[], options: CamelCaseOptions): string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