@apimatic/cli 1.5.0 → 2.0.0-beta.1

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 (610) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -212
  3. package/apimatic.schema.json +550 -0
  4. package/lib/actions/action-result.js +3 -0
  5. package/lib/actions/action-result.js.map +1 -1
  6. package/lib/actions/api/transform.js +36 -33
  7. package/lib/actions/api/transform.js.map +1 -1
  8. package/lib/actions/api/validate.d.ts +9 -6
  9. package/lib/actions/api/validate.js +44 -38
  10. package/lib/actions/api/validate.js.map +1 -1
  11. package/lib/actions/auth/login.js +7 -4
  12. package/lib/actions/auth/login.js.map +1 -1
  13. package/lib/actions/auth/logout.js +2 -1
  14. package/lib/actions/auth/logout.js.map +1 -1
  15. package/lib/actions/auth/status.js +5 -3
  16. package/lib/actions/auth/status.js.map +1 -1
  17. package/lib/actions/plugin/generate.d.ts +5 -1
  18. package/lib/actions/plugin/generate.js +83 -56
  19. package/lib/actions/plugin/generate.js.map +1 -1
  20. package/lib/actions/plugin/publish.d.ts +2 -1
  21. package/lib/actions/plugin/publish.js +34 -37
  22. package/lib/actions/plugin/publish.js.map +1 -1
  23. package/lib/actions/plugin/record-metadata.d.ts +3 -2
  24. package/lib/actions/plugin/record-metadata.js +33 -30
  25. package/lib/actions/plugin/record-metadata.js.map +1 -1
  26. package/lib/actions/portal/generate.d.ts +8 -6
  27. package/lib/actions/portal/generate.js +50 -61
  28. package/lib/actions/portal/generate.js.map +1 -1
  29. package/lib/actions/portal/prepare-project.d.ts +25 -0
  30. package/lib/actions/portal/prepare-project.js +68 -0
  31. package/lib/actions/portal/prepare-project.js.map +1 -0
  32. package/lib/actions/portal/serve.d.ts +21 -6
  33. package/lib/actions/portal/serve.js +170 -153
  34. package/lib/actions/portal/serve.js.map +1 -1
  35. package/lib/actions/publishing/profile/list.js +4 -2
  36. package/lib/actions/publishing/profile/list.js.map +1 -1
  37. package/lib/actions/quickstart.d.ts +23 -5
  38. package/lib/actions/quickstart.js +222 -21
  39. package/lib/actions/quickstart.js.map +1 -1
  40. package/lib/actions/sdk/generate.d.ts +4 -7
  41. package/lib/actions/sdk/generate.js +53 -93
  42. package/lib/actions/sdk/generate.js.map +1 -1
  43. package/lib/actions/sdk/publish/interactive.d.ts +4 -3
  44. package/lib/actions/sdk/publish/interactive.js +96 -97
  45. package/lib/actions/sdk/publish/interactive.js.map +1 -1
  46. package/lib/actions/sdk/publish/non-interactive.d.ts +4 -2
  47. package/lib/actions/sdk/publish/non-interactive.js +91 -90
  48. package/lib/actions/sdk/publish/non-interactive.js.map +1 -1
  49. package/lib/actions/sdk/publish.d.ts +3 -2
  50. package/lib/actions/sdk/publish.js +55 -53
  51. package/lib/actions/sdk/publish.js.map +1 -1
  52. package/lib/actions/sdk/record-published-sdk.d.ts +14 -0
  53. package/lib/actions/sdk/record-published-sdk.js +57 -0
  54. package/lib/actions/sdk/record-published-sdk.js.map +1 -0
  55. package/lib/client-utils/auth-manager.js +1 -1
  56. package/lib/client-utils/auth-manager.js.map +1 -1
  57. package/lib/commands/api/transform.d.ts +1 -1
  58. package/lib/commands/api/transform.js +44 -40
  59. package/lib/commands/api/transform.js.map +1 -1
  60. package/lib/commands/api/validate.js +16 -16
  61. package/lib/commands/api/validate.js.map +1 -1
  62. package/lib/commands/auth/login.js +14 -15
  63. package/lib/commands/auth/login.js.map +1 -1
  64. package/lib/commands/auth/logout.js +5 -6
  65. package/lib/commands/auth/logout.js.map +1 -1
  66. package/lib/commands/auth/status.js +4 -5
  67. package/lib/commands/auth/status.js.map +1 -1
  68. package/lib/commands/plugin/generate.d.ts +3 -3
  69. package/lib/commands/plugin/generate.js +20 -20
  70. package/lib/commands/plugin/generate.js.map +1 -1
  71. package/lib/commands/plugin/publish.js +18 -18
  72. package/lib/commands/plugin/publish.js.map +1 -1
  73. package/lib/commands/portal/generate.d.ts +9 -8
  74. package/lib/commands/portal/generate.js +36 -27
  75. package/lib/commands/portal/generate.js.map +1 -1
  76. package/lib/commands/portal/serve.d.ts +7 -9
  77. package/lib/commands/portal/serve.js +41 -44
  78. package/lib/commands/portal/serve.js.map +1 -1
  79. package/lib/commands/publishing/profile/list.js +8 -12
  80. package/lib/commands/publishing/profile/list.js.map +1 -1
  81. package/lib/commands/quickstart.d.ts +5 -5
  82. package/lib/commands/quickstart.js +18 -24
  83. package/lib/commands/quickstart.js.map +1 -1
  84. package/lib/commands/sdk/generate.d.ts +5 -7
  85. package/lib/commands/sdk/generate.js +58 -70
  86. package/lib/commands/sdk/generate.js.map +1 -1
  87. package/lib/commands/sdk/publish.d.ts +6 -7
  88. package/lib/commands/sdk/publish.js +66 -60
  89. package/lib/commands/sdk/publish.js.map +1 -1
  90. package/lib/hooks/node-version.d.ts +3 -0
  91. package/lib/hooks/node-version.js +12 -0
  92. package/lib/hooks/node-version.js.map +1 -0
  93. package/lib/hooks/not-found.js +2 -3
  94. package/lib/hooks/not-found.js.map +1 -1
  95. package/lib/hooks/utils.d.ts +4 -2
  96. package/lib/hooks/utils.js +2 -2
  97. package/lib/hooks/utils.js.map +1 -1
  98. package/lib/infrastructure/env-info.d.ts +3 -0
  99. package/lib/infrastructure/env-info.js +13 -6
  100. package/lib/infrastructure/env-info.js.map +1 -1
  101. package/lib/infrastructure/file-service.d.ts +35 -8
  102. package/lib/infrastructure/file-service.js +149 -53
  103. package/lib/infrastructure/file-service.js.map +1 -1
  104. package/lib/infrastructure/file-watch-service.d.ts +40 -0
  105. package/lib/infrastructure/file-watch-service.js +167 -0
  106. package/lib/infrastructure/file-watch-service.js.map +1 -0
  107. package/lib/infrastructure/generation-status-poller.d.ts +8 -7
  108. package/lib/infrastructure/generation-status-poller.js +20 -12
  109. package/lib/infrastructure/generation-status-poller.js.map +1 -1
  110. package/lib/infrastructure/launcher-service.js +6 -6
  111. package/lib/infrastructure/launcher-service.js.map +1 -1
  112. package/lib/infrastructure/network-service.d.ts +3 -0
  113. package/lib/infrastructure/network-service.js +15 -1
  114. package/lib/infrastructure/network-service.js.map +1 -1
  115. package/lib/infrastructure/portal-build-service.d.ts +19 -0
  116. package/lib/infrastructure/portal-build-service.js +58 -0
  117. package/lib/infrastructure/portal-build-service.js.map +1 -0
  118. package/lib/infrastructure/portal-dev-server-service.d.ts +29 -0
  119. package/lib/infrastructure/portal-dev-server-service.js +135 -0
  120. package/lib/infrastructure/portal-dev-server-service.js.map +1 -0
  121. package/lib/infrastructure/portal-pages-service.d.ts +17 -0
  122. package/lib/infrastructure/portal-pages-service.js +103 -0
  123. package/lib/infrastructure/portal-pages-service.js.map +1 -0
  124. package/lib/infrastructure/portal-project-service.d.ts +77 -0
  125. package/lib/infrastructure/portal-project-service.js +309 -0
  126. package/lib/infrastructure/portal-project-service.js.map +1 -0
  127. package/lib/infrastructure/service-error.d.ts +1 -0
  128. package/lib/infrastructure/service-error.js +39 -41
  129. package/lib/infrastructure/service-error.js.map +1 -1
  130. package/lib/infrastructure/services/api-client-factory.js +15 -13
  131. package/lib/infrastructure/services/api-client-factory.js.map +1 -1
  132. package/lib/infrastructure/services/api-service.d.ts +7 -5
  133. package/lib/infrastructure/services/api-service.js +28 -20
  134. package/lib/infrastructure/services/api-service.js.map +1 -1
  135. package/lib/infrastructure/services/auth-service.js +4 -9
  136. package/lib/infrastructure/services/auth-service.js.map +1 -1
  137. package/lib/infrastructure/services/file-download-service.js +3 -3
  138. package/lib/infrastructure/services/file-download-service.js.map +1 -1
  139. package/lib/infrastructure/services/plugin-service.d.ts +1 -8
  140. package/lib/infrastructure/services/plugin-service.js +11 -22
  141. package/lib/infrastructure/services/plugin-service.js.map +1 -1
  142. package/lib/infrastructure/services/portal-artifacts-service.d.ts +44 -0
  143. package/lib/infrastructure/services/portal-artifacts-service.js +268 -0
  144. package/lib/infrastructure/services/portal-artifacts-service.js.map +1 -0
  145. package/lib/infrastructure/services/portal-authorization-service.d.ts +22 -0
  146. package/lib/infrastructure/services/portal-authorization-service.js +23 -0
  147. package/lib/infrastructure/services/portal-authorization-service.js.map +1 -0
  148. package/lib/infrastructure/services/publishing-api-service.d.ts +1 -1
  149. package/lib/infrastructure/services/publishing-api-service.js +11 -15
  150. package/lib/infrastructure/services/publishing-api-service.js.map +1 -1
  151. package/lib/infrastructure/services/sdk-generation-service.d.ts +21 -0
  152. package/lib/infrastructure/services/sdk-generation-service.js +118 -0
  153. package/lib/infrastructure/services/sdk-generation-service.js.map +1 -0
  154. package/lib/infrastructure/services/telemetry-service.js +5 -4
  155. package/lib/infrastructure/services/telemetry-service.js.map +1 -1
  156. package/lib/infrastructure/services/transformation-service.js +29 -32
  157. package/lib/infrastructure/services/transformation-service.js.map +1 -1
  158. package/lib/infrastructure/services/validation-service.d.ts +12 -53
  159. package/lib/infrastructure/services/validation-service.js +24 -199
  160. package/lib/infrastructure/services/validation-service.js.map +1 -1
  161. package/lib/infrastructure/timer-extensions.d.ts +2 -0
  162. package/lib/infrastructure/timer-extensions.js +10 -0
  163. package/lib/infrastructure/timer-extensions.js.map +1 -0
  164. package/lib/infrastructure/tmp-extensions.d.ts +31 -1
  165. package/lib/infrastructure/tmp-extensions.js +86 -3
  166. package/lib/infrastructure/tmp-extensions.js.map +1 -1
  167. package/lib/infrastructure/zip-service.js +2 -2
  168. package/lib/infrastructure/zip-service.js.map +1 -1
  169. package/lib/prompts/api/validate.d.ts +6 -7
  170. package/lib/prompts/api/validate.js +12 -12
  171. package/lib/prompts/api/validate.js.map +1 -1
  172. package/lib/prompts/format.d.ts +4 -0
  173. package/lib/prompts/format.js +5 -0
  174. package/lib/prompts/format.js.map +1 -1
  175. package/lib/prompts/plugin/generate.d.ts +17 -12
  176. package/lib/prompts/plugin/generate.js +94 -44
  177. package/lib/prompts/plugin/generate.js.map +1 -1
  178. package/lib/prompts/plugin/publish.d.ts +2 -1
  179. package/lib/prompts/plugin/publish.js +8 -7
  180. package/lib/prompts/plugin/publish.js.map +1 -1
  181. package/lib/prompts/plugin/record-metadata.d.ts +1 -0
  182. package/lib/prompts/plugin/record-metadata.js +10 -7
  183. package/lib/prompts/plugin/record-metadata.js.map +1 -1
  184. package/lib/prompts/portal/artifacts.d.ts +8 -0
  185. package/lib/prompts/portal/artifacts.js +26 -0
  186. package/lib/prompts/portal/artifacts.js.map +1 -0
  187. package/lib/prompts/portal/authorization.d.ts +6 -0
  188. package/lib/prompts/portal/authorization.js +29 -0
  189. package/lib/prompts/portal/authorization.js.map +1 -0
  190. package/lib/prompts/portal/code-samples.d.ts +1 -0
  191. package/lib/prompts/portal/code-samples.js +9 -0
  192. package/lib/prompts/portal/code-samples.js.map +1 -0
  193. package/lib/prompts/portal/generate.d.ts +14 -9
  194. package/lib/prompts/portal/generate.js +48 -26
  195. package/lib/prompts/portal/generate.js.map +1 -1
  196. package/lib/prompts/portal/prepare-project.d.ts +20 -0
  197. package/lib/prompts/portal/prepare-project.js +36 -0
  198. package/lib/prompts/portal/prepare-project.js.map +1 -0
  199. package/lib/prompts/portal/serve.d.ts +32 -12
  200. package/lib/prompts/portal/serve.js +102 -39
  201. package/lib/prompts/portal/serve.js.map +1 -1
  202. package/lib/prompts/portal/source.d.ts +26 -0
  203. package/lib/prompts/portal/source.js +253 -0
  204. package/lib/prompts/portal/source.js.map +1 -0
  205. package/lib/prompts/prompt.d.ts +11 -3
  206. package/lib/prompts/prompt.js +39 -15
  207. package/lib/prompts/prompt.js.map +1 -1
  208. package/lib/prompts/quickstart.d.ts +46 -3
  209. package/lib/prompts/quickstart.js +199 -12
  210. package/lib/prompts/quickstart.js.map +1 -1
  211. package/lib/prompts/sdk/generate.d.ts +15 -13
  212. package/lib/prompts/sdk/generate.js +29 -32
  213. package/lib/prompts/sdk/generate.js.map +1 -1
  214. package/lib/prompts/sdk/publish/interactive.d.ts +10 -6
  215. package/lib/prompts/sdk/publish/interactive.js +26 -24
  216. package/lib/prompts/sdk/publish/interactive.js.map +1 -1
  217. package/lib/prompts/sdk/publish/non-interactive.d.ts +2 -1
  218. package/lib/prompts/sdk/publish/non-interactive.js +5 -4
  219. package/lib/prompts/sdk/publish/non-interactive.js.map +1 -1
  220. package/lib/prompts/sdk/publish.d.ts +3 -3
  221. package/lib/prompts/sdk/publish.js +13 -17
  222. package/lib/prompts/sdk/publish.js.map +1 -1
  223. package/lib/prompts/sdk/record-published-sdk.d.ts +7 -0
  224. package/lib/prompts/sdk/record-published-sdk.js +26 -0
  225. package/lib/prompts/sdk/record-published-sdk.js.map +1 -0
  226. package/lib/types/apimatic-config/document.d.ts +70 -0
  227. package/lib/types/apimatic-config/document.js +167 -0
  228. package/lib/types/apimatic-config/document.js.map +1 -0
  229. package/lib/types/apimatic-config/languages-block.d.ts +39 -0
  230. package/lib/types/apimatic-config/languages-block.js +58 -0
  231. package/lib/types/apimatic-config/languages-block.js.map +1 -0
  232. package/lib/types/apimatic-config-context.d.ts +48 -0
  233. package/lib/types/apimatic-config-context.js +121 -0
  234. package/lib/types/apimatic-config-context.js.map +1 -0
  235. package/lib/types/build/build.d.ts +1 -89
  236. package/lib/types/build/build.js +6 -161
  237. package/lib/types/build/build.js.map +1 -1
  238. package/lib/types/events/domain-event.js +3 -0
  239. package/lib/types/events/domain-event.js.map +1 -1
  240. package/lib/types/events/quickstart-completed.js +3 -3
  241. package/lib/types/events/quickstart-completed.js.map +1 -1
  242. package/lib/types/events/quickstart-initiated.js +3 -3
  243. package/lib/types/events/quickstart-initiated.js.map +1 -1
  244. package/lib/types/events/sdk-publish-validation-failed.js +1 -1
  245. package/lib/types/events/sdk-publish-validation-failed.js.map +1 -1
  246. package/lib/types/file/directory.d.ts +4 -9
  247. package/lib/types/file/directory.js +17 -65
  248. package/lib/types/file/directory.js.map +1 -1
  249. package/lib/types/file/directoryPath.d.ts +17 -0
  250. package/lib/types/file/directoryPath.js +47 -2
  251. package/lib/types/file/directoryPath.js.map +1 -1
  252. package/lib/types/file/fileName.d.ts +8 -0
  253. package/lib/types/file/fileName.js +28 -6
  254. package/lib/types/file/fileName.js.map +1 -1
  255. package/lib/types/file/filePath.d.ts +18 -2
  256. package/lib/types/file/filePath.js +39 -4
  257. package/lib/types/file/filePath.js.map +1 -1
  258. package/lib/types/file/resource-input.js +1 -2
  259. package/lib/types/file/resource-input.js.map +1 -1
  260. package/lib/types/file/urlPath.js +2 -1
  261. package/lib/types/file/urlPath.js.map +1 -1
  262. package/lib/types/flags-provider.js +22 -22
  263. package/lib/types/flags-provider.js.map +1 -1
  264. package/lib/types/package-settings-context.js +2 -1
  265. package/lib/types/package-settings-context.js.map +1 -1
  266. package/lib/types/plugin/plugin-config.d.ts +10 -50
  267. package/lib/types/plugin/plugin-config.js +7 -1
  268. package/lib/types/plugin/plugin-config.js.map +1 -1
  269. package/lib/types/plugin-config-context.d.ts +30 -37
  270. package/lib/types/plugin-config-context.js +108 -139
  271. package/lib/types/plugin-config-context.js.map +1 -1
  272. package/lib/types/plugin-context.js +3 -2
  273. package/lib/types/plugin-context.js.map +1 -1
  274. package/lib/types/portal/code-samples.d.ts +27 -0
  275. package/lib/types/portal/code-samples.js +67 -0
  276. package/lib/types/portal/code-samples.js.map +1 -0
  277. package/lib/types/portal/config/ai-config.d.ts +15 -0
  278. package/lib/types/portal/config/ai-config.js +26 -0
  279. package/lib/types/portal/config/ai-config.js.map +1 -0
  280. package/lib/types/portal/config/brand-config.d.ts +55 -0
  281. package/lib/types/portal/config/brand-config.js +105 -0
  282. package/lib/types/portal/config/brand-config.js.map +1 -0
  283. package/lib/types/portal/config/color.d.ts +19 -0
  284. package/lib/types/portal/config/color.js +43 -0
  285. package/lib/types/portal/config/color.js.map +1 -0
  286. package/lib/types/portal/config/fields.d.ts +23 -0
  287. package/lib/types/portal/config/fields.js +67 -0
  288. package/lib/types/portal/config/fields.js.map +1 -0
  289. package/lib/types/portal/config/link.d.ts +18 -0
  290. package/lib/types/portal/config/link.js +72 -0
  291. package/lib/types/portal/config/link.js.map +1 -0
  292. package/lib/types/portal/config/navigation-config.d.ts +13 -0
  293. package/lib/types/portal/config/navigation-config.js +30 -0
  294. package/lib/types/portal/config/navigation-config.js.map +1 -0
  295. package/lib/types/portal/config/site-config.d.ts +32 -0
  296. package/lib/types/portal/config/site-config.js +88 -0
  297. package/lib/types/portal/config/site-config.js.map +1 -0
  298. package/lib/types/portal/config/static-asset.d.ts +25 -0
  299. package/lib/types/portal/config/static-asset.js +77 -0
  300. package/lib/types/portal/config/static-asset.js.map +1 -0
  301. package/lib/types/portal/content-notices.d.ts +20 -0
  302. package/lib/types/portal/content-notices.js +2 -0
  303. package/lib/types/portal/content-notices.js.map +1 -0
  304. package/lib/types/portal/content-tree.d.ts +103 -0
  305. package/lib/types/portal/content-tree.js +344 -0
  306. package/lib/types/portal/content-tree.js.map +1 -0
  307. package/lib/types/portal/endpoint.d.ts +6 -0
  308. package/lib/types/portal/endpoint.js +12 -0
  309. package/lib/types/portal/endpoint.js.map +1 -0
  310. package/lib/types/portal/generated-pages.d.ts +68 -0
  311. package/lib/types/portal/generated-pages.js +111 -0
  312. package/lib/types/portal/generated-pages.js.map +1 -0
  313. package/lib/types/portal/generation-status.d.ts +31 -0
  314. package/lib/types/portal/generation-status.js +26 -0
  315. package/lib/types/portal/generation-status.js.map +1 -0
  316. package/lib/types/portal/openapi-document.d.ts +48 -0
  317. package/lib/types/portal/openapi-document.js +138 -0
  318. package/lib/types/portal/openapi-document.js.map +1 -0
  319. package/lib/types/portal/page-fragments.d.ts +13 -0
  320. package/lib/types/portal/page-fragments.js +24 -0
  321. package/lib/types/portal/page-fragments.js.map +1 -0
  322. package/lib/types/portal/page-template.d.ts +15 -0
  323. package/lib/types/portal/page-template.js +64 -0
  324. package/lib/types/portal/page-template.js.map +1 -0
  325. package/lib/types/portal/page.d.ts +24 -0
  326. package/lib/types/portal/page.js +100 -0
  327. package/lib/types/portal/page.js.map +1 -0
  328. package/lib/types/portal/portal-artifacts.d.ts +25 -0
  329. package/lib/types/portal/portal-artifacts.js +30 -0
  330. package/lib/types/portal/portal-artifacts.js.map +1 -0
  331. package/lib/types/portal/portal-config.d.ts +69 -0
  332. package/lib/types/portal/portal-config.js +105 -0
  333. package/lib/types/portal/portal-config.js.map +1 -0
  334. package/lib/types/portal/portal-downloads.d.ts +8 -0
  335. package/lib/types/portal/portal-downloads.js +14 -0
  336. package/lib/types/portal/portal-downloads.js.map +1 -0
  337. package/lib/types/portal/portal-languages.d.ts +15 -0
  338. package/lib/types/portal/portal-languages.js +45 -0
  339. package/lib/types/portal/portal-languages.js.map +1 -0
  340. package/lib/types/portal/portal-navigation.d.ts +65 -0
  341. package/lib/types/portal/portal-navigation.js +217 -0
  342. package/lib/types/portal/portal-navigation.js.map +1 -0
  343. package/lib/types/portal/portal-sdk.d.ts +15 -0
  344. package/lib/types/portal/portal-sdk.js +28 -0
  345. package/lib/types/portal/portal-sdk.js.map +1 -0
  346. package/lib/types/portal/portal-source.d.ts +129 -0
  347. package/lib/types/portal/portal-source.js +2 -0
  348. package/lib/types/portal/portal-source.js.map +1 -0
  349. package/lib/types/portal/portal-stylesheet.d.ts +19 -0
  350. package/lib/types/portal/portal-stylesheet.js +40 -0
  351. package/lib/types/portal/portal-stylesheet.js.map +1 -0
  352. package/lib/types/portal/portal-tabs.d.ts +33 -0
  353. package/lib/types/portal/portal-tabs.js +38 -0
  354. package/lib/types/portal/portal-tabs.js.map +1 -0
  355. package/lib/types/portal/preview-config.d.ts +20 -0
  356. package/lib/types/portal/preview-config.js +32 -0
  357. package/lib/types/portal/preview-config.js.map +1 -0
  358. package/lib/types/portal/preview-content.d.ts +18 -0
  359. package/lib/types/portal/preview-content.js +50 -0
  360. package/lib/types/portal/preview-content.js.map +1 -0
  361. package/lib/types/portal/published-package.d.ts +12 -0
  362. package/lib/types/portal/published-package.js +35 -0
  363. package/lib/types/portal/published-package.js.map +1 -0
  364. package/lib/types/portal/unknown-fields.d.ts +5 -0
  365. package/lib/types/portal/unknown-fields.js +10 -0
  366. package/lib/types/portal/unknown-fields.js.map +1 -0
  367. package/lib/types/portal-context.d.ts +38 -6
  368. package/lib/types/portal-context.js +71 -24
  369. package/lib/types/portal-context.js.map +1 -1
  370. package/lib/types/portal-source-context.d.ts +77 -0
  371. package/lib/types/portal-source-context.js +408 -0
  372. package/lib/types/portal-source-context.js.map +1 -0
  373. package/lib/types/project-context.d.ts +49 -0
  374. package/lib/types/project-context.js +151 -0
  375. package/lib/types/project-context.js.map +1 -0
  376. package/lib/types/project-layout.d.ts +9 -0
  377. package/lib/types/project-layout.js +10 -0
  378. package/lib/types/project-layout.js.map +1 -0
  379. package/lib/types/publish/package-settings-configuration.d.ts +2 -0
  380. package/lib/types/publish/profile-id.js +1 -0
  381. package/lib/types/publish/profile-id.js.map +1 -1
  382. package/lib/types/publish/publishing-profile.d.ts +3 -1
  383. package/lib/types/publish/publishing-profile.js +33 -15
  384. package/lib/types/publish/publishing-profile.js.map +1 -1
  385. package/lib/types/publish/publishing-profiles.js +2 -1
  386. package/lib/types/publish/publishing-profiles.js.map +1 -1
  387. package/lib/types/publish/version.js +1 -0
  388. package/lib/types/publish/version.js.map +1 -1
  389. package/lib/types/resource-context.js +3 -2
  390. package/lib/types/resource-context.js.map +1 -1
  391. package/lib/types/sdk/generate.d.ts +22 -16
  392. package/lib/types/sdk/generate.js +64 -41
  393. package/lib/types/sdk/generate.js.map +1 -1
  394. package/lib/types/sdk/stability-choice.d.ts +12 -0
  395. package/lib/types/sdk/stability-choice.js +24 -0
  396. package/lib/types/sdk/stability-choice.js.map +1 -0
  397. package/lib/types/sdk-context.d.ts +4 -5
  398. package/lib/types/sdk-context.js +10 -18
  399. package/lib/types/sdk-context.js.map +1 -1
  400. package/lib/types/spec-context.d.ts +5 -4
  401. package/lib/types/spec-context.js +9 -8
  402. package/lib/types/spec-context.js.map +1 -1
  403. package/lib/types/temp-context.d.ts +1 -1
  404. package/lib/types/temp-context.js +5 -4
  405. package/lib/types/temp-context.js.map +1 -1
  406. package/lib/types/transform-context.d.ts +9 -5
  407. package/lib/types/transform-context.js +21 -18
  408. package/lib/types/transform-context.js.map +1 -1
  409. package/lib/utils/error-utils.d.ts +2 -0
  410. package/lib/utils/error-utils.js +5 -0
  411. package/lib/utils/error-utils.js.map +1 -0
  412. package/lib/utils/json-utils.d.ts +2 -0
  413. package/lib/utils/json-utils.js +4 -0
  414. package/lib/utils/json-utils.js.map +1 -0
  415. package/lib/utils/string-utils.d.ts +8 -1
  416. package/lib/utils/string-utils.js +13 -26
  417. package/lib/utils/string-utils.js.map +1 -1
  418. package/lib/utils/utils.d.ts +1 -3
  419. package/lib/utils/utils.js +12 -40
  420. package/lib/utils/utils.js.map +1 -1
  421. package/oclif.manifest.json +69 -357
  422. package/package.json +47 -25
  423. package/portal-pages/context-plugin.mdx +26 -0
  424. package/portal-pages/sdk.mdx +8 -0
  425. package/portal-pages/sdks.mdx +11 -0
  426. package/portal-template/NOTICE +37 -0
  427. package/portal-template/downloads.ts +41 -0
  428. package/portal-template/generated-pages-reload.ts +51 -0
  429. package/portal-template/package.json +11 -0
  430. package/portal-template/portal-config.ts +32 -0
  431. package/portal-template/prerender-pages.ts +81 -0
  432. package/portal-template/spec-reload.ts +26 -0
  433. package/portal-template/src/components/api-page.tsx +15 -0
  434. package/portal-template/src/components/code-block.tsx +9 -0
  435. package/portal-template/src/components/command-block.tsx +50 -0
  436. package/portal-template/src/components/example-layout.tsx +99 -0
  437. package/portal-template/src/components/logos.tsx +127 -0
  438. package/portal-template/src/components/mdx.tsx +28 -0
  439. package/portal-template/src/components/not-found.tsx +11 -0
  440. package/portal-template/src/components/plugin-install.tsx +22 -0
  441. package/portal-template/src/components/plugin-support.tsx +53 -0
  442. package/portal-template/src/components/sdk-actions.tsx +79 -0
  443. package/portal-template/src/components/sdk-cards.tsx +100 -0
  444. package/portal-template/src/components/search.tsx +41 -0
  445. package/portal-template/src/components/usage-tabs.tsx +92 -0
  446. package/portal-template/src/lib/code-samples.server.ts +40 -0
  447. package/portal-template/src/lib/code-samples.ts +43 -0
  448. package/portal-template/src/lib/code-titles.ts +29 -0
  449. package/portal-template/src/lib/install-command.ts +13 -0
  450. package/portal-template/src/lib/json.ts +5 -0
  451. package/portal-template/src/lib/layout.shared.tsx +41 -0
  452. package/portal-template/src/lib/layout.tsx +16 -0
  453. package/portal-template/src/lib/llms.server.ts +54 -0
  454. package/portal-template/src/lib/media-adapters.ts +34 -0
  455. package/portal-template/src/lib/navigation.ts +406 -0
  456. package/portal-template/src/lib/openapi-bundle.server.ts +343 -0
  457. package/portal-template/src/lib/openapi-filter.ts +191 -0
  458. package/portal-template/src/lib/openapi-labels.ts +15 -0
  459. package/portal-template/src/lib/openapi-methods.ts +12 -0
  460. package/portal-template/src/lib/openapi-section.server.ts +280 -0
  461. package/portal-template/src/lib/openapi-slim.ts +202 -0
  462. package/portal-template/src/lib/openapi.server.ts +16 -0
  463. package/portal-template/src/lib/portal-types.ts +36 -0
  464. package/portal-template/src/lib/portal.server.ts +13 -0
  465. package/portal-template/src/lib/portal.ts +11 -0
  466. package/portal-template/src/lib/rehype-code-titles.ts +53 -0
  467. package/portal-template/src/lib/request-examples.ts +72 -0
  468. package/portal-template/src/lib/seo.ts +21 -0
  469. package/portal-template/src/lib/shared.ts +51 -0
  470. package/portal-template/src/lib/shiki-bundle.ts +104 -0
  471. package/portal-template/src/lib/sitemap.server.ts +20 -0
  472. package/portal-template/src/lib/source.server.ts +27 -0
  473. package/portal-template/src/lib/source.ts +49 -0
  474. package/portal-template/src/lib/tabs.ts +37 -0
  475. package/portal-template/src/router.tsx +12 -0
  476. package/portal-template/src/routes/$.tsx +194 -0
  477. package/portal-template/src/routes/__root.tsx +56 -0
  478. package/portal-template/src/routes/api/search[.]json.ts +9 -0
  479. package/portal-template/src/routes/llms-full[.]txt.ts +10 -0
  480. package/portal-template/src/routes/llms[.]txt.ts +10 -0
  481. package/portal-template/src/routes/robots[.]txt.ts +10 -0
  482. package/portal-template/src/routes/sitemap[.]xml.ts +10 -0
  483. package/portal-template/src/routes/spa-shell.tsx +7 -0
  484. package/portal-template/src/routes/{$}[.]md.ts +21 -0
  485. package/portal-template/src/styles/app.css +33 -0
  486. package/portal-template/tsconfig.json +26 -0
  487. package/portal-template/vite.config.ts +68 -0
  488. package/lib/actions/plugin/record-sdk.d.ts +0 -14
  489. package/lib/actions/plugin/record-sdk.js +0 -60
  490. package/lib/actions/plugin/record-sdk.js.map +0 -1
  491. package/lib/actions/portal/copilot.d.ts +0 -17
  492. package/lib/actions/portal/copilot.js +0 -89
  493. package/lib/actions/portal/copilot.js.map +0 -1
  494. package/lib/actions/portal/quickstart.d.ts +0 -18
  495. package/lib/actions/portal/quickstart.js +0 -238
  496. package/lib/actions/portal/quickstart.js.map +0 -1
  497. package/lib/actions/portal/recipe/new-recipe.d.ts +0 -15
  498. package/lib/actions/portal/recipe/new-recipe.js +0 -177
  499. package/lib/actions/portal/recipe/new-recipe.js.map +0 -1
  500. package/lib/actions/portal/toc/new-toc.d.ts +0 -21
  501. package/lib/actions/portal/toc/new-toc.js +0 -95
  502. package/lib/actions/portal/toc/new-toc.js.map +0 -1
  503. package/lib/actions/sdk/merge-source-tree.d.ts +0 -12
  504. package/lib/actions/sdk/merge-source-tree.js +0 -78
  505. package/lib/actions/sdk/merge-source-tree.js.map +0 -1
  506. package/lib/actions/sdk/quickstart.d.ts +0 -18
  507. package/lib/actions/sdk/quickstart.js +0 -188
  508. package/lib/actions/sdk/quickstart.js.map +0 -1
  509. package/lib/actions/sdk/save-changes.d.ts +0 -8
  510. package/lib/actions/sdk/save-changes.js +0 -93
  511. package/lib/actions/sdk/save-changes.js.map +0 -1
  512. package/lib/application/portal/recipe/portal-recipe.d.ts +0 -8
  513. package/lib/application/portal/recipe/portal-recipe.js +0 -33
  514. package/lib/application/portal/recipe/portal-recipe.js.map +0 -1
  515. package/lib/application/portal/recipe/recipe-generator.d.ts +0 -21
  516. package/lib/application/portal/recipe/recipe-generator.js +0 -130
  517. package/lib/application/portal/recipe/recipe-generator.js.map +0 -1
  518. package/lib/application/portal/toc/toc-content-parser.d.ts +0 -5
  519. package/lib/application/portal/toc/toc-content-parser.js +0 -44
  520. package/lib/application/portal/toc/toc-content-parser.js.map +0 -1
  521. package/lib/application/portal/toc/toc-structure-generator.d.ts +0 -11
  522. package/lib/application/portal/toc/toc-structure-generator.js +0 -165
  523. package/lib/application/portal/toc/toc-structure-generator.js.map +0 -1
  524. package/lib/commands/portal/copilot.d.ts +0 -13
  525. package/lib/commands/portal/copilot.js +0 -34
  526. package/lib/commands/portal/copilot.js.map +0 -1
  527. package/lib/commands/portal/recipe/new.d.ts +0 -12
  528. package/lib/commands/portal/recipe/new.js +0 -45
  529. package/lib/commands/portal/recipe/new.js.map +0 -1
  530. package/lib/commands/portal/toc/new.d.ts +0 -16
  531. package/lib/commands/portal/toc/new.js +0 -68
  532. package/lib/commands/portal/toc/new.js.map +0 -1
  533. package/lib/commands/sdk/save-changes.d.ts +0 -14
  534. package/lib/commands/sdk/save-changes.js +0 -51
  535. package/lib/commands/sdk/save-changes.js.map +0 -1
  536. package/lib/infrastructure/debounce-service.d.ts +0 -10
  537. package/lib/infrastructure/debounce-service.js +0 -55
  538. package/lib/infrastructure/debounce-service.js.map +0 -1
  539. package/lib/infrastructure/services/portal-service.d.ts +0 -43
  540. package/lib/infrastructure/services/portal-service.js +0 -337
  541. package/lib/infrastructure/services/portal-service.js.map +0 -1
  542. package/lib/prompts/plugin/record-sdk.d.ts +0 -9
  543. package/lib/prompts/plugin/record-sdk.js +0 -40
  544. package/lib/prompts/plugin/record-sdk.js.map +0 -1
  545. package/lib/prompts/portal/copilot.d.ts +0 -18
  546. package/lib/prompts/portal/copilot.js +0 -82
  547. package/lib/prompts/portal/copilot.js.map +0 -1
  548. package/lib/prompts/portal/quickstart.d.ts +0 -42
  549. package/lib/prompts/portal/quickstart.js +0 -243
  550. package/lib/prompts/portal/quickstart.js.map +0 -1
  551. package/lib/prompts/portal/recipe/new-recipe.d.ts +0 -29
  552. package/lib/prompts/portal/recipe/new-recipe.js +0 -165
  553. package/lib/prompts/portal/recipe/new-recipe.js.map +0 -1
  554. package/lib/prompts/portal/toc/new-toc.d.ts +0 -16
  555. package/lib/prompts/portal/toc/new-toc.js +0 -50
  556. package/lib/prompts/portal/toc/new-toc.js.map +0 -1
  557. package/lib/prompts/sdk/merge-source-tree.d.ts +0 -22
  558. package/lib/prompts/sdk/merge-source-tree.js +0 -90
  559. package/lib/prompts/sdk/merge-source-tree.js.map +0 -1
  560. package/lib/prompts/sdk/quickstart.d.ts +0 -38
  561. package/lib/prompts/sdk/quickstart.js +0 -196
  562. package/lib/prompts/sdk/quickstart.js.map +0 -1
  563. package/lib/prompts/sdk/save-changes.d.ts +0 -21
  564. package/lib/prompts/sdk/save-changes.js +0 -84
  565. package/lib/prompts/sdk/save-changes.js.map +0 -1
  566. package/lib/types/build-context.d.ts +0 -26
  567. package/lib/types/build-context.js +0 -111
  568. package/lib/types/build-context.js.map +0 -1
  569. package/lib/types/events/recipe-creation-failed.d.ts +0 -5
  570. package/lib/types/events/recipe-creation-failed.js +0 -8
  571. package/lib/types/events/recipe-creation-failed.js.map +0 -1
  572. package/lib/types/events/sdk-changes-saved.d.ts +0 -8
  573. package/lib/types/events/sdk-changes-saved.js +0 -11
  574. package/lib/types/events/sdk-changes-saved.js.map +0 -1
  575. package/lib/types/events/sdk-changes-tracked.d.ts +0 -8
  576. package/lib/types/events/sdk-changes-tracked.js +0 -11
  577. package/lib/types/events/sdk-changes-tracked.js.map +0 -1
  578. package/lib/types/events/sdk-conflicts-resolved.d.ts +0 -8
  579. package/lib/types/events/sdk-conflicts-resolved.js +0 -11
  580. package/lib/types/events/sdk-conflicts-resolved.js.map +0 -1
  581. package/lib/types/events/toc-creation-failed.d.ts +0 -5
  582. package/lib/types/events/toc-creation-failed.js +0 -8
  583. package/lib/types/events/toc-creation-failed.js.map +0 -1
  584. package/lib/types/merge-source-tree-context.d.ts +0 -28
  585. package/lib/types/merge-source-tree-context.js +0 -63
  586. package/lib/types/merge-source-tree-context.js.map +0 -1
  587. package/lib/types/plugin/language-entry.d.ts +0 -9
  588. package/lib/types/plugin/language-entry.js +0 -64
  589. package/lib/types/plugin/language-entry.js.map +0 -1
  590. package/lib/types/recipe/recipe.d.ts +0 -22
  591. package/lib/types/recipe/recipe.js +0 -6
  592. package/lib/types/recipe/recipe.js.map +0 -1
  593. package/lib/types/recipe-context.d.ts +0 -9
  594. package/lib/types/recipe-context.js +0 -26
  595. package/lib/types/recipe-context.js.map +0 -1
  596. package/lib/types/save-changes-context.d.ts +0 -17
  597. package/lib/types/save-changes-context.js +0 -42
  598. package/lib/types/save-changes-context.js.map +0 -1
  599. package/lib/types/sdl/sdl.d.ts +0 -10
  600. package/lib/types/sdl/sdl.js +0 -18
  601. package/lib/types/sdl/sdl.js.map +0 -1
  602. package/lib/types/toc/toc-components.d.ts +0 -36
  603. package/lib/types/toc/toc-components.js +0 -94
  604. package/lib/types/toc/toc-components.js.map +0 -1
  605. package/lib/types/toc/toc.d.ts +0 -67
  606. package/lib/types/toc/toc.js +0 -2
  607. package/lib/types/toc/toc.js.map +0 -1
  608. package/lib/types/toc-context.d.ts +0 -12
  609. package/lib/types/toc-context.js +0 -26
  610. package/lib/types/toc-context.js.map +0 -1
@@ -6,35 +6,10 @@ import { err, ok } from "neverthrow";
6
6
  import { ServiceError } from "../service-error.js";
7
7
  import { discardStreamBody } from "../../utils/utils.js";
8
8
  export class TransformationService {
9
- constructor() {
10
- this.CONTENT_TYPE = ContentType.EnumMultipartformdata;
11
- this.createOriginQueryParameter = (commandName) => {
12
- return {
13
- origin: `APIMATIC CLI ${commandName}`
14
- };
15
- };
16
- this.handleTransformationErrors = (error) => {
17
- if (!(error instanceof ApiError)) {
18
- return "An unexpected error occurred while validating your API Definition. Please try again later. If the problem persists, please reach out to our team at support@apimatic.io";
19
- }
20
- // `downloadTransformedFile` is a stream endpoint, so its error body is an
21
- // undrained response that would keep the event loop alive. Discarding it
22
- // first is safe: a string body (from `transformViaFile`) has no `destroy`
23
- // and is left intact for `parseApiMessage` below.
24
- discardStreamBody(error.body);
25
- switch (error.statusCode) {
26
- case 400:
27
- return "Your API Definition is invalid. Please use the APIMatic VS Code Extension to fix the errors and try again.";
28
- case 401:
29
- return ServiceError.unauthorizedWithHint(this.parseApiMessage(error.body)).errorMessage;
30
- default:
31
- return `Error ${error.statusCode}: An error occurred during the transformation. Please try again or contact support@apimatic.io for assistance.`;
32
- }
33
- };
34
- }
9
+ CONTENT_TYPE = ContentType.EnumMultipartformdata;
35
10
  async transformViaFile({ file, format, configDir, commandMetadata, authKey }) {
36
11
  const authInfo = await getAuthInfo(configDir.toString());
37
- const authorizationHeader = this.createAuthorizationHeader(authInfo, authKey !== null && authKey !== void 0 ? authKey : null);
12
+ const authorizationHeader = this.createAuthorizationHeader(authInfo, authKey ?? null);
38
13
  const client = apiClientFactory.createApiClient(authorizationHeader, commandMetadata.shell);
39
14
  const transformationController = new TransformationController(client);
40
15
  try {
@@ -53,19 +28,41 @@ export class TransformationService {
53
28
  }
54
29
  }
55
30
  createAuthorizationHeader(authInfo, overrideAuthKey) {
56
- const key = overrideAuthKey || (authInfo === null || authInfo === void 0 ? void 0 : authInfo.authKey);
57
- return `X-Auth-Key ${key !== null && key !== void 0 ? key : ""}`;
31
+ const key = overrideAuthKey || authInfo?.authKey;
32
+ return `X-Auth-Key ${key ?? ""}`;
58
33
  }
34
+ createOriginQueryParameter = (commandName) => {
35
+ return {
36
+ origin: `APIMATIC CLI ${commandName}`
37
+ };
38
+ };
59
39
  parseApiMessage(body) {
60
- var _a, _b;
61
40
  if (typeof body !== "string")
62
41
  return null;
63
42
  try {
64
- return (_b = (_a = JSON.parse(body)) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : null;
43
+ return JSON.parse(body)?.message ?? null;
65
44
  }
66
- catch (_c) {
45
+ catch {
67
46
  return null;
68
47
  }
69
48
  }
49
+ handleTransformationErrors = (error) => {
50
+ if (!(error instanceof ApiError)) {
51
+ return "An unexpected error occurred while validating your API Definition. Please try again later. If the problem persists, please reach out to our team at support@apimatic.io";
52
+ }
53
+ // `downloadTransformedFile` is a stream endpoint, so its error body is an
54
+ // undrained response that would keep the event loop alive. Discarding it
55
+ // first is safe: a string body (from `transformViaFile`) has no `destroy`
56
+ // and is left intact for `parseApiMessage` below.
57
+ discardStreamBody(error.body);
58
+ switch (error.statusCode) {
59
+ case 400:
60
+ return "Your API Definition is invalid. Please use the APIMatic VS Code Extension to fix the errors and try again.";
61
+ case 401:
62
+ return ServiceError.unauthorizedWithHint(this.parseApiMessage(error.body)).errorMessage;
63
+ default:
64
+ return `Error ${error.statusCode}: An error occurred during the transformation. Please try again or contact support@apimatic.io for assistance.`;
65
+ }
66
+ };
70
67
  }
71
68
  //# sourceMappingURL=transformation-service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transformation-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/transformation-service.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAEL,WAAW,EAEX,WAAW,EACX,wBAAwB,EAExB,QAAQ,EAET,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAY,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAG3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,GAAG,EAAE,EAAE,EAAS,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAezD,MAAM,OAAO,qBAAqB;IAAlC;QACmB,iBAAY,GAAG,WAAW,CAAC,qBAAqB,CAAC;QAyCjD,+BAA0B,GAAG,CAAC,WAAmB,EAA0B,EAAE;YAC5F,OAAO;gBACL,MAAM,EAAE,gBAAgB,WAAW,EAAE;aACtC,CAAC;QACJ,CAAC,CAAC;QAWe,+BAA0B,GAAG,CAAC,KAAc,EAAU,EAAE;YACvE,IAAI,CAAC,CAAC,KAAK,YAAY,QAAQ,CAAC,EAAE,CAAC;gBACjC,OAAO,yKAAyK,CAAC;YACnL,CAAC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AC;YAEF,MAAM,EAAE,EAAE,EAAE,oBAAoB,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC;YACvD,MAAM,EAAE,MAAM,EAAE,GAAuB,MAAM,wBAAwB,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;YAElG,OAAO,EAAE,CAAC;gBACR,MAAM,EAAE,MAA+B;gBACvC,oBAAoB;aACrB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,GAAG,CAAC,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAEO,yBAAyB,CAAC,QAAyB,EAAE,eAA8B;QACzF,MAAM,GAAG,GAAG,eAAe,KAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAA,CAAC;QACjD,OAAO,cAAc,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,EAAE,CAAC;IACnC,CAAC;IAQO,eAAe,CAAC,IAAa;;QACnC,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1C,IAAI,CAAC;YACH,OAAO,MAAA,MAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAA0B,0CAAE,OAAO,mCAAI,IAAI,CAAC;QACrE,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CAsBF"}
1
+ {"version":3,"file":"transformation-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/transformation-service.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAEL,WAAW,EAEX,WAAW,EACX,wBAAwB,EAExB,QAAQ,EAET,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAY,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAG3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,GAAG,EAA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IACH,CAAC,CAAC;CACH"}
@@ -1,64 +1,23 @@
1
- import { ValidateApiResult } from "@apimatic/sdk";
2
- import { DirectoryPath } from "../../types/file/directoryPath.js";
3
- import { Result } from "neverthrow";
4
- import { FilePath } from "../../types/file/filePath.js";
5
- import { CommandMetadata } from "../../types/common/command-metadata.js";
6
- import { ServiceError } from "../service-error.js";
7
- import { BuildConfig } from "../../types/build/build.js";
8
- export declare enum RemovableFeature {
9
- Merging = "Merging",
10
- Pagination = "Pagination",
11
- Webhooks = "Webhooks",
12
- Callbacks = "Callbacks",
13
- MultipleAuthSchemes = "MultipleAuthSchemes",
14
- Oauth2 = "OAuth2"
15
- }
16
- export interface FeaturesToRemove {
17
- features?: RemovableFeature[];
18
- endpointsToKeep?: number;
19
- }
1
+ import { ValidateApiResult } from '@apimatic/sdk';
2
+ import { DirectoryPath } from '../../types/file/directoryPath.js';
3
+ import { Result } from 'neverthrow';
4
+ import { FilePath } from '../../types/file/filePath.js';
5
+ import { CommandMetadata } from '../../types/common/command-metadata.js';
20
6
  export interface ValidateViaFileParams {
21
7
  file: FilePath;
22
8
  commandMetadata: CommandMetadata;
23
9
  authKey?: string | null;
24
10
  }
25
- export interface UnallowedFeaturesResponse {
26
- Features: RemovableFeature[];
27
- EndpointLimit: number;
28
- EndpointCount: number;
29
- IsSplitSpec: boolean;
30
- }
31
- export interface ValidateApiResponse {
32
- result: ValidateApiResult;
33
- unallowedFeatures: UnallowedFeaturesResponse | null;
34
- }
35
- export interface BuildFilePruneReport {
36
- removedLanguages: string[];
37
- removedApiCopilot: boolean;
38
- removedAiIntegration: boolean;
39
- }
40
- export interface PruneBuildFileResponse {
41
- buildFile: BuildConfig;
42
- report: BuildFilePruneReport;
43
- }
11
+ /** `rejected`: the service refused the document itself (400), so the spec is invalid rather than unchecked. */
12
+ export type ValidationFailure = {
13
+ kind: 'rejected' | 'unavailable';
14
+ message: string;
15
+ };
44
16
  export declare class ValidationService {
45
17
  private readonly configDir;
46
- private readonly apiBaseUrl;
47
- private readonly zipService;
48
- private readonly fileService;
49
18
  constructor(configDir: DirectoryPath);
50
- validateViaFile({ file, commandMetadata, authKey }: ValidateViaFileParams): Promise<Result<ValidateApiResponse, string>>;
51
- stripUnallowedFeatures(specPath: FilePath, featuresToRemove: FeaturesToRemove, authKey?: string | null): Promise<Result<NodeJS.ReadableStream, ServiceError>>;
52
- /**
53
- * Prunes a build file down to what the user's subscription allows (SDK languages +
54
- * AI features) via the platform, returning the pruned build file and a report of
55
- * what was removed. The platform is the entitlement authority, so the build we
56
- * submit for generation is never rejected for a build-file feature the plan lacks.
57
- */
58
- pruneBuildFile(buildConfigFilePath: FilePath, authKey?: string | null): Promise<Result<PruneBuildFileResponse, ServiceError>>;
59
- /** Decodes a streamed error body into a ServiceError with a prune-specific fallback message. */
60
- private parsePruneErrorResponse;
19
+ validateViaFile({ file, commandMetadata, authKey }: ValidateViaFileParams): Promise<Result<ValidateApiResult, ValidationFailure>>;
61
20
  private createAuthorizationHeader;
62
21
  private handleValidationErrors;
63
- private parseErrorResponse;
22
+ private unavailableMessage;
64
23
  }
@@ -1,232 +1,57 @@
1
- import { __asyncValues } from "tslib";
2
- import { createReadStream } from "node:fs";
3
- import fsExtra from "fs-extra";
4
- import { ApiValidationV2ExternalApisController, ContentType, FileWrapper, ApiError } from "@apimatic/sdk";
5
- import { getAuthInfo } from "../../client-utils/auth-manager.js";
6
- import { apiClientFactory } from "./api-client-factory.js";
7
- import { err, ok } from "neverthrow";
8
- import { FilePath } from "../../types/file/filePath.js";
9
- import { FileName } from "../../types/file/fileName.js";
10
- import FormData from "form-data";
11
- import { ZipService } from "../zip-service.js";
12
- import { FileService } from "../file-service.js";
13
- import { withDirPath } from "../tmp-extensions.js";
14
- import { handleServiceError, ServiceError } from "../service-error.js";
15
- import axios from "axios";
16
- import { envInfo } from "../env-info.js";
17
- import { Buffer } from "node:buffer";
18
- import { BuildConfig } from "../../types/build/build.js";
19
- export var RemovableFeature;
20
- (function (RemovableFeature) {
21
- RemovableFeature["Merging"] = "Merging";
22
- RemovableFeature["Pagination"] = "Pagination";
23
- RemovableFeature["Webhooks"] = "Webhooks";
24
- RemovableFeature["Callbacks"] = "Callbacks";
25
- RemovableFeature["MultipleAuthSchemes"] = "MultipleAuthSchemes";
26
- RemovableFeature["Oauth2"] = "OAuth2";
27
- })(RemovableFeature || (RemovableFeature = {}));
1
+ import fsExtra from 'fs-extra';
2
+ import { ApiValidationV2ExternalApisController, ContentType, FileWrapper, ApiError } from '@apimatic/sdk';
3
+ import { getAuthInfo } from '../../client-utils/auth-manager.js';
4
+ import { apiClientFactory } from './api-client-factory.js';
5
+ import { err, ok } from 'neverthrow';
6
+ import { ServiceError } from '../service-error.js';
28
7
  export class ValidationService {
8
+ configDir;
29
9
  constructor(configDir) {
30
10
  this.configDir = configDir;
31
- this.apiBaseUrl = "https://api.apimatic.io";
32
- this.zipService = new ZipService();
33
- this.fileService = new FileService();
34
11
  }
35
12
  async validateViaFile({ file, commandMetadata, authKey }) {
36
- var _a;
37
13
  const authInfo = await getAuthInfo(this.configDir.toString());
38
- const authorizationHeader = this.createAuthorizationHeader(authInfo, authKey !== null && authKey !== void 0 ? authKey : null);
14
+ const authorizationHeader = this.createAuthorizationHeader(authInfo, authKey ?? null);
39
15
  const client = apiClientFactory.createApiClient(authorizationHeader, commandMetadata.shell);
40
16
  const controller = new ApiValidationV2ExternalApisController(client);
17
+ let fileStream;
41
18
  try {
42
- const fileDescriptor = new FileWrapper(fsExtra.createReadStream(file.toString()));
43
- const validation = await controller.validateApiViaFileV2(ContentType.EnumMultipartformdata, fileDescriptor);
44
- const headerValue = (_a = validation.headers) === null || _a === void 0 ? void 0 : _a["x-unallowed-features"];
45
- let unallowedFeatures = null;
46
- if (headerValue) {
47
- const decodedJson = globalThis.Buffer.from(headerValue, "base64").toString("utf8");
48
- const parsed = JSON.parse(decodedJson);
49
- unallowedFeatures = parsed;
50
- }
51
- return ok({
52
- result: validation.result,
53
- unallowedFeatures
54
- });
19
+ fileStream = fsExtra.createReadStream(file.toString());
20
+ const validation = await controller.validateApiViaFileV2(ContentType.EnumMultipartformdata, new FileWrapper(fileStream));
21
+ return ok(validation.result);
55
22
  }
56
23
  catch (error) {
57
24
  return err(await this.handleValidationErrors(error));
58
25
  }
59
- }
60
- async stripUnallowedFeatures(specPath, featuresToRemove, authKey) {
61
- var _a;
62
- const authInfo = await getAuthInfo(this.configDir.toString());
63
- const authorizationHeader = this.createAuthorizationHeader(authInfo, authKey !== null && authKey !== void 0 ? authKey : null);
64
- const formData = new FormData();
65
- formData.append("file", createReadStream(specPath.toString()));
66
- formData.append("featuresToRemove", JSON.stringify(featuresToRemove));
67
- const baseURL = (_a = envInfo.getBaseUrl()) !== null && _a !== void 0 ? _a : this.apiBaseUrl;
68
- try {
69
- const response = await axios({
70
- method: "POST",
71
- url: `${baseURL}/api-features/strip`,
72
- data: formData,
73
- headers: Object.assign(Object.assign({}, formData.getHeaders()), { Authorization: authorizationHeader }),
74
- responseType: "stream",
75
- validateStatus: () => true
76
- });
77
- if (response.status >= 400) {
78
- return err(await this.parseErrorResponse(response));
79
- }
80
- return ok(response.data);
81
- }
82
- catch (error) {
83
- return err(handleServiceError(error));
84
- }
85
- }
86
- /**
87
- * Prunes a build file down to what the user's subscription allows (SDK languages +
88
- * AI features) via the platform, returning the pruned build file and a report of
89
- * what was removed. The platform is the entitlement authority, so the build we
90
- * submit for generation is never rejected for a build-file feature the plan lacks.
91
- */
92
- async pruneBuildFile(buildConfigFilePath, authKey) {
93
- var _a;
94
- const authInfo = await getAuthInfo(this.configDir.toString());
95
- const authorizationHeader = this.createAuthorizationHeader(authInfo, authKey !== null && authKey !== void 0 ? authKey : null);
96
- const formData = new FormData();
97
- formData.append("file", createReadStream(buildConfigFilePath.toString()), {
98
- filename: "APIMATIC-BUILD.json",
99
- contentType: "application/json"
100
- });
101
- const baseURL = (_a = envInfo.getBaseUrl()) !== null && _a !== void 0 ? _a : this.apiBaseUrl;
102
- try {
103
- const response = await axios({
104
- method: "POST",
105
- url: `${baseURL}/build-features/prune`,
106
- data: formData,
107
- headers: Object.assign(Object.assign({}, formData.getHeaders()), { Authorization: authorizationHeader }),
108
- // The endpoint returns a zip (pruned APIMATIC-BUILD.json + report.json),
109
- // streamed so it can be written straight to disk and unarchived.
110
- responseType: "stream",
111
- validateStatus: () => true
112
- });
113
- if (response.status >= 400) {
114
- return err(await this.parsePruneErrorResponse(response));
115
- }
116
- // Persist the zip to a temp dir and extract it via ZipService, then read the
117
- // two entries back off disk — no in-memory zip handling.
118
- return await withDirPath(async (tempDir) => {
119
- const zipPath = new FilePath(tempDir, new FileName("prune-response.zip"));
120
- await this.fileService.writeFile(zipPath, response.data);
121
- const extractDir = tempDir.join("prune");
122
- await this.zipService.unArchive(zipPath, extractDir);
123
- const prunedBuildConfigFile = new FilePath(extractDir, new FileName("APIMATIC-BUILD.json"));
124
- const reportFile = new FilePath(extractDir, new FileName("report.json"));
125
- if (!(await this.fileService.fileExists(prunedBuildConfigFile)) || !(await this.fileService.fileExists(reportFile))) {
126
- return err(ServiceError.ServerError);
127
- }
128
- const buildConfigFile = BuildConfig.parse(await this.fileService.getContents(prunedBuildConfigFile));
129
- const report = JSON.parse(await this.fileService.getContents(reportFile));
130
- return ok({ buildFile: buildConfigFile, report });
131
- });
132
- }
133
- catch (error) {
134
- return err(handleServiceError(error));
135
- }
136
- }
137
- /** Decodes a streamed error body into a ServiceError with a prune-specific fallback message. */
138
- async parsePruneErrorResponse(response) {
139
- var _a, e_1, _b, _c;
140
- var _d, _e, _f, _g, _h;
141
- const chunks = [];
142
- try {
143
- for (var _j = true, _k = __asyncValues(response.data), _l; _l = await _k.next(), _a = _l.done, !_a; _j = true) {
144
- _c = _l.value;
145
- _j = false;
146
- const chunk = _c;
147
- chunks.push(Buffer.from(chunk));
148
- }
149
- }
150
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
151
26
  finally {
152
- try {
153
- if (!_j && !_a && (_b = _k.return)) await _b.call(_k);
154
- }
155
- finally { if (e_1) throw e_1.error; }
156
- }
157
- const errorBody = Buffer.concat(chunks).toString("utf-8");
158
- let message = `Error ${response.status}: Failed to prune the build file for your subscription.`;
159
- try {
160
- const body = JSON.parse(errorBody);
161
- message = (_h = (_g = (_f = (_e = (_d = body === null || body === void 0 ? void 0 : body.errors) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e[0]) !== null && _f !== void 0 ? _f : body === null || body === void 0 ? void 0 : body.message) !== null && _g !== void 0 ? _g : body === null || body === void 0 ? void 0 : body.title) !== null && _h !== void 0 ? _h : message;
27
+ fileStream?.close();
162
28
  }
163
- catch (_m) {
164
- // Non-JSON / undecodable body — keep the default message.
165
- }
166
- return ServiceError.badRequest(message, {});
167
29
  }
168
30
  createAuthorizationHeader(authInfo, overrideAuthKey) {
169
- const key = overrideAuthKey || (authInfo === null || authInfo === void 0 ? void 0 : authInfo.authKey);
170
- return `X-Auth-Key ${key !== null && key !== void 0 ? key : ""}`;
31
+ const key = overrideAuthKey || authInfo?.authKey;
32
+ return `X-Auth-Key ${key ?? ''}`;
171
33
  }
172
34
  async handleValidationErrors(error) {
35
+ if (error instanceof ApiError && error.statusCode === 400) {
36
+ return { kind: 'rejected', message: 'Your API Definition is invalid. Please fix the issues and try again.' };
37
+ }
38
+ return { kind: 'unavailable', message: this.unavailableMessage(error) };
39
+ }
40
+ unavailableMessage(error) {
173
41
  if (error instanceof ApiError) {
174
42
  const apiError = error;
175
43
  switch (apiError.statusCode) {
176
- case 400:
177
- return "Your API Definition is invalid. Please fix the issues and try again.";
178
44
  case 401:
179
45
  return ServiceError.unauthorizedWithHint(null).errorMessage;
180
46
  case 403:
181
- return "You do not have permission to perform this action.";
47
+ return 'You do not have permission to perform this action.';
182
48
  case 500:
183
- return "An unexpected error occurred validating the API specification, please try again later. If the problem persists, please reach out to our team at support@apimatic.io";
49
+ return 'An unexpected error occurred validating the API specification, please try again later. If the problem persists, please reach out to our team at support@apimatic.io';
184
50
  default:
185
51
  return `Error ${apiError.statusCode}: An error occurred during validation.`;
186
52
  }
187
53
  }
188
- return "Unexpected error occurred while validating API specification.";
189
- }
190
- async parseErrorResponse(response) {
191
- var _a, e_2, _b, _c;
192
- var _d, _e;
193
- const chunks = [];
194
- try {
195
- for (var _f = true, _g = __asyncValues(response.data), _h; _h = await _g.next(), _a = _h.done, !_a; _f = true) {
196
- _c = _h.value;
197
- _f = false;
198
- const chunk = _c;
199
- chunks.push(Buffer.from(chunk));
200
- }
201
- }
202
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
203
- finally {
204
- try {
205
- if (!_f && !_a && (_b = _g.return)) await _b.call(_g);
206
- }
207
- finally { if (e_2) throw e_2.error; }
208
- }
209
- const errorBody = Buffer.concat(chunks).toString('utf-8');
210
- let errorMessage = `Error ${response.status}: Failed to strip unallowed features.`;
211
- try {
212
- const errorData = JSON.parse(errorBody);
213
- if ((_e = (_d = errorData.errors) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e[0]) {
214
- errorMessage = errorData.errors.summary[0];
215
- }
216
- else if (errorData.message) {
217
- errorMessage = errorData.message;
218
- }
219
- else if (errorData.title) {
220
- errorMessage = errorData.title;
221
- }
222
- }
223
- catch (_j) {
224
- errorMessage = errorBody || errorMessage;
225
- }
226
- return {
227
- message: errorMessage,
228
- statusCode: response.status
229
- };
54
+ return 'Unexpected error occurred while validating API specification.';
230
55
  }
231
56
  }
232
57
  //# sourceMappingURL=validation-service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/validation-service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAEL,qCAAqC,EAErC,WAAW,EACX,WAAW,EACX,QAAQ,EACT,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAY,WAAW,EAAE,MAAM,oCAAoC,CAAC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SAAS,CAAC,OAAO,CAAC;YACnC,CAAC;iBAAM,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;gBAC3B,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC;YACjC,CAAC;QACH,CAAC;QAAC,WAAM,CAAC;YACP,YAAY,GAAG,SAAS,IAAI,YAAY,CAAC;QAC3C,CAAC;QAED,OAAO;YACL,OAAO,EAAE,YAAY;YACrB,UAAU,EAAE,QAAQ,CAAC,MAAM;SACD,CAAC;IAC/B,CAAC;CACF"}
1
+ {"version":3,"file":"validation-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/validation-service.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAEL,qCAAqC,EAErC,WAAW,EACX,WAAW,EACX,QAAQ,EACT,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAY,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAWnD,MAAM,OAAO,iBAAiB;IACC,SAAS;IAAtC,YAA6B,SAAwB;yBAAxB,SAAS;IAAkB,CAAC;IAEzD,KAAK,CAAC,eAAe,CAAC,EACpB,IAAI,EACJ,eAAe,EACf,OAAO,EACe;QACtB,MAAM,QAAQ,GAAoB,MAAM,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/E,MAAM,mBAAmB,GAAG,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC;QACtF,MAAM,MAAM,GAAG,gBAAgB,CAAC,eAAe,CAAC,mBAAmB,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;QAC5F,MAAM,UAAU,GAAG,IAAI,qCAAqC,CAAC,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I,CAAC,CAAC,YAAY,CAAC;gBAC9D,KAAK,GAAG;oBACN,OAAO,oDAAoD,CAAC;gBAC9D,KAAK,GAAG;oBACN,OAAO,qKAAqK,CAAC;gBAC/K;oBACE,OAAO,SAAS,QAAQ,CAAC,UAAU,wCAAwC,CAAC;YAChF,CAAC;QACH,CAAC;QAED,OAAO,+DAA+D,CAAC;IACzE,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export type SleepResult = 'ok' | 'failed' | 'cancelled';
2
+ export declare function sleep(ms: number, signal?: AbortSignal): Promise<SleepResult>;
@@ -0,0 +1,10 @@
1
+ import { setTimeout } from 'node:timers/promises';
2
+ export async function sleep(ms, signal) {
3
+ try {
4
+ return await setTimeout(ms, 'ok', { signal });
5
+ }
6
+ catch {
7
+ return signal?.aborted ? 'cancelled' : 'failed';
8
+ }
9
+ }
10
+ //# sourceMappingURL=timer-extensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timer-extensions.js","sourceRoot":"","sources":["../../src/infrastructure/timer-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIlD,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,EAAU,EAAE,MAAoB;IAC1D,IAAI,CAAC;QACH,OAAO,MAAM,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;IAClD,CAAC;AACH,CAAC"}
@@ -1,2 +1,32 @@
1
- import { DirectoryPath } from "../types/file/directoryPath.js";
1
+ import { DirectoryPath } from '../types/file/directoryPath.js';
2
+ /**
3
+ * Windows gives a profile name longer than eight characters an 8.3 alias, and `os.tmpdir()`
4
+ * answers with it. The dev server's allow-list holds the real name, so the two spellings of one
5
+ * directory never match and every page under it is refused. Whatever compares paths has to see
6
+ * one spelling, and the real one is it.
7
+ */
8
+ export declare function canonical(directory: string): string;
2
9
  export declare function withDirPath<T>(fn: (results: DirectoryPath) => Promise<T>): Promise<T>;
10
+ /** Name of the folder created beside a project when the system temp directory is unusable. */
11
+ export declare const PORTAL_PROJECT_DIRECTORY_NAME = ".apimatic-build";
12
+ /**
13
+ * Where a portal project may live for a source directory. The system temp directory,
14
+ * unless it sits on a different Windows drive from the source: a page imports an image from
15
+ * the static directory by a path relative to the page, and `path.relative` cannot express one
16
+ * across drives. GitHub's Windows runners (workspace on D:, temp on C:) are the common case.
17
+ */
18
+ export declare function portalProjectDirectoryBase(sourceDirectory: string, systemTemp?: string, platform?: NodeJS.Platform): string;
19
+ /** Creates the base directory when it is the project-side fallback, hidden from git. */
20
+ export declare function ensurePortalProjectDirectoryBase(sourceDirectory: DirectoryPath, systemTemp?: string): Promise<string>;
21
+ /**
22
+ * Like `withDirPath`, for a portal project that must read files under `sourceDirectory`.
23
+ * The project-side fallback folder is removed again once it is empty.
24
+ */
25
+ export declare function withPortalProjectDirectory<T>(sourceDirectory: DirectoryPath, fn: (directory: DirectoryPath) => Promise<T>, systemTemp?: string): Promise<T>;
26
+ /**
27
+ * The project-side fallback folder is shared by every invocation for that project, so it is
28
+ * only taken down once nothing else is in it -- otherwise a `portal generate` finishing
29
+ * beside a running `portal serve` puts that live portal project into the user's `git status`.
30
+ * Failures are swallowed: a portal that has been written is not a crash.
31
+ */
32
+ export declare function removePortalProjectDirectoryBase(base: string, systemTemp?: string): Promise<void>;
@@ -1,6 +1,89 @@
1
- import { DirectoryPath } from "../types/file/directoryPath.js";
2
- import { withDir } from "tmp-promise";
1
+ import { realpathSync } from 'node:fs';
2
+ import fs from 'node:fs/promises';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { DirectoryPath } from '../types/file/directoryPath.js';
6
+ import { withDir } from 'tmp-promise';
7
+ /**
8
+ * Windows gives a profile name longer than eight characters an 8.3 alias, and `os.tmpdir()`
9
+ * answers with it. The dev server's allow-list holds the real name, so the two spellings of one
10
+ * directory never match and every page under it is refused. Whatever compares paths has to see
11
+ * one spelling, and the real one is it.
12
+ */
13
+ export function canonical(directory) {
14
+ try {
15
+ return realpathSync.native(directory);
16
+ }
17
+ catch {
18
+ return directory;
19
+ }
20
+ }
3
21
  export function withDirPath(fn) {
4
- return withDir(results => fn(new DirectoryPath(results.path)), { unsafeCleanup: true });
22
+ return withDir((results) => fn(new DirectoryPath(canonical(results.path))), { unsafeCleanup: true });
23
+ }
24
+ /** Name of the folder created beside a project when the system temp directory is unusable. */
25
+ export const PORTAL_PROJECT_DIRECTORY_NAME = '.apimatic-build';
26
+ /**
27
+ * Where a portal project may live for a source directory. The system temp directory,
28
+ * unless it sits on a different Windows drive from the source: a page imports an image from
29
+ * the static directory by a path relative to the page, and `path.relative` cannot express one
30
+ * across drives. GitHub's Windows runners (workspace on D:, temp on C:) are the common case.
31
+ */
32
+ export function portalProjectDirectoryBase(sourceDirectory, systemTemp = os.tmpdir(), platform = process.platform) {
33
+ if (platform !== 'win32')
34
+ return systemTemp;
35
+ const source = path.win32.resolve(sourceDirectory);
36
+ if (path.win32.parse(source).root.toLowerCase() === path.win32.parse(path.win32.resolve(systemTemp)).root.toLowerCase()) {
37
+ return systemTemp;
38
+ }
39
+ return path.win32.join(path.win32.dirname(source), PORTAL_PROJECT_DIRECTORY_NAME);
40
+ }
41
+ /** Creates the base directory when it is the project-side fallback, hidden from git. */
42
+ export async function ensurePortalProjectDirectoryBase(sourceDirectory, systemTemp = os.tmpdir()) {
43
+ const base = portalProjectDirectoryBase(sourceDirectory.toString(), systemTemp);
44
+ if (base !== systemTemp) {
45
+ await fs.mkdir(base, { recursive: true });
46
+ // A gitignore that ignores everything keeps the folder out of the user's status while it exists.
47
+ await fs.writeFile(path.join(base, '.gitignore'), '*\n');
48
+ }
49
+ return base;
50
+ }
51
+ /**
52
+ * Like `withDirPath`, for a portal project that must read files under `sourceDirectory`.
53
+ * The project-side fallback folder is removed again once it is empty.
54
+ */
55
+ export async function withPortalProjectDirectory(sourceDirectory, fn, systemTemp = os.tmpdir()) {
56
+ const base = await ensurePortalProjectDirectoryBase(sourceDirectory, systemTemp);
57
+ try {
58
+ return await withDir((results) => fn(new DirectoryPath(canonical(results.path))), {
59
+ tmpdir: base,
60
+ unsafeCleanup: true
61
+ });
62
+ }
63
+ finally {
64
+ await removePortalProjectDirectoryBase(base, systemTemp);
65
+ }
66
+ }
67
+ /**
68
+ * The project-side fallback folder is shared by every invocation for that project, so it is
69
+ * only taken down once nothing else is in it -- otherwise a `portal generate` finishing
70
+ * beside a running `portal serve` puts that live portal project into the user's `git status`.
71
+ * Failures are swallowed: a portal that has been written is not a crash.
72
+ */
73
+ export async function removePortalProjectDirectoryBase(base, systemTemp = os.tmpdir()) {
74
+ if (base === systemTemp) {
75
+ return;
76
+ }
77
+ try {
78
+ const remaining = await fs.readdir(base);
79
+ if (remaining.some((entry) => entry !== '.gitignore')) {
80
+ return;
81
+ }
82
+ await fs.rm(path.join(base, '.gitignore'), { force: true });
83
+ await fs.rmdir(base);
84
+ }
85
+ catch {
86
+ // Another run is using it, or it is already gone.
87
+ }
5
88
  }
6
89
  //# sourceMappingURL=tmp-extensions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tmp-extensions.js","sourceRoot":"","sources":["../../src/infrastructure/tmp-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,UAAU,WAAW,CACzB,EAA0C;IAE1C,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1F,CAAC"}
1
+ {"version":3,"file":"tmp-extensions.js","sourceRoot":"","sources":["../../src/infrastructure/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D,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CAAC,IAAY,EAAE,UAAU,GAAW,EAAE,CAAC,MAAM,EAAE;IACnG,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACxB,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,YAAY,CAAC,EAAE,CAAC;YACtD,OAAO;QACT,CAAC;QACD,MAAM,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,kDAAkD;IACpD,CAAC;AACH,CAAC"}
@@ -32,8 +32,8 @@ export class ZipService {
32
32
  });
33
33
  }
34
34
  async unArchive(sourceFile, destinationDirectory) {
35
- const MAX_FILES = 100000;
36
- const MAX_SIZE = 1000000000; // 1 GB
35
+ const MAX_FILES = 100_000;
36
+ const MAX_SIZE = 1_000_000_000; // 1 GB
37
37
  // adm-zip extracts synchronously, with no per-entry read streams. This
38
38
  // avoids a hang on Node 22+ where yauzl/fd-slicer (used by extract-zip)
39
39
  // builds STORED-entry read streams that deliver every byte but never emit