@xyd-js/gql 0.1.0-xyd.5 → 0.1.0-xyd.54

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +450 -0
  2. package/LICENSE +21 -0
  3. package/TODO.md +8 -0
  4. package/__fixtures__/-1.opendocs.docs-nested/input.graphql +66 -0
  5. package/__fixtures__/-1.opendocs.docs-nested/output.json +554 -0
  6. package/__fixtures__/-1.opendocs.flat/input.graphql +19 -0
  7. package/__fixtures__/-1.opendocs.flat/output.json +243 -0
  8. package/__fixtures__/-1.opendocs.scopes/input.graphql +33 -0
  9. package/__fixtures__/-1.opendocs.scopes/output.json +378 -0
  10. package/__fixtures__/-1.opendocs.sidebar/input.graphql +44 -0
  11. package/__fixtures__/-1.opendocs.sort/input.graphql +92 -0
  12. package/__fixtures__/-1.opendocs.sort/output.json +1078 -0
  13. package/__fixtures__/-1.opendocs.sort+group/input.graphql +111 -0
  14. package/__fixtures__/-1.opendocs.sort+group/output.json +1114 -0
  15. package/__fixtures__/-1.opendocs.sort+group+path/input.graphql +118 -0
  16. package/__fixtures__/-1.opendocs.sort+group+path/output.json +1114 -0
  17. package/__fixtures__/-2.complex.github/input.graphql +69424 -0
  18. package/__fixtures__/-2.complex.github/output.json +269874 -0
  19. package/__fixtures__/-2.complex.livesession/input.graphql +23 -0
  20. package/__fixtures__/-2.complex.livesession/output.json +302 -0
  21. package/__fixtures__/-2.complex.monday/input.graphql +6089 -0
  22. package/__fixtures__/-2.complex.monday/output.json +1 -0
  23. package/__fixtures__/-3.array-non-null-return/input.graphql +9 -0
  24. package/__fixtures__/-3.array-non-null-return/output.json +151 -0
  25. package/__fixtures__/1.basic/input.graphql +118 -0
  26. package/__fixtures__/1.basic/output.json +630 -0
  27. package/__fixtures__/2.circular/input.graphql +17 -0
  28. package/__fixtures__/2.circular/output.json +248 -0
  29. package/__fixtures__/3.opendocs/input.graphql +27 -0
  30. package/__fixtures__/3.opendocs/output.json +338 -0
  31. package/__fixtures__/4.union/input.graphql +19 -0
  32. package/__fixtures__/4.union/output.json +344 -0
  33. package/__fixtures__/5.flat/input.graphql +27 -0
  34. package/__fixtures__/5.flat/output.json +383 -0
  35. package/__fixtures__/6.default-values/input.graphql +47 -0
  36. package/__fixtures__/6.default-values/output.json +655 -0
  37. package/__fixtures__/7.type-args/input.graphql +19 -0
  38. package/__fixtures__/7.type-args/output.json +301 -0
  39. package/__fixtures__/8.default-sort/input.graphql +60 -0
  40. package/__fixtures__/8.default-sort/output.json +1078 -0
  41. package/__tests__/gqlSchemaToReferences.test.ts +109 -0
  42. package/__tests__/utils.ts +45 -0
  43. package/declarations.d.ts +4 -0
  44. package/dist/index.d.ts +17 -1
  45. package/dist/index.js +1334 -19871
  46. package/dist/index.js.map +1 -1
  47. package/dist/opendocs.graphql +56 -0
  48. package/package.json +7 -9
  49. package/src/context.ts +17 -0
  50. package/src/converters/gql-arg.ts +51 -0
  51. package/src/converters/gql-enum.ts +27 -0
  52. package/src/converters/gql-field.ts +164 -0
  53. package/src/converters/gql-input.ts +34 -0
  54. package/src/converters/gql-interface.ts +35 -0
  55. package/src/converters/gql-mutation.ts +36 -0
  56. package/src/converters/gql-object.ts +83 -0
  57. package/src/converters/gql-operation.ts +128 -0
  58. package/src/converters/gql-query.ts +36 -0
  59. package/src/converters/gql-sample.ts +159 -0
  60. package/src/converters/gql-scalar.ts +16 -0
  61. package/src/converters/gql-subscription.ts +36 -0
  62. package/src/converters/gql-types.ts +195 -0
  63. package/src/converters/gql-union.ts +40 -0
  64. package/src/gql-core.ts +362 -0
  65. package/src/opendocs.graphql +56 -0
  66. package/src/opendocs.ts +253 -0
  67. package/src/schema.ts +253 -67
  68. package/src/types.ts +103 -0
  69. package/src/utils.ts +21 -96
  70. package/tsconfig.json +1 -1
  71. package/tsup.config.ts +15 -1
  72. package/vitest.config.ts +15 -1
  73. package/examples/basic/index.ts +0 -12
  74. package/examples/basic/schema.graphqls +0 -89
  75. package/examples/basic/todo-app.graphqls +0 -184
  76. package/examples/graphql-types/graphql-types.0.basic.graphqls +0 -28
  77. package/examples/nested/nested-arg.0.not-required.graphqls +0 -8
  78. package/examples/nested/nested-arg.0.required.graphqls +0 -8
  79. package/examples/nested/nested-arg.1.deep.graphqls +0 -12
  80. package/src/hydration/README.md +0 -1
  81. package/src/hydration/gql-arg.ts +0 -53
  82. package/src/hydration/gql-field.ts +0 -206
  83. package/src/hydration/gql-input.ts +0 -67
  84. package/src/hydration/gql-object.ts +0 -35
  85. package/src/hydration/gql-types.ts +0 -50
  86. package/src/samples/index.ts +0 -95
  87. package/test/graphql-types.0.test.ts +0 -125
  88. package/test/nested-arg.0.test.ts +0 -208
  89. package/test/nested-arg.1.test.ts +0 -19
@@ -0,0 +1,9 @@
1
+ type Book {
2
+ book_id: ID!
3
+ }
4
+
5
+ type Query {
6
+ books(
7
+ book_id: ID!
8
+ ): [Book!]!
9
+ }
@@ -0,0 +1,151 @@
1
+ [
2
+ {
3
+ "title": "Book",
4
+ "description": "",
5
+ "canonical": "objects/Book",
6
+ "category": "graphql",
7
+ "type": "graphql_object",
8
+ "context": {
9
+ "graphqlTypeShort": "object",
10
+ "graphqlName": "Book",
11
+ "group": [
12
+ "Objects"
13
+ ],
14
+ "scopes": []
15
+ },
16
+ "examples": {
17
+ "groups": []
18
+ },
19
+ "definitions": [
20
+ {
21
+ "title": "Arguments",
22
+ "properties": [],
23
+ "variants": [],
24
+ "meta": [
25
+ {
26
+ "name": "type",
27
+ "value": "arguments"
28
+ }
29
+ ]
30
+ },
31
+ {
32
+ "title": "Fields",
33
+ "properties": [
34
+ {
35
+ "name": "book_id",
36
+ "type": "ID!",
37
+ "description": "",
38
+ "context": {
39
+ "graphqlName": "book_id",
40
+ "graphqlTypeFlat": "ID",
41
+ "graphqlBuiltInType": true
42
+ },
43
+ "properties": [],
44
+ "meta": [
45
+ {
46
+ "name": "required",
47
+ "value": "true"
48
+ }
49
+ ],
50
+ "symbolDef": {
51
+ "canonical": "/book_id"
52
+ }
53
+ }
54
+ ],
55
+ "meta": [
56
+ {
57
+ "name": "type",
58
+ "value": "fields"
59
+ }
60
+ ]
61
+ }
62
+ ]
63
+ },
64
+ {
65
+ "title": "books",
66
+ "description": "",
67
+ "canonical": "queries/books",
68
+ "category": "graphql",
69
+ "type": "graphql_query",
70
+ "context": {
71
+ "graphqlTypeShort": "query",
72
+ "graphqlName": "books",
73
+ "group": [
74
+ "Queries"
75
+ ],
76
+ "scopes": []
77
+ },
78
+ "examples": {
79
+ "groups": [
80
+ {
81
+ "description": "",
82
+ "examples": [
83
+ {
84
+ "codeblock": {
85
+ "tabs": [
86
+ {
87
+ "title": "",
88
+ "language": "graphql",
89
+ "code": "query books($book_id: ID!) {\n books(book_id: $book_id) {\n # books fields\n }\n}"
90
+ }
91
+ ]
92
+ }
93
+ }
94
+ ]
95
+ }
96
+ ]
97
+ },
98
+ "definitions": [
99
+ {
100
+ "title": "Arguments",
101
+ "properties": [
102
+ {
103
+ "name": "book_id",
104
+ "type": "ID!",
105
+ "description": "",
106
+ "context": {
107
+ "graphqlName": "book_id",
108
+ "graphqlTypeFlat": "ID",
109
+ "graphqlBuiltInType": true
110
+ },
111
+ "properties": [],
112
+ "meta": [
113
+ {
114
+ "name": "required",
115
+ "value": "true"
116
+ }
117
+ ],
118
+ "symbolDef": {
119
+ "canonical": "/book_id"
120
+ }
121
+ }
122
+ ]
123
+ },
124
+ {
125
+ "title": "Returns",
126
+ "properties": [
127
+ {
128
+ "name": "",
129
+ "type": "[Book!]!",
130
+ "description": "",
131
+ "context": {
132
+ "graphqlName": "books",
133
+ "graphqlTypeFlat": "Book",
134
+ "graphqlBuiltInType": false
135
+ },
136
+ "properties": [],
137
+ "meta": [
138
+ {
139
+ "name": "required",
140
+ "value": "true"
141
+ }
142
+ ],
143
+ "symbolDef": {
144
+ "canonical": "objects/Book"
145
+ }
146
+ }
147
+ ]
148
+ }
149
+ ]
150
+ }
151
+ ]
@@ -0,0 +1,118 @@
1
+ """
2
+ A book type
3
+ """
4
+ type Book {
5
+ """
6
+ The title of the book
7
+ """
8
+ title: String!
9
+
10
+ """
11
+ The author of the book
12
+ """
13
+ author_name: String!
14
+
15
+ """
16
+ The nested book information
17
+ """
18
+ info: BookInfo!
19
+ }
20
+
21
+ """
22
+ A book type
23
+ """
24
+ type Book {
25
+ """
26
+ The author of the book
27
+ """
28
+ author_name: String!
29
+ }
30
+
31
+ """
32
+ A book type
33
+ """
34
+ type Book {
35
+ """
36
+ The author of the book
37
+ """
38
+ author_name: String!
39
+ }
40
+
41
+ """
42
+ A nested book information type
43
+ """
44
+ type BookInfo {
45
+ """
46
+ The date of the book
47
+ """
48
+ date: String!
49
+ }
50
+
51
+ """
52
+ An author type
53
+ """
54
+ type Author {
55
+ """
56
+ The name of the author
57
+ """
58
+ name: String!
59
+
60
+ """
61
+ The books of the author
62
+ """
63
+ books: [String]
64
+ }
65
+
66
+ """
67
+ The input object for the getBook query
68
+ """
69
+ input BookInput {
70
+ """
71
+ The title of the book
72
+ """
73
+ title: String!
74
+
75
+ """
76
+ The author of the book
77
+ """
78
+ info: BookInfoInput!
79
+ }
80
+
81
+ """
82
+ A nested book information input
83
+ """
84
+ input BookInfoInput {
85
+ """
86
+ The date of the book
87
+ """
88
+ date: String!
89
+ }
90
+
91
+ type Query {
92
+ """
93
+ Get a book by title
94
+ """
95
+ getBookByTitle(
96
+ """
97
+ The title of the book
98
+ """
99
+ title: String!
100
+
101
+ """
102
+ The book info input
103
+ """
104
+ info: BookInfoInput
105
+ ): Book
106
+ }
107
+
108
+ type Mutation {
109
+ """
110
+ Add a book
111
+ """
112
+ addBook(input: BookInput!): Book!
113
+
114
+ """
115
+ Add an author
116
+ """
117
+ addAuthor(name: String!): Author!
118
+ }