polen 0.11.0-next.24 → 0.11.0-next.26

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 (375) hide show
  1. package/build/api/config/input.d.ts +259 -77
  2. package/build/api/config/input.d.ts.map +1 -1
  3. package/build/api/config/input.js +2 -0
  4. package/build/api/config/input.js.map +1 -1
  5. package/build/api/config/normalized.d.ts +433 -143
  6. package/build/api/config/normalized.d.ts.map +1 -1
  7. package/build/api/config/normalized.js +47 -0
  8. package/build/api/config/normalized.js.map +1 -1
  9. package/build/api/config-template/template.d.ts +191 -121
  10. package/build/api/config-template/template.d.ts.map +1 -1
  11. package/build/api/config-template/template.js +18 -1
  12. package/build/api/config-template/template.js.map +1 -1
  13. package/build/api/examples/diagnostic/diagnostic.d.ts +0 -23
  14. package/build/api/examples/diagnostic/diagnostic.d.ts.map +1 -1
  15. package/build/api/examples/diagnostic/diagnostic.js +1 -3
  16. package/build/api/examples/diagnostic/diagnostic.js.map +1 -1
  17. package/build/api/examples/scanner.d.ts +27 -1
  18. package/build/api/examples/scanner.d.ts.map +1 -1
  19. package/build/api/examples/scanner.js +30 -17
  20. package/build/api/examples/scanner.js.map +1 -1
  21. package/build/api/examples/schemas/catalog.d.ts +56 -12
  22. package/build/api/examples/schemas/catalog.d.ts.map +1 -1
  23. package/build/api/examples/schemas/example/example.d.ts +54 -11
  24. package/build/api/examples/schemas/example/example.d.ts.map +1 -1
  25. package/build/api/examples/schemas/example/example.js +5 -0
  26. package/build/api/examples/schemas/example/example.js.map +1 -1
  27. package/build/api/reference/$.d.ts +4 -0
  28. package/build/api/reference/$.d.ts.map +1 -0
  29. package/build/api/reference/$.js +4 -0
  30. package/build/api/reference/$.js.map +1 -0
  31. package/build/api/reference/catalog.d.ts +69 -0
  32. package/build/api/reference/catalog.d.ts.map +1 -0
  33. package/build/api/reference/catalog.js +44 -0
  34. package/build/api/reference/catalog.js.map +1 -0
  35. package/build/api/reference/config.d.ts +616 -0
  36. package/build/api/reference/config.d.ts.map +1 -0
  37. package/build/api/reference/config.js +162 -0
  38. package/build/api/reference/config.js.map +1 -0
  39. package/build/api/reference/scanner.d.ts +26 -0
  40. package/build/api/reference/scanner.d.ts.map +1 -0
  41. package/build/api/reference/scanner.js +27 -0
  42. package/build/api/reference/scanner.js.map +1 -0
  43. package/build/api/schema/augmentations/$$.d.ts +7 -0
  44. package/build/api/schema/augmentations/$$.d.ts.map +1 -0
  45. package/build/api/schema/augmentations/$$.js +7 -0
  46. package/build/api/schema/augmentations/$$.js.map +1 -0
  47. package/build/api/schema/augmentations/$.d.ts +1 -1
  48. package/build/api/schema/augmentations/$.d.ts.map +1 -1
  49. package/build/api/schema/augmentations/$.js +1 -1
  50. package/build/api/schema/augmentations/$.js.map +1 -1
  51. package/build/api/schema/augmentations/apply.d.ts +29 -0
  52. package/build/api/schema/augmentations/apply.d.ts.map +1 -0
  53. package/build/api/schema/augmentations/apply.js +181 -0
  54. package/build/api/schema/augmentations/apply.js.map +1 -0
  55. package/build/api/schema/augmentations/augmentation.d.ts +31 -0
  56. package/build/api/schema/augmentations/augmentation.d.ts.map +1 -0
  57. package/build/api/schema/augmentations/augmentation.js +22 -0
  58. package/build/api/schema/augmentations/augmentation.js.map +1 -0
  59. package/build/api/schema/augmentations/config.d.ts +24 -0
  60. package/build/api/schema/augmentations/config.d.ts.map +1 -0
  61. package/build/api/schema/augmentations/config.js +9 -0
  62. package/build/api/schema/augmentations/config.js.map +1 -0
  63. package/build/api/schema/augmentations/diagnostics/diagnostic.d.ts +67 -0
  64. package/build/api/schema/augmentations/diagnostics/diagnostic.d.ts.map +1 -0
  65. package/build/api/schema/augmentations/diagnostics/diagnostic.js +13 -0
  66. package/build/api/schema/augmentations/diagnostics/diagnostic.js.map +1 -0
  67. package/build/api/schema/augmentations/diagnostics/duplicate-version.d.ts +45 -0
  68. package/build/api/schema/augmentations/diagnostics/duplicate-version.d.ts.map +1 -0
  69. package/build/api/schema/augmentations/diagnostics/duplicate-version.js +17 -0
  70. package/build/api/schema/augmentations/diagnostics/duplicate-version.js.map +1 -0
  71. package/build/api/schema/augmentations/diagnostics/invalid-path.d.ts +46 -0
  72. package/build/api/schema/augmentations/diagnostics/invalid-path.d.ts.map +1 -0
  73. package/build/api/schema/augmentations/diagnostics/invalid-path.js +18 -0
  74. package/build/api/schema/augmentations/diagnostics/invalid-path.js.map +1 -0
  75. package/build/api/schema/augmentations/diagnostics/version-mismatch.d.ts +46 -0
  76. package/build/api/schema/augmentations/diagnostics/version-mismatch.d.ts.map +1 -0
  77. package/build/api/schema/augmentations/diagnostics/version-mismatch.js +18 -0
  78. package/build/api/schema/augmentations/diagnostics/version-mismatch.js.map +1 -0
  79. package/build/api/schema/augmentations/input.d.ts +145 -0
  80. package/build/api/schema/augmentations/input.d.ts.map +1 -0
  81. package/build/api/schema/augmentations/input.js +191 -0
  82. package/build/api/schema/augmentations/input.js.map +1 -0
  83. package/build/api/schema/augmentations/placement.d.ts +8 -0
  84. package/build/api/schema/augmentations/placement.d.ts.map +1 -0
  85. package/build/api/schema/augmentations/placement.js +7 -0
  86. package/build/api/schema/augmentations/placement.js.map +1 -0
  87. package/build/api/schema/config-schema.d.ts +66 -66
  88. package/build/api/schema/config-schema.d.ts.map +1 -1
  89. package/build/api/schema/config-schema.js +2 -2
  90. package/build/api/schema/config-schema.js.map +1 -1
  91. package/build/api/schema/input-source/load.d.ts +2 -0
  92. package/build/api/schema/input-source/load.d.ts.map +1 -1
  93. package/build/api/schema/input-source/load.js.map +1 -1
  94. package/build/api/schema/input-sources/directory.d.ts +39 -39
  95. package/build/api/schema/input-sources/file.d.ts +39 -39
  96. package/build/api/schema/input-sources/introspection-file.d.ts +39 -39
  97. package/build/api/schema/input-sources/introspection.d.ts +39 -39
  98. package/build/api/schema/input-sources/memory.d.ts +39 -39
  99. package/build/api/schema/input-sources/versioned-directory.d.ts +79 -79
  100. package/build/api/schema/load.d.ts.map +1 -1
  101. package/build/api/schema/load.js +9 -2
  102. package/build/api/schema/load.js.map +1 -1
  103. package/build/lib/catalog/catalog.d.ts +1181 -1181
  104. package/build/lib/catalog/unversioned.d.ts +312 -312
  105. package/build/lib/catalog/versioned.d.ts +634 -634
  106. package/build/lib/change/change.d.ts +238 -238
  107. package/build/lib/document/document.d.ts +14 -8
  108. package/build/lib/document/document.d.ts.map +1 -1
  109. package/build/lib/document/versioned.d.ts +17 -10
  110. package/build/lib/document/versioned.d.ts.map +1 -1
  111. package/build/lib/grafaid/schema/KindMap/_.d.ts +1 -1
  112. package/build/lib/grafaid/schema/format-default-value.d.ts +11 -0
  113. package/build/lib/grafaid/schema/format-default-value.d.ts.map +1 -0
  114. package/build/lib/grafaid/schema/format-default-value.js +20 -0
  115. package/build/lib/grafaid/schema/format-default-value.js.map +1 -0
  116. package/build/lib/grafaid/schema/schema.d.ts +1 -0
  117. package/build/lib/grafaid/schema/schema.d.ts.map +1 -1
  118. package/build/lib/grafaid/schema/schema.js +1 -0
  119. package/build/lib/grafaid/schema/schema.js.map +1 -1
  120. package/build/lib/graphql-path/$$.d.ts +7 -13
  121. package/build/lib/graphql-path/$$.d.ts.map +1 -1
  122. package/build/lib/graphql-path/$$.js +7 -13
  123. package/build/lib/graphql-path/$$.js.map +1 -1
  124. package/build/lib/graphql-path/definition.d.ts +104 -94
  125. package/build/lib/graphql-path/definition.d.ts.map +1 -1
  126. package/build/lib/graphql-path/definition.js +126 -125
  127. package/build/lib/graphql-path/definition.js.map +1 -1
  128. package/build/lib/graphql-path/query.d.ts +25 -57
  129. package/build/lib/graphql-path/query.d.ts.map +1 -1
  130. package/build/lib/graphql-path/query.js +15 -93
  131. package/build/lib/graphql-path/query.js.map +1 -1
  132. package/build/lib/graphql-path/schema.d.ts +49 -0
  133. package/build/lib/graphql-path/schema.d.ts.map +1 -0
  134. package/build/lib/graphql-path/schema.js +89 -0
  135. package/build/lib/graphql-path/schema.js.map +1 -0
  136. package/build/lib/graphql-path/types.d.ts +76 -28
  137. package/build/lib/graphql-path/types.d.ts.map +1 -1
  138. package/build/lib/graphql-path/types.js +101 -2
  139. package/build/lib/graphql-path/types.js.map +1 -1
  140. package/build/lib/revision/revision.d.ts +1170 -1170
  141. package/build/lib/schema/schema.d.ts +708 -708
  142. package/build/lib/schema/unversioned.d.ts +1092 -1092
  143. package/build/lib/schema/versioned.d.ts +634 -634
  144. package/build/lib/semver/official-release.d.ts +10 -10
  145. package/build/lib/semver/pre-release.d.ts +10 -10
  146. package/build/lib/semver/semver.d.ts +50 -50
  147. package/build/lib/version-coverage/version-coverage.d.ts +43 -11
  148. package/build/lib/version-coverage/version-coverage.d.ts.map +1 -1
  149. package/build/lib/version-coverage/version-coverage.js +40 -6
  150. package/build/lib/version-coverage/version-coverage.js.map +1 -1
  151. package/build/template/components/ArgumentAnnotation.d.ts +2 -1
  152. package/build/template/components/ArgumentAnnotation.d.ts.map +1 -1
  153. package/build/template/components/ArgumentAnnotation.js +14 -4
  154. package/build/template/components/ArgumentAnnotation.js.map +1 -1
  155. package/build/template/components/ArgumentListAnnotation.d.ts +1 -0
  156. package/build/template/components/ArgumentListAnnotation.d.ts.map +1 -1
  157. package/build/template/components/ArgumentListAnnotation.js +21 -8
  158. package/build/template/components/ArgumentListAnnotation.js.map +1 -1
  159. package/build/template/components/Changelog/groups/FieldArgument.d.ts.map +1 -1
  160. package/build/template/components/Changelog/groups/FieldArgument.js +0 -1
  161. package/build/template/components/Changelog/groups/FieldArgument.js.map +1 -1
  162. package/build/template/components/CodeBlock.d.ts.map +1 -1
  163. package/build/template/components/CodeBlock.js +1 -1
  164. package/build/template/components/CodeBlock.js.map +1 -1
  165. package/build/template/components/Description.js +1 -1
  166. package/build/template/components/Description.js.map +1 -1
  167. package/build/template/components/ExampleLink.d.ts.map +1 -1
  168. package/build/template/components/ExampleLink.js +2 -1
  169. package/build/template/components/ExampleLink.js.map +1 -1
  170. package/build/template/components/Field.d.ts +2 -0
  171. package/build/template/components/Field.d.ts.map +1 -1
  172. package/build/template/components/Field.js +42 -4
  173. package/build/template/components/Field.js.map +1 -1
  174. package/build/template/components/FieldList.d.ts +2 -1
  175. package/build/template/components/FieldList.d.ts.map +1 -1
  176. package/build/template/components/FieldList.js +14 -3
  177. package/build/template/components/FieldList.js.map +1 -1
  178. package/build/template/components/FieldListSection.d.ts.map +1 -1
  179. package/build/template/components/FieldListSection.js +6 -1
  180. package/build/template/components/FieldListSection.js.map +1 -1
  181. package/build/template/components/GraphQLDocument.d.ts.map +1 -1
  182. package/build/template/components/GraphQLDocument.js +2 -1
  183. package/build/template/components/GraphQLDocument.js.map +1 -1
  184. package/build/template/components/GraphQLInteractive/GraphQLInteractive.d.ts +2 -0
  185. package/build/template/components/GraphQLInteractive/GraphQLInteractive.d.ts.map +1 -1
  186. package/build/template/components/GraphQLInteractive/GraphQLInteractive.js +4 -3
  187. package/build/template/components/GraphQLInteractive/GraphQLInteractive.js.map +1 -1
  188. package/build/template/components/GraphQLInteractive/lib/parser.d.ts +2 -2
  189. package/build/template/components/GraphQLInteractive/lib/parser.d.ts.map +1 -1
  190. package/build/template/components/GraphQLInteractive/lib/parser.js +17 -12
  191. package/build/template/components/GraphQLInteractive/lib/parser.js.map +1 -1
  192. package/build/template/components/IAPIndicator.d.ts +12 -0
  193. package/build/template/components/IAPIndicator.d.ts.map +1 -0
  194. package/build/template/components/IAPIndicator.js +21 -0
  195. package/build/template/components/IAPIndicator.js.map +1 -0
  196. package/build/template/components/Link.d.ts +1 -2
  197. package/build/template/components/Link.d.ts.map +1 -1
  198. package/build/template/components/Link.js +5 -2
  199. package/build/template/components/Link.js.map +1 -1
  200. package/build/template/components/NamedType.d.ts.map +1 -1
  201. package/build/template/components/NamedType.js +9 -5
  202. package/build/template/components/NamedType.js.map +1 -1
  203. package/build/template/components/ReferenceLink.d.ts +2 -2
  204. package/build/template/components/ReferenceLink.d.ts.map +1 -1
  205. package/build/template/components/ReferenceLink.js +5 -3
  206. package/build/template/components/ReferenceLink.js.map +1 -1
  207. package/build/template/components/TypeAnnotation.d.ts +2 -0
  208. package/build/template/components/TypeAnnotation.d.ts.map +1 -1
  209. package/build/template/components/TypeAnnotation.js +4 -4
  210. package/build/template/components/TypeAnnotation.js.map +1 -1
  211. package/build/template/components/ViewModeToggle.d.ts +3 -0
  212. package/build/template/components/ViewModeToggle.d.ts.map +1 -0
  213. package/build/template/components/ViewModeToggle.js +9 -0
  214. package/build/template/components/ViewModeToggle.js.map +1 -0
  215. package/build/template/components/graphql/type-link.d.ts +2 -0
  216. package/build/template/components/graphql/type-link.d.ts.map +1 -1
  217. package/build/template/components/graphql/type-link.js +15 -3
  218. package/build/template/components/graphql/type-link.js.map +1 -1
  219. package/build/template/components/home/PlaygroundPreview.d.ts.map +1 -1
  220. package/build/template/components/home/PlaygroundPreview.js +3 -2
  221. package/build/template/components/home/PlaygroundPreview.js.map +1 -1
  222. package/build/template/components/sidebar/SidebarItem.d.ts.map +1 -1
  223. package/build/template/components/sidebar/SidebarItem.js +18 -5
  224. package/build/template/components/sidebar/SidebarItem.js.map +1 -1
  225. package/build/template/contexts/ReferenceConfigContext.d.ts +16 -0
  226. package/build/template/contexts/ReferenceConfigContext.d.ts.map +1 -0
  227. package/build/template/contexts/ReferenceConfigContext.js +14 -0
  228. package/build/template/contexts/ReferenceConfigContext.js.map +1 -0
  229. package/build/template/contexts/ViewModeContext.d.ts +14 -0
  230. package/build/template/contexts/ViewModeContext.d.ts.map +1 -0
  231. package/build/template/contexts/ViewModeContext.js +40 -0
  232. package/build/template/contexts/ViewModeContext.js.map +1 -0
  233. package/build/template/hooks/use-examples.d.ts +4 -1
  234. package/build/template/hooks/use-examples.d.ts.map +1 -1
  235. package/build/template/hooks/useAlignedColumns.d.ts +10 -0
  236. package/build/template/hooks/useAlignedColumns.d.ts.map +1 -0
  237. package/build/template/hooks/useAlignedColumns.js +17 -0
  238. package/build/template/hooks/useAlignedColumns.js.map +1 -0
  239. package/build/template/routes/changelog/ChangelogSidebar.d.ts +2 -2
  240. package/build/template/routes/changelog/ChangelogSidebar.d.ts.map +1 -1
  241. package/build/template/routes/changelog/ChangelogSidebar.js +4 -4
  242. package/build/template/routes/changelog/ChangelogSidebar.js.map +1 -1
  243. package/build/template/routes/examples/_.d.ts +12 -3
  244. package/build/template/routes/examples/_.d.ts.map +1 -1
  245. package/build/template/routes/examples/_index.d.ts +8 -2
  246. package/build/template/routes/examples/_index.d.ts.map +1 -1
  247. package/build/template/routes/examples/name.d.ts +12 -3
  248. package/build/template/routes/examples/name.d.ts.map +1 -1
  249. package/build/template/routes/examples/name.js +6 -2
  250. package/build/template/routes/examples/name.js.map +1 -1
  251. package/build/template/routes/reference.d.ts.map +1 -1
  252. package/build/template/routes/reference.js +37 -10
  253. package/build/template/routes/reference.js.map +1 -1
  254. package/build/template/stores/changelog.d.ts +39 -39
  255. package/build/vite/plugins/core.d.ts.map +1 -1
  256. package/build/vite/plugins/core.js +6 -0
  257. package/build/vite/plugins/core.js.map +1 -1
  258. package/build/vite/plugins/examples.d.ts.map +1 -1
  259. package/build/vite/plugins/examples.js +10 -3
  260. package/build/vite/plugins/examples.js.map +1 -1
  261. package/build/vite/plugins/index.d.ts +1 -0
  262. package/build/vite/plugins/index.d.ts.map +1 -1
  263. package/build/vite/plugins/index.js +1 -0
  264. package/build/vite/plugins/index.js.map +1 -1
  265. package/build/vite/plugins/navbar.d.ts.map +1 -1
  266. package/build/vite/plugins/navbar.js +3 -1
  267. package/build/vite/plugins/navbar.js.map +1 -1
  268. package/build/vite/plugins/reference.d.ts +19 -0
  269. package/build/vite/plugins/reference.d.ts.map +1 -0
  270. package/build/vite/plugins/reference.js +96 -0
  271. package/build/vite/plugins/reference.js.map +1 -0
  272. package/build/vite/plugins/schemas.d.ts.map +1 -1
  273. package/build/vite/plugins/schemas.js +38 -2
  274. package/build/vite/plugins/schemas.js.map +1 -1
  275. package/package.json +1 -1
  276. package/src/api/config/input.ts +2 -0
  277. package/src/api/config/normalized.ts +54 -0
  278. package/src/api/config-template/template.ts +18 -1
  279. package/src/api/examples/diagnostic/diagnostic.ts +0 -3
  280. package/src/api/examples/scanner.test.ts +83 -0
  281. package/src/api/examples/scanner.ts +31 -21
  282. package/src/api/examples/schemas/example/example.ts +6 -0
  283. package/src/api/reference/$.ts +3 -0
  284. package/src/api/reference/catalog.ts +55 -0
  285. package/src/api/reference/config.ts +193 -0
  286. package/src/api/reference/scanner.ts +53 -0
  287. package/src/api/schema/augmentations/$$.ts +6 -0
  288. package/src/api/schema/augmentations/$.ts +1 -1
  289. package/src/api/schema/augmentations/apply.test.ts +89 -0
  290. package/src/api/schema/augmentations/apply.ts +277 -0
  291. package/src/api/schema/augmentations/augmentation.ts +24 -0
  292. package/src/api/schema/augmentations/config.ts +11 -0
  293. package/src/api/schema/augmentations/diagnostics/diagnostic.ts +20 -0
  294. package/src/api/schema/augmentations/diagnostics/duplicate-version.ts +20 -0
  295. package/src/api/schema/augmentations/diagnostics/invalid-path.ts +21 -0
  296. package/src/api/schema/augmentations/diagnostics/version-mismatch.ts +21 -0
  297. package/src/api/schema/augmentations/input.test.ts +144 -0
  298. package/src/api/schema/augmentations/input.ts +215 -0
  299. package/src/api/schema/augmentations/placement.ts +11 -0
  300. package/src/api/schema/config-schema.ts +2 -2
  301. package/src/api/schema/input-source/load.ts +2 -0
  302. package/src/api/schema/load.ts +19 -2
  303. package/src/lib/grafaid/schema/format-default-value.ts +22 -0
  304. package/src/lib/grafaid/schema/schema.ts +2 -0
  305. package/src/lib/graphql-path/$$.ts +7 -13
  306. package/src/lib/graphql-path/$.test.ts +175 -0
  307. package/src/lib/graphql-path/definition.ts +162 -162
  308. package/src/lib/graphql-path/query.ts +15 -98
  309. package/src/lib/graphql-path/schema.ts +136 -0
  310. package/src/lib/graphql-path/types.ts +108 -28
  311. package/src/lib/version-coverage/version-coverage.ts +48 -6
  312. package/src/template/components/ArgumentAnnotation.tsx +58 -9
  313. package/src/template/components/ArgumentListAnnotation.tsx +50 -17
  314. package/src/template/components/Changelog/groups/FieldArgument.tsx +0 -1
  315. package/src/template/components/CodeBlock.tsx +1 -0
  316. package/src/template/components/Description.tsx +1 -1
  317. package/src/template/components/ExampleLink.tsx +2 -1
  318. package/src/template/components/Field.tsx +148 -20
  319. package/src/template/components/FieldList.tsx +28 -13
  320. package/src/template/components/FieldListSection.tsx +12 -2
  321. package/src/template/components/GraphQLDocument.tsx +2 -0
  322. package/src/template/components/GraphQLInteractive/GraphQLInteractive.tsx +6 -1
  323. package/src/template/components/GraphQLInteractive/lib/parser.ts +16 -3
  324. package/src/template/components/IAPIndicator.tsx +73 -0
  325. package/src/template/components/Link.tsx +9 -3
  326. package/src/template/components/NamedType.tsx +54 -28
  327. package/src/template/components/ReferenceLink.tsx +16 -10
  328. package/src/template/components/TypeAnnotation.tsx +17 -5
  329. package/src/template/components/ViewModeToggle.tsx +27 -0
  330. package/src/template/components/graphql/type-link.tsx +34 -3
  331. package/src/template/components/home/PlaygroundPreview.tsx +3 -0
  332. package/src/template/components/sidebar/SidebarItem.tsx +21 -5
  333. package/src/template/contexts/ReferenceConfigContext.tsx +37 -0
  334. package/src/template/contexts/ViewModeContext.tsx +64 -0
  335. package/src/template/hooks/useAlignedColumns.ts +19 -0
  336. package/src/template/routes/changelog/ChangelogSidebar.tsx +4 -4
  337. package/src/template/routes/examples/name.tsx +13 -1
  338. package/src/template/routes/reference.tsx +67 -23
  339. package/src/types/virtual-modules.d.ts +5 -0
  340. package/src/vite/plugins/core.ts +6 -0
  341. package/src/vite/plugins/examples.ts +12 -2
  342. package/src/vite/plugins/index.ts +1 -0
  343. package/src/vite/plugins/navbar.ts +4 -1
  344. package/src/vite/plugins/reference.ts +130 -0
  345. package/src/vite/plugins/schemas.ts +51 -2
  346. package/build/api/examples/diagnostic/unused-default.d.ts +0 -49
  347. package/build/api/examples/diagnostic/unused-default.d.ts.map +0 -1
  348. package/build/api/examples/diagnostic/unused-default.js +0 -19
  349. package/build/api/examples/diagnostic/unused-default.js.map +0 -1
  350. package/build/api/schema/augmentations/augmentations/description.d.ts +0 -26
  351. package/build/api/schema/augmentations/augmentations/description.d.ts.map +0 -1
  352. package/build/api/schema/augmentations/augmentations/description.js +0 -55
  353. package/build/api/schema/augmentations/augmentations/description.js.map +0 -1
  354. package/build/api/schema/augmentations/schema-augmentation.d.ts +0 -20
  355. package/build/api/schema/augmentations/schema-augmentation.d.ts.map +0 -1
  356. package/build/api/schema/augmentations/schema-augmentation.js +0 -22
  357. package/build/api/schema/augmentations/schema-augmentation.js.map +0 -1
  358. package/build/api/schema/augmentations/target.d.ts +0 -25
  359. package/build/api/schema/augmentations/target.d.ts.map +0 -1
  360. package/build/api/schema/augmentations/target.js +0 -39
  361. package/build/api/schema/augmentations/target.js.map +0 -1
  362. package/build/lib/graphql-path/constructors.d.ts +0 -57
  363. package/build/lib/graphql-path/constructors.d.ts.map +0 -1
  364. package/build/lib/graphql-path/constructors.js +0 -73
  365. package/build/lib/graphql-path/constructors.js.map +0 -1
  366. package/build/template/components/ArgumentList.d.ts +0 -6
  367. package/build/template/components/ArgumentList.d.ts.map +0 -1
  368. package/build/template/components/ArgumentList.js +0 -9
  369. package/build/template/components/ArgumentList.js.map +0 -1
  370. package/src/api/examples/diagnostic/unused-default.ts +0 -22
  371. package/src/api/schema/augmentations/augmentations/description.ts +0 -69
  372. package/src/api/schema/augmentations/schema-augmentation.ts +0 -32
  373. package/src/api/schema/augmentations/target.ts +0 -61
  374. package/src/lib/graphql-path/constructors.ts +0 -81
  375. package/src/template/components/ArgumentList.tsx +0 -22
@@ -0,0 +1,175 @@
1
+ import { S } from '#lib/kit-temp/effect'
2
+ import { describe, expect, test } from 'vitest'
3
+ import { GraphQLPath } from './$.js'
4
+
5
+ describe('decode', () => {
6
+ test.for([
7
+ ['User', [{ _tag: 'TypeSegment', type: 'User' }]],
8
+ ['User.name', [
9
+ { _tag: 'TypeSegment', type: 'User' },
10
+ { _tag: 'FieldSegment', field: 'name' },
11
+ ]],
12
+ ['User.posts(limit)', [
13
+ { _tag: 'TypeSegment', type: 'User' },
14
+ { _tag: 'FieldSegment', field: 'posts' },
15
+ { _tag: 'ArgumentSegment', argument: 'limit' },
16
+ ]],
17
+ ])('decodes "%s"', ([input, expected]) => {
18
+ expect(GraphQLPath.Definition.decodeSync(input)).toEqual(expected)
19
+ })
20
+
21
+ test.for([
22
+ '',
23
+ 'Type.field.extra',
24
+ 'Type(arg)',
25
+ '.field',
26
+ 'Type.',
27
+ ])('throws on invalid format "%s"', (input) => {
28
+ expect(() => GraphQLPath.Definition.decodeSync(input)).toThrow()
29
+ })
30
+ })
31
+
32
+ describe('encode', () => {
33
+ test.for(
34
+ [
35
+ [GraphQLPath.Definition.type('User'), 'User'],
36
+ [GraphQLPath.Definition.field('User', 'name'), 'User.name'],
37
+ [GraphQLPath.Definition.argument('User', 'posts', 'limit'), 'User.posts(limit)'],
38
+ ] as const,
39
+ )('encodes path to "%s"', ([path, expected]) => {
40
+ expect(GraphQLPath.Definition.encodeSync(path as any)).toBe(expected)
41
+ })
42
+ })
43
+
44
+ describe('round-trip', () => {
45
+ test.for([
46
+ 'Query',
47
+ 'Mutation',
48
+ 'User',
49
+ 'User.id',
50
+ 'User.name',
51
+ 'Query.users',
52
+ 'User.posts(limit)',
53
+ 'Query.search(query)',
54
+ 'Mutation.createUser(input)',
55
+ ])('round-trips "%s"', (pathString) => {
56
+ const decoded = GraphQLPath.Definition.decodeSync(pathString)
57
+ const encoded = GraphQLPath.Definition.encodeSync(decoded)
58
+ expect(encoded).toBe(pathString)
59
+ })
60
+ })
61
+
62
+ describe('type guards', () => {
63
+ const typePath = GraphQLPath.Definition.decodeSync('User')
64
+ const fieldPath = GraphQLPath.Definition.decodeSync('User.name')
65
+ const argPath = GraphQLPath.Definition.decodeSync('User.posts(limit)')
66
+
67
+ test('isTypeDefinitionPath', () => {
68
+ expect(GraphQLPath.Definition.isTypeDefinitionPath(typePath)).toBe(true)
69
+ expect(GraphQLPath.Definition.isTypeDefinitionPath(fieldPath)).toBe(false)
70
+ expect(GraphQLPath.Definition.isTypeDefinitionPath(argPath)).toBe(false)
71
+ })
72
+
73
+ test('isFieldDefinitionPath', () => {
74
+ expect(GraphQLPath.Definition.isFieldDefinitionPath(typePath)).toBe(false)
75
+ expect(GraphQLPath.Definition.isFieldDefinitionPath(fieldPath)).toBe(true)
76
+ expect(GraphQLPath.Definition.isFieldDefinitionPath(argPath)).toBe(false)
77
+ })
78
+
79
+ test('isArgumentDefinitionPath', () => {
80
+ expect(GraphQLPath.Definition.isArgumentDefinitionPath(typePath)).toBe(false)
81
+ expect(GraphQLPath.Definition.isArgumentDefinitionPath(fieldPath)).toBe(false)
82
+ expect(GraphQLPath.Definition.isArgumentDefinitionPath(argPath)).toBe(true)
83
+ })
84
+
85
+ test('Effect Schema derived segment type guards', async () => {
86
+ // Import from the types module directly since constructors re-exports them
87
+ const { isTypeSegment, isFieldSegment, isArgumentSegment } = await import('./types.js')
88
+
89
+ const typeSegment = { _tag: 'TypeSegment', type: 'User' } as const
90
+ const fieldSegment = { _tag: 'FieldSegment', field: 'name' } as const
91
+ const argSegment = { _tag: 'ArgumentSegment', argument: 'limit' } as const
92
+
93
+ // Test that Effect Schema derived guards work correctly
94
+ expect(isTypeSegment(typeSegment)).toBe(true)
95
+ expect(isTypeSegment(fieldSegment)).toBe(false)
96
+ expect(isFieldSegment(fieldSegment)).toBe(true)
97
+ expect(isFieldSegment(typeSegment)).toBe(false)
98
+ expect(isArgumentSegment(argSegment)).toBe(true)
99
+ expect(isArgumentSegment(typeSegment)).toBe(false)
100
+ })
101
+ })
102
+
103
+ describe('helper functions', () => {
104
+ test('getType extracts type from all path types', () => {
105
+ expect(GraphQLPath.Definition.getType(GraphQLPath.Definition.decodeSync('User'))).toBe('User')
106
+ expect(GraphQLPath.Definition.getType(GraphQLPath.Definition.decodeSync('User.name'))).toBe('User')
107
+ expect(GraphQLPath.Definition.getType(GraphQLPath.Definition.decodeSync('User.posts(limit)'))).toBe('User')
108
+ })
109
+
110
+ test('getField extracts field name', () => {
111
+ const fieldPath = GraphQLPath.Definition.decodeSync('User.name')
112
+ const argPath = GraphQLPath.Definition.decodeSync('User.posts(limit)')
113
+
114
+ if (GraphQLPath.Definition.isFieldDefinitionPath(fieldPath)) {
115
+ expect(GraphQLPath.Definition.getField(fieldPath)).toBe('name')
116
+ }
117
+ if (GraphQLPath.Definition.isArgumentDefinitionPath(argPath)) {
118
+ expect(GraphQLPath.Definition.getField(argPath)).toBe('posts')
119
+ }
120
+ })
121
+
122
+ test('getArgument extracts argument name', () => {
123
+ const argPath = GraphQLPath.Definition.decodeSync('User.posts(limit)')
124
+ if (GraphQLPath.Definition.isArgumentDefinitionPath(argPath)) {
125
+ expect(GraphQLPath.Definition.getArgument(argPath)).toBe('limit')
126
+ }
127
+ })
128
+ })
129
+
130
+ describe('constructors', () => {
131
+ test.for([
132
+ [GraphQLPath.Definition.type('User'), [{ _tag: 'TypeSegment', type: 'User' }]],
133
+ [GraphQLPath.Definition.field('User', 'name'), [
134
+ { _tag: 'TypeSegment', type: 'User' },
135
+ { _tag: 'FieldSegment', field: 'name' },
136
+ ]],
137
+ [GraphQLPath.Definition.argument('User', 'posts', 'limit'), [
138
+ { _tag: 'TypeSegment', type: 'User' },
139
+ { _tag: 'FieldSegment', field: 'posts' },
140
+ { _tag: 'ArgumentSegment', argument: 'limit' },
141
+ ]],
142
+ ])('constructor creates correct structure', ([result, expected]) => {
143
+ expect(result).toEqual(expected)
144
+ })
145
+ })
146
+
147
+ describe('Schema validation', () => {
148
+ test.for(
149
+ [
150
+ [GraphQLPath.Definition.TypeDefinitionPath, 'User', [{ _tag: 'TypeSegment', type: 'User' }]],
151
+ [GraphQLPath.Definition.FieldDefinitionPath, 'User.name', [
152
+ { _tag: 'TypeSegment', type: 'User' },
153
+ { _tag: 'FieldSegment', field: 'name' },
154
+ ]],
155
+ [GraphQLPath.Definition.ArgumentDefinitionPath, 'User.posts(limit)', [
156
+ { _tag: 'TypeSegment', type: 'User' },
157
+ { _tag: 'FieldSegment', field: 'posts' },
158
+ { _tag: 'ArgumentSegment', argument: 'limit' },
159
+ ]],
160
+ ] as const,
161
+ )('validates through Effect Schema', ([schema, input, expected]) => {
162
+ const result = S.decodeUnknownSync(schema as any)(input)
163
+ expect(result).toEqual(expected)
164
+ })
165
+
166
+ test('union automatically selects correct type', () => {
167
+ const typePath = S.decodeUnknownSync(GraphQLPath.Definition.DefinitionPath)('User')
168
+ const fieldPath = S.decodeUnknownSync(GraphQLPath.Definition.DefinitionPath)('User.name')
169
+ const argPath = S.decodeUnknownSync(GraphQLPath.Definition.DefinitionPath)('User.posts(limit)')
170
+
171
+ expect(typePath.length).toBe(1)
172
+ expect(fieldPath.length).toBe(2)
173
+ expect(argPath.length).toBe(3)
174
+ })
175
+ })
@@ -1,73 +1,153 @@
1
1
  /**
2
- * Definition path operations
3
- */
4
-
5
- import { createArgumentSegment, createFieldSegment, createTypeSegment } from './constructors.js'
6
-
7
- import type { ArgumentSegment, FieldSegment, TypeSegment } from '#lib/graphql-path/types'
8
-
9
- /**
10
- * Encode a definition path to a human-readable expression string
11
- *
12
- * @param path - The definition path to encode
13
- * @returns A string expression representation
14
- * @example
15
- * encode(field('User', 'name')) // 'User.name'
16
- * encode(argument('User', 'posts', 'limit')) // 'User.posts(limit)'
17
- */
18
- export const encode = (path: DefinitionPath): string => {
19
- if (isTypeDefinitionPath(path)) {
20
- return path[0].type
21
- } else if (isFieldDefinitionPath(path)) {
22
- return `${path[0].type}.${path[1].field}`
23
- } else if (isArgumentDefinitionPath(path)) {
24
- return `${path[0].type}.${path[1].field}(${path[2].argument})`
25
- }
26
- return ''
27
- }
2
+ * Definition path operations using Effect Schema transforms
3
+ */
4
+
5
+ import { S } from '#lib/kit-temp/effect'
6
+ import { ParseResult } from 'effect'
7
+ import { ArgumentSegment, FieldSegment, TypeSegment } from './types.js'
8
+
9
+ // ============================================================================
10
+ // Internal Path Schemas (Decoded Forms)
11
+ // ============================================================================
12
+
13
+ const TypeDefinitionPathDecoded = S.Tuple(TypeSegment)
14
+ const FieldDefinitionPathDecoded = S.Tuple(TypeSegment, FieldSegment)
15
+ const ArgumentDefinitionPathDecoded = S.Tuple(TypeSegment, FieldSegment, ArgumentSegment)
16
+
17
+ // ============================================================================
18
+ // Transform Codecs (String <-> Struct)
19
+ // ============================================================================
20
+
21
+ /**
22
+ * Type definition path codec
23
+ * Encoded: "User"
24
+ * Decoded: [{ _tag: 'TypeSegment', type: 'User' }]
25
+ */
26
+ export const TypeDefinitionPath = S.transformOrFail(
27
+ S.String,
28
+ TypeDefinitionPathDecoded,
29
+ {
30
+ decode: (str, _options, ast) => {
31
+ if (!str || str.includes('.') || str.includes('(')) {
32
+ return ParseResult.fail(new ParseResult.Type(ast, str))
33
+ }
34
+ return ParseResult.succeed([TypeSegment.make({ type: str })])
35
+ },
36
+ encode: (path) => ParseResult.succeed(path[0].type),
37
+ },
38
+ ).annotations({
39
+ identifier: 'TypeDefinitionPath',
40
+ description: 'Path to a type definition',
41
+ })
42
+
43
+ /**
44
+ * Field definition path codec
45
+ * Encoded: "User.name"
46
+ * Decoded: [{ _tag: 'TypeSegment', type: 'User' }, { _tag: 'FieldSegment', field: 'name' }]
47
+ */
48
+ export const FieldDefinitionPath = S.transformOrFail(
49
+ S.String,
50
+ FieldDefinitionPathDecoded,
51
+ {
52
+ decode: (str, _options, ast) => {
53
+ const parts = str.split('.')
54
+ if (parts.length !== 2 || !parts[0] || !parts[1] || str.includes('(')) {
55
+ return ParseResult.fail(new ParseResult.Type(ast, str))
56
+ }
57
+ return ParseResult.succeed([
58
+ TypeSegment.make({ type: parts[0] }),
59
+ FieldSegment.make({ field: parts[1] }),
60
+ ])
61
+ },
62
+ encode: (path) => ParseResult.succeed(`${path[0].type}.${path[1].field}`),
63
+ },
64
+ ).annotations({
65
+ identifier: 'FieldDefinitionPath',
66
+ description: 'Path to a field definition',
67
+ })
68
+
69
+ /**
70
+ * Argument definition path codec
71
+ * Encoded: "User.posts(limit)"
72
+ * Decoded: [{ _tag: 'TypeSegment', type: 'User' }, { _tag: 'FieldSegment', field: 'posts' }, { _tag: 'ArgumentSegment', argument: 'limit' }]
73
+ */
74
+ export const ArgumentDefinitionPath = S.transformOrFail(
75
+ S.String,
76
+ ArgumentDefinitionPathDecoded,
77
+ {
78
+ decode: (str, _options, ast) => {
79
+ const match = str.match(/^([^.]+)\.([^.(]+)\(([^)]+)\)$/)
80
+ if (!match || !match[1] || !match[2] || !match[3]) {
81
+ return ParseResult.fail(new ParseResult.Type(ast, str))
82
+ }
83
+ return ParseResult.succeed([
84
+ TypeSegment.make({ type: match[1] }),
85
+ FieldSegment.make({ field: match[2] }),
86
+ ArgumentSegment.make({ argument: match[3] }),
87
+ ])
88
+ },
89
+ encode: (path) => ParseResult.succeed(`${path[0].type}.${path[1].field}(${path[2].argument})`),
90
+ },
91
+ ).annotations({
92
+ identifier: 'ArgumentDefinitionPath',
93
+ description: 'Path to an argument definition',
94
+ })
95
+
96
+ /**
97
+ * Union of all definition paths
98
+ * Automatically determines the correct path type from the string format
99
+ */
100
+ export const DefinitionPath = S.Union(
101
+ ArgumentDefinitionPath, // Check argument first (most specific)
102
+ FieldDefinitionPath, // Then field
103
+ TypeDefinitionPath, // Then type (least specific)
104
+ ).annotations({
105
+ identifier: 'DefinitionPath',
106
+ description: 'Union of all definition path types',
107
+ })
108
+
109
+ // ============================================================================
110
+ // Type Exports
111
+ // ============================================================================
112
+
113
+ export type TypeDefinitionPath = S.Schema.Type<typeof TypeDefinitionPath>
114
+ export type FieldDefinitionPath = S.Schema.Type<typeof FieldDefinitionPath>
115
+ export type ArgumentDefinitionPath = S.Schema.Type<typeof ArgumentDefinitionPath>
116
+ export type DefinitionPath = S.Schema.Type<typeof DefinitionPath>
117
+
118
+ // ============================================================================
119
+ // Codec Functions
120
+ // ============================================================================
28
121
 
29
122
  /**
30
123
  * Decode a string expression into a definition path
31
- *
32
124
  * @param expression - The string expression to decode
33
- * @returns The decoded definition path or null if invalid
125
+ * @returns The decoded definition path
34
126
  * @example
35
127
  * decode('User') // type definition path
36
128
  * decode('User.name') // field definition path
37
129
  * decode('User.posts(limit)') // argument definition path
38
130
  */
39
- export const decode = (expression: string): DefinitionPath | null => {
40
- // Handle argument path: Type.field(argument)
41
- const argMatch = expression.match(/^([^.]+)\.([^.(]+)\(([^)]+)\)$/)
42
- if (argMatch) {
43
- const [, typeName, fieldName, argName] = argMatch
44
- if (!typeName || !fieldName || !argName) return null
45
- return createArgumentDefinitionPath(typeName, fieldName, argName)
46
- }
47
-
48
- // Handle field path: Type.field
49
- const fieldMatch = expression.match(/^([^.]+)\.([^.]+)$/)
50
- if (fieldMatch) {
51
- const [, typeName, fieldName] = fieldMatch
52
- if (!typeName || !fieldName) return null
53
- return createFieldDefinitionPath(typeName, fieldName)
54
- }
55
-
56
- // Handle type path: Type
57
- const typeMatch = expression.match(/^[^.]+$/)
58
- if (typeMatch) {
59
- return createTypeDefinitionPath(expression)
60
- }
61
-
62
- return null
63
- }
131
+ export const decodeSync = S.decodeUnknownSync(DefinitionPath)
132
+
133
+ /**
134
+ * Encode a definition path to a string expression
135
+ * @param path - The definition path to encode
136
+ * @returns A string expression representation
137
+ * @example
138
+ * encode([{ _tag: 'TypeSegment', type: 'User' }]) // 'User'
139
+ * encode([{ _tag: 'TypeSegment', type: 'User' }, { _tag: 'FieldSegment', field: 'name' }]) // 'User.name'
140
+ */
141
+ export const encodeSync = S.encodeSync(DefinitionPath)
142
+
143
+ // ============================================================================
144
+ // Helper Functions
145
+ // ============================================================================
64
146
 
65
147
  /**
66
148
  * Extract the type name from any definition path
67
- *
68
149
  * @param path - The definition path
69
150
  * @returns The type name
70
- * @example getType([{ kind: 'type', type: 'User' }]) // 'User'
71
151
  */
72
152
  export const getType = (path: DefinitionPath): string => {
73
153
  return path[0].type
@@ -75,10 +155,8 @@ export const getType = (path: DefinitionPath): string => {
75
155
 
76
156
  /**
77
157
  * Extract the field name from a field or argument definition path
78
- *
79
158
  * @param path - The field or argument definition path
80
159
  * @returns The field name
81
- * @example getField([{ kind: 'type', type: 'User' }, { kind: 'field', field: 'name' }]) // 'name'
82
160
  */
83
161
  export const getField = (path: FieldDefinitionPath | ArgumentDefinitionPath): string => {
84
162
  return path[1].field
@@ -86,155 +164,77 @@ export const getField = (path: FieldDefinitionPath | ArgumentDefinitionPath): st
86
164
 
87
165
  /**
88
166
  * Extract the argument name from an argument definition path
89
- *
90
167
  * @param path - The argument definition path
91
168
  * @returns The argument name
92
- * @example getArgument([{ kind: 'type', type: 'User' }, { kind: 'field', field: 'posts' }, { kind: 'argument', argument: 'limit' }]) // 'limit'
93
169
  */
94
170
  export const getArgument = (path: ArgumentDefinitionPath): string => {
95
171
  return path[2].argument
96
172
  }
97
173
 
98
- /**
99
- * Parse field path like "User.email" into type and field names
100
- */
101
- export const parseFieldPath = (path?: string): { typeName: string | null; fieldName: string | null } => {
102
- if (!path) return { typeName: null, fieldName: null }
103
-
104
- const parts = path.split('.')
105
- if (parts.length >= 2) {
106
- return {
107
- typeName: parts[0] || null,
108
- fieldName: parts[1] || null,
109
- }
110
- }
111
-
112
- return { typeName: null, fieldName: null }
113
- }
114
-
115
- /**
116
- * Definition paths - direct paths to schema definition elements
117
- * These represent the "address" of a specific schema element
118
- */
119
- export type DefinitionPath =
120
- | TypeDefinitionPath
121
- | FieldDefinitionPath
122
- | ArgumentDefinitionPath
123
-
124
- /**
125
- * Path to a type definition
126
- * @example [{ kind: 'type', type: 'User' }]
127
- */
128
- export type TypeDefinitionPath = [TypeSegment]
129
-
130
- /**
131
- * Path to a field definition (type + field)
132
- * @example [{ kind: 'type', type: 'User' }, { kind: 'field', field: 'name' }]
133
- */
134
- export type FieldDefinitionPath = [TypeSegment, FieldSegment]
135
-
136
- /**
137
- * Path to an argument definition (type + field + argument)
138
- * @example [{ kind: 'type', type: 'User' }, { kind: 'field', field: 'posts' }, { kind: 'argument', argument: 'limit' }]
139
- */
140
- export type ArgumentDefinitionPath = [TypeSegment, FieldSegment, ArgumentSegment]
174
+ // ============================================================================
175
+ // Type Guards
176
+ // ============================================================================
141
177
 
142
178
  /**
143
179
  * Type guard to check if a path is a type definition path
144
- *
145
- * @param path - The path to check
146
- * @returns True if the path is a type definition path
147
180
  */
148
181
  export const isTypeDefinitionPath = (path: DefinitionPath): path is TypeDefinitionPath => {
149
- return path.length === 1 && path[0].kind === 'type'
182
+ return path.length === 1 && path[0]._tag === 'TypeSegment'
150
183
  }
151
184
 
152
185
  /**
153
186
  * Type guard to check if a path is a field definition path
154
- *
155
- * @param path - The path to check
156
- * @returns True if the path is a field definition path
157
187
  */
158
188
  export const isFieldDefinitionPath = (path: DefinitionPath): path is FieldDefinitionPath => {
159
- return path.length === 2 && path[0].kind === 'type' && path[1].kind === 'field'
189
+ return path.length === 2 && path[0]._tag === 'TypeSegment' && path[1]._tag === 'FieldSegment'
160
190
  }
161
191
 
162
192
  /**
163
193
  * Type guard to check if a path is an argument definition path
164
- *
165
- * @param path - The path to check
166
- * @returns True if the path is an argument definition path
167
194
  */
168
195
  export const isArgumentDefinitionPath = (path: DefinitionPath): path is ArgumentDefinitionPath => {
169
- return path.length === 3 && path[0].kind === 'type' && path[1].kind === 'field' && path[2].kind === 'argument'
170
- }
171
-
172
- /**
173
- * Create a path to a type definition
174
- *
175
- * @param type - The type name
176
- * @returns A type definition path
177
- * @example createTypeDefinitionPath('User') // [{ kind: 'type', type: 'User' }]
178
- */
179
- export const createTypeDefinitionPath = (type: string): TypeDefinitionPath => {
180
- return [createTypeSegment(type)]
181
- }
182
-
183
- /**
184
- * Create a path to a field definition
185
- *
186
- * @param type - The type name
187
- * @param field - The field name
188
- * @returns A field definition path
189
- * @example createFieldDefinitionPath('User', 'name') // [{ kind: 'type', type: 'User' }, { kind: 'field', field: 'name' }]
190
- */
191
- export const createFieldDefinitionPath = (type: string, field: string): FieldDefinitionPath => {
192
- return [createTypeSegment(type), createFieldSegment(field)]
196
+ return (
197
+ path.length === 3
198
+ && path[0]._tag === 'TypeSegment'
199
+ && path[1]._tag === 'FieldSegment'
200
+ && path[2]._tag === 'ArgumentSegment'
201
+ )
193
202
  }
194
203
 
195
- /**
196
- * Create a path to an argument definition
197
- *
198
- * @param type - The type name
199
- * @param field - The field name
200
- * @param argument - The argument name
201
- * @returns An argument definition path
202
- * @example createArgumentDefinitionPath('User', 'posts', 'limit') // [{ kind: 'type', type: 'User' }, { kind: 'field', field: 'posts' }, { kind: 'argument', argument: 'limit' }]
203
- */
204
- export const createArgumentDefinitionPath = (
205
- type: string,
206
- field: string,
207
- argument: string,
208
- ): ArgumentDefinitionPath => {
209
- return [createTypeSegment(type), createFieldSegment(field), createArgumentSegment(argument)]
210
- }
204
+ // ============================================================================
205
+ // Constructor Functions
206
+ // ============================================================================
211
207
 
212
208
  /**
213
209
  * Create a type definition path
214
- *
215
210
  * @param type - The type name
216
211
  * @returns A type definition path
217
- * @example type('User') // [{ kind: 'type', type: 'User' }]
218
212
  */
219
- export const type = createTypeDefinitionPath
213
+ export const type = (typeName: string): TypeDefinitionPath => {
214
+ return [TypeSegment.make({ type: typeName })]
215
+ }
220
216
 
221
217
  /**
222
218
  * Create a field definition path
223
- *
224
219
  * @param type - The type name
225
220
  * @param field - The field name
226
221
  * @returns A field definition path
227
- * @example field('User', 'name') // [{ kind: 'type', type: 'User' }, { kind: 'field', field: 'name' }]
228
222
  */
229
- export const field = createFieldDefinitionPath
223
+ export const field = (typeName: string, fieldName: string): FieldDefinitionPath => {
224
+ return [TypeSegment.make({ type: typeName }), FieldSegment.make({ field: fieldName })]
225
+ }
230
226
 
231
227
  /**
232
228
  * Create an argument definition path
233
- *
234
229
  * @param type - The type name
235
230
  * @param field - The field name
236
231
  * @param argument - The argument name
237
232
  * @returns An argument definition path
238
- * @example argument('User', 'posts', 'limit') // [{ kind: 'type', type: 'User' }, { kind: 'field', field: 'posts' }, { kind: 'argument', argument: 'limit' }]
239
233
  */
240
- export const argument = createArgumentDefinitionPath
234
+ export const argument = (typeName: string, fieldName: string, argumentName: string): ArgumentDefinitionPath => {
235
+ return [
236
+ TypeSegment.make({ type: typeName }),
237
+ FieldSegment.make({ field: fieldName }),
238
+ ArgumentSegment.make({ argument: argumentName }),
239
+ ]
240
+ }