@graphitation/supermassive 1.0.0 → 1.1.1
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 -0
- package/CHANGELOG.md +18 -2
- package/lib/bin/supermassive.d.ts.map +1 -1
- package/lib/bin/supermassive.js +48 -4
- package/lib/bin/supermassive.mjs +48 -4
- package/lib/codegen/context/expect.d.ts +1 -0
- package/lib/codegen/context/expect.d.ts.map +1 -0
- package/lib/codegen/context/expect.js +0 -0
- package/lib/codegen/context/expect.mjs +0 -0
- package/lib/codegen/context/import.d.ts +5 -0
- package/lib/codegen/context/import.d.ts.map +1 -0
- package/lib/codegen/context/import.js +55 -0
- package/lib/codegen/context/import.mjs +37 -0
- package/lib/codegen/context/index.d.ts +52 -0
- package/lib/codegen/context/index.d.ts.map +1 -0
- package/lib/codegen/context/index.js +253 -0
- package/lib/codegen/context/index.mjs +242 -0
- package/lib/codegen/context/model.d.ts +5 -0
- package/lib/codegen/context/model.d.ts.map +1 -0
- package/lib/codegen/context/model.js +53 -0
- package/lib/codegen/context/model.mjs +37 -0
- package/lib/codegen/context/utilities.d.ts +2 -0
- package/lib/codegen/context/utilities.d.ts.map +1 -0
- package/lib/codegen/context/utilities.js +26 -0
- package/lib/codegen/context/utilities.mjs +8 -0
- package/lib/codegen/index.d.ts +7 -0
- package/lib/codegen/index.d.ts.map +1 -0
- package/lib/codegen/index.js +41 -0
- package/lib/codegen/index.mjs +23 -0
- package/lib/codegen/models.d.ts +5 -0
- package/lib/codegen/models.d.ts.map +1 -0
- package/lib/codegen/models.js +159 -0
- package/lib/codegen/models.mjs +142 -0
- package/lib/codegen/resolvers.d.ts +5 -0
- package/lib/codegen/resolvers.d.ts.map +1 -0
- package/lib/codegen/resolvers.js +155 -0
- package/lib/codegen/resolvers.mjs +143 -0
- package/lib/codegen/typedVisitor.d.ts +57 -0
- package/lib/codegen/typedVisitor.d.ts.map +1 -0
- package/lib/codegen/typedVisitor.js +26 -0
- package/lib/codegen/typedVisitor.mjs +8 -0
- package/lib/codegen/types.d.ts +18 -0
- package/lib/codegen/types.d.ts.map +1 -0
- package/lib/codegen/types.js +15 -0
- package/lib/codegen/types.mjs +0 -0
- package/lib/codegen/utilities.d.ts +50 -0
- package/lib/codegen/utilities.d.ts.map +1 -0
- package/lib/codegen/utilities.js +192 -0
- package/lib/codegen/utilities.mjs +174 -0
- package/lib/{extractImplicitTypesToTypescript.d.ts → extractors/extractImplicitTypesToTypescript.d.ts} +0 -0
- package/lib/extractors/extractImplicitTypesToTypescript.d.ts.map +1 -0
- package/lib/{extractImplicitTypesToTypescript.js → extractors/extractImplicitTypesToTypescript.js} +0 -0
- package/lib/{extractImplicitTypesToTypescript.mjs → extractors/extractImplicitTypesToTypescript.mjs} +1 -1
- package/lib/extractors/index.d.ts +1 -1
- package/lib/extractors/index.d.ts.map +1 -1
- package/lib/extractors/index.js +1 -1
- package/lib/extractors/index.mjs +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.mjs +2 -0
- package/lib/utilities/blankGraphQLTag.d.ts +2 -0
- package/lib/utilities/blankGraphQLTag.d.ts.map +1 -0
- package/lib/utilities/blankGraphQLTag.js +25 -0
- package/lib/utilities/blankGraphQLTag.mjs +7 -0
- package/package.json +1 -1
- package/lib/extractImplicitTypesToTypescript.d.ts.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,CA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MAAM,CAAC,OAAO,MAAM,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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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);
|
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
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.TypeReferenceNode | 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;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=utilities.d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B,CAAC,EAAE,OAAO,CAAC;IAEhD;;;;;;;;;;;;;;;;QAgBC;IACD,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;CACtD,CAAC;AAEF,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EACjC,OAAO,EAAE,gBAAgB,UA8D1B"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
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));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var utilities_exports = {};
|
|
39
|
+
__export(utilities_exports, {
|
|
40
|
+
addModelSuffix: () => addModelSuffix,
|
|
41
|
+
camelCase: () => camelCase,
|
|
42
|
+
createNonNullableType: () => createNonNullableType,
|
|
43
|
+
createNullableType: () => createNullableType,
|
|
44
|
+
createVariableNameFromImport: () => createVariableNameFromImport,
|
|
45
|
+
getResolverParameters: () => getResolverParameters,
|
|
46
|
+
getResolverReturnType: () => getResolverReturnType
|
|
47
|
+
});
|
|
48
|
+
module.exports = __toCommonJS(utilities_exports);
|
|
49
|
+
var import_typescript = __toESM(require("typescript"));
|
|
50
|
+
const MODEL_SUFFIX = "Model";
|
|
51
|
+
function createNullableType(node) {
|
|
52
|
+
return import_typescript.factory.createUnionTypeNode([
|
|
53
|
+
node,
|
|
54
|
+
import_typescript.factory.createLiteralTypeNode(import_typescript.factory.createNull())
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
function getResolverParameters({
|
|
58
|
+
parent,
|
|
59
|
+
args,
|
|
60
|
+
context,
|
|
61
|
+
resolveInfo
|
|
62
|
+
}) {
|
|
63
|
+
return [
|
|
64
|
+
import_typescript.factory.createParameterDeclaration(void 0, void 0, void 0, import_typescript.factory.createIdentifier(parent.name), void 0, parent.type),
|
|
65
|
+
import_typescript.factory.createParameterDeclaration(void 0, void 0, void 0, import_typescript.factory.createIdentifier(args.name), void 0, import_typescript.factory.createTypeLiteralNode(args.type)),
|
|
66
|
+
import_typescript.factory.createParameterDeclaration(void 0, void 0, void 0, import_typescript.factory.createIdentifier(context.name), void 0, context.type),
|
|
67
|
+
import_typescript.factory.createParameterDeclaration(void 0, void 0, void 0, import_typescript.factory.createIdentifier(resolveInfo.name), void 0, resolveInfo.type)
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
function getResolverReturnType(typeNode, parentName, resolverParametersDefinitions) {
|
|
71
|
+
if (parentName !== "Subscription") {
|
|
72
|
+
return import_typescript.factory.createTypeReferenceNode(import_typescript.factory.createIdentifier("PromiseOrValue"), [typeNode]);
|
|
73
|
+
}
|
|
74
|
+
return import_typescript.factory.createUnionTypeNode([
|
|
75
|
+
import_typescript.factory.createTypeReferenceNode(import_typescript.factory.createIdentifier("AsyncIterator"), [
|
|
76
|
+
typeNode
|
|
77
|
+
]),
|
|
78
|
+
import_typescript.factory.createFunctionTypeNode([import_typescript.factory.createTypeParameterDeclaration(import_typescript.factory.createIdentifier("A"))], [], import_typescript.factory.createTypeLiteralNode([
|
|
79
|
+
import_typescript.factory.createPropertySignature(void 0, import_typescript.factory.createIdentifier("subscribe"), void 0, import_typescript.factory.createFunctionTypeNode(void 0, getResolverParameters(resolverParametersDefinitions), import_typescript.factory.createTypeReferenceNode(import_typescript.factory.createIdentifier("AsyncIterator"), [import_typescript.factory.createTypeReferenceNode(import_typescript.factory.createIdentifier("A"))]))),
|
|
80
|
+
import_typescript.factory.createPropertySignature(void 0, import_typescript.factory.createIdentifier("resolve"), void 0, import_typescript.factory.createFunctionTypeNode(void 0, getResolverParameters(__spreadProps(__spreadValues({}, resolverParametersDefinitions), {
|
|
81
|
+
parent: {
|
|
82
|
+
name: "parent",
|
|
83
|
+
type: import_typescript.factory.createTypeReferenceNode(import_typescript.factory.createIdentifier("A"))
|
|
84
|
+
}
|
|
85
|
+
})), typeNode))
|
|
86
|
+
]))
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
function createNonNullableType(node) {
|
|
90
|
+
if (import_typescript.default.isUnionTypeNode(node)) {
|
|
91
|
+
return node.types[0];
|
|
92
|
+
} else {
|
|
93
|
+
throw new Error(`Can't make type non nullable: ${node}.`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function addModelSuffix(typeName) {
|
|
97
|
+
if (typeName.endsWith(MODEL_SUFFIX)) {
|
|
98
|
+
return typeName;
|
|
99
|
+
}
|
|
100
|
+
return `${typeName}${MODEL_SUFFIX}`;
|
|
101
|
+
}
|
|
102
|
+
function createVariableNameFromImport(path) {
|
|
103
|
+
return camelCase(path.replace(/\.\.\//g, "up-").replace(/@/g, "NS-").replace(/\.\//g, "cwd-").replace(/\//g, "-"), {
|
|
104
|
+
pascalCase: true,
|
|
105
|
+
preserveConsecutiveUppercase: true
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
const UPPERCASE = /[\p{Lu}]/u;
|
|
109
|
+
const LOWERCASE = /[\p{Ll}]/u;
|
|
110
|
+
const LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
|
111
|
+
const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
112
|
+
const SEPARATORS = /[_.\- ]+/;
|
|
113
|
+
const LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
114
|
+
const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
115
|
+
const NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
116
|
+
const preserveCamelCase = (string, toLowerCase, toUpperCase) => {
|
|
117
|
+
let isLastCharLower = false;
|
|
118
|
+
let isLastCharUpper = false;
|
|
119
|
+
let isLastLastCharUpper = false;
|
|
120
|
+
for (let index = 0; index < string.length; index++) {
|
|
121
|
+
const character = string[index];
|
|
122
|
+
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
123
|
+
string = string.slice(0, index) + "-" + string.slice(index);
|
|
124
|
+
isLastCharLower = false;
|
|
125
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
126
|
+
isLastCharUpper = true;
|
|
127
|
+
index++;
|
|
128
|
+
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character)) {
|
|
129
|
+
string = string.slice(0, index - 1) + "-" + string.slice(index - 1);
|
|
130
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
131
|
+
isLastCharUpper = false;
|
|
132
|
+
isLastCharLower = true;
|
|
133
|
+
} else {
|
|
134
|
+
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
|
135
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
136
|
+
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return string;
|
|
140
|
+
};
|
|
141
|
+
const preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
142
|
+
LEADING_CAPITAL.lastIndex = 0;
|
|
143
|
+
return input.replace(LEADING_CAPITAL, (m1) => toLowerCase(m1));
|
|
144
|
+
};
|
|
145
|
+
const postProcess = (input, toUpperCase) => {
|
|
146
|
+
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
147
|
+
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
148
|
+
return input.replace(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier)).replace(NUMBERS_AND_IDENTIFIER, (m) => toUpperCase(m));
|
|
149
|
+
};
|
|
150
|
+
function camelCase(input, options) {
|
|
151
|
+
if (!(typeof input === "string" || Array.isArray(input))) {
|
|
152
|
+
throw new TypeError("Expected the input to be `string | string[]`");
|
|
153
|
+
}
|
|
154
|
+
options = __spreadValues({
|
|
155
|
+
pascalCase: false,
|
|
156
|
+
preserveConsecutiveUppercase: false
|
|
157
|
+
}, options);
|
|
158
|
+
if (Array.isArray(input)) {
|
|
159
|
+
input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
|
160
|
+
} else {
|
|
161
|
+
input = input.trim();
|
|
162
|
+
}
|
|
163
|
+
if (input.length === 0) {
|
|
164
|
+
return "";
|
|
165
|
+
}
|
|
166
|
+
let locale = options.locale;
|
|
167
|
+
let toLowerCase;
|
|
168
|
+
let toUpperCase;
|
|
169
|
+
if (locale === false) {
|
|
170
|
+
toLowerCase = (s) => s.toLowerCase();
|
|
171
|
+
toUpperCase = (s) => s.toUpperCase();
|
|
172
|
+
} else {
|
|
173
|
+
toLowerCase = (s) => s.toLocaleLowerCase(locale);
|
|
174
|
+
toUpperCase = (s) => s.toLocaleUpperCase(locale);
|
|
175
|
+
}
|
|
176
|
+
if (input.length === 1) {
|
|
177
|
+
if (SEPARATORS.test(input)) {
|
|
178
|
+
return "";
|
|
179
|
+
}
|
|
180
|
+
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
181
|
+
}
|
|
182
|
+
const hasUpperCase = input !== toLowerCase(input);
|
|
183
|
+
if (hasUpperCase) {
|
|
184
|
+
input = preserveCamelCase(input, toLowerCase, toUpperCase);
|
|
185
|
+
}
|
|
186
|
+
input = input.replace(LEADING_SEPARATORS, "");
|
|
187
|
+
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
|
|
188
|
+
if (options.pascalCase) {
|
|
189
|
+
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
|
190
|
+
}
|
|
191
|
+
return postProcess(input, toUpperCase);
|
|
192
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
|
|
21
|
+
// src/codegen/utilities.ts
|
|
22
|
+
import ts, { factory } from "typescript";
|
|
23
|
+
var MODEL_SUFFIX = "Model";
|
|
24
|
+
function createNullableType(node) {
|
|
25
|
+
return factory.createUnionTypeNode([
|
|
26
|
+
node,
|
|
27
|
+
factory.createLiteralTypeNode(factory.createNull())
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
function getResolverParameters({
|
|
31
|
+
parent,
|
|
32
|
+
args,
|
|
33
|
+
context,
|
|
34
|
+
resolveInfo
|
|
35
|
+
}) {
|
|
36
|
+
return [
|
|
37
|
+
factory.createParameterDeclaration(void 0, void 0, void 0, factory.createIdentifier(parent.name), void 0, parent.type),
|
|
38
|
+
factory.createParameterDeclaration(void 0, void 0, void 0, factory.createIdentifier(args.name), void 0, factory.createTypeLiteralNode(args.type)),
|
|
39
|
+
factory.createParameterDeclaration(void 0, void 0, void 0, factory.createIdentifier(context.name), void 0, context.type),
|
|
40
|
+
factory.createParameterDeclaration(void 0, void 0, void 0, factory.createIdentifier(resolveInfo.name), void 0, resolveInfo.type)
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
function getResolverReturnType(typeNode, parentName, resolverParametersDefinitions) {
|
|
44
|
+
if (parentName !== "Subscription") {
|
|
45
|
+
return factory.createTypeReferenceNode(factory.createIdentifier("PromiseOrValue"), [typeNode]);
|
|
46
|
+
}
|
|
47
|
+
return factory.createUnionTypeNode([
|
|
48
|
+
factory.createTypeReferenceNode(factory.createIdentifier("AsyncIterator"), [
|
|
49
|
+
typeNode
|
|
50
|
+
]),
|
|
51
|
+
factory.createFunctionTypeNode([factory.createTypeParameterDeclaration(factory.createIdentifier("A"))], [], factory.createTypeLiteralNode([
|
|
52
|
+
factory.createPropertySignature(void 0, factory.createIdentifier("subscribe"), void 0, factory.createFunctionTypeNode(void 0, getResolverParameters(resolverParametersDefinitions), factory.createTypeReferenceNode(factory.createIdentifier("AsyncIterator"), [factory.createTypeReferenceNode(factory.createIdentifier("A"))]))),
|
|
53
|
+
factory.createPropertySignature(void 0, factory.createIdentifier("resolve"), void 0, factory.createFunctionTypeNode(void 0, getResolverParameters(__spreadProps(__spreadValues({}, resolverParametersDefinitions), {
|
|
54
|
+
parent: {
|
|
55
|
+
name: "parent",
|
|
56
|
+
type: factory.createTypeReferenceNode(factory.createIdentifier("A"))
|
|
57
|
+
}
|
|
58
|
+
})), typeNode))
|
|
59
|
+
]))
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
function createNonNullableType(node) {
|
|
63
|
+
if (ts.isUnionTypeNode(node)) {
|
|
64
|
+
return node.types[0];
|
|
65
|
+
} else {
|
|
66
|
+
throw new Error(`Can't make type non nullable: ${node}.`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function addModelSuffix(typeName) {
|
|
70
|
+
if (typeName.endsWith(MODEL_SUFFIX)) {
|
|
71
|
+
return typeName;
|
|
72
|
+
}
|
|
73
|
+
return `${typeName}${MODEL_SUFFIX}`;
|
|
74
|
+
}
|
|
75
|
+
function createVariableNameFromImport(path) {
|
|
76
|
+
return camelCase(path.replace(/\.\.\//g, "up-").replace(/@/g, "NS-").replace(/\.\//g, "cwd-").replace(/\//g, "-"), {
|
|
77
|
+
pascalCase: true,
|
|
78
|
+
preserveConsecutiveUppercase: true
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
var UPPERCASE = /[\p{Lu}]/u;
|
|
82
|
+
var LOWERCASE = /[\p{Ll}]/u;
|
|
83
|
+
var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
|
84
|
+
var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
85
|
+
var SEPARATORS = /[_.\- ]+/;
|
|
86
|
+
var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
87
|
+
var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
88
|
+
var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
89
|
+
var preserveCamelCase = (string, toLowerCase, toUpperCase) => {
|
|
90
|
+
let isLastCharLower = false;
|
|
91
|
+
let isLastCharUpper = false;
|
|
92
|
+
let isLastLastCharUpper = false;
|
|
93
|
+
for (let index = 0; index < string.length; index++) {
|
|
94
|
+
const character = string[index];
|
|
95
|
+
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
96
|
+
string = string.slice(0, index) + "-" + string.slice(index);
|
|
97
|
+
isLastCharLower = false;
|
|
98
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
99
|
+
isLastCharUpper = true;
|
|
100
|
+
index++;
|
|
101
|
+
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character)) {
|
|
102
|
+
string = string.slice(0, index - 1) + "-" + string.slice(index - 1);
|
|
103
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
104
|
+
isLastCharUpper = false;
|
|
105
|
+
isLastCharLower = true;
|
|
106
|
+
} else {
|
|
107
|
+
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
|
108
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
109
|
+
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return string;
|
|
113
|
+
};
|
|
114
|
+
var preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
115
|
+
LEADING_CAPITAL.lastIndex = 0;
|
|
116
|
+
return input.replace(LEADING_CAPITAL, (m1) => toLowerCase(m1));
|
|
117
|
+
};
|
|
118
|
+
var postProcess = (input, toUpperCase) => {
|
|
119
|
+
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
120
|
+
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
121
|
+
return input.replace(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier)).replace(NUMBERS_AND_IDENTIFIER, (m) => toUpperCase(m));
|
|
122
|
+
};
|
|
123
|
+
function camelCase(input, options) {
|
|
124
|
+
if (!(typeof input === "string" || Array.isArray(input))) {
|
|
125
|
+
throw new TypeError("Expected the input to be `string | string[]`");
|
|
126
|
+
}
|
|
127
|
+
options = __spreadValues({
|
|
128
|
+
pascalCase: false,
|
|
129
|
+
preserveConsecutiveUppercase: false
|
|
130
|
+
}, options);
|
|
131
|
+
if (Array.isArray(input)) {
|
|
132
|
+
input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
|
133
|
+
} else {
|
|
134
|
+
input = input.trim();
|
|
135
|
+
}
|
|
136
|
+
if (input.length === 0) {
|
|
137
|
+
return "";
|
|
138
|
+
}
|
|
139
|
+
let locale = options.locale;
|
|
140
|
+
let toLowerCase;
|
|
141
|
+
let toUpperCase;
|
|
142
|
+
if (locale === false) {
|
|
143
|
+
toLowerCase = (s) => s.toLowerCase();
|
|
144
|
+
toUpperCase = (s) => s.toUpperCase();
|
|
145
|
+
} else {
|
|
146
|
+
toLowerCase = (s) => s.toLocaleLowerCase(locale);
|
|
147
|
+
toUpperCase = (s) => s.toLocaleUpperCase(locale);
|
|
148
|
+
}
|
|
149
|
+
if (input.length === 1) {
|
|
150
|
+
if (SEPARATORS.test(input)) {
|
|
151
|
+
return "";
|
|
152
|
+
}
|
|
153
|
+
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
154
|
+
}
|
|
155
|
+
const hasUpperCase = input !== toLowerCase(input);
|
|
156
|
+
if (hasUpperCase) {
|
|
157
|
+
input = preserveCamelCase(input, toLowerCase, toUpperCase);
|
|
158
|
+
}
|
|
159
|
+
input = input.replace(LEADING_SEPARATORS, "");
|
|
160
|
+
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
|
|
161
|
+
if (options.pascalCase) {
|
|
162
|
+
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
|
163
|
+
}
|
|
164
|
+
return postProcess(input, toUpperCase);
|
|
165
|
+
}
|
|
166
|
+
export {
|
|
167
|
+
addModelSuffix,
|
|
168
|
+
camelCase,
|
|
169
|
+
createNonNullableType,
|
|
170
|
+
createNullableType,
|
|
171
|
+
createVariableNameFromImport,
|
|
172
|
+
getResolverParameters,
|
|
173
|
+
getResolverReturnType
|
|
174
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractImplicitTypesToTypescript.d.ts","sourceRoot":"","sources":["../../src/extractors/extractImplicitTypesToTypescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,YAAY,CAAC;AACzC,OAAO,EACL,YAAY,EAab,MAAM,SAAS,CAAC;AAmBjB,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,YAAY,GACrB,EAAE,CAAC,UAAU,CA8Jf"}
|
package/lib/{extractImplicitTypesToTypescript.js → extractors/extractImplicitTypesToTypescript.js}
RENAMED
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { extractImplicitTypesToTypescript } from "
|
|
1
|
+
export { extractImplicitTypesToTypescript } from "./extractImplicitTypesToTypescript";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extractors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extractors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC"}
|
package/lib/extractors/index.js
CHANGED
|
@@ -20,4 +20,4 @@ __export(extractors_exports, {
|
|
|
20
20
|
extractImplicitTypesToTypescript: () => import_extractImplicitTypesToTypescript.extractImplicitTypesToTypescript
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(extractors_exports);
|
|
23
|
-
var import_extractImplicitTypesToTypescript = require("
|
|
23
|
+
var import_extractImplicitTypesToTypescript = require("./extractImplicitTypesToTypescript");
|
package/lib/extractors/index.mjs
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -2,10 +2,12 @@ export { executeWithoutSchema } from "./executeWithoutSchema";
|
|
|
2
2
|
export { executeWithSchema } from "./executeWithSchema";
|
|
3
3
|
export { subscribeWithSchema } from "./subscribeWithSchema";
|
|
4
4
|
export { subscribeWithoutSchema } from "./subscribeWithoutSchema";
|
|
5
|
-
export type { ObjectTypeResolver, InterfaceTypeResolver, UnionTypeResolver, ScalarTypeResolver, EnumTypeResolver, InputObjectTypeResolver, FunctionFieldResolver, Resolvers, } from "./types";
|
|
5
|
+
export type { ObjectTypeResolver, InterfaceTypeResolver, UnionTypeResolver, ScalarTypeResolver, EnumTypeResolver, InputObjectTypeResolver, FunctionFieldResolver, Resolvers, ResolveInfo, } from "./types";
|
|
6
6
|
export { addTypesToRequestDocument } from "./ast/addTypesToRequestDocument";
|
|
7
7
|
export { extractImplicitTypes } from "./extractImplicitTypesRuntime";
|
|
8
8
|
export { specifiedScalars } from "./values";
|
|
9
9
|
export { annotateDocumentGraphQLTransform } from "./transforms/annotateDocumentGraphQLTransform";
|
|
10
|
+
export type { PromiseOrValue } from "./jsutils/PromiseOrValue";
|
|
11
|
+
export { generateTS } from "./codegen";
|
|
10
12
|
export type { NameNode, DocumentNode, OperationDefinitionNode, VariableDefinitionNode, VariableNode, SelectionSetNode, FieldNode, ArgumentNode, FragmentSpreadNode, InlineFragmentNode, FragmentDefinitionNode, IntValueNode, FloatValueNode, StringValueNode, BooleanValueNode, NullValueNode, EnumValueNode, ListValueNode, ObjectValueNode, ObjectFieldNode, DirectiveNode, NamedTypeNode, ListTypeNode, NonNullTypeNode, SchemaDefinitionNode, OperationTypeDefinitionNode, ScalarTypeDefinitionNode, ObjectTypeDefinitionNode, FieldDefinitionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, UnionTypeDefinitionNode, EnumTypeDefinitionNode, EnumValueDefinitionNode, InputObjectTypeDefinitionNode, DirectiveDefinitionNode, SchemaExtensionNode, ScalarTypeExtensionNode, ObjectTypeExtensionNode, InterfaceTypeExtensionNode, UnionTypeExtensionNode, EnumTypeExtensionNode, InputObjectTypeExtensionNode, } from "./ast/TypedAST";
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,SAAS,
|
|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AuB,EACvB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -22,6 +22,7 @@ __export(src_exports, {
|
|
|
22
22
|
executeWithSchema: () => import_executeWithSchema.executeWithSchema,
|
|
23
23
|
executeWithoutSchema: () => import_executeWithoutSchema.executeWithoutSchema,
|
|
24
24
|
extractImplicitTypes: () => import_extractImplicitTypesRuntime.extractImplicitTypes,
|
|
25
|
+
generateTS: () => import_codegen.generateTS,
|
|
25
26
|
specifiedScalars: () => import_values.specifiedScalars,
|
|
26
27
|
subscribeWithSchema: () => import_subscribeWithSchema.subscribeWithSchema,
|
|
27
28
|
subscribeWithoutSchema: () => import_subscribeWithoutSchema.subscribeWithoutSchema
|
|
@@ -35,3 +36,4 @@ var import_addTypesToRequestDocument = require("./ast/addTypesToRequestDocument"
|
|
|
35
36
|
var import_extractImplicitTypesRuntime = require("./extractImplicitTypesRuntime");
|
|
36
37
|
var import_values = require("./values");
|
|
37
38
|
var import_annotateDocumentGraphQLTransform = require("./transforms/annotateDocumentGraphQLTransform");
|
|
39
|
+
var import_codegen = require("./codegen");
|