@autoview/cli 0.1.0

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 (297) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +407 -0
  3. package/lib/AutoViewAgent.d.ts +109 -0
  4. package/lib/AutoViewAgent.js +123 -0
  5. package/lib/AutoViewAgent.js.map +1 -0
  6. package/lib/agent/emitMcpServer.d.ts +15 -0
  7. package/lib/agent/emitMcpServer.js +157 -0
  8. package/lib/agent/emitMcpServer.js.map +1 -0
  9. package/lib/agent/emitReport.d.ts +14 -0
  10. package/lib/agent/emitReport.js +85 -0
  11. package/lib/agent/emitReport.js.map +1 -0
  12. package/lib/agent/toolSurface.d.ts +130 -0
  13. package/lib/agent/toolSurface.js +342 -0
  14. package/lib/agent/toolSurface.js.map +1 -0
  15. package/lib/agent/verifyAgentTasks.d.ts +87 -0
  16. package/lib/agent/verifyAgentTasks.js +126 -0
  17. package/lib/agent/verifyAgentTasks.js.map +1 -0
  18. package/lib/cli/main.d.ts +2 -0
  19. package/lib/cli/main.js +295 -0
  20. package/lib/cli/main.js.map +1 -0
  21. package/lib/compiler/AutoViewInterfaceCompiler.d.ts +27 -0
  22. package/lib/compiler/AutoViewInterfaceCompiler.js +68 -0
  23. package/lib/compiler/AutoViewInterfaceCompiler.js.map +1 -0
  24. package/lib/constants/AutoViewFrontendTemplate.d.ts +1 -0
  25. package/lib/constants/AutoViewFrontendTemplate.js +46 -0
  26. package/lib/constants/AutoViewFrontendTemplate.js.map +1 -0
  27. package/lib/constants/AutoViewSystemPromptConstant.d.ts +5 -0
  28. package/lib/constants/AutoViewSystemPromptConstant.js +4 -0
  29. package/lib/constants/AutoViewSystemPromptConstant.js.map +1 -0
  30. package/lib/context/IAutoViewAgentContext.d.ts +60 -0
  31. package/lib/context/IAutoViewAgentContext.js +3 -0
  32. package/lib/context/IAutoViewAgentContext.js.map +1 -0
  33. package/lib/fromSwagger.d.ts +53 -0
  34. package/lib/fromSwagger.js +513 -0
  35. package/lib/fromSwagger.js.map +1 -0
  36. package/lib/generateDeterministic.d.ts +26 -0
  37. package/lib/generateDeterministic.js +75 -0
  38. package/lib/generateDeterministic.js.map +1 -0
  39. package/lib/index.d.ts +15 -0
  40. package/lib/index.js +41 -0
  41. package/lib/index.js.map +1 -0
  42. package/lib/orchestrate/orchestrateAutoView.d.ts +17 -0
  43. package/lib/orchestrate/orchestrateAutoView.js +491 -0
  44. package/lib/orchestrate/orchestrateAutoView.js.map +1 -0
  45. package/lib/orchestrate/orchestrateAutoViewProductPlan.d.ts +37 -0
  46. package/lib/orchestrate/orchestrateAutoViewProductPlan.js +109 -0
  47. package/lib/orchestrate/orchestrateAutoViewProductPlan.js.map +1 -0
  48. package/lib/orchestrate/orchestrateAutoViewRender.d.ts +133 -0
  49. package/lib/orchestrate/orchestrateAutoViewRender.js +943 -0
  50. package/lib/orchestrate/orchestrateAutoViewRender.js.map +1 -0
  51. package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.d.ts +24 -0
  52. package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.js +92 -0
  53. package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.js.map +1 -0
  54. package/lib/orchestrate/orchestrateAutoViewReview.d.ts +48 -0
  55. package/lib/orchestrate/orchestrateAutoViewReview.js +328 -0
  56. package/lib/orchestrate/orchestrateAutoViewReview.js.map +1 -0
  57. package/lib/orchestrate/orchestrateAutoViewScaffold.d.ts +45 -0
  58. package/lib/orchestrate/orchestrateAutoViewScaffold.js +586 -0
  59. package/lib/orchestrate/orchestrateAutoViewScaffold.js.map +1 -0
  60. package/lib/orchestrate/orchestrateAutoViewSdkStudy.d.ts +26 -0
  61. package/lib/orchestrate/orchestrateAutoViewSdkStudy.js +85 -0
  62. package/lib/orchestrate/orchestrateAutoViewSdkStudy.js.map +1 -0
  63. package/lib/orchestrate/structures/IAutoViewProductPlan.d.ts +96 -0
  64. package/lib/orchestrate/structures/IAutoViewProductPlan.js +3 -0
  65. package/lib/orchestrate/structures/IAutoViewProductPlan.js.map +1 -0
  66. package/lib/orchestrate/structures/IAutoViewProductPlanApplication.d.ts +38 -0
  67. package/lib/orchestrate/structures/IAutoViewProductPlanApplication.js +3 -0
  68. package/lib/orchestrate/structures/IAutoViewProductPlanApplication.js.map +1 -0
  69. package/lib/orchestrate/structures/IAutoViewRenderApplication.d.ts +38 -0
  70. package/lib/orchestrate/structures/IAutoViewRenderApplication.js +3 -0
  71. package/lib/orchestrate/structures/IAutoViewRenderApplication.js.map +1 -0
  72. package/lib/orchestrate/structures/IAutoViewReviewApplication.d.ts +40 -0
  73. package/lib/orchestrate/structures/IAutoViewReviewApplication.js +3 -0
  74. package/lib/orchestrate/structures/IAutoViewReviewApplication.js.map +1 -0
  75. package/lib/orchestrate/structures/IAutoViewSdkMap.d.ts +63 -0
  76. package/lib/orchestrate/structures/IAutoViewSdkMap.js +3 -0
  77. package/lib/orchestrate/structures/IAutoViewSdkMap.js.map +1 -0
  78. package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.d.ts +37 -0
  79. package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.js +3 -0
  80. package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.js.map +1 -0
  81. package/lib/orchestrate/utils/HistoryMessage.d.ts +10 -0
  82. package/lib/orchestrate/utils/HistoryMessage.js +25 -0
  83. package/lib/orchestrate/utils/HistoryMessage.js.map +1 -0
  84. package/lib/orchestrate/utils/auditFrontendRuntime.d.ts +53 -0
  85. package/lib/orchestrate/utils/auditFrontendRuntime.js +362 -0
  86. package/lib/orchestrate/utils/auditFrontendRuntime.js.map +1 -0
  87. package/lib/orchestrate/utils/buildDeterministicPlan.d.ts +4 -0
  88. package/lib/orchestrate/utils/buildDeterministicPlan.js +233 -0
  89. package/lib/orchestrate/utils/buildDeterministicPlan.js.map +1 -0
  90. package/lib/orchestrate/utils/buildDeterministicSdkMap.d.ts +22 -0
  91. package/lib/orchestrate/utils/buildDeterministicSdkMap.js +154 -0
  92. package/lib/orchestrate/utils/buildDeterministicSdkMap.js.map +1 -0
  93. package/lib/orchestrate/utils/cacheNodeModules.d.ts +31 -0
  94. package/lib/orchestrate/utils/cacheNodeModules.js +134 -0
  95. package/lib/orchestrate/utils/cacheNodeModules.js.map +1 -0
  96. package/lib/orchestrate/utils/describeEndpointPropsShape.d.ts +37 -0
  97. package/lib/orchestrate/utils/describeEndpointPropsShape.js +192 -0
  98. package/lib/orchestrate/utils/describeEndpointPropsShape.js.map +1 -0
  99. package/lib/orchestrate/utils/describeEndpointRequestBodyShape.d.ts +22 -0
  100. package/lib/orchestrate/utils/describeEndpointRequestBodyShape.js +29 -0
  101. package/lib/orchestrate/utils/describeEndpointRequestBodyShape.js.map +1 -0
  102. package/lib/orchestrate/utils/describeEndpointResponseShape.d.ts +19 -0
  103. package/lib/orchestrate/utils/describeEndpointResponseShape.js +30 -0
  104. package/lib/orchestrate/utils/describeEndpointResponseShape.js.map +1 -0
  105. package/lib/orchestrate/utils/executeCachedBatch.d.ts +22 -0
  106. package/lib/orchestrate/utils/executeCachedBatch.js +64 -0
  107. package/lib/orchestrate/utils/executeCachedBatch.js.map +1 -0
  108. package/lib/orchestrate/utils/loadShoppingFixture.d.ts +33 -0
  109. package/lib/orchestrate/utils/loadShoppingFixture.js +17 -0
  110. package/lib/orchestrate/utils/loadShoppingFixture.js.map +1 -0
  111. package/lib/orchestrate/utils/normalizeProductPlanPaths.d.ts +24 -0
  112. package/lib/orchestrate/utils/normalizeProductPlanPaths.js +77 -0
  113. package/lib/orchestrate/utils/normalizeProductPlanPaths.js.map +1 -0
  114. package/lib/orchestrate/utils/renderJsonSchema.d.ts +23 -0
  115. package/lib/orchestrate/utils/renderJsonSchema.js +122 -0
  116. package/lib/orchestrate/utils/renderJsonSchema.js.map +1 -0
  117. package/lib/orchestrate/utils/renderResourcePage.d.ts +36 -0
  118. package/lib/orchestrate/utils/renderResourcePage.js +1415 -0
  119. package/lib/orchestrate/utils/renderResourcePage.js.map +1 -0
  120. package/lib/orchestrate/utils/validateFrontendTypecheck.d.ts +109 -0
  121. package/lib/orchestrate/utils/validateFrontendTypecheck.js +274 -0
  122. package/lib/orchestrate/utils/validateFrontendTypecheck.js.map +1 -0
  123. package/lib/preview/renderPreview.d.ts +22 -0
  124. package/lib/preview/renderPreview.js +198 -0
  125. package/lib/preview/renderPreview.js.map +1 -0
  126. package/lib/typings/compiler.d.ts +39 -0
  127. package/lib/typings/compiler.js +3 -0
  128. package/lib/typings/compiler.js.map +1 -0
  129. package/lib/typings/events.d.ts +106 -0
  130. package/lib/typings/events.js +3 -0
  131. package/lib/typings/events.js.map +1 -0
  132. package/lib/typings/index.d.ts +10 -0
  133. package/lib/typings/index.js +27 -0
  134. package/lib/typings/index.js.map +1 -0
  135. package/lib/typings/misc.d.ts +78 -0
  136. package/lib/typings/misc.js +3 -0
  137. package/lib/typings/misc.js.map +1 -0
  138. package/lib/utils/ArrayUtil.d.ts +8 -0
  139. package/lib/utils/ArrayUtil.js +30 -0
  140. package/lib/utils/ArrayUtil.js.map +1 -0
  141. package/lib/utils/StringUtil.d.ts +11 -0
  142. package/lib/utils/StringUtil.js +28 -0
  143. package/lib/utils/StringUtil.js.map +1 -0
  144. package/lib/utils/classifyEndpoints.d.ts +62 -0
  145. package/lib/utils/classifyEndpoints.js +216 -0
  146. package/lib/utils/classifyEndpoints.js.map +1 -0
  147. package/lib/utils/endpointFilter.d.ts +26 -0
  148. package/lib/utils/endpointFilter.js +0 -0
  149. package/lib/utils/endpointFilter.js.map +1 -0
  150. package/lib/utils/extractFields.d.ts +85 -0
  151. package/lib/utils/extractFields.js +231 -0
  152. package/lib/utils/extractFields.js.map +1 -0
  153. package/lib/utils/index.d.ts +13 -0
  154. package/lib/utils/index.js +30 -0
  155. package/lib/utils/index.js.map +1 -0
  156. package/lib/utils/normalizeForNestia.d.ts +34 -0
  157. package/lib/utils/normalizeForNestia.js +133 -0
  158. package/lib/utils/normalizeForNestia.js.map +1 -0
  159. package/lib/utils/resourcePlan.d.ts +39 -0
  160. package/lib/utils/resourcePlan.js +95 -0
  161. package/lib/utils/resourcePlan.js.map +1 -0
  162. package/lib/utils/sliceDocument.d.ts +17 -0
  163. package/lib/utils/sliceDocument.js +114 -0
  164. package/lib/utils/sliceDocument.js.map +1 -0
  165. package/lib/utils/toEndpoints.d.ts +90 -0
  166. package/lib/utils/toEndpoints.js +227 -0
  167. package/lib/utils/toEndpoints.js.map +1 -0
  168. package/lib/verify/runWorkflows.d.ts +25 -0
  169. package/lib/verify/runWorkflows.js +366 -0
  170. package/lib/verify/runWorkflows.js.map +1 -0
  171. package/lib/verify/workflows.d.ts +53 -0
  172. package/lib/verify/workflows.js +107 -0
  173. package/lib/verify/workflows.js.map +1 -0
  174. package/package.json +82 -0
  175. package/prompts/AUTOVIEW_RENDER.md +398 -0
  176. package/prompts/AUTOVIEW_REVIEW.md +60 -0
  177. package/prompts/AUTOVIEW_SDK_STUDY.md +89 -0
  178. package/src/AutoViewAgent.ts +222 -0
  179. package/src/agent/emitMcpServer.integration.test.ts +168 -0
  180. package/src/agent/emitMcpServer.test.ts +51 -0
  181. package/src/agent/emitMcpServer.ts +178 -0
  182. package/src/agent/emitReport.ts +117 -0
  183. package/src/agent/toolSurface.test.ts +243 -0
  184. package/src/agent/toolSurface.ts +501 -0
  185. package/src/agent/verifyAgentTasks.test.ts +106 -0
  186. package/src/agent/verifyAgentTasks.ts +171 -0
  187. package/src/cli/main.ts +363 -0
  188. package/src/compiler/AutoViewInterfaceCompiler.ts +69 -0
  189. package/src/constants/AutoViewFrontendTemplate.ts +42 -0
  190. package/src/constants/AutoViewSystemPromptConstant.ts +6 -0
  191. package/src/context/IAutoViewAgentContext.ts +84 -0
  192. package/src/fromSwagger.test.ts +269 -0
  193. package/src/fromSwagger.ts +500 -0
  194. package/src/generateDeterministic.test.ts +39 -0
  195. package/src/generateDeterministic.ts +77 -0
  196. package/src/index.ts +30 -0
  197. package/src/orchestrate/orchestrateAutoView.ts +590 -0
  198. package/src/orchestrate/orchestrateAutoViewProductPlan.ts +121 -0
  199. package/src/orchestrate/orchestrateAutoViewRender.ts +1117 -0
  200. package/src/orchestrate/orchestrateAutoViewRenderDeterministic.ts +101 -0
  201. package/src/orchestrate/orchestrateAutoViewReview.ts +272 -0
  202. package/src/orchestrate/orchestrateAutoViewScaffold.ts +627 -0
  203. package/src/orchestrate/orchestrateAutoViewSdkStudy.ts +90 -0
  204. package/src/orchestrate/renderNavTs.test.ts +74 -0
  205. package/src/orchestrate/structures/IAutoViewProductPlan.ts +119 -0
  206. package/src/orchestrate/structures/IAutoViewProductPlanApplication.ts +41 -0
  207. package/src/orchestrate/structures/IAutoViewRenderApplication.ts +40 -0
  208. package/src/orchestrate/structures/IAutoViewReviewApplication.ts +42 -0
  209. package/src/orchestrate/structures/IAutoViewSdkMap.ts +72 -0
  210. package/src/orchestrate/structures/IAutoViewSdkStudyApplication.ts +40 -0
  211. package/src/orchestrate/utils/HistoryMessage.ts +41 -0
  212. package/src/orchestrate/utils/auditFrontendRuntime.test.ts +18 -0
  213. package/src/orchestrate/utils/auditFrontendRuntime.ts +454 -0
  214. package/src/orchestrate/utils/buildDeterministicPlan.test.ts +170 -0
  215. package/src/orchestrate/utils/buildDeterministicPlan.ts +289 -0
  216. package/src/orchestrate/utils/buildDeterministicSdkMap.test.ts +90 -0
  217. package/src/orchestrate/utils/buildDeterministicSdkMap.ts +169 -0
  218. package/src/orchestrate/utils/cacheNodeModules.ts +136 -0
  219. package/src/orchestrate/utils/describeEndpointPropsShape.test.ts +86 -0
  220. package/src/orchestrate/utils/describeEndpointPropsShape.ts +202 -0
  221. package/src/orchestrate/utils/describeEndpointRequestBodyShape.test.ts +87 -0
  222. package/src/orchestrate/utils/describeEndpointRequestBodyShape.ts +31 -0
  223. package/src/orchestrate/utils/describeEndpointResponseShape.test.ts +70 -0
  224. package/src/orchestrate/utils/describeEndpointResponseShape.ts +32 -0
  225. package/src/orchestrate/utils/executeCachedBatch.ts +59 -0
  226. package/src/orchestrate/utils/loadShoppingFixture.ts +52 -0
  227. package/src/orchestrate/utils/normalizeProductPlanPaths.ts +92 -0
  228. package/src/orchestrate/utils/renderJsonSchema.test.ts +162 -0
  229. package/src/orchestrate/utils/renderJsonSchema.ts +133 -0
  230. package/src/orchestrate/utils/renderResourcePage.test.ts +468 -0
  231. package/src/orchestrate/utils/renderResourcePage.ts +1624 -0
  232. package/src/orchestrate/utils/validateFrontendTypecheck.test.ts +32 -0
  233. package/src/orchestrate/utils/validateFrontendTypecheck.ts +335 -0
  234. package/src/preview/renderPreview.ts +273 -0
  235. package/src/typings/compiler.ts +47 -0
  236. package/src/typings/events.ts +155 -0
  237. package/src/typings/index.ts +10 -0
  238. package/src/typings/misc.ts +93 -0
  239. package/src/utils/ArrayUtil.ts +16 -0
  240. package/src/utils/StringUtil.ts +29 -0
  241. package/src/utils/classifyEndpoints.test.ts +86 -0
  242. package/src/utils/classifyEndpoints.ts +291 -0
  243. package/src/utils/endpointFilter.test.ts +50 -0
  244. package/src/utils/endpointFilter.ts +0 -0
  245. package/src/utils/extractFields.test.ts +82 -0
  246. package/src/utils/extractFields.ts +306 -0
  247. package/src/utils/index.ts +13 -0
  248. package/src/utils/normalizeForNestia.test.ts +93 -0
  249. package/src/utils/normalizeForNestia.ts +139 -0
  250. package/src/utils/resourcePlan.test.ts +104 -0
  251. package/src/utils/resourcePlan.ts +180 -0
  252. package/src/utils/sliceDocument.test.ts +85 -0
  253. package/src/utils/sliceDocument.ts +119 -0
  254. package/src/utils/toEndpoints.test.ts +251 -0
  255. package/src/utils/toEndpoints.ts +343 -0
  256. package/src/verify/runWorkflows.ts +403 -0
  257. package/src/verify/workflows.test.ts +117 -0
  258. package/src/verify/workflows.ts +154 -0
  259. package/template/CLAUDE.md +140 -0
  260. package/template/Dockerfile +31 -0
  261. package/template/PROMPT.md +80 -0
  262. package/template/SANDBOX.md +70 -0
  263. package/template/app/api/health/route.ts +10 -0
  264. package/template/app/globals.css +97 -0
  265. package/template/app/layout.tsx +30 -0
  266. package/template/app/page.tsx +19 -0
  267. package/template/components/AppShell.tsx +114 -0
  268. package/template/components/auto/CatalogGrid.tsx +159 -0
  269. package/template/components/auto/ConfirmButton.tsx +67 -0
  270. package/template/components/auto/EmbeddedCollection.tsx +144 -0
  271. package/template/components/auto/ResourceDashboard.tsx +104 -0
  272. package/template/components/auto/ResourceDetail.tsx +93 -0
  273. package/template/components/auto/ResourceForm.tsx +235 -0
  274. package/template/components/auto/ResourceIcon.tsx +88 -0
  275. package/template/components/auto/ResourceLanding.tsx +155 -0
  276. package/template/components/auto/ResourceTable.tsx +223 -0
  277. package/template/components/auto/formatValue.tsx +186 -0
  278. package/template/components/auto/types.ts +42 -0
  279. package/template/components/ui/badge.tsx +40 -0
  280. package/template/components/ui/button.tsx +57 -0
  281. package/template/components/ui/card.tsx +86 -0
  282. package/template/components/ui/dialog.tsx +119 -0
  283. package/template/components/ui/input.tsx +23 -0
  284. package/template/components/ui/label.tsx +24 -0
  285. package/template/components/ui/pagination.tsx +117 -0
  286. package/template/components/ui/select.tsx +92 -0
  287. package/template/components/ui/sheet.tsx +135 -0
  288. package/template/components/ui/skeleton.tsx +15 -0
  289. package/template/components/ui/table.tsx +120 -0
  290. package/template/components/ui/tabs.tsx +55 -0
  291. package/template/lib/utils.ts +35 -0
  292. package/template/next.config.mjs +52 -0
  293. package/template/package.json +46 -0
  294. package/template/postcss.config.js +6 -0
  295. package/template/scripts/start-shopping-backend.sh +56 -0
  296. package/template/tailwind.config.ts +96 -0
  297. package/template/tsconfig.json +29 -0
@@ -0,0 +1,62 @@
1
+ import { OpenApi } from "@typia/interface";
2
+ import { IAutoViewEndpoint } from "./toEndpoints";
3
+ /**
4
+ * Deterministic CRUD role of an endpoint — the first brick of the "정확한 틀".
5
+ *
6
+ * The MAP layer (SdkStudy + ProductPlan) was 100% LLM improvisation: same
7
+ * swagger, different screens every run, no CRUD-completeness guarantee, and a
8
+ * commerce-hardcoded prompt. This classifier derives each endpoint's role from
9
+ * method + path shape + query presence — purely structural, zero LLM, fully
10
+ * reproducible and domain-agnostic.
11
+ *
12
+ * - `list` GET on a collection (no trailing path param), no query
13
+ * - `search` GET on a collection WITH query parameters (filter/paginate)
14
+ * - `detail` GET on a single item (trailing `{param}`)
15
+ * - `create` POST on a collection
16
+ * - `update` PUT / PATCH on a single item
17
+ * - `delete` DELETE on a single item
18
+ * - `action` anything else (e.g. POST /pets/{id}/uploadImage, RPC-ish verbs)
19
+ */
20
+ export type EndpointRole = "list" | "search" | "detail" | "create" | "update" | "delete" | "action";
21
+ /**
22
+ * One link in a resource hierarchy: a collection name plus the path param that
23
+ * addresses a single item of it. `param` is `null` for a leaf collection that
24
+ * the endpoint does not item-address (`/sales/{saleId}/questions` → the
25
+ * `questions` link has `param: null` on a list, `param: "id"` on a detail).
26
+ */
27
+ export interface IResourceLink {
28
+ name: string;
29
+ param: string | null;
30
+ }
31
+ export interface IClassifiedEndpoint {
32
+ endpoint: IAutoViewEndpoint;
33
+ /** Top-level resource bucket = the first link of {@link chain}. */
34
+ resource: string;
35
+ /**
36
+ * Full resource hierarchy parsed from the path, skipping namespace/actor
37
+ * prefixes. `/shoppings/admins/sales/{saleId}/questions/{id}` →
38
+ * `[{sales, saleId}, {questions, id}]`. Length 1 = a top-level resource.
39
+ */
40
+ chain: IResourceLink[];
41
+ role: EndpointRole;
42
+ /** True when the path targets a single item (trailing `{param}`). */
43
+ itemScoped: boolean;
44
+ }
45
+ /** All endpoints of one resource, plus the set of roles it actually exposes. */
46
+ export interface IResourceGroup {
47
+ /** Leaf resource name = the last link of {@link chain}. */
48
+ resource: string;
49
+ /** Full hierarchy of this group (`[sales]`, `[sales, questions]`). */
50
+ chain: IResourceLink[];
51
+ /** `chain.length` — 1 = top-level, ≥2 = nested under a parent. */
52
+ depth: number;
53
+ endpoints: IClassifiedEndpoint[];
54
+ /** Which CRUD roles this resource supports — drives the screen set later. */
55
+ roles: Set<EndpointRole>;
56
+ }
57
+ export declare function classifyEndpoint(endpoint: IAutoViewEndpoint, candidates?: ReadonlySet<string>, document?: OpenApi.IDocument): IClassifiedEndpoint;
58
+ /**
59
+ * Classify every endpoint and bucket by resource. Resource order follows first
60
+ * appearance; endpoints within a resource keep their input order.
61
+ */
62
+ export declare function classifyEndpoints(endpoints: IAutoViewEndpoint[], document?: OpenApi.IDocument): IResourceGroup[];
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.classifyEndpoint = classifyEndpoint;
4
+ exports.classifyEndpoints = classifyEndpoints;
5
+ const extractFields_1 = require("./extractFields");
6
+ const PARAM = /^\{.*\}$/;
7
+ function segments(path) {
8
+ return path.split("/").filter((s) => s.length > 0);
9
+ }
10
+ /**
11
+ * Whether an endpoint's response is a browsable collection — an array, or a
12
+ * page/wrapper object whose resolved fields contain a collection field
13
+ * (`data` / `items` / `entries` / …). Used to tell a real `PATCH`-as-search
14
+ * (returns a page of results) from a `PATCH` that merely uses the verb to mutate
15
+ * a named sub-resource (`/databases/{id}/config`) and returns void or a single
16
+ * object. Without a document a page wrapper cannot be resolved, so any named
17
+ * body is conservatively treated as a collection (preserving legacy behavior)
18
+ * while a void response is still recognized as a non-collection.
19
+ */
20
+ function returnsCollection(endpoint, document) {
21
+ if (endpoint.responseBody === null)
22
+ return false;
23
+ if (endpoint.responseBody.isArray)
24
+ return true;
25
+ if (document === undefined)
26
+ return true;
27
+ return ((0, extractFields_1.findCollectionField)((0, extractFields_1.extractFields)(endpoint.responseBody.typeName, document)) !==
28
+ undefined);
29
+ }
30
+ function classifyEndpoint(endpoint, candidates = new Set(), document) {
31
+ var _a, _b, _c;
32
+ const segs = segments(endpoint.path);
33
+ const last = (_a = segs.at(-1)) !== null && _a !== void 0 ? _a : "";
34
+ // "single item" = the path's last segment is a parameter (`/pets/{id}`),
35
+ // i.e. it addresses one entity. `/pets/{id}/photos` is a collection again
36
+ // (last segment `photos` is not a param), so it lists pet-scoped photos.
37
+ const itemScoped = PARAM.test(last);
38
+ // Any path parameter means the write targets a specific entity (or a child
39
+ // of one) — `/orders/{id}/cancel`, `/pets/{id}/photos`, `/items/{id}`. We
40
+ // cannot tell a sub-resource create from an RPC verb deterministically (no
41
+ // noun/verb NLP), so both collapse to `action`: an item-scoped write the
42
+ // detail screen surfaces as a button/sub-form. A `create` is reserved for a
43
+ // POST on a bare collection (`/items`).
44
+ const hasPathParam = segs.some((s) => PARAM.test(s));
45
+ const method = endpoint.method.toLowerCase();
46
+ const hasQuery = endpoint.query !== null;
47
+ const role = (() => {
48
+ switch (method) {
49
+ case "get":
50
+ // `/pets/{id}` → detail; `/pets/{id}/photos` → list (sub-collection).
51
+ if (itemScoped)
52
+ return "detail";
53
+ return hasQuery ? "search" : "list";
54
+ case "post":
55
+ return hasPathParam ? "action" : "create";
56
+ case "put":
57
+ return "update";
58
+ case "patch":
59
+ // nestia / AutoBE convention: PATCH on a collection is index/search
60
+ // (the filter rides in the request body), NOT a partial update — this
61
+ // is how shopping/ERP expose their list endpoints. PATCH on a single
62
+ // item (`/x/{id}`) is a genuine update.
63
+ if (itemScoped)
64
+ return "update";
65
+ // ...but only when it actually returns a collection. A non-item PATCH
66
+ // that returns void or a single object (`PATCH /databases/{id}/config`)
67
+ // is a mutation, not a search — classifying it as a read would tag the
68
+ // tool `readOnly` and tell an agent a state-changing call is safe.
69
+ if (!returnsCollection(endpoint, document))
70
+ return "action";
71
+ return hasQuery ? "search" : "list";
72
+ case "delete":
73
+ return "delete";
74
+ default:
75
+ return "action";
76
+ }
77
+ })();
78
+ const chain = resourceChainOf(segs, candidates, role);
79
+ return {
80
+ endpoint,
81
+ resource: (_c = (_b = chain[0]) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : resourceOf(segs, candidates),
82
+ chain,
83
+ role,
84
+ itemScoped,
85
+ };
86
+ }
87
+ function stripBraces(seg) {
88
+ return seg.replace(/^\{/, "").replace(/\}$/, "");
89
+ }
90
+ /**
91
+ * Parse a path into its resource hierarchy, skipping namespace / actor prefix
92
+ * segments. A static segment becomes a resource link when it is item-addressed
93
+ * (a `{param}` follows it), is a known resource elsewhere (in `candidates`), or
94
+ * is the terminal collection. Pure namespacing (`shoppings`, `admins`,
95
+ * `systematic`) is dropped.
96
+ *
97
+ * `/shoppings/admins/sales/{saleId}/questions/{id}` → `[{sales,saleId},{questions,id}]`
98
+ * `/shoppings/customers/orders/{id}/publish` (action) → `[{orders,id}]`
99
+ * (the trailing verb is the action name, not a sub-resource).
100
+ */
101
+ function resourceChainOf(segs, candidates, role) {
102
+ const chain = [];
103
+ for (let i = 0; i < segs.length; i++) {
104
+ const seg = segs[i];
105
+ if (PARAM.test(seg))
106
+ continue;
107
+ const next = segs[i + 1];
108
+ const nextIsParam = next !== undefined && PARAM.test(next);
109
+ const isTerminal = i === segs.length - 1;
110
+ if (nextIsParam) {
111
+ // item-addressed collection → a real resource (`sales/{saleId}`).
112
+ chain.push({ name: seg, param: stripBraces(next) });
113
+ }
114
+ else if (candidates.has(seg)) {
115
+ // a known resource (item-addressed elsewhere), here without an id.
116
+ chain.push({ name: seg, param: null });
117
+ }
118
+ else if (isTerminal && chain.length === 0) {
119
+ // a top-level read-only collection that is never item-addressed
120
+ // (`/health`, `/system`, `/store/inventory`).
121
+ chain.push({ name: seg, param: null });
122
+ }
123
+ // else: a namespace/actor prefix, OR a deeper trailing verb/view that is
124
+ // never item-addressed (`/sales/details`, `/channels/hierarchical`,
125
+ // `/orders/incompletes`). The latter is a VARIANT of its parent resource,
126
+ // not a resource of its own — skip it so the endpoint folds into the parent
127
+ // group instead of spawning a junk top-level card.
128
+ }
129
+ // An action's trailing static verb (`.../{id}/publish`) is not a resource —
130
+ // drop it so the action attaches to its parent. Keep length ≥ 1.
131
+ if (role === "action" && chain.length > 1 && chain.at(-1).param === null) {
132
+ chain.pop();
133
+ }
134
+ return chain.length > 0 ? chain : [{ name: "root", param: null }];
135
+ }
136
+ /**
137
+ * The segment immediately before a path's last `{param}` — the entity the path
138
+ * addresses (`/shoppings/admins/coupons/{id}` → `coupons`, `/pet/{petId}` →
139
+ * `pet`). `null` when the path has no param (a collection or verb path).
140
+ */
141
+ function paramAnchoredResource(segs) {
142
+ for (let i = segs.length - 1; i >= 0; i--) {
143
+ if (PARAM.test(segs[i]))
144
+ return i > 0 ? segs[i - 1] : null;
145
+ }
146
+ return null;
147
+ }
148
+ /**
149
+ * Resource bucket of a path, using the set of param-anchored resources as
150
+ * the source of truth.
151
+ *
152
+ * - Param path (`/pet/{petId}`, `/coupons/{id}`) → the segment before the
153
+ * param. This recovers the real resource even under deep accessors that
154
+ * share a `shoppings` prefix.
155
+ * - Collection / verb path with no param (`/pet/findByStatus`, `/pet`,
156
+ * `/user/login`) → absorbed into a known resource if the path passes through
157
+ * one (findByStatus → pet, login → user), so RPC-style verbs do not spawn
158
+ * junk resources. Falls back to its own last segment when it belongs to no
159
+ * known resource (`/store/inventory` → inventory).
160
+ */
161
+ function resourceOf(segs, candidates) {
162
+ var _a;
163
+ const anchored = paramAnchoredResource(segs);
164
+ if (anchored !== null)
165
+ return anchored;
166
+ const nonParam = segs.filter((s) => !PARAM.test(s));
167
+ for (let i = nonParam.length - 1; i >= 0; i--) {
168
+ if (candidates.has(nonParam[i]))
169
+ return nonParam[i];
170
+ }
171
+ return (_a = nonParam.at(-1)) !== null && _a !== void 0 ? _a : "root";
172
+ }
173
+ /**
174
+ * Classify every endpoint and bucket by resource. Resource order follows first
175
+ * appearance; endpoints within a resource keep their input order.
176
+ */
177
+ function classifyEndpoints(endpoints, document) {
178
+ // Pass 1: collect the real resources — segments that have a `{param}` child.
179
+ const candidates = new Set();
180
+ for (const endpoint of endpoints) {
181
+ const r = paramAnchoredResource(segments(endpoint.path));
182
+ if (r !== null)
183
+ candidates.add(r);
184
+ }
185
+ // Pass 2: classify and bucket by the FULL resource chain (so a sub-resource
186
+ // like `sales/questions` is its own group, distinct from `sales`), absorbing
187
+ // param-less verb paths into a known resource.
188
+ const groups = new Map();
189
+ for (const endpoint of endpoints) {
190
+ const classified = classifyEndpoint(endpoint, candidates, document);
191
+ const chainKey = classified.chain.map((c) => c.name).join("/");
192
+ const existing = groups.get(chainKey);
193
+ const group = existing !== null && existing !== void 0 ? existing : {
194
+ resource: classified.chain.at(-1).name,
195
+ chain: classified.chain,
196
+ depth: classified.chain.length,
197
+ endpoints: [],
198
+ roles: new Set(),
199
+ };
200
+ // Prefer a chain link that carries an item param (a detail endpoint) so the
201
+ // group's chain has the real param names for routing, not just `null`s.
202
+ if (existing !== undefined) {
203
+ classified.chain.forEach((link, i) => {
204
+ var _a;
205
+ if (link.param !== null && ((_a = existing.chain[i]) === null || _a === void 0 ? void 0 : _a.param) == null) {
206
+ existing.chain[i] = link;
207
+ }
208
+ });
209
+ }
210
+ group.endpoints.push(classified);
211
+ group.roles.add(classified.role);
212
+ groups.set(chainKey, group);
213
+ }
214
+ return [...groups.values()];
215
+ }
216
+ //# sourceMappingURL=classifyEndpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classifyEndpoints.js","sourceRoot":"","sources":["../../src/utils/classifyEndpoints.ts"],"names":[],"mappings":";;AAmGA,4CA2DC;AA6FD,8CAuCC;AAhSD,mDAAqE;AAoErE,MAAM,KAAK,GAAG,UAAU,CAAC;AAEzB,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,iBAAiB,CACxB,QAA2B,EAC3B,QAA4B;IAE5B,IAAI,QAAQ,CAAC,YAAY,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACjD,IAAI,QAAQ,CAAC,YAAY,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC/C,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACxC,OAA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,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;gBAC3B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { IAutoViewEndpoint } from "./toEndpoints";
2
+ /**
3
+ * Operator-controlled endpoint filter — the answer to "huge swaggers explode
4
+ * into 73 screens and mix actor scopes".
5
+ *
6
+ * A big swagger (shopping/ERP) should not be turned into a screen per endpoint:
7
+ * actor scopes collide (a customer screen calling an admin endpoint 500s) and
8
+ * the screen count is unusable. Instead of guessing actors from the path
9
+ * (swagger-specific), the operator slices the surface explicitly:
10
+ *
11
+ * --include "shoppings/customers/**" → only the customer surface
12
+ * --exclude "**​/monitors/**" → drop monitoring noise
13
+ *
14
+ * Patterns match against the endpoint PATH (leading slash optional). Glob:
15
+ * `*` matches within a path segment (no `/`)
16
+ * `**` matches across segments
17
+ */
18
+ export interface IEndpointFilter {
19
+ include?: string[];
20
+ exclude?: string[];
21
+ }
22
+ /**
23
+ * Apply include/exclude to an endpoint list. Include keeps only matches (when
24
+ * given); exclude then drops matches. Empty/absent filter is a no-op.
25
+ */
26
+ export declare function filterEndpoints(endpoints: IAutoViewEndpoint[], filter?: IEndpointFilter): IAutoViewEndpoint[];
Binary file
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpointFilter.js","sourceRoot":"","sources":["../../src/utils/endpointFilter.ts"],"names":[],"mappings":";;AA4CA,0CAYC;AAjCD,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,UAAU,GAAG,IAAI,CAA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,CAAC,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { OpenApi } from "@typia/interface";
2
+ /**
3
+ * Deterministic data contract — the field list a screen renders.
4
+ *
5
+ * Derived structurally from a component schema's properties: list table
6
+ * columns, detail rows, and form inputs all come from here instead of the LLM
7
+ * guessing. This is what makes "table 엄청 적게" structurally impossible — every
8
+ * property of the row/response/request type becomes a column/row/input.
9
+ */
10
+ export type FieldKind = "string" | "number" | "boolean" | "enum" | "array" | "object" | "ref" | "union" | "unknown";
11
+ export interface IFieldSpec {
12
+ name: string;
13
+ required: boolean;
14
+ kind: FieldKind;
15
+ /** String format (`uuid`, `date-time`, `uri`, ...) when present. */
16
+ format?: string;
17
+ /** Allowed values for an `enum` field. */
18
+ enumValues?: Array<string | number | boolean>;
19
+ /** Component type name for a `ref` field, or the element type of an `array`. */
20
+ ref?: string;
21
+ /** For an `array`, the element's kind (e.g. array of strings vs array of refs). */
22
+ itemKind?: FieldKind;
23
+ /** For an `array` of primitives, the element's string format (`uri`, …). A
24
+ * `string[]` of image URLs carries `format: "uri"` on the ITEM, not the
25
+ * array, so the signal is lost without preserving it here. */
26
+ itemFormat?: string;
27
+ /**
28
+ * For an `array` whose elements are an INLINE object (no `$ref`, so {@link ref}
29
+ * is undefined), the element's own field list — e.g. DigitalOcean's
30
+ * `{ droplets: [ { id, name, … } ] }`, where the droplet shape is inline. Lets
31
+ * a table render real columns for such collections instead of one opaque cell.
32
+ */
33
+ itemFields?: IFieldSpec[];
34
+ }
35
+ /**
36
+ * Field names a paginated/collection response uses to hold its array of items.
37
+ * `data` is the nestia/AutoBE convention; real APIs vary (Box uses `entries`,
38
+ * others `items` / `results`). Recognizing all of them lets a list endpoint be
39
+ * rendered as a table off its element type instead of a one-record detail.
40
+ */
41
+ export declare const COLLECTION_FIELD_NAMES: Set<string>;
42
+ /** The array field that holds a collection response's items, if any. */
43
+ export declare function findCollectionField(fields: IFieldSpec[]): IFieldSpec | undefined;
44
+ /**
45
+ * Resolve a schema's effective `{ properties, required }`, following `$ref` and
46
+ * merging every `allOf` member. Composition (`allOf`) is a core OpenAPI feature
47
+ * real swaggers (Box, Stripe, …) lean on heavily — a type is often
48
+ * `allOf: [BasePagination, { properties: { entries } }]` with no direct
49
+ * `properties` of its own. Without this, such a type renders zero fields.
50
+ *
51
+ * Own `properties` win over inherited ones on a name clash; `required` is the
52
+ * union. Depth-guarded against cyclic `$ref`.
53
+ */
54
+ export declare function resolveProperties(schema: OpenApi.IJsonSchema, doc: OpenApi.IDocument, depth?: number): {
55
+ properties: Record<string, OpenApi.IJsonSchema>;
56
+ required: string[];
57
+ };
58
+ /**
59
+ * Extract the field list of a schema directly (resolving `$ref` and `allOf`).
60
+ * Works for both named component schemas and INLINE schemas — e.g. a response
61
+ * `{ databases: T[], links: … }` that is not a named component (common on
62
+ * DigitalOcean). Returns `[]` when there are no resolvable `properties`.
63
+ */
64
+ export declare function extractFieldsFromSchema(schema: OpenApi.IJsonSchema, document: OpenApi.IDocument): IFieldSpec[];
65
+ /**
66
+ * Extract the field list of a NAMED component schema. Returns `[]` when the type
67
+ * is unknown or has no resolvable `properties` — the caller then degrades
68
+ * gracefully rather than inventing fields.
69
+ */
70
+ export declare function extractFields(typeName: string, document: OpenApi.IDocument): IFieldSpec[];
71
+ /**
72
+ * The field that best represents a record's image, or `undefined`. A scalar
73
+ * `string` (often `format: uri`) or a `string[]` of image URLs whose NAME reads
74
+ * as an image wins; failing that, a uri-formatted url-ish field. This is the
75
+ * signal that turns a list into a catalog of cards instead of a table.
76
+ */
77
+ export declare function imageFieldOf(columns: IFieldSpec[]): IFieldSpec | undefined;
78
+ /** The field that best titles a record (a card's heading), or `undefined`. */
79
+ export declare function titleFieldOf(columns: IFieldSpec[]): IFieldSpec | undefined;
80
+ /**
81
+ * A collection deserves a catalog (card grid) rather than a table when its rows
82
+ * carry both an image and a title — the two things a card needs. Purely
83
+ * structural from the element schema; no domain keywords.
84
+ */
85
+ export declare function isCatalogCollection(columns: IFieldSpec[]): boolean;
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.COLLECTION_FIELD_NAMES = void 0;
4
+ exports.findCollectionField = findCollectionField;
5
+ exports.resolveProperties = resolveProperties;
6
+ exports.extractFieldsFromSchema = extractFieldsFromSchema;
7
+ exports.extractFields = extractFields;
8
+ exports.imageFieldOf = imageFieldOf;
9
+ exports.titleFieldOf = titleFieldOf;
10
+ exports.isCatalogCollection = isCatalogCollection;
11
+ function refName($ref) {
12
+ return $ref.split("/").pop();
13
+ }
14
+ /**
15
+ * Field names a paginated/collection response uses to hold its array of items.
16
+ * `data` is the nestia/AutoBE convention; real APIs vary (Box uses `entries`,
17
+ * others `items` / `results`). Recognizing all of them lets a list endpoint be
18
+ * rendered as a table off its element type instead of a one-record detail.
19
+ */
20
+ exports.COLLECTION_FIELD_NAMES = new Set([
21
+ "data",
22
+ "entries",
23
+ "items",
24
+ "results",
25
+ "values",
26
+ "list",
27
+ "records",
28
+ "rows",
29
+ ]);
30
+ /** The array field that holds a collection response's items, if any. */
31
+ function findCollectionField(fields) {
32
+ return fields.find((f) => f.kind === "array" && exports.COLLECTION_FIELD_NAMES.has(f.name.toLowerCase()));
33
+ }
34
+ function kindOf(schema) {
35
+ if ("$ref" in schema && typeof schema.$ref === "string") {
36
+ return { kind: "ref", ref: refName(schema.$ref) };
37
+ }
38
+ // A bare `const` (no `oneOf`) is a single-value literal — typically a
39
+ // discriminant like `{ const: "customer" }`. Treat it as a one-value enum so
40
+ // it renders as a labeled value, not `unknown`.
41
+ if ("const" in schema && !("oneOf" in schema)) {
42
+ return {
43
+ kind: "enum",
44
+ enumValues: [schema.const],
45
+ };
46
+ }
47
+ // upgradeDocument normalizes a string enum into `oneOf: [{ const }, ...]`, and
48
+ // a nullable type into `oneOf: [{ type: "null" }, <real schema>]`. Drop the
49
+ // null branch first, then: an all-`const` set is an enum; a single remaining
50
+ // branch is just that type made nullable (unwrap it — a nullable `$ref`
51
+ // becomes a `ref`, not a `union`); anything else is a real union.
52
+ if ("oneOf" in schema && Array.isArray(schema.oneOf)) {
53
+ const branches = schema.oneOf.filter((b) => !("type" in b && b.type === "null"));
54
+ const consts = branches.map((b) => "const" in b ? b.const : undefined);
55
+ if (consts.length > 0 && consts.every((c) => c !== undefined)) {
56
+ return { kind: "enum", enumValues: consts };
57
+ }
58
+ if (branches.length === 1)
59
+ return kindOf(branches[0]);
60
+ // A homogeneous primitive union (e.g. a string that is `ipv4 | ipv6`, or
61
+ // `uri | ""`) is, for display, just that primitive — collapse it. Branches
62
+ // with differing or no `type` (a real polymorphic `$ref` union) stay
63
+ // `union` so we never mislabel one variant as another.
64
+ const prims = branches.map((b) => "type" in b ? b.type : undefined);
65
+ if (prims.every((t) => t !== undefined && t === prims[0])) {
66
+ return kindOf(branches[0]);
67
+ }
68
+ return { kind: "union" };
69
+ }
70
+ if ("anyOf" in schema || "allOf" in schema) {
71
+ return { kind: "union" };
72
+ }
73
+ if (!("type" in schema))
74
+ return { kind: "unknown" };
75
+ switch (schema.type) {
76
+ case "boolean":
77
+ return { kind: "boolean" };
78
+ case "integer":
79
+ case "number":
80
+ return { kind: "number" };
81
+ case "string": {
82
+ // biome-ignore lint: enum is part of the JSON Schema string node
83
+ const enumValues = schema.enum;
84
+ if (Array.isArray(enumValues) && enumValues.length > 0) {
85
+ return { kind: "enum", enumValues, format: schema.format };
86
+ }
87
+ return { kind: "string", format: schema.format };
88
+ }
89
+ case "array": {
90
+ const items = "items" in schema ? schema.items : undefined;
91
+ if (items === undefined)
92
+ return { kind: "array", itemKind: "unknown" };
93
+ const inner = kindOf(items);
94
+ return {
95
+ kind: "array",
96
+ itemKind: inner.kind,
97
+ ref: inner.ref,
98
+ itemFormat: inner.format,
99
+ };
100
+ }
101
+ case "object":
102
+ return { kind: "object" };
103
+ default:
104
+ return { kind: "unknown" };
105
+ }
106
+ }
107
+ /**
108
+ * Resolve a schema's effective `{ properties, required }`, following `$ref` and
109
+ * merging every `allOf` member. Composition (`allOf`) is a core OpenAPI feature
110
+ * real swaggers (Box, Stripe, …) lean on heavily — a type is often
111
+ * `allOf: [BasePagination, { properties: { entries } }]` with no direct
112
+ * `properties` of its own. Without this, such a type renders zero fields.
113
+ *
114
+ * Own `properties` win over inherited ones on a name clash; `required` is the
115
+ * union. Depth-guarded against cyclic `$ref`.
116
+ */
117
+ function resolveProperties(schema, doc, depth = 0) {
118
+ var _a, _b;
119
+ if (depth > 8)
120
+ return { properties: {}, required: [] };
121
+ if ("$ref" in schema && typeof schema.$ref === "string") {
122
+ const target = ((_b = (_a = doc.components) === null || _a === void 0 ? void 0 : _a.schemas) !== null && _b !== void 0 ? _b : {})[refName(schema.$ref)];
123
+ return target === undefined
124
+ ? { properties: {}, required: [] }
125
+ : resolveProperties(target, doc, depth + 1);
126
+ }
127
+ let properties = {};
128
+ let required = [];
129
+ if ("allOf" in schema && Array.isArray(schema.allOf)) {
130
+ for (const member of schema.allOf) {
131
+ const sub = resolveProperties(member, doc, depth + 1);
132
+ properties = Object.assign(Object.assign({}, properties), sub.properties);
133
+ required = [...required, ...sub.required];
134
+ }
135
+ }
136
+ if ("properties" in schema && schema.properties !== undefined) {
137
+ properties = Object.assign(Object.assign({}, properties), schema.properties);
138
+ }
139
+ if ("required" in schema && Array.isArray(schema.required)) {
140
+ required = [...required, ...schema.required];
141
+ }
142
+ return { properties, required: [...new Set(required)] };
143
+ }
144
+ /**
145
+ * Extract the field list of a schema directly (resolving `$ref` and `allOf`).
146
+ * Works for both named component schemas and INLINE schemas — e.g. a response
147
+ * `{ databases: T[], links: … }` that is not a named component (common on
148
+ * DigitalOcean). Returns `[]` when there are no resolvable `properties`.
149
+ */
150
+ function extractFieldsFromSchema(schema, document) {
151
+ const { properties, required } = resolveProperties(schema, document, 0);
152
+ const requiredSet = new Set(required);
153
+ return Object.entries(properties).map(([name, prop]) => {
154
+ const k = kindOf(prop);
155
+ // For an array of INLINE objects (no $ref element type), resolve the
156
+ // element's own fields so a table can show its columns.
157
+ let itemFields;
158
+ if (k.kind === "array" && k.ref === undefined) {
159
+ const items = prop.items;
160
+ if (items !== undefined) {
161
+ const inner = extractFieldsFromSchema(items, document);
162
+ if (inner.length > 0)
163
+ itemFields = inner;
164
+ }
165
+ }
166
+ return {
167
+ name,
168
+ required: requiredSet.has(name),
169
+ kind: k.kind,
170
+ format: k.format,
171
+ enumValues: k.enumValues,
172
+ ref: k.ref,
173
+ itemKind: k.itemKind,
174
+ itemFormat: k.itemFormat,
175
+ itemFields,
176
+ };
177
+ });
178
+ }
179
+ /**
180
+ * Extract the field list of a NAMED component schema. Returns `[]` when the type
181
+ * is unknown or has no resolvable `properties` — the caller then degrades
182
+ * gracefully rather than inventing fields.
183
+ */
184
+ function extractFields(typeName, document) {
185
+ var _a, _b;
186
+ const schema = ((_b = (_a = document.components) === null || _a === void 0 ? void 0 : _a.schemas) !== null && _b !== void 0 ? _b : {})[typeName];
187
+ if (schema === undefined)
188
+ return [];
189
+ return extractFieldsFromSchema(schema, document);
190
+ }
191
+ /** Field names that read as an image, optionally suffixed with url(s)/uri(s)/src. */
192
+ const IMAGE_NAME = /(image|img|photo|picture|thumbnail|thumb|avatar|icon|logo|banner|cover|poster|artwork)s?(_?(url|uri|src|href)s?)?$/i;
193
+ /** Field names that hold a human title for a record (the card's heading). */
194
+ const TITLE_NAMES = new Set([
195
+ "name",
196
+ "title",
197
+ "label",
198
+ "headline",
199
+ "subject",
200
+ "nickname",
201
+ ]);
202
+ /**
203
+ * The field that best represents a record's image, or `undefined`. A scalar
204
+ * `string` (often `format: uri`) or a `string[]` of image URLs whose NAME reads
205
+ * as an image wins; failing that, a uri-formatted url-ish field. This is the
206
+ * signal that turns a list into a catalog of cards instead of a table.
207
+ */
208
+ function imageFieldOf(columns) {
209
+ const named = columns.find((c) => IMAGE_NAME.test(c.name) &&
210
+ (c.kind === "string" || (c.kind === "array" && c.itemKind === "string")));
211
+ if (named !== undefined)
212
+ return named;
213
+ return columns.find((c) => (c.kind === "string" &&
214
+ c.format === "uri" &&
215
+ /url|uri|src|link/i.test(c.name)) ||
216
+ (c.kind === "array" && c.itemKind === "string" && c.itemFormat === "uri"));
217
+ }
218
+ /** The field that best titles a record (a card's heading), or `undefined`. */
219
+ function titleFieldOf(columns) {
220
+ var _a;
221
+ return ((_a = columns.find((c) => c.kind === "string" && TITLE_NAMES.has(c.name.toLowerCase()))) !== null && _a !== void 0 ? _a : columns.find((c) => c.kind === "string" && /name|title/i.test(c.name)));
222
+ }
223
+ /**
224
+ * A collection deserves a catalog (card grid) rather than a table when its rows
225
+ * carry both an image and a title — the two things a card needs. Purely
226
+ * structural from the element schema; no domain keywords.
227
+ */
228
+ function isCatalogCollection(columns) {
229
+ return (imageFieldOf(columns) !== undefined && titleFieldOf(columns) !== undefined);
230
+ }
231
+ //# sourceMappingURL=extractFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractFields.js","sourceRoot":"","sources":["../../src/utils/extractFields.ts"],"names":[],"mappings":";;;AAoEA,kDAMC;AAgGD,8CA4BC;AAQD,0DA8BC;AAOD,sCAOC;AAqBD,oCAcC;AAGD,oCAMC;AAOD,kDAIC;AAnQD,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG,CAAC;AAChC,CAAC;AAED;;;;;GAKG;AACU,QAAA,sBAAsB,GAAG,IAAI,GAAG,CAAC;IAC5C,MAAM;IACN,SAAS;IACT,OAAO;IACP,SAAS;IACT,QAAQ;IACR,MAAM;IACN,SAAS;IACT,MAAM;CACP,CAAC,CAAC;AAEH,wEAAwE;AACxE,SAAgB,mBAAmB,CACjC,MAAoB;IAEpB,OAAO,MAAM,CAAC,IAAI,CAChB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,8BAAsB,CAAC,GAAG,CAAC,CAAC,CAA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