@xyd-js/gql 0.1.0-xyd.8 → 0.1.0-xyd.96

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 +819 -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,111 @@
1
+ type Query
2
+ type Mutation
3
+ type Subscription
4
+
5
+ extend schema @docs(
6
+ group: ["API & Reference"],
7
+ sortStack: [
8
+ ["Queries", "Mutations", "Subscriptions", "Inputs", "Objects", "Interfaces", "Unions", "Enums", "Scalars"],
9
+ ["Interfaces", "Unions", "Objects", "Inputs", "Enums", "Scalars"]
10
+ ],
11
+ sort: [
12
+ {
13
+ group: ["Users"],
14
+ },
15
+ {
16
+ group: ["Search"],
17
+ },
18
+ {
19
+ group: ["GraphQL Types"],
20
+ stack: 1,
21
+ },
22
+ ]
23
+ )
24
+
25
+ # Custom scalar
26
+
27
+ scalar DateTime
28
+ @doc(
29
+ group: ["GraphQL Types", "Scalars"]
30
+ )
31
+
32
+ # Enum
33
+ enum UserRole @doc(
34
+ group: ["Users", "Enums"]
35
+ ){
36
+ ADMIN
37
+ USER
38
+ GUEST
39
+ }
40
+
41
+ # Interface
42
+ interface Node @doc(
43
+ group: ["GraphQL Types", "Interfaces"]
44
+ ) {
45
+ id: ID!
46
+ }
47
+
48
+ # Input object
49
+ input UserInput @doc(
50
+ group: ["Users", "Inputs"]
51
+ ) {
52
+ name: String!
53
+ email: String!
54
+ role: UserRole
55
+ }
56
+
57
+ # Object
58
+ type User implements Node @doc(
59
+ group: ["Users", "Objects"]
60
+ ) {
61
+ id: ID!
62
+ name: String!
63
+ email: String!
64
+ role: UserRole!
65
+ createdAt: DateTime!
66
+ }
67
+
68
+ # Union
69
+ union SearchResult @doc(
70
+ group: ["Search", "Unions"]
71
+ ) = User | Post
72
+
73
+ type Post implements Node @doc(
74
+ group: ["Search", "Objects"]
75
+ ) {
76
+ id: ID!
77
+ title: String!
78
+ content: String!
79
+ author: User!
80
+ }
81
+
82
+ # Query
83
+ extend type Query @doc(
84
+ group: ["Users", "Queries"]
85
+ ) {
86
+ user(id: ID!): User
87
+ users: [User!]!
88
+ }
89
+
90
+ extend type Query @doc(
91
+ group: ["Search", "Queries"]
92
+ ) {
93
+ search(query: String!): [SearchResult!]!
94
+ }
95
+
96
+ # Mutation
97
+ extend type Mutation @doc(
98
+ group: ["Users", "Mutations"]
99
+ ) {
100
+ createUser(input: UserInput!): User!
101
+ updateUser(id: ID!, input: UserInput!): User!
102
+ }
103
+
104
+ # Subscription
105
+ extend type Subscription @doc(
106
+ group: ["Users", "Subscriptions"]
107
+ ) {
108
+ userCreated: User!
109
+ userUpdated: User!
110
+ }
111
+