@graphql-codegen/typescript-urql-graphcache 2.2.17 → 2.3.0-alpha-2fbcdb6d3.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/cjs/config.js +2 -0
- package/{index.js → cjs/index.js} +59 -78
- package/cjs/package.json +1 -0
- package/esm/config.js +1 -0
- package/{index.mjs → esm/index.js} +53 -72
- package/package.json +24 -17
- package/{config.d.ts → typings/config.d.ts} +0 -0
- package/{index.d.ts → typings/index.d.ts} +1 -1
package/cjs/config.js
ADDED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const unwrapType = (type) => graphql.isWrappingType(type) ? unwrapType(type.ofType) : type || null;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.plugin = void 0;
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
|
+
const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
|
|
6
|
+
const unwrapType = (type) => (0, graphql_1.isWrappingType)(type) ? unwrapType(type.ofType) : type || null;
|
|
9
7
|
const getObjectTypes = (schema) => {
|
|
10
8
|
const typeMap = schema.getTypeMap();
|
|
11
9
|
const queryType = schema.getQueryType();
|
|
@@ -27,7 +25,7 @@ const getObjectTypes = (schema) => {
|
|
|
27
25
|
case '__Schema':
|
|
28
26
|
continue;
|
|
29
27
|
default:
|
|
30
|
-
if (!(type instanceof
|
|
28
|
+
if (!(type instanceof graphql_1.GraphQLObjectType))
|
|
31
29
|
continue;
|
|
32
30
|
}
|
|
33
31
|
if (type !== queryType && type !== mutationType && type !== subscriptionType) {
|
|
@@ -37,55 +35,46 @@ const getObjectTypes = (schema) => {
|
|
|
37
35
|
return objectTypes;
|
|
38
36
|
};
|
|
39
37
|
function constructType(typeNode, schema, convertName, config, nullable = true, allowString = false) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
const finalType = allowString ? possibleTypes.join(' | ') + ' | string' : possibleTypes.join(' | ');
|
|
75
|
-
return nullable ? `Maybe<${finalType}>` : finalType;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
case graphql.Kind.NON_NULL_TYPE: {
|
|
81
|
-
return constructType(typeNode.type, schema, convertName, config, false, allowString);
|
|
82
|
-
}
|
|
38
|
+
if ((0, graphql_1.isListType)(typeNode)) {
|
|
39
|
+
return nullable
|
|
40
|
+
? `Maybe<Array<${constructType(typeNode.ofType, schema, convertName, config, false, allowString)}>>`
|
|
41
|
+
: `Array<${constructType(typeNode.ofType, schema, convertName, config, false, allowString)}>`;
|
|
42
|
+
}
|
|
43
|
+
if ((0, graphql_1.isNonNullType)(typeNode)) {
|
|
44
|
+
return constructType(typeNode.ofType, schema, convertName, config, false, allowString);
|
|
45
|
+
}
|
|
46
|
+
const type = schema.getType(typeNode.name);
|
|
47
|
+
if ((0, graphql_1.isScalarType)(type)) {
|
|
48
|
+
return nullable
|
|
49
|
+
? `Maybe<Scalars['${type.name}']${allowString ? ' | string' : ''}>`
|
|
50
|
+
: `Scalars['${type.name}']${allowString ? ' | string' : ''}`;
|
|
51
|
+
}
|
|
52
|
+
const tsTypeName = convertName(typeNode.name, { prefix: config.typesPrefix, suffix: config.typesSuffix });
|
|
53
|
+
if ((0, graphql_1.isUnionType)(type) || (0, graphql_1.isInputObjectType)(type) || (0, graphql_1.isObjectType)(type)) {
|
|
54
|
+
const finalType = `WithTypename<${tsTypeName}>${allowString ? ' | string' : ''}`;
|
|
55
|
+
return nullable ? `Maybe<${finalType}>` : finalType;
|
|
56
|
+
}
|
|
57
|
+
if ((0, graphql_1.isEnumType)(type)) {
|
|
58
|
+
const finalType = `${tsTypeName}${allowString ? ' | string' : ''}`;
|
|
59
|
+
return nullable ? `Maybe<${finalType}>` : finalType;
|
|
60
|
+
}
|
|
61
|
+
if ((0, graphql_1.isInterfaceType)(type)) {
|
|
62
|
+
const possibleTypes = schema.getPossibleTypes(type).map(possibleType => {
|
|
63
|
+
const tsPossibleTypeName = convertName(possibleType.name, {
|
|
64
|
+
prefix: config.typesPrefix,
|
|
65
|
+
suffix: config.typesSuffix,
|
|
66
|
+
});
|
|
67
|
+
return `WithTypename<${tsPossibleTypeName}>`;
|
|
68
|
+
});
|
|
69
|
+
const finalType = allowString ? possibleTypes.join(' | ') + ' | string' : possibleTypes.join(' | ');
|
|
70
|
+
return nullable ? `Maybe<${finalType}>` : finalType;
|
|
83
71
|
}
|
|
72
|
+
throw new Error(`Unhandled type ${type}`);
|
|
84
73
|
}
|
|
85
74
|
const capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
86
75
|
function getKeysConfig(schema, convertName, config) {
|
|
87
76
|
const keys = getObjectTypes(schema).reduce((keys, type) => {
|
|
88
|
-
keys.push(`${type.name}?: (data: WithTypename<${convertName(type.
|
|
77
|
+
keys.push(`${type.name}?: (data: WithTypename<${convertName(type.name, {
|
|
89
78
|
prefix: config.typesPrefix,
|
|
90
79
|
suffix: config.typesSuffix,
|
|
91
80
|
})}>) => null | string`);
|
|
@@ -96,21 +85,20 @@ function getKeysConfig(schema, convertName, config) {
|
|
|
96
85
|
function getResolversConfig(schema, convertName, config) {
|
|
97
86
|
const objectTypes = [schema.getQueryType(), ...getObjectTypes(schema)];
|
|
98
87
|
const resolvers = objectTypes.reduce((resolvers, parentType) => {
|
|
99
|
-
const fields = parentType.
|
|
100
|
-
|
|
101
|
-
const argsName =
|
|
102
|
-
? convertName(`${parentType.name}${capitalize(
|
|
88
|
+
const fields = Object.entries(parentType.getFields()).reduce((fields, [fieldName, field]) => {
|
|
89
|
+
const args = Object.entries(field.args);
|
|
90
|
+
const argsName = args.length
|
|
91
|
+
? convertName(`${parentType.name}${capitalize(fieldName)}Args`, {
|
|
103
92
|
prefix: config.typesPrefix,
|
|
104
93
|
suffix: config.typesSuffix,
|
|
105
94
|
})
|
|
106
95
|
: 'Record<string, never>';
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
`${convertName(parentType.astNode, {
|
|
96
|
+
fields.push(`${fieldName}?: GraphCacheResolver<WithTypename<` +
|
|
97
|
+
`${convertName(parentType.name, {
|
|
110
98
|
prefix: config.typesPrefix,
|
|
111
99
|
suffix: config.typesSuffix,
|
|
112
100
|
})}>, ${argsName}, ` +
|
|
113
|
-
`${constructType(type, schema, convertName, config, false, true)}>`);
|
|
101
|
+
`${constructType(field.type, schema, convertName, config, false, true)}>`);
|
|
114
102
|
return fields;
|
|
115
103
|
}, []);
|
|
116
104
|
resolvers.push(` ${parentType.name}?: {\n ` + fields.join(',\n ') + '\n }');
|
|
@@ -122,17 +110,14 @@ function getRootUpdatersConfig(schema, convertName, config) {
|
|
|
122
110
|
const [mutationUpdaters, subscriptionUpdaters] = [schema.getMutationType(), schema.getSubscriptionType()].map(rootType => {
|
|
123
111
|
if (rootType) {
|
|
124
112
|
const updaters = [];
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const argsName = ((_a = fieldNode.arguments) === null || _a === void 0 ? void 0 : _a.length)
|
|
129
|
-
? convertName(`${rootType.name}${capitalize(fieldNode.name.value)}Args`, {
|
|
113
|
+
Object.values(rootType.getFields()).forEach(field => {
|
|
114
|
+
const argsName = field.args.length
|
|
115
|
+
? convertName(`${rootType.name}${capitalize(field.name)}Args`, {
|
|
130
116
|
prefix: config.typesPrefix,
|
|
131
117
|
suffix: config.typesSuffix,
|
|
132
118
|
})
|
|
133
119
|
: 'Record<string, never>';
|
|
134
|
-
|
|
135
|
-
updaters.push(`${fieldNode.name.value}?: GraphCacheUpdateResolver<{ ${fieldNode.name.value}: ${constructType(type, schema, convertName, config)} }, ${argsName}>`);
|
|
120
|
+
updaters.push(`${field.name}?: GraphCacheUpdateResolver<{ ${field.name}: ${constructType(field.type, schema, convertName, config)} }, ${argsName}>`);
|
|
136
121
|
});
|
|
137
122
|
return updaters;
|
|
138
123
|
}
|
|
@@ -147,18 +132,15 @@ function getOptimisticUpdatersConfig(schema, convertName, config) {
|
|
|
147
132
|
const mutationType = schema.getMutationType();
|
|
148
133
|
if (mutationType) {
|
|
149
134
|
const optimistic = [];
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const argsName = ((_a = fieldNode.arguments) === null || _a === void 0 ? void 0 : _a.length)
|
|
154
|
-
? convertName(`${capitalize(mutationType.name)}${capitalize(fieldNode.name.value)}Args`, {
|
|
135
|
+
Object.values(mutationType.getFields()).forEach(field => {
|
|
136
|
+
const argsName = field.args.length
|
|
137
|
+
? convertName(`${capitalize(mutationType.name)}${capitalize(field.name)}Args`, {
|
|
155
138
|
prefix: config.typesPrefix,
|
|
156
139
|
suffix: config.typesSuffix,
|
|
157
140
|
})
|
|
158
141
|
: 'Record<string, never>';
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
optimistic.push(`${fieldNode.name.value}?: GraphCacheOptimisticMutationResolver<` + `${argsName}, ` + `${outputType}>`);
|
|
142
|
+
const outputType = constructType(field.type, schema, convertName, config);
|
|
143
|
+
optimistic.push(`${field.name}?: GraphCacheOptimisticMutationResolver<` + `${argsName}, ` + `${outputType}>`);
|
|
162
144
|
});
|
|
163
145
|
return optimistic;
|
|
164
146
|
}
|
|
@@ -169,7 +151,7 @@ function getImports(config) {
|
|
|
169
151
|
`${config.useTypeImports ? 'import type' : 'import'} { IntrospectionData } from '@urql/exchange-graphcache/dist/types/ast';`);
|
|
170
152
|
}
|
|
171
153
|
const plugin = (schema, _documents, config) => {
|
|
172
|
-
const convertName =
|
|
154
|
+
const convertName = (0, visitor_plugin_common_1.convertFactory)(config);
|
|
173
155
|
const imports = getImports(config);
|
|
174
156
|
const keys = getKeysConfig(schema, convertName, config);
|
|
175
157
|
const resolvers = getResolversConfig(schema, convertName, config);
|
|
@@ -203,5 +185,4 @@ const plugin = (schema, _documents, config) => {
|
|
|
203
185
|
.join('\n\n'),
|
|
204
186
|
};
|
|
205
187
|
};
|
|
206
|
-
|
|
207
188
|
exports.plugin = plugin;
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
package/esm/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { isWrappingType, GraphQLObjectType,
|
|
1
|
+
import { isWrappingType, GraphQLObjectType, isListType, isNonNullType, isScalarType, isUnionType, isInputObjectType, isObjectType, isEnumType, isInterfaceType, } from 'graphql';
|
|
2
2
|
import { convertFactory } from '@graphql-codegen/visitor-plugin-common';
|
|
3
|
-
|
|
4
3
|
const unwrapType = (type) => isWrappingType(type) ? unwrapType(type.ofType) : type || null;
|
|
5
4
|
const getObjectTypes = (schema) => {
|
|
6
5
|
const typeMap = schema.getTypeMap();
|
|
@@ -33,55 +32,46 @@ const getObjectTypes = (schema) => {
|
|
|
33
32
|
return objectTypes;
|
|
34
33
|
};
|
|
35
34
|
function constructType(typeNode, schema, convertName, config, nullable = true, allowString = false) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
const finalType = allowString ? possibleTypes.join(' | ') + ' | string' : possibleTypes.join(' | ');
|
|
71
|
-
return nullable ? `Maybe<${finalType}>` : finalType;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
case Kind.NON_NULL_TYPE: {
|
|
77
|
-
return constructType(typeNode.type, schema, convertName, config, false, allowString);
|
|
78
|
-
}
|
|
35
|
+
if (isListType(typeNode)) {
|
|
36
|
+
return nullable
|
|
37
|
+
? `Maybe<Array<${constructType(typeNode.ofType, schema, convertName, config, false, allowString)}>>`
|
|
38
|
+
: `Array<${constructType(typeNode.ofType, schema, convertName, config, false, allowString)}>`;
|
|
39
|
+
}
|
|
40
|
+
if (isNonNullType(typeNode)) {
|
|
41
|
+
return constructType(typeNode.ofType, schema, convertName, config, false, allowString);
|
|
42
|
+
}
|
|
43
|
+
const type = schema.getType(typeNode.name);
|
|
44
|
+
if (isScalarType(type)) {
|
|
45
|
+
return nullable
|
|
46
|
+
? `Maybe<Scalars['${type.name}']${allowString ? ' | string' : ''}>`
|
|
47
|
+
: `Scalars['${type.name}']${allowString ? ' | string' : ''}`;
|
|
48
|
+
}
|
|
49
|
+
const tsTypeName = convertName(typeNode.name, { prefix: config.typesPrefix, suffix: config.typesSuffix });
|
|
50
|
+
if (isUnionType(type) || isInputObjectType(type) || isObjectType(type)) {
|
|
51
|
+
const finalType = `WithTypename<${tsTypeName}>${allowString ? ' | string' : ''}`;
|
|
52
|
+
return nullable ? `Maybe<${finalType}>` : finalType;
|
|
53
|
+
}
|
|
54
|
+
if (isEnumType(type)) {
|
|
55
|
+
const finalType = `${tsTypeName}${allowString ? ' | string' : ''}`;
|
|
56
|
+
return nullable ? `Maybe<${finalType}>` : finalType;
|
|
57
|
+
}
|
|
58
|
+
if (isInterfaceType(type)) {
|
|
59
|
+
const possibleTypes = schema.getPossibleTypes(type).map(possibleType => {
|
|
60
|
+
const tsPossibleTypeName = convertName(possibleType.name, {
|
|
61
|
+
prefix: config.typesPrefix,
|
|
62
|
+
suffix: config.typesSuffix,
|
|
63
|
+
});
|
|
64
|
+
return `WithTypename<${tsPossibleTypeName}>`;
|
|
65
|
+
});
|
|
66
|
+
const finalType = allowString ? possibleTypes.join(' | ') + ' | string' : possibleTypes.join(' | ');
|
|
67
|
+
return nullable ? `Maybe<${finalType}>` : finalType;
|
|
79
68
|
}
|
|
69
|
+
throw new Error(`Unhandled type ${type}`);
|
|
80
70
|
}
|
|
81
71
|
const capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
82
72
|
function getKeysConfig(schema, convertName, config) {
|
|
83
73
|
const keys = getObjectTypes(schema).reduce((keys, type) => {
|
|
84
|
-
keys.push(`${type.name}?: (data: WithTypename<${convertName(type.
|
|
74
|
+
keys.push(`${type.name}?: (data: WithTypename<${convertName(type.name, {
|
|
85
75
|
prefix: config.typesPrefix,
|
|
86
76
|
suffix: config.typesSuffix,
|
|
87
77
|
})}>) => null | string`);
|
|
@@ -92,21 +82,20 @@ function getKeysConfig(schema, convertName, config) {
|
|
|
92
82
|
function getResolversConfig(schema, convertName, config) {
|
|
93
83
|
const objectTypes = [schema.getQueryType(), ...getObjectTypes(schema)];
|
|
94
84
|
const resolvers = objectTypes.reduce((resolvers, parentType) => {
|
|
95
|
-
const fields = parentType.
|
|
96
|
-
|
|
97
|
-
const argsName =
|
|
98
|
-
? convertName(`${parentType.name}${capitalize(
|
|
85
|
+
const fields = Object.entries(parentType.getFields()).reduce((fields, [fieldName, field]) => {
|
|
86
|
+
const args = Object.entries(field.args);
|
|
87
|
+
const argsName = args.length
|
|
88
|
+
? convertName(`${parentType.name}${capitalize(fieldName)}Args`, {
|
|
99
89
|
prefix: config.typesPrefix,
|
|
100
90
|
suffix: config.typesSuffix,
|
|
101
91
|
})
|
|
102
92
|
: 'Record<string, never>';
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
`${convertName(parentType.astNode, {
|
|
93
|
+
fields.push(`${fieldName}?: GraphCacheResolver<WithTypename<` +
|
|
94
|
+
`${convertName(parentType.name, {
|
|
106
95
|
prefix: config.typesPrefix,
|
|
107
96
|
suffix: config.typesSuffix,
|
|
108
97
|
})}>, ${argsName}, ` +
|
|
109
|
-
`${constructType(type, schema, convertName, config, false, true)}>`);
|
|
98
|
+
`${constructType(field.type, schema, convertName, config, false, true)}>`);
|
|
110
99
|
return fields;
|
|
111
100
|
}, []);
|
|
112
101
|
resolvers.push(` ${parentType.name}?: {\n ` + fields.join(',\n ') + '\n }');
|
|
@@ -118,17 +107,14 @@ function getRootUpdatersConfig(schema, convertName, config) {
|
|
|
118
107
|
const [mutationUpdaters, subscriptionUpdaters] = [schema.getMutationType(), schema.getSubscriptionType()].map(rootType => {
|
|
119
108
|
if (rootType) {
|
|
120
109
|
const updaters = [];
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const argsName = ((_a = fieldNode.arguments) === null || _a === void 0 ? void 0 : _a.length)
|
|
125
|
-
? convertName(`${rootType.name}${capitalize(fieldNode.name.value)}Args`, {
|
|
110
|
+
Object.values(rootType.getFields()).forEach(field => {
|
|
111
|
+
const argsName = field.args.length
|
|
112
|
+
? convertName(`${rootType.name}${capitalize(field.name)}Args`, {
|
|
126
113
|
prefix: config.typesPrefix,
|
|
127
114
|
suffix: config.typesSuffix,
|
|
128
115
|
})
|
|
129
116
|
: 'Record<string, never>';
|
|
130
|
-
|
|
131
|
-
updaters.push(`${fieldNode.name.value}?: GraphCacheUpdateResolver<{ ${fieldNode.name.value}: ${constructType(type, schema, convertName, config)} }, ${argsName}>`);
|
|
117
|
+
updaters.push(`${field.name}?: GraphCacheUpdateResolver<{ ${field.name}: ${constructType(field.type, schema, convertName, config)} }, ${argsName}>`);
|
|
132
118
|
});
|
|
133
119
|
return updaters;
|
|
134
120
|
}
|
|
@@ -143,18 +129,15 @@ function getOptimisticUpdatersConfig(schema, convertName, config) {
|
|
|
143
129
|
const mutationType = schema.getMutationType();
|
|
144
130
|
if (mutationType) {
|
|
145
131
|
const optimistic = [];
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const argsName = ((_a = fieldNode.arguments) === null || _a === void 0 ? void 0 : _a.length)
|
|
150
|
-
? convertName(`${capitalize(mutationType.name)}${capitalize(fieldNode.name.value)}Args`, {
|
|
132
|
+
Object.values(mutationType.getFields()).forEach(field => {
|
|
133
|
+
const argsName = field.args.length
|
|
134
|
+
? convertName(`${capitalize(mutationType.name)}${capitalize(field.name)}Args`, {
|
|
151
135
|
prefix: config.typesPrefix,
|
|
152
136
|
suffix: config.typesSuffix,
|
|
153
137
|
})
|
|
154
138
|
: 'Record<string, never>';
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
optimistic.push(`${fieldNode.name.value}?: GraphCacheOptimisticMutationResolver<` + `${argsName}, ` + `${outputType}>`);
|
|
139
|
+
const outputType = constructType(field.type, schema, convertName, config);
|
|
140
|
+
optimistic.push(`${field.name}?: GraphCacheOptimisticMutationResolver<` + `${argsName}, ` + `${outputType}>`);
|
|
158
141
|
});
|
|
159
142
|
return optimistic;
|
|
160
143
|
}
|
|
@@ -164,7 +147,7 @@ function getImports(config) {
|
|
|
164
147
|
return (`${config.useTypeImports ? 'import type' : 'import'} { Resolver as GraphCacheResolver, UpdateResolver as GraphCacheUpdateResolver, OptimisticMutationResolver as GraphCacheOptimisticMutationResolver, StorageAdapter as GraphCacheStorageAdapter } from '@urql/exchange-graphcache';\n` +
|
|
165
148
|
`${config.useTypeImports ? 'import type' : 'import'} { IntrospectionData } from '@urql/exchange-graphcache/dist/types/ast';`);
|
|
166
149
|
}
|
|
167
|
-
const plugin = (schema, _documents, config) => {
|
|
150
|
+
export const plugin = (schema, _documents, config) => {
|
|
168
151
|
const convertName = convertFactory(config);
|
|
169
152
|
const imports = getImports(config);
|
|
170
153
|
const keys = getKeysConfig(schema, convertName, config);
|
|
@@ -199,5 +182,3 @@ const plugin = (schema, _documents, config) => {
|
|
|
199
182
|
.join('\n\n'),
|
|
200
183
|
};
|
|
201
184
|
};
|
|
202
|
-
|
|
203
|
-
export { plugin };
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-urql-graphcache",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-alpha-2fbcdb6d3.0",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating a generic to be used in graphcache cache config",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@urql/exchange-graphcache": "^4.1.1",
|
|
7
6
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
8
|
-
"graphql-tag": "^2.0.0"
|
|
7
|
+
"graphql-tag": "^2.0.0",
|
|
8
|
+
"@urql/exchange-graphcache": "^4.1.1"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@graphql-codegen/plugin-helpers": "^2.
|
|
12
|
-
"@graphql-codegen/visitor-plugin-common": "2.
|
|
11
|
+
"@graphql-codegen/plugin-helpers": "^2.5.0-alpha-2fbcdb6d3.0",
|
|
12
|
+
"@graphql-codegen/visitor-plugin-common": "2.11.0-alpha-2fbcdb6d3.0",
|
|
13
13
|
"auto-bind": "~4.0.0",
|
|
14
14
|
"change-case-all": "1.0.14",
|
|
15
15
|
"tslib": "~2.4.0"
|
|
@@ -20,21 +20,28 @@
|
|
|
20
20
|
"directory": "packages/plugins/typescript/urql-graphcache"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
|
-
"main": "index.js",
|
|
24
|
-
"module": "index.
|
|
25
|
-
"typings": "index.d.ts",
|
|
23
|
+
"main": "cjs/index.js",
|
|
24
|
+
"module": "esm/index.js",
|
|
25
|
+
"typings": "typings/index.d.ts",
|
|
26
26
|
"typescript": {
|
|
27
|
-
"definition": "index.d.ts"
|
|
27
|
+
"definition": "typings/index.d.ts"
|
|
28
28
|
},
|
|
29
|
+
"type": "module",
|
|
29
30
|
"exports": {
|
|
30
|
-
"./package.json": "./package.json",
|
|
31
31
|
".": {
|
|
32
|
-
"require":
|
|
33
|
-
|
|
32
|
+
"require": {
|
|
33
|
+
"types": "./typings/index.d.ts",
|
|
34
|
+
"default": "./cjs/index.js"
|
|
35
|
+
},
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./typings/index.d.ts",
|
|
38
|
+
"default": "./esm/index.js"
|
|
39
|
+
},
|
|
40
|
+
"default": {
|
|
41
|
+
"types": "./typings/index.d.ts",
|
|
42
|
+
"default": "./esm/index.js"
|
|
43
|
+
}
|
|
34
44
|
},
|
|
35
|
-
"
|
|
36
|
-
"require": "./*.js",
|
|
37
|
-
"import": "./*.mjs"
|
|
38
|
-
}
|
|
45
|
+
"./package.json": "./package.json"
|
|
39
46
|
}
|
|
40
|
-
}
|
|
47
|
+
}
|
|
File without changes
|