Skip to content

Commit 3736a3b

Browse files
renovate[bot]renovate-botardatan
authored
feat(urql-introspection): add more options
* fix(deps): update dependency @urql/introspection to v0.3.0 * Update dev-tests * feat(urql-introspection): add more options Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
1 parent c0a4bfc commit 3736a3b

File tree

5 files changed

+84
-7
lines changed

5 files changed

+84
-7
lines changed

.changeset/thick-carpets-learn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-codegen/urql-introspection': minor
3+
---
4+
5+
feat(urql-introspection): add more options

dev-test/githunt/types.urql.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ export default ({
468468
ofType: {
469469
kind: 'OBJECT',
470470
name: 'Entry',
471+
ofType: null,
471472
},
472473
},
473474
args: [
@@ -502,6 +503,7 @@ export default ({
502503
type: {
503504
kind: 'OBJECT',
504505
name: 'Entry',
506+
ofType: null,
505507
},
506508
args: [
507509
{
@@ -521,6 +523,7 @@ export default ({
521523
type: {
522524
kind: 'OBJECT',
523525
name: 'User',
526+
ofType: null,
524527
},
525528
args: [],
526529
},
@@ -538,6 +541,7 @@ export default ({
538541
ofType: {
539542
kind: 'OBJECT',
540543
name: 'Repository',
544+
ofType: null,
541545
},
542546
},
543547
args: [],
@@ -549,6 +553,7 @@ export default ({
549553
ofType: {
550554
kind: 'OBJECT',
551555
name: 'User',
556+
ofType: null,
552557
},
553558
},
554559
args: [],
@@ -595,6 +600,7 @@ export default ({
595600
ofType: {
596601
kind: 'OBJECT',
597602
name: 'Comment',
603+
ofType: null,
598604
},
599605
},
600606
},
@@ -644,6 +650,7 @@ export default ({
644650
ofType: {
645651
kind: 'OBJECT',
646652
name: 'Vote',
653+
ofType: null,
647654
},
648655
},
649656
args: [],
@@ -720,6 +727,7 @@ export default ({
720727
type: {
721728
kind: 'OBJECT',
722729
name: 'User',
730+
ofType: null,
723731
},
724732
args: [],
725733
},
@@ -788,6 +796,7 @@ export default ({
788796
ofType: {
789797
kind: 'OBJECT',
790798
name: 'User',
799+
ofType: null,
791800
},
792801
},
793802
args: [],
@@ -855,6 +864,7 @@ export default ({
855864
type: {
856865
kind: 'OBJECT',
857866
name: 'Entry',
867+
ofType: null,
858868
},
859869
args: [
860870
{
@@ -874,6 +884,7 @@ export default ({
874884
type: {
875885
kind: 'OBJECT',
876886
name: 'Entry',
887+
ofType: null,
877888
},
878889
args: [
879890
{
@@ -903,6 +914,7 @@ export default ({
903914
type: {
904915
kind: 'OBJECT',
905916
name: 'Comment',
917+
ofType: null,
906918
},
907919
args: [
908920
{
@@ -939,6 +951,7 @@ export default ({
939951
type: {
940952
kind: 'OBJECT',
941953
name: 'Comment',
954+
ofType: null,
942955
},
943956
args: [
944957
{

packages/plugins/other/urql-introspection/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@graphql-codegen/plugin-helpers": "^1.18.5",
18-
"@urql/introspection": "0.2.0",
18+
"@urql/introspection": "0.3.0",
1919
"tslib": "~2.2.0"
2020
},
2121
"peerDependencies": {

packages/plugins/other/urql-introspection/src/index.ts

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,58 @@ export interface UrqlIntrospectionConfig {
4646
* ```
4747
*/
4848
useTypeImports?: boolean;
49+
/**
50+
* @name includeScalars
51+
* @type boolean
52+
* @default false
53+
* @description Includes scalar names (instead of an `Any` replacement) in the output when enabled.
54+
*
55+
* @example
56+
* ```yml
57+
* config:
58+
* includeScalars: true
59+
* ```
60+
*/
61+
includeScalars?: boolean;
62+
/**
63+
* @name includeEnums
64+
* @type boolean
65+
* @default false
66+
* @description Includes enums (instead of an `Any` replacement) in the output when enabled.
67+
*
68+
* @example
69+
* ```yml
70+
* config:
71+
* includeEnums: true
72+
* ```
73+
*/
74+
includeEnums?: boolean;
75+
/**
76+
* @name includeInputs
77+
* @type boolean
78+
* @default false
79+
* @description Includes all input objects (instead of an `Any` replacement) in the output when enabled.
80+
*
81+
* @example
82+
* ```yml
83+
* config:
84+
* includeInputs: true
85+
* ```
86+
*/
87+
includeInputs?: boolean;
88+
/**
89+
* @name includeDirectives
90+
* @type boolean
91+
* @default false
92+
* @description Includes all directives in the output when enabled.
93+
*
94+
* @example
95+
* ```yml
96+
* config:
97+
* includeDirectives: true
98+
* ```
99+
*/
100+
includeDirectives?: boolean;
49101
}
50102

51103
const extensions = {
@@ -60,15 +112,22 @@ export const plugin: PluginFunction = async (
60112
pluginConfig: UrqlIntrospectionConfig,
61113
info
62114
): Promise<string> => {
63-
const config: Required<UrqlIntrospectionConfig> = {
115+
const config: UrqlIntrospectionConfig = {
64116
module: 'es2015',
65117
useTypeImports: false,
66118
...pluginConfig,
67119
};
68120

69121
const ext = extname(info.outputFile).toLowerCase();
70122

71-
const minifiedData = minifyIntrospectionQuery(minifyIntrospectionQuery(getIntrospectedSchema(schema)));
123+
const minifiedData = minifyIntrospectionQuery(
124+
minifyIntrospectionQuery(getIntrospectedSchema(schema), {
125+
includeDirectives: config.includeDirectives,
126+
includeEnums: config.includeEnums,
127+
includeInputs: config.includeInputs,
128+
includeScalars: config.includeScalars,
129+
})
130+
);
72131

73132
const content = JSON.stringify(minifiedData, null, 2);
74133

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5702,10 +5702,10 @@
57025702
"@graphql-typed-document-node/core" "^3.1.0"
57035703
wonka "^4.0.14"
57045704

5705-
"@urql/introspection@0.2.0":
5706-
version "0.2.0"
5707-
resolved "https://registry.yarnpkg.com/@urql/introspection/-/introspection-0.2.0.tgz#7fee8f17bb3911abb08c36c427cfc1ee4ef53662"
5708-
integrity sha512-wA3zsEbMOhfivUtUibEaguYs+QqT9SaJ+hPhXBLyXJkml4dbDlmBJnhLq+nCoduP8Gy8Saksxh0UzMoUEM9JzA==
5705+
"@urql/introspection@0.3.0":
5706+
version "0.3.0"
5707+
resolved "https://registry.yarnpkg.com/@urql/introspection/-/introspection-0.3.0.tgz#545f2425b68d95892afa5961433a19aab1867268"
5708+
integrity sha512-dw87YiSmCgEUFnWj7fYu+wnrFcSEhYyQ8DykTvL1UzCKPm9uLDeey1z0yiSxZeX2qP9oD+TSGIq+61AZHhQO0w==
57095709

57105710
"@vue/apollo-composable@4.0.0-alpha.12":
57115711
version "4.0.0-alpha.12"

0 commit comments

Comments
 (0)