@redocly/cli 1.34.4 → 2.0.0-next.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 (321) hide show
  1. package/README.md +34 -3
  2. package/bin/cli.js +1 -1
  3. package/lib/auth/device-flow.d.ts +1 -0
  4. package/lib/auth/device-flow.d.ts.map +1 -0
  5. package/lib/auth/device-flow.js +15 -17
  6. package/lib/auth/device-flow.js.map +1 -0
  7. package/lib/auth/oauth-client.d.ts +1 -0
  8. package/lib/auth/oauth-client.d.ts.map +1 -0
  9. package/lib/auth/oauth-client.js +21 -23
  10. package/lib/auth/oauth-client.js.map +1 -0
  11. package/lib/commands/auth.d.ts +3 -5
  12. package/lib/commands/auth.d.ts.map +1 -0
  13. package/lib/commands/auth.js +19 -44
  14. package/lib/commands/auth.js.map +1 -0
  15. package/lib/commands/build-docs/index.d.ts +4 -3
  16. package/lib/commands/build-docs/index.d.ts.map +1 -0
  17. package/lib/commands/build-docs/index.js +23 -24
  18. package/lib/commands/build-docs/index.js.map +1 -0
  19. package/lib/commands/build-docs/types.d.ts +2 -1
  20. package/lib/commands/build-docs/types.d.ts.map +1 -0
  21. package/lib/commands/build-docs/types.js +2 -2
  22. package/lib/commands/build-docs/types.js.map +1 -0
  23. package/lib/commands/build-docs/utils.d.ts +3 -2
  24. package/lib/commands/build-docs/utils.d.ts.map +1 -0
  25. package/lib/commands/build-docs/utils.js +35 -37
  26. package/lib/commands/build-docs/utils.js.map +1 -0
  27. package/lib/commands/bundle.d.ts +6 -3
  28. package/lib/commands/bundle.d.ts.map +1 -0
  29. package/lib/commands/bundle.js +34 -38
  30. package/lib/commands/bundle.js.map +1 -0
  31. package/lib/commands/eject.d.ts +3 -2
  32. package/lib/commands/eject.d.ts.map +1 -0
  33. package/lib/commands/eject.js +11 -13
  34. package/lib/commands/eject.js.map +1 -0
  35. package/lib/commands/join.d.ts +4 -3
  36. package/lib/commands/join.d.ts.map +1 -0
  37. package/lib/commands/join.js +79 -81
  38. package/lib/commands/join.js.map +1 -0
  39. package/lib/commands/lint.d.ts +8 -6
  40. package/lib/commands/lint.d.ts.map +1 -0
  41. package/lib/commands/lint.js +53 -62
  42. package/lib/commands/lint.js.map +1 -0
  43. package/lib/commands/preview-project/constants.d.ts +2 -1
  44. package/lib/commands/preview-project/constants.d.ts.map +1 -0
  45. package/lib/commands/preview-project/constants.js +4 -6
  46. package/lib/commands/preview-project/constants.js.map +1 -0
  47. package/lib/commands/preview-project/index.d.ts +3 -2
  48. package/lib/commands/preview-project/index.d.ts.map +1 -0
  49. package/lib/commands/preview-project/index.js +21 -23
  50. package/lib/commands/preview-project/index.js.map +1 -0
  51. package/lib/commands/preview-project/types.d.ts +3 -2
  52. package/lib/commands/preview-project/types.d.ts.map +1 -0
  53. package/lib/commands/preview-project/types.js +2 -2
  54. package/lib/commands/preview-project/types.js.map +1 -0
  55. package/lib/commands/split/index.d.ts +4 -3
  56. package/lib/commands/split/index.d.ts.map +1 -0
  57. package/lib/commands/split/index.js +53 -57
  58. package/lib/commands/split/index.js.map +1 -0
  59. package/lib/commands/split/types.d.ts +2 -2
  60. package/lib/commands/split/types.d.ts.map +1 -0
  61. package/lib/commands/split/types.js +11 -13
  62. package/lib/commands/split/types.js.map +1 -0
  63. package/lib/commands/stats.d.ts +3 -2
  64. package/lib/commands/stats.d.ts.map +1 -0
  65. package/lib/commands/stats.js +21 -24
  66. package/lib/commands/stats.js.map +1 -0
  67. package/lib/commands/translations.d.ts +3 -2
  68. package/lib/commands/translations.d.ts.map +1 -0
  69. package/lib/commands/translations.js +11 -13
  70. package/lib/commands/translations.js.map +1 -0
  71. package/lib/index.d.ts +2 -1
  72. package/lib/index.d.ts.map +1 -0
  73. package/lib/index.js +109 -239
  74. package/lib/index.js.map +1 -0
  75. package/lib/otel.d.ts +2 -1
  76. package/lib/otel.d.ts.map +1 -0
  77. package/lib/otel.js +22 -23
  78. package/lib/otel.js.map +1 -0
  79. package/lib/reunite/api/api-client.d.ts +4 -3
  80. package/lib/reunite/api/api-client.d.ts.map +1 -0
  81. package/lib/reunite/api/api-client.js +14 -20
  82. package/lib/reunite/api/api-client.js.map +1 -0
  83. package/lib/reunite/api/api-keys.d.ts +2 -1
  84. package/lib/reunite/api/api-keys.d.ts.map +1 -0
  85. package/lib/reunite/api/api-keys.js +4 -20
  86. package/lib/reunite/api/api-keys.js.map +1 -0
  87. package/lib/reunite/api/domains.d.ts +5 -2
  88. package/lib/reunite/api/domains.d.ts.map +1 -0
  89. package/lib/reunite/api/domains.js +6 -15
  90. package/lib/reunite/api/domains.js.map +1 -0
  91. package/lib/reunite/api/index.d.ts +4 -3
  92. package/lib/reunite/api/index.d.ts.map +1 -0
  93. package/lib/reunite/api/index.js +4 -19
  94. package/lib/reunite/api/index.js.map +1 -0
  95. package/lib/reunite/api/types.d.ts +1 -0
  96. package/lib/reunite/api/types.d.ts.map +1 -0
  97. package/lib/reunite/api/types.js +2 -2
  98. package/lib/reunite/api/types.js.map +1 -0
  99. package/lib/reunite/commands/push-status.d.ts +6 -5
  100. package/lib/reunite/commands/push-status.d.ts.map +1 -0
  101. package/lib/reunite/commands/push-status.js +31 -37
  102. package/lib/reunite/commands/push-status.js.map +1 -0
  103. package/lib/reunite/commands/push.d.ts +6 -6
  104. package/lib/reunite/commands/push.d.ts.map +1 -0
  105. package/lib/reunite/commands/push.js +31 -40
  106. package/lib/reunite/commands/push.js.map +1 -0
  107. package/lib/reunite/commands/utils.d.ts +4 -3
  108. package/lib/reunite/commands/utils.d.ts.map +1 -0
  109. package/lib/reunite/commands/utils.js +9 -12
  110. package/lib/reunite/commands/utils.js.map +1 -0
  111. package/lib/reunite/utils.d.ts +1 -0
  112. package/lib/reunite/utils.d.ts.map +1 -0
  113. package/lib/reunite/utils.js +2 -5
  114. package/lib/reunite/utils.js.map +1 -0
  115. package/lib/types.d.ts +15 -27
  116. package/lib/types.d.ts.map +1 -0
  117. package/lib/types.js +2 -5
  118. package/lib/types.js.map +1 -0
  119. package/lib/utils/assert-node-version.d.ts +1 -0
  120. package/lib/utils/assert-node-version.d.ts.map +1 -0
  121. package/lib/utils/assert-node-version.js +8 -10
  122. package/lib/utils/assert-node-version.js.map +1 -0
  123. package/lib/utils/error.d.ts +4 -0
  124. package/lib/utils/error.d.ts.map +1 -0
  125. package/lib/utils/error.js +8 -0
  126. package/lib/utils/error.js.map +1 -0
  127. package/lib/utils/fetch-with-timeout.d.ts +1 -0
  128. package/lib/utils/fetch-with-timeout.d.ts.map +1 -0
  129. package/lib/utils/fetch-with-timeout.js +6 -8
  130. package/lib/utils/fetch-with-timeout.js.map +1 -0
  131. package/lib/utils/{getCommandNameFromArgs.d.ts → get-command-name-from-args.d.ts} +1 -0
  132. package/lib/utils/get-command-name-from-args.d.ts.map +1 -0
  133. package/lib/utils/get-command-name-from-args.js +4 -0
  134. package/lib/utils/get-command-name-from-args.js.map +1 -0
  135. package/lib/utils/js-utils.d.ts +1 -0
  136. package/lib/utils/js-utils.d.ts.map +1 -0
  137. package/lib/utils/js-utils.js +8 -12
  138. package/lib/utils/js-utils.js.map +1 -0
  139. package/lib/utils/miscellaneous.d.ts +9 -48
  140. package/lib/utils/miscellaneous.d.ts.map +1 -0
  141. package/lib/utils/miscellaneous.js +131 -269
  142. package/lib/utils/miscellaneous.js.map +1 -0
  143. package/lib/utils/package.d.ts +2 -0
  144. package/lib/utils/package.d.ts.map +1 -0
  145. package/lib/utils/package.js +4 -0
  146. package/lib/utils/package.js.map +1 -0
  147. package/lib/utils/platform.d.ts +1 -0
  148. package/lib/utils/platform.d.ts.map +1 -0
  149. package/lib/utils/platform.js +5 -9
  150. package/lib/utils/platform.js.map +1 -0
  151. package/lib/utils/proxy-agent.d.ts +3 -0
  152. package/lib/utils/proxy-agent.d.ts.map +1 -0
  153. package/lib/utils/proxy-agent.js +6 -0
  154. package/lib/utils/proxy-agent.js.map +1 -0
  155. package/lib/utils/spinner.d.ts +1 -0
  156. package/lib/utils/spinner.d.ts.map +1 -0
  157. package/lib/utils/spinner.js +8 -10
  158. package/lib/utils/spinner.js.map +1 -0
  159. package/lib/utils/telemetry.d.ts +40 -0
  160. package/lib/utils/telemetry.d.ts.map +1 -0
  161. package/lib/utils/telemetry.js +138 -0
  162. package/lib/utils/telemetry.js.map +1 -0
  163. package/lib/utils/update-version-notifier.d.ts +1 -1
  164. package/lib/utils/update-version-notifier.d.ts.map +1 -0
  165. package/lib/utils/update-version-notifier.js +35 -38
  166. package/lib/utils/update-version-notifier.js.map +1 -0
  167. package/lib/utils/validate-positive-number.d.ts +2 -0
  168. package/lib/utils/validate-positive-number.d.ts.map +1 -0
  169. package/lib/utils/validate-positive-number.js +13 -0
  170. package/lib/utils/validate-positive-number.js.map +1 -0
  171. package/lib/wrapper.d.ts +3 -3
  172. package/lib/wrapper.d.ts.map +1 -0
  173. package/lib/wrapper.js +39 -26
  174. package/lib/wrapper.js.map +1 -0
  175. package/package.json +16 -17
  176. package/CHANGELOG.md +0 -777
  177. package/lib/__mocks__/@redocly/openapi-core.d.ts +0 -99
  178. package/lib/__mocks__/@redocly/openapi-core.js +0 -84
  179. package/lib/__mocks__/documents.d.ts +0 -150
  180. package/lib/__mocks__/documents.js +0 -123
  181. package/lib/__mocks__/fs.d.ts +0 -8
  182. package/lib/__mocks__/fs.js +0 -9
  183. package/lib/__mocks__/perf_hooks.d.ts +0 -3
  184. package/lib/__mocks__/perf_hooks.js +0 -6
  185. package/lib/__mocks__/redoc.d.ts +0 -6
  186. package/lib/__mocks__/redoc.js +0 -5
  187. package/lib/__tests__/commands/build-docs.test.d.ts +0 -1
  188. package/lib/__tests__/commands/build-docs.test.js +0 -54
  189. package/lib/__tests__/commands/bundle.test.d.ts +0 -1
  190. package/lib/__tests__/commands/bundle.test.js +0 -235
  191. package/lib/__tests__/commands/join.test.d.ts +0 -1
  192. package/lib/__tests__/commands/join.test.js +0 -274
  193. package/lib/__tests__/commands/lint.test.d.ts +0 -1
  194. package/lib/__tests__/commands/lint.test.js +0 -149
  195. package/lib/__tests__/commands/push-region.test.d.ts +0 -1
  196. package/lib/__tests__/commands/push-region.test.js +0 -90
  197. package/lib/__tests__/commands/push.test.d.ts +0 -1
  198. package/lib/__tests__/commands/push.test.js +0 -496
  199. package/lib/__tests__/fetch-with-timeout.test.d.ts +0 -1
  200. package/lib/__tests__/fetch-with-timeout.test.js +0 -64
  201. package/lib/__tests__/fixtures/config.d.ts +0 -21
  202. package/lib/__tests__/fixtures/config.js +0 -24
  203. package/lib/__tests__/spinner.test.d.ts +0 -1
  204. package/lib/__tests__/spinner.test.js +0 -43
  205. package/lib/__tests__/utils.test.d.ts +0 -1
  206. package/lib/__tests__/utils.test.js +0 -651
  207. package/lib/__tests__/wrapper.test.d.ts +0 -1
  208. package/lib/__tests__/wrapper.test.js +0 -76
  209. package/lib/auth/__tests__/device-flow.test.d.ts +0 -1
  210. package/lib/auth/__tests__/device-flow.test.js +0 -62
  211. package/lib/auth/__tests__/oauth-client.test.d.ts +0 -1
  212. package/lib/auth/__tests__/oauth-client.test.js +0 -93
  213. package/lib/commands/preview-docs/index.d.ts +0 -12
  214. package/lib/commands/preview-docs/index.js +0 -127
  215. package/lib/commands/preview-docs/preview-server/default.hbs +0 -24
  216. package/lib/commands/preview-docs/preview-server/hot.js +0 -59
  217. package/lib/commands/preview-docs/preview-server/oauth2-redirect.html +0 -21
  218. package/lib/commands/preview-docs/preview-server/preview-server.d.ts +0 -5
  219. package/lib/commands/preview-docs/preview-server/preview-server.js +0 -113
  220. package/lib/commands/preview-docs/preview-server/server.d.ts +0 -22
  221. package/lib/commands/preview-docs/preview-server/server.js +0 -85
  222. package/lib/commands/push.d.ts +0 -44
  223. package/lib/commands/push.js +0 -301
  224. package/lib/commands/split/__tests__/index.test.d.ts +0 -1
  225. package/lib/commands/split/__tests__/index.test.js +0 -91
  226. package/lib/reunite/api/__tests__/api-keys.test.d.ts +0 -1
  227. package/lib/reunite/api/__tests__/api-keys.test.js +0 -26
  228. package/lib/reunite/api/__tests__/api.client.test.d.ts +0 -1
  229. package/lib/reunite/api/__tests__/api.client.test.js +0 -337
  230. package/lib/reunite/api/__tests__/domains.test.d.ts +0 -1
  231. package/lib/reunite/api/__tests__/domains.test.js +0 -32
  232. package/lib/reunite/commands/__tests__/push-status.test.d.ts +0 -1
  233. package/lib/reunite/commands/__tests__/push-status.test.js +0 -563
  234. package/lib/reunite/commands/__tests__/push.test.d.ts +0 -1
  235. package/lib/reunite/commands/__tests__/push.test.js +0 -315
  236. package/lib/reunite/commands/__tests__/utils.test.d.ts +0 -1
  237. package/lib/reunite/commands/__tests__/utils.test.js +0 -51
  238. package/lib/utils/__mocks__/miscellaneous.d.ts +0 -43
  239. package/lib/utils/__mocks__/miscellaneous.js +0 -24
  240. package/lib/utils/getCommandNameFromArgs.js +0 -6
  241. package/src/__mocks__/@redocly/openapi-core.ts +0 -88
  242. package/src/__mocks__/documents.ts +0 -124
  243. package/src/__mocks__/fs.ts +0 -6
  244. package/src/__mocks__/perf_hooks.ts +0 -3
  245. package/src/__mocks__/redoc.ts +0 -2
  246. package/src/__tests__/commands/build-docs.test.ts +0 -59
  247. package/src/__tests__/commands/bundle.test.ts +0 -285
  248. package/src/__tests__/commands/join.test.ts +0 -334
  249. package/src/__tests__/commands/lint.test.ts +0 -190
  250. package/src/__tests__/commands/push-region.test.ts +0 -104
  251. package/src/__tests__/commands/push.test.ts +0 -553
  252. package/src/__tests__/fetch-with-timeout.test.ts +0 -81
  253. package/src/__tests__/fixtures/config.ts +0 -21
  254. package/src/__tests__/fixtures/openapi.json +0 -0
  255. package/src/__tests__/fixtures/openapi.yaml +0 -0
  256. package/src/__tests__/fixtures/redocly.yaml +0 -0
  257. package/src/__tests__/spinner.test.ts +0 -51
  258. package/src/__tests__/utils.test.ts +0 -781
  259. package/src/__tests__/wrapper.test.ts +0 -91
  260. package/src/auth/__tests__/device-flow.test.ts +0 -73
  261. package/src/auth/__tests__/oauth-client.test.ts +0 -117
  262. package/src/auth/device-flow.ts +0 -175
  263. package/src/auth/oauth-client.ts +0 -111
  264. package/src/commands/auth.ts +0 -66
  265. package/src/commands/build-docs/index.ts +0 -55
  266. package/src/commands/build-docs/template.hbs +0 -23
  267. package/src/commands/build-docs/types.ts +0 -25
  268. package/src/commands/build-docs/utils.ts +0 -110
  269. package/src/commands/bundle.ts +0 -154
  270. package/src/commands/eject.ts +0 -42
  271. package/src/commands/join.ts +0 -794
  272. package/src/commands/lint.ts +0 -169
  273. package/src/commands/preview-docs/index.ts +0 -183
  274. package/src/commands/preview-docs/preview-server/default.hbs +0 -24
  275. package/src/commands/preview-docs/preview-server/hot.js +0 -59
  276. package/src/commands/preview-docs/preview-server/oauth2-redirect.html +0 -21
  277. package/src/commands/preview-docs/preview-server/preview-server.ts +0 -159
  278. package/src/commands/preview-docs/preview-server/server.ts +0 -92
  279. package/src/commands/preview-project/constants.ts +0 -23
  280. package/src/commands/preview-project/index.ts +0 -71
  281. package/src/commands/preview-project/types.ts +0 -12
  282. package/src/commands/push.ts +0 -470
  283. package/src/commands/split/__tests__/fixtures/samples.json +0 -61
  284. package/src/commands/split/__tests__/fixtures/spec.json +0 -70
  285. package/src/commands/split/__tests__/fixtures/webhooks.json +0 -85
  286. package/src/commands/split/__tests__/index.test.ts +0 -156
  287. package/src/commands/split/index.ts +0 -397
  288. package/src/commands/split/types.ts +0 -60
  289. package/src/commands/stats.ts +0 -140
  290. package/src/commands/translations.ts +0 -32
  291. package/src/custom.d.ts +0 -1
  292. package/src/index.ts +0 -970
  293. package/src/otel.ts +0 -59
  294. package/src/reunite/api/__tests__/api-keys.test.ts +0 -37
  295. package/src/reunite/api/__tests__/api.client.test.ts +0 -452
  296. package/src/reunite/api/__tests__/domains.test.ts +0 -41
  297. package/src/reunite/api/api-client.ts +0 -381
  298. package/src/reunite/api/api-keys.ts +0 -26
  299. package/src/reunite/api/domains.ts +0 -23
  300. package/src/reunite/api/index.ts +0 -3
  301. package/src/reunite/api/types.ts +0 -108
  302. package/src/reunite/commands/__tests__/push-status.test.ts +0 -653
  303. package/src/reunite/commands/__tests__/push.test.ts +0 -385
  304. package/src/reunite/commands/__tests__/utils.test.ts +0 -62
  305. package/src/reunite/commands/push-status.ts +0 -325
  306. package/src/reunite/commands/push.ts +0 -235
  307. package/src/reunite/commands/utils.ts +0 -66
  308. package/src/reunite/utils.ts +0 -1
  309. package/src/types.ts +0 -64
  310. package/src/utils/__mocks__/miscellaneous.ts +0 -24
  311. package/src/utils/assert-node-version.ts +0 -19
  312. package/src/utils/fetch-with-timeout.ts +0 -30
  313. package/src/utils/getCommandNameFromArgs.ts +0 -5
  314. package/src/utils/js-utils.ts +0 -24
  315. package/src/utils/miscellaneous.ts +0 -729
  316. package/src/utils/platform.ts +0 -31
  317. package/src/utils/spinner.ts +0 -50
  318. package/src/utils/update-version-notifier.ts +0 -115
  319. package/src/wrapper.ts +0 -77
  320. package/tsconfig.json +0 -9
  321. package/tsconfig.tsbuildinfo +0 -1
@@ -1,99 +0,0 @@
1
- import type { Document } from '@redocly/openapi-core';
2
- export declare const __redoclyClient: {
3
- isAuthorizedWithRedocly: jest.Mock<any, any>;
4
- isAuthorizedWithRedoclyByRegion: jest.Mock<any, any>;
5
- login: jest.Mock<any, any>;
6
- registryApi: {
7
- setAccessTokens: jest.Mock<any, any>;
8
- authStatus: jest.Mock<any, any>;
9
- prepareFileUpload: jest.Mock<any, any>;
10
- pushApi: jest.Mock<any, any>;
11
- };
12
- };
13
- export declare const RedoclyClient: jest.Mock<{
14
- isAuthorizedWithRedocly: jest.Mock<any, any>;
15
- isAuthorizedWithRedoclyByRegion: jest.Mock<any, any>;
16
- login: jest.Mock<any, any>;
17
- registryApi: {
18
- setAccessTokens: jest.Mock<any, any>;
19
- authStatus: jest.Mock<any, any>;
20
- prepareFileUpload: jest.Mock<any, any>;
21
- pushApi: jest.Mock<any, any>;
22
- };
23
- }, []>;
24
- export declare const loadConfig: jest.Mock<{
25
- configFile: null;
26
- styleguide: {
27
- addIgnore: jest.Mock<any, any>;
28
- skipRules: jest.Mock<any, any>;
29
- skipPreprocessors: jest.Mock<any, any>;
30
- saveIgnore: jest.Mock<any, any>;
31
- skipDecorators: jest.Mock<any, any>;
32
- ignore: null;
33
- decorators: {
34
- oas2: {};
35
- oas3_0: {};
36
- oas3_1: {};
37
- };
38
- preprocessors: {
39
- oas2: {};
40
- oas3_0: {};
41
- oas3_1: {};
42
- };
43
- };
44
- }, []>;
45
- export declare const getMergedConfig: jest.Mock<any, any>;
46
- export declare const getProxyAgent: jest.Mock<any, any>;
47
- export declare const lint: jest.Mock<any, any>;
48
- export declare const bundle: jest.Mock<{
49
- bundle: {
50
- parsed: null;
51
- };
52
- problems: null;
53
- }, []>;
54
- export declare const getTotals: jest.Mock<{
55
- errors: number;
56
- }, []>;
57
- export declare const formatProblems: jest.Mock<any, any>;
58
- export declare const slash: jest.Mock<any, any>;
59
- export declare const findConfig: jest.Mock<any, any>;
60
- export declare const doesYamlFileExist: jest.Mock<any, any>;
61
- export declare const bundleDocument: jest.Mock<Promise<{
62
- problems: {};
63
- }>, []>;
64
- export declare const detectSpec: jest.Mock<any, any>;
65
- export declare const isAbsoluteUrl: jest.Mock<any, any>;
66
- export declare const stringifyYaml: jest.Mock<any, [data: any]>;
67
- export declare class BaseResolver {
68
- cache: Map<string, Promise<Document | ResolveError>>;
69
- getFiles: jest.Mock<any, any>;
70
- resolveExternalRef: jest.Mock<any, any>;
71
- loadExternalRef: typeof jest.fn;
72
- parseDocument: jest.Mock<any, any>;
73
- resolveDocument: jest.Mock<any, any>;
74
- }
75
- export declare class ResolveError extends Error {
76
- originalError: Error;
77
- constructor(originalError: Error);
78
- }
79
- export declare class YamlParseError extends Error {
80
- originalError: Error;
81
- constructor(originalError: Error);
82
- }
83
- export declare enum SpecVersion {
84
- OAS2 = "oas2",
85
- OAS3_0 = "oas3_0",
86
- OAS3_1 = "oas3_1",
87
- Async2 = "async2",
88
- Async3 = "async3"
89
- }
90
- export declare enum Oas3Operations {
91
- get = "get",
92
- put = "put",
93
- post = "post",
94
- delete = "delete",
95
- options = "options",
96
- head = "head",
97
- patch = "patch",
98
- trace = "trace"
99
- }
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Oas3Operations = exports.SpecVersion = exports.YamlParseError = exports.ResolveError = exports.BaseResolver = exports.stringifyYaml = exports.isAbsoluteUrl = exports.detectSpec = exports.bundleDocument = exports.doesYamlFileExist = exports.findConfig = exports.slash = exports.formatProblems = exports.getTotals = exports.bundle = exports.lint = exports.getProxyAgent = exports.getMergedConfig = exports.loadConfig = exports.RedoclyClient = exports.__redoclyClient = void 0;
4
- const config_1 = require("./../../__tests__/fixtures/config");
5
- const documents_1 = require("../documents");
6
- exports.__redoclyClient = {
7
- isAuthorizedWithRedocly: jest.fn().mockResolvedValue(true),
8
- isAuthorizedWithRedoclyByRegion: jest.fn().mockResolvedValue(true),
9
- login: jest.fn(),
10
- registryApi: {
11
- setAccessTokens: jest.fn(),
12
- authStatus: jest.fn(),
13
- prepareFileUpload: jest.fn().mockResolvedValue({
14
- signedUploadUrl: 'signedUploadUrl',
15
- filePath: 'filePath',
16
- }),
17
- pushApi: jest.fn(),
18
- },
19
- };
20
- exports.RedoclyClient = jest.fn(() => exports.__redoclyClient);
21
- exports.loadConfig = jest.fn(() => config_1.ConfigFixture);
22
- exports.getMergedConfig = jest.fn();
23
- exports.getProxyAgent = jest.fn();
24
- exports.lint = jest.fn();
25
- exports.bundle = jest.fn(() => ({ bundle: { parsed: null }, problems: null }));
26
- exports.getTotals = jest.fn(() => ({ errors: 0 }));
27
- exports.formatProblems = jest.fn();
28
- exports.slash = jest.fn();
29
- exports.findConfig = jest.fn();
30
- exports.doesYamlFileExist = jest.fn();
31
- exports.bundleDocument = jest.fn(() => Promise.resolve({ problems: {} }));
32
- exports.detectSpec = jest.fn();
33
- exports.isAbsoluteUrl = jest.fn();
34
- exports.stringifyYaml = jest.fn((data) => data);
35
- class BaseResolver {
36
- constructor() {
37
- this.cache = new Map();
38
- this.getFiles = jest.fn();
39
- this.resolveExternalRef = jest.fn();
40
- this.loadExternalRef = jest.fn;
41
- this.parseDocument = jest.fn();
42
- this.resolveDocument = jest
43
- .fn()
44
- .mockImplementationOnce(() => Promise.resolve({ source: { absoluteRef: 'ref' }, parsed: documents_1.firstDocument }))
45
- .mockImplementationOnce(() => Promise.resolve({ source: { absoluteRef: 'ref' }, parsed: documents_1.secondDocument }))
46
- .mockImplementationOnce(() => Promise.resolve({ source: { absoluteRef: 'ref' }, parsed: documents_1.thirdDocument }));
47
- }
48
- }
49
- exports.BaseResolver = BaseResolver;
50
- class ResolveError extends Error {
51
- constructor(originalError) {
52
- super(originalError.message);
53
- this.originalError = originalError;
54
- Object.setPrototypeOf(this, ResolveError.prototype);
55
- }
56
- }
57
- exports.ResolveError = ResolveError;
58
- class YamlParseError extends Error {
59
- constructor(originalError) {
60
- super(originalError.message);
61
- this.originalError = originalError;
62
- Object.setPrototypeOf(this, YamlParseError.prototype);
63
- }
64
- }
65
- exports.YamlParseError = YamlParseError;
66
- var SpecVersion;
67
- (function (SpecVersion) {
68
- SpecVersion["OAS2"] = "oas2";
69
- SpecVersion["OAS3_0"] = "oas3_0";
70
- SpecVersion["OAS3_1"] = "oas3_1";
71
- SpecVersion["Async2"] = "async2";
72
- SpecVersion["Async3"] = "async3";
73
- })(SpecVersion || (exports.SpecVersion = SpecVersion = {}));
74
- var Oas3Operations;
75
- (function (Oas3Operations) {
76
- Oas3Operations["get"] = "get";
77
- Oas3Operations["put"] = "put";
78
- Oas3Operations["post"] = "post";
79
- Oas3Operations["delete"] = "delete";
80
- Oas3Operations["options"] = "options";
81
- Oas3Operations["head"] = "head";
82
- Oas3Operations["patch"] = "patch";
83
- Oas3Operations["trace"] = "trace";
84
- })(Oas3Operations || (exports.Oas3Operations = Oas3Operations = {}));
@@ -1,150 +0,0 @@
1
- export declare const firstDocument: {
2
- openapi: string;
3
- servers: {
4
- url: string;
5
- }[];
6
- info: {
7
- description: string;
8
- version: string;
9
- title: string;
10
- termsOfService: string;
11
- license: {
12
- name: string;
13
- url: string;
14
- };
15
- };
16
- paths: {
17
- '/GETUser/{userId}': {
18
- summary: string;
19
- description: string;
20
- servers: ({
21
- url: string;
22
- description?: undefined;
23
- } | {
24
- url: string;
25
- description: string;
26
- })[];
27
- get: {
28
- tags: string[];
29
- summary: string;
30
- description: string;
31
- operationId: string;
32
- servers: {
33
- url: string;
34
- }[];
35
- };
36
- parameters: {
37
- name: string;
38
- in: string;
39
- schema: {
40
- description: string;
41
- };
42
- }[];
43
- };
44
- };
45
- components: {};
46
- };
47
- export declare const secondDocument: {
48
- openapi: string;
49
- servers: {
50
- url: string;
51
- }[];
52
- info: {
53
- description: string;
54
- version: string;
55
- title: string;
56
- termsOfService: string;
57
- license: {
58
- name: string;
59
- url: string;
60
- };
61
- };
62
- post: {
63
- '/GETUser/{userId}': {
64
- summary: string;
65
- description: string;
66
- servers: ({
67
- url: string;
68
- description?: undefined;
69
- } | {
70
- url: string;
71
- description: string;
72
- })[];
73
- get: {
74
- tags: string[];
75
- summary: string;
76
- description: string;
77
- operationId: string;
78
- servers: {
79
- url: string;
80
- }[];
81
- };
82
- parameters: {
83
- name: string;
84
- in: string;
85
- schema: {
86
- description: string;
87
- };
88
- }[];
89
- };
90
- };
91
- components: {};
92
- };
93
- export declare const thirdDocument: {
94
- openapi: string;
95
- info: {
96
- title: string;
97
- version: string;
98
- };
99
- servers: {
100
- url: string;
101
- }[];
102
- paths: {};
103
- components: {
104
- schemas: {
105
- SchemaWithNull: {
106
- type: string;
107
- default: null;
108
- nullable: boolean;
109
- };
110
- SchemaWithRef: {
111
- type: string;
112
- properties: {
113
- schemaType: {
114
- type: string;
115
- enum: string[];
116
- };
117
- foo: {
118
- $ref: string;
119
- };
120
- };
121
- };
122
- SchemaWithDiscriminator: {
123
- discriminator: {
124
- propertyName: string;
125
- mapping: {
126
- foo: string;
127
- bar: string;
128
- };
129
- };
130
- oneOf: ({
131
- $ref: string;
132
- type?: undefined;
133
- properties?: undefined;
134
- } | {
135
- type: string;
136
- properties: {
137
- schemaType: {
138
- type: string;
139
- enum: string[];
140
- };
141
- bar: {
142
- type: string;
143
- };
144
- };
145
- $ref?: undefined;
146
- })[];
147
- };
148
- };
149
- };
150
- };
@@ -1,123 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.thirdDocument = exports.secondDocument = exports.firstDocument = void 0;
4
- exports.firstDocument = {
5
- openapi: '3.0.0',
6
- servers: [{ url: 'http://localhost:8080' }],
7
- info: {
8
- description: 'example test',
9
- version: '1.0.0',
10
- title: 'First API',
11
- termsOfService: 'http://swagger.io/terms/',
12
- license: {
13
- name: 'Apache 2.0',
14
- url: 'http://www.apache.org/licenses/LICENSE-2.0.html',
15
- },
16
- },
17
- paths: {
18
- '/GETUser/{userId}': {
19
- summary: 'get user by id',
20
- description: 'user info',
21
- servers: [{ url: '/user' }, { url: '/pet', description: 'pet server' }],
22
- get: {
23
- tags: ['pet'],
24
- summary: 'Find pet by ID',
25
- description: 'Returns a single pet',
26
- operationId: 'getPetById',
27
- servers: [{ url: '/pet' }],
28
- },
29
- parameters: [{ name: 'param1', in: 'header', schema: { description: 'string' } }],
30
- },
31
- },
32
- components: {},
33
- };
34
- exports.secondDocument = {
35
- openapi: '3.0.0',
36
- servers: [{ url: 'http://localhost:8080' }],
37
- info: {
38
- description: 'example test',
39
- version: '1.0.0',
40
- title: 'Second API',
41
- termsOfService: 'http://swagger.io/terms/',
42
- license: {
43
- name: 'Apache 2.0',
44
- url: 'http://www.apache.org/licenses/LICENSE-2.0.html',
45
- },
46
- },
47
- post: {
48
- '/GETUser/{userId}': {
49
- summary: 'get user',
50
- description: 'user information',
51
- servers: [{ url: '/user' }, { url: '/pet', description: '' }],
52
- get: {
53
- tags: ['pet'],
54
- summary: 'Find pet by ID',
55
- description: 'Returns a single pet',
56
- operationId: 'getPetById',
57
- servers: [{ url: '/pet' }],
58
- },
59
- parameters: [{ name: 'param1', in: 'header', schema: { description: 'string' } }],
60
- },
61
- },
62
- components: {},
63
- };
64
- exports.thirdDocument = {
65
- openapi: '3.0.0',
66
- info: {
67
- title: 'Third API',
68
- version: '1.0',
69
- },
70
- servers: [
71
- {
72
- url: 'https://api.server.test/v1',
73
- },
74
- ],
75
- paths: {},
76
- components: {
77
- schemas: {
78
- SchemaWithNull: {
79
- type: 'string',
80
- default: null,
81
- nullable: true,
82
- },
83
- SchemaWithRef: {
84
- type: 'object',
85
- properties: {
86
- schemaType: {
87
- type: 'string',
88
- enum: ['foo'],
89
- },
90
- foo: {
91
- $ref: '#/components/schemas/SchemaWithNull',
92
- },
93
- },
94
- },
95
- SchemaWithDiscriminator: {
96
- discriminator: {
97
- propertyName: 'schemaType',
98
- mapping: {
99
- foo: '#/components/schemas/SchemaWithRef',
100
- bar: '#/components/schemas/SchemaWithNull',
101
- },
102
- },
103
- oneOf: [
104
- {
105
- $ref: '#/components/schemas/SchemaWithRef',
106
- },
107
- {
108
- type: 'object',
109
- properties: {
110
- schemaType: {
111
- type: 'string',
112
- enum: ['bar'],
113
- },
114
- bar: {
115
- type: 'string',
116
- },
117
- },
118
- },
119
- ],
120
- },
121
- },
122
- },
123
- };
@@ -1,8 +0,0 @@
1
- export declare const existsSync: jest.Mock<any, any>;
2
- export declare const readFileSync: jest.Mock<string, []>;
3
- export declare const statSync: jest.Mock<{
4
- size: number;
5
- }, []>;
6
- export declare const createReadStream: jest.Mock<any, any>;
7
- export declare const writeFileSync: jest.Mock<any, any>;
8
- export declare const mkdirSync: jest.Mock<any, any>;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mkdirSync = exports.writeFileSync = exports.createReadStream = exports.statSync = exports.readFileSync = exports.existsSync = void 0;
4
- exports.existsSync = jest.fn();
5
- exports.readFileSync = jest.fn(() => '');
6
- exports.statSync = jest.fn(() => ({ size: 0 }));
7
- exports.createReadStream = jest.fn();
8
- exports.writeFileSync = jest.fn();
9
- exports.mkdirSync = jest.fn();
@@ -1,3 +0,0 @@
1
- export declare const performance: {
2
- now: jest.Mock<any, any>;
3
- };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.performance = void 0;
4
- exports.performance = {
5
- now: jest.fn(),
6
- };
@@ -1,6 +0,0 @@
1
- export declare const loadAndBundleSpec: jest.Mock<Promise<{
2
- openapi: string;
3
- }>, []>;
4
- export declare const createStore: jest.Mock<Promise<{
5
- toJS: jest.Mock<string, []>;
6
- }>, []>;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createStore = exports.loadAndBundleSpec = void 0;
4
- exports.loadAndBundleSpec = jest.fn(() => Promise.resolve({ openapi: '3.0.0' }));
5
- exports.createStore = jest.fn(() => Promise.resolve({ toJS: jest.fn(() => '{}') }));
@@ -1 +0,0 @@
1
- export {};
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const redoc_1 = require("redoc");
4
- const server_1 = require("react-dom/server");
5
- const build_docs_1 = require("../../commands/build-docs");
6
- const utils_1 = require("../../commands/build-docs/utils");
7
- const miscellaneous_1 = require("../../utils/miscellaneous");
8
- jest.mock('redoc');
9
- jest.mock('fs');
10
- jest.mock('../../utils/miscellaneous');
11
- const config = {
12
- output: '',
13
- title: 'Test',
14
- disableGoogleFont: false,
15
- templateFileName: '',
16
- templateOptions: {},
17
- redocOptions: {},
18
- };
19
- jest.mock('react-dom/server', () => ({
20
- renderToString: jest.fn(),
21
- }));
22
- jest.mock('handlebars', () => ({
23
- compile: jest.fn(() => jest.fn(() => '<html></html>')),
24
- }));
25
- describe('build-docs', () => {
26
- it('should return correct html and call function for ssr', async () => {
27
- const result = await (0, utils_1.getPageHTML)({}, '../some-path/openapi.yaml', {
28
- ...config,
29
- redocCurrentVersion: '2.0.0',
30
- });
31
- expect(server_1.renderToString).toBeCalledTimes(1);
32
- expect(redoc_1.createStore).toBeCalledTimes(1);
33
- expect(result).toBe('<html></html>');
34
- });
35
- it('should work correctly when calling handlerBuildCommand', async () => {
36
- const processExitMock = jest.spyOn(process, 'exit').mockImplementation();
37
- await (0, build_docs_1.handlerBuildCommand)({
38
- argv: {
39
- o: '',
40
- title: 'test',
41
- disableGoogleFont: false,
42
- template: '',
43
- templateOptions: {},
44
- theme: { openapi: {} },
45
- api: '../some-path/openapi.yaml',
46
- },
47
- config: {},
48
- version: 'cli-version',
49
- });
50
- expect(redoc_1.loadAndBundleSpec).toBeCalledTimes(1);
51
- expect(miscellaneous_1.getFallbackApisOrExit).toBeCalledTimes(1);
52
- expect(processExitMock).toBeCalledTimes(0);
53
- });
54
- });
@@ -1 +0,0 @@
1
- export {};