@xyd-js/gql 0.1.0-xyd.13 → 0.1.0-xyd.15

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 (88) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/TODO.md +8 -0
  3. package/__fixtures__/-1.opendocs.docs-nested/input.graphql +66 -0
  4. package/__fixtures__/-1.opendocs.docs-nested/output.json +554 -0
  5. package/__fixtures__/-1.opendocs.flat/input.graphql +19 -0
  6. package/__fixtures__/-1.opendocs.flat/output.json +243 -0
  7. package/__fixtures__/-1.opendocs.scopes/input.graphql +33 -0
  8. package/__fixtures__/-1.opendocs.scopes/output.json +378 -0
  9. package/__fixtures__/-1.opendocs.sidebar/input.graphql +44 -0
  10. package/__fixtures__/-1.opendocs.sort/input.graphql +92 -0
  11. package/__fixtures__/-1.opendocs.sort/output.json +1078 -0
  12. package/__fixtures__/-1.opendocs.sort+group/input.graphql +111 -0
  13. package/__fixtures__/-1.opendocs.sort+group/output.json +1114 -0
  14. package/__fixtures__/-1.opendocs.sort+group+path/input.graphql +118 -0
  15. package/__fixtures__/-1.opendocs.sort+group+path/output.json +1114 -0
  16. package/__fixtures__/-2.complex.github/input.graphql +69424 -0
  17. package/__fixtures__/-2.complex.github/output.json +269874 -0
  18. package/__fixtures__/-2.complex.livesession/input.graphql +23 -0
  19. package/__fixtures__/-2.complex.livesession/output.json +302 -0
  20. package/__fixtures__/-2.complex.monday/input.graphql +6089 -0
  21. package/__fixtures__/-2.complex.monday/output.json +1 -0
  22. package/__fixtures__/-3.array-non-null-return/input.graphql +9 -0
  23. package/__fixtures__/-3.array-non-null-return/output.json +151 -0
  24. package/__fixtures__/1.basic/input.graphql +118 -0
  25. package/__fixtures__/1.basic/output.json +630 -0
  26. package/__fixtures__/2.circular/input.graphql +17 -0
  27. package/__fixtures__/2.circular/output.json +248 -0
  28. package/__fixtures__/3.opendocs/input.graphql +27 -0
  29. package/__fixtures__/3.opendocs/output.json +338 -0
  30. package/__fixtures__/4.union/input.graphql +19 -0
  31. package/__fixtures__/4.union/output.json +344 -0
  32. package/__fixtures__/5.flat/input.graphql +27 -0
  33. package/__fixtures__/5.flat/output.json +383 -0
  34. package/__fixtures__/6.default-values/input.graphql +47 -0
  35. package/__fixtures__/6.default-values/output.json +655 -0
  36. package/__fixtures__/7.type-args/input.graphql +19 -0
  37. package/__fixtures__/7.type-args/output.json +301 -0
  38. package/__fixtures__/8.default-sort/input.graphql +60 -0
  39. package/__fixtures__/8.default-sort/output.json +1078 -0
  40. package/__tests__/gqlSchemaToReferences.test.ts +109 -0
  41. package/__tests__/utils.ts +45 -0
  42. package/declarations.d.ts +4 -0
  43. package/dist/index.d.ts +17 -1
  44. package/dist/index.js +1334 -19871
  45. package/dist/index.js.map +1 -1
  46. package/dist/opendocs.graphql +56 -0
  47. package/package.json +7 -6
  48. package/src/context.ts +17 -0
  49. package/src/converters/gql-arg.ts +51 -0
  50. package/src/converters/gql-enum.ts +27 -0
  51. package/src/converters/gql-field.ts +164 -0
  52. package/src/converters/gql-input.ts +34 -0
  53. package/src/converters/gql-interface.ts +35 -0
  54. package/src/converters/gql-mutation.ts +36 -0
  55. package/src/converters/gql-object.ts +83 -0
  56. package/src/converters/gql-operation.ts +128 -0
  57. package/src/converters/gql-query.ts +36 -0
  58. package/src/converters/gql-sample.ts +159 -0
  59. package/src/converters/gql-scalar.ts +16 -0
  60. package/src/converters/gql-subscription.ts +36 -0
  61. package/src/converters/gql-types.ts +195 -0
  62. package/src/converters/gql-union.ts +40 -0
  63. package/src/gql-core.ts +362 -0
  64. package/src/opendocs.graphql +56 -0
  65. package/src/opendocs.ts +253 -0
  66. package/src/schema.ts +253 -67
  67. package/src/types.ts +103 -0
  68. package/src/utils.ts +21 -96
  69. package/tsconfig.json +1 -1
  70. package/tsup.config.ts +15 -1
  71. package/vitest.config.ts +15 -1
  72. package/examples/basic/index.ts +0 -12
  73. package/examples/basic/schema.graphqls +0 -89
  74. package/examples/basic/todo-app.graphqls +0 -184
  75. package/examples/graphql-types/graphql-types.0.basic.graphqls +0 -28
  76. package/examples/nested/nested-arg.0.not-required.graphqls +0 -8
  77. package/examples/nested/nested-arg.0.required.graphqls +0 -8
  78. package/examples/nested/nested-arg.1.deep.graphqls +0 -12
  79. package/src/hydration/README.md +0 -1
  80. package/src/hydration/gql-arg.ts +0 -53
  81. package/src/hydration/gql-field.ts +0 -206
  82. package/src/hydration/gql-input.ts +0 -67
  83. package/src/hydration/gql-object.ts +0 -35
  84. package/src/hydration/gql-types.ts +0 -50
  85. package/src/samples/index.ts +0 -95
  86. package/test/graphql-types.0.test.ts +0 -125
  87. package/test/nested-arg.0.test.ts +0 -208
  88. package/test/nested-arg.1.test.ts +0 -19
@@ -0,0 +1,118 @@
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
+ path: "users/queries"
86
+ ) {
87
+ user(id: ID!): User
88
+ users: [User!]!
89
+ @doc(
90
+ path: "users-list"
91
+ )
92
+ }
93
+
94
+ extend type Query @doc(
95
+ group: ["Search", "Queries"]
96
+ path: "search/queries"
97
+ ) {
98
+ search(query: String!): [SearchResult!]!
99
+ }
100
+
101
+ # Mutation
102
+ extend type Mutation @doc(
103
+ group: ["Users", "Mutations"]
104
+ path: "users/mutations"
105
+ ) {
106
+ createUser(input: UserInput!): User!
107
+ updateUser(id: ID!, input: UserInput!): User!
108
+ }
109
+
110
+ # Subscription
111
+ extend type Subscription @doc(
112
+ group: ["Users", "Subscriptions"]
113
+ path: "users/subscriptions"
114
+ ) {
115
+ userCreated: User!
116
+ userUpdated: User!
117
+ }
118
+